text
stringlengths
9
39.2M
dir
stringlengths
26
295
lang
stringclasses
185 values
created_date
timestamp[us]
updated_date
timestamp[us]
repo_name
stringlengths
1
97
repo_full_name
stringlengths
7
106
star
int64
1k
183k
len_tokens
int64
1
13.8M
```xml import { defineConfig } from "@hey-api/openapi-ts"; export default defineConfig({ input: "backend/schema.yml", output: { path: "frontend/js/api", format: "prettier", }, client: "axios", useOptions: true, }); ```
/content/code_sandbox/openapi-ts.config.ts
xml
2016-07-19T20:37:29
2024-08-16T16:09:17
django-react-boilerplate
vintasoftware/django-react-boilerplate
1,920
62
```xml /* * Squidex Headless CMS * * @license */ import { CdkDrag, CdkDragDrop, CdkDragHandle, CdkDropList } from '@angular/cdk/drag-drop'; import { booleanAttribute, Component, EventEmitter, Input, Output } from '@angular/core'; import { AppSettingsDto, FieldDto, FieldGroup, LanguageDto, LocalStoreService, RootFieldDto, SchemaDto, Settings, StatefulComponent } from '@app/shared'; import { FieldComponent } from './field.component'; interface State { // The when the section is collapsed. isCollapsed: boolean; } @Component({ standalone: true, selector: 'sqx-field-group', styleUrls: ['./field-group.component.scss'], templateUrl: './field-group.component.html', imports: [ CdkDrag, CdkDragHandle, CdkDropList, FieldComponent, ], }) export class FieldGroupComponent extends StatefulComponent<State> { @Output() public sorted = new EventEmitter<CdkDragDrop<FieldDto[]>>(); @Input({ required: true }) public languages!: ReadonlyArray<LanguageDto>; @Input() public parent?: RootFieldDto; @Input({ required: true }) public settings!: AppSettingsDto; @Input({ transform: booleanAttribute }) public sortable = false; @Input({ required: true }) public schema!: SchemaDto; @Input({ transform: booleanAttribute }) public fieldsEmpty = false; @Input({ required: true }) public fieldGroup!: FieldGroup; public trackByFieldFn: (_index: number, field: FieldDto) => any; public get hasAnyFields() { return this.parent ? this.parent.nested.length > 0 : this.schema.fields.length > 0; } constructor( private readonly localStore: LocalStoreService, ) { super({ isCollapsed: false }); this.changes.subscribe(change => { if (this.fieldGroup?.separator && this.schema) { this.localStore.setBoolean(this.isCollapsedKey(), change.snapshot.isCollapsed); } }); this.trackByFieldFn = this.trackByField.bind(this); } public ngOnInit() { if (this.fieldGroup?.separator && this.schema) { const isCollapsed = this.localStore.getBoolean(this.isCollapsedKey()); this.next({ isCollapsed }); } } public toggle() { this.next(s => ({ ...s, isCollapsed: !s.isCollapsed, })); } public trackByField(_index: number, field: FieldDto) { return field.fieldId + this.schema.id; } private isCollapsedKey(): string { return Settings.Local.FIELD_COLLAPSED(this.schema?.id, this.fieldGroup.separator?.fieldId); } } ```
/content/code_sandbox/frontend/src/app/features/schemas/pages/schema/fields/field-group.component.ts
xml
2016-08-29T05:53:40
2024-08-16T17:39:38
squidex
Squidex/squidex
2,222
594
```xml <dict> <key>LayoutID</key> <integer>13</integer> <key>PathMapRef</key> <array> <dict> <key>CodecID</key> <array> <integer>287143641</integer> </array> <key>Headphone</key> <dict> <key>AmpPostDelay</key> <integer>150</integer> <key>AmpPreDelay</key> <integer>150</integer> <key>MuteGPIO</key> <integer>0</integer> </dict> <key>Inputs</key> <array> <string>LineIn</string> <string>Mic</string> </array> <key>IntSpeaker</key> <dict> <key>MaximumBootBeepValue</key> <integer>64</integer> <key>MuteGPIO</key> <integer>0</integer> </dict> <key>LineIn</key> <dict/> <key>Mic</key> <dict> <key>SignalProcessing</key> <dict> <key>SoftwareDSP</key> <dict> <key>DspFunction0</key> <dict> <key>FunctionInfo</key> <dict> <key>DspFuncInstance</key> <integer>0</integer> <key>DspFuncName</key> <string>DspNoiseReduction</string> <key>DspFuncProcessingIndex</key> <integer>0</integer> </dict> <key>ParameterInfo</key> <dict> <key>1</key> <integer>0</integer> <key>2</key> <integer>0</integer> <key>3</key> <integer>0</integer> <key>4</key> <integer>0</integer> </dict> <key>PatchbayInfo</key> <dict/> </dict> <key>DspFunction1</key> <dict> <key>FunctionInfo</key> <dict> <key>DspFuncInstance</key> <integer>1</integer> <key>DspFuncName</key> <string>DspGainStage</string> <key>DspFuncProcessingIndex</key> <integer>1</integer> </dict> <key>ParameterInfo</key> <dict> <key>1</key> <integer>0</integer> <key>2</key> <integer>1078616770</integer> <key>3</key> <integer>1078616770</integer> </dict> <key>PatchbayInfo</key> <dict> <key>InputPort0</key> <dict> <key>PortInstance</key> <integer>0</integer> <key>PortWidth</key> <integer>1</integer> <key>SourceFuncInstance</key> <integer>0</integer> <key>SourcePortIndex</key> <integer>0</integer> </dict> <key>InputPort1</key> <dict> <key>PortInstance</key> <integer>1</integer> <key>PortWidth</key> <integer>1</integer> <key>SourceFuncInstance</key> <integer>0</integer> <key>SourcePortIndex</key> <integer>1</integer> </dict> </dict> </dict> <key>DspFunction2</key> <dict> <key>FunctionInfo</key> <dict> <key>DspFuncInstance</key> <integer>2</integer> <key>DspFuncName</key> <string>DspEqualization</string> <key>DspFuncProcessingIndex</key> <integer>2</integer> </dict> <key>ParameterInfo</key> <dict> <key>1</key> <integer>0</integer> <key>Filter</key> <array> <dict> <key>2</key> <integer>2</integer> <key>3</key> <integer>0</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>1</integer> <key>6</key> <integer>1118830697</integer> <key>7</key> <integer>1060439283</integer> <key>8</key> <integer>-1044468775</integer> </dict> <dict> <key>2</key> <integer>2</integer> <key>3</key> <integer>1</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1137063621</integer> <key>7</key> <integer>1054939033</integer> <key>8</key> <integer>-1086368275</integer> </dict> <dict> <key>2</key> <integer>2</integer> <key>3</key> <integer>4</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1162269254</integer> <key>7</key> <integer>1066566541</integer> <key>8</key> <integer>-1056209924</integer> </dict> <dict> <key>2</key> <integer>2</integer> <key>3</key> <integer>15</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>6</integer> <key>6</key> <integer>1180675529</integer> <key>7</key> <integer>1060439283</integer> <key>8</key> <integer>-1044381696</integer> </dict> </array> </dict> <key>PatchbayInfo</key> <dict> <key>InputPort0</key> <dict> <key>PortInstance</key> <integer>0</integer> <key>PortWidth</key> <integer>1</integer> <key>SourceFuncInstance</key> <integer>1</integer> <key>SourcePortIndex</key> <integer>0</integer> </dict> <key>InputPort1</key> <dict> <key>PortInstance</key> <integer>1</integer> <key>PortWidth</key> <integer>1</integer> <key>SourceFuncInstance</key> <integer>1</integer> <key>SourcePortIndex</key> <integer>1</integer> </dict> </dict> </dict> </dict> </dict> </dict> <key>Outputs</key> <array> <string>IntSpeaker</string> <string>Headphone</string> </array> <key>PathMapID</key> <integer>13</integer> </dict> </array> </dict> ```
/content/code_sandbox/Resources/IDT92HD87B2_4/layout13.xml
xml
2016-03-07T20:45:58
2024-08-14T08:57:03
AppleALC
acidanthera/AppleALC
3,420
1,963
```xml import { useCallback, useRef, useState } from 'react'; import type { Dispatch, MutableRefObject, SetStateAction } from 'react'; export default function useStateRef<T>( initialValue?: T ): readonly [T, Dispatch<SetStateAction<T>>, MutableRefObject<T>] { const [_, forceRender] = useState<{}>(); const valueRef: MutableRefObject<T> = useRef<T>(initialValue); const setter: Dispatch<SetStateAction<T>> = useCallback( (value: SetStateAction<T>) => { const { current } = valueRef; value = value instanceof Function ? value(current) : value; if (current !== value) { valueRef.current = value; forceRender({}); } }, [forceRender, valueRef] ); return Object.freeze([valueRef.current, setter, valueRef]) as readonly [ T, Dispatch<SetStateAction<T>>, MutableRefObject<T> ]; } ```
/content/code_sandbox/packages/component/src/hooks/internal/useStateRef.ts
xml
2016-07-07T23:16:57
2024-08-16T00:12:37
BotFramework-WebChat
microsoft/BotFramework-WebChat
1,567
206
```xml import { useMutation } from "@apollo/client" import { toast } from "@/components/ui/use-toast" import { mutations } from "../graphql" const userFeedbackMutation = ({ callBack, }: { callBack: (result: string) => void }) => { const [ticketsAdd, { loading: loadingTicket }] = useMutation( mutations.ticketsAdd, { refetchQueries: ["tickets", "ticketsTotalCount"], } ) const addTickets = (params: any) => { ticketsAdd({ variables: { ...params, proccessId: Math.random().toString() }, }) .then(() => { toast({ title: `Send feedback`, description: `Successfully sent your feedback`, variant: "success", }) callBack("success") }) .catch((error) => { toast({ description: error.message, title: `Send feedback`, variant: "destructive", }) }) } return { addTickets, loading: loadingTicket, } } export default userFeedbackMutation ```
/content/code_sandbox/exm-web/modules/discover/hooks/userFeedbackMutation.tsx
xml
2016-11-11T06:54:50
2024-08-16T10:26:06
erxes
erxes/erxes
3,479
230
```xml import { useCallback } from 'react'; import RcSlider from 'rc-slider'; import clsx from 'clsx'; import { Lock, XCircle, CheckCircle } from 'lucide-react'; import { SliderTooltip } from '@@/Tip/SliderTooltip'; import 'rc-slider/assets/index.css'; import { Badge } from '../Badge'; import styles from './PasswordLengthSlider.module.css'; export interface Props { min: number; max: number; step: number; value: number; onChange(value: number | number[]): void; } type Strength = 'weak' | 'good' | 'strong' | 'veryStrong'; const sliderProperties: Record< Strength, { strength: string; color: string; text: string } > = { weak: { strength: 'weak', color: '#F04438', text: 'Weak password', }, good: { strength: 'good', color: '#F79009', text: 'Good password', }, strong: { strength: 'strong', color: '#12B76A', text: 'Strong password', }, veryStrong: { strength: 'veryStrong', color: '#0BA5EC', text: 'Very strong password', }, }; export function PasswordLengthSlider({ min, max, step, value, onChange, }: Props) { const sliderProps = getSliderProps(value); function getSliderProps(value: number) { if (value < 10) { return sliderProperties.weak; } if (value < 12) { return sliderProperties.good; } if (value < 14) { return sliderProperties.strong; } return sliderProperties.veryStrong; } function getBadgeIcon(strength: string) { switch (strength) { case 'weak': return <XCircle size="13" className="space-right" strokeWidth="3px" />; case 'good': case 'strong': return ( <CheckCircle size="13" className="space-right" strokeWidth="3px" /> ); default: return <Lock size="13" className="space-right" strokeWidth="3px" />; } } function handleChange(sliderValue: number | number[]) { onChange(sliderValue); } const sliderTooltip = useCallback( (node, handleProps) => ( <SliderTooltip value={`${handleProps.value} characters`} child={node} delay={800} /> ), [] ); return ( <div className={clsx(styles.root, styles[sliderProps.strength])}> <div className="col-sm-4"> <RcSlider handleRender={sliderTooltip} min={min} max={max} step={step} defaultValue={12} value={value} onChange={handleChange} /> </div> <div className={clsx('col-sm-2', styles.sliderBadge)}> <Badge icon={getBadgeIcon(sliderProps.strength)} value={sliderProps.text} color={sliderProps.color} /> </div> </div> ); } ```
/content/code_sandbox/app/react/portainer/settings/AuthenticationView/InternalAuth/PasswordLengthSlider/PasswordLengthSlider.tsx
xml
2016-05-19T20:15:28
2024-08-16T19:15:14
portainer
portainer/portainer
30,083
694
```xml import type {Placement} from '@floating-ui/utils'; import { evaluate, getAlignmentSides, getExpandedPlacements, getOppositeAxisPlacements, getOppositePlacement, getSide, getSideAxis, } from '@floating-ui/utils'; import type {DetectOverflowOptions} from '../detectOverflow'; import {detectOverflow} from '../detectOverflow'; import type {Derivable, Middleware} from '../types'; export interface FlipOptions extends DetectOverflowOptions { /** * The axis that runs along the side of the floating element. Determines * whether overflow along this axis is checked to perform a flip. * @default true */ mainAxis?: boolean; /** * The axis that runs along the alignment of the floating element. Determines * whether overflow along this axis is checked to perform a flip. * @default true */ crossAxis?: boolean; /** * Placements to try sequentially if the preferred `placement` does not fit. * @default [oppositePlacement] (computed) */ fallbackPlacements?: Array<Placement>; /** * What strategy to use when no placements fit. * @default 'bestFit' */ fallbackStrategy?: 'bestFit' | 'initialPlacement'; /** * Whether to allow fallback to the perpendicular axis of the preferred * placement, and if so, which side direction along the axis to prefer. * @default 'none' (disallow fallback) */ fallbackAxisSideDirection?: 'none' | 'start' | 'end'; /** * Whether to flip to placements with the opposite alignment if they fit * better. * @default true */ flipAlignment?: boolean; } /** * Optimizes the visibility of the floating element by flipping the `placement` * in order to keep it in view when the preferred placement(s) will overflow the * clipping boundary. Alternative to `autoPlacement`. * @see path_to_url */ export const flip = ( options: FlipOptions | Derivable<FlipOptions> = {}, ): Middleware => ({ name: 'flip', options, async fn(state) { const { placement, middlewareData, rects, initialPlacement, platform, elements, } = state; const { mainAxis: checkMainAxis = true, crossAxis: checkCrossAxis = true, fallbackPlacements: specifiedFallbackPlacements, fallbackStrategy = 'bestFit', fallbackAxisSideDirection = 'none', flipAlignment = true, ...detectOverflowOptions } = evaluate(options, state); // If a reset by the arrow was caused due to an alignment offset being // added, we should skip any logic now since `flip()` has already done its // work. // path_to_url#issuecomment-1719601643 if (middlewareData.arrow?.alignmentOffset) { return {}; } const side = getSide(placement); const initialSideAxis = getSideAxis(initialPlacement); const isBasePlacement = getSide(initialPlacement) === initialPlacement; const rtl = await platform.isRTL?.(elements.floating); const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement)); const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== 'none'; if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) { fallbackPlacements.push( ...getOppositeAxisPlacements( initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl, ), ); } const placements = [initialPlacement, ...fallbackPlacements]; const overflow = await detectOverflow(state, detectOverflowOptions); const overflows = []; let overflowsData = middlewareData.flip?.overflows || []; if (checkMainAxis) { overflows.push(overflow[side]); } if (checkCrossAxis) { const sides = getAlignmentSides(placement, rects, rtl); overflows.push(overflow[sides[0]], overflow[sides[1]]); } overflowsData = [...overflowsData, {placement, overflows}]; // One or more sides is overflowing. if (!overflows.every((side) => side <= 0)) { const nextIndex = (middlewareData.flip?.index || 0) + 1; const nextPlacement = placements[nextIndex]; if (nextPlacement) { // Try next placement and re-run the lifecycle. return { data: { index: nextIndex, overflows: overflowsData, }, reset: { placement: nextPlacement, }, }; } // First, find the candidates that fit on the mainAxis side of overflow, // then find the placement that fits the best on the main crossAxis side. let resetPlacement = overflowsData .filter((d) => d.overflows[0] <= 0) .sort((a, b) => a.overflows[1] - b.overflows[1])[0]?.placement; // Otherwise fallback. if (!resetPlacement) { switch (fallbackStrategy) { case 'bestFit': { const placement = overflowsData .filter((d) => { if (hasFallbackAxisSideDirection) { const currentSideAxis = getSideAxis(d.placement); return ( currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal // reading directions favoring greater width. currentSideAxis === 'y' ); } return true; }) .map( (d) => [ d.placement, d.overflows .filter((overflow) => overflow > 0) .reduce((acc, overflow) => acc + overflow, 0), ] as const, ) .sort((a, b) => a[1] - b[1])[0]?.[0]; if (placement) { resetPlacement = placement; } break; } case 'initialPlacement': resetPlacement = initialPlacement; break; default: } } if (placement !== resetPlacement) { return { reset: { placement: resetPlacement, }, }; } } return {}; }, }); ```
/content/code_sandbox/packages/core/src/middleware/flip.ts
xml
2016-03-29T17:00:47
2024-08-16T16:29:40
floating-ui
floating-ui/floating-ui
29,450
1,387
```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="M7.5 0C11.75 0 15 3.5 15 7.5C15 11.5 11.75 15 7.5 15C3.25 15 0 11.75 0 7.5C0 3.25 3.25 0 7.5 0zM6 9.25C6 9.25 3.13 11.25 3.13 11.25C3.13 11.25 4.5 13.25 7.5 13.25C10.5 13.25 11.88 11.25 11.88 11.25C11.88 11.25 9 9.25 9 9.25C8.06 9.88 6.94 9.88 6 9.25zM6.5 1.75C4 2.25 1.75 4.75 1.75 7.5C1.75 9.06 2.19 9.69 2.19 9.69C2.19 9.69 5.25 7.75 5.25 7.75C5.25 7.75 5 6.25 6.5 5.5C6.5 5.5 6.5 1.75 6.5 1.75zM8.5 1.75C8.5 1.75 8.5 5.5 8.5 5.5C10 6.25 9.75 7.75 9.75 7.75C9.75 7.75 12.81 9.69 12.81 9.69C12.81 9.69 13.25 9 13.25 7.5C13.25 4.75 11 2.25 8.5 1.75z"/> </vector> ```
/content/code_sandbox/app/src/main/res/drawable/ic_preset_temaki_wheel.xml
xml
2016-07-02T10:44:04
2024-08-16T18:55:54
StreetComplete
streetcomplete/StreetComplete
3,781
516
```xml import Msg from "../../models/msg"; import {IrcEventHandler} from "../../client"; import {MessageType} from "../../../shared/types/msg"; export default <IrcEventHandler>function (irc, network) { const client = this; irc.on("help", function (data) { const lobby = network.getLobby(); if (data.help) { const msg = new Msg({ type: MessageType.MONOSPACE_BLOCK, command: "help", text: data.help, }); lobby.pushMessage(client, msg, true); } }); }; ```
/content/code_sandbox/server/plugins/irc-events/help.ts
xml
2016-02-09T03:16:03
2024-08-16T10:52:38
thelounge
thelounge/thelounge
5,518
122
```xml import { Entity } from "../../../../../src/decorator/entity/Entity" import { PrimaryGeneratedColumn } from "../../../../../src/decorator/columns/PrimaryGeneratedColumn" import { Column } from "../../../../../src/decorator/columns/Column" @Entity() export class Post { @PrimaryGeneratedColumn() id: number @Column() title: string @Column() author: string @Column() moderator: string } ```
/content/code_sandbox/test/functional/query-builder/distinct-on/entity/Post.ts
xml
2016-02-29T07:41:14
2024-08-16T18:28:52
typeorm
typeorm/typeorm
33,875
97
```xml <resources> <string name="app_name">expanding-collection</string> </resources> ```
/content/code_sandbox/expanding-collection/src/main/res/values/strings.xml
xml
2016-10-06T13:30:26
2024-08-15T19:22:08
expanding-collection-android
Ramotion/expanding-collection-android
2,022
21
```xml import type { KeyTransparencyState, VerifyOutboundPublicKeys } from '@proton/shared/lib/interfaces'; import { KeyTransparencyActivation } from '@proton/shared/lib/interfaces'; import { defaultKeyTransparencyState } from '@proton/shared/lib/keyTransparency'; export interface KTContext { verifyOutboundPublicKeys: VerifyOutboundPublicKeys; ktActivation: KeyTransparencyActivation; ktState: KeyTransparencyState; } export const defaultKTContext: KTContext = { verifyOutboundPublicKeys: async () => { return {}; }, ktActivation: KeyTransparencyActivation.DISABLED, ktState: defaultKeyTransparencyState, }; ```
/content/code_sandbox/packages/components/containers/keyTransparency/ktContext.ts
xml
2016-06-08T11:16:51
2024-08-16T14:14:27
WebClients
ProtonMail/WebClients
4,300
142
```xml export const Alt = 'Alt'; export const AltGraph = 'AltGraph'; export const CapsLock = 'CapsLock'; export const Control = 'Control'; export const Fn = 'Fn'; export const FnLock = 'FnLock'; export const Meta = 'Meta'; export const NumLock = 'NumLock'; export const ScrollLock = 'ScrollLock'; export const Shift = 'Shift'; export const Symbol = 'Symbol'; export const SymbolLock = 'SymbolLock'; export const Hyper = 'Hyper'; export const Super = 'Super'; export const Enter = 'Enter'; export const Space = ' '; export const Tab = 'Tab'; export const ArrowDown = 'ArrowDown'; export const ArrowLeft = 'ArrowLeft'; export const ArrowRight = 'ArrowRight'; export const ArrowUp = 'ArrowUp'; export const End = 'End'; export const Home = 'Home'; export const PageDown = 'PageDown'; export const PageUp = 'PageUp'; export const Backspace = 'Backspace'; export const Clear = 'Clear'; export const Copy = 'Copy'; export const CrSel = 'CrSel'; export const Cut = 'Cut'; export const Delete = 'Delete'; export const EraseEof = 'EraseEof'; export const ExSel = 'ExSel'; export const Insert = 'Insert'; export const Paste = 'Paste'; export const Redo = 'Redo'; export const Undo = 'Undo'; export const Accept = 'Accept'; export const Again = 'Again'; export const Attn = 'Attn'; export const Cancel = 'Cancel'; export const ContextMenu = 'ContextMenu'; export const Escape = 'Escape'; export const Execute = 'Execute'; export const Find = 'Find'; export const Help = 'Help'; export const Pause = 'Pause'; export const Play = 'Play'; export const Props = 'Props'; export const Select = 'Select'; export const ZoomIn = 'ZoomIn'; export const ZoomOut = 'ZoomOut'; export const BrightnessDown = 'BrightnessDown'; export const BrightnessUp = 'BrightnessUp'; export const Eject = 'Eject'; export const LogOff = 'LogOff'; export const Power = 'Power'; export const PowerOff = 'PowerOff'; export const PrintScreen = 'PrintScreen'; export const Hibernate = 'Hibernate'; export const Standby = 'Standby'; export const WakeUp = 'WakeUp'; export const AllCandidates = 'AllCandidates'; export const Alphanumeric = 'Alphanumeric'; export const CodeInput = 'CodeInput'; export const Compose = 'Compose'; export const Convert = 'Convert'; export const Dead = 'Dead'; export const FinalMode = 'FinalMode'; export const GroupFirst = 'GroupFirst'; export const GroupLast = 'GroupLast'; export const GroupNext = 'GroupNext'; export const GroupPrevious = 'GroupPrevious'; export const ModeChange = 'ModeChange'; export const NextCandidate = 'NextCandidate'; export const NonConvert = 'NonConvert'; export const PreviousCandidate = 'PreviousCandidate'; export const Process = 'Process'; export const SingleCandidate = 'SingleCandidate'; export const HangulMode = 'HangulMode'; export const HanjaMode = 'HanjaMode'; export const JunjaMode = 'JunjaMode'; export const Eisu = 'Eisu'; export const Hankaku = 'Hankaku'; export const Hiragana = 'Hiragana'; export const HiraganaKatakana = 'HiraganaKatakana'; export const KanaMode = 'KanaMode'; export const KanjiMode = 'KanjiMode'; export const Katakana = 'Katakana'; export const Romaji = 'Romaji'; export const Zenkaku = 'Zenkaku'; export const ZenkakuHankaku = 'ZenkakuHankaku'; export const F1 = 'F1'; export const F2 = 'F2'; export const F3 = 'F3'; export const F4 = 'F4'; export const F5 = 'F5'; export const F6 = 'F6'; export const F7 = 'F7'; export const F8 = 'F8'; export const F9 = 'F9'; export const F10 = 'F10'; export const F11 = 'F11'; export const F12 = 'F12'; export const Soft1 = 'Soft1'; export const Soft2 = 'Soft2'; export const Soft3 = 'Soft3'; export const Soft4 = 'Soft4'; export const ChannelDown = 'ChannelDown'; export const ChannelUp = 'ChannelUp'; export const Close = 'Close'; export const MailForward = 'MailForward'; export const MailReply = 'MailReply'; export const MailSend = 'MailSend'; export const MediaClose = 'MediaClose'; export const MediaFastForward = 'MediaFastForward'; export const MediaPause = 'MediaPause'; export const MediaPlay = 'MediaPlay'; export const MediaPlayPause = 'MediaPlayPause'; export const MediaRecord = 'MediaRecord'; export const MediaRewind = 'MediaRewind'; export const MediaStop = 'MediaStop'; export const MediaTrackNext = 'MediaTrackNext'; export const MediaTrackPrevious = 'MediaTrackPrevious'; export const New = 'New'; export const Open = 'Open'; export const Print = 'Print'; export const Save = 'Save'; export const SpellCheck = 'SpellCheck'; export const Key11 = 'Key11'; export const Key12 = 'Key12'; export const AudioBalanceLeft = 'AudioBalanceLeft'; export const AudioBalanceRight = 'AudioBalanceRight'; export const AudioBassBoostDown = 'AudioBassBoostDown'; export const AudioBassBoostToggle = 'AudioBassBoostToggle'; export const AudioBassBoostUp = 'AudioBassBoostUp'; export const AudioFaderFront = 'AudioFaderFront'; export const AudioFaderRear = 'AudioFaderRear'; export const AudioSurroundModeNext = 'AudioSurroundModeNext'; export const AudioTrebleDown = 'AudioTrebleDown'; export const AudioTrebleUp = 'AudioTrebleUp'; export const AudioVolumeDown = 'AudioVolumeDown'; export const AudioVolumeUp = 'AudioVolumeUp'; export const AudioVolumeMute = 'AudioVolumeMute'; export const MicrophoneToggle = 'MicrophoneToggle'; export const MicrophoneVolumeDown = 'MicrophoneVolumeDown'; export const MicrophoneVolumeUp = 'MicrophoneVolumeUp'; export const MicrophoneVolumeMute = 'MicrophoneVolumeMute'; export const SpeechCorrectionList = 'SpeechCorrectionList'; export const SpeechInputToggle = 'SpeechInputToggle'; export const LaunchApplication1 = 'LaunchApplication1'; export const LaunchApplication2 = 'LaunchApplication2'; export const LaunchCalendar = 'LaunchCalendar'; export const LaunchContacts = 'LaunchContacts'; export const LaunchMail = 'LaunchMail'; export const LaunchMediaPlayer = 'LaunchMediaPlayer'; export const LaunchMusicPlayer = 'LaunchMusicPlayer'; export const LaunchPhone = 'LaunchPhone'; export const LaunchScreenSaver = 'LaunchScreenSaver'; export const LaunchSpreadsheet = 'LaunchSpreadsheet'; export const LaunchWebBrowser = 'LaunchWebBrowser'; export const LaunchWebCam = 'LaunchWebCam'; export const LaunchWordProcessor = 'LaunchWordProcessor'; export const BrowserBack = 'BrowserBack'; export const BrowserFavorites = 'BrowserFavorites'; export const BrowserForward = 'BrowserForward'; export const BrowserHome = 'BrowserHome'; export const BrowserRefresh = 'BrowserRefresh'; export const BrowserSearch = 'BrowserSearch'; export const BrowserStop = 'BrowserStop'; export const AppSwitch = 'AppSwitch'; export const Call = 'Call'; export const Camera = 'Camera'; export const CameraFocus = 'CameraFocus'; export const EndCall = 'EndCall'; export const GoBack = 'GoBack'; export const GoHome = 'GoHome'; export const HeadsetHook = 'HeadsetHook'; export const LastNumberRedial = 'LastNumberRedial'; export const Notification = 'Notification'; export const MannerMode = 'MannerMode'; export const VoiceDial = 'VoiceDial'; export const TV = 'TV'; export const TV3DMode = 'TV3DMode'; export const TVAntennaCable = 'TVAntennaCable'; export const TVAudioDescription = 'TVAudioDescription'; export const TVAudioDescriptionMixDown = 'TVAudioDescriptionMixDown'; export const TVAudioDescriptionMixUp = 'TVAudioDescriptionMixUp'; export const TVContentsMenu = 'TVContentsMenu'; export const TVDataService = 'TVDataService'; export const TVInput = 'TVInput'; export const TVInputComponent1 = 'TVInputComponent1'; export const TVInputComponent2 = 'TVInputComponent2'; export const TVInputComposite1 = 'TVInputComposite1'; export const TVInputComposite2 = 'TVInputComposite2'; export const TVInputHDMI1 = 'TVInputHDMI1'; export const TVInputHDMI2 = 'TVInputHDMI2'; export const TVInputHDMI3 = 'TVInputHDMI3'; export const TVInputHDMI4 = 'TVInputHDMI4'; export const TVInputVGA1 = 'TVInputVGA1'; export const TVMediaContext = 'TVMediaContext'; export const TVNetwork = 'TVNetwork'; export const TVNumberEntry = 'TVNumberEntry'; export const TVPower = 'TVPower'; export const TVRadioService = 'TVRadioService'; export const TVSatellite = 'TVSatellite'; export const TVSatelliteBS = 'TVSatelliteBS'; export const TVSatelliteCS = 'TVSatelliteCS'; export const TVSatelliteToggle = 'TVSatelliteToggle'; export const TVTerrestrialAnalog = 'TVTerrestrialAnalog'; export const TVTerrestrialDigital = 'TVTerrestrialDigital'; export const TVTimer = 'TVTimer'; export const AVRInput = 'AVRInput'; export const AVRPower = 'AVRPower'; export const ColorF0Red = 'ColorF0Red'; export const ColorF1Green = 'ColorF1Green'; export const ColorF2Yellow = 'ColorF2Yellow'; export const ColorF3Blue = 'ColorF3Blue'; export const ColorF4Grey = 'ColorF4Grey'; export const ColorF5Brown = 'ColorF5Brown'; export const ClosedCaptionToggle = 'ClosedCaptionToggle'; export const Dimmer = 'Dimmer'; export const DisplaySwap = 'DisplaySwap'; export const DVR = 'DVR'; export const Exit = 'Exit'; export const FavoriteClear0 = 'FavoriteClear0'; export const FavoriteClear1 = 'FavoriteClear1'; export const FavoriteClear2 = 'FavoriteClear2'; export const FavoriteClear3 = 'FavoriteClear3'; export const FavoriteRecall0 = 'FavoriteRecall0'; export const FavoriteRecall1 = 'FavoriteRecall1'; export const FavoriteRecall2 = 'FavoriteRecall2'; export const FavoriteRecall3 = 'FavoriteRecall3'; export const FavoriteStore0 = 'FavoriteStore0'; export const FavoriteStore1 = 'FavoriteStore1'; export const FavoriteStore2 = 'FavoriteStore2'; export const FavoriteStore3 = 'FavoriteStore3'; export const Guide = 'Guide'; export const GuideNextDay = 'GuideNextDay'; export const GuidePreviousDay = 'GuidePreviousDay'; export const Info = 'Info'; export const InstantReplay = 'InstantReplay'; export const Link = 'Link'; export const ListProgram = 'ListProgram'; export const LiveContent = 'LiveContent'; export const Lock = 'Lock'; export const MediaApps = 'MediaApps'; export const MediaAudioTrack = 'MediaAudioTrack'; export const MediaLast = 'MediaLast'; export const MediaSkipBackward = 'MediaSkipBackward'; export const MediaSkipForward = 'MediaSkipForward'; export const MediaStepBackward = 'MediaStepBackward'; export const MediaStepForward = 'MediaStepForward'; export const MediaTopMenu = 'MediaTopMenu'; export const NavigateIn = 'NavigateIn'; export const NavigateNext = 'NavigateNext'; export const NavigateOut = 'NavigateOut'; export const NavigatePrevious = 'NavigatePrevious'; export const NextFavoriteChannel = 'NextFavoriteChannel'; export const NextUserProfile = 'NextUserProfile'; export const OnDemand = 'OnDemand'; export const Pairing = 'Pairing'; export const PinPDown = 'PinPDown'; export const PinPMove = 'PinPMove'; export const PinPToggle = 'PinPToggle'; export const PinPUp = 'PinPUp'; export const PlaySpeedDown = 'PlaySpeedDown'; export const PlaySpeedReset = 'PlaySpeedReset'; export const PlaySpeedUp = 'PlaySpeedUp'; export const RandomToggle = 'RandomToggle'; export const RcLowBattery = 'RcLowBattery'; export const RecordSpeedNext = 'RecordSpeedNext'; export const RfBypass = 'RfBypass'; export const ScanChannelsToggle = 'ScanChannelsToggle'; export const ScreenModeNext = 'ScreenModeNext'; export const Settings = 'Settings'; export const SplitScreenToggle = 'SplitScreenToggle'; export const STBInput = 'STBInput'; export const STBPower = 'STBPower'; export const Subtitle = 'Subtitle'; export const Teletext = 'Teletext'; export const VideoModeNext = 'VideoModeNext'; export const Wink = 'Wink'; export const ZoomToggle = 'ZoomToggle'; export const MediaNextTrack = 'MediaNextTrack'; export const MediaPreviousTrack = 'MediaPreviousTrack'; export const Unidentified = 'Unidentified'; ```
/content/code_sandbox/packages/react-components/keyboard-keys/src/keys.ts
xml
2016-06-06T15:03:44
2024-08-16T18:49:29
fluentui
microsoft/fluentui
18,221
2,864
```xml import React, { useMemo } from 'react'; import PropTypes from 'prop-types'; import { useClassNames, useControlled, useEventCallback } from '@/internals/hooks'; import { oneOf } from '@/internals/propTypes'; import Plaintext from '@/internals/Plaintext'; import { WithAsProps, FormControlBaseProps, RsRefForwardingComponent } from '@/internals/types'; import { ValueType } from '../Radio'; export interface RadioContextProps { inline?: boolean; name?: string; value?: ValueType | null; controlled?: boolean; disabled?: boolean; readOnly?: boolean; plaintext?: boolean; onChange?: (value: ValueType | undefined, event: React.ChangeEvent<HTMLInputElement>) => void; } export interface RadioGroupProps<T = ValueType> extends WithAsProps, FormControlBaseProps<T> { /** A radio group can have different appearances */ appearance?: 'default' | 'picker'; /** Name to use for form */ name?: string; /** Inline layout */ inline?: boolean; /** Primary content */ children?: React.ReactNode; } export const RadioContext = React.createContext<RadioContextProps | undefined>(void 0); /** * The `RadioGroup` component is used to group a collection of `Radio` components. * @see path_to_url#radio-group */ const RadioGroup: RsRefForwardingComponent<'div', RadioGroupProps> = React.forwardRef( (props: RadioGroupProps, ref) => { const { as: Component = 'div', className, inline, children, classPrefix = 'radio-group', value: valueProp, defaultValue, appearance = 'default', name, plaintext, disabled, readOnly, onChange, ...rest } = props; const { merge, withClassPrefix } = useClassNames(classPrefix); const classes = merge(className, withClassPrefix(appearance, { inline })); const [value, setValue, isControlled] = useControlled(valueProp, defaultValue); const handleChange = useEventCallback( (nextValue: ValueType | undefined, event: React.ChangeEvent<HTMLInputElement>) => { setValue(nextValue); onChange?.(nextValue ?? '', event); } ); const contextValue = useMemo( () => ({ inline, name, value: typeof value === 'undefined' ? null : value, controlled: isControlled, plaintext, disabled, readOnly, onChange: handleChange }), [disabled, handleChange, inline, isControlled, name, plaintext, readOnly, value] ); return ( <RadioContext.Provider value={contextValue}> {plaintext ? ( <Plaintext ref={ref} localeKey="notSelected" {...rest}> {value ? children : null} </Plaintext> ) : ( <Component role="radiogroup" {...rest} ref={ref} className={classes}> {children} </Component> )} </RadioContext.Provider> ); } ); RadioGroup.displayName = 'RadioGroup'; RadioGroup.propTypes = { appearance: oneOf(['default', 'picker']), name: PropTypes.string, inline: PropTypes.bool, value: PropTypes.any, defaultValue: PropTypes.any, className: PropTypes.string, classPrefix: PropTypes.string, children: PropTypes.node, onChange: PropTypes.func, plaintext: PropTypes.bool }; export default RadioGroup; ```
/content/code_sandbox/src/RadioGroup/RadioGroup.tsx
xml
2016-06-06T02:27:46
2024-08-16T16:41:54
rsuite
rsuite/rsuite
8,263
732
```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 classNames from "classnames"; import * as React from "react"; import { CSSTransition, TransitionGroup } from "react-transition-group"; import { Classes, DISPLAYNAME_PREFIX, type Props } from "../../common"; import { usePrevious } from "../../hooks"; import type { Panel } from "./panelTypes"; import { PanelView2 } from "./panelView2"; /** * @template T type union of all possible panels in this stack */ // eslint-disable-next-line @typescript-eslint/ban-types export interface PanelStack2Props<T extends Panel<object>> extends Props { /** * The initial panel to show on mount. This panel cannot be removed from the * stack and will appear when the stack is empty. * This prop is only used in uncontrolled mode and is thus mutually * exclusive with the `stack` prop. */ initialPanel?: T; /** * Callback invoked when the user presses the back button or a panel * closes itself with a `closePanel()` action. */ onClose?: (removedPanel: T) => void; /** * Callback invoked when a panel opens a new panel with an `openPanel(panel)` * action. */ onOpen?: (addedPanel: T) => void; /** * If false, PanelStack will render all panels in the stack to the DOM, allowing their * React component trees to maintain state as a user navigates through the stack. * Panels other than the currently active one will be invisible. * * @default true */ renderActivePanelOnly?: boolean; /** * Whether to show the header with the "back" button in each panel. * * @default true */ showPanelHeader?: boolean; /** * The full stack of panels in controlled mode. The last panel in the stack * will be displayed. */ stack?: readonly T[]; } interface PanelStack2Component { /** * @template T type union of all possible panels in this stack */ // eslint-disable-next-line @typescript-eslint/ban-types <T extends Panel<object>>(props: PanelStack2Props<T>): React.JSX.Element | null; displayName: string; } /** * Panel stack (v2) component. * * @see path_to_url#core/components/panel-stack2 * @template T type union of all possible panels in this stack */ // eslint-disable-next-line @typescript-eslint/ban-types export const PanelStack2: PanelStack2Component = <T extends Panel<object>>(props: PanelStack2Props<T>) => { const { initialPanel, onClose, onOpen, renderActivePanelOnly = true, showPanelHeader = true, stack: propsStack, } = props; const isControlled = propsStack != null; const [localStack, setLocalStack] = React.useState<T[]>(initialPanel !== undefined ? [initialPanel] : []); const stack = React.useMemo( () => (isControlled ? propsStack.slice().reverse() : localStack), [localStack, isControlled, propsStack], ); const prevStackLength = usePrevious(stack.length) ?? stack.length; const direction = stack.length - prevStackLength < 0 ? "pop" : "push"; const handlePanelOpen = React.useCallback( (panel: T) => { onOpen?.(panel); if (!isControlled) { setLocalStack(prevStack => [panel, ...prevStack]); } }, [onOpen, isControlled], ); const handlePanelClose = React.useCallback( (panel: T) => { onClose?.(panel); if (!isControlled) { setLocalStack(prevStack => prevStack.slice(1)); } }, [onClose, isControlled], ); // early return, after all hooks are called if (stack.length === 0) { return null; } const panelsToRender = renderActivePanelOnly ? [stack[0]] : stack; const panels = panelsToRender .map((panel: T, index: number) => { // With renderActivePanelOnly={false} we would keep all the CSSTransitions rendered, // therefore they would not trigger the "enter" transition event as they were entered. // To force the enter event, we want to change the key, but stack.length is not enough // and a single panel should not rerender as long as it's hidden. // This key contains two parts: first one, stack.length - index is constant (and unique) for each panel, // second one, active changes only when the panel becomes or stops being active. const layer = stack.length - index; const key = renderActivePanelOnly ? stack.length : layer; return ( <CSSTransition classNames={Classes.PANEL_STACK2} key={key} timeout={400}> <PanelView2<T> onClose={handlePanelClose} onOpen={handlePanelOpen} panel={panel} previousPanel={stack[index + 1]} showHeader={showPanelHeader} /> </CSSTransition> ); }) .reverse(); const classes = classNames(Classes.PANEL_STACK2, `${Classes.PANEL_STACK2}-${direction}`, props.className); return ( <TransitionGroup className={classes} component="div"> {panels} </TransitionGroup> ); }; PanelStack2.displayName = `${DISPLAYNAME_PREFIX}.PanelStack2`; ```
/content/code_sandbox/packages/core/src/components/panel-stack2/panelStack2.tsx
xml
2016-10-25T21:17:50
2024-08-16T15:14:48
blueprint
palantir/blueprint
20,593
1,228
```xml export const types = ` type Config { _id: String! code: String! value: JSON } type ENV { USE_BRAND_RESTRICTIONS: String RELEASE: String } `; export const queries = ` search(value: String!): [JSON] configs: [Config] configsGetVersion(releaseNotes: Boolean): JSON configsGetEnv: ENV configsConstants: JSON configsCheckActivateInstallation(hostname: String!): JSON configsCheckPremiumService(type: String!): Boolean configsGetEmailTemplate(name: String): String configsGetValue(code:String!):JSON configsGetInstallationStatus(name: String!): JSON enabledServices: JSON `; export const mutations = ` configsUpdate(configsMap: JSON!): JSON configsActivateInstallation(token: String!, hostname: String!): JSON configsManagePluginInstall(type: String!, name: String!): JSON `; ```
/content/code_sandbox/packages/core/src/data/schema/config.ts
xml
2016-11-11T06:54:50
2024-08-16T10:26:06
erxes
erxes/erxes
3,479
209
```xml import { ComponentFixture, TestBed } from "@angular/core/testing"; import { Icon, svgIcon } from "./icon"; import { BitIconComponent } from "./icon.component"; describe("IconComponent", () => { let component: BitIconComponent; let fixture: ComponentFixture<BitIconComponent>; beforeEach(async () => { await TestBed.configureTestingModule({ declarations: [BitIconComponent], }).compileComponents(); fixture = TestBed.createComponent(BitIconComponent); component = fixture.componentInstance; fixture.detectChanges(); }); it("should have empty innerHtml when input is not an Icon", () => { const fakeIcon = { svg: "harmful user input" } as Icon; component.icon = fakeIcon; fixture.detectChanges(); const el = fixture.nativeElement as HTMLElement; expect(el.innerHTML).toBe(""); }); it("should contain icon when input is a safe Icon", () => { const icon = svgIcon`<svg><text x="0" y="15">safe icon</text></svg>`; component.icon = icon; fixture.detectChanges(); const el = fixture.nativeElement as HTMLElement; expect(el.innerHTML).toBe(`<svg><text x="0" y="15">safe icon</text></svg>`); }); }); ```
/content/code_sandbox/libs/components/src/icon/icon.components.spec.ts
xml
2016-03-09T23:14:01
2024-08-16T15:07:51
clients
bitwarden/clients
8,877
262
```xml <Documentation> <Docs DocId="T:MapKit.MKDirections"> <summary>An Apple-provided route to a destination.</summary> <remarks> <para>Application developers should be aware that sending too many routing requests from the same device may lead to a throttling error (see <see cref="F:MapKit.MKErrorCode.LoadingThrottled" />).</para> <para>To request routing, application developers must set the <c>MKDirectionsApplicationSupportedModes</c> key in the application's <c>info.plist</c> file. The following example shows an automobile routing request:</para> <example> <code lang="csharp lang-csharp"><![CDATA[ var gg = new CLLocationCoordinate2D(37.8197, -122.4786); var sfo = new CLLocationCoordinate2D(37.6189, -122.3750); var ggAnnotation = new MKPointAnnotation() { Title = "Golden Gate Bridge", Coordinate = gg }; var sfoAnnotation = new MKPointAnnotation() { Title = "SFO", Coordinate = sfo }; mapView.ShowAnnotations(new MKPointAnnotation[] { ggAnnotation, sfoAnnotation }, false); var emptyDict = new NSDictionary(); var req = new MKDirectionsRequest() { Source = new MKMapItem(new MKPlacemark(gg, emptyDict)), Destination = new MKMapItem(new MKPlacemark(sfo, emptyDict)), TransportType = MKDirectionsTransportType.Automobile }; var dir = new MKDirections(req); dir.CalculateDirections((response, error) => { if(error == null){ var route = response.Routes[0]; var rteLine = new MKPolylineRenderer(route.Polyline) { LineWidth = 5.0f, StrokeColor = UIColor.Purple }; mapView.GetRendererForOverlay = (mv, ol) => rteLine; mapView.AddOverlay(route.Polyline, MKOverlayLevel.AboveRoads); }else{ Console.WriteLine(error); } }); ]]></code> </example> <para> <img href="~/MapKit/_images/MKDirections.png" alt="Screenshot showing map routing" /> </para> </remarks> <related type="externalDocumentation" href="path_to_url">Apple documentation for <c>MKDirections</c></related> </Docs> </Documentation> ```
/content/code_sandbox/docs/api/MapKit/MKDirections.xml
xml
2016-04-20T18:24:26
2024-08-16T13:29:19
xamarin-macios
xamarin/xamarin-macios
2,436
511
```xml import sinon from "sinon" import { ConnectionOptionsReader, DatabaseType, DataSource, DataSourceOptions, } from "../../../src" import { closeTestingConnections, createTestingConnections, reloadTestingDatabases, setupTestingConnections, } from "../../utils/test-utils" import { CommandUtils } from "../../../src/commands/CommandUtils" import { MigrationGenerateCommand } from "../../../src/commands/MigrationGenerateCommand" import { Post } from "./entity/Post" import { resultsTemplates } from "./templates/result-templates-generate" describe("commands - migration generate", () => { let connectionOptions: DataSourceOptions[] let createFileStub: sinon.SinonStub let loadDataSourceStub: sinon.SinonStub let getConnectionOptionsStub: sinon.SinonStub let migrationGenerateCommand: MigrationGenerateCommand let connectionOptionsReader: ConnectionOptionsReader let baseConnectionOptions: DataSourceOptions const enabledDrivers = [ "postgres", "mssql", "mysql", "mariadb", "sqlite", "better-sqlite3", "oracle", "cockroachdb", ] as DatabaseType[] // simulate args: `npm run typeorm migration:run -- -n test-migration -d test-directory` const testHandlerArgs = (options: Record<string, any>) => ({ $0: "test", _: ["test"], path: "test-directory/test-migration", ...options, }) before(async () => { // clean out db from any prior tests in case previous state impacts the generated migrations const connections = await createTestingConnections({ entities: [], enabledDrivers, }) await reloadTestingDatabases(connections) await closeTestingConnections(connections) connectionOptions = setupTestingConnections({ entities: [Post], enabledDrivers, }) connectionOptionsReader = new ConnectionOptionsReader() migrationGenerateCommand = new MigrationGenerateCommand() createFileStub = sinon.stub(CommandUtils, "createFile") loadDataSourceStub = sinon.stub(CommandUtils, "loadDataSource") }) after(async () => { createFileStub.restore() loadDataSourceStub.restore() }) it("writes regular migration file when no option is passed", async () => { for (const connectionOption of connectionOptions) { createFileStub.resetHistory() baseConnectionOptions = await connectionOptionsReader.get( connectionOption.name as string, ) getConnectionOptionsStub = sinon .stub(ConnectionOptionsReader.prototype, "get") .resolves({ ...baseConnectionOptions, entities: [Post], }) loadDataSourceStub.resolves(new DataSource(connectionOption)) await migrationGenerateCommand.handler( testHandlerArgs({ dataSource: "dummy-path", timestamp: "1610975184784", exitProcess: false, }), ) // compare against control test strings in results-templates.ts sinon.assert.calledWith( createFileStub, sinon.match(/test-directory.*test-migration.ts/), sinon.match(resultsTemplates[connectionOption.type]?.control), ) getConnectionOptionsStub.restore() } }) it("writes Javascript printed file when option is passed", async () => { for (const connectionOption of connectionOptions) { createFileStub.resetHistory() baseConnectionOptions = await connectionOptionsReader.get( connectionOption.name as string, ) getConnectionOptionsStub = sinon .stub(ConnectionOptionsReader.prototype, "get") .resolves({ ...baseConnectionOptions, entities: [Post], }) loadDataSourceStub.resolves(new DataSource(connectionOption)) await migrationGenerateCommand.handler( testHandlerArgs({ dataSource: "dummy-path", timestamp: "1610975184784", outputJs: true, exitProcess: false, }), ) // compare against "pretty" test strings in results-templates.ts sinon.assert.calledWith( createFileStub, sinon.match(/test-directory.*test-migration.js/), sinon.match( resultsTemplates[connectionOption.type]?.javascript, ), ) getConnectionOptionsStub.restore() } }) it("writes migration file with custom timestamp when option is passed", async () => { for (const connectionOption of connectionOptions) { createFileStub.resetHistory() baseConnectionOptions = await connectionOptionsReader.get( connectionOption.name as string, ) getConnectionOptionsStub = sinon .stub(ConnectionOptionsReader.prototype, "get") .resolves({ ...baseConnectionOptions, entities: [Post], }) loadDataSourceStub.resolves(new DataSource(connectionOption)) await migrationGenerateCommand.handler( testHandlerArgs({ dataSource: "dummy-path", timestamp: "1641163894670", exitProcess: false, }), ) // compare against control test strings in results-templates.ts sinon.assert.calledWith( createFileStub, sinon.match("test-directory/1641163894670-test-migration.ts"), sinon.match(resultsTemplates[connectionOption.type]?.timestamp), ) getConnectionOptionsStub.restore() } }) }) ```
/content/code_sandbox/test/functional/commands/migration-generate.ts
xml
2016-02-29T07:41:14
2024-08-16T18:28:52
typeorm
typeorm/typeorm
33,875
1,093
```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. --> <menu xmlns:android="path_to_url" xmlns:app="path_to_url"> <item android:id="@+id/item_favorite" android:title="@string/cat_music_player_album_menu_favorite_title" android:icon="@drawable/ic_favorite_vd_theme_24px" app:showAsAction="ifRoom"/> <item android:id="@+id/item_share" android:title="@string/cat_music_player_album_menu_share_title" app:showAsAction="never"/> </menu> ```
/content/code_sandbox/catalog/java/io/material/catalog/musicplayer/res/menu/album_menu.xml
xml
2016-12-05T16:11:29
2024-08-16T17:51:42
material-components-android
material-components/material-components-android
16,176
172
```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 utilities from "./utilities"; import {Resource} from "./index"; export class BarResource extends pulumi.ComponentResource { /** @internal */ public static readonly __pulumiType = 'bar::BarResource'; /** * Returns true if the given object is an instance of BarResource. 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 BarResource { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === BarResource.__pulumiType; } public readonly foo!: pulumi.Output<Resource | undefined>; /** * Create a BarResource 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?: BarResourceArgs, opts?: pulumi.ComponentResourceOptions) { let resourceInputs: pulumi.Inputs = {}; opts = opts || {}; if (!opts.id) { resourceInputs["foo"] = args ? args.foo : undefined; } else { resourceInputs["foo"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(BarResource.__pulumiType, name, resourceInputs, opts, true /*remote*/); } } /** * The set of arguments for constructing a BarResource resource. */ export interface BarResourceArgs { foo?: pulumi.Input<Resource>; } ```
/content/code_sandbox/tests/testdata/codegen/simple-resource-schema/nodejs/barResource.ts
xml
2016-10-31T21:02:47
2024-08-16T19:47:04
pulumi
pulumi/pulumi
20,743
407
```xml import { APIFactory } from '@statoscope/extensions'; import { RelationItem } from '@statoscope/types'; import makeIndex, { IndexAPI } from '@statoscope/helpers/dist/indexer'; import { Report } from '@statoscope/types/types/custom-report'; import { Format } from './generator'; export type API = { getReports: ( compilationId?: string | null, type?: RelationItem['type'] | null, relatedId?: string | number, ) => Report<unknown, unknown>[]; getById(id: string): Report<unknown, unknown> | null; }; type CompilationIndexItem = { id: string | null; relationTypeIndex: IndexAPI<RelationItem['type'], TypeIndexItem>; itemIndex: IndexAPI<Report<unknown, unknown>['id'], Report<unknown, unknown>>; }; type TypeIndexItem = { type: RelationItem['type']; relationIdIndex: IndexAPI<RelationItem['id'], IdIndexItem>; itemIndex: IndexAPI<Report<unknown, unknown>['id'], Report<unknown, unknown>>; }; type IdIndexItem = { id: RelationItem['id']; index: IndexAPI<RelationItem['id'], Report<unknown, unknown>>; }; const makeAPI: APIFactory<Format, API> = (source) => { const idIndex = makeIndex((entity: Report<unknown, unknown>) => entity.id); const compilationIndex = makeIndex((entity: CompilationIndexItem) => entity.id); for (const compilation of source.payload.compilations) { let compilationItem = compilationIndex.get(compilation.id); if (!compilationItem) { compilationItem = { id: compilation.id, relationTypeIndex: makeIndex((entity: TypeIndexItem) => entity.type), itemIndex: makeIndex((entity: Report<unknown, unknown>) => entity.id), }; compilationIndex.add(compilationItem); } for (const item of compilation.reports) { compilationItem.itemIndex.add(item); idIndex.add(item); for (const related of item.relations ?? []) { let typeItem = compilationItem.relationTypeIndex.get(related.type); if (!typeItem) { typeItem = { type: related.type, relationIdIndex: makeIndex((entity: IdIndexItem) => entity.id), itemIndex: makeIndex((entity: Report<unknown, unknown>) => entity.id), }; compilationItem.relationTypeIndex.add(typeItem); } let idItem = typeItem.relationIdIndex.get(related.id); if (!idItem) { idItem = { id: related.id, index: makeIndex((entity: Report<unknown, unknown>) => entity.id), }; typeItem.relationIdIndex.add(idItem); } typeItem.itemIndex.add(item); idItem.index.add(item); } } } return { getReports: ( compilationId: string | null = null, type?: RelationItem['type'] | null, relatedId?: string | number, ): Report<unknown, unknown>[] => { if (relatedId) { if (!type) { throw new Error('type must be specified'); } return ( compilationIndex .get(compilationId) ?.relationTypeIndex.get(type) ?.relationIdIndex.get(relatedId) ?.index.getAll() ?? [] ); } if (type) { return ( compilationIndex .get(compilationId) ?.relationTypeIndex.get(type) ?.itemIndex.getAll() ?? [] ); } return compilationIndex.get(compilationId)?.itemIndex.getAll() ?? []; }, getById(id: string): Report<unknown, unknown> | null { return idIndex.get(id); }, }; }; export default makeAPI; ```
/content/code_sandbox/packages/stats-extension-custom-reports/src/api.ts
xml
2016-11-30T14:09:21
2024-08-15T18:52:57
statoscope
statoscope/statoscope
1,423
826
```xml <?xml version="1.0" encoding="utf-8"?> <!-- ~ ~ ~ path_to_url ~ ~ Unless required by applicable law or agreed to in writing, software ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --> <resources> <string name="bottomsheet_action_expand_halfway">Proiri donju polovicu</string> <string name="bottomsheet_drag_handle_content_description">Marker za povlaenje</string> <string name="bottomsheet_action_expand">Proirite donju tablicu</string> <string name="bottomsheet_action_collapse">Samite donju tablicu</string> <string name="bottomsheet_drag_handle_clicked">Dvaput dodirnut marker za povlaenje</string> </resources> ```
/content/code_sandbox/lib/java/com/google/android/material/bottomsheet/res/values-hr/strings.xml
xml
2016-12-05T16:11:29
2024-08-16T17:51:42
material-components-android
material-components/material-components-android
16,176
180
```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 db from '@liskhq/lisk-db'; import { getBlockchainDBPath } from './path'; export const getBlockchainDB = (dataPath: string): db.Database => new db.Database(getBlockchainDBPath(dataPath)); ```
/content/code_sandbox/commander/src/utils/db.ts
xml
2016-02-01T21:45:35
2024-08-15T19:16:48
lisk-sdk
LiskArchive/lisk-sdk
2,721
136
```xml import React, { Component } from 'react'; import { withTranslation } from 'react-i18next'; // @ts-expect-error FIXME: update react-table import ReactTable from 'react-table'; import Card from '../../ui/Card'; import CellWrap from '../../ui/CellWrap'; import whoisCell from './whoisCell'; import LogsSearchLink from '../../ui/LogsSearchLink'; import { sortIp } from '../../../helpers/helpers'; import { LocalStorageHelper, LOCAL_STORAGE_KEYS } from '../../../helpers/localStorageHelper'; import { TABLES_MIN_ROWS } from '../../../helpers/constants'; const COLUMN_MIN_WIDTH = 200; interface AutoClientsProps { t: (...args: unknown[]) => string; autoClients: any[]; normalizedTopClients: any; } class AutoClients extends Component<AutoClientsProps> { columns = [ { Header: this.props.t('table_client'), accessor: 'ip', minWidth: COLUMN_MIN_WIDTH, Cell: CellWrap, sortMethod: sortIp, }, { Header: this.props.t('table_name'), accessor: 'name', minWidth: COLUMN_MIN_WIDTH, Cell: CellWrap, }, { Header: this.props.t('source_label'), accessor: 'source', minWidth: COLUMN_MIN_WIDTH, Cell: CellWrap, }, { Header: this.props.t('whois'), accessor: 'whois_info', minWidth: COLUMN_MIN_WIDTH, Cell: whoisCell(this.props.t), }, { Header: this.props.t('requests_count'), accessor: (row: any) => this.props.normalizedTopClients.auto[row.ip] || 0, sortMethod: (a: any, b: any) => b - a, id: 'statistics', minWidth: COLUMN_MIN_WIDTH, Cell: (row: any) => { const { value: clientStats } = row; if (clientStats) { return ( <div className="logs__row"> <div className="logs__text" title={clientStats}> <LogsSearchLink search={row.original.ip}>{clientStats}</LogsSearchLink> </div> </div> ); } return ''; }, }, ]; render() { const { t, autoClients } = this.props; return ( <Card title={t('auto_clients_title')} subtitle={t('auto_clients_desc')} bodyType="card-body box-body--settings"> <ReactTable data={autoClients || []} columns={this.columns} defaultSorted={[ { id: 'statistics', asc: true, }, ]} className="-striped -highlight card-table-overflow" showPagination defaultPageSize={LocalStorageHelper.getItem(LOCAL_STORAGE_KEYS.AUTO_CLIENTS_PAGE_SIZE) || 10} onPageSizeChange={(size: any) => LocalStorageHelper.setItem(LOCAL_STORAGE_KEYS.AUTO_CLIENTS_PAGE_SIZE, size) } minRows={TABLES_MIN_ROWS} ofText="/" previousText={t('previous_btn')} nextText={t('next_btn')} pageText={t('page_table_footer_text')} rowsText={t('rows_table_footer_text')} loadingText={t('loading_table_status')} noDataText={t('clients_not_found')} /> </Card> ); } } export default withTranslation()(AutoClients); ```
/content/code_sandbox/client/src/components/Settings/Clients/AutoClients.tsx
xml
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
729
```xml import { ApplicationInterface } from './../Application/ApplicationInterface' import { DeviceInterface } from './DeviceInterface' import { RawKeychainValue } from '@standardnotes/models' export interface WebOrDesktopDeviceInterface extends DeviceInterface { readonly appVersion: string getKeychainValue(): Promise<RawKeychainValue> setKeychainValue(value: RawKeychainValue): Promise<void> setApplication(application: ApplicationInterface): void removeApplication(application: ApplicationInterface): void } ```
/content/code_sandbox/packages/services/src/Domain/Device/WebOrDesktopDeviceInterface.ts
xml
2016-12-05T23:31:33
2024-08-16T06:51:19
app
standardnotes/app
5,180
101
```xml import { relative } from 'node:path'; import type { Options } from 'storybook/internal/types'; import { listStories } from './list-stories'; /** * This file is largely based on * path_to_url */ /** * Paths get passed either with no leading './' - e.g. `src/Foo.stories.js`, or with a leading `../` * (etc), e.g. `../src/Foo.stories.js`. We want to deal in importPaths relative to the working dir, * so we normalize */ function toImportPath(relativePath: string) { return relativePath.startsWith('../') ? relativePath : `./${relativePath}`; } /** * This function takes an array of stories and creates a mapping between the stories' relative paths * to the working directory and their dynamic imports. The import is done in an asynchronous * function to delay loading. It then creates a function, `importFn(path)`, which resolves a path to * an import function and this is called by Storybook to fetch a story dynamically when needed. * * @param stories An array of absolute story paths. */ async function toImportFn(stories: string[]) { const { normalizePath } = await import('vite'); const objectEntries = stories.map((file) => { const relativePath = normalizePath(relative(process.cwd(), file)); return ` '${toImportPath(relativePath)}': async () => import('/@fs/${file}')`; }); return ` const importers = { ${objectEntries.join(',\n')} }; export async function importFn(path) { return importers[path](); } `; } export async function generateImportFnScriptCode(options: Options) { // First we need to get an array of stories and their absolute paths. const stories = await listStories(options); // We can then call toImportFn to create a function that can be used to load each story dynamically. return (await toImportFn(stories)).trim(); } ```
/content/code_sandbox/code/builders/builder-vite/src/codegen-importfn-script.ts
xml
2016-03-18T04:23:44
2024-08-16T19:22:08
storybook
storybookjs/storybook
83,755
423
```xml import { ApplicationEvent, PermissionDialog } from '@standardnotes/snjs' import { FunctionComponent, useCallback, useEffect, useState } from 'react' import ModalOverlay from '../Modal/ModalOverlay' import PermissionsModal from './PermissionsModal' import { WebApplicationInterface } from '@standardnotes/ui-services' type Props = { application: WebApplicationInterface } const PermissionsModalWrapper: FunctionComponent<Props> = ({ application }) => { const [dialog, setDialog] = useState<PermissionDialog>() const presentPermissionsDialog = useCallback((permissionDialog: PermissionDialog) => { setDialog(permissionDialog) }, []) const dismissPermissionsDialog = useCallback(() => { setDialog(undefined) }, []) const onAppStart = useCallback(() => { application.componentManager.setPermissionDialogUIHandler(presentPermissionsDialog) }, [application, presentPermissionsDialog]) useEffect(() => { if (application.isStarted()) { onAppStart() } const removeAppObserver = application.addEventObserver(async (eventName) => { if (eventName === ApplicationEvent.Started) { onAppStart() } }) return () => { removeAppObserver() } }, [application, onAppStart]) return ( <ModalOverlay isOpen={!!dialog} close={dismissPermissionsDialog} className="md:!w-[350px]"> {dialog && ( <PermissionsModal callback={dialog.callback} dismiss={dismissPermissionsDialog} component={dialog.component} permissionsString={dialog.permissionsString} /> )} </ModalOverlay> ) } export default PermissionsModalWrapper ```
/content/code_sandbox/packages/web/src/javascripts/Components/PermissionsModal/PermissionsModalWrapper.tsx
xml
2016-12-05T23:31:33
2024-08-16T06:51:19
app
standardnotes/app
5,180
339
```xml // rc-util: path_to_url import * as React from 'react'; import * as ReactDOM from 'react-dom'; import type { Root } from 'react-dom/client'; type CreateRoot = (container: ContainerType) => Root; // Let compiler not to search module usage const fullClone = { ...ReactDOM, } as typeof ReactDOM & { __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED?: { usingClientEntryPoint?: boolean; }; createRoot?: CreateRoot; }; const { version, render: reactRender, unmountComponentAtNode } = fullClone; let createRoot: CreateRoot; try { const mainVersion = Number((version || '').split('.')[0]); if (mainVersion >= 18 && fullClone.createRoot) { createRoot = fullClone.createRoot; } } catch { // Do nothing; } function toggleWarning(skip: boolean) { const { __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED } = fullClone; if ( __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED && typeof __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED === 'object' ) { __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.usingClientEntryPoint = skip; } } const MARK = '__zarm_root__'; // ========================== Render ========================== type ContainerType = (Element | DocumentFragment) & { [MARK]?: Root; }; function legacyRender(node: React.ReactElement, container: ContainerType) { reactRender(node, container); } function modernRender(node: React.ReactElement, container: ContainerType) { toggleWarning(true); const root = container[MARK] || createRoot(container); toggleWarning(false); root.render(node); container[MARK] = root; } export function render(node: React.ReactElement, container: ContainerType) { if (createRoot as unknown) { modernRender(node, container); return; } legacyRender(node, container); } function legacyUnmount(container: ContainerType) { return unmountComponentAtNode(container); } async function modernUnmount(container: ContainerType) { return Promise.resolve().then(() => { container[MARK]?.unmount(); delete container[MARK]; }); } export function unmount(container: ContainerType) { if (createRoot as unknown) { return modernUnmount(container); } return legacyUnmount(container); } ```
/content/code_sandbox/packages/zarm/src/utils/dom/render.ts
xml
2016-07-13T11:45:37
2024-08-12T19:23:48
zarm
ZhongAnTech/zarm
1,707
536
```xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="path_to_url" xmlns:tools="path_to_url" android:id="@+id/manage_chat__layout" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <com.google.android.material.appbar.MaterialToolbar android:id="@+id/manage_chat_toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" tools:context=".main.ManagerActivity" /> <ScrollView android:id="@+id/manage_chat_scrollview" android:layout_width="match_parent" android:layout_height="match_parent" android:fillViewport="true"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <LinearLayout android:id="@+id/history_retention_layout" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:paddingTop="16dp" android:paddingStart="16dp" android:paddingEnd="19dp" android:paddingBottom="14dp"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:layout_marginBottom="16dp" android:baselineAligned="false"> <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="start|center_vertical" android:text ="@string/title_properties_history_retention" android:textAppearance="?attr/textAppearanceSubtitle1" /> </RelativeLayout> <RelativeLayout android:id="@+id/history_retention_switch_layout" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:layout_weight="1" android:gravity="end|center_vertical"> <mega.privacy.android.shared.original.core.ui.controls.controlssliders.MegaSwitch android:id="@+id/history_retention_switch" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="end|center_vertical" android:stateListAnimator="@null" android:clickable="false" /> </RelativeLayout> </LinearLayout> <RelativeLayout android:id="@+id/retention_time_text_layout" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="start|center_vertical"> <TextView android:id="@+id/retention_time_subtitle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/subtitle_properties_history_retention" android:textAppearance="@style/TextAppearance.Mega.Body2.Secondary" /> <TextView android:id="@+id/retention_time" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/retention_time_subtitle" android:textAppearance="@style/TextAppearance.Mega.Body2.Accent" android:layout_marginTop="8dp" android:visibility="gone" /> </RelativeLayout> </LinearLayout> <View android:layout_width="match_parent" android:layout_height="1dp" android:layout_marginStart="16dp" android:layout_marginEnd="16dp" android:background="@color/grey_012_white_012" /> <LinearLayout android:id="@+id/picker_layout" android:layout_width="match_parent" android:layout_height="187dp" android:paddingTop="18dp" android:orientation="vertical"> <RelativeLayout android:layout_width="match_parent" android:layout_height="126dp" android:gravity="center_horizontal"> <NumberPicker android:id="@+id/number_picker" android:theme="@style/Widget.Mega.NumberPicker" android:layout_height="match_parent" android:layout_width="wrap_content" android:layout_marginEnd="34dp" android:selectionDividerHeight="1dp" android:descendantFocusability="blocksDescendants" android:showDividers="none"/> <NumberPicker android:id="@+id/text_picker" android:theme="@style/Widget.Mega.NumberPicker" android:layout_height="match_parent" android:layout_width="wrap_content" android:layout_toEndOf="@id/number_picker" android:selectionDividerHeight="1dp" android:descendantFocusability="blocksDescendants" android:showDividers="none"/> </RelativeLayout> <Button android:id="@+id/picker_button" android:stateListAnimator="@null" android:text="@string/general_ok" android:layout_gravity="end" android:gravity="center" style="?attr/borderlessButtonStyle"/> </LinearLayout> <View android:id="@+id/separator" android:layout_width="match_parent" android:layout_height="1dp" android:layout_marginStart="16dp" android:layout_marginEnd="16dp" android:background="@color/grey_012_white_012" /> <LinearLayout android:id="@+id/clear_chat_history_layout" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingTop="16dp" android:paddingStart="16dp" android:paddingEnd="19dp" android:orientation="vertical"> <TextView android:id="@+id/clear_chat_history_layout_title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="start|center_vertical" android:layout_marginBottom="6dp" android:text="@string/title_properties_clear_chat_history" android:textAppearance="@style/TextAppearance.Mega.Subtitle1.Red" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="start|center_vertical" android:layout_marginBottom="17dp" android:text="@string/subtitle_properties_chat_clear" android:textAppearance="@style/TextAppearance.Mega.Body2.Secondary" /> </LinearLayout> <View android:layout_width="match_parent" android:layout_height="1dp" android:layout_marginStart="16dp" android:layout_marginEnd="16dp" android:background="@color/grey_012_white_012" /> </LinearLayout> </ScrollView> <androidx.compose.ui.platform.ComposeView android:id="@+id/compose_view" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </LinearLayout> ```
/content/code_sandbox/app/src/main/res/layout/activity_manage_chat_history.xml
xml
2016-05-04T11:46:20
2024-08-15T16:29:10
android
meganz/android
1,537
1,528
```xml /* * This software is released under MIT license. * The full license information can be found in LICENSE in the root directory of this project. */ import { renderIcon } from '../icon.renderer.js'; import { IconShapeTuple } from '../interfaces/icon.interfaces.js'; const icon = { outline: '<path d="M27.53,24a5,5,0,0,0-3.6,1.55L11.74,19.45a4.47,4.47,0,0,0,0-2.8l12.21-6.21a5.12,5.12,0,1,0-1.07-1.7L10.79,14.89a5,5,0,1,0,0,6.33l12.06,6.07A4.93,4.93,0,0,0,22.54,29a5,5,0,1,0,5-5Zm0-20a3,3,0,1,1-3,3A3,3,0,0,1,27.53,4ZM7,21a3,3,0,1,1,3-3A3,3,0,0,1,7,21ZM27.53,32a3,3,0,1,1,3-3A3,3,0,0,1,27.53,32Z"/>', solid: '<path d="M27.53,24a5,5,0,0,0-3.6,1.55L11.74,19.45a4.47,4.47,0,0,0,0-2.8l12.21-6.21a5.12,5.12,0,1,0-1.07-1.7L10.79,14.89a5,5,0,1,0,0,6.33l12.06,6.07A4.93,4.93,0,0,0,22.54,29a5,5,0,1,0,5-5Z"/>', }; export const shareIconName = 'share'; export const shareIcon: IconShapeTuple = [shareIconName, renderIcon(icon)]; ```
/content/code_sandbox/packages/core/src/icon/shapes/share.ts
xml
2016-09-29T17:24:17
2024-08-11T17:06:15
clarity
vmware-archive/clarity
6,431
509
```xml /* eslint-disable @typescript-eslint/require-await */ import { promises as fs } from "fs"; import path from "path"; import { BundleId, ModuleLengths, VisualizerData } from "../shared/types"; import { TemplateType } from "./template-types"; const htmlEscape = (str: string) => str .replace(/&/g, "&amp;") .replace(/"/g, "&quot;") .replace(/'/g, "&#39;") .replace(/</g, "&lt;") .replace(/>/g, "&gt;"); const buildHtmlTemplate = (title: string, script: string, nodesData: string, style: string) => ` <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta http-equiv="X-UA-Compatible" content="ie=edge" /> <title>${htmlEscape(title)}</title> <style> ${style} </style> </head> <body> <main></main> <script> /*<!--*/ ${script} /*-->*/ </script> <script> /*<!--*/ const data = ${nodesData}; const run = () => { const width = window.innerWidth; const height = window.innerHeight; const chartNode = document.querySelector("main"); drawChart.default(chartNode, data, width, height); }; window.addEventListener('resize', run); document.addEventListener('DOMContentLoaded', run); /*-->*/ </script> </body> </html> `; export type RenderTemplateOptions = { data: string; title: string; }; const buildHtml = (template: TemplateType) => async ({ title, data }: RenderTemplateOptions): Promise<string> => { const [script, style] = await Promise.all([ fs.readFile(path.join(__dirname, "..", "lib", `${template}.js`), "utf8"), fs.readFile(path.join(__dirname, "..", "lib", `${template}.css`), "utf8"), ]); return buildHtmlTemplate(title, script, data, style); }; const outputRawData = (strData: string) => { const data = JSON.parse(strData) as VisualizerData; return JSON.stringify(data, null, 2); }; const outputPlainTextList = (strData: string) => { const data = JSON.parse(strData) as VisualizerData; const bundles: Record<BundleId, [string, ModuleLengths][]> = {}; for (const meta of Object.values(data.nodeMetas)) { for (const [bundleId, uid] of Object.entries(meta.moduleParts)) { // eslint-disable-next-line @typescript-eslint/no-unused-vars const { metaUid: mainUid, ...lengths } = data.nodeParts[uid]; bundles[bundleId] = bundles[bundleId] ?? []; bundles[bundleId].push([meta.id, lengths]); } } const bundlesEntries = Object.entries(bundles).sort((e1, e2) => e1[0].localeCompare(e2[0])); let output = ""; const IDENT = " "; for (const [bundleId, files] of bundlesEntries) { output += bundleId + ":\n"; files.sort((e1, e2) => e1[0].localeCompare(e2[0])); for (const [file, lengths] of files) { output += IDENT + file + ":\n"; output += IDENT + IDENT + `rendered: ${String(lengths.renderedLength)}\n`; if (data.options.gzip) { output += IDENT + IDENT + `gzip: ${String(lengths.gzipLength)}\n`; } if (data.options.brotli) { output += IDENT + IDENT + `brotli: ${String(lengths.brotliLength)}\n`; } } } return output; }; const TEMPLATE_TYPE_RENDERED: Record< TemplateType, (options: RenderTemplateOptions) => Promise<string> > = { network: buildHtml("network"), sunburst: buildHtml("sunburst"), treemap: buildHtml("treemap"), "raw-data": async ({ data }) => outputRawData(data), list: async ({ data }) => outputPlainTextList(data), flamegraph: buildHtml("flamegraph"), }; export const renderTemplate = (templateType: TemplateType, options: RenderTemplateOptions) => { return TEMPLATE_TYPE_RENDERED[templateType](options); }; ```
/content/code_sandbox/plugin/render-template.ts
xml
2016-10-25T16:11:55
2024-08-16T06:59:38
rollup-plugin-visualizer
btd/rollup-plugin-visualizer
1,845
993
```xml import { Injectable } from '@angular/core'; import { Subject } from 'rxjs'; import { TreeNodeDragEvent } from './treenodedragevent'; @Injectable() export class TreeDragDropService { private dragStartSource = new Subject<TreeNodeDragEvent>(); private dragStopSource = new Subject<TreeNodeDragEvent>(); dragStart$ = this.dragStartSource.asObservable(); dragStop$ = this.dragStopSource.asObservable(); startDrag(event: TreeNodeDragEvent) { this.dragStartSource.next(event); } stopDrag(event: TreeNodeDragEvent) { this.dragStopSource.next(event); } } ```
/content/code_sandbox/src/app/components/api/treedragdropservice.ts
xml
2016-01-16T09:23:28
2024-08-16T19:58:20
primeng
primefaces/primeng
9,969
130
```xml import ora from 'ora' import { exec } from './core' import { Context } from './types' /** * Load template config. * @todo * - Adapt to any repository? * - Automatic install template dependencies. * - Template dependencies not found. * - Check template is available. */ export default async (ctx: Context): Promise<void> => { // default template name ctx.config.name = ctx.template // Automatic install template dependencies. const spinner = ora('Installing template dependencies...').start() try { /* c8 ignore next */ const cmd = process.platform === 'win32' ? 'npm.cmd' : 'npm' await exec(cmd, ['install', '--production'], { cwd: ctx.src }) spinner.succeed('Installing template dependencies complete.') } catch { spinner.fail('Install template dependencies failed.') } try { // eslint-disable-next-line @typescript-eslint/no-var-requires const mod = require(ctx.src) if (Object.prototype.toString.call(mod) !== '[object Object]') { throw new TypeError('template needs to expose an object.') } Object.assign(ctx.config, mod) } catch (err) { const e = err as NodeJS.ErrnoException if (e.code === 'MODULE_NOT_FOUND') return e.message = `Invalid template: ${e.message}` throw e } } ```
/content/code_sandbox/src/load.ts
xml
2016-09-23T19:24:33
2024-08-09T05:04:06
caz
zce/caz
2,452
295
```xml import { ClaimsState } from '@store/claims.slice'; import { ConnectionsState } from '@store/connections.slice'; import { PromoPoapsState } from '@store/promoPoaps.slice'; import { Asset, ExtendedAsset, ExtendedContact, ExtendedContract, ExtendedNotification, ExtendedUserAction, IAccount, IRates, ISettings, Network, NetworkId, NetworkNodes, Notification, TUuid, UserAction } from '@types'; import { IProvidersMappings } from './asset'; export enum LSKeys { ADDRESS_BOOK = 'addressBook', ACCOUNTS = 'accounts', ASSETS = 'assets', RATES = 'rates', TRACKED_ASSETS = 'trackedAssets', CONTRACTS = 'contracts', NETWORKS = 'networks', NOTIFICATIONS = 'notifications', SETTINGS = 'settings', NETWORK_NODES = 'networkNodes', USER_ACTIONS = 'userActions', PROMO_POAPS = 'promoPoaps', CONNECTIONS = 'connections', CLAIMS = 'claims' } export interface LocalStorage { readonly version: string; readonly mtime: number; readonly [LSKeys.ACCOUNTS]: Record<TUuid, IAccount>; readonly [LSKeys.ASSETS]: Record<TUuid, Asset>; readonly [LSKeys.RATES]: IRates; readonly [LSKeys.TRACKED_ASSETS]: Record<string, IProvidersMappings>; readonly [LSKeys.ADDRESS_BOOK]: Record<TUuid, ExtendedContact>; readonly [LSKeys.CONTRACTS]: Record<TUuid, ExtendedContract>; readonly [LSKeys.NETWORKS]: Record<NetworkId, Network>; readonly [LSKeys.NETWORK_NODES]: Record<NetworkId, NetworkNodes>; readonly [LSKeys.NOTIFICATIONS]: Record<TUuid, Notification>; readonly [LSKeys.SETTINGS]: ISettings; readonly [LSKeys.USER_ACTIONS]: Record<TUuid, UserAction>; readonly [LSKeys.PROMO_POAPS]: PromoPoapsState; readonly [LSKeys.CONNECTIONS]: ConnectionsState; readonly [LSKeys.CLAIMS]: ClaimsState; } export interface DataStore { readonly version: string; readonly [LSKeys.ACCOUNTS]: IAccount[]; readonly [LSKeys.ASSETS]: ExtendedAsset[]; readonly [LSKeys.RATES]: IRates; readonly [LSKeys.TRACKED_ASSETS]: Record<string, IProvidersMappings>; readonly [LSKeys.ADDRESS_BOOK]: ExtendedContact[]; readonly [LSKeys.CONTRACTS]: ExtendedContract[]; readonly [LSKeys.NETWORKS]: Network[]; readonly [LSKeys.NOTIFICATIONS]: ExtendedNotification[]; readonly [LSKeys.SETTINGS]: ISettings; readonly [LSKeys.USER_ACTIONS]: ExtendedUserAction[]; readonly [LSKeys.PROMO_POAPS]: PromoPoapsState; readonly [LSKeys.CONNECTIONS]: ConnectionsState; readonly [LSKeys.CLAIMS]: ClaimsState; } ```
/content/code_sandbox/src/types/store.ts
xml
2016-12-04T01:35:27
2024-08-14T21:41:58
MyCrypto
MyCryptoHQ/MyCrypto
1,347
630
```xml /* * Squidex Headless CMS * * @license */ import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'; import { HttpTestingController, provideHttpClientTesting } from '@angular/common/http/testing'; import { inject, TestBed } from '@angular/core/testing'; import { ApiUrlConfig, Resource, ResourceLinks } from '@app/shared'; import { UserDto, UsersDto, UsersService } from './users.service'; describe('UsersService', () => { beforeEach(() => { TestBed.configureTestingModule({ imports: [], providers: [ provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting(), UsersService, { provide: ApiUrlConfig, useValue: new ApiUrlConfig('path_to_url }, ], }); }); afterEach(inject([HttpTestingController], (httpMock: HttpTestingController) => { httpMock.verify(); })); it('should make get request to get many users', inject([UsersService, HttpTestingController], (userManagementService: UsersService, httpMock: HttpTestingController) => { let users: UsersDto; userManagementService.getUsers(20, 30).subscribe(result => { users = result; }); const req = httpMock.expectOne('path_to_url expect(req.request.method).toEqual('GET'); expect(req.request.headers.get('If-Match')).toBeNull(); req.flush({ total: 100, items: [ userResponse(12), userResponse(13), ], }); expect(users!).toEqual({ total: 100, items: [ createUser(12), createUser(13), ], canCreate: false, }); })); it('should make get request with query to get many users', inject([UsersService, HttpTestingController], (userManagementService: UsersService, httpMock: HttpTestingController) => { let users: UsersDto; userManagementService.getUsers(20, 30, 'my-query').subscribe(result => { users = result; }); const req = httpMock.expectOne('path_to_url expect(req.request.method).toEqual('GET'); expect(req.request.headers.get('If-Match')).toBeNull(); req.flush({ total: 100, items: [ userResponse(12), userResponse(13), ], }); expect(users!).toEqual({ total: 100, items: [ createUser(12), createUser(13), ], canCreate: false, }); })); it('should make get request to get single user', inject([UsersService, HttpTestingController], (userManagementService: UsersService, httpMock: HttpTestingController) => { let user: UserDto; userManagementService.getUser('123').subscribe(result => { user = result; }); const req = httpMock.expectOne('path_to_url expect(req.request.method).toEqual('GET'); expect(req.request.headers.get('If-Match')).toBeNull(); req.flush(userResponse(12)); expect(user!).toEqual(createUser(12)); })); it('should make post request to create user', inject([UsersService, HttpTestingController], (userManagementService: UsersService, httpMock: HttpTestingController) => { const dto = { email: 'mail@squidex.io', displayName: 'Squidex User', permissions: ['Permission1'], password: 'password' }; let user: UserDto; userManagementService.postUser(dto).subscribe(result => { user = result; }); const req = httpMock.expectOne('path_to_url expect(req.request.method).toEqual('POST'); expect(req.request.headers.get('If-Match')).toBeNull(); req.flush(userResponse(12)); expect(user!).toEqual(createUser(12)); })); it('should make put request to update user', inject([UsersService, HttpTestingController], (userManagementService: UsersService, httpMock: HttpTestingController) => { const dto = { email: 'mail@squidex.io', displayName: 'Squidex User', permissions: ['Permission1'], password: 'password' }; const resource: Resource = { _links: { update: { method: 'PUT', href: 'api/user-management/123' }, }, }; let user: UserDto; userManagementService.putUser(resource, dto).subscribe(result => { user = result; }); const req = httpMock.expectOne('path_to_url expect(req.request.method).toEqual('PUT'); expect(req.request.headers.get('If-Match')).toBeNull(); req.flush(userResponse(12)); expect(user!).toEqual(createUser(12)); })); it('should make put request to lock user', inject([UsersService, HttpTestingController], (userManagementService: UsersService, httpMock: HttpTestingController) => { const resource: Resource = { _links: { lock: { method: 'PUT', href: 'api/user-management/123/lock' }, }, }; let user: UserDto; userManagementService.lockUser(resource).subscribe(result => { user = result; }); const req = httpMock.expectOne('path_to_url expect(req.request.method).toEqual('PUT'); expect(req.request.headers.get('If-Match')).toBeNull(); req.flush(userResponse(12)); expect(user!).toEqual(createUser(12)); })); it('should make put request to unlock user', inject([UsersService, HttpTestingController], (userManagementService: UsersService, httpMock: HttpTestingController) => { const resource: Resource = { _links: { unlock: { method: 'PUT', href: 'api/user-management/123/unlock' }, }, }; let user: UserDto; userManagementService.unlockUser(resource).subscribe(result => { user = result; }); const req = httpMock.expectOne('path_to_url expect(req.request.method).toEqual('PUT'); expect(req.request.headers.get('If-Match')).toBeNull(); req.flush(userResponse(12)); expect(user!).toEqual(createUser(12)); })); it('should make delete request to delete user', inject([UsersService, HttpTestingController], (userManagementService: UsersService, httpMock: HttpTestingController) => { const resource: Resource = { _links: { delete: { method: 'DELETE', href: 'api/user-management/123' }, }, }; userManagementService.deleteUser(resource).subscribe(); const req = httpMock.expectOne('path_to_url expect(req.request.method).toEqual('DELETE'); expect(req.request.headers.get('If-Match')).toBeNull(); req.flush({}); })); function userResponse(id: number, suffix = '') { const key = `${id}${suffix}`; return { id: `${id}`, email: `user${key}@domain.com`, displayName: `user${key}`, permissions: [ `Permission${key}`, ], isLocked: true, _links: { update: { method: 'PUT', href: `/users/${id}`, }, }, }; } }); export function createUser(id: number, suffix = '') { const links: ResourceLinks = { update: { method: 'PUT', href: `/users/${id}` }, }; const key = `${id}${suffix}`; return new UserDto(links, `${id}`, `user${key}@domain.com`, `user${key}`, [ `Permission${key}`, ], true); } ```
/content/code_sandbox/frontend/src/app/features/administration/services/users.service.spec.ts
xml
2016-08-29T05:53:40
2024-08-16T17:39:38
squidex
Squidex/squidex
2,222
1,642
```xml <?xml version="1.0" encoding="UTF-8"?> <definitions id="definitions" xmlns="path_to_url" xmlns:activiti="path_to_url" targetNamespace="org.flowable.engine.impl.webservice" xmlns:tns="org.flowable.engine.impl.webservice" xmlns:webservice="path_to_url"> <import importType="path_to_url" location="path_to_url" namespace="path_to_url" /> <process id="jsonArrayVariableDirectInvocation"> <startEvent id="theStart"> <extensionElements> <activiti:formProperty id="values" name="Values to add" type="json" required="true" /> </extensionElements> </startEvent> <sequenceFlow id="flow1" sourceRef="theStart" targetRef="webService" /> <serviceTask id="webService" name="Web service invocation" implementation="##WebService" operationRef="tns:addMultiOperation"> <ioSpecification> <dataInput itemSubjectRef="tns:addMultiRequestItem" id="dataInputOfAddMultiRequest" /> <inputSet> <dataInputRefs>dataInputOfAddMultiRequest</dataInputRefs> </inputSet> <outputSet /> </ioSpecification> <dataInputAssociation> <targetRef>dataInputOfAddMultiRequest</targetRef> <assignment> <from>${values}</from> <to>${dataInputOfAddMultiRequest.values}</to> </assignment> </dataInputAssociation> </serviceTask> <sequenceFlow id="flow2" sourceRef="webService" targetRef="theEnd" /> <endEvent id="theEnd" /> </process> <itemDefinition id="addMultiRequestItem" structureRef="webservice:addMulti" /> <itemDefinition id="addMultiResponseItem" structureRef="webservice:addMultiResponse" /> <message id="addMultiRequestMessage" itemRef="tns:addMultiRequestItem" name="addMultiRequestMessage" /> <message id="addMultiResponseMessage" itemRef="tns:addMultiResponseItem" name="addMultiResponseMessage" /> <interface name="Webservice Interface"> <operation id="addMultiOperation" name="Addition Operation with multiple values" implementationRef="webservice:addMulti"> <inMessageRef>tns:addMultiRequestMessage</inMessageRef> <outMessageRef>tns:addMultiResponseMessage</outMessageRef> </operation> </interface> </definitions> ```
/content/code_sandbox/modules/flowable-cxf/src/test/resources/org/flowable/engine/impl/webservice/WebServiceTaskTest.testJsonArrayVariableDirectInvocation.bpmn20.xml
xml
2016-10-13T07:21:43
2024-08-16T15:23:14
flowable-engine
flowable/flowable-engine
7,715
554
```xml <resources> <string name="app_name">Fragmentation</string> <string name="navigation_drawer_open">Open navigation drawer</string> <string name="navigation_drawer_close">Close navigation drawer</string> <string name="home"></string> <string name="discover"></string> <string name="shop"></string> <string name="login"></string> <string name="system"></string> <string name="swipe"></string> <string name="go_swipe_back">SwipeBackActivity+Fragment</string> <string name="recommend"></string> <string name="hot"></string> <string name="favorite"></string> <string name="password"></string> <string name="register"></string> <string name="large_text"> "Material is the metaphor.\n\n" "A material metaphor is the unifying theory of a rationalized space and a system of motion." "The material is grounded in tactile reality, inspired by the study of paper and ink, yet " "technologically advanced and open to imagination and magic.\n" "Surfaces and edges of the material provide visual cues that are grounded in reality. The " "use of familiar tactile attributes helps users quickly understand affordances. Yet the " "flexibility of the material creates new affordances that supercede those in the physical " "world, without breaking the rules of physics.\n" "The fundamentals of light, surface, and movement are key to conveying how objects move, " "interact, and exist in space and in relation to each other. Realistic lighting shows " "seams, divides space, and indicates moving parts.\n\n" "Bold, graphic, intentional.\n\n" "The foundational elements of print based design typography, grids, space, scale, color, " "and use of imagery guide visual treatments. These elements do far more than please the " "eye. They create hierarchy, meaning, and focus. Deliberate color choices, edge to edge " "imagery, large scale typography, and intentional white space create a bold and graphic " "interface that immerse the user in the experience.\n" "An emphasis on user actions makes core functionality immediately apparent and provides " "waypoints for the user.\n\n" "Motion provides meaning.\n\n" "Motion respects and reinforces the user as the prime mover. Primary user actions are " "inflection points that initiate motion, transforming the whole design.\n" "All action takes place in a single environment. Objects are presented to the user without " "breaking the continuity of experience even as they transform and reorganize.\n" "Motion is meaningful and appropriate, serving to focus attention and maintain continuity. " "Feedback is subtle yet clear. Transitions are efcient yet coherent.\n\n" "3D world.\n\n" "The material environment is a 3D space, which means all objects have x, y, and z " "dimensions. The z-axis is perpendicularly aligned to the plane of the display, with the " "positive z-axis extending towards the viewer. Every sheet of material occupies a single " "position along the z-axis and has a standard 1dp thickness.\n" "On the web, the z-axis is used for layering and not for perspective. The 3D world is " "emulated by manipulating the y-axis.\n\n" "Light and shadow.\n\n" "Within the material environment, virtual lights illuminate the scene. Key lights create " "directional shadows, while ambient light creates soft shadows from all angles.\n" "Shadows in the material environment are cast by these two light sources. In Android " "development, shadows occur when light sources are blocked by sheets of material at " "various positions along the z-axis. On the web, shadows are depicted by manipulating the " "y-axis only. The following example shows the card with a height of 6dp.\n\n" "Resting elevation.\n\n" "All material objects, regardless of size, have a resting elevation, or default elevation " "that does not change. If an object changes elevation, it should return to its resting " "elevation as soon as possible.\n\n" "Component elevations.\n\n" "The resting elevation for a component type is consistent across apps (e.g., FAB elevation " "does not vary from 6dp in one app to 16dp in another app).\n" "Components may have different resting elevations across platforms, depending on the depth " "of the environment (e.g., TV has a greater depth than mobile or desktop).\n\n" "Responsive elevation and dynamic elevation offsets.\n\n" "Some component types have responsive elevation, meaning they change elevation in response " "to user input (e.g., normal, focused, and pressed) or system events. These elevation " "changes are consistently implemented using dynamic elevation offsets.\n" "Dynamic elevation offsets are the goal elevation that a component moves towards, relative " "to the components resting state. They ensure that elevation changes are consistent " "across actions and component types. For example, all components that lift on press have " "the same elevation change relative to their resting elevation.\n" "Once the input event is completed or cancelled, the component will return to its resting " "elevation.\n\n" "Avoiding elevation interference.\n\n" "Components with responsive elevations may encounter other components as they move between " "their resting elevations and dynamic elevation offsets. Because material cannot pass " "through other material, components avoid interfering with one another any number of ways, " "whether on a per component basis or using the entire app layout.\n" "On a component level, components can move or be removed before they cause interference. " "For example, a floating action button (FAB) can disappear or move off screen before a " "user picks up a card, or it can move if a snackbar appears.\n" "On the layout level, design your app layout to minimize opportunities for interference. " "For example, position the FAB to one side of stream of a cards so the FAB wont interfere " "when a user tries to pick up one of cards.\n\n" </string> <string name="image_transition">image_transition</string> <string name="press_again_exit"></string> <string name="send"></string> <string name="sign_in_success">,NavigationView!</string> <string name="can_swipe"></string> <string name="upper_process">!</string> <string name="anim_v">! </string> <string name="anim_h">! </string> <string name="anim_none">! </string> <string name="anim"></string> <string name="account"></string> <string name="modify_title"></string> <string name="modify_success">!</string> <string name="error_username"></string> <string name="error_pwd"></string> <string name="tip_single_multi">Activity + Fragment:</string> <string name="btn_basic">GooglePlayDemo ()</string> <string name="btn_normal">Demo ()</string> <string name="btn_complicated">Demo ()</string> <string name="start_cycler">CyclerFragment</string> <string name="start_with_pop">CyclerFragment</string> <string name="modify"></string> <string name="settings"></string> <string name="action_anim_v">! ()</string> <string name="swipe_back"></string> <string name="time"></string> <string name="msg"></string> <string name="all"></string> <string name="start_result_test">startForResult</string> <string name="more"></string> <string name="me"></string> <string name="hot_news"></string> <string name="new_tip_start_dont_hide">Fragment</string> <string name="new_tip_start">Fragment</string> <string-array name="array_title"> <item>Andorid O Developer Preview</item> <item>Build for a Multi-Screen World</item> <item>Build Beautiful Apps</item> </string-array> <string-array name="array_content"> <item>An early look at the next version of Android for testing, development, and feedback. Get your apps ready for Android O!</item> <item>Android runs on billions of handheld devices around the world, and it now supports these exciting, new form-factors.</item> <item>Resources to get you started with designing and developing for Android.</item> </string-array> <string-array name="array_menu"> <item></item> <item></item> <item></item> <item></item> <item></item> <item></item> <item></item> <item></item> <item></item> <item></item> <item></item> <item></item> <item></item> <item></item> <item></item> </string-array> </resources> ```
/content/code_sandbox/demo/src/main/res/values-zh/strings.xml
xml
2016-02-23T08:54:55
2024-08-15T05:22:10
Fragmentation
YoKeyword/Fragmentation
9,719
2,018
```xml <vector xmlns:android="path_to_url" android:width="24dp" android:height="24dp" android:viewportWidth="24.0" android:viewportHeight="24.0" android:tint="?attr/colorControlNormal"> <path android:fillColor="@android:color/white" android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/> </vector> ```
/content/code_sandbox/app/src/main/res/drawable/ic_add_24dp.xml
xml
2016-07-02T10:44:04
2024-08-16T18:55:54
StreetComplete
streetcomplete/StreetComplete
3,781
114
```xml import { G2Spec } from '../../../src'; export function athletesRectBin(): G2Spec { return { type: 'rect', data: { type: 'fetch', value: 'data/athletes.csv', }, transform: [{ type: 'bin', opacity: 'count' }], encode: { x: 'weight', y: 'height', color: 'sex', }, legend: { opacity: false, }, style: { inset: 0.5, }, }; } ```
/content/code_sandbox/__tests__/plots/static/athletes-rect-bin.ts
xml
2016-05-26T09:21:04
2024-08-15T16:11:17
G2
antvis/G2
12,060
119
```xml <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="path_to_url"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion>9.0.21022</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{08791729-6CDC-4E64-8404-2CAB4528BFE2}</ProjectGuid> <OutputType>Exe</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>ConsoleApplication1</RootNamespace> <AssemblyName>setup</AssemblyName> <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE;CSS_PROJECT</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <UseVSHostingProcess>false</UseVSHostingProcess> <AllowUnsafeBlocks>false</AllowUnsafeBlocks> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE;CSS_PROJECT</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <UseVSHostingProcess>false</UseVSHostingProcess> <AllowUnsafeBlocks>false</AllowUnsafeBlocks> </PropertyGroup> <ItemGroup> <Reference Include="System" /> <Reference Include="System.Core"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Xml.Linq"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Data.DataSetExtensions"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> <Reference Include="System"> <SpecificVersion>False</SpecificVersion> <HintPath>System.dll</HintPath> </Reference> <Reference Include="System.Xml"> <SpecificVersion>False</SpecificVersion> <HintPath>System.Xml.dll</HintPath> </Reference> <Reference Include="System.Xml.Linq"> <SpecificVersion>False</SpecificVersion> <HintPath>System.Xml.Linq.dll</HintPath> </Reference> <Reference Include="system.core"> <SpecificVersion>False</SpecificVersion> <HintPath>system.core.dll</HintPath> </Reference> <Reference Include="WixSharp, Version=0.1.12.0, Culture=neutral, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\..\WixSharp.dll</HintPath> </Reference> </ItemGroup> <ItemGroup> <Compile Include="setup.cs" /> </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> <PropertyGroup> <PostBuildEvent>cd "$(ProjectDir)" "$(TargetPath)"</PostBuildEvent> </PropertyGroup> </Project> ```
/content/code_sandbox/Source/src/WixSharp.Samples/Wix# Samples/Building with Visual Studio/setup.csproj
xml
2016-01-16T05:51:01
2024-08-16T12:26:25
wixsharp
oleg-shilo/wixsharp
1,077
895
```xml <?xml version="1.0" encoding="UTF-8"?> <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16097" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> <device id="retina4_7" orientation="portrait" appearance="light"/> <dependencies> <deployment identifier="iOS"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> <objects> <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/> <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="gTV-IL-0wX" customClass="BMImageCell"> <rect key="frame" x="0.0" y="0.0" width="124" height="149"/> <autoresizingMask key="autoresizingMask"/> <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> <rect key="frame" x="0.0" y="0.0" width="124" height="149"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <subviews> <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="raD-Uh-NxR"> <rect key="frame" x="10" y="10" width="104" height="129"/> <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> </imageView> </subviews> </view> <constraints> <constraint firstItem="raD-Uh-NxR" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" constant="10" id="Toe-AA-rQr"/> <constraint firstAttribute="bottom" secondItem="raD-Uh-NxR" secondAttribute="bottom" constant="10" id="Zao-ze-cok"/> <constraint firstItem="raD-Uh-NxR" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" constant="10" id="rR3-Lb-qnR"/> <constraint firstAttribute="trailing" secondItem="raD-Uh-NxR" secondAttribute="trailing" constant="10" id="uxb-r0-jtv"/> </constraints> <size key="customSize" width="124" height="149"/> <connections> <outlet property="imageView" destination="raD-Uh-NxR" id="K6k-zi-Ab4"/> </connections> <point key="canvasLocation" x="-103" y="-20"/> </collectionViewCell> </objects> </document> ```
/content/code_sandbox/Example/BMLongPressDragCellCollectionView/Demo/Classes/QQ/View/BMImageCell.xib
xml
2016-07-04T14:16:22
2024-06-27T09:25:27
BMLongPressDragCellCollectionView
liangdahong/BMLongPressDragCellCollectionView
1,184
738
```xml import React from 'react'; import { cleanup, render } from '../../../test/test-react-testing-library'; import Spinner from './Spinner'; describe('<Spinner /> component', () => { beforeEach(cleanup); test('should render the component in default state', () => { const wrapper = render(<Spinner />); expect(wrapper).toMatchSnapshot(); }); }); ```
/content/code_sandbox/packages/ui-components/src/components/Loading/Spinner/Spinner.test.tsx
xml
2016-04-15T16:21:12
2024-08-16T09:38:01
verdaccio
verdaccio/verdaccio
16,189
72
```xml <vector xmlns:android="path_to_url" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24"> <path android:pathData="M4.04,2.821C4.051,2.826 4.062,2.831 4.073,2.836L20.823,10.373C21.052,10.476 21.281,10.579 21.459,10.679C21.625,10.773 21.945,10.966 22.128,11.335C22.335,11.754 22.335,12.246 22.128,12.665C21.945,13.034 21.625,13.227 21.459,13.321C21.281,13.421 21.052,13.524 20.824,13.627L4.046,21.177C3.811,21.282 3.578,21.387 3.381,21.455C3.201,21.518 2.837,21.632 2.435,21.52C1.981,21.393 1.612,21.06 1.441,20.62C1.289,20.231 1.367,19.858 1.411,19.672C1.459,19.47 1.54,19.227 1.622,18.983L3.947,12.037L1.626,5.044C1.622,5.033 1.618,5.021 1.615,5.01C1.534,4.767 1.454,4.524 1.406,4.322C1.362,4.137 1.286,3.764 1.438,3.376C1.61,2.937 1.978,2.605 2.432,2.478C2.834,2.366 3.197,2.481 3.377,2.543C3.574,2.611 3.806,2.716 4.04,2.821ZM3.668,4.847L5.71,11H10.501C11.054,11 11.501,11.448 11.501,12C11.501,12.552 11.054,13 10.501,13H5.734L3.675,19.15L19.564,12L3.668,4.847Z" android:fillColor="#303233" android:fillType="evenOdd"/> </vector> ```
/content/code_sandbox/icon-pack/src/main/res/drawable/ic_send_horizontal_medium_regular_outline.xml
xml
2016-05-04T11:46:20
2024-08-15T16:29:10
android
meganz/android
1,537
606
```xml import type * as ReactTypes from "react"; import type { ObservableQuery, OperationVariables } from "../../core/index.js"; import type { QueryDataOptions } from "../types/types.js"; import { Trie } from "@wry/trie"; import { canonicalStringify } from "../../cache/index.js"; // TODO: A vestigial interface from when hooks were implemented with utility // classes, which should be deleted in the future. interface QueryData { getOptions(): any; fetchData(): Promise<void>; } type QueryInfo = { seen: boolean; observable: ObservableQuery<any, any> | null; }; function makeQueryInfoTrie() { // these Tries are very short-lived, so we don't need to worry about making it // "weak" - it's easier to test and debug as a strong Trie. return new Trie<QueryInfo>(false, () => ({ seen: false, observable: null, })); } export class RenderPromises { // Map from Query component instances to pending fetchData promises. private queryPromises = new Map<QueryDataOptions<any, any>, Promise<any>>(); // Two-layered map from (query document, stringified variables) to QueryInfo // objects. These QueryInfo objects are intended to survive through the whole // getMarkupFromTree process, whereas specific Query instances do not survive // beyond a single call to renderToStaticMarkup. private queryInfoTrie = makeQueryInfoTrie(); private stopped = false; public stop() { if (!this.stopped) { this.queryPromises.clear(); this.queryInfoTrie = makeQueryInfoTrie(); this.stopped = true; } } // Registers the server side rendered observable. public registerSSRObservable<TData, TVariables extends OperationVariables>( observable: ObservableQuery<any, TVariables> ) { if (this.stopped) return; this.lookupQueryInfo(observable.options).observable = observable; } // Get's the cached observable that matches the SSR Query instances query and variables. public getSSRObservable<TData, TVariables extends OperationVariables>( props: QueryDataOptions<TData, TVariables> ): ObservableQuery<any, TVariables> | null { return this.lookupQueryInfo(props).observable; } public addQueryPromise( queryInstance: QueryData, finish?: () => ReactTypes.ReactNode ): ReactTypes.ReactNode { if (!this.stopped) { const info = this.lookupQueryInfo(queryInstance.getOptions()); if (!info.seen) { this.queryPromises.set( queryInstance.getOptions(), new Promise((resolve) => { resolve(queryInstance.fetchData()); }) ); // Render null to abandon this subtree for this rendering, so that we // can wait for the data to arrive. return null; } } return finish ? finish() : null; } public addObservableQueryPromise< TData, TVariables extends OperationVariables, >(obsQuery: ObservableQuery<TData, TVariables>) { return this.addQueryPromise({ // The only options which seem to actually be used by the // RenderPromises class are query and variables. getOptions: () => obsQuery.options, fetchData: () => new Promise<void>((resolve) => { const sub = obsQuery.subscribe({ next(result) { if (!result.loading) { resolve(); sub.unsubscribe(); } }, error() { resolve(); sub.unsubscribe(); }, complete() { resolve(); }, }); }), }); } public hasPromises() { return this.queryPromises.size > 0; } public consumeAndAwaitPromises() { const promises: Promise<any>[] = []; this.queryPromises.forEach((promise, queryInstance) => { // Make sure we never try to call fetchData for this query document and // these variables again. Since the queryInstance objects change with // every rendering, deduplicating them by query and variables is the // best we can do. If a different Query component happens to have the // same query document and variables, it will be immediately rendered // by calling finish() in addQueryPromise, which could result in the // rendering of an unwanted loading state, but that's not nearly as bad // as getting stuck in an infinite rendering loop because we kept calling // queryInstance.fetchData for the same Query component indefinitely. this.lookupQueryInfo(queryInstance).seen = true; promises.push(promise); }); this.queryPromises.clear(); return Promise.all(promises); } private lookupQueryInfo<TData, TVariables extends OperationVariables>( props: QueryDataOptions<TData, TVariables> ): QueryInfo { return this.queryInfoTrie.lookup( props.query, canonicalStringify(props.variables) ); } } ```
/content/code_sandbox/src/react/ssr/RenderPromises.ts
xml
2016-02-26T20:25:00
2024-08-16T10:56:57
apollo-client
apollographql/apollo-client
19,304
1,060
```xml <?xml version="1.0" encoding="UTF-8"?> <definitions xmlns="path_to_url" xmlns:xsi="path_to_url" xmlns:xsd="path_to_url" xmlns:flowable="path_to_url" xmlns:bpmndi="path_to_url" xmlns:omgdc="path_to_url" xmlns:omgdi="path_to_url" typeLanguage="path_to_url" expressionLanguage="path_to_url" targetNamespace="path_to_url"> <process id="simpleProcess" name="Simple Process" isExecutable="true"> <startEvent id="startEvent1" flowable:formFieldValidation="true"/> <serviceTask id="externalWorker" flowable:type="external-worker" flowable:topic="customer"/> <endEvent id="end"/> <sequenceFlow id="flow1" sourceRef="startEvent1" targetRef="externalWorker"/> <sequenceFlow id="flow2" sourceRef="externalWorker" targetRef="end"/> </process> <bpmndi:BPMNDiagram id="BPMNDiagram_simpleProcess"> <bpmndi:BPMNPlane bpmnElement="simpleProcess" id="BPMNPlane_simpleProcess"> <bpmndi:BPMNShape bpmnElement="startEvent1" id="BPMNShape_startEvent1"> <omgdc:Bounds height="30.0" width="30.0" x="100.0" y="163.0"/> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement="externalWorker" id="BPMNShape_externalWorker"> <omgdc:Bounds height="80.0" width="100.0" x="240.0" y="138.0"/> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement="end" id="BPMNShape_end"> <omgdc:Bounds height="28.0" width="28.0" x="540.0" y="164.0"/> </bpmndi:BPMNShape> <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1"> <omgdi:waypoint x="129.94999940317362" y="178.0"/> <omgdi:waypoint x="239.99999999993753" y="178.0"/> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2"> <omgdi:waypoint x="290.0" y="217.95000000000002"/> <omgdi:waypoint x="290.0" y="253.0"/> <omgdi:waypoint x="554.0" y="253.0"/> <omgdi:waypoint x="554.0" y="191.94994181072911"/> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </definitions> ```
/content/code_sandbox/modules/flowable-cmmn-engine-configurator/src/test/resources/org/flowable/cmmn/test/ExternalWorkerCombinedScopeTest.simpleProcess.bpmn20.xml
xml
2016-10-13T07:21:43
2024-08-16T15:23:14
flowable-engine
flowable/flowable-engine
7,715
700
```xml /* generate-octicons * * Utility script for generating a strongly typed representation of all * octicons distributed by the octicons NPM package. Enumerates the icons * and generates the TypeScript class containing just what Desktop needs. */ import * as fs from 'fs' import * as Path from 'path' import * as cp from 'child_process' import { check } from 'reserved-words' import toCamelCase from 'to-camel-case' // Basic type for the @primer/octicons package. type OcticonsLib = Record< string, { readonly symbol: string readonly heights: Record< string, { readonly ast: { readonly children: ReadonlyArray<{ readonly attributes: { readonly d: string } }> } readonly options: { readonly height: string readonly width: string } } > } > interface IOcticonVariant { p: string[] h: number w: number } interface IOcticon { /** JS friendly name of the icon. */ readonly name: string /** Size variants of the icon. */ readonly variants: Record<PropertyKey, IOcticonVariant> } function getJsFriendlyName(name: string) { const sanitizedName = toCamelCase(name) return check(sanitizedName, 'es6', true) ? sanitizedName + '_' : sanitizedName } async function generateIconData(): Promise<ReadonlyArray<IOcticon>> { const octicons: OcticonsLib = require('@primer/octicons') return Object.keys(octicons) .sort() .map(name => { const octicon = octicons[name] if (Object.keys(octicon.heights).length === 0) { throw new Error(`Unexpected empty sizes array for ${octicon.symbol}`) } const variants: Record<PropertyKey, IOcticonVariant> = {} Object.entries(octicon.heights).forEach(([height, data]) => { variants[height] = { p: data.ast.children.map(c => c.attributes.d), h: parseInt(data.options.height, 10), w: parseInt(data.options.width, 10), } }) return { name: getJsFriendlyName(name), variants } }) } generateIconData().then(results => { console.log(`Writing ${results.length} octicons...`) const out = fs.createWriteStream( Path.resolve(__dirname, '../app/src/ui/octicons/octicons.generated.ts'), { encoding: 'utf-8', } ) out.write(`/* * This file is automatically generated by the generate-octicons tool. * Manually changing this file will only lead to sadness. */ export type OcticonSymbolVariant = { /** SVG path element data */ readonly p: string[] /** The width of the symbol */ readonly w: number /** The height of the symbol */ readonly h: number } export type OcticonSymbolVariants = Record<PropertyKey, OcticonSymbolVariant> export type OcticonSymbol = OcticonSymbolVariant | OcticonSymbolVariants\n\n`) results.forEach(icon => { out.write( `export const ${icon.name}: OcticonSymbolVariants = ${JSON.stringify( icon.variants )}\n` ) }) out.end() console.log('Ensuring generated file is formatted correctly...') const root = Path.dirname(__dirname) const yarnExecutable = process.platform === 'win32' ? 'yarn.cmd' : 'yarn' return cp.spawn(yarnExecutable, ['lint:fix'], { cwd: root, stdio: 'inherit' }) }) ```
/content/code_sandbox/script/generate-octicons.ts
xml
2016-05-11T15:59:00
2024-08-16T17:00:41
desktop
desktop/desktop
19,544
792
```xml <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="path_to_url"> <gradient android:angle="315" android:startColor="@color/colorDeepPurplePrimary" android:centerColor="@color/colorDeepPurplePrimaryCenter" android:endColor="@color/black" /> </shape> ```
/content/code_sandbox/app/src/main/res/drawable/deep_purple_background.xml
xml
2016-02-02T05:18:46
2024-08-15T02:04:44
GanK
dongjunkun/GanK
1,163
71
```xml <!-- ~ contributor license agreements. See the NOTICE file distributed with ~ this work for additional information regarding copyright ownership. ~ ~ path_to_url ~ ~ Unless required by applicable law or agreed to in writing, software ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --> <dataset update-count="1"> <metadata data-nodes="tbl.t_single_table"> <column name="single_id" type="numeric" /> <column name="id" type="numeric" /> <column name="status" type="varchar" /> </metadata> <row data-node="tbl.t_single_table" values="2, 1001, init" /> <row data-node="tbl.t_single_table" values="3, 1002, init" /> <row data-node="tbl.t_single_table" values="4, 1003, init" /> </dataset> ```
/content/code_sandbox/test/e2e/sql/src/test/resources/cases/dml/dataset/tbl/delete_single_table_by_id.xml
xml
2016-01-18T12:49:26
2024-08-16T15:48:11
shardingsphere
apache/shardingsphere
19,707
201
```xml import * as ts from 'typescript'; import { AssignmentHelper } from './assignment'; import { CodeTemplate, CodeTemplateFactory, CTemplateBase } from '../template'; import { IScope } from '../program'; import { StringVarType, RegexVarType, NumberVarType, UniversalVarType, BooleanVarType, ArrayType, StructType, DictType } from '../types/ctypes'; import { CVariable } from './variable'; import { CRegexAsString } from './regexfunc'; import { CString } from './literals'; import { CAsNumber, CAsString_Length, CAsString_Concat, CAsUniversalVar, CAsString } from './typeconvert'; import { isCompoundAssignment, isNumberOp, isIntegerOp, isRelationalOp, isEqualityOp, isLogicOp, isInBoolContext, isSimpleNode, toNumberCanBeNaN } from '../types/utils'; import { CArraySize } from './elementaccess'; import { StandardCallHelper } from '../standard'; export type CExpression = string | CTemplateBase; @CodeTemplate(` {#if universalWrapper} js_var_to_bool({expression}) {#elseif isString && expressionIsIdentifier} *{expression} {#elseif isString} *({expression}) {#else} {expression} {/if}`) export class CCondition extends CTemplateBase { public universalWrapper: boolean = false; public isString: boolean = false; public expression: CExpression; public expressionIsIdentifier: boolean = false; constructor(scope: IScope, node: ts.Expression) { super(); this.expression = CodeTemplateFactory.createForNode(scope, node); this.expressionIsIdentifier = ts.isIdentifier(node); const type = scope.root.typeHelper.getCType(node); this.isString = type == StringVarType; if (type == UniversalVarType) { this.universalWrapper = true; scope.root.headerFlags.js_var_to_bool = true; } } } @CodeTemplate(` {#if expression} {expression} {#else} /* unsupported expression {nodeText} */ {/if}`, ts.SyntaxKind.BinaryExpression) export class CBinaryExpression extends CTemplateBase { public expression: CExpression = null; public operator: string; public left: CExpression; public right: CExpression; public nodeText: string; constructor(scope: IScope, node: ts.BinaryExpression) { super(); if (node.operatorToken.kind == ts.SyntaxKind.EqualsToken) { this.expression = AssignmentHelper.create(scope, node.left, node.right, true); return; } if (node.operatorToken.kind == ts.SyntaxKind.CommaToken) { let nodeAsStatement = <ts.ExpressionStatement>ts.createNode(ts.SyntaxKind.ExpressionStatement); nodeAsStatement.expression = node.left; nodeAsStatement.parent = node.getSourceFile(); scope.statements.push(CodeTemplateFactory.createForNode(scope, nodeAsStatement)); this.expression = CodeTemplateFactory.createForNode(scope, node.right); return; } if (node.operatorToken.kind == ts.SyntaxKind.PlusToken) { this.expression = new CPlusExpression(scope, node); return; } if (node.operatorToken.kind == ts.SyntaxKind.PlusEqualsToken) { const left = CodeTemplateFactory.createForNode(scope, node.left); const right = new CPlusExpression(scope, node); this.expression = "(" + CodeTemplateFactory.templateToString(left) + " = " + CodeTemplateFactory.templateToString(right) + ")"; } if (isNumberOp(node.operatorToken.kind) || isIntegerOp(node.operatorToken.kind)) { this.expression = new CArithmeticExpression(scope, node); return; } if (isRelationalOp(node.operatorToken.kind)) { this.expression = new CRelationalExpression(scope, node); return; } if (isEqualityOp(node.operatorToken.kind)) { this.expression = new CEqualityExpression(scope, node); return; } if (node.operatorToken.kind === ts.SyntaxKind.InKeyword) { this.expression = new CInExpression(scope, node); return; } if (isLogicOp(node.operatorToken.kind)) { this.expression = new CLogicExpession(scope, node); return; } this.nodeText = node.flags & ts.NodeFlags.Synthesized ? "(synthesized node)" : node.getText(); } } @CodeTemplate(` {#statements} {#if leftVarName} {leftVarName} = {left}; {/if} {#if rightVarName} {rightVarName} = {right}; {/if} {/statements} {#if isBoolContext} {left} {operator} {right} {#else} {condition} ? {whenTrue} : {whenFalse} {/if}`) class CLogicExpession extends CTemplateBase { public isBoolContext: boolean; public operator: string; public left: CExpression; public right: CExpression; public leftVarName: string = ""; public rightVarName: string = ""; public condition: CExpression; public whenTrue: CExpression; public whenFalse: CExpression; constructor(scope: IScope, node: ts.BinaryExpression) { super(); const type = scope.root.typeHelper.getCType(node); if (type === UniversalVarType) { this.left = new CAsUniversalVar(scope, node.left); this.right = new CAsUniversalVar(scope, node.right); } else { this.left = CodeTemplateFactory.createForNode(scope, node.left); this.right = CodeTemplateFactory.createForNode(scope, node.right); } this.isBoolContext = isInBoolContext(node) && type !== UniversalVarType; const isOr = node.operatorToken.kind === ts.SyntaxKind.BarBarToken; if (this.isBoolContext) { this.operator = isOr ? "||" : "&&"; } else { if (!isSimpleNode(node.left)) { this.leftVarName = scope.root.symbolsHelper.addTemp(node, "tmp1"); scope.variables.push(new CVariable(scope, this.leftVarName, type)); } if (!isSimpleNode(node.right)) { this.rightVarName = scope.root.symbolsHelper.addTemp(node, "tmp2"); scope.variables.push(new CVariable(scope, this.rightVarName, type)); } if (this.leftVarName && type === UniversalVarType) { this.condition = "js_var_to_bool(" + this.leftVarName + ")"; scope.root.headerFlags.js_var_to_bool = true; } else this.condition = this.leftVarName || new CCondition(scope, node.left); if (isOr) { this.whenTrue = this.leftVarName || this.left; this.whenFalse = this.rightVarName || this.right; } else { this.whenTrue = this.rightVarName || this.right; this.whenFalse = this.leftVarName || this.left; } } } } @CodeTemplate(` {#if operator} {left} {operator} {right} {#elseif computeOperation && isCompoundAssignment} {left} = js_var_compute({left}, {computeOperation}, {right}) {#elseif computeOperation} js_var_compute({left}, {computeOperation}, {right}) {#else} /* unsupported arithmetic expression {nodeText} */ {/if}`) class CArithmeticExpression extends CTemplateBase { public isCompoundAssignment; public operator: string = null; public computeOperation: string = null; public left: CExpression; public right: CExpression; public nodeText: string; constructor(scope: IScope, node: ts.BinaryExpression) { super(); let leftType = scope.root.typeHelper.getCType(node.left); let rightType = scope.root.typeHelper.getCType(node.right); this.isCompoundAssignment = isCompoundAssignment(node.operatorToken); if (toNumberCanBeNaN(leftType) || toNumberCanBeNaN(rightType)) { const js_var_operator_map = { [ts.SyntaxKind.AsteriskToken]: "JS_VAR_ASTERISK", [ts.SyntaxKind.AsteriskEqualsToken]: "JS_VAR_ASTERISK", [ts.SyntaxKind.SlashToken]: "JS_VAR_SLASH", [ts.SyntaxKind.SlashEqualsToken]: "JS_VAR_SLASH", [ts.SyntaxKind.PercentToken]: "JS_VAR_PERCENT", [ts.SyntaxKind.PercentEqualsToken]: "JS_VAR_PERCENT", [ts.SyntaxKind.MinusToken]: "JS_VAR_MINUS", [ts.SyntaxKind.MinusEqualsToken]: "JS_VAR_MINUS", [ts.SyntaxKind.LessThanLessThanToken]: "JS_VAR_SHL", [ts.SyntaxKind.LessThanLessThanEqualsToken]: "JS_VAR_SHL", [ts.SyntaxKind.GreaterThanGreaterThanToken]: "JS_VAR_SHR", [ts.SyntaxKind.GreaterThanGreaterThanEqualsToken]: "JS_VAR_SHR", [ts.SyntaxKind.GreaterThanGreaterThanGreaterThanToken]: "JS_VAR_USHR", [ts.SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken]: "JS_VAR_USHR", [ts.SyntaxKind.BarToken]: "JS_VAR_OR", [ts.SyntaxKind.BarEqualsToken]: "JS_VAR_OR", [ts.SyntaxKind.AmpersandToken]: "JS_VAR_AND", [ts.SyntaxKind.AmpersandEqualsToken]: "JS_VAR_AND" }; this.computeOperation = js_var_operator_map[node.operatorToken.kind]; this.left = new CAsUniversalVar(scope, node.left); this.right = new CAsUniversalVar(scope, node.right); scope.root.headerFlags.js_var_compute = true; } else { this.operator = node.operatorToken.getText(); this.left = new CAsNumber(scope, node.left); this.right = new CAsNumber(scope, node.right); if (node.operatorToken.kind == ts.SyntaxKind.GreaterThanGreaterThanGreaterThanToken || node.operatorToken.kind == ts.SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken) { this.operator = ">>"; const leftAsString = CodeTemplateFactory.templateToString(this.left); this.left = "((uint16_t)" + leftAsString + ")"; if (node.operatorToken.kind == ts.SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken) this.left = leftAsString + " = " + this.left; scope.root.headerFlags.uint16_t = true; } } this.nodeText = node.flags & ts.NodeFlags.Synthesized ? "(synthesized node)" : node.getText(); } } @CodeTemplate(` {#if operator} {left} {operator} {right} {#elseif stringCondition} strcmp({left}, {right}) {stringCondition} {#elseif universalCondition} js_var_lessthan({left}, {right}) {universalCondition} {#else} /* unsupported relational expression {nodeText} */ {/if}`) class CRelationalExpression extends CTemplateBase { public operator: string = null; public universalCondition: string = null; public stringCondition: string = null; public left: CExpression; public right: CExpression; public nodeText: string; constructor(scope: IScope, node: ts.BinaryExpression) { super(); let leftType = scope.root.typeHelper.getCType(node.left); let rightType = scope.root.typeHelper.getCType(node.right); if (leftType === UniversalVarType || rightType === UniversalVarType) { switch(node.operatorToken.kind) { case ts.SyntaxKind.LessThanToken: this.left = new CAsUniversalVar(scope, node.left); this.right = new CAsUniversalVar(scope, node.right); this.universalCondition = "> 0"; break; case ts.SyntaxKind.LessThanEqualsToken: // notice operands are swapped this.left = new CAsUniversalVar(scope, node.right); this.right = new CAsUniversalVar(scope, node.left); this.universalCondition = "< 0"; break; case ts.SyntaxKind.GreaterThanToken: // notice operands are swapped this.left = new CAsUniversalVar(scope, node.right); this.right = new CAsUniversalVar(scope, node.left); this.universalCondition = "> 0"; break; case ts.SyntaxKind.GreaterThanEqualsToken: this.left = new CAsUniversalVar(scope, node.left); this.right = new CAsUniversalVar(scope, node.right); this.universalCondition = "< 0"; break; } scope.root.headerFlags.js_var_lessthan = true; } else if (leftType === StringVarType && rightType === StringVarType) { this.stringCondition = node.operatorToken.getText() + " 0"; this.left = CodeTemplateFactory.createForNode(scope, node.left); this.right = CodeTemplateFactory.createForNode(scope, node.right); scope.root.headerFlags.strings = true; } else { this.operator = node.operatorToken.getText(); this.left = new CAsNumber(scope, node.left); this.right = new CAsNumber(scope, node.right); } this.nodeText = node.flags & ts.NodeFlags.Synthesized ? "(synthesized node)" : node.getText(); } } @CodeTemplate(` {#if expression} {expression} {#elseif operator} {left} {operator} {right} {#elseif stringCondition} strcmp({left}, {right}) {stringCondition} {#elseif strNumCondition} str_int16_t_cmp({left}, {right}) {strNumCondition} {#elseif universalCondition} js_var_eq({left}, {right}, {strict}) {universalCondition} {#else} /* unsupported equality expression {nodeText} */ {/if}`) class CEqualityExpression extends CTemplateBase { public expression: string = null; public operator: string = null; public stringCondition: string = null; public strNumCondition: string = null; public universalCondition: string = null; public strict: string = null; public left: CExpression; public right: CExpression; public nodeText: string; constructor(scope: IScope, node: ts.BinaryExpression) { super(); const leftType = scope.root.typeHelper.getCType(node.left); const rightType = scope.root.typeHelper.getCType(node.right); const notEquals = node.operatorToken.kind === ts.SyntaxKind.ExclamationEqualsEqualsToken || node.operatorToken.kind === ts.SyntaxKind.ExclamationEqualsToken; this.strict = node.operatorToken.kind === ts.SyntaxKind.ExclamationEqualsEqualsToken || node.operatorToken.kind === ts.SyntaxKind.EqualsEqualsEqualsToken ? "TRUE" : "FALSE"; this.left = CodeTemplateFactory.createForNode(scope, node.left); this.right = CodeTemplateFactory.createForNode(scope, node.right); if ((leftType == NumberVarType || leftType == BooleanVarType) && (rightType == NumberVarType || rightType == BooleanVarType)) { this.operator = notEquals ? "!=" : "=="; } else if (leftType == StringVarType && rightType == StringVarType) { this.stringCondition = notEquals ? "!= 0" : "== 0"; scope.root.headerFlags.strings = true; } else if (leftType == NumberVarType && rightType == StringVarType || leftType == StringVarType && rightType == NumberVarType) { this.strNumCondition = notEquals ? "!= 0" : "== 0"; scope.root.headerFlags.str_int16_t_cmp = true; // str_int16_t_cmp expects certain order of arguments (string, number) if (leftType == NumberVarType) { const tmp = this.left; this.left = this.right; this.right = tmp; } } else if (leftType == UniversalVarType || rightType == UniversalVarType) { this.universalCondition = notEquals ? "== FALSE" : "== TRUE"; this.left = new CAsUniversalVar(scope, this.left, leftType); this.right = new CAsUniversalVar(scope, this.right, rightType); scope.root.headerFlags.js_var_eq = true; } else if (leftType instanceof StructType || leftType instanceof ArrayType || leftType instanceof DictType || rightType instanceof StructType || rightType instanceof ArrayType || rightType instanceof DictType) { if (leftType != rightType) { this.expression = notEquals ? "TRUE" : "FALSE"; scope.root.headerFlags.bool = true; } else this.operator = notEquals ? "!=" : "=="; } this.nodeText = node.flags & ts.NodeFlags.Synthesized ? "(synthesized node)" : node.getText(); } } @CodeTemplate(` {#statements} {#if replacedWithVar} {replacementVarName} = malloc({strlen_left} + {strlen_right} + 1); assert({replacementVarName} != NULL); {replacementVarName}[0] = '\\0'; {strcat_left} {strcat_right} {/if} {#if replacedWithVar && gcVarName} ARRAY_PUSH({gcVarName}, {replacementVarName}); {/if} {/statements} {#if addNumbers} {left} + {right} {#elseif replacedWithVar} {replacementVarName} {#elseif isUniversalVar} js_var_plus({left}, {right}) {/if}`) class CPlusExpression extends CTemplateBase { public addNumbers: boolean = false; public isUniversalVar: boolean = false; public replacedWithVar: boolean = false; public replacementVarName: string = null; public gcVarName: string = null; public left: CExpression; public right: CExpression; public strcat_left: CExpression; public strcat_right: CExpression; public strlen_left: CExpression; public strlen_right: CExpression; constructor(scope: IScope, node: ts.BinaryExpression) { super(); let leftType = scope.root.typeHelper.getCType(node.left); this.left = CodeTemplateFactory.createForNode(scope, node.left); let rightType = scope.root.typeHelper.getCType(node.right); this.right = CodeTemplateFactory.createForNode(scope, node.right); if (leftType == RegexVarType) { leftType = StringVarType; this.left = new CRegexAsString(this.left); } if (rightType == RegexVarType) { rightType = StringVarType; this.right = new CRegexAsString(this.right); } if ((leftType === NumberVarType || leftType === BooleanVarType) && (rightType === NumberVarType || rightType === BooleanVarType)) { this.addNumbers = true; } else if (leftType === UniversalVarType || rightType === UniversalVarType) { this.isUniversalVar = true; this.left = new CAsUniversalVar(scope, this.left, leftType); this.right = new CAsUniversalVar(scope, this.right, rightType); scope.root.headerFlags.js_var_plus = true; } else { let tempVarName = scope.root.memoryManager.getReservedTemporaryVarName(node); scope.func.variables.push(new CVariable(scope, tempVarName, "char *", { initializer: "NULL" })); this.gcVarName = scope.root.memoryManager.getGCVariableForNode(node); this.replacedWithVar = true; this.replacementVarName = tempVarName; this.strlen_left = new CAsString_Length(scope, node.left, this.left, leftType); this.strlen_right = new CAsString_Length(scope, node.right, this.right, rightType); this.strcat_left = new CAsString_Concat(scope, node.left, tempVarName, this.left, leftType); this.strcat_right = new CAsString_Concat(scope, node.right, tempVarName, this.right, rightType); scope.root.headerFlags.strings = true; scope.root.headerFlags.malloc = true; scope.root.headerFlags.str_int16_t_cat = true; if (this.gcVarName) { scope.root.headerFlags.gc_iterator = true; scope.root.headerFlags.array = true; } } } } @CodeTemplate(` {#statements} {#if tmpVarName} {tmpVarName} = {key}; {/if} {/statements} {#if result} {result} {#elseif isArray && tmpVarName} ({tmpVarName}.type != JS_VAR_NAN && {tmpVarName}.number >= 0 && {tmpVarName}.number < {arraySize}) {#elseif isArray && !tmpVarName} ({key} >= 0 && {key} < {arraySize}) {#elseif isStruct} dict_find_pos({propertiesVarName}, {propertiesCount}, {key}) > -1 {#elseif isDict} dict_find_pos({obj}->index->data, {obj}->index->size, {key}) > -1 {#elseif isUniversalVar} js_var_get({obj}, {key}).type != JS_VAR_UNDEFINED {#else} /* unsupported 'in' expression {nodeText} */ {/if}`) class CInExpression extends CTemplateBase { public isArray: boolean = false; public arraySize: CArraySize; public isStruct: boolean = false; public propertiesVarName: string; public propertiesCount: string; public isDict: boolean = false; public isUniversalVar: boolean = false; public result: string = null; public obj: CExpression; public key: CExpression; public tmpVarName: string = null; public nodeText: string; constructor(scope: IScope, node: ts.BinaryExpression) { super(); const type = scope.root.typeHelper.getCType(node.right); this.obj = CodeTemplateFactory.createForNode(scope, node.right); if (type instanceof ArrayType) { this.isArray = true; this.arraySize = new CArraySize(scope, this.obj, type); this.key = new CAsNumber(scope, node.left); const keyType = scope.root.typeHelper.getCType(node.left); if (toNumberCanBeNaN(keyType)) { this.tmpVarName = scope.root.symbolsHelper.addTemp(node, "tmp_key"); scope.variables.push(new CVariable(scope, this.tmpVarName, UniversalVarType)); } } else { this.key = new CAsString(scope, node.left); } if (type instanceof StructType) { this.isStruct = true; const propTypes = Object.keys(type.properties); if (propTypes.length == 0) { this.result = "FALSE"; scope.root.headerFlags.bool = true; } else { const initializer = "{ " + propTypes.sort().map(p => '"' + p + '"').join(", ") + " }"; this.propertiesVarName = type.structName + "_props"; this.propertiesCount = propTypes.length + ""; if (!scope.root.variables.some(v => v.name === this.propertiesVarName)) scope.root.variables.push(new CVariable(scope, this.propertiesVarName, "const char *{var}[" + this.propertiesCount + "]", { initializer })); scope.root.headerFlags.dict_find_pos = true; } } this.isDict = type instanceof DictType; this.isUniversalVar = type === UniversalVarType; if (ts.isStringLiteral(node.left)) { const ident = ts.createIdentifier(node.left.text); const propAccess = ts.createPropertyAccess(node.right, ident); const standardCall = ts.createCall(propAccess,[],[]); ident.parent = propAccess; ident.getText = () => ident.text; propAccess.parent = standardCall; propAccess.getText = () => "(" + node.right.getText() + ")." + ident.text; standardCall.parent = node.parent; standardCall.getText = () => propAccess.getText() + "()"; if (StandardCallHelper.isStandardCall(scope.root.typeHelper, standardCall)) this.result = "TRUE"; } if (this.isArray && ts.isStringLiteral(node.left) && node.left.text === "length") this.result = "TRUE"; this.nodeText = node.getText(); } } @CodeTemplate(` {#if isCompound} ({operand} = {before}{operand}{after}) {#elseif incrementBy && isPostfix} js_var_dict_inc({operand}, {argumentExpr}, {incrementBy}, TRUE) {#elseif incrementBy} js_var_dict_inc({operand}, {argumentExpr}, {incrementBy}, FALSE) {#else} {before}{operand}{after} {/if}`, [ts.SyntaxKind.PrefixUnaryExpression, ts.SyntaxKind.PostfixUnaryExpression]) class CUnaryExpression extends CTemplateBase { public before: string = ""; public operand: CExpression; public after: string = ""; public argumentExpr: CExpression = null; public incrementBy: string = ""; public isPostfix: boolean; public isCompound: boolean = false; constructor(scope: IScope, node: ts.PostfixUnaryExpression | ts.PrefixUnaryExpression) { super(); this.isPostfix = ts.isPostfixUnaryExpression(node); const isTopExpressionOfStatement = ts.isExpressionStatement(node.parent); const type = scope.root.typeHelper.getCType(node.operand); if (node.operator === ts.SyntaxKind.PlusToken) this.operand = new CAsNumber(scope, node.operand); else if (node.operator === ts.SyntaxKind.MinusToken) { this.before = "-"; this.operand = new CAsNumber(scope, node.operand); if (toNumberCanBeNaN(type)) { this.before = "js_var_compute(js_var_from_int16_t(0), JS_VAR_MINUS, "; this.after = ")"; scope.root.headerFlags.js_var_compute = true; scope.root.headerFlags.js_var_from_int16_t = true; } } else if (node.operator === ts.SyntaxKind.TildeToken) { this.before = "~"; this.operand = new CAsNumber(scope, node.operand); if (toNumberCanBeNaN(type)) this.after = ".number"; } else if (node.operator === ts.SyntaxKind.ExclamationToken) { this.before = "!"; this.operand = new CCondition(scope, node.operand); } else if (node.operator === ts.SyntaxKind.PlusPlusToken || node.operator === ts.SyntaxKind.MinusMinusToken) { const plus = node.operator === ts.SyntaxKind.PlusPlusToken; let accessObj = null, isDict = false; if ((ts.isPropertyAccessExpression(node.operand) || ts.isElementAccessExpression(node.operand))) { this.argumentExpr = CodeTemplateFactory.createForNode(scope, ts.isPropertyAccessExpression(node.operand) ? node.operand.name : node.operand.argumentExpression); accessObj = node.operand.expression; isDict = scope.root.typeHelper.getCType(accessObj) instanceof DictType; } if (this.isPostfix) { if (!isDict && (type === NumberVarType || type === BooleanVarType)) { this.operand = CodeTemplateFactory.createForNode(scope, node.operand); this.after = plus ? "++" : "--"; } else if (isDict) { this.operand = CodeTemplateFactory.createForNode(scope, accessObj); this.incrementBy = plus ? "1" : "-1"; scope.root.headerFlags.js_var_dict_inc = true; } else if (type === UniversalVarType) { this.before = "js_var_inc(&"; this.operand = CodeTemplateFactory.createForNode(scope, node.operand); this.after = ", " + (plus ? "1" : "-1") + ")"; scope.root.headerFlags.js_var_inc = true; } else { this.operand = "/* expression is not yet supported " + node.getText() + " */"; } } else { if (!isDict && (type === NumberVarType || type === BooleanVarType)) { this.operand = CodeTemplateFactory.createForNode(scope, node.operand); this.before = plus ? "++" : "--"; } else if (!isDict && !toNumberCanBeNaN(type)) { this.isCompound = true; this.operand = new CAsNumber(scope, node.operand); this.after = plus ? " + 1" : " - 1"; } else if (isTopExpressionOfStatement) { const applyOperation = plus ? ts.createAdd : ts.createSubtract const binExpr = applyOperation(node.operand, ts.createNumericLiteral("1")); binExpr.parent = node; binExpr.getText = () => node.operand.getText() + (plus ? "+" : "-") + "1"; binExpr.operatorToken.getText = () => plus ? "+" : "-"; binExpr.right.getText = () => "1"; scope.root.typeHelper.registerSyntheticNode(binExpr, UniversalVarType); this.operand = AssignmentHelper.create(scope, node.operand, binExpr); } else if (!isDict && plus) { this.isCompound = true; this.before = "js_var_plus(js_var_to_number("; this.operand = CodeTemplateFactory.createForNode(scope, node.operand); this.after = "), js_var_from_int16_t(1))"; scope.root.headerFlags.js_var_plus = true; scope.root.headerFlags.js_var_from_int16_t = true; } else if (!isDict && !plus) { this.isCompound = true; this.before = "js_var_compute(js_var_to_number("; this.operand = CodeTemplateFactory.createForNode(scope, node.operand); this.after = "), JS_VAR_MINUS, js_var_from_int16_t(1))"; scope.root.headerFlags.js_var_compute = true; scope.root.headerFlags.js_var_from_int16_t = true; } else { this.operand = CodeTemplateFactory.createForNode(scope, accessObj); this.incrementBy = plus ? "1" : "-1"; scope.root.headerFlags.js_var_dict_inc = true; } } } else { this.operand = `/* not supported unary expression ${node.getText()} */`; } } } @CodeTemplate(`{condition} ? {whenTrue} : {whenFalse}`, ts.SyntaxKind.ConditionalExpression) class CTernaryExpression extends CTemplateBase { public condition: CExpression; public whenTrue: CExpression; public whenFalse: CExpression; constructor(scope: IScope, node: ts.ConditionalExpression) { super(); this.condition = CodeTemplateFactory.createForNode(scope, node.condition); this.whenTrue = CodeTemplateFactory.createForNode(scope, node.whenTrue); this.whenFalse = CodeTemplateFactory.createForNode(scope, node.whenFalse); } } @CodeTemplate(`({expression})`, ts.SyntaxKind.ParenthesizedExpression) class CGroupingExpression extends CTemplateBase { public expression: CExpression; constructor(scope: IScope, node: ts.ParenthesizedExpression) { super(); this.expression = CodeTemplateFactory.createForNode(scope, node.expression); } } @CodeTemplate(` {#if isUniversalVar} js_var_typeof({expression}) {#elseif isString} "string" {#elseif isNumber} "number" {#elseif isBoolean} "number" {#else} "object" {/if}`, ts.SyntaxKind.TypeOfExpression) class CTypeOf extends CTemplateBase { expression: CExpression; isUniversalVar: boolean; isNumber: boolean; isBoolean: boolean; isString: boolean; constructor(scope: IScope, node: ts.TypeOfExpression) { super(); const type = scope.root.typeHelper.getCType(node.expression); this.isUniversalVar = type === UniversalVarType; this.isString = type === StringVarType; this.isNumber = type === NumberVarType; this.isBoolean = type === BooleanVarType; this.expression = CodeTemplateFactory.createForNode(scope, node.expression); if (type == UniversalVarType) { scope.root.headerFlags.js_var = true; scope.root.headerFlags.js_var_typeof = true; } } } @CodeTemplate(`js_var_to_undefined({expression})`, ts.SyntaxKind.VoidExpression) class CVoid extends CTemplateBase { public expression: CExpression; constructor(scope: IScope, node: ts.TypeOfExpression) { super(); this.expression = CodeTemplateFactory.createForNode(scope, node.expression); scope.root.headerFlags.js_var = true; scope.root.headerFlags.js_var_to_undefined = true; } } @CodeTemplate(` {#statements} {tempVarName} = dict_find_pos({dict}->index->data, {dict}->index->size, {argExpression}); if ({tempVarName} >= 0) { ARRAY_REMOVE({dict}->index, {tempVarName}, 1); ARRAY_REMOVE({dict}->values, {tempVarName}, 1); } {/statements} {#if !topExpressionOfStatement} TRUE {/if}`, ts.SyntaxKind.DeleteExpression) class CDelete extends CTemplateBase { public dict: CExpression; public argExpression: CExpression; public tempVarName: string; public topExpressionOfStatement: boolean; constructor(scope: IScope, node: ts.DeleteExpression) { super(); this.topExpressionOfStatement = node.parent.kind == ts.SyntaxKind.ExpressionStatement; this.dict = (ts.isPropertyAccessExpression(node.expression) || ts.isElementAccessExpression(node.expression)) && CodeTemplateFactory.createForNode(scope, node.expression.expression); if (ts.isElementAccessExpression(node.expression)) this.argExpression = ts.isNumericLiteral(node.expression.argumentExpression) ? '"' + node.expression.argumentExpression.text + '"' : CodeTemplateFactory.createForNode(scope, node.expression.argumentExpression) else if (ts.isPropertyAccessExpression(node.expression)) this.argExpression = new CString(scope, node.expression.name.text); this.tempVarName = scope.root.symbolsHelper.addTemp(node, "tmp_dict_pos"); scope.variables.push(new CVariable(scope, this.tempVarName, NumberVarType)); scope.root.headerFlags.bool = true; scope.root.headerFlags.array_remove = true; } } ```
/content/code_sandbox/src/nodes/expressions.ts
xml
2016-07-24T23:05:37
2024-08-12T19:23:59
ts2c
andrei-markeev/ts2c
1,252
7,401
```xml import { ScrollingModule } from '@angular/cdk/scrolling'; import { ComponentFixture, TestBed, fakeAsync, flush, tick } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { OverlayModule } from 'primeng/overlay'; import { TooltipModule } from 'primeng/tooltip'; import { MultiSelect, MultiSelectItem } from './multiselect'; import { ChevronDownIcon } from 'primeng/icons/chevrondown'; import { SearchIcon } from 'primeng/icons/search'; import { TimesIcon } from 'primeng/icons/times'; import { NO_ERRORS_SCHEMA } from '@angular/core'; describe('MultiSelect', () => { let multiselect: MultiSelect; let multiselectItem: MultiSelectItem; let fixture: ComponentFixture<MultiSelect>; let fixtureItem: ComponentFixture<MultiSelectItem>; beforeEach(() => { TestBed.configureTestingModule({ imports: [NoopAnimationsModule, ScrollingModule, TooltipModule, OverlayModule, SearchIcon, ChevronDownIcon, TimesIcon], declarations: [MultiSelect, MultiSelectItem], schemas: [NO_ERRORS_SCHEMA] }); fixture = TestBed.createComponent(MultiSelect); fixtureItem = TestBed.createComponent(MultiSelectItem); multiselect = fixture.componentInstance; multiselectItem = fixtureItem.componentInstance; }); it('should disabled', () => { multiselect.disabled = true; const showSpy = spyOn(multiselect, 'onContainerClick').and.callThrough(); fixture.detectChanges(); const containerEl = fixture.debugElement.query(By.css('div')).nativeElement; const inputReadOnlyEl = fixture.debugElement.query(By.css('div')).nativeElement; containerEl.click(); fixture.detectChanges(); expect(showSpy).toHaveBeenCalled(); expect(containerEl.className).toContain('p-disabled'); expect(inputReadOnlyEl.className).toContain('p-disabled'); expect(multiselect.overlayVisible).toEqual(undefined); }); it('should set dropdown icon by default and able to change', () => { fixture.detectChanges(); const dropdownIcon = fixture.debugElement.query(By.css('.p-multiselect-trigger-icon')).nativeElement; expect(dropdownIcon.tagName.toLowerCase()).toEqual('svg'); fixture.detectChanges(); multiselect.dropdownIcon = 'Primeng Rocks!'; fixture.detectChanges(); multiselect.cd.detectChanges(); const dropdownIconEl = fixture.debugElement.query(By.css('.p-multiselect-trigger-icon')); expect(dropdownIconEl.nativeElement.className).toContain('Primeng Rocks!'); }); it('should change style and styleClass', () => { fixture.detectChanges(); multiselect.style = { height: '300px' }; multiselect.styleClass = 'Primeng ROCKS!'; fixture.detectChanges(); multiselect.cd.detectChanges(); const multiselectEl = fixture.debugElement.children[0].nativeElement; expect(multiselectEl.className).toContain('Primeng ROCKS!'); expect(multiselectEl.style.height).toContain('300px'); }); it('should change panelstyle and panelStyleClass', () => { fixture.detectChanges(); multiselect.panelStyle = { height: '300px' }; multiselect.panelStyleClass = 'Primeng ROCKS!'; multiselect.overlayVisible = true; fixture.detectChanges(); multiselect.cd.detectChanges(); const multiselectPanelEl = fixture.debugElement.query(By.css('.p-multiselect-panel')).nativeElement; expect(multiselectPanelEl.className).toContain('Primeng ROCKS!'); expect(multiselectPanelEl.style.height).toContain('300px'); }); it('should open when click', () => { fixture.detectChanges(); const multiselectEl = fixture.debugElement.children[0].nativeElement; const clickSpy = spyOn(multiselect, 'onContainerClick').and.callThrough(); multiselectEl.click(); fixture.detectChanges(); const multiselectOverlay = fixture.debugElement.query(By.css('.p-overlay')); expect(clickSpy).toHaveBeenCalled(); expect(multiselectOverlay).toBeTruthy(); }); it('should open and close with keydown', () => { const onShowSpy = spyOn(multiselect, 'show').and.callThrough(); const onHideSpy = spyOn(multiselect, 'hide').and.callThrough(); fixture.detectChanges(); const multiselectEl = fixture.debugElement.query(By.css('input')).nativeElement; multiselectEl.dispatchEvent(new KeyboardEvent('keydown', { code: 'Tab' })); multiselectEl.dispatchEvent(new KeyboardEvent('keydown', { code: 'Enter' })); fixture.detectChanges(); const multiselectPanelEl = fixture.debugElement.query(By.css('.p-multiselect-panel')).nativeElement; fixture.detectChanges(); expect(multiselect.overlayVisible).toEqual(true); expect(multiselectPanelEl).toBeTruthy(); multiselectEl.dispatchEvent(new KeyboardEvent('keydown', { code: 'Escape' })); fixture.detectChanges(); expect(onShowSpy).toHaveBeenCalled(); expect(onHideSpy).toHaveBeenCalled(); }); it('should close when double click', fakeAsync(() => { fixture.detectChanges(); const multiselectEl = fixture.debugElement.query(By.css('.p-multiselect')).nativeElement; const showSpy = spyOn(multiselect, 'show').and.callThrough(); multiselectEl.dispatchEvent(new KeyboardEvent('click')); tick(350); fixture.detectChanges(); expect(showSpy).toHaveBeenCalled(); const onHideSpy = spyOn(multiselect, 'hide').and.callThrough(); multiselectEl.dispatchEvent(new KeyboardEvent('click')); tick(); fixture.detectChanges(); expect(onHideSpy).toHaveBeenCalled(); flush(); })); it('should select item', () => { multiselect.options = [ { label: 'Audi', value: 'Audi' }, { label: 'BMW', value: 'BMW' }, { label: 'Fiat', value: 'Fiat' }, { label: 'Ford', value: 'Ford' }, { label: 'Honda', value: 'Honda' }, { label: 'Jaguar', value: 'Jaguar' }, { label: 'Mercedes', value: 'Mercedes' }, { label: 'Renault', value: 'Renault' }, { label: 'VW', value: 'VW' }, { label: 'Volvo', value: 'Volvo' } ]; fixture.detectChanges(); const multiselectEl = fixture.debugElement.children[0].nativeElement; multiselectEl.click(); fixture.detectChanges(); const multiselectItemEl = fixture.debugElement.queryAll(By.css('.p-multiselect-item')); expect(multiselectItemEl.length).toEqual(10); const bmwEl = multiselectItemEl[1]; const onOptionClickSpy = spyOn(multiselectItem, 'onOptionClick').and.callThrough(); bmwEl.nativeElement.click(); fixture.detectChanges(); expect(multiselect.value[0]).toEqual('BMW'); expect(onOptionClickSpy).toBeTruthy(); }); it('should select item and navigate with keydown', () => { multiselect.options = [ { label: 'Audi', value: 'Audi' }, { label: 'BMW', value: 'BMW' }, { label: 'Fiat', value: 'Fiat' }, { label: 'Ford', value: 'Ford' }, { label: 'Honda', value: 'Honda' }, { label: 'Jaguar', value: 'Jaguar' }, { label: 'Mercedes', value: 'Mercedes' }, { label: 'Renault', value: 'Renault' }, { label: 'VW', value: 'VW' }, { label: 'Volvo', value: 'Volvo' } ]; fixture.detectChanges(); const onArrowDownKeySpy = spyOn(multiselect, 'onArrowDownKey').and.callThrough(); const onArrowUpKeySpy = spyOn(multiselect, 'onArrowUpKey').and.callThrough(); const multiselectEl = fixture.debugElement.query(By.css('.p-multiselect')).nativeElement; multiselectEl.click(); fixture.detectChanges(); const multiselectFilterEl = fixture.debugElement.query(By.css('input')).nativeElement; multiselectFilterEl.dispatchEvent(new KeyboardEvent('keydown', { code: 'ArrowDown' })); multiselectFilterEl.dispatchEvent(new KeyboardEvent('keydown', { code: 'Enter' })); multiselectFilterEl.dispatchEvent(new KeyboardEvent('keydown', { code: 'ArrowUp' })); fixture.detectChanges(); expect(multiselect.value[0]).toEqual('BMW'); expect(multiselect.value.length).toEqual(1); expect(onArrowUpKeySpy).toHaveBeenCalledTimes(1); expect(onArrowDownKeySpy).toHaveBeenCalledTimes(1); }); it('should unselect item', () => { multiselect.options = [ { label: 'Audi', value: 'Audi' }, { label: 'BMW', value: 'BMW' }, { label: 'Fiat', value: 'Fiat' }, { label: 'Ford', value: 'Ford' }, { label: 'Honda', value: 'Honda' }, { label: 'Jaguar', value: 'Jaguar' }, { label: 'Mercedes', value: 'Mercedes' }, { label: 'Renault', value: 'Renault' }, { label: 'VW', value: 'VW' }, { label: 'Volvo', value: 'Volvo' } ]; multiselect.selectionLimit = 3; multiselect.value = []; fixture.detectChanges(); const multiselectEl = fixture.debugElement.children[0].nativeElement; multiselectEl.click(); fixture.detectChanges(); const multiselectItemEl = fixture.debugElement.queryAll(By.css('.p-multiselect-item')); expect(multiselectItemEl.length).toEqual(10); const audiEl = multiselectItemEl[0]; const bmwEl = multiselectItemEl[1]; const onOptionClickSpy = spyOn(multiselectItem, 'onOptionClick').and.callThrough(); bmwEl.nativeElement.click(); audiEl.nativeElement.click(); fixture.detectChanges(); expect(multiselect.value[0]).toEqual('BMW'); expect(multiselect.value[1]).toEqual('Audi'); expect(multiselect.value.length).toEqual(2); expect(onOptionClickSpy).toBeTruthy(); audiEl.nativeElement.click(); fixture.detectChanges(); expect(multiselect.value.length).toEqual(1); }); it('should not select disabled item', () => { multiselect.options = [ { label: 'Audi', value: 'Audi' }, { label: 'Fiat', value: 'Fiat' }, { label: 'BMW', value: 'BMW', disabled: true }, { label: 'Ford', value: 'Ford' }, { label: 'Honda', value: 'Honda' }, { label: 'Jaguar', value: 'Jaguar' }, { label: 'Mercedes', value: 'Mercedes' }, { label: 'Renault', value: 'Renault' }, { label: 'VW', value: 'VW' }, { label: 'Volvo', value: 'Volvo' } ]; fixture.detectChanges(); const multiselectEl = fixture.debugElement.children[0].nativeElement; multiselectEl.click(); fixture.detectChanges(); const multiselectItemEl = fixture.debugElement.queryAll(By.css('.p-multiselect-item')); expect(multiselectItemEl.length).toEqual(10); const fiatEl = multiselectItemEl[1]; const bmwEl = multiselectItemEl[2]; const audiEl = multiselectItemEl[0]; const onOptionClickSpy = spyOn(multiselectItem, 'onOptionClick').and.callThrough(); bmwEl.nativeElement.click(); fixture.detectChanges(); audiEl.nativeElement.click(); fiatEl.nativeElement.click(); fixture.detectChanges(); expect(multiselect.value[0]).not.toEqual('BMW'); expect(bmwEl.nativeElement.className).not.toContain('p-highlight'); expect(onOptionClickSpy).toBeTruthy(); }); it('should select multiple', () => { multiselect.options = [ { label: 'Audi', value: 'Audi' }, { label: 'BMW', value: 'BMW' }, { label: 'Fiat', value: 'Fiat' }, { label: 'Ford', value: 'Ford' }, { label: 'Honda', value: 'Honda' }, { label: 'Jaguar', value: 'Jaguar' }, { label: 'Mercedes', value: 'Mercedes' }, { label: 'Renault', value: 'Renault' }, { label: 'VW', value: 'VW' }, { label: 'Volvo', value: 'Volvo' } ]; multiselect.value = []; fixture.detectChanges(); const multiselectEl = fixture.debugElement.query(By.css('.p-multiselect')).nativeElement; const onOptionClickSpy = spyOn(multiselectItem, 'onOptionClick').and.callThrough(); fixture.detectChanges(); fixtureItem.detectChanges(); multiselectEl.click(); fixture.detectChanges(); const multiselectItemEl = fixture.debugElement.queryAll(By.css('.p-multiselect-item')); fixture.detectChanges(); expect(multiselectItemEl.length).toEqual(10); const bmwEl = multiselectItemEl[1]; const fiatEl = multiselectItemEl[2]; const fordEl = multiselectItemEl[3]; bmwEl.nativeElement.click(); fiatEl.nativeElement.click(); fordEl.nativeElement.click(); fixture.detectChanges(); fixtureItem.detectChanges(); expect(multiselect.value[2]).toEqual('Ford'); expect(multiselect.value.length).toEqual(3); expect(onOptionClickSpy).toBeTruthy(); }); it('should select multiple with selection limit', () => { multiselect.options = [ { label: 'Audi', value: 'Audi' }, { label: 'BMW', value: 'BMW' }, { label: 'Fiat', value: 'Fiat' }, { label: 'Ford', value: 'Ford' }, { label: 'Honda', value: 'Honda' }, { label: 'Jaguar', value: 'Jaguar' }, { label: 'Mercedes', value: 'Mercedes' }, { label: 'Renault', value: 'Renault' }, { label: 'VW', value: 'VW' }, { label: 'Volvo', value: 'Volvo' } ]; multiselect.value = []; multiselect.selectionLimit = 2; fixture.detectChanges(); const multiselectEl = fixture.debugElement.query(By.css('.p-multiselect')).nativeElement; const onOptionClickSpy = spyOn(multiselectItem, 'onOptionClick').and.callThrough(); fixture.detectChanges(); fixtureItem.detectChanges(); multiselectEl.click(); fixture.detectChanges(); const multiselectItemEl = fixture.debugElement.queryAll(By.css('.p-multiselect-item')); fixture.detectChanges(); expect(multiselectItemEl.length).toEqual(10); const bmwEl = multiselectItemEl[1]; const fordEl = multiselectItemEl[3]; const fiatEl = multiselectItemEl[2]; bmwEl.nativeElement.click(); fordEl.nativeElement.click(); fiatEl.nativeElement.click(); fixture.detectChanges(); fixtureItem.detectChanges(); expect(multiselect.value[0]).toEqual('BMW'); expect(multiselect.value[1]).toEqual('Ford'); expect(multiselect.value.length).toEqual(2); expect(fiatEl.nativeElement.className).not.toContain('p-highlight'); expect(onOptionClickSpy).toBeTruthy(); }); it('should select all', () => { multiselect.options = [ { label: 'Audi', value: 'Audi' }, { label: 'BMW', value: 'BMW' }, { label: 'Fiat', value: 'Fiat' }, { label: 'Ford', value: 'Ford' }, { label: 'Honda', value: 'Honda' }, { label: 'Jaguar', value: 'Jaguar' }, { label: 'Mercedes', value: 'Mercedes' }, { label: 'Renault', value: 'Renault' }, { label: 'VW', value: 'VW' }, { label: 'Volvo', value: 'Volvo' } ]; fixture.detectChanges(); const multiselectEl = fixture.debugElement.children[0].nativeElement; const itemClickSpy = spyOn(multiselect, 'onToggleAll').and.callThrough(); multiselectEl.click(); fixture.detectChanges(); const allCheckedEl = fixture.debugElement.query(By.css('.p-checkbox-box')).nativeElement; const readOnlyEl = fixture.debugElement.query(By.css('.p-checkbox')).children[0].children[0].nativeElement; readOnlyEl.dispatchEvent(new Event('focus')); allCheckedEl.click(); fixture.detectChanges(); expect(multiselect.value.length).toEqual(10); expect(itemClickSpy).toHaveBeenCalled(); }); it('should select all when filtered', () => { multiselect.options = [ { label: 'Audi', value: 'Audi' }, { label: 'BMW', value: 'BMW' }, { label: 'Fiat', value: 'Fiat' }, { label: 'Ford', value: 'Ford' }, { label: 'Honda', value: 'Honda' }, { label: 'Jaguar', value: 'Jaguar' }, { label: 'Mercedes', value: 'Mercedes' }, { label: 'Renault', value: 'Renault' }, { label: 'VW', value: 'VW' }, { label: 'Volvo', value: 'Volvo' } ]; fixture.detectChanges(); const onInputFocusSpy = spyOn(multiselect, 'onInputFocus').and.callThrough(); const onInputBlur = spyOn(multiselect, 'onInputBlur').and.callThrough(); const multiselectEl = fixture.debugElement.children[0].nativeElement; const readOnlyEl = fixture.debugElement.query(By.css('input')).nativeElement; readOnlyEl.dispatchEvent(new Event('focus')); multiselectEl.click(); fixture.detectChanges(); readOnlyEl.dispatchEvent(new Event('blur')); const filterInputEl = fixture.debugElement.query(By.css('.p-inputtext')).nativeElement; filterInputEl.value = 'v'; filterInputEl.dispatchEvent(new Event('input')); fixture.detectChanges(); const allCheckedEl = fixture.debugElement.query(By.css('.p-checkbox-box')).nativeElement; allCheckedEl.click(); fixture.detectChanges(); expect(multiselect.value.length).toEqual(2); expect(onInputFocusSpy).toHaveBeenCalled(); expect(onInputBlur).toHaveBeenCalled(); }); it('should unselect all', () => { multiselect.options = [ { name: 'New York', code: 'NY' }, { name: 'Rome', code: 'RM' }, { name: 'London', code: 'LDN' }, { name: 'Istanbul', code: 'IST' }, { name: 'Paris', code: 'PRS' } ]; multiselect.optionLabel = 'name'; fixture.detectChanges(); const multiselectEl = fixture.debugElement.children[0].nativeElement; const toggleSpy = spyOn(multiselect, 'onToggleAll').and.callThrough(); multiselectEl.click(); fixture.detectChanges(); let allCheckedEl = fixture.debugElement.query(By.css('.p-checkbox-box')).nativeElement; allCheckedEl.click(); fixture.detectChanges(); expect(multiselect.value.length).toEqual(5); expect(toggleSpy).toHaveBeenCalled(); allCheckedEl.click(); fixture.detectChanges(); expect(multiselect.value.length).toEqual(0); }); it('should filtered', () => { multiselect.options = [ { label: 'Audi', value: 'Audi' }, { label: 'BMW', value: 'BMW' }, { label: 'Fiat', value: 'Fiat' }, { label: 'Ford', value: 'Ford' }, { label: 'Honda', value: 'Honda' }, { label: 'Jaguar', value: 'Jaguar' }, { label: 'Mercedes', value: 'Mercedes' }, { label: 'Renault', value: 'Renault' }, { label: 'VW', value: 'VW' }, { label: 'Volvo', value: 'Volvo' } ]; fixture.detectChanges(); const multiselectEl = fixture.debugElement.children[0].nativeElement; multiselectEl.click(); fixture.detectChanges(); const filterInputEl = fixture.debugElement.query(By.css('.p-inputtext')).nativeElement; filterInputEl.value = 'f'; filterInputEl.dispatchEvent(new Event('input')); fixture.detectChanges(); expect(multiselect.visibleOptions().length).toEqual(2); }); it('should close with close icon and reset filter input', () => { multiselect.options = [ { label: 'Audi', value: 'Audi' }, { label: 'BMW', value: 'BMW' }, { label: 'Fiat', value: 'Fiat' }, { label: 'Ford', value: 'Ford' }, { label: 'Honda', value: 'Honda' }, { label: 'Jaguar', value: 'Jaguar' }, { label: 'Mercedes', value: 'Mercedes' }, { label: 'Renault', value: 'Renault' }, { label: 'VW', value: 'VW' }, { label: 'Volvo', value: 'Volvo' } ]; fixture.detectChanges(); multiselect.resetFilterOnHide = true; const multiselectEl = fixture.debugElement.children[0].nativeElement; multiselectEl.click(); fixture.detectChanges(); const filterInputEl = fixture.debugElement.query(By.css('.p-inputtext')).nativeElement; filterInputEl.value = 'f'; filterInputEl.dispatchEvent(new Event('input')); fixture.detectChanges(); expect(multiselect.visibleOptions().length).toEqual(2); const closeEl = fixture.debugElement.query(By.css('.p-multiselect-close')); closeEl.nativeElement.click(); fixture.detectChanges(); expect(fixture.debugElement.query(By.css('div')).nativeElement.className).not.toContain('p-multiselect-open'); }); it('should display not found message when filter returns 0 results', () => { multiselect.options = [ { label: 'Audi', value: 'Audi' }, { label: 'BMW', value: 'BMW' }, { label: 'Fiat', value: 'Fiat' }, { label: 'Ford', value: 'Ford' }, { label: 'Honda', value: 'Honda' }, { label: 'Jaguar', value: 'Jaguar' }, { label: 'Mercedes', value: 'Mercedes' }, { label: 'Renault', value: 'Renault' }, { label: 'VW', value: 'VW' }, { label: 'Volvo', value: 'Volvo' } ]; fixture.detectChanges(); const multiselectEl = fixture.debugElement.children[0].nativeElement; multiselectEl.click(); fixture.detectChanges(); const filterInputEl = fixture.debugElement.query(By.css('.p-inputtext')).nativeElement; filterInputEl.value = '1'; filterInputEl.dispatchEvent(new Event('input')); fixture.detectChanges(); multiselect.cd.detectChanges(); const visibleItems = fixture.debugElement.queryAll(By.css('.p-multiselect-items li')).filter((el) => el.styles.display !== 'none'); const emptyMesage = fixture.debugElement.query(By.css('.p-multiselect-empty-message')); expect(visibleItems.length).toEqual(1); expect(emptyMesage).toBeTruthy(); expect(emptyMesage.nativeElement.textContent).toContain('No results found'); }); }); ```
/content/code_sandbox/src/app/components/multiselect/multiselect.spec.ts
xml
2016-01-16T09:23:28
2024-08-16T19:58:20
primeng
primefaces/primeng
9,969
5,180
```xml import { GraphQLError } from "graphql"; import type { Tester } from "@jest/expect-utils"; export const areGraphQLErrorsEqual: Tester = function (a, b, customTesters) { if (a instanceof GraphQLError || b instanceof GraphQLError) { return this.equals( a instanceof GraphQLError ? a.toJSON() : a, b instanceof GraphQLError ? b.toJSON() : b, customTesters ); } }; ```
/content/code_sandbox/src/config/jest/areGraphQlErrorsEqual.ts
xml
2016-02-26T20:25:00
2024-08-16T10:56:57
apollo-client
apollographql/apollo-client
19,304
103
```xml <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="path_to_url" android:layout_width="match_parent" android:layout_height="wrap_content"> <include layout="@layout/common_item" /> </FrameLayout> ```
/content/code_sandbox/feature/utilcode/pkg/src/main/res/layout/fragment_child.xml
xml
2016-07-30T18:18:32
2024-08-16T01:37:59
AndroidUtilCode
Blankj/AndroidUtilCode
33,178
58
```xml import { describe, expect, test } from "vitest"; import { builtinTypes, domainKws } from "../hooks/domain/domainAutocomplete"; import { getDomainCache } from "../hooks/domain/getDomainCache"; import { parser } from "../parser/domain/domain"; import { compareDicts, constructDomainCacheObj, hasNoErrors, testDomainAutocomplete, } from "./testUtils"; describe("Parser", () => { test("empty", () => { let prog = ""; hasNoErrors(parser, prog); }); test("comments and whitespaces", () => { const prog = `-- comments type Set -- inline comments\r -- type Point predicate From(Map f, Set domain, Set codomain)\r\n /* Multi-line comments type ParametrizedSet ('T, 'U) predicate From(Map f, Set domain, Set codomain) */ predicate From(Map f, Set domain, Set codomain) `; hasNoErrors(parser, prog); }); test("tree integrity", () => { const prog = `-- comments type Set -- inline comments -- type Point predicate From(Map f, Set domain, Set codomain) /* Multi-line comments predicate From(Map f, Set domain, Set codomain) */ predicate From(Map f, Set domain, Set codomain) function Intersection(Set a, Set b) -> Set function Union(Set a, Set b) -> Set c function Subtraction(Set a, Set b) -> Set function CartesianProduct(Set a, Set b) -> Set function Difference(Set a, Set b) -> Set function Subset(Set a, Set b) -> Set function AddPoint(Point p, Set s1) -> Set -- edge case function Empty() -> Scalar s -- generics RightClopenInterval <: Interval `; hasNoErrors(parser, prog); }); test("predicate decls", () => { const prog = `-- comments predicate Not(Prop p1) predicate From(Map f, Set domain, Set codomain) predicate Empty(Set s) predicate Intersecting(Set s1, Set s2) predicate Subset(Set s1, Set s2) predicate PointIn(Set s, Point p) predicate In(Point p, Set s) predicate Injection(Map m) predicate Surjection(Map m) predicate Bijection(Map m) predicate PairIn(Point, Point, Map) symmetric predicate Intersecting(Set s1, Set s2) symmetric predicate Disjoint(Set, Set) `; hasNoErrors(parser, prog); }); test("function decls", () => { const prog = `-- comments function Intersection(Set a, Set b) -> Set function Union(Set a, Set b) -> Set c function Subtraction(Set a, Set b) -> Set function CartesianProduct(Set a, Set b) -> Set function Difference(Set a, Set b) -> Set function Subset(Set a, Set b) -> Set function AddPoint(Point p, Set s1) -> Set -- edge case function Empty() -> Scalar `; hasNoErrors(parser, prog); }); test("constructor decls", () => { const prog = `-- real program constructor CreateInterval(Real left, Real right) -> Interval constructor CreateOpenInterval(Real left, Real right) -> OpenInterval constructor CreateClosedInterval(Real left, Real right) -> ClosedInterval constructor CreateLeftClopenInterval(Real left, Real right) -> LeftClopenInterval constructor CreateRightClopenInterval(Real left, Real right) -> RightClopenInterval constructor CreateFunction(Set s1, Set s2) -> Function constructor Pt(Real x, Real y) -> Point `; hasNoErrors(parser, prog); }); test("Subtype decls", () => { const prog = `Reals <: Set Interval <: Set Reals <: Interval OpenInterval <: Interval ClosedInterval <: Interval LeftClopenInterval <: Interval RightClopenInterval <: Interval `; hasNoErrors(parser, prog); }); // TODO: resolve the ambiguous grammar in Domain // path_to_url test.skip("dangling output type conflict with subtype decls", () => { const prog = `type A type B function f(A arg) -> B A <: B`; hasNoErrors(parser, prog); }); }); describe("Caching", () => { test("type names", () => { const input = `type Set type Segment type Element`; const expected = constructDomainCacheObj( ["Set", "Segment", "Element"], [], [], [], ); expect(compareDicts(getDomainCache(input), expected)).toBe(true); }); test("pred names", () => { const input = `predicate Disjoint(Set s1, Set s2) predicate Intersecting(Set s1, Set s2) predicate Subset(Set s1, Set s2)`; const expected = constructDomainCacheObj( [], ["Subset", "Disjoint", "Intersecting"], [], [], ); expect(compareDicts(getDomainCache(input), expected)).toBe(true); }); test("function names", () => { const input = `function Intersection(Set a, Set b) -> Set function Union(Set a, Set b) -> Set function Subtraction(Set a, Set b) -> Set function CartesianProduct(Set a, Set b) -> Set`; const expected = constructDomainCacheObj( [], [], ["Union", "Subtraction", "Intersection", "CartesianProduct"], [], ); expect(compareDicts(getDomainCache(input), expected)).toBe(true); }); test("constructor names", () => { const input = `constructor Segment( Point p, Point q ) constructor LineSegment( Point p, Point q ) -> Segment constructor ClosestPoint( Set s, Point p ) -> Point constructor ClosestSegment( Set s, Point p ) -> Segment`; const expected = constructDomainCacheObj( [], [], [], ["Segment", "LineSegment", "ClosestPoint", "ClosestSegment"], ); expect(compareDicts(getDomainCache(input), expected)).toBe(true); }); test("subtypes", () => { const input = `type Set type Point <: Set type Segment <: Set, Point type Ray <: Set Ray <: Segment`; const expected = constructDomainCacheObj( ["Set", "Ray", "Point", "Segment"], [], [], [], ); expect(compareDicts(getDomainCache(input), expected)).toBe(true); }); test("combined 1", () => { const input = `type Graph type Layer type Layer1 type Layer2 Layer1 <: Layer Layer2 <: Layer predicate GraphHasNode(Graph g, Node n) predicate Layer1HasEdge(Layer1 l, Edge e) predicate Layer2HasEdge(Layer2 l, Edge e) constructor Quadrilateral(Point p, Point q, Point r, Point s) -- This function creates a quadrilateral from four points. constructor CircleR(Point center, Point radius) -> Circle -- This constructor creates a circle from a center point and a radius point. function Bisector(Angle) -> Ray -- This function creates a ray as the angle bisector of an angle. `; const expected = constructDomainCacheObj( ["Graph", "Layer", "Layer1", "Layer2"], ["GraphHasNode", "Layer1HasEdge", "Layer2HasEdge"], ["Bisector"], ["Quadrilateral", "CircleR"], ); expect(compareDicts(getDomainCache(input), expected)).toBe(true); }); test("combined 2", () => { const input = `predicate IsLine() predicate IsBig() type Angle function Bisector (Angle) -> Angle constructor Amongus (Angle a) -> Angle`; const expected = constructDomainCacheObj( ["Angle"], ["IsLine", "IsBig"], ["Bisector"], ["Amongus"], ); expect(compareDicts(getDomainCache(input), expected)).toBe(true); }); test("runtime 1", () => { const input = `type Set type Point <: Set type Segment <: Set type Ray <: Set type Vector <: Set type Triangle <: Set type Circle <: Set type Disk <: Set type Chord <: Set type Length <: Set type Polyline <: Set type Angle <: Set constructor Segment( Point p, Point q ) constructor LineSegment( Point p, Point q ) -> Segment constructor ClosestPoint( Set s, Point p ) -> Point constructor ClosestSegment( Set s, Point p ) -> Segment constructor RayFrom( Point p, Vector v ) -> Ray constructor RayIntersection( Ray r, Set s ) -> Point constructor RaySegmentIntersection( Ray r, Segment s ) -> Point constructor Triangle( Point p1, Point p2, Point p3 ) constructor LengthBetween( Point x, Point y ) -> Length constructor LengthOf( Segment s ) -> Length constructor Normal( Set s ) -> Vector constructor InteriorAngle( Point a, Point b, Point c ) -> Angle predicate RootedAt( Point p, Vector v ) predicate InTri( Point p, Triangle t ) predicate OnCircle( Point p, Circle c ) predicate InDisk( Point p, Disk d ) predicate OfDisk( Chord c, Disk d ) predicate IsDashed( Set s ) predicate IsOriented( Set s )`; const start = performance.now(); getDomainCache(input); const end = performance.now(); const executionTime = end - start; console.log(`Domain Cache Execution Time: ${executionTime} ms`); expect(executionTime).toBeLessThan(10); }); test("runtime 2", () => { const input = `-- Mesh combinatorics type Vertex type Edge type Halfedge type DualEdge type Triangle type Corner constructor MakeEdge(Vertex i, Vertex j) -> Edge constructor MakeHalfedge(Vertex from, Vertex to) -> Halfedge constructor MakeTriangle(Vertex i, Vertex j, Vertex k) -> Triangle constructor MakeCorner( Vertex inner, Vertex outer1, Vertex outer2 ) -> Corner constructor MakeDualEdge(Triangle a, Triangle b) -> DualEdge predicate IsBoundaryVertex(Vertex v) predicate IsBoundaryEdge(Edge e) predicate IsBoundaryTriangle(Triangle t) predicate HasLabel(Vertex v) predicate IsPositivelyOriented(Triangle t) predicate IsNegativelyOriented(Triangle t) -- Geometry type Point type Circle type Length constructor Barycenter(Triangle t) -> Point constructor Circumcenter(Triangle t) -> Point constructor Incenter(Triangle t) -> Point constructor Circumcircle(Triangle t) -> Circle constructor Incircle(Triangle t) -> Circle constructor EdgeLength(Edge e) -> Length constructor DualEdgeLength(DualEdge d) -> Length constructor Intersection(Edge e, Edge f) -> Point -- Specific to angle-equivalence.substance function similarity(Vertex i) -> Vertex -- Specific to concyclic-pair.substance predicate IsFlipped(Edge e) predicate Concyclic(Triangle s, Triangle t)`; const start = performance.now(); getDomainCache(input); const end = performance.now(); const executionTime = end - start; console.log(`Domain Cache Execution Time: ${executionTime} ms`); expect(executionTime).toBeLessThan(10); }); }); // Narrowing of results is handled by a separate Codemirror extension // End back tick for input strings should be same line as the last character describe("Autocomplete", () => { test("Top level kws basic", async () => { const input = `type Circle ty`; await testDomainAutocomplete(input, domainKws.concat(["Circle"])); }); test("Top level kws mixed", async () => { const input = `type Angle type Point predicate Segment(Point x, Point y) f`; await testDomainAutocomplete(input, domainKws.concat(["Angle", "Point"])); }); test("Top level kws function ambiguous case 1", async () => { const input = `type Angle function Bisect(Angle a) -> Angle sy`; await testDomainAutocomplete(input, domainKws.concat(["Angle"])); }); test("Top level kws ambiguous case 2", async () => { const input = `type Angle predicate Large(Angle a, Angle b) constructor Bisect(Angle a) -> Angle sy`; await testDomainAutocomplete(input, domainKws.concat(["Angle"])); }); test("Top level kws constructor no output type", async () => { const input = `type Angle constructor Bisect(Angle a) sy`; await testDomainAutocomplete(input, domainKws.concat(["Angle"])); }); test("Top level kws constructor with identifier", async () => { const input = `type Angle constructor Bisect(Angle a) -> Angle b sy`; await testDomainAutocomplete(input, domainKws.concat(["Angle"])); }); test("Symmetric predicate", async () => { const input = `type Point type Circle symmetric p`; await testDomainAutocomplete(input, ["predicate"]); }); // Offset by 1 to put cursor after P rather than after ) test("Type names, first item in function param list", async () => { const input = `type Point type Rectangle function Box(P)`; await testDomainAutocomplete( input, ["Point", "Rectangle"].concat(builtinTypes), 1, ); }); test("Type names, first item in constructor param list", async () => { const input = `type Point type Rectangle constructor Box(P)`; await testDomainAutocomplete( input, ["Point", "Rectangle"].concat(builtinTypes), 1, ); }); test("Type names, comma sep in function param list", async () => { const input = `type Point type Rectangle function Box(Point x1, Point y1, Point x2, P)`; await testDomainAutocomplete( input, ["Point", "Rectangle"].concat(builtinTypes), 1, ); }); test("Function output type", async () => { const input = `type Array type Element type Program function Compute(Array a) -> E`; await testDomainAutocomplete( input, ["Element", "Array", "Program"].concat(builtinTypes), ); }); test("Constructor output type", async () => { const input = `type Array type Element type Program constructor Compute(Array a) -> E`; await testDomainAutocomplete( input, ["Element", "Array", "Program"].concat(builtinTypes), ); }); test("Subtypes implicit", async () => { const input = `type Array type Element type Program Element <: P`; await testDomainAutocomplete( input, ["Element", "Array", "Program"].concat(builtinTypes), ); }); test("Subtypes explicit", async () => { const input = `type Array type Element type Program type Balls <: P`; await testDomainAutocomplete( input, ["Element", "Array", "Program", "Balls"].concat(builtinTypes), ); }); }); ```
/content/code_sandbox/packages/components/src/editing/tests/domainTests.test.ts
xml
2016-09-22T04:47:19
2024-08-16T13:00:54
penrose
penrose/penrose
6,760
3,365
```xml // // // path_to_url // #include "pxr/imaging/hgiMetal/shaderProgram.h" #include "pxr/imaging/hgiMetal/shaderFunction.h" PXR_NAMESPACE_OPEN_SCOPE HgiMetalShaderProgram::HgiMetalShaderProgram(HgiShaderProgramDesc const& desc) : HgiShaderProgram(desc) , _vertexFunction(nil) , _fragmentFunction(nil) , _computeFunction(nil) , _postTessVertexFunction(nil) , _postTessControlFunction(nil) { HgiShaderFunctionHandleVector const &shaderFuncs = desc.shaderFunctions; for (auto const& func : shaderFuncs) { HgiMetalShaderFunction const *metalFunction = static_cast<HgiMetalShaderFunction*>(func.Get()); switch (metalFunction->GetDescriptor().shaderStage) { case HgiShaderStageVertex: _vertexFunction = metalFunction->GetShaderId(); break; case HgiShaderStageFragment: _fragmentFunction = metalFunction->GetShaderId(); break; case HgiShaderStageCompute: _computeFunction = metalFunction->GetShaderId(); break; case HgiShaderStagePostTessellationVertex: _postTessVertexFunction = metalFunction->GetShaderId(); break; case HgiShaderStagePostTessellationControl: _postTessControlFunction = metalFunction->GetShaderId(); break; } } } HgiMetalShaderProgram::~HgiMetalShaderProgram() = default; HgiShaderFunctionHandleVector const& HgiMetalShaderProgram::GetShaderFunctions() const { return _descriptor.shaderFunctions; } bool HgiMetalShaderProgram::IsValid() const { return true; } std::string const& HgiMetalShaderProgram::GetCompileErrors() { return _errors; } size_t HgiMetalShaderProgram::GetByteSizeOfResource() const { size_t byteSize = 0; for (HgiShaderFunctionHandle const& fn : _descriptor.shaderFunctions) { byteSize += fn->GetByteSizeOfResource(); } return byteSize; } uint64_t HgiMetalShaderProgram::GetRawResource() const { return 0; } PXR_NAMESPACE_CLOSE_SCOPE ```
/content/code_sandbox/pxr/imaging/hgiMetal/shaderProgram.mm
xml
2016-05-06T00:02:56
2024-08-16T19:38:40
OpenUSD
PixarAnimationStudios/OpenUSD
5,824
492
```xml import {describe, expect, it} from 'vitest'; import {renderList} from './renderList'; describe('renderList', () => { it('works', () => { const result = renderList(['Item 1', 'Item 2', 'Item 3']); expect(result).toMatchInlineSnapshot(` "* Item 1 * Item 2 * Item 3" `); }); }); ```
/content/code_sandbox/generator/src/utils/markdown/renderList.test.ts
xml
2016-06-15T08:26:16
2024-08-16T18:47:29
OpenAudio
webprofusion/OpenAudio
1,829
93
```xml <!-- or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file path_to_url Unless required by applicable law or agreed to in writing, "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY specific language governing permissions and limitations --> <!DOCTYPE suite SYSTEM "path_to_url" > <suite name="Pulsar Transaction Integration Tests" verbose="2" annotations="JDK"> <test name="pulsar-transaction-test-suite" preserve-order="true" > <classes> <class name="org.apache.pulsar.tests.integration.transaction.TransactionTest" /> </classes> </test> </suite> ```
/content/code_sandbox/tests/integration/src/test/resources/pulsar-transaction.xml
xml
2016-06-28T07:00:03
2024-08-16T17:12:43
pulsar
apache/pulsar
14,047
158
```xml import { PrefKey, Platform } from '@standardnotes/snjs' import { Subtitle, Text, Title } from '@/Components/Preferences/PreferencesComponents/Content' import { WebApplication } from '@/Application/WebApplication' import { FunctionComponent, useState } from 'react' import HorizontalSeparator from '@/Components/Shared/HorizontalSeparator' import Switch from '@/Components/Switch/Switch' import PreferencesGroup from '../../PreferencesComponents/PreferencesGroup' import PreferencesSegment from '../../PreferencesComponents/PreferencesSegment' import usePreference from '@/Hooks/usePreference' import { MutuallyExclusiveMediaQueryBreakpoints, useMediaQuery } from '@/Hooks/useMediaQuery' type Props = { application: WebApplication } export const AndroidConfirmBeforeExitKey = 'ConfirmBeforeExit' const Defaults: FunctionComponent<Props> = ({ application }) => { const [androidConfirmBeforeExit, setAndroidConfirmBeforeExit] = useState( () => (application.getValue(AndroidConfirmBeforeExitKey) as boolean) ?? true, ) const isMobile = useMediaQuery(MutuallyExclusiveMediaQueryBreakpoints.sm) const spellcheck = usePreference(PrefKey.EditorSpellcheck) const addNoteToParentFolders = usePreference(PrefKey.NoteAddToParentFolders) const alwaysShowSuperToolbar = usePreference(PrefKey.AlwaysShowSuperToolbar) const toggleSpellcheck = () => { application.toggleGlobalSpellcheck().catch(console.error) } const toggleAndroidConfirmBeforeExit = () => { const newValue = !androidConfirmBeforeExit setAndroidConfirmBeforeExit(newValue) application.setValue(AndroidConfirmBeforeExitKey, newValue) } return ( <PreferencesGroup> <PreferencesSegment> <Title>Defaults</Title> {application.platform === Platform.Android && ( <> <div className="flex justify-between gap-2 md:items-center"> <div className="flex flex-col"> <Subtitle>Always ask before closing app (Android)</Subtitle> <Text>Whether a confirmation dialog should be shown before closing the app.</Text> </div> <Switch onChange={toggleAndroidConfirmBeforeExit} checked={androidConfirmBeforeExit} /> </div> <HorizontalSeparator classes="my-4" /> </> )} <div className="flex justify-between gap-2 md:items-center"> <div className="flex flex-col"> <Subtitle>Spellcheck</Subtitle> <Text> The default spellcheck value for new notes. Spellcheck can be configured per note from the note context menu. Spellcheck may degrade overall typing performance with long notes. </Text> </div> <Switch onChange={toggleSpellcheck} checked={spellcheck} /> </div> <HorizontalSeparator classes="my-4" /> <div className="flex justify-between gap-2 md:items-center"> <div className="flex flex-col"> <Subtitle>Add all parent tags when adding a nested tag to a note</Subtitle> <Text>When enabled, adding a nested tag to a note will automatically add all associated parent tags.</Text> </div> <Switch onChange={() => { application.setPreference(PrefKey.NoteAddToParentFolders, !addNoteToParentFolders).catch(console.error) }} checked={addNoteToParentFolders} /> </div> <HorizontalSeparator classes="my-4" /> {!isMobile && ( <div className="flex justify-between gap-2 md:items-center"> <div className="flex flex-col"> <Subtitle>Use always-visible toolbar in Super notes</Subtitle> <Text> When enabled, the Super toolbar will always be shown at the top of the note. It can be temporarily toggled using Cmd/Ctrl+Shift+K. When disabled, the Super toolbar will only be shown as a floating toolbar when text is selected. </Text> </div> <Switch onChange={() => { application.setPreference(PrefKey.AlwaysShowSuperToolbar, !alwaysShowSuperToolbar).catch(console.error) }} checked={alwaysShowSuperToolbar} /> </div> )} </PreferencesSegment> </PreferencesGroup> ) } export default Defaults ```
/content/code_sandbox/packages/web/src/javascripts/Components/Preferences/Panes/General/Defaults.tsx
xml
2016-12-05T23:31:33
2024-08-16T06:51:19
app
standardnotes/app
5,180
893
```xml import { render } from "@testing-library/react"; import React from "react"; import { CoralContext, CoralContextProvider, } from "coral-framework/lib/bootstrap"; import AppContainer from "coral-stream/App"; export default function customRenderAppWithContext(context: CoralContext) { render( <CoralContextProvider value={context}> <AppContainer disableListeners /> </CoralContextProvider> ); } ```
/content/code_sandbox/client/src/core/client/stream/test/customRenderAppWithContext.tsx
xml
2016-10-31T16:14:05
2024-08-06T16:15:57
talk
coralproject/talk
1,881
90
```xml import Document, { Html, Head, Main, NextScript } from 'next/document' class CustomDocument extends Document { render() { return ( <Html lang="en"> <Head /> <body> <Main /> <NextScript /> <script type="text/javascript" dangerouslySetInnerHTML={{ __html: `(function(a,e,f,g,b,c,d){a.GoogleAnalyticsObject=b;a[b]=a[b]||function(){(a[b].q=a[b].q||[]).push(arguments)};a[b].l=1*new Date;c=e.createElement(f);d=e.getElementsByTagName(f)[0];c.async=1;c.src=g;d.parentNode.insertBefore(c,d)})(window,document,"script","//www.google-analytics.com/analytics.js","ga");ga("create","UA-67824860-7","auto");ga("send","pageview");`, }} /> </body> </Html> ) } } export default CustomDocument ```
/content/code_sandbox/packages/website/src/pages/_document.tsx
xml
2016-10-21T09:36:02
2024-08-16T14:16:08
gitmoji
carloscuesta/gitmoji
15,539
211
```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="M13.91,3.41,13.5,3l0.2-0.28c0.02-0.03 0.04-0.05 0.06-0.08A0.969 0.969,0,0,0,14,1.99a1,1,0,0,0-1.62-0.77c-0.03 0.02-0.06 0.05-0.09 0.07L12,1.5l-0.386-0.386a0.354 0.354,0,0,0-0.525 0.475l0.417 0.417-0.5 0.5-0.392-0.392a0.354 0.354,0,0,0-0.525 0.475L10.5,3l-0.5 0.5-0.381-0.381a0.354 0.354,0,1,0-0.528 0.472h0l0.028 0.028L9.5,4,9,4.5l-0.395-0.395a0.354 0.354,0,0,0-0.517 0.483L8.5,5,8,5.5l-0.365-0.365a0.354 0.354,0,0,0-0.556 0.439h0C7.1,5.6,7.508,6,7.508,6L7,6.5l-0.394-0.392a0.392 0.392,0,0,0-0.5-0.028 0.384 0.384,0,0,0-0.028 0.5L6.1,6.6l0.4 0.4L6,7.5l-0.4-0.4a0.37 0.37,0,0,0-0.5,0L6.248,8.244,12.09,2.41,12.5,2H13v0.5l-0.41 0.41L6.751,8.749,7.9,9.9a0.355 0.355,0,0,0,0-0.5l-0.008-0.009L7.5,9,8,8.5l0.384 0.384a0.354 0.354,0,0,0,0.528-0.472L8.5,8,9,7.5l0.38 0.38a0.354 0.354,0,0,0,0.528-0.472l-0.02-0.02L9.5,7l0.5-0.5 0.377 0.377A0.35 0.35,0,0,0,10.64,7a0.347 0.347,0,0,0,0.252-0.6L10.5,6l0.5-0.5 0.38 0.38a0.354 0.354,0,0,0,0.528-0.472L11.88,5.38,11.5,5l0.5-0.5 0.381 0.381a0.354 0.354,0,0,0,0.528-0.472l-0.025-0.025L12.5,4l0.5-0.5 0.382 0.382a0.354 0.354,0,0,0,0.528-0.472ZM4.39,7.916C3.893,7.419,3.641,7,3,7H1.5a0.5 0.5,0,0,0-0.5 0.5v3A2.19,2.19,0,0,0,1.5,12l0.815 0.811A2.251,2.251,0,0,0,5.493,13h0L7.5,11ZM3.5,10,2.262,11.238A1.3,1.3,0,0,1,2,10.5V8H3a0.545 0.545,0,0,1,0.335 0.194 0.455 0.455,0,0,1,0.165 0.418Z"/> </vector> ```
/content/code_sandbox/app/src/main/res/drawable/ic_preset_maki_logging.xml
xml
2016-07-02T10:44:04
2024-08-16T18:55:54
StreetComplete
streetcomplete/StreetComplete
3,781
1,121
```xml import { DefaultPalette } from './colors/index'; import { DefaultEffects } from './effects/index'; import { DefaultFontStyles } from './fonts/index'; import { mergeThemes } from './mergeThemes'; import { DefaultSpacing } from './spacing/index'; import { makeSemanticColors } from './utilities/makeSemanticColors'; import type { PartialTheme, Theme } from './types/index'; /** * Creates a custom theme definition. * @param theme - Partial theme object. * @param depComments - Whether to include deprecated tags as comments for deprecated slots. */ export function createTheme(theme: PartialTheme = {}, depComments: boolean = false): Theme { const isInverted = !!theme.isInverted; const baseTheme: Theme = { palette: DefaultPalette, effects: DefaultEffects, fonts: DefaultFontStyles, spacing: DefaultSpacing, isInverted, disableGlobalClassNames: false, semanticColors: makeSemanticColors(DefaultPalette, DefaultEffects, undefined, isInverted, depComments), rtl: undefined, }; return mergeThemes(baseTheme, theme); } ```
/content/code_sandbox/packages/theme/src/createTheme.ts
xml
2016-06-06T15:03:44
2024-08-16T18:49:29
fluentui
microsoft/fluentui
18,221
227
```xml <Application xmlns="path_to_url" xmlns:x="path_to_url" xmlns:local="clr-namespace:MauiForms" x:Class="MauiForms.App"> <Application.Resources> <ResourceDictionary> <Color x:Key="PrimaryColor">#512bdf</Color> <Color x:Key="SecondaryColor">White</Color> <Style TargetType="Label"> <Setter Property="TextColor" Value="{DynamicResource PrimaryColor}" /> <Setter Property="FontFamily" Value="OpenSansRegular" /> </Style> <Style TargetType="Button"> <Setter Property="TextColor" Value="{DynamicResource SecondaryColor}" /> <Setter Property="FontFamily" Value="OpenSansRegular" /> <Setter Property="BackgroundColor" Value="{DynamicResource PrimaryColor}" /> <Setter Property="Padding" Value="14,10" /> </Style> </ResourceDictionary> </Application.Resources> </Application> ```
/content/code_sandbox/tests/dotnet/size-comparison/MauiForms/dotnet/App.xaml
xml
2016-04-20T18:24:26
2024-08-16T13:29:19
xamarin-macios
xamarin/xamarin-macios
2,436
205
```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. */ export type ScrollKey = "scrollLeft" | "scrollTop"; export class TableQuadrantStackCache { private cachedRowHeaderWidth: number = 0; private cachedColumnHeaderHeight: number = 0; private cachedScrollLeft: number = 0; private cachedScrollTop: number = 0; private cachedScrollContainerClientWidth: number | undefined; private cachedScrollContainerClientHeight: number | undefined; public constructor() { this.reset(); } public reset() { this.cachedRowHeaderWidth = 0; this.cachedColumnHeaderHeight = 0; this.cachedScrollLeft = 0; this.cachedScrollTop = 0; } // Getters // ======= public getScrollOffset(scrollKey: ScrollKey) { return scrollKey === "scrollLeft" ? this.cachedScrollLeft : this.cachedScrollTop; } public getRowHeaderWidth() { return this.cachedRowHeaderWidth; } public getColumnHeaderHeight() { return this.cachedColumnHeaderHeight; } public getScrollContainerClientWidth() { return this.cachedScrollContainerClientWidth; } public getScrollContainerClientHeight() { return this.cachedScrollContainerClientHeight; } // Setters // ======= public setColumnHeaderHeight(height: number) { this.cachedColumnHeaderHeight = height; } public setRowHeaderWidth(width: number) { this.cachedRowHeaderWidth = width; } public setScrollOffset(scrollKey: ScrollKey, offset: number) { if (scrollKey === "scrollLeft") { this.cachedScrollLeft = offset; } else { this.cachedScrollTop = offset; } } public setScrollContainerClientWidth(clientWidth: number | undefined) { this.cachedScrollContainerClientWidth = clientWidth; } public setScrollContainerClientHeight(clientHeight: number | undefined) { this.cachedScrollContainerClientHeight = clientHeight; } } ```
/content/code_sandbox/packages/table/src/quadrants/tableQuadrantStackCache.ts
xml
2016-10-25T21:17:50
2024-08-16T15:14:48
blueprint
palantir/blueprint
20,593
483
```xml import * as React from 'react'; import { mount, ReactWrapper } from 'enzyme'; import { ColorPicker } from './ColorPicker'; import { ColorPickerBase } from './ColorPicker.base'; import { ColorSliderBase } from './ColorSlider/ColorSlider.base'; import { setWarningCallback } from '../../Utilities'; import type { IColorPickerState } from './ColorPicker.base'; import type { IColorPickerProps, IColorPickerStrings } from './ColorPicker.types'; describe('ColorPicker', () => { let wrapper: ReactWrapper<IColorPickerProps, IColorPickerState, ColorPickerBase> | undefined; beforeAll(() => { // Prevent warn deprecations from failing test setWarningCallback(() => { /* no-op */ }); }); afterAll(() => { setWarningCallback(); }); afterEach(() => { if (wrapper) { wrapper.unmount(); wrapper = undefined; } }); it('hides alpha control slider', () => { wrapper = mount(<ColorPicker color="#ffffff" alphaSliderHidden={true} />); const alphaSlider = wrapper.find('.is-alpha'); const tableHeaders = wrapper.find('thead td'); // There should only be table headers and inputs for hex, red, green, and blue (no alpha) expect(alphaSlider.exists()).toBe(false); expect(tableHeaders).toHaveLength(4); const inputs = wrapper.getDOMNode().querySelectorAll('input') as NodeListOf<HTMLInputElement>; expect(inputs).toHaveLength(4); expect(inputs[0].value).toBe('ffffff'); expect(inputs[1].value).toBe('255'); expect(inputs[2].value).toBe('255'); expect(inputs[3].value).toBe('255'); }); it('renders deprecated custom strings', () => { const fields = ['Custom Hex', 'Custom Red', 'Custom Green', 'Custom Blue', 'Custom Alpha']; wrapper = mount( <ColorPicker color="#FFFFFF" hexLabel={fields[0]} redLabel={fields[1]} greenLabel={fields[2]} blueLabel={fields[3]} alphaLabel={fields[4]} />, ); const tableHeaders = wrapper.find('thead td'); tableHeaders.forEach((node, index) => { expect(node.text()).toEqual(fields[index]); }); const sliders = wrapper.find(ColorSliderBase); expect(sliders.at(1).html()).toContain('Custom Alpha'); }); it('renders mix of new and deprecated custom strings', () => { const customRed = 'Custom Red'; const customAlpha = 'Custom Alpha'; const customStrings: IColorPickerStrings = { hex: 'Custom Hex', blue: 'Custom Blue', }; wrapper = mount( <ColorPicker color="#FFFFFF" strings={customStrings} redLabel={customRed} alphaLabel={customAlpha} />, ); const tableHeaders = wrapper.find('thead td'); expect(tableHeaders.at(0).text()).toEqual(customStrings.hex); expect(tableHeaders.at(1).text()).toEqual(customRed); expect(tableHeaders.at(2).text()).toEqual('Green'); // not customized expect(tableHeaders.at(3).text()).toEqual(customStrings.blue); expect(tableHeaders.at(4).text()).toEqual(customAlpha); }); }); ```
/content/code_sandbox/packages/react/src/components/ColorPicker/ColorPicker.deprecated.test.tsx
xml
2016-06-06T15:03:44
2024-08-16T18:49:29
fluentui
microsoft/fluentui
18,221
709
```xml import * as React from 'react'; import LondonCycleMap from './londonCycle'; import AllShapes from './allShapes'; import HtmlFeatures from './htmlFeatures'; import ThreeDMap from './threeDMap'; import HtmlCluster from './htmlCluster'; import SwitchStyle from './switchStyle'; import GeoJsonLayer from './geojsonLayer'; import VectorLayer from './vectorLayer'; import Heatmap from './heatmap'; import { Live } from '../live'; import raw from 'raw.macro'; const LondonCycleMapRaw = raw('./raws/londonCycle.raw'); const AllShapesRaw = raw('./raws/allShapes.raw'); const HtmlFeaturesRaw = raw('./raws/htmlFeatures.raw'); const ThreeDMapRaw = raw('./raws/threeDMap.raw'); const HtmlClusterRaw = raw('./raws/htmlCluster.raw'); const SwitchStyleRaw = raw('./raws/switchStyle.raw'); const GeoJsonLayerRaw = raw('./raws/geojsonLayer.raw'); const HeatmapRaw = raw('./raws/heatmap.raw'); const VectorLayerRaw = raw('./raws/vectorLayer.raw'); export const sections = [ { shortTitle: 'london-cycle', title: 'Bike stations in London', components: ['ReactMapboxGl', 'Layer', 'Feature'], DemoComponent: LondonCycleMap, reactLive: <Live full={true} raw={LondonCycleMapRaw} /> }, { shortTitle: 'heatmap', title: 'Heatmap of London house prices', components: ['ReactMapboxGl', 'Layer', 'Feature'], DemoComponent: Heatmap, reactLive: <Live full={true} raw={HeatmapRaw} /> }, { shortTitle: 'all-shapes', title: 'Mapbox webgl shapes', components: [ 'ReactMapboxGl', 'Layer', 'Feature', 'ScaleControl', 'ZoomControl', 'RotationControl' ], DemoComponent: AllShapes, reactLive: <Live full={true} raw={AllShapesRaw} /> }, { shortTitle: 'html-marker', title: 'Html features (Marker)', components: ['ReactMapboxGl', 'Marker'], DemoComponent: HtmlFeatures, reactLive: <Live full={true} raw={HtmlFeaturesRaw} /> }, { shortTitle: '3d-map', title: '3D extrusion map', components: ['ReactMapboxGl', 'Layer'], DemoComponent: ThreeDMap, reactLive: <Live full={true} raw={ThreeDMapRaw} /> }, { shortTitle: 'html-cluster', title: 'Cluster of Html markers', components: ['ReactMapboxGl', 'Marker', 'Cluster'], DemoComponent: HtmlCluster, reactLive: <Live full={true} raw={HtmlClusterRaw} /> }, { shortTitle: 'switch-style', title: 'Swap Mapbox map style', components: ['ReactMapboxGl', 'Source', 'Layer', 'Feature'], DemoComponent: SwitchStyle, reactLive: <Live full={true} raw={SwitchStyleRaw} /> }, { shortTitle: 'geojson-data', title: 'Display data from GeoJson', components: ['ReactMapboxGl', 'GeoJsonLayer'], DemoComponent: GeoJsonLayer, reactLive: <Live full={true} raw={GeoJsonLayerRaw} /> }, { shortTitle: 'vector-source', title: 'Display data from vector tile', components: ['ReactMapboxGl', 'Source', 'Layer'], DemoComponent: VectorLayer, reactLive: <Live full={true} raw={VectorLayerRaw} /> } ]; ```
/content/code_sandbox/example/src/demos/sections.tsx
xml
2016-04-16T08:23:57
2024-08-08T07:47:19
react-mapbox-gl
alex3165/react-mapbox-gl
1,907
808
```xml /** * @license * * path_to_url * * Unless required by applicable law or agreed to in writing, software * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ /** * @file Velocity estimation for prefetching using exponentially-weighted moving estimate of * univariate gaussian distribution of per-dimension velocities. * * Because changes to the global position are not continuous, we estimate the velocity itself using * an exponentially-weighted moving average over a relatively short time scale * `velocityHalfLifeMilliseconds`, and then estimate a mean and variance of these velocity estimates * using an expeonentially-weighted moving average over a longer time scale. */ const VELOCITY_HALF_LIFE_MS = 50; const MODEL_HALF_LIFE_MS = 1000; export class VelocityEstimator { private lastTime = Number.NEGATIVE_INFINITY; rank = 0; private numSamples = 0; // Previous position sampled. private prevPosition = new Float32Array(); // Moving average of raw velocity over `velocityHalfLifeMilliseconds`. private velocity = new Float32Array(); // Moving average of `velocity` estimate using `modelHalfLifeMilliseconds`. mean = new Float32Array(); // Moving variance of `velocity` estimate using `modelHalfLifeMilliseconds`. variance = new Float32Array(); constructor( public velocityHalfLifeMilliseconds: number = VELOCITY_HALF_LIFE_MS, public modelHalfLifeMilliseconds: number = MODEL_HALF_LIFE_MS, ) {} reset(rank: number) { this.lastTime = Number.NEGATIVE_INFINITY; this.rank = rank; this.numSamples = 0; this.velocity = new Float32Array(rank); this.prevPosition = new Float32Array(rank); this.mean = new Float32Array(rank); this.variance = new Float32Array(rank); } addSample(position: Float32Array, time = Date.now()) { const rank = position.length; if (rank !== this.rank) { this.reset(rank); } const numSamples = this.numSamples; ++this.numSamples; // Update `velocity` estimate. if (this.numSamples === 0) { this.prevPosition.set(position); this.lastTime = time; return; } const deltaT = time - this.lastTime; this.lastTime = time; const velocityAlpha = 1 - 2 ** -(deltaT / this.velocityHalfLifeMilliseconds); const modelAlpha = 1 - 2 ** -(deltaT / this.modelHalfLifeMilliseconds); const { velocity, prevPosition, mean, variance } = this; for (let i = 0; i < rank; ++i) { const curVelocitySample = (position[i] - prevPosition[i]) / Math.max(deltaT, 1); prevPosition[i] = position[i]; const prevVelocity = velocity[i]; const newVelocity = (velocity[i] = prevVelocity + velocityAlpha * (curVelocitySample - prevVelocity)); if (numSamples === 1) { mean[i] = newVelocity; } else { const meanPrev = mean[i]; const varPrev = variance[i]; const delta = newVelocity - meanPrev; mean[i] = meanPrev + modelAlpha * delta; variance[i] = (1 - modelAlpha) * (varPrev + modelAlpha * delta * delta); } } } } ```
/content/code_sandbox/src/util/velocity_estimation.ts
xml
2016-05-27T02:37:25
2024-08-16T07:24:25
neuroglancer
google/neuroglancer
1,045
735
```xml <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> <class>FilterAlertWidget</class> <widget class="QWidget" name="FilterAlertWidget"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>194</width> <height>152</height> </rect> </property> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Maximum"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="minimumSize"> <size> <width>194</width> <height>0</height> </size> </property> <property name="maximumSize"> <size> <width>16777215</width> <height>16777215</height> </size> </property> <property name="styleSheet"> <string notr="true">#wFilterAlertContainer { border: 1px solid #B8B8B8; background-color: #FFFFFF; } #bAll, #bContacts, #bPayment, #bShares { border: none; margin-left: 8px; color: #777777; font-family: Lato; font-size: 14px; } #bAll::hover, #bContacts::hover, #bPayment::hover, #bShares::hover { color: #000000; } #bNumberNotifications, #bNumberNotificationsContacts, #bNumberNotificationsPayments, #bNumberNotificationsShares { border: none; background-color: #FF333A; color: #FFFFFF; font-weight: bold; font-family: Lato; font-size: 11px; border-radius: 4px; margin-right: 8px; } #wSeparator { background-color: rgba(0,0,0,0.1); }</string> </property> <layout class="QVBoxLayout" name="verticalLayout_2"> <property name="spacing"> <number>0</number> </property> <property name="leftMargin"> <number>0</number> </property> <property name="topMargin"> <number>0</number> </property> <property name="rightMargin"> <number>0</number> </property> <property name="bottomMargin"> <number>0</number> </property> <item> <widget class="QWidget" name="wFilterAlertContainer" native="true"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Maximum"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <layout class="QVBoxLayout" name="verticalLayout_3"> <property name="spacing"> <number>8</number> </property> <property name="leftMargin"> <number>8</number> </property> <property name="topMargin"> <number>11</number> </property> <property name="rightMargin"> <number>8</number> </property> <property name="bottomMargin"> <number>11</number> </property> <item> <widget class="QWidget" name="wAllNotifications" native="true"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <layout class="QHBoxLayout" name="horizontalLayout_4" stretch="1,0"> <property name="spacing"> <number>5</number> </property> <property name="leftMargin"> <number>0</number> </property> <property name="topMargin"> <number>0</number> </property> <property name="rightMargin"> <number>0</number> </property> <property name="bottomMargin"> <number>0</number> </property> <item alignment="Qt::AlignLeft"> <widget class="QToolButton" name="bAll"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="text"> <string>All notifications</string> </property> </widget> </item> <item> <widget class="QToolButton" name="bNumberNotifications"> <property name="sizePolicy"> <sizepolicy hsizetype="Maximum" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="minimumSize"> <size> <width>24</width> <height>14</height> </size> </property> <property name="maximumSize"> <size> <width>24</width> <height>14</height> </size> </property> <property name="text"> <string notr="true">0</string> </property> </widget> </item> </layout> </widget> </item> <item> <widget class="QWidget" name="wSeparator" native="true"> <property name="minimumSize"> <size> <width>0</width> <height>1</height> </size> </property> <property name="maximumSize"> <size> <width>16777215</width> <height>1</height> </size> </property> </widget> </item> <item> <widget class="QWidget" name="wTypesNotifications" native="true"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <layout class="QVBoxLayout" name="verticalLayout"> <property name="spacing"> <number>12</number> </property> <property name="leftMargin"> <number>0</number> </property> <property name="topMargin"> <number>0</number> </property> <property name="rightMargin"> <number>0</number> </property> <property name="bottomMargin"> <number>0</number> </property> <item> <widget class="QWidget" name="wContactsNotifications" native="true"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <layout class="QHBoxLayout" name="horizontalLayout" stretch="1,0"> <property name="spacing"> <number>5</number> </property> <property name="leftMargin"> <number>0</number> </property> <property name="topMargin"> <number>0</number> </property> <property name="rightMargin"> <number>0</number> </property> <property name="bottomMargin"> <number>0</number> </property> <item> <widget class="QToolButton" name="bContacts"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="text"> <string>Contacts</string> </property> <property name="icon"> <iconset> <normalon>:/images/contacts_padding.png</normalon> </iconset> </property> <property name="iconSize"> <size> <width>14</width> <height>6</height> </size> </property> <property name="toolButtonStyle"> <enum>Qt::ToolButtonTextBesideIcon</enum> </property> </widget> </item> <item> <widget class="QToolButton" name="bNumberNotificationsContacts"> <property name="sizePolicy"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="minimumSize"> <size> <width>24</width> <height>14</height> </size> </property> <property name="maximumSize"> <size> <width>24</width> <height>14</height> </size> </property> <property name="text"> <string notr="true">0</string> </property> </widget> </item> </layout> </widget> </item> <item> <widget class="QWidget" name="wSharesNotifications" native="true"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <layout class="QHBoxLayout" name="horizontalLayout_2" stretch="1,0"> <property name="spacing"> <number>5</number> </property> <property name="leftMargin"> <number>0</number> </property> <property name="topMargin"> <number>0</number> </property> <property name="rightMargin"> <number>0</number> </property> <property name="bottomMargin"> <number>0</number> </property> <item> <widget class="QToolButton" name="bShares"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="text"> <string>Incoming Shares</string> </property> <property name="icon"> <iconset> <normalon>:/images/Incoming_padding.png</normalon> </iconset> </property> <property name="iconSize"> <size> <width>14</width> <height>6</height> </size> </property> <property name="toolButtonStyle"> <enum>Qt::ToolButtonTextBesideIcon</enum> </property> </widget> </item> <item> <widget class="QToolButton" name="bNumberNotificationsShares"> <property name="sizePolicy"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="minimumSize"> <size> <width>24</width> <height>14</height> </size> </property> <property name="maximumSize"> <size> <width>24</width> <height>14</height> </size> </property> <property name="text"> <string notr="true">0</string> </property> </widget> </item> </layout> </widget> </item> <item> <widget class="QWidget" name="wPaymentNotifications" native="true"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <layout class="QHBoxLayout" name="horizontalLayout_3" stretch="1,0"> <property name="spacing"> <number>5</number> </property> <property name="leftMargin"> <number>0</number> </property> <property name="topMargin"> <number>0</number> </property> <property name="rightMargin"> <number>0</number> </property> <property name="bottomMargin"> <number>0</number> </property> <item> <widget class="QToolButton" name="bPayment"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="text"> <string>Payment</string> </property> <property name="icon"> <iconset> <normalon>:/images/payment_padding.png</normalon> </iconset> </property> <property name="iconSize"> <size> <width>14</width> <height>6</height> </size> </property> <property name="toolButtonStyle"> <enum>Qt::ToolButtonTextBesideIcon</enum> </property> </widget> </item> <item> <widget class="QToolButton" name="bNumberNotificationsPayments"> <property name="sizePolicy"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="minimumSize"> <size> <width>24</width> <height>14</height> </size> </property> <property name="maximumSize"> <size> <width>24</width> <height>14</height> </size> </property> <property name="text"> <string notr="true">0</string> </property> </widget> </item> </layout> </widget> </item> </layout> </widget> </item> </layout> </widget> </item> </layout> </widget> <resources/> <connections/> </ui> ```
/content/code_sandbox/src/MEGASync/gui/win/FilterAlertWidget.ui
xml
2016-02-10T18:28:05
2024-08-16T19:36:44
MEGAsync
meganz/MEGAsync
1,593
3,309
```xml <vector xmlns:android="path_to_url" android:width="128dp" android:height="128dp" android:viewportWidth="128" android:viewportHeight="128"> <path android:pathData="m32,24 l0.01,87.92h16l-0.01,-87.92z" android:fillColor="#666"/> <path android:pathData="m80,24 l0.01,87.92h16l-0.01,-87.92z" android:fillColor="#666"/> <path android:pathData="m24.04,32h79.91c4.46,0 8.04,3.59 8.04,8.04v31.91c0,4.46 -3.59,8.04 -8.04,8.04h-79.91c-4.46,0 -8.04,-3.59 -8.04,-8.04v-31.91c0,-4.46 3.59,-8.04 8.04,-8.04z" android:fillColor="#555"/> <path android:pathData="m24,32c-3.82,0 -6.99,2.65 -7.79,6.21l28.75,41.79h14.14l-32.33,-48zM40.62,32 L72.95,80h14.14l-32.33,-48zM68.62,32 L100.95,80h3.05c3.69,0 6.78,-2.48 7.71,-5.87l-28.94,-42.13zM96.62,32 L112,54v-14c0,-4.43 -3.57,-8 -8,-8zM16,58v14c0,4.43 3.57,8 8,8h7.09z" android:fillColor="#ffe94c"/> <path android:pathData="m24.04,32h79.92c4.45,0 8.04,3.58 8.04,8.04v31.92c0,4.45 -3.58,8.04 -8.04,8.04h-79.92c-4.45,0 -8.04,-3.58 -8.04,-8.04v-31.92c0,-4.45 3.58,-8.04 8.04,-8.04z" android:strokeLineJoin="round" android:strokeWidth="4" android:fillColor="#00000000" android:strokeColor="#555" android:strokeLineCap="round"/> </vector> ```
/content/code_sandbox/app/src/main/res/drawable/ic_building_construction.xml
xml
2016-07-02T10:44:04
2024-08-16T18:55:54
StreetComplete
streetcomplete/StreetComplete
3,781
621
```xml import React from 'react' import { css } from 'styled-components/macro' import { colors, boxShadows } from '../utils/theme' interface AuthFormLayoutProps { children: React.ReactNode heading: string } const AuthFormLayout = (props: AuthFormLayoutProps) => <> <div css={css` background-color: ${colors.primary}; position: fixed; top: 0; left: 0; bottom: 0; right: 0; z-index: -1; `} /> <div css={css` background-color: ${colors.white}; border-radius: 2rem; box-shadow: ${boxShadows[0]}; padding: 2rem; margin: 0 auto; max-width: 420px; position: relative; `}> <h1>{props.heading}</h1> {props.children} </div> </> export default AuthFormLayout ```
/content/code_sandbox/examples/firebase/src/styled/AuthFormLayout.tsx
xml
2016-09-24T07:44:26
2024-07-11T14:52:12
navi
frontarm/navi
2,070
212
```xml import Graph, {Attributes} from 'graphology-types'; type NodeIterationWithGenerationCallback< NodeAttributes extends Attributes = Attributes > = (node: string, attributes: NodeAttributes, generation: number) => void; export function forEachNodeInTopologicalOrder< NodeAttributes extends Attributes = Attributes >( graph: Graph<NodeAttributes>, callback: NodeIterationWithGenerationCallback<NodeAttributes> ): void; export function topologicalSort(graph: Graph): Array<string>; export function forEachTopologicalGeneration< NodeAttributes extends Attributes = Attributes >( graph: Graph<NodeAttributes>, callback: (generation: Array<string>) => void ): void; export function topologicalGenerations(graph: Graph): Array<Array<string>>; ```
/content/code_sandbox/src/dag/topological-sort.d.ts
xml
2016-08-24T16:59:27
2024-08-16T09:58:25
graphology
graphology/graphology
1,223
150
```xml <SendEmailResponse xmlns="path_to_url"> <SendEmailResult> <MessageId>0100018b81588ee5-1dbe20d2-f13b-4def-ad1c-ae05365b54e6-000000</MessageId> </SendEmailResult> <ResponseMetadata> <RequestId>70819981-5f17-4a04-b070-9b31b7921fab</RequestId> </ResponseMetadata> </SendEmailResponse> ```
/content/code_sandbox/cpp/example_code/ses/tests/mock_input/SendEmail.xml
xml
2016-08-18T19:06:57
2024-08-16T18:59:44
aws-doc-sdk-examples
awsdocs/aws-doc-sdk-examples
9,298
110
```xml import { evalToken } from '../render' import { Context } from '../context' import { identify, isFunction } from '../util/underscore' import { FilterHandler, FilterImplOptions } from './filter-impl-options' import { FilterArg, isKeyValuePair } from '../parser/filter-arg' import { Liquid } from '../liquid' export class Filter { public name: string public args: FilterArg[] public readonly raw: boolean private handler: FilterHandler private liquid: Liquid public constructor (name: string, options: FilterImplOptions | undefined, args: FilterArg[], liquid: Liquid) { this.name = name this.handler = isFunction(options) ? options : (isFunction(options?.handler) ? options!.handler : identify) this.raw = !isFunction(options) && !!options?.raw this.args = args this.liquid = liquid } public * render (value: any, context: Context): IterableIterator<unknown> { const argv: any[] = [] for (const arg of this.args as FilterArg[]) { if (isKeyValuePair(arg)) argv.push([arg[0], yield evalToken(arg[1], context)]) else argv.push(yield evalToken(arg, context)) } return yield this.handler.apply({ context, liquid: this.liquid }, [value, ...argv]) } } ```
/content/code_sandbox/src/template/filter.ts
xml
2016-06-13T07:39:30
2024-08-16T16:56:50
liquidjs
harttle/liquidjs
1,485
294
```xml <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="path_to_url"> <item android:drawable="@color/btn_press_bg" android:state_pressed="true"/> <item android:drawable="@android:color/transparent"/> </selector> ```
/content/code_sandbox/app/src/main/res/drawable/sel_btn_press_bg.xml
xml
2016-08-19T09:59:38
2024-07-21T15:24:26
MvpApp
Rukey7/MvpApp
2,342
61
```xml import { Column, Entity, Index, PrimaryColumn } from "../../../../src" enum ExternalUserProvider { A = "A", B = "B", C = "C", } @Entity() export class TestEntity { @PrimaryColumn({ name: "provider", type: "enum", enumName: "external_user_provider", enum: ExternalUserProvider, }) @Index() public provider!: ExternalUserProvider @Column({ type: "enum", enumName: "external_user_provider", enum: ExternalUserProvider, array: true, }) public provider2!: ExternalUserProvider } ```
/content/code_sandbox/test/github-issues/7614/entity/Test.ts
xml
2016-02-29T07:41:14
2024-08-16T18:28:52
typeorm
typeorm/typeorm
33,875
137
```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 { ChangeDetectorRef, Component, forwardRef, Input, OnInit, Renderer2, ViewContainerRef } from '@angular/core'; import { PageComponent } from '@shared/components/page.component'; import { Store } from '@ngrx/store'; import { AppState } from '@core/core.state'; import { ControlValueAccessor, NG_VALUE_ACCESSOR, UntypedFormBuilder, UntypedFormGroup } from '@angular/forms'; import { DialogService } from '@core/services/dialog.service'; import { coerceBooleanProperty } from '@angular/cdk/coercion'; import { TranslateService } from '@ngx-translate/core'; import { coerceBoolean } from '@shared/decorators/coercion'; import { TbPopoverService } from '@shared/components/popover.service'; import { MaterialIconsComponent } from '@shared/components/material-icons.component'; import { MatButton } from '@angular/material/button'; @Component({ selector: 'tb-material-icon-select', templateUrl: './material-icon-select.component.html', styleUrls: ['./material-icon-select.component.scss'], providers: [ { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => MaterialIconSelectComponent), multi: true } ] }) export class MaterialIconSelectComponent extends PageComponent implements OnInit, ControlValueAccessor { @Input() @coerceBoolean() asBoxInput = false; @Input() label = this.translate.instant('icon.icon'); @Input() color: string; @Input() backgroundColor: string; @Input() disabled: boolean; @Input() @coerceBoolean() iconClearButton = false; private requiredValue: boolean; get required(): boolean { return this.requiredValue; } @Input() set required(value: boolean) { this.requiredValue = coerceBooleanProperty(value); } private modelValue: string; private propagateChange = null; public materialIconFormGroup: UntypedFormGroup; constructor(protected store: Store<AppState>, private dialogs: DialogService, private translate: TranslateService, private popoverService: TbPopoverService, private renderer: Renderer2, private viewContainerRef: ViewContainerRef, private fb: UntypedFormBuilder, private cd: ChangeDetectorRef) { super(store); } ngOnInit(): void { this.materialIconFormGroup = this.fb.group({ icon: [null, []] }); this.materialIconFormGroup.valueChanges.subscribe(() => { this.updateModel(); }); } registerOnChange(fn: any): void { this.propagateChange = fn; } registerOnTouched(fn: any): void { } setDisabledState(isDisabled: boolean): void { this.disabled = isDisabled; if (isDisabled) { this.materialIconFormGroup.disable({emitEvent: false}); } else { this.materialIconFormGroup.enable({emitEvent: false}); } } writeValue(value: string): void { this.modelValue = value; this.materialIconFormGroup.patchValue( { icon: this.modelValue }, {emitEvent: false} ); } private updateModel() { const icon: string = this.materialIconFormGroup.get('icon').value; if (this.modelValue !== icon) { this.modelValue = icon; this.propagateChange(this.modelValue); } } openIconDialog() { if (!this.disabled) { this.dialogs.materialIconPicker(this.materialIconFormGroup.get('icon').value, this.iconClearButton).subscribe( (result) => { if (!result?.canceled) { this.materialIconFormGroup.patchValue( {icon: result?.icon}, {emitEvent: true} ); this.cd.markForCheck(); } } ); } } openIconPopup($event: Event, matButton: MatButton) { if ($event) { $event.stopPropagation(); } const trigger = matButton._elementRef.nativeElement; if (this.popoverService.hasPopover(trigger)) { this.popoverService.hidePopover(trigger); } else { const materialIconsPopover = this.popoverService.displayPopover(trigger, this.renderer, this.viewContainerRef, MaterialIconsComponent, 'left', true, null, { selectedIcon: this.materialIconFormGroup.get('icon').value, iconClearButton: this.iconClearButton }, {}, {}, {}, true); materialIconsPopover.tbComponentRef.instance.popover = materialIconsPopover; materialIconsPopover.tbComponentRef.instance.iconSelected.subscribe((icon) => { materialIconsPopover.hide(); this.materialIconFormGroup.patchValue( {icon}, {emitEvent: true} ); this.cd.markForCheck(); }); } } clear() { this.materialIconFormGroup.get('icon').patchValue(null, {emitEvent: true}); this.cd.markForCheck(); } } ```
/content/code_sandbox/ui-ngx/src/app/shared/components/material-icon-select.component.ts
xml
2016-12-01T09:33:30
2024-08-16T19:58:25
thingsboard
thingsboard/thingsboard
16,820
1,076
```xml import './hide-newsfeed-noise.css'; import * as pageDetect from 'github-url-detection'; import features from '../feature-manager.js'; void features.addCssFeature(import.meta.url, [pageDetect.isDashboard]); /* Test URLs: - path_to_url - path_to_url */ ```
/content/code_sandbox/source/features/hide-newsfeed-noise.tsx
xml
2016-02-15T16:45:02
2024-08-16T18:39:26
refined-github
refined-github/refined-github
24,013
60
```xml // Type definitions for react-native-mauron85-background-geolocation // Project: path_to_url // Definitions by: Mauron85 (@mauron85), Norbert Gyrg (@djereg) // Definitions: path_to_url type Event = 'location' | 'stationary' | 'activity' | 'start' | 'stop' | 'error' | 'authorization' | 'foreground' | 'background' | 'abort_requested' | 'http_authorization'; type HeadlessTaskEventName = 'location' | 'stationary' | 'activity'; type iOSActivityType = 'AutomotiveNavigation' | 'OtherNavigation' | 'Fitness' | 'Other'; type NativeProvider = 'gps' | 'network' | 'passive' | 'fused'; type ActivityType = 'IN_VEHICLE' | 'ON_BICYCLE' | 'ON_FOOT' | 'RUNNING' | 'STILL' | 'TILTING' | 'UNKNOWN' | 'WALKING'; type LogLevel = 'TRACE' | 'DEBUG' | 'INFO' | 'WARN' | 'ERROR'; type LocationProvider = 0 | 1 | 2; type AuthorizationStatus = 0 | 1 | 2; type AccuracyLevel = 0 | 100 | 1000 | 10000 | number; type LocationErrorCode = 1 | 2 | 3; type ServiceMode = 0 | 1; export interface ConfigureOptions { /** * Set location provider * * Platform: all * Available providers: * DISTANCE_FILTER_PROVIDER, * ACTIVITY_PROVIDER * RAW_PROVIDER * * @default DISTANCE_FILTER_PROVIDER * @example * { locationProvider: BackgroundGeolocation.RAW_PROVIDER } */ locationProvider?: LocationProvider; /** * Desired accuracy in meters. * * Platform: all * Provider: all * Possible values: * HIGH_ACCURACY, * MEDIUM_ACCURACY, * LOW_ACCURACY, * PASSIVE_ACCURACY * Note: Accuracy has direct effect on power drain. Lower accuracy = lower power drain. * * @default MEDIUM_ACCURACY * @example * { desiredAccuracy: BackgroundGeolocation.LOW_ACCURACY } */ desiredAccuracy?: AccuracyLevel; /** * Stationary radius in meters. * * When stopped, the minimum distance the device must move beyond the stationary location for aggressive background-tracking to engage. * Platform: all * Provider: DISTANCE_FILTER * * @default 50 */ stationaryRadius?: number; /** * When enabled, the plugin will emit sounds for life-cycle events of background-geolocation! See debugging sounds table. * * Platform: all * Provider: all * * @default false */ debug?: boolean; /** * The minimum distance (measured in meters) a device must move horizontally before an update event is generated. * * Platform: all * Provider: DISTANCE_FILTER, RAW * * @default 500 * @see {@link path_to_url|Apple docs} */ distanceFilter?: number; /** * Enable this in order to force a stop() when the application terminated. * E.g. on iOS, double-tap home button, swipe away the app. * * Platform: all * Provider: all * * @default true */ stopOnTerminate?: boolean; /** * Start background service on device boot. * * Platform: Android * Provider: all * * @default false */ startOnBoot?: boolean; /** * The minimum time interval between location updates in milliseconds. * * Platform: Android * Provider: all * * @default 60000 * @see {@link path_to_url|Android docs} */ interval?: number; /** * Fastest rate in milliseconds at which your app can handle location updates. * * Platform: Android * Provider: ACTIVITY * * @default 120000 * @see {@link path_to_url|Android docs} */ fastestInterval?: number; /** * Rate in milliseconds at which activity recognition occurs. * Larger values will result in fewer activity detections while improving battery life. * * Platform: Android * Provider: ACTIVITY * * @default 10000 */ activitiesInterval?: number; /** * @deprecated Stop location updates, when the STILL activity is detected. */ stopOnStillActivity?: boolean; /** * Enable/disable local notifications when tracking and syncing locations. * * Platform: Android * Provider: all * * @default true */ notificationsEnabled?: boolean; /** * Allow location sync service to run in foreground state. * Foreground state also requires a notification to be presented to the user. * * Platform: Android * Provider: all * * @default false */ startForeground?: boolean; /** * Custom notification title in the drawer. * * Platform: Android * Provider: all * @default "Background tracking" */ notificationTitle?: string; /** * Custom notification text in the drawer. * * Platform: Android * Provider: all * * @default "ENABLED" */ notificationText?: string; /** * The accent color (hex triplet) to use for notification. * Eg. <code>#4CAF50</code>. * * Platform: Android * Provider: all */ notificationIconColor?: string; /** * The filename of a custom notification icon. * * Platform: Android * Provider: all */ notificationIconLarge?: string; /** * The filename of a custom notification icon. * * Platform: Android * Provider: all */ notificationIconSmall?: string; /** * Activity type. * Presumably, this affects iOS GPS algorithm. * * Possible values: * "AutomotiveNavigation", "OtherNavigation", "Fitness", "Other" * * Platform: iOS * Provider: all * * @default "OtherNavigation" * @see {@link path_to_url|Apple docs} */ activityType?: iOSActivityType; /** * Pauses location updates when app is paused. * * Platform: iOS * Provider: all * * @default false * @see {@link path_to_url|Apple docs} */ pauseLocationUpdates?: boolean; /** * Switch to less accurate significant changes and region monitory when in background. * * Platform: iOS * Provider: all * * @default false */ saveBatteryOnBackground?: boolean; /** * Server url where to send HTTP POST with recorded locations * * Platform: all * Provider: all */ url?: string; /** * Server url where to send fail to post locations * * Platform: all * Provider: all */ syncUrl?: string; /** * Specifies how many previously failed locations will be sent to server at once. * * Platform: all * Provider: all * * @default 100 */ syncThreshold?: string; /** * Optional HTTP headers sent along in HTTP request. * * Platform: all * Provider: all */ httpHeaders?: any; /** * Limit maximum number of locations stored into db. * * Platform: all * Provider: all * * @default 10000 */ maxLocations?: number; /** * Customization post template. * * Platform: all * Provider: all */ postTemplate?: any; } export interface LocationOptions { /** * Maximum time in milliseconds device will wait for location. */ timeout?: number; /** * Maximum age in milliseconds of a possible cached location that is acceptable to return. */ maximumAge?: number; /** * If true and if the device is able to provide a more accurate position, it will do so. */ enableHighAccuracy?: boolean; } export interface Location { /** ID of location as stored in DB (or null) */ id: number; /** * Native provider reponsible for location. * * Possible values: * "gps", "network", "passive" or "fused" */ provider: NativeProvider; /** Configured location provider. */ locationProvider: number; /** UTC time of this fix, in milliseconds since January 1, 1970. */ time: number; /** Latitude, in degrees. */ latitude: number; /** Longitude, in degrees. */ longitude: number; /** Estimated accuracy of this location, in meters. */ accuracy: number; /** * Speed if it is available, in meters/second over ground. * * Note: Not all providers are capable of providing speed. * Typically network providers are not able to do so. */ speed: number; /** Altitude if available, in meters above the WGS 84 reference ellipsoid. */ altitude: number; /** Bearing, in degrees. */ bearing: number; /** * True if location was recorded by mock provider. (ANDROID ONLY) * * Note: this property is not enabled by default! * You can enable it "postTemplate" configure option. */ isFromMockProvider?: boolean; /** * True if device has mock locations enabled. (ANDROID ONLY) * * Note: this property is not enabled by default! * You can enable it "postTemplate" configure option. */ mockLocationsEnabled?: boolean; } export interface StationaryLocation extends Location { radius: number } export interface LocationError { /** * Reason of an error occurring when using the geolocating device. * * Possible error codes: * 1. PERMISSION_DENIED * 2. LOCATION_UNAVAILABLE * 3. TIMEOUT */ code: LocationErrorCode; /** Message describing the details of the error */ message: string; } export interface BackgroundGeolocationError { code: number; message: string; } export interface Activity { /** Percentage indicating the likelihood user is performing this activity. */ confidence: number; /** * Type of the activity. * * Possible values: * IN_VEHICLE, ON_BICYCLE, ON_FOOT, RUNNING, STILL, TILTING, UNKNOWN, WALKING */ type: ActivityType; } export interface ServiceStatus { /** TRUE if service is running. */ isRunning: boolean; /** TRUE if location services are enabled */ locationServicesEnabled: boolean; /** * Authorization status. * * Posible values: * NOT_AUTHORIZED, AUTHORIZED, AUTHORIZED_FOREGROUND * * @example * if (authorization == BackgroundGeolocation.NOT_AUTHORIZED) {...} */ authorization: AuthorizationStatus; } export interface LogEntry { /** ID of log entry as stored in db. */ id: number; /** Timestamp in milliseconds since beginning of UNIX epoch. */ timestamp: number; /** Log level */ level: LogLevel; /** Log message */ message: string; /** Recorded stacktrace. (Android only, on iOS part of message) */ stackTrace: string; } export interface EventSubscription { remove(): void; } export interface HeadlessTaskEvent { /** Name of the event [ "location", "stationary", "activity" ] */ name: HeadlessTaskEventName; /** Event parameters. */ params: any; } export interface BackgroundGeolocationPlugin { DISTANCE_FILTER_PROVIDER: LocationProvider; ACTIVITY_PROVIDER: LocationProvider; RAW_PROVIDER: LocationProvider; BACKGROUND_MODE: ServiceMode; FOREGROUND_MODE: ServiceMode; NOT_AUTHORIZED: AuthorizationStatus; AUTHORIZED: AuthorizationStatus; AUTHORIZED_FOREGROUND: AuthorizationStatus; HIGH_ACCURACY: AccuracyLevel; MEDIUM_ACCURACY: AccuracyLevel; LOW_ACCURACY: AccuracyLevel; PASSIVE_ACCURACY: AccuracyLevel; LOG_ERROR: LogLevel; LOG_WARN: LogLevel; LOG_INFO: LogLevel; LOG_DEBUG: LogLevel; LOG_TRACE: LogLevel; PERMISSION_DENIED: LocationErrorCode; LOCATION_UNAVAILABLE: LocationErrorCode; TIMEOUT: LocationErrorCode; events: Event[]; /** * Configure plugin. * Platform: iOS, Android * * @param options * @param success * @param fail */ configure( options: ConfigureOptions, success?: () => void, fail?: () => void ): void; /** * Start background geolocation. * Platform: iOS, Android */ start(): void; /** * Stop background geolocation. * Platform: iOS, Android */ stop(): void; /** * One time location check to get current location of the device. * * Platform: all * * @param success * @param fail * @param options */ getCurrentLocation( success: (location: Location) => void, fail?: (error: LocationError) => void | null, options?: LocationOptions ): void; /** * Returns current stationaryLocation if available. Null if not * * Platform: all * * @param success * @param fail */ getStationaryLocation( success: (location: StationaryLocation | null) => void, fail?: (error: BackgroundGeolocationError) => void, ): void; /** * Check status of the service * * @param success * @param fail */ checkStatus( success: (status: ServiceStatus) => void, fail?: (error: BackgroundGeolocationError) => void ): void; /** * Show app settings to allow change of app location permissions. * * Platform: Android >= 6, iOS >= 8.0 */ showAppSettings(): void; /** * Show system settings to allow configuration of current location sources. * * Platform: Android */ showLocationSettings(): void; /** * Return all stored locations. * Useful for initial rendering of user location on a map just after application launch. * * Platform: iOS, Android * * @param success * @param fail * @see {@link path_to_url#getlocationssuccess-fail|Docs} */ getLocations( success: (locations: Location[]) => void, fail?: (error: BackgroundGeolocationError) => void ): void; /** * Method will return locations which have not yet been posted to server. * Platform: iOS, Android * @param success * @param fail * @see {@link path_to_url#getvalidlocationssuccess-fail|Docs} */ getValidLocations( success: (location: Location[]) => void, fail?: (error: BackgroundGeolocationError) => void ): void; /** * Delete location by locationId. * * Platform: iOS, Android * * @param locationId * @param success * @param fail */ deleteLocation( locationId: number, success?: () => void, fail?: (error: BackgroundGeolocationError) => void ): void; /** * Delete all stored locations. * * Platform: iOS, Android * * Note: You don't need to delete all locations. * The plugin manages the number of stored locations automatically and the total count never exceeds the number as defined by <code>option.maxLocations</code>. * * @param success * @param fail */ deleteAllLocations( success?: () => void, fail?: (error: BackgroundGeolocationError) => void ): void; /** * Switch plugin operation mode, * * Platform: iOS * * Normally the plugin will handle switching between <b>BACKGROUND</b> and <b>FOREGROUND</b> mode itself. * Calling <code>switchMode</code> you can override plugin behavior and force it to switch into other mode. * * @example * // switch to FOREGROUND mode * BackgroundGeolocation.switchMode(BackgroundGeolocation.FOREGROUND_MODE); * * // switch to BACKGROUND mode * BackgroundGeolocation.switchMode(BackgroundGeolocation.BACKGROUND_MODE); */ switchMode( modeId: ServiceMode, success?: () => void, fail?: (error: BackgroundGeolocationError) => void ): void; /** * Force sync of pending locations. * Option <code>syncThreshold</code> will be ignored and all pending locations will be immediately posted to <code>syncUrl</code> in single batch. * * Platform: Android, iOS * * @param success * @param fail */ forceSync( success?: () => void, fail?: (error: BackgroundGeolocationError) => void ): void; /** * Get stored configuration options. * * @param success * @param fail */ getConfig( success: (options: ConfigureOptions) => void, fail?: (error: BackgroundGeolocationError) => void ): void; /** * Return all logged events. Useful for plugin debugging. * * Platform: Android, iOS * * @param limit Limits number of returned entries. * @param fromId Return entries after <code>fromId</code>. Useful if you plan to implement infinite log scrolling * @param minLevel Available levels: ["TRACE", "DEBUG", "INFO", "WARN", "ERROR"] * @param success * @param fail */ getLogEntries( limit: number, fromId: number, minLevel: LogLevel, success: (entries: LogEntry[]) => void, fail?: (error: BackgroundGeolocationError) => void ): void; /** * Unregister all event listeners for given event. * * If parameter <code>event</code> is not provided then all event listeners will be removed. * * @param event */ removeAllListeners(event?: Event): void; /** * Start background task (iOS only) * * To perform any long running operation on iOS * you need to create background task * IMPORTANT: task has to be ended by endTask * * @param success * @param fail */ startTask( success: (taskKey: number) => void, fail?: (error: BackgroundGeolocationError) => void ): void; /** * End background task indentified by taskKey (iOS only) * * @param taskKey * @param success * @param fail */ endTask( taskKey: number, success?: () => void, fail?: (error: BackgroundGeolocationError) => void ): void; /** * A special task that gets executed when the app is terminated, but * the plugin was configured to continue running in the background * (option <code>stopOnTerminate: false</code>). * * In this scenario the Activity was killed by the system and all registered * event listeners will not be triggered until the app is relaunched. * * @example * BackgroundGeolocation.headlessTask(function(event) { * * if (event.name === 'location' || event.name === 'stationary') { * var xhr = new XMLHttpRequest(); * xhr.open('POST', 'path_to_url * xhr.setRequestHeader('Content-Type', 'application/json'); * xhr.send(JSON.stringify(event.params)); * } * * return 'Processing event: ' + event.name; // will be logged * }); */ headlessTask( task: (event: HeadlessTaskEvent) => void ): void; /** * Register location event listener. * * @param eventName * @param callback */ on( eventName: 'location', callback: (location: Location) => void ): void; /** * Register stationary location event listener. * * @param eventName * @param callback */ on( eventName: 'stationary', callback: (location: StationaryLocation) => void ): void; /** * Register activity monitoring listener. * * @param eventName * @param callback */ on( eventName: 'activity', callback: (activity: Activity) => void ): void; /** * Register start event listener. * * Event is triggered when background service has been started succesfully. * * @param eventName * @param callback */ on( eventName: 'start', callback: () => void ): void; /** * Register stop event listener. * * Triggered when background service has been stopped succesfully. * * @param eventName * @param callback */ on( eventName: 'stop', callback: () => void ): void; /** * Register error listener. * * @param eventName * @param callback */ on( eventName: 'error', callback: (error: BackgroundGeolocationError) => void ): void; /** * Register authorization listener. * * Triggered when user changes authorization/permissions for * the app or toggles location services. * * @param eventName * @param callback */ on( eventName: 'authorization', callback: (status: AuthorizationStatus) => void ): void; /** * Register foreground event listener. * * Triggered when app entered foreground state and (visible to the user). * * @param eventName * @param callback */ on( eventName: 'foreground', callback: () => void ): void; /** * Register background event listener. * * Triggered when app entered background state and (not visible to the user). * * @param eventName * @param callback */ on( eventName: 'background', callback: () => void ): void; /** * Register abort_requested event listener. * * Triggered when server responded with "<code>285 Updates Not Required</code>" to post/sync request. * * @param eventName * @param callback */ on( eventName: 'abort_requested', callback: () => void ): void; /** * Register http_authorization event listener. * * Triggered when server responded with "<code>401 Unauthorized</code>" to post/sync request. * * @param eventName * @param callback */ on( eventName: 'http_authorization', callback: () => void ): void; } declare const BackgroundGeolocation: BackgroundGeolocationPlugin; export default BackgroundGeolocation; ```
/content/code_sandbox/index.d.ts
xml
2016-05-31T22:09:08
2024-08-16T08:47:22
react-native-background-geolocation
mauron85/react-native-background-geolocation
1,326
5,192
```xml // See LICENSE in the project root for license information. export { RushRedisCobuildPlugin as default, type IRushRedisCobuildPluginOptions } from './RushRedisCobuildPlugin'; export { RedisCobuildLockProvider } from './RedisCobuildLockProvider'; export type { IRedisCobuildLockProviderOptions } from './RedisCobuildLockProvider'; ```
/content/code_sandbox/rush-plugins/rush-redis-cobuild-plugin/src/index.ts
xml
2016-09-30T00:28:20
2024-08-16T18:54:35
rushstack
microsoft/rushstack
5,790
85
```xml import { loadTestableCollectionFromDocsAsync } from "../services/backendRequests"; import { stateAndDispatch } from "../state"; import * as Actions from "../state/actions"; const files = [ "/teachertool/validator-plans.json", // target-specific catalog "/teachertool/validator-plans-shared.json", // shared across all targets ]; export async function loadValidatorPlansAsync() { const { dispatch } = stateAndDispatch(); const plans = await loadTestableCollectionFromDocsAsync<pxt.blocks.ValidatorPlan>(files, "validatorPlans"); dispatch(Actions.setValidatorPlans(plans)); } ```
/content/code_sandbox/teachertool/src/transforms/loadValidatorPlansAsync.ts
xml
2016-01-24T19:35:52
2024-08-16T16:39:39
pxt
microsoft/pxt
2,069
133
```xml import * as R from 'ramda'; import { RouteComponentProps } from 'react-router'; import { DeepPartial } from 'redux'; export function makeRouterMockProps<P>( params: P, defaultProps: DeepPartial<RouteComponentProps<P, {}>> = {} ): RouteComponentProps<P, {}> { const mockProps: RouteComponentProps<P, {}> = R.mergeDeepRight( { location: { pathname: 'Pathname', search: 'Search', state: 'LocationState', key: 'LocationKey', hash: 'hash', }, history: { listen: jest.fn(), location: { pathname: 'pathname', search: '', state: '', key: '', hash: '', }, push: jest.fn(), }, match: { params, isExact: false, url: '', path: '', }, staticContext: {} as any, }, defaultProps ) as any; return mockProps; } ```
/content/code_sandbox/webapp/client/src/shared/utils/tests/react/routeComponentProps.ts
xml
2016-10-19T01:07:26
2024-08-14T03:53:55
modeldb
VertaAI/modeldb
1,689
218
```xml import { css } from '@microsoft/fast-element'; import { baseButtonStyles } from '../button/button.styles.js'; import { forcedColorsStylesheetBehavior } from '../utils/index.js'; // Need to support icon hover styles export const styles = css` ${baseButtonStyles} ::slotted(a) { position: absolute; inset: 0; } `.withBehaviors( forcedColorsStylesheetBehavior(css` :host { border-color: LinkText; color: LinkText; } `), ); ```
/content/code_sandbox/packages/web-components/src/anchor-button/anchor-button.styles.ts
xml
2016-06-06T15:03:44
2024-08-16T18:49:29
fluentui
microsoft/fluentui
18,221
115
```xml import type { TagAppearance, TagSize } from '@fluentui/react-tags/src/index'; import type { TagPickerSize } from '../TagPicker'; import { ComboboxBaseProps } from '@fluentui/react-combobox'; export function tagPickerSizeToTagSize(size: TagPickerSize): TagSize { switch (size) { case 'medium': return 'extra-small'; case 'large': return 'small'; case 'extra-large': return 'medium'; default: return 'extra-small'; } } export function tagSizeToTagPickerSize(size: TagSize): TagPickerSize { switch (size) { case 'extra-small': return 'medium'; case 'small': return 'large'; case 'medium': return 'extra-large'; default: return 'medium'; } } export function tagPickerAppearanceToTagAppearance(appearance: ComboboxBaseProps['appearance']): TagAppearance { switch (appearance) { case 'filled-darker': return 'outline'; default: return 'filled'; } } ```
/content/code_sandbox/packages/react-components/react-tag-picker/library/src/utils/tagPicker2Tag.ts
xml
2016-06-06T15:03:44
2024-08-16T18:49:29
fluentui
microsoft/fluentui
18,221
232
```xml <LinearLayout xmlns:android="path_to_url" xmlns:app="path_to_url" xmlns:tools="path_to_url" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context=".activity.PreviewActivity"> <androidx.viewpager.widget.ViewPager android:id="@+id/viewpager" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" app:layout_behavior="@string/appbar_scrolling_view_behavior"> <com.google.android.material.tabs.TabLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="top" app:tabIndicator="@drawable/tab_indicator" app:tabTextAppearance="@style/TabLayoutCustomStyle" /> </androidx.viewpager.widget.ViewPager> <TextView android:id="@+id/info" android:layout_width="match_parent" android:layout_height="40dp" android:layout_gravity="center_horizontal" android:background="@color/colorAccent" android:gravity="center" android:text="@string/swipe_to_view_next" android:textColor="@color/white" /> </LinearLayout> ```
/content/code_sandbox/app/src/main/res/layout/activity_preview_images.xml
xml
2016-02-22T10:00:46
2024-08-16T15:37:50
Images-to-PDF
Swati4star/Images-to-PDF
1,174
275
```xml import { btoa } from "abab"; const getContactHref = (name: string, contact: string) => { const hrefs: { [key: string]: string } = { email: btoa(contact) || "", line: `line://ti/p/${contact}`, telegram: `path_to_url{contact}`, vkontakte: `path_to_url{contact}`, medium: `path_to_url{contact}`, github: `path_to_url{contact}`, weibo: `path_to_url{contact}`, gitlab: `path_to_url{contact}`, codepen: `path_to_url{contact}`, twitter: `path_to_url{contact}`, soundcloud: `path_to_url{contact}`, facebook: `path_to_url{contact}`, instagram: `path_to_url{contact}`, linkedin: `path_to_url{contact}`, youtube: `path_to_url{contact}`, mastodon: `${contact}`, bluesky: `path_to_url{contact}.bsky.social`, }; return hrefs[name] ?? contact; }; export default getContactHref; ```
/content/code_sandbox/src/utils/get-contact-href.ts
xml
2016-03-11T21:02:37
2024-08-15T23:09:27
gatsby-starter-lumen
alxshelepenok/gatsby-starter-lumen
1,987
239
```xml <?xml version="1.0" encoding="utf-8"?> <asmdudedata> <info>General info here</info> <userdefined> <userdefined1 name="MY_MACRO_A1"> <description>BLAH 1</description> </userdefined1> <userdefined1 name="MY_MACRO_A2"> <description>BLAH 2</description> </userdefined1> <userdefined2 name="MY_MACRO_B1"> <description>BLAH 3</description> </userdefined2> <userdefined3 name="MY_MACRO_C1" /> </userdefined> <miscs> <misc name="Z" arch="AVX512VL"> <description>Zero Mask {Z}</description> </misc> <misc name="SAE" arch="AVX512VL"> <description>Suppress all Exceptions {SAE}</description> </misc> <misc name="RN-SAE" arch="AVX512VL"> <description>Rounding Mode: round nearest even {RN-SAE}</description> </misc> <misc name="RU-SAE" arch="AVX512VL"> <description>Rounding Mode: round up {RU-SAE}</description> </misc> <misc name="RD-SAE" arch="AVX512VL"> <description>Rounding Mode: round down {RD-SAE}</description> </misc> <misc name="RZ-SAE" arch="AVX512VL"> <description>Rounding Mode: truncate / round to zero {RZ-SAE}</description> </misc> <misc name="1TO16" arch="AVX512VL"> <description>Broadcast 1 to 16 {1TO16}</description> </misc> <misc name="1TO8" arch="AVX512VL"> <description>Broadcast 1 to 8 {1TO8}</description> </misc> <misc name="1TO4" arch="AVX512VL"> <description>Broadcast 1 to 4 {1TO4}</description> </misc> </miscs> <directives> <directive name="ADDR" tool="MASM"> <description>Operator used exclusively with INVOKE to pass the address of a variable to a procedure.</description> </directive> <directive name="OFFSET" tool="MASM"> <description>Returns the address of a variable.</description> </directive> <directive name="PTR" tool="MASM"> <description>Specifies a type for a memory address.</description> </directive> <directive name="DB" tool="MASM, NASM"> <description>Pseudo-Instruction declaring initialized data. Byte (1 byte, 8 bit). DB is a synonym of BYTE</description> </directive> <directive name="DW" tool="MASM, NASM"> <description>Pseudo-Instruction declaring initialized data. Word, Half Precision (2 bytes, 16 bit). DW is a synonym of WORD.</description> </directive> <directive name="DD" tool="MASM, NASM"> <description>Pseudo-Instruction declaring initialized data. Double Word, Single Precision (4 bytes, 32 bit). DD is a synonym of DWORD.</description> </directive> <directive name="DF" tool="MASM"> <description>Pseudo-Instruction declaring initialized data. (6 bytes, 48 bit). DF is a synonym of FWORD.</description> </directive> <directive name="DQ" tool="MASM, NASM"> <description>Pseudo-Instruction declaring initialized data. Quad word, Double Precision (8 bytes, 64 bit). DQ is a synonym of QWORD.</description> </directive> <directive name="DT" tool="MASM, NASM"> <description>Pseudo-Instruction declaring initialized data. Extended (Double) Precision (10 bytes, 80 bit). DT is a synonym of TBYTE.</description> </directive> <directive name="DO" tool="MASM, NASM"> <description>Pseudo-Instruction declaring initialized data. IEEE 754-2008 Quad Precision (16 bytes, 128 bit), DO is a synonym of OWORD.</description> </directive> <directive name="DY" tool="MASM, NASM"> <description>Pseudo-Instruction declaring initialized data. (32 bytes, 256 bit). DY is a synonym of YWORD.</description> </directive> <directive name="DZ" tool="MASM, NASM"> <description>Pseudo-Instruction declaring initialized data. (64 bytes, 512 bit). DZ is a synonym of ZWORD.</description> </directive> <directive name="RESB" tool="MASM, NASM"> <description>Pseudo-Instruction declaring uninitialized data. Byte (1 byte, 8 bit). RESB is a synonym of BYTE</description> </directive> <directive name="RESW" tool="MASM, NASM"> <description>Pseudo-Instruction declaring uninitialized data. Word, Half Precision (2 bytes, 16 bit). RESW is a synonym of WORD.</description> </directive> <directive name="RESD" tool="MASM, NASM"> <description>Pseudo-Instruction declaring uninitialized data. Double Word, Single Precision (4 bytes, 32 bit). RESD is a synonym of DWORD.</description> </directive> <directive name="RESQ" tool="MASM, NASM"> <description>Pseudo-Instruction declaring uninitialized data. Quad word, Double Precision (8 bytes, 64 bit). RESQ is a synonym of QWORD.</description> </directive> <directive name="REST" tool="MASM, NASM"> <description>Pseudo-Instruction declaring uninitialized data. Extended (Double) Precision (10 bytes, 80 bit). REST is a synonym of TBYTE.</description> </directive> <directive name="RESO" tool="MASM, NASM"> <description>Pseudo-Instruction declaring uninitialized data. IEEE 754-2008 Quad Precision (16 bytes, 128 bit), RESO is a synonym of OWORD.</description> </directive> <directive name="RESY" tool="MASM, NASM"> <description>Pseudo-Instruction declaring uninitialized data. (32 bytes, 256 bit). RESY is a synonym of YWORD.</description> </directive> <directive name="RESZ" tool="MASM, NASM"> <description>Pseudo-Instruction declaring uninitialized data. (64 bytes, 512 bit). RESZ is a synonym of ZWORD.</description> </directive> <directive name="BOOLEAN" tool="MASM"> <description>Boolean</description> </directive> <directive name="HWND" tool="MASM"> <description>A handle to a window</description> </directive> <directive name="BYTE" tool="NASM, MASM"> <description>Pseudo-Instruction declaring uninitialized data. Byte (1 byte, 8 bit)</description> </directive> <directive name="SBYTE" tool="NASM, MASM"> <description>Pseudo-Instruction declaring uninitialized data. Signed Byte (1 byte, 8 bit)</description> </directive> <directive name="WORD" tool="NASM, MASM"> <description>Pseudo-Instruction declaring uninitialized data. Word, Half Precision (2 bytes, 16 bit)</description> </directive> <directive name="SWORD" tool="NASM, MASM"> <description>Pseudo-Instruction declaring uninitialized data. Signed Word, Half Precision (2 bytes, 16 bit)</description> </directive> <directive name="DWORD" tool="NASM, MASM"> <description>Pseudo-Instruction declaring uninitialized data. Double Word, Single Precision (4 bytes, 32 bit)</description> </directive> <directive name="SDWORD" tool="NASM, MASM"> <description>Pseudo-Instruction declaring uninitialized data. Signed Double Word, Single Precision (4 bytes, 32 bit)</description> </directive> <directive name="FWORD" tool="MASM"> <description>Pseudo-Instruction declaring uninitialized data. (6 bytes, 48 bit).</description> </directive> <directive name="QWORD" tool="NASM, MASM"> <description>Pseudo-Instruction declaring uninitialized data. Quad word, Double Precision (8 bytes, 64 bit)</description> </directive> <directive name="MMWORD" tool="NASM, MASM"> <description>Pseudo-Instruction declaring uninitialized data. Quad word, Double Precision (8 bytes, 64 bit)</description> </directive> <directive name="TWORD" tool="NASM, MASM"> <description>Pseudo-Instruction declaring uninitialized data. Extended (Double) Precision (10 bytes, 80 bit)</description> </directive> <directive name="XMMWORD" tool="NASM, MASM"> <description>Pseudo-Instruction declaring uninitialized data. (16 bytes, 128 bit)</description> </directive> <directive name="OWORD" tool="NASM, MASM"> <description>Pseudo-Instruction declaring uninitialized data. IEEE 754-2008 Quad Precision (16 bytes, 128 bit)</description> </directive> <directive name="YMMWORD" tool="NASM, MASM"> <description>Pseudo-Instruction declaring uninitialized data. (32 bytes, 256 bit)</description> </directive> <directive name="YWORD" tool="NASM, MASM"> <description>Pseudo-Instruction declaring uninitialized data. (32 bytes, 256 bit)</description> </directive> <directive name="ZMMWORD" tool="NASM, MASM"> <description>Pseudo-Instruction declaring uninitialized data. (64 bytes, 512 bit)</description> </directive> <directive name="ZWORD" tool="NASM, MASM"> <description>Pseudo-Instruction declaring uninitialized data. (64 bytes, 512 bit)</description> </directive> <directive name="REAL4" tool="MASM"> <description>Allocates and optionally initializes a single-precision (4-byte) floating-point number for each initializer.</description> </directive> <directive name="REAL8" tool="MASM"> <description>Allocates and optionally initializes a double-precision (8-byte) floating-point number for each initializer.</description> </directive> <directive name="REAL10" tool="MASM"> <description>Allocates and optionally initializes a 10-byte floating-point number for each initializer.</description> </directive> <directive name="TBYTE" tool="MASM"> <description>Allocates and optionally initializes 10 bytes of storage for each initializer. Can also be used as a type specifier anywhere a type is legal.</description> </directive> <directive name="STRICT" tool="MASM"> <description>TODO.</description> </directive> <directive name=".ALLOCSTACK" tool="MASM"> <description>MASM64: Generates a UWOP_ALLOC_SMALL or a UWOP_ALLOC_LARGE with the specified size for the current offset in the prologue.</description> </directive> <directive name=".ENDPROLOG" tool="MASM"> <description>MASM64: Signals the end of the prologue declarations.</description> </directive> <directive name=".PUSHFRAME" tool="MASM"> <description>MASM64: Generates a UWOP_PUSH_MACHFRAME unwind code entry. If the optional code is specified, the unwind code entry is given a modifier of 1. Otherwise the modifier is 0.</description> </directive> <directive name=".PUSHREG" tool="MASM"> <description>MASM64: Generates a UWOP_PUSH_NONVOL unwind code entry for the specified register number using the current offset in the prologue.</description> </directive> <directive name=".SAVEREG" tool="MASM"> <description>MASM64: Generates either a UWOP_SAVE_NONVOL or a UWOP_SAVE_NONVOL_FAR unwind code entry for the specified register (reg) and offset (offset) using the current prologue offset. MASM will choose the most efficient encoding.</description> </directive> <directive name=".SAVEXMM128" tool="MASM"> <description>MASM64: Generates either a UWOP_SAVE_XMM128 or a UWOP_SAVE_XMM128_FAR unwind code entry for the specified XMM register and offset using the current prologue offset. MASM will choose the most efficient encoding.</description> </directive> <directive name=".SETFRAME" tool="MASM"> <description>MASM64: Fills in the frame register field and offset in the unwind information using the specified register (reg) and offset (offset). The offset must be a multiple of 16 and less than or equal to 240. This directive also generates a UWOP_SET_FPREG unwind code entry for the specified register using the current prologue offset.</description> </directive> <directive name="ALIGN" tool="MASM"> <description>Aligns the next variable or instruction on a byte that is a multiple of number.</description> </directive> <directive name="EVEN" tool="MASM"> <description>Aligns the next variable or instruction on an even byte.</description> </directive> <directive name="LABEL" tool="MASM"> <description>Creates a new label by assigning the current location-counter value and the given type to name.</description> </directive> <directive name="ORG" tool="MASM"> <description>Sets the location counter to expression.</description> </directive> <directive name="ELSE" tool="MASM"> <description>Marks the beginning of an alternate block within a conditional block.</description> </directive> <directive name="ELSEIF" tool="MASM"> <description>Combines ELSE and IF into one statement.</description> </directive> <directive name="ELSEIF2" tool="MASM"> <description>ELSEIF block evaluated on every assembly pass if OPTION:SETIF2 is TRUE.</description> </directive> <directive name="IF" tool="MASM"> <description>Grants assembly of ifstatements if expression1 is true (nonzero) or elseifstatements if expression1 is false (0) and expression2 is true.</description> </directive> <directive name="IF2" tool="MASM"> <description>IF block is evaluated on every assembly pass if OPTION:SETIF2 is TRUE.</description> </directive> <directive name="IFNB" tool="MASM"> <description>Grants assembly if textitem is not blank.</description> </directive> <directive name="IFB" tool="MASM"> <description>Grants assembly if textitem is blank.</description> </directive> <directive name="IFDEF" tool="MASM"> <description>Grants assembly if name is a previously defined label, variable, or symbol.</description> </directive> <directive name="IFNDEF" tool="MASM"> <description>Grants assembly if name has not been defined.</description> </directive> <directive name="IFDIF" tool="MASM"> <description>Grants assembly if the text items are different.</description> </directive> <directive name="IFE" tool="MASM"> <description>Grants assembly if expression is false (0).</description> </directive> <directive name="IFIDN" tool="MASM"> <description>Grants assembly if the text items are identical.</description> </directive> <directive name="ENDIF" tool="MASM"> <description>MASM:</description> </directive> <directive name="ALIAS" tool="MASM"> <description>The ALIAS directive creates an alternate name for a function.</description> </directive> <directive name=".BREAK" tool="MASM"> <description>Generates code to terminate a .WHILE or .REPEAT block if condition is true.</description> </directive> <directive name=".CONTINUE" tool="MASM"> <description>Generates code to jump to the top of a .WHILE or .REPEAT block if condition is true.</description> </directive> <directive name=".ELSE" tool="MASM"> <description>Generates code to jump to the top of a .WHILE or .REPEAT block if condition is false.</description> </directive> <directive name=".ELSIF" tool="MASM"> <description>Generates code that tests condition1 (for example, AX > 7) and executes the statements if that condition is true.</description> </directive> <directive name=".ELSEIF" tool="MASM"> <description>Generates code that tests condition1 (for example, AX > 7) and executes the statements if that condition is true.</description> </directive> <directive name=".ENDIF" tool="MASM"> <description>MASM:</description> </directive> <directive name=".ENDW" tool="MASM"> <description>MASM:</description> </directive> <directive name=".IF" tool="MASM"> <description>Generates code that tests condition1 (for example, AX > 7) and executes the statements if that condition is true.</description> </directive> <directive name=".REPEAT" tool="MASM"> <description>Generates code that repeats execution of the block of statements until condition becomes true. .UNTILCXZ, which becomes true when CX is zero, may be substituted for .UNTIL. The condition is optional with .UNTILCXZ.</description> </directive> <directive name=".UNTIL" tool="MASM"> <description>Generates code that repeats execution of the block of statements until condition becomes true. .UNTILCXZ, which becomes true when CX is zero, may be substituted for .UNTIL. The condition is optional with .UNTILCXZ.</description> </directive> <directive name=".UNTILCXZ" tool="MASM"> <description>Generates code that repeats execution of the block of statements until condition becomes true. .UNTILCXZ, which becomes true when CX is zero, may be substituted for .UNTIL. The condition is optional with .UNTILCXZ.</description> </directive> <directive name=".WHILE" tool="MASM"> <description>Generates code that executes the block of statements while condition remains true.</description> </directive> <directive name=".ERR" tool="MASM"> <description>Generates an error.</description> </directive> <directive name=".ERR2" tool="MASM"> <description>.ERR block evaluated on every assembly pass if OPTION:SETIF2 is TRUE.</description> </directive> <directive name=".ERRB" tool="MASM"> <description>Generates an error if textitem is blank.</description> </directive> <directive name=".ERRDEF" tool="MASM"> <description>Generates an error if name is a previously defined label, variable, or symbol.</description> </directive> <directive name=".ERRDIF" tool="MASM"> <description>Generates an error if the text items are different.</description> </directive> <directive name=".ERRE" tool="MASM"> <description>Generates an error if expression is false (0).</description> </directive> <directive name=".ERRIDN" tool="MASM"> <description>Generates an error if the text items are identical.</description> </directive> <directive name=".ERRNB" tool="MASM"> <description>Generates an error if textitem is not blank.</description> </directive> <directive name=".ERRNDEF" tool="MASM"> <description>Generates an error if name has not been defined.</description> </directive> <directive name=".ERRNZ" tool="MASM"> <description>Generates an error if expression is true (nonzero).</description> </directive> <directive name="EQU" tool="MASM, NASM"> <description>EQU defines a symbol to a given constant value: when EQU is used, the source line must contain a label. The action of EQU is to define the given label name to the value of its (only) operand. This definition is absolute, and cannot change later.</description> </directive> <directive name="TEXTEQU" tool="MASM"> <description>Assigns textitem to name. The textitem can be a literal string, a constant preceded by a %, or the string returned by a macro function.</description> </directive> <directive name=".CREF" tool="MASM"> <description>Enables listing of symbols in the symbol portion of the symbol table and browser file.</description> </directive> <directive name=".LIST" tool="MASM"> <description>Starts listing of statements.</description> </directive> <directive name=".LISTALL" tool="MASM"> <description>Starts listing of all statements.</description> </directive> <directive name=".LISTIF" tool="MASM"> <description>Starts listing of statements in false conditional blocks.</description> </directive> <directive name=".LISTMACRO" tool="MASM"> <description>Starts listing of macro expansion statements that generate code or data.</description> </directive> <directive name=".LISTMACROALL" tool="MASM"> <description>Starts listing of all statements in macros.</description> </directive> <directive name=".NOCREF" tool="MASM"> <description>Suppresses listing of symbols in the symbol table and browser file.</description> </directive> <directive name="PAGE" tool="MASM"> <description>The first directive sets line length and character width of the program listing. If no arguments are given, generates a page break. The second directive increments the section number and resets the page number to 1.</description> </directive> <directive name="SUBTITLE" tool="MASM"> <description>Defines the listing subtitle. Same as SUBTTL.</description> </directive> <directive name=".TFCOND" tool="MASM"> <description>Toggles listing of false conditional blocks.</description> </directive> <directive name="TITLE" tool="MASM"> <description>Defines the program listing title.</description> </directive> <directive name="ENDM" tool="MASM"> <description>Terminates a macro or repeat block.</description> </directive> <directive name="EXITM" tool="MASM"> <description>Terminates expansion of the current repeat or macro block and begins assembly of the next statement outside the block.</description> </directive> <directive name="GOTO" tool="MASM"> <description>Transfers assembly to the line marked :macrolabel.</description> </directive> <directive name="LOCAL" tool="MASM"> <description>In the first directive, within a macro, LOCAL defines labels that are unique to each instance of the macro.</description> </directive> <directive name="MACRO" tool="MASM"> <description>Marks a macro block called name and establishes parameter placeholders for arguments passed when the macro is called.</description> </directive> <directive name="PURGE" tool="MASM"> <description>Deletes the specified macros from memory.</description> </directive> <directive name="ASSUME" tool="MASM"> <description>Enables error checking for register values.</description> </directive> <directive name="COMMENT" tool="MASM"> <description>Treats all text between or on the same line as the delimiters as a comment.</description> </directive> <directive name="ECHO" tool="MASM"> <description>Displays message to the standard output device (by default, the screen).</description> </directive> <directive name="END" tool="MASM"> <description>Marks the end of a module and, optionally, sets the program entry point to address.</description> </directive> <directive name=".FPO" tool="MASM"> <description>The .FPO directive controls the emission of debug records to the .debug$F segment or section.</description> </directive> <directive name="INCLUDE" tool="MASM,NASM"> <description>Inserts source code from the source file given by filename into the current source file during assembly.</description> </directive> <directive name="INCLUDELIB" tool="MASM"> <description>Informs the linker that the current module should be linked with libraryname.</description> </directive> <directive name="OPTION" tool="MASM"> <description>Enables and disables features of the assembler.</description> </directive> <directive name="POPCONTEXT" tool="MASM"> <description>Restores part or all of the current context (saved by the PUSHCONTEXT directive). The context can be ASSUMES, RADIX, LISTING, CPU, or ALL.</description> </directive> <directive name="PUSHCONTEXT" tool="MASM"> <description>Saves part or all of the current context: segment register assumes, radix value, listing and cref flags, or processor/coprocessor values. The context can be ASSUMES, RADIX, LISTING, CPU, or ALL.</description> </directive> <directive name=".RADIX" tool="MASM"> <description>Sets the default radix, in the range 2 to 16, to the value of expression.</description> </directive> <directive name=".SAFESEH" tool="MASM"> <description>Registers a function as a structured exception handler.</description> </directive> <directive name="ENDP" tool="MASM"> <description>Marks the end of procedure name previously begun with PROC.</description> </directive> <directive name="INVOKE" tool="MASM"> <description>Calls the procedure at the address given by expression, passing the arguments on the stack or in registers according to the standard calling conventions of the language type.</description> </directive> <directive name="PROC" tool="MASM"> <description>Marks start and end of a procedure block called label. The statements in the block can be called with the CALL instruction or INVOKE directive.</description> </directive> <directive name="PROTO" tool="MASM"> <description>Prototypes a function.</description> </directive> <directive name=".386" tool="MASM"> <description>Enables assembly of nonprivileged instructions for the 80386 processor; disables assembly of instructions introduced with later processors.</description> </directive> <directive name=".386P" tool="MASM"> <description>Enables assembly of all instructions (including privileged) for the 80386 processor; disables assembly of instructions introduced with later processors.</description> </directive> <directive name=".387" tool="MASM"> <description>Enables assembly of instructions for the 80387 coprocessor.</description> </directive> <directive name=".486" tool="MASM"> <description>Enables assembly of nonprivileged instructions for the 80486 processor.</description> </directive> <directive name=".486P" tool="MASM"> <description>Enables assembly of all instructions (including privileged) for the 80486 processor.</description> </directive> <directive name=".586" tool="MASM"> <description>Enables assembly of nonprivileged instructions for the Pentium processor.</description> </directive> <directive name=".586P" tool="MASM"> <description>Enables assembly of all instructions (including privileged) for the Pentium processor.</description> </directive> <directive name=".686" tool="MASM"> <description>Enables assembly of nonprivileged instructions for the Pentium Pro processor.</description> </directive> <directive name=".686P" tool="MASM"> <description>Enables assembly of all instructions (including privileged) for the Pentium Pro processor.</description> </directive> <directive name=".K3D" tool="MASM"> <description>Enables assembly of K3D instructions.</description> </directive> <directive name=".MMX" tool="MASM"> <description>Enables assembly of MMX or single-instruction, multiple data (SIMD) instructions.</description> </directive> <directive name=".XMM" tool="MASM"> <description>Enables assembly of Internet Streaming SIMD Extension instructions.</description> </directive> <directive name="FOR" tool="MASM"> <description>Marks a block that will be repeated once for each argument, with the current argument replacing parameter on each repetition.</description> </directive> <directive name="FORC" tool="MASM"> <description>Marks a block that will be repeated once for each character in string, with the current character replacing parameter on each repetition.</description> </directive> <directive name="COMM" tool="MASM"> <description>Creates a communal variable with the attributes specified in definition.</description> </directive> <directive name="EXTRN" tool="MASM"> <description>Defines one or more external variables, labels, or symbols called name whose type is type.</description> </directive> <directive name="EXTERN" tool="MASM"> <description>Defines one or more external variables, labels, or symbols called name whose type is type.</description> </directive> <directive name="EXTERNDEF" tool="MASM"> <description>Defines one or more external variables, labels, or symbols called name whose type is type.</description> </directive> <directive name="PUBLIC" tool="MASM"> <description>Makes each variable, label, or absolute symbol specified as name available to all other modules in the program.</description> </directive> <directive name=".ALPHA" tool="MASM"> <description>Orders segments alphabetically.</description> </directive> <directive name=".DOSSEG" tool="MASM"> <description>Orders the segments according to the MS-DOS segment convention: CODE first, then segments not in DGROUP, and then segments in DGROUP.</description> </directive> <directive name="ENDS" tool="MASM"> <description>Marks the end of segment, structure, or union name previously begun with SEGMENT, STRUCT, UNION, or a simplified segment directive.</description> </directive> <directive name="GROUP" tool="MASM"> <description>Add the specified segments to the group called name.</description> </directive> <directive name="SEGMENT" tool="MASM"> <description>Defines a program segment called name having segment attributes</description> </directive> <directive name=".SEQ" tool="MASM"> <description>Orders segments sequentially (the default order).</description> </directive> <directive name=".CODE" tool="MASM"> <description>When used with .MODEL, indicates the start of a code segment.</description> </directive> <directive name=".CONST" tool="MASM"> <description>When used with .MODEL, starts a constant data segment (with segment name CONST).</description> </directive> <directive name=".DATA" tool="MASM"> <description>When used with .MODEL, starts a near data segment for initialized data (segment name _DATA).</description> </directive> <directive name=".DATA?" tool="MASM"> <description>When used with .MODEL, starts a near data segment for uninitialized data (segment name _BSS).</description> </directive> <directive name=".EXIT" tool="MASM"> <description>Generates termination code.</description> </directive> <directive name=".FARDATA" tool="MASM"> <description>When used with .MODEL, starts a far data segment for initialized data (segment name FAR_DATA or name).</description> </directive> <directive name=".FARDATA?" tool="MASM"> <description>When used with .MODEL, starts a far data segment for uninitialized data (segment name FAR_BSS or name).</description> </directive> <directive name=".MODEL" tool="MASM"> <description>Initializes the program memory model.</description> </directive> <directive name=".STACK" tool="MASM"> <description>When used with .MODEL, defines a stack segment (with segment name STACK). The optional size specifies the number of bytes for the stack (default 1,024). The .STACK directive automatically closes the stack statement.</description> </directive> <directive name=".STARTUP" tool="MASM"> <description>Generates program start-up code.</description> </directive> <directive name="CATSTR" tool="MASM"> <description>Concatenates text items.</description> </directive> <directive name="INSTR" tool="MASM"> <description>Finds the first occurrence of textitem2 in textitem1.</description> </directive> <directive name="SIZESTR" tool="MASM"> <description>Finds the size of a text item.</description> </directive> <directive name="SUBSTR" tool="MASM"> <description>Returns a substring of textitem, starting at position. The textitem can be a literal string, a constant preceded by a %, or the string returned by a macro function.</description> </directive> <directive name="RECORD" tool="MASM"> <description>Declares a record type consisting of the specified fields. fieldname names the field, width specifies the number of bits, and expression gives its initial value.</description> </directive> <directive name="STRUCT" tool="MASM"> <description>Declares a structure type having the specified fielddeclarations. Each field must be a valid data definition. Same as STRUC.</description> </directive> <directive name="TYPEDEF" tool="MASM"> <description>Defines a new type called name, which is equivalent to type.</description> </directive> <directive name="UNION" tool="MASM"> <description>Declares a union of one or more data types. The fielddeclarations must be valid data definitions. Omit the ENDS name label on nested UNION definitions.</description> </directive> <directive name=".LALL" tool="MASM"> <description>TODO</description> </directive> <directive name=".LFCOND" tool="MASM"> <description>TODO</description> </directive> <directive name=".NOLIST" tool="MASM"> <description>Suppresses program listing. Same as .XLIST</description> </directive> <directive name=".SALL" tool="MASM"> <description>Suppresses listing of macro expansions.</description> </directive> <directive name=".SFCOND" tool="MASM"> <description>Suppresses listing of conditional blocks whose condition evaluates to false (0).</description> </directive> <directive name=".XALL" tool="MASM"> <description>Starts listing of macro expansion statements that generate code or data.</description> </directive> <directive name=".XCREF" tool="MASM"> <description>Suppresses listing of symbols in the symbol table and browser file.</description> </directive> <directive name=".XLIST" tool="MASM"> <description>Suppresses program listing. Same as .NOLIST</description> </directive> <directive name="BITS" tool="NASM"> <description>TODO</description> </directive> <directive name="%DEFINE" tool="NASM"> <description>Define Single-line macros that is resolved at the time the embedded macro is expanded.</description> </directive> <directive name="%XDEFINE" tool="NASM"> <description>Define Single-line macros that is resolved at the time the embedded macro is defined.</description> </directive> <directive name="%IXDEFINE" tool="NASM"> <description>Define case-insensitive single-line macros that is resolved at the time the embedded macro is defined.</description> </directive> <directive name="%UNDEF" tool="NASM"> <description>Define Single-line macros can be removed with the %undef directive.</description> </directive> <directive name="%UNDEF" tool="NASM"> <description>Single-line macros can be removed with the %undef directive.</description> </directive> <directive name="%ASSIGN" tool="NASM"> <description>Define single-line macros.</description> </directive> <directive name="%IASSIGN" tool="NASM"> <description>Define case-insensitive single-line macros.</description> </directive> <directive name="%DEFSTR" tool="NASM"> <description>%defstr, and its case-insensitive counterpart %idefstr, define or redefine a single-line macro without parameters but converts the entire right-hand side, after macro expansion, to a quoted string before definition.</description> </directive> <directive name="%IDEFSTR" tool="NASM"> <description>%defstr, and its case-insensitive counterpart %idefstr, define or redefine a single-line macro without parameters but converts the entire right-hand side, after macro expansion, to a quoted string before definition.</description> </directive> <directive name="%DEFTOK" tool="NASM"> <description>%deftok, and its case-insensitive counterpart %ideftok, define or redefine a single-line macro without parameters but converts the second parameter, after string conversion, to a sequence of tokens.</description> </directive> <directive name="%IDEFTOK" tool="NASM"> <description>%deftok, and its case-insensitive counterpart %ideftok, define or redefine a single-line macro without parameters but converts the second parameter, after string conversion, to a sequence of tokens.</description> </directive> <directive name="%STRCAT" tool="NASM"> <description>The %strcat operator concatenates quoted strings and assign them to a single-line macro.</description> </directive> <directive name="%STRLEN" tool="NASM"> <description>The %strlen operator assigns the length of a string to a macro.</description> </directive> <directive name="%SUBSTR" tool="NASM"> <description>Individual letters or substrings in strings can be extracted using the %substr operator.</description> </directive> <directive name="%MACRO" tool="NASM"> <description>Start a multiline macro</description> </directive> <directive name="%ENDMACRO" tool="NASM"> <description>End a multiline macro, started with %macro.</description> </directive> <directive name="%UNMACRO" tool="NASM"> <description>Multi-line macros can be removed with the %unmacro directive. Unlike the %undef directive, however, %unmacro takes an argument specification, and will only remove exact matches with that argument specification.</description> </directive> <directive name="%IF" tool="NASM"> <description>Conditional Assembly.</description> </directive> <directive name="%ELIF" tool="NASM"> <description>Conditional Assembly.</description> </directive> <directive name="%ELSE" tool="NASM"> <description>Conditional Assembly.</description> </directive> <directive name="%ENDIF" tool="NASM"> <description>Conditional Assembly.</description> </directive> <directive name="%IFDEF" tool="NASM"> <description>Testing Single-Line Macro Existence.</description> </directive> <directive name="%IFMACRO" tool="NASM"> <description>Testing Multi-Line Macro Existence. The %ifmacro directive operates in the same way as the %ifdef directive, except that it checks for the existence of a multi-line macro.</description> </directive> <directive name="%IFCTX" tool="NASM"> <description>Testing the Context Stack. The %ifmacro directive operates in the same way as the %ifdef directive, except that it checks for the existence of a multi-line macro.</description> </directive> <directive name="%IFIDN" tool="NASM"> <description>Testing Exact Text Identity. The construct %ifidn text1,text2 will cause the subsequent code to be assembled if and only if text1 and text2, after expanding single-line macros, are identical pieces of text. Differences in white space are not counted.</description> </directive> <directive name="%IFIDNI" tool="NASM"> <description>Testing Exact Text Identity. The construct %ifidni text1,text2 will cause the subsequent code to be assembled if and only if text1 and text2, after expanding single-line macros, are identical pieces of text (case-insensitive). Differences in white space are not counted.</description> </directive> <directive name="%IFID" tool="NASM"> <description>Testing Token Types. The conditional assembly construct %ifid, taking one parameter (which may be blank), assembles the subsequent code if and only if the first token in the parameter exists and is an identifier.</description> </directive> <directive name="%IFNUM" tool="NASM"> <description>Testing Token Types. The conditional assembly construct %ifnum, taking one parameter (which may be blank), assembles the subsequent code if and only if the first token in the parameter exists and is a number.</description> </directive> <directive name="%IFSTR" tool="NASM"> <description>Testing Token Types. The conditional assembly construct %ifstr, taking one parameter (which may be blank), assembles the subsequent code if and only if the first token in the parameter exists and is a string.</description> </directive> <directive name="%IFTOKEN" tool="NASM"> <description>Test for a Single Token. The conditional assembly construct %iftoken assembles the subsequent code if and only if the expanded parameters consist of exactly one token, possibly surrounded by whitespace.</description> </directive> <directive name="%IFEMPTY" tool="NASM"> <description>Test for Empty Expansion. The conditional assembly construct %ifempty assembles the subsequent code if and only if the expanded parameters do not contain any tokens at all, whitespace excepted.</description> </directive> <directive name="%IFENV" tool="NASM"> <description>Test If Environment Variable Exists. The conditional assembly construct %ifenv assembles the subsequent code if and only if the environment variable referenced by the %!env directive exists.</description> </directive> <directive name="%REP" tool="NASM"> <description>The directives %rep and %endrep (%rep takes a numeric argument, which can be an expression; %endrep takes no arguments) can be used to enclose a chunk of code, which is then replicated as many times as specified by the preprocessor.</description> </directive> <directive name="%INCLUDE" tool="NASM"> <description>Inserts source code from the source file given by filename into the current source file during assembly.</description> </directive> <directive name="%PATHSEARCH" tool="NASM"> <description>Search the Include Path.</description> </directive> <directive name="%DEPEND" tool="NASM"> <description>Add Dependent Files.</description> </directive> <directive name="%USE" tool="NASM"> <description>Include Standard Macro Package.</description> </directive> <directive name="%PUSH" tool="NASM"> <description>Creating and Removing Contexts.</description> </directive> <directive name="%POP" tool="NASM"> <description>Creating and Removing Contexts.</description> </directive> <directive name="%REPL" tool="NASM"> <description>Renaming a Context.</description> </directive> <directive name="%ARG" tool="NASM"> <description>The %arg directive is used to simplify the handling of parameters passed on the stack.</description> </directive> <directive name="%STACKSIZE" tool="NASM"> <description>TODO</description> </directive> <directive name="%LOCAL" tool="NASM"> <description>TODO</description> </directive> <directive name="%ERROR" tool="NASM"> <description>The preprocessor directive %error will cause NASM to report an error if it occurs in assembled code.</description> </directive> <directive name="%WARNING" tool="NASM"> <description>The preprocessor directive %warning will cause NASM to report an warning (but allows assembly to continue) if it occurs in assembled code.</description> </directive> <directive name="%FATAL" tool="NASM"> <description>The preprocessor directive %warning will cause NASM to terminate immediately, regardless of pass.</description> </directive> <directive name="%LINE" tool="NASM"> <description>The %line directive is used to notify NASM that the input line corresponds to a specific line number in another file.</description> </directive> <directive name="__NASM_MAJOR__" tool="NASM"> <description>TODO</description> </directive> <directive name="__NASM_MINOR__" tool="NASM"> <description>TODO</description> </directive> <directive name="__NASM_SUBMINOR__" tool="NASM"> <description>TODO</description> </directive> <directive name="___NASM_PATCHLEVEL__" tool="NASM"> <description>TODO</description> </directive> <directive name="__NASM_VERSION_ID__" tool="NASM"> <description>TODO</description> </directive> <directive name="__NASM_VER__" tool="NASM"> <description>TODO</description> </directive> <directive name="__FILE__" tool="NASM"> <description>TODO</description> </directive> <directive name="__LINE__" tool="NASM"> <description>TODO</description> </directive> <directive name="__BITS__" tool="NASM"> <description>The __BITS__ standard macro is updated every time that the BITS mode is set using the BITS XX or [BITS XX] directive, where XX is a valid mode number of 16, 32 or 64.</description> </directive> <directive name="__OUTPUT_FORMAT__" tool="NASM"> <description>The __OUTPUT_FORMAT__ standard macro holds the current Output Format, as given by the -f option or NASM's default.</description> </directive> <directive name="__DATE__" tool="NASM"> <description>TODO</description> </directive> <directive name="__TIME__" tool="NASM"> <description>NASM:</description> </directive> <directive name="__DATE_NUM__" tool="NASM"> <description>TODO</description> </directive> <directive name="__TIME_NUM__" tool="NASM"> <description>TODO</description> </directive> <directive name="__UTC_DATE__" tool="NASM"> <description>TODO</description> </directive> <directive name="__UTC_TIME__" tool="NASM"> <description>TODO</description> </directive> <directive name="__UTC_DATE_NUM__" tool="NASM"> <description>TODO</description> </directive> <directive name="__UTC_TIME_NUM__" tool="NASM"> <description>TODO</description> </directive> <directive name="__POSIX_TIME__" tool="NASM"> <description>TODO</description> </directive> <directive name="STRUC" tool="NASM"> <description>TODO</description> </directive> <directive name="ENDSTRUC" tool="NASM"> <description>TODO</description> </directive> <directive name="ISTRUC" tool="NASM"> <description>TODO</description> </directive> <directive name="IEND" tool="NASM"> <description>TODO</description> </directive> <directive name="ALIGN" tool="NASM"> <description>The ALIGN and ALIGNB macros provides a convenient way to align code or data on a word, longword, paragraph or other boundary. Normally, you can just use ALIGN in code and data sections and ALIGNB in BSS sections, and never need the second argument except for special purposes.</description> </directive> <directive name="ALIGNB" tool="NASM"> <description>The ALIGN and ALIGNB macros provides a convenient way to align code or data on a word, longword, paragraph or other boundary. Normally, you can just use ALIGN in code and data sections and ALIGNB in BSS sections, and never need the second argument except for special purposes.</description> </directive> <directive name="SECTALIGN" tool="NASM"> <description>The SECTALIGN macros provides a way to modify alignment attribute of output file section.</description> </directive> <directive name="INCBIN" tool="NASM"> <description>Includes a binary file verbatim into the output file.</description> </directive> <directive name="TIMES" tool="MASM, NASM"> <description>The TIMES prefix causes the instruction to be assembled multiple times.</description> </directive> <directive name="AT" tool="NASM"> <description>TODO</description> </directive> <directive name=".INTEL_SYNTAX" tool="NASM"> <description>switch to INTEL syntax</description> </directive> <directive name=".ATT_SYNTAX" tool="NASM"> <description>switch to AT&amp;T syntax</description> </directive> <directive name=".TEXT" tool="NASM"> <description>TODO</description> </directive> <directive name=".GLOBAL" tool="NASM"> <description>TODO</description> </directive> <directive name=".ALIGN" tool="NASM"> <description>TODO</description> </directive> <directive name=".NOPREFIX" tool="NASM"> <description>TODO</description> </directive> </directives> <registers> <register name='CS' bits='16' arch='8086'> <description>Segment Register (Code Segment)</description> </register> <register name='DS' bits='16' arch='8086'> <description>Segment Register (Data Segment)</description> </register> <register name='ES' bits='16' arch='8086'> <description>Segment Register (Extra Segment)</description> </register> <register name='SS' bits='16' arch='8086'> <description>Segment Register (Stack Segment)</description> </register> <register name='FS' bits='16' arch='386'> <description>Segment Register (General Purpose)</description> </register> <register name='GS' bits='16' arch='386'> <description>Segment Register (General Purpose)</description> </register> <register name='CR0' bits='32' arch='386'> <description>Control Register 0</description> </register> <register name='CR1' bits='32' arch='386'> <description>Control Register 1</description> </register> <register name='CR2' bits='32' arch='386'> <description>Control Register 2</description> </register> <register name='CR3' bits='32' arch='386'> <description>Control Register 3</description> </register> <register name='CR4' bits='32' arch='386'> <description>Control Register 4</description> </register> <register name='CR5' bits='32' arch='386'> <description>Control Register 5</description> </register> <register name='CR6' bits='32' arch='386'> <description>Control Register 6</description> </register> <register name='CR7' bits='32' arch='386'> <description>Control Register 7</description> </register> <register name='CR8' bits='64' arch='X64'> <description>Control Register 8</description> </register> <register name='DR0' bits='32' arch='386'> <description>Debug Register 0</description> </register> <register name='DR1' bits='32' arch='386'> <description>Debug Register 1</description> </register> <register name='DR2' bits='32' arch='386'> <description>Debug Register 2</description> </register> <register name='DR3' bits='32' arch='386'> <description>Debug Register 3</description> </register> <register name='DR4' bits='32' arch='386'> <description>Debug Register 4 (alias for DR6)</description> </register> <register name='DR5' bits='32' arch='386'> <description>Debug Register 5 (alias for DR7)</description> </register> <register name='DR6' bits='32' arch='386'> <description>Debug Register 6</description> </register> <register name='DR7' bits='32' arch='386'> <description>Debug Register 7</description> </register> <register name='K0' bits='64' arch='AVX512VL'> <description>Opmask Register 0</description> </register> <register name='K1' bits='64' arch='AVX512VL'> <description>Opmask Register 1</description> </register> <register name='K2' bits='64' arch='AVX512VL'> <description>Opmask Register 2</description> </register> <register name='K3' bits='64' arch='AVX512VL'> <description>Opmask Register 3</description> </register> <register name='K4' bits='64' arch='AVX512VL'> <description>Opmask Register 4</description> </register> <register name='K5' bits='64' arch='AVX512VL'> <description>Opmask Register 5</description> </register> <register name='K6' bits='64' arch='AVX512VL'> <description>Opmask Register 6</description> </register> <register name='K7' bits='64' arch='AVX512VL'> <description>Opmask Register 7</description> </register> <register name='BND0' bits='128' arch='MPX'> <description>MPX Bound Register 0</description> </register> <register name='BND1' bits='128' arch='MPX'> <description>MPX Bound Register 1</description> </register> <register name='BND2' bits='128' arch='MPX'> <description>MPX Bound Register 2</description> </register> <register name='BND3' bits='128' arch='MPX'> <description>MPX Bound Register 3</description> </register> <register name='RAX' bits='64' arch='X64'> <description>64-bit GPR (Accumulator)</description> </register> <register name='RBX' bits='64' arch='X64'> <description>64-bit GPR (Base Register)</description> </register> <register name='RCX' bits='64' arch='X64'> <description>64-bit GPR (Count Register)</description> </register> <register name='RDX' bits='64' arch='X64'> <description>64-bit GPR (Data Register)</description> </register> <register name='RSI' bits='64' arch='X64'> <description>64-bit Index Register (Source Index)</description> </register> <register name='RDI' bits='64' arch='X64'> <description>64-bit Index Register (Destination Index)</description> </register> <register name='RBP' bits='64' arch='X64'> <description>64-bit Pointer Register (Base Pointer)</description> </register> <register name='RSP' bits='64' arch='X64'> <description>64-bit Pointer Register (Stack Pointer) </description> </register> <register name='R8' bits='64' arch='X64'> <description>64-bit GPR</description> </register> <register name='R9' bits='64' arch='X64'> <description>64-bit GPR</description> </register> <register name='R10' bits='64' arch='X64'> <description>64-bit GPR</description> </register> <register name='R11' bits='64' arch='X64'> <description>64-bit GPR</description> </register> <register name='R12' bits='64' arch='X64'> <description>64-bit GPR</description> </register> <register name='R13' bits='64' arch='X64'> <description>64-bit GPR</description> </register> <register name='R14' bits='64' arch='X64'> <description>64-bit GPR</description> </register> <register name='R15' bits='64' arch='X64'> <description>64-bit GPR</description> </register> <register name='EAX' bits='32' arch='386'> <description>32-bit GPR (Accumulator)</description> </register> <register name='EBX' bits='32' arch='386'> <description>32-bit GPR (Base Register)</description> </register> <register name='ECX' bits='32' arch='386'> <description>32-bit GPR (Count Register)</description> </register> <register name='EDX' bits='32' arch='386'> <description>32-bit GPR (Data Register)</description> </register> <register name='ESI' bits='32' arch='386'> <description>32-bit Index Register (Source Index)</description> </register> <register name='EDI' bits='32' arch='386'> <description>32-bit Index Register (Destination Index)</description> </register> <register name='EBP' bits='32' arch='386'> <description>32-bit Pointer Register (Base Pointer)</description> </register> <register name='ESP' bits='32' arch='386'> <description>32-bit Pointer Register (Stack Pointer) </description> </register> <register name='R8D' bits='32' arch='X64'> <description>32-bit GPR</description> </register> <register name='R9D' bits='32' arch='X64'> <description>32-bit GPR</description> </register> <register name='R10D' bits='32' arch='X64'> <description>32-bit GPR</description> </register> <register name='R11D' bits='32' arch='X64'> <description>32-bit GPR</description> </register> <register name='R12D' bits='32' arch='X64'> <description>32-bit GPR</description> </register> <register name='R13D' bits='32' arch='X64'> <description>32-bit GPR</description> </register> <register name='R14D' bits='32' arch='X64'> <description>32-bit GPR</description> </register> <register name='R15D' bits='32' arch='X64'> <description>32-bit GPR</description> </register> <register name='AX' bits='16' arch='8086'> <description>16-bit GPR (Accumulator)</description> </register> <register name='BX' bits='16' arch='8086'> <description>16-bit GPR (Base Register)</description> </register> <register name='CX' bits='16' arch='8086'> <description>16-bit GPR (Count Register)</description> </register> <register name='DX' bits='16' arch='8086'> <description>16-bit GPR (Data Register)</description> </register> <register name='SI' bits='16' arch='8086'> <description>16-bit Index Register (Source Index)</description> </register> <register name='DI' bits='16' arch='8086'> <description>16-bit Index Register (Destination Index)</description> </register> <register name='BP' bits='16' arch='8086'> <description>16-bit Pointer Register (Base Pointer)</description> </register> <register name='SP' bits='16' arch='8086'> <description>16-bit Pointer Register (Stack Pointer) </description> </register> <register name='R8W' bits='16' arch='X64'> <description>16-bit GPR</description> </register> <register name='R9W' bits='16' arch='X64'> <description>16-bit GPR</description> </register> <register name='R10W' bits='16' arch='X64'> <description>16-bit GPR</description> </register> <register name='R11W' bits='16' arch='X64'> <description>16-bit GPR</description> </register> <register name='R12W' bits='16' arch='X64'> <description>16-bit GPR</description> </register> <register name='R13W' bits='16' arch='X64'> <description>16-bit GPR</description> </register> <register name='R14W' bits='16' arch='X64'> <description>16-bit GPR</description> </register> <register name='R15W' bits='16' arch='X64'> <description>16-bit GPR</description> </register> <register name='AH' bits='8' arch='8086'> <description>8-bit GPR (Accumulator)</description> </register> <register name='BH' bits='8' arch='8086'> <description>8-bit GPR (Base Register)</description> </register> <register name='CH' bits='8' arch='8086'> <description>8-bit GPR (Count Register)</description> </register> <register name='DH' bits='8' arch='8086'> <description>8-bit GPR (Data Register)</description> </register> <register name='AL' bits='8' arch='8086'> <description>8-bit GPR (Accumulator)</description> </register> <register name='BL' bits='8' arch='8086'> <description>8-bit GPR (Base Register)</description> </register> <register name='CL' bits='8' arch='8086'> <description>8-bit GPR (Count Register)</description> </register> <register name='DL' bits='8' arch='8086'> <description>8-bit GPR (Data Register)</description> </register> <register name='SIL' bits='8' arch='8086'> <description>8-bit Index Register (Source Index)</description> </register> <register name='DIL' bits='8' arch='8086'> <description>8-bit Index Register (Destination Index)</description> </register> <register name='BPL' bits='8' arch='8086'> <description>8-bit Pointer Register (Base Pointer)</description> </register> <register name='SPL' bits='8' arch='8086'> <description>8-bit Pointer Register (Stack Pointer) </description> </register> <register name='R8B' bits='8' arch='X64'> <description>8-bit GPR</description> </register> <register name='R9B' bits='8' arch='X64'> <description>8-bit GPR</description> </register> <register name='R10B' bits='8' arch='X64'> <description>8-bit GPR</description> </register> <register name='R11B' bits='8' arch='X64'> <description>8-bit GPR</description> </register> <register name='R12B' bits='8' arch='X64'> <description>8-bit GPR</description> </register> <register name='R13B' bits='8' arch='X64'> <description>8-bit GPR</description> </register> <register name='R14B' bits='8' arch='X64'> <description>8-bit GPR</description> </register> <register name='R15B' bits='8' arch='X64'> <description>8-bit GPR</description> </register> <register name='MM0' bits='64' arch='MMX'> <description>64-bit mmx Register</description> </register> <register name='MM1' bits='64' arch='MMX'> <description>64-bit mmx Register</description> </register> <register name='MM2' bits='64' arch='MMX'> <description>64-bit mmx Register</description> </register> <register name='MM3' bits='64' arch='MMX'> <description>64-bit mmx Register</description> </register> <register name='MM4' bits='64' arch='MMX'> <description>64-bit mmx Register</description> </register> <register name='MM5' bits='64' arch='MMX'> <description>64-bit mmx Register</description> </register> <register name='MM6' bits='64' arch='MMX'> <description>64-bit mmx Register</description> </register> <register name='MM7' bits='64' arch='MMX'> <description>64-bit mmx Register</description> </register> <register name='XMM0' bits='128' arch='SSE'> <description>128-bit sse Register</description> </register> <register name='XMM1' bits='128' arch='SSE'> <description>128-bit sse Register</description> </register> <register name='XMM2' bits='128' arch='SSE'> <description>128-bit sse Register</description> </register> <register name='XMM3' bits='128' arch='SSE'> <description>128-bit sse Register</description> </register> <register name='XMM4' bits='128' arch='SSE'> <description>128-bit sse Register</description> </register> <register name='XMM5' bits='128' arch='SSE'> <description>128-bit sse Register</description> </register> <register name='XMM6' bits='128' arch='SSE'> <description>128-bit sse Register</description> </register> <register name='XMM7' bits='128' arch='SSE'> <description>128-bit sse Register</description> </register> <register name='XMM8' bits='128' arch='SSE2'> <description>128-bit sse Register</description> </register> <register name='XMM9' bits='128' arch='SSE2'> <description>128-bit sse Register</description> </register> <register name='XMM10' bits='128' arch='SSE2'> <description>128-bit sse Register</description> </register> <register name='XMM11' bits='128' arch='SSE2'> <description>128-bit sse Register</description> </register> <register name='XMM12' bits='128' arch='SSE2'> <description>128-bit sse Register</description> </register> <register name='XMM13' bits='128' arch='SSE2'> <description>128-bit sse Register</description> </register> <register name='XMM14' bits='128' arch='SSE2'> <description>128-bit sse Register</description> </register> <register name='XMM15' bits='128' arch='SSE2'> <description>128-bit sse Register</description> </register> <register name='XMM16' bits='128' arch='AVX512VL'> <description>128-bit sse Register</description> </register> <register name='XMM17' bits='128' arch='AVX512VL'> <description>128-bit sse Register</description> </register> <register name='XMM18' bits='128' arch='AVX512VL'> <description>128-bit sse Register</description> </register> <register name='XMM19' bits='128' arch='AVX512VL'> <description>128-bit sse Register</description> </register> <register name='XMM20' bits='128' arch='AVX512VL'> <description>128-bit sse Register</description> </register> <register name='XMM21' bits='128' arch='AVX512VL'> <description>128-bit sse Register</description> </register> <register name='XMM22' bits='128' arch='AVX512VL'> <description>128-bit sse Register</description> </register> <register name='XMM23' bits='128' arch='AVX512VL'> <description>128-bit sse Register</description> </register> <register name='XMM24' bits='128' arch='AVX512VL'> <description>128-bit sse Register</description> </register> <register name='XMM25' bits='128' arch='AVX512VL'> <description>128-bit sse Register</description> </register> <register name='XMM26' bits='128' arch='AVX512VL'> <description>128-bit sse Register</description> </register> <register name='XMM27' bits='128' arch='AVX512VL'> <description>128-bit sse Register</description> </register> <register name='XMM28' bits='128' arch='AVX512VL'> <description>128-bit sse Register</description> </register> <register name='XMM29' bits='128' arch='AVX512VL'> <description>128-bit sse Register</description> </register> <register name='XMM30' bits='128' arch='AVX512VL'> <description>128-bit sse Register</description> </register> <register name='XMM31' bits='128' arch='AVX512VL'> <description>128-bit sse Register</description> </register> <register name='YMM0' bits='256' arch='AVX'> <description>256-bit avx Register</description> </register> <register name='YMM1' bits='256' arch='AVX'> <description>256-bit avx Register</description> </register> <register name='YMM2' bits='256' arch='AVX'> <description>256-bit avx Register</description> </register> <register name='YMM3' bits='256' arch='AVX'> <description>256-bit avx Register</description> </register> <register name='YMM4' bits='256' arch='AVX'> <description>256-bit avx Register</description> </register> <register name='YMM5' bits='256' arch='AVX'> <description>256-bit avx Register</description> </register> <register name='YMM6' bits='256' arch='AVX'> <description>256-bit avx Register</description> </register> <register name='YMM7' bits='256' arch='AVX'> <description>256-bit avx Register</description> </register> <register name='YMM8' bits='256' arch='AVX'> <description>256-bit avx Register</description> </register> <register name='YMM9' bits='256' arch='AVX'> <description>256-bit avx Register</description> </register> <register name='YMM10' bits='256' arch='AVX'> <description>256-bit avx Register</description> </register> <register name='YMM11' bits='256' arch='AVX'> <description>256-bit avx Register</description> </register> <register name='YMM12' bits='256' arch='AVX'> <description>256-bit avx Register</description> </register> <register name='YMM13' bits='256' arch='AVX'> <description>256-bit avx Register</description> </register> <register name='YMM14' bits='256' arch='AVX'> <description>256-bit avx Register</description> </register> <register name='YMM15' bits='256' arch='AVX'> <description>256-bit avx Register</description> </register> <register name='YMM16' bits='256' arch='AVX512VL'> <description>256-bit avx Register</description> </register> <register name='YMM17' bits='256' arch='AVX512VL'> <description>256-bit avx Register</description> </register> <register name='YMM18' bits='256' arch='AVX512VL'> <description>256-bit avx Register</description> </register> <register name='YMM19' bits='256' arch='AVX512VL'> <description>256-bit avx Register</description> </register> <register name='YMM20' bits='256' arch='AVX512VL'> <description>256-bit avx Register</description> </register> <register name='YMM21' bits='256' arch='AVX512VL'> <description>256-bit avx Register</description> </register> <register name='YMM22' bits='256' arch='AVX512VL'> <description>256-bit avx Register</description> </register> <register name='YMM23' bits='256' arch='AVX512VL'> <description>256-bit avx Register</description> </register> <register name='YMM24' bits='256' arch='AVX512VL'> <description>256-bit avx Register</description> </register> <register name='YMM25' bits='256' arch='AVX512VL'> <description>256-bit avx Register</description> </register> <register name='YMM26' bits='256' arch='AVX512VL'> <description>256-bit avx Register</description> </register> <register name='YMM27' bits='256' arch='AVX512VL'> <description>256-bit avx Register</description> </register> <register name='YMM28' bits='256' arch='AVX512VL'> <description>256-bit avx Register</description> </register> <register name='YMM29' bits='256' arch='AVX512VL'> <description>256-bit avx Register</description> </register> <register name='YMM30' bits='256' arch='AVX512VL'> <description>256-bit avx Register</description> </register> <register name='YMM31' bits='256' arch='AVX512VL'> <description>256-bit avx Register</description> </register> <register name='ZMM0' bits='512' arch='AVX512F'> <description>512-bit avx-512 Register</description> </register> <register name='ZMM1' bits='512' arch='AVX512F'> <description>512-bit avx-512 Register</description> </register> <register name='ZMM2' bits='512' arch='AVX512F'> <description>512-bit avx-512 Register</description> </register> <register name='ZMM3' bits='512' arch='AVX512F'> <description>512-bit avx-512 Register</description> </register> <register name='ZMM4' bits='512' arch='AVX512F'> <description>512-bit avx-512 Register</description> </register> <register name='ZMM5' bits='512' arch='AVX512F'> <description>512-bit avx-512 Register</description> </register> <register name='ZMM6' bits='512' arch='AVX512F'> <description>512-bit avx-512 Register</description> </register> <register name='ZMM7' bits='512' arch='AVX512F'> <description>512-bit avx-512 Register</description> </register> <register name='ZMM8' bits='512' arch='AVX512F'> <description>512-bit avx-512 Register</description> </register> <register name='ZMM9' bits='512' arch='AVX512F'> <description>512-bit avx-512 Register</description> </register> <register name='ZMM10' bits='512' arch='AVX512F'> <description>512-bit avx-512 Register</description> </register> <register name='ZMM11' bits='512' arch='AVX512F'> <description>512-bit avx-512 Register</description> </register> <register name='ZMM12' bits='512' arch='AVX512F'> <description>512-bit avx-512 Register</description> </register> <register name='ZMM13' bits='512' arch='AVX512F'> <description>512-bit avx-512 Register</description> </register> <register name='ZMM14' bits='512' arch='AVX512F'> <description>512-bit avx-512 Register</description> </register> <register name='ZMM15' bits='512' arch='AVX512F'> <description>512-bit avx-512 Register</description> </register> <register name='ZMM16' bits='512' arch='AVX512F'> <description>512-bit avx-512 Register</description> </register> <register name='ZMM17' bits='512' arch='AVX512F'> <description>512-bit avx-512 Register</description> </register> <register name='ZMM18' bits='512' arch='AVX512F'> <description>512-bit avx-512 Register</description> </register> <register name='ZMM19' bits='512' arch='AVX512F'> <description>512-bit avx-512 Register</description> </register> <register name='ZMM20' bits='512' arch='AVX512F'> <description>512-bit avx-512 Register</description> </register> <register name='ZMM21' bits='512' arch='AVX512F'> <description>512-bit avx-512 Register</description> </register> <register name='ZMM22' bits='512' arch='AVX512F'> <description>512-bit avx-512 Register</description> </register> <register name='ZMM23' bits='512' arch='AVX512F'> <description>512-bit avx-512 Register</description> </register> <register name='ZMM24' bits='512' arch='AVX512F'> <description>512-bit avx-512 Register</description> </register> <register name='ZMM25' bits='512' arch='AVX512F'> <description>512-bit avx-512 Register</description> </register> <register name='ZMM26' bits='512' arch='AVX512F'> <description>512-bit avx-512 Register</description> </register> <register name='ZMM27' bits='512' arch='AVX512F'> <description>512-bit avx-512 Register</description> </register> <register name='ZMM28' bits='512' arch='AVX512F'> <description>512-bit avx-512 Register</description> </register> <register name='ZMM29' bits='512' arch='AVX512F'> <description>512-bit avx-512 Register</description> </register> <register name='ZMM30' bits='512' arch='AVX512F'> <description>512-bit avx-512 Register</description> </register> <register name='ZMM31' bits='512' arch='AVX512F'> <description>512-bit avx-512 Register</description> </register> </registers> </asmdudedata> ```
/content/code_sandbox/VS/CSHARP/asm-dude2-vsix/Resources/AsmDudeData.xml
xml
2016-02-19T15:43:23
2024-08-16T10:20:31
asm-dude
HJLebbink/asm-dude
4,118
18,892
```xml // See LICENSE in the project root for license information. import { Label } from '@fluentui/react'; import type { AnyAction, Dispatch } from '@reduxjs/toolkit'; import * as React from 'react'; import { type CSSProperties, useEffect } from 'react'; import { useAppDispatch } from '../store/hooks'; import { type ICommandLineParameter, useFilteredParameters } from '../store/slices/parameter'; import { setUserSelectedParameterName, useCurrentParameterName, useUserSelectedParameterName } from '../store/slices/ui'; const navStyle: CSSProperties = { width: '160px', height: 'auto', boxSizing: 'border-box', overflowY: 'auto' }; const NAV_LABEL_PREFIX: string = 'parameter-nav-label-'; export const ParameterNav = (): JSX.Element => { const parameters: ICommandLineParameter[] = useFilteredParameters(); const currentParameterName: string = useCurrentParameterName(); const userSelectdParameterName: string = useUserSelectedParameterName(); const dispatch: Dispatch<AnyAction> = useAppDispatch(); useEffect(() => { const $el: HTMLElement | null = document.getElementById(`${NAV_LABEL_PREFIX}${currentParameterName}`); if ($el) { $el.scrollIntoView({ block: 'nearest', inline: 'nearest' }); } }, [currentParameterName]); return ( <div style={navStyle}> {parameters.map((parameter: ICommandLineParameter) => { const { longName } = parameter; const text: string = longName .replace(/^--([a-z])/, (matches) => { return matches[2].toUpperCase(); }) .replace(/-([a-z])/g, (matches) => { return matches[1].toUpperCase(); }); let fontWeight: string = 'normal'; if (userSelectdParameterName) { if (userSelectdParameterName === longName) { fontWeight = 'bold'; } } else if (currentParameterName === longName) { fontWeight = 'bold'; } return ( <Label id={`${NAV_LABEL_PREFIX}${longName}`} styles={{ root: { fontWeight, cursor: 'pointer' } }} key={text} required={parameter.required} onClick={() => { dispatch(setUserSelectedParameterName(longName)); }} > {text} </Label> ); })} </div> ); }; ```
/content/code_sandbox/vscode-extensions/rush-vscode-command-webview/src/ParameterView/ParameterNav.tsx
xml
2016-09-30T00:28:20
2024-08-16T18:54:35
rushstack
microsoft/rushstack
5,790
534
```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 itermsumabs = require( './index' ); /** * Returns an iterator protocol-compliant object. * * @returns iterator protocol-compliant object */ function iterator() { return { 'next': next }; /** * Implements the iterator protocol `next` method. * * @returns iterator protocol-compliant object */ function next() { return { 'value': true, 'done': false }; } } // TESTS // // The function returns an iterator... { itermsumabs( iterator(), 3 ); // $ExpectType Iterator } // The compiler throws an error if the function is provided a first argument which is not an iterator protocol-compliant object... { itermsumabs( '5', 3 ); // $ExpectError itermsumabs( 5, 3 ); // $ExpectError itermsumabs( true, 3 ); // $ExpectError itermsumabs( false, 3 ); // $ExpectError itermsumabs( null, 3 ); // $ExpectError itermsumabs( undefined, 3 ); // $ExpectError itermsumabs( [], 3 ); // $ExpectError itermsumabs( {}, 3 ); // $ExpectError itermsumabs( ( x: number ): number => x, 3 ); // $ExpectError } // The compiler throws an error if the function is provided a second argument which is not a positive integer... { itermsumabs( iterator(), '5' ); // $ExpectError itermsumabs( iterator(), true ); // $ExpectError itermsumabs( iterator(), false ); // $ExpectError itermsumabs( iterator(), null ); // $ExpectError itermsumabs( iterator(), undefined ); // $ExpectError itermsumabs( iterator(), [] ); // $ExpectError itermsumabs( iterator(), {} ); // $ExpectError itermsumabs( iterator(), ( x: number ): number => x ); // $ExpectError } // The compiler throws an error if the function is provided insufficient arguments... { itermsumabs(); // $ExpectError itermsumabs( iterator() ); // $ExpectError itermsumabs( iterator(), 3, 3 ); // $ExpectError } ```
/content/code_sandbox/lib/node_modules/@stdlib/stats/iter/msumabs/docs/types/test.ts
xml
2016-03-24T04:19:52
2024-08-16T09:03:19
stdlib
stdlib-js/stdlib
4,266
549
```xml <epp xmlns="urn:ietf:params:xml:ns:epp-1.0"> <command> <transfer op="reject"> <domain:transfer xmlns:domain="urn:ietf:params:xml:ns:domain-1.0"> <domain:name>example.tld</domain:name> </domain:transfer> </transfer> <clTRID>ABC-12345</clTRID> </command> </epp> ```
/content/code_sandbox/core/src/test/resources/google/registry/flows/domain/domain_transfer_reject.xml
xml
2016-02-29T20:16:48
2024-08-15T19:49:29
nomulus
google/nomulus
1,685
103
```xml import { isConcrete } from "../engine/EngineUtils.js"; import { A, ASTNode, Identifier, NodeType, SourceLoc } from "../types/ast.js"; import { StyleError } from "../types/errors.js"; import { Expr, FunctionCall, InlineComparison, Path, PropertyDecl, } from "../types/style.js"; import { Resolved, ResolvedPath, ResolvedStylePath, ResolvedUnindexedStylePath, StylePathToNamespaceScope, StylePathToScope, StylePathToSubstanceScope, StylePathToUnindexedObject, UnindexedStylePath, } from "../types/stylePathResolution.js"; import { Assignment, BlockInfo, StySubst, SubstanceObject, } from "../types/styleSemantics.js"; import { Result, all, err, ok } from "../utils/Error.js"; const loc = ( x: ASTNode<A>, ): { nodeType: NodeType; start?: SourceLoc; end?: SourceLoc } => { if (isConcrete(x)) { return { start: x.start, end: x.end, nodeType: x.nodeType }; } else { return { nodeType: x.nodeType }; } }; const locs = ( x: ASTNode<A>, y: ASTNode<A>, ): { nodeType: NodeType; start?: SourceLoc; end?: SourceLoc } => { if (isConcrete(x) && isConcrete(y)) { return { start: x.start, end: y.end, nodeType: x.nodeType }; } else { return { nodeType: x.nodeType }; } }; // represents location of an empty AST node at the same location as `startAt` const emptyLoc = ( startAt: ASTNode<A>, ): { nodeType: NodeType; start?: SourceLoc; end?: SourceLoc } => { if (isConcrete(startAt)) { const { start } = startAt; return { start, end: start, nodeType: startAt.nodeType, }; } else { return { nodeType: startAt.nodeType }; } }; const findInSubst = ( subst: StySubst, id: string, ): SubstanceObject | SubstanceObject[] | undefined => { if (subst.tag === "CollectionSubst") { if (id === subst.collName) { return subst.collContent; } if (id in subst.groupby) { return subst.groupby[id]; } } if (subst.tag === "StySubSubst" && id in subst.contents) { return subst.contents[id]; } return undefined; }; export const resolveLhsStylePath = ( block: BlockInfo, assignment: Assignment, original: Path<A>, ): Result<ResolvedUnindexedStylePath<A>, StyleError> => { const resolved = resolveStylePath(block, assignment, original); if (resolved.isErr()) return err(resolved.error); if (resolved.value.tag === "Object") { const { access } = resolved.value; if (access.tag === "Index") { // AssignAccessError return err({ tag: "AssignAccessError", path: resolved.value, }); } else { return ok({ ...resolved.value, access, }); } } else { return ok(resolved.value); } }; export const resolveStylePath = ( block: BlockInfo, assignment: Assignment, original: Path<A>, ): Result<ResolvedStylePath<A>, StyleError> => { const withoutIndex = resolveStylePathWithoutIndex( block, assignment, original, ); if (withoutIndex.isErr()) { return err(withoutIndex.error); } const { indices } = original; if (indices.length === 0) { return ok(withoutIndex.value); } if (withoutIndex.value.tag !== "Object") { // numerically indexing into an non-object return err({ tag: "UnindexableItemError", expr: withoutIndex.value, }); } const resolvedIndices = all( indices.map((index) => resolveStyleExpr(block, assignment, index)), ); if (resolvedIndices.isErr()) { return err(resolvedIndices.error[0]); } const res: ResolvedStylePath<A> = { ...original, tag: "Object", access: { tag: "Index", parent: withoutIndex.value, indices: resolvedIndices.value, }, }; return ok(res); }; export const resolveStylePathWithoutIndex = ( { block, subst }: BlockInfo, assignment: Assignment, original: Omit<Path<A>, "indices">, ): Result<ResolvedUnindexedStylePath<A>, StyleError> => { let curr: UnindexedStylePath<A> = { ...emptyLoc(original), tag: "Empty", }; const firstPart: Identifier<A> = original.name.tag === "StyVar" ? original.name.contents : { ...original.name.contents, tag: "Identifier", value: `\`${original.name.contents.value}\``, }; let parts: Identifier<A>[] = [firstPart, ...original.members]; while (parts.length > 0) { const r = resolveStylePathHelper({ block, subst }, assignment, curr, parts); if (r.isErr()) { return err(r.error); } else { const { result, remaining } = r.value; curr = result; parts = remaining; } } if (curr.tag === "Empty" || curr.tag === "Unnamed") { // should never end with Empty or Unnamed path throw new Error( "resolved into an Empty or Unnamed path which should not happen", ); } else return ok(curr); }; const resolveStylePathHelper = ( { block, subst }: BlockInfo, assignment: Assignment, curr: UnindexedStylePath<A>, parts: Identifier<A>[], allowUndeclared: boolean = true, ): Result< { result: UnindexedStylePath<A>; remaining: Identifier<A>[]; }, StyleError > => { if (parts.length === 0) { return ok({ result: curr, remaining: [] }); } const [next, ...rest] = parts; const nextName = next.value; if (curr.tag === "Empty") { const subObj = findInSubst(subst, next.value); // special handling for a substance variable that is not declared in header if ( nextName.startsWith("`") && nextName.endsWith("`") && subObj === undefined ) { return err({ tag: "UndeclaredSubVarError", name: next, }); } if (subObj !== undefined) { if (subObj instanceof Array) { return ok({ result: { ...loc(next), tag: "Collection", substanceObjects: subObj, styleName: nextName, }, remaining: rest, }); } else { return ok({ result: { ...loc(next), tag: "Substance", substanceObject: subObj, styleName: nextName, }, remaining: rest, }); } } else if (assignment.globals.has(nextName)) { return ok({ result: { ...loc(next), tag: "Namespace", name: nextName, }, remaining: rest, }); } else { if (block.tag === "LocalVarId") { const [blockId, substId] = block.contents; return ok({ result: { ...loc(curr), tag: "Unnamed", blockId, substId, }, // do not advance the pointer since we haven't actually resolved `next` // we only know that `next` is in the scope of `unnamed` remaining: parts, }); } else { return ok({ result: { ...loc(curr), tag: "Namespace", name: block.contents, }, // similar as above remaining: parts, }); } } } else if ( curr.tag === "Namespace" || curr.tag === "Substance" || curr.tag === "Unnamed" ) { return ok({ result: { ...locs(curr, next), tag: "Object", access: { tag: "Member", parent: curr, name: nextName, }, }, remaining: rest, }); } else if (curr.tag === "Collection") { return err({ tag: "CollectionMemberAccessError", path: curr, field: nextName, }); } else { // if both parent and parent's parent are objects, this is not a well-formed path const newPath: StylePathToUnindexedObject<A> = { ...locs(curr, next), tag: "Object", access: { tag: "Member", parent: curr, name: nextName, }, }; if ( curr.access.parent.tag === "Object" && curr.access.parent.access.parent.tag === "Object" ) { return err({ tag: "NonWellFormedPathError", path: newPath, }); } return ok({ result: newPath, remaining: rest, }); } }; export const stylePathToNamespaceScope = ( name: string, ): StylePathToNamespaceScope<A> => ({ tag: "Namespace", name, nodeType: "SyntheticStyle", }); export const stylePathToSubstanceScope = ( obj: SubstanceObject, ): StylePathToSubstanceScope<A> => ({ tag: "Substance", substanceObject: obj, nodeType: "SyntheticStyle", }); export const stylePathToUnnamedScope = ( blockId: number, substId: number, ): StylePathToScope<A> => ({ tag: "Unnamed", blockId, substId, nodeType: "SyntheticStyle", }); const resolvePath = ( block: BlockInfo, assignment: Assignment, p: Path<A>, ): Result<ResolvedPath<A>, StyleError> => { const resolved = resolveStylePath(block, assignment, p); if (resolved.isErr()) { return err(resolved.error); } return ok({ ...p, tag: "ResolvedPath", contents: resolved.value, }); }; const resolveStyleFunctionCall = ( block: BlockInfo, assignment: Assignment, body: FunctionCall<A> | InlineComparison<A>, ): Result<Resolved<FunctionCall<A> | InlineComparison<A>>, StyleError> => { const resolvee = (e: Expr<A>) => resolveStyleExpr(block, assignment, e); if (body.tag === "InlineComparison") { const a1 = resolvee(body.arg1); if (a1.isErr()) return err(a1.error); const a2 = resolvee(body.arg2); if (a2.isErr()) return err(a2.error); return ok({ ...body, arg1: a1.value, arg2: a2.value, }); } else { const a = all(body.args.map(resolvee)); if (a.isErr()) return err(a.error[0]); return ok({ ...body, args: a.value, }); } }; export const resolveStyleExpr = ( block: BlockInfo, assignment: Assignment, expr: Expr<A>, ): Result<Resolved<Expr<A>>, StyleError> => { const resolvee = (e: Expr<A>) => resolveStyleExpr(block, assignment, e); const resolvep = (p: Path<A>): Result<ResolvedPath<A>, StyleError> => resolvePath(block, assignment, p); switch (expr.tag) { case "Fix": case "Vary": case "BoolLit": case "StringLit": case "ColorLit": return ok(expr); case "BinOp": { const l = resolvee(expr.left); if (l.isErr()) return err(l.error); const r = resolvee(expr.right); if (r.isErr()) return err(r.error); return ok({ ...expr, left: l.value, right: r.value, }); } case "UOp": { const a = resolvee(expr.arg); if (a.isErr()) return err(a.error); return ok({ ...expr, arg: a.value, }); } case "Layering": { const l = resolvep(expr.left); if (l.isErr()) return err(l.error); const r = all(expr.right.map(resolvep)); if (r.isErr()) return err(r.error[0]); return ok({ ...expr, left: l.value, right: r.value, }); } case "List": case "Vector": { const c = all(expr.contents.map(resolvee)); if (c.isErr()) return err(c.error[0]); return ok({ ...expr, contents: c.value, }); } case "Tuple": { const c0 = resolvee(expr.contents[0]); if (c0.isErr()) return err(c0.error); const c1 = resolvee(expr.contents[1]); if (c1.isErr()) return err(c1.error); return ok({ ...expr, contents: [c0.value, c1.value], }); } case "CompApp": { const a = all(expr.args.map(resolvee)); if (a.isErr()) return err(a.error[0]); return ok({ ...expr, args: a.value, }); } case "ObjFn": case "ConstrFn": { const b = resolveStyleFunctionCall(block, assignment, expr.body); if (b.isErr()) return err(b.error); return ok({ ...expr, body: b.value, }); } case "GPIDecl": { const ps = all( expr.properties.map( (pDecl): Result<Resolved<PropertyDecl<A>>, StyleError> => { const v = resolvee(pDecl.value); if (v.isErr()) return err(v.error); return ok({ ...pDecl, value: v.value, }); }, ), ); if (ps.isErr()) return err(ps.error[0]); return ok({ ...expr, properties: ps.value, }); } case "UnaryStyVarExpr": { const a = resolvep(expr.arg); if (a.isErr()) return err(a.error); return ok({ ...expr, arg: a.value, }); } case "CollectionAccess": { const n = resolvep(expr.name); if (n.isErr()) return err(n.error); return ok({ ...expr, name: n.value, }); } case "Path": return resolvep(expr); } }; ```
/content/code_sandbox/packages/core/src/utils/StylePathResolution.ts
xml
2016-09-22T04:47:19
2024-08-16T13:00:54
penrose
penrose/penrose
6,760
3,266
```xml <resources> <string name="listview_header_hint_normal">Pull to refresh</string> <string name="listview_header_hint_release">Refresh when release</string> <string name="listview_loading">Loading...</string> <string name="nomore_loading">No more</string> <string name="refreshing">Refreshing...</string> <string name="refresh_done">Refresh done</string> <string name="listview_header_last_time">Last update time</string> <!--footer--> <string name="list_footer_loading">Loading...</string> <string name="list_footer_network_error">Click to refresh now</string> <string name="list_footer_end">Loading done</string> <string name="text_just">Just</string> <string name="text_seconds_ago">seconds ago</string> <string name="text_minute_ago">minutes ago</string> <string name="text_hour_ago">hours ago</string> <string name="text_day_ago">days ago</string> <string name="text_month_ago">mouths ago</string> <string name="text_year_ago">years ago</string> </resources> ```
/content/code_sandbox/LRecyclerview_library/src/main/res/values/strings.xml
xml
2016-05-19T10:12:08
2024-08-02T07:42:36
LRecyclerView
jdsjlzx/LRecyclerView
2,470
262
```xml /** * @file General key value model * @module model/key-value * @author Surmon <path_to_url */ import { prop } from '@typegoose/typegoose' import { IsString, IsNotEmpty } from 'class-validator' export class KeyValueModel { @IsString() @IsNotEmpty() @prop({ required: false, validate: /\S+/ }) name: string @IsString() @IsNotEmpty() @prop({ required: false, validate: /\S+/ }) value: string } ```
/content/code_sandbox/src/models/key-value.model.ts
xml
2016-02-13T08:16:02
2024-08-12T08:34:20
nodepress
surmon-china/nodepress
1,421
118
```xml import { Entity } from "../../../../src/decorator/entity/Entity" import { Column } from "../../../../src/decorator/columns/Column" import { PrimaryColumn } from "../../../../src/decorator/columns/PrimaryColumn" @Entity({ synchronize: false }) export class Album { @PrimaryColumn() id: number @Column() name: string } ```
/content/code_sandbox/test/functional/schema-builder/entity/Album.ts
xml
2016-02-29T07:41:14
2024-08-16T18:28:52
typeorm
typeorm/typeorm
33,875
77
```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 blocks from './blocks'; import * as transactions from './transactions'; import * as network from './network'; import * as forks from './forks'; import * as prometheusExport from './prometheus'; export { blocks, transactions, network, forks, prometheusExport }; ```
/content/code_sandbox/framework-plugins/lisk-framework-monitor-plugin/src/controllers/index.ts
xml
2016-02-01T21:45:35
2024-08-15T19:16:48
lisk-sdk
LiskArchive/lisk-sdk
2,721
144
```xml /** * @file Automatically generated by @tsed/barrels. */ export * from "./constants/constants.js"; export * from "./decorators/webhookEvent.js"; export * from "./domain/StripeSettings.js"; export * from "./middlewares/WebhookEventMiddleware.js"; export * from "./services/StripeFactory.js"; ```
/content/code_sandbox/packages/third-parties/stripe/src/index.ts
xml
2016-02-21T18:38:47
2024-08-14T21:19:48
tsed
tsedio/tsed
2,817
64
```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. // This file exports metadata about the context in which a program is being run. import * as settings from "./runtime/settings"; /** * Returns the current organization name. */ export function getOrganization(): string { return settings.getOrganization(); } /** * Returns the current project name. Throws an exception if none is registered. */ export function getProject(): string { return settings.getProject(); } /** * Returns the current stack name. Throws an exception if none is registered. */ export function getStack(): string { return settings.getStack(); } ```
/content/code_sandbox/sdk/nodejs/metadata.ts
xml
2016-10-31T21:02:47
2024-08-16T19:47:04
pulumi
pulumi/pulumi
20,743
147
```xml import { throwError } from "rxjs"; import { EncryptService } from "@bitwarden/common/platform/abstractions/encrypt.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { AbstractStorageService } from "@bitwarden/common/platform/abstractions/storage.service"; import { Utils } from "@bitwarden/common/platform/misc/utils"; import { EncArrayBuffer } from "@bitwarden/common/platform/models/domain/enc-array-buffer"; import { SymmetricCryptoKey } from "@bitwarden/common/platform/models/domain/symmetric-crypto-key"; export class NodeEnvSecureStorageService implements AbstractStorageService { constructor( private storageService: AbstractStorageService, private logService: LogService, private encryptService: EncryptService, ) {} get valuesRequireDeserialization(): boolean { return true; } get updates$() { return throwError( () => new Error("Secure storage implementations cannot have their updates subscribed to."), ); } async get<T>(key: string): Promise<T> { const value = await this.storageService.get<string>(this.makeProtectedStorageKey(key)); if (value == null) { return null; } const obj = await this.decrypt(value); return obj as any; } async has(key: string): Promise<boolean> { return (await this.get(key)) != null; } async save(key: string, obj: any): Promise<void> { if (obj == null) { return this.remove(key); } if (obj !== null && typeof obj !== "string") { throw new Error("Only string storage is allowed."); } const protectedObj = await this.encrypt(obj); await this.storageService.save(this.makeProtectedStorageKey(key), protectedObj); } async remove(key: string): Promise<void> { await this.storageService.remove(this.makeProtectedStorageKey(key)); return; } private async encrypt(plainValue: string): Promise<string> { const sessionKey = this.getSessionKey(); if (sessionKey == null) { throw new Error("No session key available."); } const encValue = await this.encryptService.encryptToBytes( Utils.fromB64ToArray(plainValue), sessionKey, ); if (encValue == null) { throw new Error("Value didn't encrypt."); } return Utils.fromBufferToB64(encValue.buffer); } private async decrypt(encValue: string): Promise<string> { try { const sessionKey = this.getSessionKey(); if (sessionKey == null) { return null; } const encBuf = EncArrayBuffer.fromB64(encValue); const decValue = await this.encryptService.decryptToBytes(encBuf, sessionKey); if (decValue == null) { this.logService.info("Failed to decrypt."); return null; } return Utils.fromBufferToB64(decValue); } catch (e) { this.logService.info("Decrypt error."); return null; } } private getSessionKey() { try { if (process.env.BW_SESSION != null) { const sessionBuffer = Utils.fromB64ToArray(process.env.BW_SESSION); if (sessionBuffer != null) { const sessionKey = new SymmetricCryptoKey(sessionBuffer); if (sessionBuffer != null) { return sessionKey; } } } } catch (e) { this.logService.info("Session key is invalid."); } return null; } private makeProtectedStorageKey(key: string) { return "__PROTECTED__" + key; } } ```
/content/code_sandbox/apps/cli/src/platform/services/node-env-secure-storage.service.ts
xml
2016-03-09T23:14:01
2024-08-16T15:07:51
clients
bitwarden/clients
8,877
779
```xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns="path_to_url"> <type>org.netbeans.modules.apisupport.project</type> <configuration> <data xmlns="path_to_url"> <code-name-base>org.graalvm.visualvm.sampler.truffle</code-name-base> <suite-component/> <module-dependencies> <dependency> <code-name-base>org.graalvm.visualvm.application</code-name-base> <build-prerequisite/> <compile-dependency/> <run-dependency> <release-version>2</release-version> <specification-version>2.0</specification-version> </run-dependency> </dependency> <dependency> <code-name-base>org.graalvm.visualvm.core</code-name-base> <build-prerequisite/> <compile-dependency/> <run-dependency> <release-version>2</release-version> <specification-version>2.4</specification-version> </run-dependency> </dependency> <dependency> <code-name-base>org.graalvm.visualvm.coredump</code-name-base> <build-prerequisite/> <compile-dependency/> <run-dependency> <release-version>2</release-version> <specification-version>2.0</specification-version> </run-dependency> </dependency> <dependency> <code-name-base>org.graalvm.visualvm.heapdump</code-name-base> <build-prerequisite/> <compile-dependency/> <run-dependency> <release-version>2</release-version> <specification-version>2.0</specification-version> </run-dependency> </dependency> <dependency> <code-name-base>org.graalvm.visualvm.lib.common</code-name-base> <build-prerequisite/> <compile-dependency/> <run-dependency> <release-version>2</release-version> <specification-version>2.0</specification-version> </run-dependency> </dependency> <dependency> <code-name-base>org.graalvm.visualvm.lib.jfluid</code-name-base> <build-prerequisite/> <compile-dependency/> <run-dependency> <release-version>2</release-version> <specification-version>2.0</specification-version> </run-dependency> </dependency> <dependency> <code-name-base>org.graalvm.visualvm.lib.profiler</code-name-base> <build-prerequisite/> <compile-dependency/> <run-dependency> <release-version>2</release-version> <specification-version>2.0</specification-version> </run-dependency> </dependency> <dependency> <code-name-base>org.graalvm.visualvm.lib.profiler.api</code-name-base> <build-prerequisite/> <compile-dependency/> <run-dependency> <release-version>2</release-version> <specification-version>2.0</specification-version> </run-dependency> </dependency> <dependency> <code-name-base>org.graalvm.visualvm.lib.ui</code-name-base> <build-prerequisite/> <compile-dependency/> <run-dependency> <release-version>2</release-version> <specification-version>2.0</specification-version> </run-dependency> </dependency> <dependency> <code-name-base>org.graalvm.visualvm.profiling</code-name-base> <build-prerequisite/> <compile-dependency/> <run-dependency> <release-version>2</release-version> <specification-version>2.2</specification-version> </run-dependency> </dependency> <dependency> <code-name-base>org.graalvm.visualvm.threaddump</code-name-base> <build-prerequisite/> <compile-dependency/> <run-dependency> <release-version>2</release-version> <specification-version>2.0</specification-version> </run-dependency> </dependency> <dependency> <code-name-base>org.graalvm.visualvm.tools</code-name-base> <build-prerequisite/> <compile-dependency/> <run-dependency> <release-version>2</release-version> <specification-version>2.0</specification-version> </run-dependency> </dependency> <dependency> <code-name-base>org.graalvm.visualvm.uisupport</code-name-base> <build-prerequisite/> <compile-dependency/> <run-dependency> <release-version>2</release-version> <specification-version>2.0</specification-version> </run-dependency> </dependency> <dependency> <code-name-base>org.netbeans.api.progress</code-name-base> <build-prerequisite/> <compile-dependency/> <run-dependency> <release-version>1</release-version> <specification-version>1.48</specification-version> </run-dependency> </dependency> <dependency> <code-name-base>org.netbeans.api.progress.nb</code-name-base> <build-prerequisite/> <compile-dependency/> <run-dependency> <specification-version>1.48</specification-version> </run-dependency> </dependency> <dependency> <code-name-base>org.openide.dialogs</code-name-base> <build-prerequisite/> <compile-dependency/> <run-dependency> <specification-version>7.15.1</specification-version> </run-dependency> </dependency> <dependency> <code-name-base>org.openide.modules</code-name-base> <build-prerequisite/> <compile-dependency/> <run-dependency> <specification-version>7.17.1</specification-version> </run-dependency> </dependency> <dependency> <code-name-base>org.openide.util</code-name-base> <build-prerequisite/> <compile-dependency/> <run-dependency> <specification-version>8.6.1</specification-version> </run-dependency> </dependency> <dependency> <code-name-base>org.openide.util.lookup</code-name-base> <build-prerequisite/> <compile-dependency/> <run-dependency> <specification-version>8.11</specification-version> </run-dependency> </dependency> <dependency> <code-name-base>org.openide.util.ui</code-name-base> <build-prerequisite/> <compile-dependency/> <run-dependency> <specification-version>9.8</specification-version> </run-dependency> </dependency> </module-dependencies> <public-packages/> <class-path-extension> <runtime-relative-path>ext/stagent.jar</runtime-relative-path> </class-path-extension> <extra-compilation-unit> <package-root>libsrc</package-root> <classpath>${lib.cp}</classpath> <built-to>${build.dir}/lib-classes</built-to> <built-to>${cluster}/modules/ext/stagent.jar</built-to> </extra-compilation-unit> </data> </configuration> </project> ```
/content/code_sandbox/visualvm/sampler.truffle/nbproject/project.xml
xml
2016-09-12T14:44:30
2024-08-16T14:41:50
visualvm
oracle/visualvm
2,821
1,623
```xml 'use strict'; import { Progress, ProgressLocation, window } from 'vscode'; import { Disposable, LanguageClient } from 'vscode-languageclient/node'; import { createDeferred, Deferred } from '../common/utils/async'; export class ProgressReporting implements Disposable { private statusBarMessage: Disposable | undefined; private progress: Progress<{ message?: string; increment?: number }> | undefined; private progressDeferred: Deferred<void> | undefined; constructor(private readonly languageClient: LanguageClient) { this.languageClient.onNotification('python/setStatusBarMessage', (m: string) => { if (this.statusBarMessage) { this.statusBarMessage.dispose(); } this.statusBarMessage = window.setStatusBarMessage(m); }); this.languageClient.onNotification('python/beginProgress', (_) => { if (this.progressDeferred) { return; } this.beginProgress(); }); this.languageClient.onNotification('python/reportProgress', (m: string) => { if (!this.progress) { this.beginProgress(); } this.progress!.report({ message: m }); // NOSONAR }); this.languageClient.onNotification('python/endProgress', (_) => { if (this.progressDeferred) { this.progressDeferred.resolve(); this.progressDeferred = undefined; this.progress = undefined; } }); } public dispose() { if (this.statusBarMessage) { this.statusBarMessage.dispose(); } } private beginProgress(): void { this.progressDeferred = createDeferred<void>(); window.withProgress( { location: ProgressLocation.Window, title: '', }, (progress) => { this.progress = progress; return this.progressDeferred!.promise; }, ); } } ```
/content/code_sandbox/src/client/activation/progress.ts
xml
2016-01-19T10:50:01
2024-08-12T21:05:24
pythonVSCode
DonJayamanne/pythonVSCode
2,078
373
```xml <?xml version="1.0" encoding="utf-8"?> <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="path_to_url" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd"> <file datatype="xml" source-language="en" target-language="cs" original="../HelpStrings.resx"> <body> <trans-unit id="Hint_AmbiguousLanguage"> <source>Re-run the command specifying the language to use with --language option.</source> <target state="translated">Spuste pkaz znovu s tm, e pomoc monosti --language zadte jazyk, kter se m pout.</target> <note>--language is an option name and should not be translated.</note> </trans-unit> <trans-unit id="Hint_AmbiguousType"> <source>Re-run the command specifying the type to use with --type option.</source> <target state="translated">Spuste pkaz znovu s tm, e pomoc monosti --type zadte typ, kter se m pout.</target> <note>--type is an option name and should not be translated.</note> </trans-unit> <trans-unit id="Hint_HelpForOtherLanguages"> <source>To see help for other template languages ({0}), use --language option:</source> <target state="translated">Pokud chcete zobrazit npovdu pro jin jazyky ablony ({0}), pouijte monost --language:</target> <note>{0} is comma-separated list of supported programming languages by template. --language should not be translated.</note> </trans-unit> <trans-unit id="Hint_HelpForOtherTypes"> <source>To see help for other template types ({0}), use --type option:</source> <target state="translated">Npovdu k jinm typm ablon ({0}) zobrazte pomoc monosti --type:</target> <note>{0} is comma-separated list of supported types by template. --type should not be translated.</note> </trans-unit> <trans-unit id="Info_TemplateThirdPartyNotice"> <source>This template contains technologies from parties other than Microsoft, see {0} for details.</source> <target state="translated">Tato ablona obsahuje technologie jinch dodavatel ne Microsoftu, podrobnosti najdete tady: {0}</target> <note /> </trans-unit> <trans-unit id="RowHeader_AllowMultiValue"> <source>Multiple values are allowed: {0}</source> <target state="translated">Je povoleno vce hodnot: {0}</target> <note>{0} is a boolean flag</note> </trans-unit> <trans-unit id="RowHeader_DefaultIfOptionWithoutValue"> <source>Default if option is provided without a value: {0}</source> <target state="translated">Vchoz monost, pokud se zadala monost bez hodnoty: {0}</target> <note>{0} is default value if option was provided without a value</note> </trans-unit> <trans-unit id="RowHeader_DefaultValue"> <source>Default: {0}</source> <target state="translated">Vchoz: {0}</target> <note>{0} is default value for option</note> </trans-unit> <trans-unit id="RowHeader_Description"> <source>Description: {0}</source> <target state="translated">Popis: {0}</target> <note /> </trans-unit> <trans-unit id="RowHeader_TemplateAuthor"> <source>Author: {0}</source> <target state="translated">Autor: {0}</target> <note /> </trans-unit> <trans-unit id="RowHeader_Type"> <source>Type: {0}</source> <target state="translated">Typ: {0}</target> <note>{0} is option type (string, boolean, etc)</note> </trans-unit> <trans-unit id="SectionHeader_TemplateSpecificOptions"> <source>Template options:</source> <target state="translated">Monosti ablony:</target> <note /> </trans-unit> <trans-unit id="TableHeader_AmbiguousTemplatesList"> <source>Unable to resolve the template, these templates matched your input:</source> <target state="translated">Nelze peloit ablonu. Tyto ablony odpovdaj vaemu vstupu:</target> <note /> </trans-unit> <trans-unit id="Text_ChoiceArgumentHelpName"> <source>choice</source> <target state="translated">volba</target> <note>this text is used as argument help name when list of possible values is too long to fit the screen, " --my-o &lt;choice&gt;"</note> </trans-unit> <trans-unit id="Text_Disabled"> <source>Enabled: *false*</source> <target state="translated">Povoleno: *false*</target> <note>Indication that parameter is not enabled</note> </trans-unit> <trans-unit id="Text_EnabledCondition"> <source>Enabled if: {0}</source> <target state="translated">Povoleno, pokud: {0}</target> <note>{0} is the condition expression</note> </trans-unit> <trans-unit id="Text_NoTemplateOptions"> <source>(No options)</source> <target state="translated">(dn monosti)</target> <note /> </trans-unit> <trans-unit id="Text_Required"> <source>Required: *true*</source> <target state="translated">Povinn: *true*</target> <note>Indication that parameter is always required, do not translate "true".</note> </trans-unit> <trans-unit id="Text_RequiredCondition"> <source>Required if: {0}</source> <target state="translated">Povinn, pokud: {0}</target> <note>{0} is the condition expression</note> </trans-unit> <trans-unit id="Text_UsageTemplateOptionsPart"> <source>[template options]</source> <target state="translated">[monosti ablony]</target> <note>this text will be used as part of command usage: dotnet new console [options] [template options]</note> </trans-unit> </body> </file> </xliff> ```
/content/code_sandbox/src/Cli/Microsoft.TemplateEngine.Cli/Commands/xlf/HelpStrings.cs.xlf
xml
2016-07-22T21:26:02
2024-08-16T17:23:58
sdk
dotnet/sdk
2,627
1,457