text stringlengths 9 39.2M | dir stringlengths 26 295 | lang stringclasses 185
values | created_date timestamp[us] | updated_date timestamp[us] | repo_name stringlengths 1 97 | repo_full_name stringlengths 7 106 | star int64 1k 183k | len_tokens int64 1 13.8M |
|---|---|---|---|---|---|---|---|---|
```xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="path_to_url"
android:layout_width="match_parent"
android:layout_height="@dimen/home_recommend_foot_layout_height"
android:paddingEnd="@dimen/card_margin"
android:paddingStart="@dimen/card_margin">
<Button
android:id="@+id/item_btn_more"
android:layout_width="@dimen/home_recommend_foot_button_width"
android:layout_height="@dimen/home_recommend_foot_button_height"
android:layout_alignParentStart="true"
android:layout_centerInParent="true"
android:background="@drawable/btn_more_white"
android:text="@string/look_more"
android:textColor="@color/font_normal"
android:textSize="@dimen/default_small_text_size"
android:visibility="visible" />
<LinearLayout
android:id="@+id/item_refresh_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerInParent="true"
android:gravity="center"
android:orientation="horizontal"
android:visibility="visible">
<TextView
android:id="@+id/item_dynamic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/black_80"
android:textSize="@dimen/default_tiny_text_size" />
<Space
android:layout_width="@dimen/default_tiny_padding"
android:layout_height="wrap_content" />
<ImageView
android:id="@+id/item_btn_refresh"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_category_more_refresh"
android:tint="@color/refresh_pink_background" />
</LinearLayout>
<LinearLayout
android:id="@+id/item_recommend_refresh_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center"
android:orientation="horizontal"
android:visibility="gone">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/change_recommend"
android:textColor="@color/black_80"
android:textSize="@dimen/default_tiny_text_size" />
<Space
android:layout_width="@dimen/home_recommend_foot_refresh_margin"
android:layout_height="wrap_content" />
<ImageView
android:id="@+id/item_recommend_refresh"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_category_more_refresh"
android:tint="@color/refresh_pink_background" />
</LinearLayout>
<LinearLayout
android:id="@+id/item_bangumi_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:paddingEnd="@dimen/default_tiny_padding"
android:paddingStart="@dimen/default_tiny_padding"
android:visibility="gone">
<ImageView
android:id="@+id/item_btn_bangumi_timeline"
android:layout_width="match_parent"
android:layout_height="@dimen/home_recommend_foot_bangumi_layout_height"
android:layout_weight="1"
android:background="@drawable/bangumi_timeline_background"
android:scaleType="center"
android:src="@drawable/bangumi_timeline_text" />
<Space
android:layout_width="@dimen/default_general_margin"
android:layout_height="wrap_content" />
<ImageView
android:id="@+id/item_btn_bangumi_index"
android:layout_width="match_parent"
android:layout_height="@dimen/home_recommend_foot_bangumi_layout_height"
android:layout_weight="1"
android:background="@drawable/bangumi_index_background"
android:scaleType="center"
android:src="@drawable/bangumi_index_text" />
</LinearLayout>
</RelativeLayout>
``` | /content/code_sandbox/app/src/main/res/layout/layout_home_recommend_foot.xml | xml | 2016-06-01T04:36:01 | 2024-08-14T06:51:22 | bilibili-android-client | HotBitmapGG/bilibili-android-client | 4,487 | 882 |
```xml
// See LICENSE in the project root for license information.
import * as tsdoc from '@microsoft/tsdoc';
import { ApiItem, type IApiItemOptions, type IApiItemJson } from './ApiItem';
import type { DeserializerContext } from '../model/DeserializerContext';
/**
* Constructor options for {@link ApiDocumentedItem}.
* @public
*/
export interface IApiDocumentedItemOptions extends IApiItemOptions {
docComment: tsdoc.DocComment | undefined;
}
export interface IApiDocumentedItemJson extends IApiItemJson {
docComment: string;
}
/**
* An abstract base class for API declarations that can have an associated TSDoc comment.
*
* @remarks
*
* This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of
* API declarations.
*
* @public
*/
export class ApiDocumentedItem extends ApiItem {
private _tsdocComment: tsdoc.DocComment | undefined;
public constructor(options: IApiDocumentedItemOptions) {
super(options);
this._tsdocComment = options.docComment;
}
/** @override */
public static onDeserializeInto(
options: Partial<IApiDocumentedItemOptions>,
context: DeserializerContext,
jsonObject: IApiItemJson
): void {
super.onDeserializeInto(options, context, jsonObject);
const documentedJson: IApiDocumentedItemJson = jsonObject as IApiDocumentedItemJson;
if (documentedJson.docComment) {
const tsdocParser: tsdoc.TSDocParser = new tsdoc.TSDocParser(context.tsdocConfiguration);
// NOTE: For now, we ignore TSDoc errors found in a serialized .api.json file.
// Normally these errors would have already been reported by API Extractor during analysis.
// However, they could also arise if the JSON file was edited manually, or if the file was saved
// using a different release of the software that used an incompatible syntax.
const parserContext: tsdoc.ParserContext = tsdocParser.parseString(documentedJson.docComment);
options.docComment = parserContext.docComment;
}
}
public get tsdocComment(): tsdoc.DocComment | undefined {
return this._tsdocComment;
}
/** @override */
public serializeInto(jsonObject: Partial<IApiDocumentedItemJson>): void {
super.serializeInto(jsonObject);
if (this.tsdocComment !== undefined) {
jsonObject.docComment = this.tsdocComment.emitAsTsdoc();
} else {
jsonObject.docComment = '';
}
}
}
``` | /content/code_sandbox/libraries/api-extractor-model/src/items/ApiDocumentedItem.ts | xml | 2016-09-30T00:28:20 | 2024-08-16T18:54:35 | rushstack | microsoft/rushstack | 5,790 | 549 |
```xml
import React, { useCallback, useMemo, useState } from 'react'
import WorkspaceExplorer from '../../../WorkspaceExplorer'
import { useNav } from '../../../../lib/stores/nav'
import Button from '../../../../../design/components/atoms/Button'
import styled from '../../../../../design/lib/styled'
import FormRowItem from '../../../../../design/components/molecules/Form/templates/FormRowItem'
import { useToast } from '../../../../../design/lib/stores/toast'
interface FolderSelectProps {
value: string | null
update: (folderId: string) => void
}
const FolderSelect = ({ value, update }: FolderSelectProps) => {
const { foldersMap, workspacesMap } = useNav()
const [selectedWorkspaceId, setSelectedWorkspaceId] = useState(() => {
const initialFolder = foldersMap.get('')
return initialFolder != null ? initialFolder.workspaceId : undefined
})
const [selectedFolderId, setSelectedFolderId] = useState<string | undefined>(
''
)
const [showingFolderExplorer, setShowingFolderExplorer] =
useState<boolean>(false)
const { pushMessage } = useToast()
const [folders, workspaces] = useMemo(() => {
return [Array.from(foldersMap.values()), Array.from(workspacesMap.values())]
}, [foldersMap, workspacesMap])
const saveSelectedFolderId = useCallback(
(folderId) => {
if (folderId != null && folderId != '') {
update(folderId)
} else {
pushMessage({
title: 'Folder selection (change) failed.',
description: 'Please select a valid folder.',
})
}
setShowingFolderExplorer(false)
},
[pushMessage, update]
)
const folderName = useMemo(() => {
const folder = foldersMap.get(value || '')
const workspace = workspacesMap.get(value || '')
if (folder != null) {
return folder.name
} else if (workspace != null) {
return workspace.name
} else {
return null
}
}, [foldersMap, value, workspacesMap])
return (
<FolderSelectContainer>
<FormRowItem
className={'folder__select__row_container'}
item={{
type: 'select',
props: {
placeholder: 'Select..',
value:
folderName == null
? null
: { label: folderName, value: value || '' },
options: [],
onChange: () => {
// no need - used as a selector opener which will call on change when needed
},
onMenuOpen: () => {
setShowingFolderExplorer(!showingFolderExplorer)
},
isMenuOpen: false,
},
}}
/>
{showingFolderExplorer && (
<div className={'folder__select__explorer__row'}>
<WorkspaceExplorer
workspaces={workspaces}
folders={folders}
selectedWorkspaceId={selectedWorkspaceId}
selectedFolderId={selectedFolderId}
setSelectedWorkspaceId={setSelectedWorkspaceId}
setSelectedFolderId={setSelectedFolderId}
/>
<Button
className={'folder__select__save_button'}
variant={'secondary'}
onClick={() =>
saveSelectedFolderId(
selectedFolderId != null
? selectedFolderId
: selectedWorkspaceId
)
}
>
Save
</Button>
</div>
)}
</FolderSelectContainer>
)
}
export default FolderSelect
const FolderSelectContainer = styled.div`
display: flex;
flex-direction: column;
align-items: self-start;
max-width: 800px;
.folder__select__row_container {
min-width: 160px;
}
.folder__select__explorer__row {
margin-top: ${({ theme }) => theme.sizes.spaces.sm}px;
display: flex;
flex-direction: column;
}
.folder__select__save_button {
margin-top: ${({ theme }) => theme.sizes.spaces.sm}px;
align-self: self-start;
}
`
``` | /content/code_sandbox/src/cloud/components/Modal/contents/SmartView/FolderSelect.tsx | xml | 2016-11-19T14:30:34 | 2024-08-16T03:13:45 | BoostNote-App | BoostIO/BoostNote-App | 3,745 | 860 |
```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
*/
/**
* Runtime environment that provide js libaries calls.
*/
import { Pointer } from "./ctypes";
import { LibraryProvider } from "./types";
import { assert } from "./support";
import * as ctypes from "./ctypes";
/**
* Detect library provider from the importObject.
*
* @param importObject The import object.
*/
function detectLibraryProvider(
importObject: Record<string, any>
): LibraryProvider | undefined {
if (
importObject["wasmLibraryProvider"] &&
importObject["wasmLibraryProvider"]["start"] &&
importObject["wasmLibraryProvider"]["imports"] !== undefined
) {
const item = importObject as { wasmLibraryProvider: LibraryProvider };
// create provider so that we capture imports in the provider.
return {
imports: item.wasmLibraryProvider.imports,
start: (inst: WebAssembly.Instance): void => {
item.wasmLibraryProvider.start(inst);
},
};
} else if (importObject["imports"] && importObject["start"] !== undefined) {
return importObject as LibraryProvider;
} else if (importObject["wasiImport"] && importObject["start"] !== undefined) {
// WASI
return {
imports: {
"wasi_snapshot_preview1": importObject["wasiImport"],
},
start: (inst: WebAssembly.Instance): void => {
importObject["start"](inst);
}
};
} else {
return undefined;
}
}
/**
* Environment to impelement most of the JS library functions.
*/
export class Environment implements LibraryProvider {
logger: (msg: string) => void;
imports: Record<string, any>;
/**
* Maintains a table of FTVMWasmPackedCFunc that the C part
* can call via TVMWasmPackedCFunc.
*
* We maintain a separate table so that we can have un-limited amount
* of functions that do not maps to the address space.
*/
packedCFuncTable: Array<ctypes.FTVMWasmPackedCFunc | undefined> = [
undefined,
];
/**
* Free table index that can be recycled.
*/
packedCFuncTableFreeId: Array<number> = [];
private libProvider?: LibraryProvider;
constructor(
importObject: Record<string, any> = {},
logger: (msg: string) => void = console.log
) {
this.logger = logger;
this.libProvider = detectLibraryProvider(importObject);
// get imports from the provider
if (this.libProvider !== undefined) {
this.imports = this.libProvider.imports;
} else {
this.imports = importObject;
}
// update with more functions
this.imports.env = this.environment(this.imports.env);
}
/** Mark the start of the instance. */
start(inst: WebAssembly.Instance): void {
if (this.libProvider !== undefined) {
this.libProvider.start(inst);
}
}
private environment(initEnv: Record<string, any>): Record<string, any> {
// default env can be overriden by libraries.
const defaultEnv = {
"__cxa_thread_atexit": (): void => {},
// eslint-disable-next-line @typescript-eslint/no-unused-vars
"emscripten_notify_memory_growth": (index: number): void => {}
};
const wasmPackedCFunc: ctypes.FTVMWasmPackedCFunc = (
args: Pointer,
typeCodes: Pointer,
nargs: number,
ret: Pointer,
resourceHandle: Pointer
): number => {
const cfunc = this.packedCFuncTable[resourceHandle];
assert(cfunc !== undefined);
return cfunc(args, typeCodes, nargs, ret, resourceHandle);
};
const wasmPackedCFuncFinalizer: ctypes.FTVMWasmPackedCFuncFinalizer = (
resourceHandle: Pointer
): void => {
this.packedCFuncTable[resourceHandle] = undefined;
this.packedCFuncTableFreeId.push(resourceHandle);
};
const newEnv = {
TVMWasmPackedCFunc: wasmPackedCFunc,
TVMWasmPackedCFuncFinalizer: wasmPackedCFuncFinalizer,
"__console_log": (msg: string): void => {
this.logger(msg);
}
};
return Object.assign(defaultEnv, initEnv, newEnv);
}
}
``` | /content/code_sandbox/web/src/environment.ts | xml | 2016-10-12T22:20:28 | 2024-08-16T11:24:08 | tvm | apache/tvm | 11,517 | 1,032 |
```xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="path_to_url"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/view_toolbar"
android:id="@+id/toolbar"/>
<com.prolificinteractive.materialcalendarview.MaterialCalendarView
xmlns:app="path_to_url"
android:id="@+id/view_calender"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:mcv_showOtherDates="all"
app:mcv_selectionColor="@color/colorPrimary"
/>
<TextView
android:id="@+id/tv_calender_enter"
android:layout_margin="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="@color/colorPrimary"
android:layout_gravity="end" />
</LinearLayout>
``` | /content/code_sandbox/app/src/main/res/layout/activity_calender.xml | xml | 2016-08-07T14:56:56 | 2024-08-13T01:11:07 | GeekNews | codeestX/GeekNews | 3,498 | 212 |
```xml
import { APPS, APP_NAMES } from '@proton/shared/lib/constants';
import { CryptoWorkerOptions } from '@proton/shared/lib/helpers/setupCryptoWorker';
import clamp from '@proton/utils/clamp';
export const getCryptoWorkerOptions = (
appName: APP_NAMES,
openpgpConfigOptions: NonNullable<CryptoWorkerOptions['openpgpConfigOptions']>
): CryptoWorkerOptions => {
// The account and vpn app typically requires less crypto workers than others, mainly for SRP and key management.
// This is to avoid loading too many workers to prevent load issues.
if (appName === APPS.PROTONACCOUNT || appName === APPS.PROTONVPN_SETTINGS) {
return {
poolSize: clamp(navigator.hardwareConcurrency, 1, 2),
openpgpConfigOptions,
};
}
return { openpgpConfigOptions };
};
``` | /content/code_sandbox/packages/account/bootstrap/cryptoWorkerOptions.ts | xml | 2016-06-08T11:16:51 | 2024-08-16T14:14:27 | WebClients | ProtonMail/WebClients | 4,300 | 184 |
```xml
import { Component, Input } from "@angular/core";
import { Icon } from "../icon";
import { SideNavService } from "./side-nav.service";
@Component({
selector: "bit-nav-logo",
templateUrl: "./nav-logo.component.html",
})
export class NavLogoComponent {
/** Icon that is displayed when the side nav is closed */
@Input() closedIcon = "bwi-shield";
/** Icon that is displayed when the side nav is open */
@Input({ required: true }) openIcon: Icon;
/**
* Route to be passed to internal `routerLink`
*/
@Input({ required: true }) route: string | any[];
/** Passed to `attr.aria-label` and `attr.title` */
@Input({ required: true }) label: string;
constructor(protected sideNavService: SideNavService) {}
}
``` | /content/code_sandbox/libs/components/src/navigation/nav-logo.component.ts | xml | 2016-03-09T23:14:01 | 2024-08-16T15:07:51 | clients | bitwarden/clients | 8,877 | 182 |
```xml
export { default as PlaylistHelper } from './playlist';
export { Playlist, PlaylistTrack } from './playlist/types';
``` | /content/code_sandbox/packages/core/src/helpers/index.ts | xml | 2016-09-22T22:58:21 | 2024-08-16T15:47:39 | nuclear | nukeop/nuclear | 11,862 | 24 |
```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "path_to_url">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>JueJinClient</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>NSLocationWhenInUseUsageDescription</key>
<string/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>UIAppFonts</key>
<array>
<string>Entypo.ttf</string>
<string>EvilIcons.ttf</string>
<string>FontAwesome.ttf</string>
<string>Foundation.ttf</string>
<string>Ionicons.ttf</string>
<string>MaterialIcons.ttf</string>
<string>Octicons.ttf</string>
<string>SimpleLineIcons.ttf</string>
<string>Zocial.ttf</string>
</array>
</dict>
</plist>
``` | /content/code_sandbox/ios/JueJinClient/Info.plist | xml | 2016-11-01T11:08:05 | 2024-08-16T10:11:29 | JueJinClient | wangdicoder/JueJinClient | 1,213 | 553 |
```xml
<!--
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~
~ path_to_url
~
~ Unless required by applicable law or agreed to in writing, software
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-->
<dataset>
<metadata data-nodes="write_dataset.t_shadow,write_shadow_dataset.t_shadow,read_dataset.t_shadow">
<column name="order_id" type="long" />
<column name="user_id" type="int" />
<column name="order_name" type="varchar" />
<column name="type_char" type="char" />
<column name="type_boolean" type="boolean" />
<column name="type_smallint" type="smallint" />
<column name="type_enum" type="enum#season" />
<column name="type_decimal" type="decimal" />
<column name="type_date" type="Date" />
<column name="type_time" type="time" />
<column name="type_timestamp" type="timestamp" />
</metadata>
<metadata data-nodes="write_dataset.t_merchant,write_shadow_dataset.t_merchant,read_dataset.t_merchant">
<column name="merchant_id" type="numeric" />
<column name="country_id" type="numeric" />
<column name="merchant_name" type="varchar" />
<column name="business_code" type="varchar" />
<column name="telephone" type="varchar" />
<column name="creation_date" type="datetime" />
</metadata>
<row data-node="write_dataset.t_shadow" values="1, 1, pro_order, S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
<row data-node="write_dataset.t_shadow" values="2, 1, pro_order, S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
<row data-node="write_dataset.t_shadow" values="3, 1, pro_order, S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
<row data-node="write_dataset.t_shadow" values="4, 1, pro_order, S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
<row data-node="write_dataset.t_shadow" values="5, 1, pro_order, S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
<row data-node="write_shadow_dataset.t_shadow" values="1, 0, shadow_order, S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
<row data-node="write_shadow_dataset.t_shadow" values="2, 0, shadow_order, S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
<row data-node="write_shadow_dataset.t_shadow" values="3, 0, shadow_order, S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
<row data-node="write_shadow_dataset.t_shadow" values="4, 0, shadow_order, S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
<row data-node="write_shadow_dataset.t_shadow" values="5, 0, shadow_order, S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
<row data-node="read_dataset.t_shadow" values="1, 1, read_order, S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
<row data-node="read_dataset.t_shadow" values="2, 1, read_order, S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
<row data-node="read_dataset.t_shadow" values="3, 1, read_order, S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
<row data-node="read_dataset.t_shadow" values="4, 1, read_order, S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
<row data-node="read_dataset.t_shadow" values="5, 1, read_order, S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
<row data-node="write_dataset.t_merchant" values="1, 86, tencent, 86000001, 86100000001, 2017-08-08" />
<row data-node="write_dataset.t_merchant" values="2, 86, haier, 86000002, 86100000002, 2017-08-08" />
<row data-node="write_dataset.t_merchant" values="3, 86, huawei, 86000003, 86100000003, 2017-08-08" />
<row data-node="write_dataset.t_merchant" values="4, 86, alibaba, 86000004, 86100000004, 2017-08-08" />
<row data-node="write_dataset.t_merchant" values="5, 86, lenovo, 86000005, 86100000005, 2017-08-08" />
<row data-node="write_dataset.t_merchant" values="6, 86, moutai, 86000006, 86100000006, 2017-08-08" />
<row data-node="write_dataset.t_merchant" values="7, 86, baidu, 86000007, 86100000007, 2017-08-08" />
<row data-node="write_dataset.t_merchant" values="8, 86, xiaomi, 86000008, 86100000008, 2017-08-08" />
<row data-node="write_dataset.t_merchant" values="9, 86, vivo, 86000009, 86100000009, 2017-08-08" />
<row data-node="write_dataset.t_merchant" values="10, 86, oppo, 86000010, 86100000010, 2017-08-08" />
<row data-node="write_dataset.t_merchant" values="11, 1, google, 01000011, 01100000011, 2017-08-08" />
<row data-node="write_dataset.t_merchant" values="12, 1, walmart, 01000012, 01100000012, 2017-08-08" />
<row data-node="write_dataset.t_merchant" values="13, 1, amazon, 01000013, 01100000013, 2017-08-08" />
<row data-node="write_dataset.t_merchant" values="14, 1, apple, 01000014, 01100000014, 2017-08-08" />
<row data-node="write_dataset.t_merchant" values="15, 1, microsoft, 01000015, 01100000015, 2017-08-08" />
<row data-node="write_dataset.t_merchant" values="16, 1, dell, 01000016, 01100000016, 2017-08-08" />
<row data-node="write_dataset.t_merchant" values="17, 1, johnson, 01000017, 01100000017, 2017-08-08" />
<row data-node="write_dataset.t_merchant" values="18, 1, intel, 01000018, 01100000018, 2017-08-08" />
<row data-node="write_dataset.t_merchant" values="19, 1, hp, 01000019, 01100000019, 2017-08-08" />
<row data-node="write_dataset.t_merchant" values="20, 1, tesla, 01000020, 01100000020, 2017-08-08" />
<row data-node="write_shadow_dataset.t_merchant" values="1, 86, shadow_tencent, 86000001, 86100000001, 2017-08-08" />
<row data-node="write_shadow_dataset.t_merchant" values="2, 86, shadow_haier, 86000002, 86100000002, 2017-08-08" />
<row data-node="write_shadow_dataset.t_merchant" values="3, 86, shadow_huawei, 86000003, 86100000003, 2017-08-08" />
<row data-node="write_shadow_dataset.t_merchant" values="4, 86, shadow_alibaba, 86000004, 86100000004, 2017-08-08" />
<row data-node="write_shadow_dataset.t_merchant" values="5, 86, shadow_lenovo, 86000005, 86100000005, 2017-08-08" />
<row data-node="write_shadow_dataset.t_merchant" values="6, 86, shadow_moutai, 86000006, 86100000006, 2017-08-08" />
<row data-node="write_shadow_dataset.t_merchant" values="7, 86, shadow_baidu, 86000007, 86100000007, 2017-08-08" />
<row data-node="write_shadow_dataset.t_merchant" values="8, 86, shadow_xiaomi, 86000008, 86100000008, 2017-08-08" />
<row data-node="write_shadow_dataset.t_merchant" values="9, 86, shadow_vivo, 86000009, 86100000009, 2017-08-08" />
<row data-node="write_shadow_dataset.t_merchant" values="10, 86, shadow_oppo, 86000010, 86100000010, 2017-08-08" />
<row data-node="write_shadow_dataset.t_merchant" values="11, 1, shadow_google, 01000011, 01100000011, 2017-08-08" />
<row data-node="write_shadow_dataset.t_merchant" values="12, 1, shadow_walmart, 01000012, 01100000012, 2017-08-08" />
<row data-node="write_shadow_dataset.t_merchant" values="13, 1, shadow_amazon, 01000013, 01100000013, 2017-08-08" />
<row data-node="write_shadow_dataset.t_merchant" values="14, 1, shadow_apple, 01000014, 01100000014, 2017-08-08" />
<row data-node="write_shadow_dataset.t_merchant" values="15, 1, shadow_microsoft, 01000015, 01100000015, 2017-08-08" />
<row data-node="write_shadow_dataset.t_merchant" values="16, 1, shadow_dell, 01000016, 01100000016, 2017-08-08" />
<row data-node="write_shadow_dataset.t_merchant" values="17, 1, shadow_johnson, 01000017, 01100000017, 2017-08-08" />
<row data-node="write_shadow_dataset.t_merchant" values="18, 1, shadow_intel, 01000018, 01100000018, 2017-08-08" />
<row data-node="write_shadow_dataset.t_merchant" values="19, 1, shadow_hp, 01000019, 01100000019, 2017-08-08" />
<row data-node="write_shadow_dataset.t_merchant" values="20, 1, shadow_tesla, 01000020, 01100000020, 2017-08-08" />
<row data-node="read_dataset.t_merchant" values="1, 86, tencent, 86000001, 86100000001, 2017-08-08" />
<row data-node="read_dataset.t_merchant" values="2, 86, haier, 86000002, 86100000002, 2017-08-08" />
<row data-node="read_dataset.t_merchant" values="3, 86, huawei, 86000003, 86100000003, 2017-08-08" />
<row data-node="read_dataset.t_merchant" values="4, 86, alibaba, 86000004, 86100000004, 2017-08-08" />
<row data-node="read_dataset.t_merchant" values="5, 86, lenovo, 86000005, 86100000005, 2017-08-08" />
<row data-node="read_dataset.t_merchant" values="6, 86, moutai, 86000006, 86100000006, 2017-08-08" />
<row data-node="read_dataset.t_merchant" values="7, 86, baidu, 86000007, 86100000007, 2017-08-08" />
<row data-node="read_dataset.t_merchant" values="8, 86, xiaomi, 86000008, 86100000008, 2017-08-08" />
<row data-node="read_dataset.t_merchant" values="9, 86, vivo, 86000009, 86100000009, 2017-08-08" />
<row data-node="read_dataset.t_merchant" values="10, 86, oppo, 86000010, 86100000010, 2017-08-08" />
<row data-node="read_dataset.t_merchant" values="11, 1, google, 01000011, 01100000011, 2017-08-08" />
<row data-node="read_dataset.t_merchant" values="12, 1, walmart, 01000012, 01100000012, 2017-08-08" />
<row data-node="read_dataset.t_merchant" values="13, 1, amazon, 01000013, 01100000013, 2017-08-08" />
<row data-node="read_dataset.t_merchant" values="14, 1, apple, 01000014, 01100000014, 2017-08-08" />
<row data-node="read_dataset.t_merchant" values="15, 1, microsoft, 01000015, 01100000015, 2017-08-08" />
<row data-node="read_dataset.t_merchant" values="16, 1, dell, 01000016, 01100000016, 2017-08-08" />
<row data-node="read_dataset.t_merchant" values="17, 1, johnson, 01000017, 01100000017, 2017-08-08" />
<row data-node="read_dataset.t_merchant" values="18, 1, intel, 01000018, 01100000018, 2017-08-08" />
<row data-node="read_dataset.t_merchant" values="19, 1, hp, 01000019, 01100000019, 2017-08-08" />
<row data-node="read_dataset.t_merchant" values="20, 1, tesla, 01000020, 01100000020, 2017-08-08" />
</dataset>
``` | /content/code_sandbox/test/e2e/sql/src/test/resources/env/scenario/readwrite_splitting_and_shadow/data/expected/dataset.xml | xml | 2016-01-18T12:49:26 | 2024-08-16T15:48:11 | shardingsphere | apache/shardingsphere | 19,707 | 3,917 |
```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="db.t_order">
<column name="order_id" type="numeric" />
<column name="user_id" type="numeric" />
<column name="status" type="varchar" />
</metadata>
<row data-node="db.t_order" values="1000, 10, update" />
<row data-node="db.t_order" values="1001, 10, init" />
<row data-node="db.t_order" values="1100, 11, init" />
<row data-node="db.t_order" values="1101, 11, init" />
<row data-node="db.t_order" values="1200, 12, init" />
<row data-node="db.t_order" values="1201, 12, init" />
<row data-node="db.t_order" values="1300, 13, init" />
<row data-node="db.t_order" values="1301, 13, init" />
<row data-node="db.t_order" values="1400, 14, init" />
<row data-node="db.t_order" values="1401, 14, init" />
<row data-node="db.t_order" values="1500, 15, init" />
<row data-node="db.t_order" values="1501, 15, init" />
<row data-node="db.t_order" values="1600, 16, init" />
<row data-node="db.t_order" values="1601, 16, init" />
<row data-node="db.t_order" values="1700, 17, init" />
<row data-node="db.t_order" values="1701, 17, init" />
<row data-node="db.t_order" values="1800, 18, init" />
<row data-node="db.t_order" values="1801, 18, init" />
<row data-node="db.t_order" values="1900, 19, init" />
<row data-node="db.t_order" values="1901, 19, init" />
<row data-node="db.t_order" values="2000, 20, init" />
<row data-node="db.t_order" values="2001, 20, init" />
<row data-node="db.t_order" values="2100, 21, init" />
<row data-node="db.t_order" values="2101, 21, init" />
<row data-node="db.t_order" values="2200, 22, init" />
<row data-node="db.t_order" values="2201, 22, init" />
<row data-node="db.t_order" values="2300, 23, init" />
<row data-node="db.t_order" values="2301, 23, init" />
<row data-node="db.t_order" values="2400, 24, init" />
<row data-node="db.t_order" values="2401, 24, init" />
<row data-node="db.t_order" values="2500, 25, init" />
<row data-node="db.t_order" values="2501, 25, init" />
<row data-node="db.t_order" values="2600, 26, init" />
<row data-node="db.t_order" values="2601, 26, init" />
<row data-node="db.t_order" values="2700, 27, init" />
<row data-node="db.t_order" values="2701, 27, init" />
<row data-node="db.t_order" values="2800, 28, init" />
<row data-node="db.t_order" values="2801, 28, init" />
<row data-node="db.t_order" values="2900, 29, init" />
<row data-node="db.t_order" values="2901, 29, init" />
</dataset>
``` | /content/code_sandbox/test/e2e/sql/src/test/resources/cases/dml/dataset/shadow/update.xml | xml | 2016-01-18T12:49:26 | 2024-08-16T15:48:11 | shardingsphere | apache/shardingsphere | 19,707 | 975 |
```xml
///
///
///
/// path_to_url
///
/// Unless required by applicable law or agreed to in writing, software
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
///
import { Component } from '@angular/core';
import { WidgetSettings, WidgetSettingsComponent } from '@shared/models/widget.models';
import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import {
aggregatedValueCardDefaultKeySettings,
AggregatedValueCardKeyPosition,
aggregatedValueCardKeyPositionTranslations
} from '@home/components/widget/lib/cards/aggregated-value-card.models';
import { constantColor } from '@shared/models/widget-settings.models';
@Component({
selector: 'tb-aggregated-value-card-key-settings',
templateUrl: './aggregated-value-card-key-settings.component.html',
styleUrls: ['./../widget-settings.scss']
})
export class AggregatedValueCardKeySettingsComponent extends WidgetSettingsComponent {
aggregatedValueCardKeyPositions: AggregatedValueCardKeyPosition[] =
Object.keys(AggregatedValueCardKeyPosition).map(value => AggregatedValueCardKeyPosition[value]);
aggregatedValueCardKeyPositionTranslationMap = aggregatedValueCardKeyPositionTranslations;
aggregatedValueCardKeySettingsForm: UntypedFormGroup;
constructor(protected store: Store<AppState>,
private fb: UntypedFormBuilder) {
super(store);
}
protected settingsForm(): UntypedFormGroup {
return this.aggregatedValueCardKeySettingsForm;
}
protected defaultSettings(): WidgetSettings {
return {...aggregatedValueCardDefaultKeySettings};
}
protected onSettingsSet(settings: WidgetSettings) {
this.aggregatedValueCardKeySettingsForm = this.fb.group({
position: [settings.position, []],
font: [settings.font, []],
color: [settings.color, []],
showArrow: [settings.showArrow, []]
});
}
}
``` | /content/code_sandbox/ui-ngx/src/app/modules/home/components/widget/lib/settings/cards/aggregated-value-card-key-settings.component.ts | xml | 2016-12-01T09:33:30 | 2024-08-16T19:58:25 | thingsboard | thingsboard/thingsboard | 16,820 | 406 |
```xml
declare function skewness(arr: number[]): number
declare function skewness(...arr: number[]): number
export default skewness
``` | /content/code_sandbox/packages/array-skewness/index.d.ts | xml | 2016-06-26T02:04:54 | 2024-08-15T00:08:43 | just | angus-c/just | 5,974 | 27 |
```xml
export class ProductionInfo {
role: string = undefined;
originatedFromPrimitive: string = undefined;
static fromRawData(rawProductionInfo) {
const info = new ProductionInfo();
function collectProductionInfo(rawInfo) {
Object.keys(info).forEach(attr => {
if (info[attr] === undefined && rawInfo[attr] !== undefined) {
info[attr] = rawInfo[attr]
}
});
if (rawInfo.derived) {
rawInfo.derived.forEach(d => collectProductionInfo(d));
}
}
collectProductionInfo(rawProductionInfo);
return info;
}
}
``` | /content/code_sandbox/web/app/cad/model/productionInfo.ts | xml | 2016-08-26T21:55:19 | 2024-08-15T01:02:53 | jsketcher | xibyte/jsketcher | 1,461 | 132 |
```xml
import { formatDate } from '@/portainer/filters/filters';
import { columnHelper } from './helper';
export const creationDate = columnHelper.accessor(
(row) => formatDate(row.creationDate),
{
header: 'Creation Date',
cell: ({ getValue }) => getValue(),
}
);
``` | /content/code_sandbox/app/react/kubernetes/applications/DetailsView/ApplicationContainersDatatable/columns/creationDate.tsx | xml | 2016-05-19T20:15:28 | 2024-08-16T19:15:14 | portainer | portainer/portainer | 30,083 | 64 |
```xml
export * from './Waffle'
export * from './ResponsiveWaffle'
export * from './WaffleHtml'
export * from './ResponsiveWaffleHtml'
export * from './WaffleCanvas'
export * from './ResponsiveWaffleCanvas'
export * from './types'
export * from './defaults'
``` | /content/code_sandbox/packages/waffle/src/index.ts | xml | 2016-04-16T03:27:56 | 2024-08-16T03:38:37 | nivo | plouc/nivo | 13,010 | 62 |
```xml
import * as React from 'react';
import {
Popover,
PopoverTrigger,
PopoverSurface,
Button,
makeStyles,
Checkbox,
SpinButton,
Label,
} from '@fluentui/react-components';
const useStyles = makeStyles({
boundary: {
border: '2px dashed red',
padding: '20px',
width: '300px',
height: '300px',
display: 'flex',
flexDirection: 'column',
alignItems: 'end',
},
trigger: {
display: 'block',
width: '150px',
marginTop: '60px',
},
});
export const OverflowBoundaryPadding = () => {
const styles = useStyles();
const [boundaryRef, setBoundaryRef] = React.useState<HTMLDivElement | null>(null);
const [open, setOpen] = React.useState(false);
const [padding, setPadding] = React.useState(8);
return (
<>
<div>
<Checkbox
labelPosition="before"
label="Open"
checked={open}
onChange={(e, data) => setOpen(data.checked as boolean)}
/>
</div>
<div>
<Label style={{ marginRight: 4, marginLeft: 8 }} htmlFor="boundary-padding">
Padding
</Label>
<SpinButton id="boundary-padding" value={padding} onChange={(e, { value }) => value && setPadding(value)} />
</div>
<div ref={setBoundaryRef} className={styles.boundary}>
<Popover
open={open}
positioning={{
overflowBoundary: boundaryRef,
overflowBoundaryPadding: padding,
position: 'below',
align: 'start',
}}
>
<PopoverTrigger disableButtonEnhancement>
<Button className={styles.trigger}>Shorthand padding</Button>
</PopoverTrigger>
<PopoverSurface>10px padding from boundary</PopoverSurface>
</Popover>
<Popover
open={open}
positioning={{
overflowBoundary: boundaryRef,
overflowBoundaryPadding: { end: padding, top: 0, start: 0, bottom: 0 },
position: 'below',
align: 'start',
}}
>
<PopoverTrigger disableButtonEnhancement>
<Button className={styles.trigger}>Longhand padding</Button>
</PopoverTrigger>
<PopoverSurface>10px padding from boundary end</PopoverSurface>
</Popover>
</div>
</>
);
};
OverflowBoundaryPadding.parameters = {
docs: {
description: {
story: [
'The `overflowBoundaryPadding` property sets the padding between the positioned element and the',
'chosen boundary. The padding can be a shorthand number which applies for all sides, or an object',
'That explicitly sets the padding for each side.',
'',
'> _Design guidance recommenends using **8px** or **4px** if a padding is required._',
'_Custom values are also possible but should stay within a 4px grid, please consult your_',
'_designer if a custom padding is required._',
].join('\n'),
},
},
};
``` | /content/code_sandbox/apps/public-docsite-v9/src/Concepts/Positioning/OverflowBoundaryPadding.stories.tsx | xml | 2016-06-06T15:03:44 | 2024-08-16T18:49:29 | fluentui | microsoft/fluentui | 18,221 | 670 |
```xml
import * as compose from 'lodash.flowright';
import { mutations, queries } from '../../graphql';
import { Alert } from '@erxes/ui/src/utils';
import { ConfirmRequestMutationResponse } from '../../types';
import React from 'react';
import RequestedFileList from '../../components/file/RequestedFilesList';
import Spinner from '@erxes/ui/src/components/Spinner';
import { gql } from '@apollo/client';
import { graphql } from '@apollo/client/react/hoc';
type Props = {
fileId: string;
};
type FinalProps = {
getAccessRequestQuery: any;
} & Props &
ConfirmRequestMutationResponse;
const RequestedFilesListContainer = ({
confirmRequestMutation,
getAccessRequestQuery
}: FinalProps) => {
if (getAccessRequestQuery && getAccessRequestQuery.loading) {
return <Spinner objective={true} />;
}
const onConfirm = (requestId: string) => {
confirmRequestMutation({
variables: {
requestId
}
})
.then(() => {
Alert.success('Request confirmed!');
})
.catch(error => {
Alert.error(error.message);
});
};
const accessRequests =
getAccessRequestQuery.filemanagerGetAccessRequests || ([] as any);
return <RequestedFileList requests={accessRequests} onConfirm={onConfirm} />;
};
export default compose(
graphql<Props>(gql(queries.filemanagerGetAccessRequests), {
name: 'getAccessRequestQuery',
options: ({ fileId }: { fileId: string }) => ({
variables: {
fileId
}
})
}),
graphql<Props, ConfirmRequestMutationResponse, {}>(
gql(mutations.filemanagerConfirmAccessRequest),
{
name: 'confirmRequestMutation',
options: ({ fileId }: { fileId: string }) => {
return {
refetchQueries: [
{
query: gql(queries.filemanagerGetAccessRequests),
variables: {
fileId
}
}
]
};
}
}
)
)(RequestedFilesListContainer);
``` | /content/code_sandbox/packages/plugin-filemanager-ui/src/containers/file/RequestedFilesList.tsx | xml | 2016-11-11T06:54:50 | 2024-08-16T10:26:06 | erxes | erxes/erxes | 3,479 | 428 |
```xml
<schemalist>
<schema id='org.gtk.test.schema'>
<key name='test' type='s'>
<aliases/>
</key>
</schema>
</schemalist>
``` | /content/code_sandbox/utilities/glib/gio/tests/schema-tests/bare-alias.gschema.xml | xml | 2016-10-27T09:31:28 | 2024-08-16T19:00:35 | nexmon | seemoo-lab/nexmon | 2,381 | 44 |
```xml
import { Observable } from '../Observable';
import { fromArray } from '../observable/fromArray';
import { scalar } from '../observable/scalar';
import { empty } from '../observable/empty';
import { concat as concatStatic } from '../observable/concat';
import { isScheduler } from '../util/isScheduler';
import { MonoTypeOperatorFunction, OperatorFunction, SchedulerLike } from '../types';
/* tslint:disable:max-line-length */
export function startWith<T>(scheduler?: SchedulerLike): MonoTypeOperatorFunction<T>;
export function startWith<T, D = T>(v1: D, scheduler?: SchedulerLike): OperatorFunction<T, T | D>;
export function startWith<T, D = T, E = T>(v1: D, v2: E, scheduler?: SchedulerLike): OperatorFunction<T, T | D | E>;
export function startWith<T, D = T, E = T, F = T>(v1: D, v2: E, v3: F, scheduler?: SchedulerLike): OperatorFunction<T, T | D | E | F>;
export function startWith<T, D = T, E = T, F = T, G = T>(v1: D, v2: E, v3: F, v4: G, scheduler?: SchedulerLike): OperatorFunction<T, T | D | E | F | G>;
export function startWith<T, D = T, E = T, F = T, G = T, H = T>(v1: D, v2: E, v3: F, v4: G, v5: H, scheduler?: SchedulerLike): OperatorFunction<T, T | D | E | F | G | H>;
export function startWith<T, D = T, E = T, F = T, G = T, H = T, I = T>(v1: D, v2: E, v3: F, v4: G, v5: H, v6: I, scheduler?: SchedulerLike): OperatorFunction<T, T | D | E | F | G | H | I>;
export function startWith<T, D = T>(...array: Array<D | SchedulerLike>): OperatorFunction<T, T | D>;
/* tslint:enable:max-line-length */
/**
* Returns an Observable that emits the items you specify as arguments before it begins to emit
* items emitted by the source Observable.
*
* <span class="informal">First emits its arguments in order, and then any
* emissions from the source.</span>
*
* 
*
* ## Examples
*
* Start the chain of emissions with `"first"`, `"second"`
*
* ```javascript
* of("from source")
* .pipe(startWith("first", "second"))
* .subscribe(x => console.log(x));
*
* // results:
* // "first"
* // "second"
* // "from source"
* ```
*
* @param {...T} values - Items you want the modified Observable to emit first.
* @param {SchedulerLike} [scheduler] - A {@link SchedulerLike} to use for scheduling
* the emissions of the `next` notifications.
* @return {Observable} An Observable that emits the items in the specified Iterable and then emits the items
* emitted by the source Observable.
* @method startWith
* @owner Observable
*/
export function startWith<T, D>(...array: Array<T | SchedulerLike>): OperatorFunction<T, T | D> {
return (source: Observable<T>) => {
let scheduler = <SchedulerLike>array[array.length - 1];
if (isScheduler(scheduler)) {
array.pop();
} else {
scheduler = null;
}
const len = array.length;
if (len === 1 && !scheduler) {
return concatStatic(scalar(array[0] as T), source);
} else if (len > 0) {
return concatStatic(fromArray(array as T[], scheduler), source);
} else {
return concatStatic<T>(empty(scheduler) as any, source);
}
};
}
``` | /content/code_sandbox/deps/node-10.15.3/tools/node_modules/eslint/node_modules/rxjs/src/internal/operators/startWith.ts | xml | 2016-09-05T10:18:44 | 2024-08-11T13:21:40 | LiquidCore | LiquidPlayer/LiquidCore | 1,010 | 867 |
```xml
import { Button, ButtonLike } from '@proton/atoms';
import getNotificationsTexts from '@proton/components/containers/calendar/notifications/getNotificationsTexts';
import type { NotificationModel } from '@proton/shared/lib/interfaces/calendar/Notification';
import addItem from '@proton/utils/addItem';
import clsx from '@proton/utils/clsx';
import removeItem from '@proton/utils/removeIndex';
import updateItem from '@proton/utils/updateItem';
import type { IconName } from '../../../components';
import { Icon, Tooltip } from '../../../components';
import { generateUID } from '../../../helpers';
import NotificationInput from './inputs/NotificationInput';
export const NOTIFICATION_ID = 'notifications';
interface Props {
id: string;
notifications: NotificationModel[];
hasWhen?: boolean;
hasType?: boolean;
fullWidth?: boolean;
canAdd?: boolean;
addIcon?: IconName;
defaultNotification: NotificationModel;
disabled?: boolean;
onChange: (value: NotificationModel[]) => void;
}
const Notifications = ({
id,
notifications,
hasWhen,
hasType,
fullWidth = true,
canAdd = true,
addIcon,
defaultNotification,
disabled,
onChange,
}: Props) => {
const { addNotificationText, addNotificationTitle, removeNotificationText } = getNotificationsTexts();
const noNotificationsButtonClassName = fullWidth ? 'mt-4 md:mt-2' : 'mt-4 lg:mt-0';
return (
<>
{notifications.map((notification, index) => {
const uniqueId = index === 0 ? id : `${id}-${index}`;
return (
<div className="mb-2 flex flex-nowrap items-center" key={notification.id}>
<NotificationInput
id={uniqueId}
hasWhen={hasWhen}
hasType={hasType}
fullWidth={fullWidth}
notification={notification}
disabled={disabled}
onEdit={(newNotification) => onChange(updateItem(notifications, index, newNotification))}
/>
<Tooltip title={removeNotificationText}>
<ButtonLike
data-testid="delete-notification"
className="flex shrink-0 ml-2"
disabled={disabled}
onClick={() => onChange(removeItem(notifications, index))}
icon
type="button"
shape="ghost"
color="norm"
>
<Icon name="trash" className="shrink-0" />
<span className="sr-only">{removeNotificationText}</span>
</ButtonLike>
</Tooltip>
</div>
);
})}
{canAdd && (
<Button
className={clsx([
fullWidth ? 'p-0' : 'p-2',
notifications.length === 0 && noNotificationsButtonClassName,
])}
shape={addIcon ? 'ghost' : 'underline'}
color={addIcon ? 'weak' : 'norm'}
data-testid="add-notification"
title={addNotificationTitle}
disabled={disabled}
onClick={() =>
onChange(addItem(notifications, { ...defaultNotification, id: generateUID('notification') }))
}
>
{addIcon ? (
<span className="flex flex-nowrap w-full items-center">
<Icon name={addIcon} className="mr-2 self-center my-auto" />
{addNotificationText}
</span>
) : (
addNotificationText
)}
</Button>
)}
</>
);
};
export default Notifications;
``` | /content/code_sandbox/packages/components/containers/calendar/notifications/Notifications.tsx | xml | 2016-06-08T11:16:51 | 2024-08-16T14:14:27 | WebClients | ProtonMail/WebClients | 4,300 | 738 |
```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 * as CanvasGauges from 'canvas-gauges';
import { WidgetContext } from '@home/models/widget-component.models';
import {
convertLevelColorsSettingsToColorProcessor,
DigitalGaugeSettings
} from '@home/components/widget/lib/digital-gauge.models';
import tinycolor from 'tinycolor2';
import { isDefined, isDefinedAndNotNull } from '@core/utils';
import { prepareFontSettings } from '@home/components/widget/lib/settings.models';
import { CanvasDigitalGauge, CanvasDigitalGaugeOptions } from '@home/components/widget/lib/canvas-digital-gauge';
import { DatePipe } from '@angular/common';
import { IWidgetSubscription } from '@core/api/widget-api.models';
import { Subscription } from 'rxjs';
import { ColorProcessor, createValueSubscription, ValueSourceType } from '@shared/models/widget-settings.models';
import GenericOptions = CanvasGauges.GenericOptions;
// @dynamic
export class TbCanvasDigitalGauge {
constructor(protected ctx: WidgetContext, canvasId: string) {
const gaugeElement = $('#' + canvasId, ctx.$container)[0];
const settings: DigitalGaugeSettings = ctx.settings;
this.localSettings = {};
this.localSettings.minValue = settings.minValue || 0;
this.localSettings.maxValue = settings.maxValue || 100;
this.localSettings.gaugeType = settings.gaugeType || 'arc';
this.localSettings.neonGlowBrightness = settings.neonGlowBrightness || 0;
this.localSettings.dashThickness = settings.dashThickness || 0;
this.localSettings.roundedLineCap = settings.roundedLineCap === true;
const dataKey = ctx.data[0].dataKey;
const keyColor = settings.defaultColor || dataKey.color;
this.localSettings.unitTitle = ((settings.showUnitTitle === true) ?
(settings.unitTitle && settings.unitTitle.length > 0 ?
settings.unitTitle : dataKey.label) : '');
this.localSettings.showUnitTitle = settings.showUnitTitle === true;
this.localSettings.showTimestamp = settings.showTimestamp === true;
this.localSettings.timestampFormat = settings.timestampFormat && settings.timestampFormat.length ?
settings.timestampFormat : 'yyyy-MM-dd HH:mm:ss';
this.localSettings.gaugeWidthScale = settings.gaugeWidthScale || 0.75;
this.localSettings.gaugeColor = settings.gaugeColor || tinycolor(keyColor).setAlpha(0.2).toRgbString();
convertLevelColorsSettingsToColorProcessor(settings, keyColor);
this.localSettings.barColor = settings.barColor;
this.localSettings.showTicks = settings.showTicks || false;
this.localSettings.ticks = [];
this.localSettings.ticksValue = settings.ticksValue || [];
this.localSettings.tickWidth = settings.tickWidth || 4;
this.localSettings.colorTicks = settings.colorTicks || '#666';
this.localSettings.decimals = isDefined(dataKey.decimals) ? dataKey.decimals :
(isDefinedAndNotNull(settings.decimals) ? settings.decimals : ctx.decimals);
this.localSettings.units = dataKey.units && dataKey.units.length ? dataKey.units :
(isDefined(settings.units) && settings.units.length > 0 ? settings.units : ctx.units);
this.localSettings.hideValue = settings.showValue !== true;
this.localSettings.hideMinMax = settings.showMinMax !== true;
this.localSettings.donutStartAngle = isDefinedAndNotNull(settings.donutStartAngle) ?
-TbCanvasDigitalGauge.toRadians(settings.donutStartAngle) : null;
this.localSettings.title = ((settings.showTitle === true) ?
(settings.title && settings.title.length > 0 ?
settings.title : dataKey.label) : '');
if (!this.localSettings.unitTitle && this.localSettings.showTimestamp) {
this.localSettings.unitTitle = ' ';
}
this.localSettings.titleFont = prepareFontSettings(settings.titleFont, {
size: 12,
style: 'normal',
weight: '500',
color: keyColor
});
this.localSettings.valueFont = prepareFontSettings(settings.valueFont, {
size: 18,
style: 'normal',
weight: '500',
color: keyColor
});
this.localSettings.minMaxFont = prepareFontSettings(settings.minMaxFont, {
size: 10,
style: 'normal',
weight: '500',
color: keyColor
});
this.localSettings.labelFont = prepareFontSettings(settings.labelFont, {
size: 8,
style: 'normal',
weight: '500',
color: keyColor
});
this.barColorProcessor = ColorProcessor.fromSettings(settings.barColor, this.ctx);
const gaugeData: CanvasDigitalGaugeOptions = {
renderTo: gaugeElement,
gaugeWidthScale: this.localSettings.gaugeWidthScale,
gaugeColor: this.localSettings.gaugeColor,
barColorProcessor: this.barColorProcessor,
colorTicks: this.localSettings.colorTicks,
tickWidth: this.localSettings.tickWidth,
ticks: this.localSettings.ticks,
title: this.localSettings.title,
fontTitleSize: this.localSettings.titleFont.size,
fontTitleStyle: this.localSettings.titleFont.style,
fontTitleWeight: this.localSettings.titleFont.weight,
colorTitle: this.localSettings.titleFont.color,
fontTitle: this.localSettings.titleFont.family,
fontValueSize: this.localSettings.valueFont.size,
fontValueStyle: this.localSettings.valueFont.style,
fontValueWeight: this.localSettings.valueFont.weight,
colorValue: this.localSettings.valueFont.color,
fontValue: this.localSettings.valueFont.family,
fontMinMaxSize: this.localSettings.minMaxFont.size,
fontMinMaxStyle: this.localSettings.minMaxFont.style,
fontMinMaxWeight: this.localSettings.minMaxFont.weight,
colorMinMax: this.localSettings.minMaxFont.color,
fontMinMax: this.localSettings.minMaxFont.family,
fontLabelSize: this.localSettings.labelFont.size,
fontLabelStyle: this.localSettings.labelFont.style,
fontLabelWeight: this.localSettings.labelFont.weight,
colorLabel: this.localSettings.labelFont.color,
fontLabel: this.localSettings.labelFont.family,
minValue: this.localSettings.minValue,
maxValue: this.localSettings.maxValue,
gaugeType: this.localSettings.gaugeType,
dashThickness: this.localSettings.dashThickness,
roundedLineCap: this.localSettings.roundedLineCap,
symbol: this.localSettings.units,
unitTitle: this.localSettings.unitTitle,
showUnitTitle: this.localSettings.showUnitTitle,
showTimestamp: this.localSettings.showTimestamp,
hideValue: this.localSettings.hideValue,
hideMinMax: this.localSettings.hideMinMax,
donutStartAngle: this.localSettings.donutStartAngle,
valueDec: this.localSettings.decimals,
neonGlowBrightness: this.localSettings.neonGlowBrightness,
// animations
animation: settings.animation !== false && !ctx.isMobile,
animationDuration: isDefinedAndNotNull(settings.animationDuration) ? settings.animationDuration : 500,
animationRule: settings.animationRule || 'linear',
isMobile: ctx.isMobile
};
this.gauge = new CanvasDigitalGauge(gaugeData).draw();
this.init();
}
private localSettings: DigitalGaugeSettings;
private ticksSourcesSubscription: IWidgetSubscription;
private readonly barColorProcessor: ColorProcessor;
private gauge: CanvasDigitalGauge;
private static toRadians(angle: number): number {
return angle * (Math.PI / 180);
}
init() {
let updateSetting = false;
if (this.localSettings.showTicks && this.localSettings.ticksValue?.length) {
this.localSettings.ticks = this.localSettings.ticksValue
.map(tick => tick.type === ValueSourceType.constant && isFinite(tick.value) ? tick.value : null);
createValueSubscription(
this.ctx,
this.localSettings.ticksValue,
this.updateAttribute.bind(this)
).subscribe((subscription) => {
this.ticksSourcesSubscription = subscription;
});
updateSetting = true;
}
if (updateSetting) {
this.updateSetting();
}
this.barColorProcessor.colorUpdated?.subscribe(() => {
this.gauge.update({} as CanvasDigitalGaugeOptions);
});
}
updateAttribute(subscription: IWidgetSubscription) {
for (const keyData of subscription.data) {
if (keyData && keyData.data && keyData.data[0]) {
const attrValue = keyData.data[0][1];
if (isFinite(attrValue)) {
for (const index of keyData.dataKey.settings.indexes) {
this.localSettings.ticks[index] = attrValue;
}
}
}
}
this.updateSetting();
}
updateSetting() {
(this.gauge.options as CanvasDigitalGaugeOptions).ticks = this.localSettings.ticks;
this.gauge.options = CanvasDigitalGauge.configure(this.gauge.options as CanvasDigitalGaugeOptions);
this.gauge.update({} as CanvasDigitalGaugeOptions);
}
update() {
if (this.ctx.data.length > 0) {
const cellData = this.ctx.data[0];
if (cellData.data.length > 0) {
const tvPair = cellData.data[cellData.data.length -
1];
let timestamp: number;
if (this.localSettings.showTimestamp) {
timestamp = tvPair[0];
const filter = this.ctx.$injector.get(DatePipe);
(this.gauge.options as CanvasDigitalGaugeOptions).labelTimestamp =
filter.transform(timestamp, this.localSettings.timestampFormat);
}
const value = parseFloat(tvPair[1]);
if (value !== this.gauge.value) {
if (!this.gauge.options.animation) {
this.gauge._value = value;
}
this.gauge.value = value;
} else if (this.localSettings.showTimestamp && this.gauge.timestamp !== timestamp) {
this.gauge.timestamp = timestamp;
}
}
}
}
mobileModeChanged() {
const animation = this.ctx.settings.animation !== false && !this.ctx.isMobile;
this.gauge.update({animation, isMobile: this.ctx.isMobile} as CanvasDigitalGaugeOptions);
}
resize() {
this.gauge.update({width: this.ctx.width, height: this.ctx.height} as GenericOptions);
}
destroy() {
this.gauge.destroy();
this.barColorProcessor.destroy();
if (this.ticksSourcesSubscription) {
this.ctx.subscriptionApi.removeSubscription(this.ticksSourcesSubscription.id);
}
this.gauge = null;
}
}
``` | /content/code_sandbox/ui-ngx/src/app/modules/home/components/widget/lib/digital-gauge.ts | xml | 2016-12-01T09:33:30 | 2024-08-16T19:58:25 | thingsboard | thingsboard/thingsboard | 16,820 | 2,330 |
```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 mapArguments = require( './index' );
/**
* Callback function.
*
* @param v - argument
* @returns result
*/
function clbk( v: any ): any {
return v;
}
// TESTS //
// The function returns a function...
{
mapArguments( ( x: any, y: any, z: any ): Array<any> => [ x, y, z ], clbk ); // $ExpectType Function
mapArguments( ( x: any, y: any, z: any ): Array<any> => [ x, y, z ], clbk, {} ); // $ExpectType Function
}
// The compiler throws an error if the function is provided a first argument other than a function...
{
mapArguments( true, clbk ); // $ExpectError
mapArguments( false, clbk ); // $ExpectError
mapArguments( 5, clbk ); // $ExpectError
mapArguments( [], clbk ); // $ExpectError
mapArguments( {}, clbk ); // $ExpectError
mapArguments( 'abc', clbk ); // $ExpectError
mapArguments( true, clbk, {} ); // $ExpectError
mapArguments( false, clbk, {} ); // $ExpectError
mapArguments( 5, clbk, {} ); // $ExpectError
mapArguments( [], clbk, {} ); // $ExpectError
mapArguments( {}, clbk, {} ); // $ExpectError
mapArguments( 'abc', clbk, {} ); // $ExpectError
}
// The compiler throws an error if the function is provided a second argument other than a function...
{
mapArguments( ( x: any, y: any, z: any ): Array<any> => [ x, y, z ], '5' ); // $ExpectError
mapArguments( ( x: any, y: any, z: any ): Array<any> => [ x, y, z ], true ); // $ExpectError
mapArguments( ( x: any, y: any, z: any ): Array<any> => [ x, y, z ], false ); // $ExpectError
mapArguments( ( x: any, y: any, z: any ): Array<any> => [ x, y, z ], 123 ); // $ExpectError
mapArguments( ( x: any, y: any, z: any ): Array<any> => [ x, y, z ], null ); // $ExpectError
mapArguments( ( x: any, y: any, z: any ): Array<any> => [ x, y, z ], {} ); // $ExpectError
mapArguments( ( x: any, y: any, z: any ): Array<any> => [ x, y, z ], [] ); // $ExpectError
mapArguments( ( x: any, y: any, z: any ): Array<any> => [ x, y, z ], '5', {} ); // $ExpectError
mapArguments( ( x: any, y: any, z: any ): Array<any> => [ x, y, z ], true, {} ); // $ExpectError
mapArguments( ( x: any, y: any, z: any ): Array<any> => [ x, y, z ], false, {} ); // $ExpectError
mapArguments( ( x: any, y: any, z: any ): Array<any> => [ x, y, z ], 123, {} ); // $ExpectError
mapArguments( ( x: any, y: any, z: any ): Array<any> => [ x, y, z ], null, {} ); // $ExpectError
mapArguments( ( x: any, y: any, z: any ): Array<any> => [ x, y, z ], {}, {} ); // $ExpectError
mapArguments( ( x: any, y: any, z: any ): Array<any> => [ x, y, z ], [], {} ); // $ExpectError
}
// The compiler throws an error if the function is provided more than three arguments...
{
mapArguments( ( x: number, y: number ): number => x + y, clbk, {}, 4 ); // $ExpectError
}
``` | /content/code_sandbox/lib/node_modules/@stdlib/utils/map-arguments/docs/types/test.ts | xml | 2016-03-24T04:19:52 | 2024-08-16T09:03:19 | stdlib | stdlib-js/stdlib | 4,266 | 931 |
```xml
import { format as nf } from '../Utils/NumberFormatter';
export class IndicatorInput {
reversedInput?:boolean;
format?:(data:number)=>number
}
export class AllInputs {
values?:number[]
open?:number[]
high?:number[]
low?:number[]
close?:number[]
volume?:number[]
timestamp?: number[]
}
export class Indicator {
result:any;
format:(data:number)=>number;
constructor(input:IndicatorInput) {
this.format = input.format || nf;
}
static reverseInputs(input:any):void {
if(input.reversedInput) {
input.values ? input.values.reverse() : undefined;
input.open ? input.open.reverse() : undefined;
input.high ? input.high.reverse() : undefined;
input.low ? input.low.reverse() : undefined;
input.close ? input.close.reverse() : undefined;
input.volume ? input.volume.reverse() : undefined;
input.timestamp ? input.timestamp.reverse() : undefined;
}
}
getResult() {
return this.result;
}
}
``` | /content/code_sandbox/src/indicator/indicator.ts | xml | 2016-05-02T19:16:32 | 2024-08-15T14:25:09 | technicalindicators | anandanand84/technicalindicators | 2,137 | 226 |
```xml
import { render as rtlRender, RenderOptions } from '@testing-library/react-native';
import * as React from 'react';
import { AppProviders, AppProvidersProps } from './components/AppProviders';
export * from '@testing-library/react-native';
type AppProviderOptions = {
initialAppProviderProps?: Partial<AppProvidersProps>;
};
export function render(
component: React.ReactElement<any>,
options: RenderOptions & AppProviderOptions = {}
) {
const { initialAppProviderProps = {}, ...renderOptions } = options;
return rtlRender(component, {
...renderOptions,
wrapper: (props: any) => <AppProviders {...props} {...initialAppProviderProps} />,
});
}
``` | /content/code_sandbox/packages/expo-dev-menu/app/test-utils.tsx | xml | 2016-08-15T17:14:25 | 2024-08-16T19:54:44 | expo | expo/expo | 32,004 | 146 |
```xml
/**
*/
import axios from '@nextcloud/axios'
import { getCurrentUser } from '@nextcloud/auth'
import { loadState } from '@nextcloud/initial-state'
import { generateOcsUrl } from '@nextcloud/router'
import { defineComponent } from 'vue'
export default defineComponent({
props: {
resourceId: {
type: Number,
required: true,
},
resourceType: {
type: String,
default: 'files',
},
},
data() {
return {
editorData: {
actorDisplayName: getCurrentUser()!.displayName as string,
actorId: getCurrentUser()!.uid as string,
key: 'editor',
},
userData: {},
}
},
methods: {
/**
* Autocomplete @mentions
*
* @param {string} search the query
* @param {Function} callback the callback to process the results with
*/
async autoComplete(search, callback) {
const { data } = await axios.get(generateOcsUrl('core/autocomplete/get'), {
params: {
search,
itemType: 'files',
itemId: this.resourceId,
sorter: 'commenters|share-recipients',
limit: loadState('comments', 'maxAutoCompleteResults'),
},
})
// Save user data so it can be used by the editor to replace mentions
data.ocs.data.forEach(user => { this.userData[user.id] = user })
return callback(Object.values(this.userData))
},
/**
* Make sure we have all mentions as Array of objects
*
* @param mentions the mentions list
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
genMentionsData(mentions: any[]): Record<string, object> {
Object.values(mentions)
.flat()
.forEach(mention => {
this.userData[mention.mentionId] = {
// TODO: support groups
icon: 'icon-user',
id: mention.mentionId,
label: mention.mentionDisplayName,
source: 'users',
primary: getCurrentUser()?.uid === mention.mentionId,
}
})
return this.userData
},
},
})
``` | /content/code_sandbox/apps/comments/src/mixins/CommentView.ts | xml | 2016-06-02T07:44:14 | 2024-08-16T18:23:54 | server | nextcloud/server | 26,415 | 490 |
```xml
import { Component } from '@angular/core';
import { MessageService } from 'primeng/api';
import { DialogService, DynamicDialogRef } from 'primeng/dynamicdialog';
import { Code } from '@domain/code';
import { Product } from '@domain/product';
import { ProductListDemo } from './productlistdemo';
@Component({
selector: 'close-doc',
template: `
<app-docsectiontext>
<p>
Most of the time, requirement is returning a value from the dialog. DialogRef's close method is used for this purpose where the parameter passed will be available at the <i>onClose</i> event at the caller. Here is an example on how to
close the dialog from the ProductListDemo by passing a selected product.
</p>
</app-docsectiontext>
<app-code [code]="code" [hideToggleCode]="true"></app-code>
`,
providers: [DialogService, MessageService]
})
export class CloseDoc {
constructor(public dialogService: DialogService, public messageService: MessageService) {}
ref: DynamicDialogRef | undefined;
show() {
this.ref = this.dialogService.open(ProductListDemo, {
header: 'Select a Product',
width: '70%',
contentStyle: { overflow: 'auto' },
baseZIndex: 10000,
maximizable: true
});
this.ref.onClose.subscribe((product: Product) => {
if (product) {
this.messageService.add({ severity: 'info', summary: 'Product Selected', detail: product.name });
}
});
}
code: Code = {
typescript: `
import { Component, Input } from '@angular/core';
import { MessageService } from 'primeng/api';
import { DialogService, DynamicDialogRef } from 'primeng/dynamicdialog';
import { Product } from '@domain/product';
import { ProductListDemo } from './productlistdemo';
@Component({
templateUrl: './dynamicdialogdemo.html',
providers: [DialogService, MessageService]
})
export class DynamicDialogDemo {
ref: DynamicDialogRef | undefined;
constructor(public dialogService: DialogService, public messageService: MessageService) {}
show() {
this.ref = this.dialogService.open(ProductListDemo, {
header: 'Select a Product',
width: '70%',
contentStyle: { overflow: 'auto' },
baseZIndex: 10000,
maximizable: true
});
this.ref.onClose.subscribe((product: Product) => {
if (product) {
this.messageService.add({ severity: 'info', summary: 'Product Selected', detail: product.name });
}
});
}
}`
};
}
``` | /content/code_sandbox/src/app/showcase/doc/dynamicdialog/closedoc.ts | xml | 2016-01-16T09:23:28 | 2024-08-16T19:58:20 | primeng | primefaces/primeng | 9,969 | 578 |
```xml
<?xml version="1.0" encoding="UTF-8"?>
<empns:empResponse xmlns:empns="path_to_url" xmlns:xsi="path_to_url" xsi:schemaLocation="path_to_url Employee.xsd ">
<empns:id>1</empns:id>
<empns:role>Developer</empns:role>
<empns:fullName>Pankaj Kumar</empns:fullName>
</empns:empResponse>
``` | /content/code_sandbox/CoreJavaProjects/CoreJavaExamples/EmployeeResponse.xml | xml | 2016-05-02T05:43:21 | 2024-08-16T06:51:39 | journaldev | WebJournal/journaldev | 1,314 | 99 |
```xml
export {
Async,
AutoScroll,
// eslint-disable-next-line deprecation/deprecation
BaseComponent,
Customizations,
// eslint-disable-next-line deprecation/deprecation
Customizer,
CustomizerContext,
DATA_IS_SCROLLABLE_ATTRIBUTE,
DATA_PORTAL_ATTRIBUTE,
DelayedRender,
EventGroup,
FabricPerformance,
FocusRects,
GlobalSettings,
IsFocusVisibleClassName,
KeyCodes,
Rectangle,
SELECTION_CHANGE,
Selection,
SelectionDirection,
SelectionMode,
addDirectionalKeyCode,
addElementAtIndex,
allowOverscrollOnElement,
allowScrollOnElement,
anchorProperties,
appendFunction,
arraysEqual,
asAsync,
assertNever,
assign,
audioProperties,
baseElementEvents,
baseElementProperties,
buttonProperties,
calculatePrecision,
canUseDOM,
classNamesFunction,
colGroupProperties,
colProperties,
composeComponentAs,
composeRenderFunction,
createArray,
createMemoizer,
createMergedRef,
css,
customizable,
disableBodyScroll,
divProperties,
doesElementContainFocus,
elementContains,
elementContainsAttribute,
enableBodyScroll,
extendComponent,
filteredAssign,
find,
findElementRecursive,
findIndex,
findScrollableParent,
fitContentToBounds,
flatten,
focusAsync,
focusFirstChild,
formProperties,
format,
getChildren,
getDistanceBetweenPoints,
getDocument,
getElementIndexPath,
getFirstFocusable,
getFirstTabbable,
getFirstVisibleElementFromSelector,
getFocusableByIndexPath,
getId,
getInitials,
getLanguage,
getLastFocusable,
getLastTabbable,
getNativeElementProps,
getNativeProps,
getNextElement,
getParent,
getPreviousElement,
getPropsWithDefaults,
getRTL,
getRTLSafeKeyCode,
getRect,
// eslint-disable-next-line deprecation/deprecation
getResourceUrl,
getScrollbarWidth,
getVirtualParent,
getWindow,
hasHorizontalOverflow,
hasOverflow,
hasVerticalOverflow,
hoistMethods,
hoistStatics,
htmlElementProperties,
iframeProperties,
// eslint-disable-next-line deprecation/deprecation
imageProperties,
imgProperties,
initializeComponentRef,
// eslint-disable-next-line deprecation/deprecation
initializeFocusRects,
inputProperties,
isControlled,
isDirectionalKeyCode,
isElementFocusSubZone,
isElementFocusZone,
isElementTabbable,
isElementVisible,
isElementVisibleAndNotHidden,
isIE11,
isIOS,
isMac,
isVirtualElement,
labelProperties,
liProperties,
mapEnumByName,
memoize,
memoizeFunction,
merge,
mergeAriaAttributeValues,
mergeCustomizations,
mergeScopedSettings,
mergeSettings,
modalize,
nullRender,
olProperties,
omit,
on,
optionProperties,
portalContainsElement,
precisionRound,
// eslint-disable-next-line deprecation/deprecation
raiseClick,
removeIndex,
replaceElement,
resetControlledWarnings,
resetIds,
resetMemoizations,
safeRequestAnimationFrame,
safeSetTimeout,
selectProperties,
// eslint-disable-next-line deprecation/deprecation
setBaseUrl,
setFocusVisibility,
// eslint-disable-next-line deprecation/deprecation
setLanguage,
setMemoizeWeakMap,
setPortalAttribute,
setRTL,
// eslint-disable-next-line deprecation/deprecation
setSSR,
setVirtualParent,
setWarningCallback,
shallowCompare,
shouldWrapFocus,
styled,
tableProperties,
tdProperties,
textAreaProperties,
thProperties,
toMatrix,
trProperties,
unhoistMethods,
useCustomizationSettings,
useFocusRects,
values,
videoProperties,
warn,
warnConditionallyRequiredProps,
warnControlledUsage,
warnDeprecations,
warnMutuallyExclusive,
} from '@fluentui/react/lib/Utilities';
export type {
FitMode,
IAsAsyncOptions,
IBaseProps,
ICancelable,
IChangeDescription,
IChangeEventCallback,
// eslint-disable-next-line deprecation/deprecation
IClassNames,
IClassNamesFunctionOptions,
IComponentAs,
IComponentAsProps,
ICssInput,
ICustomizableProps,
ICustomizations,
ICustomizerContext,
ICustomizerProps,
IDeclaredEventsByName,
IDelayedRenderProps,
IDelayedRenderState,
IDictionary,
IDisposable,
IEventRecord,
IEventRecordList,
IEventRecordsByName,
IFitContentToBoundsOptions,
IObjectWithKey,
IPerfData,
IPerfMeasurement,
IPerfSummary,
// eslint-disable-next-line deprecation/deprecation
IPoint,
IPropsWithStyles,
IRectangle,
IRefObject,
IRenderComponent,
IRenderFunction,
ISelection,
ISelectionOptions,
ISelectionOptionsWithRequiredGetKey,
ISerializableObject,
ISettings,
ISettingsFunction,
ISettingsMap,
ISize,
IStyleFunction,
IStyleFunctionOrObject,
IVirtualElement,
IWarnControlledUsageParams,
// eslint-disable-next-line deprecation/deprecation
Omit,
Point,
RefObject,
// eslint-disable-next-line deprecation/deprecation
Settings,
// eslint-disable-next-line deprecation/deprecation
SettingsFunction,
StyleFunction,
} from '@fluentui/react/lib/Utilities';
``` | /content/code_sandbox/packages/react-experiments/src/Utilities.ts | xml | 2016-06-06T15:03:44 | 2024-08-16T18:49:29 | fluentui | microsoft/fluentui | 18,221 | 1,236 |
```xml
import * as core from "./core.js";
test(
"prints a schema for polymorphic",
core.test(__filename, ["polymorphic"], {}),
);
``` | /content/code_sandbox/postgraphile/postgraphile/__tests__/schema/v4/polymorphic.test.ts | xml | 2016-04-14T21:29:19 | 2024-08-16T17:12:51 | crystal | graphile/crystal | 12,539 | 34 |
```xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="path_to_url"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical">
<android.support.v7.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_margin="@dimen/margin_moderate"
android:text="@string/connect_to_susi"
android:textSize="@dimen/text_size_moderate"
android:textAlignment="center" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_extremely_large"
android:orientation="horizontal">
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/margin_moderate"
android:layout_marginRight="@dimen/margin_moderate"
android:layout_weight="2"
android:textSize="@dimen/text_size_moderate"
android:id="@+id/cannot_connect_susiai"
android:background="@color/colorPrimary"
android:text="@string/cannot_connect_button"
android:textAllCaps="false"
android:textColor="@color/md_white_1000" />
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/margin_moderate"
android:layout_weight="3"
android:id="@+id/connected_susiai"
android:textSize="@dimen/text_size_moderate"
android:background="@color/colorPrimary"
android:text="@string/connected_to_susiai"
android:textColor="@color/md_white_1000"
android:textAllCaps="false"/>
</LinearLayout>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="@dimen/margin_extra_large"
android:background="@color/colorPrimary"
android:id="@+id/cancel_susiai_connection"
android:text="@string/cancel"
android:textSize="@dimen/text_size_moderate"
android:textAllCaps="false"
android:textColor="@color/md_white_1000" />
</LinearLayout>
``` | /content/code_sandbox/app/src/main/res/layout/connect_susiai_speaker.xml | xml | 2016-09-21T08:56:16 | 2024-08-06T13:58:15 | susi_android | fossasia/susi_android | 2,419 | 552 |
```xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
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 concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept rev="1.1" id="create_view">
<title>CREATE VIEW Statement</title>
<titlealts audience="PDF">
<navtitle>CREATE VIEW</navtitle>
</titlealts>
<prolog>
<metadata>
<data name="Category" value="Impala"/>
<data name="Category" value="SQL"/>
<data name="Category" value="DDL"/>
<data name="Category" value="Tables"/>
<data name="Category" value="Schemas"/>
<data name="Category" value="Views"/>
<data name="Category" value="Developers"/>
<data name="Category" value="Data Analysts"/>
</metadata>
</prolog>
<conbody>
<p>
The <codeph>CREATE VIEW</codeph> statement lets you create a shorthand abbreviation for a
more complicated query. The base query can involve joins, expressions, reordered columns,
column aliases, and other SQL features that can make a query hard to understand or
maintain.
</p>
<p>
Because a view is purely a logical construct (an alias for a query) with no physical data
behind it, <codeph>ALTER VIEW</codeph> only involves changes to metadata in the metastore
database, not any data files in HDFS.
</p>
<p conref="../shared/impala_common.xml#common/syntax_blurb"/>
<codeblock>CREATE VIEW [IF NOT EXISTS] <varname>view_name</varname>
[(<varname>column_name</varname> [COMMENT '<varname>column_comment</varname>'][, ...])]
[COMMENT '<varname>view_comment</varname>']
[TBLPROPERTIES ('<varname>name</varname>' = '<varname>value</varname>'[, ...])]
AS <varname>select_statement</varname></codeblock>
<p conref="../shared/impala_common.xml#common/ddl_blurb"/>
<p conref="../shared/impala_common.xml#common/usage_notes_blurb"/>
<p>
The <codeph>CREATE VIEW</codeph> statement can be useful in scenarios such as the
following:
</p>
<ul>
<li>
To turn even the most lengthy and complicated SQL query into a one-liner. You can issue
simple queries against the view from applications, scripts, or interactive queries in
<cmdname>impala-shell</cmdname>. For example:
<codeblock>select * from <varname>view_name</varname>;
select * from <varname>view_name</varname> order by c1 desc limit 10;</codeblock>
The more complicated and hard-to-read the original query, the more benefit there is to
simplifying the query using a view.
</li>
<li>
To hide the underlying table and column names, to minimize maintenance problems if those
names change. In that case, you re-create the view using the new names, and all queries
that use the view rather than the underlying tables keep running with no changes.
</li>
<li>
To experiment with optimization techniques and make the optimized queries available to
all applications. For example, if you find a combination of <codeph>WHERE</codeph>
conditions, join order, join hints, and so on that works the best for a class of
queries, you can establish a view that incorporates the best-performing techniques.
Applications can then make relatively simple queries against the view, without repeating
the complicated and optimized logic over and over. If you later find a better way to
optimize the original query, when you re-create the view, all the applications
immediately take advantage of the optimized base query.
</li>
<li>
To simplify a whole class of related queries, especially complicated queries involving
joins between multiple tables, complicated expressions in the column list, and other SQL
syntax that makes the query difficult to understand and debug. For example, you might
create a view that joins several tables, filters using several <codeph>WHERE</codeph>
conditions, and selects several columns from the result set. Applications might issue
queries against this view that only vary in their <codeph>LIMIT</codeph>, <codeph>ORDER
BY</codeph>, and similar simple clauses.
</li>
</ul>
<p>
For queries that require repeating complicated clauses over and over again, for example in
the select list, <codeph>ORDER BY</codeph>, and <codeph>GROUP BY</codeph> clauses, you can
use the <codeph>WITH</codeph> clause as an alternative to creating a view.
</p>
<p>
You can optionally specify the table-level and the column-level comments as in the
<codeph>CREATE TABLE</codeph> statement.
</p>
<p conref="../shared/impala_common.xml#common/complex_types_blurb"/>
<p conref="../shared/impala_common.xml#common/complex_types_views"/>
<p conref="../shared/impala_common.xml#common/complex_types_views_caveat"/>
<p conref="../shared/impala_common.xml#common/sync_ddl_blurb"/>
<p conref="../shared/impala_common.xml#common/security_blurb"/>
<p conref="../shared/impala_common.xml#common/redaction_yes"/>
<p conref="../shared/impala_common.xml#common/cancel_blurb_no"/>
<p conref="../shared/impala_common.xml#common/permissions_blurb_no"/>
<p conref="../shared/impala_common.xml#common/example_blurb"/>
<codeblock>-- Create a view that is exactly the same as the underlying table.
CREATE VIEW v1 AS SELECT * FROM t1;
-- Create a view that includes only certain columns from the underlying table.
CREATE VIEW v2 AS SELECT c1, c3, c7 FROM t1;
-- Create a view that filters the values from the underlying table.
CREATE VIEW v3 AS SELECT DISTINCT c1, c3, c7 FROM t1 WHERE c1 IS NOT NULL AND c5 > 0;
-- Create a view that that reorders and renames columns from the underlying table.
CREATE VIEW v4 AS SELECT c4 AS last_name, c6 AS address, c2 AS birth_date FROM t1;
-- Create a view that runs functions to convert or transform certain columns.
CREATE VIEW v5 AS SELECT c1, CAST(c3 AS STRING) c3, CONCAT(c4,c5) c5, TRIM(c6) c6, "Constant" c8 FROM t1;
-- Create a view that hides the complexity of a view query.
CREATE VIEW v6 AS SELECT t1.c1, t2.c2 FROM t1 JOIN t2 ON t1.id = t2.id;
-- Create a view with a column comment and a table comment.
CREATE VIEW v7 (c1 COMMENT 'Comment for c1', c2) COMMENT 'Comment for v7' AS SELECT t1.c1, t1.c2 FROM t1;
-- Create a view with tblproperties.
CREATE VIEW v7 (c1 , c2) TBLPROPERTIES ('tblp1' = '1', 'tblp2' = '2') AS SELECT t1.c1, t1.c2 FROM t1;
</codeblock>
<p conref="../shared/impala_common.xml#common/related_info"/>
<p>
<xref href="impala_views.xml#views"/>,
<xref
href="impala_alter_view.xml#alter_view"/>,
<xref
href="impala_drop_view.xml#drop_view"/>
</p>
</conbody>
</concept>
``` | /content/code_sandbox/docs/topics/impala_create_view.xml | xml | 2016-04-13T07:00:08 | 2024-08-16T10:10:44 | impala | apache/impala | 1,115 | 1,811 |
```xml
import { PlanSponsorshipType } from "../../../../billing/enums";
export class OrganizationSponsorshipCreateRequest {
sponsoredEmail: string;
planSponsorshipType: PlanSponsorshipType;
friendlyName: string;
}
``` | /content/code_sandbox/libs/common/src/admin-console/models/request/organization/organization-sponsorship-create.request.ts | xml | 2016-03-09T23:14:01 | 2024-08-16T15:07:51 | clients | bitwarden/clients | 8,877 | 50 |
```xml
import * as React from 'react';
import cx from 'classnames';
import { createSvgIcon } from '../utils/createSvgIcon';
import { iconClassNames } from '../utils/iconClassNames';
export const CodeSnippetIcon = createSvgIcon({
svg: ({ classes }) => (
<svg role="presentation" focusable="false" className={classes.svg} viewBox="2 2 16 16">
<g className={cx(iconClassNames.outline, classes.outlinePart)}>
<path d="M12.9667 3.6795C13.0658 3.42177 12.9372 3.13247 12.6795 3.03334C12.4218 2.93421 12.1325 3.06279 12.0333 3.32052L7.03334 16.3205C6.93421 16.5783 7.06279 16.8676 7.32052 16.9667C7.57826 17.0658 7.86756 16.9372 7.96669 16.6795L12.9667 3.6795Z" />
<path d="M5.8254 6.12038C6.03506 6.30009 6.05934 6.61574 5.87963 6.8254L3.15854 10L5.87963 13.1746C6.05934 13.3843 6.03506 13.6999 5.8254 13.8796C5.61573 14.0593 5.30008 14.0351 5.12037 13.8254L2.12037 10.3254C1.95988 10.1382 1.95988 9.86186 2.12037 9.67461L5.12037 6.17461C5.30008 5.96495 5.61573 5.94067 5.8254 6.12038Z" />
<path d="M14.1746 14.3796C13.9649 14.1999 13.9407 13.8843 14.1204 13.6746L16.8415 10.5L14.1204 7.32539C13.9407 7.11572 13.9649 6.80007 14.1746 6.62036C14.3843 6.44065 14.6999 6.46493 14.8796 6.6746L17.8796 10.1746C18.0401 10.3618 18.0401 10.6381 17.8796 10.8254L14.8796 14.3254C14.6999 14.535 14.3843 14.5593 14.1746 14.3796Z" />
</g>
<g className={cx(iconClassNames.filled, classes.filledPart)}>
<path d="M12.9365 4.052C13.1033 3.67286 12.9312 3.23028 12.5521 3.06346C12.1729 2.89664 11.7303 3.06875 11.5635 3.44789L6.06352 15.9479C5.8967 16.327 6.06882 16.7696 6.44795 16.9364C6.82709 17.1033 7.26967 16.9311 7.43649 16.552L12.9365 4.052Z" />
<path d="M14.2927 13.8444C13.9644 13.5919 13.903 13.121 14.1555 12.7927L16.3038 9.99996L14.1555 7.20725C13.903 6.87893 13.9644 6.40805 14.2927 6.15549C14.621 5.90294 15.0919 5.96436 15.3445 6.29268L17.8445 9.54268C18.0518 9.81227 18.0518 10.1877 17.8445 10.4572L15.3445 13.7072C15.0919 14.0356 14.621 14.097 14.2927 13.8444Z" />
<path d="M5.70728 6.15557C6.0356 6.40812 6.09702 6.879 5.84447 7.20732L3.69622 10L5.84447 12.7928C6.09702 13.1211 6.0356 13.592 5.70728 13.8445C5.37897 14.0971 4.90808 14.0356 4.65553 13.7073L2.15553 10.4573C1.94816 10.1877 1.94816 9.81234 2.15553 9.54275L4.65553 6.29275C4.90808 5.96444 5.37897 5.90302 5.70728 6.15557Z" />
</g>
</svg>
),
displayName: 'CodeSnippetIcon',
});
``` | /content/code_sandbox/packages/fluentui/react-icons-northstar/src/components/CodeSnippetIcon.tsx | xml | 2016-06-06T15:03:44 | 2024-08-16T18:49:29 | fluentui | microsoft/fluentui | 18,221 | 1,271 |
```xml
import * as ts from 'typescript';
import { callExpression, decoratorArgument, hasProperties, withIdentifier } from '../util/astQuery';
import { ifTrue, listToMaybe, Maybe, unwrapFirst } from '../util/function';
import { logger } from '../util/logger';
import { getAnimations, getInlineStyle, getTemplate } from '../util/ngQuery';
import { getDecoratorPropertyInitializer, isBooleanLiteralLike, isStringLiteralLike, maybeNodeArray } from '../util/utils';
import { Config } from './config';
import { FileResolver } from './fileResolver/fileResolver';
import {
AnimationMetadata,
CodeWithSourceMap,
ComponentMetadata,
DirectiveMetadata,
InjectableMetadata,
ModuleMetadata,
PipeMetadata,
StyleMetadata,
TemplateMetadata,
} from './metadata';
import { AbstractResolver, MetadataUrls } from './urlResolvers/abstractResolver';
import { PathResolver } from './urlResolvers/pathResolver';
import { UrlResolver } from './urlResolvers/urlResolver';
const normalizeTransformed = (t: CodeWithSourceMap): CodeWithSourceMap => {
if (!t.map) {
t.source = t.code;
}
return t;
};
/**
* For async implementation path_to_url
*/
export class MetadataReader {
constructor(private readonly fileResolver: FileResolver, private readonly urlResolver?: AbstractResolver) {
this.urlResolver = this.urlResolver || new UrlResolver(new PathResolver());
}
read(d: ts.ClassDeclaration): DirectiveMetadata | ComponentMetadata | PipeMetadata | ModuleMetadata | InjectableMetadata | undefined {
const componentMetadata = unwrapFirst<ComponentMetadata | undefined>(
maybeNodeArray(ts.createNodeArray(d.decorators)).map((dec) => {
return Maybe.lift(dec)
.bind(callExpression)
.bind(withIdentifier('Component') as any)
.fmap(() => this.readComponentMetadata(d, dec));
})
);
const directiveMetadata = unwrapFirst<DirectiveMetadata | undefined>(
maybeNodeArray(ts.createNodeArray(d.decorators)).map((dec) =>
Maybe.lift(dec)
.bind(callExpression)
.bind(withIdentifier('Directive') as any)
.fmap(() => this.readDirectiveMetadata(d, dec))
)
);
const pipeMetadata = unwrapFirst<PipeMetadata | undefined>(
maybeNodeArray(ts.createNodeArray(d.decorators)).map((dec) =>
Maybe.lift(dec)
.bind(callExpression)
.bind(withIdentifier('Pipe') as any)
.fmap(() => this.readPipeMetadata(d, dec))
)
);
const moduleMetadata = unwrapFirst<ModuleMetadata | undefined>(
maybeNodeArray(ts.createNodeArray(d.decorators)).map((dec) =>
Maybe.lift(dec)
.bind(callExpression)
.bind(withIdentifier('NgModule') as any)
.fmap(() => this.readModuleMetadata(d, dec))
)
);
const injectableMetadata = unwrapFirst<InjectableMetadata | undefined>(
maybeNodeArray(ts.createNodeArray(d.decorators)).map((dec) =>
Maybe.lift(dec)
.bind(callExpression)
.bind(withIdentifier('Injectable') as any)
.fmap(() => this.readInjectableMetadata(d, dec))
)
);
return directiveMetadata || componentMetadata || pipeMetadata || moduleMetadata || injectableMetadata;
}
protected readDirectiveMetadata(d: ts.ClassDeclaration, dec: ts.Decorator): DirectiveMetadata {
const selectorExpression = getDecoratorPropertyInitializer(dec, 'selector');
const selector = selectorExpression && isStringLiteralLike(selectorExpression) ? selectorExpression.text : undefined;
return new DirectiveMetadata(d, dec, selector);
}
protected readPipeMetadata(d: ts.ClassDeclaration, dec: ts.Decorator): DirectiveMetadata {
const nameExpression = getDecoratorPropertyInitializer(dec, 'name');
const name = nameExpression && isStringLiteralLike(nameExpression) ? nameExpression.text : undefined;
const pureExpression = getDecoratorPropertyInitializer(dec, 'pure');
const pure = pureExpression && isBooleanLiteralLike(pureExpression) ? pureExpression : undefined;
return new PipeMetadata(d, dec, name, pure);
}
protected readModuleMetadata(d: ts.ClassDeclaration, dec: ts.Decorator): DirectiveMetadata {
return new ModuleMetadata(d, dec);
}
protected readInjectableMetadata(d: ts.ClassDeclaration, dec: ts.Decorator): DirectiveMetadata {
const providedInExpression = getDecoratorPropertyInitializer(dec, 'providedIn');
return new InjectableMetadata(d, dec, providedInExpression);
}
protected readComponentMetadata(d: ts.ClassDeclaration, dec: ts.Decorator): ComponentMetadata {
const expr = this.getDecoratorArgument(dec);
const directiveMetadata = this.readDirectiveMetadata(d, dec);
const external_M = expr.fmap(() => this.urlResolver!.resolve(dec));
const animations_M = external_M.bind(() => this.readComponentAnimationsMetadata(dec));
const style_M = external_M.bind((external) => this.readComponentStylesMetadata(dec, external!));
const template_M = external_M.bind((external) => this.readComponentTemplateMetadata(dec, external!));
return new ComponentMetadata(
directiveMetadata.controller,
directiveMetadata.decorator,
directiveMetadata.selector,
animations_M.unwrap(),
style_M.unwrap(),
template_M.unwrap()
);
}
protected getDecoratorArgument(decorator: ts.Decorator): Maybe<ts.ObjectLiteralExpression | undefined> {
return decoratorArgument(decorator).bind(ifTrue(hasProperties));
}
protected readComponentAnimationsMetadata(dec: ts.Decorator): Maybe<(AnimationMetadata | undefined)[] | undefined> {
return getAnimations(dec).fmap((inlineAnimations) =>
inlineAnimations!.elements.filter(isStringLiteralLike).map<AnimationMetadata>((inlineAnimation) => ({
animation: normalizeTransformed({ code: (inlineAnimation as ts.StringLiteral).text }),
node: inlineAnimation as ts.Node,
}))
);
}
protected readComponentTemplateMetadata(dec: ts.Decorator, external: MetadataUrls): Maybe<TemplateMetadata | undefined> {
// Resolve Inline template
return getTemplate(dec)
.fmap<TemplateMetadata>((inlineTemplate) => ({
node: inlineTemplate,
template: normalizeTransformed(Config.transformTemplate(inlineTemplate!.text)),
url: undefined,
}))
.catch(() =>
// If there's no valid inline template, we resolve external template
Maybe.lift(external.templateUrl).bind((url) =>
this._resolve(url!).fmap<TemplateMetadata>((template) => ({
node: undefined,
template: normalizeTransformed(Config.transformTemplate(template!, url)),
url,
}))
)
);
}
protected readComponentStylesMetadata(dec: ts.Decorator, external: MetadataUrls): Maybe<(StyleMetadata | undefined)[] | undefined> {
return getInlineStyle(dec)
.fmap((inlineStyles) =>
// Resolve Inline styles
inlineStyles!.elements.filter(isStringLiteralLike).map<StyleMetadata>((inlineStyle) => ({
node: inlineStyle,
style: normalizeTransformed(Config.transformStyle((inlineStyle as ts.StringLiteral).text)),
}))
)
.catch(() =>
// If there's no valid inline styles, we resolve external styles
Maybe.lift(external.styleUrls)
.fmap((urls) =>
urls.map((
url // Resolve each style URL and transform to metadata
) =>
this._resolve(url).fmap<StyleMetadata>((style) => ({
node: undefined,
style: normalizeTransformed(Config.transformStyle(style!, url)),
url,
}))
)
)
// merge Maybe<StyleMetadata>[] to Maybe<StyleMetadata[]>
.bind((url) => listToMaybe(url as any) as any)
);
}
private _resolve(url: string): Maybe<string | undefined> {
try {
return Maybe.lift(this.fileResolver.resolve(url));
} catch {
logger.info('Cannot read file' + url);
return Maybe.nothing;
}
}
}
``` | /content/code_sandbox/src/angular/metadataReader.ts | xml | 2016-02-10T17:22:40 | 2024-08-14T16:41:28 | codelyzer | mgechev/codelyzer | 2,446 | 1,691 |
```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.
-->
<nine-patch xmlns:android="path_to_url"
xmlns:tools="path_to_url"
android:src="@drawable/material_shadow_z3_xhdpi"
tools:ignore="unused" />
``` | /content/code_sandbox/app/src/main/res/drawable-xhdpi/material_shadow_z3.xml | xml | 2016-08-08T13:25:41 | 2024-08-15T07:21:04 | H-Viewer | PureDark/H-Viewer | 1,738 | 94 |
```xml
/* tslint:disable:no-unused-variable */
import { FeedLightboxComponent } from './feed-lightbox.component';
import { Component, Input, Output, EventEmitter } from '@angular/core';
import { TestBed, async } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
@Component({
selector: 'feed-linker',
template: ''
})
class FeedLinkerStubComponent {
@Input() text: string;
@Input() hashtags: string[] = new Array<string>();
@Input() mentions: string[] = new Array<string>();
@Input() links: string[] = new Array<string>();
@Input() unshorten: Object = {};
@Input() useAll = false;
@Output() showed: EventEmitter<boolean> = new EventEmitter<boolean>();
}
describe('Component: FeedLightbox', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [
RouterTestingModule
],
declarations: [
FeedLinkerStubComponent,
FeedLightboxComponent
]
});
});
it('should create an instance', () => {
const fixture = TestBed.createComponent(FeedLightboxComponent);
const component = fixture.debugElement.componentInstance;
expect(component).toBeTruthy();
});
it('should use feedItem for various function', async(() => {
const fixture = TestBed.createComponent(FeedLightboxComponent);
const component = fixture.debugElement.componentInstance;
component.feedItem = {
images : [],
screen_name : '@fossasia',
user : {
name : 'testUser'
},
text : 'testText',
retweet_count : 20,
favourites_count : 25,
created_at : new Date(),
videos : []
};
component.ttt();
expect(component.datetime).toBe('now');
expect(component.itemText).toBe('testText');
expect(component.profileName).toBe('testUser');
expect(component.retweetCount).toBe('20');
expect(component.favoriteCount).toBe('25');
expect(component.profileURL).toBe('path_to_url
}));
it('should have feedLinker component', async(() => {
const fixture = TestBed.createComponent(FeedLinkerStubComponent);
const component = fixture.debugElement.componentInstance;
expect(component).toBeTruthy();
}));
it('should emit hideLightBox EventEmitter on click', async(() => {
const fixture = TestBed.createComponent(FeedLightboxComponent);
const component = fixture.debugElement.componentInstance;
spyOn(component.hideLightBox, 'emit');
component.onShowed();
expect(component.hideLightBox.emit).toHaveBeenCalled();
}));
});
``` | /content/code_sandbox/src/app/feed/feed-lightbox/feed-lightbox.component.spec.ts | xml | 2016-09-20T13:50:42 | 2024-08-06T13:58:18 | loklak_search | fossasia/loklak_search | 1,829 | 554 |
```xml
export default (compName) => `import { ReactNode } from 'react';
export interface Base${compName}Props {
children?: ReactNode;
}
`;
``` | /content/code_sandbox/packages/zarm-cli/src/templates/component/interfaceTpl.ts | xml | 2016-07-13T11:45:37 | 2024-08-12T19:23:48 | zarm | ZhongAnTech/zarm | 1,707 | 35 |
```xml
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="path_to_url path_to_url" xmlns="path_to_url"
xmlns:xsi="path_to_url">
<parent>
<groupId>io.strimzi</groupId>
<artifactId>strimzi</artifactId>
<version>0.44.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>operator-common</artifactId>
<licenses>
<license>
<url>path_to_url
</license>
</licenses>
<properties>
<!-- Points to the root directory of the Strimzi project directory and can be used for fixed location to configuration files -->
<strimziRootDirectory>${basedir}${file.separator}..</strimziRootDirectory>
</properties>
<dependencies>
<dependency>
<groupId>io.strimzi</groupId>
<artifactId>crd-annotations</artifactId>
</dependency>
<dependency>
<groupId>io.strimzi</groupId>
<artifactId>api</artifactId>
</dependency>
<dependency>
<groupId>io.strimzi</groupId>
<artifactId>certificate-manager</artifactId>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-client</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-httpclient-jdk</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-client-api</artifactId>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-model-core</artifactId>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>zjsonpatch</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<exclusions>
<!-- We just depend on the CronExpression class, not all of quartz's deps -->
<exclusion>
<groupId>com.mchange</groupId>
<artifactId>c3p0</artifactId>
</exclusion>
<exclusion>
<groupId>com.mchange</groupId>
<artifactId>mchange-commons-java</artifactId>
</exclusion>
<exclusion>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP-java7</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
</dependency>
<dependency>
<groupId>io.strimzi</groupId>
<artifactId>test</artifactId>
</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-core</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>${maven.jar.version}</version>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>${maven.dependency.version}</version>
<executions>
<execution>
<id>analyze</id>
<goals>
<goal>analyze-only</goal>
</goals>
<configuration>
<failOnWarning>true</failOnWarning>
<ignoredUnusedDeclaredDependencies>
<!-- Fabric8 Kubernetes Client and HttpClient are required by the tests -->
<ignoredUnusedDeclaredDependency>io.fabric8:kubernetes-client</ignoredUnusedDeclaredDependency>
<ignoredUnusedDeclaredDependency>io.fabric8:kubernetes-httpclient-jdk</ignoredUnusedDeclaredDependency>
<!-- Needed for logging in tests -->
<ignoredUnusedDeclaredDependency>org.apache.logging.log4j:log4j-core</ignoredUnusedDeclaredDependency>
<!-- Needed for logging in tests using the Kubernetes Client (uses SLF4J) -->
<ignoredUnusedDeclaredDependency>org.apache.logging.log4j:log4j-slf4j-impl</ignoredUnusedDeclaredDependency>
</ignoredUnusedDeclaredDependencies>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
``` | /content/code_sandbox/operator-common/pom.xml | xml | 2016-05-06T08:52:33 | 2024-08-16T12:29:50 | strimzi-kafka-operator | strimzi/strimzi-kafka-operator | 4,713 | 1,430 |
```xml
<manifest xmlns:android="path_to_url">
<application>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/catchup_util_file_paths"/>
</provider>
</application>
</manifest>
``` | /content/code_sandbox/libraries/util/src/main/AndroidManifest.xml | xml | 2016-04-25T09:33:27 | 2024-08-16T02:22:21 | CatchUp | ZacSweers/CatchUp | 1,958 | 99 |
```xml
import { Tabs, TabTitle } from "@erxes/ui/src/components/tabs";
import { __ } from "@erxes/ui/src/utils/core";
import React from "react";
import { Content } from "../styles";
import DetailContainer from "../corporateGateway/accounts/containers/Detail";
import TransactionsContainer from "../corporateGateway/transactions/containers/List";
type Props = {
loading?: boolean;
queryParams: any;
};
const Detail = (props: Props) => {
const { queryParams } = props;
const serviceTypes = ["account", "transactions"];
const [currentTab, setCurrentTab] = React.useState<string>(serviceTypes[0]);
const tabOnClick = (tab: string) => {
setCurrentTab(tab);
};
const renderContent = () => {
if (currentTab === "account") {
return (
<Content>
<DetailContainer {...props} queryParams={queryParams} />
</Content>
);
}
if (currentTab === "transactions") {
return (
<Content>
<TransactionsContainer {...props} queryParams={queryParams} />
</Content>
);
}
return <>{currentTab}</>;
};
const renderTabs = () => {
if (!queryParams.account) {
return <>please select corporate gateway</>;
}
return (
<>
<Tabs full={true}>
{Object.values(serviceTypes).map((type) => (
<TabTitle
key={type}
className={currentTab === type ? "active" : ""}
onClick={() => tabOnClick(type)}
>
{__(type)}
</TabTitle>
))}
</Tabs>
{renderContent()}
</>
);
};
return renderTabs();
};
export default Detail;
``` | /content/code_sandbox/packages/plugin-golomtbank-ui/src/components/Detail.tsx | xml | 2016-11-11T06:54:50 | 2024-08-16T10:26:06 | erxes | erxes/erxes | 3,479 | 368 |
```xml
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="path_to_url"
android:height="18dp"
android:viewportHeight="18"
android:viewportWidth="18"
android:width="18dp">
<path
android:fillColor="#FFC107"
android:pathData="M9,11.3 L12.71,14 L11.29,9.64 L15,7 L10.45,7 L9,2.5 L7.55,7 L3,7 L6.71,9.64
L5.29,14 Z" />
<path
android:pathData="M0,0 L18,0 L18,18 L0,18 Z" />
</vector>
``` | /content/code_sandbox/sample/src/main/res/drawable/ic_star.xml | xml | 2016-07-22T23:32:30 | 2024-08-07T09:37:58 | expandable-recycler-view | thoughtbot/expandable-recycler-view | 2,119 | 170 |
```xml
import { createAction, createSelector, createSlice, PayloadAction } from '@reduxjs/toolkit';
import { all, call, put, select, takeLatest } from 'redux-saga/effects';
import { EXCLUDED_ASSETS } from '@config';
import { MyCryptoApiService } from '@services';
import { ExtendedAsset, LSKeys, Network, NetworkId, StoreAsset, TUuid } from '@types';
import { arrayToObj } from '@utils';
import { filter, findIndex, map, mergeRight, pipe, propEq, toPairs } from '@vendor';
import { getAccountsAssets } from './account.slice';
import { initialLegacyState } from './legacy.initialState';
import { appReset } from './root.reducer';
import { getAppState } from './selectors';
const sliceName = LSKeys.ASSETS;
export const initialState = initialLegacyState[sliceName];
const slice = createSlice({
name: sliceName,
initialState,
reducers: {
create(state, action: PayloadAction<ExtendedAsset>) {
state.push(action.payload);
},
createMany(state, action: PayloadAction<ExtendedAsset[]>) {
action.payload.forEach((a) => {
state.push(a);
});
},
destroy(state, action: PayloadAction<TUuid>) {
const idx = findIndex(propEq('uuid', action.payload), state);
state.splice(idx, 1);
},
update(state, action: PayloadAction<ExtendedAsset>) {
const idx = findIndex(propEq('uuid', action.payload.uuid), state);
state[idx] = action.payload;
},
updateMany(state, action: PayloadAction<ExtendedAsset[]>) {
const assets = action.payload;
assets.forEach((asset) => {
const idx = findIndex(propEq('uuid', asset.uuid), state);
state[idx] = asset;
});
},
addFromAPI(_state, action: PayloadAction<ExtendedAsset[]>) {
// Sets the state directly since the payload is merged in the saga
return action.payload;
},
reset() {
return initialState;
}
}
});
export const fetchAssets = createAction(`${slice.name}/fetchAssets`);
export const {
create: createAsset,
createMany: createAssets,
destroy: destroyAsset,
update: updateAsset,
updateMany: updateAssets,
addFromAPI: addAssetsFromAPI,
reset: resetAsset
} = slice.actions;
export default slice;
/**
* Selectors
*/
export const getAssets = createSelector([getAppState], (s) => s.assets);
export const getAssetsByNetwork = (network: NetworkId) =>
createSelector(getAssets, (assets) => assets.filter((asset) => asset.networkId === network));
export const getBaseAssetByNetwork = (network: Network) =>
createSelector(getAssets, (assets) => assets.find((asset) => asset.uuid === network.baseAsset)!);
export const getAssetByUUID = (uuid: TUuid) =>
createSelector([getAssets], (a) => a.find((asset) => asset.uuid === uuid));
export const getCoinGeckoAssetManifest = createSelector(getAssets, (assets) =>
assets.filter((a) => a.mappings?.coinGeckoId).map((a) => a.uuid)
);
/**
* Sagas
*/
export function* assetSaga() {
yield all([
takeLatest(fetchAssets.type, fetchAssetsWorker),
// Trigger fetching assets on appReset, is dispatched when resetting and importing new settings
takeLatest(appReset.type, fetchAssetsWorker)
]);
}
export function* fetchAssetsWorker() {
const fetchedAssets = yield call(MyCryptoApiService.instance.getAssets);
const lsAssets: ExtendedAsset[] = yield select(getAssets);
const accountAssets: StoreAsset[] = yield select(getAccountsAssets);
const currentAssets = arrayToObj('uuid')(
lsAssets.filter(
(a) =>
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
a.isCustom ||
a.type === 'base' ||
accountAssets.some((accAsset) => accAsset.uuid === a.uuid && accAsset.balance.gt(0))
)
);
const mergeAssets = pipe(
(assets: Record<TUuid, ExtendedAsset>) => mergeRight(currentAssets, assets),
toPairs,
// Asset API returns certain assets we don't want to show in the UI (as their balance is infinity)
filter(([uuid, _]) => !EXCLUDED_ASSETS.includes(uuid)),
map(([uuid, a]) => ({ ...a, uuid } as ExtendedAsset))
);
const merged = mergeAssets(fetchedAssets);
yield put(slice.actions.addFromAPI(merged));
}
``` | /content/code_sandbox/src/services/Store/store/asset.slice.ts | xml | 2016-12-04T01:35:27 | 2024-08-14T21:41:58 | MyCrypto | MyCryptoHQ/MyCrypto | 1,347 | 989 |
```xml
import KoaRouter from "@koa/router";
import {
createContext,
PlatformAdapter,
PlatformBuilder,
PlatformHandler,
PlatformMulter,
PlatformMulterSettings,
PlatformProvider,
PlatformRequest,
PlatformResponse,
PlatformStaticsOptions,
runInContext
} from "@tsed/common";
import {catchAsyncError, isFunction, Type} from "@tsed/core";
import {PlatformExceptions} from "@tsed/platform-exceptions";
import {PlatformHandlerMetadata, PlatformHandlerType, PlatformLayer} from "@tsed/platform-router";
import Koa, {Context, Next} from "koa";
import koaBodyParser, {Options} from "koa-bodyparser";
// @ts-ignore
import koaQs from "koa-qs";
import send from "koa-send";
import {staticsMiddleware} from "../middlewares/staticsMiddleware.js";
import {PlatformKoaHandler} from "../services/PlatformKoaHandler.js";
import {PlatformKoaRequest} from "../services/PlatformKoaRequest.js";
import {PlatformKoaResponse} from "../services/PlatformKoaResponse.js";
import {getMulter} from "../utils/multer.js";
declare global {
namespace TsED {
export interface Application extends Koa {}
}
namespace TsED {
export interface StaticsOptions extends send.SendOptions {}
}
}
// @ts-ignore
KoaRouter.prototype.$$match = KoaRouter.prototype.match;
KoaRouter.prototype.match = function match(...args: any[]) {
const matched = this.$$match(...args);
if (matched) {
if (matched.path.length) {
matched.route = true;
}
}
return matched;
};
/**
* @platform
* @koa
*/
@PlatformProvider()
export class PlatformKoa extends PlatformAdapter<Koa> {
static readonly NAME = "koa";
readonly providers = [
{
provide: PlatformResponse,
useClass: PlatformKoaResponse
},
{
provide: PlatformRequest,
useClass: PlatformKoaRequest
},
{
provide: PlatformHandler,
useClass: PlatformKoaHandler
}
];
/**
* Create new serverless application. In this mode, the component scan are disabled.
* @param module
* @param settings
*/
static create(module: Type<any>, settings: Partial<TsED.Configuration> = {}) {
return PlatformBuilder.create<Koa>(module, {
...settings,
adapter: PlatformKoa
});
}
/**
* Bootstrap a server application
* @param module
* @param settings
*/
static bootstrap(module: Type<any>, settings: Partial<TsED.Configuration> = {}) {
return PlatformBuilder.bootstrap<Koa>(module, {
...settings,
adapter: PlatformKoa
});
}
onInit() {
this.app.getApp().silent = true;
}
mapLayers(layers: PlatformLayer[]) {
const {settings} = this.injector;
const {app} = this;
const options = settings.get("koa.router", {});
const rawRouter = new KoaRouter(options) as any;
layers.forEach((layer) => {
switch (layer.method) {
case "statics":
rawRouter.use(layer.path, this.statics(layer.path as string, layer.opts as any));
break;
default:
rawRouter[layer.method](...layer.getArgs());
}
});
app.getApp().use(rawRouter.routes()).use(rawRouter.allowedMethods());
}
mapHandler(handler: Function, metadata: PlatformHandlerMetadata) {
return async (koaContext: Koa.Context, next: Koa.Next) => {
const {$ctx} = koaContext.request;
$ctx.next = next;
const error = await catchAsyncError(() => handler($ctx));
if (error) {
$ctx.error = error;
}
if (metadata.type !== PlatformHandlerType.RESPONSE_FN) {
return $ctx.next && $ctx.error ? $ctx.next($ctx.error) : $ctx.next();
}
};
}
useContext(): this {
const {app} = this;
const invoke = createContext(this.injector);
const platformExceptions = this.injector.get<PlatformExceptions>(PlatformExceptions);
app.use((koaContext: Context, next: Next) => {
const $ctx = invoke({
request: koaContext.request as any,
response: koaContext.response as any,
koaContext
});
return runInContext($ctx, async () => {
try {
await $ctx.start();
await next();
const status = koaContext.status || 404;
if (status === 404 && !$ctx.isDone()) {
platformExceptions?.resourceNotFound($ctx);
}
} catch (error) {
platformExceptions?.catch(error, $ctx);
} finally {
await $ctx.finish();
}
});
});
return this;
}
createApp() {
const app = this.injector.settings.get("koa.app") || new Koa();
koaQs(app, "extended");
return {
app,
callback() {
return app.callback();
}
};
}
multipart(options: PlatformMulterSettings): PlatformMulter {
return getMulter(options);
}
statics(endpoint: string, options: PlatformStaticsOptions) {
return staticsMiddleware(options);
}
bodyParser(type: "json" | "urlencoded" | "raw" | "text", additionalOptions: any = {}): any {
const opts = this.injector.settings.get(`koa.bodyParser`);
let parser: any = koaBodyParser;
let options: Options = {};
if (isFunction(opts)) {
parser = opts;
options = {};
}
return parser({...options, ...additionalOptions});
}
}
``` | /content/code_sandbox/packages/platform/platform-koa/src/components/PlatformKoa.ts | xml | 2016-02-21T18:38:47 | 2024-08-14T21:19:48 | tsed | tsedio/tsed | 2,817 | 1,246 |
```xml
type PromiseOf<T extends (...args: any[]) => any> = T extends (...args: any[]) => Promise<infer R> ? R : ReturnType<T>;
export function runTests<
TSync extends (...args: any[]) => TResult,
TAsync extends (...args: any[]) => Promise<TResult>,
TResult = ReturnType<TSync>,
>({ sync: executeSync, async: executeAsync }: { sync: TSync; async: TAsync }) {
return (
testRunner: (
executeFn: (...args: Parameters<TSync | TAsync>) => Promise<PromiseOf<TSync | TAsync>>,
mode: 'sync' | 'async',
) => void,
) => {
// sync
describe('sync', () => {
testRunner((...args: Parameters<TSync>) => {
return new Promise<PromiseOf<TAsync>>((resolve, reject) => {
try {
const result: any = executeSync(...args);
resolve(result);
} catch (error) {
reject(error);
}
});
}, 'sync');
});
// async
describe('async', () => {
testRunner(executeAsync as any, 'async');
});
};
}
``` | /content/code_sandbox/test/utils/runner.ts | xml | 2016-07-29T09:54:26 | 2024-08-08T15:15:52 | graphql-config | kamilkisiela/graphql-config | 1,160 | 257 |
```xml
import type { RefObject } from 'react';
import { useEffect, useRef } from 'react';
import { c } from 'ttag';
import { Button } from '@proton/atoms';
import type { ModalProps } from '@proton/components';
import { Form, ModalTwo, ModalTwoContent, ModalTwoFooter, ModalTwoHeader } from '@proton/components';
import { MailboxContainerContextProvider } from '../../../containers/mailbox/MailboxContainerProvider';
import type { MessageStateWithData } from '../../../store/messages/messagesTypes';
import MessageBody from '../MessageBody';
import './MessagePrint.scss';
interface Props extends ModalProps {
labelID: string;
message: MessageStateWithData;
}
const MessagePrintModal = ({ labelID, message, ...rest }: Props) => {
const iframeRef = useRef<HTMLIFrameElement | null>();
const { onClose } = rest;
const handlePrint = () => {
iframeRef.current?.contentWindow?.print();
};
useEffect(() => {
document.body.classList.add('is-printed-version');
}, []);
const handleClose = () => {
document.body.classList.remove('is-printed-version');
onClose?.();
};
const handleIframeReady = (iframe: RefObject<HTMLIFrameElement>) => {
iframeRef.current = iframe.current;
};
return (
<ModalTwo className="print-modal" as={Form} onSubmit={handlePrint} {...rest} onClose={handleClose}>
<ModalTwoHeader title={c('Info').t`Print email`} />
<ModalTwoContent>
<MailboxContainerContextProvider containerRef={null} elementID={undefined} isResizing={false}>
<MessageBody
messageLoaded
bodyLoaded
sourceMode={false}
message={message}
labelID={labelID}
originalMessageMode={false}
forceBlockquote
isPrint
onIframeReady={handleIframeReady}
/>
</MailboxContainerContextProvider>
</ModalTwoContent>
<ModalTwoFooter>
<Button onClick={handleClose}>{c('Action').t`Cancel`}</Button>
<Button color="norm" type="submit">{c('Action').t`Print`}</Button>
</ModalTwoFooter>
</ModalTwo>
);
};
export default MessagePrintModal;
``` | /content/code_sandbox/applications/mail/src/app/components/message/modals/MessagePrintModal.tsx | xml | 2016-06-08T11:16:51 | 2024-08-16T14:14:27 | WebClients | ProtonMail/WebClients | 4,300 | 492 |
```xml
import {boxSizes} from './box-sizes';
import {Controls} from './Controls';
type Props = {
id: string;
label: string;
onChange: (value: string) => void;
size: string;
};
export function BoxSizeControl({id, label, onChange, size}: Props) {
return (
<>
<h3>{label}</h3>
<Controls>
{boxSizes.map((boxSize) => (
<button
key={boxSize}
data-testid={`${id}-${boxSize}`}
onClick={() => onChange(boxSize)}
style={{
backgroundColor: boxSize === size ? 'black' : '',
}}
>
{boxSize}
</button>
))}
</Controls>
</>
);
}
``` | /content/code_sandbox/packages/dom/test/visual/utils/BoxSizeControl.tsx | xml | 2016-03-29T17:00:47 | 2024-08-16T16:29:40 | floating-ui | floating-ui/floating-ui | 29,450 | 165 |
```xml
export * from './AcsChat.module.scss';
export * from './RoomChatControl';
export * from './IRoomChatProps';
``` | /content/code_sandbox/samples/react-roomchat/src/components/RoomChat/index.ts | xml | 2016-08-30T17:21:43 | 2024-08-16T18:41:32 | sp-dev-fx-webparts | pnp/sp-dev-fx-webparts | 2,027 | 28 |
```xml
import { createElement, useMemo, useCallback, useState, MouseEvent } from 'react'
import { line as d3Line, curveBasis, curveLinear } from 'd3-shape'
import { useTheme } from '@nivo/core'
import { useOrdinalColorScale, useInheritedColor, InheritedColorConfig } from '@nivo/colors'
import { useTooltip } from '@nivo/tooltip'
import {
BumpInterpolation,
BumpCommonProps,
BumpDatum,
DefaultBumpDatum,
BumpDataProps,
BumpComputedSerie,
BumpPoint,
BumpLabel,
BumpLabelData,
BumpSerieExtraProps,
BumpPointMouseHandler,
BumpSerieMouseHandler,
} from './types'
import { computeSeries } from './compute'
const useLineGenerator = (interpolation: BumpInterpolation) =>
useMemo(
() =>
d3Line<[number, number | null]>()
.curve(interpolation === 'smooth' ? curveBasis : curveLinear)
.defined(d => d[0] !== null && d[1] !== null),
[interpolation]
)
const useSerieDerivedProp = <Target, Output extends string | number>(
instruction: ((target: Target) => Output) | Output
): ((target: Target) => Output) =>
useMemo(() => {
if (typeof instruction === 'function') return instruction
return () => instruction
}, [instruction])
const useSerieStyle = <Datum extends BumpDatum, ExtraProps extends BumpSerieExtraProps>({
lineWidth,
activeLineWidth,
inactiveLineWidth,
opacity,
activeOpacity,
inactiveOpacity,
isInteractive,
activeSerieIds,
}: {
lineWidth: BumpCommonProps<Datum, ExtraProps>['lineWidth']
activeLineWidth: BumpCommonProps<Datum, ExtraProps>['activeLineWidth']
inactiveLineWidth: BumpCommonProps<Datum, ExtraProps>['inactiveLineWidth']
opacity: BumpCommonProps<Datum, ExtraProps>['opacity']
activeOpacity: BumpCommonProps<Datum, ExtraProps>['activeOpacity']
inactiveOpacity: BumpCommonProps<Datum, ExtraProps>['inactiveOpacity']
isInteractive: BumpCommonProps<Datum, ExtraProps>['isInteractive']
activeSerieIds: string[]
}) => {
type Serie = Omit<BumpComputedSerie<Datum, ExtraProps>, 'color' | 'opacity' | 'lineWidth'>
const getLineWidth = useSerieDerivedProp<Serie, number>(lineWidth)
const getActiveLineWidth = useSerieDerivedProp<Serie, number>(activeLineWidth)
const getInactiveLineWidth = useSerieDerivedProp<Serie, number>(inactiveLineWidth)
const getOpacity = useSerieDerivedProp<Serie, number>(opacity)
const getActiveOpacity = useSerieDerivedProp<Serie, number>(activeOpacity)
const getInactiveOpacity = useSerieDerivedProp<Serie, number>(inactiveOpacity)
const getNormalStyle = useCallback(
(serie: Serie) => ({
opacity: getOpacity(serie),
lineWidth: getLineWidth(serie),
}),
[getLineWidth, getOpacity]
)
const getActiveStyle = useCallback(
(serie: Serie) => ({
opacity: getActiveOpacity(serie),
lineWidth: getActiveLineWidth(serie),
}),
[getActiveLineWidth, getActiveOpacity]
)
const getInactiveStyle = useCallback(
(serie: Serie) => ({
opacity: getInactiveOpacity(serie),
lineWidth: getInactiveLineWidth(serie),
}),
[getInactiveLineWidth, getInactiveOpacity]
)
return useCallback(
(serie: Serie) => {
if (!isInteractive || activeSerieIds.length === 0) return getNormalStyle(serie)
if (activeSerieIds.includes(serie.id)) return getActiveStyle(serie)
return getInactiveStyle(serie)
},
[getNormalStyle, getActiveStyle, getInactiveStyle, isInteractive, activeSerieIds]
)
}
const usePointStyle = <Datum extends BumpDatum, ExtraProps extends BumpSerieExtraProps>({
pointSize,
activePointSize,
inactivePointSize,
pointBorderWidth,
activePointBorderWidth,
inactivePointBorderWidth,
isInteractive,
activePointIds,
}: {
pointSize: BumpCommonProps<Datum, ExtraProps>['pointSize']
activePointSize: BumpCommonProps<Datum, ExtraProps>['activePointSize']
inactivePointSize: BumpCommonProps<Datum, ExtraProps>['inactivePointSize']
pointBorderWidth: BumpCommonProps<Datum, ExtraProps>['pointBorderWidth']
activePointBorderWidth: BumpCommonProps<Datum, ExtraProps>['activePointBorderWidth']
inactivePointBorderWidth: BumpCommonProps<Datum, ExtraProps>['inactivePointBorderWidth']
isInteractive: BumpCommonProps<Datum, ExtraProps>['isInteractive']
activePointIds: string[]
}) => {
type Point = Omit<BumpPoint<Datum, ExtraProps>, 'size' | 'borderWidth'>
const getSize = useSerieDerivedProp(pointSize)
const getActiveSize = useSerieDerivedProp(activePointSize)
const getInactiveSize = useSerieDerivedProp(inactivePointSize)
const getBorderWidth = useSerieDerivedProp(pointBorderWidth)
const getActiveBorderWidth = useSerieDerivedProp(activePointBorderWidth)
const getInactiveBorderWidth = useSerieDerivedProp(inactivePointBorderWidth)
const getNormalStyle = useCallback(
(point: Point) => ({
size: getSize(point),
borderWidth: getBorderWidth(point),
}),
[getSize, getBorderWidth]
)
const getActiveStyle = useCallback(
(point: Point) => ({
size: getActiveSize(point),
borderWidth: getActiveBorderWidth(point),
}),
[getActiveSize, getActiveBorderWidth]
)
const getInactiveStyle = useCallback(
(point: Point) => ({
size: getInactiveSize(point),
borderWidth: getInactiveBorderWidth(point),
}),
[getInactiveSize, getInactiveBorderWidth]
)
return useCallback(
(point: Point) => {
if (!isInteractive || activePointIds.length === 0) return getNormalStyle(point)
if (activePointIds.includes(point.id)) return getActiveStyle(point)
return getInactiveStyle(point)
},
[getNormalStyle, getActiveStyle, getInactiveStyle, isInteractive, activePointIds]
)
}
export const useBump = <
Datum extends BumpDatum = DefaultBumpDatum,
ExtraProps extends BumpSerieExtraProps = Record<string, never>
>({
width,
height,
data,
interpolation,
xPadding,
xOuterPadding,
yOuterPadding,
lineWidth,
activeLineWidth,
inactiveLineWidth,
colors,
opacity,
activeOpacity,
inactiveOpacity,
pointSize,
activePointSize,
inactivePointSize,
pointColor,
pointBorderWidth,
activePointBorderWidth,
inactivePointBorderWidth,
pointBorderColor,
isInteractive,
defaultActiveSerieIds,
}: {
width: number
height: number
data: BumpDataProps<Datum, ExtraProps>['data']
interpolation: BumpCommonProps<Datum, ExtraProps>['interpolation']
xPadding: BumpCommonProps<Datum, ExtraProps>['xPadding']
xOuterPadding: BumpCommonProps<Datum, ExtraProps>['xOuterPadding']
yOuterPadding: BumpCommonProps<Datum, ExtraProps>['yOuterPadding']
lineWidth: BumpCommonProps<Datum, ExtraProps>['lineWidth']
activeLineWidth: BumpCommonProps<Datum, ExtraProps>['activeLineWidth']
inactiveLineWidth: BumpCommonProps<Datum, ExtraProps>['inactiveLineWidth']
colors: BumpCommonProps<Datum, ExtraProps>['colors']
opacity: BumpCommonProps<Datum, ExtraProps>['opacity']
activeOpacity: BumpCommonProps<Datum, ExtraProps>['activeOpacity']
inactiveOpacity: BumpCommonProps<Datum, ExtraProps>['inactiveOpacity']
pointSize: BumpCommonProps<Datum, ExtraProps>['pointSize']
activePointSize: BumpCommonProps<Datum, ExtraProps>['activePointSize']
inactivePointSize: BumpCommonProps<Datum, ExtraProps>['inactivePointSize']
pointColor: BumpCommonProps<Datum, ExtraProps>['pointColor']
pointBorderWidth: BumpCommonProps<Datum, ExtraProps>['pointBorderWidth']
activePointBorderWidth: BumpCommonProps<Datum, ExtraProps>['activePointBorderWidth']
inactivePointBorderWidth: BumpCommonProps<Datum, ExtraProps>['inactivePointBorderWidth']
pointBorderColor: BumpCommonProps<Datum, ExtraProps>['pointBorderColor']
isInteractive: BumpCommonProps<Datum, ExtraProps>['isInteractive']
defaultActiveSerieIds: string[]
}) => {
const [activeSerieIds, setActiveSerieIds] = useState<string[]>(defaultActiveSerieIds)
const [activePointIds, setActivePointIds] = useState<string[]>(defaultActiveSerieIds)
const {
series: rawSeries,
xScale,
yScale,
} = useMemo(
() =>
computeSeries<Datum, ExtraProps>({
width,
height,
data,
xPadding,
xOuterPadding,
yOuterPadding,
}),
[width, height, data, xPadding, xOuterPadding, yOuterPadding]
)
const lineGenerator = useLineGenerator(interpolation)
const getColor = useOrdinalColorScale(colors, 'id')
const getSerieStyle = useSerieStyle<Datum, ExtraProps>({
lineWidth,
activeLineWidth,
inactiveLineWidth,
opacity,
activeOpacity,
inactiveOpacity,
isInteractive,
activeSerieIds,
})
const series: BumpComputedSerie<Datum, ExtraProps>[] = useMemo(
() =>
rawSeries.map(serie => ({
...serie,
color: getColor(serie.data),
...getSerieStyle(serie),
})),
[rawSeries, getColor, getSerieStyle]
)
const theme = useTheme()
const getPointColor = useInheritedColor(pointColor, theme)
const getPointBorderColor = useInheritedColor(pointBorderColor, theme)
const getPointStyle = usePointStyle<Datum, ExtraProps>({
pointSize,
activePointSize,
inactivePointSize,
pointBorderWidth,
activePointBorderWidth,
inactivePointBorderWidth,
isInteractive,
activePointIds,
})
const points: BumpPoint<Datum, ExtraProps>[] = useMemo(() => {
const pts: BumpPoint<Datum, ExtraProps>[] = []
series.forEach(serie => {
serie.points.forEach(rawPoint => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const point: BumpPoint<Datum, ExtraProps> = {
...rawPoint,
serie,
isActive: activeSerieIds.includes(serie.id),
isInactive: activeSerieIds.length > 0 && !activeSerieIds.includes(serie.id),
}
point.color = getPointColor(point)
point.borderColor = getPointBorderColor(point)
pts.push({
...point,
...getPointStyle(point),
})
})
})
return pts
}, [series, activeSerieIds, getPointColor, getPointBorderColor, getPointStyle])
return {
xScale,
yScale,
series,
points,
lineGenerator,
activeSerieIds,
setActiveSerieIds,
activePointIds,
setActivePointIds,
}
}
export const useBumpSerieHandlers = <
Datum extends BumpDatum,
ExtraProps extends BumpSerieExtraProps
>({
serie,
isInteractive,
onMouseEnter,
onMouseMove,
onMouseLeave,
onClick,
setActiveSerieIds,
lineTooltip: tooltip,
}: {
serie: BumpComputedSerie<Datum, ExtraProps>
isInteractive: BumpCommonProps<Datum, ExtraProps>['isInteractive']
onMouseEnter?: BumpSerieMouseHandler<Datum, ExtraProps>
onMouseMove?: BumpSerieMouseHandler<Datum, ExtraProps>
onMouseLeave?: BumpSerieMouseHandler<Datum, ExtraProps>
onClick?: BumpSerieMouseHandler<Datum, ExtraProps>
setActiveSerieIds: (serieIds: string[]) => void
lineTooltip: BumpCommonProps<Datum, ExtraProps>['lineTooltip']
}) => {
const { showTooltipFromEvent, hideTooltip } = useTooltip()
const handleMouseEnter = useCallback(
(event: MouseEvent<SVGPathElement>) => {
showTooltipFromEvent(createElement(tooltip, { serie }), event)
setActiveSerieIds([serie.id])
onMouseEnter && onMouseEnter(serie, event)
},
[serie, onMouseEnter, showTooltipFromEvent, setActiveSerieIds, tooltip]
)
const handleMouseMove = useCallback(
(event: MouseEvent<SVGPathElement>) => {
showTooltipFromEvent(createElement(tooltip, { serie }), event)
onMouseMove && onMouseMove(serie, event)
},
[serie, onMouseMove, showTooltipFromEvent, tooltip]
)
const handleMouseLeave = useCallback(
(event: MouseEvent<SVGPathElement>) => {
hideTooltip()
setActiveSerieIds([])
onMouseLeave && onMouseLeave(serie, event)
},
[serie, onMouseLeave, hideTooltip, setActiveSerieIds]
)
const handleClick = useCallback(
(event: MouseEvent<SVGPathElement>) => {
onClick && onClick(serie, event)
},
[serie, onClick]
)
return useMemo(
() => ({
onMouseEnter: isInteractive ? handleMouseEnter : undefined,
onMouseMove: isInteractive ? handleMouseMove : undefined,
onMouseLeave: isInteractive ? handleMouseLeave : undefined,
onClick: isInteractive ? handleClick : undefined,
}),
[isInteractive, handleMouseEnter, handleMouseMove, handleMouseLeave, handleClick]
)
}
export const useBumpPointHandlers = <
Datum extends BumpDatum,
ExtraProps extends BumpSerieExtraProps
>({
point,
isInteractive,
onMouseEnter,
onMouseMove,
onMouseLeave,
onClick,
setActivePointIds,
setActiveSerieIds,
pointTooltip: tooltip,
}: {
point: BumpPoint<Datum, ExtraProps>
isInteractive: BumpCommonProps<Datum, ExtraProps>['isInteractive']
onMouseEnter?: BumpPointMouseHandler<Datum, ExtraProps>
onMouseMove?: BumpPointMouseHandler<Datum, ExtraProps>
onMouseLeave?: BumpPointMouseHandler<Datum, ExtraProps>
onClick?: BumpPointMouseHandler<Datum, ExtraProps>
setActivePointIds: (pointIds: string[]) => void
setActiveSerieIds: (pointIds: string[]) => void
pointTooltip: BumpCommonProps<Datum, ExtraProps>['pointTooltip']
}) => {
const { showTooltipFromEvent, hideTooltip } = useTooltip()
const handleMouseEnter = useCallback(
(event: MouseEvent<SVGPathElement>) => {
showTooltipFromEvent(createElement(tooltip, { point }), event)
setActivePointIds([point.id])
setActiveSerieIds([point.serie.id])
onMouseEnter && onMouseEnter(point, event)
},
[showTooltipFromEvent, tooltip, point, setActivePointIds, setActiveSerieIds, onMouseEnter]
)
const handleMouseMove = useCallback(
(event: MouseEvent<SVGPathElement>) => {
showTooltipFromEvent(createElement(tooltip, { point }), event)
onMouseMove && onMouseMove(point, event)
},
[showTooltipFromEvent, tooltip, point, onMouseMove]
)
const handleMouseLeave = useCallback(
(event: MouseEvent<SVGPathElement>) => {
hideTooltip()
setActivePointIds([])
setActiveSerieIds([])
onMouseLeave && onMouseLeave(point, event)
},
[hideTooltip, setActivePointIds, setActiveSerieIds, onMouseLeave, point]
)
const handleClick = useCallback(
(event: MouseEvent<SVGPathElement>) => {
onClick && onClick(point, event)
},
[point, onClick]
)
return useMemo(
() => ({
onMouseEnter: isInteractive ? handleMouseEnter : undefined,
onMouseMove: isInteractive ? handleMouseMove : undefined,
onMouseLeave: isInteractive ? handleMouseLeave : undefined,
onClick: isInteractive ? handleClick : undefined,
}),
[isInteractive, handleMouseEnter, handleMouseMove, handleMouseLeave, handleClick]
)
}
export const useBumpSeriesLabels = <
Datum extends BumpDatum,
ExtraProps extends BumpSerieExtraProps
>({
series,
position,
padding,
color,
getLabel,
}: {
series: BumpComputedSerie<Datum, ExtraProps>[]
position: 'start' | 'end'
padding: number
color: InheritedColorConfig<BumpComputedSerie<Datum, ExtraProps>>
getLabel: Exclude<BumpLabel<Datum, ExtraProps>, false>
}) => {
const theme = useTheme()
const getColor = useInheritedColor(color, theme)
return useMemo(() => {
let textAnchor: 'start' | 'end'
let signedPadding: number
if (position === 'start') {
textAnchor = 'end'
signedPadding = padding * -1
} else {
textAnchor = 'start'
signedPadding = padding
}
const labels: BumpLabelData<Datum, ExtraProps>[] = []
series.forEach(serie => {
let label = serie.id
if (typeof getLabel === 'function') {
label = getLabel(serie.data)
}
const point =
position === 'start'
? serie.linePoints[0]
: serie.linePoints[serie.linePoints.length - 1]
// exclude labels for series having missing data at the beginning/end
if (point?.[0] === null || point?.[1] === null) {
return
}
labels.push({
id: serie.id,
label,
x: point[0] + signedPadding,
y: point[1],
color: getColor(serie) as string,
opacity: serie.opacity,
serie,
textAnchor,
})
})
return labels
}, [series, position, padding, getColor, getLabel])
}
``` | /content/code_sandbox/packages/bump/src/bump/hooks.ts | xml | 2016-04-16T03:27:56 | 2024-08-16T03:38:37 | nivo | plouc/nivo | 13,010 | 4,047 |
```xml
import { useEffect } from 'react';
import ScrollPosition from '../types/ScrollPosition';
import useWebChatUIContext from './internal/useWebChatUIContext';
export default function useObserveScrollPosition(
observer: (scrollPosition: ScrollPosition) => void,
deps: any[]
): void {
if (typeof observer !== 'function') {
observer = undefined;
console.warn('botframework-webchat: First argument passed to "useObserveScrollPosition" must be a function.');
} else if (typeof deps !== 'undefined' && !Array.isArray(deps)) {
console.warn(
'botframework-webchat: Second argument passed to "useObserveScrollPosition" must be an array if specified.'
);
}
const { observeScrollPosition } = useWebChatUIContext();
/* eslint-disable-next-line react-hooks/exhaustive-deps */
useEffect(() => observer && observeScrollPosition(observer), [...(deps || []), observer, observeScrollPosition]);
}
``` | /content/code_sandbox/packages/component/src/hooks/useObserveScrollPosition.ts | xml | 2016-07-07T23:16:57 | 2024-08-16T00:12:37 | BotFramework-WebChat | microsoft/BotFramework-WebChat | 1,567 | 208 |
```xml
import { ComponentRegistry } from 'mailspring-exports';
import PersonalLevelIcon from './personal-level-icon';
/*
All packages must export a basic object that has at least the following 3
methods:
1. `activate` - Actions to take once the package gets turned on.
Pre-enabled packages get activated on Mailspring bootup. They can also be
activated manually by a user.
2. `deactivate` - Actions to take when a package gets turned off. This can
happen when a user manually disables a package.
*/
export function activate() {
ComponentRegistry.register(PersonalLevelIcon, {
role: 'ThreadListIcon',
});
}
export function deactivate() {
ComponentRegistry.unregister(PersonalLevelIcon);
}
``` | /content/code_sandbox/app/internal_packages/personal-level-indicators/lib/main.ts | xml | 2016-10-13T06:45:50 | 2024-08-16T18:14:37 | Mailspring | Foundry376/Mailspring | 15,331 | 153 |
```xml
<vector xmlns:android="path_to_url"
android:width="24dp"
android:height="24dp"
android:viewportHeight="20.0"
android:viewportWidth="20.0">
<path
android:fillColor="@color/ucrop_color_default_logo"
android:pathData="M20,1.25L18.75,0L14.66,4.02L6.04,4.02L6.04,0L4,0L4,4.02L0,4.02L0,6.03L4,6.03L4,15.98L14,15.98L14,20L16,20L16,15.98L20,15.98L20,13.99L16,13.99L16,5.33L20,1.25ZM6.03,6.02L12.55,6.02L6.03,12.67L6.03,6.02ZM7.18,13.99L13.99,7.2L13.99,13.99L7.18,13.99ZM7.18,13.99"/>
</vector>
``` | /content/code_sandbox/ucrop/src/main/res/drawable/ucrop_vector_ic_crop.xml | xml | 2016-01-05T13:41:06 | 2024-08-16T11:17:20 | uCrop | Yalantis/uCrop | 11,830 | 266 |
```xml
<dict>
<key>CommonPeripheralDSP</key>
<array>
<dict>
<key>DeviceID</key>
<integer>0</integer>
<key>DeviceType</key>
<string>Headphone</string>
</dict>
<dict>
<key>DeviceID</key>
<integer>0</integer>
<key>DeviceType</key>
<string>Microphone</string>
</dict>
</array>
<key>PathMaps</key>
<array>
<dict>
<key>PathMap</key>
<array>
<array>
<array>
<array>
<dict>
<key>Amp</key>
<dict>
<key>Channels</key>
<array>
<dict>
<key>Bind</key>
<integer>1</integer>
<key>Channel</key>
<integer>1</integer>
</dict>
<dict>
<key>Bind</key>
<integer>2</integer>
<key>Channel</key>
<integer>2</integer>
</dict>
</array>
<key>MuteInputAmp</key>
<true/>
<key>PublishMute</key>
<false/>
<key>PublishVolume</key>
<false/>
<key>VolumeInputAmp</key>
<true/>
</dict>
<key>NodeID</key>
<integer>7</integer>
</dict>
<dict>
<key>NodeID</key>
<integer>36</integer>
</dict>
<dict>
<key>Boost</key>
<integer>3</integer>
<key>NodeID</key>
<integer>18</integer>
</dict>
</array>
</array>
<array>
<array>
<dict>
<key>Amp</key>
<dict>
<key>Channels</key>
<array>
<dict>
<key>Bind</key>
<integer>1</integer>
<key>Channel</key>
<integer>1</integer>
</dict>
<dict>
<key>Bind</key>
<integer>2</integer>
<key>Channel</key>
<integer>2</integer>
</dict>
</array>
<key>MuteInputAmp</key>
<true/>
<key>PublishMute</key>
<false/>
<key>PublishVolume</key>
<false/>
<key>VolumeInputAmp</key>
<true/>
</dict>
<key>NodeID</key>
<integer>8</integer>
</dict>
<dict>
<key>NodeID</key>
<integer>35</integer>
</dict>
<dict>
<key>Boost</key>
<integer>3</integer>
<key>NodeID</key>
<integer>25</integer>
</dict>
</array>
</array>
</array>
<array>
<array>
<array>
<dict>
<key>Amp</key>
<dict>
<key>MuteInputAmp</key>
<false/>
<key>PublishMute</key>
<true/>
<key>PublishVolume</key>
<false/>
<key>VolumeInputAmp</key>
<false/>
</dict>
<key>NodeID</key>
<integer>27</integer>
</dict>
<dict>
<key>Amp</key>
<dict>
<key>Channels</key>
<array>
<dict>
<key>Bind</key>
<integer>1</integer>
<key>Channel</key>
<integer>1</integer>
</dict>
<dict>
<key>Bind</key>
<integer>2</integer>
<key>Channel</key>
<integer>2</integer>
</dict>
</array>
<key>MuteInputAmp</key>
<false/>
<key>PublishMute</key>
<false/>
<key>PublishVolume</key>
<true/>
<key>VolumeInputAmp</key>
<false/>
</dict>
<key>NodeID</key>
<integer>2</integer>
</dict>
</array>
</array>
<array>
<array>
<dict>
<key>Amp</key>
<dict>
<key>MuteInputAmp</key>
<false/>
<key>PublishMute</key>
<true/>
<key>PublishVolume</key>
<false/>
<key>VolumeInputAmp</key>
<false/>
</dict>
<key>NodeID</key>
<integer>33</integer>
</dict>
<dict>
<key>Amp</key>
<dict>
<key>Channels</key>
<array>
<dict>
<key>Bind</key>
<integer>1</integer>
<key>Channel</key>
<integer>1</integer>
</dict>
<dict>
<key>Bind</key>
<integer>2</integer>
<key>Channel</key>
<integer>2</integer>
</dict>
</array>
<key>MuteInputAmp</key>
<false/>
<key>PublishMute</key>
<false/>
<key>PublishVolume</key>
<true/>
<key>VolumeInputAmp</key>
<false/>
</dict>
<key>NodeID</key>
<integer>3</integer>
</dict>
</array>
</array>
</array>
</array>
<key>PathMapID</key>
<integer>212</integer>
</dict>
</array>
</dict>
``` | /content/code_sandbox/Resources/ALC274/Platforms35.xml | xml | 2016-03-07T20:45:58 | 2024-08-14T08:57:03 | AppleALC | acidanthera/AppleALC | 3,420 | 1,562 |
```xml
import { EncryptionType } from "../../enums";
import { Utils } from "../../misc/utils";
import { EncString } from "../../models/domain/enc-string";
import { USER_ENCRYPTED_PRIVATE_KEY, USER_EVER_HAD_USER_KEY } from "./user-key.state";
function makeEncString(data?: string) {
data ??= Utils.newGuid();
return new EncString(EncryptionType.AesCbc256_HmacSha256_B64, data, "test", "test");
}
describe("Ever had user key", () => {
const sut = USER_EVER_HAD_USER_KEY;
it("should deserialize ever had user key", () => {
const everHadUserKey = true;
const result = sut.deserializer(JSON.parse(JSON.stringify(everHadUserKey)));
expect(result).toEqual(everHadUserKey);
});
});
describe("Encrypted private key", () => {
const sut = USER_ENCRYPTED_PRIVATE_KEY;
it("should deserialize encrypted private key", () => {
const encryptedPrivateKey = makeEncString().encryptedString;
const result = sut.deserializer(JSON.parse(JSON.stringify(encryptedPrivateKey)));
expect(result).toEqual(encryptedPrivateKey);
});
});
``` | /content/code_sandbox/libs/common/src/platform/services/key-state/user-key.state.spec.ts | xml | 2016-03-09T23:14:01 | 2024-08-16T15:07:51 | clients | bitwarden/clients | 8,877 | 248 |
```xml
import * as React from 'react';
import { ElementType } from 'react';
import Typography, { TypographyProps } from '@mui/material/Typography';
import { useFieldValue, useTranslate } from 'ra-core';
import { sanitizeFieldRestProps } from './sanitizeFieldRestProps';
import { FieldProps } from './types';
import { genericMemo } from './genericMemo';
const TextFieldImpl = <
RecordType extends Record<string, any> = Record<string, any>,
>(
props: TextFieldProps<RecordType>
) => {
const { className, emptyText, ...rest } = props;
const translate = useTranslate();
const value = useFieldValue(props);
return (
<Typography
component="span"
variant="body2"
className={className}
{...sanitizeFieldRestProps(rest)}
>
{value != null && typeof value !== 'string'
? value.toString()
: value ||
(emptyText ? translate(emptyText, { _: emptyText }) : null)}
</Typography>
);
};
// what? TypeScript loses the displayName if we don't set it explicitly
TextFieldImpl.displayName = 'TextFieldImpl';
export const TextField = genericMemo(TextFieldImpl);
export interface TextFieldProps<
RecordType extends Record<string, any> = Record<string, any>,
> extends FieldProps<RecordType>,
Omit<TypographyProps, 'textAlign'> {
// TypographyProps do not expose the component props, see path_to_url
component?: ElementType<any>;
}
``` | /content/code_sandbox/packages/ra-ui-materialui/src/field/TextField.tsx | xml | 2016-07-13T07:58:54 | 2024-08-16T18:32:27 | react-admin | marmelab/react-admin | 24,624 | 312 |
```xml
import { ModuleWithProviders, NgModule } from '@angular/core';
import { MY_PROJECT_NAME_ROUTE_PROVIDERS } from './providers/route.provider';
@NgModule()
export class MyProjectNameConfigModule {
static forRoot(): ModuleWithProviders<MyProjectNameConfigModule> {
return {
ngModule: MyProjectNameConfigModule,
providers: [MY_PROJECT_NAME_ROUTE_PROVIDERS],
};
}
}
``` | /content/code_sandbox/templates/module/angular/projects/my-project-name/config/src/my-project-name-config.module.ts | xml | 2016-12-03T22:56:24 | 2024-08-16T16:24:05 | abp | abpframework/abp | 12,657 | 84 |
```xml
import { Version } from '@microsoft/sp-core-library';
import {
BaseClientSideWebPart,
IPropertyPaneConfiguration,
PropertyPaneTextField,
IWebPartContext
} from '@microsoft/sp-webpart-base';
import { escape } from '@microsoft/sp-lodash-subset';
import { SPComponentLoader } from '@microsoft/sp-loader';
import styles from './MsGraph.module.scss';
import * as strings from 'msGraphStrings';
import { IMsGraphWebPartProps } from './IMsGraphWebPartProps';
import * as angular from 'angular';
import 'ng-office-fabric-ui';
import 'hellojs';
import './app/aad';
import './app/app.module';
export default class MsGraphWebPart extends BaseClientSideWebPart<IMsGraphWebPartProps> {
private $injector: angular.auto.IInjectorService;
public constructor(context: IWebPartContext) {
super();
SPComponentLoader.loadCss('path_to_url
SPComponentLoader.loadCss('path_to_url
}
public render(): void {
if (this.renderedOnce === false){
this.domElement.innerHTML = '<angulargraphapi></angulargraphapi>';
this.$injector = angular.bootstrap(this.domElement, ['angularconnectsp']);
}
}
protected get dataVersion(): Version {
return Version.parse('1.0');
}
protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration {
return {
pages: [
{
header: {
description: strings.PropertyPaneDescription
},
groups: [
{
groupName: strings.BasicGroupName,
groupFields: [
PropertyPaneTextField('description', {
label: strings.DescriptionFieldLabel
})
]
}
]
}
]
};
}
}
``` | /content/code_sandbox/samples/angular-msgraph/src/webparts/msGraph/MsGraphWebPart.ts | xml | 2016-08-30T17:21:43 | 2024-08-16T18:41:32 | sp-dev-fx-webparts | pnp/sp-dev-fx-webparts | 2,027 | 377 |
```xml
// See LICENSE.txt for license information.
import {withDatabase, withObservables} from '@nozbe/watermelondb/react';
import moment from 'moment-timezone';
import {of as of$} from 'rxjs';
import {distinctUntilChanged, switchMap} from 'rxjs/operators';
import JoinCallBanner from '@calls/components/join_call_banner/join_call_banner';
import {observeIsCallLimitRestricted} from '@calls/observers';
import {observeCallsState} from '@calls/state';
import {idsAreEqual, userIds} from '@calls/utils';
import {queryUsersById} from '@queries/servers/user';
import type {WithDatabaseArgs} from '@typings/database/database';
type OwnProps = {
serverUrl: string;
channelId: string;
}
const enhanced = withObservables(['serverUrl', 'channelId'], ({
serverUrl,
channelId,
database,
}: OwnProps & WithDatabaseArgs) => {
const callsState = observeCallsState(serverUrl).pipe(
switchMap((state) => of$(state.calls[channelId])),
);
const userModels = callsState.pipe(
distinctUntilChanged((prev, curr) => prev?.sessions === curr?.sessions), // Did the userModels object ref change?
switchMap((call) => (call ? of$(userIds(Object.values(call.sessions))) : of$([]))),
distinctUntilChanged((prev, curr) => idsAreEqual(prev, curr)), // Continue only if we have a different set of participant userIds
switchMap((ids) => (ids.length > 0 ? queryUsersById(database, ids).observeWithColumns(['last_picture_update']) : of$([]))),
);
const channelCallStartTime = callsState.pipe(
// if for some reason we don't have a startTime, use 'a few seconds ago' instead of '53 years ago'
switchMap((state) => of$(state && state.startTime ? state.startTime : moment.now())),
distinctUntilChanged(),
);
const callId = callsState.pipe(
switchMap((state) => of$(state?.id || '')),
);
return {
callId,
userModels,
channelCallStartTime,
limitRestrictedInfo: observeIsCallLimitRestricted(database, serverUrl, channelId),
};
});
export default withDatabase(enhanced(JoinCallBanner));
``` | /content/code_sandbox/app/products/calls/components/join_call_banner/index.ts | xml | 2016-10-07T16:52:32 | 2024-08-16T12:08:38 | mattermost-mobile | mattermost/mattermost-mobile | 2,155 | 491 |
```xml
/*
* @license Apache-2.0
*
*
*
* path_to_url
*
* Unless required by applicable law or agreed to in writing, software
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/
// TypeScript Version: 4.1
/**
* Percent-encodes a UTF-16 encoded string according to [RFC 3986][1].
*
* [1]: path_to_url#section-2.1
*
* @param str - string to percent-encode
* @returns percent-encoded string
*
* @example
* var str1 = 'Ladies + Gentlemen';
*
* var str2 = percentEncode( str1 );
* // returns 'Ladies%20%2B%20Gentlemen'
*/
declare function percentEncode( str: string ): string;
// EXPORTS //
export = percentEncode;
``` | /content/code_sandbox/lib/node_modules/@stdlib/string/percent-encode/docs/types/index.d.ts | xml | 2016-03-24T04:19:52 | 2024-08-16T09:03:19 | stdlib | stdlib-js/stdlib | 4,266 | 182 |
```xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="path_to_url"
xmlns="path_to_url"
xsi:schemaLocation="path_to_url path_to_url">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>spring-cloud-dependencies-parent</artifactId>
<groupId>org.springframework.cloud</groupId>
<version>4.2.0-SNAPSHOT</version>
<relativePath/>
</parent>
<artifactId>spring-cloud-function-dependencies</artifactId>
<version>4.2.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Spring Cloud Function Dependencies</name>
<description>Spring Cloud Function Dependencies</description>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-function-context</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-function-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-function-web</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-function-web</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-function-webflux</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-function-deployer</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-function-adapter-aws</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-function-adapter-azure</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-function-adapter-gcp</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-function-integration</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-function-kotlin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-function-rsocket</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-function-grpc</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-function-grpc-cloudevent-ext</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-function-serverless-web</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<profiles>
<profile>
<id>spring</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
</profiles>
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>path_to_url
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>path_to_url
</repository>
<repository>
<id>spring-releases</id>
<name>Spring Releases</name>
<url>path_to_url
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>path_to_url
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>path_to_url
</pluginRepository>
<pluginRepository>
<id>spring-releases</id>
<name>Spring Releases</name>
<url>path_to_url
</pluginRepository>
</pluginRepositories>
</project>
``` | /content/code_sandbox/spring-cloud-function-dependencies/pom.xml | xml | 2016-09-22T02:34:34 | 2024-08-16T08:19:07 | spring-cloud-function | spring-cloud/spring-cloud-function | 1,032 | 1,221 |
```xml
import React, { useCallback, useRef, useState } from 'react'
import styled from '../../lib/styled'
import cc from 'classcat'
interface WithTooltipProps {
className?: string
side?: 'right' | 'bottom' | 'bottom-right' | 'top'
tooltip?: React.ReactNode
}
const posOffset = 5
const WithTooltip: React.FC<WithTooltipProps> = ({
children,
tooltip,
className,
side = 'bottom',
}) => {
const [open, setOpen] = useState(false)
const [tooltipStyle, setTooltipStyle] = useState<React.CSSProperties>()
const ref = useRef<HTMLDivElement>(null)
const tooltipRef = useRef<HTMLDivElement>(null)
const onMouseOver = useCallback(() => {
if (ref.current == null || tooltipRef.current == null) {
setTooltipStyle(undefined)
return
}
const rectOffset = ref.current.getBoundingClientRect()
const tooltipOffset = tooltipRef.current.getBoundingClientRect()
let style: React.CSSProperties = {}
switch (side) {
case 'right':
style = {
left: rectOffset.left + rectOffset.width + posOffset,
top: rectOffset.top - (tooltipOffset.height - rectOffset.height) / 2,
}
break
case 'bottom':
style = {
left: rectOffset.left - (tooltipOffset.width - rectOffset.width) / 2,
top: rectOffset.top + rectOffset.height + posOffset,
}
break
case 'bottom-right':
style = {
left: rectOffset.left + rectOffset.width + posOffset,
top: rectOffset.top + rectOffset.height + posOffset,
}
break
case 'top':
style = {
left: rectOffset.left - (tooltipOffset.width - rectOffset.width) / 2,
top: rectOffset.top - posOffset - tooltipOffset.height,
}
break
default:
return
}
setTooltipStyle(style)
}, [side, ref])
if (tooltip == null) {
return <>{children}</>
}
return (
<div
onPointerEnter={() => setOpen(true)}
onPointerLeave={() => setOpen(false)}
onPointerOver={onMouseOver}
onClick={() => setOpen(false)}
className={className}
ref={ref}
>
{children}
{open && (
<Container
className={cc(['tooltip__container', side])}
style={tooltipStyle}
ref={tooltipRef}
>
<div className='tooltip__base'>
<span>{tooltip}</span>
</div>
</Container>
)}
</div>
)
}
export default WithTooltip
const Container = styled.div`
position: fixed;
z-index: 100;
width: max-content;
min-width: 40px;
text-align: center;
pointer-events: none;
> div {
background-color: ${({ theme }) => theme.colors.background.primary};
padding: ${({ theme }) => theme.sizes.spaces.xsm}px
${({ theme }) => theme.sizes.spaces.sm}px;
border: 1px solid ${({ theme }) => theme.colors.border.second};
border-radius: 5px;
font-size: ${({ theme }) => theme.sizes.fonts.sm}px;
color: ${({ theme }) => theme.colors.text.primary};
.tooltip-text {
background-color: transparent;
padding-right: ${({ theme }) => theme.sizes.spaces.df}px;
}
.tooltip-command {
display: inline-block;
line-height: 18px;
padding: 0 ${({ theme }) => theme.sizes.spaces.xsm}px;
border-radius: 2px;
border: 1px solid ${({ theme }) => theme.colors.border.second};
color: ${({ theme }) => theme.colors.text.subtle};
}
}
`
``` | /content/code_sandbox/src/design/components/atoms/WithTooltip.tsx | xml | 2016-11-19T14:30:34 | 2024-08-16T03:13:45 | BoostNote-App | BoostIO/BoostNote-App | 3,745 | 828 |
```xml
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="path_to_url">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), testAsset.props))\testAsset.props" />
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFrameworks>net451;$(CurrentTargetFramework)</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<ProjectReference Condition=" '$(TargetFramework)' == 'net451' " Include="..\Lib\Lib.csproj" />
</ItemGroup>
</Project>
``` | /content/code_sandbox/test/TestAssets/NonRestoredTestProjects/DotnetAddP2PProjects/WithExistingRefCondOnItem/WithExistingRefCondOnItem.csproj | xml | 2016-07-22T21:26:02 | 2024-08-16T17:23:58 | sdk | dotnet/sdk | 2,627 | 129 |
```xml
// See LICENSE.txt for license information.
import {withDatabase, withObservables} from '@nozbe/watermelondb/react';
import {observeCurrentUserId} from '@queries/servers/system';
import TeamListItem from './team_list_item';
import type {WithDatabaseArgs} from '@typings/database/database';
const withSystem = withObservables([], ({database}: WithDatabaseArgs) => ({
currentUserId: observeCurrentUserId(database),
}));
export default withDatabase(withSystem(TeamListItem));
``` | /content/code_sandbox/app/components/team_list/team_list_item/index.ts | xml | 2016-10-07T16:52:32 | 2024-08-16T12:08:38 | mattermost-mobile | mattermost/mattermost-mobile | 2,155 | 101 |
```xml
/*
*
* This source code is licensed under the MIT license which is detailed in the LICENSE.txt file.
*/
// Generic type for making a type readonly and its fields, recursively.
// This only supports Json types and bans a couple of common types which don't translate to Json.
export type DeepReadonly<T> =
T extends [infer A] ? DeepReadonlyObject1<[A]> :
T extends [infer A, infer B] ? DeepReadonlyObject1<[A, B]> :
T extends [infer A, infer B, infer C] ? DeepReadonlyObject1<[A, B, C]> :
T extends [infer A, infer B, infer C, infer D] ? DeepReadonlyObject1<[A, B, C, D]> :
T extends [infer A, infer B, infer C, infer D, infer E] ? DeepReadonlyObject1<[A, B, C, D, E]> :
T extends Array<infer U> ? ReadonlyArray<DeepReadonlyObject1<U>> :
T extends Map<infer U, infer V> ? ReadonlyMap<DeepReadonlyObject1<U>, DeepReadonlyObject1<V>> :
T extends Set<infer U> ? ReadonlySet<DeepReadonlyObject1<U>> :
T extends object ? DeepReadonlyObject1<T> :
T;
export type DeepReadonlyObject1<T> = { readonly [K in keyof T]: DeepReadonly1<T[K]> };
export type DeepReadonly1<T> =
T extends [infer A] ? DeepReadonlyObject2<[A]> :
T extends [infer A, infer B] ? DeepReadonlyObject2<[A, B]> :
T extends [infer A, infer B, infer C] ? DeepReadonlyObject2<[A, B, C]> :
T extends [infer A, infer B, infer C, infer D] ? DeepReadonlyObject2<[A, B, C, D]> :
T extends [infer A, infer B, infer C, infer D, infer E] ? DeepReadonlyObject2<[A, B, C, D, E]> :
T extends Array<infer U> ? ReadonlyArray<DeepReadonlyObject2<U>> :
T extends Map<infer U, infer V> ? ReadonlyMap<DeepReadonlyObject2<U>, DeepReadonlyObject2<V>> :
T extends Set<infer U> ? ReadonlySet<DeepReadonlyObject2<U>> :
T extends object ? DeepReadonlyObject2<T> :
T;
export type DeepReadonlyObject2<T> = { readonly [K in keyof T]: DeepReadonly2<T[K]> };
export type DeepReadonly2<T> =
T extends [infer A] ? DeepReadonlyObject3<[A]> :
T extends [infer A, infer B] ? DeepReadonlyObject3<[A, B]> :
T extends [infer A, infer B, infer C] ? DeepReadonlyObject3<[A, B, C]> :
T extends [infer A, infer B, infer C, infer D] ? DeepReadonlyObject3<[A, B, C, D]> :
T extends [infer A, infer B, infer C, infer D, infer E] ? DeepReadonlyObject3<[A, B, C, D, E]> :
T extends Array<infer U> ? ReadonlyArray<DeepReadonlyObject3<U>> :
T extends Map<infer U, infer V> ? ReadonlyMap<DeepReadonlyObject3<U>, DeepReadonlyObject3<V>> :
T extends Set<infer U> ? ReadonlySet<DeepReadonlyObject3<U>> :
T extends object ? DeepReadonlyObject3<T> :
T;
export type DeepReadonlyObject3<T> = { readonly [K in keyof T]: DeepReadonly3<T[K]> };
export type DeepReadonly3<T> =
T extends [infer A] ? DeepReadonlyObject4<[A]> :
T extends [infer A, infer B] ? DeepReadonlyObject4<[A, B]> :
T extends [infer A, infer B, infer C] ? DeepReadonlyObject4<[A, B, C]> :
T extends [infer A, infer B, infer C, infer D] ? DeepReadonlyObject4<[A, B, C, D]> :
T extends [infer A, infer B, infer C, infer D, infer E] ? DeepReadonlyObject4<[A, B, C, D, E]> :
T extends Array<infer U> ? ReadonlyArray<DeepReadonlyObject4<U>> :
T extends Map<infer U, infer V> ? ReadonlyMap<DeepReadonlyObject4<U>, DeepReadonlyObject4<V>> :
T extends Set<infer U> ? ReadonlySet<DeepReadonlyObject4<U>> :
T extends object ? DeepReadonlyObject4<T> :
T;
export type DeepReadonlyObject4<T> = { readonly [K in keyof T]: T[K] };
export function freezeDeep<A>(thing: A): A {
if (Object.isFrozen(thing)) {
return thing;
}
Object.freeze(thing);
for (const prop of Object.getOwnPropertyNames(thing)) {
freezeDeep(thing[prop]);
}
return thing;
}
``` | /content/code_sandbox/packages/extraterm-readonly-toolbox/src/main.ts | xml | 2016-03-04T12:39:59 | 2024-08-16T18:44:37 | extraterm | sedwards2009/extraterm | 2,501 | 1,133 |
```xml
import { ExpoMiddleware } from './ExpoMiddleware';
import { ServerNext, ServerRequest, ServerResponse } from './server.types';
import { getFaviconFromExpoConfigAsync } from '../../../export/favicon';
const debug = require('debug')('expo:start:server:middleware:favicon') as typeof console.log;
/**
* Middleware for generating a favicon.ico file for the current project if one doesn't exist.
*
* Test by making a get request with:
* curl -v path_to_url
*/
export class FaviconMiddleware extends ExpoMiddleware {
constructor(protected projectRoot: string) {
super(projectRoot, ['/favicon.ico']);
}
async handleRequestAsync(
req: ServerRequest,
res: ServerResponse,
next: ServerNext
): Promise<void> {
if (!['GET', 'HEAD'].includes(req.method || '')) {
return next();
}
let faviconImageData: Buffer | null;
try {
const data = await getFaviconFromExpoConfigAsync(this.projectRoot, { force: true });
if (!data) {
debug('No favicon defined in the Expo Config, skipping generation.');
return next();
}
faviconImageData = data.source;
debug(' Generated favicon successfully.');
} catch (error: any) {
debug('Failed to generate favicon from Expo config:', error);
return next(error);
}
// Respond with the generated favicon file
res.setHeader('Content-Type', 'image/x-icon');
res.end(faviconImageData);
}
}
``` | /content/code_sandbox/packages/@expo/cli/src/start/server/middleware/FaviconMiddleware.ts | xml | 2016-08-15T17:14:25 | 2024-08-16T19:54:44 | expo | expo/expo | 32,004 | 320 |
```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="side_sheet_accessibility_pane_title">Yon varaq</string>
</resources>
``` | /content/code_sandbox/lib/java/com/google/android/material/sidesheet/res/values-uz/strings.xml | xml | 2016-12-05T16:11:29 | 2024-08-16T17:51:42 | material-components-android | material-components/material-components-android | 16,176 | 89 |
```xml
// See LICENSE in the project root for license information.
/**
* Specifies the kind of data represented by a {@link ITerminalChunk} object.
* @public
*/
export enum TerminalChunkKind {
/**
* Indicates a `ITerminalChunk` object representing `stdout` console output.
*/
Stdout = 'O',
/**
* Indicates a `ITerminalChunk` object representing `stderr` console output.
*/
Stderr = 'E'
}
/**
* Represents a chunk of output that will ultimately be written to a {@link TerminalWritable}.
*
* @remarks
* Today `ITerminalChunk` represents the `stdout` and `stderr` text streams. In the future,
* we plan to expand it to include other console UI elements such as instructions for displaying
* an interactive progress bar. We may also add other metadata, for example tracking whether
* the `text` string is known to contain color codes or not.
*
* The `ITerminalChunk` object should be considered to be immutable once it is created.
* For example, {@link SplitterTransform} may pass the same chunk to multiple destinations.
*
* @public
*/
export interface ITerminalChunk {
/**
* Indicates the kind of information stored in this chunk.
*
* @remarks
* More kinds will be introduced in the future. Implementors of
* {@link TerminalWritable.onWriteChunk} should ignore unrecognized `TerminalChunkKind`
* values. `TerminalTransform` implementors should pass along unrecognized chunks
* rather than discarding them.
*/
kind: TerminalChunkKind;
/**
* The next chunk of text from the `stderr` or `stdout` stream.
*/
text: string;
}
``` | /content/code_sandbox/libraries/terminal/src/ITerminalChunk.ts | xml | 2016-09-30T00:28:20 | 2024-08-16T18:54:35 | rushstack | microsoft/rushstack | 5,790 | 372 |
```xml
<?xml version="1.0" encoding="UTF-8"?>
<document filename='bm_us-004-str.xml'>
<table id='1'>
<region id='1' col-increment='0' row-increment='0' page='2'>
<cell id='1' start-row='0' start-col='0' end-row='1'>
<bounding-box x1='131' y1='534' x2='176' y2='544'/>
<content>Loan type</content>
<instruction instr-id='525' subinstr-id='0'/>
<instruction instr-id='525' subinstr-id='2'/>
<instruction instr-id='525' subinstr-id='4'/>
</cell>
<cell id='1' start-row='0' start-col='1' end-col='2'>
<bounding-box x1='262' y1='550' x2='313' y2='559'/>
<content>12/31/2009</content>
<instruction instr-id='527' subinstr-id='2'/>
<instruction instr-id='527' subinstr-id='4'/>
<instruction instr-id='527' subinstr-id='6'/>
</cell>
<cell id='1' start-row='0' start-col='3' end-col='4'>
<bounding-box x1='354' y1='550' x2='404' y2='559'/>
<content>12/31/2010</content>
<instruction instr-id='523' subinstr-id='0'/>
<instruction instr-id='523' subinstr-id='2'/>
<instruction instr-id='523' subinstr-id='4'/>
</cell>
<cell id='1' start-row='0' start-col='5' end-col='6'>
<bounding-box x1='458' y1='550' x2='503' y2='559'/>
<content>6/30/2011</content>
<instruction instr-id='523' subinstr-id='20'/>
<instruction instr-id='523' subinstr-id='22'/>
<instruction instr-id='523' subinstr-id='24'/>
</cell>
<cell id='1' start-row='1' start-col='1'>
<bounding-box x1='251' y1='535' x2='280' y2='545'/>
<content>$000's</content>
<instruction instr-id='447' subinstr-id='0'/>
<instruction instr-id='447' subinstr-id='2'/>
</cell>
<cell id='1' start-row='1' start-col='2'>
<bounding-box x1='309' y1='535' x2='318' y2='545'/>
<content>%</content>
<instruction instr-id='447' subinstr-id='4'/>
</cell>
<cell id='1' start-row='1' start-col='3'>
<bounding-box x1='347' y1='535' x2='376' y2='545'/>
<content>$000's</content>
<instruction instr-id='447' subinstr-id='6'/>
<instruction instr-id='447' subinstr-id='8'/>
</cell>
<cell id='1' start-row='1' start-col='4'>
<bounding-box x1='405' y1='535' x2='414' y2='545'/>
<content>%</content>
<instruction instr-id='447' subinstr-id='10'/>
</cell>
<cell id='1' start-row='1' start-col='5'>
<bounding-box x1='444' y1='535' x2='472' y2='545'/>
<content>$000's</content>
<instruction instr-id='447' subinstr-id='12'/>
<instruction instr-id='447' subinstr-id='14'/>
</cell>
<cell id='1' start-row='1' start-col='6'>
<bounding-box x1='501' y1='535' x2='510' y2='545'/>
<content>%</content>
<instruction instr-id='447' subinstr-id='16'/>
</cell>
<cell id='1' start-row='2' start-col='0'>
<bounding-box x1='74' y1='522' x2='170' y2='533'/>
<content>Real estate loans</content>
<instruction instr-id='452' subinstr-id='0'/>
<instruction instr-id='452' subinstr-id='2'/>
<instruction instr-id='452' subinstr-id='4'/>
<instruction instr-id='452' subinstr-id='6'/>
<instruction instr-id='452' subinstr-id='8'/>
<instruction instr-id='452' subinstr-id='10'/>
<instruction instr-id='452' subinstr-id='12'/>
<instruction instr-id='452' subinstr-id='14'/>
<instruction instr-id='452' subinstr-id='18'/>
<instruction instr-id='452' subinstr-id='20'/>
<instruction instr-id='452' subinstr-id='22'/>
<instruction instr-id='452' subinstr-id='24'/>
<instruction instr-id='452' subinstr-id='26'/>
</cell>
<cell id='1' start-row='3' start-col='0'>
<bounding-box x1='77' y1='509' x2='217' y2='518'/>
<content>1-4 family residential mortgage</content>
<instruction instr-id='457' subinstr-id='0'/>
<instruction instr-id='457' subinstr-id='2'/>
<instruction instr-id='457' subinstr-id='4'/>
<instruction instr-id='457' subinstr-id='6'/>
<instruction instr-id='457' subinstr-id='8'/>
<instruction instr-id='457' subinstr-id='10'/>
<instruction instr-id='457' subinstr-id='12'/>
<instruction instr-id='457' subinstr-id='16'/>
<instruction instr-id='457' subinstr-id='18'/>
<instruction instr-id='457' subinstr-id='20'/>
<instruction instr-id='457' subinstr-id='22'/>
<instruction instr-id='457' subinstr-id='24'/>
<instruction instr-id='457' subinstr-id='26'/>
<instruction instr-id='457' subinstr-id='28'/>
<instruction instr-id='457' subinstr-id='30'/>
<instruction instr-id='457' subinstr-id='32'/>
<instruction instr-id='457' subinstr-id='34'/>
</cell>
<cell id='1' start-row='3' start-col='1'>
<bounding-box x1='248' y1='509' x2='293' y2='518'/>
<content>4,151,000</content>
<instruction instr-id='457' subinstr-id='36'/>
<instruction instr-id='457' subinstr-id='38'/>
<instruction instr-id='457' subinstr-id='40'/>
</cell>
<cell id='1' start-row='3' start-col='2'>
<bounding-box x1='310' y1='509' x2='330' y2='518'/>
<content>25.0</content>
<instruction instr-id='457' subinstr-id='42'/>
<instruction instr-id='457' subinstr-id='44'/>
</cell>
<cell id='1' start-row='3' start-col='3'>
<bounding-box x1='344' y1='509' x2='389' y2='518'/>
<content>4,090,000</content>
<instruction instr-id='457' subinstr-id='46'/>
<instruction instr-id='457' subinstr-id='48'/>
<instruction instr-id='457' subinstr-id='50'/>
<instruction instr-id='457' subinstr-id='52'/>
</cell>
<cell id='1' start-row='3' start-col='4'>
<bounding-box x1='406' y1='509' x2='426' y2='518'/>
<content>27.5</content>
<instruction instr-id='457' subinstr-id='54'/>
<instruction instr-id='457' subinstr-id='56'/>
</cell>
<cell id='1' start-row='3' start-col='5'>
<bounding-box x1='440' y1='509' x2='485' y2='518'/>
<content>3,925,000</content>
<instruction instr-id='457' subinstr-id='58'/>
<instruction instr-id='457' subinstr-id='60'/>
<instruction instr-id='457' subinstr-id='62'/>
</cell>
<cell id='1' start-row='3' start-col='6'>
<bounding-box x1='503' y1='509' x2='523' y2='518'/>
<content>24.9</content>
<instruction instr-id='457' subinstr-id='64'/>
<instruction instr-id='457' subinstr-id='66'/>
</cell>
<cell id='1' start-row='4' start-col='0'>
<bounding-box x1='80' y1='496' x2='180' y2='506'/>
<content>Commercial Mortgage</content>
<instruction instr-id='461' subinstr-id='0'/>
<instruction instr-id='461' subinstr-id='2'/>
<instruction instr-id='461' subinstr-id='4'/>
<instruction instr-id='461' subinstr-id='6'/>
<instruction instr-id='461' subinstr-id='8'/>
<instruction instr-id='461' subinstr-id='10'/>
<instruction instr-id='461' subinstr-id='12'/>
<instruction instr-id='461' subinstr-id='14'/>
<instruction instr-id='461' subinstr-id='16'/>
<instruction instr-id='461' subinstr-id='18'/>
<instruction instr-id='461' subinstr-id='20'/>
</cell>
<cell id='1' start-row='4' start-col='1'>
<bounding-box x1='257' y1='496' x2='293' y2='506'/>
<content>361,000</content>
<instruction instr-id='461' subinstr-id='22'/>
<instruction instr-id='461' subinstr-id='24'/>
</cell>
<cell id='1' start-row='4' start-col='2'>
<bounding-box x1='316' y1='496' x2='330' y2='506'/>
<content>2.2</content>
<instruction instr-id='461' subinstr-id='26'/>
<instruction instr-id='461' subinstr-id='28'/>
</cell>
<cell id='1' start-row='4' start-col='3'>
<bounding-box x1='353' y1='496' x2='389' y2='506'/>
<content>331,000</content>
<instruction instr-id='461' subinstr-id='30'/>
<instruction instr-id='461' subinstr-id='32'/>
<instruction instr-id='461' subinstr-id='34'/>
</cell>
<cell id='1' start-row='4' start-col='4'>
<bounding-box x1='412' y1='496' x2='426' y2='506'/>
<content>2.2</content>
<instruction instr-id='461' subinstr-id='36'/>
<instruction instr-id='461' subinstr-id='38'/>
</cell>
<cell id='1' start-row='4' start-col='5'>
<bounding-box x1='449' y1='496' x2='485' y2='506'/>
<content>284,000</content>
<instruction instr-id='461' subinstr-id='40'/>
<instruction instr-id='461' subinstr-id='42'/>
</cell>
<cell id='1' start-row='4' start-col='6'>
<bounding-box x1='508' y1='496' x2='523' y2='506'/>
<content>1.8</content>
<instruction instr-id='461' subinstr-id='44'/>
<instruction instr-id='461' subinstr-id='46'/>
</cell>
<cell id='1' start-row='5' start-col='0'>
<bounding-box x1='80' y1='484' x2='232' y2='493'/>
<content>Multifamily residential (5 or more)</content>
<instruction instr-id='464' subinstr-id='0'/>
<instruction instr-id='464' subinstr-id='2'/>
<instruction instr-id='464' subinstr-id='4'/>
<instruction instr-id='464' subinstr-id='6'/>
<instruction instr-id='464' subinstr-id='8'/>
<instruction instr-id='464' subinstr-id='10'/>
<instruction instr-id='464' subinstr-id='12'/>
<instruction instr-id='464' subinstr-id='14'/>
<instruction instr-id='464' subinstr-id='16'/>
<instruction instr-id='464' subinstr-id='18'/>
<instruction instr-id='464' subinstr-id='20'/>
<instruction instr-id='464' subinstr-id='22'/>
<instruction instr-id='464' subinstr-id='24'/>
<instruction instr-id='464' subinstr-id='26'/>
<instruction instr-id='464' subinstr-id='28'/>
<instruction instr-id='464' subinstr-id='30'/>
<instruction instr-id='464' subinstr-id='34'/>
<instruction instr-id='464' subinstr-id='36'/>
<instruction instr-id='464' subinstr-id='38'/>
<instruction instr-id='464' subinstr-id='42'/>
<instruction instr-id='464' subinstr-id='44'/>
<instruction instr-id='464' subinstr-id='46'/>
</cell>
<cell id='1' start-row='5' start-col='1'>
<bounding-box x1='257' y1='484' x2='293' y2='493'/>
<content>380,000</content>
<instruction instr-id='464' subinstr-id='48'/>
<instruction instr-id='464' subinstr-id='50'/>
</cell>
<cell id='1' start-row='5' start-col='2'>
<bounding-box x1='316' y1='484' x2='330' y2='493'/>
<content>2.3</content>
<instruction instr-id='464' subinstr-id='52'/>
<instruction instr-id='464' subinstr-id='54'/>
</cell>
<cell id='1' start-row='5' start-col='3'>
<bounding-box x1='353' y1='484' x2='389' y2='493'/>
<content>327,000</content>
<instruction instr-id='464' subinstr-id='56'/>
<instruction instr-id='464' subinstr-id='58'/>
<instruction instr-id='464' subinstr-id='60'/>
</cell>
<cell id='1' start-row='5' start-col='4'>
<bounding-box x1='412' y1='484' x2='426' y2='493'/>
<content>2.2</content>
<instruction instr-id='464' subinstr-id='62'/>
<instruction instr-id='464' subinstr-id='64'/>
</cell>
<cell id='1' start-row='5' start-col='5'>
<bounding-box x1='449' y1='484' x2='485' y2='493'/>
<content>327,000</content>
<instruction instr-id='464' subinstr-id='66'/>
<instruction instr-id='464' subinstr-id='68'/>
</cell>
<cell id='1' start-row='5' start-col='6'>
<bounding-box x1='508' y1='484' x2='523' y2='493'/>
<content>2.1</content>
<instruction instr-id='464' subinstr-id='70'/>
<instruction instr-id='464' subinstr-id='72'/>
</cell>
<cell id='1' start-row='6' start-col='0'>
<bounding-box x1='80' y1='471' x2='168' y2='481'/>
<content>Construction Loans</content>
<instruction instr-id='468' subinstr-id='0'/>
<instruction instr-id='468' subinstr-id='2'/>
<instruction instr-id='468' subinstr-id='4'/>
<instruction instr-id='468' subinstr-id='6'/>
<instruction instr-id='468' subinstr-id='8'/>
<instruction instr-id='468' subinstr-id='10'/>
<instruction instr-id='468' subinstr-id='12'/>
<instruction instr-id='468' subinstr-id='14'/>
<instruction instr-id='468' subinstr-id='16'/>
</cell>
<cell id='1' start-row='6' start-col='1'>
<bounding-box x1='257' y1='471' x2='293' y2='481'/>
<content>173,000</content>
<instruction instr-id='468' subinstr-id='18'/>
<instruction instr-id='468' subinstr-id='20'/>
</cell>
<cell id='1' start-row='6' start-col='2'>
<bounding-box x1='316' y1='471' x2='330' y2='481'/>
<content>1.0</content>
<instruction instr-id='468' subinstr-id='22'/>
<instruction instr-id='468' subinstr-id='24'/>
</cell>
<cell id='1' start-row='6' start-col='3'>
<bounding-box x1='353' y1='471' x2='389' y2='481'/>
<content>148,000</content>
<instruction instr-id='468' subinstr-id='26'/>
<instruction instr-id='468' subinstr-id='28'/>
<instruction instr-id='468' subinstr-id='30'/>
</cell>
<cell id='1' start-row='6' start-col='4'>
<bounding-box x1='412' y1='471' x2='426' y2='481'/>
<content>1.0</content>
<instruction instr-id='468' subinstr-id='32'/>
<instruction instr-id='468' subinstr-id='34'/>
</cell>
<cell id='1' start-row='6' start-col='5'>
<bounding-box x1='449' y1='471' x2='485' y2='481'/>
<content>170,000</content>
<instruction instr-id='468' subinstr-id='36'/>
<instruction instr-id='468' subinstr-id='38'/>
</cell>
<cell id='1' start-row='6' start-col='6'>
<bounding-box x1='508' y1='471' x2='523' y2='481'/>
<content>1.1</content>
<instruction instr-id='468' subinstr-id='40'/>
<instruction instr-id='468' subinstr-id='42'/>
</cell>
<cell id='1' start-row='7' start-col='0'>
<bounding-box x1='74' y1='458' x2='194' y2='467'/>
<content>Commercial & Industrial</content>
<instruction instr-id='475' subinstr-id='0'/>
<instruction instr-id='475' subinstr-id='2'/>
<instruction instr-id='475' subinstr-id='4'/>
<instruction instr-id='475' subinstr-id='6'/>
<instruction instr-id='475' subinstr-id='8'/>
<instruction instr-id='475' subinstr-id='10'/>
<instruction instr-id='475' subinstr-id='12'/>
<instruction instr-id='475' subinstr-id='14'/>
<instruction instr-id='475' subinstr-id='16'/>
<instruction instr-id='475' subinstr-id='18'/>
<instruction instr-id='475' subinstr-id='22'/>
<instruction instr-id='475' subinstr-id='24'/>
<instruction instr-id='475' subinstr-id='26'/>
<instruction instr-id='475' subinstr-id='28'/>
<instruction instr-id='475' subinstr-id='30'/>
<instruction instr-id='475' subinstr-id='32'/>
<instruction instr-id='475' subinstr-id='34'/>
</cell>
<cell id='1' start-row='7' start-col='1'>
<bounding-box x1='257' y1='458' x2='293' y2='467'/>
<content>555,000</content>
<instruction instr-id='479' subinstr-id='0'/>
<instruction instr-id='479' subinstr-id='2'/>
</cell>
<cell id='1' start-row='7' start-col='2'>
<bounding-box x1='316' y1='458' x2='330' y2='467'/>
<content>3.3</content>
<instruction instr-id='479' subinstr-id='4'/>
<instruction instr-id='479' subinstr-id='6'/>
</cell>
<cell id='1' start-row='7' start-col='3'>
<bounding-box x1='353' y1='458' x2='389' y2='467'/>
<content>497,000</content>
<instruction instr-id='479' subinstr-id='8'/>
<instruction instr-id='479' subinstr-id='10'/>
<instruction instr-id='479' subinstr-id='12'/>
</cell>
<cell id='1' start-row='7' start-col='4'>
<bounding-box x1='412' y1='458' x2='426' y2='467'/>
<content>3.3</content>
<instruction instr-id='479' subinstr-id='14'/>
<instruction instr-id='479' subinstr-id='16'/>
</cell>
<cell id='1' start-row='7' start-col='5'>
<bounding-box x1='449' y1='458' x2='485' y2='467'/>
<content>438,000</content>
<instruction instr-id='479' subinstr-id='18'/>
<instruction instr-id='479' subinstr-id='20'/>
</cell>
<cell id='1' start-row='7' start-col='6'>
<bounding-box x1='508' y1='458' x2='523' y2='467'/>
<content>2.8</content>
<instruction instr-id='479' subinstr-id='22'/>
<instruction instr-id='479' subinstr-id='24'/>
</cell>
<cell id='1' start-row='8' start-col='0'>
<bounding-box x1='74' y1='444' x2='158' y2='454'/>
<content>Consumer Loans</content>
<instruction instr-id='483' subinstr-id='0'/>
<instruction instr-id='483' subinstr-id='2'/>
<instruction instr-id='483' subinstr-id='4'/>
<instruction instr-id='483' subinstr-id='6'/>
<instruction instr-id='483' subinstr-id='8'/>
<instruction instr-id='483' subinstr-id='10'/>
<instruction instr-id='483' subinstr-id='12'/>
</cell>
<cell id='1' start-row='8' start-col='01'>
<bounding-box x1='262' y1='445' x2='293' y2='454'/>
<content>63,000</content>
<instruction instr-id='487' subinstr-id='0'/>
<instruction instr-id='487' subinstr-id='2'/>
</cell>
<cell id='1' start-row='8' start-col='2'>
<bounding-box x1='316' y1='445' x2='330' y2='454'/>
<content>0.4</content>
<instruction instr-id='487' subinstr-id='4'/>
<instruction instr-id='487' subinstr-id='6'/>
</cell>
<cell id='1' start-row='8' start-col='3'>
<bounding-box x1='358' y1='445' x2='389' y2='454'/>
<content>69,000</content>
<instruction instr-id='487' subinstr-id='8'/>
<instruction instr-id='487' subinstr-id='10'/>
<instruction instr-id='487' subinstr-id='12'/>
</cell>
<cell id='1' start-row='8' start-col='4'>
<bounding-box x1='412' y1='445' x2='426' y2='454'/>
<content>0.5</content>
<instruction instr-id='487' subinstr-id='14'/>
<instruction instr-id='487' subinstr-id='16'/>
</cell>
<cell id='1' start-row='8' start-col='5'>
<bounding-box x1='455' y1='445' x2='485' y2='454'/>
<content>66,000</content>
<instruction instr-id='487' subinstr-id='18'/>
<instruction instr-id='487' subinstr-id='20'/>
</cell>
<cell id='1' start-row='8' start-col='6'>
<bounding-box x1='508' y1='445' x2='523' y2='454'/>
<content>0.4</content>
<instruction instr-id='487' subinstr-id='22'/>
<instruction instr-id='487' subinstr-id='24'/>
</cell>
<cell id='1' start-row='9' start-col='0'>
<bounding-box x1='74' y1='431' x2='215' y2='441'/>
<content>Lease financing receivables</content>
<instruction instr-id='492' subinstr-id='0'/>
<instruction instr-id='492' subinstr-id='2'/>
<instruction instr-id='492' subinstr-id='4'/>
<instruction instr-id='492' subinstr-id='6'/>
<instruction instr-id='492' subinstr-id='8'/>
<instruction instr-id='492' subinstr-id='10'/>
<instruction instr-id='492' subinstr-id='12'/>
<instruction instr-id='492' subinstr-id='14'/>
<instruction instr-id='492' subinstr-id='16'/>
<instruction instr-id='492' subinstr-id='18'/>
<instruction instr-id='492' subinstr-id='20'/>
<instruction instr-id='492' subinstr-id='22'/>
<instruction instr-id='492' subinstr-id='24'/>
<instruction instr-id='492' subinstr-id='26'/>
<instruction instr-id='492' subinstr-id='28'/>
<instruction instr-id='492' subinstr-id='30'/>
<instruction instr-id='492' subinstr-id='32'/>
<instruction instr-id='492' subinstr-id='34'/>
<instruction instr-id='492' subinstr-id='36'/>
<instruction instr-id='492' subinstr-id='38'/>
<instruction instr-id='492' subinstr-id='40'/>
</cell>
<cell id='1' start-row='9' start-col='1'>
<bounding-box x1='248' y1='431' x2='293' y2='441'/>
<content>3,508,000</content>
<instruction instr-id='496' subinstr-id='0'/>
<instruction instr-id='496' subinstr-id='2'/>
<instruction instr-id='496' subinstr-id='4'/>
</cell>
<cell id='1' start-row='9' start-col='2'>
<bounding-box x1='310' y1='431' x2='330' y2='441'/>
<content>21.1</content>
<instruction instr-id='496' subinstr-id='6'/>
<instruction instr-id='496' subinstr-id='8'/>
</cell>
<cell id='1' start-row='9' start-col='3'>
<bounding-box x1='344' y1='431' x2='389' y2='441'/>
<content>3,147,000</content>
<instruction instr-id='496' subinstr-id='10'/>
<instruction instr-id='496' subinstr-id='12'/>
<instruction instr-id='496' subinstr-id='14'/>
<instruction instr-id='496' subinstr-id='16'/>
</cell>
<cell id='1' start-row='9' start-col='4'>
<bounding-box x1='406' y1='431' x2='426' y2='441'/>
<content>21.2</content>
<instruction instr-id='496' subinstr-id='18'/>
<instruction instr-id='496' subinstr-id='20'/>
</cell>
<cell id='1' start-row='9' start-col='5'>
<bounding-box x1='440' y1='431' x2='485' y2='441'/>
<content>2,780,000</content>
<instruction instr-id='496' subinstr-id='22'/>
<instruction instr-id='496' subinstr-id='24'/>
<instruction instr-id='496' subinstr-id='26'/>
</cell>
<cell id='1' start-row='9' start-col='06'>
<bounding-box x1='503' y1='431' x2='523' y2='441'/>
<content>17.7</content>
<instruction instr-id='496' subinstr-id='28'/>
<instruction instr-id='496' subinstr-id='30'/>
</cell>
<cell id='1' start-row='10' start-col='0'>
<bounding-box x1='74' y1='418' x2='132' y2='427'/>
<content>Other loans</content>
<instruction instr-id='501' subinstr-id='0'/>
<instruction instr-id='501' subinstr-id='2'/>
<instruction instr-id='501' subinstr-id='4'/>
<instruction instr-id='501' subinstr-id='6'/>
<instruction instr-id='501' subinstr-id='8'/>
<instruction instr-id='501' subinstr-id='10'/>
<instruction instr-id='501' subinstr-id='12'/>
<instruction instr-id='501' subinstr-id='14'/>
</cell>
<cell id='1' start-row='11' start-col='0'>
<bounding-box x1='77' y1='405' x2='208' y2='415'/>
<content>Loans to purchase securities</content>
<instruction instr-id='508' subinstr-id='2'/>
<instruction instr-id='508' subinstr-id='4'/>
<instruction instr-id='508' subinstr-id='6'/>
<instruction instr-id='508' subinstr-id='8'/>
<instruction instr-id='508' subinstr-id='10'/>
<instruction instr-id='508' subinstr-id='12'/>
<instruction instr-id='508' subinstr-id='14'/>
<instruction instr-id='508' subinstr-id='16'/>
<instruction instr-id='508' subinstr-id='18'/>
<instruction instr-id='508' subinstr-id='20'/>
<instruction instr-id='508' subinstr-id='22'/>
<instruction instr-id='508' subinstr-id='24'/>
</cell>
<cell id='1' start-row='11' start-col='1'>
<bounding-box x1='248' y1='405' x2='293' y2='415'/>
<content>1,844,000</content>
<instruction instr-id='508' subinstr-id='26'/>
<instruction instr-id='508' subinstr-id='28'/>
<instruction instr-id='508' subinstr-id='30'/>
</cell>
<cell id='1' start-row='11' start-col='2'>
<bounding-box x1='310' y1='405' x2='330' y2='415'/>
<content>11.1</content>
<instruction instr-id='508' subinstr-id='32'/>
<instruction instr-id='508' subinstr-id='34'/>
</cell>
<cell id='1' start-row='11' start-col='3'>
<bounding-box x1='344' y1='405' x2='389' y2='415'/>
<content>1,148,000</content>
<instruction instr-id='508' subinstr-id='36'/>
<instruction instr-id='508' subinstr-id='38'/>
<instruction instr-id='508' subinstr-id='40'/>
<instruction instr-id='508' subinstr-id='42'/>
</cell>
<cell id='1' start-row='11' start-col='4'>
<bounding-box x1='412' y1='405' x2='426' y2='415'/>
<content>7.7</content>
<instruction instr-id='508' subinstr-id='44'/>
<instruction instr-id='508' subinstr-id='46'/>
</cell>
<cell id='1' start-row='11' start-col='5'>
<bounding-box x1='440' y1='405' x2='485' y2='415'/>
<content>2,754,000</content>
<instruction instr-id='508' subinstr-id='48'/>
<instruction instr-id='508' subinstr-id='50'/>
<instruction instr-id='508' subinstr-id='52'/>
</cell>
<cell id='1' start-row='11' start-col='6'>
<bounding-box x1='503' y1='405' x2='523' y2='415'/>
<content>17.5</content>
<instruction instr-id='508' subinstr-id='54'/>
<instruction instr-id='508' subinstr-id='56'/>
</cell>
<cell id='1' start-row='12' start-col='0'>
<bounding-box x1='77' y1='393' x2='223' y2='402'/>
<content>Loans to nondepository Fin.Inst.</content>
<instruction instr-id='512' subinstr-id='2'/>
<instruction instr-id='512' subinstr-id='4'/>
<instruction instr-id='512' subinstr-id='6'/>
<instruction instr-id='512' subinstr-id='8'/>
<instruction instr-id='512' subinstr-id='10'/>
<instruction instr-id='512' subinstr-id='12'/>
<instruction instr-id='512' subinstr-id='14'/>
<instruction instr-id='512' subinstr-id='16'/>
<instruction instr-id='512' subinstr-id='18'/>
<instruction instr-id='512' subinstr-id='20'/>
<instruction instr-id='512' subinstr-id='22'/>
<instruction instr-id='512' subinstr-id='24'/>
<instruction instr-id='512' subinstr-id='26'/>
<instruction instr-id='512' subinstr-id='28'/>
</cell>
<cell id='1' start-row='12' start-col='1'>
<bounding-box x1='248' y1='393' x2='293' y2='402'/>
<content>4,958,000</content>
<instruction instr-id='512' subinstr-id='30'/>
<instruction instr-id='512' subinstr-id='32'/>
<instruction instr-id='512' subinstr-id='34'/>
</cell>
<cell id='1' start-row='12' start-col='2'>
<bounding-box x1='310' y1='393' x2='330' y2='402'/>
<content>29.9</content>
<instruction instr-id='512' subinstr-id='36'/>
<instruction instr-id='512' subinstr-id='38'/>
</cell>
<cell id='1' start-row='12' start-col='3'>
<bounding-box x1='344' y1='393' x2='389' y2='402'/>
<content>4,512,000</content>
<instruction instr-id='512' subinstr-id='40'/>
<instruction instr-id='512' subinstr-id='42'/>
<instruction instr-id='512' subinstr-id='44'/>
<instruction instr-id='512' subinstr-id='46'/>
</cell>
<cell id='1' start-row='12' start-col='4'>
<bounding-box x1='406' y1='393' x2='426' y2='402'/>
<content>30.3</content>
<instruction instr-id='512' subinstr-id='48'/>
<instruction instr-id='512' subinstr-id='50'/>
</cell>
<cell id='1' start-row='12' start-col='5'>
<bounding-box x1='440' y1='393' x2='485' y2='402'/>
<content>4,207,000</content>
<instruction instr-id='512' subinstr-id='52'/>
<instruction instr-id='512' subinstr-id='54'/>
<instruction instr-id='512' subinstr-id='56'/>
</cell>
<cell id='1' start-row='12' start-col='6'>
<bounding-box x1='503' y1='393' x2='523' y2='402'/>
<content>26.7</content>
<instruction instr-id='512' subinstr-id='58'/>
<instruction instr-id='512' subinstr-id='60'/>
</cell>
<cell id='1' start-row='13' start-col='0'>
<bounding-box x1='77' y1='380' x2='145' y2='390'/>
<content>All other Loans</content>
<instruction instr-id='517' subinstr-id='0'/>
<instruction instr-id='517' subinstr-id='2'/>
<instruction instr-id='517' subinstr-id='4'/>
<instruction instr-id='517' subinstr-id='6'/>
<instruction instr-id='517' subinstr-id='8'/>
<instruction instr-id='517' subinstr-id='12'/>
</cell>
<cell id='1' start-row='13' start-col='1'>
<bounding-box x1='257' y1='380' x2='293' y2='390'/>
<content>611,000</content>
<instruction instr-id='517' subinstr-id='14'/>
<instruction instr-id='517' subinstr-id='16'/>
</cell>
<cell id='1' start-row='13' start-col='2'>
<bounding-box x1='316' y1='380' x2='330' y2='390'/>
<content>3.7</content>
<instruction instr-id='517' subinstr-id='18'/>
<instruction instr-id='517' subinstr-id='20'/>
</cell>
<cell id='1' start-row='13' start-col='3'>
<bounding-box x1='353' y1='380' x2='389' y2='390'/>
<content>602,000</content>
<instruction instr-id='517' subinstr-id='22'/>
<instruction instr-id='517' subinstr-id='24'/>
<instruction instr-id='517' subinstr-id='26'/>
</cell>
<cell id='1' start-row='13' start-col='4'>
<bounding-box x1='412' y1='380' x2='426' y2='390'/>
<content>4.0</content>
<instruction instr-id='517' subinstr-id='28'/>
<instruction instr-id='517' subinstr-id='30'/>
</cell>
<cell id='1' start-row='13' start-col='5'>
<bounding-box x1='449' y1='380' x2='485' y2='390'/>
<content>799,000</content>
<instruction instr-id='517' subinstr-id='32'/>
<instruction instr-id='517' subinstr-id='34'/>
</cell>
<cell id='1' start-row='13' start-col='6'>
<bounding-box x1='508' y1='380' x2='523' y2='390'/>
<content>5.1</content>
<instruction instr-id='517' subinstr-id='36'/>
<instruction instr-id='517' subinstr-id='38'/>
</cell>
<cell id='1' start-row='14' start-col='0'>
<bounding-box x1='74' y1='367' x2='157' y2='377'/>
<content>Total Gross Loans</content>
<instruction instr-id='521' subinstr-id='0'/>
<instruction instr-id='521' subinstr-id='2'/>
<instruction instr-id='521' subinstr-id='4'/>
<instruction instr-id='521' subinstr-id='6'/>
<instruction instr-id='521' subinstr-id='8'/>
<instruction instr-id='521' subinstr-id='10'/>
<instruction instr-id='521' subinstr-id='12'/>
<instruction instr-id='521' subinstr-id='16'/>
</cell>
<cell id='1' start-row='14' start-col='1'>
<bounding-box x1='243' y1='367' x2='293' y2='377'/>
<content>16,604,000</content>
<instruction instr-id='521' subinstr-id='18'/>
<instruction instr-id='521' subinstr-id='20'/>
<instruction instr-id='521' subinstr-id='22'/>
</cell>
<cell id='1' start-row='14' start-col='2'>
<bounding-box x1='305' y1='367' x2='330' y2='377'/>
<content>100.0</content>
<instruction instr-id='521' subinstr-id='24'/>
<instruction instr-id='521' subinstr-id='26'/>
</cell>
<cell id='1' start-row='14' start-col='3'>
<bounding-box x1='339' y1='367' x2='389' y2='377'/>
<content>14,871,000</content>
<instruction instr-id='521' subinstr-id='28'/>
<instruction instr-id='521' subinstr-id='30'/>
<instruction instr-id='521' subinstr-id='32'/>
<instruction instr-id='521' subinstr-id='34'/>
</cell>
<cell id='1' start-row='14' start-col='4'>
<bounding-box x1='401' y1='367' x2='426' y2='377'/>
<content>100.0</content>
<instruction instr-id='521' subinstr-id='36'/>
<instruction instr-id='521' subinstr-id='38'/>
</cell>
<cell id='1' start-row='14' start-col='5'>
<bounding-box x1='435' y1='367' x2='485' y2='377'/>
<content>15,750,000</content>
<instruction instr-id='521' subinstr-id='40'/>
<instruction instr-id='521' subinstr-id='42'/>
<instruction instr-id='521' subinstr-id='44'/>
</cell>
<cell id='1' start-row='14' start-col='6'>
<bounding-box x1='497' y1='367' x2='523' y2='377'/>
<content>100.0</content>
<instruction instr-id='521' subinstr-id='46'/>
<instruction instr-id='521' subinstr-id='48'/>
</cell>
</region>
</table>
</document>
``` | /content/code_sandbox/tests/files/tabula/icdar2013-dataset/competition-dataset-us/us-004-str.xml | xml | 2016-06-18T11:48:49 | 2024-08-15T18:32:02 | camelot | atlanhq/camelot | 3,628 | 9,838 |
```xml
import {RawPathParams, UsePipe} from "@tsed/platform-params";
import {useDecorators} from "@tsed/core";
import {PersonPipe} from "../services/PersonPipe";
export interface IUsePersonParamOptions {
optional?: boolean;
}
export function UsePersonParam(expression: string, options: IUsePersonParamOptions = {}): ParameterDecorator {
return useDecorators(
RawPathParams(expression),
UsePipe(PersonPipe, options) // UsePipe accept second parameter to store your options
);
}
``` | /content/code_sandbox/docs/docs/snippets/pipes/pipes-decorator-with-options.ts | xml | 2016-02-21T18:38:47 | 2024-08-14T21:19:48 | tsed | tsedio/tsed | 2,817 | 112 |
```xml
<!--
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~
~ path_to_url
~
~ Unless required by applicable law or agreed to in writing, software
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-->
<dataset>
<metadata>
<column name="object_catalog"/>
<column name="object_schema"/>
<column name="object_name"/>
<column name="object_type"/>
<column name="collection_type_identifier"/>
<column name="data_type"/>
<column name="character_maximum_length"/>
<column name="character_octet_length"/>
<column name="character_set_catalog"/>
<column name="character_set_schema"/>
<column name="character_set_name"/>
<column name="collation_catalog"/>
<column name="collation_schema"/>
<column name="collation_name"/>
<column name="numeric_precision"/>
<column name="numeric_precision_radix"/>
<column name="numeric_scale"/>
<column name="datetime_precision"/>
<column name="interval_type"/>
<column name="interval_precision"/>
<column name="domain_default"/>
<column name="udt_catalog"/>
<column name="udt_schema"/>
<column name="udt_name"/>
<column name="scope_catalog"/>
<column name="scope_schema"/>
<column name="scope_name"/>
<column name="maximum_cardinality"/>
<column name="dtd_identifier"/>
</metadata>
</dataset>
``` | /content/code_sandbox/test/e2e/sql/src/test/resources/cases/dql/dataset/empty_storage_units/opengauss/select_opengauss_information_schema_element_types.xml | xml | 2016-01-18T12:49:26 | 2024-08-16T15:48:11 | shardingsphere | apache/shardingsphere | 19,707 | 335 |
```xml
import { put, takeEvery } from 'redux-saga/effects';
import { removeUserAccess } from '@proton/pass/lib/shares/share.requests';
import {
shareRemoveMemberAccessFailure,
shareRemoveMemberAccessIntent,
shareRemoveMemberAccessSuccess,
} from '@proton/pass/store/actions';
function* removeUserAccessWorker({ payload, meta: { request } }: ReturnType<typeof shareRemoveMemberAccessIntent>) {
try {
yield removeUserAccess(payload);
yield put(shareRemoveMemberAccessSuccess(request.id, payload.shareId, payload.userShareId));
} catch (err) {
yield put(shareRemoveMemberAccessFailure(request.id, err));
}
}
export default function* watcher() {
yield takeEvery(shareRemoveMemberAccessIntent.match, removeUserAccessWorker);
}
``` | /content/code_sandbox/packages/pass/store/sagas/shares/share-remove-member.saga.ts | xml | 2016-06-08T11:16:51 | 2024-08-16T14:14:27 | WebClients | ProtonMail/WebClients | 4,300 | 168 |
```xml
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="Model2022"
targetNamespace="path_to_url"
elementFormDefault="qualified"
xmlns="path_to_url"
xmlns:mstns="path_to_url"
xmlns:xs="path_to_url"
>
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
Xml
</xs:documentation>
</xs:annotation>
<xs:element name="Tables" type="TablesType"></xs:element>
<xs:complexType name="TablesType">
<xs:sequence>
<xs:element name="Table" type="TableType" maxOccurs="unbounded" ></xs:element>
</xs:sequence>
<xs:attribute name="NameSpace" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="ConnName" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Output" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="BaseClass" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="ChineseFileName" type="BooleanType">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="ModelClass" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
{name}Model
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="ModelInterface" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
{name}Model
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="NameFormat" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
Default/Upper/Lower/Underline
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Version" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
XCode
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Document" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<!--Table-start-->
<xs:complexType name="TableType">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
Table
</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="Columns" type="ColumnsType">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
/
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="Indexes" type="IndexesType" minOccurs="0">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
<xs:attribute name="Name" type="xs:string" use="required">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
TableNameTableName
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="TableName" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
Name
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="BaseType" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Owner" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="ConnName" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="DbType" type="DbTypeType">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="IsView" type="BooleanType">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="DisplayName" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
DescriptionDescriptionName
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Description" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="InsertOnly" type="BooleanType">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="ModelClass" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
{name}Model
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="ModelInterface" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
{name}Model
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<!--Table-end-->
<xs:simpleType name="DbTypeType">
<xs:annotation>
<xs:documentation>
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:enumeration value="Access" ></xs:enumeration>
<xs:enumeration value="SqlServer" ></xs:enumeration>
<xs:enumeration value="Oracle" ></xs:enumeration>
<xs:enumeration value="MySql" ></xs:enumeration>
<xs:enumeration value="SqlCe" ></xs:enumeration>
<xs:enumeration value="SQLite" ></xs:enumeration>
<xs:enumeration value="PostgreSQL" ></xs:enumeration>
<xs:enumeration value="DaMeng" ></xs:enumeration>
<xs:enumeration value="DB2" ></xs:enumeration>
<xs:enumeration value="TDengine" ></xs:enumeration>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="ColumnsType">
<xs:sequence>
<xs:element name="Column" type="ColumnType" maxOccurs="unbounded"></xs:element>
</xs:sequence>
</xs:complexType>
<!--Column-start-->
<xs:complexType name="ColumnType">
<xs:attribute name="Name" type="xs:string">
<xs:annotation>
<xs:documentation>
ColumnName
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="ColumnName" type="xs:string">
<xs:annotation>
<xs:documentation>
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="DataType" type="DataTypeType">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
C#
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="RawType" type="xs:string">
<xs:annotation>
<xs:documentation>
RawType
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Identity" type="BooleanType">
<xs:annotation>
<xs:documentation>
Id
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="PrimaryKey" type="BooleanType">
<xs:annotation>
<xs:documentation>
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Master" type="xs:string">
<xs:annotation>
<xs:documentation>
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Length" type="xs:int">
<xs:annotation>
<xs:documentation>
-1
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Precision" type="xs:int">
<xs:annotation>
<xs:documentation>
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Scale" type="xs:int">
<xs:annotation>
<xs:documentation>
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Nullable" type="BooleanType">
<xs:annotation>
<xs:documentation>
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="DisplayName" type="xs:string">
<xs:annotation>
<xs:documentation>
DescriptionDescriptionName
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Description" type="xs:string">
<xs:annotation>
<xs:documentation>
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Type" type="xs:string">
<xs:annotation>
<xs:documentation>
+
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Attribute" type="xs:string">
<xs:annotation>
<xs:documentation>
XmlIgnore,ScriptIgnore,IgnoreDataMember{name}
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="ItemType" type="ItemTypeType">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Model" type="BooleanType">
<xs:annotation>
<xs:documentation>
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<!--Column-end-->
<!--BooleanType-start-->
<xs:simpleType name="BooleanType">
<xs:restriction base="xs:string">
<xs:enumeration value="True" ></xs:enumeration>
<xs:enumeration value="False" ></xs:enumeration>
</xs:restriction>
</xs:simpleType>
<!--BooleanType-end-->
<!--DataType-start-->
<xs:simpleType name="DataTypeType">
<xs:restriction base="xs:string">
<xs:enumeration value="Boolean" ></xs:enumeration>
<xs:enumeration value="SByte" ></xs:enumeration>
<xs:enumeration value="Byte" ></xs:enumeration>
<xs:enumeration value="Int16" ></xs:enumeration>
<xs:enumeration value="UInt16" ></xs:enumeration>
<xs:enumeration value="UInt16" ></xs:enumeration>
<xs:enumeration value="Int32" ></xs:enumeration>
<xs:enumeration value="UInt32" ></xs:enumeration>
<xs:enumeration value="Int64" ></xs:enumeration>
<xs:enumeration value="UInt64" ></xs:enumeration>
<xs:enumeration value="Single" ></xs:enumeration>
<xs:enumeration value="Double" ></xs:enumeration>
<xs:enumeration value="Decimal" ></xs:enumeration>
<xs:enumeration value="DateTime" ></xs:enumeration>
<xs:enumeration value="String" ></xs:enumeration>
<xs:enumeration value="Byte[]" ></xs:enumeration>
</xs:restriction>
</xs:simpleType>
<!--DataType-end-->
<!--ItemType-start-->
<xs:simpleType name="ItemTypeType">
<xs:restriction base="xs:string">
<xs:enumeration value="image" ></xs:enumeration>
<xs:enumeration value="file" ></xs:enumeration>
<xs:enumeration value="html" ></xs:enumeration>
<xs:enumeration value="mail" ></xs:enumeration>
<xs:enumeration value="mobile" ></xs:enumeration>
<xs:enumeration value="phone" ></xs:enumeration>
<xs:enumeration value="url" ></xs:enumeration>
</xs:restriction>
</xs:simpleType>
<!--ItemType-end-->
<xs:complexType name="IndexesType">
<xs:sequence>
<xs:element name="Index" type="IndexType" maxOccurs="unbounded"></xs:element>
</xs:sequence>
</xs:complexType>
<!--Index-start-->
<xs:complexType name="IndexType">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
</xs:documentation>
</xs:annotation>
<xs:attribute name="Name">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Columns" use="required">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
ID,Name
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Unique" type="BooleanType">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="PrimaryKey" type="BooleanType">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<!--Index-end-->
</xs:schema>
``` | /content/code_sandbox/XCode/ModelSchema.xsd | xml | 2016-06-22T14:26:52 | 2024-08-16T04:07:33 | X | NewLifeX/X | 1,746 | 3,495 |
```xml
=== basic hash
# This is just a simple one key hash.
--- yaml
a: b
--- json
{"a":"b"}
=== double quoted keys
# Hash with quoted key with embedded newline
--- yaml
"a\nb": c
--- json
{"a\nb":"c"}
# --- dump
# "a\nb": c
=== basic array
# This is just a simple one key hash.
--- yaml
- a
-b
--- json
["a","b"]
``` | /content/code_sandbox/gnu/usr.bin/perl/cpan/CPAN-Meta-YAML/t/tml-spec/basic-data.tml | xml | 2016-08-30T18:18:25 | 2024-08-16T17:21:09 | src | openbsd/src | 3,139 | 105 |
```xml
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.*?>
<?import java.net.*?>
<?import javafx.scene.image.*?>
<?import javafx.scene.shape.*?>
<?import javafx.scene.effect.*?>
<?import javafx.scene.text.*?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import java.lang.*?>
<?import javafx.scene.layout.*?>
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="500.0" minWidth="600.0" styleClass="setting_view" xmlns="path_to_url" xmlns:fx="path_to_url" fx:controller="com.linchaolong.apktoolplus.module.settings.SettingsActivity">
<children>
<AnchorPane prefHeight="42.0" prefWidth="650.0" styleClass="top_pane" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<Button fx:id="btnClose" layoutX="570.0" layoutY="5.0" mnemonicParsing="false" onAction="#close" prefHeight="32.0" prefWidth="40.0" styleClass="button_close" stylesheets="@../../../../../css/settings.css" AnchorPane.bottomAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
<HBox AnchorPane.leftAnchor="8.0" AnchorPane.topAnchor="6.0">
<children>
<ImageView fitHeight="50.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../../../../../res/white_icon/white_icon_Engine.png" />
</image>
</ImageView>
<Text fill="WHITE" layoutX="342.0" layoutY="30.0" strokeType="OUTSIDE" strokeWidth="0.0" text="" AnchorPane.leftAnchor="15.0" AnchorPane.topAnchor="8.0">
<font>
<Font name="Arial" size="22.0" />
</font>
<effect>
<DropShadow color="WHITE" />
</effect>
<HBox.margin>
<Insets left="5.0" top="2.0" />
</HBox.margin>
</Text>
</children>
</HBox>
</children>
</AnchorPane>
<AnchorPane fx:id="paneItems" prefHeight="200.0" prefWidth="150.0" style="-fx-background-color: #ECECEC;" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="42.0">
<children>
<VBox fx:id="boxItems">
<children>
<ToggleButton mnemonicParsing="false" styleClass="button_item" text="" />
<ToggleButton layoutX="10.0" layoutY="10.0" mnemonicParsing="false" styleClass="button_item" text="ApkTool" />
<ToggleButton mnemonicParsing="false" styleClass="button_item" text="" />
</children>
</VBox>
</children>
</AnchorPane>
<AnchorPane fx:id="paneContent" prefHeight="200.0" prefWidth="200.0" AnchorPane.bottomAnchor="35.0" AnchorPane.leftAnchor="150.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="42.0" />
<Text fx:id="textVersion" fill="#43b1e0" strokeType="OUTSIDE" strokeWidth="0.0" text="Version:1.0" AnchorPane.bottomAnchor="10.0" AnchorPane.rightAnchor="10.0">
<font>
<Font size="15.0" />
</font>
</Text>
</children>
<stylesheets>
<URL value="@../../../../../css/settings.css" />
</stylesheets>
</AnchorPane>
``` | /content/code_sandbox/app/src/com/linchaolong/apktoolplus/module/settings/settings.fxml | xml | 2016-04-18T17:52:39 | 2024-08-16T07:10:35 | ApkToolPlus | CYRUS-STUDIO/ApkToolPlus | 1,196 | 846 |
```xml
<?xml version="1.0" encoding="utf-8"?>
<!--
~
~
~ Permission is hereby granted, free of charge, to any person obtaining a copy
~ of this software and associated documentation files (the "Software"), to deal
~ in the Software without restriction, including without limitation the rights
~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
~ copies of the Software, and to permit persons to whom the Software is
~ furnished to do so, subject to the following conditions:
~
~ The above copyright notice and this permission notice shall be included in all
~ copies or substantial portions of the Software.
~
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
~ SOFTWARE.
-->
<LinearLayout xmlns:android="path_to_url"
xmlns:tools="path_to_url"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".FirstAnimGlideActivity">
<TextView
android:id="@+id/firstHeader"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:textAlignment="center"
android:textColor="@android:color/black"
android:textSize="21sp"
android:textStyle="bold"
android:text="@string/header_first_activity"
/>
<RadioGroup
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RadioButton
android:id="@+id/use_glide"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:text="@string/radio_use_glide"
android:checked="true"
/>
<RadioButton
android:id="@+id/use_fresco"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:text="@string/radio_use_fresco"
/>
</RadioGroup>
<CheckBox
android:id="@+id/check_use_view_factory"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:text="@string/check_use_view_factory"
/>
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/thumbView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:transitionName="@string/transition_name"
android:adjustViewBounds="true"
android:scaleType="fitStart"
android:contentDescription="@string/content_desc_thumb" />
</LinearLayout>
``` | /content/code_sandbox/app/src/main/res/layout/activity_anim_first_fresco.xml | xml | 2016-11-06T09:55:02 | 2024-08-16T07:33:57 | BigImageViewer | Piasy/BigImageViewer | 3,973 | 696 |
```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 { codec } from '@liskhq/lisk-codec';
import { utils, ed, bls, encrypt, address } from '@liskhq/lisk-cryptography';
import { InMemoryDatabase, Database } from '@liskhq/lisk-db';
import { dataStructures } from '@liskhq/lisk-utils';
import { LiskValidationError } from '@liskhq/lisk-validator';
import { Chain } from '@liskhq/lisk-chain';
import { when } from 'jest-when';
import { ABI, TransactionVerifyResult } from '../../../../src/abi';
import { Logger } from '../../../../src/logger';
import {
GENERATOR_STORE_INFO_PREFIX,
GENERATOR_STORE_KEY_PREFIX,
} from '../../../../src/engine/generator/constants';
import { PlainGeneratorKeyData, Consensus, Keypair } from '../../../../src/engine/generator/types';
import { Endpoint } from '../../../../src/engine/generator/endpoint';
import {
encryptedMessageSchema,
generatorKeysSchema,
plainGeneratorKeysSchema,
previouslyGeneratedInfoSchema,
} from '../../../../src/engine/generator/schemas';
import { fakeLogger } from '../../../utils/mocks';
import { SingleCommitHandler } from '../../../../src/engine/generator/single_commit_handler';
describe('generator endpoint', () => {
const logger: Logger = fakeLogger;
const defaultPassword = 'elephant tree paris dragon chair galaxy';
const chainID = Buffer.alloc(0);
const blockTime = 10;
let defaultKeys: PlainGeneratorKeyData;
let defaultEncryptedKeys: {
address: Buffer;
type: 'encrypted';
data: encrypt.EncryptedMessageObject;
};
let endpoint: Endpoint;
let consensus: Consensus;
let abi: ABI;
let chain: Chain;
let db: Database;
beforeEach(async () => {
const generatorPrivateKey = await ed.getPrivateKeyFromPhraseAndPath(
'passphrase',
"m/25519'/134'/0'/0'",
);
const blsPrivateKey = await bls.getPrivateKeyFromPhraseAndPath('passphrase', 'm/12381/134/0/0');
defaultKeys = {
generatorKey: ed.getPublicKeyFromPrivateKey(generatorPrivateKey),
generatorPrivateKey,
blsPrivateKey,
blsKey: bls.getPublicKeyFromPrivateKey(blsPrivateKey),
};
defaultEncryptedKeys = {
address: Buffer.from('9cabee3d27426676b852ce6b804cb2fdff7cd0b5', 'hex'),
type: 'encrypted',
data: await encrypt.encryptAES128GCMWithPassword(
codec.encode(plainGeneratorKeysSchema, defaultKeys),
defaultPassword,
{
kdfparams: {
memorySize: 2048,
},
},
),
};
consensus = {
isSynced: jest.fn().mockResolvedValue(true),
finalizedHeight: jest.fn().mockReturnValue(0),
} as never;
abi = {
verifyTransaction: jest.fn().mockResolvedValue({ result: TransactionVerifyResult.OK }),
} as never;
chain = {
dataAccess: {
getBlockHeaderByHeight: jest.fn(),
},
} as never;
endpoint = new Endpoint({
abi,
consensus,
keypair: new dataStructures.BufferMap<Keypair>(),
blockTime,
chain,
});
db = new InMemoryDatabase() as never;
endpoint.init({
generatorDB: db,
genesisHeight: 0,
singleCommitHandler: {
initSingleCommits: jest.fn(),
} as unknown as SingleCommitHandler,
});
});
describe('updateStatus', () => {
const bftProps = {
height: 200,
maxHeightPrevoted: 200,
maxHeightGenerated: 10,
};
beforeEach(async () => {
const encodedData = codec.encode(encryptedMessageSchema, defaultEncryptedKeys.data);
await db.set(
Buffer.concat([GENERATOR_STORE_KEY_PREFIX, defaultEncryptedKeys.address]),
codec.encode(generatorKeysSchema, {
type: defaultEncryptedKeys.type,
data: encodedData,
}),
);
await db.set(
Buffer.concat([GENERATOR_STORE_INFO_PREFIX, defaultEncryptedKeys.address]),
codec.encode(previouslyGeneratedInfoSchema, bftProps),
);
});
it('should reject with error when request schema is invalid', async () => {
await expect(
endpoint.updateStatus({
logger,
params: {
enable: true,
password: defaultPassword,
...bftProps,
},
chainID,
}),
).rejects.toThrow(LiskValidationError);
});
it('should reject with error when address is not in config', async () => {
await expect(
endpoint.updateStatus({
logger,
params: {
address: address.getLisk32AddressFromAddress(utils.getRandomBytes(20)),
enable: true,
password: defaultPassword,
...bftProps,
},
chainID,
}),
).rejects.toThrow('Generator with address:');
});
it('should return error with invalid password', async () => {
await expect(
endpoint.updateStatus({
logger,
params: {
address: address.getLisk32AddressFromAddress(defaultEncryptedKeys.address),
enable: true,
password: 'wrong password',
...bftProps,
},
chainID,
}),
).rejects.toThrow('Unsupported state or unable to authenticate data');
});
it('should return error if the engine is not synced', async () => {
(consensus.isSynced as jest.Mock).mockReturnValue(false);
await expect(
endpoint.updateStatus({
logger,
params: {
address: address.getLisk32AddressFromAddress(defaultEncryptedKeys.address),
enable: true,
password: defaultPassword,
...bftProps,
},
chainID,
}),
).rejects.toThrow('Failed to enable forging as the node is not synced to the network.');
});
it('should delete the keypair if disabling', async () => {
endpoint['_keypairs'].set(defaultEncryptedKeys.address, {
publicKey: Buffer.alloc(0),
privateKey: Buffer.alloc(0),
blsPublicKey: Buffer.alloc(0),
blsSecretKey: Buffer.alloc(0),
});
await expect(
endpoint.updateStatus({
logger,
params: {
address: address.getLisk32AddressFromAddress(defaultEncryptedKeys.address),
enable: false,
password: defaultPassword,
...bftProps,
},
chainID,
}),
).resolves.toEqual({
address: address.getLisk32AddressFromAddress(defaultEncryptedKeys.address),
enabled: false,
});
expect(endpoint['_keypairs'].has(defaultEncryptedKeys.address)).toBeFalse();
});
it('should update the keypair and return enabled', async () => {
await expect(
endpoint.updateStatus({
logger,
params: {
address: address.getLisk32AddressFromAddress(defaultEncryptedKeys.address),
enable: true,
password: defaultPassword,
...bftProps,
},
chainID,
}),
).resolves.toEqual({
address: address.getLisk32AddressFromAddress(defaultEncryptedKeys.address),
enabled: true,
});
expect(endpoint['_keypairs'].has(defaultEncryptedKeys.address)).toBeTrue();
});
it('should create single commits for the address', async () => {
await expect(
endpoint.updateStatus({
logger,
params: {
address: address.getLisk32AddressFromAddress(defaultEncryptedKeys.address),
enable: true,
password: defaultPassword,
...bftProps,
},
chainID,
}),
).resolves.toEqual({
address: address.getLisk32AddressFromAddress(defaultEncryptedKeys.address),
enabled: true,
});
expect(endpoint['_singleCommitHandler'].initSingleCommits).toHaveBeenCalledWith(
defaultEncryptedKeys.address,
);
});
it('should accept if BFT properties specified are zero and there is no previous values', async () => {
await db.del(Buffer.concat([GENERATOR_STORE_INFO_PREFIX, defaultEncryptedKeys.address]));
await expect(
endpoint.updateStatus({
logger,
params: {
address: address.getLisk32AddressFromAddress(defaultEncryptedKeys.address),
enable: true,
password: defaultPassword,
height: 0,
maxHeightPrevoted: 0,
maxHeightGenerated: 0,
},
chainID,
}),
).resolves.toEqual({
address: address.getLisk32AddressFromAddress(defaultEncryptedKeys.address),
enabled: true,
});
});
it('should reject if BFT properties specified are non-zero and there is no previous values', async () => {
await db.del(Buffer.concat([GENERATOR_STORE_INFO_PREFIX, defaultEncryptedKeys.address]));
await expect(
endpoint.updateStatus({
logger,
params: {
address: address.getLisk32AddressFromAddress(defaultEncryptedKeys.address),
enable: true,
password: defaultPassword,
height: 100,
maxHeightPrevoted: 40,
maxHeightGenerated: 3,
},
chainID,
}),
).rejects.toThrow('Last generated information does not exist.');
});
it('should reject if BFT properties specified are zero and there is non zero previous values', async () => {
const encodedInfo = codec.encode(previouslyGeneratedInfoSchema, {
height: 100,
maxHeightPrevoted: 40,
maxHeightGenerated: 3,
});
await db.set(
Buffer.concat([GENERATOR_STORE_INFO_PREFIX, defaultEncryptedKeys.address]),
encodedInfo,
);
await expect(
endpoint.updateStatus({
logger,
params: {
address: address.getLisk32AddressFromAddress(defaultEncryptedKeys.address),
enable: true,
password: defaultPassword,
height: 0,
maxHeightPrevoted: 0,
maxHeightGenerated: 0,
},
chainID,
}),
).rejects.toThrow('Request does not match last generated information.');
});
it('should reject if BFT properties specified specified does not match existing properties', async () => {
const encodedInfo = codec.encode(previouslyGeneratedInfoSchema, {
height: 50,
maxHeightPrevoted: 40,
maxHeightGenerated: 3,
});
await db.set(
Buffer.concat([GENERATOR_STORE_INFO_PREFIX, defaultEncryptedKeys.address]),
encodedInfo,
);
await expect(
endpoint.updateStatus({
logger,
params: {
address: address.getLisk32AddressFromAddress(defaultEncryptedKeys.address),
enable: true,
password: defaultPassword,
height: 100,
maxHeightPrevoted: 40,
maxHeightGenerated: 3,
},
chainID,
}),
).rejects.toThrow('Request does not match last generated information.');
});
});
describe('setStatus', () => {
beforeEach(async () => {
const encodedData = codec.encode(encryptedMessageSchema, defaultEncryptedKeys.data);
await db.set(
Buffer.concat([GENERATOR_STORE_KEY_PREFIX, defaultEncryptedKeys.address]),
codec.encode(generatorKeysSchema, {
type: defaultEncryptedKeys.type,
data: encodedData,
}),
);
});
it('should reject with error if the input is invalid', async () => {
await expect(
endpoint.setStatus({
logger,
params: {
address: address.getLisk32AddressFromAddress(defaultEncryptedKeys.address),
height: -1,
maxHeightPrevoted: 40,
maxHeightGenerated: 3,
},
chainID,
}),
).rejects.toThrow('Lisk validator found 1 error');
});
it('should resolve and store the given input when input is valid', async () => {
await expect(
endpoint.setStatus({
logger,
params: {
address: address.getLisk32AddressFromAddress(defaultEncryptedKeys.address),
height: 33,
maxHeightPrevoted: 40,
maxHeightGenerated: 3,
},
chainID,
}),
).resolves.toBeUndefined();
await expect(
db.has(Buffer.concat([GENERATOR_STORE_INFO_PREFIX, defaultEncryptedKeys.address])),
).resolves.toBeTrue();
});
});
describe('getStatus', () => {
beforeEach(async () => {
const encodedInfo = codec.encode(previouslyGeneratedInfoSchema, {
height: 50,
maxHeightPrevoted: 40,
maxHeightGenerated: 3,
});
await db.set(
Buffer.concat([GENERATOR_STORE_INFO_PREFIX, defaultEncryptedKeys.address]),
encodedInfo,
);
const randomEncodedInfo = codec.encode(previouslyGeneratedInfoSchema, {
height: 50,
maxHeightPrevoted: 44,
maxHeightGenerated: 3,
});
await db.set(
Buffer.concat([GENERATOR_STORE_INFO_PREFIX, utils.getRandomBytes(20)]),
randomEncodedInfo,
);
});
it('should resolve all the status', async () => {
const resp = await endpoint.getStatus({
logger,
params: {},
chainID,
});
expect(resp.status).toHaveLength(2);
expect(resp.status[0].address).not.toBeInstanceOf(Buffer);
expect(resp.status[0].blsKey).toBeString();
expect(resp.status[0].generatorKey).toBeString();
});
});
describe('estimateSafeStatus', () => {
const finalizedBlock = {
height: 300000,
timestamp: 1659679220,
};
const blockPerMonth = (60 * 60 * 24 * 30) / blockTime;
beforeEach(() => {
jest.spyOn(consensus, 'finalizedHeight').mockReturnValue(finalizedBlock.height);
});
it('should reject when timeshutDown is not provided', async () => {
await expect(
endpoint.estimateSafeStatus({
logger,
params: {},
chainID,
}),
).rejects.toThrow('Lisk validator found');
});
it('should fail if the timeShutdown is not finalized', async () => {
when(chain.dataAccess.getBlockHeaderByHeight as jest.Mock)
.calledWith(finalizedBlock.height)
.mockResolvedValue(finalizedBlock);
const now = Math.floor(Date.now() / 1000);
await expect(
endpoint.estimateSafeStatus({
logger,
params: {
timeShutdown: now,
},
chainID,
}),
).rejects.toThrow(`A block at the time shutdown ${now} must be finalized.`);
});
it('should resolve the finalized height when there is no missed block in past month', async () => {
when(chain.dataAccess.getBlockHeaderByHeight as jest.Mock)
.calledWith(finalizedBlock.height)
.mockResolvedValue(finalizedBlock)
.calledWith(finalizedBlock.height - blockPerMonth)
.mockResolvedValue({
height: finalizedBlock.height - blockPerMonth,
timestamp: finalizedBlock.timestamp - blockTime * blockPerMonth,
});
await expect(
endpoint.estimateSafeStatus({
logger,
params: {
timeShutdown: finalizedBlock.timestamp - 100000,
},
chainID,
}),
).resolves.toEqual({
height: finalizedBlock.height,
maxHeightGenerated: finalizedBlock.height,
maxHeightPrevoted: finalizedBlock.height,
});
});
it('should resolve the finalized height + missed block when there is missed block in past month', async () => {
const missedBlocks = 50;
when(chain.dataAccess.getBlockHeaderByHeight as jest.Mock)
.calledWith(finalizedBlock.height)
.mockResolvedValue(finalizedBlock)
.calledWith(finalizedBlock.height - blockPerMonth)
// missed 50 blocks
.mockResolvedValue({
height: finalizedBlock.height - blockPerMonth,
timestamp:
finalizedBlock.timestamp - blockTime * blockPerMonth - blockTime * missedBlocks,
});
await expect(
endpoint.estimateSafeStatus({
logger,
params: {
timeShutdown: finalizedBlock.timestamp - 100000,
},
chainID,
}),
).resolves.toEqual({
height: finalizedBlock.height + missedBlocks,
maxHeightGenerated: finalizedBlock.height + missedBlocks,
maxHeightPrevoted: finalizedBlock.height + missedBlocks,
});
});
});
describe('setKeys', () => {
it('should reject if input is invalid', async () => {
await expect(
endpoint.setKeys({
logger,
params: {
address: address.getLisk32AddressFromAddress(defaultEncryptedKeys.address),
type: 'plain',
data: {
version: '1',
ciphertext:
your_sha256_hashyour_sha256_hasha348fc1f013ceb5d8bb314',
mac: your_sha256_hash,
kdf: 'argon2id',
kdfparams: {
parallelism: 4,
iterations: 1,
memorySize: 2024,
salt: 'e9f564ce7f8392acb2691fb4953e17c0',
},
cipher: 'aes-128-gcm',
cipherparams: {},
},
},
chainID,
}),
).rejects.toThrow('Lisk validator found');
});
it('should resolve and save input value', async () => {
const val = {
version: '1',
ciphertext:
your_sha256_hashyour_sha256_hasha348fc1f013ceb5d8bb314',
mac: your_sha256_hash,
kdf: 'argon2id',
kdfparams: {
parallelism: 4,
iterations: 1,
memorySize: 2024,
salt: 'e9f564ce7f8392acb2691fb4953e17c0',
},
cipher: 'aes-128-gcm',
cipherparams: {
iv: '57124bb910dbf9e24e37d401',
tag: 'b769dcbd4ad0d3f44041afe5322aad82',
},
};
await expect(
endpoint.setKeys({
logger,
params: {
address: address.getLisk32AddressFromAddress(defaultEncryptedKeys.address),
type: 'encrypted',
data: val,
},
chainID,
}),
).resolves.toBeUndefined();
await expect(
db.has(Buffer.concat([GENERATOR_STORE_KEY_PREFIX, defaultEncryptedKeys.address])),
).resolves.toBeTrue();
});
it('should delete in-memory keypairs when new keys are set', async () => {
endpoint['_keypairs'].set(defaultEncryptedKeys.address, {
blsPublicKey: Buffer.alloc(0),
blsSecretKey: Buffer.alloc(0),
privateKey: Buffer.alloc(0),
publicKey: Buffer.alloc(0),
});
await expect(
endpoint.setKeys({
logger,
params: {
address: address.getLisk32AddressFromAddress(defaultEncryptedKeys.address),
type: 'encrypted',
data: defaultEncryptedKeys.data,
},
chainID,
}),
).resolves.toBeUndefined();
expect(endpoint['_keypairs'].has(defaultEncryptedKeys.address)).toBeFalse();
});
});
describe('getAllKeys', () => {
beforeEach(async () => {
await endpoint.setKeys({
logger,
params: {
address: address.getLisk32AddressFromAddress(defaultEncryptedKeys.address),
type: 'encrypted',
data: {
version: '1',
ciphertext:
your_sha256_hashyour_sha256_hasha348fc1f013ceb5d8bb314',
mac: your_sha256_hash,
kdf: 'argon2id',
kdfparams: {
parallelism: 4,
iterations: 1,
memorySize: 2024,
salt: 'e9f564ce7f8392acb2691fb4953e17c0',
},
cipher: 'aes-128-gcm',
cipherparams: {
iv: '57124bb910dbf9e24e37d401',
tag: 'b769dcbd4ad0d3f44041afe5322aad82',
},
},
},
chainID,
});
await endpoint.setKeys({
logger,
params: {
address: address.getLisk32AddressFromAddress(utils.getRandomBytes(20)),
type: 'plain',
data: {
generatorKey: defaultKeys.generatorKey.toString('hex'),
generatorPrivateKey: defaultKeys.generatorPrivateKey.toString('hex'),
blsPrivateKey: defaultKeys.blsPrivateKey.toString('hex'),
blsKey: defaultKeys.blsKey.toString('hex'),
},
},
chainID,
});
});
it('should resolve all keys registered', async () => {
const result = await endpoint.getAllKeys({
logger,
params: {},
chainID,
});
expect(result.keys).toHaveLength(2);
});
});
describe('hasKeys', () => {
beforeEach(async () => {
await endpoint.setKeys({
logger,
params: {
address: address.getLisk32AddressFromAddress(defaultEncryptedKeys.address),
type: 'encrypted',
data: {
version: '1',
ciphertext:
your_sha256_hashyour_sha256_hasha348fc1f013ceb5d8bb314',
mac: your_sha256_hash,
kdf: 'argon2id',
kdfparams: {
parallelism: 4,
iterations: 1,
memorySize: 2024,
salt: 'e9f564ce7f8392acb2691fb4953e17c0',
},
cipher: 'aes-128-gcm',
cipherparams: {
iv: '57124bb910dbf9e24e37d401',
tag: 'b769dcbd4ad0d3f44041afe5322aad82',
},
},
},
chainID,
});
});
it('should fail if address does not exist in input', async () => {
await expect(
endpoint.hasKeys({
logger,
params: {},
chainID,
}),
).rejects.toThrow('Lisk validator found 1 error');
});
it('should resolve true if key exist', async () => {
await expect(
endpoint.hasKeys({
logger,
params: {
address: address.getLisk32AddressFromAddress(defaultEncryptedKeys.address),
},
chainID,
}),
).resolves.toEqual({ hasKey: true });
});
it('should resolve false if key does not exist', async () => {
await expect(
endpoint.hasKeys({
logger,
params: {
address: address.getLisk32AddressFromAddress(utils.getRandomBytes(20)),
},
chainID,
}),
).resolves.toEqual({ hasKey: false });
});
});
});
``` | /content/code_sandbox/framework/test/unit/engine/generator/endpoint.spec.ts | xml | 2016-02-01T21:45:35 | 2024-08-15T19:16:48 | lisk-sdk | LiskArchive/lisk-sdk | 2,721 | 5,348 |
```xml
import * as React from 'react';
import {
makeStyles,
Menu,
MenuItem,
MenuList,
MenuPopover,
MenuTrigger,
SplitButton,
} from '@fluentui/react-components';
import type { MenuButtonProps } from '@fluentui/react-components';
const useStyles = makeStyles({
wrapper: {
columnGap: '15px',
display: 'flex',
minWidth: 'min-content',
},
});
export const Disabled = () => {
const styles = useStyles();
return (
<div className={styles.wrapper}>
<Menu positioning="below-end">
<MenuTrigger disableButtonEnhancement>
{(triggerProps: MenuButtonProps) => <SplitButton menuButton={triggerProps}>Enabled state</SplitButton>}
</MenuTrigger>
<MenuPopover>
<MenuList>
<MenuItem>Item a</MenuItem>
<MenuItem>Item b</MenuItem>
</MenuList>
</MenuPopover>
</Menu>
<Menu positioning="below-end">
<MenuTrigger disableButtonEnhancement>
{(triggerProps: MenuButtonProps) => (
<SplitButton menuButton={triggerProps} disabled>
Disabled state
</SplitButton>
)}
</MenuTrigger>
<MenuPopover>
<MenuList>
<MenuItem>Item a</MenuItem>
<MenuItem>Item b</MenuItem>
</MenuList>
</MenuPopover>
</Menu>
<Menu positioning="below-end">
<MenuTrigger disableButtonEnhancement>
{(triggerProps: MenuButtonProps) => (
<SplitButton menuButton={triggerProps} disabledFocusable>
Disabled focusable state
</SplitButton>
)}
</MenuTrigger>
<MenuPopover>
<MenuList>
<MenuItem>Item a</MenuItem>
<MenuItem>Item b</MenuItem>
</MenuList>
</MenuPopover>
</Menu>
</div>
);
};
Disabled.parameters = {
docs: {
description: {
story: `A split button can be \`disabled\` or \`disabledFocusable\`.
\`disabledFocusable\` is used in scenarios where it is important to keep a consistent tab order
for screen reader and keyboard users. The primary example of this pattern is when
the disabled split button is in a menu or a commandbar and is seldom used for standalone buttons.`,
},
},
};
``` | /content/code_sandbox/packages/react-components/react-button/stories/src/SplitButton/SplitButtonDisabled.stories.tsx | xml | 2016-06-06T15:03:44 | 2024-08-16T18:49:29 | fluentui | microsoft/fluentui | 18,221 | 510 |
```xml
import { Component, ViewChild, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { AlertController, IonList, IonRouterOutlet, LoadingController, ModalController, ToastController, Config } from '@ionic/angular';
import { ScheduleFilterPage } from '../schedule-filter/schedule-filter';
import { ConferenceData } from '../../providers/conference-data';
import { UserData } from '../../providers/user-data';
@Component({
selector: 'page-schedule',
templateUrl: 'schedule.html',
styleUrls: ['./schedule.scss'],
})
export class SchedulePage implements OnInit {
// Gets a reference to the list element
@ViewChild('scheduleList', { static: true }) scheduleList: IonList;
ios: boolean;
dayIndex = 0;
queryText = '';
segment = 'all';
excludeTracks: any = [];
shownSessions: any = [];
groups: any = [];
confDate: string;
showSearchbar: boolean;
constructor(
public alertCtrl: AlertController,
public confData: ConferenceData,
public loadingCtrl: LoadingController,
public modalCtrl: ModalController,
public router: Router,
public routerOutlet: IonRouterOutlet,
public toastCtrl: ToastController,
public user: UserData,
public config: Config
) { }
ngOnInit() {
this.updateSchedule();
this.ios = this.config.get('mode') === 'ios';
}
updateSchedule() {
// Close any open sliding items when the schedule updates
if (this.scheduleList) {
this.scheduleList.closeSlidingItems();
}
this.confData.getTimeline(this.dayIndex, this.queryText, this.excludeTracks, this.segment).subscribe((data: any) => {
this.shownSessions = data.shownSessions;
this.groups = data.groups;
});
}
async presentFilter() {
const modal = await this.modalCtrl.create({
component: ScheduleFilterPage,
swipeToClose: true,
presentingElement: this.routerOutlet.nativeEl,
componentProps: { excludedTracks: this.excludeTracks }
});
await modal.present();
const { data } = await modal.onWillDismiss();
if (data) {
this.excludeTracks = data;
this.updateSchedule();
}
}
async addFavorite(slidingItem: HTMLIonItemSlidingElement, sessionData: any) {
if (this.user.hasFavorite(sessionData.name)) {
// Prompt to remove favorite
this.removeFavorite(slidingItem, sessionData, 'Favorite already added');
} else {
// Add as a favorite
this.user.addFavorite(sessionData.name);
// Close the open item
slidingItem.close();
// Create a toast
const toast = await this.toastCtrl.create({
header: `${sessionData.name} was successfully added as a favorite.`,
duration: 3000,
buttons: [{
text: 'Close',
role: 'cancel'
}]
});
// Present the toast at the bottom of the page
await toast.present();
}
}
async removeFavorite(slidingItem: HTMLIonItemSlidingElement, sessionData: any, title: string) {
const alert = await this.alertCtrl.create({
header: title,
message: 'Would you like to remove this session from your favorites?',
buttons: [
{
text: 'Cancel',
handler: () => {
// they clicked the cancel button, do not remove the session
// close the sliding item and hide the option buttons
slidingItem.close();
}
},
{
text: 'Remove',
handler: () => {
// they want to remove this session from their favorites
this.user.removeFavorite(sessionData.name);
this.updateSchedule();
// close the sliding item and hide the option buttons
slidingItem.close();
}
}
]
});
// now present the alert on top of all other content
await alert.present();
}
async openSocial(network: string, fab: HTMLIonFabElement) {
const loading = await this.loadingCtrl.create({
message: `Posting to ${network}`,
duration: (Math.random() * 1000) + 500
});
await loading.present();
await loading.onWillDismiss();
fab.close();
}
}
``` | /content/code_sandbox/examples/ionic-angular/src/app/pages/schedule/schedule.ts | xml | 2016-09-09T01:12:08 | 2024-08-16T17:39:45 | vercel | vercel/vercel | 12,545 | 915 |
```xml
import {test, expect} from 'vitest';
import parse from '@commitlint/parse';
import {trailerExists} from './trailer-exists.js';
const messages = {
empty: 'test:\n',
with: `test: subject\n\nbody\n\nfooter\n\nSigned-off-by:\n\n`,
without: `test: subject\n\nbody\n\nfooter\n\n`,
inSubject: `test: subject Signed-off-by:\n\nbody\n\nfooter\n\n`,
inBody: `test: subject\n\nbody Signed-off-by:\n\nfooter\n\n`,
withSignoffAndNoise: `test: subject
message body
Arbitrary-trailer:
Signed-off-by:
Another-arbitrary-trailer:
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
`,
};
const parsed = {
empty: parse(messages.empty),
with: parse(messages.with),
without: parse(messages.without),
inSubject: parse(messages.inSubject),
inBody: parse(messages.inBody),
withSignoffAndNoise: parse(messages.withSignoffAndNoise),
};
test('empty against "always trailer-exists" should fail', async () => {
const [actual] = trailerExists(
await parsed.empty,
'always',
'Signed-off-by:'
);
const expected = false;
expect(actual).toEqual(expected);
});
test('empty against "never trailer-exists" should succeed', async () => {
const [actual] = trailerExists(await parsed.empty, 'never', 'Signed-off-by:');
const expected = true;
expect(actual).toEqual(expected);
});
test('with against "always trailer-exists" should succeed', async () => {
const [actual] = trailerExists(await parsed.with, 'always', 'Signed-off-by:');
const expected = true;
expect(actual).toEqual(expected);
});
test('with against "never trailer-exists" should fail', async () => {
const [actual] = trailerExists(await parsed.with, 'never', 'Signed-off-by:');
const expected = false;
expect(actual).toEqual(expected);
});
test('without against "always trailer-exists" should fail', async () => {
const [actual] = trailerExists(
await parsed.without,
'always',
'Signed-off-by:'
);
const expected = false;
expect(actual).toEqual(expected);
});
test('without against "never trailer-exists" should succeed', async () => {
const [actual] = trailerExists(
await parsed.without,
'never',
'Signed-off-by:'
);
const expected = true;
expect(actual).toEqual(expected);
});
test('comments and other trailers should be ignored', async () => {
const [actual] = trailerExists(
await parsed.withSignoffAndNoise,
'always',
'Signed-off-by:'
);
const expected = true;
expect(actual).toEqual(expected);
});
test('inSubject against "always trailer-exists" should fail', async () => {
const [actual] = trailerExists(
await parsed.inSubject,
'always',
'Signed-off-by:'
);
const expected = false;
expect(actual).toEqual(expected);
});
test('inSubject against "never trailer-exists" should succeed', async () => {
const [actual] = trailerExists(
await parsed.inSubject,
'never',
'Signed-off-by:'
);
const expected = true;
expect(actual).toEqual(expected);
});
test('inBody against "always trailer-exists" should fail', async () => {
const [actual] = trailerExists(
await parsed.inBody,
'always',
'Signed-off-by:'
);
const expected = false;
expect(actual).toEqual(expected);
});
test('inBody against "never trailer-exists" should succeed', async () => {
const [actual] = trailerExists(
await parsed.inBody,
'never',
'Signed-off-by:'
);
const expected = true;
expect(actual).toEqual(expected);
});
``` | /content/code_sandbox/@commitlint/rules/src/trailer-exists.test.ts | xml | 2016-02-12T08:37:56 | 2024-08-16T13:28:33 | commitlint | conventional-changelog/commitlint | 16,499 | 843 |
```xml
import { ActivityHandler } from 'botbuilder';
export class EmptyBot extends ActivityHandler {
constructor() {
super();
this.onMembersAdded(async (context, next) => {
const membersAdded = context.activity.membersAdded;
for (const member of membersAdded) {
if (member.id !== context.activity.recipient.id) {
await context.sendActivity('Hello world!');
}
}
// By calling next() you ensure that the next BotHandler is run.
await next();
});
}
}
``` | /content/code_sandbox/samples/typescript_nodejs/00.empty-bot/src/bot.ts | xml | 2016-09-20T16:17:28 | 2024-08-16T02:44:00 | BotBuilder-Samples | microsoft/BotBuilder-Samples | 4,323 | 111 |
```xml
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0-windows10.0.18362.0</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<OutputType>Exe</OutputType>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<Platforms>AnyCPU;x64;x86</Platforms>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<RuntimeIdentifier></RuntimeIdentifier>
<OutputPath>..\..\bin\Debug\AnyCPU\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'">
<RuntimeIdentifier>win-x86</RuntimeIdentifier>
<OutputPath>..\..\bin\Debug\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<OutputPath>..\..\bin\Debug\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<RuntimeIdentifier></RuntimeIdentifier>
<OutputPath>..\..\bin\Release\AnyCPU\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x86'">
<RuntimeIdentifier>win-x86</RuntimeIdentifier>
<OutputPath>..\..\bin\Release\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<OutputPath>..\..\bin\Release\</OutputPath>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\GlobalAssemblyInfo.cs">
<Link>Properties\GlobalAssemblyInfo.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\KlocTools\KlocTools.csproj" />
</ItemGroup>
<ItemGroup>
<None Include="..\Licence.licenseheader">
<Link>Licence.licenseheader</Link>
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="System.ServiceProcess.ServiceController" Version="8.0.0" />
</ItemGroup>
<Import Project="..\HelperTools\HelperTools.projitems" Label="Shared" />
</Project>
``` | /content/code_sandbox/source/OculusHelper/OculusHelper.csproj | xml | 2016-08-01T15:17:05 | 2024-08-16T18:43:08 | Bulk-Crap-Uninstaller | Klocman/Bulk-Crap-Uninstaller | 10,756 | 586 |
```xml
import { Entity } from "../../../../../../src/decorator/entity/Entity"
import { PrimaryColumn } from "../../../../../../src/decorator/columns/PrimaryColumn"
import { Column } from "../../../../../../src/decorator/columns/Column"
@Entity()
export class Post {
@PrimaryColumn()
id: number
@Column()
name: string
// your_sha256_hash---------
// Numeric Types
// your_sha256_hash---------
@Column("number")
number: number
@Column("numeric")
numeric: number
@Column("float")
float: number
@Column("dec")
dec: number
@Column("decimal")
decimal: number
@Column("int")
int: number
@Column("integer")
integer: number
@Column("smallint")
smallint: number
@Column("real")
real: number
@Column("double precision")
doublePrecision: number
// your_sha256_hash---------
// Character Types
// your_sha256_hash---------
@Column("char")
char: string
@Column("nchar")
nchar: string
@Column("nvarchar2")
nvarchar2: string
@Column("varchar2")
varchar2: string
@Column("long")
long: string
@Column("raw")
raw: Buffer
// your_sha256_hash---------
// Date Types
// your_sha256_hash---------
@Column("date")
dateObj: Date
@Column("date")
date: string
@Column("timestamp")
timestamp: Date
@Column("timestamp with time zone")
timestampWithTimeZone: Date
@Column("timestamp with local time zone")
timestampWithLocalTimeZone: Date
// your_sha256_hash---------
// LOB Type
// your_sha256_hash---------
@Column("blob")
blob: Buffer
@Column("clob")
clob: string
@Column("nclob")
nclob: string
@Column("json")
json: any
// your_sha256_hash---------
// TypeOrm Specific Type
// your_sha256_hash---------
@Column("simple-array")
simpleArray: string[]
@Column("simple-json")
simpleJson: any
}
``` | /content/code_sandbox/test/functional/database-schema/column-types/oracle/entity/Post.ts | xml | 2016-02-29T07:41:14 | 2024-08-16T18:28:52 | typeorm | typeorm/typeorm | 33,875 | 504 |
```xml
import { Component } from '@angular/core';
import { Code } from 'src/app/showcase/domain/code';
@Component({
selector: 'normalize-doc',
template: `
<app-docsectiontext>
<p>Normalize is another utility to reset CSS of the standard elements. While importing the CSS file, assign it to a layer and define the layer order with primeNG coming after the normalized layer.</p>
<app-code [code]="code" selector="normalize-demo" [hideToggleCode]="true" [hideCodeSandbox]="true" [hideStackBlitz]="true"></app-code>
</app-docsectiontext>
`
})
export class NormalizeDoc {
code: Code = {
basic: `@layer normalize, primeng;
@import "normalize.css" layer(normalize-reset);`
};
}
``` | /content/code_sandbox/src/app/showcase/doc/guides/csslayer/normalizedoc.ts | xml | 2016-01-16T09:23:28 | 2024-08-16T19:58:20 | primeng | primefaces/primeng | 9,969 | 173 |
```xml
<fxlayout>
<page name="Solarize">
<control>maximum</control>
<control>peak_edge</control>
</page>
</fxlayout>
``` | /content/code_sandbox/stuff/profiles/layouts/fxs/STD_solarizeFx.xml | xml | 2016-03-18T17:55:48 | 2024-08-15T18:11:38 | opentoonz | opentoonz/opentoonz | 4,445 | 39 |
```xml
'use client'
import * as React from 'react'
import Form from 'next/form'
import { useRouter } from 'next/navigation'
export default function Home() {
const router = useRouter()
return (
<Form
action="/search"
id="search-form"
onSubmit={(e) => {
e.preventDefault()
// `preventDefault()` should stop <Form> from running its navigation logic.
// if it doesn't (which'd be a bug), <Form> would call a `router.push` after this,
// and the last push wins, so this would be ignored.
router.push('/redirected-from-action')
}}
>
<input name="query" />
<button type="submit">Submit</button>
</Form>
)
}
``` | /content/code_sandbox/test/e2e/app-dir/next-form/default/app/forms/with-onsubmit-preventdefault/page.tsx | xml | 2016-10-05T23:32:51 | 2024-08-16T19:44:30 | next.js | vercel/next.js | 124,056 | 165 |
```xml
<UserControl x:Class="Dopamine.Views.Common.UpdateStatus"
xmlns="path_to_url"
xmlns:d="path_to_url"
xmlns:x="path_to_url"
xmlns:mc="path_to_url"
xmlns:prismMvvm="clr-namespace:Prism.Mvvm;assembly=Prism.Wpf"
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300"
prismMvvm:ViewModelLocator.AutoWireViewModel="True">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Loaded">
<i:InvokeCommandAction Command="{Binding LoadedCommand}" />
</i:EventTrigger>
</i:Interaction.Triggers>
<Border DockPanel.Dock="Top" Height="0" Opacity="0">
<Border Background="{DynamicResource Brush_Accent}" Height="30">
<DockPanel VerticalAlignment="Center" Visibility="{Binding IsUpdateAvailable,Converter={StaticResource BooleanToVisibilityConverter}}">
<Button DockPanel.Dock="Left" Style="{StaticResource TransparentButton}" Height="18" VerticalAlignment="Center" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Cursor="Hand" ToolTip="{Binding UpdateToolTip}" Command="{Binding DownloadOrInstallUpdateCommand}">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<Grid Margin="15,0,10,0">
<!-- Download -->
<TextBlock Text="" Style="{StaticResource SegoeAssets}" Foreground="{DynamicResource Brush_StatustText}" FontSize="16" Visibility="{Binding ShowInstallUpdateButton,Converter={StaticResource InvertingBooleanToVisibilityConverter}}"/>
<!-- Install -->
<TextBlock Text="" Style="{StaticResource SegoeAssets}" Foreground="{DynamicResource Brush_StatustText}" FontSize="16" Visibility="{Binding ShowInstallUpdateButton,Converter={StaticResource BooleanToVisibilityConverter}}"/>
</Grid>
<TextBlock Text="{DynamicResource Language_New_Version_available}" Foreground="{DynamicResource Brush_StatustText}"/>
<TextBlock Text=": " Foreground="{DynamicResource Brush_StatustText}"/>
<TextBlock Text="{Binding Package.FormattedVersionNoBuildWithLabel}" FontWeight="Bold" Foreground="{DynamicResource Brush_StatustText}"/>
</StackPanel>
</Button>
<!-- Hide button -->
<Button DockPanel.Dock="Right" Width="18" Height="18" Margin="0,0,10,0" VerticalAlignment="Center" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" ToolTip="{DynamicResource Language_Hide}" Style="{StaticResource TransparentButton}" Command="{Binding HideUpdateStatusCommand}">
<TextBlock Text="" Style="{StaticResource SegoeAssets}" Foreground="{DynamicResource Brush_StatustText}" FontSize="16"/>
</Button>
<ContentControl x:Name="Spacer"/>
</DockPanel>
</Border>
<Border.Style>
<Style TargetType="Border">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=IsUpdateAvailable}" Value="True">
<DataTrigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Duration="0:0:0.15" Storyboard.TargetProperty="Height" To="30" />
<DoubleAnimation Duration="0:0:0.25" Storyboard.TargetProperty="Opacity" To="1" />
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
<DataTrigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Duration="0:0:0.25" Storyboard.TargetProperty="Height" To="0" />
<DoubleAnimation Duration="0:0:0.15" Storyboard.TargetProperty="Opacity" To="0" />
</Storyboard>
</BeginStoryboard>
</DataTrigger.ExitActions>
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
</Border>
</UserControl>
``` | /content/code_sandbox/Dopamine/Views/Common/UpdateStatus.xaml | xml | 2016-07-13T21:34:42 | 2024-08-15T03:30:43 | dopamine-windows | digimezzo/dopamine-windows | 1,786 | 877 |
```xml
<vector android:height="128dp" android:viewportHeight="33.866665"
android:viewportWidth="33.866673" android:width="128dp" xmlns:android="path_to_url">
<path
android:fillColor="#529add"
android:pathData="M33.87,16.93C33.87,26.29 26.29,33.87 16.93,33.87 7.58,33.87 0,26.29 0,16.93 0,7.58 7.58,0 16.93,0c9.35,0 16.93,7.58 16.93,16.93" android:strokeWidth="0.05291667"/>
<path
android:fillAlpha="0.2"
android:fillColor="#000"
android:pathData="m15.87,15.58c0,0.26 0.26,0.53 0.53,0.53l0.53,0.03v6.1h-0.15c-0.26,0 -0.37,0.12 -0.38,0.38l-0.01,0.28c-0.01,0.26 0.13,0.4 0.39,0.4l0.69,-0 -0.01,0.93c-0,0.66 0.26,0.92 0.8,0.92l1.57,-0c0.54,-0 0.79,-0.26 0.8,-0.95l0.01,-0.9 5.3,-0 -0.01,0.92c-0,0.66 0.26,0.92 0.8,0.92l1.57,-0c0.54,-0 0.79,-0.26 0.8,-0.95l0.01,-0.9 0.67,-0c0.26,-0 0.39,-0.13 0.39,-0.39l0,-0.27c0,-0.26 -0.13,-0.4 -0.39,-0.4h-0.15v-5.79l0.53,-0.03c0.26,0 0.53,-0.26 0.53,-0.53l0,-1.06L15.88,14.82Z" />
<path
android:fillColor="#555"
android:pathData="m20.64,23.13c-0,0.69 -0.26,0.95 -0.8,0.95l-1.57,0c-0.54,0 -0.81,-0.26 -0.8,-0.92l0.01,-1 3.17,0.01z"/>
<path
android:fillColor="#99aab5"
android:pathData="m30.69,14.82c0,0.26 -0.26,0.53 -0.53,0.53l-0.53,0.03v-4.23l0.53,-0.03c0.26,0 0.53,0.27 0.53,0.53z"/>
<path
android:fillColor="#ccd6dd"
android:pathData="m21.17,7.41c-0.53,0 -1.06,0.53 -1.06,1.06h-1.59c-1.03,0 -1.59,0.18 -1.59,1.22v5.56h12.7v-5.56c0,-1.03 -0.53,-1.22 -1.59,-1.22h-1.56c-0.04,-0.56 -0.55,-1.06 -1.08,-1.06z" />
<path
android:fillColor="#ffcc4d"
android:pathData="m29.63,21.59h-12.7v-6.35h12.7z"/>
<path
android:fillColor="#ffac33"
android:pathData="m29.63,21.19h-12.7v-2.67h12.7z"/>
<path
android:fillColor="#555"
android:pathData="m29.1,23.12c-0,0.69 -0.26,0.95 -0.8,0.95l-1.57,0c-0.54,0 -0.81,-0.26 -0.8,-0.92l0.01,-1 3.17,0.01z"/>
<path
android:fillColor="#66757f"
android:pathData="m30.17,21.83c-0,0.26 -0.13,0.39 -0.39,0.39l-12.99,0.01c-0.26,0 -0.39,-0.14 -0.39,-0.4l0.01,-0.28c0.01,-0.26 0.12,-0.38 0.38,-0.38l12.99,-0.01c0.26,-0 0.39,0.14 0.39,0.4z"/>
<path
android:fillColor="#66757f"
android:pathData="m29.63,15.35c0,0.79 -0.29,1.06 -1.06,1.06L17.99,16.4c-0.77,0 -1.06,-0.28 -1.06,-1.06v-3.7c0,-0.78 0.29,-1.06 1.06,-1.06h10.58c0.79,0 1.06,0.26 1.06,1.06z"/>
<path
android:fillColor="#88c9f9"
android:pathData="m28.84,14.85c0,0.44 -0.26,0.76 -0.79,0.76l-9.52,0.03c-0.51,0 -0.81,-0.3 -0.79,-0.82v-2.75c0.02,-0.52 0.28,-0.69 0.79,-0.69h9.52c0.51,0 0.79,0.17 0.79,0.69z"/>
<path
android:fillColor="#99aab5"
android:pathData="m25.4,20.64h-4.23v-1.59h4.23z"/>
<path
android:fillColor="#555"
android:pathData="m25.14,9.26h-3.7c-0.26,0 -0.53,-0.26 -0.53,-0.53 0,-0.26 0.32,-0.53 0.53,-0.53h3.7c0.26,0 0.53,0.26 0.53,0.53 0,0.26 -0.26,0.53 -0.53,0.53z"/>
<path
android:fillColor="#fff"
android:pathData="M18.55,19.83m-1.05,0a1.05,1.05 0,1 1,2.11 0a1.05,1.05 0,1 1,-2.11 0"/>
<path
android:fillColor="#fff"
android:pathData="M28.02,19.83m-1.05,0a1.05,1.05 0,1 1,2.11 0a1.05,1.05 0,1 1,-2.11 0"/>
<path
android:fillColor="#99aab5"
android:pathData="m15.88,14.52c0,0.26 0.26,0.53 0.53,0.53l0.53,0.03v-4.23l-0.53,-0.03c-0.26,0 -0.53,0.27 -0.53,0.53z"/>
<path
android:fillColor="#666"
android:pathData="m8.47,26.48v5.11c0.68,0.39 1.38,0.74 2.12,1.04v-6.15z" android:strokeWidth="0.05291667"/>
<path
android:fillAlpha="0.2" android:fillColor="#000"
android:pathData="m14.82,25.37v1.29c0,0.49 -0.39,0.88 -0.88,0.88L5.12,27.54c-0.49,0 -0.88,-0.39 -0.88,-0.88v-1.29z"/>
<path
android:fillColor="#fff"
android:pathData="M5.29,12.2L13.76,12.2A1.06,1.06 0,0 1,14.82 13.25L14.82,25.42A1.06,1.06 0,0 1,13.76 26.48L5.29,26.48A1.06,1.06 0,0 1,4.23 25.42L4.23,13.25A1.06,1.06 0,0 1,5.29 12.2z" />
<path
android:fillColor="#495aad"
android:pathData="M5.56,17.48a3.97,3.99 0,1 0,7.94 0a3.97,3.99 0,1 0,-7.94 0z"/>
<path
android:fillColor="#fff"
android:pathData="m7.94,14.84c-0.29,0 -0.53,0.24 -0.53,0.53v3.69c0,0.2 0.11,0.36 0.26,0.46v0.87h1.06v-0.79h1.59v0.79h1.06v-0.87c0.16,-0.09 0.26,-0.26 0.26,-0.46v-3.69c0,-0.29 -0.24,-0.53 -0.53,-0.53zM8.73,15.61h1.59c0.29,0 0.53,0.24 0.53,0.53v1.32L8.2,17.46v-1.32c0,-0.29 0.24,-0.53 0.53,-0.53zM8.48,18c0.29,0 0.53,0.24 0.53,0.53 0,0.29 -0.24,0.53 -0.53,0.53 -0.29,0 -0.53,-0.24 -0.53,-0.53 0,-0.29 0.24,-0.53 0.53,-0.53zM10.6,18c0.29,0 0.53,0.24 0.53,0.53 0,0.29 -0.24,0.53 -0.53,0.53 -0.29,0 -0.53,-0.24 -0.53,-0.53 0,-0.29 0.24,-0.53 0.53,-0.53z" />
<path
android:fillColor="#cbcbcb"
android:pathData="M5.56,22.23h7.94v2.91h-7.94z"/>
</vector>
``` | /content/code_sandbox/app/src/main/res/drawable/ic_quest_bus_stop_name.xml | xml | 2016-07-02T10:44:04 | 2024-08-16T18:55:54 | StreetComplete | streetcomplete/StreetComplete | 3,781 | 2,753 |
```xml
import type { User } from '@proton/shared/lib/interfaces';
import { canPay, isAdmin, isFree, isMember, isPaid } from './helpers';
const format = (user: User) => {
return {
...user,
isFree: isFree(user),
isPaid: isPaid(user),
isAdmin: isAdmin(user),
isMember: isMember(user),
canPay: canPay(user),
};
};
export default format;
``` | /content/code_sandbox/packages/shared/lib/user/format.ts | xml | 2016-06-08T11:16:51 | 2024-08-16T14:14:27 | WebClients | ProtonMail/WebClients | 4,300 | 96 |
```xml
<dict>
<key>CommonPeripheralDSP</key>
<array>
<dict>
<key>DeviceID</key>
<integer>0</integer>
<key>DeviceType</key>
<string>Headphone</string>
</dict>
<dict>
<key>DeviceID</key>
<integer>0</integer>
<key>DeviceType</key>
<string>Microphone</string>
</dict>
</array>
<key>PathMaps</key>
<array>
<dict>
<key>PathMap</key>
<array>
<array>
<array>
<array>
<dict>
<key>Amp</key>
<dict>
<key>Channels</key>
<array>
<dict>
<key>Bind</key>
<integer>1</integer>
<key>Channel</key>
<integer>1</integer>
</dict>
<dict>
<key>Bind</key>
<integer>2</integer>
<key>Channel</key>
<integer>2</integer>
</dict>
</array>
<key>MuteInputAmp</key>
<true/>
<key>PublishMute</key>
<true/>
<key>PublishVolume</key>
<true/>
<key>VolumeInputAmp</key>
<true/>
</dict>
<key>NodeID</key>
<integer>17</integer>
</dict>
<dict>
<key>Boost</key>
<integer>3</integer>
<key>NodeID</key>
<integer>18</integer>
</dict>
</array>
</array>
<array>
<array>
<dict>
<key>Amp</key>
<dict>
<key>Channels</key>
<array>
<dict>
<key>Bind</key>
<integer>1</integer>
<key>Channel</key>
<integer>1</integer>
</dict>
<dict>
<key>Bind</key>
<integer>2</integer>
<key>Channel</key>
<integer>2</integer>
</dict>
</array>
<key>MuteInputAmp</key>
<true/>
<key>PublishMute</key>
<true/>
<key>PublishVolume</key>
<true/>
<key>VolumeInputAmp</key>
<true/>
</dict>
<key>NodeID</key>
<integer>9</integer>
</dict>
<dict>
<key>NodeID</key>
<integer>34</integer>
</dict>
<dict>
<key>Boost</key>
<integer>3</integer>
<key>NodeID</key>
<integer>24</integer>
</dict>
</array>
</array>
</array>
<array>
<array>
<array>
<dict>
<key>Amp</key>
<dict>
<key>MuteInputAmp</key>
<true/>
<key>PublishMute</key>
<true/>
<key>PublishVolume</key>
<true/>
<key>VolumeInputAmp</key>
<false/>
</dict>
<key>NodeID</key>
<integer>20</integer>
</dict>
<dict>
<key>Amp</key>
<dict>
<key>MuteInputAmp</key>
<true/>
<key>PublishMute</key>
<true/>
<key>PublishVolume</key>
<true/>
<key>VolumeInputAmp</key>
<false/>
</dict>
<key>NodeID</key>
<integer>12</integer>
</dict>
<dict>
<key>Amp</key>
<dict>
<key>Channels</key>
<array>
<dict>
<key>Bind</key>
<integer>1</integer>
<key>Channel</key>
<integer>1</integer>
</dict>
<dict>
<key>Bind</key>
<integer>2</integer>
<key>Channel</key>
<integer>2</integer>
</dict>
</array>
<key>MuteInputAmp</key>
<true/>
<key>PublishMute</key>
<true/>
<key>PublishVolume</key>
<true/>
<key>VolumeInputAmp</key>
<false/>
</dict>
<key>NodeID</key>
<integer>2</integer>
</dict>
</array>
</array>
<array>
<array>
<dict>
<key>Amp</key>
<dict>
<key>MuteInputAmp</key>
<true/>
<key>PublishMute</key>
<true/>
<key>PublishVolume</key>
<true/>
<key>VolumeInputAmp</key>
<false/>
</dict>
<key>NodeID</key>
<integer>33</integer>
</dict>
<dict>
<key>Amp</key>
<dict>
<key>MuteInputAmp</key>
<true/>
<key>PublishMute</key>
<true/>
<key>PublishVolume</key>
<true/>
<key>VolumeInputAmp</key>
<false/>
</dict>
<key>NodeID</key>
<integer>13</integer>
</dict>
<dict>
<key>Amp</key>
<dict>
<key>Channels</key>
<array>
<dict>
<key>Bind</key>
<integer>1</integer>
<key>Channel</key>
<integer>1</integer>
</dict>
<dict>
<key>Bind</key>
<integer>2</integer>
<key>Channel</key>
<integer>2</integer>
</dict>
</array>
<key>MuteInputAmp</key>
<true/>
<key>PublishMute</key>
<true/>
<key>PublishVolume</key>
<true/>
<key>VolumeInputAmp</key>
<false/>
</dict>
<key>NodeID</key>
<integer>3</integer>
</dict>
</array>
</array>
</array>
</array>
<key>PathMapID</key>
<integer>282</integer>
</dict>
</array>
</dict>
``` | /content/code_sandbox/Resources/ALC282/PlatformsID.xml | xml | 2016-03-07T20:45:58 | 2024-08-14T08:57:03 | AppleALC | acidanthera/AppleALC | 3,420 | 1,759 |
```xml
import './Foo.scss';
export function Foo() {
if (typeof document === 'undefined') return;
const root = document.querySelector('#root');
let fooEl = root.querySelector('.Foo');
console.log('entreis!!!!', __build_env.entries);
if (!fooEl) {
fooEl = document.createElement('div');
fooEl.className = 'Foo';
root.appendChild(fooEl);
}
}
``` | /content/code_sandbox/playground/code_splitting/src/foo/Foo.ts | xml | 2016-10-28T10:37:16 | 2024-07-27T15:17:43 | fuse-box | fuse-box/fuse-box | 4,003 | 87 |
```xml
import { useState } from 'react';
import { useEventCallback } from '@/internals/hooks';
interface UseMonthViewProps {
onToggleMonthDropdown?: (toggle: boolean) => void;
}
function useMonthView(props: UseMonthViewProps) {
const { onToggleMonthDropdown } = props;
const [monthView, setMonthView] = useState(false);
/**
* The callback triggered after the month selection box is opened or closed.
*/
const toggleMonthView = useEventCallback((show: boolean) => {
onToggleMonthDropdown?.(show);
setMonthView(show);
});
return {
monthView,
setMonthView,
toggleMonthView
};
}
export default useMonthView;
``` | /content/code_sandbox/src/DatePicker/hooks/useMonthView.ts | xml | 2016-06-06T02:27:46 | 2024-08-16T16:41:54 | rsuite | rsuite/rsuite | 8,263 | 157 |
```xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="path_to_url" xmlns:xsi="path_to_url"
xsi:schemaLocation="path_to_url path_to_url">
<modelVersion>4.0.0</modelVersion>
<groupId>com.fuzzer</groupId>
<artifactId>project-parent</artifactId>
<version>0.1.0</version>
<packaging>pom</packaging>
<modules>
<module>hive</module>
<module>fuzz-targets</module>
</modules>
</project>
``` | /content/code_sandbox/projects/hive/project-parent/pom.xml | xml | 2016-07-20T19:39:50 | 2024-08-16T10:54:09 | oss-fuzz | google/oss-fuzz | 10,251 | 130 |
```xml
import {
TouchableHighlight,
TouchableNativeFeedback,
TouchableOpacity,
TouchableWithoutFeedback,
ScrollView,
FlatList,
Switch,
TextInput,
DrawerLayoutAndroid,
View,
} from 'react-native';
import { State } from './State';
import { Directions } from './Directions';
const NOOP = () => {
// Do nothing
};
const PanGestureHandler = View;
const attachGestureHandler = NOOP;
const createGestureHandler = NOOP;
const dropGestureHandler = NOOP;
const updateGestureHandler = NOOP;
const flushOperations = NOOP;
const install = NOOP;
const NativeViewGestureHandler = View;
const TapGestureHandler = View;
const ForceTouchGestureHandler = View;
const LongPressGestureHandler = View;
const PinchGestureHandler = View;
const RotationGestureHandler = View;
const FlingGestureHandler = View;
const RawButton = TouchableNativeFeedback;
const BaseButton = TouchableNativeFeedback;
const RectButton = TouchableNativeFeedback;
const BorderlessButton = TouchableNativeFeedback;
export default {
TouchableHighlight,
TouchableNativeFeedback,
TouchableOpacity,
TouchableWithoutFeedback,
ScrollView,
FlatList,
Switch,
TextInput,
DrawerLayoutAndroid,
NativeViewGestureHandler,
TapGestureHandler,
ForceTouchGestureHandler,
LongPressGestureHandler,
PinchGestureHandler,
RotationGestureHandler,
FlingGestureHandler,
RawButton,
BaseButton,
RectButton,
BorderlessButton,
PanGestureHandler,
attachGestureHandler,
createGestureHandler,
dropGestureHandler,
updateGestureHandler,
flushOperations,
install,
// Probably can be removed
Directions,
State,
} as const;
``` | /content/code_sandbox/src/mocks.ts | xml | 2016-10-27T08:31:38 | 2024-08-16T12:03:40 | react-native-gesture-handler | software-mansion/react-native-gesture-handler | 5,989 | 369 |
```xml
import { Cell, CodeCell, ICellModel, MarkdownCell } from '@jupyterlab/cells';
import { IMarkdownParser, IRenderMime } from '@jupyterlab/rendermime';
import {
TableOfContents,
TableOfContentsFactory,
TableOfContentsModel,
TableOfContentsUtils
} from '@jupyterlab/toc';
import { KernelError, NotebookActions } from './actions';
import { NotebookPanel } from './panel';
import { INotebookTracker } from './tokens';
import { Notebook } from './widget';
/**
* Cell running status
*/
export enum RunningStatus {
/**
* Cell is idle
*/
Idle = -1,
/**
* Cell execution is unsuccessful
*/
Error = -0.5,
/**
* Cell execution is scheduled
*/
Scheduled = 0,
/**
* Cell is running
*/
Running = 1
}
/**
* Interface describing a notebook cell heading.
*/
export interface INotebookHeading extends TableOfContents.IHeading {
/**
* Reference to a notebook cell.
*/
cellRef: Cell;
/**
* Running status of the cells in the heading
*/
isRunning: RunningStatus;
/**
* Index of the output containing the heading
*/
outputIndex?: number;
/**
* Type of heading
*/
type: Cell.HeadingType;
}
/**
* Table of content model for Notebook files.
*/
export class NotebookToCModel extends TableOfContentsModel<
INotebookHeading,
NotebookPanel
> {
/**
* Constructor
*
* @param widget The widget to search in
* @param parser Markdown parser
* @param sanitizer Sanitizer
* @param configuration Default model configuration
*/
constructor(
widget: NotebookPanel,
protected parser: IMarkdownParser | null,
protected sanitizer: IRenderMime.ISanitizer,
configuration?: TableOfContents.IConfig
) {
super(widget, configuration);
this._runningCells = new Array<Cell>();
this._errorCells = new Array<Cell>();
this._cellToHeadingIndex = new WeakMap<Cell, number>();
void widget.context.ready.then(() => {
// Load configuration from metadata
this.setConfiguration({});
});
this.widget.context.model.metadataChanged.connect(
this.onMetadataChanged,
this
);
this.widget.content.activeCellChanged.connect(
this.onActiveCellChanged,
this
);
NotebookActions.executionScheduled.connect(this.onExecutionScheduled, this);
NotebookActions.executed.connect(this.onExecuted, this);
NotebookActions.outputCleared.connect(this.onOutputCleared, this);
this.headingsChanged.connect(this.onHeadingsChanged, this);
}
/**
* Type of document supported by the model.
*
* #### Notes
* A `data-document-type` attribute with this value will be set
* on the tree view `.jp-TableOfContents-content[data-document-type="..."]`
*/
get documentType(): string {
return 'notebook';
}
/**
* Whether the model gets updated even if the table of contents panel
* is hidden or not.
*/
protected get isAlwaysActive(): boolean {
return true;
}
/**
* List of configuration options supported by the model.
*/
get supportedOptions(): (keyof TableOfContents.IConfig)[] {
return [
'baseNumbering',
'maximalDepth',
'numberingH1',
'numberHeaders',
'includeOutput',
'syncCollapseState'
];
}
/**
* Get the headings of a given cell.
*
* @param cell Cell
* @returns The associated headings
*/
getCellHeadings(cell: Cell): INotebookHeading[] {
const headings = new Array<INotebookHeading>();
let headingIndex = this._cellToHeadingIndex.get(cell);
if (headingIndex !== undefined) {
const candidate = this.headings[headingIndex];
headings.push(candidate);
while (
this.headings[headingIndex - 1] &&
this.headings[headingIndex - 1].cellRef === candidate.cellRef
) {
headingIndex--;
headings.unshift(this.headings[headingIndex]);
}
}
return headings;
}
/**
* Dispose the object
*/
dispose(): void {
if (this.isDisposed) {
return;
}
this.headingsChanged.disconnect(this.onHeadingsChanged, this);
this.widget.context?.model?.metadataChanged.disconnect(
this.onMetadataChanged,
this
);
this.widget.content?.activeCellChanged.disconnect(
this.onActiveCellChanged,
this
);
NotebookActions.executionScheduled.disconnect(
this.onExecutionScheduled,
this
);
NotebookActions.executed.disconnect(this.onExecuted, this);
NotebookActions.outputCleared.disconnect(this.onOutputCleared, this);
this._runningCells.length = 0;
this._errorCells.length = 0;
super.dispose();
}
/**
* Model configuration setter.
*
* @param c New configuration
*/
setConfiguration(c: Partial<TableOfContents.IConfig>): void {
// Ensure configuration update
const metadataConfig = this.loadConfigurationFromMetadata();
super.setConfiguration({ ...this.configuration, ...metadataConfig, ...c });
}
/**
* Callback on heading collapse.
*
* @param options.heading The heading to change state (all headings if not provided)
* @param options.collapsed The new collapsed status (toggle existing status if not provided)
*/
toggleCollapse(options: {
heading?: INotebookHeading;
collapsed?: boolean;
}): void {
super.toggleCollapse(options);
this.updateRunningStatus(this.headings);
}
/**
* Produce the headings for a document.
*
* @returns The list of new headings or `null` if nothing needs to be updated.
*/
protected getHeadings(): Promise<INotebookHeading[] | null> {
const cells = this.widget.content.widgets;
const headings: INotebookHeading[] = [];
const documentLevels = new Array<number>();
// Generate headings by iterating through all notebook cells...
for (let i = 0; i < cells.length; i++) {
const cell: Cell = cells[i];
const model = cell.model;
switch (model.type) {
case 'code': {
// Collapsing cells is incompatible with output headings
if (
!this.configuration.syncCollapseState &&
this.configuration.includeOutput
) {
headings.push(
...TableOfContentsUtils.filterHeadings(
cell.headings,
this.configuration,
documentLevels
).map(heading => {
return {
...heading,
cellRef: cell,
collapsed: false,
isRunning: RunningStatus.Idle
};
})
);
}
break;
}
case 'markdown': {
const cellHeadings = TableOfContentsUtils.filterHeadings(
cell.headings,
this.configuration,
documentLevels
).map((heading, index) => {
return {
...heading,
cellRef: cell,
collapsed: false,
isRunning: RunningStatus.Idle
};
});
// If there are multiple headings, only collapse the highest heading (i.e. minimal level)
// consistent with the cell.headingInfo
if (
this.configuration.syncCollapseState &&
(cell as MarkdownCell).headingCollapsed
) {
const minLevel = Math.min(...cellHeadings.map(h => h.level));
const minHeading = cellHeadings.find(h => h.level === minLevel);
minHeading!.collapsed = (cell as MarkdownCell).headingCollapsed;
}
headings.push(...cellHeadings);
break;
}
}
if (headings.length > 0) {
this._cellToHeadingIndex.set(cell, headings.length - 1);
}
}
this.updateRunningStatus(headings);
return Promise.resolve(headings);
}
/**
* Test if two headings are equal or not.
*
* @param heading1 First heading
* @param heading2 Second heading
* @returns Whether the headings are equal.
*/
protected override isHeadingEqual(
heading1: INotebookHeading,
heading2: INotebookHeading
): boolean {
return (
super.isHeadingEqual(heading1, heading2) &&
heading1.cellRef === heading2.cellRef
);
}
/**
* Read table of content configuration from notebook metadata.
*
* @returns ToC configuration from metadata
*/
protected loadConfigurationFromMetadata(): Partial<TableOfContents.IConfig> {
const nbModel = this.widget.content.model;
const newConfig: Partial<TableOfContents.IConfig> = {};
if (nbModel) {
for (const option in this.configMetadataMap) {
const keys = this.configMetadataMap[option];
for (const k of keys) {
let key = k;
const negate = key[0] === '!';
if (negate) {
key = key.slice(1);
}
const keyPath = key.split('/');
let value = nbModel.getMetadata(keyPath[0]);
for (let p = 1; p < keyPath.length; p++) {
value = (value ?? {})[keyPath[p]];
}
if (value !== undefined) {
if (typeof value === 'boolean' && negate) {
value = !value;
}
newConfig[option] = value;
}
}
}
}
return newConfig;
}
protected onActiveCellChanged(
notebook: Notebook,
cell: Cell<ICellModel>
): void {
// Highlight the first title as active (if multiple titles are in the same cell)
const activeHeading = this.getCellHeadings(cell)[0];
this.setActiveHeading(activeHeading ?? null, false);
}
protected onHeadingsChanged(): void {
if (this.widget.content.activeCell) {
this.onActiveCellChanged(
this.widget.content,
this.widget.content.activeCell
);
}
}
protected onExecuted(
_: unknown,
args: {
notebook: Notebook;
cell: Cell;
success: boolean;
error: KernelError | null;
}
): void {
this._runningCells.forEach((cell, index) => {
if (cell === args.cell) {
this._runningCells.splice(index, 1);
const headingIndex = this._cellToHeadingIndex.get(cell);
if (headingIndex !== undefined) {
const heading = this.headings[headingIndex];
// when the execution is not successful but errorName is undefined,
// the execution is interrupted by previous cells
if (args.success || args.error?.errorName === undefined) {
heading.isRunning = RunningStatus.Idle;
return;
}
heading.isRunning = RunningStatus.Error;
if (!this._errorCells.includes(cell)) {
this._errorCells.push(cell);
}
}
}
});
this.updateRunningStatus(this.headings);
this.stateChanged.emit();
}
protected onExecutionScheduled(
_: unknown,
args: { notebook: Notebook; cell: Cell }
): void {
if (!this._runningCells.includes(args.cell)) {
this._runningCells.push(args.cell);
}
this._errorCells.forEach((cell, index) => {
if (cell === args.cell) {
this._errorCells.splice(index, 1);
}
});
this.updateRunningStatus(this.headings);
this.stateChanged.emit();
}
protected onOutputCleared(
_: unknown,
args: { notebook: Notebook; cell: Cell }
): void {
this._errorCells.forEach((cell, index) => {
if (cell === args.cell) {
this._errorCells.splice(index, 1);
const headingIndex = this._cellToHeadingIndex.get(cell);
if (headingIndex !== undefined) {
const heading = this.headings[headingIndex];
heading.isRunning = RunningStatus.Idle;
}
}
});
this.updateRunningStatus(this.headings);
this.stateChanged.emit();
}
protected onMetadataChanged(): void {
this.setConfiguration({});
}
protected updateRunningStatus(headings: INotebookHeading[]): void {
// Update isRunning
this._runningCells.forEach((cell, index) => {
const headingIndex = this._cellToHeadingIndex.get(cell);
if (headingIndex !== undefined) {
const heading = this.headings[headingIndex];
// Running is prioritized over Scheduled, so if a heading is
// running don't change status
if (heading.isRunning !== RunningStatus.Running) {
heading.isRunning =
index > 0 ? RunningStatus.Scheduled : RunningStatus.Running;
}
}
});
this._errorCells.forEach((cell, index) => {
const headingIndex = this._cellToHeadingIndex.get(cell);
if (headingIndex !== undefined) {
const heading = this.headings[headingIndex];
// Running and Scheduled are prioritized over Error, so only if
// a heading is idle will it be set to Error
if (heading.isRunning === RunningStatus.Idle) {
heading.isRunning = RunningStatus.Error;
}
}
});
let globalIndex = 0;
while (globalIndex < headings.length) {
const heading = headings[globalIndex];
globalIndex++;
if (heading.collapsed) {
const maxIsRunning = Math.max(
heading.isRunning,
getMaxIsRunning(headings, heading.level)
);
heading.dataset = {
...heading.dataset,
'data-running': maxIsRunning.toString()
};
} else {
heading.dataset = {
...heading.dataset,
'data-running': heading.isRunning.toString()
};
}
}
function getMaxIsRunning(
headings: INotebookHeading[],
collapsedLevel: number
): RunningStatus {
let maxIsRunning = RunningStatus.Idle;
while (globalIndex < headings.length) {
const heading = headings[globalIndex];
heading.dataset = {
...heading.dataset,
'data-running': heading.isRunning.toString()
};
if (heading.level > collapsedLevel) {
globalIndex++;
maxIsRunning = Math.max(heading.isRunning, maxIsRunning);
if (heading.collapsed) {
maxIsRunning = Math.max(
maxIsRunning,
getMaxIsRunning(headings, heading.level)
);
heading.dataset = {
...heading.dataset,
'data-running': maxIsRunning.toString()
};
}
} else {
break;
}
}
return maxIsRunning;
}
}
/**
* Mapping between configuration options and notebook metadata.
*
* If it starts with `!`, the boolean value of the configuration option is
* opposite to the one stored in metadata.
* If it contains `/`, the metadata data is nested.
*/
protected configMetadataMap: {
[k: keyof TableOfContents.IConfig]: string[];
} = {
numberHeaders: ['toc-autonumbering', 'toc/number_sections'],
numberingH1: ['!toc/skip_h1_title'],
baseNumbering: ['toc/base_numbering']
};
private _runningCells: Cell[];
private _errorCells: Cell[];
private _cellToHeadingIndex: WeakMap<Cell, number>;
}
/**
* Table of content model factory for Notebook files.
*/
export class NotebookToCFactory extends TableOfContentsFactory<NotebookPanel> {
/**
* Constructor
*
* @param tracker Widget tracker
* @param parser Markdown parser
* @param sanitizer Sanitizer
*/
constructor(
tracker: INotebookTracker,
protected parser: IMarkdownParser | null,
protected sanitizer: IRenderMime.ISanitizer
) {
super(tracker);
}
/**
* Whether to scroll the active heading to the top
* of the document or not.
*/
get scrollToTop(): boolean {
return this._scrollToTop;
}
set scrollToTop(v: boolean) {
this._scrollToTop = v;
}
/**
* Create a new table of contents model for the widget
*
* @param widget - widget
* @param configuration - Table of contents configuration
* @returns The table of contents model
*/
protected _createNew(
widget: NotebookPanel,
configuration?: TableOfContents.IConfig
): TableOfContentsModel<TableOfContents.IHeading, NotebookPanel> {
const model = new NotebookToCModel(
widget,
this.parser,
this.sanitizer,
configuration
);
// Connect model signals to notebook panel
let headingToElement = new WeakMap<INotebookHeading, Element | null>();
const onActiveHeadingChanged = (
model: NotebookToCModel,
heading: INotebookHeading | null
) => {
if (heading) {
const onCellInViewport = async (cell: Cell): Promise<void> => {
if (!cell.inViewport) {
// Bail early
return;
}
const el = headingToElement.get(heading);
if (el) {
if (this.scrollToTop) {
el.scrollIntoView({ block: 'start' });
} else {
const widgetBox = widget.content.node.getBoundingClientRect();
const elementBox = el.getBoundingClientRect();
if (
elementBox.top > widgetBox.bottom ||
elementBox.bottom < widgetBox.top
) {
el.scrollIntoView({ block: 'center' });
}
}
} else {
console.debug('scrolling to heading: using fallback strategy');
await widget.content.scrollToItem(
widget.content.activeCellIndex,
this.scrollToTop ? 'start' : undefined,
0
);
}
};
const cell = heading.cellRef;
const cells = widget.content.widgets;
const idx = cells.indexOf(cell);
// Switch to command mode to avoid entering Markdown cell in edit mode
// if the document was in edit mode
if (cell.model.type == 'markdown' && widget.content.mode != 'command') {
widget.content.mode = 'command';
}
widget.content.activeCellIndex = idx;
if (cell.inViewport) {
onCellInViewport(cell).catch(reason => {
console.error(
`Fail to scroll to cell to display the required heading (${reason}).`
);
});
} else {
widget.content
.scrollToItem(idx, this.scrollToTop ? 'start' : undefined)
.then(() => {
return onCellInViewport(cell);
})
.catch(reason => {
console.error(
`Fail to scroll to cell to display the required heading (${reason}).`
);
});
}
}
};
const findHeadingElement = (cell: Cell): void => {
model.getCellHeadings(cell).forEach(async heading => {
const elementId = await getIdForHeading(
heading,
this.parser!,
this.sanitizer
);
const selector = elementId
? `h${heading.level}[id="${CSS.escape(elementId)}"]`
: `h${heading.level}`;
if (heading.outputIndex !== undefined) {
// Code cell
headingToElement.set(
heading,
TableOfContentsUtils.addPrefix(
(heading.cellRef as CodeCell).outputArea.widgets[
heading.outputIndex
].node,
selector,
heading.prefix ?? ''
)
);
} else {
headingToElement.set(
heading,
TableOfContentsUtils.addPrefix(
heading.cellRef.node,
selector,
heading.prefix ?? ''
)
);
}
});
};
const onHeadingsChanged = (model: NotebookToCModel) => {
if (!this.parser) {
return;
}
// Clear all numbering items
TableOfContentsUtils.clearNumbering(widget.content.node);
// Create a new mapping
headingToElement = new WeakMap<INotebookHeading, Element | null>();
widget.content.widgets.forEach(cell => {
findHeadingElement(cell);
});
};
const onHeadingCollapsed = (
_: NotebookToCModel,
heading: INotebookHeading | null
) => {
if (model.configuration.syncCollapseState) {
if (heading !== null) {
const cell = heading.cellRef as MarkdownCell;
if (cell.headingCollapsed !== (heading.collapsed ?? false)) {
cell.headingCollapsed = heading.collapsed ?? false;
}
} else {
const collapseState = model.headings[0]?.collapsed ?? false;
widget.content.widgets.forEach(cell => {
if (cell instanceof MarkdownCell) {
if (cell.headingInfo.level >= 0) {
cell.headingCollapsed = collapseState;
}
}
});
}
}
};
const onCellCollapsed = (_: unknown, cell: MarkdownCell) => {
if (model.configuration.syncCollapseState) {
const h = model.getCellHeadings(cell)[0];
if (h) {
model.toggleCollapse({
heading: h,
collapsed: cell.headingCollapsed
});
}
}
};
const onCellInViewportChanged = (_: unknown, cell: Cell) => {
if (cell.inViewport) {
findHeadingElement(cell);
} else {
// Needed to remove prefix in cell outputs
TableOfContentsUtils.clearNumbering(cell.node);
}
};
void widget.context.ready.then(() => {
onHeadingsChanged(model);
model.activeHeadingChanged.connect(onActiveHeadingChanged);
model.headingsChanged.connect(onHeadingsChanged);
model.collapseChanged.connect(onHeadingCollapsed);
widget.content.cellCollapsed.connect(onCellCollapsed);
widget.content.cellInViewportChanged.connect(onCellInViewportChanged);
widget.disposed.connect(() => {
model.activeHeadingChanged.disconnect(onActiveHeadingChanged);
model.headingsChanged.disconnect(onHeadingsChanged);
model.collapseChanged.disconnect(onHeadingCollapsed);
widget.content.cellCollapsed.disconnect(onCellCollapsed);
widget.content.cellInViewportChanged.disconnect(
onCellInViewportChanged
);
});
});
return model;
}
private _scrollToTop: boolean = true;
}
/**
* Get the element id for an heading
* @param heading Heading
* @param parser The markdownparser
* @returns The element id
*/
export async function getIdForHeading(
heading: INotebookHeading,
parser: IRenderMime.IMarkdownParser,
sanitizer: IRenderMime.ISanitizer
) {
let elementId: string | null = null;
if (heading.type === Cell.HeadingType.Markdown) {
elementId = await TableOfContentsUtils.Markdown.getHeadingId(
parser,
// Type from TableOfContentsUtils.Markdown.IMarkdownHeading
(heading as any).raw,
heading.level,
sanitizer
);
} else if (heading.type === Cell.HeadingType.HTML) {
// Type from TableOfContentsUtils.IHTMLHeading
elementId = (heading as any).id;
}
return elementId;
}
``` | /content/code_sandbox/packages/notebook/src/toc.ts | xml | 2016-06-03T20:09:17 | 2024-08-16T19:12:44 | jupyterlab | jupyterlab/jupyterlab | 14,019 | 5,017 |
```xml
// Libraries
import React, {PureComponent} from 'react'
import {Dropdown} from '../../Dropdown'
interface Props {
options: string[]
selectedOption: string
testID?: string
onSelect?: (option: string) => void
onDelete?: () => void | boolean
isInCheckOverlay?: boolean
children?: JSX.Element
}
export default class BuilderCardDropdownHeader extends PureComponent<Props> {
public static defaultProps = {
testID: 'builder-card--header',
}
public render() {
const {children, options, onSelect, selectedOption, testID} = this.props
return (
<div className="builder-card--header" data-test={testID}>
<Dropdown
items={options.map(x => ({text: x}))}
onChoose={({text}) => onSelect(text)}
selected={selectedOption}
buttonSize="btn-sm"
className="dropdown-stretch"
data-test="select-option-dropdown"
/>
{children}
{this.deleteButton}
</div>
)
}
private get deleteButton(): JSX.Element | undefined {
const {onDelete} = this.props
if (onDelete) {
return <div className="builder-card--delete" onClick={onDelete} />
}
}
}
``` | /content/code_sandbox/ui/src/shared/components/TimeMachine/fluxQueryBuilder/BuilderCardDropdownHeader.tsx | xml | 2016-08-24T23:28:56 | 2024-08-13T19:50:03 | chronograf | influxdata/chronograf | 1,494 | 272 |
```xml
export type Mutable<Type> = {
-readonly [Property in keyof Type]: Type[Property];
};
``` | /content/code_sandbox/packages/webview-api/src/types.ts | xml | 2016-05-16T10:42:22 | 2024-08-16T02:29:06 | vscode-spell-checker | streetsidesoftware/vscode-spell-checker | 1,377 | 22 |
```xml
/**
* This file is part of OpenMediaVault.
*
* @license path_to_url GPL Version 3
* @author Volker Theile <volker.theile@openmediavault.org>
*
* OpenMediaVault is free software: you can redistribute it and/or modify
* any later version.
*
* OpenMediaVault is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*/
import { Component, EventEmitter, HostBinding, Input, OnInit, Output } from '@angular/core';
import { marker as gettext } from '@ngneat/transloco-keys-manager/marker';
import * as _ from 'lodash';
import { CoerceBoolean } from '~/app/decorators';
import { Icon } from '~/app/shared/enum/icon.enum';
import { UserLocalStorageService } from '~/app/shared/services/user-local-storage.service';
export type AlertPanelButtonConfig = {
icon: string;
class?: string;
tooltip?: string;
click?: (config: AlertPanelButtonConfig) => void;
};
@Component({
selector: 'omv-alert-panel',
templateUrl: './alert-panel.component.html',
styleUrls: ['./alert-panel.component.scss']
})
export class AlertPanelComponent implements OnInit {
@Input()
type: 'info' | 'success' | 'warning' | 'error' | 'tip';
@CoerceBoolean()
@Input()
hasTitle = true;
@CoerceBoolean()
@Input()
hasMargin = true;
@CoerceBoolean()
@Input()
dismissible = false;
// An identifier, e.g. a UUID, which identifies this alert panel
// uniquely. This is used to store/restore the dismissed state.
@Input()
stateId: string;
@Input()
buttons: AlertPanelButtonConfig[] = [];
@Input()
icon?: string;
@Input()
title?: string;
@Output()
closed = new EventEmitter();
// Internal
public dismissed = false;
constructor(private userLocalStorageService: UserLocalStorageService) {}
@HostBinding('class')
get class(): string {
const result: string[] = [];
if (this.dismissed) {
result.push('omv-display-none');
}
return result.join(' ');
}
ngOnInit(): void {
if (this.dismissible) {
this.buttons.push({
icon: Icon.close,
tooltip: gettext('Dismiss'),
click: this.close.bind(this)
});
if (this.stateId) {
this.dismissed =
'dismiss' === this.userLocalStorageService.get(`alertpanel_state_${this.stateId}`, '');
}
}
this.sanitizeConfig();
}
close(): void {
this.dismissed = true;
if (this.stateId) {
this.userLocalStorageService.set(`alertpanel_state_${this.stateId}`, 'dismiss');
}
this.closed.emit();
}
protected sanitizeConfig() {
this.type = _.defaultTo(this.type, 'info');
switch (this.type) {
case 'info':
this.title = this.title || gettext('Information');
this.icon = _.get(Icon, this.icon, Icon.information);
break;
case 'success':
this.title = this.title || gettext('Success');
this.icon = _.get(Icon, this.icon, Icon.success);
break;
case 'warning':
this.title = this.title || gettext('Warning');
this.icon = _.get(Icon, this.icon, Icon.warning);
break;
case 'error':
this.title = this.title || gettext('Error');
this.icon = _.get(Icon, this.icon, Icon.error);
break;
case 'tip':
this.title = this.title || gettext('Tip');
this.icon = _.get(Icon, this.icon, Icon.tip);
break;
}
}
}
``` | /content/code_sandbox/deb/openmediavault/workbench/src/app/shared/components/alert-panel/alert-panel.component.ts | xml | 2016-05-03T10:35:34 | 2024-08-16T08:03:04 | openmediavault | openmediavault/openmediavault | 4,954 | 838 |
```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd"
[
<!ENTITY varName "[A-Za-z]\w*">
<!ENTITY variable "@\{&varName;\}">
<!ENTITY exec "[pPcC]?[iuU]?x">
<!ENTITY globbChars "*?">
<!-- Characters not allowed in a path -->
<!ENTITY noPathChar "\s\)"">
<!ENTITY noPathCharWithoutSpace ")"">
<!ENTITY endPath ",([\s"]|$)">
]>
<!--
AppArmor Profiles Syntax Highlighting Definition for the KDE KSyntaxHighlighting Framework
==========================================================================================
This file is part of the KDE's KSyntaxHighlighting framework.
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
==========================================================================================
Last update:
Syntax highlighting based on AppArmor 2.13.3
For more details about the syntax of AppArmor profiles, visit:
path_to_url
path_to_url
Change log:
* Version 9 [20-Jun-2019]: (AppArmor 2.13.3):
- Add new network domain keywords.
- Fixes: drop unsupported 'to' operator for link rules and only highlight the 'in'
operator in mount rules. Only highlight valid numbers in rlimit rules.
* Version 8 [02-Apr-2019]: (AppArmor 2.13.2)
- Do not highlight variable assignments and alias rules within profiles.
- Add keywords of "tunables/share" variables.
- Change style of "Other Option" attribute and remove one indentation.
* Version 7 [15-Sep-2018]:
- Update itemData's style for the new Solarized color schemes.
- Fixes in "_end_rule_irnc".
* Version 6 [24-Jul-2018, by Nibaldo G.]: (AppArmor 2.13.0)
- Fixes for Include rules, add 'if exists'. Fix escapes & globbing in text quoted.
- Improvements in paths that start with variables, hats, comments and variable
assignments and others. Add some abstractions & filesystems.
* Version 4 [25-Jan-2018, by Nibaldo G.]: (AppArmor 2.12.0)
- New keywords: network and mount rules, default abstractions, variables and others.
- Multiple improvements and fixes.
- Do not allow comments within rules and in variable assignment lines.
* Version 3 [24-Sep-2017, by Nibaldo G.]:
- Fix incorrect highlighting of the DBus rule 'name' keyword.
* Version 2 [29-Aug-2017, by Nibaldo G.]:
- Improvements and bug fixes.
- Each rule has its own context.
- The profile name is highlighted in the profile header and profile transition rules.
* Version 1 [22-Feb-2017, by Nibaldo Gonzlez]:
- Initial version. Support for profile syntax of Apparmor 2.11.
-->
<language name="AppArmor Security Profile"
version="9"
kateversion="5.0"
section="Markup"
extensions="usr.bin.*;usr.sbin.*;bin.*;sbin.*;usr.lib.*;usr.lib64.*;usr.lib32.*;usr.libx32.*;usr.libexec.*;usr.local.bin.*;usr.local.sbin.*;usr.local.lib*;opt.*;etc.cron.*;snap.*;snap-update-ns.*;snap-confine.*"
priority="0"
mimetype=""
author="Nibaldo Gonzlez (nibgonz@gmail.com)"
license="MIT">
<highlighting>
<!-- Profile Header -->
<list name="profile_head">
<item>profile</item>
<item>hat</item>
</list>
<list name="profile_options">
<item>flags</item>
<item>xattrs</item>
</list>
<list name="profile_flags">
<item>audit</item>
<item>complain</item>
<item>enforce</item>
<item>mediate_deleted</item>
<item>attach_disconnected</item>
<item>chroot_relative</item>
<item>chroot_attach</item>
<item>chroot_no_attach</item>
<item>delegate_deleted</item>
<item>no_attach_disconnected</item>
<item>namespace_relative</item>
</list>
<!-- Rule Qualifiers -->
<list name="access_types">
<item>allow</item>
<item>deny</item>
</list>
<list name="file_qualifiers">
<item>owner</item>
<item>other</item>
</list>
<list name="qualifiers">
<item>audit</item>
<!-- noaudit/quiet, defined, not -->
</list>
<!-- Conditional: if, else -->
<!-- Capabilities, Capability Rule.
Lowercase capability name without 'CAP_' prefix.
path_to_url -->
<list name="rule_capability">
<item>audit_control</item>
<item>audit_read</item>
<item>audit_write</item>
<item>block_suspend</item>
<item>chown</item>
<item>dac_override</item>
<item>dac_read_search</item>
<item>fowner</item>
<item>fsetid</item>
<item>ipc_lock</item>
<item>ipc_owner</item>
<item>kill</item>
<item>lease</item>
<item>linux_immutable</item>
<item>mac_admin</item>
<item>mac_override</item>
<item>mknod</item>
<item>net_admin</item>
<item>net_bind_service</item>
<item>net_broadcast</item>
<item>net_raw</item>
<item>setgid</item>
<item>setfcap</item>
<item>setpcap</item>
<item>setuid</item>
<item>sys_admin</item>
<item>sys_boot</item>
<item>sys_chroot</item>
<item>sys_module</item>
<item>sys_nice</item>
<item>sys_pacct</item>
<item>sys_ptrace</item>
<item>sys_rawio</item>
<item>sys_resource</item>
<item>sys_time</item>
<item>sys_tty_config</item>
<item>syslog</item>
<item>wake_alarm</item>
</list>
<!-- Network Rule -->
<list name="rule_network">
<!-- Domain.
Also: unix -->
<item>inet</item>
<item>ax25</item>
<item>ipx</item>
<item>appletalk</item>
<item>netrom</item>
<item>bridge</item>
<item>atmpvc</item>
<item>x25</item>
<item>inet6</item>
<item>rose</item>
<item>netbeui</item>
<item>security</item>
<item>key</item>
<item>packet</item>
<item>ash</item>
<item>econet</item>
<item>atmsvc</item>
<item>sna</item>
<item>irda</item>
<item>pppox</item>
<item>wanpipe</item>
<item>bluetooth</item>
<item>netlink</item>
<item>rds</item>
<item>llc</item>
<item>can</item>
<item>tipc</item>
<item>iucv</item>
<item>rxrpc</item>
<item>isdn</item>
<item>phonet</item>
<item>ieee802154</item>
<item>caif</item>
<item>alg</item>
<item>nfc</item>
<item>vsock</item>
<item>mpls</item>
<item>ib</item>
<item>kcm</item>
<item>smc</item>
<item>qipcrtr</item>
<item>xdp</item>
<!-- Type.
Also: packet -->
<item>stream</item>
<item>dgram</item>
<item>seqpacket</item>
<item>rdm</item>
<item>raw</item>
<!-- Protocol -->
<item>tcp</item>
<item>udp</item>
<item>icmp</item>
</list>
<list name="rule_network_unix">
<!-- NOTE: This keyword is placed in a separate list,
to avoid conflicts with the 'unix' rule name. -->
<item>unix</item>
</list>
<!-- Mount Rule -->
<list name="rule_mount_options">
<item>fstype</item>
<item>vfstype</item>
<item>options</item>
<item>option</item>
</list>
<list name="rule_mount_flags">
<item>r</item>
<item>w</item>
<item>rw</item>
<item>ro</item>
<item>read-only</item>
<item>suid</item>
<item>nosuid</item>
<item>dev</item>
<item>nodev</item>
<item>exec</item>
<item>noexec</item>
<item>sync</item>
<item>async</item>
<item>remount</item>
<item>mand</item>
<item>nomand</item>
<item>dirsync</item>
<item>atime</item>
<item>noatime</item>
<item>diratime</item>
<item>nodiratime</item>
<item>bind</item>
<item>B</item>
<item>move</item>
<item>M</item>
<item>rbind</item>
<item>R</item>
<item>verbose</item>
<item>silent</item>
<item>loud</item>
<item>acl</item>
<item>noacl</item>
<item>unbindable</item>
<item>make-unbindable</item>
<item>runbindable</item>
<item>make-runbindable</item>
<item>private</item>
<item>make-private</item>
<item>rprivate</item>
<item>make-rprivate</item>
<item>slave</item>
<item>make-slave</item>
<item>rslave</item>
<item>make-rslave</item>
<item>shared</item>
<item>make-shared</item>
<item>rshared</item>
<item>make-rshared</item>
<item>relatime</item>
<item>norelatime</item>
<item>iversion</item>
<item>noiversion</item>
<item>strictatime</item>
<item>user</item>
<item>nouser</item>
</list>
<list name="rule_mount_fstypes">
<item>ecryptfs</item>
<item>overlayfs</item>
<item>unionfs</item>
<item>shm</item>
<!-- VFS Types -->
<item>cryfs</item>
<item>encfs</item>
<item>apparmorfs</item>
<item>autofs</item>
<item>bdev</item>
<item>bpf</item>
<item>cachefs</item>
<item>cgroup</item>
<item>cgroup2</item>
<item>cifs</item>
<item>coherent</item>
<item>configfs</item>
<item>cpuset</item>
<item>cramfs</item>
<item>debugfs</item>
<item>devfs</item>
<item>devpts</item>
<item>devtmpfs</item>
<item>efs</item>
<item>fuse</item>
<item>fuseblk</item>
<item>fusectl</item>
<item>futexfs</item>
<item>hugetlbfs</item>
<item>kernfs</item>
<item>mqueue</item>
<item>pipefs</item>
<item>proc</item>
<item>procfs</item>
<item>pstorefs</item>
<item>pstore</item>
<item>ramfs</item>
<item>romfs</item>
<item>rootfs</item>
<item>sdcardfs</item>
<item>securityfs</item>
<item>selinuxfs</item>
<item>sockfs</item>
<item>specfs</item>
<item>squashfs</item>
<item>swapfs</item>
<item>sysfs</item>
<item>sysv</item>
<item>tmpfs</item>
<item>usbfs</item>
<item>vfat</item>
<item>functionfs</item>
<item>inotifyfs</item>
<item>labeledfs</item>
<item>oemfs</item>
<!-- FS Types -->
<item>adfs</item>
<item>affs</item>
<item>afs</item>
<item>apfs</item>
<item>bfs</item>
<item>btrfs</item>
<item>ceph</item>
<item>coda</item>
<item>exfat</item>
<item>ext2</item>
<item>ext3</item>
<item>ext4</item>
<item>f2fs</item>
<item>fatx</item>
<item>gfs</item>
<item>hfs</item>
<item>hfsplus</item>
<item>hpfs</item>
<item>ifs</item>
<item>iso9660</item>
<item>jffs2</item>
<item>jffs</item>
<item>jfs</item>
<item>lvm2</item>
<item>minix</item>
<item>msdos</item>
<item>ncpfs</item>
<item>nilfs</item>
<item>nilfs2</item>
<item>nfs</item>
<item>nfs4</item>
<item>ntfs-3g</item>
<item>ntfs</item>
<item>ocfs</item>
<item>qnx4</item>
<item>qnx6</item>
<item>reiser4</item>
<item>reiserfs</item>
<item>smbfs</item>
<item>swap</item>
<item>tracefs</item>
<item>ubifs</item>
<item>udf</item>
<item>ufs</item>
<item>umsdos</item>
<item>urefs</item>
<item>xenix</item>
<item>yaffs2</item>
<item>yaffs</item>
<item>xfs</item>
<item>zfs</item>
<!-- Not included: ext, usbdevfs, xiafs -->
</list>
<!-- Pivot Root Rule -->
<list name="rule_pivotroot_options">
<item>oldroot</item>
</list>
<!-- Ptrace Rule -->
<list name="rule_ptrace_options">
<item>peer</item>
</list>
<list name="rule_ptrace_access">
<!-- Also: r, w, rw, read -->
<item>readby</item>
<item>trace</item>
<item>tracedby</item>
</list>
<!-- Signal Rule -->
<list name="rule_signal_options">
<item>set</item>
<item>peer</item>
</list>
<list name="rule_signal">
<!-- Also: rtmin+0 ... rtmin+32 -->
<item>bus</item>
<item>hup</item>
<item>int</item>
<item>quit</item>
<item>ill</item>
<item>trap</item>
<item>abrt</item>
<item>fpe</item>
<item>kill</item>
<item>usr1</item>
<item>segv</item>
<item>usr2</item>
<item>pipe</item>
<item>alrm</item>
<item>term</item>
<item>stkflt</item>
<item>chld</item>
<item>cont</item>
<item>stop</item>
<item>stp</item>
<item>ttin</item>
<item>ttou</item>
<item>urg</item>
<item>xcpu</item>
<item>xfsz</item>
<item>vtalrm</item>
<item>prof</item>
<item>winch</item>
<item>io</item>
<item>pwr</item>
<item>sys</item>
<item>emt</item>
<item>exists</item>
</list>
<list name="rule_signal_access">
<!-- Also: r, w, rw, read, write -->
<item>send</item>
<item>receive</item>
</list>
<!-- DBus Rule -->
<list name="rule_dbus_options">
<item>peer</item>
<item>bus</item>
<item>path</item>
<item>interface</item>
<item>member</item>
<item>name</item>
</list>
<list name="rule_dbus_peer">
<item>name</item>
<item>label</item>
</list>
<list name="rule_dbus_access">
<!-- Also: r, w, rw, read, write -->
<item>send</item>
<item>receive</item>
<item>bind</item>
<item>eavesdrop</item>
</list>
<list name="rule_dbus_bus">
<item>system</item>
<item>session</item>
</list>
<!-- Unix Rule -->
<list name="rule_unix_options">
<item>peer</item>
<item>set</item>
<item>label</item>
<item>type</item>
<item>protocol</item>
<item>addr</item>
<item>attr</item>
<item>opt</item>
</list>
<list name="rule_unix_access">
<!-- Also: r, w, rw, read, write -->
<item>send</item>
<item>receive</item>
<item>bind</item>
<item>create</item>
<item>listen</item>
<item>accept</item>
<item>connect</item>
<item>shutdown</item>
<item>getattr</item>
<item>setattr</item>
<item>getopt</item>
<item>setopt</item>
</list>
<!-- Rlimit Rule -->
<list name="rule_rlimit">
<item>cpu</item>
<item>fsize</item>
<item>data</item>
<item>stack</item>
<item>core</item>
<item>rss</item>
<item>nofile</item>
<item>ofile</item>
<item>as</item>
<item>nproc</item>
<item>memlock</item>
<item>locks</item>
<item>sigpending</item>
<item>msgqueue</item>
<item>nice</item>
<item>rtprio</item>
<item>rttime</item>
</list>
<!-- Link Rule -->
<list name="rule_link">
<item>subset</item>
</list>
<!-- Change Profile Rule -->
<list name="rule_changeprofile">
<item>safe</item>
<item>unsafe</item>
</list>
<!-- Include Rule -->
<list name="rule_include">
<item>if</item>
<item>exists</item>
</list>
<!-- Permissions -->
<list name="base_accesses">
<item>rw</item>
<item>r</item>
<item>w</item>
<item>read</item>
<item>write</item>
</list>
<!-- Abstractions and variables defined in the provided AppArmor policy.
NOTE: The following keywords are not used for highlighting. The purpose of these
is to provide autocomplete suggestions when writing Include rules and variables. -->
<list name="default_variables">
<item>profile_name</item> <!-- Special variable -->
<item>HOME</item>
<item>HOMEDIRS</item>
<item>multiarch</item>
<item>pid</item>
<item>pids</item>
<item>PROC</item>
<item>securityfs</item>
<item>apparmorfs</item>
<item>sys</item>
<item>tid</item>
<item>XDG_DESKTOP_DIR</item>
<item>XDG_DOWNLOAD_DIR</item>
<item>XDG_TEMPLATES_DIR</item>
<item>XDG_PUBLICSHARE_DIR</item>
<item>XDG_DOCUMENTS_DIR</item>
<item>XDG_MUSIC_DIR</item>
<item>XDG_PICTURES_DIR</item>
<item>XDG_VIDEOS_DIR</item>
<item>flatpak_exports_root</item>
<item>system_share_dirs</item>
<item>user_share_dirs</item>
</list>
<list name="default_abstractions">
<item>abstractions/</item>
<item>apache2-common</item>
<item>aspell</item>
<item>audio</item>
<item>authentication</item>
<item>base</item>
<item>bash</item>
<item>consoles</item>
<item>cups-client</item>
<item>dbus</item>
<item>dbus-accessibility</item>
<item>dbus-accessibility-strict</item>
<item>dbus-session</item>
<item>dbus-session-strict</item>
<item>dbus-strict</item>
<item>dconf</item>
<item>dovecot-common</item>
<item>dri-common</item>
<item>dri-enumerate</item>
<item>enchant</item>
<item>fcitx</item>
<item>fcitx-strict</item>
<item>fonts</item>
<item>freedesktop.org</item>
<item>gnome</item>
<item>gnupg</item>
<item>ibus</item>
<item>kde-icon-cache-write</item>
<item>kde-globals-write</item>
<item>kde-language-write</item>
<item>kde</item>
<item>kerberosclient</item>
<item>launchpad-integration</item>
<item>ldapclient</item>
<item>libpam-systemd</item>
<item>likewise</item>
<item>mdns</item>
<item>mesa</item>
<item>mir</item>
<item>mozc</item>
<item>mysql</item>
<item>nameservice</item>
<item>nis</item>
<item>nvidia</item>
<item>opencl</item>
<item>opencl-common</item>
<item>opencl-intel</item>
<item>opencl-mesa</item>
<item>opencl-nvidia</item>
<item>opencl-pocl</item>
<item>openssl</item>
<item>orbit2</item>
<item>p11-kit</item>
<item>perl</item>
<item>php</item>
<item>php5</item>
<item>postfix-common</item>
<item>private-files</item>
<item>private-files-strict</item>
<item>python</item>
<item>qt5-compose-cache-write</item>
<item>qt5-settings-write</item>
<item>qt5</item>
<item>recent-documents-write</item>
<item>ruby</item>
<item>samba</item>
<item>smbpass</item>
<item>ssl_certs</item>
<item>ssl_keys</item>
<item>svn-repositories</item>
<item>ubuntu-bittorrent-clients</item>
<item>ubuntu-browsers</item>
<item>ubuntu-console-browsers</item>
<item>ubuntu-console-email</item>
<item>ubuntu-email</item>
<item>ubuntu-feed-readers</item>
<item>ubuntu-gnome-terminal</item>
<item>ubuntu-helpers</item>
<item>ubuntu-konsole</item>
<item>ubuntu-media-players</item>
<item>ubuntu-unity7-base</item>
<item>ubuntu-unity7-launcher</item>
<item>ubuntu-unity7-messaging</item>
<item>ubuntu-xterm</item>
<item>user-download</item>
<item>user-mail</item>
<item>user-manpages</item>
<item>user-tmp</item>
<item>user-write</item>
<item>video</item>
<item>vulkan</item>
<item>wayland</item>
<item>web-data</item>
<item>winbind</item>
<item>wutmp</item>
<item>X</item>
<item>xad</item>
<item>xdg-desktop</item>
<item>ubuntu-browsers.d/</item>
<item>java</item>
<item>mailto</item>
<item>multimedia</item>
<item>plugins-common</item>
<item>productivity</item>
<item>text-editors</item>
<item>ubuntu-integration</item>
<item>ubuntu-integration-xul</item>
<item>user-files</item>
<item>apparmor_api/</item>
<item>change_profile</item>
<item>examine</item>
<item>find_mountpoint</item>
<item>introspect</item>
<item>is_enabled</item>
<item>tunables/</item>
<item>alias</item>
<item>apparmorfs</item>
<item>dovecot</item>
<item>global</item>
<item>home</item>
<item>kernelvars</item>
<item>multiarch</item>
<item>ntpd</item>
<item>proc</item>
<item>securityfs</item>
<item>sys</item>
<item>xdg-user-dirs</item>
<item>home.d/</item>
<item>multiarch.d/</item>
<item>xdg-user-dirs.d/</item>
<item>site.local</item>
<item>local/</item>
</list>
<list name="boolean">
<item>true</item>
<item>false</item>
</list>
<list name="other_words">
<item>unspec</item>
<item>none</item>
<item>unconfined</item>
</list>
<!-- Rule Names.
NOTE:
- Each rule name is a keyword in separate lists, since each
has a different context and for a correct delimitation of the words.
- The content of a rule is found in the contexts "_default_rule"
and "_default_rule_with_comments".
- When adding a new rule, add it also in "_end_rule_irnc"! -->
<list name="rule_name_mount">
<item>mount</item>
<item>remount</item>
<item>umount</item>
</list>
<list name="rule_name_alias"><item>alias</item></list>
<list name="rule_name_file"><item>file</item></list>
<list name="rule_name_capability"><item>capability</item></list>
<list name="rule_name_network"><item>network</item></list>
<list name="rule_name_pivotroot"><item>pivot_root</item></list>
<list name="rule_name_ptrace"><item>ptrace</item></list>
<list name="rule_name_signal"><item>signal</item></list>
<list name="rule_name_dbus"><item>dbus</item></list>
<list name="rule_name_unix"><item>unix</item></list>
<list name="rule_name_link"><item>link</item></list>
<list name="rule_name_changeprofile"><item>change_profile</item></list>
<list name="rule_name_rlimit"><item>rlimit</item></list>
<list name="rule_name_set"><item>set</item></list>
<!-- AppArmor 2.12.0: Keywords not currently supported:
if, else, not, defined, other, rewrite, quiet, kill, nokill -->
<contexts>
<context name="_normal" attribute="Normal Text" lineEndContext="#stay">
<!-- Preamble -->
<!-- Variable Assignment.
NOTE:
- Variable assignments are not allowed within profiles (when writing assignments within
profiles, the parser shows an error because it does not allow + or = after a variable).
- [Jul 24, 2018] Variables of type "@VAR" will only be highlighted in assignments, as long
as they are not fully supported (apparently, they will be used in conditional expressions). -->
<Detect2Chars context="_variable_assignment" attribute="Variable" char="@" char1="{" lookAhead="true" firstNonSpace="true"/>
<RegExpr context="_variable_assignment_operator" attribute="Variable" String="@&varName;(?=\s*(\+?\=|$|\s#))" firstNonSpace="true"/>
<DetectChar context="_variable_assignment_line_general" attribute="Operator 1" char="=" firstNonSpace="true"/>
<Detect2Chars context="_variable_assignment_line" attribute="Operator 1" char="+" char1="=" firstNonSpace="true"/>
<!-- Alias rule -->
<keyword context="_default_rule_with_comments" attribute="Rule" String="rule_name_alias" beginRegion="Rule"/>
<!-- Profile Content (also highlight rules, for abstractions) -->
<IncludeRules context="_default_profile"/>
</context>
<!-- Profile Content, within { ... } -->
<context name="_profile" attribute="Normal Text" lineEndContext="#stay">
<DetectChar context="#pop" attribute="Operator 1" char="}" endRegion="Profile"/>
<Detect2Chars context="_variable_assignment_error" attribute="Variable" char="@" char1="{" lookAhead="true" firstNonSpace="true"/>
<IncludeRules context="_default_profile"/>
<WordDetect context="#stay" attribute="Error" String="alias"/> <!-- rule_name_alias -->
</context>
<context name="_default_profile" attribute="Normal Text" lineEndContext="#stay">
<!-- Profile Header -->
<keyword context="_profile_name" attribute="Profile Head" String="profile_head"/>
<RegExpr context="_profile_name" attribute="Profile Head" String="(^|\s)\^(?=\S)"/>
<keyword context="#stay" attribute="Option" String="profile_options"/>
<!-- Line Rules -->
<StringDetect context="_include" attribute="Preprocessor" String="#include" insensitive="true"/>
<RegExpr context="_include" attribute="Preprocessor" String="(^|\s)include(?=\s)"/>
<DetectChar context="_comment" attribute="Comment" char="#"/>
<!-- Variables -->
<Detect2Chars context="_variable" attribute="Variable" char="@" char1="{" lookAhead="true"/>
<Detect2Chars context="_boolean" attribute="Variable" char="$" char1="{" lookAhead="true"/>
<keyword context="#stay" attribute="Other Option" String="boolean" insensitive="true"/>
<RegExpr context="#stay" attribute="Variable" String="\$&varName;(?=[\s\(\)\{\}"@\$#\=\+]|$)"/>
<!-- Brackets -->
<IncludeRules context="_brackets_error"/> <!-- {} -->
<DetectChar context="_profile" attribute="Operator 1" char="{" beginRegion="Profile"/>
<DetectChar context="_parentheses_block_profile" attribute="Normal Text" char="("/>
<DetectChar context="_r_square_brackets" attribute="Globbing Brackets" char="["/>
<!-- Rule Qualifiers -->
<keyword context="#stay" attribute="Access Qualifier" String="access_types"/>
<keyword context="#stay" attribute="Qualifier" String="qualifiers"/>
<keyword context="#stay" attribute="File Qualifier" String="file_qualifiers"/>
<!-- Rules -->
<keyword context="_rule_file" attribute="Rule" String="rule_name_file" beginRegion="Rule"/>
<keyword context="_rule_mount" attribute="Rule" String="rule_name_mount" beginRegion="Rule"/>
<keyword context="_rule_capability" attribute="Rule" String="rule_name_capability" beginRegion="Rule"/>
<keyword context="_rule_network" attribute="Rule" String="rule_name_network" beginRegion="Rule"/>
<keyword context="_rule_pivotroot" attribute="Rule" String="rule_name_pivotroot" beginRegion="Rule"/>
<keyword context="_rule_ptrace" attribute="Rule" String="rule_name_ptrace" beginRegion="Rule"/>
<keyword context="_rule_signal" attribute="Rule" String="rule_name_signal" beginRegion="Rule"/>
<keyword context="_rule_dbus" attribute="Rule" String="rule_name_dbus" beginRegion="Rule"/>
<keyword context="_rule_unix" attribute="Rule" String="rule_name_unix" beginRegion="Rule"/>
<keyword context="_rule_link" attribute="Rule" String="rule_name_link" beginRegion="Rule"/>
<keyword context="_rule_changeprofile" attribute="Rule" String="rule_name_changeprofile" beginRegion="Rule"/>
<keyword context="_rule_rlimit" attribute="Rule Error" String="rule_name_rlimit" beginRegion="Rule"/> <!-- set rlimit -->
<keyword context="_rule_set" attribute="Rule" String="rule_name_set"/>
<!-- Paths, text in quotes, file permissions and others -->
<IncludeRules context="_operators"/>
<IncludeRules context="_find_path"/>
<IncludeRules context="_find_text_quoted"/>
<IncludeRules context="_file_rule_permissions"/>
<keyword context="#stay" String="default_variables"/>
</context>
<!-- Within rules and blocks of parentheses -->
<context name="_common" attribute="Normal Text" lineEndContext="#stay">
<StringDetect context="#stay" attribute="Error" String="#include" insensitive="true"/>
<RegExpr context="#stay" attribute="Error" String="include(?=\s)" firstNonSpace="true"/>
<IncludeRules context="_brackets_error"/>
<IncludeRules context="_operators"/>
<IncludeRules context="_find_text_quoted"/>
<keyword context="#stay" attribute="Other Data" String="other_words" insensitive="true"/>
<keyword context="#stay" attribute="Other Data" String="boolean" insensitive="true"/>
</context>
<!-- Comment -->
<context name="_comment" attribute="Comment" lineEndContext="#pop">
<DetectSpaces />
<LineContinue context="#pop" attribute="Comment"/>
<IncludeRules context="##Alerts"/>
<IncludeRules context="##Modelines"/>
<!-- URL -->
<RegExpr context="#stay" attribute="URL in Comment" String="\bhttps?://[^\s<>"'`]*[^\s<>"'`\}\)\]\.,;\|]"/>
<!-- Email (Source: path_to_url -->
<RegExpr context="#stay" attribute="URL in Comment" String="(([^<>\(\)\[\]\\\.,;:\s@"]+(\.[^<>\(\)\[\]\\\.,;:\s@"]+)*)|("[^"]+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}])|(([a-zA-Z\-\d]+\.)+[a-zA-Z]{2,}))\b"/>
</context>
<!-- Profile Header:
Highlight the name of the profile.
The profile name label is optional. This is written after the hat character (^) or a profile keyword. -->
<context name="_profile_name" attribute="Profile Name" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop">
<DetectSpaces context="#stay" attribute="Normal Text"/>
<!-- Not highlighting paths and paths quoted.
NOTE: Some profile labels may contain "/" (like [/]). These cases are not considered. -->
<RegExpr context="#pop" attribute="Normal Text" String=""([^/"\\]|\\.)*/" lookAhead="true"/>
<RegExpr context="#pop!_path_content" attribute="Path" String="([^\s"\\]|\\.)*/" lookAhead="true"/>
<DetectChar context="#pop!_profile_name_quoted" attribute="Profile Name" char="""/>
<!-- First word (the profile name) -->
<RegExpr context="#pop!_profile_name_content" attribute="Normal Text" String="[^\s/\^\{]" lookAhead="true"/>
</context>
<context name="_profile_name_content" attribute="Profile Name" lineEndContext="#pop">
<!-- NOTE: "(" generates errors when calling "get_profiles()" (apparmor_status). This forces to put a space before. -->
<RegExpr context="#pop" attribute="Error" String="\(\S*\)?"/>
<!-- End of the profile name label -->
<DetectSpaces context="#pop" attribute="Normal Text" lookAhead="true"/>
<!-- The quote ends the profile name, but it is ideal to put a space before -->
<DetectChar context="#pop" attribute="Normal Text" char=""" lookAhead="true"/>
<RegExpr context="#stay" attribute="Profile Name Error" String="[^\s\(\\](?=["\(])"/>
<StringDetect context="#pop" attribute="Error" String="#include" insensitive="true"/>
<IncludeRules context="_variable_simple"/>
<IncludeRules context="_escape"/>
</context>
<context name="_profile_name_quoted" attribute="Profile Name" lineEndContext="#stay">
<DetectChar context="#pop" attribute="Profile Name" char="""/>
<IncludeRules context="_variable_simple"/>
<IncludeRules context="_escape"/>
</context>
<!-- Include Rule: include <abstraction/path> -->
<context name="_include" attribute="Preprocessor" lineEndContext="#pop">
<Detect2Chars context="#pop" attribute="Error" char=""" char1="""/>
<Detect2Chars context="#pop" attribute="Error" char="<" char1=">"/>
<RegExpr context="#stay" attribute="Error" String="<+(?=[<\s])"/>
<RegExpr context="#pop!_include_preplib_thanquot" attribute="Prep. Lib" String="<\s*(?=")"/> <!-- <"path"> -->
<DetectChar context="#pop!_include_preplib_than" attribute="Prep. Lib" char="<" lookAhead="true"/> <!-- <magic/path> -->
<DetectChar context="#pop!_include_preplib_quot" attribute="Prep. Lib" char="""/> <!-- "/abs/path" -->
<keyword context="#stay" attribute="Preprocessor" String="rule_include"/>
<RegExpr context="#pop" attribute="Prep. Lib" String="[^\s/"<>]*/\S*(?=\s|$)"/> <!-- /abs/path -->
</context>
<context name="_include_preplib_than" attribute="Prep. Lib" lineEndContext="#pop">
<DetectChar context="#pop" attribute="Prep. Lib" char=">"/>
<keyword context="#stay" attribute="Prep. Lib" String="default_abstractions"/>
<RegExpr context="#pop" attribute="Open Prep. Lib" String="[^>\s](?=\s*$)"/>
</context>
<context name="_include_preplib_quot" attribute="Prep. Lib" lineEndContext="#pop">
<DetectChar context="#pop" attribute="Prep. Lib" char="""/>
<keyword context="#stay" attribute="Prep. Lib" String="default_abstractions"/>
<RegExpr context="#pop" attribute="Open Prep. Lib" String="[^"\s](?=\s*$)"/>
</context>
<context name="_include_preplib_thanquot" attribute="Prep. Lib" lineEndContext="#pop">
<DetectChar context="_include_preplib_quot" attribute="Prep. Lib" char="""/>
<IncludeRules context="_include_preplib_than"/>
</context>
<!-- @{VARIABLE} -->
<context name="_variable" attribute="Variable" lineEndContext="#pop">
<RegExpr context="#pop!_find_path_after_variable" attribute="Variable" String="&variable;"/>
<DetectChar context="#pop" attribute="Error" char="@"/>
</context>
<context name="_parentheses_variable" attribute="Variable" lineEndContext="#pop">
<RegExpr context="#pop!_parentheses_find_path_after_variable" attribute="Variable" String="&variable;"/>
<DetectChar context="#pop" attribute="Error" char="@"/>
</context>
<context name="_variable_simple" attribute="Normal Text" lineEndContext="#stay">
<RegExpr context="#stay" attribute="Variable" String="&variable;"/>
</context>
<!-- Find path after a variable -->
<context name="_find_path_after_variable" attribute="Path" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!_path_content">
<DetectSpaces context="#pop" lookAhead="true"/>
<AnyChar context="#pop" String="&noPathCharWithoutSpace;]}=" lookAhead="true"/>
<RegExpr context="#pop" String="[[:cntrl:]]" lookAhead="true"/> <!-- It is necessary? -->
</context>
<context name="_parentheses_find_path_after_variable" attribute="Path" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!_parentheses_path_content">
<DetectChar context="#pop" char="," lookAhead="true"/>
<IncludeRules context="_find_path_after_variable"/>
</context>
<!-- @{VARIABLE} = A B C -->
<context name="_variable_assignment" attribute="Variable" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
<RegExpr context="#pop!_variable_assignment_operator" attribute="Variable" String="&variable;"/>
<DetectChar context="#pop" attribute="Error" char="@"/>
</context>
<context name="_variable_assignment_operator" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!_path_content">
<!-- After the operator, highlighting as "Path" the entire line -->
<RegExpr context="#pop!_variable_assignment_line" attribute="Operator 1" String="\s*\+?\="/>
<DetectChar context="#pop!_path_content" attribute="Error" char="+"/>
<IncludeRules context="_find_path_after_variable"/>
</context>
<context name="_variable_assignment_line" attribute="Path" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!_variable_assignment_line_content">
<DetectChar context="#pop!_variable_assignment_line_content" attribute="Error" char="#"/> <!-- Comment -->
</context>
<context name="_variable_assignment_line_content" attribute="Path" lineEndContext="#pop">
<LineContinue context="#stay" attribute="Escape Char"/>
<IncludeRules context="_path_globbing"/>
<IncludeRules context="_find_text_quoted"/>
<IncludeRules context="_variable_simple"/>
<Detect2Chars context="_hat_path" char="/" char1="/" lookAhead="true"/>
<RegExpr context="#stay" attribute="Error" String=",(?=[\s"]|$)"/> <!-- End of rule comma (&endPath;) -->
<StringDetect context="#stay" attribute="Error" String="#include" insensitive="true"/>
<!-- NOTE: [V4][Jan 06, 2018] AppArmor does not detect comments in variable assignment lines
(these are carried through to the policy). This is an AppArmor bug, therefore, the hash
character after a space is highlighted as "Error". Check this when the bug has been fixed. -->
<RegExpr context="_comment_variable_assignment_line" attribute="Path" String="\s(?=#)"/>
</context>
<context name="_comment_variable_assignment_line" attribute="Error" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
<DetectChar context="#pop" attribute="Error" char="#"/>
</context>
<context name="_variable_assignment_line_general" attribute="Path" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!_variable_assignment_line">
<keyword context="#pop!_variable_assignment_line" attribute="Other Option" String="boolean" insensitive="true"/>
<DetectSpaces context="#stay"/>
</context>
<!-- Within the profiles, highlight as "Error" the operators of variable assignment (= and +=) -->
<context name="_variable_assignment_error" attribute="Variable" lineEndContext="#pop">
<RegExpr context="#pop!_variable_assignment_error_operator" attribute="Variable" String="&variable;"/>
<DetectChar context="#pop" attribute="Error" char="@"/>
</context>
<context name="_variable_assignment_error_operator" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!_find_path_after_variable">
<DetectChar context="#pop!_find_path_after_variable" attribute="Error" char="="/>
<Detect2Chars context="#pop!_find_path_after_variable" attribute="Error" char="+" char1="="/>
<RegExpr context="#pop!_variable_assignment_error_operator_after_spaces" String="\s+(?=\+?\=)"/>
</context>
<context name="_variable_assignment_error_operator_after_spaces" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
<DetectChar context="#pop" attribute="Error" char="="/>
<Detect2Chars context="#pop" attribute="Error" char="+" char1="="/>
</context>
<!-- ${BOOLEAN} -->
<context name="_boolean" attribute="Variable" lineEndContext="#pop">
<RegExpr context="#pop" attribute="Variable" String="\$\{&varName;\}"/>
<DetectChar context="#pop" attribute="Error" char="$"/>
</context>
<!-- Access Modes / File Permissions -->
<context name="_permissions" attribute="Normal Text" lineEndContext="#stay">
<IncludeRules context="_permissions_correction"/>
<RegExpr context="#stay" attribute="Permissions" String="(^|\s)([rwkml]|&exec;)+(?=[\s,]|$)"/>
<RegExpr context="#stay" attribute="Permissions" String="(^|\s)([rakml]|&exec;)+(?=[\s,]|$)"/>
</context>
<context name="_file_rule_permissions" attribute="Normal Text" lineEndContext="#stay">
<IncludeRules context="_permissions_correction"/>
<RegExpr context="_rule_file" attribute="Permissions" String="(^|\s)([rwkml]|&exec;)+(?=[\s,]|$)"/>
<RegExpr context="_rule_file" attribute="Permissions" String="(^|\s)([rakml]|&exec;)+(?=[\s,]|$)"/>
</context>
<context name="_permissions_correction" attribute="Normal Text" lineEndContext="#stay">
<!-- Incompatible execution modes -->
<RegExpr context="_perm_correction_in" String="(^|\s)[rwakml]*p[iUu]?x([rwakml]|p[iUu]?x)*[PcC]?[iUu]?x([rwakml]|&exec;)*([\s,]|$)" lookAhead="true"/> <!-- p -->
<RegExpr context="_perm_correction_in" String="(^|\s)[rwakml]*P[iUu]?x([rwakml]|P[iUu]?x)*[pcC]?[iUu]?x([rwakml]|&exec;)*([\s,]|$)" lookAhead="true"/> <!-- P -->
<RegExpr context="_perm_correction_in" String="(^|\s)[rwakml]*c[iUu]?x([rwakml]|c[iUu]?x)*[PpC]?[iUu]?x([rwakml]|&exec;)*([\s,]|$)" lookAhead="true"/> <!-- c -->
<RegExpr context="_perm_correction_in" String="(^|\s)[rwakml]*C[iUu]?x([rwakml]|C[iUu]?x)*[Ppc]?[iUu]?x([rwakml]|&exec;)*([\s,]|$)" lookAhead="true"/> <!-- C -->
<RegExpr context="_perm_correction_in" String="(^|\s)[rwakml]*[PpCc]?ix([rwakml]|[PpCc]?ix)*[PpCc]?[Uu]?x([rwakml]|&exec;)*([\s,]|$)" lookAhead="true"/> <!-- i -->
<RegExpr context="_perm_correction_in" String="(^|\s)[rwakml]*[PpCc]?ux([rwakml]|[PpCc]?ux)*[PpCc]?[iU]?x([rwakml]|&exec;)*([\s,]|$)" lookAhead="true"/> <!-- u -->
<RegExpr context="_perm_correction_in" String="(^|\s)[rwakml]*[PpCc]?Ux([rwakml]|[PpCc]?Ux)*[PpCc]?[iu]?x([rwakml]|&exec;)*([\s,]|$)" lookAhead="true"/> <!-- U -->
<RegExpr context="_perm_correction_in" String="(^|\s)[rwakml]*[iuU]?x([rwakml]|[iuU]?x)*[PpCc][iuU]?x([rwakml]|&exec;)*([\s,]|$)" lookAhead="true"/> <!-- x, ix, ux or Ux followed by P, p, C or c -->
<RegExpr context="_perm_correction_in" String="(^|\s)[rwakml]*x[rwakmlx]*[iuU]x([rwakml]|&exec;)*([\s,]|$)" lookAhead="true"/> <!-- x followed by ix, ux or Ux -->
</context>
<context name="_perm_correction_in" attribute="Normal Text" lineEndContext="#pop">
<!-- Highlight the previous space or the full permission -->
<DetectSpaces context="#pop"/>
<DetectIdentifier context="#pop"/>
</context>
<!-- Operators -->
<context name="_operators" attribute="Normal Text" lineEndContext="#stay">
<DetectChar context="#stay" attribute="Operator 1" char="="/>
<Detect2Chars context="#stay" attribute="Operator 1" char="+" char1="="/>
<Detect2Chars context="#stay" attribute="Operator 2" char="-" char1=">"/>
</context>
<context name="_operators_in" attribute="Normal Text" lineEndContext="#stay">
<!-- Only in mount rules -->
<RegExpr context="#stay" attribute="Operator 2" String="\b(in)(?=[\s\(\{\["/@\$]|$)"/>
</context>
<!-- RULES -->
<!-- For all rules -->
<!-- Also see: _default_parentheses_block_rule -->
<context name="_common_rule" attribute="Normal Text" lineEndContext="#stay">
<!-- Highlight as path the text after the '=' operator, except keywords or simple words ([\w\-\+]+) -->
<RegExpr context="#stay" attribute="Error" String="\=(?=\s*($|&endPath;))"/>
<RegExpr context="_path_content" attribute="Operator 1" String="\=\s*(?=[^\s"\(]*([^&noPathChar;\]\}\=\w\+\-\(,]|,[^&noPathChar;]))"/>
<Detect2Chars context="_variable" attribute="Variable" char="@" char1="{" lookAhead="true"/>
<IncludeRules context="_find_path"/>
<IncludeRules context="_common"/>
<DetectChar context="_r_curly_brackets" attribute="Globbing Brackets" char="{"/>
<DetectChar context="_r_square_brackets" attribute="Globbing Brackets" char="["/>
<!-- This must be at the end of each context (to avoid conflicts with some keywords) -->
<IncludeRules context="_end_rule"/>
</context>
<context name="_default_rule_without_parentheses" attribute="Normal Text" lineEndContext="#stay">
<IncludeRules context="_common_rule"/>
<!-- AppArmor does not detect comments within rules (except in file & alias rules) -->
<IncludeRules context="_comment_not_allowed"/>
</context>
<context name="_default_rule" attribute="Normal Text" lineEndContext="#stay">
<IncludeRules context="_default_rule_without_parentheses"/>
<DetectChar context="_default_parentheses_block_rule" attribute="Normal Text" char="("/>
</context>
<context name="_default_rule_with_comments" attribute="Normal Text" lineEndContext="#stay">
<IncludeRules context="_common_rule"/>
<DetectChar context="_comment" attribute="Comment" char="#"/>
</context>
<context name="_comment_not_allowed" attribute="Normal Text" lineEndContext="#stay">
<DetectChar context="_comment" attribute="Error" char="#" firstNonSpace="true"/>
<DetectChar context="#stay" attribute="Error" char="#"/>
</context>
<!-- Network Rule -->
<context name="_rule_network" attribute="Normal Text" lineEndContext="#stay">
<keyword context="#stay" attribute="Data" String="rule_network"/>
<keyword context="#stay" attribute="Data" String="rule_network_unix"/>
<IncludeRules context="_default_rule"/>
</context>
<!-- Capability Rule -->
<context name="_rule_capability" attribute="Normal Text" lineEndContext="#stay">
<keyword context="#stay" attribute="Data" String="rule_capability"/>
<IncludeRules context="_default_rule"/>
</context>
<!-- Mount Rule -->
<context name="_rule_mount" attribute="Normal Text" lineEndContext="#stay">
<keyword context="#stay" attribute="Option" String="rule_mount_options"/>
<IncludeRules context="_mount_rule_keywords"/>
<IncludeRules context="_default_rule_without_parentheses"/>
<DetectChar context="_mount_parentheses_block" attribute="Normal Text" char="("/>
</context>
<context name="_mount_parentheses_block" attribute="Normal Text" lineEndContext="#stay">
<IncludeRules context="_mount_rule_keywords"/>
<IncludeRules context="_default_parentheses_block_rule"/>
</context>
<context name="_mount_rule_keywords" attribute="Normal Text" lineEndContext="#stay">
<keyword context="#stay" attribute="Permissions" String="rule_mount_flags"/>
<keyword context="#stay" attribute="Flags" String="rule_mount_fstypes"/>
<IncludeRules context="_operators_in"/>
</context>
<!-- Pivot Root Rule -->
<context name="_rule_pivotroot" attribute="Normal Text" lineEndContext="#stay">
<keyword context="#stay" attribute="Option" String="rule_pivotroot_options"/>
<IncludeRules context="_default_rule"/>
</context>
<!-- Ptrace Rule -->
<context name="_rule_ptrace" attribute="Normal Text" lineEndContext="#stay">
<keyword context="#stay" attribute="Option" String="rule_ptrace_options"/>
<IncludeRules context="_ptrace_rule_keywords"/>
<IncludeRules context="_default_rule_without_parentheses"/>
<DetectChar context="_ptrace_parentheses_block" attribute="Normal Text" char="("/>
</context>
<context name="_ptrace_parentheses_block" attribute="Normal Text" lineEndContext="#stay">
<keyword context="#stay" attribute="Other Option" String="rule_ptrace_options"/>
<IncludeRules context="_ptrace_rule_keywords"/>
<IncludeRules context="_default_parentheses_block_rule"/>
</context>
<context name="_ptrace_rule_keywords" attribute="Normal Text" lineEndContext="#stay">
<keyword context="#stay" attribute="Permissions" String="rule_ptrace_access"/>
<keyword context="#stay" attribute="Permissions" String="base_accesses"/>
</context>
<!-- Signal Rule -->
<context name="_rule_signal" attribute="Normal Text" lineEndContext="#stay">
<keyword context="#stay" attribute="Option" String="rule_signal_options"/>
<IncludeRules context="_signal_rule_keywords"/>
<IncludeRules context="_default_rule_without_parentheses"/>
<DetectChar context="_signal_parentheses_block" attribute="Normal Text" char="("/>
</context>
<context name="_signal_parentheses_block" attribute="Normal Text" lineEndContext="#stay">
<IncludeRules context="_signal_rule_keywords"/>
<keyword context="#stay" attribute="Other Option" String="rule_signal_options"/>
<IncludeRules context="_default_parentheses_block_rule"/>
</context>
<context name="_signal_rule_keywords" attribute="Normal Text" lineEndContext="#stay">
<keyword context="#stay" attribute="Flags" String="rule_signal"/>
<keyword context="#stay" attribute="Permissions" String="rule_signal_access"/>
<keyword context="#stay" attribute="Permissions" String="base_accesses"/>
<RegExpr context="#stay" attribute="Flags" String="\b(rtmin\+)0*(3[012]|[12]?\d)\b"/>
</context>
<!-- DBus Rule -->
<context name="_rule_dbus" attribute="Normal Text" lineEndContext="#stay">
<keyword context="#stay" attribute="Option" String="rule_dbus_options"/>
<IncludeRules context="_dbus_rule_keywords"/>
<IncludeRules context="_default_rule_without_parentheses"/>
<DetectChar context="_dbus_parentheses_block" attribute="Normal Text" char="("/>
</context>
<context name="_dbus_parentheses_block" attribute="Normal Text" lineEndContext="#stay">
<keyword context="#stay" attribute="Other Option" String="rule_dbus_peer"/>
<IncludeRules context="_dbus_rule_keywords"/>
<IncludeRules context="_default_parentheses_block_rule"/>
</context>
<context name="_dbus_rule_keywords" attribute="Normal Text" lineEndContext="#stay">
<keyword context="#stay" attribute="Other Data" String="rule_dbus_bus"/>
<keyword context="#stay" attribute="Permissions" String="rule_dbus_access"/>
<keyword context="#stay" attribute="Permissions" String="base_accesses"/>
</context>
<!-- Unix Rule -->
<context name="_rule_unix" attribute="Normal Text" lineEndContext="#stay">
<keyword context="#stay" attribute="Option" String="rule_unix_options"/>
<IncludeRules context="_unix_rule_keywords"/>
<IncludeRules context="_default_rule_without_parentheses"/>
<DetectChar context="_path_content" attribute="Path" char="@" lookAhead="true"/> <!-- Socket -->
<DetectChar context="_unix_parentheses_block" attribute="Normal Text" char="("/>
</context>
<context name="_unix_parentheses_block" attribute="Normal Text" lineEndContext="#stay">
<IncludeRules context="_unix_rule_keywords"/>
<keyword context="#stay" attribute="Other Option" String="rule_unix_options"/>
<IncludeRules context="_default_parentheses_block_rule"/>
<DetectChar context="_parentheses_path_content" attribute="Path" char="@" lookAhead="true"/>
</context>
<context name="_unix_rule_keywords" attribute="Normal Text" lineEndContext="#stay">
<keyword context="#stay" attribute="Permissions" String="rule_unix_access"/>
<keyword context="#stay" attribute="Permissions" String="base_accesses"/>
<keyword context="#stay" attribute="Data" String="rule_network"/>
</context>
<!-- Rlimit Rule -->
<context name="_rule_set" attribute="Normal Text" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop">
<keyword context="#pop!_rule_rlimit" attribute="Rule" String="rule_name_rlimit" beginRegion="Rule"/>
<DetectSpaces context="#stay" attribute="Normal Text"/>
<RegExpr context="_comment" attribute="Comment" String="#(?!include)" insensitive="true"/>
</context>
<context name="_rule_rlimit" attribute="Normal Text" lineEndContext="#stay">
<keyword context="#stay" attribute="Data" String="rule_rlimit"/>
<Detect2Chars context="#stay" attribute="Operator 2" char="<" char1="="/>
<RegExpr context="#stay" attribute="Number" String="\-(20|1?\d)\b"/>
<RegExpr context="_number_unit" attribute="Number" String="\b\d+"/> <!-- Rules Int don't use '-' as a delimiter -->
<WordDetect context="#stay" attribute="Number" String="infinity"/>
<RegExpr context="#stay" attribute="Numerical Unit" String="\b([KMG]B?|[shd]|us|ms|min|sec|(minute|day|hour|week|second)(s?)|(milli|micro)second(s?))\b"/>
<IncludeRules context="_default_rule"/>
</context>
<context name="_number_unit" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
<RegExpr context="#pop" attribute="Numerical Unit" String="([KMG]B?|[shd]|us|ms|min|sec|(minute|day|hour|week|second)(s?)|(milli|micro)second(s?))\b"/>
</context>
<!-- Link Rule -->
<context name="_rule_link" attribute="Normal Text" lineEndContext="#stay">
<keyword context="#stay" attribute="Data" String="rule_link"/>
<IncludeRules context="_default_rule"/>
</context>
<!-- Change Profile Rule -->
<context name="_rule_changeprofile" attribute="Normal Text" lineEndContext="#stay">
<Detect2Chars context="#pop!_profile_transition" attribute="Operator 2" char="-" char1=">"/>
<keyword context="#stay" attribute="Data" String="rule_changeprofile"/>
<IncludeRules context="_default_rule"/>
</context>
<!-- File Rule -->
<context name="_rule_file" attribute="Normal Text" lineEndContext="#stay">
<Detect2Chars context="#pop!_profile_transition" attribute="Operator 2" char="-" char1=">"/>
<IncludeRules context="_default_rule_with_comments"/>
<IncludeRules context="_permissions"/>
</context>
<!-- Profile Transition:
Highlight the profile name in File Rules (Execute Mode) and Change Profile Rules. -->
<context name="_profile_transition" attribute="Transition Profile Name" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop">
<DetectSpaces context="#stay" attribute="Normal Text"/>
<!-- Not highlighting paths and paths quoted -->
<RegExpr context="#pop!_default_rule_with_comments" attribute="Path" String="([^\s/\[\\]|//|\\.|\[([^\s\]\\]|\\.)*\])*/($|[^/])" lookAhead="true"/>
<RegExpr context="#pop!_default_rule_with_comments" attribute="Normal Text" String=""([^/"\[\\]|//|\\.|\[([^"\]\\]|\\.)*\])*/($|[^/])" lookAhead="true"/>
<DetectChar context="#pop!_t_profile_name_quoted" attribute="Transition Profile Name" char="""/>
<RegExpr context="#pop!_profile_transition_content" attribute="Normal Text" String="[^\s/]" lookAhead="true"/> <!-- First word -->
</context>
<context name="_profile_transition_content" attribute="Transition Profile Name" lineEndContext="#pop!_default_rule_with_comments">
<RegExpr context="#pop!_default_rule_with_comments" attribute="Error" String="\(\S*(?=,([&noPathChar;]|$))"/>
<RegExpr context="#pop!_default_rule_with_comments" attribute="Normal Text" String="&endPath;" lookAhead="true"/> <!-- End rule -->
<DetectSpaces context="#pop" attribute="Normal Text" lookAhead="true"/> <!-- End of the profile name -->
<DetectChar context="#stay" attribute="Error" char="""/>
<StringDetect context="#pop!_default_rule_with_comments" attribute="Error" String="#include" insensitive="true"/>
<RegExpr context="#stay" String="//(?=&endPath;)"/>
<IncludeRules context="_default_profile_transition"/>
</context>
<context name="_t_profile_name_quoted" attribute="Transition Profile Name" lineEndContext="#pop!_default_rule_with_comments">
<DetectChar context="#pop!_default_rule_with_comments" attribute="Transition Profile Name" char="""/>
<IncludeRules context="_default_profile_transition"/>
</context>
<context name="_default_profile_transition" attribute="Transition Profile Name" lineEndContext="#stay">
<IncludeRules context="_variable_simple"/>
<AnyChar context="#stay" attribute="Globbing Char in Tran. Prof." String="&globbChars;"/>
<IncludeRules context="_profile_transition_escape"/>
<RegExpr context="#stay" attribute="Hat Operator in Tran. Prof." String="//(?=[^&noPathChar;/])"/>
</context>
<!-- Change Hat / Child Profile (name//HAT).
NOTE: Old style (name^HAT) not included -->
<context name="_hat_path" attribute="Path" lineEndContext="#pop">
<RegExpr context="#pop" attribute="Path" String="/(?=/&endPath;)"/>
<RegExpr context="#pop!_hat_path_content" attribute="SubProfile/Hat Operator" String="//(?=([^\s"/\\]|\\.)+([\s"]|$))"/>
<DetectChar context="#pop" attribute="Path" char="/"/>
</context>
<context name="_hat_path_parentheses" attribute="Path" lineEndContext="#pop">
<RegExpr context="#pop!_hat_path_parentheses_content" attribute="SubProfile/Hat Operator" String="//(?=([^&noPathChar;/\\,]|\\.)+([&noPathChar;,]|$))"/>
<DetectChar context="#pop" attribute="Path" char="/"/>
</context>
<context name="_hat_path_quoted" attribute="Text Quoted" lineEndContext="#pop">
<RegExpr context="#pop!_hat_path_quoted_content" attribute="SubProfile/Hat Operator" String="//(?=([^"/\\]|\\.)+")"/>
<DetectChar context="#pop" attribute="Text Quoted" char="/"/>
</context>
<context name="_hat_path_content" attribute="SubProfile/Hat" lineEndContext="#pop">
<RegExpr context="#pop" String="&endPath;" lookAhead="true"/> <!-- End Path -->
<IncludeRules context="_default_path"/>
</context>
<context name="_hat_path_parentheses_content" attribute="SubProfile/Hat" lineEndContext="#pop">
<DetectChar context="#pop" char="," lookAhead="true"/> <!-- End Path -->
<IncludeRules context="_default_path"/>
</context>
<context name="_hat_path_quoted_content" attribute="SubProfile/Hat" lineEndContext="#pop">
<DetectChar context="#pop" char=""" lookAhead="true"/>
<IncludeRules context="_default_quoted"/>
</context>
<!-- Parentheses Block: ( )
NOTE: Here special contexts are used for paths, strings and brackets. The "," character acts as a delimiter. -->
<context name="_common_parentheses_block" attribute="Normal Text" lineEndContext="#stay">
<DetectChar context="#pop" attribute="Normal Text" char=")"/>
<!-- Highlight as path the text after the '=' operator, except keywords or simple words ([\w\-\+]+) -->
<RegExpr context="#stay" attribute="Error" String="\=(?=\s*($|[,\)]))"/>
<RegExpr context="_parentheses_path_content" attribute="Operator 1" String="\=\s*(?=[^\s"\(\),]*[^&noPathChar;\]\}\=\w\+\-\(,])"/>
<DetectChar context="_parentheses_path_content" attribute="Path" char="/" lookAhead="true"/>
<Detect2Chars context="_parentheses_variable" attribute="Variable" char="@" char1="{" lookAhead="true"/>
<IncludeRules context="_common"/>
<DetectChar context="_round_brackets" attribute="Globbing Brackets" char="("/>
<DetectChar context="_p_curly_brackets" attribute="Globbing Brackets" char="{"/>
<DetectChar context="_p_square_brackets" attribute="Globbing Brackets" char="["/>
<IncludeRules context="_comment_not_allowed"/>
</context>
<context name="_parentheses_block_profile" attribute="Normal Text" lineEndContext="#stay">
<keyword context="#stay" attribute="Flags" String="profile_flags"/>
<!-- Used by xattrs -->
<RegExpr context="#stay" attribute="Other Option" String="\b[a-zA-Z](\.?[\w\-])*(?=\s*\=)"/>
<IncludeRules context="_common_parentheses_block"/>
<IncludeRules context="_end_rule_irnc"/>
</context>
<!-- Parentheses Block within Rules -->
<context name="_default_parentheses_block_rule" attribute="Normal Text" lineEndContext="#stay">
<IncludeRules context="_common_parentheses_block"/>
<IncludeRules context="_end_rule_irnc_parentheses_rule"/>
</context>
<!-- Finding the end of a rule -->
<context name="_end_rule" attribute="Normal Text" lineEndContext="#stay">
<RegExpr context="#stay" attribute="Normal Text" String=",(?=(\)|[\w\-]+[^\s\w\-,#\("]))"/> <!-- Fix possible incorrect rule closures -->
<DetectChar context="#pop" attribute="End of Rule Char" char="," endRegion="Rule"/>
<IncludeRules context="_end_rule_irnc"/>
</context>
<!-- Rule/Profile on new line, in rule not closed -->
<context name="_end_rule_irnc" attribute="Normal Text" lineEndContext="#stay">
<keyword String="profile_head" context="#pop!_profile_name" attribute="Profile Head Error" firstNonSpace="true" endRegion="Rule"/>
<keyword String="access_types" context="#pop" attribute="Access Qualifier Error" firstNonSpace="true" endRegion="Rule"/>
<keyword String="qualifiers" context="#pop" attribute="Qualifier Error" firstNonSpace="true" endRegion="Rule"/>
<keyword String="file_qualifiers" context="#pop" attribute="File Qualifier Error" firstNonSpace="true" endRegion="Rule"/>
<RegExpr String="set(?=\s+rlimit\b)" context="#pop" attribute="Rule Error" firstNonSpace="true" endRegion="Rule"/>
<keyword String="rule_name_file" context="#pop!_rule_file" attribute="Rule Error" firstNonSpace="true" endRegion="Rule" beginRegion="Rule"/>
<keyword String="rule_name_capability" context="#pop!_rule_capability" attribute="Rule Error" firstNonSpace="true" endRegion="Rule" beginRegion="Rule"/>
<keyword String="rule_name_network" context="#pop!_rule_network" attribute="Rule Error" firstNonSpace="true" endRegion="Rule" beginRegion="Rule"/>
<keyword String="rule_name_pivotroot" context="#pop!_rule_pivotroot" attribute="Rule Error" firstNonSpace="true" endRegion="Rule" beginRegion="Rule"/>
<keyword String="rule_name_ptrace" context="#pop!_rule_ptrace" attribute="Rule Error" firstNonSpace="true" endRegion="Rule" beginRegion="Rule"/>
<keyword String="rule_name_signal" context="#pop!_rule_signal" attribute="Rule Error" firstNonSpace="true" endRegion="Rule" beginRegion="Rule"/>
<keyword String="rule_name_dbus" context="#pop!_rule_dbus" attribute="Rule Error" firstNonSpace="true" endRegion="Rule" beginRegion="Rule"/>
<keyword String="rule_name_link" context="#pop!_rule_link" attribute="Rule Error" firstNonSpace="true" endRegion="Rule" beginRegion="Rule"/>
<keyword String="rule_name_changeprofile" context="#pop!_rule_changeprofile" attribute="Rule Error" firstNonSpace="true" endRegion="Rule" beginRegion="Rule"/>
<keyword String="rule_name_rlimit" context="#pop!_rule_rlimit" attribute="Rule Error" firstNonSpace="true" endRegion="Rule" beginRegion="Rule"/>
<!-- This must be at the end of each rule context, to avoid replacing the 'unix' & 'remount' keywords
('unix' is also a domain of the network rule; 'remount' is also a flag of the mount rule). -->
<keyword String="rule_name_mount" context="#pop!_rule_mount" attribute="Rule Error" firstNonSpace="true" endRegion="Rule" beginRegion="Rule"/>
<keyword String="rule_name_unix" context="#pop!_rule_unix" attribute="Rule Error" firstNonSpace="true" endRegion="Rule" beginRegion="Rule"/>
<!-- Not included: alias rule -->
</context>
<!-- For blocks of parentheses within rules (the same keywords as "_end_rule_irnc"!) -->
<context name="_end_rule_irnc_parentheses_rule" attribute="Normal Text" lineEndContext="#stay">
<keyword String="profile_head" context="#pop" attribute="Profile Head Error" lookAhead="true" firstNonSpace="true"/>
<keyword String="access_types" context="#pop" attribute="Access Qualifier Error" lookAhead="true" firstNonSpace="true"/>
<keyword String="qualifiers" context="#pop" attribute="Qualifier Error" lookAhead="true" firstNonSpace="true"/>
<keyword String="file_qualifiers" context="#pop" attribute="File Qualifier Error" lookAhead="true" firstNonSpace="true"/>
<RegExpr String="set(?=\s+rlimit\b)" context="#pop" attribute="Rule Error" lookAhead="true" firstNonSpace="true"/>
<keyword String="rule_name_file" context="#pop" attribute="Rule Error" lookAhead="true" firstNonSpace="true"/>
<keyword String="rule_name_capability" context="#pop" attribute="Rule Error" lookAhead="true" firstNonSpace="true"/>
<keyword String="rule_name_network" context="#pop" attribute="Rule Error" lookAhead="true" firstNonSpace="true"/>
<keyword String="rule_name_pivotroot" context="#pop" attribute="Rule Error" lookAhead="true" firstNonSpace="true"/>
<keyword String="rule_name_ptrace" context="#pop" attribute="Rule Error" lookAhead="true" firstNonSpace="true"/>
<keyword String="rule_name_signal" context="#pop" attribute="Rule Error" lookAhead="true" firstNonSpace="true"/>
<keyword String="rule_name_dbus" context="#pop" attribute="Rule Error" lookAhead="true" firstNonSpace="true"/>
<keyword String="rule_name_link" context="#pop" attribute="Rule Error" lookAhead="true" firstNonSpace="true"/>
<keyword String="rule_name_changeprofile" context="#pop" attribute="Rule Error" lookAhead="true" firstNonSpace="true"/>
<keyword String="rule_name_rlimit" context="#pop" attribute="Rule Error" lookAhead="true" firstNonSpace="true"/>
<!-- Keep at the end to avoid conflicts! -->
<keyword String="rule_name_mount" context="#pop" attribute="Rule Error" lookAhead="true" firstNonSpace="true"/>
<keyword String="rule_name_unix" context="#pop" attribute="Rule Error" lookAhead="true" firstNonSpace="true"/>
<!-- Not included: alias rule -->
</context>
<!-- Paths & File Globals -->
<context name="_find_path" attribute="Normal Text" lineEndContext="#stay">
<DetectChar context="_path_content" attribute="Path" char="/" lookAhead="true"/>
<RegExpr context="_path_content" String=":([^:&noPathChar;\(\\]|\\.)+:" lookAhead="true"/> <!-- :namespace: -->
</context>
<context name="_path_content" attribute="Path" lineEndContext="#pop">
<RegExpr context="#pop" String="&endPath;" lookAhead="true"/>
<IncludeRules context="_default_path"/>
<Detect2Chars context="_hat_path" char="/" char1="/" lookAhead="true"/>
</context>
<context name="_parentheses_path_content" attribute="Path" lineEndContext="#pop">
<DetectChar context="#pop" char="," lookAhead="true"/>
<IncludeRules context="_default_path"/>
<Detect2Chars context="_hat_path_parentheses" char="/" char1="/" lookAhead="true"/>
</context>
<context name="_default_path" attribute="Path" lineEndContext="#pop">
<DetectSpaces context="#pop" lookAhead="true"/>
<AnyChar context="#pop" String="&noPathCharWithoutSpace;" lookAhead="true"/>
<IncludeRules context="_variable_simple"/>
<IncludeRules context="_path_globbing"/>
</context>
<!-- Globbing -->
<context name="_path_globbing" attribute="Normal Text" lineEndContext="#stay">
<IncludeRules context="_brackets_error"/>
<DetectChar context="_curly_brackets" attribute="Globbing Brackets" char="{"/>
<DetectChar context="_square_brackets" attribute="Globbing Brackets" char="["/>
<DetectChar context="_round_brackets" attribute="Globbing Brackets" char="("/>
<IncludeRules context="_path_globbing_chars"/>
</context>
<context name="_path_globbing_chars" attribute="Normal Text" lineEndContext="#stay">
<AnyChar context="#stay" attribute="Globbing Char" String="&globbChars;"/>
<IncludeRules context="_escape"/>
</context>
<!-- Escapes: Hexadecimal (\xNN), decimal (\dNNN) & octal (\NNN). Also make literal any character.
NOTE: Reserved character escape sequences: \\"aefnrt0 -->
<context name="_escape" attribute="Normal Text" lineEndContext="#stay">
<RegExpr context="#stay" attribute="Escape Char" String="\\(x[a-fA-F\d]{1,2}|d\d{1,3}|[0-3][0-7]{0,2}|[4-7][0-7]?|.)"/>
</context>
<context name="_profile_transition_escape" attribute="Transition Profile Name" lineEndContext="#stay">
<RegExpr context="#stay" attribute="Globbing Char in Tran. Prof." String="\\(x[a-fA-F\d]{1,2}|d\d{1,3}|[0-3][0-7]{0,2}|[4-7][0-7]?|.)"/>
</context>
<!-- Groups of brackets: { }, [ ] and ( ) -->
<context name="_curly_brackets" attribute="Globbing Brackets" lineEndContext="#pop">
<DetectChar context="#pop" attribute="Globbing Brackets" char="}"/>
<RegExpr context="#stay" attribute="Open Globbing Brackets" String="[^&noPathChar;\(\[\{\}\\](?=[&noPathChar;]|$)"/>
<IncludeRules context="_default_path"/>
<IncludeRules context="_default_curly_brackets"/>
</context>
<context name="_square_brackets" attribute="Globbing Brackets" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!_square_brackets_content">
<RegExpr context="#pop!_square_brackets_content" attribute="Globbing Char of Brackets" String="\^(?=[^\s\]"])"/>
</context>
<context name="_square_brackets_content" attribute="Globbing Brackets" lineEndContext="#pop">
<DetectChar context="#pop" attribute="Globbing Brackets" char="]"/>
<DetectSpaces context="#pop" lookAhead="true"/>
<DetectChar context="#pop" char=""" lookAhead="true"/> <!-- &noPathChar; -->
<RegExpr context="#stay" attribute="Open Globbing Brackets" String="[^\s\[\]\\](?=["\s]|$)"/> <!-- &noPathChar; -->
<IncludeRules context="_default_square_brackets"/>
</context>
<context name="_round_brackets" attribute="Globbing Brackets" lineEndContext="#pop">
<DetectChar context="#pop" attribute="Globbing Brackets" char=")"/>
<RegExpr context="#stay" attribute="Open Globbing Brackets" String="[^&noPathChar;\(\[\{\\](?=["\s]|$)"/> <!-- &noPathChar; -->
<IncludeRules context="_default_path"/>
<IncludeRules context="_default_round_brackets"/>
</context>
<!-- Brackets quoted (allow spaces and line breaks) -->
<context name="_curly_brackets_quoted" attribute="Globbing Brackets" lineEndContext="#stay">
<DetectChar context="#pop" attribute="Globbing Brackets" char="}"/>
<DetectChar context="#pop" char=""" lookAhead="true"/>
<RegExpr context="#stay" attribute="Open Globbing Brackets" String="[^\s"\(\[\{\}\\](?=\s*")"/>
<IncludeRules context="_default_quoted"/>
<IncludeRules context="_default_curly_brackets"/>
</context>
<context name="_square_brackets_quoted" attribute="Globbing Brackets" lineEndContext="#pop!_square_brackets_content_quoted" fallthrough="true" fallthroughContext="#pop!_square_brackets_content_quoted">
<RegExpr context="#pop!_square_brackets_content_quoted" attribute="Globbing Char of Brackets" String="\^(?=[^\]"])"/>
</context>
<context name="_square_brackets_content_quoted" attribute="Globbing Brackets" lineEndContext="#stay">
<DetectChar context="#pop" attribute="Globbing Brackets" char="]"/>
<DetectChar context="#pop" char=""" lookAhead="true"/>
<RegExpr context="#stay" attribute="Open Globbing Brackets" String="[^\s"\[\]\\](?=\s*")"/>
<IncludeRules context="_default_square_brackets"/>
</context>
<context name="_round_brackets_quoted" attribute="Globbing Brackets" lineEndContext="#stay">
<DetectChar context="#pop" attribute="Globbing Brackets" char=")"/>
<DetectChar context="#pop" char=""" lookAhead="true"/>
<RegExpr context="#stay" attribute="Open Globbing Brackets" String="[^\s"\[\{\(\)\\](?=\s*")"/>
<IncludeRules context="_default_quoted"/>
<IncludeRules context="_default_round_brackets"/>
</context>
<context name="_default_curly_brackets" attribute="Globbing Brackets" lineEndContext="#stay">
<DetectChar context="#stay" attribute="Globbing Char of Brackets" char=","/>
<keyword context="#stay" String="default_variables"/>
</context>
<context name="_default_round_brackets" attribute="Globbing Brackets" lineEndContext="#stay">
<DetectChar context="#stay" attribute="Globbing Char of Brackets" char="|"/>
</context>
<context name="_default_square_brackets" attribute="Globbing Brackets" lineEndContext="#stay">
<IncludeRules context="_variable_simple"/>
<DetectChar context="#stay" attribute="Error" char="["/>
<IncludeRules context="_path_globbing_chars"/>
</context>
<context name="_brackets_error" attribute="Normal Text" lineEndContext="#stay">
<Detect2Chars context="#stay" attribute="Error" char="[" char1="]"/>
<Detect2Chars context="#stay" attribute="Error" char="{" char1="}"/>
<Detect2Chars context="#stay" attribute="Error" char="(" char1=")"/>
</context>
<!-- If the brackets are outside a path -->
<context name="_r_curly_brackets" attribute="Globbing Brackets" lineEndContext="#pop">
<DetectChar context="#pop!_find_path_after_variable" attribute="Globbing Brackets" char="}"/>
<IncludeRules context="_curly_brackets"/>
</context>
<context name="_r_square_brackets" attribute="Globbing Brackets" lineEndContext="#pop">
<DetectChar context="#pop!_find_path_after_variable" attribute="Globbing Brackets" char="]"/>
<IncludeRules context="_square_brackets"/>
</context>
<!-- In block of parentheses... -->
<context name="_p_curly_brackets" attribute="Globbing Brackets" lineEndContext="#pop">
<DetectChar context="#pop!_parentheses_find_path_after_variable" attribute="Globbing Brackets" char="}"/>
<IncludeRules context="_curly_brackets"/>
</context>
<context name="_p_square_brackets" attribute="Globbing Brackets" lineEndContext="#pop">
<DetectChar context="#pop!_parentheses_find_path_after_variable" attribute="Globbing Brackets" char="]"/>
<IncludeRules context="_square_brackets"/>
</context>
<!-- Path Quoted -->
<context name="_find_text_quoted" attribute="Normal Text" lineEndContext="#stay">
<DetectChar context="_quoted" attribute="Text Quoted" char="""/>
</context>
<context name="_quoted" attribute="Text Quoted" lineEndContext="#stay">
<DetectChar context="#pop" attribute="Text Quoted" char="""/>
<IncludeRules context="_default_quoted"/>
<Detect2Chars context="_hat_path_quoted" char="/" char1="/" lookAhead="true"/>
</context>
<context name="_default_quoted" attribute="Text Quoted" lineEndContext="#stay">
<IncludeRules context="_variable_simple"/>
<IncludeRules context="_brackets_error"/>
<DetectChar context="_curly_brackets_quoted" attribute="Globbing Brackets" char="{"/>
<DetectChar context="_square_brackets_quoted" attribute="Globbing Brackets" char="["/>
<DetectChar context="_round_brackets_quoted" attribute="Globbing Brackets" char="("/>
<IncludeRules context="_path_globbing_chars"/>
</context>
</contexts>
<itemDatas>
<itemData name="Normal Text" defStyleNum="dsNormal" spellChecking="false"/>
<itemData name="Path" defStyleNum="dsNormal" bold="0" spellChecking="false"/>
<itemData name="Text Quoted" defStyleNum="dsString" bold="0" spellChecking="false"/>
<itemData name="Comment" defStyleNum="dsComment"/>
<itemData name="URL in Comment" defStyleNum="dsComment" underline="1" spellChecking="false" />
<itemData name="Preprocessor" defStyleNum="dsPreprocessor" spellChecking="false"/>
<itemData name="Prep. Lib" defStyleNum="dsImport" underline="0" spellChecking="false"/>
<itemData name="Open Prep. Lib" defStyleNum="dsImport" underline="1" spellChecking="false"/>
<itemData name="Variable" defStyleNum="dsInformation" bold="0" spellChecking="false"/>
<itemData name="Profile Head" defStyleNum="dsFunction" bold="1" underline="0" spellChecking="false"/>
<itemData name="Profile Name" defStyleNum="dsFunction" bold="0" underline="0" spellChecking="false"/>
<itemData name="Qualifier" defStyleNum="dsKeyword" bold="1" underline="0" spellChecking="false"/>
<itemData name="Access Qualifier" defStyleNum="dsWarning" bold="1" underline="0" spellChecking="false"/>
<itemData name="File Qualifier" defStyleNum="dsVariable" bold="1" underline="0" spellChecking="false"/>
<itemData name="Rule" defStyleNum="dsVariable" bold="1" underline="0" spellChecking="false"/>
<itemData name="Data" defStyleNum="dsVariable" bold="0" spellChecking="false"/>
<itemData name="Other Data" defStyleNum="dsNormal" bold="0" italic="1" spellChecking="false"/>
<itemData name="Permissions" defStyleNum="dsNormal" bold="1" spellChecking="false"/>
<itemData name="Option" defStyleNum="dsOthers" bold="0" spellChecking="false"/>
<itemData name="Other Option" defStyleNum="dsAttribute" bold="0" spellChecking="false"/>
<itemData name="Flags" defStyleNum="dsVerbatimString" spellChecking="false"/>
<itemData name="SubProfile/Hat" defStyleNum="dsAnnotation" bold="0" spellChecking="false"/>
<itemData name="SubProfile/Hat Operator" defStyleNum="dsAnnotation" bold="1" spellChecking="false"/>
<itemData name="Operator 1" defStyleNum="dsOperator" spellChecking="false"/>
<itemData name="Operator 2" defStyleNum="dsWarning" bold="1" spellChecking="false"/>
<itemData name="Number" defStyleNum="dsDecVal" spellChecking="false"/>
<itemData name="Numerical Unit" defStyleNum="dsDecVal" bold="1" spellChecking="false"/>
<itemData name="End of Rule Char" defStyleNum="dsNormal" spellChecking="false"/>
<itemData name="Escape Char" defStyleNum="dsSpecialChar" bold="0" spellChecking="false"/>
<itemData name="Globbing Char" defStyleNum="dsSpecialChar" bold="0" spellChecking="false"/>
<itemData name="Globbing Char of Brackets" defStyleNum="dsBuiltIn" bold="0" spellChecking="false"/>
<itemData name="Globbing Brackets" defStyleNum="dsVerbatimString" bold="0" underline="0" spellChecking="false"/>
<itemData name="Open Globbing Brackets" defStyleNum="dsVerbatimString" bold="0" underline="1" spellChecking="false"/>
<itemData name="Transition Profile Name" defStyleNum="dsFunction" bold="0" italic="1" underline="0" spellChecking="false"/>
<itemData name="Globbing Char in Tran. Prof." defStyleNum="dsSpecialChar" bold="0" italic="1" spellChecking="false"/>
<itemData name="Hat Operator in Tran. Prof." defStyleNum="dsAnnotation" bold="1" italic="1" spellChecking="false"/>
<itemData name="Rule Error" defStyleNum="dsVariable" bold="1" underline="1" spellChecking="false"/>
<itemData name="Qualifier Error" defStyleNum="dsNormal" bold="1" underline="1" spellChecking="false"/>
<itemData name="Access Qualifier Error" defStyleNum="dsWarning" bold="1" underline="1" spellChecking="false"/>
<itemData name="File Qualifier Error" defStyleNum="dsVariable" bold="1" underline="1" spellChecking="false"/>
<itemData name="Profile Head Error" defStyleNum="dsFunction" bold="1" underline="1" spellChecking="false"/>
<itemData name="Profile Name Error" defStyleNum="dsFunction" bold="0" underline="1" spellChecking="false"/>
<itemData name="Error" defStyleNum="dsError" spellChecking="false"/>
</itemDatas>
</highlighting>
<general>
<!-- Keyword delimiters: .()<>=/\[]{},"'^;:| -->
<keywords casesensitive="true" additionalDeliminator=""'" weakDeliminator="!+-%*?~&"/>
<comments>
<comment name="singleLine" start="#"/>
</comments>
</general>
</language>
<!-- kate: replace-tabs off; tab-width 3; indent-width 3; remove-trailing-spaces mod; dynamic-word-wrap off; -->
``` | /content/code_sandbox/src/data/extra/syntax-highlighting/syntax/apparmor.xml | xml | 2016-10-05T07:24:54 | 2024-08-16T05:03:40 | vnote | vnotex/vnote | 11,687 | 22,435 |
```xml
/* eslint-env node */
import yargs from 'yargs/yargs';
import { Argv } from 'yargs';
import { hideBin } from 'yargs/helpers';
import serveCommand from './commands/serve';
import generateCommand from './commands/generate';
import validateCommand from './commands/validate';
import queryCommand from './commands/query';
import initCommand from './commands/init';
import injectReportCommand from './commands/injectReport';
import injectExtensionCommand from './commands/injectExtension';
import createCommand from './commands/create';
import vrulesCommand from './commands/validationRules';
const commands: Array<(yargs: Argv) => Argv> = [
serveCommand,
generateCommand,
validateCommand,
queryCommand,
injectReportCommand,
injectExtensionCommand,
initCommand,
createCommand,
vrulesCommand,
(yargs): Argv => yargs.strictCommands().demandCommand(1),
];
commands.reduce<Argv>((all, current) => current(all), yargs(hideBin(process.argv))).argv;
``` | /content/code_sandbox/packages/cli/src/index.ts | xml | 2016-11-30T14:09:21 | 2024-08-15T18:52:57 | statoscope | statoscope/statoscope | 1,423 | 219 |
```xml
/* eslint react/prop-types: "off" */
import { ToastMiddleware } from 'botframework-webchat-api';
import React from 'react';
import BasicToast from '../BasicToast';
function createToastMiddleware(): ToastMiddleware {
return () =>
() =>
({ notification }) => <BasicToast notification={notification} />;
}
export default createToastMiddleware;
``` | /content/code_sandbox/packages/component/src/Toast/createToastMiddleware.tsx | xml | 2016-07-07T23:16:57 | 2024-08-16T00:12:37 | BotFramework-WebChat | microsoft/BotFramework-WebChat | 1,567 | 74 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.