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 <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="path_to_url"> <item android:state_pressed="true"> <shape> <solid android:color="@color/app_red" /> <corners android:topLeftRadius="@dimen/dp_4"/> </shape> </item> <item> <shape> <solid android:color="@color/app_red" /> <corners android:topLeftRadius="@dimen/dp_4"/> </shape> </item> </selector> ```
/content/code_sandbox/app/src/main/res/drawable/bg_banner_tag.xml
xml
2016-04-09T15:47:45
2024-08-14T04:30:04
MusicLake
caiyonglong/MusicLake
2,654
128
```xml <Project xmlns="path_to_url"> <!-- helper import to get $(PeachpieVersion) property --> <Import Project="$(MSBuildThisFileDirectory)..\build\Peachpie.Version.props" /> </Project> ```
/content/code_sandbox/src/Peachpie.NET.Sdk/Sdk/Version.props
xml
2016-02-05T16:22:55
2024-08-16T17:42:35
peachpie
peachpiecompiler/peachpie
2,317
45
```xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="path_to_url" xmlns:app="path_to_url" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:orientation="vertical"> <com.kofigyan.stateprogressbar.StateProgressBar android:id="@+id/state_progress_bar" android:layout_width="wrap_content" android:layout_height="wrap_content" app:spb_currentStateNumber="three" app:spb_maxStateNumber="four" /> </LinearLayout> ```
/content/code_sandbox/sample/src/main/res/layout/activity_basic_four_states.xml
xml
2016-08-16T12:50:30
2024-08-13T08:27:46
StateProgressBar
kofigyan/StateProgressBar
1,537
130
```xml import Fs from "fs"; import Path from "path"; import _ from "lodash"; /** * Add a list of packages to a package.json's depedencies * * @param pkgJson - package.json data * @param packages - list of packages to add * @param dep - which dependencies section to add * * @returns packages actually added */ export const addDepToPkgJson = (pkgJson: any, packages: Record<string, string>, dep: string) => { const section = (pkgJson[dep] = pkgJson[dep] || {}); const added = {}; Object.keys(packages).forEach(name => { if (!section.hasOwnProperty(name)) { section[name] = packages[name]; added[name] = packages[name]; } }); if (!_.isEmpty(added)) { pkgJson[dep] = Object.keys(section) .sort() .reduce((sorted, key) => { sorted[key] = section[key]; return sorted; }, {}); } return added; }; /** * Load a package.json from dir * * @param dir - directory * @returns package.json object */ export const loadPkgJson = (dir: string) => { return JSON.parse(Fs.readFileSync(Path.resolve(dir, "package.json"), "utf-8")); }; /** * Save a package.json to dir * * @param dir - directory * @param pkgJson * @params pkgJson - package.json object * @returns none */ export const savePkgJson = (dir: string, pkgJson: any) => { return Fs.writeFileSync( Path.resolve(dir, "package.json"), `${JSON.stringify(pkgJson, null, 2)}\n` ); }; /* eslint-disable @typescript-eslint/no-var-requires */ const xarcAppPkgJson = require("@xarc/app/package.json"); import { logger } from "../logger"; /** * Update app's dependencies * * @param xarcCwd - CWD for app * @returns {void} nothing */ export const updateAppDep = (xarcCwd: string) => { const appPkg = loadPkgJson(xarcCwd); const added = addDepToPkgJson( appPkg, _.pick(xarcAppPkgJson.dependencies, ["@babel/runtime"]), "dependencies" ); if (!_.isEmpty(added)) { savePkgJson(xarcCwd, appPkg); logger.info( `*** Added these packages to your dependencies, please run install again: ${Object.keys(added)} ***` ); } }; ```
/content/code_sandbox/packages/xarc-app-dev/src/lib/tasks/package-json.ts
xml
2016-09-06T19:02:39
2024-08-11T11:43:11
electrode
electrode-io/electrode
2,103
562
```xml export { MD3LightTheme } from './v3/LightTheme'; export { MD3DarkTheme } from './v3/DarkTheme'; export { MD2LightTheme } from './v2/LightTheme'; export { MD2DarkTheme } from './v2/DarkTheme'; ```
/content/code_sandbox/src/styles/themes/index.ts
xml
2016-10-19T05:56:53
2024-08-16T08:48:04
react-native-paper
callstack/react-native-paper
12,646
61
```xml import { render } from '@testing-library/react'; import userEvents from '@testing-library/user-event'; import { EditorState, Modifier } from 'draft-js'; import React from 'react'; import { UndoPuginStore } from '../..'; import Redo from '../index'; describe('RedoButton', () => { function getStore(state = EditorState.createEmpty()): UndoPuginStore { return { getEditorState: () => state, setEditorState: jest.fn(), } as unknown as UndoPuginStore; } it('applies the className based on the theme property `redo`', () => { const theme = { redo: 'custom-class-name' }; const store = getStore(); const { getByRole } = render( <Redo store={store} theme={theme}> redo </Redo> ); expect(getByRole('button')).toHaveClass('custom-class-name'); }); it('renders the passed in children', () => { const store = getStore(); const { getByRole } = render( <Redo store={store} theme={{}}> redo </Redo> ); expect(getByRole('button')).toHaveTextContent('redo'); }); it('applies a custom className as well as the theme', () => { const theme = { redo: 'custom-class-name' }; const store = getStore(); const { getByRole } = render( <Redo store={store} theme={theme} className="redo"> redo </Redo> ); expect(getByRole('button')).toHaveClass('custom-class-name redo'); }); it('adds disabled attribute to button if the getRedoStack is empty', () => { const store = getStore(); const { getByRole } = render( <Redo store={store} theme={{}}> redo </Redo> ); expect(getByRole('button')).toHaveProperty('disabled', true); }); it('removes disabled attribute from button if the getRedoStack is not empty and click button', async () => { const editorState = EditorState.createEmpty(); const contentState = editorState.getCurrentContent(); const SelectionState = editorState.getSelection(); const newContent = Modifier.insertText( contentState, SelectionState, 'hello' ); const newEditorState = EditorState.push( editorState, newContent, 'insert-characters' ); const undoEditorState = EditorState.undo(newEditorState); const store = getStore(undoEditorState); const { getByRole } = render( <Redo store={store} theme={{}}> redo </Redo> ); expect(getByRole('button')).toHaveProperty('disabled', false); await userEvents.click(getByRole('button')); expect(store.setEditorState).toHaveBeenCalledTimes(1); }); }); ```
/content/code_sandbox/packages/undo/src/RedoButton/__test__/index.test.tsx
xml
2016-02-26T09:54:56
2024-08-16T18:16:31
draft-js-plugins
draft-js-plugins/draft-js-plugins
4,087
628
```xml // See LICENSE in the project root for license information. // eslint-disable-next-line no-console const path: string = requireFolder({ sources: [ { globsBase: './assets', globPatterns: ['**/*.*'] } ], outputFolder: 'assets_[hash]' }); // eslint-disable-next-line no-console console.log(path); // eslint-disable-next-line no-console console.log(typeof requireFolder); ```
/content/code_sandbox/webpack/hashed-folder-copy-plugin/src/test/scenarios/localFolder/entry.ts
xml
2016-09-30T00:28:20
2024-08-16T18:54:35
rushstack
microsoft/rushstack
5,790
91
```xml <?xml version="1.0" encoding="UTF-8" standalone="no"?> <vector xmlns:android="path_to_url" android:height="24dp" android:viewportHeight="24.0" android:viewportWidth="24.0" android:width="24dp"> <path android:fillColor="#FFFFFF" android:pathData="M19,7h-8v6h8L19,7zM21,3L3,3c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,1.98 2,1.98h18c1.1,0 2,-0.88 2,-1.98L23,5c0,-1.1 -0.9,-2 -2,-2zM21,19.01L3,19.01L3,4.98h18v14.03z"/> </vector> ```
/content/code_sandbox/app/src/main/res/drawable/ic_picture_in_picture.xml
xml
2016-04-09T15:47:45
2024-08-14T04:30:04
MusicLake
caiyonglong/MusicLake
2,654
205
```xml import { InferAttributes, InferCreationAttributes } from "sequelize"; import { Column, Table, BelongsTo, ForeignKey, NotEmpty, DataType, IsIn, } from "sequelize-typescript"; import { type WebhookDeliveryStatus } from "@server/types"; import WebhookSubscription from "./WebhookSubscription"; import IdModel from "./base/IdModel"; import Fix from "./decorators/Fix"; @Table({ tableName: "webhook_deliveries", modelName: "webhook_delivery", }) @Fix class WebhookDelivery extends IdModel< InferAttributes<WebhookDelivery>, Partial<InferCreationAttributes<WebhookDelivery>> > { @NotEmpty @IsIn([["pending", "success", "failed"]]) @Column(DataType.STRING) status: WebhookDeliveryStatus; @Column(DataType.INTEGER) statusCode?: number | null; @Column(DataType.JSONB) requestBody: unknown; @Column(DataType.JSONB) requestHeaders: Record<string, string>; @Column(DataType.TEXT) responseBody: string; @Column(DataType.JSONB) responseHeaders: Record<string, string>; @Column(DataType.DATE) createdAt: Date; // associations @BelongsTo(() => WebhookSubscription, "webhookSubscriptionId") webhookSubscription: WebhookSubscription; @ForeignKey(() => WebhookSubscription) @Column webhookSubscriptionId: string; } export default WebhookDelivery; ```
/content/code_sandbox/server/models/WebhookDelivery.ts
xml
2016-05-22T21:31:47
2024-08-16T19:57:22
outline
outline/outline
26,751
309
```xml <test> <query>SELECT CounterID, EventDate FROM hits_100m_single ORDER BY CounterID, exp(CounterID), sqrt(CounterID) FORMAT Null</query> <query>SELECT CounterID, EventDate FROM hits_100m_single ORDER BY CounterID, EventDate, exp(CounterID), toDateTime(EventDate) FORMAT Null</query> <query>SELECT CounterID, EventDate FROM hits_100m_single ORDER BY CounterID DESC, EventDate DESC, exp(CounterID), toDateTime(EventDate) FORMAT Null</query> </test> ```
/content/code_sandbox/tests/performance/redundant_functions_in_order_by.xml
xml
2016-06-02T08:28:18
2024-08-16T18:39:33
ClickHouse
ClickHouse/ClickHouse
36,234
123
```xml import { assert } from 'chai'; import { JavaScriptObfuscator } from '../../../../../../src/JavaScriptObfuscatorFacade'; import { NO_ADDITIONAL_NODES_PRESET } from '../../../../../../src/options/presets/NoCustomNodes'; import { IdentifierNamesGenerator } from '../../../../../../src/enums/generators/identifier-names-generators/IdentifierNamesGenerator'; import { readFileAsString } from '../../../../../helpers/readFileAsString'; describe('ForceTransformStringObfuscatingGuard', () => { describe('check', () => { describe('`forceTransformStrings` option is enabled', () => { const obfuscatingGuardRegExp: RegExp = new RegExp( 'var foo *= *\'foo\';.*' + 'var bar *= *b\\(0x0\\);' ); let obfuscatedCode: string; beforeEach(() => { const code: string = readFileAsString(__dirname + '/fixtures/base-behaviour.js'); obfuscatedCode = JavaScriptObfuscator.obfuscate( code, { ...NO_ADDITIONAL_NODES_PRESET, forceTransformStrings: ['bar'], identifierNamesGenerator: IdentifierNamesGenerator.MangledIdentifierNamesGenerator, stringArray: true, stringArrayThreshold: 0 } ).getObfuscatedCode(); }); it('match #1: should obfuscate force transform strings', () => { assert.match(obfuscatedCode, obfuscatingGuardRegExp); }); }); describe('`forceTransformStrings` option is disabled', () => { const obfuscatingGuardRegExp: RegExp = new RegExp( 'var foo *= *\'foo\';' + 'var bar *= *\'bar\';' ); let obfuscatedCode: string; beforeEach(() => { const code: string = readFileAsString(__dirname + '/fixtures/base-behaviour.js'); obfuscatedCode = JavaScriptObfuscator.obfuscate( code, { ...NO_ADDITIONAL_NODES_PRESET, forceTransformStrings: [], identifierNamesGenerator: IdentifierNamesGenerator.MangledIdentifierNamesGenerator, stringArray: true, stringArrayThreshold: 0 } ).getObfuscatedCode(); }); it('match #1: shouldn\'t obfuscate strings', () => { assert.match(obfuscatedCode, obfuscatingGuardRegExp); }); }); }); }); ```
/content/code_sandbox/test/functional-tests/node-transformers/preparing-transformers/obfuscating-guards/force-transform-string-obfuscating-guard/ForceTransformStringObfuscatingGuard.spec.ts
xml
2016-05-09T08:16:53
2024-08-16T19:43:07
javascript-obfuscator
javascript-obfuscator/javascript-obfuscator
13,358
502
```xml import { Point } from 'slate' export const input = { point: { path: [0, 4], offset: 3, }, another: { path: [0, 1], offset: 3, }, } export const test = ({ point, another }) => { return Point.isAfter(point, another) } export const output = true ```
/content/code_sandbox/packages/slate/test/interfaces/Point/isAfter/path-after-offset-equal.tsx
xml
2016-06-18T01:52:42
2024-08-16T18:43:42
slate
ianstormtaylor/slate
29,492
85
```xml import { observer } from "mobx-react"; import { MoreIcon, QuestionMarkIcon, UserIcon } from "outline-icons"; import * as React from "react"; import { useTranslation } from "react-i18next"; import styled, { useTheme } from "styled-components"; import Squircle from "@shared/components/Squircle"; import { Pagination } from "@shared/constants"; import { CollectionPermission, IconType } from "@shared/types"; import { determineIconType } from "@shared/utils/icon"; import type Collection from "~/models/Collection"; import type Document from "~/models/Document"; import Share from "~/models/Share"; import Flex from "~/components/Flex"; import LoadingIndicator from "~/components/LoadingIndicator"; import Scrollable from "~/components/Scrollable"; import Text from "~/components/Text"; import useCurrentTeam from "~/hooks/useCurrentTeam"; import useCurrentUser from "~/hooks/useCurrentUser"; import useMaxHeight from "~/hooks/useMaxHeight"; import usePolicy from "~/hooks/usePolicy"; import useRequest from "~/hooks/useRequest"; import useStores from "~/hooks/useStores"; import Avatar from "../../Avatar"; import { AvatarSize } from "../../Avatar/Avatar"; import CollectionIcon from "../../Icons/CollectionIcon"; import Tooltip from "../../Tooltip"; import { Separator } from "../components"; import { ListItem } from "../components/ListItem"; import DocumentMemberList from "./DocumentMemberList"; import PublicAccess from "./PublicAccess"; type Props = { /** The document being shared. */ document: Document; /** List of users that have been invited during the current editing session */ invitedInSession: string[]; /** The existing share model, if any. */ share: Share | null | undefined; /** The existing share parent model, if any. */ sharedParent: Share | null | undefined; /** Callback fired when the popover requests to be closed. */ onRequestClose: () => void; /** Whether the popover is visible. */ visible: boolean; }; export const AccessControlList = observer( ({ document, invitedInSession, share, sharedParent, onRequestClose, visible, }: Props) => { const { t } = useTranslation(); const theme = useTheme(); const collection = document.collection; const usersInCollection = useUsersInCollection(collection); const user = useCurrentUser(); const { userMemberships } = useStores(); const collectionSharingDisabled = document.collection?.sharing === false; const team = useCurrentTeam(); const can = usePolicy(document); const containerRef = React.useRef<HTMLDivElement | null>(null); const { maxHeight, calcMaxHeight } = useMaxHeight({ elementRef: containerRef, maxViewportPercentage: 70, margin: 24, }); const { loading: loadingDocumentMembers, request: fetchDocumentMembers } = useRequest( React.useCallback( () => userMemberships.fetchDocumentMemberships({ id: document.id, limit: Pagination.defaultLimit, }), [userMemberships, document.id] ) ); React.useEffect(() => { void fetchDocumentMembers(); }, [fetchDocumentMembers]); React.useEffect(() => { calcMaxHeight(); }); return ( <ScrollableContainer ref={containerRef} hiddenScrollbars style={{ maxHeight }} > {loadingDocumentMembers && <LoadingIndicator />} {collection ? ( <> {collection.permission ? ( <ListItem image={ <Squircle color={theme.accent} size={AvatarSize.Medium}> <UserIcon color={theme.accentText} size={16} /> </Squircle> } title={t("All members")} subtitle={t("Everyone in the workspace")} actions={ <AccessTooltip> {collection?.permission === CollectionPermission.ReadWrite ? t("Can edit") : t("Can view")} </AccessTooltip> } /> ) : usersInCollection ? ( <ListItem image={<CollectionSquircle collection={collection} />} title={collection.name} subtitle={t("Everyone in the collection")} actions={<AccessTooltip>{t("Can view")}</AccessTooltip>} /> ) : ( <ListItem image={<Avatar model={user} showBorder={false} />} title={user.name} subtitle={t("You have full access")} actions={<AccessTooltip>{t("Can edit")}</AccessTooltip>} /> )} <DocumentMemberList document={document} invitedInSession={invitedInSession} /> </> ) : document.isDraft ? ( <> <ListItem image={<Avatar model={document.createdBy} showBorder={false} />} title={document.createdBy?.name} actions={ <AccessTooltip content={t("Created the document")}> {t("Can edit")} </AccessTooltip> } /> <DocumentMemberList document={document} invitedInSession={invitedInSession} /> </> ) : ( <> <DocumentMemberList document={document} invitedInSession={invitedInSession} /> <ListItem image={ <Squircle color={theme.accent} size={AvatarSize.Medium}> <MoreIcon color={theme.accentText} size={16} /> </Squircle> } title={t("Other people")} subtitle={t("Other workspace members may have access")} actions={ <AccessTooltip content={t( "This document may be shared with more workspace members through a parent document or collection you do not have access to" )} /> } /> </> )} {team.sharing && can.share && !collectionSharingDisabled && visible && ( <> {document.members.length ? <Separator /> : null} <PublicAccess document={document} share={share} sharedParent={sharedParent} onRequestClose={onRequestClose} /> </> )} </ScrollableContainer> ); } ); const AccessTooltip = ({ children, content, }: { children?: React.ReactNode; content?: string; }) => { const { t } = useTranslation(); return ( <Flex align="center" gap={2}> <Text type="secondary" size="small"> {children} </Text> <Tooltip content={content ?? t("Access inherited from collection")}> <QuestionMarkIcon size={18} /> </Tooltip> </Flex> ); }; const CollectionSquircle = ({ collection }: { collection: Collection }) => { const theme = useTheme(); const iconType = determineIconType(collection.icon)!; const squircleColor = iconType === IconType.SVG ? collection.color! : theme.slateLight; const iconSize = iconType === IconType.SVG ? 16 : 22; return ( <Squircle color={squircleColor} size={AvatarSize.Medium}> <CollectionIcon collection={collection} color={theme.white} size={iconSize} /> </Squircle> ); }; function useUsersInCollection(collection?: Collection) { const { users, memberships } = useStores(); const { request } = useRequest(() => memberships.fetchPage({ limit: 1, id: collection!.id }) ); React.useEffect(() => { if (collection && !collection.permission) { void request(); } }, [collection]); return collection ? collection.permission ? true : users.inCollection(collection.id).length > 1 : false; } const ScrollableContainer = styled(Scrollable)` padding: 12px 24px; margin: -12px -24px; `; ```
/content/code_sandbox/app/components/Sharing/Document/AccessControlList.tsx
xml
2016-05-22T21:31:47
2024-08-16T19:57:22
outline
outline/outline
26,751
1,676
```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. --> <vector xmlns:android="path_to_url" xmlns:tools="path_to_url" android:height="24dp" android:viewportHeight="24.0" android:viewportWidth="24.0" android:width="24dp" tools:ignore="NewApi"> <path android:fillColor="@android:color/white" android:pathData="M7 14l5-5 5 5z"/> </vector> ```
/content/code_sandbox/lib/java/com/google/android/material/textfield/res/drawable/mtrl_ic_arrow_drop_up.xml
xml
2016-12-05T16:11:29
2024-08-16T17:51:42
material-components-android
material-components/material-components-android
16,176
163
```xml import * as React from 'react'; import ComponentExample from '../../../../components/ComponentDoc/ComponentExample'; import NonPublicSection from '../../../../components/ComponentDoc/NonPublicSection'; const Visual = () => ( <NonPublicSection title="Visual tests"> <ComponentExample examplePath="components/Popup/Visual/PopupExamplePointerOffset" /> <ComponentExample examplePath="components/Popup/Visual/PopupExamplePointerMargin" /> <ComponentExample examplePath="components/Popup/Visual/PopupExampleContainerTransformed" /> <ComponentExample examplePath="components/Popup/Visual/PopupScrollExample" /> <ComponentExample examplePath="components/Popup/Visual/PopperExampleVisibilityModifiers" /> </NonPublicSection> ); export default Visual; ```
/content/code_sandbox/packages/fluentui/docs/src/examples/components/Popup/Visual/index.tsx
xml
2016-06-06T15:03:44
2024-08-16T18:49:29
fluentui
microsoft/fluentui
18,221
160
```xml /// /// /// /// path_to_url /// /// Unless required by applicable law or agreed to in writing, software /// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. /// import { Component, Injector } from '@angular/core'; import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms'; import { Store } from '@ngrx/store'; import { AppState } from '@core/core.state'; import { BasicWidgetConfigComponent } from '@home/components/widget/config/widget-config.component.models'; import { WidgetConfigComponentData } from '@home/models/widget-component.models'; import { DataKey, Datasource, legendPositions, legendPositionTranslationMap, WidgetConfig, } from '@shared/models/widget.models'; import { WidgetConfigComponent } from '@home/components/widget/widget-config.component'; import { DataKeyType } from '@shared/models/telemetry/telemetry.models'; import { getTimewindowConfig, setTimewindowConfig } from '@home/components/widget/config/timewindow-config-panel.component'; import { formatValue, isUndefined, mergeDeep } from '@core/utils'; import { cssSizeToStrSize, DateFormatProcessor, DateFormatSettings, resolveCssSize } from '@shared/models/widget-settings.models'; import { barChartWithLabelsDefaultSettings, BarChartWithLabelsWidgetSettings } from '@home/components/widget/lib/chart/bar-chart-with-labels-widget.models'; import { TimeSeriesChartType } from '@home/components/widget/lib/chart/time-series-chart.models'; @Component({ selector: 'tb-bar-chart-with-labels-basic-config', templateUrl: './bar-chart-with-labels-basic-config.component.html', styleUrls: ['../basic-config.scss'] }) export class BarChartWithLabelsBasicConfigComponent extends BasicWidgetConfigComponent { public get datasource(): Datasource { const datasources: Datasource[] = this.barChartWidgetConfigForm.get('datasources').value; if (datasources && datasources.length) { return datasources[0]; } else { return null; } } legendPositions = legendPositions; legendPositionTranslationMap = legendPositionTranslationMap; barChartWidgetConfigForm: UntypedFormGroup; tooltipValuePreviewFn = this._tooltipValuePreviewFn.bind(this); tooltipDatePreviewFn = this._tooltipDatePreviewFn.bind(this); constructor(protected store: Store<AppState>, protected widgetConfigComponent: WidgetConfigComponent, private $injector: Injector, private fb: UntypedFormBuilder) { super(store, widgetConfigComponent); } protected configForm(): UntypedFormGroup { return this.barChartWidgetConfigForm; } protected defaultDataKeys(configData: WidgetConfigComponentData): DataKey[] { return [{ name: 'temperature', label: 'Temperature', type: DataKeyType.timeseries }]; } protected onConfigSet(configData: WidgetConfigComponentData) { const settings: BarChartWithLabelsWidgetSettings = mergeDeep<BarChartWithLabelsWidgetSettings>({} as BarChartWithLabelsWidgetSettings, barChartWithLabelsDefaultSettings, configData.config.settings as BarChartWithLabelsWidgetSettings); const iconSize = resolveCssSize(configData.config.iconSize); this.barChartWidgetConfigForm = this.fb.group({ timewindowConfig: [getTimewindowConfig(configData.config), []], datasources: [configData.config.datasources, []], series: [this.getSeries(configData.config.datasources), []], showTitle: [configData.config.showTitle, []], title: [configData.config.title, []], titleFont: [configData.config.titleFont, []], titleColor: [configData.config.titleColor, []], showIcon: [configData.config.showTitleIcon, []], iconSize: [iconSize[0], [Validators.min(0)]], iconSizeUnit: [iconSize[1], []], icon: [configData.config.titleIcon, []], iconColor: [configData.config.iconColor, []], dataZoom: [settings.dataZoom, []], showBarLabel: [settings.showBarLabel, []], barLabelFont: [settings.barLabelFont, []], barLabelColor: [settings.barLabelColor, []], showBarValue: [settings.showBarValue, []], barValueFont: [settings.barValueFont, []], barValueColor: [settings.barValueColor, []], showBarBorder: [settings.showBarBorder, []], barBorderWidth: [settings.barBorderWidth, []], barBorderRadius: [settings.barBorderRadius, []], barBackgroundSettings: [settings.barBackgroundSettings, []], noAggregationBarWidthSettings: [settings.noAggregationBarWidthSettings, []], units: [configData.config.units, []], decimals: [configData.config.decimals, []], grid: [settings.grid, []], yAxis: [settings.yAxis, []], xAxis: [settings.xAxis, []], thresholds: [settings.thresholds, []], animation: [settings.animation, []], showLegend: [settings.showLegend, []], legendPosition: [settings.legendPosition, []], legendLabelFont: [settings.legendLabelFont, []], legendLabelColor: [settings.legendLabelColor, []], showTooltip: [settings.showTooltip, []], tooltipLabelFont: [settings.tooltipLabelFont, []], tooltipLabelColor: [settings.tooltipLabelColor, []], tooltipValueFont: [settings.tooltipValueFont, []], tooltipValueColor: [settings.tooltipValueColor, []], tooltipShowDate: [settings.tooltipShowDate, []], tooltipDateFormat: [settings.tooltipDateFormat, []], tooltipDateFont: [settings.tooltipDateFont, []], tooltipDateColor: [settings.tooltipDateColor, []], tooltipDateInterval: [settings.tooltipDateInterval, []], tooltipBackgroundColor: [settings.tooltipBackgroundColor, []], tooltipBackgroundBlur: [settings.tooltipBackgroundBlur, []], background: [settings.background, []], cardButtons: [this.getCardButtons(configData.config), []], borderRadius: [configData.config.borderRadius, []], padding: [settings.padding, []], actions: [configData.config.actions || {}, []] }); } protected prepareOutputConfig(config: any): WidgetConfigComponentData { setTimewindowConfig(this.widgetConfig.config, config.timewindowConfig); this.widgetConfig.config.datasources = config.datasources; this.setSeries(config.series, this.widgetConfig.config.datasources); this.widgetConfig.config.showTitle = config.showTitle; this.widgetConfig.config.title = config.title; this.widgetConfig.config.titleFont = config.titleFont; this.widgetConfig.config.titleColor = config.titleColor; this.widgetConfig.config.showTitleIcon = config.showIcon; this.widgetConfig.config.iconSize = cssSizeToStrSize(config.iconSize, config.iconSizeUnit); this.widgetConfig.config.titleIcon = config.icon; this.widgetConfig.config.iconColor = config.iconColor; this.widgetConfig.config.settings = this.widgetConfig.config.settings || {}; this.widgetConfig.config.settings.dataZoom = config.dataZoom; this.widgetConfig.config.settings.showBarLabel = config.showBarLabel; this.widgetConfig.config.settings.barLabelFont = config.barLabelFont; this.widgetConfig.config.settings.barLabelColor = config.barLabelColor; this.widgetConfig.config.settings.showBarValue = config.showBarValue; this.widgetConfig.config.settings.barValueFont = config.barValueFont; this.widgetConfig.config.settings.barValueColor = config.barValueColor; this.widgetConfig.config.settings.showBarBorder = config.showBarBorder; this.widgetConfig.config.settings.barBorderWidth = config.barBorderWidth; this.widgetConfig.config.settings.barBorderRadius = config.barBorderRadius; this.widgetConfig.config.settings.barBackgroundSettings = config.barBackgroundSettings; this.widgetConfig.config.settings.noAggregationBarWidthSettings = config.noAggregationBarWidthSettings; this.widgetConfig.config.units = config.units; this.widgetConfig.config.decimals = config.decimals; this.widgetConfig.config.settings.grid = config.grid; this.widgetConfig.config.settings.yAxis = config.yAxis; this.widgetConfig.config.settings.xAxis = config.xAxis; this.widgetConfig.config.settings.thresholds = config.thresholds; this.widgetConfig.config.settings.animation = config.animation; this.widgetConfig.config.settings.showLegend = config.showLegend; this.widgetConfig.config.settings.legendPosition = config.legendPosition; this.widgetConfig.config.settings.legendLabelFont = config.legendLabelFont; this.widgetConfig.config.settings.legendLabelColor = config.legendLabelColor; this.widgetConfig.config.settings.showTooltip = config.showTooltip; this.widgetConfig.config.settings.tooltipLabelFont = config.tooltipLabelFont; this.widgetConfig.config.settings.tooltipLabelColor = config.tooltipLabelColor; this.widgetConfig.config.settings.tooltipValueFont = config.tooltipValueFont; this.widgetConfig.config.settings.tooltipValueColor = config.tooltipValueColor; this.widgetConfig.config.settings.tooltipShowDate = config.tooltipShowDate; this.widgetConfig.config.settings.tooltipDateFormat = config.tooltipDateFormat; this.widgetConfig.config.settings.tooltipDateFont = config.tooltipDateFont; this.widgetConfig.config.settings.tooltipDateColor = config.tooltipDateColor; this.widgetConfig.config.settings.tooltipDateInterval = config.tooltipDateInterval; this.widgetConfig.config.settings.tooltipBackgroundColor = config.tooltipBackgroundColor; this.widgetConfig.config.settings.tooltipBackgroundBlur = config.tooltipBackgroundBlur; this.widgetConfig.config.settings.background = config.background; this.setCardButtons(config.cardButtons, this.widgetConfig.config); this.widgetConfig.config.borderRadius = config.borderRadius; this.widgetConfig.config.settings.padding = config.padding; this.widgetConfig.config.actions = config.actions; return this.widgetConfig; } protected validatorTriggers(): string[] { return ['showTitle', 'showIcon', 'showBarLabel', 'showBarValue', 'showBarBorder', 'showLegend', 'showTooltip', 'tooltipShowDate']; } protected updateValidators(emitEvent: boolean, trigger?: string) { const showTitle: boolean = this.barChartWidgetConfigForm.get('showTitle').value; const showIcon: boolean = this.barChartWidgetConfigForm.get('showIcon').value; const showBarLabel: boolean = this.barChartWidgetConfigForm.get('showBarLabel').value; const showBarValue: boolean = this.barChartWidgetConfigForm.get('showBarValue').value; const showBarBorder: boolean = this.barChartWidgetConfigForm.get('showBarBorder').value; const showLegend: boolean = this.barChartWidgetConfigForm.get('showLegend').value; const showTooltip: boolean = this.barChartWidgetConfigForm.get('showTooltip').value; const tooltipShowDate: boolean = this.barChartWidgetConfigForm.get('tooltipShowDate').value; if (showTitle) { this.barChartWidgetConfigForm.get('title').enable(); this.barChartWidgetConfigForm.get('titleFont').enable(); this.barChartWidgetConfigForm.get('titleColor').enable(); this.barChartWidgetConfigForm.get('showIcon').enable({emitEvent: false}); if (showIcon) { this.barChartWidgetConfigForm.get('iconSize').enable(); this.barChartWidgetConfigForm.get('iconSizeUnit').enable(); this.barChartWidgetConfigForm.get('icon').enable(); this.barChartWidgetConfigForm.get('iconColor').enable(); } else { this.barChartWidgetConfigForm.get('iconSize').disable(); this.barChartWidgetConfigForm.get('iconSizeUnit').disable(); this.barChartWidgetConfigForm.get('icon').disable(); this.barChartWidgetConfigForm.get('iconColor').disable(); } } else { this.barChartWidgetConfigForm.get('title').disable(); this.barChartWidgetConfigForm.get('titleFont').disable(); this.barChartWidgetConfigForm.get('titleColor').disable(); this.barChartWidgetConfigForm.get('showIcon').disable({emitEvent: false}); this.barChartWidgetConfigForm.get('iconSize').disable(); this.barChartWidgetConfigForm.get('iconSizeUnit').disable(); this.barChartWidgetConfigForm.get('icon').disable(); this.barChartWidgetConfigForm.get('iconColor').disable(); } if (showBarLabel) { this.barChartWidgetConfigForm.get('barLabelFont').enable(); this.barChartWidgetConfigForm.get('barLabelColor').enable(); } else { this.barChartWidgetConfigForm.get('barLabelFont').disable(); this.barChartWidgetConfigForm.get('barLabelColor').disable(); } if (showBarValue) { this.barChartWidgetConfigForm.get('barValueFont').enable(); this.barChartWidgetConfigForm.get('barValueColor').enable(); } else { this.barChartWidgetConfigForm.get('barValueFont').disable(); this.barChartWidgetConfigForm.get('barValueColor').disable(); } if (showBarBorder) { this.barChartWidgetConfigForm.get('barBorderWidth').enable(); } else { this.barChartWidgetConfigForm.get('barBorderWidth').disable(); } if (showLegend) { this.barChartWidgetConfigForm.get('legendPosition').enable(); this.barChartWidgetConfigForm.get('legendLabelFont').enable(); this.barChartWidgetConfigForm.get('legendLabelColor').enable(); } else { this.barChartWidgetConfigForm.get('legendPosition').disable(); this.barChartWidgetConfigForm.get('legendLabelFont').disable(); this.barChartWidgetConfigForm.get('legendLabelColor').disable(); } if (showTooltip) { this.barChartWidgetConfigForm.get('tooltipLabelFont').enable(); this.barChartWidgetConfigForm.get('tooltipLabelColor').enable(); this.barChartWidgetConfigForm.get('tooltipValueFont').enable(); this.barChartWidgetConfigForm.get('tooltipValueColor').enable(); this.barChartWidgetConfigForm.get('tooltipShowDate').enable({emitEvent: false}); this.barChartWidgetConfigForm.get('tooltipBackgroundColor').enable(); this.barChartWidgetConfigForm.get('tooltipBackgroundBlur').enable(); if (tooltipShowDate) { this.barChartWidgetConfigForm.get('tooltipDateFormat').enable(); this.barChartWidgetConfigForm.get('tooltipDateFont').enable(); this.barChartWidgetConfigForm.get('tooltipDateColor').enable(); this.barChartWidgetConfigForm.get('tooltipDateInterval').enable(); } else { this.barChartWidgetConfigForm.get('tooltipDateFormat').disable(); this.barChartWidgetConfigForm.get('tooltipDateFont').disable(); this.barChartWidgetConfigForm.get('tooltipDateColor').disable(); this.barChartWidgetConfigForm.get('tooltipDateInterval').disable(); } } else { this.barChartWidgetConfigForm.get('tooltipLabelFont').disable(); this.barChartWidgetConfigForm.get('tooltipLabelColor').disable(); this.barChartWidgetConfigForm.get('tooltipValueFont').disable(); this.barChartWidgetConfigForm.get('tooltipValueColor').disable(); this.barChartWidgetConfigForm.get('tooltipShowDate').disable({emitEvent: false}); this.barChartWidgetConfigForm.get('tooltipDateFormat').disable(); this.barChartWidgetConfigForm.get('tooltipDateFont').disable(); this.barChartWidgetConfigForm.get('tooltipDateColor').disable(); this.barChartWidgetConfigForm.get('tooltipDateInterval').disable(); this.barChartWidgetConfigForm.get('tooltipBackgroundColor').disable(); this.barChartWidgetConfigForm.get('tooltipBackgroundBlur').disable(); } } private getSeries(datasources?: Datasource[]): DataKey[] { if (datasources && datasources.length) { return datasources[0].dataKeys || []; } return []; } private setSeries(series: DataKey[], datasources?: Datasource[]) { if (datasources && datasources.length) { datasources[0].dataKeys = series; } } private getCardButtons(config: WidgetConfig): string[] { const buttons: string[] = []; if (isUndefined(config.enableFullscreen) || config.enableFullscreen) { buttons.push('fullscreen'); } return buttons; } private setCardButtons(buttons: string[], config: WidgetConfig) { config.enableFullscreen = buttons.includes('fullscreen'); } private _tooltipValuePreviewFn(): string { const units: string = this.barChartWidgetConfigForm.get('units').value; const decimals: number = this.barChartWidgetConfigForm.get('decimals').value; return formatValue(22, decimals, units, false); } private _tooltipDatePreviewFn(): string { const dateFormat: DateFormatSettings = this.barChartWidgetConfigForm.get('tooltipDateFormat').value; const processor = DateFormatProcessor.fromSettings(this.$injector, dateFormat); processor.update(Date.now()); return processor.formatted; } protected readonly TimeSeriesChartType = TimeSeriesChartType; } ```
/content/code_sandbox/ui-ngx/src/app/modules/home/components/widget/config/basic/chart/bar-chart-with-labels-basic-config.component.ts
xml
2016-12-01T09:33:30
2024-08-16T19:58:25
thingsboard
thingsboard/thingsboard
16,820
3,643
```xml import { WebPartContext } from "@microsoft/sp-webpart-base"; import { ApplicationCustomizerContext } from "@microsoft/sp-application-base"; import { IUserProperties } from "./IUserProperties"; export interface IPersonaCardProps { context: WebPartContext | ApplicationCustomizerContext; profileProperties: IUserProperties; } ```
/content/code_sandbox/samples/react-directory/src/webparts/directory/components/PersonaCard/IPersonaCardProps.ts
xml
2016-08-30T17:21:43
2024-08-16T18:41:32
sp-dev-fx-webparts
pnp/sp-dev-fx-webparts
2,027
70
```xml import Box from '@mui/material/Box'; import Card from '@mui/material/Card'; import CardContent from '@mui/material/CardContent'; import React, { Fragment } from 'react'; import { useTranslation } from 'react-i18next'; import NoItems from '../NoItems'; import { DependencyBlock } from './DependencyBlock'; import { hasKeys } from './utits'; const Dependencies: React.FC<{ packageMeta: any }> = ({ packageMeta }) => { const { t } = useTranslation(); const { latest } = packageMeta; // FIXME: add dependencies to package meta type // @ts-ignore const { dependencies, devDependencies, peerDependencies, optionalDependencies, bundleDependencies, name, } = latest; const dependencyMap = { dependencies, devDependencies, peerDependencies, optionalDependencies, bundleDependencies, }; const hasDependencies = hasKeys(dependencies) || hasKeys(bundleDependencies) || hasKeys(optionalDependencies) || hasKeys(devDependencies) || hasKeys(peerDependencies); if (hasDependencies) { return ( <Card sx={{ mb: 2 }}> <CardContent> <Box data-testid="dependencies-box" sx={{ m: 2 }}> {Object.entries(dependencyMap).map(([dependencyType, dependencies]) => { if (!dependencies || Object.keys(dependencies).length === 0) { return null; } return ( <Fragment key={dependencyType}> <DependencyBlock dependencies={dependencies} key={dependencyType} title={dependencyType} /> </Fragment> ); })} </Box> </CardContent> </Card> ); } return ( <Card sx={{ mb: 2 }}> <CardContent> <NoItems text={t('dependencies.has-no-dependencies', { package: name })} /> </CardContent> </Card> ); }; export default Dependencies; ```
/content/code_sandbox/packages/ui-components/src/components/Dependencies/Dependencies.tsx
xml
2016-04-15T16:21:12
2024-08-16T09:38:01
verdaccio
verdaccio/verdaccio
16,189
418
```xml <?xml version="1.0" encoding="UTF-8"?> <!-- Comprehensive XML Example --> <root:root xmlns:root="path_to_url" xmlns:main="path_to_url" version="1.0"> <!-- Main Section --> <main:companyInfo> <main:name>ABC Corporation</main:name> <main:location> <main:city>New York</main:city> <main:state>NY</main:state> </main:location> </main:companyInfo> <!-- Employees Section --> <employees> <!-- Employee 1 --> <employee id="001"> <name>John Doe</name> <position>Engineer</position> <project name="Project A"> <task>Implement feature X</task> <task>Test feature Y</task> </project> <project name="Project B"> <!-- No tasks for this project --> </project> <manager id="M001" name="Manager One"/> </employee> <!-- Employee 2 --> <employee id="002"> <name>Jane Smith</name> <position>UI/UX</position> <project name="Project C"> <task>Create wireframes for new feature</task> <task>Conduct user testing sessions</task> </project> </employee> <!-- Employee 3 --> <employee> <name>Jane Smith</name> <project name="Project C"> <task>Conduct user testing sessions</task> </project> </employee> </employees> <!-- Additional Information --> <!-- This is a comment --> <?processing-instruction target="value"?> <!-- Mixed Content --> <mixed> This is <b>bold</b> and <i>italic</i>. </mixed> <!-- CDATA Section --> <![CDATA[This is CDATA content <with special characters & symbols>.]]> </root:root> ```
/content/code_sandbox/misc/xml-to-record-converter/src/test/resources/xml/sample_15.xml
xml
2016-11-16T14:58:44
2024-08-15T15:15:21
ballerina-lang
ballerina-platform/ballerina-lang
3,561
426
```xml export default class Ref { num: number; gen: number; constructor({ num, gen }: { num: number; gen: number }) { this.num = num; this.gen = gen; } toString(): string { let str = `${this.num}R`; if (this.gen !== 0) { str += this.gen; } return str; } } ```
/content/code_sandbox/packages/react-pdf/src/Ref.ts
xml
2016-08-01T13:46:02
2024-08-16T16:54:44
react-pdf
wojtekmaj/react-pdf
9,159
87
```xml import { Localized } from "@fluent/react/compat"; import { useRouter } from "found"; import React, { FunctionComponent, useCallback } from "react"; import { graphql } from "react-relay"; import ConfigBox from "coral-admin/routes/Configure/ConfigBox"; import Header from "coral-admin/routes/Configure/Header"; import { urls } from "coral-framework/helpers"; import { withFragmentContainer } from "coral-framework/lib/relay"; import { HorizontalGutter } from "coral-ui/components/v2"; import { AddWebhookEndpointContainer_settings } from "coral-admin/__generated__/AddWebhookEndpointContainer_settings.graphql"; import { ConfigureWebhookEndpointForm } from "../ConfigureWebhookEndpointForm"; import ExperimentalWebhooksCallOut from "../ExperimentalWebhooksCallOut"; interface Props { settings: AddWebhookEndpointContainer_settings; } const AddWebhookEndpointContainer: FunctionComponent<Props> = ({ settings, }) => { const { router } = useRouter(); const onCancel = useCallback(() => { router.push(urls.admin.webhooks); }, [router]); return ( <HorizontalGutter size="double"> <ExperimentalWebhooksCallOut /> <ConfigBox title={ <Localized id="configure-webhooks-addEndpoint"> <Header>Add a webhook endpoint</Header> </Localized> } > <ConfigureWebhookEndpointForm settings={settings} webhookEndpoint={null} onCancel={onCancel} /> </ConfigBox> </HorizontalGutter> ); }; const enhanced = withFragmentContainer<Props>({ settings: graphql` fragment AddWebhookEndpointContainer_settings on Settings { ...ConfigureWebhookEndpointForm_settings } `, })(AddWebhookEndpointContainer); export default enhanced; ```
/content/code_sandbox/client/src/core/client/admin/routes/Configure/sections/WebhookEndpoints/AddWebhookEndpoint/AddWebhookEndpointContainer.tsx
xml
2016-10-31T16:14:05
2024-08-06T16:15:57
talk
coralproject/talk
1,881
377
```xml <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="path_to_url" android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content"> <TableRow android:id="@+id/rowVideo1" android:layout_width="match_parent" android:layout_height="wrap_content"> <Button android:id="@+id/contrastBtn" style="@style/Widget.AppCompat.Button.Borderless" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="@string/contrast" android:textAllCaps="false" /> <Button android:id="@+id/brightnessBtn" style="@style/Widget.AppCompat.Button.Borderless" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="@string/video_brightness" android:textAllCaps="false" /> </TableRow> <TableRow android:id="@+id/rowVideo2" android:layout_width="match_parent" android:layout_height="match_parent"> <Button android:id="@+id/gammaBtn" style="@style/Widget.AppCompat.Button.Borderless" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="@string/gamma" android:textAllCaps="false" /> <Button android:id="@+id/saturationBtn" style="@style/Widget.AppCompat.Button.Borderless" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="@string/saturation" android:textAllCaps="false" /> </TableRow> <TableRow android:id="@+id/rowSubSeek" android:layout_width="match_parent" android:layout_height="wrap_content"> <Button android:id="@+id/subSeekBtn" style="@style/Widget.AppCompat.Button.Borderless" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="4" android:text="@string/sub_seek_button" android:textAllCaps="false" /> <Button android:id="@+id/subSeekPrev" style="@style/Widget.AppCompat.Button.Borderless" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:background="@drawable/alpha_darken" android:text="@string/dialog_prev" android:textAllCaps="false" /> <Button android:id="@+id/subSeekNext" style="@style/Widget.AppCompat.Button.Borderless" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:background="@drawable/alpha_darken" android:text="@string/dialog_next" android:textAllCaps="false" /> </TableRow> <TableRow android:layout_width="match_parent" android:layout_height="wrap_content"> <Button android:id="@+id/statsBtn" style="@style/Widget.AppCompat.Button.Borderless" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="4" android:text="@string/toggle_stats" android:textAllCaps="false" /> <Button android:id="@+id/statsBtn1" style="@style/Widget.AppCompat.Button.Borderless" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:background="@drawable/alpha_darken" android:text="1" android:textAllCaps="false" /> <Button android:id="@+id/statsBtn2" style="@style/Widget.AppCompat.Button.Borderless" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:background="@drawable/alpha_darken" android:text="2" android:textAllCaps="false" /> <Button android:id="@+id/statsBtn3" style="@style/Widget.AppCompat.Button.Borderless" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:background="@drawable/alpha_darken" android:text="3" android:textAllCaps="false" /> </TableRow> <TableRow android:layout_width="match_parent" android:layout_height="match_parent"> <Button android:id="@+id/audioDelayBtn" style="@style/Widget.AppCompat.Button.Borderless" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="@string/audio_delay" android:textAllCaps="false" /> <Button android:id="@+id/subDelayBtn" style="@style/Widget.AppCompat.Button.Borderless" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="@string/sub_delay" android:textAllCaps="false" /> </TableRow> <Button android:id="@+id/aspectBtn" style="@style/Widget.AppCompat.Button.Borderless" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/aspect_ratio" android:textAllCaps="false" /> </LinearLayout> </ScrollView> ```
/content/code_sandbox/app/src/main/res/layout/dialog_advanced_menu.xml
xml
2016-04-20T21:29:44
2024-08-16T16:14:46
mpv-android
mpv-android/mpv-android
1,964
1,252
```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 * as cryptography from '@liskhq/lisk-cryptography'; import * as transactions from '@liskhq/lisk-transactions'; import { codec, Schema } from '@liskhq/lisk-codec'; const account = { passphrase: 'endless focus guilt bronze hold economy bulk parent soon tower cement venue', privateKey: your_sha256_hashyour_sha256_hash, publicKey: your_sha256_hash, address: '9cabee3d27426676b852ce6b804cb2fdff7cd0b5', }; export const multisigRegMsgSchema = { $id: '/test/auth/command/regMultisigMsg', type: 'object', required: ['address', 'nonce', 'numberOfSignatures', 'mandatoryKeys', 'optionalKeys'], properties: { address: { dataType: 'bytes', fieldNumber: 1, minLength: 20, maxLength: 20, }, nonce: { dataType: 'uint64', fieldNumber: 2, }, numberOfSignatures: { dataType: 'uint32', fieldNumber: 3, }, mandatoryKeys: { type: 'array', items: { dataType: 'bytes', minLength: 32, maxLength: 32, }, fieldNumber: 4, }, optionalKeys: { type: 'array', items: { dataType: 'bytes', minLength: 32, maxLength: 32, }, fieldNumber: 5, }, }, }; export const registerMultisignatureParamsSchema = { $id: '/test/auth/command/regMultisig', type: 'object', properties: { numberOfSignatures: { dataType: 'uint32', fieldNumber: 1, minimum: 1, maximum: 64, }, mandatoryKeys: { type: 'array', items: { dataType: 'bytes', minLength: 32, maxLength: 32, }, fieldNumber: 2, minItems: 0, maxItems: 64, }, optionalKeys: { type: 'array', items: { dataType: 'bytes', minLength: 32, maxLength: 32, }, fieldNumber: 3, minItems: 0, maxItems: 64, }, signatures: { type: 'array', items: { dataType: 'bytes', minLength: 64, maxLength: 64, }, fieldNumber: 4, }, }, required: ['numberOfSignatures', 'mandatoryKeys', 'optionalKeys', 'signatures'], }; export const tokenTransferParamsSchema = { $id: '/test/lisk/transferCommand', title: 'Transfer transaction command', type: 'object', required: ['tokenID', 'amount', 'recipientAddress', 'data'], properties: { tokenID: { dataType: 'bytes', fieldNumber: 1, }, amount: { dataType: 'uint64', fieldNumber: 2, }, recipientAddress: { dataType: 'bytes', fieldNumber: 3, format: 'lisk32', }, data: { dataType: 'string', fieldNumber: 4, minLength: 0, maxLength: 64, }, }, }; export const posVoteParamsSchema = { $id: '/test/pos/command/stakeParams', type: 'object', required: ['stakes'], properties: { stakes: { type: 'array', fieldNumber: 1, minItems: 1, maxItems: 20, items: { type: 'object', required: ['validatorAddress', 'amount'], properties: { validatorAddress: { dataType: 'bytes', fieldNumber: 1, format: 'lisk32', }, amount: { dataType: 'sint64', fieldNumber: 2, }, }, }, }, }, }; export const schemaWithArray = { $id: '/lisk/schemaWithArray', type: 'object', required: ['attributesArray'], properties: { attributesArray: { type: 'array', fieldNumber: 1, items: { dataType: 'uint64', }, }, }, }; export const schemaWithArrayOfObjects = { $id: '/lisk/schemaWithArrayOfObjects', type: 'object', required: ['attributesArray'], properties: { attributesArray: { type: 'array', fieldNumber: 4, items: { type: 'object', required: ['module', 'attributes'], properties: { module: { dataType: 'string', minLength: 0, maxLength: 10, pattern: '^[a-zA-Z0-9]*$', fieldNumber: 1, }, attributes: { dataType: 'bytes', fieldNumber: 2, }, }, }, }, }, }; export const castValidationSchema = { $id: '/lisk/castValidation', type: 'object', required: [ 'uInt64', 'sIn64', 'uInt32', 'sInt32', 'uInt64Array', 'sInt64Array', 'uInt32Array', 'sInt32Array', ], properties: { uInt64: { dataType: 'uint64', fieldNumber: 1, }, sInt64: { dataType: 'sint64', fieldNumber: 2, }, uInt32: { dataType: 'uint32', fieldNumber: 3, }, sInt32: { dataType: 'sint32', fieldNumber: 4, }, uInt64Array: { type: 'array', fieldNumber: 5, items: { dataType: 'uint64', }, }, sInt64Array: { type: 'array', fieldNumber: 6, items: { dataType: 'sint64', }, }, uInt32Array: { type: 'array', fieldNumber: 7, items: { dataType: 'uint32', }, }, sInt32Array: { type: 'array', fieldNumber: 8, items: { dataType: 'sint32', }, }, nested: { type: 'array', fieldNumber: 9, items: { type: 'object', properties: { uInt64: { dataType: 'uint64', fieldNumber: 1, }, sInt64: { dataType: 'sint64', fieldNumber: 2, }, uInt32: { dataType: 'uint32', fieldNumber: 3, }, sInt32: { dataType: 'sint32', fieldNumber: 4, }, }, }, }, }, }; export const genesisBlockID = Buffer.from( your_sha256_hash, 'hex', ); export const chainID = Buffer.from('10000000', 'hex'); export const chainIDStr = chainID.toString('hex'); export const createTransferTransaction = ({ amount, fee, recipientAddress, nonce, }: { amount: string; fee: string; recipientAddress: string; nonce: number; }): Record<string, unknown> => { const transaction = transactions.signTransaction( { module: 'token', command: 'transfer', nonce: BigInt(nonce), fee: BigInt(transactions.convertLSKToBeddows(fee)), senderPublicKey: Buffer.from(account.publicKey, 'hex'), params: { tokenID: Buffer.from([0, 0, 0, 0, 0, 0]), amount: BigInt(transactions.convertLSKToBeddows(amount)), recipientAddress: cryptography.address.getAddressFromLisk32Address(recipientAddress), data: '', }, }, chainID, Buffer.from(account.privateKey, 'hex'), tokenTransferParamsSchema, ) as any; return { ...transaction, id: transaction.id.toString('hex'), senderPublicKey: transaction.senderPublicKey.toString('hex'), signatures: transaction.signatures.map((s: Buffer) => s.toString('hex')), params: { ...transaction.params, tokenID: transaction.params.tokenID.toString('hex'), amount: transaction.params.amount.toString(), recipientAddress: cryptography.address.getLisk32AddressFromAddress( transaction.params.recipientAddress, ), }, nonce: transaction.nonce.toString(), fee: transaction.fee.toString(), }; }; export const encodeTransactionFromJSON = ( transaction: Record<string, unknown>, baseSchema: Schema, commandsSchemas: { module: string; command: string; schema: Schema }[], ): string => { const transactionTypeAssetSchema = commandsSchemas.find( as => as.module === transaction.module && as.command === transaction.command, ); if (!transactionTypeAssetSchema) { throw new Error('Transaction type not found.'); } const transactionAssetBuffer = codec.encode( transactionTypeAssetSchema.schema, // eslint-disable-next-line @typescript-eslint/ban-types codec.fromJSON(transactionTypeAssetSchema.schema, transaction.params as object), ); const transactionBuffer = codec.encode( baseSchema, codec.fromJSON(baseSchema, { ...transaction, params: transactionAssetBuffer, }), ); return transactionBuffer.toString('hex'); }; ```
/content/code_sandbox/commander/test/helpers/transactions.ts
xml
2016-02-01T21:45:35
2024-08-15T19:16:48
lisk-sdk
LiskArchive/lisk-sdk
2,721
2,273
```xml <resources> <string name="app_name">ContactsTest</string> </resources> ```
/content/code_sandbox/chapter7/ContactsTest/app/src/main/res/values/strings.xml
xml
2016-10-04T02:55:57
2024-08-16T11:00:26
booksource
guolindev/booksource
3,105
20
```xml export {}; declare global { module NodeJS { interface Global { jasmine: any; shellStartTime: number; errorLogger: any; application: import('../application').default; } } module Electron { interface BrowserWindow { loadSettings: { [key: string]: unknown }; loadSettingsChangedSinceGetURL: boolean; updateLoadSettings: boolean; } interface TouchBarButton { command: string; group: string; } interface TouchBarSpacer { command: string; group: string; } } } ```
/content/code_sandbox/app/src/browser/types/global-ext.d.ts
xml
2016-10-13T06:45:50
2024-08-16T18:14:37
Mailspring
Foundry376/Mailspring
15,331
123
```xml export interface PendingPromise<TValue> extends Promise<TValue> { status: "pending"; } export interface FulfilledPromise<TValue> extends Promise<TValue> { status: "fulfilled"; value: TValue; } export interface RejectedPromise<TValue> extends Promise<TValue> { status: "rejected"; reason: unknown; } export type PromiseWithState<TValue> = | PendingPromise<TValue> | FulfilledPromise<TValue> | RejectedPromise<TValue>; export function createFulfilledPromise<TValue>(value: TValue) { const promise = Promise.resolve(value) as FulfilledPromise<TValue>; promise.status = "fulfilled"; promise.value = value; return promise; } export function createRejectedPromise<TValue = unknown>(reason: unknown) { const promise = Promise.reject(reason) as RejectedPromise<TValue>; // prevent potential edge cases leaking unhandled error rejections promise.catch(() => {}); promise.status = "rejected"; promise.reason = reason; return promise; } export function isStatefulPromise<TValue>( promise: Promise<TValue> ): promise is PromiseWithState<TValue> { return "status" in promise; } export function wrapPromiseWithState<TValue>( promise: Promise<TValue> ): PromiseWithState<TValue> { if (isStatefulPromise(promise)) { return promise; } const pendingPromise = promise as PendingPromise<TValue>; pendingPromise.status = "pending"; pendingPromise.then( (value) => { if (pendingPromise.status === "pending") { const fulfilledPromise = pendingPromise as unknown as FulfilledPromise<TValue>; fulfilledPromise.status = "fulfilled"; fulfilledPromise.value = value; } }, (reason: unknown) => { if (pendingPromise.status === "pending") { const rejectedPromise = pendingPromise as unknown as RejectedPromise<TValue>; rejectedPromise.status = "rejected"; rejectedPromise.reason = reason; } } ); return promise as PromiseWithState<TValue>; } ```
/content/code_sandbox/src/utilities/promises/decoration.ts
xml
2016-02-26T20:25:00
2024-08-16T10:56:57
apollo-client
apollographql/apollo-client
19,304
444
```xml import React from 'react'; import { AppConsumer } from '@erxes/ui/src/appContext'; const withConsumer = (WrappedComponent: any) => { return (props) => ( <AppConsumer> {(context: any) => <WrappedComponent {...props} {...context} />} </AppConsumer> ); }; export default withConsumer; ```
/content/code_sandbox/packages/plugin-calls-ui/src/withConsumer.tsx
xml
2016-11-11T06:54:50
2024-08-16T10:26:06
erxes
erxes/erxes
3,479
75
```xml import { FragmentType, useFragment } from './gql/fragment-masking'; import { graphql } from './gql'; export const FilmFragment = graphql(/* GraphQL */ ` fragment FilmItem on Film { id title releaseDate producers } `); const Film = (props: { film: FragmentType<typeof FilmFragment> }) => { const film = useFragment(FilmFragment, props.film); return ( <div> <h3>{film.title}</h3> <p>{film.releaseDate}</p> </div> ); }; export default Film; ```
/content/code_sandbox/examples/react/apollo-client-swc-plugin/src/Film.tsx
xml
2016-12-05T19:15:11
2024-08-15T14:56:08
graphql-code-generator
dotansimha/graphql-code-generator
10,759
131
```xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="path_to_url" xmlns:tools="path_to_url" android:id="@+id/activity_music" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#ECECEC" android:orientation="vertical" tools:context="com.lcodecore.twinklingrefreshlayout.PhotoActivity"> <RelativeLayout android:layout_width="match_parent" android:layout_height="56dp" android:background="#1F2426"> <ImageButton android:id="@+id/bt_back" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_marginLeft="12dp" android:background="@null" android:src="@drawable/back_pink" /> <TextView android:id="@+id/tv_spacing" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:text="P H O T O" android:textColor="#FFEEEE" android:textSize="14sp" android:textStyle="bold" /> <ImageButton android:id="@+id/ib_refresh" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_centerVertical="true" android:layout_marginRight="12dp" android:background="@null" android:src="@drawable/map" /> </RelativeLayout> <com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout android:id="@+id/refresh" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.v7.widget.RecyclerView android:id="@+id/recyclerview" android:layout_width="match_parent" android:layout_height="match_parent" android:overScrollMode="never"/> </com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout> </LinearLayout> ```
/content/code_sandbox/app/src/main/res/layout/activity_photo.xml
xml
2016-03-02T12:11:56
2024-08-07T06:56:48
TwinklingRefreshLayout
lcodecorex/TwinklingRefreshLayout
3,995
458
```xml // *** WARNING: this file was generated by test. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** import * as pulumi from "@pulumi/pulumi"; import * as inputs from "./types/input"; import * as outputs from "./types/output"; import * as utilities from "./utilities"; export class Resource extends pulumi.CustomResource { /** * Get an existing Resource resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ public static get(name: string, id: pulumi.Input<pulumi.ID>, opts?: pulumi.CustomResourceOptions): Resource { return new Resource(name, undefined as any, { ...opts, id: id }); } /** @internal */ public static readonly __pulumiType = 'mypkg::Resource'; /** * Returns true if the given object is an instance of Resource. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ public static isInstance(obj: any): obj is Resource { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === Resource.__pulumiType; } public readonly config!: pulumi.Output<outputs.Config>; public readonly configArray!: pulumi.Output<outputs.Config[]>; public readonly configMap!: pulumi.Output<{[key: string]: outputs.Config}>; public readonly foo!: pulumi.Output<string>; public readonly fooArray!: pulumi.Output<string[]>; public readonly fooMap!: pulumi.Output<{[key: string]: string}>; /** * Create a Resource resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: ResourceArgs, opts?: pulumi.CustomResourceOptions) { let resourceInputs: pulumi.Inputs = {}; opts = opts || {}; if (!opts.id) { if ((!args || args.config === undefined) && !opts.urn) { throw new Error("Missing required property 'config'"); } if ((!args || args.configArray === undefined) && !opts.urn) { throw new Error("Missing required property 'configArray'"); } if ((!args || args.configMap === undefined) && !opts.urn) { throw new Error("Missing required property 'configMap'"); } if ((!args || args.foo === undefined) && !opts.urn) { throw new Error("Missing required property 'foo'"); } if ((!args || args.fooArray === undefined) && !opts.urn) { throw new Error("Missing required property 'fooArray'"); } if ((!args || args.fooMap === undefined) && !opts.urn) { throw new Error("Missing required property 'fooMap'"); } resourceInputs["config"] = args?.config ? pulumi.secret(args.config) : undefined; resourceInputs["configArray"] = args?.configArray ? pulumi.secret(args.configArray) : undefined; resourceInputs["configMap"] = args?.configMap ? pulumi.secret(args.configMap) : undefined; resourceInputs["foo"] = args?.foo ? pulumi.secret(args.foo) : undefined; resourceInputs["fooArray"] = args?.fooArray ? pulumi.secret(args.fooArray) : undefined; resourceInputs["fooMap"] = args?.fooMap ? pulumi.secret(args.fooMap) : undefined; } else { resourceInputs["config"] = undefined /*out*/; resourceInputs["configArray"] = undefined /*out*/; resourceInputs["configMap"] = undefined /*out*/; resourceInputs["foo"] = undefined /*out*/; resourceInputs["fooArray"] = undefined /*out*/; resourceInputs["fooMap"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["config", "configArray", "configMap", "foo", "fooArray", "fooMap"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(Resource.__pulumiType, name, resourceInputs, opts); } } /** * The set of arguments for constructing a Resource resource. */ export interface ResourceArgs { config: pulumi.Input<inputs.ConfigArgs>; configArray: pulumi.Input<pulumi.Input<inputs.ConfigArgs>[]>; configMap: pulumi.Input<{[key: string]: pulumi.Input<inputs.ConfigArgs>}>; foo: pulumi.Input<string>; fooArray: pulumi.Input<pulumi.Input<string>[]>; fooMap: pulumi.Input<{[key: string]: pulumi.Input<string>}>; } ```
/content/code_sandbox/tests/testdata/codegen/secrets/nodejs/resource.ts
xml
2016-10-31T21:02:47
2024-08-16T19:47:04
pulumi
pulumi/pulumi
20,743
1,080
```xml import { mockProperty, unmockProperty } from 'jest-expo'; import * as Sharing from '../Sharing'; describe('Sharing', () => { describe('isAvailableAsync', () => { if (typeof navigator !== 'undefined') { describe('browser', () => { it(`returns true if navigator.share is defined`, async () => { mockProperty(navigator, 'share', true); const isAvailable = await Sharing.isAvailableAsync(); expect(isAvailable).toBeTruthy(); unmockProperty(navigator, 'share'); }); }); } else { describe('node', () => { it(`returns false`, async () => { const isAvailable = await Sharing.isAvailableAsync(); expect(isAvailable).toBeFalsy(); }); }); } }); }); ```
/content/code_sandbox/packages/expo-sharing/src/__tests__/Sharing-test.web.ts
xml
2016-08-15T17:14:25
2024-08-16T19:54:44
expo
expo/expo
32,004
166
```xml <vector xmlns:android="path_to_url" android:height="34.0dp" android:tint="?attr/colorControlNormal" android:viewportHeight="15" android:viewportWidth="15" android:width="34.0dp"> <path android:fillColor="@android:color/white" android:pathData="M15 3C15 3 15 13 15 13L0.05 13C1.5 12.5 3.5 12.5 4.5 11.5C3.5 11.5 3 10.5 2.5 10.5C2 10.5 1.5 11.5 0.5 11.5C0.5 11.5 0.5 10 0.5 10C1 10 1.5 9 2.5 9C3.5 9 4 10 4.5 10C5 10 5.5 9 6.5 9C7 9 7 9 7 9L8 8C8 8.5 7 7.5 6.5 7.5C6 7.5 5.5 8.5 4.5 8.5C3.5 8.5 3 7.5 2.5 7.5C2 7.5 1.5 8.5 0.5 8.5C0.5 8.5 0.5 7 0.51 7.02C1 7 1.5 6 2.5 6C3.5 6 4 7 4.5 7C5 7 5.5 6 6.5 6C7.5 6 8.5 7 9 7C10 6 13 3 15 3z"/> </vector> ```
/content/code_sandbox/app/src/main/res/drawable/ic_preset_temaki_beach.xml
xml
2016-07-02T10:44:04
2024-08-16T18:55:54
StreetComplete
streetcomplete/StreetComplete
3,781
432
```xml import deleteCustomProps from "./delete-custom-props"; // eslint-disable-next-line @typescript-eslint/no-var-requires const _ = require("lodash"); import assert = require("assert"); import Partial from "./partial"; import Profile from "./profile"; import ConcatMethod from "./concat-method"; import CONSTANT from "./constants"; const { getConcatMethod } = ConcatMethod; const { PROFILES, PARTIALS } = CONSTANT; class WebpackConfigComposer { logger: any; constructor(options: Record<string, unknown> | undefined | null) { options = options || {}; this[PROFILES] = {}; this[PARTIALS] = {}; if (options.profiles) { this.addProfiles(options.profiles); } if (options.partials) { this.addPartials(options.partials); } // eslint-disable-next-line no-console this.logger = options.logger || console.log; } get profiles(): any { return this[PROFILES]; } get partials(): any { return this[PARTIALS]; } addProfiles(profiles: any): any { // eslint-disable-next-line prefer-rest-params profiles = Array.isArray(profiles) ? profiles : Array.prototype.slice.call(arguments); profiles.forEach(a => { Object.keys(a).forEach(k => this.addProfile(k, a[k].partials)); }); } addProfile(name: string, partials: Record<string, unknown> | unknown): any { assert(!this.getProfile(name), `Profile ${name} already exist.`); let profile; if (typeof partials !== "object") { // take argument as list of partial names // eslint-disable-next-line prefer-rest-params const partialNames = Array.prototype.slice.call(arguments, 1); profile = new Profile(name, {}); partialNames.forEach((pn) => { profile.partials[pn] = {}; }); } else { profile = new Profile(name, partials); } this[PROFILES][name] = profile; return profile; } // eslint-disable-next-line max-params addPartialToProfile(partialName, profileName, config, partialOptions) { let profile = this.getProfile(profileName); if (!profile) { profile = this.addProfile(profileName, {}); } assert( !profile.getPartial(partialName), `Partial ${partialName} already exist in profile ${profileName}` ); this.addPartial(partialName, config, null); profile.setPartial(partialName, partialOptions); } addPartials(partials) { // eslint-disable-next-line prefer-rest-params partials = Array.isArray(partials) ? partials : Array.prototype.slice.call(arguments); partials.forEach(a => { Object.keys(a).forEach(k => { this._addPartial(k, a[k], a[k].addOptions); }); }); } _addPartial(name, data, addOpt) { const exist = this[PARTIALS][name]; if (!exist || _.get(addOpt, "method") === "replace") { this[PARTIALS][name] = data instanceof Partial ? data : new Partial(name, data); } else { exist.merge(data, _.get(addOpt, "concatArray")); } return this; } addPartial(name, config, options) { return this._addPartial(name, { config }, options); } replacePartial(name, config, options) { return this._addPartial(name, { config }, Object.assign({}, options, { method: "replace" })); } getPartial(name) { return this[PARTIALS][name]; } enablePartial(name, flag) { const partial = this.getPartial(name); if (partial) { partial.enable = flag; } } getProfile(name) { return this[PROFILES][name]; } /* eslint-disable max-statements */ compose(options, ...profiles) { const allProfiles = _.flatten(profiles); const profileNames = allProfiles.map(p => (_.isString(p) ? p : p.name)); let profPartials = allProfiles.map(p => { if (_.isString(p)) { const prof = this.getProfile(p); assert(prof, `Profile ${p} doesn't exist in the composer`); return prof.partials; } return p.partials || {}; }); profPartials = _.merge({}, ...profPartials); const num = x => { return _.isString(x) ? parseInt(x, 10) : x; }; const checkNaN = x => { return isNaN(x) ? Infinity : x; }; const isEnable = p => profPartials[p].enable !== false; const partialOrder = p => checkNaN(num(profPartials[p].order)); const sortedKeys = _(Object.keys(profPartials)) .filter(isEnable) .sortBy(partialOrder) .value(); const currentConfig = options.currentConfig || {}; const concat = getConcatMethod(options.concatArray, null); sortedKeys.forEach(partialName => { const partial = this.getPartial(partialName); assert(partial, `Partial ${partialName} doesn't exist or has not been added`); const composeOptions = Object.assign({}, profPartials[partialName].options, { currentConfig }); const ret = partial.compose(composeOptions); if (typeof ret === "object") { _.mergeWith(currentConfig, ret, concat); } }); if (!options.skipNamePlugins && currentConfig.plugins) { currentConfig.plugins = currentConfig.plugins.map(x => { x.__name = x.constructor.name; return x; }); } if (!options.keepCustomProps) { deleteCustomProps(currentConfig); } if (options.meta) { return { config: currentConfig, profileNames, partialNames: sortedKeys }; } return currentConfig; } /* eslint-enable max-statements */ deleteCustomProps(config) { return deleteCustomProps(config); } } export = WebpackConfigComposer; ```
/content/code_sandbox/packages/webpack-config-composer/src/index.ts
xml
2016-09-06T19:02:39
2024-08-11T11:43:11
electrode
electrode-io/electrode
2,103
1,324
```xml // Escapes the RegExp special characters "^", "$", "", ".", "*", "+", "?", "(", // ")", "[", "]", "{", "}", and "|" in string. // See path_to_url#escapeRegExp import escapeRegExp from "lodash/escapeRegExp"; import {Part} from "./merge"; export type ChannelPart = Part & { channel: string; }; // escapes a regex in a way that's compatible to shove it in // a regex char set (meaning it also escapes -) function escapeRegExpCharSet(raw: string): string { const escaped: string = escapeRegExp(raw); return escaped.replace("-", "\\-"); } // Given an array of channel prefixes (such as "#" and "&") and an array of user // modes (such as "@" and "+"), this function extracts channels and nicks from a // text. // It returns an array of objects for each channel found with their start index, // end index and channel name. function findChannels(text: string, channelPrefixes: string[], userModes: string[]) { // `userModePattern` is necessary to ignore user modes in /whois responses. // For example, a voiced user in #thelounge will have a /whois response of: // > foo is on the following channels: +#thelounge // We need to explicitly ignore user modes to parse such channels correctly. const userModePattern = userModes.map(escapeRegExpCharSet).join(""); const channelPrefixPattern = channelPrefixes.map(escapeRegExpCharSet).join(""); const channelPattern = `(?:^|\\s)[${userModePattern}]*([${channelPrefixPattern}][^ \u0007]+)`; const channelRegExp = new RegExp(channelPattern, "g"); const result: ChannelPart[] = []; let match: RegExpExecArray | null; do { // With global ("g") regexes, calling `exec` multiple times will find // successive matches in the same string. match = channelRegExp.exec(text); if (match) { result.push({ start: match.index + match[0].length - match[1].length, end: match.index + match[0].length, channel: match[1], }); } } while (match); return result; } export default findChannels; ```
/content/code_sandbox/client/js/helpers/ircmessageparser/findChannels.ts
xml
2016-02-09T03:16:03
2024-08-16T10:52:38
thelounge
thelounge/thelounge
5,518
489
```xml <?xml version="1.0" encoding="UTF-8"?> <?eclipse version="3.2"?> <plugin> <extension-point id="org.lamport.tla.toolbox.tool" name="Toolbox Life Cycle Participant" schema="schema/org.lamport.tla.toolbox.tool.exsd"/> <!-- --> <!-- Application --> <!-- --> <extension id="org.lamport.tla.toolbox.application" point="org.eclipse.core.runtime.applications"> <application> <run class="org.lamport.tla.toolbox.Application"> </run> </application> </extension> <!-- --> <!-- Product --> <!-- --> <extension id="product" point="org.eclipse.core.runtime.products"> <product application="org.lamport.tla.toolbox.application" name="TLA+ Toolbox"> <property name="windowImages" value="platform:/plugin/org.lamport.tla.toolbox/icons/full/etool16/tla_launch_check_wiz_16.png,platform:/plugin/org.lamport.tla.toolbox/icons/full/etool16/tla_launch_check_wiz_32.png,platform:/plugin/org.lamport.tla.toolbox/icons/full/etool16/tla_launch_check_wiz_48.png,platform:/plugin/org.lamport.tla.toolbox/icons/full/etool16/tla_launch_check_wiz_64.png,platform:/plugin/org.lamport.tla.toolbox/icons/full/etool16/tla_launch_check_wiz_128.png,platform:/plugin/org.lamport.tla.toolbox/icons/full/etool16/tla_launch_check_wiz_256.png"> </property> <property name="aboutText" value="TLA+ Toolbox provides a user interface for TLA+ Tools. &#x0A;&#x0A;This is Version 1.8.0 of Day Month Year and includes:&#x0A; - SANY Version 2.2 of 20 April 2020&#x0A; - TLC Version 2.15 of 20 April 2020&#x0A; - PlusCal Version 1.10 of 20 April 2020&#x0A; - TLATeX Version 1.0 of 20 September 2017&#x0A;&#x0A;Don&apos;t forget to click on help. You can learn about features that you never knew about or have forgotten.&#x0A;&#x0A;Please send us reports of problems or suggestions; see path_to_url .&#x0A;&#x0A;Some icons used in the Toolbox were provided by www.flaticon.com"> </property> <property name="aboutImage" value="images/splash_small.png"> </property> <property name="appName" value="TLA+ Toolbox"> </property> <property name="lifeCycleURI" value="bundleclass://org.lamport.tla.toolbox/org.lamport.tla.toolbox.OpenFileManager"> </property> </product> </extension> <!-- --> <!-- Intro --> <!-- --> <extension point="org.eclipse.ui.intro"> <intro class="org.lamport.tla.toolbox.ui.intro.ToolboxIntroPart" id="org.lamport.tla.toolbox.product.standalone.intro"> </intro> <introProductBinding introId="org.lamport.tla.toolbox.product.standalone.intro" productId="org.lamport.tla.toolbox.product.standalone.product"> </introProductBinding> </extension> <extension point="org.eclipse.ui.menus"> <menuContribution locationURI="menu:org.eclipse.ui.main.menu?after=additions"> <menu id="toolbox.menu.help" label="Help" mnemonic="H" tooltip="Opens the help menu"> <command commandId="org.eclipse.equinox.p2.ui.sdk.update" id="toolbox.menuItem.checkForUpdates" label="Check for Updates" mnemonic="c" mode="FORCE_TEXT" style="push" tooltip="Checks the web for a newer Toolbox version"> </command> </menu> </menuContribution> </extension> <!-- Add the update scheduler as a root preference page to the product defining bundle --> <extension point="org.eclipse.ui.startup"> <startup class="org.eclipse.equinox.internal.p2.ui.sdk.scheduler.AutomaticUpdateScheduler"> </startup> </extension> <extension point="org.eclipse.ui.preferencePages"> <page class="org.lamport.tla.toolbox.preferences.AutomaticUpdatesPreferencePage" id="org.eclipse.equinox.internal.p2.ui.sdk.scheduler.AutomaticUpdatesPreferencePage" name="Automatic Update"> <keywordReference id="org.eclipse.equinox.p2.ui.sdk.updates.general"/> </page> <!-- Activate preference page below if Toolbox preferences should include generic p2 repository editor (see Window > Preferences > Install/Update > Available Sofware Sites in Eclipse. <page class="org.eclipse.equinox.p2.ui.RepositoryManipulationPage" id="org.eclipse.equinox.internal.p2.ui.sdk.SitesPreferencePage" name="Available Software Sites"> <keywordReference id="org.eclipse.equinox.p2.ui.sdk.updates.general"/> </page> --> </extension> <!-- Navogator --> <!-- <extension point="org.eclipse.ui.navigator.viewer"> <viewerActionBinding viewerId="toolbox.view.Navigator"> <includes> <actionExtension pattern="org.eclipse.ui.navigator.resources.*"> </actionExtension></includes> </viewerActionBinding> <viewerContentBinding viewerId="toolbox.view.Navigator"> <includes> <contentExtension pattern="org.eclipse.ui.navigator.resourceContent"> </contentExtension> <contentExtension pattern="org.eclipse.ui.navigator.resources.linkHelper"> </contentExtension> <contentExtension pattern="org.eclipse.ui.navigator.resources.filters.*"> </contentExtension> <contentExtension pattern="org.eclipse.ui.navigator.resources.workingSets"> </contentExtension> </includes> </viewerContentBinding> </extension> <extension point="org.eclipse.ui.views"> <view class="org.eclipse.ui.navigator.CommonNavigator" id="toolbox.view.Navigator" name="Spec Navigator" restorable="true"> </view> </extension> --> </plugin> ```
/content/code_sandbox/toolbox/org.lamport.tla.toolbox.product.standalone/plugin.xml
xml
2016-02-02T08:48:27
2024-08-16T16:50:00
tlaplus
tlaplus/tlaplus
2,271
1,420
```xml import { Outlet, defineDataLoader, useData, request } from 'ice'; export default () => { const data = useData(); console.log(data); return ( <div> <h1>ICE 3.0 Layout</h1> <Outlet /> </div> ); }; export function pageConfig() { return { title: 'Layout', meta: [ { name: 'layout-color', content: '#f00', }, ], }; } export const dataLoader = defineDataLoader(async () => { try { const data = await request('/data'); return data; } catch (e) { console.error(e); return {}; } }); ```
/content/code_sandbox/examples/with-request/src/pages/layout.tsx
xml
2016-11-03T06:59:15
2024-08-16T10:11:29
ice
alibaba/ice
17,815
156
```xml /* eslint-disable */ /** * This file was automatically generated by json-schema-to-typescript. * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and run json-schema-to-typescript to regenerate this file. */ /** * Measures the session recovery initiation api call successes and failures */ export interface WebCoreSessionRecoveryInitiationTotal { Value: number; Labels: { status: "success" | "failure" | "4xx" | "5xx"; }; } ```
/content/code_sandbox/packages/metrics/types/web_core_session_recovery_initiation_total_v1.schema.d.ts
xml
2016-06-08T11:16:51
2024-08-16T14:14:27
WebClients
ProtonMail/WebClients
4,300
107
```xml import React from 'react' import { generateChordData } from '@nivo/generators' import { Seo } from '../../components/Seo' import { ApiClient } from '../../components/components/api-client/ApiClient' import { groups } from '../../data/components/chord/props' import mapper from '../../data/components/chord/mapper' import meta from '../../data/components/chord/meta.yml' import { graphql, useStaticQuery } from 'gatsby' const MATRIX_SIZE = 5 const data = generateChordData({ size: MATRIX_SIZE }) const ChordApi = () => { const { image: { childImageSharp: { gatsbyImageData: image }, }, } = useStaticQuery(graphql` query { image: file(absolutePath: { glob: "**/src/assets/captures/chord.png" }) { childImageSharp { gatsbyImageData(layout: FIXED, width: 700, quality: 100) } } } `) return ( <> <Seo title="Chord HTTP API" image={image} keywords={[...meta.Chord.tags, 'HTTP API']} /> <ApiClient componentName="Chord" chartClass="chord" apiPath="/charts/chord" flavors={meta.flavors} //dataProperty="matrix" controlGroups={groups} propsMapper={mapper} defaultProps={{ width: 800, height: 800, data: JSON.stringify(data.matrix, null, ' '), keys: data.keys, margin: { top: 40, right: 40, bottom: 40, left: 40, }, padAngle: 0.02, innerRadiusRatio: 0.96, innerRadiusOffset: 0.01, colors: { scheme: 'nivo' }, arcOpacity: 1, arcBorderWidth: 1, arcBorderColor: { from: 'color', modifiers: [['darker', 0.4]], }, ribbonOpacity: 0.5, ribbonBorderWidth: 1, ribbonBorderColor: { from: 'color', modifiers: [['darker', 0.4]], }, enableLabel: true, label: 'id', labelOffset: 12, labelRotation: -90, labelTextColor: { from: 'color', modifiers: [['darker', 1]], }, }} /> </> ) } export default ChordApi ```
/content/code_sandbox/website/src/pages/chord/api.tsx
xml
2016-04-16T03:27:56
2024-08-16T03:38:37
nivo
plouc/nivo
13,010
545
```xml <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="path_to_url"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion>10.0.20506</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{8F6F8F9D-04FD-0C41-9AFC-603AD5D8D509}</ProjectGuid> <OutputType>Library</OutputType> <AssemblyName>Assembly-CSharp</AssemblyName> <FileAlignment>512</FileAlignment> <ProjectTypeGuids>{E097FAD1-6243-4DAD-9C02-E9B9EFC3FFC1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> <TargetFrameworkIdentifier>.NETFramework</TargetFrameworkIdentifier> <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> <TargetFrameworkProfile>Unity Web v3.5</TargetFrameworkProfile> <CompilerResponseFile></CompilerResponseFile> <UnityProjectType>Game:1</UnityProjectType> <UnityBuildTarget>WebPlayer:6</UnityBuildTarget> <UnityVersion>5.2.1f1</UnityVersion> <RootNamespace></RootNamespace> <LangVersion Condition=" '$(VisualStudioVersion)' != '10.0' ">4</LangVersion> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>false</Optimize> <OutputPath>Temp\UnityVS_bin\Debug\</OutputPath> <IntermediateOutputPath>Temp\UnityVS_obj\Debug\</IntermediateOutputPath> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <DefineConstants>DEBUG;TRACE;UNITY_5_2_1;UNITY_5_2;UNITY_5;ENABLE_NEW_BUGREPORTER;ENABLE_2D_PHYSICS;ENABLE_4_6_FEATURES;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_FRAME_DEBUGGER;ENABLE_GENERICS;ENABLE_HOME_SCREEN;ENABLE_IMAGEEFFECTS;ENABLE_LIGHT_PROBES_LEGACY;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_PLUGIN_INSPECTOR;ENABLE_SHADOWS;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_RAKNET;ENABLE_UNET;ENABLE_UNITYEVENTS;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_METRICS;ENABLE_REFLECTION_BUFFERS;INCLUDE_DYNAMIC_GI;INCLUDE_GI;INCLUDE_IL2CPP;INCLUDE_DIRECTX12;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;ENABLE_LOCALIZATION;ENABLE_ANDROID_ATLAS_ETC1_COMPRESSION;UNITY_WEBPLAYER;ENABLE_SUBSTANCE;WEBPLUG;ENABLE_TEXTUREID_MAP;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_MONO;ENABLE_PROFILER;DEBUG;TRACE;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN;UNITY_TEAM_LICENSE;UNITY_PRO_LICENSE</DefineConstants> <AllowUnsafeBlocks>false</AllowUnsafeBlocks> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>false</Optimize> <OutputPath>Temp\UnityVS_bin\Release\</OutputPath> <IntermediateOutputPath>Temp\UnityVS_obj\Release\</IntermediateOutputPath> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <DefineConstants>TRACE;UNITY_5_2_1;UNITY_5_2;UNITY_5;ENABLE_NEW_BUGREPORTER;ENABLE_2D_PHYSICS;ENABLE_4_6_FEATURES;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_FRAME_DEBUGGER;ENABLE_GENERICS;ENABLE_HOME_SCREEN;ENABLE_IMAGEEFFECTS;ENABLE_LIGHT_PROBES_LEGACY;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_PLUGIN_INSPECTOR;ENABLE_SHADOWS;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_RAKNET;ENABLE_UNET;ENABLE_UNITYEVENTS;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_METRICS;ENABLE_REFLECTION_BUFFERS;INCLUDE_DYNAMIC_GI;INCLUDE_GI;INCLUDE_IL2CPP;INCLUDE_DIRECTX12;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;ENABLE_LOCALIZATION;ENABLE_ANDROID_ATLAS_ETC1_COMPRESSION;UNITY_WEBPLAYER;ENABLE_SUBSTANCE;WEBPLUG;ENABLE_TEXTUREID_MAP;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_MONO;ENABLE_PROFILER;DEBUG;TRACE;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN;UNITY_TEAM_LICENSE;UNITY_PRO_LICENSE</DefineConstants> <AllowUnsafeBlocks>false</AllowUnsafeBlocks> </PropertyGroup> <ItemGroup> <Reference Include="mscorlib" /> <Reference Include="System" /> <Reference Include="System.XML" /> <Reference Include="System.Core" /> <Reference Include="Boo.Lang" /> <Reference Include="UnityScript.Lang" /> <Reference Include="UnityEngine"> <HintPath>Library\UnityAssemblies\UnityEngine.dll</HintPath> </Reference> <Reference Include="UnityEngine.UI"> <HintPath>Library\UnityAssemblies\UnityEngine.UI.dll</HintPath> </Reference> <Reference Include="UnityEngine.Networking"> <HintPath>Library\UnityAssemblies\UnityEngine.Networking.dll</HintPath> </Reference> <Reference Include="UnityEngine.Networking"> <HintPath>Library\UnityAssemblies\UnityEngine.Networking.dll</HintPath> </Reference> <Reference Include="UnityEngine.UI"> <HintPath>Library\UnityAssemblies\UnityEngine.UI.dll</HintPath> </Reference> <Reference Include="UnityEditor"> <HintPath>Library\UnityAssemblies\UnityEditor.dll</HintPath> </Reference> <Reference Include="Mono.Cecil"> <HintPath>Library\UnityAssemblies\Mono.Cecil.dll</HintPath> </Reference> <Reference Include="UnityEditor.iOS.Extensions.Xcode"> <HintPath>Library\UnityAssemblies\UnityEditor.iOS.Extensions.Xcode.dll</HintPath> </Reference> </ItemGroup> <ItemGroup> <Compile Include="Assets\Behavioral Patterns\Chain of Responsibility Pattern\Example1\ChainOfResponsibilityExample1.cs" /> <Compile Include="Assets\Behavioral Patterns\Chain of Responsibility Pattern\Example2\ChainOfResponsibilityExample2.cs" /> <Compile Include="Assets\Behavioral Patterns\Chain of Responsibility Pattern\Structure\ChainOfResponsibilityStructure.cs" /> <Compile Include="Assets\Behavioral Patterns\Command Pattern\Example1\CommandExample1.cs" /> <Compile Include="Assets\Behavioral Patterns\Command Pattern\Example2\DeviceButton.cs" /> <Compile Include="Assets\Behavioral Patterns\Command Pattern\Example2\ICommand.cs" /> <Compile Include="Assets\Behavioral Patterns\Command Pattern\Example2\IElectronicDevice.cs" /> <Compile Include="Assets\Behavioral Patterns\Command Pattern\Example2\Radio.cs" /> <Compile Include="Assets\Behavioral Patterns\Command Pattern\Example2\TVRemove.cs" /> <Compile Include="Assets\Behavioral Patterns\Command Pattern\Example2\Television.cs" /> <Compile Include="Assets\Behavioral Patterns\Command Pattern\Example2\TestCommandPattern.cs" /> <Compile Include="Assets\Behavioral Patterns\Command Pattern\Example2\TurnItAllOff.cs" /> <Compile Include="Assets\Behavioral Patterns\Command Pattern\Example2\TurnTVOff.cs" /> <Compile Include="Assets\Behavioral Patterns\Command Pattern\Example2\TurnTVOn.cs" /> <Compile Include="Assets\Behavioral Patterns\Command Pattern\Example2\TurnVolumeDown.cs" /> <Compile Include="Assets\Behavioral Patterns\Command Pattern\Example2\TurnVolumeUp.cs" /> <Compile Include="Assets\Behavioral Patterns\Command Pattern\Example3\Command.cs" /> <Compile Include="Assets\Behavioral Patterns\Command Pattern\Example3\InputHandler.cs" /> <Compile Include="Assets\Behavioral Patterns\Command Pattern\Example3\MoveCommand.cs" /> <Compile Include="Assets\Behavioral Patterns\Command Pattern\Example3\MoveCommandReceiver.cs" /> <Compile Include="Assets\Behavioral Patterns\Command Pattern\Structure\CommandStructure.cs" /> <Compile Include="Assets\Behavioral Patterns\Interpreter Pattern\Example1\InterpreterExample1.cs" /> <Compile Include="Assets\Behavioral Patterns\Interpreter Pattern\Structure\InterpreterStructrue.cs" /> <Compile Include="Assets\Behavioral Patterns\Iterator Pattern\Example1\IteratorExample1.cs" /> <Compile Include="Assets\Behavioral Patterns\Iterator Pattern\Structure\IteratorStructure.cs" /> <Compile Include="Assets\Behavioral Patterns\Mediator Pattern\Example1\MediatorExample1.cs" /> <Compile Include="Assets\Behavioral Patterns\Mediator Pattern\Structure\MediatorStructure.cs" /> <Compile Include="Assets\Behavioral Patterns\Memento Pattern\Example1\MementoExample1.cs" /> <Compile Include="Assets\Behavioral Patterns\Memento Pattern\Structure\MementoStructure.cs" /> <Compile Include="Assets\Behavioral Patterns\Observer Pattern\Example1\ObserverExample1.cs" /> <Compile Include="Assets\Behavioral Patterns\Observer Pattern\Structure\ObserverStructure.cs" /> <Compile Include="Assets\Behavioral Patterns\State Pattern\Exmaple1\StateExample1.cs" /> <Compile Include="Assets\Behavioral Patterns\State Pattern\Exmaple2\StateExmaple2.cs" /> <Compile Include="Assets\Behavioral Patterns\State Pattern\Exmaple3\ATMMachine.cs" /> <Compile Include="Assets\Behavioral Patterns\State Pattern\Exmaple3\ATMState.cs" /> <Compile Include="Assets\Behavioral Patterns\State Pattern\Exmaple3\HasCard.cs" /> <Compile Include="Assets\Behavioral Patterns\State Pattern\Exmaple3\HasPin.cs" /> <Compile Include="Assets\Behavioral Patterns\State Pattern\Exmaple3\NoCard.cs" /> <Compile Include="Assets\Behavioral Patterns\State Pattern\Exmaple3\NoCash.cs" /> <Compile Include="Assets\Behavioral Patterns\State Pattern\Exmaple3\TestATMMachine.cs" /> <Compile Include="Assets\Behavioral Patterns\State Pattern\Exmaple4\DrivingState.cs" /> <Compile Include="Assets\Behavioral Patterns\State Pattern\Exmaple4\DuckingState.cs" /> <Compile Include="Assets\Behavioral Patterns\State Pattern\Exmaple4\Heroine.cs" /> <Compile Include="Assets\Behavioral Patterns\State Pattern\Exmaple4\HeroineBaseState.cs" /> <Compile Include="Assets\Behavioral Patterns\State Pattern\Exmaple4\JumpingState.cs" /> <Compile Include="Assets\Behavioral Patterns\State Pattern\Exmaple4\StandingState.cs" /> <Compile Include="Assets\Behavioral Patterns\State Pattern\Exmaple4\TestHeroine.cs" /> <Compile Include="Assets\Behavioral Patterns\State Pattern\Structure\StateStructure.cs" /> <Compile Include="Assets\Behavioral Patterns\Strategy Pattern\Exmaple1\StrategyPatternExample1.cs" /> <Compile Include="Assets\Behavioral Patterns\Strategy Pattern\Structure\StrategyStructure.cs" /> <Compile Include="Assets\Behavioral Patterns\Template Method Pattern\Exmaple1\TemplateMethodPatternExample1.cs" /> <Compile Include="Assets\Behavioral Patterns\Template Method Pattern\Structure\TemplateMethodStructure.cs" /> <Compile Include="Assets\Behavioral Patterns\Visitor Pattern\Exmaple1\VisitorPatternExample1.cs" /> <Compile Include="Assets\Behavioral Patterns\Visitor Pattern\Structure\VisitorStructure.cs" /> <Compile Include="Assets\Creational Patterns\Abstract Factory Pattern\Example1\AbstractFactoryPatternExample1.cs" /> <Compile Include="Assets\Creational Patterns\Abstract Factory Pattern\Structure\AbstractFactoryStructrue.cs" /> <Compile Include="Assets\Creational Patterns\Builder Pattern\Example1\BuilderPatternExample1.cs" /> <Compile Include="Assets\Creational Patterns\Builder Pattern\Structure\BuilderStructure.cs" /> <Compile Include="Assets\Creational Patterns\Factory Method Pattern\Example1\FactoryMethodPatternExample1.cs" /> <Compile Include="Assets\Creational Patterns\Factory Method Pattern\Structure\FactoryMethodStructure.cs" /> <Compile Include="Assets\Creational Patterns\Prototype Pattern\Example1\PrototypePatternExample1.cs" /> <Compile Include="Assets\Creational Patterns\Prototype Pattern\Structure\PrototypeStructure.cs" /> <Compile Include="Assets\Creational Patterns\Singleton Pattern\Example1\SingletonPatternExample1.cs" /> <Compile Include="Assets\Creational Patterns\Singleton Pattern\Structure\SingletonStructure.cs" /> <Compile Include="Assets\Game Programming Patterns\SubclassSandbox Pattern\example\FlashSpeed.cs" /> <Compile Include="Assets\Game Programming Patterns\SubclassSandbox Pattern\example\GroundDive.cs" /> <Compile Include="Assets\Game Programming Patterns\SubclassSandbox Pattern\example\SkyLaunch.cs" /> <Compile Include="Assets\Game Programming Patterns\SubclassSandbox Pattern\example\SuperPower.cs" /> <Compile Include="Assets\Game Programming Patterns\SubclassSandbox Pattern\example\TestSubclassSandbox.cs" /> <Compile Include="Assets\Structural Patterns\Adapter Pattern\Exmaple1\AdapterPatternExample1.cs" /> <Compile Include="Assets\Structural Patterns\Adapter Pattern\Structure\AdapterStructure.cs" /> <Compile Include="Assets\Structural Patterns\Bridge Pattern\Exmaple1\BridgePatternExample1.cs" /> <Compile Include="Assets\Structural Patterns\Bridge Pattern\Structure\BridgeStructure.cs" /> <Compile Include="Assets\Structural Patterns\Composite Pattern\Exmaple1\CompositePatternExample1.cs" /> <Compile Include="Assets\Structural Patterns\Composite Pattern\Structure\CompositeStructure.cs" /> <Compile Include="Assets\Structural Patterns\Decorator Pattern\Exmaple1\DecoratorPatternExample1.cs" /> <Compile Include="Assets\Structural Patterns\Decorator Pattern\Structure\DecoratorStructure.cs" /> <Compile Include="Assets\Structural Patterns\Facade Pattern\Exmaple1\FacadePatternExample1.cs" /> <Compile Include="Assets\Structural Patterns\Facade Pattern\Structure\FacadeStructure.cs" /> <Compile Include="Assets\Structural Patterns\Flyweight Pattern\Exmaple1\FlyweightPatternExample1.cs" /> <Compile Include="Assets\Structural Patterns\Flyweight Pattern\Structure\FlyweightStructure.cs" /> <Compile Include="Assets\Structural Patterns\Proxy Pattern\Exmaple1\ProxyPatternExample1.cs" /> <Compile Include="Assets\Structural Patterns\Proxy Pattern\Structure\ProxyStructure.cs" /> </ItemGroup> <Import Project="$(MSBuildExtensionsPath)\SyntaxTree\UnityVS\2015\UnityVS.CSharp.targets" /> </Project> ```
/content/code_sandbox/Unity-Design-Pattern.CSharp.csproj
xml
2016-10-11T04:26:01
2024-08-16T05:01:31
Unity-Design-Pattern
QianMo/Unity-Design-Pattern
4,141
3,557
```xml import { Component, OnInit } from '@angular/core'; @Component({ selector: 'app-footer', templateUrl: './footer.component.html', styleUrls: ['./footer.component.scss'] }) export class FooterComponent implements OnInit { constructor() { } ngOnInit(): void { } } ```
/content/code_sandbox/projects/docs-app/src/app/layout/footer/footer.component.ts
xml
2016-03-10T21:29:15
2024-08-15T07:07:30
angular-tree-component
CirclonGroup/angular-tree-component
1,093
58
```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> <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorAccent</item> <item name="colorControlHighlight">@android:color/darker_gray</item> <item name="android:textColor">@color/text_color</item> </style> <style name="AppTheme.Main"/> <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar"/> <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light"/> </resources> ```
/content/code_sandbox/supportSample/src/main/res/values/styles.xml
xml
2016-08-03T15:43:34
2024-08-14T01:11:22
SwipeRecyclerView
yanzhenjie/SwipeRecyclerView
5,605
202
```xml import { processFiles } from './processFiles'; const ARGS = require('minimist')(process.argv.slice(2)); const SRC = ARGS.src; const BUILD_TYPE = process.env.BUILD_TYPE; try { processFiles(SRC, { regexp: /<%=\s*BUILD_TYPE\s*%>/g, replace: BUILD_TYPE }); } catch (e) { console.error(e); } ```
/content/code_sandbox/build/vars.ts
xml
2016-02-10T17:22:40
2024-08-14T16:41:28
codelyzer
mgechev/codelyzer
2,446
88
```xml import type { LexicalNode } from 'lexical' import { CustomListNode } from './CustomListNode' export function $isCustomListNode(node: LexicalNode | null | undefined): node is CustomListNode { return node instanceof CustomListNode } ```
/content/code_sandbox/applications/docs-editor/src/app/Plugins/CustomList/$isCustomListNode.ts
xml
2016-06-08T11:16:51
2024-08-16T14:14:27
WebClients
ProtonMail/WebClients
4,300
51
```xml import resolvers from './resolvers'; import typeDefs from './typeDefs'; const mod = { resolvers, typeDefs, }; export default mod; ```
/content/code_sandbox/packages/plugin-insight-api/src/graphql/index.ts
xml
2016-11-11T06:54:50
2024-08-16T10:26:06
erxes
erxes/erxes
3,479
34
```xml <test> <query>SELECT arrayFold((acc, x) -> acc + x, range(number % 100), toUInt64(0)) from numbers(100000) Format Null</query> <query>SELECT arrayFold((acc, x) -> acc + 1, range(number % 100), toUInt64(0)) from numbers(100000) Format Null</query> <query>SELECT arrayFold((acc, x) -> acc + x, range(number), toUInt64(0)) from numbers(10000) Format Null</query> </test> ```
/content/code_sandbox/tests/performance/array_fold.xml
xml
2016-06-02T08:28:18
2024-08-16T18:39:33
ClickHouse
ClickHouse/ClickHouse
36,234
125
```xml /** * @license * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ import {MDCComponent} from '@material/base/component'; import {MDCTabIndicatorAdapter} from './adapter'; import {MDCFadingTabIndicatorFoundation} from './fading-foundation'; import {MDCTabIndicatorFoundation} from './foundation'; import {MDCSlidingTabIndicatorFoundation} from './sliding-foundation'; /** MDC Tab Indicator Factory */ export type MDCTabIndicatorFactory = (el: HTMLElement, foundation?: MDCTabIndicatorFoundation) => MDCTabIndicator; /** MDC Tab Indicator */ export class MDCTabIndicator extends MDCComponent<MDCTabIndicatorFoundation> { static override attachTo(root: HTMLElement): MDCTabIndicator { return new MDCTabIndicator(root); } private content!: HTMLElement; // assigned in initialize() override initialize() { this.content = this.root.querySelector<HTMLElement>( MDCTabIndicatorFoundation.strings.CONTENT_SELECTOR)!; } computeContentClientRect(): DOMRect { return this.foundation.computeContentClientRect(); } override getDefaultFoundation() { // DO NOT INLINE this variable. For backward compatibility, foundations take // a Partial<MDCFooAdapter>. To ensure we don't accidentally omit any // methods, we need a separate, strongly typed adapter variable. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. const adapter: MDCTabIndicatorAdapter = { addClass: (className) => { this.root.classList.add(className); }, removeClass: (className) => { this.root.classList.remove(className); }, computeContentClientRect: () => this.content.getBoundingClientRect(), setContentStyleProperty: (prop, value) => { this.content.style.setProperty(prop, value); }, }; // tslint:enable:object-literal-sort-keys if (this.root.classList.contains( MDCTabIndicatorFoundation.cssClasses.FADE)) { return new MDCFadingTabIndicatorFoundation(adapter); } // Default to the sliding indicator return new MDCSlidingTabIndicatorFoundation(adapter); } activate(previousIndicatorClientRect?: DOMRect) { this.foundation.activate(previousIndicatorClientRect); } deactivate() { this.foundation.deactivate(); } } ```
/content/code_sandbox/packages/mdc-tab-indicator/component.ts
xml
2016-12-05T16:04:09
2024-08-16T15:42:22
material-components-web
material-components/material-components-web
17,119
697
```xml import { Injectable } from '@angular/core'; import { messages } from './messages'; import { botReplies, gifsLinks, imageLinks } from './bot-replies'; @Injectable() export class ChatService { loadMessages() { return messages; } loadBotReplies() { return botReplies; } reply(message: string) { const botReply: any = this.loadBotReplies() .find((reply: any) => message.search(reply.regExp) !== -1); if (botReply.reply.type === 'quote') { botReply.reply.quote = message; } if (botReply.type === 'gif') { botReply.reply.files[0].url = gifsLinks[Math.floor(Math.random() * gifsLinks.length)]; } if (botReply.type === 'pic') { botReply.reply.files[0].url = imageLinks[Math.floor(Math.random() * imageLinks.length)]; } if (botReply.type === 'group') { botReply.reply.files[1].url = gifsLinks[Math.floor(Math.random() * gifsLinks.length)]; botReply.reply.files[2].url = imageLinks[Math.floor(Math.random() * imageLinks.length)]; } botReply.reply.text = botReply.answerArray[Math.floor(Math.random() * botReply.answerArray.length)]; return { ...botReply.reply }; } } ```
/content/code_sandbox/src/app/pages/extra-components/chat/chat.service.ts
xml
2016-05-25T10:09:03
2024-08-16T16:34:03
ngx-admin
akveo/ngx-admin
25,169
291
```xml import { memo } from 'react'; import { c } from 'ttag'; import { isEmailNotification } from '@proton/shared/lib/calendar/alarms'; import getNotificationString from '@proton/shared/lib/calendar/alarms/getNotificationString'; import type { NotificationModel } from '@proton/shared/lib/interfaces/calendar'; interface Props { notification: NotificationModel; formatTime: (date: Date) => string; } const PopoverNotification = memo(function PopoverNotificationComponent({ notification, formatTime }: Props) { const str = getNotificationString(notification, formatTime); // translator: the leading string for this can be something like "minutes before" or "at time of event". The UI for an email notification looks like [15] [minutes before by email] const notificationSuffix = c('Notification suffix').t`by email`; return ( <div> {str} {isEmailNotification(notification) ? notificationSuffix : ''} </div> ); }); export default PopoverNotification; ```
/content/code_sandbox/applications/calendar/src/app/components/events/PopoverNotification.tsx
xml
2016-06-08T11:16:51
2024-08-16T14:14:27
WebClients
ProtonMail/WebClients
4,300
213
```xml import { PropertyType } from 'shared/models/Filters'; import { IFilterRootState, IFilterState } from './types'; const selectState = (state: IFilterRootState): IFilterState => state.filters; export const selectCurrentContextAppliedFilters = (state: IFilterRootState) => { return selectCurrentContextFilters(state); }; export const selectContextFilters = (state: IFilterRootState, name: string) => { const context = selectContextDataByName(state, name); return context ? context.filters : []; }; export const selectCurrentContextFilters = (state: IFilterRootState) => { const context = selectCurrentContextData(state); return context ? context.filters : []; }; export const selectCurrentContextName = (state: IFilterRootState) => selectState(state).data.currentContextName; export const selectCurrentContextData = (state: IFilterRootState) => { const currentContextName = selectCurrentContextName(state); return currentContextName ? selectContextsData(state)[currentContextName] : undefined; }; export const selectContextDataByName = ( state: IFilterRootState, name: string ) => selectContextsData(state)[name]; export const selectContextsData = (state: IFilterRootState) => selectState(state).data.contexts; export const hasContext = (state: IFilterRootState, name: string) => Boolean(selectContextDataByName(state, name)); export const selectCurrentContextFiltersByType = ( state: IFilterRootState, type: PropertyType ) => { const context = selectCurrentContextData(state); return context ? context.filters.filter(filter => filter.type === type) : []; }; ```
/content/code_sandbox/webapp/client/src/features/filter/store/selectors.ts
xml
2016-10-19T01:07:26
2024-08-14T03:53:55
modeldb
VertaAI/modeldb
1,689
367
```xml import FormControl from '../form/Control'; import { __ } from '../../utils/core'; import React from 'react'; type Props = { placeholder?: string; onChange: (e) => void; }; function Filter({ placeholder = 'Search', onChange }: Props) { return ( <FormControl type="text" placeholder={__(placeholder)} onChange={onChange} autoFocus={true} /> ); } export default Filter; ```
/content/code_sandbox/packages/erxes-ui/src/components/filterableList/Filter.tsx
xml
2016-11-11T06:54:50
2024-08-16T10:26:06
erxes
erxes/erxes
3,479
93
```xml import { isNil } from '../util' export class MapFS { constructor (private mapping: {[key: string]: string}) {} public sep = '/' async exists (filepath: string) { return this.existsSync(filepath) } existsSync (filepath: string) { return !isNil(this.mapping[filepath]) } async readFile (filepath: string) { return this.readFileSync(filepath) } readFileSync (filepath: string) { const content = this.mapping[filepath] if (isNil(content)) throw new Error(`ENOENT: ${filepath}`) return content } dirname (filepath: string) { const segments = filepath.split(this.sep) segments.pop() return segments.join(this.sep) } resolve (dir: string, file: string, ext: string) { file += ext if (dir === '.') return file const segments = dir.split(/\/+/) for (const segment of file.split(this.sep)) { if (segment === '.' || segment === '') continue else if (segment === '..') { if (segments.length > 1 || segments[0] !== '') segments.pop() } else segments.push(segment) } return segments.join(this.sep) } } ```
/content/code_sandbox/src/fs/map-fs.ts
xml
2016-06-13T07:39:30
2024-08-16T16:56:50
liquidjs
harttle/liquidjs
1,485
271
```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 /** * Returns the median of a Bernoulli distribution. * * ## Notes * * - If `p < 0` or `p > 1`, the function returns `NaN`. * * @param p - success probability * @returns median * * @example * var v = median( 0.1 ); * // returns 0 * * @example * var v = median( 0.8 ); * // returns 1 * * @example * var v = median( 1.1 ); * // returns NaN * * @example * var v = median( NaN ); * // returns NaN */ declare function median( p: number ): number; // EXPORTS // export = median; ```
/content/code_sandbox/lib/node_modules/@stdlib/stats/base/dists/bernoulli/median/docs/types/index.d.ts
xml
2016-03-24T04:19:52
2024-08-16T09:03:19
stdlib
stdlib-js/stdlib
4,266
216
```xml import { createInjector } from 'typed-inject'; import { RestClient } from 'typed-rest-client'; import { execaCommand } from 'execa'; import { resolveFromCwd } from '@stryker-mutator/util'; import { LogLevel } from '@stryker-mutator/api/core'; import { coreTokens, provideLogger } from '../di/index.js'; import { LogConfigurator } from '../logging/log-configurator.js'; import * as initializerTokens from './initializer-tokens.js'; import { NpmClient } from './npm-client.js'; import { StrykerConfigWriter } from './stryker-config-writer.js'; import { StrykerInitializer } from './stryker-initializer.js'; import { StrykerInquirer } from './stryker-inquirer.js'; import { createInitializers } from './custom-initializers/index.js'; import { GitignoreWriter } from './gitignore-writer.js'; const NPM_REGISTRY = 'path_to_url export function initializerFactory(): StrykerInitializer { LogConfigurator.configureMainProcess(LogLevel.Information); return provideLogger(createInjector()) .provideValue(initializerTokens.out, console.log) .provideValue(initializerTokens.restClientNpm, new RestClient('npm', NPM_REGISTRY)) .provideClass(initializerTokens.npmClient, NpmClient) .provideClass(initializerTokens.configWriter, StrykerConfigWriter) .provideClass(initializerTokens.gitignoreWriter, GitignoreWriter) .provideClass(initializerTokens.inquirer, StrykerInquirer) .provideValue(coreTokens.execa, execaCommand) .provideValue(coreTokens.resolveFromCwd, resolveFromCwd) .provideFactory(initializerTokens.customInitializers, createInitializers) .injectClass(StrykerInitializer); } export { initializerTokens }; ```
/content/code_sandbox/packages/core/src/initializer/index.ts
xml
2016-02-12T13:14:28
2024-08-15T18:38:25
stryker-js
stryker-mutator/stryker-js
2,561
382
```xml import { DtoError } from './dto_error'; export interface MailScheduleRecord { scheduleName: string; success: boolean; duration: number; runResults: MailRunResult[]; } export interface MailRunResult { recordName: string; parameter: string; envName: string; tests: { [key: string]: boolean }; duration: number; error?: DtoError; isSuccess: boolean; } ```
/content/code_sandbox/client/src/common/interfaces/dto_mail.ts
xml
2016-09-26T02:47:43
2024-07-24T09:32:20
Hitchhiker
brookshi/Hitchhiker
2,193
95
```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>15D21</string> <key>CFBundleExecutable</key> <string>BrcmFirmwareRepo</string> <key>CFBundleIdentifier</key> <string>com.no-one.BrcmFirmwareStore</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleName</key> <string>BrcmFirmwareRepo</string> <key>CFBundlePackageType</key> <string>KEXT</string> <key>CFBundleShortVersionString</key> <string>2.2.3</string> <key>CFBundleSignature</key> <string>????</string> <key>CFBundleSupportedPlatforms</key> <array> <string>MacOSX</string> </array> <key>CFBundleVersion</key> <string>2.2.3</string> <key>DTCompiler</key> <string>com.apple.compilers.llvm.clang.1_0</string> <key>DTPlatformBuild</key> <string>7C68</string> <key>DTPlatformVersion</key> <string>GM</string> <key>DTSDKBuild</key> <string>10M2518</string> <key>DTSDKName</key> <string>macosx10.6</string> <key>DTXcode</key> <string>0720</string> <key>DTXcodeBuild</key> <string>7C68</string> <key>IOKitPersonalities</key> <dict> <key>BrcmFirmwareStore</key> <dict> <key>CFBundleIdentifier</key> <string>com.no-one.BrcmFirmwareStore</string> <key>IOClass</key> <string>BrcmFirmwareStore</string> <key>IOMatchCategory</key> <string>BrcmFirmwareStore</string> <key>IOProviderClass</key> <string>disabled_IOResources</string> </dict> </dict> <key>OSBundleCompatibleVersion</key> <string>2.2.3</string> <key>OSBundleLibraries</key> <dict> <key>com.apple.kpi.iokit</key> <string>9.0</string> <key>com.apple.kpi.libkern</key> <string>9.0</string> <key>com.apple.kpi.mach</key> <string>9.0</string> </dict> <key>Source Code</key> <string>path_to_url </dict> </plist> ```
/content/code_sandbox/Clover-Configs/Dell/Dell XPS 13 9350/CLOVER/kexts/10.11/BrcmFirmwareRepo.kext/Contents/Info.plist
xml
2016-11-05T04:22:54
2024-08-12T19:25:53
Hackintosh-Installer-University
huangyz0918/Hackintosh-Installer-University
3,937
680
```xml import './parent.js'; import type { Selector } from '../shared/helper.js'; declare module '../shared/core.js' { // eslint-disable-next-line @typescript-eslint/no-unused-vars interface JQ<T = HTMLElement> { /** * * @param selector CSS * @example ```js // span $('span').parents() ``` * @example ```js // span p $('span').parents('p'); ``` */ parents(selector?: Selector): this; } } ```
/content/code_sandbox/packages/jq/src/methods/parents.ts
xml
2016-07-11T17:39:02
2024-08-16T07:12:34
mdui
zdhxiong/mdui
4,077
114
```xml import DateSelect from './DateSelect'; export type { DateSelectProps } from './DateSelect'; export default DateSelect; ```
/content/code_sandbox/packages/zarm/src/date-select/index.tsx
xml
2016-07-13T11:45:37
2024-08-12T19:23:48
zarm
ZhongAnTech/zarm
1,707
26
```xml import { BooleanInput, coerceBooleanProperty } from "@angular/cdk/coercion"; import { CommonModule } from "@angular/common"; import { Component, Input, Signal, inject } from "@angular/core"; import { JslibModule } from "@bitwarden/angular/jslib.module"; import { AsyncActionsModule, FunctionReturningAwaitable, IconButtonModule, TypographyModule, } from "@bitwarden/components"; import { PopupRouterCacheService } from "../view-cache/popup-router-cache.service"; import { PopupPageComponent } from "./popup-page.component"; @Component({ selector: "popup-header", templateUrl: "popup-header.component.html", standalone: true, imports: [TypographyModule, CommonModule, IconButtonModule, JslibModule, AsyncActionsModule], }) export class PopupHeaderComponent { private popupRouterCacheService = inject(PopupRouterCacheService); protected pageContentScrolled: Signal<boolean> = inject(PopupPageComponent).isScrolled; /** Background color */ @Input() background: "default" | "alt" = "default"; /** Display the back button, which uses Location.back() to go back one page in history */ @Input() get showBackButton() { return this._showBackButton; } set showBackButton(value: BooleanInput) { this._showBackButton = coerceBooleanProperty(value); } private _showBackButton = false; /** Title string that will be inserted as an h1 */ @Input({ required: true }) pageTitle: string; /** * Async action that occurs when clicking the back button * * If unset, will call `location.back()` **/ @Input() backAction: FunctionReturningAwaitable = async () => { return this.popupRouterCacheService.back(); }; } ```
/content/code_sandbox/apps/browser/src/platform/popup/layout/popup-header.component.ts
xml
2016-03-09T23:14:01
2024-08-16T15:07:51
clients
bitwarden/clients
8,877
384
```xml import { setHeader } from 'h3' export default defineNuxtPlugin({ name: 'server-only-plugin', setup () { const evt = useRequestEvent() if (evt) { setHeader(evt, 'custom-head', 'hello') } }, env: { islands: false, }, }) ```
/content/code_sandbox/test/fixtures/basic/plugins/server-only.server.ts
xml
2016-10-26T11:18:47
2024-08-16T19:32:46
nuxt
nuxt/nuxt
53,705
72
```xml export function normalizedAssetPrefix(assetPrefix: string | undefined): string { // remove all leading slashes and trailing slashes const escapedAssetPrefix = assetPrefix?.replace(/^\/+|\/+$/g, '') || false // if an assetPrefix was '/', we return empty string // because it could be an unnecessary trailing slash if (!escapedAssetPrefix) { return '' } if (URL.canParse(escapedAssetPrefix)) { const url = new URL(escapedAssetPrefix).toString() return url.endsWith('/') ? url.slice(0, -1) : url } // assuming assetPrefix here is a pathname-style, // restore the leading slash return `/${escapedAssetPrefix}` } ```
/content/code_sandbox/packages/next/src/shared/lib/normalized-asset-prefix.ts
xml
2016-10-05T23:32:51
2024-08-16T19:44:30
next.js
vercel/next.js
124,056
156
```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. */ export * as dataStructures from './data_structures'; export * as jobHandlers from './job_handlers'; export * as objects from './objects'; export * as math from './math'; ```
/content/code_sandbox/elements/lisk-utils/src/index.ts
xml
2016-02-01T21:45:35
2024-08-15T19:16:48
lisk-sdk
LiskArchive/lisk-sdk
2,721
124
```xml import { ProfileThreePage } from './profile-three'; import { NgModule } from '@angular/core'; import { IonicPageModule } from 'ionic-angular'; @NgModule({ declarations: [ ProfileThreePage, ], imports: [ IonicPageModule.forChild(ProfileThreePage), ], exports: [ ProfileThreePage ] }) export class ProfileThreePageModule { } ```
/content/code_sandbox/src/pages/profile/profile-three/profile-three.module.ts
xml
2016-11-04T05:48:23
2024-08-03T05:22:54
ionic3-components
yannbf/ionic3-components
1,679
78
```xml <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" xmlns="path_to_url"> <ItemGroup> <Filter Include="Source Files"> <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> </Filter> <Filter Include="Header Files"> <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions> </Filter> <Filter Include="Resource Files"> <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> </Filter> </ItemGroup> <ItemGroup> <ClCompile Include="PrintListInReversedOrder.cpp"> <Filter>Source Files</Filter> </ClCompile> </ItemGroup> </Project> ```
/content/code_sandbox/06_PrintListInReversedOrder/06_PrintListInReversedOrder.vcxproj.filters
xml
2016-11-21T05:04:57
2024-08-14T04:03:23
CodingInterviewChinese2
zhedahht/CodingInterviewChinese2
5,289
313
```xml import { animate, state, style, transition, trigger } from '@angular/animations'; import { CommonModule } from '@angular/common'; import { AfterContentInit, ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChildren, ElementRef, EventEmitter, Inject, Input, NgModule, OnChanges, Output, QueryList, SimpleChanges, TemplateRef, ViewChild, ViewEncapsulation, booleanAttribute, computed, forwardRef, numberAttribute, signal } from '@angular/core'; import { RouterModule } from '@angular/router'; import { MenuItem, PrimeTemplate, SharedModule } from 'primeng/api'; import { DomHandler } from 'primeng/dom'; import { AngleDownIcon } from 'primeng/icons/angledown'; import { AngleRightIcon } from 'primeng/icons/angleright'; import { ChevronDownIcon } from 'primeng/icons/chevrondown'; import { ChevronRightIcon } from 'primeng/icons/chevronright'; import { TooltipModule } from 'primeng/tooltip'; import { ObjectUtils, UniqueComponentId } from 'primeng/utils'; @Component({ selector: 'p-panelMenuSub', template: ` <ul #list [ngClass]="{ 'p-submenu-list': true, 'p-panelmenu-root-list': root }" role="tree" [tabindex]="-1" [attr.aria-activedescendant]="focusedItemId" [attr.data-pc-section]="'menu'" [attr.aria-hidden]="!parentExpanded" (focusin)="menuFocus.emit($event)" (focusout)="menuBlur.emit($event)" (keydown)="menuKeyDown.emit($event)" > <ng-template ngFor let-processedItem let-index="index" [ngForOf]="items"> <li *ngIf="processedItem.separator" class="p-menuitem-separator" role="separator"></li> <li *ngIf="!processedItem.separator && isItemVisible(processedItem)" [ngClass]="getItemClass(processedItem)" role="treeitem" [attr.id]="getItemId(processedItem)" [attr.aria-label]="getItemProp(processedItem, 'label')" [attr.aria-expanded]="isItemGroup(processedItem) ? isItemActive(processedItem) : undefined" [attr.aria-level]="level + 1" [attr.aria-setsize]="getAriaSetSize()" [attr.aria-posinset]="getAriaPosInset(index)" [class]="getItemProp(processedItem, 'styleClass')" [class.p-hidden]="processedItem.visible === false" [class.p-focus]="isItemFocused(processedItem) && !isItemDisabled(processedItem)" [ngStyle]="getItemProp(processedItem, 'style')" [pTooltip]="getItemProp(processedItem, 'tooltip')" [attr.data-p-disabled]="isItemDisabled(processedItem)" [tooltipOptions]="getItemProp(processedItem, 'tooltipOptions')" > <div class="p-menuitem-content" (click)="onItemClick($event, processedItem)"> <ng-container *ngIf="!itemTemplate"> <a *ngIf="!getItemProp(processedItem, 'routerLink')" [attr.href]="getItemProp(processedItem, 'url')" class="p-menuitem-link" [ngClass]="{ 'p-disabled': getItemProp(processedItem, 'disabled') }" [target]="getItemProp(processedItem, 'target')" [attr.data-pc-section]="'action'" [attr.tabindex]="!!parentExpanded ? '0' : '-1'" > <ng-container *ngIf="isItemGroup(processedItem)"> <ng-container *ngIf="!panelMenu.submenuIconTemplate"> <AngleDownIcon [styleClass]="'p-submenu-icon'" *ngIf="isItemActive(processedItem)" [ngStyle]="getItemProp(processedItem, 'iconStyle')" /> <AngleRightIcon [styleClass]="'p-submenu-icon'" *ngIf="!isItemActive(processedItem)" [ngStyle]="getItemProp(processedItem, 'iconStyle')" /> </ng-container> <ng-template *ngTemplateOutlet="panelMenu.submenuIconTemplate"></ng-template> </ng-container> <span class="p-menuitem-icon" [ngClass]="processedItem.icon" *ngIf="processedItem.icon" [ngStyle]="getItemProp(processedItem, 'iconStyle')"></span> <span class="p-menuitem-text" *ngIf="processedItem.item?.escape !== false; else htmlLabel">{{ getItemProp(processedItem, 'label') }}</span> <ng-template #htmlLabel><span class="p-menuitem-text" [innerHTML]="getItemProp(processedItem, 'label')"></span></ng-template> <span class="p-menuitem-badge" *ngIf="processedItem.badge" [ngClass]="processedItem.badgeStyleClass">{{ processedItem.badge }}</span> </a> <a *ngIf="getItemProp(processedItem, 'routerLink')" [routerLink]="getItemProp(processedItem, 'routerLink')" [queryParams]="getItemProp(processedItem, 'queryParams')" [routerLinkActive]="'p-menuitem-link-active'" [routerLinkActiveOptions]="getItemProp(processedItem, 'routerLinkActiveOptions') || { exact: false }" class="p-menuitem-link" [ngClass]="{ 'p-disabled': getItemProp(processedItem, 'disabled') }" [target]="getItemProp(processedItem, 'target')" [attr.title]="getItemProp(processedItem, 'title')" [fragment]="getItemProp(processedItem, 'fragment')" [queryParamsHandling]="getItemProp(processedItem, 'queryParamsHandling')" [preserveFragment]="getItemProp(processedItem, 'preserveFragment')" [skipLocationChange]="getItemProp(processedItem, 'skipLocationChange')" [replaceUrl]="getItemProp(processedItem, 'replaceUrl')" [state]="getItemProp(processedItem, 'state')" [attr.data-pc-section]="'action'" [attr.tabindex]="!!parentExpanded ? '0' : '-1'" > <ng-container *ngIf="isItemGroup(processedItem)"> <ng-container *ngIf="!panelMenu.submenuIconTemplate"> <AngleDownIcon *ngIf="isItemActive(processedItem)" [styleClass]="'p-submenu-icon'" [ngStyle]="getItemProp(processedItem, 'iconStyle')" /> <AngleRightIcon *ngIf="!isItemActive(processedItem)" [styleClass]="'p-submenu-icon'" [ngStyle]="getItemProp(processedItem, 'iconStyle')" /> </ng-container> <ng-template *ngTemplateOutlet="panelMenu.submenuIconTemplate"></ng-template> </ng-container> <span class="p-menuitem-icon" [ngClass]="processedItem.icon" *ngIf="processedItem.icon" [ngStyle]="getItemProp(processedItem, 'iconStyle')"></span> <span class="p-menuitem-text" *ngIf="getItemProp(processedItem, 'escape') !== false; else htmlRouteLabel">{{ getItemProp(processedItem, 'label') }}</span> <ng-template #htmlRouteLabel><span class="p-menuitem-text" [innerHTML]="getItemProp(processedItem, 'label')"></span></ng-template> <span class="p-menuitem-badge" *ngIf="processedItem.badge" [ngClass]="getItemProp(processedItem, 'badgeStyleClass')">{{ getItemProp(processedItem, 'badge') }}</span> </a> </ng-container> <ng-container *ngIf="itemTemplate"> <ng-template *ngTemplateOutlet="itemTemplate; context: { $implicit: processedItem.item }"></ng-template> </ng-container> </div> <div class="p-toggleable-content" [@submenu]="getAnimation(processedItem)"> <p-panelMenuSub *ngIf="isItemVisible(processedItem) && isItemGroup(processedItem) && isItemExpanded(processedItem)" [id]="getItemId(processedItem) + '_list'" [panelId]="panelId" [items]="processedItem?.items" [itemTemplate]="itemTemplate" [transitionOptions]="transitionOptions" [focusedItemId]="focusedItemId" [activeItemPath]="activeItemPath" [level]="level + 1" [parentExpanded]="!!parentExpanded && isItemExpanded(processedItem)" (itemToggle)="onItemToggle($event)" ></p-panelMenuSub> </div> </li> </ng-template> </ul> `, animations: [ trigger('submenu', [ state( 'hidden', style({ height: '0' }) ), state( 'visible', style({ height: '*' }) ), transition('visible <=> hidden', [animate('{{transitionParams}}')]), transition('void => *', animate(0)) ]) ], encapsulation: ViewEncapsulation.None, host: { class: 'p-element' } }) export class PanelMenuSub { @Input() panelId: string | undefined; @Input() focusedItemId: string | undefined; @Input() items: any[]; @Input() itemTemplate: HTMLElement | undefined; @Input({ transform: numberAttribute }) level: number = 0; @Input() activeItemPath: any[]; @Input({ transform: booleanAttribute }) root: boolean | undefined; @Input({ transform: numberAttribute }) tabindex: number | undefined; @Input() transitionOptions: string | undefined; @Input({ transform: booleanAttribute }) parentExpanded: boolean | undefined; @Output() itemToggle: EventEmitter<any> = new EventEmitter<any>(); @Output() menuFocus: EventEmitter<any> = new EventEmitter<any>(); @Output() menuBlur: EventEmitter<any> = new EventEmitter<any>(); @Output() menuKeyDown: EventEmitter<any> = new EventEmitter<any>(); @ViewChild('list') listViewChild: ElementRef; constructor(@Inject(forwardRef(() => PanelMenu)) public panelMenu: PanelMenu, public el: ElementRef) {} getItemId(processedItem) { return processedItem.item?.id ?? `${this.panelId}_${processedItem.key}`; } getItemKey(processedItem) { return this.getItemId(processedItem); } getItemClass(processedItem) { return { 'p-menuitem': true, 'p-disabled': this.isItemDisabled(processedItem) }; } getItemProp(processedItem, name?, params?) { return processedItem && processedItem.item ? ObjectUtils.getItemValue(processedItem.item[name], params) : undefined; } getItemLabel(processedItem) { return this.getItemProp(processedItem, 'label'); } isItemExpanded(processedItem) { return processedItem.expanded; } isItemActive(processedItem) { return this.isItemExpanded(processedItem) || this.activeItemPath.some((path) => path && path.key === processedItem.key); } isItemVisible(processedItem) { return this.getItemProp(processedItem, 'visible') !== false; } isItemDisabled(processedItem) { return this.getItemProp(processedItem, 'disabled'); } isItemFocused(processedItem) { return this.focusedItemId === this.getItemId(processedItem); } isItemGroup(processedItem) { return ObjectUtils.isNotEmpty(processedItem.items); } getAnimation(processedItem) { return this.isItemActive(processedItem) ? { value: 'visible', params: { transitionParams: this.transitionOptions, height: '*' } } : { value: 'hidden', params: { transitionParams: this.transitionOptions, height: '0' } }; } getAriaSetSize() { return this.items.filter((processedItem) => this.isItemVisible(processedItem) && !this.getItemProp(processedItem, 'separator')).length; } getAriaPosInset(index) { return index - this.items.slice(0, index).filter((processedItem) => this.isItemVisible(processedItem) && this.getItemProp(processedItem, 'separator')).length + 1; } onItemClick(event, processedItem) { if (!this.isItemDisabled(processedItem)) { this.getItemProp(processedItem, 'command', { originalEvent: event, item: processedItem.item }); this.itemToggle.emit({ processedItem, expanded: !this.isItemActive(processedItem) }); } } onItemToggle(event) { this.itemToggle.emit(event); } } @Component({ selector: 'p-panelMenuList', template: ` <p-panelMenuSub #submenu [root]="true" [id]="panelId + '_list'" [panelId]="panelId" [tabindex]="tabindex" [itemTemplate]="itemTemplate" [focusedItemId]="focused ? focusedItemId : undefined" [activeItemPath]="activeItemPath()" [transitionOptions]="transitionOptions" [items]="processedItems()" [parentExpanded]="parentExpanded" (itemToggle)="onItemToggle($event)" (keydown)="onKeyDown($event)" (menuFocus)="onFocus($event)" (menuBlur)="onBlur($event)" ></p-panelMenuSub> `, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, styleUrls: ['./panelmenu.css'], host: { class: 'p-element' } }) export class PanelMenuList implements OnChanges { @Input() panelId: string | undefined; @Input() id: string | undefined; @Input() items: any[]; @Input() itemTemplate: HTMLElement | undefined; @Input({ transform: booleanAttribute }) parentExpanded: boolean | undefined; @Input({ transform: booleanAttribute }) expanded: boolean | undefined; @Input() transitionOptions: string | undefined; @Input({ transform: booleanAttribute }) root: boolean | undefined; @Input({ transform: numberAttribute }) tabindex: number | undefined; @Input() activeItem: any; @Output() itemToggle: EventEmitter<any> = new EventEmitter<any>(); @Output() headerFocus: EventEmitter<any> = new EventEmitter<any>(); @ViewChild('submenu') subMenuViewChild: PanelMenuSub; searchTimeout: any; searchValue: any; focused: boolean | undefined; focusedItem = signal<any>(null); activeItemPath = signal<any[]>([]); processedItems = signal<any[]>([]); visibleItems = computed(() => { const processedItems = this.processedItems(); return this.flatItems(processedItems); }); get focusedItemId() { const focusedItem = this.focusedItem(); return focusedItem && focusedItem.item?.id ? focusedItem.item.id : ObjectUtils.isNotEmpty(this.focusedItem()) ? `${this.panelId}_${this.focusedItem().key}` : undefined; } constructor(private el: ElementRef) {} ngOnChanges(changes: SimpleChanges) { this.processedItems.set(this.createProcessedItems(changes?.items?.currentValue || this.items || [])); } getItemProp(processedItem, name) { return processedItem && processedItem.item ? ObjectUtils.getItemValue(processedItem.item[name]) : undefined; } getItemLabel(processedItem) { return this.getItemProp(processedItem, 'label'); } isItemVisible(processedItem) { return this.getItemProp(processedItem, 'visible') !== false; } isItemDisabled(processedItem) { return this.getItemProp(processedItem, 'disabled'); } isItemActive(processedItem) { return this.activeItemPath().some((path) => path.key === processedItem.parentKey); } isItemGroup(processedItem) { return ObjectUtils.isNotEmpty(processedItem.items); } isElementInPanel(event, element) { const panel = event.currentTarget.closest('[data-pc-section="panel"]'); return panel && panel.contains(element); } isItemMatched(processedItem) { return this.isValidItem(processedItem) && this.getItemLabel(processedItem).toLocaleLowerCase().startsWith(this.searchValue.toLocaleLowerCase()); } isVisibleItem(processedItem) { return !!processedItem && (processedItem.level === 0 || this.isItemActive(processedItem)) && this.isItemVisible(processedItem); } isValidItem(processedItem) { return !!processedItem && !this.isItemDisabled(processedItem) && !processedItem.separator; } findFirstItem() { return this.visibleItems().find((processedItem) => this.isValidItem(processedItem)); } findLastItem() { return ObjectUtils.findLast(this.visibleItems(), (processedItem) => this.isValidItem(processedItem)); } findItemByEventTarget(target: EventTarget): undefined | any { let parentNode = target as ParentNode & Element; while (parentNode && parentNode.tagName?.toLowerCase() !== 'li') { parentNode = parentNode?.parentNode as Element; } return parentNode?.id && this.visibleItems().find((processedItem) => this.isValidItem(processedItem) && `${this.panelId}_${processedItem.key}` === parentNode.id); } createProcessedItems(items, level = 0, parent = {}, parentKey = '') { const processedItems = []; items && items.forEach((item, index) => { const key = (parentKey !== '' ? parentKey + '_' : '') + index; const newItem = { icon: item.icon, expanded: item.expanded, separator: item.separator, item, index, level, key, parent, parentKey }; newItem['items'] = this.createProcessedItems(item.items, level + 1, newItem, key); processedItems.push(newItem); }); return processedItems; } findProcessedItemByItemKey(key, processedItems?, level = 0) { processedItems = processedItems || this.processedItems(); if (processedItems && processedItems.length) { for (let i = 0; i < processedItems.length; i++) { const processedItem = processedItems[i]; if (this.getItemProp(processedItem, 'key') === key) return processedItem; const matchedItem = this.findProcessedItemByItemKey(key, processedItem.items, level + 1); if (matchedItem) return matchedItem; } } } flatItems(processedItems, processedFlattenItems = []) { processedItems && processedItems.forEach((processedItem) => { if (this.isVisibleItem(processedItem)) { processedFlattenItems.push(processedItem); this.flatItems(processedItem.items, processedFlattenItems); } }); return processedFlattenItems; } changeFocusedItem(event) { const { originalEvent, processedItem, focusOnNext, selfCheck, allowHeaderFocus = true } = event; if (ObjectUtils.isNotEmpty(this.focusedItem()) && this.focusedItem().key !== processedItem.key) { this.focusedItem.set(processedItem); this.scrollInView(); } else if (allowHeaderFocus) { this.headerFocus.emit({ originalEvent, focusOnNext, selfCheck }); } } scrollInView() { const element = DomHandler.findSingle(this.subMenuViewChild.listViewChild.nativeElement, `li[id="${`${this.focusedItemId}`}"]`); if (element) { element.scrollIntoView && element.scrollIntoView({ block: 'nearest', inline: 'nearest' }); } } onFocus(event) { if (!this.focused) { this.focused = true; const focusedItem = this.focusedItem() || (this.isElementInPanel(event, event.relatedTarget) ? this.findItemByEventTarget(event.target) || this.findFirstItem() : this.findLastItem()); if (event.relatedTarget !== null) this.focusedItem.set(focusedItem); } } onBlur(event) { const target = event.relatedTarget; if (this.focused && !this.el.nativeElement.contains(target)) { this.focused = false; this.focusedItem.set(null); this.searchValue = ''; } } onItemToggle(event) { const { processedItem, expanded } = event; processedItem.expanded = !processedItem.expanded; const activeItemPath = this.activeItemPath().filter((p) => p.parentKey !== processedItem.parentKey); expanded && activeItemPath.push(processedItem); this.activeItemPath.set(activeItemPath); this.processedItems.update((value) => value.map((i) => (i === processedItem ? processedItem : i))); this.focusedItem.set(processedItem); } onKeyDown(event) { const metaKey = event.metaKey || event.ctrlKey; switch (event.code) { case 'ArrowDown': this.onArrowDownKey(event); break; case 'ArrowUp': this.onArrowUpKey(event); break; case 'ArrowLeft': this.onArrowLeftKey(event); break; case 'ArrowRight': this.onArrowRightKey(event); break; case 'Home': this.onHomeKey(event); break; case 'End': this.onEndKey(event); break; case 'Space': this.onSpaceKey(event); break; case 'Enter': this.onEnterKey(event); break; case 'Escape': case 'Tab': case 'PageDown': case 'PageUp': case 'Backspace': case 'ShiftLeft': case 'ShiftRight': //NOOP break; default: if (!metaKey && ObjectUtils.isPrintableCharacter(event.key)) { this.searchItems(event, event.key); } break; } } onArrowDownKey(event) { const processedItem = ObjectUtils.isNotEmpty(this.focusedItem()) ? this.findNextItem(this.focusedItem()) : this.findFirstItem(); this.changeFocusedItem({ originalEvent: event, processedItem, focusOnNext: true }); event.preventDefault(); } onArrowUpKey(event) { const processedItem = ObjectUtils.isNotEmpty(this.focusedItem()) ? this.findPrevItem(this.focusedItem()) : this.findLastItem(); this.changeFocusedItem({ originalEvent: event, processedItem, selfCheck: true }); event.preventDefault(); } onArrowLeftKey(event) { if (ObjectUtils.isNotEmpty(this.focusedItem())) { const matched = this.activeItemPath().some((p) => p.key === this.focusedItem().key); if (matched) { const activeItemPath = this.activeItemPath().filter((p) => p.key !== this.focusedItem().key); this.activeItemPath.set(activeItemPath); } else { const focusedItem = ObjectUtils.isNotEmpty(this.focusedItem().parent) ? this.focusedItem().parent : this.focusedItem(); this.focusedItem.set(focusedItem); } event.preventDefault(); } } onArrowRightKey(event) { if (ObjectUtils.isNotEmpty(this.focusedItem())) { const grouped = this.isItemGroup(this.focusedItem()); if (grouped) { const matched = this.activeItemPath().some((p) => p.key === this.focusedItem().key); if (matched) { this.onArrowDownKey(event); } else { const activeItemPath = this.activeItemPath().filter((p) => p.parentKey !== this.focusedItem().parentKey); activeItemPath.push(this.focusedItem()); this.activeItemPath.set(activeItemPath); } } event.preventDefault(); } } onHomeKey(event) { this.changeFocusedItem({ originalEvent: event, processedItem: this.findFirstItem(), allowHeaderFocus: false }); event.preventDefault(); } onEndKey(event) { this.changeFocusedItem({ originalEvent: event, processedItem: this.findLastItem(), focusOnNext: true, allowHeaderFocus: false }); event.preventDefault(); } onEnterKey(event) { if (ObjectUtils.isNotEmpty(this.focusedItem())) { const element = DomHandler.findSingle(this.subMenuViewChild.listViewChild.nativeElement, `li[id="${`${this.focusedItemId}`}"]`); const anchorElement = element && (DomHandler.findSingle(element, '[data-pc-section="action"]') || DomHandler.findSingle(element, 'a,button')); anchorElement ? anchorElement.click() : element && element.click(); } event.preventDefault(); } onSpaceKey(event) { this.onEnterKey(event); } findNextItem(processedItem) { const index = this.visibleItems().findIndex((item) => item.key === processedItem.key); const matchedItem = index < this.visibleItems().length - 1 ? this.visibleItems() .slice(index + 1) .find((pItem) => this.isValidItem(pItem)) : undefined; return matchedItem || processedItem; } findPrevItem(processedItem) { const index = this.visibleItems().findIndex((item) => item.key === processedItem.key); const matchedItem = index > 0 ? ObjectUtils.findLast(this.visibleItems().slice(0, index), (pItem) => this.isValidItem(pItem)) : undefined; return matchedItem || processedItem; } searchItems(event, char) { this.searchValue = (this.searchValue || '') + char; let matchedItem = null; let matched = false; if (ObjectUtils.isNotEmpty(this.focusedItem())) { const focusedItemIndex = this.visibleItems().findIndex((processedItem) => processedItem.key === this.focusedItem().key); matchedItem = this.visibleItems() .slice(focusedItemIndex) .find((processedItem) => this.isItemMatched(processedItem)); matchedItem = ObjectUtils.isEmpty(matchedItem) ? this.visibleItems() .slice(0, focusedItemIndex) .find((processedItem) => this.isItemMatched(processedItem)) : matchedItem; } else { matchedItem = this.visibleItems().find((processedItem) => this.isItemMatched(processedItem)); } if (ObjectUtils.isNotEmpty(matchedItem)) { matched = true; } if (ObjectUtils.isEmpty(matchedItem) && ObjectUtils.isEmpty(this.focusedItem())) { matchedItem = this.findFirstItem(); } if (ObjectUtils.isNotEmpty(matchedItem)) { this.changeFocusedItem({ originalEvent: event, processedItem: matchedItem, allowHeaderFocus: false }); } if (this.searchTimeout) { clearTimeout(this.searchTimeout); } this.searchTimeout = setTimeout(() => { this.searchValue = ''; this.searchTimeout = null; }, 500); return matched; } } /** * PanelMenu is a hybrid of Accordion and Tree components. * @group Components */ @Component({ selector: 'p-panelMenu', template: ` <div [class]="styleClass" [ngStyle]="style" [ngClass]="'p-panelmenu p-component'" #container> <ng-container *ngFor="let item of model; let f = first; let l = last; let i = index"> <div *ngIf="isItemVisible(item)" class="p-panelmenu-panel" [ngClass]="getItemProp(item, 'headerClass')" [ngStyle]="getItemProp(item, 'style')" [attr.data-pc-section]="'panel'"> <div [ngClass]="{ 'p-component p-panelmenu-header': true, 'p-highlight': isItemActive(item), 'p-disabled': isItemDisabled(item) }" [class]="getItemProp(item, 'styleClass')" [ngStyle]="getItemProp(item, 'style')" [pTooltip]="getItemProp(item, 'tooltip')" [attr.id]="getHeaderId(item, i)" [tabindex]="0" role="button" [tooltipOptions]="getItemProp(item, 'tooltipOptions')" [attr.aria-expanded]="isItemActive(item)" [attr.aria-label]="getItemProp(item, 'label')" [attr.aria-controls]="getContentId(item, i)" [attr.aria-disabled]="isItemDisabled(item)" [attr.data-p-highlight]="isItemActive(item)" [attr.data-p-disabled]="isItemDisabled(item)" [attr.data-pc-section]="'header'" (click)="onHeaderClick($event, item, i)" (keydown)="onHeaderKeyDown($event, item, i)" > <div class="p-panelmenu-header-content"> <ng-container *ngIf="!itemTemplate"> <a *ngIf="!getItemProp(item, 'routerLink')" [attr.href]="getItemProp(item, 'url')" [attr.tabindex]="-1" [target]="getItemProp(item, 'target')" [attr.title]="getItemProp(item, 'title')" class="p-panelmenu-header-action" [attr.data-pc-section]="'headeraction'" > <ng-container *ngIf="isItemGroup(item)"> <ng-container *ngIf="!submenuIconTemplate"> <ChevronDownIcon [styleClass]="'p-submenu-icon'" *ngIf="isItemActive(item)" /> <ChevronRightIcon [styleClass]="'p-submenu-icon'" *ngIf="!isItemActive(item)" /> </ng-container> <ng-template *ngTemplateOutlet="submenuIconTemplate"></ng-template> </ng-container> <span class="p-menuitem-icon" [ngClass]="item.icon" *ngIf="item.icon" [ngStyle]="getItemProp(item, 'iconStyle')"></span> <span class="p-menuitem-text" *ngIf="getItemProp(item, 'escape') !== false; else htmlLabel">{{ getItemProp(item, 'label') }}</span> <ng-template #htmlLabel><span class="p-menuitem-text" [innerHTML]="getItemProp(item, 'label')"></span></ng-template> <span class="p-menuitem-badge" *ngIf="getItemProp(item, 'badge')" [ngClass]="getItemProp(item, 'badgeStyleClass')">{{ getItemProp(item, 'badge') }}</span> </a> </ng-container> <ng-container *ngTemplateOutlet="itemTemplate; context: { $implicit: item }"></ng-container> <a *ngIf="getItemProp(item, 'routerLink')" [routerLink]="getItemProp(item, 'routerLink')" [queryParams]="getItemProp(item, 'queryParams')" [routerLinkActive]="'p-menuitem-link-active'" [routerLinkActiveOptions]="getItemProp(item, 'routerLinkActiveOptions') || { exact: false }" [target]="getItemProp(item, 'target')" class="p-panelmenu-header-action" [attr.tabindex]="-1" [fragment]="getItemProp(item, 'fragment')" [queryParamsHandling]="getItemProp(item, 'queryParamsHandling')" [preserveFragment]="getItemProp(item, 'preserveFragment')" [skipLocationChange]="getItemProp(item, 'skipLocationChange')" [replaceUrl]="getItemProp(item, 'replaceUrl')" [state]="getItemProp(item, 'state')" [attr.data-pc-section]="'headeraction'" > <ng-container *ngIf="isItemGroup(item)"> <ng-container *ngIf="!submenuIconTemplate"> <ChevronDownIcon [styleClass]="'p-submenu-icon'" *ngIf="isItemActive(item)" /> <ChevronRightIcon [styleClass]="'p-submenu-icon'" *ngIf="!isItemActive(item)" /> </ng-container> <ng-template *ngTemplateOutlet="submenuIconTemplate"></ng-template> </ng-container> <span class="p-menuitem-icon" [ngClass]="item.icon" *ngIf="item.icon" [ngStyle]="getItemProp(item, 'iconStyle')"></span> <span class="p-menuitem-text" *ngIf="getItemProp(item, 'escape') !== false; else htmlRouteLabel">{{ getItemProp(item, 'label') }}</span> <ng-template #htmlRouteLabel><span class="p-menuitem-text" [innerHTML]="getItemProp(item, 'label')"></span></ng-template> <span class="p-menuitem-badge" *ngIf="getItemProp(item, 'badge')" [ngClass]="getItemProp(item, 'badgeStyleClass')">{{ getItemProp(item, 'badge') }}</span> </a> </div> </div> <div *ngIf="isItemGroup(item)" class="p-toggleable-content" [ngClass]="{ 'p-panelmenu-expanded': isItemActive(item) }" [@rootItem]="getAnimation(item)" (@rootItem.done)="onToggleDone()" role="region" [attr.id]="getContentId(item, i)" [attr.aria-labelledby]="getHeaderId(item, i)" [attr.data-pc-section]="'toggleablecontent'" > <div class="p-panelmenu-content" [attr.data-pc-section]="'menucontent'"> <p-panelMenuList [panelId]="getPanelId(i, item)" [items]="getItemProp(item, 'items')" [itemTemplate]="itemTemplate" [transitionOptions]="transitionOptions" [root]="true" [activeItem]="activeItem()" [tabindex]="tabindex" [parentExpanded]="isItemActive(item)" (headerFocus)="updateFocusedHeader($event)" ></p-panelMenuList> </div> </div> </div> </ng-container> </div> `, animations: [ trigger('rootItem', [ state( 'hidden', style({ height: '0' }) ), state( 'visible', style({ height: '*' }) ), transition('visible <=> hidden', [animate('{{transitionParams}}')]), transition('void => *', animate(0)) ]) ], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, styleUrls: ['./panelmenu.css'], host: { class: 'p-element' } }) export class PanelMenu implements AfterContentInit { /** * An array of menuitems. * @group Props */ @Input() model: MenuItem[] | undefined; /** * Inline style of the component. * @group Props */ @Input() style: { [klass: string]: any } | null | undefined; /** * Style class of the component. * @group Props */ @Input() styleClass: string | undefined; /** * Whether multiple tabs can be activated at the same time or not. * @group Props */ @Input({ transform: booleanAttribute }) multiple: boolean = false; /** * Transition options of the animation. * @group Props */ @Input() transitionOptions: string = '400ms cubic-bezier(0.86, 0, 0.07, 1)'; /** * Current id state as a string. * @group Props */ @Input() id: string | undefined; /** * Index of the element in tabbing order. * @group Props */ @Input({ transform: numberAttribute }) tabindex: number | undefined = 0; @ContentChildren(PrimeTemplate) templates: QueryList<PrimeTemplate> | undefined; @ViewChild('container') containerViewChild: ElementRef | undefined; submenuIconTemplate: TemplateRef<any> | undefined; itemTemplate: TemplateRef<any> | undefined; public animating: boolean | undefined; activeItem = signal<any>(null); ngOnInit() { this.id = this.id || UniqueComponentId(); } ngAfterContentInit() { this.templates?.forEach((item) => { switch (item.getType()) { case 'submenuicon': this.submenuIconTemplate = item.template; break; case 'item': this.itemTemplate = item.template; break; default: this.itemTemplate = item.template; break; } }); } constructor(private cd: ChangeDetectorRef) {} /** * Collapses open panels. * @group Method */ collapseAll() { for (let item of this.model!) { if (item.expanded) { item.expanded = false; } } this.cd.detectChanges(); } onToggleDone() { this.animating = false; this.cd.markForCheck(); } changeActiveItem(event, item, index?: number, selfActive = false) { if (!this.isItemDisabled(item)) { const activeItem = selfActive ? item : this.activeItem && ObjectUtils.equals(item, this.activeItem) ? null : item; this.activeItem.set(activeItem); } } getAnimation(item: MenuItem) { return item.expanded ? { value: 'visible', params: { transitionParams: this.animating ? this.transitionOptions : '0ms', height: '*' } } : { value: 'hidden', params: { transitionParams: this.transitionOptions, height: '0' } }; } getItemProp(item, name) { return item ? ObjectUtils.getItemValue(item[name]) : undefined; } getItemLabel(item) { return this.getItemProp(item, 'label'); } isItemActive(item) { return item.expanded; } isItemVisible(item) { return this.getItemProp(item, 'visible') !== false; } isItemDisabled(item) { return this.getItemProp(item, 'disabled'); } isItemGroup(item) { return ObjectUtils.isNotEmpty(item.items); } getPanelId(index, item?) { return item && item.id ? item.id : `${this.id}_${index}`; } getHeaderId(item, index) { return item.id ? item.id + '_header' : `${this.getPanelId(index)}_header`; } getContentId(item, index) { return item.id ? item.id + '_content' : `${this.getPanelId(index)}_content`; } updateFocusedHeader(event) { const { originalEvent, focusOnNext, selfCheck } = event; const panelElement = originalEvent.currentTarget.closest('[data-pc-section="panel"]'); const header = selfCheck ? DomHandler.findSingle(panelElement, '[data-pc-section="header"]') : focusOnNext ? this.findNextHeader(panelElement) : this.findPrevHeader(panelElement); header ? this.changeFocusedHeader(originalEvent, header) : focusOnNext ? this.onHeaderHomeKey(originalEvent) : this.onHeaderEndKey(originalEvent); } changeFocusedHeader(event, element) { element && DomHandler.focus(element); } findNextHeader(panelElement, selfCheck = false) { const nextPanelElement = selfCheck ? panelElement : panelElement.nextElementSibling; const headerElement = DomHandler.findSingle(nextPanelElement, '[data-pc-section="header"]'); return headerElement ? (DomHandler.getAttribute(headerElement, 'data-p-disabled') ? this.findNextHeader(headerElement.parentElement) : headerElement) : null; } findPrevHeader(panelElement, selfCheck = false) { const prevPanelElement = selfCheck ? panelElement : panelElement.previousElementSibling; const headerElement = DomHandler.findSingle(prevPanelElement, '[data-pc-section="header"]'); return headerElement ? (DomHandler.getAttribute(headerElement, 'data-p-disabled') ? this.findPrevHeader(headerElement.parentElement) : headerElement) : null; } findFirstHeader() { return this.findNextHeader(this.containerViewChild.nativeElement.firstElementChild, true); } findLastHeader() { return this.findPrevHeader(this.containerViewChild.nativeElement.lastElementChild, true); } onHeaderClick(event, item, index) { if (this.isItemDisabled(item)) { event.preventDefault(); return; } if (item.command) { item.command({ originalEvent: event, item }); } if (!this.multiple) { for (let modelItem of this.model!) { if (item !== modelItem && modelItem.expanded) { modelItem.expanded = false; } } } item.expanded = !item.expanded; this.changeActiveItem(event, item, index); this.animating = true; DomHandler.focus(event.currentTarget as HTMLElement); } onHeaderKeyDown(event, item, index) { switch (event.code) { case 'ArrowDown': this.onHeaderArrowDownKey(event); break; case 'ArrowUp': this.onHeaderArrowUpKey(event); break; case 'Home': this.onHeaderHomeKey(event); break; case 'End': this.onHeaderEndKey(event); break; case 'Enter': case 'Space': this.onHeaderEnterKey(event, item, index); break; default: break; } } onHeaderArrowDownKey(event) { const rootList = DomHandler.getAttribute(event.currentTarget, 'data-p-highlight') === true ? DomHandler.findSingle(event.currentTarget.nextElementSibling, '[data-pc-section="menu"]') : null; rootList ? DomHandler.focus(rootList) : this.updateFocusedHeader({ originalEvent: event, focusOnNext: true }); event.preventDefault(); } onHeaderArrowUpKey(event) { const prevHeader = this.findPrevHeader(event.currentTarget.parentElement) || this.findLastHeader(); const rootList = DomHandler.getAttribute(prevHeader, 'data-p-highlight') === true ? DomHandler.findSingle(prevHeader.nextElementSibling, '[data-pc-section="menu"]') : null; rootList ? DomHandler.focus(rootList) : this.updateFocusedHeader({ originalEvent: event, focusOnNext: false }); event.preventDefault(); } onHeaderHomeKey(event) { this.changeFocusedHeader(event, this.findFirstHeader()); event.preventDefault(); } onHeaderEndKey(event) { this.changeFocusedHeader(event, this.findLastHeader()); event.preventDefault(); } onHeaderEnterKey(event, item, index) { const headerAction = DomHandler.findSingle(event.currentTarget, '[data-pc-section="headeraction"]'); headerAction ? headerAction.click() : this.onHeaderClick(event, item, index); event.preventDefault(); } } @NgModule({ imports: [CommonModule, RouterModule, TooltipModule, SharedModule, AngleDownIcon, AngleRightIcon, ChevronDownIcon, ChevronRightIcon], exports: [PanelMenu, RouterModule, TooltipModule, SharedModule], declarations: [PanelMenu, PanelMenuSub, PanelMenuList] }) export class PanelMenuModule {} ```
/content/code_sandbox/src/app/components/panelmenu/panelmenu.ts
xml
2016-01-16T09:23:28
2024-08-16T19:58:20
primeng
primefaces/primeng
9,969
9,329
```xml import { dotize } from "./dotize"; it("converts nested properties", () => { const input = { a: "property", can: { be: "nested", really: { deeply: "sometimes" } }, }; const output = dotize(input); expect(output).toStrictEqual({ a: "property", "can.be": "nested", "can.really.deeply": "sometimes", }); }); it("converts properties with dates", () => { const now = new Date(); const input = { a: now, can: { be: now } }; const output = dotize(input); expect(output).toStrictEqual({ a: now, "can.be": now, }); }); it("converts array properties when enabled", () => { const input = { a: [ { property: "with", an: "array" }, { value: [{ sometimes: "nested" }] }, ], other: { times: "not" }, }; const output = dotize(input); expect(output).toStrictEqual({ "a[0].property": "with", "a[0].an": "array", "a[1].value[0].sometimes": "nested", "other.times": "not", }); }); it("does not converts array properties when disabled", () => { const input = { a: [ { property: "with", an: "array" }, { value: [{ sometimes: "nested" }] }, ], other: { times: "not" }, }; const output = dotize(input, { ignoreArrays: true }); expect(output).toStrictEqual({ "other.times": "not", }); }); it("does convert array properties properly", () => { expect( dotize({ wordlist: { banned: ["banned"] } }, { embedArrays: true }) ).toStrictEqual({ "wordlist.banned": ["banned"], }); }); it("does exclude undefined properties by default", () => { expect(dotize({ test: { is: undefined, a: 1 } })).toStrictEqual({ "test.a": 1, }); }); it("does include undefined properties when requested", () => { expect( dotize({ test: { is: undefined, a: 1 } }, { includeUndefined: true }) ).toStrictEqual({ "test.a": 1, "test.is": undefined, }); }); ```
/content/code_sandbox/server/src/core/server/utils/dotize.spec.ts
xml
2016-10-31T16:14:05
2024-08-06T16:15:57
talk
coralproject/talk
1,881
537
```xml var arr1 = [1, 3, 2]; arr1.reverse(); console.log(arr1); var arr2 = ["def", "abc", "aba", "ced", "meh"]; console.log(arr2.reverse()); var arr3 = ["abc", "def"]; console.log(arr3.reverse()); ```
/content/code_sandbox/tests/arrays/reverse.ts
xml
2016-07-24T23:05:37
2024-08-12T19:23:59
ts2c
andrei-markeev/ts2c
1,252
65
```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 zeros = require( '@stdlib/ndarray/zeros' ); import nditerStacks = require( './index' ); // TESTS // // The function returns an iterator... { nditerStacks( zeros( [ 2, 2, 2 ] ), [ 1, 2 ] ); // $ExpectType Iterator<typedndarray<number>> nditerStacks( zeros( [ 2, 2, 2 ] ), [ 1, 2 ], {} ); // $ExpectType Iterator<typedndarray<number>> } // The compiler throws an error if the function is provided a first argument which is not an ndarray... { nditerStacks( 123, [ 1, 2 ] ); // $ExpectError nditerStacks( true, [ 1, 2 ] ); // $ExpectError nditerStacks( false, [ 1, 2 ] ); // $ExpectError nditerStacks( null, [ 1, 2 ] ); // $ExpectError nditerStacks( undefined, [ 1, 2 ] ); // $ExpectError nditerStacks( {}, [ 1, 2 ] ); // $ExpectError nditerStacks( [], [ 1, 2 ] ); // $ExpectError nditerStacks( ( x: number ): number => x, [ 1, 2 ] ); // $ExpectError nditerStacks( 123, [ 1, 2 ], {} ); // $ExpectError nditerStacks( true, [ 1, 2 ], {} ); // $ExpectError nditerStacks( false, [ 1, 2 ], {} ); // $ExpectError nditerStacks( null, [ 1, 2 ], {} ); // $ExpectError nditerStacks( undefined, [ 1, 2 ], {} ); // $ExpectError nditerStacks( {}, [ 1, 2 ], {} ); // $ExpectError nditerStacks( [], [ 1, 2 ], {} ); // $ExpectError nditerStacks( ( x: number ): number => x, [ 1, 2 ], {} ); // $ExpectError } // The compiler throws an error if the function is provided a second argument which is not an array of numbers... { nditerStacks( zeros( [ 2, 2, 2 ] ), '123' ); // $ExpectError nditerStacks( zeros( [ 2, 2, 2 ] ), 5 ); // $ExpectError nditerStacks( zeros( [ 2, 2, 2 ] ), true ); // $ExpectError nditerStacks( zeros( [ 2, 2, 2 ] ), false ); // $ExpectError nditerStacks( zeros( [ 2, 2, 2 ] ), null ); // $ExpectError nditerStacks( zeros( [ 2, 2, 2 ] ), undefined ); // $ExpectError nditerStacks( zeros( [ 2, 2, 2 ] ), {} ); // $ExpectError nditerStacks( zeros( [ 2, 2, 2 ] ), [ '5' ] ); // $ExpectError nditerStacks( zeros( [ 2, 2, 2 ] ), ( x: number ): number => x ); // $ExpectError nditerStacks( zeros( [ 2, 2, 2 ] ), '123', {} ); // $ExpectError nditerStacks( zeros( [ 2, 2, 2 ] ), 5, {} ); // $ExpectError nditerStacks( zeros( [ 2, 2, 2 ] ), true, {} ); // $ExpectError nditerStacks( zeros( [ 2, 2, 2 ] ), false, {} ); // $ExpectError nditerStacks( zeros( [ 2, 2, 2 ] ), null, {} ); // $ExpectError nditerStacks( zeros( [ 2, 2, 2 ] ), undefined, {} ); // $ExpectError nditerStacks( zeros( [ 2, 2, 2 ] ), {}, {} ); // $ExpectError nditerStacks( zeros( [ 2, 2, 2 ] ), [ '5' ], {} ); // $ExpectError nditerStacks( zeros( [ 2, 2, 2 ] ), ( x: number ): number => x, {} ); // $ExpectError } // The compiler throws an error if the function is provided a third argument which is not an object... { nditerStacks( zeros( [ 2, 2, 2 ] ), [ 1, 2 ], 'abc' ); // $ExpectError nditerStacks( zeros( [ 2, 2, 2 ] ), [ 1, 2 ], 123 ); // $ExpectError nditerStacks( zeros( [ 2, 2, 2 ] ), [ 1, 2 ], true ); // $ExpectError nditerStacks( zeros( [ 2, 2, 2 ] ), [ 1, 2 ], false ); // $ExpectError nditerStacks( zeros( [ 2, 2, 2 ] ), [ 1, 2 ], null ); // $ExpectError nditerStacks( zeros( [ 2, 2, 2 ] ), [ 1, 2 ], [] ); // $ExpectError nditerStacks( zeros( [ 2, 2, 2 ] ), [ 1, 2 ], ( x: number ): number => x ); // $ExpectError } // The compiler throws an error if the function is provided a `readonly` option which is not a boolean... { nditerStacks( zeros( [ 2, 2, 2 ] ), [ 1, 2 ], { 'readonly': 'abc' } ); // $ExpectError nditerStacks( zeros( [ 2, 2, 2 ] ), [ 1, 2 ], { 'readonly': 123 } ); // $ExpectError nditerStacks( zeros( [ 2, 2, 2 ] ), [ 1, 2 ], { 'readonly': null } ); // $ExpectError nditerStacks( zeros( [ 2, 2, 2 ] ), [ 1, 2 ], { 'readonly': [] } ); // $ExpectError nditerStacks( zeros( [ 2, 2, 2 ] ), [ 1, 2 ], { 'readonly': {} } ); // $ExpectError nditerStacks( zeros( [ 2, 2, 2 ] ), [ 1, 2 ], { 'readonly': ( x: number ): number => x } ); // $ExpectError } // The compiler throws an error if the function is provided an unsupported number of arguments... { nditerStacks(); // $ExpectError nditerStacks( zeros( [ 2, 2, 2 ] ) ); // $ExpectError nditerStacks( zeros( [ 2, 2, 2 ] ), [ 1, 2 ], {}, {} ); // $ExpectError } ```
/content/code_sandbox/lib/node_modules/@stdlib/ndarray/iter/stacks/docs/types/test.ts
xml
2016-03-24T04:19:52
2024-08-16T09:03:19
stdlib
stdlib-js/stdlib
4,266
1,699
```xml import * as React from 'react'; import createSvgIcon from '../utils/createSvgIcon'; const CheckListCheckMirroredIcon = createSvgIcon({ svg: ({ classes }) => ( <svg xmlns="path_to_url" viewBox="0 0 2048 2048" className={classes.svg} focusable="false"> <path d="M1728 1621l211-210 90 90-301 301-173-173 90-90 83 82zm301-1272l-301 301-173-173 90-90 83 82 211-210 90 90zm-301 504l211-210 90 90-301 301-173-173 90-90 83 82zm0 384l211-210 90 90-301 301-173-173 90-90 83 82z" /> </svg> ), displayName: 'CheckListCheckMirroredIcon', }); export default CheckListCheckMirroredIcon; ```
/content/code_sandbox/packages/react-icons-mdl2/src/components/CheckListCheckMirroredIcon.tsx
xml
2016-06-06T15:03:44
2024-08-16T18:49:29
fluentui
microsoft/fluentui
18,221
223
```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="alter_publication_rename" value="ALTER PUBLICATION old_publication RENAME TO new_publication;" db-types="PostgreSQL" /> <sql-case id="alter_publication_owner" value="ALTER PUBLICATION new_publication OWNER TO CURRENT_ROLE;" db-types="PostgreSQL" /> <sql-case id="alter_publication_set_table" value="ALTER PUBLICATION mypublication SET TABLE users, departments;" db-types="PostgreSQL" /> <sql-case id="alter_publication_add_table" value="ALTER PUBLICATION mypublication ADD TABLE stores, cities;" db-types="PostgreSQL" /> <sql-case id="alter_publication_drop_table" value="ALTER PUBLICATION mypublication DROP TABLE users;" db-types="PostgreSQL" /> <sql-case id="alter_publication_set_definition" value="ALTER PUBLICATION noinsert SET (publish = 'update, delete');" db-types="PostgreSQL" /> </sql-cases> ```
/content/code_sandbox/test/it/parser/src/main/resources/sql/supported/ddl/alter-publication.xml
xml
2016-01-18T12:49:26
2024-08-16T15:48:11
shardingsphere
apache/shardingsphere
19,707
295
```xml <PreferenceScreen xmlns:android="path_to_url"> <SwitchPreference android:defaultValue="true" android:key="example_switch" android:summary="@string/pref_description_social_recommendations" android:title="@string/pref_title_social_recommendations"/> <!-- NOTE: EditTextPreference accepts EditText attributes. --> <!-- NOTE: EditTextPreference's summary should be set to its value by the activity code. --> <EditTextPreference android:capitalize="words" android:defaultValue="@string/pref_default_display_name" android:inputType="textCapWords" android:key="example_text" android:maxLines="1" android:selectAllOnFocus="true" android:singleLine="true" android:title="@string/pref_title_display_name"/> <!-- NOTE: Hide buttons to simplify the UI. Users can touch outside the dialog to dismiss it. --> <!-- NOTE: ListPreference's summary should be set to its value by the activity code. --> <ListPreference android:defaultValue="-1" android:entries="@array/pref_example_list_titles" android:entryValues="@array/pref_example_list_values" android:key="example_list" android:negativeButtonText="@null" android:positiveButtonText="@null" android:title="@string/pref_title_add_friends_to_messages"/> </PreferenceScreen> ```
/content/code_sandbox/app/src/main/res/xml/pref_general.xml
xml
2016-08-08T08:52:10
2024-08-12T19:24:13
AndroidAnimationExercise
REBOOTERS/AndroidAnimationExercise
1,868
284
```xml import { describe, expect, test } from 'vitest'; import { isNodeVersionGreaterThan21 } from '@verdaccio/config'; import { aesDecryptDeprecated, aesEncryptDeprecated, generateRandomSecretKeyDeprecated, } from '../src'; const itdescribe = (condition) => (condition ? describe : describe.skip); itdescribe(isNodeVersionGreaterThan21() === false)('test deprecated crypto utils', () => { test('generateRandomSecretKeyDeprecated', () => { expect(generateRandomSecretKeyDeprecated()).toHaveLength(12); }); test('decrypt payload flow', () => { const secret = '4b4512c6ce20'; const payload = 'juan:password'; const token = aesEncryptDeprecated(Buffer.from(payload), secret); expect(token.toString('base64')).toEqual('auizc1j3lSEd2wEB5CyGbQ=='); const data = aesDecryptDeprecated(token, secret); expect(data.toString()).toEqual(payload.toString()); }); test('crypt fails if secret is incorrect', () => { const payload = 'juan:password'; expect(aesEncryptDeprecated(Buffer.from(payload), 'fake_token').toString()).not.toEqual( Buffer.from(payload) ); }); }); ```
/content/code_sandbox/packages/signature/test/legacy-token-deprecated.spec.ts
xml
2016-04-15T16:21:12
2024-08-16T09:38:01
verdaccio
verdaccio/verdaccio
16,189
265
```xml <?xml version="1.0" encoding="UTF-8"?> <definitions id="definition" xmlns="path_to_url" xmlns:xsi="path_to_url" xmlns:flowable="path_to_url" targetNamespace="Examples"> <process id="miSubProcessLocalVariables"> <startEvent id="theStart" /> <sequenceFlow id="flow1" sourceRef="theStart" targetRef="nesting1" /> <subProcess id="nesting1"> <multiInstanceLoopCharacteristics isSequential="true"> <loopCardinality>${4}</loopCardinality> </multiInstanceLoopCharacteristics> <startEvent id="subStart1" /> <sequenceFlow id="flow2" sourceRef="subStart1" targetRef="callActivity" /> <callActivity id="callActivity" calledElement="externalSubProcess" flowable:useLocalScopeForOutParameters="true"> <extensionElements> <flowable:in source="name" target="name" /> <flowable:out source="output" target="output" /> </extensionElements> </callActivity> <sequenceFlow id="flow3" sourceRef="callActivity" targetRef="task" /> <userTask id="task" /> <sequenceFlow id="flow4" sourceRef="task" targetRef="subProcessEnd1" /> <endEvent id="subProcessEnd1" /> </subProcess> <sequenceFlow id="flow5" sourceRef="nesting1" targetRef="theEnd" /> <endEvent id="theEnd" /> </process> </definitions> ```
/content/code_sandbox/modules/flowable-engine/src/test/resources/org/flowable/engine/test/bpmn/multiinstance/MultiInstanceTest.testCallActivityLocalVariables.bpmn20.xml
xml
2016-10-13T07:21:43
2024-08-16T15:23:14
flowable-engine
flowable/flowable-engine
7,715
357
```xml import { Component, Input, OnInit } from '@angular/core'; import { InputBase } from './input-base'; import { AnotherComponent } from './another-component.component'; /** * The main component */ @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent extends AnotherComponent { constructor() { super(); } @Input() public internalLabel: string; } ```
/content/code_sandbox/test/fixtures/sample-files-extends/src/app/app.component.ts
xml
2016-10-17T07:09:28
2024-08-14T16:30:10
compodoc
compodoc/compodoc
3,980
95
```xml /*your_sha256_hash---------- zero Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. your_sha256_hash-----------*/ export class Angle { /** Creates an angle from the given radian. */ public static fromRadian(radian: number): number { return (radian * 57.29578) } } ```
/content/code_sandbox/src/engine/math/angle.ts
xml
2016-10-10T11:59:07
2024-08-16T11:00:47
zero
sinclairzx81/zero
2,412
265
```xml <assembly xmlns="path_to_url" xmlns:xsi="path_to_url" xsi:schemaLocation="path_to_url path_to_url"> <id>publish</id> <formats> <format>tar.gz</format> </formats> <includeBaseDirectory>false</includeBaseDirectory> <fileSets> <fileSet> <directory>${basedir}/target/repository</directory> <outputDirectory/> <includes> <include>bin/**</include> <include>config_linux/**</include> <include>config_linux_arm/**</include> <include>config_mac/**</include> <include>config_mac_arm/**</include> <include>config_win/**</include> <include>config_ss_linux/**</include> <include>config_ss_linux_arm/**</include> <include>config_ss_mac/**</include> <include>config_ss_mac_arm/**</include> <include>config_ss_win/**</include> <include>features/**</include> <include>plugins/**</include> </includes> <excludes> <exclude>**/*.pack.gz</exclude> </excludes> <fileMode>755</fileMode> </fileSet> </fileSets> </assembly> ```
/content/code_sandbox/org.eclipse.jdt.ls.product/publish-assembly.xml
xml
2016-06-27T13:06:53
2024-08-16T00:38:32
eclipse.jdt.ls
eclipse-jdtls/eclipse.jdt.ls
1,726
282
```xml <?xml version="1.0" encoding="utf-8"?> <vector xmlns:android="path_to_url" android:viewportWidth="800" android:viewportHeight="800" android:width="1000dp" android:height="1000dp"> <path android:pathData="M323.37 205.33c1.18 -0.21 2.39 -0.33 3.6 -0.36 46.34 0.02 92.69 0.02 139.03 0.01 5.79 0.04 11.85 -0.67 17.32 1.71 5.47 2.42 11.21 5.21 14.75 10.25 3.81 5.26 6.76 11.44 6.96 18.03 -0.03 107.34 -0.01 214.69 -0.01 322.03 -0.08 5.87 0.67 11.95 -1.4 17.59 -2.31 6.33 -5.97 12.57 -11.74 16.32 -5.25 3.57 -11.41 6.19 -17.85 6.15 -46.01 -0.1 -92.02 -0.03 -138.03 -0.04 -6.81 0.17 -13.96 0.44 -20.17 -2.84 -10.78 -4.51 -18.15 -15.61 -18.86 -27.16 0.02 -110.68 0.03 -221.36 0 -332.05 0.04 -3.85 1.22 -7.6 2.94 -11.02 2.33 -4.71 5.03 -9.58 9.63 -12.42 4.27 -2.71 8.82 -5.23 13.83 -6.2m1.02 4.08c-13.13 1.97 -23.58 14.28 -23.37 27.56 0 109.35 -0.01 218.71 0 328.06 0.07 7.31 2.79 14.7 8.2 19.74 5.27 5.69 13.12 8.34 20.76 8.23 48.01 -0.06 96.03 0.04 144.04 -0.05 11.77 -0.17 22.84 -8.75 25.84 -20.13 1.34 -4.48 1.16 -9.2 1.14 -13.82 -0.06 -107.67 0.04 -215.35 -0.05 -323.02 -0.11 -11.58 -8.39 -22.13 -19.33 -25.58 -5.35 -1.86 -11.07 -1.34 -16.62 -1.39 -42.67 0.01 -85.33 0.01 -128 0 -4.21 0.05 -8.44 -0.26 -12.61 0.4z" android:fillColor="#000000" /> <path android:pathData="M351.39 257.25c3.07 -0.96 6.55 0.42 8.63 2.75 3.05 4 1.77 9.34 2.04 14 -0.19 4.02 0.6 8.26 -0.91 12.1 -1.83 4.43 -7.9 6.4 -11.93 3.71 -3.58 -1.78 -4.46 -6.14 -4.29 -9.78 0.08 -4.99 -0.16 -9.99 0.13 -14.97 0.14 -3.66 2.76 -6.93 6.33 -7.81m0.03 3.05c-1.69 0.99 -3.4 2.61 -3.32 4.74 -0.18 5.96 -0.18 11.95 0 17.92 -0.01 4.11 5.68 6.84 8.73 3.88 2.59 -1.76 2.11 -5.12 2.19 -7.83 -0.1 -4.65 0.13 -9.32 -0.12 -13.97 -0.05 -3.55 -4.22 -6.17 -7.48 -4.74z" android:fillColor="#000000" /> <path android:pathData="M386.37 257.33c4.51 -0.75 9.12 -0.32 13.67 -0.4 3.4 -0.09 7.43 0.53 9.4 3.66 2.51 4 1.36 8.95 1.63 13.41 -0.2 4.53 0.91 9.91 -2.53 13.55 -3.35 3.21 -8.32 2.4 -12.54 2.55 -4.54 -0.23 -9.91 0.88 -13.54 -2.55 -3 -3.07 -2.49 -7.64 -2.53 -11.56 0.09 -3.94 -0.22 -7.9 0.24 -11.82 0.42 -3.29 2.93 -6.14 6.2 -6.84m0.03 3.03c-2.11 1.03 -3.62 3.19 -3.36 5.61 0.08 5.87 -0.43 11.8 0.32 17.64 2.29 4.89 8.36 3.04 12.63 3.4 3.99 -0.22 9.6 1.19 11.65 -3.41 0.74 -5.83 0.24 -11.76 0.32 -17.63 0.37 -3.28 -2.65 -6.3 -5.93 -5.93 -5.21 0.04 -10.47 -0.4 -15.63 0.32z" android:fillColor="#000000" /> <path android:pathData="M434.4 257.33c3.66 -0.72 7.53 -0.72 11.2 0 2.33 1.41 4.71 3.67 4.43 6.64 -0.08 6.95 0.27 13.92 -0.18 20.86 -1.44 5.16 -7.36 5.87 -11.9 5.3 -3.98 0.42 -8.16 -3 -7.98 -7.1 -0.04 -6.35 -0.04 -12.71 0 -19.07 -0.29 -2.97 2.1 -5.22 4.43 -6.63m0.96 2c-3.49 0.72 -3.38 4.87 -3.37 7.64 0.19 5.89 -0.38 11.82 0.35 17.67 0.71 3.47 4.88 3.43 7.66 3.44 2.77 0 6.95 0.02 7.66 -3.44 0.73 -5.85 0.16 -11.78 0.35 -17.67 -0.11 -2.55 0.27 -6.21 -2.63 -7.38 -3.22 -0.98 -6.74 -0.81 -10.02 -0.26z" android:fillColor="#000000" /> <path android:pathData="M351.29 263.08c1.45 -0.27 2.96 -0.27 4.43 0 1.98 1.16 1.38 3.73 1.2 5.63 -1.16 2 -3.74 1.37 -5.63 1.21 -2.05 -1.43 -2.06 -5.41 0 -6.84m0.72 1.93c0 0.74 0 2.23 0 2.98 0.75 0 2.23 0 2.98 -0.01 0 -0.74 -0.01 -2.22 -0.01 -2.96 -0.74 0 -2.22 -0.01 -2.97 -0.01z" android:fillColor="#000000" /> <path android:pathData="M393.39 264.27c5.8 -1.62 11.88 3.81 11.66 9.67 -0.43 3.79 -2.94 7.37 -6.67 8.52 -6.72 2.8 -14.63 -5.12 -11.84 -11.84 1 -3.17 3.7 -5.48 6.85 -6.35m-0.01 2.02c-2.89 0.96 -5.23 3.68 -5.39 6.77 -0.34 4.27 3.69 8.28 7.95 7.95 3.94 -0.22 7.37 -3.99 7.07 -7.95 -0.21 -4.56 -5.23 -8.26 -9.63 -6.77z" android:fillColor="#000000" /> <path android:pathData="M351.28 271.06c1.47 -0.23 2.97 -0.23 4.44 0 2.05 1.66 1.15 4.64 1.44 6.94 -0.28 2.3 0.6 5.28 -1.44 6.95 -1.47 0.22 -2.98 0.23 -4.44 0 -2.06 -1.67 -1.16 -4.65 -1.44 -6.95 0.28 -2.3 -0.62 -5.29 1.44 -6.94m0.78 1.95c-0.06 3.33 -0.06 6.65 0 9.97 0.72 0 2.16 0.01 2.89 0.01 0.05 -3.33 0.05 -6.65 -0.01 -9.98 -0.72 0 -2.16 0 -2.88 0z" android:fillColor="#000000" /> </vector> ```
/content/code_sandbox/app/src/main/res/drawable/ic_device_outline_24dp.xml
xml
2016-02-01T23:48:36
2024-08-15T03:35:42
TagMo
HiddenRamblings/TagMo
2,976
2,589
```xml import * as React from 'react'; import { BaseButton } from '../BaseButton'; import { customizable, nullRender } from '../../../Utilities'; import { getStyles } from './DefaultButton.styles'; import type { IButtonProps } from '../Button.types'; /** * {@docCategory Button} */ @customizable('DefaultButton', ['theme', 'styles'], true) export class DefaultButton extends React.Component<IButtonProps, {}> { public render(): JSX.Element { const { primary = false, styles, theme } = this.props; return ( <BaseButton {...this.props} variantClassName={primary ? 'ms-Button--primary' : 'ms-Button--default'} styles={getStyles(theme!, styles, primary)} onRenderDescription={nullRender} /> ); } } ```
/content/code_sandbox/packages/react/src/components/Button/DefaultButton/DefaultButton.tsx
xml
2016-06-06T15:03:44
2024-08-16T18:49:29
fluentui
microsoft/fluentui
18,221
172
```xml /* * path_to_url * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either */ import { services } from 'ask-sdk-model'; import { expect } from 'chai'; import * as sinon from 'sinon'; import { ApiClient } from '../../lib/services/apiClient'; import { ListManagementService } from '../../lib/services/listManagementService'; const mockToken = 'token'; const mockListId = 'listId'; const mockListItemId = 'listItemId'; const mockListItemStatus = 'active'; const mockAPIResult: services.ApiClientResponse = { headers : [], statusCode: 200, body: '', }; const mockAPIFailedResult: services.ApiClientResponse = { headers : [], statusCode: 400, body: 'Error', }; describe('ListManagementService', () => { it('should call corresponding apiClient method', () => { const mockListObject = {}; const mockListItemObject = {}; const apiStub: ApiClient = { post : ( uri: string, headers: Array<{key: string, value: string}>, body: string, ) => Promise.resolve(mockAPIResult), put : ( uri: string, headers: Array<{key: string, value: string}>, body: string, ) => Promise.resolve(mockAPIResult), get : ( uri: string, headers: Array<{key: string, value: string}>, ) => Promise.resolve(mockAPIResult), delete : ( uri: string, headers: Array<{key: string, value: string}>, ) => Promise.resolve(mockAPIResult), }; const spyPost = sinon.spy(apiStub, 'post'); const spyPut = sinon.spy(apiStub, 'put'); const spyGet = sinon.spy(apiStub, 'get'); const spyDelete = sinon.spy(apiStub, 'delete'); const lms = new ListManagementService(apiStub); return lms.getListsMetadata(mockToken) .then(() => lms.createList(mockListObject, mockToken)) .then(() => lms.getList(mockListId, mockListItemStatus, mockToken)) .then(() => lms.updateList(mockListId, mockListObject, mockToken)) .then(() => lms.deleteList(mockListId, mockToken)) .then(() => lms.createListItem(mockListId, mockListItemObject, mockToken)) .then(() => lms.getListItem(mockListId, mockListItemId, mockToken)) .then(() => lms.updateListItem(mockListId, mockListItemId, mockListItemObject, mockToken)) .then(() => lms.deleteListItem(mockListId, mockListItemId, mockToken)) .then(() => { expect(spyPost.callCount).to.equal(2); expect(spyPut.callCount).to.equal(2); expect(spyGet.callCount).to.equal(3); expect(spyDelete.callCount).to.equal(2); }); }); it('should properly set API Endpoint address with given value', () => { const defaultApiEndpoint = 'path_to_url const updatedApiEndpoint = 'path_to_url const lms = new ListManagementService(); expect(lms.getApiEndpoint()).to.equal(defaultApiEndpoint); lms.setApiEndpoint(updatedApiEndpoint); expect(lms.getApiEndpoint()).to.equal(updatedApiEndpoint); }); it('should properly construct uri and headers with given non empty query parameters', () => { const apiStub: ApiClient = { get : ( uri: string, headers: Array<{key: string, value: string}>, ) => Promise.resolve(mockAPIResult), }; const spyGet = sinon.spy(apiStub, 'get'); const expectedUri = 'path_to_url const expectedHeaders = [{key : 'Authorization', value: `Bearer ${mockToken}`}]; const lms = new ListManagementService(apiStub); return lms.getListsMetadata(mockToken) .then(() => { expect(spyGet.getCall(0).args[0]).to.equal(expectedUri); expect(spyGet.getCall(0).args[1]).to.deep.equal(expectedHeaders); }); }); it('should reject promise on http request error', () => { const apiStub: ApiClient = { get : ( uri: string, headers: Array<{key: string, value: string}>, ) => Promise.reject(new Error('Error')), }; const expectedErrMsg = 'Error'; const lms = new ListManagementService(apiStub); return lms.getListsMetadata(mockToken) .then(() => { expect.fail('should have thrown error'); }) .catch((error) => { expect(error.message).to.equal(expectedErrMsg); }); }); it('should reject promise with error message if the device API returns a non 2xx status', () => { const apiStub: ApiClient = { get : ( uri: string, headers: Array<{key: string, value: string}>, ) => Promise.resolve(mockAPIFailedResult), }; const expectedErrMsg = JSON.stringify('Error'); const lms = new ListManagementService(apiStub); return lms.getListsMetadata(mockToken) .then(() => { expect.fail('should have thrown error'); }) .catch((error) => { expect(error.statusCode).to.equal(400); expect(error.message).to.equal(expectedErrMsg); }); }); }); ```
/content/code_sandbox/ask-sdk-v1adapter/tst/services/listManagementService.spec.ts
xml
2016-06-24T06:26:05
2024-08-14T12:39:19
alexa-skills-kit-sdk-for-nodejs
alexa/alexa-skills-kit-sdk-for-nodejs
3,118
1,204
```xml <!-- ~ Nextcloud - Android Client ~ --> <vector xmlns:android="path_to_url" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24"> <path android:fillColor="#757575" android:pathData="M12,5V1L7,6l5,5V7c3.31,0 6,2.69 6,6s-2.69,6 -6,6 -6,-2.69 -6,-6H4c0,4.42 3.58,8 8,8s8,-3.58 8,-8 -3.58,-8 -8,-8z"/> </vector> ```
/content/code_sandbox/app/src/main/res/drawable/ic_history.xml
xml
2016-06-06T21:23:36
2024-08-16T18:22:36
android
nextcloud/android
4,122
169
```xml import React from 'react' import {MdArrowDropDown, MdArrowDropUp} from 'react-icons/md' type CollapserProps = { isCollapsed: boolean style?: object }; export default class Collapser extends React.Component<CollapserProps> { render() { const iconStyle = { width: 20, height: 20, ...this.props.style, } return this.props.isCollapsed ? <MdArrowDropUp style={iconStyle}/> : <MdArrowDropDown style={iconStyle} /> } } ```
/content/code_sandbox/src/components/Collapser.tsx
xml
2016-09-08T17:52:22
2024-08-16T12:54:23
maputnik
maplibre/maputnik
2,046
120
```xml <Project> <PropertyGroup> <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects> <EFCoreMySqlJsonNewtonsoftFile>$(IntermediateOutputPath)EFCoreMySqlJsonNewtonsoft$(DefaultLanguageSourceExtension)</EFCoreMySqlJsonNewtonsoftFile> </PropertyGroup> <Choose> <When Condition="'$(Language)' == 'F#'"> <Choose> <When Condition="'$(OutputType)' == 'Exe' OR '$(OutputType)' == 'WinExe'"> <PropertyGroup> <CodeFragmentItemGroup>CompileBefore</CodeFragmentItemGroup> </PropertyGroup> </When> <Otherwise> <PropertyGroup> <CodeFragmentItemGroup>CompileAfter</CodeFragmentItemGroup> </PropertyGroup> </Otherwise> </Choose> </When> <Otherwise> <PropertyGroup> <CodeFragmentItemGroup>Compile</CodeFragmentItemGroup> </PropertyGroup> </Otherwise> </Choose> <Target Name="AddEFCoreMySqlJsonNewtonsoft" BeforeTargets="CoreCompile" DependsOnTargets="PrepareForBuild" Condition="'$(DesignTimeBuild)' != 'True'" Inputs="$(MSBuildAllProjects)" Outputs="$(EFCoreMySqlJsonNewtonsoftFile)"> <ItemGroup> <EFCoreMySqlJsonNewtonsoftServices Include="Microsoft.EntityFrameworkCore.Design.DesignTimeServicesReferenceAttribute"> <_Parameter1>Pomelo.EntityFrameworkCore.MySql.Json.Newtonsoft.Design.Internal.MySqlJsonNewtonsoftDesignTimeServices, Pomelo.EntityFrameworkCore.MySql.Json.Newtonsoft</_Parameter1> <_Parameter2>Pomelo.EntityFrameworkCore.MySql.Json.Newtonsoft</_Parameter2> </EFCoreMySqlJsonNewtonsoftServices> </ItemGroup> <WriteCodeFragment AssemblyAttributes="@(EFCoreMySqlJsonNewtonsoftServices)" Language="$(Language)" OutputFile="$(EFCoreMySqlJsonNewtonsoftFile)"> <Output TaskParameter="OutputFile" ItemName="$(CodeFragmentItemGroup)" /> <Output TaskParameter="OutputFile" ItemName="FileWrites" /> </WriteCodeFragment> </Target> </Project> ```
/content/code_sandbox/src/EFCore.MySql.Json.Newtonsoft/build/netstandard2.0/Pomelo.EntityFrameworkCore.MySql.Json.Newtonsoft.targets
xml
2016-07-11T16:05:17
2024-08-14T15:06:37
Pomelo.EntityFrameworkCore.MySql
PomeloFoundation/Pomelo.EntityFrameworkCore.MySql
2,674
477
```xml import { ActionName, calculateActionName, runAction, QueryParams, QueryMatcher, DeterministicSortComparator, StateResolveFunctionInput, ChangeEvent } from 'event-reduce-js'; import type { RxQuery, MangoQuery, RxChangeEvent, StringKeys, RxDocumentData } from './types/index.d.ts'; import { rxChangeEventToEventReduceChangeEvent } from './rx-change-event.ts'; import { arrayFilterNotEmpty, clone, ensureNotFalsy, getFromMapOrCreate } from './plugins/utils/index.ts'; import { getQueryMatcher, getSortComparator, normalizeMangoQuery } from './rx-query-helper.ts'; export type EventReduceResultNeg = { runFullQueryAgain: true; }; export type EventReduceResultPos<RxDocumentType> = { runFullQueryAgain: false; changed: boolean; newResults: RxDocumentType[]; }; export type EventReduceResult<RxDocumentType> = EventReduceResultNeg | EventReduceResultPos<RxDocumentType>; export function getSortFieldsOfQuery<RxDocType>( primaryKey: StringKeys<RxDocumentData<RxDocType>>, query: MangoQuery<RxDocType> ): (string | StringKeys<RxDocType>)[] { if (!query.sort || query.sort.length === 0) { return [primaryKey]; } else { return query.sort.map(part => Object.keys(part)[0]); } } export const RXQUERY_QUERY_PARAMS_CACHE: WeakMap<RxQuery, QueryParams<any>> = new WeakMap(); export function getQueryParams<RxDocType>( rxQuery: RxQuery<RxDocType> ): QueryParams<RxDocType> { return getFromMapOrCreate( RXQUERY_QUERY_PARAMS_CACHE, rxQuery, () => { const collection = rxQuery.collection; const normalizedMangoQuery = normalizeMangoQuery( collection.storageInstance.schema, clone(rxQuery.mangoQuery) ); const primaryKey = collection.schema.primaryPath; /** * Create a custom sort comparator * that uses the hooks to ensure * we send for example compressed documents to be sorted by compressed queries. */ const sortComparator = getSortComparator( collection.schema.jsonSchema, normalizedMangoQuery ); const useSortComparator: DeterministicSortComparator<RxDocType> = (docA: RxDocType, docB: RxDocType) => { const sortComparatorData = { docA, docB, rxQuery }; return sortComparator(sortComparatorData.docA, sortComparatorData.docB); }; /** * Create a custom query matcher * that uses the hooks to ensure * we send for example compressed documents to match compressed queries. */ const queryMatcher = getQueryMatcher( collection.schema.jsonSchema, normalizedMangoQuery ); const useQueryMatcher: QueryMatcher<RxDocumentData<RxDocType>> = (doc: RxDocumentData<RxDocType>) => { const queryMatcherData = { doc, rxQuery }; return queryMatcher(queryMatcherData.doc); }; const ret: QueryParams<any> = { primaryKey: rxQuery.collection.schema.primaryPath as any, skip: normalizedMangoQuery.skip, limit: normalizedMangoQuery.limit, sortFields: getSortFieldsOfQuery(primaryKey, normalizedMangoQuery) as string[], sortComparator: useSortComparator, queryMatcher: useQueryMatcher }; return ret; } ); } export function calculateNewResults<RxDocumentType>( rxQuery: RxQuery<RxDocumentType>, rxChangeEvents: RxChangeEvent<RxDocumentType>[] ): EventReduceResult<RxDocumentType> { if (!rxQuery.collection.database.eventReduce) { return { runFullQueryAgain: true }; } const queryParams = getQueryParams(rxQuery); const previousResults: RxDocumentType[] = ensureNotFalsy(rxQuery._result).docsData.slice(0); const previousResultsMap: Map<string, RxDocumentType> = ensureNotFalsy(rxQuery._result).docsDataMap; let changed: boolean = false; const eventReduceEvents: ChangeEvent<RxDocumentType>[] = rxChangeEvents .map(cE => rxChangeEventToEventReduceChangeEvent(cE)) .filter(arrayFilterNotEmpty); const foundNonOptimizeable = eventReduceEvents.find(eventReduceEvent => { const stateResolveFunctionInput: StateResolveFunctionInput<RxDocumentType> = { queryParams, changeEvent: eventReduceEvent, previousResults, keyDocumentMap: previousResultsMap }; const actionName: ActionName = calculateActionName(stateResolveFunctionInput); if (actionName === 'runFullQueryAgain') { return true; } else if (actionName !== 'doNothing') { changed = true; runAction( actionName, queryParams, eventReduceEvent, previousResults, previousResultsMap ); return false; } }); if (foundNonOptimizeable) { return { runFullQueryAgain: true, }; } else { return { runFullQueryAgain: false, changed, newResults: previousResults }; } } ```
/content/code_sandbox/src/event-reduce.ts
xml
2016-12-02T19:34:42
2024-08-16T15:47:20
rxdb
pubkey/rxdb
21,054
1,144
```xml import React from 'react'; import ReplyFbMessage from './components/action/ReplyFbMessage'; import OptionalContent from './components/OptionalContent'; import MessageForm from './components/trigger/MessageForm'; import TriggerContent from './components/trigger/Content'; import CommnetForm from './components/trigger/CommentForm'; import Label from '@erxes/ui/src/components/Label'; import Tip from '@erxes/ui/src/components/Tip'; import { Link } from 'react-router-dom'; import ReplyComments from './components/action/ReplyComment'; const Automations = (props) => { const { componentType, activeAction, activeTrigger, target } = props || {}; if (componentType === 'triggerForm') { const [_serviceName, contentType] = activeTrigger?.type.split(':'); switch (contentType) { case 'messages': return <MessageForm {...props} />; case 'comments': return <CommnetForm {...props} />; default: return null; } } if (componentType === 'triggerContent') { return <TriggerContent {...props} />; } if (componentType === 'optionalContent') { return <OptionalContent action={props.data} handle={props.handle} />; } if (componentType === 'actionForm') { const { type } = activeAction; const [_serviceName, contentType, _action] = type .replace('.', ':') .split(':'); switch (contentType) { case 'messages': return <ReplyFbMessage {...props} />; case 'comments': return <ReplyComments {...props} />; default: return null; } } if (componentType === 'historyActionResult') { const { result } = props; if (result?.error) { return ( <Tip text={result?.error}> <Label lblStyle="danger">{'Error'}</Label> </Tip> ); } return <Label lblStyle="success">{'Sent'}</Label>; } if (componentType === 'historyName') { return ( <> <Link target="_blank" to={`/contacts/details/${target?.customerId}`}> {'See Customer'} </Link> <Link target="_blank" to={`/inbox/index?_id=${target?.conversationId}`}> {`\u00A0/\u00A0`} {'See Conversation'} </Link> </> ); } }; export default Automations; ```
/content/code_sandbox/packages/plugin-facebook-ui/src/automations/index.tsx
xml
2016-11-11T06:54:50
2024-08-16T10:26:06
erxes
erxes/erxes
3,479
527
```xml import { Context } from "../shapes/Samplers.js"; import * as ad from "./ad.js"; import { FunctionInternalWarning } from "./errors.js"; import { ValueShapeT } from "./types.js"; import { Value } from "./value.js"; export type MayWarn<T> = { value: T; warnings: FunctionInternalWarning[]; }; export type CompFuncBody = ( context: Context, ...args: any[] ) => MayWarn<Value<ad.Num>>; export type ObjFuncBody = (...args: any[]) => MayWarn<ad.Num>; export type ConstrFuncBody = (...args: any[]) => MayWarn<ad.Num>; export interface FuncParam { name: string; type: ValueShapeT; default?: Value<ad.Num>["contents"]; description?: string; } export interface CompFunc { name: string; params: FuncParam[]; body: CompFuncBody; returns: ValueShapeT; description?: string; } export interface ObjFunc { name: string; params: FuncParam[]; body: ObjFuncBody; description?: string; } export interface ConstrFunc { name: string; params: FuncParam[]; body: ConstrFuncBody; description?: string; } export type CompFuncSignature = Omit<CompFunc, "body">; export type ObjFuncSignature = Omit<ObjFunc, "body">; export type ConstrFuncSignature = Omit<ConstrFunc, "body">; export type FuncSignature = | CompFuncSignature | ObjFuncSignature | ConstrFuncSignature; ```
/content/code_sandbox/packages/core/src/types/functions.ts
xml
2016-09-22T04:47:19
2024-08-16T13:00:54
penrose
penrose/penrose
6,760
337
```xml export * from "./WorkflowExtensionModule"; ```
/content/code_sandbox/src/main/Extensions/Workflow/index.ts
xml
2016-10-11T04:59:52
2024-08-16T11:53:31
ueli
oliverschwendener/ueli
3,543
9
```xml <?xml version="1.0" encoding="UTF-8"?> <ns2:test-suite xmlns:ns2="urn:model.allure.qatools.yandex.ru" start="1443622429471" stop="1443622429475"> <name>multistep</name> <title>Multi-step</title> <test-cases> <test-case start="1443622429471" stop="1443622429472" status="failed"> <name>test</name> <title>test case</title> <description></description> <steps> <step start="1412949045143" stop="1412949047173" status="failed"> <name>buttons</name> <title>Buttons</title> <attachments> <attachment title="screen diff" source="3-1-combined-attachment.json" type="application/vnd.allure.image.diff"/> </attachments> <steps/> </step> <step start="1412949047173" stop="1412949048754" status="passed"> <name>language</name> <title>language</title> <steps></steps> <attachments> <attachment title="screen diff" source="3-2-combined-attachment.json" type="application/vnd.allure.image.diff"/> </attachments> </step> <step start="1443622429474" stop="1443622429474" status="passed"> <name>payment 1</name> <title>payment 1</title> <attachments> <attachment title="screen diff" source="3-3-combined-attachment.json" type="application/vnd.allure.image.diff"/> </attachments> </step> <step start="1443622429475" stop="1443622429475" status="failed"> <name>payment 2</name> <title>payment 2</title> <attachments> <attachment title="screen diff" source="3-4-combined-attachment.json" type="application/vnd.allure.image.diff"/> </attachments> </step> </steps> <failure> <message>Some comparison failed, check steps for more details</message> <stack-trace>AssertionError: Screenshots do not match at Context.&lt;anonymous&gt; (test/test.spec.js:47:15)</stack-trace> </failure> </test-case> </test-cases> </ns2:test-suite> ```
/content/code_sandbox/allure-generator/test-data/screen-diff/steps-testsuite.xml
xml
2016-05-27T14:06:05
2024-08-16T20:00:51
allure2
allure-framework/allure2
4,013
551
```xml <?xml version="1.0" encoding="utf-8"?> <layout xmlns:android="path_to_url" xmlns:app="path_to_url" xmlns:tools="path_to_url"> <android.support.design.widget.CoordinatorLayout android:id="@+id/main_content" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true"> <android.support.design.widget.AppBarLayout android:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="200dp" android:fitsSystemWindows="true" android:theme="@style/AppTheme.AppBarOverlay" app:layout_behavior="android.support.design.widget.AppBarLayoutSpringBehavior"> <android.support.design.widget.CollapsingToolbarLayout android:id="@+id/collapsing_toolbar" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" app:contentScrim="?attr/colorPrimary" app:expandedTitleMarginEnd="16dp" app:expandedTitleMarginStart="16dp" app:layout_scrollFlags="scroll|exitUntilCollapsed" app:statusBarScrim="?attr/colorPrimary"> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" app:layout_collapseMode="parallax" app:layout_collapseParallaxMultiplier="0.7"> <ImageView android:id="@+id/im_header" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignParentTop="true" android:layout_gravity="center" android:fitsSystemWindows="true" android:scaleType="centerCrop" /> <ImageView android:id="@+id/image" android:layout_width="100dp" android:layout_height="100dp" android:layout_centerInParent="true" android:layout_gravity="top" android:scaleType="centerCrop" app:layout_behavior="com.view.behavior.UserHeadBehavior" app:layout_collapseMode="parallax" /> </RelativeLayout> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" app:layout_collapseMode="pin" app:layout_scrollFlags="scroll|exitUntilCollapsed" app:popupTheme="@style/AppTheme.PopupOverlay" /> </android.support.design.widget.CollapsingToolbarLayout> </android.support.design.widget.AppBarLayout> <com.base.adapter.TRecyclerView android:id="@+id/lv_comment" android:layout_width="match_parent" android:layout_height="wrap_content" app:isRefreshable="false" app:itemType="@layout/list_item_user_comment" app:layout_behavior="@string/appbar_scrolling_view_behavior" /> <android.support.design.widget.FloatingActionButton android:id="@+id/fab" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="@dimen/fab_margin" android:clickable="true" android:onClick="checkin" app:layout_anchor="@id/appbar" app:layout_anchorGravity="bottom|right|end" app:srcCompat="@drawable/ic_whilte_send" /> </android.support.design.widget.CoordinatorLayout> </layout> ```
/content/code_sandbox/app/src/main/res/layout/activity_user.xml
xml
2016-05-09T05:55:34
2024-07-26T07:43:48
T-MVP
north2016/T-MVP
2,709
771
```xml import gql from 'graphql-tag'; export default ({ rootMutationName, extendTypeDefs = true, }: { rootMutationName?: string; extendTypeDefs?: boolean; }) => gql` ${extendTypeDefs ? 'extend' : ''} type ${rootMutationName || 'Mutation'} { # Creates a user with a password, returns the id corresponding db ids, such as number IDs, ObjectIDs or UUIDs createUser(user: CreateUserInput!): CreateUserResult verifyEmail(token: String!): Boolean resetPassword(token: String!, newPassword: String!): LoginResult sendVerificationEmail(email: String!): Boolean sendResetPasswordEmail(email: String!): Boolean addEmail(newEmail: String!): Boolean changePassword(oldPassword: String!, newPassword: String!): Boolean twoFactorSet(secret: TwoFactorSecretKeyInput!, code: String!): Boolean twoFactorUnset(code: String!): Boolean } `; ```
/content/code_sandbox/modules/module-password/src/schema/mutation.ts
xml
2016-10-07T01:43:23
2024-07-14T11:57:08
accounts
accounts-js/accounts
1,492
211
```xml import { Route, Routes, useLocation, useParams } from "react-router-dom"; import MainSettings from "./settings/components/MainSettings"; import React from "react"; import Settings from "./settings/containers/Settings"; import asyncComponent from "@erxes/ui/src/components/AsyncComponent"; import queryString from "query-string"; const ContractList = asyncComponent( () => import(/* webpackChunkName: "ContractList" */ "./contracts/containers/List") ); const ContractDetails = asyncComponent( () => import( /* webpackChunkName: "ContractDetails" */ "./contracts/containers/detail/ContractDetails" ) ); const PeriodLockDetails = asyncComponent( () => import( /* webpackChunkName: "PeriodLockDetails" */ "./periodLocks/containers/PeriodLockDetails" ) ); const TransactionList = asyncComponent( () => import( /* webpackChunkName: "TransactionList" */ "./transactions/containers/TransactionsList" ) ); const PeriodLockList = asyncComponent( () => import( /* webpackChunkName: "PeriodLockList" */ "./periodLocks/containers/PeriodLocksList" ) ); const ContractTypesList = asyncComponent( () => import( /* webpackChunkName: "ContractTypesList" */ "./contractTypes/containers/ContractTypesList" ) ); const ContractTypeDetails = asyncComponent( () => import( /* webpackChunkName: "ContractTypeDetails" */ "./contractTypes/containers/ContractTypeDetails" ) ); const ContractLists = () => { const location = useLocation(); return ( <ContractList queryParams={queryString.parse(location.search)} isDeposit={false} /> ); }; const DepositLists = () => { const location = useLocation(); return ( <ContractList queryParams={queryString.parse(location.search)} isDeposit={true} /> ); }; const DetailsOfContract = () => { const { id } = useParams(); return <ContractDetails id={id} />; }; const PeriodLockDetail = () => { const { id } = useParams(); return <PeriodLockDetails id={id} />; }; const TransactionLists = () => { const location = useLocation(); return <TransactionList queryParams={queryString.parse(location.search)} />; }; const PeriodLockLists = () => { const location = useLocation(); return <PeriodLockList queryParams={queryString.parse(location.search)} />; }; const ContractTypesLists = () => { const location = useLocation(); return <ContractTypesList queryParams={queryString.parse(location.search)} />; }; const ContractTypeDetail = () => { const { id } = useParams(); return <ContractTypeDetails id={id} />; }; const MainSettingsComponent = () => { return <Settings components={MainSettings}></Settings>; }; const SavingRoutes = () => { return ( <Routes> <Route key="/erxes-plugin-saving/contract-list" path="/erxes-plugin-saving/contract-list" element={<ContractLists />} /> <Route key="/erxes-plugin-saving/deposit-list" path="/erxes-plugin-saving/deposit-list" element={<DepositLists />} /> <Route path="/erxes-plugin-saving/contract-details/:id" element={<DetailsOfContract />} /> <Route path="/erxes-plugin-saving/transaction-list" element={<TransactionLists />} /> <Route path="/erxes-plugin-saving/contract-types" element={<ContractTypesLists />} /> <Route path="/erxes-plugin-saving/contract-type-details/:id" element={<ContractTypeDetail />} /> <Route path="/erxes-plugin-saving/saving-settings" element={<MainSettingsComponent />} /> <Route path="/erxes-plugin-saving/periodLock-list" element={<PeriodLockLists />} /> <Route path="/erxes-plugin-saving/periodLock-details/:id" element={<PeriodLockDetail />} /> </Routes> ); }; export default SavingRoutes; ```
/content/code_sandbox/packages/plugin-savings-ui/src/routes.tsx
xml
2016-11-11T06:54:50
2024-08-16T10:26:06
erxes
erxes/erxes
3,479
867
```xml import {Component, OnInit, ViewContainerRef} from '@angular/core'; import {LoggedInCallback} from './services/cognito.service'; import {environment} from '../environments/environment'; import {Router} from '@angular/router'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent implements OnInit, LoggedInCallback { constructor(public router: Router) {} ngOnInit() { const errorMessages = []; console.log('AppComponent: Checking configuration values.'); if (!environment.cognitoIdentityPoolId) { errorMessages.push('Cognito Identity Pool not configured!\n\t The id is available in cloud formation output section.\n'); } if (!environment.facebookAppId) { errorMessages.push('Facebook App Id not configured! \n\t This is the ID from your facebook developer portal.\n'); } if (!environment.ticketAPI) { errorMessages.push('Ticket API not configured!'); } if (errorMessages.length > 0) { this.router.navigate(['/troubleshooting']); } } isLoggedIn(message: string, isLoggedIn: boolean) { console.log('AppComponent: the user is authenticated: ' + isLoggedIn); } } ```
/content/code_sandbox/MultiRegion/2_UI/src/app/app.component.ts
xml
2016-11-22T22:47:29
2024-08-16T02:04:15
aws-serverless-workshops
aws-samples/aws-serverless-workshops
4,177
259
```xml import * as React from 'react'; import * as ReactDom from 'react-dom'; import { Version } from '@microsoft/sp-core-library'; import { IPropertyPaneConfiguration, PropertyPaneTextField } from '@microsoft/sp-property-pane'; import { BaseClientSideWebPart } from '@microsoft/sp-webpart-base'; import * as strings from 'ReactYammerWebPartStrings'; import ReactYammer from './components/ReactYammer'; import { IReactYammerProps } from './components/IReactYammerProps'; import { AadTokenProvider,AadHttpClient } from '@microsoft/sp-http'; import YammerProvider from './yammer/YammerProvider'; import { IYammerProvider } from './yammer/IYammerProvider'; export interface IReactYammerWebPartProps { description: string; } export default class ReactYammerWebPart extends BaseClientSideWebPart<IReactYammerWebPartProps> { private aadToken: string = ""; public render(): void { let yammerProvider: IYammerProvider = new YammerProvider(this.aadToken, this.context.pageContext.user.email); const element: React.ReactElement<IReactYammerProps> = React.createElement( ReactYammer, { context: this.context, yammerProvider } ); ReactDom.render(element, this.domElement); } public async onInit(): Promise<void> { const tokenProvider: AadTokenProvider = await this.context.aadTokenProviderFactory.getTokenProvider(); await tokenProvider.getToken("path_to_url").then(token => { this.aadToken = token; }).catch(err => console.log(err)); } protected onDispose(): void { ReactDom.unmountComponentAtNode(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-yammer-praise/src/webparts/reactYammer/ReactYammerWebPart.ts
xml
2016-08-30T17:21:43
2024-08-16T18:41:32
sp-dev-fx-webparts
pnp/sp-dev-fx-webparts
2,027
477
```xml <?xml version="1.0" encoding="utf-8"?> <rotate xmlns:android="path_to_url" android:drawable="@drawable/abc_ic_ab_back_material" android:fromDegrees="180" android:pivotX="50%" android:pivotY="50%" android:toDegrees="180" /> ```
/content/code_sandbox/sample/src/main/res/drawable/ms_right_arrow.xml
xml
2016-06-28T08:27:15
2024-08-05T10:12:04
android-material-stepper
stepstone-tech/android-material-stepper
1,781
71
```xml import { tokens } from '@fluentui/react-theme'; import type { SlotClassNames } from '@fluentui/react-utilities'; import { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react'; import type { AvatarSlots, AvatarState } from './Avatar.types'; export const avatarClassNames: SlotClassNames<AvatarSlots> = { root: 'fui-Avatar', image: 'fui-Avatar__image', initials: 'fui-Avatar__initials', icon: 'fui-Avatar__icon', badge: 'fui-Avatar__badge', }; // CSS variables used internally in Avatar's styles const vars = { badgeRadius: '--fui-Avatar-badgeRadius', badgeGap: '--fui-Avatar-badgeGap', badgeAlign: '--fui-Avatar-badgeAlign', ringWidth: '--fui-Avatar-ringWidth', }; const useRootClassName = makeResetStyles({ display: 'inline-block', flexShrink: 0, position: 'relative', verticalAlign: 'middle', borderRadius: tokens.borderRadiusCircular, fontFamily: tokens.fontFamilyBase, fontWeight: tokens.fontWeightSemibold, fontSize: tokens.fontSizeBase300, width: '32px', height: '32px', // ::before is the ring, and ::after is the shadow. // These are not displayed by default; the ring and shadow clases set content: "" to display them when appropriate. '::before,::after': { position: 'absolute', top: 0, left: 0, bottom: 0, right: 0, zIndex: -1, margin: `calc(-2 * var(${vars.ringWidth}, 0px))`, borderRadius: 'inherit', transitionProperty: 'margin, opacity', transitionTimingFunction: `${tokens.curveEasyEaseMax}, ${tokens.curveLinear}`, transitionDuration: `${tokens.durationUltraSlow}, ${tokens.durationSlower}`, '@media screen and (prefers-reduced-motion: reduce)': { transitionDuration: '0.01ms', }, }, '::before': { borderStyle: 'solid', borderWidth: `var(${vars.ringWidth})`, }, }); const useImageClassName = makeResetStyles({ position: 'absolute', top: 0, left: 0, width: '100%', height: '100%', borderRadius: 'inherit', objectFit: 'cover', verticalAlign: 'top', }); const useIconInitialsClassName = makeResetStyles({ position: 'absolute', boxSizing: 'border-box', top: 0, left: 0, width: '100%', height: '100%', lineHeight: '1', border: `${tokens.strokeWidthThin} solid ${tokens.colorTransparentStroke}`, display: 'flex', alignItems: 'center', justifyContent: 'center', verticalAlign: 'center', textAlign: 'center', userSelect: 'none', borderRadius: 'inherit', }); /** * Helper to create a maskImage that punches out a circle larger than the badge by `badgeGap`. * This creates a transparent gap between the badge and Avatar. * * Used by the icon, initials, and image slots, as well as the ring ::before pseudo-element. */ const badgeMask = (margin?: string) => { // Center the cutout at the badge's radius away from the edge. // The ring (::before) also has a 2 * ringWidth margin that also needs to be offset. const centerOffset = margin ? `calc(var(${vars.badgeRadius}) + ${margin})` : `var(${vars.badgeRadius})`; // radial-gradient does not have anti-aliasing, so the transparent and opaque gradient stops are offset by +/- 0.25px // to "fade" from transparent to opaque over a half-pixel and ease the transition. const innerRadius = `calc(var(${vars.badgeRadius}) + var(${vars.badgeGap}) - 0.25px)`; const outerRadius = `calc(var(${vars.badgeRadius}) + var(${vars.badgeGap}) + 0.25px)`; return ( `radial-gradient(circle at bottom ${centerOffset} var(${vars.badgeAlign}) ${centerOffset}, ` + `transparent ${innerRadius}, white ${outerRadius})` ); }; const useStyles = makeStyles({ textCaption2Strong: { fontSize: tokens.fontSizeBase100 }, textCaption1Strong: { fontSize: tokens.fontSizeBase200 }, textSubtitle2: { fontSize: tokens.fontSizeBase400 }, textSubtitle1: { fontSize: tokens.fontSizeBase500 }, textTitle3: { fontSize: tokens.fontSizeBase600 }, squareSmall: { borderRadius: tokens.borderRadiusSmall }, squareMedium: { borderRadius: tokens.borderRadiusMedium }, squareLarge: { borderRadius: tokens.borderRadiusLarge }, squareXLarge: { borderRadius: tokens.borderRadiusXLarge }, activeOrInactive: { transform: 'perspective(1px)', // Work-around for text pixel snapping at the end of the animation transitionProperty: 'transform, opacity', transitionDuration: `${tokens.durationUltraSlow}, ${tokens.durationFaster}`, transitionTimingFunction: `${tokens.curveEasyEaseMax}, ${tokens.curveLinear}`, '@media screen and (prefers-reduced-motion: reduce)': { transitionDuration: '0.01ms', }, }, ring: { // Show the ::before pseudo-element, which is the ring '::before': { content: '""' }, }, ringBadgeCutout: { '::before': { maskImage: badgeMask(/*margin =*/ `2 * var(${vars.ringWidth})`) }, }, ringThick: { [vars.ringWidth]: tokens.strokeWidthThick, }, ringThicker: { [vars.ringWidth]: tokens.strokeWidthThicker, }, ringThickest: { [vars.ringWidth]: tokens.strokeWidthThickest, }, shadow: { // Show the ::after pseudo-element, which is the shadow '::after': { content: '""' }, }, shadow4: { '::after': { boxShadow: tokens.shadow4 }, }, shadow8: { '::after': { boxShadow: tokens.shadow8 }, }, shadow16: { '::after': { boxShadow: tokens.shadow16 }, }, shadow28: { '::after': { boxShadow: tokens.shadow28 }, }, inactive: { opacity: '0.8', transform: 'scale(0.875)', transitionTimingFunction: `${tokens.curveDecelerateMin}, ${tokens.curveLinear}`, '::before,::after': { margin: 0, opacity: 0, transitionTimingFunction: `${tokens.curveDecelerateMin}, ${tokens.curveLinear}`, }, }, // Applied to the badge slot badge: { position: 'absolute', bottom: 0, right: 0, }, // Applied to the image, initials, or icon slot when there is a badge badgeCutout: { maskImage: badgeMask(), }, // Applied to the root when there is a badge badgeAlign: { // Griffel won't auto-flip the "right" alignment to "left" in RTL if it is inline in the maskImage, // so split it out into a css variable that will auto-flip. [vars.badgeAlign]: 'right', }, // Badge size: applied to root when there is a badge tiny: { [vars.badgeRadius]: '3px', [vars.badgeGap]: tokens.strokeWidthThin, }, 'extra-small': { [vars.badgeRadius]: '5px', [vars.badgeGap]: tokens.strokeWidthThin, }, small: { [vars.badgeRadius]: '6px', [vars.badgeGap]: tokens.strokeWidthThin, }, medium: { [vars.badgeRadius]: '8px', [vars.badgeGap]: tokens.strokeWidthThin, }, large: { [vars.badgeRadius]: '10px', [vars.badgeGap]: tokens.strokeWidthThick, }, 'extra-large': { [vars.badgeRadius]: '14px', [vars.badgeGap]: tokens.strokeWidthThick, }, icon12: { fontSize: '12px' }, icon16: { fontSize: '16px' }, icon20: { fontSize: '20px' }, icon24: { fontSize: '24px' }, icon28: { fontSize: '28px' }, icon32: { fontSize: '32px' }, icon48: { fontSize: '48px' }, }); export const useSizeStyles = makeStyles({ 16: { width: '16px', height: '16px' }, 20: { width: '20px', height: '20px' }, 24: { width: '24px', height: '24px' }, 28: { width: '28px', height: '28px' }, 32: { width: '32px', height: '32px' }, 36: { width: '36px', height: '36px' }, 40: { width: '40px', height: '40px' }, 48: { width: '48px', height: '48px' }, 56: { width: '56px', height: '56px' }, 64: { width: '64px', height: '64px' }, 72: { width: '72px', height: '72px' }, 96: { width: '96px', height: '96px' }, 120: { width: '120px', height: '120px' }, 128: { width: '128px', height: '128px' }, }); const useColorStyles = makeStyles({ neutral: { color: tokens.colorNeutralForeground3, backgroundColor: tokens.colorNeutralBackground6, }, brand: { color: tokens.colorNeutralForegroundStaticInverted, backgroundColor: tokens.colorBrandBackgroundStatic, }, 'dark-red': { color: tokens.colorPaletteDarkRedForeground2, backgroundColor: tokens.colorPaletteDarkRedBackground2, }, cranberry: { color: tokens.colorPaletteCranberryForeground2, backgroundColor: tokens.colorPaletteCranberryBackground2, }, red: { color: tokens.colorPaletteRedForeground2, backgroundColor: tokens.colorPaletteRedBackground2, }, pumpkin: { color: tokens.colorPalettePumpkinForeground2, backgroundColor: tokens.colorPalettePumpkinBackground2, }, peach: { color: tokens.colorPalettePeachForeground2, backgroundColor: tokens.colorPalettePeachBackground2, }, marigold: { color: tokens.colorPaletteMarigoldForeground2, backgroundColor: tokens.colorPaletteMarigoldBackground2, }, gold: { color: tokens.colorPaletteGoldForeground2, backgroundColor: tokens.colorPaletteGoldBackground2, }, brass: { color: tokens.colorPaletteBrassForeground2, backgroundColor: tokens.colorPaletteBrassBackground2, }, brown: { color: tokens.colorPaletteBrownForeground2, backgroundColor: tokens.colorPaletteBrownBackground2, }, forest: { color: tokens.colorPaletteForestForeground2, backgroundColor: tokens.colorPaletteForestBackground2, }, seafoam: { color: tokens.colorPaletteSeafoamForeground2, backgroundColor: tokens.colorPaletteSeafoamBackground2, }, 'dark-green': { color: tokens.colorPaletteDarkGreenForeground2, backgroundColor: tokens.colorPaletteDarkGreenBackground2, }, 'light-teal': { color: tokens.colorPaletteLightTealForeground2, backgroundColor: tokens.colorPaletteLightTealBackground2, }, teal: { color: tokens.colorPaletteTealForeground2, backgroundColor: tokens.colorPaletteTealBackground2, }, steel: { color: tokens.colorPaletteSteelForeground2, backgroundColor: tokens.colorPaletteSteelBackground2, }, blue: { color: tokens.colorPaletteBlueForeground2, backgroundColor: tokens.colorPaletteBlueBackground2, }, 'royal-blue': { color: tokens.colorPaletteRoyalBlueForeground2, backgroundColor: tokens.colorPaletteRoyalBlueBackground2, }, cornflower: { color: tokens.colorPaletteCornflowerForeground2, backgroundColor: tokens.colorPaletteCornflowerBackground2, }, navy: { color: tokens.colorPaletteNavyForeground2, backgroundColor: tokens.colorPaletteNavyBackground2, }, lavender: { color: tokens.colorPaletteLavenderForeground2, backgroundColor: tokens.colorPaletteLavenderBackground2, }, purple: { color: tokens.colorPalettePurpleForeground2, backgroundColor: tokens.colorPalettePurpleBackground2, }, grape: { color: tokens.colorPaletteGrapeForeground2, backgroundColor: tokens.colorPaletteGrapeBackground2, }, lilac: { color: tokens.colorPaletteLilacForeground2, backgroundColor: tokens.colorPaletteLilacBackground2, }, pink: { color: tokens.colorPalettePinkForeground2, backgroundColor: tokens.colorPalettePinkBackground2, }, magenta: { color: tokens.colorPaletteMagentaForeground2, backgroundColor: tokens.colorPaletteMagentaBackground2, }, plum: { color: tokens.colorPalettePlumForeground2, backgroundColor: tokens.colorPalettePlumBackground2, }, beige: { color: tokens.colorPaletteBeigeForeground2, backgroundColor: tokens.colorPaletteBeigeBackground2, }, mink: { color: tokens.colorPaletteMinkForeground2, backgroundColor: tokens.colorPaletteMinkBackground2, }, platinum: { color: tokens.colorPalettePlatinumForeground2, backgroundColor: tokens.colorPalettePlatinumBackground2, }, anchor: { color: tokens.colorPaletteAnchorForeground2, backgroundColor: tokens.colorPaletteAnchorBackground2, }, }); const useRingColorStyles = makeStyles({ neutral: { '::before': { color: tokens.colorBrandStroke1 }, }, brand: { '::before': { color: tokens.colorBrandStroke1 }, }, 'dark-red': { '::before': { color: tokens.colorPaletteDarkRedBorderActive }, }, cranberry: { '::before': { color: tokens.colorPaletteCranberryBorderActive }, }, red: { '::before': { color: tokens.colorPaletteRedBorderActive }, }, pumpkin: { '::before': { color: tokens.colorPalettePumpkinBorderActive }, }, peach: { '::before': { color: tokens.colorPalettePeachBorderActive }, }, marigold: { '::before': { color: tokens.colorPaletteMarigoldBorderActive }, }, gold: { '::before': { color: tokens.colorPaletteGoldBorderActive }, }, brass: { '::before': { color: tokens.colorPaletteBrassBorderActive }, }, brown: { '::before': { color: tokens.colorPaletteBrownBorderActive }, }, forest: { '::before': { color: tokens.colorPaletteForestBorderActive }, }, seafoam: { '::before': { color: tokens.colorPaletteSeafoamBorderActive }, }, 'dark-green': { '::before': { color: tokens.colorPaletteDarkGreenBorderActive }, }, 'light-teal': { '::before': { color: tokens.colorPaletteLightTealBorderActive }, }, teal: { '::before': { color: tokens.colorPaletteTealBorderActive }, }, steel: { '::before': { color: tokens.colorPaletteSteelBorderActive }, }, blue: { '::before': { color: tokens.colorPaletteBlueBorderActive }, }, 'royal-blue': { '::before': { color: tokens.colorPaletteRoyalBlueBorderActive }, }, cornflower: { '::before': { color: tokens.colorPaletteCornflowerBorderActive }, }, navy: { '::before': { color: tokens.colorPaletteNavyBorderActive }, }, lavender: { '::before': { color: tokens.colorPaletteLavenderBorderActive }, }, purple: { '::before': { color: tokens.colorPalettePurpleBorderActive }, }, grape: { '::before': { color: tokens.colorPaletteGrapeBorderActive }, }, lilac: { '::before': { color: tokens.colorPaletteLilacBorderActive }, }, pink: { '::before': { color: tokens.colorPalettePinkBorderActive }, }, magenta: { '::before': { color: tokens.colorPaletteMagentaBorderActive }, }, plum: { '::before': { color: tokens.colorPalettePlumBorderActive }, }, beige: { '::before': { color: tokens.colorPaletteBeigeBorderActive }, }, mink: { '::before': { color: tokens.colorPaletteMinkBorderActive }, }, platinum: { '::before': { color: tokens.colorPalettePlatinumBorderActive }, }, anchor: { '::before': { color: tokens.colorPaletteAnchorBorderActive }, }, }); export const useAvatarStyles_unstable = (state: AvatarState): AvatarState => { 'use no memo'; const { size, shape, active, activeAppearance, color } = state; const rootClassName = useRootClassName(); const imageClassName = useImageClassName(); const iconInitialsClassName = useIconInitialsClassName(); const styles = useStyles(); const sizeStyles = useSizeStyles(); const colorStyles = useColorStyles(); const ringColorStyles = useRingColorStyles(); const rootClasses = [rootClassName, size !== 32 && sizeStyles[size]]; if (state.badge) { rootClasses.push(styles.badgeAlign, styles[state.badge.size || 'medium']); } if (size <= 24) { rootClasses.push(styles.textCaption2Strong); } else if (size <= 28) { rootClasses.push(styles.textCaption1Strong); } else if (size <= 40) { // Default text size included in useRootClassName } else if (size <= 56) { rootClasses.push(styles.textSubtitle2); } else if (size <= 96) { rootClasses.push(styles.textSubtitle1); } else { rootClasses.push(styles.textTitle3); } if (shape === 'square') { if (size <= 24) { rootClasses.push(styles.squareSmall); } else if (size <= 48) { rootClasses.push(styles.squareMedium); } else if (size <= 72) { rootClasses.push(styles.squareLarge); } else { rootClasses.push(styles.squareXLarge); } } if (active === 'active' || active === 'inactive') { rootClasses.push(styles.activeOrInactive); if (activeAppearance === 'ring' || activeAppearance === 'ring-shadow') { rootClasses.push(styles.ring, ringColorStyles[color]); if (state.badge) { rootClasses.push(styles.ringBadgeCutout); } if (size <= 48) { rootClasses.push(styles.ringThick); } else if (size <= 64) { rootClasses.push(styles.ringThicker); } else { rootClasses.push(styles.ringThickest); } } if (activeAppearance === 'shadow' || activeAppearance === 'ring-shadow') { rootClasses.push(styles.shadow); if (size <= 28) { rootClasses.push(styles.shadow4); } else if (size <= 48) { rootClasses.push(styles.shadow8); } else if (size <= 64) { rootClasses.push(styles.shadow16); } else { rootClasses.push(styles.shadow28); } } // Note: The inactive style overrides some of the activeAppearance styles and must be applied after them if (active === 'inactive') { rootClasses.push(styles.inactive); } } state.root.className = mergeClasses(avatarClassNames.root, ...rootClasses, state.root.className); if (state.badge) { state.badge.className = mergeClasses(avatarClassNames.badge, styles.badge, state.badge.className); } if (state.image) { state.image.className = mergeClasses( avatarClassNames.image, imageClassName, colorStyles[color], state.badge && styles.badgeCutout, state.image.className, ); } if (state.initials) { state.initials.className = mergeClasses( avatarClassNames.initials, iconInitialsClassName, colorStyles[color], state.badge && styles.badgeCutout, state.initials.className, ); } if (state.icon) { let iconSizeClass; if (size <= 16) { iconSizeClass = styles.icon12; } else if (size <= 24) { iconSizeClass = styles.icon16; } else if (size <= 40) { iconSizeClass = styles.icon20; } else if (size <= 48) { iconSizeClass = styles.icon24; } else if (size <= 56) { iconSizeClass = styles.icon28; } else if (size <= 72) { iconSizeClass = styles.icon32; } else { iconSizeClass = styles.icon48; } state.icon.className = mergeClasses( avatarClassNames.icon, iconInitialsClassName, iconSizeClass, colorStyles[color], state.badge && styles.badgeCutout, state.icon.className, ); } return state; }; ```
/content/code_sandbox/packages/react-components/react-avatar/library/src/components/Avatar/useAvatarStyles.styles.ts
xml
2016-06-06T15:03:44
2024-08-16T18:49:29
fluentui
microsoft/fluentui
18,221
4,775
```xml import { useCurrentTheme, useExpoTheme } from 'expo-dev-client-components'; export function useTheme(): { theme: ReturnType<typeof useExpoTheme>; themeType: 'light' | 'dark'; } { const theme = useExpoTheme(); const themeType = useCurrentTheme(); return { theme, themeType }; } ```
/content/code_sandbox/apps/expo-go/src/utils/useTheme.ts
xml
2016-08-15T17:14:25
2024-08-16T19:54:44
expo
expo/expo
32,004
75
```xml function forceDownload(blobUrl: string, filename: string) { let a: any = document.createElement("a"); a.download = filename; a.href = blobUrl; document.body.appendChild(a); a.click(); a.remove(); } export default function downloadPhoto(url: string, filename: string) { if (!filename) filename = url.split("\\").pop().split("/").pop(); fetch(url, { headers: new Headers({ Origin: location.origin, }), mode: "cors", }) .then((response) => response.blob()) .then((blob) => { let blobUrl = window.URL.createObjectURL(blob); forceDownload(blobUrl, filename); }) .catch((e) => console.error(e)); } ```
/content/code_sandbox/examples/with-cloudinary/utils/downloadPhoto.ts
xml
2016-10-05T23:32:51
2024-08-16T19:44:30
next.js
vercel/next.js
124,056
163
```xml declare module 'cytoscape'; declare module 'cytoscape-clipboard'; declare module 'cytoscape-edgehandles'; declare module 'cytoscape-grid-guide'; declare module 'cytoscape-panzoom'; declare module 'cytoscape-undo-redo'; ```
/content/code_sandbox/api/client/src/app/playbook/playbook.d.ts
xml
2016-06-08T16:34:46
2024-08-16T18:12:30
WALKOFF
nsacyber/WALKOFF
1,198
56
```xml import { filesystem } from "gluegun" import * as tempy from "tempy" import { runIgnite } from "../_test-helpers" const BOILERPLATE_PATH = filesystem.path(__dirname, "../../boilerplate") const setup = (): { TEMP_DIR: string } => { const TEMP_DIR = tempy.directory({ prefix: "ignite-" }) beforeEach(() => { // create the destination directory filesystem.dir(TEMP_DIR) // copy the relevant folders filesystem.copy(BOILERPLATE_PATH + "/app", TEMP_DIR + "/app", { overwrite: true }) filesystem.copy(BOILERPLATE_PATH + "/.maestro", TEMP_DIR + "/.maestro", { overwrite: true }) filesystem.copy(BOILERPLATE_PATH + "/assets", TEMP_DIR + "/assets", { overwrite: true }) }) afterEach(() => { filesystem.remove(TEMP_DIR) // clean up our mess }) return { TEMP_DIR } } describe("ignite-cli remove-demo", () => { const { TEMP_DIR } = setup() it("should print the expected response", async () => { const result = await runIgnite(`remove-demo ${TEMP_DIR}`) // "/user/home/ignite" replaces the temp directory, so we don't get failures when it changes every test run const MOCK_DIR = `/user/home/ignite` const output = result.replace(new RegExp(TEMP_DIR, "g"), MOCK_DIR) expect(output).toMatchSnapshot() }) }) ```
/content/code_sandbox/test/vanilla/ignite-remove-demo.test.ts
xml
2016-02-10T16:06:07
2024-08-16T19:52:51
ignite
infinitered/ignite
17,196
321
```xml import { Color } from './Color' describe('Color', () => { it('should throw an error if the color is invalid', () => { expect(() => new Color('#ff')).toThrowError('Invalid color') }) it('should parse a rgb string', () => { const color = new Color('rgb(255, 0, 0)') expect(color.r).toBe(255) expect(color.g).toBe(0) expect(color.b).toBe(0) expect(color.a).toBe(1) }) it('should throw error if rgb string is invalid', () => { expect(() => new Color('rgb(255, 0)')).toThrowError('Invalid color') expect(() => new Color('rgb(266, -1, 0)')).toThrowError('Invalid color') }) it('should parse a hex string', () => { const color = new Color('#ff0000') expect(color.r).toBe(255) expect(color.g).toBe(0) expect(color.b).toBe(0) expect(color.a).toBe(1) }) it('should throw error if hex string is invalid', () => { expect(() => new Color('#ff')).toThrowError('Invalid color') expect(() => new Color('#ff000')).toThrowError('Invalid color') expect(() => new Color('#ff00000')).toThrowError('Invalid color') }) it('should set the alpha value', () => { const color = new Color('rgb(255, 0, 0)') color.setAlpha(0.5) expect(color.a).toBe(0.5) }) it('should throw error if alpha value is invalid', () => { const color = new Color('rgb(255, 0, 0)') expect(() => color.setAlpha(-1)).toThrowError('Invalid alpha value') expect(() => color.setAlpha(1.1)).toThrowError('Invalid alpha value') }) it('should convert to string', () => { const color = new Color('rgb(255, 0, 0)') color.setAlpha(0.5) expect(color.toString()).toBe('rgba(255, 0, 0, 0.5)') }) it('should return correct isDark value', () => { const autobiographyThemeBG = 'rgb(237, 228, 218)' const darkThemeBG = 'rgb(15, 16, 17)' const solarizedThemeBG = 'rgb(0, 43, 54)' const titaniumThemeBG = 'rgb(238, 239, 241)' expect(new Color(autobiographyThemeBG).isDark()).toBe(false) expect(new Color(darkThemeBG).isDark()).toBe(true) expect(new Color(solarizedThemeBG).isDark()).toBe(true) expect(new Color(titaniumThemeBG).isDark()).toBe(false) }) }) ```
/content/code_sandbox/packages/ui-services/src/Theme/Color.spec.ts
xml
2016-12-05T23:31:33
2024-08-16T06:51:19
app
standardnotes/app
5,180
636
```xml import useNavigate from '../hooks/drive/useNavigate'; import { useSpotlight } from './useSpotlight'; const useOpenPreview = () => { const { navigateToLink } = useNavigate(); const spotlight = useSpotlight(); const openPreview = (shareId: string, linkId: string) => { spotlight.searchSpotlight.close(); navigateToLink(shareId, linkId, true); }; return openPreview; }; export default useOpenPreview; ```
/content/code_sandbox/applications/drive/src/app/components/useOpenPreview.ts
xml
2016-06-08T11:16:51
2024-08-16T14:14:27
WebClients
ProtonMail/WebClients
4,300
103
```xml /** * Before 11/23/2022, web and desktop used independent semantic versioning. After this point, desktop automatically * uses web's versioning. The mapping below allows us to see what particular web version a legacy desktop version maps to */ export const LegacyWebToDesktopVersionMapping: Record<string, string> = { '3.107.0': '3.101.2', '3.106.0': '3.101.1', '3.105.0': '3.101.0', '3.104.1': '3.100.18', '3.104.0': '3.100.17', '3.103.2': '3.100.16', '3.103.1': '3.100.15', '3.103.0': '3.100.14', '3.102.0': '3.100.13', '3.101.2': '3.100.12', '3.101.1': '3.100.11', '3.101.0': '3.100.10', '3.100.8': '3.100.9', '3.100.7': '3.100.8', '3.100.6': '3.100.7', '3.100.5': '3.100.6', '3.100.4': '3.100.5', '3.100.3': '3.100.4', '3.100.2': '3.100.3', '3.100.1': '3.100.2', '3.100.0': '3.100.1', '3.99.0': '3.100.0', '3.98.2': '3.23.301', '3.98.1': '3.23.300', '3.98.0': '3.23.299', '3.97.0': '3.23.298', '3.96.1': '3.23.297', '3.96.0': '3.23.296', '3.95.1': '3.23.295', '3.95.0': '3.23.294', '3.94.2': '3.23.293', '3.94.1': '3.23.292', '3.94.0': '3.23.291', '3.93.19': '3.23.290', '3.93.18': '3.23.289', '3.93.17': '3.23.288', '3.93.16': '3.23.287', '3.93.15': '3.23.286', '3.93.14': '3.23.285', '3.93.13': '3.23.284', '3.93.12': '3.23.283', '3.93.11': '3.23.282', '3.93.10': '3.23.281', '3.93.9': '3.23.280', '3.93.8': '3.23.279', '3.93.7': '3.23.278', '3.93.6': '3.23.277', '3.93.5': '3.23.276', '3.93.4': '3.23.275', '3.93.3': '3.23.274', '3.93.2': '3.23.273', '3.93.1': '3.23.272', '3.93.0': '3.23.271', '3.92.0': '3.23.270', '3.91.1': '3.23.269', '3.91.0': '3.23.268', '3.90.11': '3.23.267', '3.90.10': '3.23.266', '3.90.9': '3.23.265', '3.90.8': '3.23.264', '3.90.7': '3.23.263', '3.90.6': '3.23.262', '3.90.5': '3.23.261', '3.90.4': '3.23.260', '3.90.3': '3.23.259', '3.90.2': '3.23.258', '3.90.1': '3.23.257', '3.90.0': '3.23.256', '3.89.0': '3.23.255', '3.88.1': '3.23.254', '3.88.0': '3.23.253', '3.87.2': '3.23.252', '3.87.1': '3.23.251', '3.87.0': '3.23.250', '3.86.0': '3.23.249', '3.85.2': '3.23.248', '3.85.1': '3.23.247', '3.85.0': '3.23.246', '3.84.7': '3.23.245', '3.84.6': '3.23.244', '3.84.5': '3.23.243', '3.84.4': '3.23.242', '3.84.3': '3.23.241', '3.84.2': '3.23.240', '3.84.1': '3.23.239', '3.84.0': '3.23.238', '3.83.0': '3.23.237', '3.82.6': '3.23.236', '3.82.5': '3.23.235', '3.82.4': '3.23.234', '3.82.3': '3.23.233', '3.82.2': '3.23.232', '3.82.1': '3.23.231', '3.82.0': '3.23.230', '3.81.0': '3.23.229', '3.80.1': '3.23.228', '3.80.0': '3.23.227', '3.79.0': '3.23.226', '3.78.1': '3.23.225', '3.78.0': '3.23.224', '3.77.1': '3.23.223', '3.77.0': '3.23.222', '3.76.2': '3.23.221', '3.76.1': '3.23.220', '3.76.0': '3.23.219', '3.75.1': '3.23.218', '3.75.0': '3.23.217', '3.74.0': '3.23.216', '3.73.0': '3.23.215', '3.72.4': '3.23.214', '3.72.3': '3.23.213', '3.72.2': '3.23.212', '3.72.1': '3.23.211', '3.72.0': '3.23.210', '3.71.8': '3.23.209', '3.71.7': '3.23.208', '3.71.6': '3.23.207', '3.71.5': '3.23.206', '3.71.4': '3.23.205', '3.71.3': '3.23.204', '3.71.2': '3.23.203', '3.71.1': '3.23.202', '3.71.0': '3.23.201', '3.70.5': '3.23.200', '3.70.4': '3.23.199', '3.70.3': '3.23.198', '3.70.2': '3.23.197', '3.70.1': '3.23.196', '3.70.0': '3.23.195', '3.69.1': '3.23.194', '3.69.0': '3.23.193', '3.68.6': '3.23.192', '3.68.5': '3.23.191', '3.68.4': '3.23.190', '3.68.3': '3.23.189', '3.68.2': '3.23.188', '3.68.1': '3.23.187', '3.68.0': '3.23.186', '3.67.4': '3.23.185', '3.67.3': '3.23.184', '3.67.2': '3.23.183', '3.67.1': '3.23.182', '3.67.0': '3.23.181', '3.66.0': '3.23.180', '3.65.0': '3.23.179', '3.64.0': '3.23.178', '3.63.3': '3.23.177', '3.63.2': '3.23.176', '3.63.1': '3.23.175', '3.63.0': '3.23.174', '3.62.4': '3.23.173', '3.62.3': '3.23.172', '3.62.2': '3.23.171', '3.62.1': '3.23.170', '3.62.0': '3.23.169', '3.61.0': '3.23.168', '3.60.0': '3.23.167', '3.59.3': '3.23.166', '3.59.2': '3.23.165', '3.59.1': '3.23.164', '3.59.0': '3.23.163', '3.58.1': '3.23.162', '3.58.0': '3.23.161', '3.57.3': '3.23.160', '3.57.2': '3.23.159', '3.57.1': '3.23.158', '3.57.0': '3.23.157', '3.56.0': '3.23.156', '3.55.2': '3.23.155', '3.55.1': '3.23.154', '3.55.0': '3.23.153', '3.54.6': '3.23.152', '3.54.5': '3.23.151', '3.54.4': '3.23.150', '3.54.3': '3.23.149', '3.54.2': '3.23.148', '3.54.1': '3.23.147', '3.54.0': '3.23.146', '3.53.0': '3.23.145', '3.52.1': '3.23.144', '3.52.0': '3.23.143', '3.51.0': '3.23.142', '3.50.6': '3.23.141', '3.50.5': '3.23.140', '3.50.4': '3.23.139', '3.50.3': '3.23.138', '3.50.2': '3.23.137', '3.50.1': '3.23.136', '3.50.0': '3.23.135', '3.49.3': '3.23.134', '3.49.2': '3.23.133', '3.49.1': '3.23.132', '3.49.0': '3.23.131', '3.48.3': '3.23.130', '3.48.2': '3.23.129', '3.48.1': '3.23.128', '3.48.0': '3.23.127', '3.47.3': '3.23.126', '3.47.2': '3.23.125', '3.47.1': '3.23.124', '3.47.0': '3.23.123', '3.46.3': '3.23.122', '3.46.2': '3.23.121', '3.46.1': '3.23.120', '3.46.0': '3.23.119', '3.45.18': '3.23.118', '3.45.17': '3.23.117', '3.45.16': '3.23.116', '3.45.15': '3.23.115', '3.45.14': '3.23.114', '3.45.13': '3.23.113', '3.45.12': '3.23.112', '3.45.11': '3.23.111', '3.45.10': '3.23.110', '3.45.9': '3.23.109', '3.45.8': '3.23.108', '3.45.7': '3.23.107', '3.45.6': '3.23.106', '3.45.5': '3.23.105', '3.45.4': '3.23.104', '3.45.3': '3.23.103', '3.45.2': '3.23.102', '3.45.1': '3.23.101', '3.45.0': '3.23.100', '3.44.7': '3.23.99', '3.44.6': '3.23.98', '3.44.5': '3.23.97', '3.44.4': '3.23.96', '3.44.3': '3.23.95', '3.44.2': '3.23.94', '3.44.1': '3.23.93', '3.44.0': '3.23.92', '3.43.1': '3.23.91', '3.43.0': '3.23.90', '3.42.1': '3.23.89', '3.42.0': '3.23.88', '3.41.3': '3.23.87', '3.41.2': '3.23.86', '3.41.1': '3.23.85', '3.41.0': '3.23.84', '3.40.7': '3.23.83', '3.40.6': '3.23.82', '3.40.5': '3.23.81', '3.40.4': '3.23.80', '3.40.3': '3.23.79', '3.40.2': '3.23.78', '3.40.1': '3.23.77', '3.40.0': '3.23.76', '3.39.1': '3.23.75', '3.39.0': '3.23.74', '3.38.6': '3.23.73', '3.38.5': '3.23.72', '3.38.4': '3.23.71', '3.38.3': '3.23.70', '3.38.2': '3.23.69', '3.38.1': '3.23.68', '3.38.0': '3.23.67', '3.37.7': '3.23.66', '3.37.6': '3.23.65', '3.37.5': '3.23.64', '3.37.4': '3.23.63', '3.37.3': '3.23.62', '3.37.2': '3.23.61', '3.37.1': '3.23.60', '3.37.0': '3.23.59', '3.36.0': '3.23.58', '3.35.2': '3.23.57', '3.35.1': '3.23.56', '3.35.0': '3.23.55', '3.34.0': '3.23.54', '3.33.8': '3.23.53', '3.33.7': '3.23.52', '3.33.6': '3.23.51', '3.33.5': '3.23.50', '3.33.4': '3.23.49', '3.33.3': '3.23.48', '3.33.2': '3.23.47', '3.33.1': '3.23.46', '3.33.0': '3.23.45', '3.32.0': '3.23.44', '3.31.1': '3.23.43', '3.31.0': '3.23.42', '3.30.0': '3.23.41', '3.29.2': '3.23.40', '3.29.1': '3.23.39', '3.29.0': '3.23.38', '3.28.1': '3.23.37', '3.28.0': '3.23.36', '3.27.7': '3.23.35', '3.27.6': '3.23.34', '3.27.5': '3.23.33', '3.27.4': '3.23.32', '3.27.3': '3.23.31', '3.27.2': '3.23.30', '3.27.1': '3.23.29', '3.27.0': '3.23.28', '3.26.4': '3.23.27', '3.26.3': '3.23.26', '3.26.2': '3.23.25', '3.26.1': '3.23.24', '3.26.0': '3.23.23', '3.25.0': '3.23.22', '3.24.6': '3.23.21', '3.24.5': '3.23.20', '3.24.4': '3.23.19', '3.24.3': '3.23.18', '3.24.3-alpha.1': '3.23.17', '3.24.3-alpha.0': '3.23.16', '3.24.2': '3.23.15', '3.24.2-alpha.1': '3.23.14', '3.24.2-alpha.0': '3.23.13', '3.24.1': '3.23.12', '3.24.1-alpha.0': '3.23.11', '3.24.0': '3.23.10', '3.24.0-alpha.7': '3.23.9', '3.24.0-alpha.6': '3.23.8', '3.24.0-alpha.5': '3.23.7', '3.24.0-alpha.4': '3.23.6', '3.24.0-alpha.3': '3.23.5', '3.24.0-alpha.2': '3.23.4', '3.24.0-alpha.1': '3.23.3', '3.24.0-alpha.0': '3.23.2', '3.23.0': '3.23.1', '3.23.0-alpha.1': '3.23.0', '3.23.0-alpha.0': '3.22.21', '3.22.7-alpha.0': '3.22.20', '3.22.6': '3.22.19', '3.22.6-alpha.0': '3.22.18', '3.22.5': '3.22.17', '3.22.4': '3.22.13-alpha.9', '3.22.3': '3.22.13-alpha.8', '3.22.3-alpha.9': '3.22.16-alpha.1', '3.22.3-alpha.8': '3.22.16-alpha.0', '3.22.3-alpha.7': '3.22.15', '3.22.3-alpha.6': '3.22.15-alpha.3', '3.22.3-alpha.5': '3.22.15-alpha.2', '3.22.3-alpha.4': '3.22.15-alpha.1', '3.22.3-alpha.3': '3.22.15-alpha.0', '3.22.3-alpha.2': '3.22.14', '3.22.3-alpha.1': '3.22.14-alpha.0', '3.22.3-alpha.0': '3.22.13', '3.22.2': '3.22.13-alpha.10', '3.22.1': '3.22.13-alpha.7', '3.22.0': '3.22.13-alpha.6', '3.21.0': '3.22.13-alpha.5', } ```
/content/code_sandbox/packages/ui-services/src/Changelog/LegacyDesktopMapping.ts
xml
2016-12-05T23:31:33
2024-08-16T06:51:19
app
standardnotes/app
5,180
5,366