text stringlengths 9 39.2M | dir stringlengths 26 295 | lang stringclasses 185
values | created_date timestamp[us] | updated_date timestamp[us] | repo_name stringlengths 1 97 | repo_full_name stringlengths 7 106 | star int64 1k 183k | len_tokens int64 1 13.8M |
|---|---|---|---|---|---|---|---|---|
```xml
import * as Registry from 'native-reg';
import type {HKEY} from 'native-reg';
const appPath = `"${process.execPath}"`;
const regKeys = [
`Software\\Classes\\Directory\\Background\\shell\\Hyper`,
`Software\\Classes\\Directory\\shell\\Hyper`,
`Software\\Classes\\Drive\\shell\\Hyper`
];
const regParts = [
{key: 'command', name: '', value: `${appPath} "%V"`},
{name: '', value: 'Open &Hyper here'},
{name: 'Icon', value: `${appPath}`}
];
function addValues(hyperKey: HKEY, commandKey: HKEY) {
try {
Registry.setValueSZ(hyperKey, regParts[1].name, regParts[1].value);
} catch (error) {
console.error(error);
}
try {
Registry.setValueSZ(hyperKey, regParts[2].name, regParts[2].value);
} catch (err) {
console.error(err);
}
try {
Registry.setValueSZ(commandKey, regParts[0].name, regParts[0].value);
} catch (err_) {
console.error(err_);
}
}
export const add = () => {
regKeys.forEach((regKey) => {
try {
const hyperKey =
Registry.openKey(Registry.HKCU, regKey, Registry.Access.ALL_ACCESS) ||
Registry.createKey(Registry.HKCU, regKey, Registry.Access.ALL_ACCESS);
const commandKey =
Registry.openKey(Registry.HKCU, `${regKey}\\${regParts[0].key}`, Registry.Access.ALL_ACCESS) ||
Registry.createKey(Registry.HKCU, `${regKey}\\${regParts[0].key}`, Registry.Access.ALL_ACCESS);
addValues(hyperKey, commandKey);
Registry.closeKey(hyperKey);
Registry.closeKey(commandKey);
} catch (error) {
console.error(error);
}
});
};
export const remove = () => {
regKeys.forEach((regKey) => {
try {
Registry.deleteTree(Registry.HKCU, regKey);
} catch (err) {
console.error(err);
}
});
};
``` | /content/code_sandbox/app/utils/system-context-menu.ts | xml | 2016-07-01T06:01:21 | 2024-08-16T16:05:22 | hyper | vercel/hyper | 43,095 | 476 |
```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.
-->
<!DOCTYPE configuration>
<configuration scan="true" scanPeriod="10 seconds">
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{ISO8601} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<logger name="org" level="WARN"/>
<logger name="org.thingsboard.server" level="INFO"/>
<logger name="org.thingsboard.monitoring" level="INFO"/>
<logger name="org.thingsboard.monitoring.client" level="WARN"/>
<root level="INFO">
<appender-ref ref="STDOUT"/>
</root>
</configuration>
``` | /content/code_sandbox/monitoring/src/main/resources/logback.xml | xml | 2016-12-01T09:33:30 | 2024-08-16T19:58:25 | thingsboard | thingsboard/thingsboard | 16,820 | 211 |
```xml
<resources xmlns:tools="path_to_url">
<string name="crop__saving">Menyimpan gambar</string>
<string name="crop__wait">Silakan tunggu</string>
<string name="crop__pick_error">Tidak ada sumber gambar yang tersedia</string>
<string name="crop__done">SELESAI</string>
<string name="crop__cancel" tools:ignore="ButtonCase">BATAL</string>
</resources>
``` | /content/code_sandbox/DragSquare/crop/src/main/res/values-in/strings.xml | xml | 2016-05-27T07:13:04 | 2024-07-27T08:49:43 | DragRankSquare | xmuSistone/DragRankSquare | 1,113 | 107 |
```xml
/**
* A recreation of this demo: path_to_url
*/
import { Chart } from '@antv/g2';
import { median } from 'd3-array';
fetch('path_to_url
.then((res) => res.json())
.then((data) => {
const medianValue = median(data, (d) => d.value);
const chart = new Chart({
container: 'container',
autoFit: true,
});
chart
.line()
.data(data)
.scale('y', { nice: true })
.scale('x', { utc: true })
.scale('color', {
type: 'threshold',
domain: [medianValue],
range: ['black', 'red'],
})
.encode('x', (d) => new Date(d.date))
.encode('y', 'value')
.encode('shape', 'hvh')
.encode('color', 'value')
.encode('series', () => undefined)
.style('gradient', 'y')
.style('lineWidth', 1.5)
.style('lineJoin', 'round')
.axis('x', { title: 'date' });
chart.render();
});
``` | /content/code_sandbox/site/examples/general/line/demo/line-threshold.ts | xml | 2016-05-26T09:21:04 | 2024-08-15T16:11:17 | G2 | antvis/G2 | 12,060 | 263 |
```xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7702" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7701"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB">
<rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Powered by React Native" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye">
<rect key="frame" x="20" y="439" width="441" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="tech_stack" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
<rect key="frame" x="20" y="140" width="441" height="43"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="kId-c2-rCX" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="bottom" multiplier="1/3" constant="1" id="5cJ-9S-tgC"/>
<constraint firstAttribute="centerX" secondItem="kId-c2-rCX" secondAttribute="centerX" id="Koa-jz-hwk"/>
<constraint firstAttribute="bottom" secondItem="8ie-xW-0ye" secondAttribute="bottom" constant="20" id="Kzo-t9-V3l"/>
<constraint firstItem="8ie-xW-0ye" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="MfP-vx-nX0"/>
<constraint firstAttribute="centerX" secondItem="8ie-xW-0ye" secondAttribute="centerX" id="ZEH-qu-HZ9"/>
<constraint firstItem="kId-c2-rCX" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="fvb-Df-36g"/>
</constraints>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<point key="canvasLocation" x="548" y="455"/>
</view>
</objects>
</document>
``` | /content/code_sandbox/tech_stack/ios/tech_stack/Base.lproj/LaunchScreen.xib | xml | 2016-09-19T16:57:30 | 2024-08-06T14:29:02 | ReactNativeReduxCasts | StephenGrider/ReactNativeReduxCasts | 2,568 | 938 |
```xml
// Styles
import './VTabs.sass'
// Components
import { VTab } from './VTab'
import { VTabsWindow } from './VTabsWindow'
import { VTabsWindowItem } from './VTabsWindowItem'
import { makeVSlideGroupProps, VSlideGroup } from '@/components/VSlideGroup/VSlideGroup'
// Composables
import { useBackgroundColor } from '@/composables/color'
import { provideDefaults } from '@/composables/defaults'
import { makeDensityProps, useDensity } from '@/composables/density'
import { useProxiedModel } from '@/composables/proxiedModel'
import { useScopeId } from '@/composables/scopeId'
import { makeTagProps } from '@/composables/tag'
// Utilities
import { computed, toRef } from 'vue'
import { convertToUnit, genericComponent, isObject, propsFactory, useRender } from '@/util'
// Types
import type { PropType } from 'vue'
import { VTabsSymbol } from './shared'
export type TabItem = string | number | Record<string, any>
export type VTabsSlot = {
item: TabItem
}
export type VTabsSlots = {
default: never
tab: VTabsSlot
item: VTabsSlot
window: never
} & {
[key: `tab.${string}`]: VTabsSlot
[key: `item.${string}`]: VTabsSlot
}
function parseItems (items: readonly TabItem[] | undefined) {
if (!items) return []
return items.map(item => {
if (!isObject(item)) return { text: item, value: item }
return item
})
}
export const makeVTabsProps = propsFactory({
alignTabs: {
type: String as PropType<'start' | 'title' | 'center' | 'end'>,
default: 'start',
},
color: String,
fixedTabs: Boolean,
items: {
type: Array as PropType<readonly TabItem[]>,
default: () => ([]),
},
stacked: Boolean,
bgColor: String,
grow: Boolean,
height: {
type: [Number, String],
default: undefined,
},
hideSlider: Boolean,
sliderColor: String,
...makeVSlideGroupProps({
mandatory: 'force' as const,
selectedClass: 'v-tab-item--selected',
}),
...makeDensityProps(),
...makeTagProps(),
}, 'VTabs')
export const VTabs = genericComponent<VTabsSlots>()({
name: 'VTabs',
props: makeVTabsProps(),
emits: {
'update:modelValue': (v: unknown) => true,
},
setup (props, { attrs, slots }) {
const model = useProxiedModel(props, 'modelValue')
const items = computed(() => parseItems(props.items))
const { densityClasses } = useDensity(props)
const { backgroundColorClasses, backgroundColorStyles } = useBackgroundColor(toRef(props, 'bgColor'))
const { scopeId } = useScopeId()
provideDefaults({
VTab: {
color: toRef(props, 'color'),
direction: toRef(props, 'direction'),
stacked: toRef(props, 'stacked'),
fixed: toRef(props, 'fixedTabs'),
sliderColor: toRef(props, 'sliderColor'),
hideSlider: toRef(props, 'hideSlider'),
},
})
useRender(() => {
const slideGroupProps = VSlideGroup.filterProps(props)
const hasWindow = !!(slots.window || props.items.length > 0)
return (
<>
<VSlideGroup
{ ...slideGroupProps }
v-model={ model.value }
class={[
'v-tabs',
`v-tabs--${props.direction}`,
`v-tabs--align-tabs-${props.alignTabs}`,
{
'v-tabs--fixed-tabs': props.fixedTabs,
'v-tabs--grow': props.grow,
'v-tabs--stacked': props.stacked,
},
densityClasses.value,
backgroundColorClasses.value,
props.class,
]}
style={[
{ '--v-tabs-height': convertToUnit(props.height) },
backgroundColorStyles.value,
props.style,
]}
role="tablist"
symbol={ VTabsSymbol }
{ ...scopeId }
{ ...attrs }
>
{ slots.default?.() ?? items.value.map(item => (
slots.tab?.({ item }) ?? (
<VTab
{ ...item }
key={ item.text }
value={ item.value }
v-slots={{
default: slots[`tab.${item.value}`] ? () => slots[`tab.${item.value}`]?.({ item }) : undefined,
}}
/>
)
))}
</VSlideGroup>
{ hasWindow && (
<VTabsWindow
v-model={ model.value }
key="tabs-window"
{ ...scopeId }
>
{ items.value.map(item => slots.item?.({ item }) ?? (
<VTabsWindowItem
value={ item.value }
v-slots={{
default: () => slots[`item.${item.value}`]?.({ item }),
}}
/>
))}
{ slots.window?.() }
</VTabsWindow>
)}
</>
)
})
return {}
},
})
export type VTabs = InstanceType<typeof VTabs>
``` | /content/code_sandbox/packages/vuetify/src/components/VTabs/VTabs.tsx | xml | 2016-09-12T00:39:35 | 2024-08-16T20:06:39 | vuetify | vuetifyjs/vuetify | 39,539 | 1,159 |
```xml
<n:ExWindow x:Class="ScreenToGif.Windows.Other.AutomatedTask"
xmlns="path_to_url"
xmlns:x="path_to_url"
xmlns:n="clr-namespace:ScreenToGif.Controls"
xmlns:c="clr-namespace:ScreenToGif.Util.Converters;assembly=ScreenToGif.Util"
xmlns:u="clr-namespace:ScreenToGif.Util"
xmlns:t="clr-namespace:ScreenToGif.ViewModel.Tasks;assembly=ScreenToGif.ViewModel"
Title="{DynamicResource S.Options.Tasks.Title}" Width="370" Height="400" MinWidth="350" MinHeight="300"
WindowStartupLocation="CenterScreen" SnapsToDevicePixels="True"
Icon="/Resources/Logo.ico" Loaded="Window_Loaded">
<n:ExWindow.CommandBindings>
<CommandBinding Command="{StaticResource Command.Ok}" CanExecute="Ok_CanExecute" Executed="Ok_Executed"/>
</n:ExWindow.CommandBindings>
<n:ExWindow.Resources>
<c:StringToStaticResource x:Key="StringToStaticResource"/>
<c:NullToVisibility x:Key="NullToVisibility"/>
<u:ComboBoxItemTemplateSelector x:Key="ItemSelector"/>
</n:ExWindow.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="35"/>
<RowDefinition/>
<RowDefinition Height="40"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0" Background="{DynamicResource Panel.Background.Level4}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Border Grid.Column="0" x:Name="MainBorder" Margin="6" Background="{StaticResource Vector.Add}" Width="23" Opacity="{DynamicResource Element.Opacity}"/>
<TextBlock Grid.Column="1" x:Name="TypeTextBlock" Text="{DynamicResource S.Add}" Margin="5" VerticalAlignment="Center"
FontFamily="Segoe UI Semilight" FontSize="18" Foreground="{DynamicResource Element.Foreground.Header}"/>
<ComboBox Grid.Column="2" x:Name="TypeComboBox" Margin="5,3" SelectedIndex="0" ItemTemplateSelector="{StaticResource ItemSelector}" SelectionChanged="TypeComboBox_Selected">
<u:ComboBoxItemTemplateSelector.SelectedTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="30"/>
<ColumnDefinition Width="1"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.Column="0" Background="{Binding Image, Converter={StaticResource StringToStaticResource}}" Width="14" Height="14" Margin="3,2,6,2"/>
<Separator Grid.Column="1" Width="1" Margin="0"/>
<TextBlock Grid.Column="2" Text="{Binding Kind}" Margin="10,0,2,0" Foreground="{DynamicResource Element.Foreground.Medium}" VerticalAlignment="Center"/>
</Grid>
</DataTemplate>
</u:ComboBoxItemTemplateSelector.SelectedTemplate>
<u:ComboBoxItemTemplateSelector.DropDownTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="30"/>
<ColumnDefinition Width="1"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.Column="0" Background="{Binding Image, Converter={StaticResource StringToStaticResource}}" Width="20" Height="20" Margin="3,3,6,3"/>
<Separator Grid.Column="1" Width="1" Margin="0"/>
<TextBlock Grid.Column="2" Text="{Binding Kind}" Margin="10,0,2,0" Foreground="{DynamicResource Element.Foreground.Medium}" VerticalAlignment="Center"/>
</Grid>
</DataTemplate>
</u:ComboBoxItemTemplateSelector.DropDownTemplate>
<t:BaseTaskViewModel Image="Vector.Info"/>
<t:MouseEventsViewModel Image="Vector.Cursor"/>
<t:KeyStrokesViewModel Image="Vector.Keyboard"/>
<t:DelayViewModel Image="Vector.Clock"/>
<t:ProgressViewModel Image="Vector.Progress"/>
<t:BorderViewModel Image="Vector.Border"/>
<t:ShadowViewModel Image="Vector.Shadow"/>
</ComboBox>
</Grid>
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto">
<ContentControl x:Name="MainPresenter" Focusable="False"/>
</ScrollViewer>
<TextBlock Grid.Row="1" FontSize="20" VerticalAlignment="Center" HorizontalAlignment="Center" TextAlignment="Center" TextWrapping="Wrap"
Foreground="{DynamicResource Element.Foreground.Gray192}" FontFamily="Segoe UI Semilight" Effect="{StaticResource Shadow.Background.Tiny}"
Visibility="{Binding ElementName=MainPresenter, Path=Content, Converter={StaticResource NullToVisibility}}">
<Run Text=""/>
<LineBreak/>
<Run Text="{DynamicResource S.Options.Tasks.SelectType.Info}"/>
</TextBlock>
<Grid Grid.Row="2" Background="{DynamicResource Panel.Background.Level3}">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="Auto" MinWidth="100"/>
<ColumnDefinition Width="Auto" MinWidth="100"/>
</Grid.ColumnDefinitions>
<n:ExtendedCheckBox Grid.Column="0" x:Name="EnabledCheckBox" Text="{DynamicResource S.Options.Tasks.Enable}" Margin="5,3" Visibility="Collapsed"
IsChecked="{Binding ElementName=MainPresenter, Path=Content.DataContext.IsEnabled, FallbackValue=True}"/>
<n:ExtendedButton Grid.Column="1" x:Name="OkButton" Text="{DynamicResource S.Ok}" Icon="{StaticResource Vector.Ok}" ContentHeight="18" ContentWidth="18"
Padding="4,0" Margin="5" Command="{StaticResource Command.Ok}"/>
<n:ExtendedButton Grid.Column="2" x:Name="CancelButton" Text="{DynamicResource S.Cancel}" Icon="{StaticResource Vector.Cancel}" ContentHeight="18" ContentWidth="18"
Padding="4,0" Margin="5" Click="CancelButton_Click" IsCancel="True"/>
</Grid>
</Grid>
</n:ExWindow>
``` | /content/code_sandbox/ScreenToGif/Windows/Other/AutomatedTask.xaml | xml | 2016-08-02T01:28:59 | 2024-08-16T05:33:15 | ScreenToGif | NickeManarin/ScreenToGif | 23,310 | 1,348 |
```xml
export * from './PatternsDotsDemo'
export * from './PatternsExample'
export * from './PatternsIllustrations'
export * from './PatternsLinesDemo'
export * from './PatternsSquaresDemo'
``` | /content/code_sandbox/website/src/components/guides/patterns/index.ts | xml | 2016-04-16T03:27:56 | 2024-08-16T03:38:37 | nivo | plouc/nivo | 13,010 | 42 |
```xml
import { ServerRegistrationModule } from './ServerRegistrationModule.types';
export default {
addListener: () => {},
removeListeners: () => {},
} as ServerRegistrationModule;
``` | /content/code_sandbox/packages/expo-notifications/src/ServerRegistrationModule.ts | xml | 2016-08-15T17:14:25 | 2024-08-16T19:54:44 | expo | expo/expo | 32,004 | 37 |
```xml
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":receiver-management" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="understand-plugin-framework" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
<option name="GRADLE_PROJECT_PATH" value=":receiver-management" />
</configuration>
</facet>
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<afterSyncTasks>
<task>generateDebugSources</task>
</afterSyncTasks>
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/test/debug" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/debug" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/mockable-android-23.jar" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/tmp" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 23 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="org.twodividedbyzero.idea.findbugs">
<option name="_basePreferences">
<map>
<entry key="property.analysisEffortLevel" value="default" />
<entry key="property.analyzeAfterAutoMake" value="false" />
<entry key="property.analyzeAfterCompile" value="false" />
<entry key="property.annotationGutterIconEnabled" value="true" />
<entry key="property.annotationSuppressWarningsClass" value="edu.umd.cs.findbugs.annotations.SuppressFBWarnings" />
<entry key="property.annotationTextRangeMarkupEnabled" value="true" />
<entry key="property.exportAsHtml" value="true" />
<entry key="property.exportAsXml" value="true" />
<entry key="property.exportBaseDir" value="" />
<entry key="property.exportCreateArchiveDir" value="false" />
<entry key="property.exportOpenBrowser" value="true" />
<entry key="property.minPriorityToReport" value="Medium" />
<entry key="property.runAnalysisInBackground" value="false" />
<entry key="property.showHiddenDetectors" value="false" />
<entry key="property.toolWindowToFront" value="true" />
</map>
</option>
<option name="_detectors">
<map>
<entry key="AppendingToAnObjectOutputStream" value="true" />
<entry key="AtomicityProblem" value="true" />
<entry key="BadAppletConstructor" value="false" />
<entry key="BadResultSetAccess" value="true" />
<entry key="BadSyntaxForRegularExpression" value="true" />
<entry key="BadUseOfReturnValue" value="true" />
<entry key="BadlyOverriddenAdapter" value="true" />
<entry key="BooleanReturnNull" value="true" />
<entry key="BuildInterproceduralCallGraph" value="false" />
<entry key="BuildObligationPolicyDatabase" value="true" />
<entry key="BuildStringPassthruGraph" value="true" />
<entry key="CallToUnsupportedMethod" value="false" />
<entry key="CalledMethods" value="true" />
<entry key="CheckCalls" value="false" />
<entry key="CheckExpectedWarnings" value="false" />
<entry key="CheckImmutableAnnotation" value="true" />
<entry key="CheckRelaxingNullnessAnnotation" value="true" />
<entry key="CheckTypeQualifiers" value="true" />
<entry key="CloneIdiom" value="true" />
<entry key="ComparatorIdiom" value="true" />
<entry key="ConfusedInheritance" value="true" />
<entry key="ConfusionBetweenInheritedAndOuterMethod" value="true" />
<entry key="CovariantArrayAssignment" value="false" />
<entry key="CrossSiteScripting" value="true" />
<entry key="DefaultEncodingDetector" value="true" />
<entry key="DoInsideDoPrivileged" value="true" />
<entry key="DontCatchIllegalMonitorStateException" value="true" />
<entry key="DontIgnoreResultOfPutIfAbsent" value="true" />
<entry key="DontUseEnum" value="true" />
<entry key="DroppedException" value="true" />
<entry key="DumbMethodInvocations" value="true" />
<entry key="DumbMethods" value="true" />
<entry key="DuplicateBranches" value="true" />
<entry key="EmptyZipFileEntry" value="false" />
<entry key="EqualsOperandShouldHaveClassCompatibleWithThis" value="true" />
<entry key="ExplicitSerialization" value="true" />
<entry key="FieldItemSummary" value="true" />
<entry key="FinalizerNullsFields" value="true" />
<entry key="FindBadCast2" value="true" />
<entry key="FindBadForLoop" value="true" />
<entry key="FindBugsSummaryStats" value="true" />
<entry key="FindCircularDependencies" value="false" />
<entry key="FindComparatorProblems" value="true" />
<entry key="FindDeadLocalStores" value="true" />
<entry key="FindDoubleCheck" value="true" />
<entry key="FindEmptySynchronizedBlock" value="true" />
<entry key="FindFieldSelfAssignment" value="true" />
<entry key="FindFinalizeInvocations" value="true" />
<entry key="FindFloatEquality" value="true" />
<entry key="FindFloatMath" value="false" />
<entry key="FindHEmismatch" value="true" />
<entry key="FindInconsistentSync2" value="true" />
<entry key="FindJSR166LockMonitorenter" value="true" />
<entry key="FindLocalSelfAssignment2" value="true" />
<entry key="FindMaskedFields" value="true" />
<entry key="FindMismatchedWaitOrNotify" value="true" />
<entry key="FindNakedNotify" value="true" />
<entry key="FindNoSideEffectMethods" value="true" />
<entry key="FindNonSerializableStoreIntoSession" value="false" />
<entry key="FindNonSerializableValuePassedToWriteObject" value="false" />
<entry key="FindNonShortCircuit" value="true" />
<entry key="FindNullDeref" value="true" />
<entry key="FindNullDerefsInvolvingNonShortCircuitEvaluation" value="true" />
<entry key="FindOpenStream" value="true" />
<entry key="FindPuzzlers" value="true" />
<entry key="FindRefComparison" value="true" />
<entry key="FindReturnRef" value="true" />
<entry key="FindRoughConstants" value="true" />
<entry key="FindRunInvocations" value="true" />
<entry key="FindSelfComparison" value="true" />
<entry key="FindSelfComparison2" value="true" />
<entry key="FindSleepWithLockHeld" value="true" />
<entry key="FindSpinLoop" value="true" />
<entry key="FindSqlInjection" value="true" />
<entry key="FindTwoLockWait" value="true" />
<entry key="FindUncalledPrivateMethods" value="true" />
<entry key="FindUnconditionalWait" value="true" />
<entry key="FindUninitializedGet" value="true" />
<entry key="FindUnrelatedTypesInGenericContainer" value="true" />
<entry key="FindUnreleasedLock" value="true" />
<entry key="FindUnsatisfiedObligation" value="true" />
<entry key="FindUnsyncGet" value="true" />
<entry key="FindUseOfNonSerializableValue" value="true" />
<entry key="FindUselessControlFlow" value="true" />
<entry key="FindUselessObjects" value="true" />
<entry key="FormatStringChecker" value="true" />
<entry key="FunctionsThatMightBeMistakenForProcedures" value="true" />
<entry key="HugeSharedStringConstants" value="true" />
<entry key="IDivResultCastToDouble" value="true" />
<entry key="IncompatMask" value="true" />
<entry key="InconsistentAnnotations" value="true" />
<entry key="InefficientIndexOf" value="false" />
<entry key="InefficientInitializationInsideLoop" value="false" />
<entry key="InefficientMemberAccess" value="false" />
<entry key="InefficientToArray" value="false" />
<entry key="InfiniteLoop" value="true" />
<entry key="InfiniteRecursiveLoop" value="true" />
<entry key="InheritanceUnsafeGetResource" value="true" />
<entry key="InitializationChain" value="true" />
<entry key="InitializeNonnullFieldsInConstructor" value="true" />
<entry key="InstantiateStaticClass" value="true" />
<entry key="IntCast2LongAsInstant" value="true" />
<entry key="InvalidJUnitTest" value="true" />
<entry key="IteratorIdioms" value="true" />
<entry key="LazyInit" value="true" />
<entry key="LoadOfKnownNullValue" value="true" />
<entry key="LostLoggerDueToWeakReference" value="true" />
<entry key="MethodReturnCheck" value="true" />
<entry key="Methods" value="true" />
<entry key="MultithreadedInstanceAccess" value="true" />
<entry key="MutableEnum" value="true" />
<entry key="MutableLock" value="true" />
<entry key="MutableStaticFields" value="true" />
<entry key="Naming" value="true" />
<entry key="Noise" value="false" />
<entry key="NoiseNullDeref" value="false" />
<entry key="NoteAnnotationRetention" value="true" />
<entry key="NoteCheckReturnValueAnnotations" value="true" />
<entry key="NoteDirectlyRelevantTypeQualifiers" value="true" />
<entry key="NoteJCIPAnnotation" value="true" />
<entry key="NoteNonNullAnnotations" value="false" />
<entry key="NoteNonnullReturnValues" value="false" />
<entry key="NoteSuppressedWarnings" value="true" />
<entry key="NoteUnconditionalParamDerefs" value="true" />
<entry key="NumberConstructor" value="true" />
<entry key="OptionalReturnNull" value="true" />
<entry key="OverridingEqualsNotSymmetrical" value="true" />
<entry key="PreferZeroLengthArrays" value="true" />
<entry key="PublicSemaphores" value="false" />
<entry key="QuestionableBooleanAssignment" value="true" />
<entry key="ReadOfInstanceFieldInMethodInvokedByConstructorInSuperclass" value="true" />
<entry key="ReadReturnShouldBeChecked" value="true" />
<entry key="RedundantConditions" value="true" />
<entry key="RedundantInterfaces" value="true" />
<entry key="ReflectiveClasses" value="true" />
<entry key="RepeatedConditionals" value="true" />
<entry key="ResolveAllReferences" value="false" />
<entry key="RuntimeExceptionCapture" value="true" />
<entry key="SerializableIdiom" value="true" />
<entry key="StartInConstructor" value="true" />
<entry key="StaticCalendarDetector" value="true" />
<entry key="StringConcatenation" value="true" />
<entry key="SuperfluousInstanceOf" value="true" />
<entry key="SuspiciousThreadInterrupted" value="true" />
<entry key="SwitchFallthrough" value="true" />
<entry key="SynchronizationOnSharedBuiltinConstant" value="true" />
<entry key="SynchronizeAndNullCheckField" value="true" />
<entry key="SynchronizeOnClassLiteralNotGetClass" value="true" />
<entry key="SynchronizingOnContentsOfFieldToProtectField" value="true" />
<entry key="TestASM" value="false" />
<entry key="TestDataflowAnalysis" value="false" />
<entry key="TestingGround" value="false" />
<entry key="TestingGround2" value="false" />
<entry key="TrainFieldStoreTypes" value="true" />
<entry key="TrainLongInstantfParams" value="true" />
<entry key="TrainNonNullAnnotations" value="true" />
<entry key="TrainUnconditionalDerefParams" value="true" />
<entry key="URLProblems" value="true" />
<entry key="UncallableMethodOfAnonymousClass" value="true" />
<entry key="UnnecessaryMath" value="true" />
<entry key="UnreadFields" value="true" />
<entry key="UselessSubclassMethod" value="false" />
<entry key="VarArgsProblems" value="true" />
<entry key="VolatileUsage" value="true" />
<entry key="WaitInLoop" value="true" />
<entry key="WrongMapIterator" value="true" />
<entry key="XMLFactoryBypass" value="true" />
</map>
</option>
<option name="_reportCategories">
<map>
<entry key="BAD_PRACTICE" value="true" />
<entry key="CORRECTNESS" value="true" />
<entry key="EXPERIMENTAL" value="true" />
<entry key="I18N" value="true" />
<entry key="MALICIOUS_CODE" value="true" />
<entry key="MT_CORRECTNESS" value="true" />
<entry key="PERFORMANCE" value="true" />
<entry key="SECURITY" value="true" />
<entry key="STYLE" value="true" />
</map>
</option>
</component>
</module>
``` | /content/code_sandbox/receiver-management/receiver-management.iml | xml | 2016-01-28T02:51:45 | 2024-08-16T11:36:48 | understand-plugin-framework | tiann/understand-plugin-framework | 2,633 | 4,984 |
```xml
<?xml version="1.0" encoding="UTF-8"?>
<definitions
xmlns="path_to_url"
xmlns:activiti="path_to_url"
targetNamespace="Examples">
<process id="dynamicServiceTask">
<startEvent id="theStart" />
<sequenceFlow id="flow1" sourceRef="theStart" targetRef="task1" />
<userTask id="task1" activiti:assignee="test" />
<sequenceFlow id="flow2" sourceRef="task1" targetRef="service" />
<serviceTask id="service" activiti:class="org.flowable.engine.test.bpmn.servicetask.DummyServiceTask" />
<sequenceFlow id="flow3" sourceRef="service" targetRef="task2" />
<userTask id="task2" activiti:assignee="test" />
<sequenceFlow id="flow4" sourceRef="task2" targetRef="theEnd" />
<endEvent id="theEnd" />
</process>
</definitions>
``` | /content/code_sandbox/modules/flowable-engine/src/test/resources/org/flowable/engine/test/bpmn/usertask/DisabledDefinitionInfoCacheTest.testChangeClassName.bpmn20.xml | xml | 2016-10-13T07:21:43 | 2024-08-16T15:23:14 | flowable-engine | flowable/flowable-engine | 7,715 | 237 |
```xml
import { Get, Route } from '@tsoa/runtime';
import { ModelService } from '../services/modelService';
import { TestModel } from '../testModel';
@Route()
export class PathlessGetTestController {
@Get('Current')
public async getCurrentModel(): Promise<TestModel> {
return new ModelService().getModel();
}
}
``` | /content/code_sandbox/tests/fixtures/controllers/pathlessGetController.ts | xml | 2016-06-17T10:42:50 | 2024-08-16T05:57:17 | tsoa | lukeautry/tsoa | 3,408 | 74 |
```xml
import { c } from 'ttag';
import { Button, Href } from '@proton/atoms';
import type { ModalProps } from '@proton/components';
import {
Form,
ModalTwo,
ModalTwoContent,
ModalTwoFooter,
ModalTwoHeader,
PrimaryButton,
useApi,
useEventManager,
useGetUserKeys,
useNotifications,
} from '@proton/components';
import type { PrivateKeyReference, PublicKeyReference } from '@proton/crypto';
import { useLoading } from '@proton/hooks';
import { addContacts, getContact, updateContact } from '@proton/shared/lib/api/contacts';
import { API_CODES, CONTACT_CARD_TYPE } from '@proton/shared/lib/constants';
import { pinKeyCreateContact, pinKeyUpdateContact } from '@proton/shared/lib/contacts/keyPinning';
import { getKnowledgeBaseUrl } from '@proton/shared/lib/helpers/url';
import type { Api } from '@proton/shared/lib/interfaces';
import type { ContactCard, ContactWithBePinnedPublicKey } from '@proton/shared/lib/interfaces/contacts';
import { splitKeys } from '@proton/shared/lib/keys/keys';
import SimplePublicKeyTable from './SimplePublicKeyTable';
interface ParamsUpdate {
contact: Required<ContactWithBePinnedPublicKey>;
api: Api;
publicKeys: PublicKeyReference[];
privateKeys: PrivateKeyReference[];
}
const updateContactPinnedKeys = async ({ contact, api, publicKeys, privateKeys }: ParamsUpdate) => {
const { contactID, emailAddress, bePinnedPublicKey, isInternal } = contact;
const {
Contact: { Cards: contactCards },
} = await api<{ Contact: { Cards: ContactCard[] } }>(getContact(contactID));
const hasSignedCard = !!contactCards.find(({ Type }) => Type === CONTACT_CARD_TYPE.SIGNED);
const hasEncryptedCard = !!contactCards.find(({ Type }) =>
[CONTACT_CARD_TYPE.ENCRYPTED, CONTACT_CARD_TYPE.ENCRYPTED_AND_SIGNED].includes(Type)
);
if (hasEncryptedCard && !hasSignedCard) {
throw new Error('Corrupted contact card data');
}
// If no signed card is present, that means the contact was created by the server,
// and we can simply create a new contact
const updatedContactCards = hasSignedCard
? await pinKeyUpdateContact({
contactCards,
emailAddress,
isInternal,
bePinnedPublicKey,
publicKeys,
privateKeys,
})
: await pinKeyCreateContact({
emailAddress,
isInternal,
bePinnedPublicKey,
privateKeys,
});
await api(updateContact(contactID, { Cards: updatedContactCards }));
};
interface ParamsCreate {
contact: ContactWithBePinnedPublicKey;
api: Api;
privateKeys: PrivateKeyReference[];
}
const createContactPinnedKeys = async ({ contact, api, privateKeys }: ParamsCreate) => {
const { emailAddress, name, isInternal, bePinnedPublicKey } = contact;
const contactCards = await pinKeyCreateContact({
emailAddress,
name,
isInternal,
bePinnedPublicKey,
privateKeys,
});
return api<{ Code: number; Responses: { Response: { Code: number } }[] }>(
addContacts({ Contacts: [{ Cards: contactCards }], Overwrite: 1, Labels: 0 })
);
};
interface Props extends ModalProps {
contact: ContactWithBePinnedPublicKey;
}
const TrustPublicKeyModal = ({ contact, ...rest }: Props) => {
const api = useApi();
const getUserKeys = useGetUserKeys();
const [loading, withLoading] = useLoading(false);
const { createNotification } = useNotifications();
const { call } = useEventManager();
const { onClose } = rest;
const isCreateContact = !contact.contactID;
const handleUpdateContact = async () => {
const { privateKeys: allPrivateKeys, publicKeys } = splitKeys(await getUserKeys());
const privateKeys = [allPrivateKeys[0]];
await updateContactPinnedKeys({
contact: contact as Required<ContactWithBePinnedPublicKey>,
api,
publicKeys,
privateKeys,
});
createNotification({ text: c('Success').t`Public key trusted`, type: 'success' });
void call(); // No await
onClose?.();
};
const handleCreateContact = async () => {
const { privateKeys: allPrivateKeys } = splitKeys(await getUserKeys());
const privateKeys = [allPrivateKeys[0]];
const {
Responses: [
{
Response: { Code },
},
],
} = await createContactPinnedKeys({ contact, api, privateKeys });
if (Code !== API_CODES.SINGLE_SUCCESS) {
createNotification({ text: c('Error').t`Public key could not be trusted`, type: 'error' });
onClose?.();
return;
}
createNotification({ text: c('Success').t`Public key trusted`, type: 'success' });
void call(); // No await
onClose?.();
};
const handleSubmit = isCreateContact ? handleCreateContact : handleUpdateContact;
const alertMessage = isCreateContact
? c('Key pinning')
.t`Clicking "Trust Key" will create a new contact and associate this public key with this sender. Emails from this address will be automatically cryptographically verified.`
: c('Key pinning')
.t`Clicking "Trust Key" will associate this public key with this sender and emails from this address will be automatically cryptographically verified.`;
return (
<ModalTwo as={Form} onSubmit={() => withLoading(handleSubmit())} size="xlarge" {...rest}>
<ModalTwoHeader title={c('Title').t`Trust public key?`} />
<ModalTwoContent>
<div className="mb-4">
<span className="mr-2">{alertMessage}</span>
<Href href={getKnowledgeBaseUrl('/address-verification')} className="inline-block">{c('Link')
.t`Learn more`}</Href>
</div>
<div className="mb-4">
<span className="mr-2">{c('Info')
.t`This public key will be automatically used for encrypting email sent to this address.`}</span>
<Href href={getKnowledgeBaseUrl('/how-to-use-pgp')} className="inline-block">{c('Link')
.t`Learn more`}</Href>
</div>
<div>
<SimplePublicKeyTable contact={contact} />
</div>
</ModalTwoContent>
<ModalTwoFooter>
<Button onClick={onClose}>{c('Action').t`Cancel`}</Button>
<PrimaryButton loading={loading} type="submit" data-testid="trust-key-modal:submit">
{c('Action').t`Trust key`}
</PrimaryButton>
</ModalTwoFooter>
</ModalTwo>
);
};
export default TrustPublicKeyModal;
``` | /content/code_sandbox/applications/mail/src/app/components/message/modals/TrustPublicKeyModal.tsx | xml | 2016-06-08T11:16:51 | 2024-08-16T14:14:27 | WebClients | ProtonMail/WebClients | 4,300 | 1,501 |
```xml
<!--
Description: entry rights - xhtml w/ escaped markup
-->
<feed xmlns="path_to_url">
<entry>
<rights type="xhtml"><div xmlns="path_to_url"><p>Entry Rights</p></div></rights>
</entry>
</feed>
``` | /content/code_sandbox/testdata/parser/atom/atom10_feed_entry_rights_xhtml_escaped_markup.xml | xml | 2016-01-23T02:44:34 | 2024-08-16T15:16:03 | gofeed | mmcdole/gofeed | 2,547 | 64 |
```xml
import { styled } from '@storybook/core/theming';
import { headerCommon, withReset } from '../lib/common';
export const H3 = styled.h3(withReset, headerCommon, ({ theme }) => ({
fontSize: `${theme.typography.size.m1}px`,
}));
``` | /content/code_sandbox/code/core/src/components/components/typography/elements/H3.tsx | xml | 2016-03-18T04:23:44 | 2024-08-16T19:22:08 | storybook | storybookjs/storybook | 83,755 | 57 |
```xml
/*************************************************************
*
*
* path_to_url
*
* Unless required by applicable law or agreed to in writing, software
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/
/**
* @fileoverview Macro and environment mappings for the mathtools package.
*
* @author v.sorge@mathjax.org (Volker Sorge)
* @author dpvc@mathjax.org (Davide P. Cervone)
*/
import ParseMethods from '../ParseMethods.js';
import {CommandMap, EnvironmentMap, DelimiterMap} from '../SymbolMap.js';
import {TexConstant} from '../TexConstants.js';
import {MathtoolsMethods} from './MathtoolsMethods.js';
//
// Mathtools macros that are not implemented:
//
// \smashoperator[pos]{operator with limits}
// \SwapAboveDisplaySkip
// \noeqref{label,label,. . . }
// \intertext{text }
// \shortintertext{text }
// \reDeclarePairedDelimiterInnerWrapper{macro name}{star or nostarnonscaled or nostarscaled}{code}
// \DeclareMathSizes{dimen}{dimen}{dimen}{dimen}
// \newgathered{name}{pre_line}{post_line}{after}
// \renewgathered{name}{pre_line}{post_line}{after}
//
/**
* The macros for this package.
*/
new CommandMap('mathtools-macros', {
shoveleft: ['HandleShove', TexConstant.Align.LEFT], // override AMS version
shoveright: ['HandleShove', TexConstant.Align.RIGHT], // override AMS version
xleftrightarrow: ['xArrow', 0x2194, 10, 10],
xLeftarrow: ['xArrow', 0x21D0, 12, 7],
xRightarrow: ['xArrow', 0x21D2, 7, 12],
xLeftrightarrow: ['xArrow', 0x21D4, 12, 12],
xhookleftarrow: ['xArrow', 0x21A9, 10, 5],
xhookrightarrow: ['xArrow', 0x21AA, 5, 10],
xmapsto: ['xArrow', 0x21A6, 10, 10],
xrightharpoondown: ['xArrow', 0x21C1, 5, 10],
xleftharpoondown: ['xArrow', 0x21BD, 10, 5],
xrightleftharpoons: ['xArrow', 0x21CC, 10, 10],
xrightharpoonup: ['xArrow', 0x21C0, 5, 10],
xleftharpoonup: ['xArrow', 0x21BC, 10, 5],
xleftrightharpoons: ['xArrow', 0x21CB, 10, 10],
mathllap: ['MathLap', 'l', false],
mathrlap: ['MathLap', 'r', false],
mathclap: ['MathLap', 'c', false],
clap: ['MtLap', 'c'],
textllap: ['MtLap', 'l'],
textrlap: ['MtLap', 'r'],
textclap: ['MtLap', 'c'],
cramped: 'Cramped',
crampedllap: ['MathLap', 'l', true],
crampedrlap: ['MathLap', 'r', true],
crampedclap: ['MathLap', 'c', true],
crampedsubstack: ['Macro', '\\begin{crampedsubarray}{c}#1\\end{crampedsubarray}', 1],
mathmbox: 'MathMBox',
mathmakebox: 'MathMakeBox',
overbracket: 'UnderOverBracket',
underbracket: 'UnderOverBracket',
refeq: 'HandleRef',
MoveEqLeft: ['Macro', '\\hspace{#1em}&\\hspace{-#1em}', 1, '2'],
Aboxed: 'Aboxed',
ArrowBetweenLines: 'ArrowBetweenLines',
vdotswithin: 'VDotsWithin',
shortvdotswithin: 'ShortVDotsWithin',
MTFlushSpaceAbove: 'FlushSpaceAbove',
MTFlushSpaceBelow: 'FlushSpaceBelow',
DeclarePairedDelimiter: 'DeclarePairedDelimiter',
DeclarePairedDelimiterX: 'DeclarePairedDelimiterX',
DeclarePairedDelimiterXPP: 'DeclarePairedDelimiterXPP',
//
// Typos from initial release -- kept for backward compatibility for now
//
DeclarePairedDelimiters: 'DeclarePairedDelimiter',
DeclarePairedDelimitersX: 'DeclarePairedDelimiterX',
DeclarePairedDelimitersXPP: 'DeclarePairedDelimiterXPP',
centercolon: ['CenterColon', true, true],
ordinarycolon: ['CenterColon', false],
MTThinColon: ['CenterColon', true, true, true],
coloneqq: ['Relation', ':=', '\u2254'],
Coloneqq: ['Relation', '::=', '\u2A74'],
coloneq: ['Relation', ':-'],
Coloneq: ['Relation', '::-'],
eqqcolon: ['Relation', '=:', '\u2255'],
Eqqcolon: ['Relation', '=::'],
eqcolon: ['Relation', '-:', '\u2239'],
Eqcolon: ['Relation', '-::'],
colonapprox: ['Relation', ':\\approx'],
Colonapprox: ['Relation', '::\\approx'],
colonsim: ['Relation', ':\\sim'],
Colonsim: ['Relation', '::\\sim'],
dblcolon: ['Relation', '::', '\u2237'],
nuparrow: ['NArrow', '\u2191', '.06em'],
ndownarrow: ['NArrow', '\u2193', '.25em'],
bigtimes: ['Macro', '\\mathop{\\Large\\kern-.1em\\boldsymbol{\\times}\\kern-.1em}'],
splitfrac: ['SplitFrac', false],
splitdfrac: ['SplitFrac', true],
xmathstrut: 'XMathStrut',
prescript: 'Prescript',
newtagform: ['NewTagForm', false],
renewtagform: ['NewTagForm', true],
usetagform: 'UseTagForm',
adjustlimits: [
'MacroWithTemplate',
'\\mathop{{#1}\\vphantom{{#3}}}_{{#2}\\vphantom{{#4}}}\\mathop{{#3}\\vphantom{{#1}}}_{{#4}\\vphantom{{#2}}}',
4, , '_', , '_'
],
mathtoolsset: 'SetOptions'
}, MathtoolsMethods);
/**
* The environments for this package.
*/
new EnvironmentMap('mathtools-environments', ParseMethods.environment, {
dcases: ['Array', null, '\\{', '', 'll', null, '.2em', 'D'],
rcases: ['Array', null, '', '\\}', 'll', null, '.2em'],
drcases: ['Array', null, '', '\\}', 'll', null, '.2em', 'D'],
'dcases*': ['Cases', null, '{', '', 'D'],
'rcases*': ['Cases', null, '', '}'],
'drcases*': ['Cases', null, '', '}', 'D'],
'cases*': ['Cases', null, '{', ''],
'matrix*': ['MtMatrix', null, null, null],
'pmatrix*': ['MtMatrix', null, '(', ')'],
'bmatrix*': ['MtMatrix', null, '[', ']'],
'Bmatrix*': ['MtMatrix', null, '\\{', '\\}'],
'vmatrix*': ['MtMatrix', null, '\\vert', '\\vert'],
'Vmatrix*': ['MtMatrix', null, '\\Vert', '\\Vert'],
'smallmatrix*': ['MtSmallMatrix', null, null, null],
psmallmatrix: ['MtSmallMatrix', null, '(', ')', 'c'],
'psmallmatrix*': ['MtSmallMatrix', null, '(', ')'],
bsmallmatrix: ['MtSmallMatrix', null, '[', ']', 'c'],
'bsmallmatrix*': ['MtSmallMatrix', null, '[', ']'],
Bsmallmatrix: ['MtSmallMatrix', null, '\\{', '\\}', 'c'],
'Bsmallmatrix*': ['MtSmallMatrix', null, '\\{', '\\}'],
vsmallmatrix: ['MtSmallMatrix', null, '\\vert', '\\vert', 'c'],
'vsmallmatrix*': ['MtSmallMatrix', null, '\\vert', '\\vert'],
Vsmallmatrix: ['MtSmallMatrix', null, '\\Vert', '\\Vert', 'c'],
'Vsmallmatrix*': ['MtSmallMatrix', null, '\\Vert', '\\Vert'],
crampedsubarray: ['Array', null, null, null, null, '0em', '0.1em', 'S\'', 1],
multlined: 'MtMultlined',
spreadlines: ['SpreadLines', true],
lgathered: ['AmsEqnArray', null, null, null, 'l', null, '.5em', 'D'],
rgathered: ['AmsEqnArray', null, null, null, 'r', null, '.5em', 'D'],
}, MathtoolsMethods);
/**
* The delimiters for this package.
*/
new DelimiterMap('mathtools-delimiters', ParseMethods.delimiter, {
'\\lparen': '(',
'\\rparen': ')'
});
/**
* The special characters for this package.
*/
new CommandMap('mathtools-characters', {
':' : ['CenterColon', true]
}, MathtoolsMethods);
``` | /content/code_sandbox/ts/input/tex/mathtools/MathtoolsMappings.ts | xml | 2016-02-23T09:52:03 | 2024-08-16T04:46:50 | MathJax-src | mathjax/MathJax-src | 2,017 | 2,233 |
```xml
<?xml version="1.0" encoding="utf-8"?>
<!--
/* //device/apps/common/res/anim/slide_in_right.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.
*/
-->
<set xmlns:android="path_to_url">
<translate android:fromXDelta="50%p" android:toXDelta="0"
android:duration="@android:integer/config_shortAnimTime"/>
<alpha android:fromAlpha="0.0" android:toAlpha="1.0"
android:duration="@android:integer/config_shortAnimTime" />
</set>
``` | /content/code_sandbox/app/src/main/res/anim/slide_in_right.xml | xml | 2016-08-15T19:10:31 | 2024-08-16T19:34:19 | Aegis | beemdevelopment/Aegis | 8,651 | 151 |
```xml
import TraitManager from '..';
import CategoryView from '../../abstract/ModuleCategoryView';
import DomainViews from '../../domain_abstract/view/DomainViews';
import EditorModel from '../../editor/model/Editor';
import Trait from '../model/Trait';
import Traits from '../model/Traits';
import { TraitManagerConfigModule } from '../types';
import TraitView from './TraitView';
interface TraitsViewProps {
el?: HTMLElement;
collection: any[];
editor: EditorModel;
config: TraitManagerConfigModule;
}
const ATTR_CATEGORIES = 'data-categories';
const ATTR_NO_CATEGORIES = 'data-no-categories';
export default class TraitsView extends DomainViews {
reuseView = true;
em: EditorModel;
pfx: string;
ppfx: string;
renderedCategories = new Map<string, CategoryView>();
config: TraitManagerConfigModule;
traitContClass: string;
catsClass: string;
classNoCat: string;
catsEl?: HTMLElement;
traitsEl?: HTMLElement;
rendered?: boolean;
itemsView: TraitManager['types'];
collection: Traits;
constructor(props: TraitsViewProps, itemsView: TraitManager['types']) {
super(props);
this.itemsView = itemsView;
const config = props.config || {};
this.config = config;
const em = props.editor;
this.em = em;
const ppfx = config.pStylePrefix || '';
this.ppfx = ppfx;
this.pfx = ppfx + config.stylePrefix || '';
this.className = `${this.pfx}traits`;
this.traitContClass = `${ppfx}traits-c`;
this.classNoCat = `${ppfx}traits-empty-c`;
this.catsClass = `${ppfx}trait-categories`;
this.collection = new Traits([], { em });
this.listenTo(em, 'component:toggled', this.updatedCollection);
this.updatedCollection();
}
/**
* Update view collection
* @private
*/
updatedCollection() {
const { ppfx, em } = this;
const comp = em.getSelected();
this.el.className = `${this.traitContClass}s ${ppfx}one-bg ${ppfx}two-color`;
this.collection = comp?.traits || new Traits([], { em });
this.render();
}
/**
* Render new model inside the view
* @param {Model} model
* @param {Object} fragment Fragment collection
* @private
* */
add(model: Trait, fragment?: DocumentFragment) {
const { config, renderedCategories } = this;
let itemView = this.itemView;
const typeField = model.get(this.itemType as any);
if (this.itemsView && this.itemsView[typeField]) {
itemView = this.itemsView[typeField];
}
const view = new itemView({
config,
model,
attributes: model.get('attributes'),
});
const rendered = view.render().el;
const category = model.parent.initCategory(model);
if (category) {
const catId = category.getId();
const categories = this.getCategoriesEl();
let catView = renderedCategories.get(catId);
if (!catView && categories) {
catView = new CategoryView({ model: category }, config, 'trait').render();
renderedCategories.set(catId, catView);
categories.appendChild(catView.el);
}
catView?.append(rendered);
return;
}
fragment ? fragment.appendChild(rendered) : this.append(rendered);
}
getCategoriesEl() {
if (!this.catsEl) {
this.catsEl = this.el.querySelector(`[${ATTR_CATEGORIES}]`)!;
}
return this.catsEl;
}
getTraitsEl() {
if (!this.traitsEl) {
this.traitsEl = this.el.querySelector(`[${ATTR_NO_CATEGORIES}]`)!;
}
return this.traitsEl;
}
append(el: HTMLElement | DocumentFragment) {
const traits = this.getTraitsEl();
traits?.appendChild(el);
}
render() {
const { el, ppfx, catsClass, traitContClass, classNoCat } = this;
const frag = document.createDocumentFragment();
delete this.catsEl;
delete this.traitsEl;
this.renderedCategories = new Map();
el.innerHTML = `
<div class="${catsClass}" ${ATTR_CATEGORIES}></div>
<div class="${classNoCat} ${traitContClass}" ${ATTR_NO_CATEGORIES}></div>
`;
this.collection.forEach((model) => this.add(model, frag));
this.append(frag);
const cls = `${traitContClass}s ${ppfx}one-bg ${ppfx}two-color`;
this.$el.addClass(cls);
this.rendered = true;
return this;
}
}
TraitsView.prototype.itemView = TraitView;
``` | /content/code_sandbox/src/trait_manager/view/TraitsView.ts | xml | 2016-01-22T00:23:19 | 2024-08-16T11:20:59 | grapesjs | GrapesJS/grapesjs | 21,687 | 1,030 |
```xml
import {
getElementType,
useAutoControlled,
useStyles,
useUnhandledProps,
useFluentContext,
useTelemetry,
ForwardRefWithAs,
useMergedRefs,
useIsomorphicLayoutEffect,
} from '@fluentui/react-bindings';
import { handleRef, Ref } from '@fluentui/react-component-ref';
import * as customPropTypes from '@fluentui/react-proptypes';
import { indicatorBehavior, AccessibilityAttributes, getCode, keyboardKey, SpacebarKey } from '@fluentui/accessibility';
import * as React from 'react';
import * as PropTypes from 'prop-types';
import * as _ from 'lodash';
import cx from 'classnames';
import computeScrollIntoView from 'compute-scroll-into-view';
import { ShorthandRenderFunction, ShorthandValue, ShorthandCollection, FluentComponentStaticProps } from '../../types';
import Downshift, {
DownshiftState,
StateChangeOptions,
A11yStatusMessageOptions,
GetMenuPropsOptions,
GetPropsCommonOptions,
GetInputPropsOptions,
GetToggleButtonPropsOptions,
GetItemPropsOptions,
ControllerStateAndHelpers,
} from 'downshift';
import {
commonPropTypes,
UIComponentProps,
isFromKeyboard as detectIsFromKeyboard,
createShorthand,
setWhatInputSource,
} from '../../utils';
import { List, ListProps } from '../List/List';
import { DropdownItem, DropdownItemProps } from './DropdownItem';
import { DropdownSelectedItem, DropdownSelectedItemProps } from './DropdownSelectedItem';
import { DropdownSearchInput, DropdownSearchInputProps } from './DropdownSearchInput';
import { Button, ButtonProps } from '../Button/Button';
import { screenReaderContainerStyles } from '../../utils/accessibility/Styles/accessibilityStyles';
import { Box, BoxProps } from '../Box/Box';
import { Portal } from '../Portal/Portal';
import {
ALIGNMENTS,
POSITIONS,
Popper,
PositioningProps,
PopperShorthandProps,
partitionPopperPropsFromShorthand,
AutoSize,
AUTOSIZES,
} from '../../utils/positioner';
import { CloseIcon, ChevronDownIcon } from '@fluentui/react-icons-northstar';
export interface DownshiftA11yStatusMessageOptions<Item> extends Required<A11yStatusMessageOptions<Item>> {}
export interface DropdownSlotClassNames {
clearIndicator: string;
container: string;
toggleIndicator: string;
item: string;
itemsCount: string;
itemsList: string;
searchInput: string;
selectedItem: string;
selectedItems: string;
triggerButton: string;
}
export interface DropdownProps extends UIComponentProps<DropdownProps>, PositioningProps {
/** The index of the currently selected item, if the dropdown supports multiple selection. */
activeSelectedIndex?: number;
/** Whether the ComboBox allows freeform user input, rather than restricting to the provided options. */
allowFreeform?: boolean;
/** Identifies the element (or elements) that labels the current element. Will be passed to `triggerButton`. */
'aria-labelledby'?: AccessibilityAttributes['aria-labelledby'];
'aria-describedby'?: AccessibilityAttributes['aria-describedby'];
/** Indicates the entered value does not conform to the format expected by the application. Will be passed to `triggerButton`. */
'aria-invalid'?: AccessibilityAttributes['aria-invalid'];
/** A dropdown item can show a check indicator if it is selected. */
checkable?: boolean;
/** A slot for a selected indicator in the dropdown list. */
checkableIndicator?: ShorthandValue<BoxProps>;
/** A dropdown can be clearable to let users remove their selection. */
clearable?: boolean;
/** A slot for the clearing indicator. */
clearIndicator?: ShorthandValue<BoxProps>;
/** The initial value for the index of the currently selected item in a multiple selection. */
defaultActiveSelectedIndex?: number;
/** The initial value for 'open' in uncontrolled mode. */
defaultOpen?: boolean;
/** The initial list item index to highlight. */
defaultHighlightedIndex?: number;
/** The initial value for the search query if the dropdown has `search` enabled. */
defaultSearchQuery?: string;
/** The initial value (or value array if the array has multiple selection). */
defaultValue?: ShorthandValue<DropdownItemProps> | ShorthandCollection<DropdownItemProps>;
/** A dropdown can show that it cannot be interacted with. */
disabled?: boolean;
/** A dropdown can fill the width of its container. */
fluid?: boolean;
/** Object with callbacks for generating announcements for item selection and removal. */
getA11ySelectionMessage?: {
/**
* Callback that creates custom accessibility message a screen reader narrates on item added to selection.
* @param item - Dropdown added element.
*/
onAdd?: (item: ShorthandValue<DropdownItemProps>) => string;
/**
* Callback that creates custom accessibility message a screen reader narrates on item removed from selection.
* @param item - Dropdown removed element.
*/
onRemove?: (item: ShorthandValue<DropdownItemProps>) => string;
/**
* Callback that creates custom accessibility message about the selected items count a screen reader narrates on input field focus.
* @param count - number of items selected.
*/
itemsCount?: (count: number) => string;
};
/** A label for selected items listbox. */
a11ySelectedItemsMessage?: string;
/**
* Callback that provides status announcement message with number of items in the list, using Arrow Up/Down keys to navigate through them and, if multiple, using Arrow Left/Right to navigate through selected items.
* @param messageGenerationProps - Object with properties to generate message from. See getA11yStatusMessage from Downshift repo.
*/
getA11yStatusMessage?: (options: DownshiftA11yStatusMessageOptions<ShorthandValue<DropdownItemProps>>) => string;
/** A dropdown can highlight the first option when it opens. */
highlightFirstItemOnOpen?: boolean;
/** The index of the list item to highlight. */
highlightedIndex?: number;
/** A dropdown can be formatted to appear inline next to other elements. */
inline?: boolean;
/** A dropdown can have inverted colors. */
inverted?: boolean;
/** Array of props for generating list options (Dropdown.Item[]) and selected item labels (Dropdown.SelectedItem[]), if it's a multiple selection. */
items?: ShorthandCollection<DropdownItemProps>;
/**
* A function that converts an item to string. Used when dropdown has `search` enabled.
* By default, it:
* - returns the `header` property if it exists on an item
* - stringifies the item if it is a primitive type
*/
itemToString?: (item: ShorthandValue<DropdownItemProps>) => string;
/** Used when comparing two items in multiple selection. Default comparison is by the header prop. */
itemToValue?: (item: ShorthandValue<DropdownItemProps>) => any;
/** A message to be displayed in the list header. */
headerMessage?: ShorthandValue<DropdownItemProps>;
/** A slot for dropdown list. */
list?: ShorthandValue<ListProps & { popper?: PopperShorthandProps }>;
/** A dropdown can show that it is currently loading data. */
loading?: boolean;
/** A message to be displayed in the list when the dropdown is loading. */
loadingMessage?: ShorthandValue<DropdownItemProps>;
/** When selecting an element with Tab, focus stays on the dropdown by default. If true, the focus will jump to next/previous element in DOM. Only available to multiple selection dropdowns. */
moveFocusOnTab?: boolean;
/** A dropdown can allow a user to select multiple items. */
multiple?: boolean;
/** A message to be displayed in the list when the dropdown has no items. */
noResultsMessage?: ShorthandValue<DropdownItemProps>;
/**
* Called when the dropdown's selected items index change.
* @param event - React's original SyntheticEvent.
* @param data - All props and the new selected value(s).
*/
onActiveSelectedIndexChange?: (event: React.MouseEvent | React.KeyboardEvent | null, data: DropdownProps) => void;
/**
* Called when the dropdown's highlighted index change.
* @param event - React's original SyntheticEvent.
* @param data - All props and the new selected value(s).
*/
onHighlightedIndexChange?: (event: React.MouseEvent | React.KeyboardEvent | null, data: DropdownProps) => void;
/**
* Called when the dropdown opens or closes.
* @param event - React's original SyntheticEvent.
* @param data - All props, with `open` reflecting the new open state.
*/
onOpenChange?: (event: React.MouseEvent | React.KeyboardEvent | null, data: DropdownProps) => void;
/**
* Called when the dropdown's search query changes.
* @param event - React's original SyntheticEvent.
* @param data - All props, with `searchQuery` reflecting its new value.
*/
onSearchQueryChange?: (event: React.MouseEvent | React.KeyboardEvent | null, data: DropdownProps) => void;
/**
* Called when the dropdown's selected item(s) change.
* @param event - React's original SyntheticEvent.
* @param data - All props and the new selected value(s).
*/
onChange?: (event: React.MouseEvent | React.KeyboardEvent | null, data: DropdownProps) => void;
/**
* Called when the focus moves out from dropdown.
* @param event - React's original SyntheticEvent.
*/
onBlur?: (event: React.FocusEvent | null) => void;
/** A dropdown's open state can be controlled. */
open?: boolean;
/** A placeholder message for the input field. */
placeholder?: string;
/**
* A render function to customize how items are rendered in the dropdown.
*
* @param Component - The computed component for this slot.
* @param props - The computed props for this slot.
* @param children - The computed children for this slot.
*/
renderItem?: ShorthandRenderFunction<DropdownItemProps>;
/**
* A custom render function for the selected item. Only applicable with the `multiple` prop.
*
* @param Component - The computed component for this slot.
* @param props - The computed props for this slot.
* @param children - The computed children for this slot.
*/
renderSelectedItem?: ShorthandRenderFunction<DropdownSelectedItemProps>;
/** A dropdown can have a search field instead of trigger button. Can receive a custom search function that will replace the default equivalent. */
search?:
| boolean
| ((items: ShorthandCollection<DropdownItemProps>, searchQuery: string) => ShorthandCollection<DropdownItemProps>);
/** A search dropdown's input can be customized. */
searchInput?: ShorthandValue<DropdownSearchInputProps>;
/** Sets search query value (controlled mode). */
searchQuery?: string;
/** Controls the appearance of the indicator that shows/hides the list of items. */
toggleIndicator?: ShorthandValue<BoxProps>;
/** Controls the appearance of the trigger button if it's a selection dropdown (not a search). */
triggerButton?: ShorthandValue<ButtonProps>;
/** Sets the dropdown's currently selected value(s) in controlled mode. */
value?: ShorthandValue<DropdownItemProps> | ShorthandCollection<DropdownItemProps>;
/** Dropdown can have errors status */
error?: boolean;
}
export type DropdownStylesProps = Required<
Pick<DropdownProps, 'disabled' | 'error' | 'fluid' | 'inline' | 'inverted' | 'multiple' | 'position' | 'open'>
> & {
focused: boolean;
isEmptyClearIndicator: boolean;
hasToggleIndicator: boolean;
isFromKeyboard: boolean;
search: boolean;
hasItemsSelected: boolean;
};
type DropdownStateForInvoke = {
activeSelectedIndex?: number | null;
highlightedIndex?: number | null;
itemIsFromKeyboard?: boolean;
open?: boolean;
searchQuery?: string;
value?: ShorthandCollection<DropdownItemProps>;
};
export const dropdownClassName = 'ui-dropdown';
export const dropdownSlotClassNames: DropdownSlotClassNames = {
clearIndicator: `${dropdownClassName}__clear-indicator`,
container: `${dropdownClassName}__container`,
toggleIndicator: `${dropdownClassName}__toggle-indicator`,
item: `${dropdownClassName}__item`,
itemsCount: `${dropdownClassName}__items-count`,
itemsList: `${dropdownClassName}__items-list`,
searchInput: `${dropdownClassName}__searchinput`,
selectedItem: `${dropdownClassName}__selecteditem`,
selectedItems: `${dropdownClassName}__selected-items`,
triggerButton: `${dropdownClassName}__trigger-button`,
};
const a11yStatusCleanupTime = 500;
const charKeyPressedCleanupTime = 500;
/** `normalizedValue` should be normalized always as it can be received from props */
function normalizeValue(multiple: boolean, rawValue: DropdownProps['value']): ShorthandCollection<DropdownItemProps> {
const normalizedValue = Array.isArray(rawValue) ? rawValue : [rawValue];
if (multiple) {
return normalizedValue;
}
if (normalizedValue[0] === '') {
return [];
}
return normalizedValue.slice(0, 1);
}
/**
* Used to compute the filtered items (by value and search query) and, if needed,
* their string equivalents, in order to be used throughout the component.
*/
function getFilteredValues(
options: Required<
Pick<DropdownProps, 'multiple' | 'items' | 'itemToValue' | 'itemToString' | 'search' | 'searchQuery'>
> & {
value: ShorthandCollection<DropdownItemProps>;
},
) {
const { items, itemToString, itemToValue, multiple, search, searchQuery, value } = options;
const filteredItemsByValue = multiple ? _.differenceBy(items, value, itemToValue) : items;
const filteredItemStrings = _.map(filteredItemsByValue, filteredItem => itemToString(filteredItem).toLowerCase());
if (search) {
if (_.isFunction(search)) {
return {
filteredItems: search(filteredItemsByValue, searchQuery),
filteredItemStrings,
};
}
return {
filteredItems: filteredItemsByValue.filter(
item => itemToString(item).toLowerCase().indexOf(searchQuery.toLowerCase()) !== -1,
),
filteredItemStrings,
};
}
return {
filteredItems: filteredItemsByValue,
filteredItemStrings,
};
}
const isEmpty = prop => {
return typeof prop === 'object' && !prop.props && !_.get(prop, 'children') && !_.get(prop, 'content');
};
/**
* A Dropdown allows user to select one or more values from a list of options.
* Can be created with search and multi-selection capabilities.
*
* @accessibility
* Implements [ARIA Combo Box](path_to_url#combobox) design pattern, uses aria-live to announce state changes.
* @accessibilityIssues
* [Issue 991203: VoiceOver doesn't narrate properly elements in the input/combobox](path_to_url
* [JAWS - ESC (ESCAPE) not closing collapsible listbox (dropdown) on first time #528](path_to_url
*/
export const Dropdown = React.forwardRef<HTMLDivElement, DropdownProps>((props, ref) => {
const context = useFluentContext();
const { setStart, setEnd } = useTelemetry(Dropdown.displayName, context.telemetry);
setStart();
const {
'aria-labelledby': ariaLabelledby,
'aria-describedby': ariaDescribedby,
'aria-invalid': ariaInvalid,
allowFreeform,
clearable,
clearIndicator,
checkable,
checkableIndicator,
className,
design,
disabled,
error,
fluid,
getA11ySelectionMessage,
a11ySelectedItemsMessage,
getA11yStatusMessage,
inline,
inverted,
itemToString,
itemToValue,
items,
highlightFirstItemOnOpen,
multiple,
headerMessage,
moveFocusOnTab,
noResultsMessage,
loading,
loadingMessage,
placeholder,
renderItem,
renderSelectedItem,
search,
searchInput,
styles,
toggleIndicator,
triggerButton,
variables,
} = props;
const {
align,
flipBoundary,
overflowBoundary,
position,
positionFixed,
offset,
unstable_disableTether,
unstable_pinned,
autoSize,
} = props; // PositioningProps passed directly to Dropdown
const [list, positioningProps] = partitionPopperPropsFromShorthand(props.list); // PositioningProps passed to Dropdown `list` prop's `popper` key
const buttonRef = React.useRef<HTMLElement>();
const inputRef = React.useRef<HTMLInputElement | undefined>() as React.MutableRefObject<HTMLInputElement | undefined>;
const listRef = React.useRef<HTMLElement>();
const selectedItemsRef = React.useRef<HTMLDivElement>();
const containerRef = React.useRef<HTMLDivElement>();
const defaultTriggerButtonId = React.useMemo(() => _.uniqueId('dropdown-trigger-button-'), []);
const selectedItemsCountNarrationId = React.useMemo(() => _.uniqueId('dropdown-selected-items-count-'), []);
const ElementType = getElementType(props);
const unhandledProps = useUnhandledProps(Dropdown.handledProps, props);
const [activeSelectedIndex, setActiveSelectedIndex] = useAutoControlled<number | null | undefined>({
defaultValue: props.defaultActiveSelectedIndex,
initialValue: multiple ? null : undefined,
value: props.activeSelectedIndex,
});
const [highlightedIndex, setHighlightedIndex] = useAutoControlled<number | null>({
defaultValue: props.defaultHighlightedIndex,
initialValue: highlightFirstItemOnOpen ? 0 : null,
value: props.highlightedIndex,
});
const [open, setOpen] = useAutoControlled({
defaultValue: props.defaultOpen,
initialValue: false,
value: props.open,
});
const [searchQuery, setSearchQuery] = useAutoControlled<string | undefined>({
defaultValue: props.defaultSearchQuery,
initialValue: search ? '' : undefined,
value: props.searchQuery,
});
const [rawValue, setValue] = useAutoControlled({
defaultValue: props.defaultValue,
initialValue: [],
value: props.value,
});
const value = normalizeValue(multiple, rawValue);
const [a11ySelectionStatus, setA11ySelectionStatus] = React.useState('');
const [focused, setFocused] = React.useState(false);
const [isFromKeyboard, setIsFromKeyboard] = React.useState(false);
const [itemIsFromKeyboard, setItemIsFromKeyboard] = React.useState(false);
const [startingString, setStartingString] = React.useState<string | undefined>(search ? undefined : '');
// used for keeping track of the source of the input, as Downshift does not pass events to the handlers
// for free form dropdown:
// - if the value is changed based on search query change (from input), accept any value even if not in the list
// - if the value is changed based on selection from list, use the value from the list item
const inListbox = React.useRef(false);
const { filteredItems, filteredItemStrings } = getFilteredValues({
itemToString,
itemToValue,
items,
multiple,
search,
searchQuery,
value,
});
const { classes, styles: resolvedStyles } = useStyles<DropdownStylesProps>(Dropdown.displayName, {
className: dropdownClassName,
mapPropsToStyles: () => ({
disabled,
error,
fluid,
focused,
isEmptyClearIndicator: isEmpty(clearIndicator),
hasToggleIndicator: !!toggleIndicator,
inline,
inverted,
isFromKeyboard,
multiple,
open,
position: positioningProps?.position ?? position,
search: !!search,
hasItemsSelected: value.length > 0,
}),
mapPropsToInlineStyles: () => ({
className,
design,
styles,
variables,
}),
rtl: context.rtl,
});
const popperRef = useMergedRefs(props.popperRef);
useIsomorphicLayoutEffect(() => {
popperRef.current?.updatePosition();
}, [filteredItems?.length, popperRef]);
const clearA11ySelectionMessage = React.useMemo(
() =>
_.debounce(() => {
setA11ySelectionStatus('');
}, a11yStatusCleanupTime),
[],
);
const clearStartingString = React.useMemo(
() =>
_.debounce(() => {
setStartingString('');
}, charKeyPressedCleanupTime),
[],
);
const handleChange = (e: React.SyntheticEvent) => {
// Dropdown component doesn't present any `input` component in markup, however all of our
// components should handle events transparently.
_.invoke(props, 'onChange', e, { ...props, value });
};
const handleOnBlur = (e: React.SyntheticEvent) => {
// Dropdown component doesn't present any `input` component in markup, however all of our
// components should handle events transparently.
if (e.target !== buttonRef.current) {
_.invoke(props, 'onBlur', e, props);
}
};
const renderTriggerButton = (getToggleButtonProps: (options?: GetToggleButtonPropsOptions) => any): JSX.Element => {
const content = getSelectedItemAsString(value[0]);
const triggerButtonId = triggerButton['id'] || defaultTriggerButtonId;
const triggerButtonContentId = `${triggerButtonId}__content`;
const triggerButtonProps = getToggleButtonProps({
disabled,
onFocus: handleTriggerButtonOrListFocus,
onBlur: handleTriggerButtonBlur,
onKeyDown: e => {
handleTriggerButtonKeyDown(e);
},
'aria-invalid': ariaInvalid,
'aria-label': undefined,
'aria-labelledby': [ariaLabelledby, triggerButtonContentId].filter(Boolean).join(' '),
...(open && { 'aria-expanded': true }),
});
const { onClick, onFocus, onBlur, onKeyDown, ...restTriggerButtonProps } = triggerButtonProps;
return (
<Ref innerRef={buttonRef}>
{createShorthand(Button, triggerButton, {
defaultProps: () => ({
className: dropdownSlotClassNames.triggerButton,
disabled,
id: triggerButtonId,
fluid: true,
styles: resolvedStyles.triggerButton,
...restTriggerButtonProps,
}),
overrideProps: (predefinedProps: ButtonProps) => {
// It can be a shorthand
const resolvedContent = _.isPlainObject(predefinedProps.content)
? (predefinedProps.content as {})
: predefinedProps.content
? { children: predefinedProps.content }
: {};
return {
content:
// If `null` is passed we should not render the slot
predefinedProps.content === null ? null : { content, id: triggerButtonContentId, ...resolvedContent },
onClick: e => {
onClick(e);
_.invoke(predefinedProps, 'onClick', e, predefinedProps);
},
onFocus: e => {
onFocus(e);
_.invoke(predefinedProps, 'onFocus', e, predefinedProps);
},
onBlur: e => {
if (!disabled) {
onBlur(e);
}
_.invoke(predefinedProps, 'onBlur', e, predefinedProps);
},
onKeyDown: e => {
if (!disabled) {
onKeyDown(e);
}
_.invoke(predefinedProps, 'onKeyDown', e, predefinedProps);
},
};
},
})}
</Ref>
);
};
const renderSearchInput = (
accessibilityComboboxProps: Object,
highlightedIndex: number,
getInputProps: (options?: GetInputPropsOptions) => any,
selectItemAtIndex: (index: number, otherStateToSet?: Partial<StateChangeOptions<any>>, cb?: () => void) => void,
toggleMenu: () => void,
variables,
): JSX.Element => {
const noPlaceholder = searchQuery?.length > 0 || (multiple && value.length > 0);
const isMac = /Mac|iPod|iPhone|iPad/.test(navigator.platform);
const comboboxProps = isMac
? { ...accessibilityComboboxProps, 'aria-owns': undefined }
: accessibilityComboboxProps;
return DropdownSearchInput.create(searchInput || {}, {
defaultProps: () => ({
className: dropdownSlotClassNames.searchInput,
placeholder: noPlaceholder ? '' : placeholder,
inline,
variables,
disabled,
}),
overrideProps: handleSearchInputOverrides(
highlightedIndex,
selectItemAtIndex,
toggleMenu,
comboboxProps,
getInputProps,
),
});
};
const renderSelectedItemsCountNarration = id => {
// Get narration only if callback is provided, at least one item is selected and only in multiple case
if (!getA11ySelectionMessage || !getA11ySelectionMessage.itemsCount || value.length === 0 || !multiple) {
return null;
}
const narration = getA11ySelectionMessage.itemsCount(value.length);
return (
<span id={id} className={dropdownSlotClassNames.itemsCount} style={screenReaderContainerStyles}>
{narration}
</span>
);
};
const renderItemsList = (
highlightedIndex: number,
toggleMenu: () => void,
selectItemAtIndex: (index: number) => void,
getMenuProps: (options?: GetMenuPropsOptions, otherOptions?: GetPropsCommonOptions) => any,
getItemProps: (options: GetItemPropsOptions<ShorthandValue<DropdownItemProps>>) => any,
getInputProps: (options?: GetInputPropsOptions) => any,
) => {
const items = open ? renderItems(getItemProps) : [];
const { innerRef, ...accessibilityMenuProps } = getMenuProps({ refKey: 'innerRef' }, { suppressRefError: true });
// If it's just a selection, some attributes and listeners from Downshift input need to go on the menu list.
if (!search) {
const accessibilityInputProps = getInputProps();
accessibilityMenuProps['aria-activedescendant'] = accessibilityInputProps['aria-activedescendant'];
accessibilityMenuProps['onKeyDown'] = e => {
handleListKeyDown(e, highlightedIndex, accessibilityInputProps['onKeyDown'], toggleMenu, selectItemAtIndex);
};
}
return (
<Ref
innerRef={(listElement: HTMLElement) => {
handleRef(listRef, listElement);
handleRef(innerRef, listElement);
}}
>
<Popper
rtl={context.rtl}
enabled={open}
targetRef={containerRef}
positioningDependencies={[items.length]}
// positioning props:
align={align}
flipBoundary={flipBoundary}
overflowBoundary={overflowBoundary}
popperRef={popperRef}
position={position}
positionFixed={positionFixed}
offset={offset}
unstable_disableTether={unstable_disableTether}
unstable_pinned={unstable_pinned}
autoSize={autoSize}
{...positioningProps}
>
{List.create(list, {
defaultProps: () => ({
className: dropdownSlotClassNames.itemsList,
...accessibilityMenuProps,
styles: resolvedStyles.list,
items,
tabIndex: search ? undefined : -1, // needs to be focused when trigger button is activated.
'aria-hidden': !open,
}),
overrideProps: (predefinedProps: ListProps) => ({
onFocus: (e: React.SyntheticEvent<HTMLElement>, listProps: ListProps) => {
handleTriggerButtonOrListFocus();
_.invoke(predefinedProps, 'onClick', e, listProps);
},
onBlur: (e: React.SyntheticEvent<HTMLElement>, listProps: ListProps) => {
handleListBlur(e);
_.invoke(predefinedProps, 'onBlur', e, listProps);
},
}),
})}
</Popper>
</Ref>
);
};
const renderItems = (getItemProps: (options: GetItemPropsOptions<ShorthandValue<DropdownItemProps>>) => any) => {
const footerItem = renderItemsListFooter();
const headerItem = renderItemsListHeader();
const items = _.map(filteredItems, (item, index) => ({
children: () => {
const selected = value.indexOf(item) !== -1;
return DropdownItem.create(item, {
defaultProps: () => ({
className: dropdownSlotClassNames.item,
active: highlightedIndex === index,
selected,
checkable,
checkableIndicator,
isFromKeyboard: itemIsFromKeyboard,
variables,
...(typeof item === 'object' &&
!item.hasOwnProperty('key') && {
key: (item as any).header,
}),
}),
overrideProps: handleItemOverrides(item, index, getItemProps, selected),
render: renderItem,
});
},
}));
if (footerItem) {
items.push(footerItem);
}
return headerItem ? [headerItem, ...items] : items;
};
const renderItemsListHeader = () => {
if (headerMessage) {
return {
children: () =>
DropdownItem.create(headerMessage, {
defaultProps: () => ({
key: 'items-list-footer-message',
styles: resolvedStyles.headerMessage,
}),
}),
};
}
return null;
};
const renderItemsListFooter = () => {
if (loading) {
return {
children: () =>
DropdownItem.create(loadingMessage, {
defaultProps: () => ({
key: 'loading-message',
styles: resolvedStyles.loadingMessage,
}),
}),
};
}
if (filteredItems && filteredItems.length === 0) {
return {
children: () =>
DropdownItem.create(noResultsMessage, {
defaultProps: () => ({
key: 'no-results-message',
styles: resolvedStyles.noResultsMessage,
}),
}),
};
}
return null;
};
const selectedItemsCountNarration = renderSelectedItemsCountNarration(selectedItemsCountNarrationId);
const renderSelectedItems = () => {
if (value.length === 0) {
return null;
}
const selectedItems = value.map((item: DropdownItemProps, index) =>
// (!) an item matches DropdownItemProps
DropdownSelectedItem.create(item, {
defaultProps: () => ({
className: dropdownSlotClassNames.selectedItem,
active: isSelectedItemActive(index),
disabled,
variables,
...(typeof item === 'object' &&
!item.hasOwnProperty('key') && {
key: (item as any).header,
}),
}),
overrideProps: handleSelectedItemOverrides(item),
render: renderSelectedItem,
}),
);
return (
<>
<div role="listbox" tabIndex={-1} aria-label={a11ySelectedItemsMessage}>
{selectedItems}
</div>
{selectedItemsCountNarration}
</>
);
};
const downshiftStateReducer = (
state: DownshiftState<ShorthandValue<DropdownItemProps>>,
changes: StateChangeOptions<ShorthandValue<DropdownItemProps>>,
) => {
const activeElement: Element = context.target.activeElement;
switch (changes.type) {
case Downshift.stateChangeTypes.blurButton:
// Downshift closes the list by default on trigger blur. It does not support the case when dropdown is
// single selection and focuses list on trigger click/up/down/space/enter. Treating that here.
if (state.isOpen && activeElement === listRef.current) {
return {}; // won't change state in this case.
}
_.invoke(props, 'onBlur', null);
default:
return changes;
}
};
const handleInputValueChange = (
inputValue: string,
stateAndHelpers: ControllerStateAndHelpers<ShorthandValue<DropdownItemProps>>,
) => {
const itemSelected = stateAndHelpers.selectedItem && inputValue === itemToString(stateAndHelpers.selectedItem);
if (
inputValue !== searchQuery &&
!itemSelected // when item is selected, `handleStateChange` will update searchQuery.
) {
setStateAndInvokeHandler(['onSearchQueryChange'], null, {
searchQuery: inputValue,
});
}
};
const handleStateChange = (changes: StateChangeOptions<ShorthandValue<DropdownItemProps>>) => {
const { type } = changes;
const newState = {} as DropdownStateForInvoke;
switch (type) {
case Downshift.stateChangeTypes.changeInput: {
const shouldValueChange = changes.inputValue === '' && !multiple && value.length > 0;
if (allowFreeform) {
// set highlighted index to first item starting with search query
const itemIndex = items.findIndex(i =>
itemToString(i)?.toLocaleLowerCase().startsWith(changes.inputValue?.toLowerCase()),
);
if (itemIndex !== -1) {
newState.highlightedIndex = itemIndex;
// for free form always keep searchQuery and inputValue in sync
// as state change might not be called after last letter was entered
newState.searchQuery = changes.inputValue;
}
} else {
newState.highlightedIndex = highlightFirstItemOnOpen ? 0 : null;
}
if (shouldValueChange) {
newState.value = [];
}
if (open) {
// we clear value when in single selection user cleared the query.
const shouldMenuClose = changes.inputValue === '' || changes.selectedItem !== undefined;
if (shouldMenuClose) {
newState.open = false;
}
} else {
newState.open = true;
}
break;
}
case Downshift.stateChangeTypes.keyDownEnter:
case Downshift.stateChangeTypes.clickItem:
const shouldAddHighlightedIndex = !multiple && items && items.length > 0;
const isSameItemSelected = changes.selectedItem === undefined;
const newValue = isSameItemSelected ? value[0] : changes.selectedItem;
newState.searchQuery = getSelectedItemAsString(newValue);
if (allowFreeform && !inListbox.current && type === Downshift.stateChangeTypes.keyDownEnter) {
const itemIndex = items.findIndex(i =>
itemToString(i)?.toLocaleLowerCase().startsWith(searchQuery?.toLocaleLowerCase()),
);
// if there is an item that starts with searchQuery, still apply the search query
// to do auto complete (you enter '12:', can be completed to '12:00')
if (itemIndex === -1) {
delete newState.searchQuery;
}
}
newState.open = false;
newState.highlightedIndex = shouldAddHighlightedIndex ? items.indexOf(newValue) : null;
inListbox.current = false;
if (!isSameItemSelected) {
newState.value = multiple ? [...value, changes.selectedItem] : [changes.selectedItem];
if (getA11ySelectionMessage && getA11ySelectionMessage.onAdd) {
setA11ySelectionMessage(getA11ySelectionMessage.onAdd(newValue));
}
}
if (multiple) {
context.target?.defaultView.setTimeout(
() => (selectedItemsRef.current.scrollTop = selectedItemsRef.current.scrollHeight),
0,
);
}
// timeout because of NVDA, otherwise it narrates old button value/state
context.target?.defaultView.setTimeout(() => tryFocusTriggerButton(), 100);
break;
case Downshift.stateChangeTypes.keyDownEscape:
if (search && !multiple) {
newState.value = [];
}
newState.open = false;
newState.highlightedIndex = highlightFirstItemOnOpen ? 0 : null;
break;
case Downshift.stateChangeTypes.keyDownArrowDown:
case Downshift.stateChangeTypes.keyDownArrowUp:
if (changes.isOpen !== undefined) {
newState.open = changes.isOpen;
newState.highlightedIndex = changes.highlightedIndex;
if (changes.isOpen) {
const highlightedIndexOnArrowKeyOpen = getHighlightedIndexOnArrowKeyOpen(changes);
if (_.isNumber(highlightedIndexOnArrowKeyOpen)) {
newState.highlightedIndex = highlightedIndexOnArrowKeyOpen;
}
if (!search) {
listRef.current.focus();
}
} else {
newState.highlightedIndex = null;
}
}
case Downshift.stateChangeTypes['keyDownHome']:
case Downshift.stateChangeTypes['keyDownEnd']:
if (open && _.isNumber(changes.highlightedIndex)) {
newState.highlightedIndex = changes.highlightedIndex;
newState.itemIsFromKeyboard = true;
}
break;
case Downshift.stateChangeTypes.mouseUp:
if (open) {
newState.open = false;
if (allowFreeform) {
const itemIndex = items.findIndex(i =>
itemToString(i)?.toLowerCase().startsWith(searchQuery?.toLowerCase()),
);
// if there is an item that starts with searchQuery, still apply the search query
// to do auto complete (you enter '12:', can be completed to '12:00')
if (itemIndex !== -1) {
newState.searchQuery = itemToString(items[itemIndex]);
}
} else {
newState.highlightedIndex = null;
}
}
break;
case Downshift.stateChangeTypes.clickButton:
case Downshift.stateChangeTypes.keyDownSpaceButton:
newState.open = changes.isOpen;
newState.itemIsFromKeyboard = isFromKeyboard;
if (changes.isOpen) {
const highlightedIndexOnArrowKeyOpen = getHighlightedIndexOnArrowKeyOpen(changes);
if (_.isNumber(highlightedIndexOnArrowKeyOpen)) {
newState.highlightedIndex = highlightedIndexOnArrowKeyOpen;
}
if (!search) {
listRef.current.focus();
}
} else if (allowFreeform) {
const itemIndex = items.findIndex(i =>
itemToString(i)?.toLocaleLowerCase().startsWith(searchQuery.toLowerCase()),
);
// if there is an item that starts with searchQuery, still apply the search query
// to do auto complete (you enter '12:', can be completed to '12:00')
if (itemIndex !== -1) {
newState.searchQuery = itemToString(items[itemIndex]);
}
} else {
newState.highlightedIndex = null;
}
break;
case Downshift.stateChangeTypes.itemMouseEnter:
newState.highlightedIndex = changes.highlightedIndex;
newState.itemIsFromKeyboard = false;
break;
case Downshift.stateChangeTypes.unknown:
if (changes.selectedItem) {
newState.value = multiple ? [...value, changes.selectedItem] : [changes.selectedItem];
newState.searchQuery = multiple ? '' : changes.inputValue;
newState.open = false;
newState.highlightedIndex = changes.highlightedIndex;
tryFocusTriggerButton();
} else {
newState.open = changes.isOpen;
}
default:
break;
}
if (_.isEmpty(newState)) {
return;
}
const handlers: (keyof DropdownProps)[] = [
newState.highlightedIndex !== undefined && 'onHighlightedIndexChange',
newState.open !== undefined && 'onOpenChange',
newState.searchQuery !== undefined && 'onSearchQueryChange',
newState.value !== undefined && 'onChange',
].filter(Boolean) as (keyof DropdownProps)[];
setStateAndInvokeHandler(handlers, null, newState);
};
const isSelectedItemActive = (index: number): boolean => {
return index === activeSelectedIndex;
};
const handleItemOverrides =
(
item: ShorthandValue<DropdownItemProps>,
index: number,
getItemProps: (options: GetItemPropsOptions<ShorthandValue<DropdownItemProps>>) => any,
selected: boolean,
) =>
(predefinedProps: DropdownItemProps) => ({
accessibilityItemProps: {
...getItemProps({
item,
index,
disabled: item['disabled'],
onClick: e => {
e.stopPropagation();
e.nativeEvent.stopImmediatePropagation();
_.invoke(predefinedProps, 'onClick', e, predefinedProps);
},
}),
// for single selection the selected item should have aria-selected, instead of the highlighted
...(!multiple && {
'aria-selected': selected,
}),
},
});
const handleSelectedItemOverrides =
(item: ShorthandValue<DropdownItemProps>) => (predefinedProps: DropdownSelectedItemProps) => ({
onRemove: (e: React.SyntheticEvent, dropdownSelectedItemProps: DropdownSelectedItemProps) => {
handleSelectedItemRemove(e, item, predefinedProps, dropdownSelectedItemProps);
},
onClick: (e: React.SyntheticEvent, dropdownSelectedItemProps: DropdownSelectedItemProps) => {
setStateAndInvokeHandler(['onActiveSelectedIndexChange'], null, {
activeSelectedIndex: value.indexOf(item),
});
e.stopPropagation();
_.invoke(predefinedProps, 'onClick', e, dropdownSelectedItemProps);
},
onKeyDown: (e: React.KeyboardEvent, dropdownSelectedItemProps: DropdownSelectedItemProps) => {
handleSelectedItemKeyDown(e, item, predefinedProps, dropdownSelectedItemProps);
},
});
const handleSearchInputOverrides =
(
highlightedIndex: number,
selectItemAtIndex: (index: number, otherStateToSet?: Partial<StateChangeOptions<any>>, cb?: () => void) => void,
toggleMenu: () => void,
accessibilityComboboxProps: Object,
getInputProps: (options?: GetInputPropsOptions) => any,
) =>
(predefinedProps: DropdownSearchInputProps) => {
const handleInputBlur = (e: React.SyntheticEvent, searchInputProps: DropdownSearchInputProps) => {
if (!disabled) {
setFocused(false);
setIsFromKeyboard(detectIsFromKeyboard());
e.nativeEvent['preventDownshiftDefault'] = true;
}
_.invoke(predefinedProps, 'onInputBlur', e, searchInputProps);
};
const handleInputKeyDown = (
e: React.KeyboardEvent<HTMLInputElement>,
searchInputProps: DropdownSearchInputProps,
) => {
if (!disabled) {
switch (getCode(e)) {
// path_to_url
// Downshift skips Home/End if Deopdown is opened
case keyboardKey.Home:
e.nativeEvent['preventDownshiftDefault'] = filteredItems.length === 0;
break;
case keyboardKey.End:
e.nativeEvent['preventDownshiftDefault'] = filteredItems.length === 0;
break;
case keyboardKey.Tab:
e.stopPropagation();
handleTabSelection(e, highlightedIndex, selectItemAtIndex, toggleMenu);
break;
case keyboardKey.ArrowLeft:
e.stopPropagation();
if (!context.rtl) {
// path_to_url
// JSDOM does not implement `event.view` so prune this code path in test
if (process.env.NODE_ENV !== 'test') {
setWhatInputSource(e.view.document, 'keyboard');
}
trySetLastSelectedItemAsActive();
}
break;
case keyboardKey.ArrowRight:
e.stopPropagation();
if (context.rtl) {
// path_to_url
// JSDOM does not implement `event.view` so prune this code path in test
if (process.env.NODE_ENV !== 'test') {
setWhatInputSource(e.view.document, 'keyboard');
}
trySetLastSelectedItemAsActive();
}
break;
case keyboardKey.Backspace:
e.stopPropagation();
tryRemoveItemFromValue();
break;
case keyboardKey.Escape:
// If dropdown list is open ESC should close it and not propagate to the parent
// otherwise event should propagate
if (open) {
e.stopPropagation();
}
case keyboardKey.ArrowUp:
case keyboardKey.ArrowDown:
if (allowFreeform) {
inListbox.current = true;
}
break;
default:
if (getCode(e) !== keyboardKey.Enter) {
inListbox.current = false;
}
break;
}
}
_.invoke(predefinedProps, 'onInputKeyDown', e, {
...searchInputProps,
highlightedIndex,
selectItemAtIndex,
});
};
return {
// getInputProps adds Downshift handlers. We also add our own by passing them as params to that function.
// user handlers were also added to our handlers previously, at the beginning of this function.
accessibilityInputProps: {
...getInputProps({
disabled,
onBlur: e => {
handleInputBlur(e, predefinedProps);
},
onKeyDown: e => {
handleInputKeyDown(e, predefinedProps);
},
onChange: (e: React.ChangeEvent<HTMLInputElement>) => {
// we prevent the onChange input event to bubble up to our Dropdown handler,
// since in Dropdown it gets handled as onSearchQueryChange.
e.stopPropagation();
// A state modification should be triggered there otherwise it will go to an another frame and will break
// cursor position:
// path_to_url#issuecomment-469352730
setSearchQuery(e.target.value);
},
'aria-labelledby': ariaLabelledby,
'aria-describedby': ariaDescribedby || selectedItemsCountNarrationId,
}),
},
// same story as above for getRootProps.
accessibilityComboboxProps,
inputRef: (node: HTMLInputElement) => {
handleRef(predefinedProps.inputRef, node);
inputRef.current = node;
},
onFocus: (e: React.FocusEvent, searchInputProps: DropdownSearchInputProps) => {
if (!disabled) {
setFocused(true);
setIsFromKeyboard(detectIsFromKeyboard());
}
_.invoke(predefinedProps, 'onFocus', e, searchInputProps);
},
onInputBlur: (e: React.FocusEvent, searchInputProps: DropdownSearchInputProps) => {
handleInputBlur(e, searchInputProps);
},
onInputKeyDown: (e: React.KeyboardEvent<HTMLInputElement>, searchInputProps: DropdownSearchInputProps) => {
handleInputKeyDown(e, searchInputProps);
},
};
};
/**
* Custom Tab selection logic, at least until Downshift will implement selection on blur.
* Also keeps focus on multiple selection dropdown when selecting by Tab.
*/
const handleTabSelection = (
e: React.SyntheticEvent,
highlightedIndex: number,
selectItemAtIndex: (highlightedIndex: number) => void,
toggleMenu: () => void,
): void => {
if (open) {
if (!_.isNil(highlightedIndex) && filteredItems.length && !items[highlightedIndex]['disabled']) {
selectItemAtIndex(highlightedIndex);
if (multiple && !moveFocusOnTab) {
e.preventDefault();
}
} else {
toggleMenu();
}
}
};
const trySetLastSelectedItemAsActive = () => {
if (!multiple || (inputRef.current && inputRef.current.selectionStart !== 0)) {
return;
}
if (value.length > 0) {
// If last element was already active, perform a 'reset' of activeSelectedIndex.
if (activeSelectedIndex === value.length - 1) {
setStateAndInvokeHandler(['onActiveSelectedIndexChange'], null, {
activeSelectedIndex: value.length - 1,
});
} else {
setStateAndInvokeHandler(['onActiveSelectedIndexChange'], null, {
activeSelectedIndex: value.length - 1,
});
}
}
};
const tryRemoveItemFromValue = () => {
if (
multiple &&
(searchQuery === '' || (inputRef.current.selectionStart === 0 && inputRef.current.selectionEnd === 0)) &&
value.length > 0
) {
removeItemFromValue();
}
};
const handleClear = (e: React.SyntheticEvent<HTMLElement>) => {
setStateAndInvokeHandler(['onChange', 'onActiveSelectedIndexChange', 'onHighlightedIndexChange'], e, {
activeSelectedIndex: multiple ? null : undefined,
highlightedIndex: highlightFirstItemOnOpen ? 0 : null,
open: false,
searchQuery: search ? '' : undefined,
value: [],
});
tryFocusSearchInput();
tryFocusTriggerButton();
};
const handleContainerClick = () => {
tryFocusSearchInput();
};
const handleTriggerButtonKeyDown = (e: React.KeyboardEvent) => {
switch (getCode(e)) {
case keyboardKey.ArrowLeft:
if (!context.rtl) {
trySetLastSelectedItemAsActive();
}
return;
case keyboardKey.ArrowRight:
if (context.rtl) {
trySetLastSelectedItemAsActive();
}
return;
default:
return;
}
};
const handleListKeyDown = (
e: React.KeyboardEvent,
highlightedIndex: number,
accessibilityInputPropsKeyDown: (e) => any,
toggleMenu: () => void,
selectItemAtIndex: (index: number) => void,
) => {
const keyCode = getCode(e);
switch (keyCode) {
case keyboardKey.Tab:
handleTabSelection(e, highlightedIndex, selectItemAtIndex, toggleMenu);
return;
case keyboardKey.Escape:
accessibilityInputPropsKeyDown(e);
tryFocusTriggerButton();
e.stopPropagation();
return;
default:
const keyString = String.fromCharCode(keyCode);
if (/[a-zA-Z0-9]/.test(keyString)) {
setHighlightedIndexOnCharKeyDown(keyString);
}
accessibilityInputPropsKeyDown(e);
return;
}
};
const handleSelectedItemKeyDown = (
e: React.KeyboardEvent,
item: ShorthandValue<DropdownItemProps>,
predefinedProps: DropdownSelectedItemProps,
dropdownSelectedItemProps: DropdownSelectedItemProps,
) => {
const previousKey = context.rtl ? keyboardKey.ArrowRight : keyboardKey.ArrowLeft;
const nextKey = context.rtl ? keyboardKey.ArrowLeft : keyboardKey.ArrowRight;
switch (getCode(e)) {
case keyboardKey.Delete:
case keyboardKey.Backspace:
handleSelectedItemRemove(e, item, predefinedProps, dropdownSelectedItemProps);
break;
case previousKey:
if (value.length > 0 && !_.isNil(activeSelectedIndex) && activeSelectedIndex > 0) {
setStateAndInvokeHandler(['onActiveSelectedIndexChange'], null, {
activeSelectedIndex: activeSelectedIndex - 1,
});
}
break;
case nextKey:
if (value.length > 0 && !_.isNil(activeSelectedIndex)) {
if (activeSelectedIndex < value.length - 1) {
setStateAndInvokeHandler(['onActiveSelectedIndexChange'], null, {
activeSelectedIndex: activeSelectedIndex + 1,
});
} else {
setStateAndInvokeHandler(['onActiveSelectedIndexChange'], null, {
activeSelectedIndex: null,
});
if (search) {
e.preventDefault(); // prevents caret to forward one position in input.
inputRef.current.focus();
} else {
buttonRef.current.focus();
}
}
}
break;
default:
break;
}
_.invoke(predefinedProps, 'onKeyDown', e, dropdownSelectedItemProps);
};
const handleTriggerButtonOrListFocus = () => {
setFocused(true);
setIsFromKeyboard(detectIsFromKeyboard());
};
const handleTriggerButtonBlur = e => {
if (listRef.current !== e.relatedTarget) {
setFocused(false);
setIsFromKeyboard(detectIsFromKeyboard());
}
};
const handleListBlur = e => {
if (buttonRef.current !== e.relatedTarget) {
setFocused(false);
setIsFromKeyboard(detectIsFromKeyboard());
}
};
/**
* Sets highlightedIndex to be the item that starts with the character keys the
* user has typed. Only used in non-search dropdowns.
*
* @param keystring - The string the item needs to start with. It is composed by typing keys in fast succession.
*/
const setHighlightedIndexOnCharKeyDown = (keyString: string): void => {
const newStartingString = `${startingString}${keyString.toLowerCase()}`;
let newHighlightedIndex = -1;
setStartingString(newStartingString);
clearStartingString();
if (_.isNumber(highlightedIndex)) {
newHighlightedIndex = _.findIndex(
filteredItemStrings,
item => item.startsWith(newStartingString),
highlightedIndex + (startingString.length > 0 ? 0 : 1),
);
}
if (newHighlightedIndex < 0) {
newHighlightedIndex = _.findIndex(filteredItemStrings, item => item.startsWith(newStartingString));
}
if (newHighlightedIndex >= 0) {
setStateAndInvokeHandler(['onHighlightedIndexChange'], null, {
highlightedIndex: newHighlightedIndex,
});
}
};
const handleSelectedItemRemove = (
e: React.SyntheticEvent,
item: ShorthandValue<DropdownItemProps>,
predefinedProps: DropdownSelectedItemProps,
dropdownSelectedItemProps: DropdownSelectedItemProps,
) => {
setStateAndInvokeHandler(['onActiveSelectedIndexChange'], null, {
activeSelectedIndex: null,
});
removeItemFromValue(item);
tryFocusSearchInput();
tryFocusTriggerButton();
_.invoke(predefinedProps, 'onRemove', e, dropdownSelectedItemProps);
};
const removeItemFromValue = (item?: ShorthandValue<DropdownItemProps>) => {
let poppedItem = item;
let newValue = [...value];
if (poppedItem) {
newValue = newValue.filter(currentElement => currentElement !== item);
} else {
poppedItem = newValue.pop();
}
if (getA11ySelectionMessage && getA11ySelectionMessage.onRemove) {
setA11ySelectionMessage(getA11ySelectionMessage.onRemove(poppedItem));
}
setStateAndInvokeHandler(['onChange'], null, { value: newValue });
};
/**
* Calls setState and invokes event handler exposed to user.
* We don't have the event object for most events coming from Downshift se we send an empty event
* because we want to keep the event handling interface
*/
const setStateAndInvokeHandler = (
handlerNames: (keyof DropdownProps)[],
event: React.SyntheticEvent<HTMLElement>,
newState: DropdownStateForInvoke,
) => {
const proposedValue = _.isNil(newState.value) ? value : newState.value;
// `proposedValue` should be normalized for single/multiple variations, `null` condition is
// required as first item can be undefined
const newValue = multiple ? proposedValue : proposedValue[0] || null;
if (newState.hasOwnProperty('activeSelectedIndex')) {
setActiveSelectedIndex(newState.activeSelectedIndex);
}
if (newState.hasOwnProperty('highlightedIndex')) {
setHighlightedIndex(newState.highlightedIndex);
}
if (newState.hasOwnProperty('itemIsFromKeyboard')) {
setItemIsFromKeyboard(newState.itemIsFromKeyboard);
}
if (newState.hasOwnProperty('open')) {
setOpen(newState.open);
}
if (newState.hasOwnProperty('searchQuery')) {
setSearchQuery(newState.searchQuery);
}
if (newState.hasOwnProperty('value')) {
setValue(newState.value);
}
handlerNames.forEach(handlerName => {
_.invoke(props, handlerName, event, { ...props, ...newState, value: newValue });
});
};
const tryFocusTriggerButton = () => {
if (!search && buttonRef.current) {
buttonRef.current.focus();
}
};
const tryFocusSearchInput = () => {
if (search && inputRef.current) {
inputRef.current.focus();
}
};
/**
* If there is no value we use the placeholder value
* otherwise, for single selection we convert the value with itemToString
* and for multiple selection we return empty string, the values are rendered by renderSelectedItems
*/
const getSelectedItemAsString = (value: ShorthandValue<DropdownItemProps>): string => {
if (!value) {
return search ? '' : placeholder;
}
if (multiple) {
return '';
}
return itemToString(value);
};
const getHighlightedIndexOnArrowKeyOpen = (
changes: StateChangeOptions<ShorthandValue<DropdownItemProps>>,
): number => {
const isArrowUp = changes.type === Downshift.stateChangeTypes.keyDownArrowUp;
const isArrowDown = changes.type === Downshift.stateChangeTypes.keyDownArrowDown;
const itemsLength = filteredItems.length;
if (highlightedIndex) {
return highlightedIndex;
}
if (highlightFirstItemOnOpen) {
// otherwise, if highlightFirstItemOnOpen prop is provied, highlight first item.
return 0;
}
if (!multiple && value.length > 0) {
// in single selection (search or not search), if there is a selected item, highlight it.
const offset = isArrowUp ? -1 : isArrowDown ? 1 : 0;
const newHighlightedIndex = items.indexOf(value[0]) + offset;
if (newHighlightedIndex >= itemsLength) {
return 0;
}
if (isArrowUp && newHighlightedIndex < 0) {
return itemsLength - 1;
}
if (newHighlightedIndex > 0) {
return newHighlightedIndex;
}
}
if (isArrowDown) {
return 0;
}
if (isArrowUp) {
return itemsLength - 1;
}
return null;
};
/**
* Function that sets and cleans the selection message after it has been set,
* so it is not read anymore via virtual cursor.
*/
const setA11ySelectionMessage = (a11ySelectionStatus: string): void => {
setA11ySelectionStatus(a11ySelectionStatus);
clearA11ySelectionMessage();
};
React.useEffect(() => {
return () => {
clearStartingString.cancel();
clearA11ySelectionMessage.cancel();
};
}, [clearA11ySelectionMessage, clearStartingString]);
const element = (
<ElementType
className={classes.root}
onBlur={handleOnBlur}
onChange={handleChange}
ref={ref}
{...unhandledProps}
{...(process.env.NODE_ENV === 'test' && { 'data-test-focused': focused })}
>
<Downshift
isOpen={open}
inputValue={search ? searchQuery : null}
stateReducer={downshiftStateReducer}
itemToString={itemToString}
// downshift does not work with arrays as selectedItem.
selectedItem={multiple || !value.length ? null : value[0]}
scrollIntoView={(node: HTMLElement, menu: HTMLElement) => {
if (node) {
const { children } = menu;
let nodeToScroll = node;
/**
* If it's loading downshift doesn't take the last node with loadingMessage
* in consideration to scrolld so we need to check if the current is the
* antepenultimate and is so scroll the loading into view, same for headerMessage
*/
if (loading && children[children.length - 2] === node) {
nodeToScroll = children[children.length - 1] as HTMLElement;
} else if (headerMessage && children[1] === node) {
nodeToScroll = children[0] as HTMLElement;
}
// Replicating same config that Downshift uses
const actions = computeScrollIntoView(nodeToScroll, {
boundary: menu, // Explicitly set boundary to avoid unnecessary scrolling by checking all parent elements
scrollMode: 'if-needed',
block: 'nearest',
inline: 'nearest',
});
actions.forEach(({ el, top, left }) => {
el.scrollTop = top;
el.scrollLeft = left;
});
}
}}
getA11yStatusMessage={getA11yStatusMessage}
highlightedIndex={highlightedIndex}
onStateChange={handleStateChange}
onInputValueChange={handleInputValueChange}
labelId={ariaLabelledby}
environment={context.target?.defaultView}
inputId={searchInput && searchInput['id'] ? searchInput['id'] : undefined}
>
{({
getInputProps,
getItemProps,
getMenuProps,
getRootProps,
getToggleButtonProps,
toggleMenu,
highlightedIndex,
selectItemAtIndex,
}) => {
const { innerRef, ...accessibilityRootPropsRest } = getRootProps(
{ refKey: 'innerRef' },
{ suppressRefError: true },
);
const showClearIndicator = clearable && value.length > 0;
return (
<Ref innerRef={innerRef}>
<div
ref={containerRef}
className={cx(dropdownSlotClassNames.container, classes.container)}
onClick={search && !open ? handleContainerClick : undefined}
>
<div ref={selectedItemsRef} className={cx(dropdownSlotClassNames.selectedItems, classes.selectedItems)}>
{/* We previously were rendering the trigger button after selected items list,
after listbox wrapper was introduced we moved it to before and
set as absolute to avoid visual regressions */}
{!search && renderTriggerButton(getToggleButtonProps)}
{multiple && renderSelectedItems()}
{search &&
renderSearchInput(
accessibilityRootPropsRest,
highlightedIndex,
getInputProps,
selectItemAtIndex,
toggleMenu,
variables,
)}
</div>
{showClearIndicator
? Box.create(clearIndicator, {
defaultProps: () => ({
className: dropdownSlotClassNames.clearIndicator,
styles: resolvedStyles.clearIndicator,
...(!search ? { tabIndex: 0, role: 'button' } : { accessibility: indicatorBehavior }),
}),
overrideProps: (predefinedProps: BoxProps) => ({
onClick: (e: React.SyntheticEvent<HTMLElement>) => {
_.invoke(predefinedProps, 'onClick', e);
handleClear(e);
},
onKeyDown: (e: React.KeyboardEvent<HTMLElement>) => {
_.invoke(predefinedProps, 'onKeyDown', e);
const keyCode = getCode(e);
if (!search && (keyCode === keyboardKey.Enter || keyCode === SpacebarKey)) {
handleClear(e);
e.preventDefault();
}
},
}),
})
: Box.create(toggleIndicator, {
defaultProps: () => ({
className: dropdownSlotClassNames.toggleIndicator,
styles: resolvedStyles.toggleIndicator,
accessibility: indicatorBehavior,
}),
overrideProps: (predefinedProps: BoxProps) => ({
onClick: e => {
if (!disabled) {
getToggleButtonProps({ disabled }).onClick(e);
}
_.invoke(predefinedProps, 'onClick', e);
},
}),
})}
{renderItemsList(
highlightedIndex,
toggleMenu,
selectItemAtIndex,
getMenuProps,
getItemProps,
getInputProps,
)}
</div>
</Ref>
);
}}
</Downshift>
<Portal open={!!getA11ySelectionMessage}>
<div role="status" aria-live="polite" aria-relevant="additions text" style={screenReaderContainerStyles}>
{a11ySelectionStatus}
</div>
</Portal>
</ElementType>
);
setEnd();
return element;
}) as unknown as ForwardRefWithAs<'div', HTMLDivElement, DropdownProps> &
FluentComponentStaticProps<DropdownProps> & {
Item: typeof DropdownItem;
SearchInput: typeof DropdownSearchInput;
SelectedItem: typeof DropdownSelectedItem;
};
Dropdown.displayName = 'Dropdown';
Dropdown.propTypes = {
...commonPropTypes.createCommon({
accessibility: false,
children: false,
content: false,
}),
activeSelectedIndex: PropTypes.number,
allowFreeform: PropTypes.bool,
checkable: PropTypes.bool,
checkableIndicator: customPropTypes.shorthandAllowingChildren,
clearable: PropTypes.bool,
clearIndicator: customPropTypes.shorthandAllowingChildren,
defaultActiveSelectedIndex: PropTypes.number,
defaultOpen: PropTypes.bool,
defaultHighlightedIndex: PropTypes.number,
defaultSearchQuery: PropTypes.string,
defaultValue: PropTypes.oneOfType([customPropTypes.itemShorthand, customPropTypes.collectionShorthand]),
disabled: PropTypes.bool,
error: PropTypes.bool,
fluid: PropTypes.bool,
getA11ySelectionMessage: PropTypes.object,
getA11yStatusMessage: PropTypes.func,
highlightFirstItemOnOpen: PropTypes.bool,
highlightedIndex: PropTypes.number,
inline: PropTypes.bool,
inverted: PropTypes.bool,
items: customPropTypes.collectionShorthand,
itemToString: PropTypes.func,
itemToValue: PropTypes.func,
headerMessage: customPropTypes.itemShorthand,
list: customPropTypes.itemShorthand,
loading: PropTypes.bool,
loadingMessage: customPropTypes.itemShorthand,
moveFocusOnTab: PropTypes.bool,
multiple: PropTypes.bool,
noResultsMessage: customPropTypes.itemShorthand,
onOpenChange: PropTypes.func,
onSearchQueryChange: PropTypes.func,
onBlur: PropTypes.func,
onChange: PropTypes.func,
onActiveSelectedIndexChange: PropTypes.func,
onHighlightedIndexChange: PropTypes.func,
open: PropTypes.bool,
placeholder: PropTypes.string,
renderItem: PropTypes.func,
renderSelectedItem: PropTypes.func,
search: PropTypes.oneOfType([PropTypes.bool, PropTypes.func]),
searchQuery: PropTypes.string,
searchInput: customPropTypes.itemShorthand,
toggleIndicator: customPropTypes.shorthandAllowingChildren,
triggerButton: customPropTypes.itemShorthand,
value: PropTypes.oneOfType([customPropTypes.itemShorthand, customPropTypes.collectionShorthand]),
'aria-labelledby': PropTypes.string,
'aria-invalid': PropTypes.bool,
a11ySelectedItemsMessage: PropTypes.string,
// positioning props
align: PropTypes.oneOf(ALIGNMENTS),
flipBoundary: PropTypes.oneOfType([
PropTypes.object as PropTypes.Requireable<HTMLElement>,
PropTypes.arrayOf(PropTypes.object) as PropTypes.Requireable<HTMLElement[]>,
PropTypes.oneOf<'clippingParents' | 'window' | 'scrollParent'>(['clippingParents', 'window', 'scrollParent']),
]),
overflowBoundary: PropTypes.oneOfType([
PropTypes.object as PropTypes.Requireable<HTMLElement>,
PropTypes.arrayOf(PropTypes.object) as PropTypes.Requireable<HTMLElement[]>,
PropTypes.oneOf<'clippingParents' | 'window' | 'scrollParent'>(['clippingParents', 'window', 'scrollParent']),
]),
popperRef: customPropTypes.ref,
position: PropTypes.oneOf(POSITIONS),
positionFixed: PropTypes.bool,
offset: PropTypes.oneOfType([
PropTypes.func,
PropTypes.arrayOf(PropTypes.number) as PropTypes.Requireable<[number, number]>,
]),
unstable_disableTether: PropTypes.oneOf([true, false, 'all']),
unstable_pinned: PropTypes.bool,
autoSize: PropTypes.oneOf<AutoSize>(AUTOSIZES),
};
Dropdown.handledProps = Object.keys(Dropdown.propTypes) as any;
Dropdown.defaultProps = {
align: 'start',
clearIndicator: <CloseIcon outline />,
itemToString: item => {
if (!item || React.isValidElement(item)) {
return '';
}
// targets DropdownItem shorthand objects
return (item as any).header || String(item);
},
itemToValue: item => {
if (!item || React.isValidElement(item)) {
return '';
}
// targets DropdownItem shorthand objects
return (item as any).header || String(item);
},
list: {},
position: 'below',
toggleIndicator: <ChevronDownIcon outline />,
triggerButton: {},
};
Dropdown.Item = DropdownItem;
Dropdown.SearchInput = DropdownSearchInput;
Dropdown.SelectedItem = DropdownSelectedItem;
``` | /content/code_sandbox/packages/fluentui/react-northstar/src/components/Dropdown/Dropdown.tsx | xml | 2016-06-06T15:03:44 | 2024-08-16T18:49:29 | fluentui | microsoft/fluentui | 18,221 | 14,656 |
```xml
// See LICENSE.txt for license information.
import {withDatabase, withObservables} from '@nozbe/watermelondb/react';
import {observeConfigBooleanValue, observeCurrentTeamId} from '@queries/servers/system';
import AppSlashSuggestion from './app_slash_suggestion';
import type {WithDatabaseArgs} from '@typings/database/database';
const enhanced = withObservables([], ({database}: WithDatabaseArgs) => ({
currentTeamId: observeCurrentTeamId(database),
isAppsEnabled: observeConfigBooleanValue(database, 'FeatureFlagAppsEnabled'),
}));
export default withDatabase(enhanced(AppSlashSuggestion));
``` | /content/code_sandbox/app/components/autocomplete/slash_suggestion/app_slash_suggestion/index.ts | xml | 2016-10-07T16:52:32 | 2024-08-16T12:08:38 | mattermost-mobile | mattermost/mattermost-mobile | 2,155 | 131 |
```xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="path_to_url"
xmlns:app="path_to_url"
android:layout_width="120dp"
android:layout_height="150dp"
android:transitionName="img"
app:cardBackgroundColor="#ffffff"
app:cardCornerRadius="2dp"
app:cardElevation="5dp">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop" />
<TextView
android:id="@+id/item_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textColor="#ffffff"
android:textSize="26sp"
android:textStyle="bold" />
</FrameLayout>
</androidx.cardview.widget.CardView>
``` | /content/code_sandbox/imitate/src/main/res/layout/large_image_item.xml | xml | 2016-08-08T08:52:10 | 2024-08-12T19:24:13 | AndroidAnimationExercise | REBOOTERS/AndroidAnimationExercise | 1,868 | 241 |
```xml
import * as React from 'react';
import createSvgIcon from '../utils/createSvgIcon';
const UploadIcon = createSvgIcon({
svg: ({ classes }) => (
<svg xmlns="path_to_url" viewBox="0 0 2048 2048" className={classes.svg} focusable="false">
<path d="M1536 0v128H384V0h1152zm45 979l-90 90-467-470v1449H896V599l-467 470-90-90 621-626 621 626z" />
</svg>
),
displayName: 'UploadIcon',
});
export default UploadIcon;
``` | /content/code_sandbox/packages/react-icons-mdl2/src/components/UploadIcon.tsx | xml | 2016-06-06T15:03:44 | 2024-08-16T18:49:29 | fluentui | microsoft/fluentui | 18,221 | 145 |
```xml
import { Messages } from '../Details.messages';
export const TableTabs = {
table: Messages.tabs.tables.sections.table,
indexes: Messages.tabs.tables.sections.indexes,
status: Messages.tabs.tables.sections.status,
};
``` | /content/code_sandbox/pmm-app/src/pmm-qan/panel/components/Details/Table/TableContainer.constants.ts | xml | 2016-01-22T07:14:23 | 2024-08-13T13:01:59 | grafana-dashboards | percona/grafana-dashboards | 2,661 | 45 |
```xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="path_to_url">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:name="androidx.multidex.MultiDexApplication">
<activity android:name=".EntryChoiceActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.EntryChoice"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".java.MainActivity"
android:theme="@style/AppTheme.Activity" />
<activity
android:name=".kotlin.MainActivity"
android:theme="@style/AppTheme.Activity" />
</application>
</manifest>
``` | /content/code_sandbox/firestore/app/src/main/AndroidManifest.xml | xml | 2016-04-26T17:13:27 | 2024-08-16T18:37:58 | quickstart-android | firebase/quickstart-android | 8,797 | 219 |
```xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="path_to_url"
package="com.example.activitytest">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".FirstActivity"
android:label="This is FirstActivity"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".SecondActivity"
android:launchMode="singleInstance">
<intent-filter>
<action android:name="com.example.activitytest.ACTION_START" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="com.example.activitytest.MY_CATEGORY" />
</intent-filter>
</activity>
<activity android:name=".ThirdActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="http" />
</intent-filter>
</activity>
</application>
</manifest>
``` | /content/code_sandbox/chapter2/ActivityTest/app/src/main/AndroidManifest.xml | xml | 2016-10-04T02:55:57 | 2024-08-16T11:00:26 | booksource | guolindev/booksource | 3,105 | 293 |
```xml
<project xmlns="path_to_url" xmlns:xsi="path_to_url" xsi:schemaLocation="path_to_url path_to_url">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.amazonaws.serverless</groupId>
<artifactId>aws-serverless-java-container</artifactId>
<version>2.1.0-SNAPSHOT</version>
</parent>
<groupId>com.amazonaws.serverless.archetypes</groupId>
<artifactId>aws-serverless-struts-archetype</artifactId>
<version>2.1.0-SNAPSHOT</version>
<packaging>maven-archetype</packaging>
<scm>
<url>path_to_url
<tag>HEAD</tag>
</scm>
<licenses>
<license>
<url>path_to_url
<distribution>repo</distribution>
</license>
</licenses>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>archetype-resources/pom.xml</include>
<include>archetype-resources/README.md</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<excludes>
<exclude>archetype-resources/pom.xml</exclude>
</excludes>
</resource>
</resources>
<extensions>
<extension>
<groupId>org.apache.maven.archetype</groupId>
<artifactId>archetype-packaging</artifactId>
<version>3.0.1</version>
</extension>
</extensions>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.1</version>
<configuration>
<escapeString>\</escapeString>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-archetype-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
``` | /content/code_sandbox/aws-serverless-struts-archetype/pom.xml | xml | 2016-12-05T20:04:57 | 2024-08-15T19:57:41 | serverless-java-container | aws/serverless-java-container | 1,480 | 548 |
```xml
export { DirectiveKeys } from './datamodel/directives'
export { LegacyRelationalReservedFields } from './datamodel/legacyFields'
export {
ISDL,
IGQLType,
IGQLField,
IComment,
IDirectiveInfo,
IIndexInfo,
IArguments,
GQLFieldBase,
GQLOneRelationField,
GQLMultiRelationField,
GQLScalarField,
cloneSchema,
cloneField,
cloneIndices,
cloneType,
IdStrategy,
} from './datamodel/model'
export { default as DefaultParser } from './datamodel/parser'
export { default as Parser } from './datamodel/parser/parser'
export { default as DefaultRenderer } from './datamodel/renderer'
export { default as Renderer } from './datamodel/renderer/renderer'
export { DatabaseType } from './databaseType'
export { default as GQLAssert } from './util/gqlAssert'
export { default as AstTools } from './util/astTools'
export { capitalize, lowerCase, camelCase, plural, dedent } from './util/util'
export { toposort } from './util/sort'
export { TypeIdentifier, TypeIdentifiers } from './datamodel/scalar'
export { SdlExpect } from './test-helpers'
export { isTypeIdentifier } from './datamodel/scalar'
``` | /content/code_sandbox/cli/packages/prisma-datamodel/src/index.ts | xml | 2016-09-25T12:54:40 | 2024-08-16T11:41:23 | prisma1 | prisma/prisma1 | 16,549 | 282 |
```xml
import { darkTheme, lightTheme } from '@expo/styleguide-base';
import React, { createContext, useState, useContext, PropsWithChildren } from 'react';
import { useColorScheme } from 'react-native';
export type ThemeName = 'light' | 'dark';
export type ThemeType = typeof lightTheme | typeof darkTheme;
type ThemeContextType = {
name: ThemeName;
theme: ThemeType;
setTheme: (themeName: 'light' | 'dark') => void;
};
export const ThemeContext = createContext<ThemeContextType>({
name: 'light',
theme: lightTheme,
setTheme: () => undefined,
});
export function ThemeProvider({ children }: PropsWithChildren) {
const defaultTheme = useColorScheme() ?? 'light';
const [currentThemeName, setCurrentThemeName] = useState<ThemeName>(defaultTheme);
const [currentTheme, setCurrentTheme] = useState<ThemeType>(
defaultTheme === 'dark' ? darkTheme : lightTheme
);
function setTheme(name: ThemeName) {
setCurrentThemeName(name);
setCurrentTheme(name === 'dark' ? darkTheme : lightTheme);
}
return (
<ThemeContext.Provider
value={{
name: currentThemeName,
theme: currentTheme,
setTheme,
}}>
{children}
</ThemeContext.Provider>
);
}
export function useTheme() {
return useContext(ThemeContext);
}
``` | /content/code_sandbox/apps/common/ThemeProvider.tsx | xml | 2016-08-15T17:14:25 | 2024-08-16T19:54:44 | expo | expo/expo | 32,004 | 306 |
```xml
<resources>
<string name="app_name">pjsua</string>
<string name="title_activity_main">MainActivity</string>
</resources>
``` | /content/code_sandbox/pjsip-apps/src/pjsua/android/app/src/main/res/values/strings.xml | xml | 2016-01-24T05:00:33 | 2024-08-16T03:31:21 | pjproject | pjsip/pjproject | 1,960 | 34 |
```xml
<resources>
<string name="app_name" translatable="false">APKUpdater</string>
<string name="tab_apps"></string>
<string name="tab_search"></string>
<string name="tab_updates"></string>
<string name="tab_settings"></string>
<string name="something_went_wrong">"\n\uD83E\uDD26"</string>
<string name="ignore_version"></string>
<string name="ignore_cd"></string>
<string name="unignore_cd"></string>
<string name="refresh_updates"></string>
<string name="exclude_system_apps"></string>
<string name="include_system_apps"></string>
<string name="exclude_app_store"></string>
<string name="include_app_store"></string>
<string name="exclude_disabled_apps"></string>
<string name="include_disabled_apps"></string>
<string name="install_cd"></string>
<string name="app_cd"></string>
<string name="install_success">%1$s </string>
<string name="install_failure">%1$s </string>
<string name="root_install_not_supported"> Root </string>
// Settings
<string name="settings_portrait_columns"></string>
<string name="settings_landscape_columns"></string>
<string name="play_text_animations"></string>
<string name="settings_sources"></string>
<string name="settings_ui"></string>
<string name="settings_alarm"></string>
<string name="settings_options"></string>
<string name="settings_utils"></string>
<string name="settings_hour"></string>
<string name="settings_alarm_daily"></string>
<string name="settings_alarm_3day"></string>
<string name="settings_alarm_weekly"></string>
<string name="settings_android_tv_ui" translatable="false">Android TV UI</string>
<string name="ignore_alpha"> Alpha </string>
<string name="ignore_beta"> Beta </string>
<string name="ignore_preRelease"></string>
<string name="use_safe_stores"> (Aptoide)</string>
<string name="root_install">Root </string>
<string name="source_apkmirror" translatable="false">ApkMirror</string>
<string name="source_fdroid" translatable="false">F-Droid Main</string>
<string name="source_izzy" translatable="false">F-Droid Izzy</string>
<string name="source_aptoide" translatable="false">Aptoide</string>
<string name="source_github" translatable="false">GitHub</string>
<string name="source_gitlab" translatable="false">GitLab</string>
<string name="source_apkpure" translatable="false">APKPure</string>
<string name="source_play" translatable="false">Play</string>
<string name="about"></string>
<string name="frequency"></string>
<string name="theme"></string>
<string name="theme_system"></string>
<string name="theme_dark"></string>
<string name="theme_light"></string>
<string name="about_github"></string>
<string name="about_donate"></string>
<string name="copy_to_clipboard"></string>
<string name="copy_app_list"></string>
<string name="copy_app_logs"></string>
// Notifications
<string name="notification_channel_name"></string>
<string name="notification_channel_description"></string>
<string name="notification_channel_id" translatable="false">updateChannel</string>
<string name="notification_update_title"></string>
<plurals name="notification_update_description">
<item quantity="zero"></item>
<item quantity="one"> %1$d </item>
<item quantity="other"> %1$d </item>
</plurals>
</resources>
``` | /content/code_sandbox/app/src/main/res/values-zh-rTW/strings.xml | xml | 2016-08-21T09:18:13 | 2024-08-16T02:55:58 | apkupdater | rumboalla/apkupdater | 2,835 | 856 |
```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "path_to_url">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>14A356a</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>AppleHDA</string>
<key>CFBundleGetInfoString</key>
<key>CFBundleIdentifier</key>
<string>com.apple.driver.AppleHDA</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Apple HDA Driver</string>
<key>CFBundlePackageType</key>
<string>KEXT</string>
<key>CFBundleShortVersionString</key>
<string>266.5</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>266.5</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>6A280m</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
<string>14A355</string>
<key>DTSDKName</key>
<string>macosx10.10internal</string>
<key>DTXcode</key>
<string>0600</string>
<key>DTXcodeBuild</key>
<string>6A280m</string>
<key>IOKitPersonalities</key>
<dict>
<key>HDA Driver</key>
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.driver.AppleHDA</string>
<key>IOClass</key>
<string>AppleHDADriver</string>
<key>IOProviderClass</key>
<string>AppleHDACodec</string>
<key>InputSampleLatency</key>
<integer>0</integer>
<key>MultiDisplayPorts</key>
<array>
<integer>32</integer>
<integer>35</integer>
<integer>66</integer>
</array>
<key>OutputSampleLatency</key>
<integer>0</integer>
<key>SampleOffsetPad</key>
<integer>0</integer>
<key>SystemSpecificSampleOffsetPad</key>
<array>
<dict>
<key>LayoutID</key>
<integer>8</integer>
<key>SampleOffsetPad</key>
<integer>260</integer>
</dict>
</array>
</dict>
<key>HDA Generic Codec Driver</key>
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.driver.AppleHDA</string>
<key>IOClass</key>
<string>AppleHDACodecGeneric</string>
<key>IOHDACodecFunctionGroupType</key>
<integer>1</integer>
<key>IOProviderClass</key>
<string>IOHDACodecFunction</string>
</dict>
</dict>
<key>OSBundleLibraries</key>
<dict>
<key>com.apple.driver.AppleHDAController</key>
<string>1.7.2a1</string>
<key>com.apple.driver.DspFuncLib</key>
<string>1.5.2a1</string>
<key>com.apple.iokit.IOAudioFamily</key>
<string>1.8.6fc11</string>
<key>com.apple.iokit.IOGraphicsFamily</key>
<string>2.0</string>
<key>com.apple.iokit.IOHDAFamily</key>
<string>1.0.0d1</string>
<key>com.apple.iokit.IONDRVSupport</key>
<string>2.0</string>
<key>com.apple.kpi.bsd</key>
<string>8.0.0b3</string>
<key>com.apple.kpi.iokit</key>
<string>8.0.0b3</string>
<key>com.apple.kpi.libkern</key>
<string>8.0.0b3</string>
<key>com.apple.kpi.mach</key>
<string>8.0.0b3</string>
<key>com.apple.kpi.private</key>
<string>8.0.0b3</string>
</dict>
</dict>
</plist>
``` | /content/code_sandbox/Clover-Configs/Lenovo/G50-70M/CLOVER/kexts/Other/AppleHDA.kext/Contents/Info.plist | xml | 2016-11-05T04:22:54 | 2024-08-12T19:25:53 | Hackintosh-Installer-University | huangyz0918/Hackintosh-Installer-University | 3,937 | 1,145 |
```xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="path_to_url"
xmlns:app="path_to_url"
xmlns:tools="path_to_url"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/white"
tools:context="home.smart.fly.animations.bga.BgaAllActivity">
<androidx.appcompat.widget.Toolbar
app:theme="@style/AppTheme.AppBarOverlay"
android:background="@color/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay"
app:navigationIcon="?attr/homeAsUpIndicator"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize">
</androidx.appcompat.widget.Toolbar>
<cn.bingoogolapple.refreshlayout.BGARefreshLayout
android:id="@+id/rl_modulename_refresh"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerview"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
</cn.bingoogolapple.refreshlayout.BGARefreshLayout>
</LinearLayout>
``` | /content/code_sandbox/app/src/main/res/layout/activity_bga_all.xml | xml | 2016-08-08T08:52:10 | 2024-08-12T19:24:13 | AndroidAnimationExercise | REBOOTERS/AndroidAnimationExercise | 1,868 | 291 |
```xml
import {Config} from '../common/config/private/Config';
import * as express from 'express';
import {Request} from 'express';
import * as cookieParser from 'cookie-parser';
import * as _http from 'http';
import {Server as HttpServer} from 'http';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import * as locale from 'locale';
import {ObjectManagers} from './model/ObjectManagers';
import {Logger} from './Logger';
import {LoggerRouter} from './routes/LoggerRouter';
import {ConfigDiagnostics} from './model/diagnostics/ConfigDiagnostics';
import {Localizations} from './model/Localizations';
import {CookieNames} from '../common/CookieNames';
import {Router} from './routes/Router';
import {PhotoProcessing} from './model/fileaccess/fileprocessing/PhotoProcessing';
import * as _csrf from 'csurf';
import {Event} from '../common/event/Event';
import {QueryParams} from '../common/QueryParams';
import {ConfigClassBuilder} from 'typeconfig/node';
import {ConfigClassOptions} from 'typeconfig/src/decorators/class/IConfigClass';
import {ServerConfig} from '../common/config/private/PrivateConfig';
import {unless} from 'express-unless';
// eslint-disable-next-line @typescript-eslint/no-var-requires
const session = require('cookie-session');
declare const process: NodeJS.Process;
const LOG_TAG = '[server]';
export class Server {
public onStarted = new Event<void>();
public app: express.Express;
private server: HttpServer;
public static instance: Server = null;
public static getInstance(): Server {
if (!this.instance) {
this.instance = new Server();
}
return this.instance;
}
constructor(listen = true) {
if (!(process.env.NODE_ENV === 'production')) {
Logger.info(
LOG_TAG,
'Running in DEBUG mode, set env variable NODE_ENV=production to disable '
);
}
this.init(listen).catch(console.error);
}
get Server(): HttpServer {
return this.server;
}
async init(listen = true): Promise<void> {
this.app = express();
LoggerRouter.route(this.app);
this.app.set('view engine', 'ejs');
Logger.info(LOG_TAG, 'running diagnostics...');
await ConfigDiagnostics.runDiagnostics();
Logger.verbose(
LOG_TAG,
() => 'using config from ' +
(
ConfigClassBuilder.attachPrivateInterface(Config)
.__options as ConfigClassOptions<ServerConfig>
).configPath +
':'
);
Logger.verbose(LOG_TAG, () => JSON.stringify(Config.toJSON({attachDescription: false}), (k, v) => {
const MAX_LENGTH = 80;
if (typeof v === 'string' && v.length > MAX_LENGTH) {
v = v.slice(0, MAX_LENGTH - 3) + '...';
}
return v;
}, 2));
/**
* Session above all
*/
this.app.use(
session({
name: CookieNames.session,
keys: Config.Server.sessionSecret,
})
);
/**
* Parse parameters in POST
*/
// for parsing application/json
this.app.use(express.json());
this.app.use(cookieParser());
const csuf: any = _csrf();
csuf.unless = unless;
this.app.use(
csuf.unless((req: Request) => {
return (
Config.Users.authenticationRequired === false ||
[Config.Server.apiPath + '/user/login', Config.Server.apiPath + '/user/logout', Config.Server.apiPath + '/share/login'].indexOf(
req.originalUrl
) !== -1 ||
(Config.Sharing.enabled === true &&
!!req.query[QueryParams.gallery.sharingKey_query])
);
})
);
// enable token generation but do not check it
this.app.post(
[Config.Server.apiPath + '/user/login', Config.Server.apiPath + '/share/login'],
_csrf({ignoreMethods: ['POST']})
);
this.app.get(
[Config.Server.apiPath + '/user/me', Config.Server.apiPath + '/share/:' + QueryParams.gallery.sharingKey_params],
_csrf({ignoreMethods: ['GET']})
);
PhotoProcessing.init();
Localizations.init();
this.app.use(locale(Config.Server.languages, 'en'));
await ObjectManagers.getInstance().init();
Router.route(this.app);
// Get PORT from environment and store in Express.
this.app.set('port', Config.Server.port);
// Create HTTP server.
this.server = _http.createServer(this.app);
// Listen on provided PORT, on all network interfaces.
if (listen) {
this.server.listen(Config.Server.port, Config.Server.host);
}
this.server.on('error', this.onError);
this.server.on('listening', this.onListening);
this.server.on('close', this.onClose);
// Sigterm handler
process.removeAllListeners('SIGTERM');
process.on('SIGTERM', this.SIGTERM);
if (!listen) {
this.onStarted.trigger();
}
}
private SIGTERM = () =>{
Logger.info(LOG_TAG, 'SIGTERM signal received');
this.server.close(() => {
process.exit(0);
});
}
/**
* Event listener for HTTP server "error" event.
*/
private onError = (error: any) => {
if (error.syscall !== 'listen') {
Logger.error(LOG_TAG, 'Server error', error);
throw error;
}
const bind = Config.Server.host + ':' + Config.Server.port;
// handle specific listen error with friendly messages
switch (error.code) {
case 'EACCES':
Logger.error(LOG_TAG, bind + ' requires elevated privileges');
process.exit(1);
break;
case 'EADDRINUSE':
Logger.error(LOG_TAG, bind + ' is already in use');
process.exit(1);
break;
default:
throw error;
}
};
/**
* Event listener for HTTP server "listening" event.
*/
private onListening = () => {
const addr = this.server.address();
const bind =
typeof addr === 'string' ? 'pipe ' + addr : 'port ' + addr.port;
Logger.info(LOG_TAG, 'Listening on ' + bind);
this.onStarted.trigger();
};
/**
* Event listener for HTTP server "close" event.
*/
private onClose = () => {
Logger.info(LOG_TAG, 'Closed http server');
};
public Stop(): Promise<void> {
return new Promise((resolve, reject) => {
if(!this.server.listening){
return resolve();
}
this.server.close((err) => {
if (!err) {
return resolve();
}
reject(err);
});
});
}
}
``` | /content/code_sandbox/src/backend/server.ts | xml | 2016-03-12T11:46:41 | 2024-08-16T19:56:44 | pigallery2 | bpatrik/pigallery2 | 1,727 | 1,469 |
```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
/**
* Status code.
*
* ## Notes
*
* The status code indicates the following conditions:
*
* - if equal to zero, then the factorization was successful.
* - if less than zero, then the k-th argument had an illegal value, where `k = -StatusCode`.
* - if greater than zero, then the leading principal minor of order `k` is not positive, where `k = StatusCode`. If `k < N`, then the factorization could not be completed. If `k = N`, then the factorization was completed, but `D(N) <= 0`, meaning that the matrix `A` is not positive definite.
*/
type StatusCode = number;
/**
* Interface describing `dpttrf`.
*/
interface Routine {
/**
* Computes the `L * D * L^T` factorization of a real symmetric positive definite tridiagonal matrix `A`.
*
* @param N - order of matrix `A`
* @param D - the `N` diagonal elements of `A`
* @param E - the `N-1` subdiagonal elements of `A`
* @returns status code
*
* @example
* var Float64Array = require( '@stdlib/array/float64' );
*
* var D = new Float64Array( [ 4.0, 5.0, 6.0 ] );
* var E = new Float64Array( [ 1.0, 2.0 ] );
*
* dpttrf( 3, D, E );
* // D => <Float64Array>[ 4, 4.75, ~5.15789 ]
* // E => <Float64Array>[ 0.25, ~0.4210 ]
*/
( N: number, D: Float64Array, E: Float64Array ): StatusCode;
/**
* Computes the `L * D * L^T` factorization of a real symmetric positive definite tridiagonal matrix `A` using alternative indexing semantics.
*
* @param N - order of matrix `A`
* @param D - the `N` diagonal elements of `A`
* @param strideD - stride length for `D`
* @param offsetD - starting index of `D`
* @param E - the `N-1` subdiagonal elements of `A`
* @param strideE - stride length for `E`
* @param offsetE - starting index of `E`
* @returns status code
*
* @example
* var Float64Array = require( '@stdlib/array/float64' );
*
* var D = new Float64Array( [ 4.0, 5.0, 6.0 ] );
* var E = new Float64Array( [ 1.0, 2.0 ] );
*
* dpttrf.ndarray( 3, D, 1, 0, E, 1, 0 );
* // D => <Float64Array>[ 4, 4.75, ~5.15789 ]
* // E => <Float64Array>[ 0.25, ~0.4210 ]
*/
ndarray( N: number, D: Float64Array, strideD: number, offsetD: number, E: Float64Array, strideE: number, offsetE: number ): StatusCode;
}
/**
* Computes the `L * D * L^T` factorization of a real symmetric positive definite tridiagonal matrix `A`.
*
* @param N - order of matrix `A`
* @param D - the `N` diagonal elements of `A`
* @param E - the `N-1` subdiagonal elements of `A`
* @returns status code
*
* @example
* var Float64Array = require( '@stdlib/array/float64' );
*
* var D = new Float64Array( [ 4.0, 5.0, 6.0 ] );
* var E = new Float64Array( [ 1.0, 2.0 ] );
*
* dpttrf( 3, D, E );
* // D => <Float64Array>[ 4, 4.75, ~5.15789 ]
* // E => <Float64Array>[ 0.25, ~0.4210 ]
*
* @example
* var Float64Array = require( '@stdlib/array/float64' );
*
* var D = new Float64Array( [ 4.0, 5.0, 6.0 ] );
* var E = new Float64Array( [ 1.0, 2.0 ] );
*
* dpttrf.ndarray( 3, D, 1, 0, E, 1, 0 );
* // D => <Float64Array>[ 4, 4.75, ~5.15789 ]
* // E => <Float64Array>[ 0.25, ~0.4210 ]
*/
declare var dpttrf: Routine;
// EXPORTS //
export = dpttrf;
``` | /content/code_sandbox/lib/node_modules/@stdlib/lapack/base/dpttrf/docs/types/index.d.ts | xml | 2016-03-24T04:19:52 | 2024-08-16T09:03:19 | stdlib | stdlib-js/stdlib | 4,266 | 1,166 |
```xml
<?xml version="1.0" encoding="utf-8"?>
<!--EXPORTED BY TOOL, DON'T MODIFY IT!-->
<!--Source File: node_test\query_ut_4.xml-->
<behavior name="node_test/query_ut_4" agenttype="AgentBehaviacNode" version="1">
<node class="Sequence" version="1" id="0">
<property EnterAction="Self.AgentBehaviacNode::enter_action_1(0)" />
<property ExitAction="Self.AgentBehaviacNode::exit_action_2(0,"")" />
<node class="Query" version="1" id="1">
<property Descriptors="1:{Attribute=int Self.AgentBehaviacNode::testVar_1;Reference=const int 0;Weight=100;}" />
<property Domain="test" />
</node>
<node class="Sequence" version="1" id="2">
<node class="Query" version="1" id="3">
<property Descriptors="1:{Attribute=int Self.AgentBehaviacNode::testVar_1;Reference=const int 0;Weight=100;}" />
<property Domain="test" />
</node>
<node class="Query" version="1" id="4">
<property Descriptors="1:{Attribute=int Self.AgentBehaviacNode::testVar_1;Reference=const int 0;Weight=100;}" />
<property Domain="test" />
</node>
</node>
</node>
</behavior>
``` | /content/code_sandbox/integration/unity/Assets/Resources/behaviac/exported/node_test/query_ut_4.xml | xml | 2016-11-21T05:08:08 | 2024-08-16T07:18:30 | behaviac | Tencent/behaviac | 2,831 | 338 |
```xml
<?xml version="1.0" encoding="UTF-8" ?>
<Shell
x:Class="MyCompanyName.MyProjectName.AppShell"
xmlns="path_to_url"
xmlns:x="path_to_url"
xmlns:local="clr-namespace:MyCompanyName.MyProjectName"
Shell.FlyoutBehavior="Disabled">
<ShellContent
Title="Home"
ContentTemplate="{DataTemplate local:MainPage}"
Route="MainPage" />
</Shell>
``` | /content/code_sandbox/templates/maui/src/MyCompanyName.MyProjectName/AppShell.xaml | xml | 2016-12-03T22:56:24 | 2024-08-16T16:24:05 | abp | abpframework/abp | 12,657 | 102 |
```xml
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14868" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14868"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="Document">
<connections>
<outlet property="gbsAuthor" destination="gaD-ZH-Beh" id="2i7-BD-bJ2"/>
<outlet property="gbsNextPrevButton" destination="SRS-M5-VVL" id="YEN-01-wRX"/>
<outlet property="gbsPlayPauseButton" destination="qxJ-pH-d0y" id="qk8-8I-9u5"/>
<outlet property="gbsPlayerView" destination="c22-O7-iKe" id="A1w-e5-EQE"/>
<outlet property="gbsRewindButton" destination="0yD-Sp-Ilo" id="FgR-xd-JW5"/>
<outlet property="gbsTitle" destination="H3v-X3-48q" id="DCl-wL-oy8"/>
<outlet property="gbsTracks" destination="I1T-VS-Vse" id="Vk4-GP-RjB"/>
<outlet property="gbsVisualizer" destination="Q3o-bK-DIN" id="1YC-C5-Je6"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customView id="c22-O7-iKe">
<rect key="frame" x="0.0" y="0.0" width="332" height="221"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="H3v-X3-48q">
<rect key="frame" x="18" y="192" width="296" height="19"/>
<autoresizingMask key="autoresizingMask" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="clipping" alignment="center" title="Title" id="BwZ-Zj-sP6">
<font key="font" metaFont="systemBold" size="16"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="gaD-ZH-Beh">
<rect key="frame" x="18" y="166" width="296" height="16"/>
<autoresizingMask key="autoresizingMask" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="clipping" alignment="center" title="Author" id="IgT-r1-T38">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<button focusRingType="none" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="qxJ-pH-d0y">
<rect key="frame" x="57" y="124" width="50" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="push" bezelStyle="rounded" image="Play" imagePosition="only" alignment="center" alternateImage="Pause" state="on" borderStyle="border" focusRingType="none" inset="2" id="3ZK-br-UrS">
<behavior key="behavior" pushIn="YES" changeContents="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="togglePause:" target="-2" id="AUe-I7-nOK"/>
</connections>
</button>
<popUpButton focusRingType="none" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="I1T-VS-Vse">
<rect key="frame" x="105" y="127" width="141" height="25"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<popUpButtonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" alignment="center" lineBreakMode="truncatingTail" borderStyle="border" focusRingType="none" imageScaling="proportionallyDown" inset="2" id="YJh-dI-A5D">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" id="Knp-Ok-Pb4"/>
</popUpButtonCell>
<connections>
<action selector="changeGBSTrack:" target="-2" id="HET-AT-CfQ"/>
</connections>
</popUpButton>
<segmentedControl verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="SRS-M5-VVL">
<rect key="frame" x="247" y="129" width="68" height="24"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<segmentedCell key="cell" borderStyle="border" alignment="left" style="rounded" trackingMode="momentary" id="cmq-I8-cFL">
<font key="font" metaFont="system"/>
<segments>
<segment toolTip="Previous Track" image="Previous" width="31"/>
<segment toolTip="Next Track" image="Next" width="30" tag="1"/>
</segments>
</segmentedCell>
<connections>
<action selector="gbsNextPrevPushed:" target="-2" id="roN-Iy-tDQ"/>
</connections>
</segmentedControl>
<box verticalHuggingPriority="750" fixedFrame="YES" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="b9A-cd-ias">
<rect key="frame" x="0.0" y="117" width="332" height="5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
</box>
<customView appearanceType="darkAqua" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="tRy-Gw-IaG" customClass="GBOptionalVisualEffectView">
<rect key="frame" x="0.0" y="24" width="332" height="95"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Q3o-bK-DIN" customClass="GBVisualizerView">
<rect key="frame" x="0.0" y="0.0" width="332" height="95"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
</customView>
</subviews>
</customView>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="2dl-dH-E3J">
<rect key="frame" x="18" y="5" width="296" height="14"/>
<autoresizingMask key="autoresizingMask" flexibleMinY="YES"/>
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<button focusRingType="none" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="0yD-Sp-Ilo">
<rect key="frame" x="13" y="124" width="50" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="push" bezelStyle="rounded" image="Rewind" imagePosition="only" alignment="center" state="on" borderStyle="border" focusRingType="none" inset="2" id="ZIF-TP-Fqn">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="changeGBSTrack:" target="-2" id="jug-AS-bW7"/>
</connections>
</button>
</subviews>
<point key="canvasLocation" x="67" y="292.5"/>
</customView>
</objects>
<resources>
<image name="Next" width="16" height="10"/>
<image name="Pause" width="10" height="10"/>
<image name="Play" width="10" height="10"/>
<image name="Previous" width="16" height="10"/>
<image name="Rewind" width="10" height="10"/>
</resources>
</document>
``` | /content/code_sandbox/Cocoa/GBS11.xib | xml | 2016-04-01T20:39:14 | 2024-08-16T17:51:49 | SameBoy | LIJI32/SameBoy | 1,613 | 2,298 |
```xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="BSP_PadButtonStyle.Numeric">
<item name="android:textSize">36sp</item>
</style>
<style name="BSP_PadButtonStyle.Numeric.Minute">
<item name="android:textSize">30sp</item>
</style>
</resources>
``` | /content/code_sandbox/bottomsheetpickers/src/main/res/values-sw600dp-land/styles.xml | xml | 2016-10-06T01:20:05 | 2024-08-05T10:12:07 | BottomSheetPickers | philliphsu/BottomSheetPickers | 1,101 | 86 |
```xml
// See LICENSE in the project root for license information.
import * as path from 'path';
import * as fs from 'fs';
import * as nodeResolve from 'resolve';
import stripJsonComments from 'strip-json-comments';
import { Helpers } from './Helpers';
/**
* Represents the literal contents of the `config/rig.json` file.
*
* @public
*/
export interface IRigConfigJson {
/**
* The name of the rig package to use.
*
* @remarks
* The name must be a valid NPM package name, and must end with the `-rig` suffix.
*
* Example: `example-rig`
*/
rigPackageName: string;
/**
* Specify which rig profile to use from the rig package.
*
* @remarks
* The name must consist of lowercase alphanumeric words separated by hyphens, for example `"sample-profile"`.
* If the `"rigProfile"` is not specified, then the profile name `"default"` will be used.
*
* Example: `example-profile`
*/
rigProfile?: string;
}
interface IRigConfigOptions {
projectFolderPath: string;
rigFound: boolean;
filePath: string;
rigPackageName: string;
rigProfile?: string;
}
/**
* Options for {@link RigConfig.loadForProjectFolder}.
*
* @public
*/
export interface ILoadForProjectFolderOptions {
/**
* The path to the folder of the project to be analyzed. This folder should contain a `package.json` file.
*/
projectFolderPath: string;
/**
* If specified, instead of loading the `config/rig.json` from disk, this object will be substituted instead.
*/
overrideRigJsonObject?: IRigConfigJson;
/**
* If specified, force a fresh load instead of returning a cached entry, if one existed.
*/
bypassCache?: boolean;
}
/**
* This is the main API for loading the `config/rig.json` file format.
*
* @public
*/
export interface IRigConfig {
/**
* The project folder path that was passed to {@link RigConfig.loadForProjectFolder},
* which maybe an absolute or relative path.
*
* @remarks
* Example: `.`
*/
readonly projectFolderOriginalPath: string;
/**
* The absolute path for the project folder path that was passed to {@link RigConfig.loadForProjectFolder}.
*
* @remarks
* Example: `/path/to/your-project`
*/
readonly projectFolderPath: string;
/**
* Returns `true` if `config/rig.json` was found, or `false` otherwise.
*/
readonly rigFound: boolean;
/**
* The full path to the `rig.json` file that was found, or `""` if none was found.
*
* @remarks
* Example: `/path/to/your-project/config/rig.json`
*/
readonly filePath: string;
/**
* The `"rigPackageName"` field from `rig.json`, or `""` if the file was not found.
*
* @remarks
* The name must be a valid NPM package name, and must end with the `-rig` suffix.
*
* Example: `example-rig`
*/
readonly rigPackageName: string;
/**
* The `"rigProfile"` value that was loaded from `rig.json`, or `""` if the file was not found.
*
* @remarks
* The name must consist of lowercase alphanumeric words separated by hyphens, for example `"sample-profile"`.
* If the `rig.json` file exists, but the `"rigProfile"` is not specified, then the profile
* name will be `"default"`.
*
* Example: `example-profile`
*/
readonly rigProfile: string;
/**
* The relative path to the rig profile specified by `rig.json`, or `""` if the file was not found.
*
* @remarks
* Example: `profiles/example-profile`
*/
readonly relativeProfileFolderPath: string;
/**
* Performs Node.js module resolution to locate the rig package folder, then returns the absolute path
* of the rig profile folder specified by `rig.json`.
*
* @remarks
* If no `rig.json` file was found, then this method throws an error. The first time this method
* is called, the result is cached and will be returned by all subsequent calls.
*
* Example: `/path/to/your-project/node_modules/example-rig/profiles/example-profile`
*/
getResolvedProfileFolder(): string;
/**
* An async variant of {@link IRigConfig.getResolvedProfileFolder}
*/
getResolvedProfileFolderAsync(): Promise<string>;
/**
* This lookup first checks for the specified relative path under `projectFolderPath`; if it does
* not exist there, then it checks in the resolved rig profile folder. If the file is found,
* its absolute path is returned. Otherwise, `undefined` is returned.
*
* @remarks
* For example, suppose the rig profile is:
*
* `/path/to/your-project/node_modules/example-rig/profiles/example-profile`
*
* And suppose `configFileRelativePath` is `folder/file.json`. Then the following locations will be checked:
*
* `/path/to/your-project/folder/file.json`
*
* `/path/to/your-project/node_modules/example-rig/profiles/example-profile/folder/file.json`
*/
tryResolveConfigFilePath(configFileRelativePath: string): string | undefined;
/**
* An async variant of {@link IRigConfig.tryResolveConfigFilePath}
*/
tryResolveConfigFilePathAsync(configFileRelativePath: string): Promise<string | undefined>;
}
/**
* {@inheritdoc IRigConfig}
*
* @public
*/
export class RigConfig implements IRigConfig {
// For syntax details, see PackageNameParser from @rushstack/node-core-library
private static readonly _packageNameRegExp: RegExp = /^(@[A-Za-z0-9\-_\.]+\/)?[A-Za-z0-9\-_\.]+$/;
// Rig package names must have the "-rig" suffix.
// Also silently accept "-rig-test" for our build test projects.
private static readonly _rigNameRegExp: RegExp = /-rig(-test)?$/;
// Profiles must be lowercase alphanumeric words separated by hyphens
private static readonly _profileNameRegExp: RegExp = /^[a-z0-9_\.]+(\-[a-z0-9_\.]+)*$/;
/**
* Returns the absolute path of the `rig.schema.json` JSON schema file for `config/rig.json`,
* which is bundled with this NPM package.
*
* @remarks
* The `RigConfig` class already performs schema validation when loading `rig.json`; however
* this schema file may be useful for integration with other validation tools.
*
* @public
*/
public static jsonSchemaPath: string = path.resolve(__dirname, './schemas/rig.schema.json');
private static _jsonSchemaObject: object | undefined = undefined;
private static readonly _configCache: Map<string, RigConfig> = new Map();
/**
* {@inheritdoc IRigConfig.projectFolderOriginalPath}
*/
public readonly projectFolderOriginalPath: string;
/**
* {@inheritdoc IRigConfig.projectFolderPath}
*/
public readonly projectFolderPath: string;
/**
* {@inheritdoc IRigConfig.rigFound}
*/
public readonly rigFound: boolean;
/**
* {@inheritdoc IRigConfig.filePath}
*/
public readonly filePath: string;
/**
* {@inheritdoc IRigConfig.rigPackageName}
*/
public readonly rigPackageName: string;
/**
* {@inheritdoc IRigConfig.rigProfile}
*/
public readonly rigProfile: string;
/**
* {@inheritdoc IRigConfig.relativeProfileFolderPath}
*/
public readonly relativeProfileFolderPath: string;
// Example: /path/to/your-project/node_modules/example-rig/
// If the value is `undefined`, then getResolvedProfileFolder() has not calculated it yet
private _resolvedRigPackageFolder: string | undefined;
// Example: /path/to/your-project/node_modules/example-rig/profiles/example-profile
// If the value is `undefined`, then getResolvedProfileFolder() has not calculated it yet
private _resolvedProfileFolder: string | undefined;
private constructor(options: IRigConfigOptions) {
const { projectFolderPath, rigFound, filePath, rigPackageName, rigProfile = 'default' } = options;
this.projectFolderOriginalPath = projectFolderPath;
this.projectFolderPath = path.resolve(projectFolderPath);
this.rigFound = rigFound;
this.filePath = filePath;
this.rigPackageName = rigPackageName;
this.rigProfile = rigProfile;
if (this.rigFound) {
this.relativeProfileFolderPath = 'profiles/' + this.rigProfile;
} else {
this.relativeProfileFolderPath = '';
}
}
/**
* The JSON contents of the {@link RigConfig.jsonSchemaPath} file.
*
* @remarks
* The JSON object will be lazily loaded when this property getter is accessed, and the result
* will be cached.
* Accessing this property may make a synchronous filesystem call.
*/
public static get jsonSchemaObject(): object {
if (RigConfig._jsonSchemaObject === undefined) {
const jsonSchemaContent: string = fs.readFileSync(RigConfig.jsonSchemaPath).toString();
RigConfig._jsonSchemaObject = JSON.parse(jsonSchemaContent);
}
return RigConfig._jsonSchemaObject!;
}
/**
* Use this method to load the `config/rig.json` file for a given project.
*
* @remarks
* If the file cannot be found, an empty `RigConfig` object will be returned with {@link RigConfig.rigFound}
* equal to `false`.
*/
public static loadForProjectFolder(options: ILoadForProjectFolderOptions): RigConfig {
const { overrideRigJsonObject, projectFolderPath } = options;
const fromCache: RigConfig | undefined =
!options.bypassCache && !overrideRigJsonObject
? RigConfig._configCache.get(projectFolderPath)
: undefined;
if (fromCache) {
return fromCache;
}
const rigConfigFilePath: string = path.join(projectFolderPath, 'config/rig.json');
let config: RigConfig | undefined;
let json: IRigConfigJson | undefined = overrideRigJsonObject;
try {
if (!json) {
const rigConfigFileContent: string = fs.readFileSync(rigConfigFilePath).toString();
json = JSON.parse(stripJsonComments(rigConfigFileContent)) as IRigConfigJson;
}
RigConfig._validateSchema(json);
} catch (error) {
config = RigConfig._handleConfigError(error as Error, projectFolderPath, rigConfigFilePath);
}
if (!config) {
config = new RigConfig({
projectFolderPath: projectFolderPath,
rigFound: true,
filePath: rigConfigFilePath,
rigPackageName: json!.rigPackageName,
rigProfile: json!.rigProfile
});
}
if (!overrideRigJsonObject) {
RigConfig._configCache.set(projectFolderPath, config);
}
return config;
}
/**
* An async variant of {@link RigConfig.loadForProjectFolder}
*/
public static async loadForProjectFolderAsync(options: ILoadForProjectFolderOptions): Promise<RigConfig> {
const { overrideRigJsonObject, projectFolderPath } = options;
const fromCache: RigConfig | false | undefined =
!options.bypassCache && !overrideRigJsonObject && RigConfig._configCache.get(projectFolderPath);
if (fromCache) {
return fromCache;
}
const rigConfigFilePath: string = path.join(projectFolderPath, 'config/rig.json');
let config: RigConfig | undefined;
let json: IRigConfigJson | undefined = overrideRigJsonObject;
try {
if (!json) {
const rigConfigFileContent: string = (await fs.promises.readFile(rigConfigFilePath)).toString();
json = JSON.parse(stripJsonComments(rigConfigFileContent)) as IRigConfigJson;
}
RigConfig._validateSchema(json);
} catch (error) {
config = RigConfig._handleConfigError(error as Error, projectFolderPath, rigConfigFilePath);
}
if (!config) {
config = new RigConfig({
projectFolderPath: projectFolderPath,
rigFound: true,
filePath: rigConfigFilePath,
rigPackageName: json!.rigPackageName,
rigProfile: json!.rigProfile
});
}
if (!overrideRigJsonObject) {
RigConfig._configCache.set(projectFolderPath, config);
}
return config;
}
private static _handleConfigError(
error: NodeJS.ErrnoException,
projectFolderPath: string,
rigConfigFilePath: string
): RigConfig {
if (error.code !== 'ENOENT' && error.code !== 'ENOTDIR') {
throw new Error(error.message + '\nError loading config file: ' + rigConfigFilePath);
}
// File not found, i.e. no rig config
return new RigConfig({
projectFolderPath,
rigFound: false,
filePath: '',
rigPackageName: '',
rigProfile: ''
});
}
/**
* {@inheritdoc IRigConfig.getResolvedProfileFolder}
*/
public getResolvedProfileFolder(): string {
if (this._resolvedRigPackageFolder === undefined) {
if (!this.rigFound) {
throw new Error('Cannot resolve the rig package because no rig was specified for this project');
}
const rigPackageJsonModuleSpecifier: string = `${this.rigPackageName}/package.json`;
const resolveOptions: nodeResolve.Opts = { basedir: this.projectFolderPath };
const resolvedRigPackageJsonPath: string = nodeResolve.sync(
rigPackageJsonModuleSpecifier,
resolveOptions
);
this._resolvedRigPackageFolder = path.dirname(resolvedRigPackageJsonPath);
}
if (this._resolvedProfileFolder === undefined) {
this._resolvedProfileFolder = path.join(this._resolvedRigPackageFolder, this.relativeProfileFolderPath);
if (!fs.existsSync(this._resolvedProfileFolder)) {
throw new Error(
`The rig profile "${this.rigProfile}" is not defined` +
` by the rig package "${this.rigPackageName}"`
);
}
}
return this._resolvedProfileFolder;
}
/**
* {@inheritdoc IRigConfig.getResolvedProfileFolderAsync}
*/
public async getResolvedProfileFolderAsync(): Promise<string> {
if (this._resolvedRigPackageFolder === undefined) {
if (!this.rigFound) {
throw new Error('Cannot resolve the rig package because no rig was specified for this project');
}
const rigPackageJsonModuleSpecifier: string = `${this.rigPackageName}/package.json`;
const resolveOptions: nodeResolve.Opts = { basedir: this.projectFolderPath };
const resolvedRigPackageJsonPath: string = await Helpers.nodeResolveAsync(
rigPackageJsonModuleSpecifier,
resolveOptions
);
this._resolvedRigPackageFolder = path.dirname(resolvedRigPackageJsonPath);
}
if (this._resolvedProfileFolder === undefined) {
this._resolvedProfileFolder = path.join(this._resolvedRigPackageFolder, this.relativeProfileFolderPath);
if (!(await Helpers.fsExistsAsync(this._resolvedProfileFolder))) {
throw new Error(
`The rig profile "${this.rigProfile}" is not defined` +
` by the rig package "${this.rigPackageName}"`
);
}
}
return this._resolvedProfileFolder;
}
/**
* {@inheritdoc IRigConfig.tryResolveConfigFilePath}
*/
public tryResolveConfigFilePath(configFileRelativePath: string): string | undefined {
if (!Helpers.isDownwardRelative(configFileRelativePath)) {
throw new Error('The configFileRelativePath is not a relative path: ' + configFileRelativePath);
}
const localPath: string = path.join(this.projectFolderPath, configFileRelativePath);
if (fs.existsSync(localPath)) {
return localPath;
}
if (this.rigFound) {
const riggedPath: string = path.join(this.getResolvedProfileFolder(), configFileRelativePath);
if (fs.existsSync(riggedPath)) {
return riggedPath;
}
}
return undefined;
}
/**
* {@inheritdoc IRigConfig.tryResolveConfigFilePathAsync}
*/
public async tryResolveConfigFilePathAsync(configFileRelativePath: string): Promise<string | undefined> {
if (!Helpers.isDownwardRelative(configFileRelativePath)) {
throw new Error('The configFileRelativePath is not a relative path: ' + configFileRelativePath);
}
const localPath: string = path.join(this.projectFolderPath, configFileRelativePath);
if (await Helpers.fsExistsAsync(localPath)) {
return localPath;
}
if (this.rigFound) {
const riggedPath: string = path.join(
await this.getResolvedProfileFolderAsync(),
configFileRelativePath
);
if (await Helpers.fsExistsAsync(riggedPath)) {
return riggedPath;
}
}
return undefined;
}
private static _validateSchema(json: IRigConfigJson): void {
for (const key of Object.getOwnPropertyNames(json)) {
switch (key) {
case '$schema':
case 'rigPackageName':
case 'rigProfile':
break;
default:
throw new Error(`Unsupported field ${JSON.stringify(key)}`);
}
}
if (!json.rigPackageName) {
throw new Error('Missing required field "rigPackageName"');
}
if (!RigConfig._packageNameRegExp.test(json.rigPackageName)) {
throw new Error(
`The "rigPackageName" value is not a valid NPM package name: ${JSON.stringify(json.rigPackageName)}`
);
}
if (!RigConfig._rigNameRegExp.test(json.rigPackageName)) {
throw new Error(
`The "rigPackageName" value is missing the "-rig" suffix: ` + JSON.stringify(json.rigProfile)
);
}
if (json.rigProfile !== undefined) {
if (!RigConfig._profileNameRegExp.test(json.rigProfile)) {
throw new Error(
`The profile name must consist of lowercase alphanumeric words separated by hyphens: ` +
JSON.stringify(json.rigProfile)
);
}
}
}
}
``` | /content/code_sandbox/libraries/rig-package/src/RigConfig.ts | xml | 2016-09-30T00:28:20 | 2024-08-16T18:54:35 | rushstack | microsoft/rushstack | 5,790 | 4,010 |
```xml
import * as React from 'react';
import { MentionIcon, RedbangIcon } from '@fluentui/react-icons-northstar';
import { Avatar, Chat, ChatItemProps, ShorthandCollection, Text } from '@fluentui/react-northstar';
import { robinAvatar, timAvatar } from './compactAvatars';
const items: ShorthandCollection<ChatItemProps> = [
{
gutter: <Avatar {...robinAvatar} />,
message: (
<Chat.Message
content={
<>
{'Hi '}
<Text atMention="me" content="Tim" />
{'!'}
</>
}
author="Robin Counts"
timestamp="10:20"
mine
badge={{
icon: <MentionIcon />,
}}
variables={{
hasMention: true,
}}
/>
),
key: 'message-id-1',
},
{
gutter: <Avatar {...timAvatar} />,
message: <Chat.Message content="Hey" author="Tim Deboer" timestamp="10:21" />,
key: 'message-id-2',
},
{
gutter: <Avatar {...robinAvatar} />,
message: (
<Chat.Message
content="Please look into this as soon as possible"
author="Robin Counts"
timestamp="10:22"
mine
badge={{
icon: <RedbangIcon />,
}}
variables={{
isImportant: true,
}}
/>
),
key: 'message-id-3',
},
];
export const CompactChatWithBadges = () => <Chat density="compact" items={items} />;
``` | /content/code_sandbox/packages/fluentui/react-northstar-prototypes/src/prototypes/compactChat/CompactChatWithBadges.tsx | xml | 2016-06-06T15:03:44 | 2024-08-16T18:49:29 | fluentui | microsoft/fluentui | 18,221 | 349 |
```xml
import { runMigrator } from "../migration-helper.spec";
import { MergeEnvironmentState } from "./45-merge-environment-state";
describe("MergeEnvironmentState", () => {
const migrator = new MergeEnvironmentState(44, 45);
it("can migrate all data", async () => {
const output = await runMigrator(migrator, {
authenticatedAccounts: ["user1", "user2"],
global: {
extra: "data",
},
global_environment_region: "US",
global_environment_urls: {
base: "example.com",
},
user1: {
extra: "data",
settings: {
extra: "data",
},
},
user2: {
extra: "data",
settings: {
extra: "data",
},
},
extra: "data",
user_user1_environment_region: "US",
user_user2_environment_region: "EU",
user_user1_environment_urls: {
base: "example.com",
},
user_user2_environment_urls: {
base: "other.example.com",
},
});
expect(output).toEqual({
authenticatedAccounts: ["user1", "user2"],
global: {
extra: "data",
},
global_environment_environment: {
region: "US",
urls: {
base: "example.com",
},
},
user1: {
extra: "data",
settings: {
extra: "data",
},
},
user2: {
extra: "data",
settings: {
extra: "data",
},
},
extra: "data",
user_user1_environment_environment: {
region: "US",
urls: {
base: "example.com",
},
},
user_user2_environment_environment: {
region: "EU",
urls: {
base: "other.example.com",
},
},
});
});
it("handles missing parts", async () => {
const output = await runMigrator(migrator, {
authenticatedAccounts: ["user1", "user2"],
global: {
extra: "data",
},
user1: {
extra: "data",
settings: {
extra: "data",
},
},
user2: null,
});
expect(output).toEqual({
authenticatedAccounts: ["user1", "user2"],
global: {
extra: "data",
},
user1: {
extra: "data",
settings: {
extra: "data",
},
},
user2: null,
});
});
it("can migrate only global data", async () => {
const output = await runMigrator(migrator, {
authenticatedAccounts: [],
global_environment_region: "Self-Hosted",
global: {},
});
expect(output).toEqual({
authenticatedAccounts: [],
global_environment_environment: {
region: "Self-Hosted",
urls: undefined,
},
global: {},
});
});
it("can migrate only user state", async () => {
const output = await runMigrator(migrator, {
authenticatedAccounts: ["user1"] as const,
global: null,
user1: { settings: {} },
user_user1_environment_region: "Self-Hosted",
user_user1_environment_urls: {
base: "some-base-url",
api: "some-api-url",
identity: "some-identity-url",
icons: "some-icons-url",
notifications: "some-notifications-url",
events: "some-events-url",
webVault: "some-webVault-url",
keyConnector: "some-keyConnector-url",
},
});
expect(output).toEqual({
authenticatedAccounts: ["user1"] as const,
global: null,
user1: { settings: {} },
user_user1_environment_environment: {
region: "Self-Hosted",
urls: {
base: "some-base-url",
api: "some-api-url",
identity: "some-identity-url",
icons: "some-icons-url",
notifications: "some-notifications-url",
events: "some-events-url",
webVault: "some-webVault-url",
keyConnector: "some-keyConnector-url",
},
},
});
});
});
``` | /content/code_sandbox/libs/common/src/state-migrations/migrations/45-merge-environment-state.spec.ts | xml | 2016-03-09T23:14:01 | 2024-08-16T15:07:51 | clients | bitwarden/clients | 8,877 | 930 |
```xml
import { SettingsManager } from "@Core/SettingsManager";
import { App, BrowserWindowConstructorOptions } from "electron";
import { join } from "path";
import { describe, expect, it, vi } from "vitest";
import { AppIconFilePathResolver } from "../AppIconFilePathResolver";
import { DefaultBrowserWindowConstructorOptionsProvider } from "./DefaultBrowserWindowConstructorOptionsProvider";
import { defaultWindowSize } from "./defaultWindowSize";
describe(DefaultBrowserWindowConstructorOptionsProvider, () => {
describe(DefaultBrowserWindowConstructorOptionsProvider.prototype.get, () => {
it("should use the default settings", () => {
const getValueMock = vi.fn();
const app = <App>{ isPackaged: true };
const settingsManager = <SettingsManager>{ getValue: (k, d) => getValueMock(k, d) };
const appIconFilePathResolver = <AppIconFilePathResolver>{ getAppIconFilePath: () => "appIconFilePath" };
expect(
new DefaultBrowserWindowConstructorOptionsProvider(app, settingsManager, appIconFilePathResolver).get(),
).toEqual(<BrowserWindowConstructorOptions>{
width: defaultWindowSize.width,
height: defaultWindowSize.height,
alwaysOnTop: undefined,
show: undefined,
frame: false,
icon: "appIconFilePath",
webPreferences: {
spellcheck: false,
preload: join(__dirname, "..", "dist-preload", "index.js"),
allowRunningInsecureContent: false,
webSecurity: true,
devTools: false,
},
});
expect(getValueMock).toHaveBeenCalledWith("window.showOnStartup", true);
expect(getValueMock).toHaveBeenCalledWith("window.alwaysOnTop", false);
});
it("should allow insecure content and disable web security if app is not packaged", () => {
const getValueMock = vi.fn();
const app = <App>{ isPackaged: false };
const settingsManager = <SettingsManager>{ getValue: (k, d) => getValueMock(k, d) };
const appIconFilePathResolver = <AppIconFilePathResolver>{ getAppIconFilePath: () => "appIconFilePath" };
const { webPreferences } = new DefaultBrowserWindowConstructorOptionsProvider(
app,
settingsManager,
appIconFilePathResolver,
).get();
expect(webPreferences.webSecurity).toBe(false);
expect(webPreferences.allowRunningInsecureContent).toBe(true);
expect(webPreferences.devTools).toBe(true);
});
});
});
``` | /content/code_sandbox/src/main/Core/BrowserWindow/BrowserWindowConstructorOptionsProvider/DefaultBrowserWindowConstructorOptionsProvider.test.ts | xml | 2016-10-11T04:59:52 | 2024-08-16T11:53:31 | ueli | oliverschwendener/ueli | 3,543 | 516 |
```xml
export type PlanFeatures = {
[key: string]: {
[plan: string]: {
planTitle: string;
heading?: string;
planDescription?: string;
features: {
title: string;
enabled: boolean;
tooltip?: string;
visibleInPricingPageOnly?: boolean;
}[];
};
};
};
``` | /content/code_sandbox/app/src/features/pricing/components/PricingTable/types.ts | xml | 2016-12-01T04:36:06 | 2024-08-16T19:12:19 | requestly | requestly/requestly | 2,121 | 75 |
```xml
import { View } from '../../common';
import { keys } from 'underscore';
import Layer from '../model/Layer';
import EditorModel from '../../editor/model/Editor';
import PropertyStackView from './PropertyStackView';
export default class LayerView extends View<Layer> {
pfx!: string;
ppfx!: string;
em!: EditorModel;
propertyView!: PropertyStackView;
propsWrapEl?: HTMLElement;
previewEl?: HTMLElement;
labelEl?: HTMLElement;
sorter!: any;
config!: any;
events() {
return {
click: 'select',
'click [data-close-layer]': 'removeItem',
'mousedown [data-move-layer]': 'initSorter',
'touchstart [data-move-layer]': 'initSorter',
};
}
template() {
const { pfx, ppfx, em } = this;
const icons = em?.getConfig().icons;
const iconClose = icons?.close || '';
const iconMove = icons?.move || '';
return `
<div class="${pfx}label-wrp">
<div id="${pfx}move" class="${ppfx}no-touch-actions" data-move-layer>
${iconMove}
</div>
<div id="${pfx}label" data-label></div>
<div id="${pfx}preview-box" class="${pfx}layer-preview" style="display: none" data-preview-box>
<div id="${pfx}preview" class="${pfx}layer-preview-cnt" data-preview></div>
</div>
<div id="${pfx}close-layer" class="${pfx}btn-close" data-close-layer>
${iconClose}
</div>
</div>
<div id="${pfx}inputs" data-properties></div>
`;
}
initialize(o: any = {}) {
const { model } = this;
const config = o.config || {};
this.em = config.em;
this.config = config;
this.sorter = o.sorter;
this.pfx = config.stylePrefix || '';
this.ppfx = config.pStylePrefix || '';
this.propertyView = o.propertyView;
const pModel = this.propertyView.model;
this.listenTo(model, 'destroy remove', this.remove);
this.listenTo(model, 'change:values', this.updateLabel);
this.listenTo(pModel, 'change:selectedLayer', this.updateVisibility);
// For the sorter
model.view = this;
// @ts-ignore
model.set({ droppable: 0, draggable: 1 });
this.$el.data('model', model);
}
initSorter() {
this.sorter?.startSort(this.el);
}
removeItem(ev: Event) {
ev && ev.stopPropagation();
this.model.remove();
}
select() {
this.model.select();
}
getPropertiesWrapper() {
if (!this.propsWrapEl) this.propsWrapEl = this.el.querySelector('[data-properties]')!;
return this.propsWrapEl;
}
getPreviewEl() {
if (!this.previewEl) this.previewEl = this.el.querySelector('[data-preview]')!;
return this.previewEl;
}
getLabelEl() {
if (!this.labelEl) this.labelEl = this.el.querySelector('[data-label]')!;
return this.labelEl;
}
updateLabel() {
const { model } = this;
const label = model.getLabel();
this.getLabelEl().innerHTML = label;
if (model.hasPreview()) {
const prvEl = this.getPreviewEl();
const style = model.getStylePreview({ number: { min: -3, max: 3 } });
const styleStr = keys(style)
.map((k) => `${k}:${style[k]}`)
.join(';');
prvEl.setAttribute('style', styleStr);
}
}
updateVisibility() {
const { pfx, model, propertyView } = this;
const wrapEl = this.getPropertiesWrapper();
const isSelected = model.isSelected();
wrapEl.style.display = isSelected ? '' : 'none';
this.$el[isSelected ? 'addClass' : 'removeClass'](`${pfx}active`);
isSelected && wrapEl.appendChild(propertyView.props?.el!);
}
render() {
const { el, pfx, model } = this;
el.innerHTML = this.template();
el.className = `${pfx}layer`;
if (model.hasPreview()) {
(el.querySelector('[data-preview-box]') as HTMLElement).style.display = '';
}
this.updateLabel();
this.updateVisibility();
return this;
}
}
``` | /content/code_sandbox/src/style_manager/view/LayerView.ts | xml | 2016-01-22T00:23:19 | 2024-08-16T11:20:59 | grapesjs | GrapesJS/grapesjs | 21,687 | 995 |
```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
/**
* Interface defining `isNegativeInteger` with methods for testing for primitives and objects, respectively.
*/
interface IsNegativeInteger {
/**
* Tests if a value is a negative integer.
*
* @param value - value to test
* @returns boolean indicating whether value is a negative integer
*
* @example
* var bool = isNegativeInteger( -5.0 );
* // returns true
*
* @example
* var bool = isNegativeInteger( new Number( -5.0 ) );
* // returns true
*
* @example
* var bool = isNegativeInteger( 5.0 );
* // returns false
*
* @example
* var bool = isNegativeInteger( -3.14 );
* // returns false
*
* @example
* var bool = isNegativeInteger( null );
* // returns false
*/
( value: any ): boolean;
/**
* Tests if a value is a number primitive having a negative integer value.
*
* @param value - value to test
* @returns boolean indicating if a value is a number primitive having a negative integer value
*
* @example
* var bool = isNegativeInteger.isPrimitive( -3.0 );
* // returns true
*
* @example
* var bool = isNegativeInteger.isPrimitive( new Number( -3.0 ) );
* // returns false
*/
isPrimitive( value: any ): boolean;
/**
* Tests if a value is a number object having a negative integer value.
*
* @param value - value to test
* @returns boolean indicating if a value is a number object having a negative integer value
*
* @example
* var bool = isNegativeInteger.isObject( -3.0 );
* // returns false
*
* @example
* var bool = isNegativeInteger.isObject( new Number( -3.0 ) );
* // returns true
*/
isObject( value: any ): boolean;
}
/**
* Tests if a value is a negative integer.
*
* @param value - value to test
* @returns boolean indicating whether value is a negative integer
*
* @example
* var bool = isNegativeInteger( -5.0 );
* // returns true
*
* @example
* var bool = isNegativeInteger( new Number( -5.0 ) );
* // returns true
*
* @example
* var bool = isNegativeInteger( 5.0 );
* // returns false
*
* @example
* var bool = isNegativeInteger( -3.14 );
* // returns false
*
* @example
* var bool = isNegativeInteger( null );
* // returns false
*
* @example
* var bool = isNegativeInteger.isPrimitive( -3.0 );
* // returns true
*
* @example
* var bool = isNegativeInteger.isObject( new Number( -3.0 ) );
* // returns true
*/
declare var isNegativeInteger: IsNegativeInteger;
// EXPORTS //
export = isNegativeInteger;
``` | /content/code_sandbox/lib/node_modules/@stdlib/assert/is-negative-integer/docs/types/index.d.ts | xml | 2016-03-24T04:19:52 | 2024-08-16T09:03:19 | stdlib | stdlib-js/stdlib | 4,266 | 738 |
```xml
import { c } from 'ttag';
import type { ContactEditProps } from '@proton/components/containers/contacts/edit/ContactEditModal';
import type { RecipientOrGroup } from '../../../models/address';
import RecipientItem from './RecipientItem';
import RecipientType from './RecipientType';
interface Props {
recipientsOrGroup: RecipientOrGroup[];
isLoading: boolean;
isOutside?: boolean;
onContactDetails: (contactID: string) => void;
onContactEdit: (props: ContactEditProps) => void;
}
const RecipientSimple = ({ isLoading, recipientsOrGroup, isOutside, onContactDetails, onContactEdit }: Props) => {
return (
<div className="flex flex-nowrap items-center" data-testid="message-header:to">
<RecipientType label={c('Label Recipient').t`To`}>
<span className="flex" data-testid="recipients:partial-recipients-list">
{recipientsOrGroup.length
? recipientsOrGroup.map((recipientOrGroup, index) => {
return (
<span className="mr-2 flex" key={index}>
<RecipientItem
recipientOrGroup={recipientOrGroup}
isLoading={isLoading}
isOutside={isOutside}
isRecipient={true}
isExpanded={false}
onContactDetails={onContactDetails}
onContactEdit={onContactEdit}
customDataTestId={`recipients:item-${
recipientOrGroup.group
? recipientOrGroup.group.group?.Name
: recipientOrGroup.recipient?.Address
}`}
/>
{index < recipientsOrGroup.length - 1 && (
<span className="message-recipient-item-separator mr-0.5">,</span>
)}
</span>
);
})
: c('Label').t`Undisclosed Recipients`}
</span>
</RecipientType>
</div>
);
};
export default RecipientSimple;
``` | /content/code_sandbox/applications/mail/src/app/components/message/recipients/RecipientSimple.tsx | xml | 2016-06-08T11:16:51 | 2024-08-16T14:14:27 | WebClients | ProtonMail/WebClients | 4,300 | 417 |
```xml
import * as compose from "lodash.flowright";
import { Alert, ButtonMutate, Spinner } from "@erxes/ui/src";
import { IButtonMutateProps } from "@erxes/ui/src/types";
import { mutations, queries } from "../graphql";
import FormCompnent from "../components/Form";
import React from "react";
import { gql } from "@apollo/client";
import { graphql } from "@apollo/client/react/hoc";
import { refetchQueries } from "../common/utils";
import { withProps } from "@erxes/ui/src/utils/core";
import { useNavigate } from "react-router-dom";
type Props = {
_id?: string;
queryParams: any;
};
type FinalProps = {
indicatorDetail: any;
duplicateMutation: any;
} & Props;
const FormContainer = (props: FinalProps) => {
const navigate = useNavigate();
const { indicatorDetail, queryParams, duplicateMutation } = props;
if (indicatorDetail?.loading) {
return <Spinner />;
}
const renderButton = ({
name,
values,
isSubmitted,
confirmationUpdate,
object,
callback,
}: IButtonMutateProps) => {
let mutation = mutations.riskIndicatorAdd;
let successAction = "added";
if (object) {
mutation = mutations.riskIndicatorUpdate;
successAction = "updated";
}
const afterMutate = ({ addRiskIndicator }) => {
if (callback) {
callback();
}
if (!object) {
const newIndicator = addRiskIndicator || {};
newIndicator &&
navigate(`/settings/risk-indicators/detail/${newIndicator._id}`);
}
};
return (
<ButtonMutate
mutation={mutation}
variables={values}
callback={afterMutate}
isSubmitted={isSubmitted}
refetchQueries={refetchQueries(queryParams)}
type="submit"
confirmationUpdate={confirmationUpdate}
successMessage={`You successfully ${successAction} a ${name}`}
/>
);
};
const duplicatIndicator = (_id) => {
duplicateMutation({ variables: { _id } })
.then(({ data }) => {
const duplicatedIndicator = data?.duplicateRiskIndicator || {};
duplicatedIndicator &&
navigate(
`/settings/risk-indicators/detail/${duplicatedIndicator._id}`
);
})
.catch((e) => {
Alert.error(e.message);
});
};
const updatedProps = {
...props,
detail: indicatorDetail?.riskIndicatorDetail,
renderButton,
duplicatIndicator,
navigate
};
return <FormCompnent {...updatedProps} />;
};
export default withProps<Props>(
compose(
graphql<Props>(gql(queries.indicatorDetail), {
name: "indicatorDetail",
skip: ({ _id }) => !_id,
options: ({ _id }) => ({
variables: { id: _id },
fetchPolicy: "no-cache",
}),
}),
graphql<Props>(gql(mutations.duplicate), {
name: "duplicateMutation",
})
)(FormContainer)
);
``` | /content/code_sandbox/packages/plugin-riskassessment-ui/src/indicator/containers/Form.tsx | xml | 2016-11-11T06:54:50 | 2024-08-16T10:26:06 | erxes | erxes/erxes | 3,479 | 660 |
```xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="article_content_horizontal_margin">0dp</dimen>
<dimen name="article_content_padding">16dp</dimen>
<dimen name="shot_item_container_padding">0dp</dimen>
<dimen name="shot_item_margin">0dp</dimen>
<dimen name="shot_item_margin_bottom">8dp</dimen>
<dimen name="shot_image_height">300dp</dimen>
<dimen name="shot_comments_margin_bottom">0dp</dimen>
<dimen name="content_recycler_view_padding">0dp</dimen>
</resources>
``` | /content/code_sandbox/mobile/src/main/res/values/dimens.xml | xml | 2016-05-04T13:33:42 | 2024-05-04T02:43:21 | Bourbon | hitherejoe/Bourbon | 1,115 | 155 |
```xml
import css from "./hello-world.module.css";
export default function HelloWorld() {
return (
<div className={css.hello}>
Hello World, I am being styled using CSS Modules!
</div>
);
}
``` | /content/code_sandbox/examples/next-css/app/_component/hello-world.tsx | xml | 2016-10-05T23:32:51 | 2024-08-16T19:44:30 | next.js | vercel/next.js | 124,056 | 47 |
```xml
import { strict as assert } from "assert";
import * as vs from "vscode";
import { InteractiveRefactors, SupportedParameterKind } from "../../../shared/vscode/interactive_refactors";
import { activate, emptyFile, extApi, helloWorldMainFile, sb } from "../../helpers";
describe("interactive refactors", () => {
const testRefactorCommandName = "myRefactorCommand";
beforeEach("activate", () => activate());
beforeEach("check capabilities", function () {
if (!extApi.isLsp)
this.skip();
});
it("does not rewrite unrelated code actions", async () => {
const refactors = extApi.interactiveRefactors!;
const codeActionWithCommand = new vs.CodeAction("e");
codeActionWithCommand.command = {
// Deliberately looks like a new refactor, but is missing "data".
arguments: [{
arguments: ["aaa"],
}],
command: "eee",
title: "ee",
};
const codeActions: Array<vs.Command | vs.CodeAction> = [
{ title: "a", command: "aa" },
{ title: "b", command: "bb", arguments: ["bbb"] },
new vs.CodeAction("d"),
new vs.CodeAction("d", vs.CodeActionKind.Refactor),
codeActionWithCommand,
];
const originalJson = JSON.stringify(codeActions);
refactors.rewriteCommands(codeActions);
const newJson = JSON.stringify(codeActions);
assert.equal(newJson, originalJson);
});
/// Rewrites and executes `codeAction` and returns arguments passed to the test refactor command.
async function executeRefactor(refactors: InteractiveRefactors, codeAction: vs.CodeAction) {
let capturedArgs: any;
refactors.rewriteCommands([codeAction]);
const commandSub = vs.commands.registerCommand(testRefactorCommandName, (args) => capturedArgs = args);
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
await vs.commands.executeCommand(codeAction.command!.command, ...codeAction.command!.arguments!);
await commandSub.dispose();
return capturedArgs;
}
/// Creates a test refactor with a single parameter with the supplier kind/defaultValue.
function createTestRefactor(kind: string, defaultValue: unknown, additionalArgs: Record<string, unknown> = {}) {
const refactorTitle = "My Interactive Refactor";
const refactorArgs = {
arguments: [defaultValue],
...additionalArgs,
};
const refactorParams = [
{
defaultValue,
kind,
parameterLabel: "My Parameter",
},
];
const codeAction = new vs.CodeAction(refactorTitle, vs.CodeActionKind.RefactorInline);
codeAction.command = {
arguments: [refactorArgs],
command: testRefactorCommandName,
title: codeAction.title,
};
(codeAction as any).data = {
parameters: refactorParams,
};
return codeAction;
}
it("rewrites interactive refactor code actions", async () => {
const refactors = extApi.interactiveRefactors!;
const kind = "unknown_kind";
const defaultValue = "aaa";
const codeAction = createTestRefactor(kind, defaultValue, { myRefactorCustomArg: 1 });
refactors.rewriteCommands([codeAction]);
const rewrittenCommandName = codeAction.command!.command;
const rewrittenArgments = codeAction.command!.arguments!;
assert.equal(rewrittenCommandName, InteractiveRefactors.commandName);
assert.equal(rewrittenArgments[0], testRefactorCommandName);
assert.equal(rewrittenArgments[1][0].kind, kind);
assert.equal(rewrittenArgments[1][0].defaultValue, defaultValue);
assert.deepStrictEqual(rewrittenArgments[2].arguments, [defaultValue]);
});
it("runs using original values for unknown kinds", async () => {
const refactors = extApi.interactiveRefactors!;
const kind = "unknown_kind";
const defaultValue = "aaa";
const codeAction = createTestRefactor(kind, defaultValue);
const capturedArgs = await executeRefactor(refactors, codeAction);
assert.deepStrictEqual(capturedArgs.arguments[0], defaultValue);
});
it("handles 'saveUri' parameters", async () => {
const refactors = extApi.interactiveRefactors!;
const kind = SupportedParameterKind.saveUri;
// Use emptyFile as the default.
const defaultValue = emptyFile;
// Provide mainFile to the prompt.
const showSaveDialog = sb.stub(vs.window, "showSaveDialog");
showSaveDialog.resolves(helloWorldMainFile);
const codeAction = createTestRefactor(kind, defaultValue);
const capturedArgs = await executeRefactor(refactors, codeAction);
// Expect the captured args to contain the value we returned from showSaveDialog.
assert.deepStrictEqual(capturedArgs.arguments[0], helloWorldMainFile.toString());
});
});
``` | /content/code_sandbox/src/test/dart/refactors/interactive_refactors.test.ts | xml | 2016-07-30T13:49:11 | 2024-08-10T16:23:15 | Dart-Code | Dart-Code/Dart-Code | 1,472 | 1,074 |
```xml
import { getElements, isTruthy } from './util';
const COLOR_MODE_KEY = 'netbox-color-mode';
/**
* Determine if a value is a supported color mode string value.
*/
function isColorMode(value: unknown): value is ColorMode {
return value === 'dark' || value === 'light';
}
/**
* Set the color mode to light or dark.
*
* @param mode `'light'` or `'dark'`
* @returns `true` if the color mode was successfully set, `false` if not.
*/
function storeColorMode(mode: ColorMode): void {
return localStorage.setItem(COLOR_MODE_KEY, mode);
}
function updateElements(targetMode: ColorMode): void {
const body = document.querySelector('body');
if (body && targetMode == 'dark') {
body.setAttribute('data-bs-theme', 'dark');
} else if (body) {
body.setAttribute('data-bs-theme', 'light');
}
for (const elevation of getElements<HTMLObjectElement>('.rack_elevation')) {
const svg = elevation.contentDocument?.querySelector('svg') ?? null;
if (svg !== null) {
svg.setAttribute(`data-bs-theme`, targetMode);
}
}
}
/**
* Call all functions necessary to update the color mode across the UI.
*
* @param mode Target color mode.
*/
export function setColorMode(mode: ColorMode): void {
storeColorMode(mode);
updateElements(mode);
}
/**
* Toggle the color mode when a color mode toggle is clicked.
*/
function handleColorModeToggle(): void {
const currentValue = localStorage.getItem(COLOR_MODE_KEY);
if (currentValue === 'light') {
setColorMode('dark');
} else if (currentValue === 'dark') {
setColorMode('light');
} else {
console.warn('Unable to determine the current color mode');
}
}
/**
* Determine the user's preference and set it as the color mode.
*/
function defaultColorMode(): void {
// Get the current color mode value from local storage.
const currentValue = localStorage.getItem(COLOR_MODE_KEY) as Nullable<ColorMode>;
if (isTruthy(currentValue)) {
return setColorMode(currentValue);
}
let preference: ColorModePreference = 'none';
// Determine if the user prefers dark or light mode.
for (const mode of ['dark', 'light']) {
if (window.matchMedia(`(prefers-color-scheme: ${mode})`).matches) {
preference = mode as ColorModePreference;
break;
}
}
if (isTruthy(currentValue) && isColorMode(currentValue)) {
return setColorMode(currentValue);
}
switch (preference) {
case 'dark':
return setColorMode('dark');
case 'light':
return setColorMode('light');
case 'none':
return setColorMode('light');
default:
return setColorMode('light');
}
}
/**
* Initialize color mode toggle buttons and set the default color mode.
*/
function initColorModeToggle(): void {
for (const element of getElements<HTMLButtonElement>('button.color-mode-toggle')) {
element.addEventListener('click', handleColorModeToggle);
}
}
/**
* Initialize all color mode elements.
*/
export function initColorMode(): void {
window.addEventListener('load', defaultColorMode);
for (const func of [initColorModeToggle]) {
func();
}
}
``` | /content/code_sandbox/netbox/project-static/src/colorMode.ts | xml | 2016-02-29T14:15:46 | 2024-08-16T16:25:20 | netbox | netbox-community/netbox | 15,588 | 712 |
```xml
import Sidebar from '@erxes/ui/src/layout/components/Sidebar';
export default Sidebar;
``` | /content/code_sandbox/packages/core-ui/src/modules/layout/components/Sidebar.tsx | xml | 2016-11-11T06:54:50 | 2024-08-16T10:26:06 | erxes | erxes/erxes | 3,479 | 18 |
```xml
import {
ExtensionRegistry,
MessageViewExtension,
ComposerExtension,
RegExpUtils,
Message,
} from 'mailspring-exports';
const TrackingBlacklist = [
{
name: 'NGPVan',
pattern: 'click.ngpvan.com/',
homepage: 'path_to_url
},
{
name: 'Sidekick',
pattern: 't.signaux',
homepage: 'path_to_url
},
{
name: 'Sidekick',
pattern: 't.senal',
homepage: 'path_to_url
},
{
name: 'Sidekick',
pattern: 't.sidekickopen',
homepage: 'path_to_url
},
{
name: 'Sidekick',
pattern: 't.sigopn',
homepage: 'path_to_url
},
{
name: 'Banana Tag',
pattern: 'bl-1.com',
homepage: 'path_to_url
},
{
name: 'Boomerang',
pattern: 'mailstat.us/tr',
homepage: 'path_to_url
},
{
name: 'Cirrus Inisght',
pattern: 'tracking.cirrusinsight.com',
homepage: 'path_to_url
},
{
name: 'Yesware',
pattern: 'app.yesware.com',
homepage: 'path_to_url
},
{
name: 'Yesware',
pattern: 't.yesware.com',
homepage: 'path_to_url
},
{
name: 'Streak',
pattern: 'mailfoogae.appspot.com',
homepage: 'path_to_url
},
{
name: 'LaunchBit',
pattern: 'launchbit.com/taz-pixel',
homepage: 'path_to_url
},
{
name: 'MailChimp',
pattern: 'list-manage.com/track',
homepage: 'path_to_url
},
{
name: 'Postmark',
pattern: 'cmail1.com/t',
homepage: 'path_to_url
},
{
name: 'iContact',
pattern: 'click.icptrack.com/icp/',
homepage: 'path_to_url
},
{
name: 'Infusionsoft',
pattern: 'infusionsoft.com/app/emailOpened',
homepage: 'path_to_url
},
{
name: 'Intercom',
pattern: 'via.intercom.io/o',
homepage: 'path_to_url
},
{
name: 'Mandrill',
pattern: 'mandrillapp.com/track',
homepage: 'path_to_url
},
{
name: 'Hubspot',
pattern: 't.hsms06.com',
homepage: 'path_to_url
},
{
name: 'RelateIQ',
pattern: 'app.relateiq.com/t.png',
homepage: 'path_to_url
},
{
name: 'RJ Metrics',
pattern: 'go.rjmetrics.com',
homepage: 'path_to_url
},
{
name: 'Mixpanel',
pattern: 'api.mixpanel.com/track',
homepage: 'path_to_url
},
{
name: 'Front App',
pattern: 'web.frontapp.com/api',
homepage: 'path_to_url
},
{
name: 'Mailtrack.io',
pattern: 'mailtrack.io/trace',
homepage: 'path_to_url
},
{
name: 'Salesloft',
pattern: 'sdr.salesloft.com/email_trackers',
homepage: 'path_to_url
},
];
export function rejectImagesInBody(body: string, callback: (url: string) => boolean) {
const spliceRegions = [];
const regex = RegExpUtils.imageTagRegex();
// Identify img tags that should be cut
let result = null;
while ((result = regex.exec(body)) !== null) {
if (callback(result[1])) {
spliceRegions.push({ start: result.index, end: result.index + result[0].length });
}
}
// Remove them all, from the end of the string to the start
let updated = body;
spliceRegions.reverse().forEach(({ start, end }) => {
updated = updated.substr(0, start) + updated.substr(end);
});
return updated;
}
export function removeTrackingPixels(message: Message) {
const isFromMe = message.isFromMe();
message.body = rejectImagesInBody(message.body, imageURL => {
if (isFromMe) {
// If the image is sent by the user, remove all forms of tracking pixels.
// They could be viewing an email they sent with Salesloft, etc.
for (const item of TrackingBlacklist) {
if (imageURL.indexOf(item.pattern) >= 0) {
return true;
}
}
}
// Remove Mailspring read receipt pixels for the current account. If this is a
// reply or a bounce, our read receipt could still be in the body and could
// trigger additional opens. (isFromMe is not sufficient!) [BG NOTE "HMID"]
if (
imageURL.includes(`getmailspring.com/open/${message.accountId.toUpperCase()}`) ||
imageURL.includes(`me=${encodeURIComponent(message.accountId)}`)
) {
return true;
}
return false;
});
}
class TrackingPixelsMessageExtension extends MessageViewExtension {
static formatMessageBody = ({ message }) => {
removeTrackingPixels(message);
};
}
class TrackingPixelsComposerExtension extends ComposerExtension {
static prepareNewDraft = ({ draft }) => {
removeTrackingPixels(draft);
};
}
export function activate() {
ExtensionRegistry.MessageView.register(TrackingPixelsMessageExtension);
ExtensionRegistry.Composer.register(TrackingPixelsComposerExtension);
}
export function deactivate() {
ExtensionRegistry.MessageView.unregister(TrackingPixelsMessageExtension);
ExtensionRegistry.Composer.unregister(TrackingPixelsComposerExtension);
}
``` | /content/code_sandbox/app/internal_packages/remove-tracking-pixels/lib/main.ts | xml | 2016-10-13T06:45:50 | 2024-08-16T18:14:37 | Mailspring | Foundry376/Mailspring | 15,331 | 1,286 |
```xml
export interface IFileData {
filePath: string;
content: string;
}
``` | /content/code_sandbox/src/interfaces/cli/IFileData.ts | xml | 2016-05-09T08:16:53 | 2024-08-16T19:43:07 | javascript-obfuscator | javascript-obfuscator/javascript-obfuscator | 13,358 | 18 |
```xml
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="path_to_url"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#ED7563"
android:pathData="M15,3L6,3c-0.83,0 -1.54,0.5 -1.84,1.22l-3.02,7.05c-0.09,0.23 -0.14,0.47 -0.14,0.73v1.91l0.01,0.01L1,14c0,1.1 0.9,2 2,2h6.31l-0.95,4.57 -0.03,0.32c0,0.41 0.17,0.79 0.44,1.06L9.83,23l6.59,-6.59c0.36,-0.36 0.58,-0.86 0.58,-1.41L17,5c0,-1.1 -0.9,-2 -2,-2zM19,3v12h4L23,3h-4z"/>
</vector>
``` | /content/code_sandbox/sample/src/main/res/drawable/skip_red_24dp.xml | xml | 2016-03-20T04:52:33 | 2024-08-08T01:21:44 | CardStackView | yuyakaido/CardStackView | 2,353 | 298 |
```xml
import React, { forwardRef } from 'react';
import { SectionList as RNSectionList } from 'react-native';
import { usePropsResolution } from '../../../hooks';
import { makeStyledComponent } from '../../../utils/styled';
import type { ISectionListProps } from './types';
import { useHasResponsiveProps } from '../../../hooks/useHasResponsiveProps';
const StyledSectionList: any = makeStyledComponent(RNSectionList);
const SectionListComponent = <ItemT extends any, sectionT extends any>(
props: ISectionListProps<ItemT, sectionT>,
ref: any
) => {
const { ...resolvedProps } = usePropsResolution('SectionList', props);
//TODO: refactor for responsive prop
if (useHasResponsiveProps(props)) {
return null;
}
return <StyledSectionList {...resolvedProps} ref={ref} />;
};
export const SectionList = forwardRef(SectionListComponent) as <
ItemT,
sectionT
>(
props: ISectionListProps<ItemT, sectionT>,
ref: any
) => any;
``` | /content/code_sandbox/src/components/basic/SectionList/SectionList.tsx | xml | 2016-04-15T11:37:23 | 2024-08-14T16:16:44 | NativeBase | GeekyAnts/NativeBase | 20,132 | 228 |
```xml
<?xml version="1.0" encoding="UTF-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="path_to_url" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 path_to_url">
<file original="Keka/en.lproj/AppShortcuts.strings" datatype="plaintext" source-language="en" target-language="zh-Hant">
<header>
<tool tool-id="com.apple.dt.xcode" tool-name="Xcode" tool-version="15.2" build-num="15C500b"/>
</header>
<body>
<trans-unit id="Compress Files with ${applicationName}" xml:space="preserve">
<source>Compress Files with ${applicationName}</source>
<target state="translated">${applicationName}</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Extract Files with ${applicationName}" xml:space="preserve">
<source>Extract Files with ${applicationName}</source>
<target state="translated">${applicationName}</target>
<note>No comment provided by engineer.</note>
</trans-unit>
</body>
</file>
<file original="Keka/en.lproj/InfoPlist.strings" source-language="en" target-language="zh-Hant" datatype="plaintext">
<header>
<tool tool-id="com.apple.dt.xcode" tool-name="Xcode" tool-version="15.2" build-num="15C500b"/>
</header>
<body>
<trans-unit id="7Z Archive" xml:space="preserve">
<source>7Z Archive</source>
<target>7Z</target>
<note/>
</trans-unit>
<trans-unit id="ACE Archive" xml:space="preserve">
<source>ACE Archive</source>
<target>ACE</target>
<note/>
</trans-unit>
<trans-unit id="ALZip Archive" xml:space="preserve">
<source>ALZip Archive</source>
<target>ALZip</target>
<note/>
</trans-unit>
<trans-unit id="APPX Archive" xml:space="preserve">
<source>APPX Archive</source>
<target>APPX</target>
<note/>
</trans-unit>
<trans-unit id="ARC Archive" xml:space="preserve">
<source>ARC Archive</source>
<target>ARC</target>
<note/>
</trans-unit>
<trans-unit id="ARJ Archive" xml:space="preserve">
<source>ARJ Archive</source>
<target>ARJ</target>
<note/>
</trans-unit>
<trans-unit id="Amiga DCS Disk Archive" xml:space="preserve">
<source>Amiga DCS Disk Archive</source>
<target>Amiga DCS</target>
<note/>
</trans-unit>
<trans-unit id="Amiga DMS Disk Archive" xml:space="preserve">
<source>Amiga DMS Disk Archive</source>
<target>Amiga DMS</target>
<note/>
</trans-unit>
<trans-unit id="Amiga Disk File" xml:space="preserve">
<source>Amiga Disk File</source>
<target>Amiga</target>
<note/>
</trans-unit>
<trans-unit id="Amiga PackDev Disk Archive" xml:space="preserve">
<source>Amiga PackDev Disk Archive</source>
<target>Amiga PackDev</target>
<note/>
</trans-unit>
<trans-unit id="Amiga PowerPacker Archive" xml:space="preserve">
<source>Amiga PowerPacker Archive</source>
<target>Amiga PowerPacker</target>
<note/>
</trans-unit>
<trans-unit id="Amiga Zoom Disk Archive" xml:space="preserve">
<source>Amiga Zoom Disk Archive</source>
<target>Amiga Zoom</target>
<note/>
</trans-unit>
<trans-unit id="Amiga xMash Disk Archive" xml:space="preserve">
<source>Amiga xMash Disk Archive</source>
<target>Amiga xMash</target>
<note/>
</trans-unit>
<trans-unit id="Android Application Package" xml:space="preserve">
<source>Android Application Package</source>
<target>Android</target>
<note/>
</trans-unit>
<trans-unit id="Apple Archive" xml:space="preserve">
<source>Apple Archive</source>
<target>Apple</target>
<note/>
</trans-unit>
<trans-unit id="BZIP2 Archive" xml:space="preserve">
<source>BZIP2 Archive</source>
<target>BZIP2</target>
<note/>
</trans-unit>
<trans-unit id="BZIP2 Tarball Archive" xml:space="preserve">
<source>BZIP2 Tarball Archive</source>
<target>BZIP2 Tarball</target>
<note/>
</trans-unit>
<trans-unit id="CAB Archive" xml:space="preserve">
<source>CAB Archive</source>
<target>CAB</target>
<note/>
</trans-unit>
<trans-unit id="CDI Disk Image" xml:space="preserve">
<source>CDI Disk Image</source>
<target>CDI</target>
<note/>
</trans-unit>
<trans-unit id="Compact Pro Archive" xml:space="preserve">
<source>Compact Pro Archive</source>
<target>Compact Pro</target>
<note/>
</trans-unit>
<trans-unit id="Compressed Amiga Disk File" xml:space="preserve">
<source>Compressed Amiga Disk File</source>
<target>Amiga</target>
<note/>
</trans-unit>
<trans-unit id="Deb Archive" xml:space="preserve">
<source>Deb Archive</source>
<target>Deb</target>
<note/>
</trans-unit>
<trans-unit id="DiskDoubler Archive" xml:space="preserve">
<source>DiskDoubler Archive</source>
<target>DiskDoubler</target>
<note/>
</trans-unit>
<trans-unit id="Generic Archive Volume" xml:space="preserve">
<source>Generic Archive Volume</source>
<target></target>
<note/>
</trans-unit>
<trans-unit id="HA Archive" xml:space="preserve">
<source>HA Archive</source>
<target>HA</target>
<note/>
</trans-unit>
<trans-unit id="Keka Extraction Package" xml:space="preserve">
<source>Keka Extraction Package</source>
<target>Keka</target>
<note/>
</trans-unit>
<trans-unit id="LBR Archive" xml:space="preserve">
<source>LBR Archive</source>
<target>LBR</target>
<note/>
</trans-unit>
<trans-unit id="LZMA File" xml:space="preserve">
<source>LZMA File</source>
<target>LZMA</target>
<note/>
</trans-unit>
<trans-unit id="LZX Archive" xml:space="preserve">
<source>LZX Archive</source>
<target>LZX</target>
<note/>
</trans-unit>
<trans-unit id="LhA Archive" xml:space="preserve">
<source>LhA Archive</source>
<target>LhA</target>
<note/>
</trans-unit>
<trans-unit id="LhF Archive" xml:space="preserve">
<source>LhF Archive</source>
<target>LhF</target>
<note/>
</trans-unit>
<trans-unit id="Linux RPM Archive" xml:space="preserve">
<source>Linux RPM Archive</source>
<target>Linux RPM</target>
<note/>
</trans-unit>
<trans-unit id="MDF Disk Image" xml:space="preserve">
<source>MDF Disk Image</source>
<target>MDF</target>
<note/>
</trans-unit>
<trans-unit id="Microsoft MSI Installer" xml:space="preserve">
<source>Microsoft MSI Installer</source>
<target>Microsoft MSI</target>
<note/>
</trans-unit>
<trans-unit id="NRG Disk Image" xml:space="preserve">
<source>NRG Disk Image</source>
<target>NRG</target>
<note/>
</trans-unit>
<trans-unit id="NSA Archive" xml:space="preserve">
<source>NSA Archive</source>
<target>NSA</target>
<note/>
</trans-unit>
<trans-unit id="Now Compress Archive" xml:space="preserve">
<source>Now Compress Archive</source>
<target>Now Compress</target>
<note/>
</trans-unit>
<trans-unit id="PMA Archive" xml:space="preserve">
<source>PMA Archive</source>
<target>PMA</target>
<note/>
</trans-unit>
<trans-unit id="PackIt Archive" xml:space="preserve">
<source>PackIt Archive</source>
<target>PackIt</target>
<note/>
</trans-unit>
<trans-unit id="Pax Archive" xml:space="preserve">
<source>Pax Archive</source>
<target>Pax</target>
<note/>
</trans-unit>
<trans-unit id="RAR Archive" xml:space="preserve">
<source>RAR Archive</source>
<target>RAR</target>
<note/>
</trans-unit>
<trans-unit id="SAR Archive" xml:space="preserve">
<source>SAR Archive</source>
<target>SAR</target>
<note/>
</trans-unit>
<trans-unit id="Self-Extracting Archive" xml:space="preserve">
<source>Self-Extracting Archive</source>
<target></target>
<note/>
</trans-unit>
<trans-unit id="Unix Compress File" xml:space="preserve">
<source>Unix Compress File</source>
<target>Unix</target>
<note/>
</trans-unit>
<trans-unit id="Unix Compress Tar Archive" xml:space="preserve">
<source>Unix Compress Tar Archive</source>
<target>UnixTar</target>
<note/>
</trans-unit>
<trans-unit id="WARC Web Archive" xml:space="preserve">
<source>WARC Web Archive</source>
<target>WARC</target>
<note/>
</trans-unit>
<trans-unit id="XAR Archive" xml:space="preserve">
<source>XAR Archive</source>
<target>XAR</target>
<note/>
</trans-unit>
<trans-unit id="XIP Archive" xml:space="preserve">
<source>XIP Archive</source>
<target>XIP</target>
<note/>
</trans-unit>
<trans-unit id="XZ Archive" xml:space="preserve">
<source>XZ Archive</source>
<target>XZ</target>
<note/>
</trans-unit>
<trans-unit id="XZ Tarball Archive" xml:space="preserve">
<source>XZ Tarball Archive</source>
<target>XZ Tarball</target>
<note/>
</trans-unit>
<trans-unit id="ZIP Archive" xml:space="preserve">
<source>ZIP Archive</source>
<target>ZIP</target>
<note/>
</trans-unit>
<trans-unit id="ZIPX Archive" xml:space="preserve">
<source>ZIPX Archive</source>
<target>ZIPX</target>
<note/>
</trans-unit>
<trans-unit id="ZOO Archive" xml:space="preserve">
<source>ZOO Archive</source>
<target>ZOO</target>
<note/>
</trans-unit>
<trans-unit id="Zstandard Archive" xml:space="preserve">
<source>Zstandard Archive</source>
<target>Zstandard</target>
<note/>
</trans-unit>
<trans-unit id="Zstandard Tarball Archive" xml:space="preserve">
<source>Zstandard Tarball Archive</source>
<target>Zstandard Tarball</target>
<note/>
</trans-unit>
</body>
</file>
<file original="Keka/en.lproj/Localizable.strings" source-language="en" target-language="zh-Hant" datatype="plaintext">
<header>
<tool tool-id="com.apple.dt.xcode" tool-name="Xcode" tool-version="15.2" build-num="15C500b"/>
</header>
<body>
<trans-unit id=""%@"" xml:space="preserve">
<source>"%@"</source>
<target>%@</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="%@ Folder" xml:space="preserve">
<source>%@ Folder</source>
<target state="translated">%@</target>
<note>Keka Folder</note>
</trans-unit>
<trans-unit id="%@ item" xml:space="preserve">
<source>%@ item</source>
<target>%@</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="%@ items" xml:space="preserve">
<source>%@ items</source>
<target>%@</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="%@ of "%@" failed" xml:space="preserve">
<source>%@ of "%@" failed</source>
<target state="translated">%2$@%1$@</target>
<note>_OPERATION_ of "_FILENAME_" failed</note>
</trans-unit>
<trans-unit id="%@ of %@ item" xml:space="preserve">
<source>%@ of %@ item</source>
<target>%@/%@</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="%@ of %@ items" xml:space="preserve">
<source>%@ of %@ items</source>
<target>%@/%@</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="%lld items" xml:space="preserve">
<source>%lld items</source>
<target state="translated">%lld</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="ARCHIVE_DEFAULT_NAME" xml:space="preserve">
<source>Archive</source>
<target></target>
<note>Default compression file name.</note>
</trans-unit>
<trans-unit id="About" xml:space="preserve">
<source>About</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Actions" xml:space="preserve">
<source>Actions</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Actions to do with the current browsed file" xml:space="preserve">
<source>Actions to do with the current browsed file</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Add a File" xml:space="preserve">
<source>Add a File</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Add a Folder" xml:space="preserve">
<source>Add a Folder</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Add a Photo or Video" xml:space="preserve">
<source>Add a Photo or Video</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Add files and folders to a compression list" xml:space="preserve">
<source>Add files and folders to a compression list</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Add some contents using the %@ button or the %@ button in the toolbar." xml:space="preserve">
<source>Add some contents using the %@ button or the %@ button in the toolbar.</source>
<target>%@%@</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Add some contents using the %@ button or the %@, %@ or %@ buttons in the toolbar." xml:space="preserve">
<source>Add some contents using the %@ button or the %@, %@ or %@ buttons in the toolbar.</source>
<target>%@%@%@%@</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Add some contents using the %@ button." xml:space="preserve">
<source>Add some contents using the %@ button.</source>
<target>%@</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Advanced Settings" xml:space="preserve">
<source>Advanced Settings</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Allocated size" xml:space="preserve">
<source>Allocated size</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Archive items separately" xml:space="preserve">
<source>Archive items separately</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Ask" xml:space="preserve">
<source>Ask</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="BROWSE_OPERATION" xml:space="preserve">
<source>Browse</source>
<target></target>
<note>Browse, operation description.</note>
</trans-unit>
<trans-unit id="BROWSE_RUNNING" xml:space="preserve">
<source>Browsing</source>
<target></target>
<note>Browsing, operation running.</note>
</trans-unit>
<trans-unit id="BROWSE_SECTION_TITLE" xml:space="preserve">
<source>Browsing</source>
<target></target>
<note>Browsing, tasks section title.</note>
</trans-unit>
<trans-unit id="Browser" xml:space="preserve">
<source>Browser</source>
<target></target>
<note>Browser settings title.</note>
</trans-unit>
<trans-unit id="Bytes" xml:space="preserve">
<source>Bytes</source>
<target state="translated"></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="COMPRESSION_OPERATION" xml:space="preserve">
<source>Compression</source>
<target></target>
<note>Compression, operation description.</note>
</trans-unit>
<trans-unit id="COMPRESSION_RUNNING" xml:space="preserve">
<source>Compressing</source>
<target></target>
<note>Compressing, operation running.</note>
</trans-unit>
<trans-unit id="COMPRESSION_SECTION_TITLE" xml:space="preserve">
<source>Compressing</source>
<target></target>
<note>Compressing, tasks section title.</note>
</trans-unit>
<trans-unit id="Calculate" xml:space="preserve">
<source>Calculate</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Cancel" xml:space="preserve">
<source>Cancel</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Cancelled" xml:space="preserve">
<source>Cancelled</source>
<target state="translated"></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Choose" xml:space="preserve">
<source>Choose</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Clear Cache" xml:space="preserve">
<source>Clear Cache</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Clear Cache Contents" xml:space="preserve">
<source>Clear Cache Contents</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Close" xml:space="preserve">
<source>Close</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Comments" xml:space="preserve">
<source>Comments</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Compress" xml:space="preserve">
<source>Compress</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Compress Files with Keka" xml:space="preserve">
<source>Compress Files with Keka</source>
<target state="translated">Keka</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Compress all the items in the compression list" xml:space="preserve">
<source>Compress all the items in the compression list</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Compress some files with Keka." xml:space="preserve">
<source>Compress some files with Keka.</source>
<target state="translated">Keka</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Compressed size" xml:space="preserve">
<source>Compressed size</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Compression" xml:space="preserve">
<source>Compression</source>
<target></target>
<note>Compression settings title.</note>
</trans-unit>
<trans-unit id="Compression Level:" xml:space="preserve">
<source>Compression Level:</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Contents" xml:space="preserve">
<source>Contents</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Contents: %@, Size: %@" xml:space="preserve">
<source>Contents: %@, Size: %@</source>
<target>%@%@</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Contents: %lld, Size: %@" xml:space="preserve">
<source>Contents: %lld, Size: %@</source>
<target>%lld%@</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Created" xml:space="preserve">
<source>Created</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Custom..." xml:space="preserve">
<source>Custom...</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Date" xml:space="preserve">
<source>Date</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Default Compression Level" xml:space="preserve">
<source>Default Compression Level</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Default Destination" xml:space="preserve">
<source>Default Destination</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Default Format" xml:space="preserve">
<source>Default Format</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Default Tap Action" xml:space="preserve">
<source>Default Tap Action</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Default Volume Unit" xml:space="preserve">
<source>Default Volume Unit</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Delete" xml:space="preserve">
<source>Delete</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Delete files(s) after compression" xml:space="preserve">
<source>Delete files(s) after compression</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Destination" xml:space="preserve">
<source>Destination</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Disable "%@" if you prefer to use a default configuration." xml:space="preserve">
<source>Disable "%@" if you prefer to use a default configuration.</source>
<target>%@</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Dismiss" xml:space="preserve">
<source>Dismiss</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Document" xml:space="preserve">
<source>Document</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Documents" xml:space="preserve">
<source>Documents</source>
<target state="translated"></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Done" xml:space="preserve">
<source>Done</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Downloads" xml:space="preserve">
<source>Downloads</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="EXTRACTION_OPERATION" xml:space="preserve">
<source>Extraction</source>
<target></target>
<note>Extraction, operation description.</note>
</trans-unit>
<trans-unit id="EXTRACTION_RUNNING" xml:space="preserve">
<source>Extracting</source>
<target></target>
<note>Extracting, operation running.</note>
</trans-unit>
<trans-unit id="EXTRACTION_SECTION_TITLE" xml:space="preserve">
<source>Extracting</source>
<target></target>
<note>Extracting, tasks section title.</note>
</trans-unit>
<trans-unit id="Edit" xml:space="preserve">
<source>Edit</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Encrypt Filenames" xml:space="preserve">
<source>Encrypt Filenames</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Encrypt Filenames if Possible" xml:space="preserve">
<source>Encrypt Filenames if Possible</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Enter the password for the file "%@"" xml:space="preserve">
<source>Enter the password for the file
"%@"</source>
<target>
%@</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Exclude Mac resource forks" xml:space="preserve">
<source>Exclude Mac resource forks</source>
<target>Mac</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Extract" xml:space="preserve">
<source>Extract</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Extract Files with Keka" xml:space="preserve">
<source>Extract Files with Keka</source>
<target state="translated">Keka</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Extract some files with Keka." xml:space="preserve">
<source>Extract some files with Keka.</source>
<target state="translated">Keka</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Extract the file" xml:space="preserve">
<source>Extract the file</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Extraction" xml:space="preserve">
<source>Extraction</source>
<target></target>
<note>Extraction settings title.</note>
</trans-unit>
<trans-unit id="Fast" xml:space="preserve">
<source>Fast</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Fastest" xml:space="preserve">
<source>Fastest</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Feedback" xml:space="preserve">
<source>Feedback</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="File for Keka" xml:space="preserve">
<source>File for Keka</source>
<target state="translated">Keka</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="File not informed properly, try again." xml:space="preserve">
<source>File not informed properly, try again.</source>
<target state="translated"></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Files" xml:space="preserve">
<source>Files</source>
<target state="translated"></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Files and Folders" xml:space="preserve">
<source>Files and Folders</source>
<target state="translated"></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Folder drop is only supported on iOS 16 or newer" xml:space="preserve">
<source>Folder drop is only supported on iOS 16 or newer</source>
<target>iOS 16</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Format" xml:space="preserve">
<source>Format</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="General" xml:space="preserve">
<source>General</source>
<target></target>
<note>General settings title.</note>
</trans-unit>
<trans-unit id="Get Info" xml:space="preserve">
<source>Get Info</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Gigabyte" xml:space="preserve">
<source>Gigabyte</source>
<target state="translated">GB</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Give Access" xml:space="preserve">
<source>Give Access</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Hide Password by Default" xml:space="preserve">
<source>Hide Password by Default</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="If you got here, please get in touch with the developers." xml:space="preserve">
<source>If you got here, please get in touch with the developers.</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Information" xml:space="preserve">
<source>Information</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Keka's Folder" xml:space="preserve">
<source>Keka's Folder</source>
<target>Keka</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Keka's icon" xml:space="preserve">
<source>Keka's icon</source>
<target>Keka</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Kilobytes" xml:space="preserve">
<source>Kilobytes</source>
<target state="translated">KB</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Kind" xml:space="preserve">
<source>Kind</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Last opened" xml:space="preserve">
<source>Last opened</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Level" xml:space="preserve">
<source>Level</source>
<target state="translated"></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Loading" xml:space="preserve">
<source>Loading</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Made with" xml:space="preserve">
<source>Made with</source>
<target></target>
<note>"Made with" part from "Made with love by aone".</note>
</trans-unit>
<trans-unit id="Megabytes" xml:space="preserve">
<source>Megabytes</source>
<target state="translated">MB</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Modified" xml:space="preserve">
<source>Modified</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Name" xml:space="preserve">
<source>Name</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="New Compression" xml:space="preserve">
<source>New Compression</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="No archive selected" xml:space="preserve">
<source>No archive selected</source>
<target state="translated"></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="No contents" xml:space="preserve">
<source>No contents</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="No files to extract" xml:space="preserve">
<source>No files to extract</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="None" xml:space="preserve">
<source>None</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Normal" xml:space="preserve">
<source>Normal</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Not all platforms support AES-256 encryption. You may need a third party application (like Keka) to open these compressed files." xml:space="preserve">
<source>Not all platforms support AES-256 encryption. You may need a third party application (like Keka) to open these compressed files.</source>
<target>AES-256Keka</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="OK" xml:space="preserve">
<source>OK</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Open" xml:space="preserve">
<source>Open</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Open Keka" xml:space="preserve">
<source>Open Keka</source>
<target state="translated">Keka</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Open..." xml:space="preserve">
<source>Open...</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Order" xml:space="preserve">
<source>Order</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Password" xml:space="preserve">
<source>Password</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Password Protected" xml:space="preserve">
<source>Password Protected</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Password for "%@"" xml:space="preserve">
<source>Password for "%@"</source>
<target state="translated">%@</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Password needed" xml:space="preserve">
<source>Password needed</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Pause" xml:space="preserve">
<source>Pause</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Petabytes" xml:space="preserve">
<source>Petabytes</source>
<target state="translated">PB</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Please enter the password for:" xml:space="preserve">
<source>Please enter the password for:</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Please select the encoding for:" xml:space="preserve">
<source>Please select the encoding for:</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Preview" xml:space="preserve">
<source>Preview</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Quick Look" xml:space="preserve">
<source>Quick Look</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Remember Last Used Options" xml:space="preserve">
<source>Remember Last Used Options</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Remove" xml:space="preserve">
<source>Remove</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Remove All Items" xml:space="preserve">
<source>Remove All Items</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Remove from cache" xml:space="preserve">
<source>Remove from cache</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Remove the selected items from the compression list" xml:space="preserve">
<source>Remove the selected items from the compression list</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Reset" xml:space="preserve">
<source>Reset</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Reset All Settings" xml:space="preserve">
<source>Reset All Settings</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Resume" xml:space="preserve">
<source>Resume</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Review" xml:space="preserve">
<source>Review</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Run asynchronously" xml:space="preserve">
<source>Run asynchronously</source>
<target state="translated"></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Save" xml:space="preserve">
<source>Save</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Select some files and folders for Keka." xml:space="preserve">
<source>Select some files and folders for Keka.</source>
<target state="translated">Keka</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Settings" xml:space="preserve">
<source>Settings</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Share" xml:space="preserve">
<source>Share</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Share..." xml:space="preserve">
<source>Share...</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Show Advanced Settings" xml:space="preserve">
<source>Show Advanced Settings</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Show Info" xml:space="preserve">
<source>Show Info</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Show Less" xml:space="preserve">
<source>Show Less</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Show or hide additional advanced settings" xml:space="preserve">
<source>Show or hide additional advanced settings</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Show or hide additional information about the selected item" xml:space="preserve">
<source>Show or hide additional information about the selected item</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Size" xml:space="preserve">
<source>Size</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Slow" xml:space="preserve">
<source>Slow</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Slowest" xml:space="preserve">
<source>Slowest</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Split in volumes" xml:space="preserve">
<source>Split in volumes</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Store" xml:space="preserve">
<source>Store</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="TRANSLATOR_LINK" xml:space="preserve">
<source>TRANSLATOR_LINK</source>
<target>path_to_urlpath_to_url path_to_url
<note>The translator link, if any. Can be a mail address or a website.</note>
</trans-unit>
<trans-unit id="TRANSLATOR_NAME" xml:space="preserve">
<source>TRANSLATOR_NAME</source>
<target>aonePeterDaveHelloYi-Jyun Pan</target>
<note>The translator name, if any.</note>
</trans-unit>
<trans-unit id="Terabytes" xml:space="preserve">
<source>Terabytes</source>
<target state="translated">TB</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="The %@ of space available in the destination might not be enough for compressing the estimated %@." xml:space="preserve">
<source>The %@ of space available in the destination might not be enough for compressing the estimated %@.</source>
<target>%@%@</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="The changes could not be saved" xml:space="preserve">
<source>The changes could not be saved</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="The character %@ is not compatilbe with the %@ format." xml:space="preserve">
<source>The character %@ is not compatilbe with the %@ format.</source>
<target>%@%@</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="The characters %@ are not compatilbe with the %@ format." xml:space="preserve">
<source>The characters %@ are not compatilbe with the %@ format.</source>
<target>%@%@</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="The compression may need more memory than available (%@) and may not be completed successfully. Will be limited to 1 thread." xml:space="preserve">
<source>The compression may need more memory than available (%@) and may not be completed successfully. Will be limited to 1 thread.</source>
<target>%@1</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="The compression will be limited to %lld thread/s due to memory constraints." xml:space="preserve">
<source>The compression will be limited to %lld thread/s due to memory constraints.</source>
<target>%lld</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="The destination has %@ of space available." xml:space="preserve">
<source>The destination has %@ of space available.</source>
<target>%@</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="The file manager for iOS and macOS" xml:space="preserve">
<source>The file manager for iOS and macOS</source>
<target>iOSmacOS</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="The folder is empty" xml:space="preserve">
<source>The folder is empty</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="The password length should be %lld or higher." xml:space="preserve">
<source>The password length should be %lld or higher.</source>
<target>%lld</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="The slower the level the more compression can be accomplished. The store level does no compression at all, only archives the contents." xml:space="preserve">
<source>The slower the level the more compression can be accomplished. The store level does no compression at all, only archives the contents.</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="This volume file needs additional files access to be opened. You can give access to the rest of the files or the parent folder." xml:space="preserve">
<source>This volume file needs additional files access to be opened.
You can give access to the rest of the files or the parent folder.</source>
<target>
</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="To extract" xml:space="preserve">
<source>To extract</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="To prevent a timeout on large operation, enable this setting. The result will always be true if enabled." xml:space="preserve">
<source>To prevent a timeout on large operation, enable this setting. The result will always be true if enabled.</source>
<target state="translated">true</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Total size" xml:space="preserve">
<source>Total size</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Translated by %@" xml:space="preserve">
<source>Translated by %@</source>
<target>%@</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Type" xml:space="preserve">
<source>Type</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="URL Encoded" xml:space="preserve">
<source>URL Encoded</source>
<target state="translated">URL</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Unable to apply the app icon" xml:space="preserve">
<source>Unable to apply the app icon</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Unable to browse "%@"" xml:space="preserve">
<source>Unable to browse "%@"</source>
<target>%@</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Unable to delete the file" xml:space="preserve">
<source>Unable to delete the file</source>
<target state="translated"></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Unable to determine the available space." xml:space="preserve">
<source>Unable to determine the available space.</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Unable to get encoding data" xml:space="preserve">
<source>Unable to get encoding data</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Use AES-256 Encryption" xml:space="preserve">
<source>Use AES-256 Encryption</source>
<target>AES-256</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Use AES-256 if Available" xml:space="preserve">
<source>Use AES-256 if Available</source>
<target>AES-256</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Use UTF-8 Encoding if Available" xml:space="preserve">
<source>Use UTF-8 Encoding if Available</source>
<target>UTF-8</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Use special coloring for known formats" xml:space="preserve">
<source>Use special coloring for known formats</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Verify compression integrity" xml:space="preserve">
<source>Verify compression integrity</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Volume Size" xml:space="preserve">
<source>Volume Size</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Volume Unit" xml:space="preserve">
<source>Volume Unit</source>
<target state="translated"></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Welcome" xml:space="preserve">
<source>Welcome</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Welcome to %@" xml:space="preserve">
<source>Welcome to %@</source>
<target>%@</target>
<note>The "Welcome to Keka" title.</note>
</trans-unit>
<trans-unit id="Where" xml:space="preserve">
<source>Where</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="archive" xml:space="preserve">
<source>archive</source>
<target state="translated"></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="by %@" xml:space="preserve">
<source>by %@</source>
<target>%@</target>
<note>"by aone" part from "Made with love by aone".</note>
</trans-unit>
<trans-unit id="compress" xml:space="preserve">
<source>compress</source>
<target state="translated"></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="compressed" xml:space="preserve">
<source>compressed</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="compression" xml:space="preserve">
<source>compression</source>
<target state="translated"></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="compression failed" xml:space="preserve">
<source>compression failed</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="done" xml:space="preserve">
<source>done</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="extract" xml:space="preserve">
<source>extract</source>
<target state="translated"></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="extracted" xml:space="preserve">
<source>extracted</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="extraction" xml:space="preserve">
<source>extraction</source>
<target state="translated"></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="extraction failed" xml:space="preserve">
<source>extraction failed</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="failed" xml:space="preserve">
<source>failed</source>
<target></target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="file" xml:space="preserve">
<source>file</source>
<target state="translated"></target>
<note>No comment provided by engineer.</note>
</trans-unit>
</body>
</file>
<file original="KekaBrowseAction/en.lproj/InfoPlist.strings" source-language="en" target-language="zh-Hant" datatype="plaintext">
<header>
<tool tool-id="com.apple.dt.xcode" tool-name="Xcode" tool-version="15.2" build-num="15C500b"/>
</header>
<body>
<trans-unit id="CFBundleDisplayName" xml:space="preserve">
<source>Browse with Keka</source>
<target>Keka</target>
<note>Bundle display name</note>
</trans-unit>
</body>
</file>
<file original="KekaCompressionAction/en.lproj/InfoPlist.strings" source-language="en" target-language="zh-Hant" datatype="plaintext">
<header>
<tool tool-id="com.apple.dt.xcode" tool-name="Xcode" tool-version="15.2" build-num="15C500b"/>
</header>
<body>
<trans-unit id="CFBundleDisplayName" xml:space="preserve">
<source>Compress using Keka</source>
<target>Keka</target>
<note>Bundle display name</note>
</trans-unit>
</body>
</file>
<file original="KekaExtractionAction/en.lproj/InfoPlist.strings" source-language="en" target-language="zh-Hant" datatype="plaintext">
<header>
<tool tool-id="com.apple.dt.xcode" tool-name="Xcode" tool-version="15.2" build-num="15C500b"/>
</header>
<body>
<trans-unit id="CFBundleDisplayName" xml:space="preserve">
<source>Extract using Keka</source>
<target>Keka</target>
<note>Bundle display name</note>
</trans-unit>
</body>
</file>
</xliff>
``` | /content/code_sandbox/Translations-iOS/zh-Hant.xcloc/Localized Contents/zh-Hant.xliff | xml | 2016-11-08T19:35:50 | 2024-08-16T17:49:34 | Keka | aonez/Keka | 4,664 | 13,656 |
```xml
import { Resources, RestartPolicy } from 'docker-types/generated/1.41';
import axios, { parseAxiosError } from '@/portainer/services/axios';
import { EnvironmentId } from '@/react/portainer/environments/types';
import { withAgentTargetHeader } from '../../proxy/queries/utils';
import { buildDockerProxyUrl } from '../../proxy/queries/buildDockerProxyUrl';
/**
* UpdateConfig holds the mutable attributes of a Container.
* Those attributes can be updated at runtime.
*/
interface UpdateConfig extends Resources {
// Contains container's resources (cgroups, ulimits)
RestartPolicy?: RestartPolicy;
}
/**
* Raw docker API proxy
*/
export async function updateContainer(
environmentId: EnvironmentId,
containerId: string,
config: UpdateConfig,
{ nodeName }: { nodeName?: string } = {}
) {
try {
await axios.post<{ Warnings: string[] }>(
buildDockerProxyUrl(environmentId, 'containers', containerId, 'update'),
config,
{ headers: { ...withAgentTargetHeader(nodeName) } }
);
} catch (err) {
throw parseAxiosError(err, 'failed updating container');
}
}
``` | /content/code_sandbox/app/react/docker/containers/queries/useUpdateContainer.ts | xml | 2016-05-19T20:15:28 | 2024-08-16T19:15:14 | portainer | portainer/portainer | 30,083 | 253 |
```xml
import type { DialogTriggerState } from './DialogTrigger.types';
/**
* Render the final JSX of MenuTrigger
*
* Only renders children
*/
export const renderDialogTrigger_unstable = (state: DialogTriggerState) => state.children;
``` | /content/code_sandbox/packages/react-components/react-dialog/library/src/components/DialogTrigger/renderDialogTrigger.tsx | xml | 2016-06-06T15:03:44 | 2024-08-16T18:49:29 | fluentui | microsoft/fluentui | 18,221 | 50 |
```xml
import * as _ from 'lodash';
import * as PropTypes from 'prop-types';
import * as React from 'react';
import AceEditor, { AceEditorProps } from 'react-ace';
// These are from react-ace and we don't want to depend on brace separately
/* eslint-disable import/no-extraneous-dependencies */
import * as ace from 'brace';
import 'brace/ext/language_tools';
import 'brace/mode/jsx';
import 'brace/theme/tomorrow_night_eighties';
/* eslint-enable import/no-extraneous-dependencies */
const parentComponents = [];
// Set up custom completers by using a ace extension
// path_to_url
const languageTools = ace.acequire('ace/ext/language_tools');
type Completion = {
caption: string;
value: string;
meta: string;
};
const semanticUIReactCompleter = {
getCompletions(editor, session, pos, prefix, callback) {
const completions: Completion[] = [];
_.each(parentComponents, component => {
const { name } = component._meta;
// Component
completions.push({ caption: name, value: name, meta: 'Component' });
// Its props (propTypes do not exist in prod, use handledProps added by babel)
_.each(component.handledProps, propName => {
// don't add duplicate prop completions
if (_.find(completions, { value: propName })) return;
completions.push({ caption: propName, value: propName, meta: 'Component Prop' });
});
});
callback(null, completions);
},
};
languageTools.addCompleter(semanticUIReactCompleter);
export interface EditorProps extends AceEditorProps {
active?: boolean;
highlightGutterLine?: boolean;
mode?: 'html' | 'jsx' | 'sh' | 'json';
value?: string;
showCursor?: boolean;
}
export const EDITOR_BACKGROUND_COLOR = '#2D2D2D';
export const EDITOR_GUTTER_COLOR = '#272727';
export class Editor extends React.PureComponent<EditorProps> {
editorRef = React.createRef<any>();
name = `docs-editor-${_.uniqueId()}`;
static propTypes = {
value: PropTypes.string.isRequired,
mode: PropTypes.oneOf(['html', 'json', 'jsx', 'sh']),
active: PropTypes.bool,
showCursor: PropTypes.bool,
};
static defaultProps = {
value: '',
mode: 'jsx',
theme: 'tomorrow_night_eighties',
height: '100px',
width: '100%',
active: true,
enableBasicAutocompletion: true,
enableLiveAutocompletion: true,
editorProps: { $blockScrolling: Infinity },
setOptions: { fixedWidthGutter: true, showFoldWidgets: false },
showPrintMargin: false,
tabSize: 2,
maxLines: Infinity,
readOnly: false,
highlightActiveLine: true,
highlightGutterLine: true,
showCursor: true,
};
componentDidMount() {
const { showCursor } = this.props;
this.setCursorVisibility(showCursor);
}
UNSAFE_componentWillReceiveProps(nextProps) {
const previousPros = this.props;
const { active, showCursor } = nextProps;
if (showCursor !== previousPros.showCursor) {
this.setCursorVisibility(showCursor);
}
// focus editor when editor it becomes active
if (active !== previousPros.active && active) {
this.editorRef.current.editor.focus();
}
}
handleChange = _.debounce((value: string, e) => {
_.invoke(this.props, 'onChange', value, e);
}, 200);
setCursorVisibility = visible => {
const cursor = this.editorRef.current.editor.renderer.$cursorLayer.element;
cursor.style.display = visible ? '' : 'none';
};
render() {
return <AceEditor {...this.props} name={this.name} onChange={this.handleChange} ref={this.editorRef} />;
}
}
``` | /content/code_sandbox/packages/fluentui/docs-components/src/Editor/Editor.tsx | xml | 2016-06-06T15:03:44 | 2024-08-16T18:49:29 | fluentui | microsoft/fluentui | 18,221 | 858 |
```xml
/**
Given any element in a comment, returns the comments author
This works on:
- First comment
- Following comments
- Main review comment
- Following review comments
- Gist comments
- Bots
Note: Bots are used as `name[bot]`, `app/name`, or `apps/name` depending on the context:
- path_to_url
- path_to_url
- path_to_url
@returns user-name
@returns dependabot[bot]
*/
export default function getCommentAuthor(anyElementInsideComment: Element): string {
const avatar: HTMLImageElement = anyElementInsideComment
.closest(['.TimelineItem', '.review-comment'])!
.querySelector(['.TimelineItem-avatar img', 'img.avatar'])!;
const name = avatar
.alt // Occasionally ends with `[bot]`
.replace(/^@/, ''); // May or may not be present
if (!name.endsWith('[bot]') && avatar.closest('[href^="path_to_url"]')) {
// Example: path_to_url#issuecomment-1170670173
return name + '[bot]';
}
return name;
}
``` | /content/code_sandbox/source/github-helpers/get-comment-author.ts | xml | 2016-02-15T16:45:02 | 2024-08-16T18:39:26 | refined-github | refined-github/refined-github | 24,013 | 239 |
```xml
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="path_to_url">
<item android:title="Help"/>
<item android:title="About"/>
</menu>
``` | /content/code_sandbox/TranslucentStatusBar/app/src/main/res/menu/main_menu.xml | xml | 2016-02-25T11:06:48 | 2024-08-07T21:41:59 | android-examples | nisrulz/android-examples | 1,747 | 44 |
```xml
import superjson from 'superjson';
import { companiesRouter } from './companies-router';
import { createRouter } from './context';
import { locationsRouter } from './locations-router';
import { offersRouter } from './offers/offers';
import { offerAdminRouter } from './offers/offers-admin-router';
import { offersAnalysisRouter } from './offers/offers-analysis-router';
import { offersCommentsRouter } from './offers/offers-comments-router';
import { offersProfileRouter } from './offers/offers-profile-router';
import { offersUserProfileRouter } from './offers/offers-user-profile-router';
import { protectedExampleRouter } from './protected-example-router';
import { questionsAnswerCommentRouter } from './questions/questions-answer-comment-router';
import { questionsAnswerCommentUserRouter } from './questions/questions-answer-comment-user-router';
import { questionsAnswerRouter } from './questions/questions-answer-router';
import { questionsAnswerUserRouter } from './questions/questions-answer-user-router';
import { questionsListRouter } from './questions/questions-list-router';
import { questionsQuestionCommentRouter } from './questions/questions-question-comment-router';
import { questionsQuestionCommentUserRouter } from './questions/questions-question-comment-user-router';
import { questionsQuestionEncounterRouter } from './questions/questions-question-encounter-router';
import { questionsQuestionEncounterUserRouter } from './questions/questions-question-encounter-user-router';
import { questionsQuestionRouter } from './questions/questions-question-router';
import { questionsQuestionUserRouter } from './questions/questions-question-user-router';
import { resumeCommentsRouter } from './resumes/resumes-comments-router';
import { resumesCommentsUserRouter } from './resumes/resumes-comments-user-router';
import { resumesCommentsVotesRouter } from './resumes/resumes-comments-votes-router';
import { resumesCommentsVotesUserRouter } from './resumes/resumes-comments-votes-user-router';
import { resumesRouter } from './resumes/resumes-resume-router';
import { resumesResumeUserRouter } from './resumes/resumes-resume-user-router';
import { resumesStarUserRouter } from './resumes/resumes-star-user-router';
import { todosRouter } from './todos';
import { todosUserRouter } from './todos-user-router';
import { userRouter } from './user-router';
export const appRouter = createRouter()
.transformer(superjson)
// All keys should be delimited by a period and end with a period.
// Example routers. Learn more about tRPC routers: path_to_url
.merge('auth.', protectedExampleRouter)
.merge('user.', userRouter)
.merge('todos.', todosRouter)
.merge('todos.user.', todosUserRouter)
.merge('companies.', companiesRouter)
.merge('locations.', locationsRouter)
.merge('resumes.resume.', resumesRouter)
.merge('resumes.resume.user.', resumesResumeUserRouter)
.merge('resumes.resume.', resumesStarUserRouter)
.merge('resumes.comments.', resumeCommentsRouter)
.merge('resumes.comments.user.', resumesCommentsUserRouter)
.merge('resumes.comments.votes.', resumesCommentsVotesRouter)
.merge('resumes.comments.votes.user.', resumesCommentsVotesUserRouter)
.merge('questions.answers.comments.', questionsAnswerCommentRouter)
.merge('questions.answers.comments.user.', questionsAnswerCommentUserRouter)
.merge('questions.answers.', questionsAnswerRouter)
.merge('questions.answers.user.', questionsAnswerUserRouter)
.merge('questions.lists.', questionsListRouter)
.merge('questions.questions.comments.', questionsQuestionCommentRouter)
.merge(
'questions.questions.comments.user.',
questionsQuestionCommentUserRouter,
)
.merge('questions.questions.encounters.', questionsQuestionEncounterRouter)
.merge(
'questions.questions.encounters.user.',
questionsQuestionEncounterUserRouter,
)
.merge('questions.questions.', questionsQuestionRouter)
.merge('questions.questions.user.', questionsQuestionUserRouter)
.merge('offers.', offersRouter)
.merge('offers.profile.', offersProfileRouter)
.merge('offers.analysis.', offersAnalysisRouter)
.merge('offers.comments.', offersCommentsRouter)
.merge('offers.user.profile.', offersUserProfileRouter)
.merge('offers.admin.', offerAdminRouter);
// Export type definition of API
export type AppRouter = typeof appRouter;
``` | /content/code_sandbox/apps/portal/src/server/router/index.ts | xml | 2016-07-05T05:00:48 | 2024-08-16T19:01:19 | tech-interview-handbook | yangshun/tech-interview-handbook | 115,302 | 892 |
```xml
<xs:annotation>
<xs:documentation>
<![CDATA[This is the documentation for the schema rooted at <b><code>Sheet</code></b> class.
<ul>
<li>It describes any <b><code>sheet#N.xml</code></b> file within an Audiveris <code>.omr</code> project file.
<li><a href="Sheet.xsd"><b>Sheet.xsd</b></a> file contains the annotated schema verbatim.
<li>This documentation describes all schema elements in alphabetical order.
<li>For your convenience, you can start directly by the root <b><a href="#type_sheet">Sheet</a></b> complex type.
</ul>
<p>
The diagram below presents <code>Book</code> and <code>Sheet</code> simplified structures.
<p>
This <code>Sheet</code> documentation corresponds to the <b>right half</b> of the diagram.
<p>
<img src="doc-files/Book-vs-Sheet.png" alt="Book-vs-Sheet UML">]]>
</xs:documentation>
</xs:annotation>
``` | /content/code_sandbox/schemas/dev/headers/schemaHeaderForSheet.xsd | xml | 2016-09-07T13:31:03 | 2024-08-14T06:25:10 | audiveris | Audiveris/audiveris | 1,488 | 237 |
```xml
import { addDays, differenceInCalendarDays, endOfDay, max, min, startOfDay } from '@proton/shared/lib/date-fns-utc';
import type { CalendarViewBusyEvent, CalendarViewEvent } from '../../containers/calendar/interface';
import type { LayoutEvent } from './layout';
const getEndDate = (end: Date, maxDate: Date, isAllPartDay: boolean) => {
const endsOnMidnight = +end === +startOfDay(end);
const minEnd = min(end, maxDate);
if (isAllPartDay && endsOnMidnight) {
// for part-day events displayed within range as all-day and ending on midnight, we want to avoid "adding an extra day"
const endsWithinRange = +minEnd === +end;
if (endsWithinRange) {
return endOfDay(addDays(minEnd, -1));
}
}
return endOfDay(minEnd);
};
interface SplitDayEventsInIntervalArguments {
events: (CalendarViewEvent | CalendarViewBusyEvent)[];
min: Date;
max: Date;
}
export const splitDayEventsInInterval = ({
events = [],
min: minDate,
max: maxDate,
}: SplitDayEventsInIntervalArguments) => {
return events.reduce<LayoutEvent[]>((acc, { start, end, isAllDay, isAllPartDay }, i) => {
const startDate = startOfDay(max(start, minDate));
const endDate = getEndDate(end, maxDate, isAllPartDay);
const isDisplayedMultipleDays = isAllDay || isAllPartDay;
if (startDate >= endDate) {
return acc;
}
// Part day events that are not displayed as all day events that start before the date range, are already displayed in a previous row.
if (!isDisplayedMultipleDays && startDate > start) {
return acc;
}
const calendarDaysDifference = isDisplayedMultipleDays ? differenceInCalendarDays(endDate, startDate) : 0;
const startIndex = differenceInCalendarDays(startDate, minDate);
acc.push({
idx: i,
start: startIndex,
end: startIndex + calendarDaysDifference + 1,
});
return acc;
}, []);
};
``` | /content/code_sandbox/applications/calendar/src/app/components/calendar/splitDayEventsInInterval.ts | xml | 2016-06-08T11:16:51 | 2024-08-16T14:14:27 | WebClients | ProtonMail/WebClients | 4,300 | 471 |
```xml
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="path_to_url"
xmlns:app="path_to_url"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include
android:id="@+id/header"
layout="@layout/item_contact_request"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/divider_header"
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_marginStart="16dp"
android:background="@color/grey_012_white_012"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/header" />
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/divider_header">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/items_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/btn_accept"
style="@style/BottomSheetOption"
android:layout_width="0dp"
android:layout_height="56dp"
android:text="@string/contact_accept"
app:drawableStartCompat="@drawable/ic_check_circle_medium_regular_outline"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/divider_accept"
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_marginStart="72dp"
android:background="@color/grey_012_white_012"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/btn_accept" />
<TextView
android:id="@+id/btn_ignore"
style="@style/BottomSheetOption"
android:layout_width="0dp"
android:layout_height="56dp"
android:text="@string/contact_ignore"
app:drawableStartCompat="@drawable/ic_slash_circle_medium_regular_outline"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/divider_accept" />
<View
android:id="@+id/divider_ignore"
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_marginStart="72dp"
android:background="@color/grey_012_white_012"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/btn_ignore" />
<TextView
android:id="@+id/btn_decline"
style="@style/BottomSheetOption.Red"
android:layout_width="0dp"
android:layout_height="56dp"
android:text="@string/contact_decline"
app:drawableStartCompat="@drawable/ic_x_circle_medium_regular_outline"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/divider_ignore" />
<androidx.constraintlayout.widget.Group
android:id="@+id/group_received"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:constraint_referenced_ids="btn_accept, divider_accept, btn_ignore, divider_ignore, btn_decline" />
<TextView
android:id="@+id/btn_reinvite"
style="@style/BottomSheetOption"
android:layout_width="0dp"
android:layout_height="56dp"
android:text="@string/contact_reinvite"
app:drawableStartCompat="@drawable/ic_reinvite"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/divider_reinvite"
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_marginStart="72dp"
android:background="@color/grey_012_white_012"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/btn_reinvite" />
<TextView
android:id="@+id/btn_remove"
style="@style/BottomSheetOption.Red"
android:layout_width="0dp"
android:layout_height="56dp"
android:text="@string/general_remove"
app:drawableStartCompat="@drawable/ic_x_medium_regular_outline"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/divider_reinvite" />
<androidx.constraintlayout.widget.Group
android:id="@+id/group_sent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
app:constraint_referenced_ids="btn_reinvite, divider_reinvite, btn_remove" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
``` | /content/code_sandbox/app/src/main/res/layout/bottom_sheet_contact_request.xml | xml | 2016-05-04T11:46:20 | 2024-08-15T16:29:10 | android | meganz/android | 1,537 | 1,236 |
```xml
import type { Location } from 'history';
import { getAutoCoupon } from '@proton/components/containers/payments/subscription/helpers';
import type { BillingAddress, PaymentsApi } from '@proton/components/payments/core';
import type { CheckSubscriptionData } from '@proton/shared/lib/api/payments';
import type { APP_NAMES } from '@proton/shared/lib/constants';
import { PLANS, SSO_PATHS } from '@proton/shared/lib/constants';
import { hasPlanIDs } from '@proton/shared/lib/helpers/planIDs';
import type { Currency, Cycle } from '@proton/shared/lib/interfaces';
import { getFreeCheckResult } from '@proton/shared/lib/subscription/freePlans';
import type { PlanIDs } from './interfaces';
export async function getSubscriptionPrices(
paymentsApi: PaymentsApi,
planIDs: PlanIDs,
currency: Currency,
cycle: Cycle,
billingAddress?: BillingAddress,
maybeCoupon?: string
) {
if (!hasPlanIDs(planIDs) || planIDs[PLANS.FREE]) {
return getFreeCheckResult(currency, cycle);
}
const coupon = getAutoCoupon({ coupon: maybeCoupon, planIDs, cycle });
const data: CheckSubscriptionData = {
Plans: planIDs,
Currency: currency,
Cycle: cycle,
CouponCode: coupon,
};
if (billingAddress) {
data.BillingAddress = {
State: billingAddress.State,
CountryCode: billingAddress.CountryCode,
};
}
return paymentsApi.checkWithAutomaticVersion(data);
}
export const isMailTrialSignup = (location: Location) => {
return location.pathname.includes(SSO_PATHS.TRIAL);
};
export const isMailReferAFriendSignup = (location: Location) => {
return location.pathname.includes(SSO_PATHS.REFER);
};
export const getSignupApplication = (APP_NAME: APP_NAMES) => {
if (APP_NAME === 'proton-vpn-settings') {
return 'proton-vpn-settings';
}
return 'proton-account';
};
``` | /content/code_sandbox/applications/account/src/app/signup/helper.ts | xml | 2016-06-08T11:16:51 | 2024-08-16T14:14:27 | WebClients | ProtonMail/WebClients | 4,300 | 434 |
```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
interface Options {
/**
* Boolean indicating whether to store duplicate keys.
*/
duplicates?: boolean;
}
/**
* Inverts an object, such that keys become values and values become keys.
*
* @param obj - input object
* @param opts - function options
* @param opts.duplicates - boolean indicating whether to store duplicate keys (default: true)
* @returns inverted object
*
* @example
* var out = invert({
* 'a': 'beep',
* 'b': 'boop'
* });
* // returns { 'beep': 'a', 'boop': 'b' }
*
* @example
* var out = invert({
* 'a': 'beep',
* 'b': 'beep'
* });
* // returns { 'beep': [ 'a', 'b' ] }
*
* @example
* var obj = {};
* obj.a = 'beep';
* obj.b = 'boop';
* obj.c = 'beep'; // inserted after `a`
*
* var out = invert( obj, {
* 'duplicates': false
* });
* // returns { 'beep': 'c', 'boop': 'b' }
*/
declare function invert( obj: any, options?: Options ): any;
// EXPORTS //
export = invert;
``` | /content/code_sandbox/lib/node_modules/@stdlib/utils/object-inverse/docs/types/index.d.ts | xml | 2016-03-24T04:19:52 | 2024-08-16T09:03:19 | stdlib | stdlib-js/stdlib | 4,266 | 341 |
```xml
import { CoverageColors } from '../Coverage/CoverageOverlay';
import { JESParserPluginOptions, ProjectWorkspace } from 'jest-editor-support';
import { RunShell } from '../JestExt/run-shell';
import { RunMode } from '../JestExt/run-mode';
export type JestTestProcessType =
| 'all-tests'
| 'watch-tests'
| 'watch-all-tests'
| 'by-file'
| 'by-file-test'
| 'not-test'
| 'by-file-test-pattern'
| 'by-file-pattern';
export type OnStartupType = Extract<JestTestProcessType, 'all-tests'>[];
export type OnSaveFileType = 'test-file' | 'test-src-file';
export type JestExtAutoRunShortHand = 'default' | 'watch' | 'on-save' | 'legacy' | 'off';
export type JestExtAutoRunConfig =
| { watch: true; onStartup?: OnStartupType }
| {
watch: false;
onStartup?: OnStartupType;
onSave?: OnSaveFileType;
};
export type JestExtAutoRunSetting = JestExtAutoRunShortHand | JestExtAutoRunConfig;
export interface JestRunModeOptions {
runAllTestsOnStartup?: boolean;
coverage?: boolean;
deferred?: boolean;
// TestExplorer related settings
showInlineError?: boolean;
}
export type JestRunMode = (
| { type: 'watch' }
| { type: 'on-demand' }
| { type: 'on-save'; testFileOnly?: boolean }
) &
JestRunModeOptions;
export type JestRunModeType = JestRunMode['type'];
export type JestPredefinedRunModeType = JestRunModeType | 'deferred';
export type JestRunModeSetting = JestRunMode | JestPredefinedRunModeType;
export interface JestRawOutputSetting {
revealWithFocus?: 'terminal' | 'test-results' | 'none';
revealOn?: 'run' | 'error' | 'demand';
clearOnRun?: 'both' | 'terminal' | 'test-results' | 'none';
}
export type JestPredefinedOutputSetting = 'neutral' | 'terminal-based' | 'test-results-based';
export type JestOutputSetting = JestPredefinedOutputSetting | JestRawOutputSetting;
export type TestExplorerConfigLegacy =
| { enabled: false }
| { enabled: true; showClassicStatus?: boolean; showInlineError?: boolean };
export interface TestExplorerConfig {
showInlineError?: boolean;
}
export type NodeEnv = ProjectWorkspace['nodeEnv'];
export type MonitorLongRun = 'off' | number;
export type AutoRevealOutputType = 'on-run' | 'on-exec-error' | 'off';
export interface PluginResourceSettings {
jestCommandLine?: string;
rootPath: string;
coverageFormatter: string;
debugMode?: boolean;
coverageColors?: CoverageColors;
runMode: RunMode;
nodeEnv?: NodeEnv;
shell: RunShell;
monitorLongRun?: MonitorLongRun;
enable?: boolean;
parserPluginOptions?: JESParserPluginOptions;
useDashedArgs?: boolean;
useJest30?: boolean;
}
export interface DeprecatedPluginResourceSettings {
showCoverageOnLoad?: boolean;
autoRun?: JestExtAutoRunSetting | null;
testExplorer?: TestExplorerConfig;
}
export interface PluginWindowSettings {
disabledWorkspaceFolders: string[];
}
export type AllPluginResourceSettings = PluginResourceSettings & DeprecatedPluginResourceSettings;
export type VirtualFolderSettingKey = keyof AllPluginResourceSettings;
export interface VirtualFolderSettings extends AllPluginResourceSettings {
name: string;
}
export type GetConfigFunction = <T>(key: VirtualFolderSettingKey) => T | undefined;
export interface SettingDetail<T> {
value: T | undefined;
/** true if the setting is explicitly defined in a settings file, i.e., not from default value */
isExplicitlySet: boolean;
}
``` | /content/code_sandbox/src/Settings/types.ts | xml | 2016-10-09T13:06:02 | 2024-08-13T18:32:04 | vscode-jest | jest-community/vscode-jest | 2,819 | 840 |
```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 INT8_NUM_BYTES = require( './index' );
// TESTS //
// The export is a number...
{
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
INT8_NUM_BYTES; // $ExpectType number
}
``` | /content/code_sandbox/lib/node_modules/@stdlib/constants/int8/num-bytes/docs/types/test.ts | xml | 2016-03-24T04:19:52 | 2024-08-16T09:03:19 | stdlib | stdlib-js/stdlib | 4,266 | 100 |
```xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="path_to_url">
<item android:color="@android:color/white" android:state_activated="true" />
<item android:color="@color/colorAccent" />
</selector>
``` | /content/code_sandbox/app/src/main/res/color/selectable_header_text_color.xml | xml | 2016-04-16T22:20:07 | 2024-07-18T10:04:59 | StickyHeaders | ShamylZakariya/StickyHeaders | 1,404 | 62 |
```xml
import * as React from 'react';
import { Pill } from '@fluentui/react-northstar';
const PillActionableExample = () => (
<Pill
actionable
onDismiss={(e, data) => {
// eslint-disable-next-line no-console
console.log(e, data);
}}
>
Outlined Pill
</Pill>
);
export default PillActionableExample;
``` | /content/code_sandbox/packages/fluentui/docs/src/examples/components/Pill/Variations/PillExampleActionable.tsx | xml | 2016-06-06T15:03:44 | 2024-08-16T18:49:29 | fluentui | microsoft/fluentui | 18,221 | 88 |
```xml
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="path_to_url">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{0034821E-740D-4553-821B-14CE9213C43C}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>ConsoleAppCosmosDb</RootNamespace>
<AssemblyName>ConsoleAppCosmosDb</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject>ConsoleAppCosmosDb.Program</StartupObject>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Azure.Documents.Client, Version=2.5.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Azure.DocumentDB.2.5.1\lib\net45\Microsoft.Azure.Documents.Client.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Entities\Entity.cs" />
<Compile Include="Entities\EntityData.cs" />
<Compile Include="Entities\EntityReading.cs" />
<Compile Include="Entities\EntityReadingValue.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\System.Linq.Dynamic.Core\System.Linq.Dynamic.Core.csproj">
<Project>{d3804228-91f4-4502-9595-39584e510002}</Project>
<Name>System.Linq.Dynamic.Core</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\..\packages\Microsoft.Azure.DocumentDB.2.5.1\build\Microsoft.Azure.DocumentDB.targets" Condition="Exists('..\..\packages\Microsoft.Azure.DocumentDB.2.5.1\build\Microsoft.Azure.DocumentDB.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see path_to_url The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\Microsoft.Azure.DocumentDB.2.5.1\build\Microsoft.Azure.DocumentDB.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Azure.DocumentDB.2.5.1\build\Microsoft.Azure.DocumentDB.targets'))" />
</Target>
</Project>
``` | /content/code_sandbox/src-console/ConsoleApp_net452_CosmosDb/ConsoleApp_net452_CosmosDb.csproj | xml | 2016-04-08T16:41:51 | 2024-08-16T05:55:59 | System.Linq.Dynamic.Core | zzzprojects/System.Linq.Dynamic.Core | 1,537 | 1,132 |
```xml
<manifest xmlns:android="path_to_url"
package="cn.bingoogolapple.photopicker">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
<application>
<!---->
<activity
android:name="cn.bingoogolapple.photopicker.activity.BGAPhotoPreviewActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:screenOrientation="portrait"
android:theme="@style/BGAPPTheme"
android:windowSoftInputMode="stateAlwaysHidden" />
<!---->
<activity
android:name="cn.bingoogolapple.photopicker.activity.BGAPhotoPickerActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:screenOrientation="portrait"
android:theme="@style/BGAPPTheme"
android:windowSoftInputMode="stateAlwaysHidden" />
<!---->
<activity
android:name="cn.bingoogolapple.photopicker.activity.BGAPhotoPickerPreviewActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:screenOrientation="portrait"
android:theme="@style/BGAPPTheme"
android:windowSoftInputMode="stateAlwaysHidden" />
<provider
android:name="cn.bingoogolapple.photopicker.util.BGAPhotoFileProvider"
android:authorities="${applicationId}.bga_photo_picker.file_provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/bga_photo_picker_file_paths" />
</provider>
</application>
</manifest>
``` | /content/code_sandbox/library/src/main/AndroidManifest.xml | xml | 2016-06-24T04:05:29 | 2024-08-02T03:07:30 | BGAPhotoPicker-Android | bingoogolapple/BGAPhotoPicker-Android | 2,235 | 407 |
```xml
import * as React from 'react';
import { divProperties, getNativeProps } from '../../../Utilities';
import { DirectionalHint } from '../../../common/DirectionalHint';
import { Callout, FocusTrapCallout } from '../../../Callout';
import type { IBaseCardProps } from '../BaseCard.types';
import type { ICalloutProps } from '../../../Callout';
export interface ICardCalloutProps extends IBaseCardProps<{}, {}, {}> {
finalHeight?: number;
content?: JSX.Element;
}
export const CardCallout = (props: ICardCalloutProps) => {
const {
gapSpace = 0,
directionalHint = DirectionalHint.bottomLeftEdge,
directionalHintFixed,
targetElement,
firstFocus,
trapFocus,
onLeave,
className,
finalHeight,
content,
calloutProps,
} = props;
const mergedCalloutProps: ICalloutProps = {
...getNativeProps(props, divProperties),
className,
target: targetElement,
isBeakVisible: false,
directionalHint,
directionalHintFixed,
finalHeight,
minPagePadding: 24,
onDismiss: onLeave,
gapSpace,
...calloutProps,
};
return (
<>
{trapFocus ? (
<FocusTrapCallout
{...mergedCalloutProps}
focusTrapProps={{
forceFocusInsideTrap: false,
isClickableOutsideFocusTrap: true,
disableFirstFocus: !firstFocus,
}}
>
{content}
</FocusTrapCallout>
) : (
<Callout {...mergedCalloutProps}>{content}</Callout>
)}
</>
);
};
``` | /content/code_sandbox/packages/react/src/components/HoverCard/CardCallout/CardCallout.tsx | xml | 2016-06-06T15:03:44 | 2024-08-16T18:49:29 | fluentui | microsoft/fluentui | 18,221 | 365 |
```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>
<item type="id" name="navigation_bar_item_icon_container"/>
<item type="id" name="navigation_bar_item_active_indicator_view"/>
<item type="id" name="navigation_bar_item_icon_view" />
<item type="id" name="navigation_bar_item_labels_group" />
<item type="id" name="navigation_bar_item_small_label_view" />
<item type="id" name="navigation_bar_item_large_label_view" />
<item type="id" name="navigation_bar_item_content_container" />
<item type="id" name="navigation_bar_item_inner_content_container" />
</resources>
``` | /content/code_sandbox/lib/java/com/google/android/material/navigation/res/values/ids.xml | xml | 2016-12-05T16:11:29 | 2024-08-16T17:51:42 | material-components-android | material-components/material-components-android | 16,176 | 200 |
```xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
path_to_url
Unless required by applicable law or agreed to in writing, software
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-->
<project xmlns="path_to_url"
xmlns:xsi="path_to_url"
xsi:schemaLocation="path_to_url path_to_url">
<modelVersion>4.0.0</modelVersion>
<groupId>archetype.it</groupId>
<artifactId>basic</artifactId>
<version>0.1</version>
<properties>
<beam.version>@project.version@</beam.version>
<maven-compiler-plugin.version>@maven-compiler-plugin.version@</maven-compiler-plugin.version>
<maven-exec-plugin.version>@maven-exec-plugin.version@</maven-exec-plugin.version>
<slf4j.version>@slf4j.version@</slf4j.version>
</properties>
<repositories>
<repository>
<id>apache.snapshots</id>
<name>Apache Development Snapshot Repository</name>
<url>path_to_url
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>${maven-exec-plugin.version}</version>
<configuration>
<cleanupDaemonThreads>false</cleanupDaemonThreads>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<dependency>
<groupId>org.apache.beam</groupId>
<artifactId>beam-sdks-java-core</artifactId>
<version>${beam.version}</version>
</dependency>
<!--
By default, the starter project has a dependency on the Beam DirectRunner
to enable development and testing of pipelines. To run on another of the
Beam runners, add its module to this pom.xml according to the
runner-specific setup instructions on the Beam website:
path_to_url#runners
-->
<dependency>
<groupId>org.apache.beam</groupId>
<artifactId>beam-runners-direct-java</artifactId>
<version>${beam.version}</version>
<scope>runtime</scope>
</dependency>
<!-- slf4j API frontend binding with JUL backend -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>${slf4j.version}</version>
</dependency>
</dependencies>
</project>
``` | /content/code_sandbox/sdks/java/maven-archetypes/starter/src/test/resources/projects/basic/reference/pom.xml | xml | 2016-02-02T08:00:06 | 2024-08-16T18:58:11 | beam | apache/beam | 7,730 | 761 |
```xml
import { CodedError } from 'expo-modules-core';
/**
* Server response error.
*/
export type ResponseErrorConfig = Record<string, any> & {
/**
* Error code
*/
error: string;
/**
* Additional message
*/
error_description?: string;
/**
* URI for more info on the error
*/
error_uri?: string;
};
export type AuthErrorConfig = ResponseErrorConfig & {
/**
* Required only if state is used in the initial request
*/
state?: string;
};
const errorCodeMessages = {
// path_to_url#section-4.1.2.1
// path_to_url#AuthError
auth: {
// OAuth 2.0
invalid_request: `The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed.`,
unauthorized_client: `The client is not authorized to request an authorization code using this method.`,
access_denied: `The resource owner or authorization server denied the request.`,
unsupported_response_type: `The authorization server does not support obtaining an authorization code using this method.`,
invalid_scope: 'The requested scope is invalid, unknown, or malformed.',
server_error:
'The authorization server encountered an unexpected condition that prevented it from fulfilling the request. (This error code is needed because a 500 Internal Server Error HTTP status code cannot be returned to the client via an HTTP redirect.)',
temporarily_unavailable:
'The authorization server is currently unable to handle the request due to a temporary overloading or maintenance of the server. (This error code is needed because a 503 Service Unavailable HTTP status code cannot be returned to the client via an HTTP redirect.)',
// Open ID Connect error codes
interaction_required:
'Auth server requires user interaction of some form to proceed. This error may be returned when the prompt parameter value in the auth request is none, but the auth request cannot be completed without displaying a user interface for user interaction.',
login_required:
'Auth server requires user authentication. This error may be returned when the prompt parameter value in the auth request is none, but the auth request cannot be completed without displaying a user interface for user authentication.',
account_selection_required:
'User is required to select a session at the auth server. The user may be authenticated at the auth server with different associated accounts, but the user did not select a session. This error may be returned when the prompt parameter value in the auth request is `none`, but the auth request cannot be completed without displaying a user interface to prompt for a session to use.',
consent_required:
'Auth server requires user consent. This error may be returned when the prompt parameter value in the auth request is none, but the auth request cannot be completed without displaying a user interface for user consent.',
invalid_request_uri:
'The `request_uri` in the auth request returns an error or contains invalid data.',
invalid_request_object: 'The request parameter contains an invalid request object.',
request_not_supported:
'The OP does not support use of the `request` parameter defined in Section 6. (path_to_url#JWTRequests)',
request_uri_not_supported:
'The OP does not support use of the `request_uri` parameter defined in Section 6. (path_to_url#JWTRequests)',
registration_not_supported:
'The OP does not support use of the `registration` parameter defined in Section 7.2.1. (path_to_url#RegistrationParameter)',
},
// path_to_url#section-5.2
token: {
invalid_request: `The request is missing a required parameter, includes an unsupported parameter value (other than grant type), repeats a parameter, includes multiple credentials, utilizes more than one mechanism for authenticating the client, or is otherwise malformed.`,
invalid_client: `Client authentication failed (e.g., unknown client, no client authentication included, or unsupported authentication method). The authorization server MAY return an HTTP 401 (Unauthorized) status code to indicate which HTTP authentication schemes are supported. If the client attempted to authenticate via the "Authorization" request header field, the authorization server MUST respond with an HTTP 401 (Unauthorized) status code and include the "WWW-Authenticate" response header field matching the authentication scheme used by the client.`,
invalid_grant: `The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client.`,
unauthorized_client: `The authenticated client is not authorized to use this authorization grant type.`,
unsupported_grant_type: `The authorization grant type is not supported by the authorization server.`,
},
};
/**
* [Section 4.1.2.1](path_to_url#section-4.1.2.1)
*/
export class ResponseError extends CodedError {
/**
* Used to assist the client developer in
* understanding the error that occurred.
*/
description?: string;
/**
* A URI identifying a human-readable web page with
* information about the error, used to provide the client
* developer with additional information about the error.
*/
uri?: string;
/**
* Raw results of the error.
*/
params: Record<string, string>;
constructor(params: ResponseErrorConfig, errorCodeType: string) {
const { error, error_description, error_uri } = params;
const message = errorCodeMessages[errorCodeType][error];
let errorMessage: string;
if (message) {
errorMessage = message + (error_description ? `\nMore info: ${error_description}` : '');
} else if (error_description) {
errorMessage = error_description;
} else {
errorMessage = 'An unknown error occurred';
}
super(error, errorMessage);
this.description = error_description ?? message;
this.uri = error_uri;
this.params = params;
}
}
// @needsAudit
/**
* Represents an authorization response error: [Section 5.2](path_to_url#section-5.2).
* Often times providers will fail to return the proper error message for a given error code.
* This error method will add the missing description for more context on what went wrong.
*/
export class AuthError extends ResponseError {
/**
* Required only if state is used in the initial request
*/
state?: string;
constructor(response: AuthErrorConfig) {
super(response, 'auth');
this.state = response.state;
}
}
/**
* [Section 4.1.2.1](path_to_url#section-4.1.2.1)
*/
export class TokenError extends ResponseError {
constructor(response: ResponseErrorConfig) {
super(response, 'token');
}
}
``` | /content/code_sandbox/packages/expo-auth-session/src/Errors.ts | xml | 2016-08-15T17:14:25 | 2024-08-16T19:54:44 | expo | expo/expo | 32,004 | 1,434 |
```xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="path_to_url"
xmlns:xsi="path_to_url"
xsi:schemaLocation="path_to_url path_to_url">
<bean id="processEngineConfiguration"
class="org.flowable.engine.impl.cfg.StandaloneProcessEngineConfiguration">
<property name="jdbcUrl" value="${jdbc.url:jdbc:h2:mem:flowable;DB_CLOSE_DELAY=1000}" />
<property name="jdbcDriver" value="${jdbc.driver:org.h2.Driver}" />
<property name="jdbcUsername" value="${jdbc.username:sa}" />
<property name="jdbcPassword" value="${jdbc.password:}" />
<!-- Database configurations -->
<property name="databaseSchemaUpdate" value="drop-create" />
<!-- mail server configurations -->
<property name="mailServerPort" value="5025" />
<property name="history" value="full" />
</bean>
</beans>
``` | /content/code_sandbox/modules/flowable-jmx/src/test/resources/flowable.cfg.xml | xml | 2016-10-13T07:21:43 | 2024-08-16T15:23:14 | flowable-engine | flowable/flowable-engine | 7,715 | 211 |
```xml
import {getJsonSchema} from "../../index.js";
import {Schema} from "./schema.js";
describe("Schema()", () => {
it("should store data", () => {
class Test {
@Schema({
pattern: "a|b"
})
test: string;
}
expect(getJsonSchema(Test)).toEqual({
properties: {
test: {
pattern: "a|b",
type: "string"
}
},
type: "object"
});
});
});
``` | /content/code_sandbox/packages/specs/schema/src/decorators/common/schema.spec.ts | xml | 2016-02-21T18:38:47 | 2024-08-14T21:19:48 | tsed | tsedio/tsed | 2,817 | 109 |
```xml
/*
* @license Apache-2.0
*
*
*
* path_to_url
*
* Unless required by applicable law or agreed to in writing, software
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/
// TypeScript Version: 4.1
/**
* Returns a list of standard library aliases.
*
* @param namespace - namespace filter
* @returns list of aliases
*
* @example
* var list = aliases();
* // returns [...]
*
* @example
* var list = aliases( '@stdlib/math/base/special' );
* // returns [...]
*/
declare function aliases( namespace?: string ): Array<string>;
// EXPORTS //
export = aliases;
``` | /content/code_sandbox/lib/node_modules/@stdlib/namespace/aliases/docs/types/index.d.ts | xml | 2016-03-24T04:19:52 | 2024-08-16T09:03:19 | stdlib | stdlib-js/stdlib | 4,266 | 146 |
```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
-->
<project xmlns="path_to_url" xmlns:xsi="path_to_url"
xsi:schemaLocation="path_to_url path_to_url">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.pulsar</groupId>
<artifactId>pulsar-client-1x-base</artifactId>
<version>4.0.0-SNAPSHOT</version>
</parent>
<artifactId>pulsar-client-1x</artifactId>
<name>Pulsar Client 1.x Compatibility API</name>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>pulsar-client-2x-shaded</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.gaul</groupId>
<artifactId>modernizer-maven-plugin</artifactId>
<configuration>
<failOnViolations>true</failOnViolations>
<javaVersion>8</javaVersion>
</configuration>
<executions>
<execution>
<id>modernizer</id>
<phase>verify</phase>
<goals>
<goal>modernizer</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>${spotbugs-maven-plugin.version}</version>
<configuration>
<excludeFilterFile>${basedir}/src/main/resources/findbugsExclude.xml</excludeFilterFile>
</configuration>
<executions>
<execution>
<id>spotbugs</id>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
``` | /content/code_sandbox/pulsar-client-1x-base/pulsar-client-1x/pom.xml | xml | 2016-06-28T07:00:03 | 2024-08-16T17:12:43 | pulsar | apache/pulsar | 14,047 | 575 |
```xml
import * as React from 'react';
import cx from 'classnames';
import { createSvgIcon } from '../utils/createSvgIcon';
import { iconClassNames } from '../utils/iconClassNames';
export const DownloadIcon = createSvgIcon({
svg: ({ classes }) => (
<svg role="presentation" focusable="false" viewBox="2 2 16 16" className={classes.svg}>
<path
className={cx(iconClassNames.outline, classes.outlinePart)}
d="M15.5 16.9989C15.7761 16.9989 16 17.2227 16 17.4989C16 17.7443 15.8231 17.9485 15.5899 17.9908L15.5 17.9989H4.5C4.22386 17.9989 4 17.775 4 17.4989C4 17.2534 4.17688 17.0493 4.41012 17.0069L4.5 16.9989H15.5ZM10.0001 2.0011C10.2456 2.0011 10.4497 2.1781 10.492 2.41137L10.5 2.50124L10.496 14.2951L14.1414 10.6468C14.3148 10.473 14.5842 10.4535 14.7792 10.5883L14.8485 10.6461C15.0222 10.8195 15.0418 11.0889 14.907 11.2839L14.8492 11.3532L10.3574 15.8532C10.285 15.9259 10.1957 15.9715 10.1021 15.9902L9.99608 16C9.83511 16 9.69192 15.9239 9.60051 15.8057L5.14386 11.3538C4.94846 11.1587 4.94823 10.8421 5.14336 10.6467C5.3168 10.473 5.58621 10.4535 5.78117 10.5884L5.85046 10.6462L9.496 14.2871L9.5 2.50095C9.50008 2.22481 9.724 2.0011 10.0001 2.0011Z"
/>
<path
className={cx(iconClassNames.filled, classes.filledPart)}
d="M15.2444 16.4976C15.6586 16.4976 15.9944 16.8334 15.9944 17.2476C15.9944 17.6273 15.7123 17.9411 15.3462 17.9907L15.2444 17.9976H4.74976C4.33554 17.9976 3.99976 17.6618 3.99976 17.2476C3.99976 16.8679 4.28191 16.5541 4.64799 16.5044L4.74976 16.4976H15.2444ZM10.0034 1.99939C10.3831 1.99939 10.6969 2.28154 10.7465 2.64762L10.7534 2.74939L10.7528 12.9424L13.719 9.97181C13.985 9.7053 14.4016 9.68071 14.6955 9.89829L14.7796 9.97083C15.0461 10.2369 15.0707 10.6535 14.8532 10.9473L14.7806 11.0315L10.5378 15.2821L10.4671 15.3446L10.3762 15.4032L10.3397 15.4244L10.2486 15.4623L10.1281 15.4924L10.0588 15.5003L9.99876 15.5023C9.94864 15.5023 9.89776 15.4968 9.84804 15.4862L9.76716 15.4631C9.67115 15.4321 9.58404 15.3818 9.50989 15.3171L5.22032 11.0324C4.92721 10.7397 4.92688 10.2648 5.21956 9.9717C5.48564 9.70524 5.90228 9.68074 6.19605 9.89838L6.28022 9.97094L9.25276 12.9384L9.25338 2.74939C9.25338 2.33518 9.58917 1.99939 10.0034 1.99939Z"
/>
</svg>
),
displayName: 'DownloadIcon',
});
``` | /content/code_sandbox/packages/fluentui/react-icons-northstar/src/components/DownloadIcon.tsx | xml | 2016-06-06T15:03:44 | 2024-08-16T18:49:29 | fluentui | microsoft/fluentui | 18,221 | 1,221 |
```xml
import {
Button,
MainStyleTitle as Title,
Wrapper,
HeaderDescription,
} from '@erxes/ui/src';
import React, { useState } from 'react';
import { ContentBox } from '../styles';
import { IConfigsMap } from '../types';
import PerSettings from './PerHolidayBonus';
import Sidebar from './Sidebar';
import { __ } from 'coreui/utils';
function Header() {
return (
<HeaderDescription
icon="/images/actions/25.svg"
title={__('Holiday config')}
description=""
/>
);
}
type Props = {
save: (configsMap: IConfigsMap) => void;
configsMap: IConfigsMap;
};
const GeneralSettings = (props: Props) => {
const [configsMap, setConfigsMap] = useState<IConfigsMap>(props.configsMap);
const add = (e) => {
e.preventDefault();
if (!configsMap.holidayConfig) {
configsMap.holidayConfig = {};
}
// must save prev item saved then new item
const newHolidayConfig = {
title: 'New Holiday Config',
month: undefined,
day: undefined,
};
setConfigsMap((prevConfigsMap) => ({
...prevConfigsMap,
holidayConfig: {
...prevConfigsMap.holidayConfig,
newHolidayConfig,
},
}));
};
const deleteHandler = (currentConfigKey: string) => {
const updated = Object.fromEntries(
Object.entries(configsMap.holidayConfig).filter(
([key]) => key !== (currentConfigKey || 'newHolidayConfig'),
),
);
setConfigsMap({ ...configsMap, holidayConfig: updated });
props.save({ ...configsMap, holidayConfig: updated });
};
const renderConfigs = (configs) => {
return Object.keys(configs).map((key) => {
return (
<PerSettings
key={Math.random()}
configsMap={configsMap}
config={configs[key]}
currentConfigKey={key}
save={props.save}
delete={deleteHandler}
/>
);
});
};
const renderContent = () => {
const configs = configsMap.holidayConfig || {};
return (
<ContentBox id={'HolidaySettingsMenu'}>
{renderConfigs(configs)}
</ContentBox>
);
};
const breadcrumb = [
{ title: __('Settings'), link: '/settings' },
{ title: __('Loan config') },
];
const actionButtons = (
<Button btnStyle="primary" onClick={add} icon="plus" uppercase={false}>
{__('New config')}
</Button>
);
return (
<Wrapper
header={
<Wrapper.Header title={__('Holiday configs')} breadcrumb={breadcrumb} />
}
mainHead={<Header />}
actionBar={
<Wrapper.ActionBar
left={<Title>{__('Holiday configs')}</Title>}
right={actionButtons}
/>
}
leftSidebar={<Sidebar />}
content={renderContent()}
/>
);
};
export default GeneralSettings;
``` | /content/code_sandbox/packages/plugin-loans-ui/src/settings/components/HolidaySettings.tsx | xml | 2016-11-11T06:54:50 | 2024-08-16T10:26:06 | erxes | erxes/erxes | 3,479 | 650 |
```xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="path_to_url"
xmlns:xsi="path_to_url"
xsi:schemaLocation="path_to_url path_to_url">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>cn.abel</groupId>
<artifactId>abel-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<groupId>cn.abel</groupId>
<artifactId>abel-user-provider</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>cn.abel</groupId>
<artifactId>abel-user-api</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>cn.abel</groupId>
<artifactId>abel-util</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.58</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<!--mybatis-->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!--dubbox-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>dubbo</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
</dependency>
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jackson-provider</artifactId>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
</dependency>
<dependency>
<groupId>com.101tec</groupId>
<artifactId>zkclient</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore-nio</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpasyncclient</artifactId>
</dependency>
<dependency>
<groupId>it.uniroma1.dis.wsngroup.gexf4j</groupId>
<artifactId>gexf4j</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>io.sentry</groupId>
<artifactId>sentry-logback</artifactId>
<version>1.7.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-framework</artifactId>
<version>2.5.0</version>
</dependency>
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.15.0-GA</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
``` | /content/code_sandbox/springboot-dubbo/abel-user-provider/pom.xml | xml | 2016-11-07T02:13:31 | 2024-08-16T08:17:57 | springBoot | 527515025/springBoot | 6,488 | 1,325 |
```xml
import React from 'react'
import {MdPriorityHigh} from 'react-icons/md'
export default class IconMissing extends React.Component {
render() {
return (
<MdPriorityHigh {...this.props} />
)
}
}
``` | /content/code_sandbox/src/components/IconMissing.tsx | xml | 2016-09-08T17:52:22 | 2024-08-16T12:54:23 | maputnik | maplibre/maputnik | 2,046 | 50 |
```xml
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="path_to_url" xmlns:xsi="path_to_url" xmlns:flowable="path_to_url" xmlns:cmmndi="path_to_url" xmlns:dc="path_to_url" xmlns:di="path_to_url" targetNamespace="path_to_url">
<case id="testIsNotEmptyFunction" name="testElFunction" flowable:initiatorVariableName="initiator">
<casePlanModel id="casePlanModel">
<planItem id="planItem1" name="The Task" definitionRef="sid-3D4B7A72-8A16-40ED-A41D-A57D36457FE8"></planItem>
<planItem id="planItem2" name="Guarded Task" definitionRef="sid-B8631F0D-DA56-42D3-AFA2-46E147559E2A">
<entryCriterion id="sid-73C946BB-815E-4CF7-8290-5DD83E47C4DB" sentryRef="sentry1"></entryCriterion>
</planItem>
<sentry id="sentry1">
<ifPart>
<condition><![CDATA[${variables:isNotEmpty(myVar)}]]></condition>
</ifPart>
</sentry>
<humanTask id="sid-3D4B7A72-8A16-40ED-A41D-A57D36457FE8" name="The Task"></humanTask>
<humanTask id="sid-B8631F0D-DA56-42D3-AFA2-46E147559E2A" name="Guarded Task"></humanTask>
</casePlanModel>
</case>
<cmmndi:CMMNDI>
<cmmndi:CMMNDiagram id="CMMNDiagram_testElFunction">
<cmmndi:CMMNShape id="CMMNShape_casePlanModel" cmmnElementRef="casePlanModel">
<dc:Bounds height="714.0" width="718.0" x="40.0" y="40.0"></dc:Bounds>
<cmmndi:CMMNLabel></cmmndi:CMMNLabel>
</cmmndi:CMMNShape>
<cmmndi:CMMNShape id="CMMNShape_planItem1" cmmnElementRef="planItem1">
<dc:Bounds height="80.0" width="100.0" x="165.0" y="213.0"></dc:Bounds>
<cmmndi:CMMNLabel></cmmndi:CMMNLabel>
</cmmndi:CMMNShape>
<cmmndi:CMMNShape id="CMMNShape_planItem2" cmmnElementRef="planItem2">
<dc:Bounds height="80.0" width="100.0" x="420.0" y="213.0"></dc:Bounds>
<cmmndi:CMMNLabel></cmmndi:CMMNLabel>
</cmmndi:CMMNShape>
<cmmndi:CMMNShape id="CMMNShape_sid-73C946BB-815E-4CF7-8290-5DD83E47C4DB" cmmnElementRef="sid-73C946BB-815E-4CF7-8290-5DD83E47C4DB">
<dc:Bounds height="22.0" width="14.0" x="412.52723935207854" y="239.67941330354384"></dc:Bounds>
<cmmndi:CMMNLabel></cmmndi:CMMNLabel>
</cmmndi:CMMNShape>
</cmmndi:CMMNDiagram>
</cmmndi:CMMNDI>
</definitions>
``` | /content/code_sandbox/modules/flowable-cmmn-engine/src/test/resources/org/flowable/cmmn/test/el/VariableFunctionDelegatesTest.testVariableIsNotEmpty.cmmn.xml | xml | 2016-10-13T07:21:43 | 2024-08-16T15:23:14 | flowable-engine | flowable/flowable-engine | 7,715 | 871 |
```xml
import React, { CSSProperties, FC, useMemo } from 'react';
import { css, Stack, StackItem, useTheme } from '@fluentui/react';
import { useConst } from '@fluentui/react-hooks';
import { LockIcon, POIIcon, RecentIcon, RepeatAllIcon } from '@fluentui/react-icons-mdl2';
import { IEvent } from 'model';
import { useConfigurationService } from 'services';
import { Humanize as strings } from 'ComponentStrings';
import styles from './EventBar.module.scss';
export enum EventBarSize {
Compact,
Large
}
interface IProps {
event: IEvent;
startsIn: boolean;
endsIn: boolean;
timeStringOverride?: string;
size?: EventBarSize;
}
export const EventBar: FC<IProps> = ({ event, startsIn, endsIn, timeStringOverride, size = EventBarSize.Compact }) => {
const { palette: { themePrimary } } = useTheme();
const { active: { useApprovals } } = useConfigurationService();
const { isPendingApproval, isRejected, title, start, end, isAllDay, location, tag, color, isConfidential, isRecurring } = event;
const eventClassName = css(
styles.event,
{
[styles.unapproved]: useApprovals && isPendingApproval,
[styles.rejected]: isRejected,
[styles.startsIn]: startsIn,
[styles.endsIn]: endsIn,
[styles.compact]: size === EventBarSize.Compact
}
);
const style: CSSProperties = useMemo(() => {
return {
backgroundColor: color?.toCssString() || themePrimary
};
}, [color, themePrimary]);
const startTimeString = timeStringOverride ||
(size === EventBarSize.Compact
? (!isAllDay && start?.format('LT'))
: isAllDay ? strings.AllDay : `${start?.format('LT')} - ${end?.format('LT')}`
);
return (
<Stack className={eventClassName} style={style} tokens={useConst({ childrenGap: 2 })}>
<Stack horizontal verticalAlign="center" title={title} tokens={useConst({ childrenGap: 6 })}>
{tag && <span>[{tag}]</span>}
<StackItem className={styles.text}>
{size === EventBarSize.Compact && startTimeString && `${startTimeString}, `}
{title}
</StackItem>
{isConfidential && <LockIcon />}
<StackItem grow className={styles.recur}>
{isRecurring && <RepeatAllIcon />}
</StackItem>
</Stack>
{size === EventBarSize.Large && <>
<Stack horizontal verticalAlign='center' tokens={useConst({ childrenGap: 4 })}>
<RecentIcon />
<span className={styles.text}>{startTimeString}</span>
</Stack>
<Stack horizontal verticalAlign='center' tokens={useConst({ childrenGap: 4 })}>
<POIIcon />
<span className={styles.text}>{location || '-'}</span>
</Stack>
</>}
</Stack>
);
}
``` | /content/code_sandbox/samples/react-rhythm-of-business-calendar/src/components/events/EventBar.tsx | xml | 2016-08-30T17:21:43 | 2024-08-16T18:41:32 | sp-dev-fx-webparts | pnp/sp-dev-fx-webparts | 2,027 | 685 |
```xml
<Documentation>
<Docs DocId="T:CoreImage.CIPhotoEffectChrome">
<summary>A filter that exaggerates color of the image producing a vintage look.</summary>
<remarks>
<para>The following example shows this filter in use</para>
<example>
<code lang="csharp lang-csharp"><![CDATA[
// Create the CIImage from a file
CIImage flower = CIImage.FromCGImage (UIImage.FromFile ("flower.png").CGImage);
// Create a CIPhotoEffectChrome filter with the input image
var photo_effect_chrome = new CIPhotoEffectChrome ()
{
Image = flower
};
// Get the altered image from the filter
var output = photo_effect_chrome.OutputImage;
// To render the results, we need to create a context, and then
// use one of the context rendering APIs, in this case, we render the
// result into a CoreGraphics image, which is merely a useful representation
//
var context = CIContext.FromOptions (null);
var cgimage = context.CreateCGImage (output, output.Extent);
// The above cgimage can be added to a screen view, for example, this
// would add it to a UIImageView on the screen:
myImageView.Image = UIImage.FromImage (cgimage);
]]></code>
</example>
<para>
With the following image input:
</para>
<para>
<img href="~/CoreImage/_images/flower.png" alt="Photograph of a sunflower." />
</para>
<para>
Produces the following output:
</para>
<para>
<img href="~/CoreImage/_images/photo_effect_chrome.png" alt="Result of applying the filter." />
</para>
<para>
"Flower" 2012 Milica Sekulic, used under a Creative Commons Attribution-ShareAlike license: path_to_url
</para>
</remarks>
</Docs>
</Documentation>
``` | /content/code_sandbox/docs/api/CoreImage/CIPhotoEffectChrome.xml | xml | 2016-04-20T18:24:26 | 2024-08-16T13:29:19 | xamarin-macios | xamarin/xamarin-macios | 2,436 | 428 |
```xml
import { graphql } from './gql/index';
import { makeYoga } from './yoga';
import persistedDocumentsDictionary from './gql/persisted-documents.json';
import { print } from 'graphql';
const persistedDocuments = new Map<string, string>(Object.entries(persistedDocumentsDictionary));
const HelloQuery = graphql(/* GraphQL */ `
query HelloQuery {
hello
}
`);
describe('Persisted Documents', () => {
it('execute document without persisted operation enabled', async () => {
const yoga = makeYoga({ persistedDocuments: null });
const result = await yoga.fetch('path_to_url {
method: 'POST',
headers: {
'content-type': 'application/json',
accept: 'application/json',
},
body: JSON.stringify({
query: print(HelloQuery),
}),
});
expect(await result.json()).toMatchInlineSnapshot(`
Object {
"data": Object {
"hello": "Hello world!",
},
}
`);
});
it('can not execute arbitrary operation with persisted operations enabled', async () => {
const yoga = makeYoga({ persistedDocuments });
const result = await yoga.fetch('path_to_url {
method: 'POST',
headers: {
'content-type': 'application/json',
accept: 'application/json',
},
body: JSON.stringify({
query: print(HelloQuery),
}),
});
expect(await result.json()).toMatchInlineSnapshot(`
Object {
"errors": Array [
Object {
"message": "PersistedQueryOnly",
},
],
}
`);
});
it('can execute persisted operation with persisted operations enabled', async () => {
const yoga = makeYoga({ persistedDocuments });
const result = await yoga.fetch('path_to_url {
method: 'POST',
headers: {
'content-type': 'application/json',
accept: 'application/json',
},
body: JSON.stringify({
extensions: {
persistedQuery: {
version: 1,
sha256Hash: (HelloQuery as any)['__meta__']['hash'],
},
},
}),
});
expect(await result.json()).toMatchInlineSnapshot(`
Object {
"data": Object {
"hello": "Hello world!",
},
}
`);
});
});
``` | /content/code_sandbox/examples/persisted-documents/src/yoga.spec.ts | xml | 2016-12-05T19:15:11 | 2024-08-15T14:56:08 | graphql-code-generator | dotansimha/graphql-code-generator | 10,759 | 492 |
```xml
/*
* This software is released under MIT license.
* The full license information can be found in LICENSE in the root directory of this project.
*/
import {
ClarityMotion,
AnimationAccordionPanelOpenName,
AnimationAccordionPanelOpenConfig,
registerElementSafely,
} from '@cds/core/internal';
import { CdsAccordion } from './accordion.element.js';
import { CdsAccordionPanel } from './accordion-panel.element.js';
import { CdsAccordionContent } from './accordion-content.element.js';
import { CdsAccordionHeader } from './accordion-header.element.js';
import '@cds/core/icon/register.js';
import '@cds/core/button-expand/register.js';
registerElementSafely('cds-accordion', CdsAccordion);
registerElementSafely('cds-accordion-panel', CdsAccordionPanel);
registerElementSafely('cds-accordion-content', CdsAccordionContent);
registerElementSafely('cds-accordion-header', CdsAccordionHeader);
ClarityMotion.add(AnimationAccordionPanelOpenName, AnimationAccordionPanelOpenConfig);
declare global {
interface HTMLElementTagNameMap {
'cds-accordion': CdsAccordion;
'cds-accordion-panel': CdsAccordionPanel;
'cds-accordion-content': CdsAccordionContent;
'cds-accordion-header': CdsAccordionHeader;
}
}
``` | /content/code_sandbox/packages/core/src/accordion/register.ts | xml | 2016-09-29T17:24:17 | 2024-08-11T17:06:15 | clarity | vmware-archive/clarity | 6,431 | 284 |
```xml
declare interface IBotFrameworkChatStrings {
PropertyPaneDescription: string;
BasicGroupName: string;
DescriptionFieldLabel: string;
}
declare module 'BotFrameworkChatWebPartStrings' {
const strings: IBotFrameworkChatStrings;
export = strings;
}
``` | /content/code_sandbox/samples/react-bot-framework/src/webparts/botFrameworkChat/loc/mystrings.d.ts | xml | 2016-08-30T17:21:43 | 2024-08-16T18:41:32 | sp-dev-fx-webparts | pnp/sp-dev-fx-webparts | 2,027 | 57 |
```xml
import { Plugin } from 'rollup'
import logger from '../logger'
export default function ({ title }: { title: string }): Plugin {
return {
name: 'progress',
buildStart() {
logger.progress(title)
},
transform(code: string, id: string) {
if (!process.env.CI && process.stdout.isTTY) {
logger.progress(`Bundling ${id.replace(process.cwd(), '.')}`)
}
return null
},
}
}
``` | /content/code_sandbox/src/plugins/progress.ts | xml | 2016-08-03T12:17:13 | 2024-07-22T12:56:16 | bili | egoist/bili | 1,043 | 101 |
```xml
import { NameObj, MovementType, DrawType } from "./NameObj.js";
import { OceanBowl } from "./Actors/OceanBowl.js";
import { SceneObjHolder, SpecialTextureType, SceneObj } from "./Main.js";
import { connectToSceneScreenEffectMovement, getCamPos, connectToSceneAreaObj, getPlayerPos, connectToScene, loadBTIData, setTextureMatrixST, isValidSwitchA } from "./ActorUtil.js";
import { ViewerRenderInput } from "../viewer.js";
import { AreaObjMgr, AreaObj, AreaFormType } from "./AreaObj.js";
import { vec3, mat4, ReadonlyVec3 } from "gl-matrix";
import { OceanRing, isEqualStageName, HeatHazeDirector, WhirlPoolAccelerator } from "./Actors/MiscActor.js";
import { JMapInfoIter, getJMapInfoBool, getJMapInfoArg0, getJMapInfoArg1, getJMapInfoArg2 } from "./JMapInfo.js";
import { ZoneAndLayer, LiveActor, dynamicSpawnZoneAndLayer } from "./LiveActor.js";
import { createNormalBloom } from "./ImageEffect.js";
import { fallback } from "../util.js";
import { OceanSphere } from "./Actors/OceanSphere.js";
import { colorNewFromRGBA8, colorCopy, colorLerp } from "../Color.js";
import { BTIData } from "../Common/JSYSTEM/JUTTexture.js";
import { GfxDevice } from "../gfx/platform/GfxPlatform.js";
import { GfxRenderInstManager } from "../gfx/render/GfxRenderInstManager.js";
import { GXMaterialHelperGfx, ub_SceneParamsBufferSize, MaterialParams, DrawParams, ColorKind } from "../gx/gx_render.js";
import { GXMaterialBuilder } from "../gx/GXMaterialBuilder.js";
import { TDDraw } from "./DDraw.js";
import * as GX from '../gx/gx_enum.js';
import { MathConstants, saturate, Vec3NegY } from "../MathHelpers.js";
import { GX_Program } from "../gx/gx_material.js";
import { gfxDeviceNeedsFlipY } from "../gfx/helpers/GfxDeviceHelpers.js";
//#region Water
export class WaterArea extends AreaObj {
public override getManagerName(): string {
return "Water";
}
}
export function requestArchivesWaterArea(sceneObjHolder: SceneObjHolder): void {
WaterAreaHolder.requestArchives(sceneObjHolder);
}
export class WaterAreaMgr extends AreaObjMgr<WaterArea> {
constructor(sceneObjHolder: SceneObjHolder) {
super(sceneObjHolder, "Water");
}
}
export class WaterInfo {
public depth: number = 0;
public areaObj: AreaObj | null = null;
public oceanBowl: OceanBowl | null = null;
public oceanRing: OceanRing | null = null;
public oceanSphere: OceanSphere | null = null;
public reset(): void {
this.depth = 0;
this.areaObj = null;
this.oceanBowl = null;
this.oceanRing = null;
this.oceanSphere = null;
}
}
const scratchVec3 = vec3.create();
export class WaterAreaHolder extends NameObj {
public cameraInWater: boolean = false;
public cameraWaterInfo = new WaterInfo();
public oceanBowl: OceanBowl[] = [];
public oceanRing: OceanRing[] = [];
public oceanSphere: OceanSphere[] = [];
private useBloom: boolean = false;
private waterCameraFilter: WaterCameraFilter;
constructor(sceneObjHolder: SceneObjHolder) {
super(sceneObjHolder, 'WaterAreaHolder');
if (isEqualStageName(sceneObjHolder, 'HeavenlyBeachGalaxy') || isEqualStageName(sceneObjHolder, 'OceanRingGalaxy')) {
createNormalBloom(sceneObjHolder);
this.useBloom = true;
}
connectToSceneScreenEffectMovement(sceneObjHolder, this);
this.waterCameraFilter = new WaterCameraFilter(dynamicSpawnZoneAndLayer, sceneObjHolder);
}
public isOnWaterCameraFilter(): boolean {
return this.waterCameraFilter.isOnWaterCameraFilter();
}
public entryOceanBowl(oceanBowl: OceanBowl): void {
this.oceanBowl.push(oceanBowl);
}
public entryOceanRing(oceanRing: OceanRing): void {
this.oceanRing.push(oceanRing);
}
public entryOceanSphere(oceanSphere: OceanSphere): void {
this.oceanSphere.push(oceanSphere);
}
public entryWhirlPoolAccelerator(whirlPool: WhirlPoolAccelerator): void {
// TODO(jstpierre)
}
public override movement(sceneObjHolder: SceneObjHolder): void {
super.movement(sceneObjHolder);
getCamPos(scratchVec3, sceneObjHolder.viewerInput.camera);
const inWater = getWaterAreaObj(this.cameraWaterInfo, sceneObjHolder, scratchVec3);
if (inWater) {
if (!this.cameraInWater) {
this.cameraInWater = true;
if (this.useBloom) {
const imageEffectDirector = sceneObjHolder.imageEffectSystemHolder!.imageEffectDirector;
imageEffectDirector.turnOnNormal(sceneObjHolder);
imageEffectDirector.setNormalBloomIntensity(0xFF);
imageEffectDirector.setNormalBloomThreshold(0x80);
imageEffectDirector.setNormalBloomBlurIntensity1(0x28);
imageEffectDirector.setNormalBloomBlurIntensity2(0x14);
}
}
getWaterAreaInfo(this.cameraWaterInfo, scratchVec3, Vec3NegY);
// TODO(jstpierre): WaterInfo
} else {
if (this.cameraInWater) {
if (this.useBloom) {
const imageEffectDirector = sceneObjHolder.imageEffectSystemHolder!.imageEffectDirector;
imageEffectDirector.setAuto(sceneObjHolder);
}
this.cameraInWater = false;
}
}
}
public static override requestArchives(sceneObjHolder: SceneObjHolder): void {
WaterCameraFilter.requestArchives(sceneObjHolder);
}
}
export function getWaterAreaObj(dst: WaterInfo | null, sceneObjHolder: SceneObjHolder, position: ReadonlyVec3): boolean {
if (dst !== null)
dst.reset();
if (sceneObjHolder.areaObjContainer !== null) {
const areaObj = sceneObjHolder.areaObjContainer.getAreaObj("Water", position);
if (areaObj !== null) {
if (dst !== null)
dst.areaObj = areaObj;
return true;
}
}
// tryInOceanArea
if (sceneObjHolder.waterAreaHolder !== null) {
const waterAreas = sceneObjHolder.waterAreaHolder;
for (let i = 0; i < waterAreas.oceanBowl.length; i++) {
if (waterAreas.oceanBowl[i].isInWater(position)) {
if (dst !== null)
dst.oceanBowl = waterAreas.oceanBowl[i];
return true;
}
}
for (let i = 0; i < waterAreas.oceanRing.length; i++) {
if (waterAreas.oceanRing[i].isInWater(sceneObjHolder, position)) {
if (dst !== null)
dst.oceanRing = waterAreas.oceanRing[i];
return true;
}
}
for (let i = 0; i < waterAreas.oceanSphere.length; i++) {
if (waterAreas.oceanSphere[i].isInWater(position)) {
if (dst !== null)
dst.oceanSphere = waterAreas.oceanSphere[i];
return true;
}
}
}
return false;
}
export function getWaterAreaInfo(info: WaterInfo, pos: ReadonlyVec3, gravity: ReadonlyVec3, recurse: boolean = false): void {
if (info.oceanBowl !== null) {
info.oceanBowl.calcWaterInfo(info, pos, gravity);
} else if (info.oceanSphere !== null) {
info.oceanSphere.calcWaterInfo(info, pos, gravity);
} else if (info.oceanRing !== null) {
info.oceanRing.calcWaterInfo(info, pos, gravity);
} else if (info.areaObj !== null) {
}
}
export function isInWater(sceneObjHolder: SceneObjHolder, position: ReadonlyVec3): boolean {
return getWaterAreaObj(null, sceneObjHolder, position);
}
export function isCameraInWater(sceneObjHolder: SceneObjHolder): boolean {
if (sceneObjHolder.waterAreaHolder === null)
return false;
return sceneObjHolder.waterAreaHolder.cameraInWater;
}
export function createWaterAreaCube(zoneAndLayer: ZoneAndLayer, sceneObjHolder: SceneObjHolder, infoIter: JMapInfoIter): NameObj {
return new WaterArea(zoneAndLayer, sceneObjHolder, infoIter, AreaFormType.BaseOriginCube);
}
export function createWaterAreaCylinder(zoneAndLayer: ZoneAndLayer, sceneObjHolder: SceneObjHolder, infoIter: JMapInfoIter): NameObj {
return new WaterArea(zoneAndLayer, sceneObjHolder, infoIter, AreaFormType.BaseOriginCylinder);
}
export function createWaterAreaSphere(zoneAndLayer: ZoneAndLayer, sceneObjHolder: SceneObjHolder, infoIter: JMapInfoIter): NameObj {
return new WaterArea(zoneAndLayer, sceneObjHolder, infoIter, AreaFormType.Sphere);
}
function computeRotationZAroundPoint(dst: mat4, theta: number, x: number, y: number): void {
const sin = Math.sin(theta), cos = Math.cos(theta);
dst[0] = cos;
dst[4] = -sin;
dst[12] = x + -x * cos + y * sin;
dst[1] = sin;
dst[5] = cos;
dst[13] = y + -x * sin - y * cos;
}
const drawParams = new DrawParams();
const enum WaterCameraFilterNrv { Air, AirToWater, Water, WaterToAir }
export class WaterCameraFilter extends LiveActor<WaterCameraFilterNrv> {
private angle: number = 0;
private fade: number = 0;
private colorShallow = colorNewFromRGBA8(0x32320000);
private colorDeep = colorNewFromRGBA8(0x32000000);
private color = colorNewFromRGBA8(0x00000000);
private materialParams = new MaterialParams();
private filterTexture: BTIData;
private materialHelper: GXMaterialHelperGfx;
private ddraw = new TDDraw();
constructor(zoneAndLayer: ZoneAndLayer, sceneObjHolder: SceneObjHolder) {
super(zoneAndLayer, sceneObjHolder, 'WaterCameraFilter');
connectToScene(sceneObjHolder, this, MovementType.MapObj, -1, -1, DrawType.WaterCameraFilter);
// invalidateClipping
this.initNerve(WaterCameraFilterNrv.Air);
const arc = sceneObjHolder.modelCache.getObjectData('WaterCameraFilter');
this.filterTexture = loadBTIData(sceneObjHolder, arc, 'WaterCameraFilter.bti');
this.filterTexture.fillTextureMapping(this.materialParams.m_TextureMapping[0]);
sceneObjHolder.specialTextureBinder.registerTextureMapping(this.materialParams.m_TextureMapping[1], SpecialTextureType.OpaqueSceneTexture);
this.makeActorAppeared(sceneObjHolder);
// loadMaterial
this.ddraw.setVtxDesc(GX.Attr.POS, true);
this.ddraw.setVtxDesc(GX.Attr.TEX0, true);
this.ddraw.setVtxDesc(GX.Attr.TEX1, true);
const mb = new GXMaterialBuilder('WaterCameraFilter');
mb.setTexCoordGen(GX.TexCoordID.TEXCOORD0, GX.TexGenType.MTX3x4, GX.TexGenSrc.TEX0, GX.TexGenMatrix.TEXMTX0);
mb.setTexCoordGen(GX.TexCoordID.TEXCOORD1, GX.TexGenType.MTX3x4, GX.TexGenSrc.TEX1, GX.TexGenMatrix.IDENTITY);
mb.setIndTexOrder(GX.IndTexStageID.STAGE0, GX.TexCoordID.TEXCOORD0, GX.TexMapID.TEXMAP0);
mb.setTevIndWarp(0, GX.IndTexStageID.STAGE0, true, false, GX.IndTexMtxID._0);
mb.setTevOrder(0, GX.TexCoordID.TEXCOORD1, GX.TexMapID.TEXMAP1, GX.RasColorChannelID.COLOR_ZERO);
mb.setTevColorIn(0, GX.CC.C0, GX.CC.ZERO, GX.CC.ZERO, GX.CC.TEXC);
mb.setTevColorOp(0, GX.TevOp.SUB, GX.TevBias.ZERO, GX.TevScale.SCALE_1, true, GX.Register.PREV);
mb.setTevAlphaIn(0, GX.CA.A0, GX.CA.ZERO, GX.CA.ZERO, GX.CA.ZERO);
mb.setTevAlphaOp(0, GX.TevOp.ADD, GX.TevBias.ZERO, GX.TevScale.SCALE_1, true, GX.Register.PREV);
mb.setBlendMode(GX.BlendMode.BLEND, GX.BlendFactor.SRCALPHA, GX.BlendFactor.INVSRCALPHA);
mb.setAlphaCompare(GX.CompareType.GREATER, 0, GX.AlphaOp.OR, GX.CompareType.GREATER, 0);
mb.setZMode(false, GX.CompareType.ALWAYS, false);
mb.setCullMode(GX.CullMode.NONE);
mb.setUsePnMtxIdx(false);
this.materialHelper = new GXMaterialHelperGfx(mb.finish());
}
protected override control(sceneObjHolder: SceneObjHolder): void {
super.control(sceneObjHolder);
if (isCameraInWater(sceneObjHolder)) {
this.angle += 0.5 * sceneObjHolder.deltaTimeFrames;
const cameraDepth = saturate(sceneObjHolder.waterAreaHolder!.cameraWaterInfo.depth / 3000.0);
colorLerp(this.color, this.colorShallow, this.colorDeep, cameraDepth);
}
}
protected override updateSpine(sceneObjHolder: SceneObjHolder, currentNerve: WaterCameraFilterNrv, deltaTimeFrames: number): void {
if (currentNerve === WaterCameraFilterNrv.Air) {
if (isCameraInWater(sceneObjHolder))
this.setNerve(WaterCameraFilterNrv.AirToWater);
} else if (currentNerve === WaterCameraFilterNrv.AirToWater) {
if (isCameraInWater(sceneObjHolder)) {
this.fade += 20.0 * deltaTimeFrames;
if (this.fade >= 255.0) {
this.fade = 255.0;
this.setNerve(WaterCameraFilterNrv.Water);
}
} else {
this.setNerve(WaterCameraFilterNrv.WaterToAir);
}
} else if (currentNerve === WaterCameraFilterNrv.Water) {
if (!isCameraInWater(sceneObjHolder))
this.setNerve(WaterCameraFilterNrv.WaterToAir);
} else if (currentNerve === WaterCameraFilterNrv.WaterToAir) {
if (isCameraInWater(sceneObjHolder)) {
this.setNerve(WaterCameraFilterNrv.AirToWater);
} else {
this.fade -= 20.0 * deltaTimeFrames;
if (this.fade <= 0.0) {
this.fade = 0.0;
this.setNerve(WaterCameraFilterNrv.Air);
}
}
}
}
public isOnWaterCameraFilter(): boolean {
return this.getCurrentNerve() !== WaterCameraFilterNrv.Air;
}
public override draw(sceneObjHolder: SceneObjHolder, renderInstManager: GfxRenderInstManager, viewerInput: ViewerRenderInput): void {
super.draw(sceneObjHolder, renderInstManager, viewerInput);
if (!this.isOnWaterCameraFilter())
return;
// Captured already.
const cache = sceneObjHolder.modelCache.cache;
const ddraw = this.ddraw;
ddraw.beginDraw(cache);
const flipY = gfxDeviceNeedsFlipY(sceneObjHolder.modelCache.device);
// getPlayerCenterPos / calcScreenPosition
const playerCenterX = 0.5;
const playerCenterY = 0.5;
const fbWidth = viewerInput.backbufferWidth, fbHeight = viewerInput.backbufferHeight;
ddraw.begin(GX.Command.DRAW_TRIANGLE_STRIP, 4);
ddraw.position3f32(0, 0, 0);
ddraw.texCoord2f32(GX.Attr.TEX0, playerCenterX - 0.5, playerCenterY - 0.5);
ddraw.texCoord2f32(GX.Attr.TEX1, 0.0, flipY ? 0.0 : 1.0);
ddraw.position3f32(fbWidth, 0, 0);
ddraw.texCoord2f32(GX.Attr.TEX0, playerCenterX + 0.5, playerCenterY - 0.5);
ddraw.texCoord2f32(GX.Attr.TEX1, 1.0, flipY ? 0.0 : 1.0);
ddraw.position3f32(0, fbHeight, 0);
ddraw.texCoord2f32(GX.Attr.TEX0, playerCenterX - 0.5, playerCenterY + 0.5);
ddraw.texCoord2f32(GX.Attr.TEX1, 0.0, flipY ? 1.0 : 0.0);
ddraw.position3f32(fbWidth, fbHeight, 0);
ddraw.texCoord2f32(GX.Attr.TEX0, playerCenterX + 0.5, playerCenterY + 0.5);
ddraw.texCoord2f32(GX.Attr.TEX1, 1.0, flipY ? 1.0 : 0.0);
ddraw.end();
const renderInst = ddraw.endDrawAndMakeRenderInst(renderInstManager);
const materialParams = this.materialParams;
computeRotationZAroundPoint(materialParams.u_TexMtx[0], this.angle * MathConstants.DEG_TO_RAD, 0.5, 0.5);
setTextureMatrixST(materialParams.u_IndTexMtx[0], 0.05, null);
this.color.a = this.fade / 255.0;
colorCopy(materialParams.u_Color[ColorKind.C0], this.color);
this.materialHelper.setOnRenderInst(cache, renderInst);
renderInst.setUniformBufferOffset(GX_Program.ub_SceneParams, sceneObjHolder.renderParams.sceneParamsOffs2D, ub_SceneParamsBufferSize);
this.materialHelper.allocateMaterialParamsDataOnInst(renderInst, this.materialParams);
renderInst.setSamplerBindingsFromTextureMappings(this.materialParams.m_TextureMapping);
mat4.identity(drawParams.u_PosMtx[0]);
this.materialHelper.allocateDrawParamsDataOnInst(renderInst, drawParams);
renderInstManager.submitRenderInst(renderInst);
}
public override destroy(device: GfxDevice): void {
this.filterTexture.destroy(device);
}
public static override requestArchives(sceneObjHolder: SceneObjHolder): void {
sceneObjHolder.modelCache.requestObjectData('WaterCameraFilter');
}
}
//#endregion
//#region SwitchArea
export class SwitchArea extends AreaObj {
public forwardSwitchB: boolean;
public turnOffSwitch: boolean;
public needsPlayerOnGround: boolean;
protected override parseArgs(infoIter: JMapInfoIter): void {
this.forwardSwitchB = getJMapInfoBool(fallback(getJMapInfoArg0(infoIter), -1));
this.turnOffSwitch = getJMapInfoBool(fallback(getJMapInfoArg1(infoIter), -1));
this.needsPlayerOnGround = getJMapInfoBool(fallback(getJMapInfoArg2(infoIter), -1));
}
protected override postCreate(sceneObjHolder: SceneObjHolder): void {
connectToSceneAreaObj(sceneObjHolder, this);
}
private isUpdate(sceneObjHolder: SceneObjHolder): boolean {
// if (this.needsPlayerOnGround && !calcPlayerOnGround(sceneObjHolder))
// return false;
if (this.forwardSwitchB)
return true;
if (this.turnOffSwitch)
return this.switchCtrl.isOnSwitchA(sceneObjHolder);
else
return !this.switchCtrl.isOnSwitchA(sceneObjHolder);
}
public override movement(sceneObjHolder: SceneObjHolder): void {
if (!this.isUpdate(sceneObjHolder))
return;
if (!this.switchCtrl.isValidSwitchB() || this.switchCtrl.isOnSwitchB(sceneObjHolder)) {
getPlayerPos(scratchVec3, sceneObjHolder);
if (this.isInVolume(scratchVec3)) {
if (this.turnOffSwitch) {
this.switchCtrl.offSwitchA(sceneObjHolder);
} else {
this.switchCtrl.onSwitchA(sceneObjHolder);
}
}
} else {
if (this.forwardSwitchB)
this.switchCtrl.offSwitchA(sceneObjHolder);
}
}
public override getManagerName(): string {
return 'SwitchArea';
}
}
export function createSwitchCube(zoneAndLayer: ZoneAndLayer, sceneObjHolder: SceneObjHolder, infoIter: JMapInfoIter): SwitchArea {
return new SwitchArea(zoneAndLayer, sceneObjHolder, infoIter, AreaFormType.BaseOriginCube);
}
export function createSwitchSphere(zoneAndLayer: ZoneAndLayer, sceneObjHolder: SceneObjHolder, infoIter: JMapInfoIter): SwitchArea {
return new SwitchArea(zoneAndLayer, sceneObjHolder, infoIter, AreaFormType.Sphere);
}
export function createSwitchCylinder(zoneAndLayer: ZoneAndLayer, sceneObjHolder: SceneObjHolder, infoIter: JMapInfoIter): SwitchArea {
return new SwitchArea(zoneAndLayer, sceneObjHolder, infoIter, AreaFormType.BaseOriginCylinder);
}
//#endregion
//#region HazeCube
export class HazeCube extends AreaObj {
public depth: number;
protected override parseArgs(infoIter: JMapInfoIter): void {
this.depth = fallback(getJMapInfoArg0(infoIter), 1000);
}
protected override postCreate(sceneObjHolder: SceneObjHolder): void {
sceneObjHolder.create(SceneObj.HeatHazeDirector);
}
public static override requestArchives(sceneObjHolder: SceneObjHolder): void {
HeatHazeDirector.requestArchives(sceneObjHolder);
}
}
export function createHazeCube(zoneAndLayer: ZoneAndLayer, sceneObjHolder: SceneObjHolder, infoIter: JMapInfoIter): HazeCube {
return new HazeCube(zoneAndLayer, sceneObjHolder, infoIter, AreaFormType.BaseOriginCube);
}
export function requestArchivesHazeCube(sceneObjHolder: SceneObjHolder, infoIter: JMapInfoIter): void {
HazeCube.requestArchives(sceneObjHolder);
}
//#endregion
//#region MeractorCube
export class MercatorTransformCube extends AreaObj {
public sphereRadius: number;
protected override parseArgs(infoIter: JMapInfoIter): void {
this.sphereRadius = fallback(getJMapInfoArg0(infoIter), 3000.0);
}
protected override postCreate(sceneObjHolder: SceneObjHolder): void {
}
}
export function createMercatorCube(zoneAndLayer: ZoneAndLayer, sceneObjHolder: SceneObjHolder, infoIter: JMapInfoIter): MercatorTransformCube {
return new MercatorTransformCube(zoneAndLayer, sceneObjHolder, infoIter, AreaFormType.BaseOriginCube);
}
//#endregion
//#region DeathArea
export class DeathArea extends AreaObj {
protected override postCreate(sceneObjHolder: SceneObjHolder): void {
connectToSceneAreaObj(sceneObjHolder, this);
}
public override isInVolume(v: ReadonlyVec3) {
// TODO(jstpierre): SwitchA
return super.isInVolume(v);
}
public override getManagerName(): string {
return 'DeathArea';
}
}
export function createDeathCube(zoneAndLayer: ZoneAndLayer, sceneObjHolder: SceneObjHolder, infoIter: JMapInfoIter) {
return new DeathArea(zoneAndLayer, sceneObjHolder, infoIter, AreaFormType.BaseOriginCube);
}
export function createDeathSphere(zoneAndLayer: ZoneAndLayer, sceneObjHolder: SceneObjHolder, infoIter: JMapInfoIter) {
return new DeathArea(zoneAndLayer, sceneObjHolder, infoIter, AreaFormType.Sphere);
}
export function createDeathCylinder(zoneAndLayer: ZoneAndLayer, sceneObjHolder: SceneObjHolder, infoIter: JMapInfoIter) {
return new DeathArea(zoneAndLayer, sceneObjHolder, infoIter, AreaFormType.BaseOriginCylinder);
}
//#endregion
``` | /content/code_sandbox/src/SuperMarioGalaxy/MiscMap.ts | xml | 2016-10-06T21:43:45 | 2024-08-16T17:03:52 | noclip.website | magcius/noclip.website | 3,206 | 5,464 |
```xml
declare interface IControlStrings {
BirthdayControlDefaultDay: string,
HappyBirthdayMsg: string,
NextBirthdayMsg: string,
HappyAnniversaryMsg: string,
NextAnniversaryMsg: string,
MessageNoBirthdays: string
}
declare module 'ControlStrings' {
const strings: IControlStrings;
export = strings;
}
``` | /content/code_sandbox/samples/react-birthdays/src/controls/happyBirthdayCard/loc/mystrings.d.ts | xml | 2016-08-30T17:21:43 | 2024-08-16T18:41:32 | sp-dev-fx-webparts | pnp/sp-dev-fx-webparts | 2,027 | 75 |
```xml
import { CMS_NAME } from "@/lib/constants";
export function Intro() {
return (
<section className="flex-col md:flex-row flex items-center md:justify-between mt-16 mb-16 md:mb-12">
<h1 className="text-5xl md:text-8xl font-bold tracking-tighter leading-tight md:pr-8">
Blog.
</h1>
<h4 className="text-center md:text-left text-lg mt-5 md:pl-8">
A statically generated blog example using{" "}
<a
href="path_to_url"
className="underline hover:text-blue-600 duration-200 transition-colors"
>
Next.js
</a>{" "}
and {CMS_NAME}.
</h4>
</section>
);
}
``` | /content/code_sandbox/examples/blog-starter/src/app/_components/intro.tsx | xml | 2016-10-05T23:32:51 | 2024-08-16T19:44:30 | next.js | vercel/next.js | 124,056 | 172 |
```xml
import { basename, isAbsolute, posix, resolve, sep, win32 } from 'node:path';
import { getDirectoryFromWorkingDir } from '@storybook/core/common';
import type { Options } from '@storybook/core/types';
import { logger } from '@storybook/core/node-logger';
import chalk from 'chalk';
import type { Router } from 'express';
import express from 'express';
import { pathExists } from 'fs-extra';
import { dedent } from 'ts-dedent';
export async function useStatics(router: Router, options: Options) {
const staticDirs = (await options.presets.apply('staticDirs')) ?? [];
const faviconPath = await options.presets.apply<string>('favicon');
const statics = [
...staticDirs.map((dir) => (typeof dir === 'string' ? dir : `${dir.from}:${dir.to}`)),
];
if (statics && statics.length > 0) {
await Promise.all(
statics.map(async (dir) => {
try {
const normalizedDir =
staticDirs && !isAbsolute(dir)
? getDirectoryFromWorkingDir({
configDir: options.configDir,
workingDir: process.cwd(),
directory: dir,
})
: dir;
const { staticDir, staticPath, targetEndpoint } = await parseStaticDir(normalizedDir);
// Don't log for the internal static dir
if (!targetEndpoint.startsWith('/sb-')) {
logger.info(
`=> Serving static files from ${chalk.cyan(staticDir)} at ${chalk.cyan(targetEndpoint)}`
);
}
router.use(targetEndpoint, express.static(staticPath, { index: false }));
} catch (e) {
if (e instanceof Error) {
logger.warn(e.message);
}
}
})
);
}
router.get(`/${basename(faviconPath)}`, (req, res) => res.sendFile(faviconPath));
}
export const parseStaticDir = async (arg: string) => {
// Split on last index of ':', for Windows compatibility (e.g. 'C:\some\dir:\foo')
const lastColonIndex = arg.lastIndexOf(':');
const isWindowsAbsolute = win32.isAbsolute(arg);
const isWindowsRawDirOnly = isWindowsAbsolute && lastColonIndex === 1; // e.g. 'C:\some\dir'
const splitIndex = lastColonIndex !== -1 && !isWindowsRawDirOnly ? lastColonIndex : arg.length;
const targetRaw = arg.substring(splitIndex + 1) || '/';
const target = targetRaw.split(sep).join(posix.sep); // Ensure target has forward-slash path
const rawDir = arg.substring(0, splitIndex);
const staticDir = isAbsolute(rawDir) ? rawDir : `./${rawDir}`;
const staticPath = resolve(staticDir);
const targetDir = target.replace(/^\/?/, './');
const targetEndpoint = targetDir.substring(1);
if (!(await pathExists(staticPath))) {
throw new Error(
dedent`
Failed to load static files, no such directory: ${chalk.cyan(staticPath)}
Make sure this directory exists.
`
);
}
return { staticDir, staticPath, targetDir, targetEndpoint };
};
``` | /content/code_sandbox/code/core/src/core-server/utils/server-statics.ts | xml | 2016-03-18T04:23:44 | 2024-08-16T19:22:08 | storybook | storybookjs/storybook | 83,755 | 695 |
```xml
import { SNNote } from '@standardnotes/snjs'
export type NotesOptionsProps = {
notes: SNNote[]
requestDisableClickOutside?: (disabled: boolean) => void
closeMenu: () => void
}
``` | /content/code_sandbox/packages/web/src/javascripts/Components/NotesOptions/NotesOptionsProps.ts | xml | 2016-12-05T23:31:33 | 2024-08-16T06:51:19 | app | standardnotes/app | 5,180 | 49 |
```xml
import { Injectable } from "@angular/core";
import { ApiService } from "@bitwarden/common/abstractions/api.service";
import { EventResponse } from "@bitwarden/common/models/response/event.response";
import { ListResponse } from "@bitwarden/common/models/response/list.response";
@Injectable({
providedIn: "root",
})
export class ServiceAccountEventLogApiService {
constructor(private apiService: ApiService) {}
async getEvents(
serviceAccountId: string,
start: string,
end: string,
token: string,
): Promise<ListResponse<EventResponse>> {
const r = await this.apiService.send(
"GET",
this.addEventParameters("/sm/events/service-accounts/" + serviceAccountId, start, end, token),
null,
true,
true,
);
return new ListResponse(r, EventResponse);
}
private addEventParameters(base: string, start: string, end: string, token: string) {
if (start != null) {
base += "?start=" + start;
}
if (end != null) {
base += base.indexOf("?") > -1 ? "&" : "?";
base += "end=" + end;
}
if (token != null) {
base += base.indexOf("?") > -1 ? "&" : "?";
base += "continuationToken=" + token;
}
return base;
}
}
``` | /content/code_sandbox/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/event-logs/service-account-event-log-api.service.ts | xml | 2016-03-09T23:14:01 | 2024-08-16T15:07:51 | clients | bitwarden/clients | 8,877 | 299 |
```xml
import { theme } from '@expo/styleguide';
export const ServerErrorImage = () => (
<svg width="218" height="133" fill="none" xmlns="path_to_url">
<path
d="m25.977 131.315 63.762-8.961c5.47-.769 9.28-5.826 8.511-11.295l-9.14-65.046a10 10 0 0 0-3.885-6.594L56.807 18.005a10 10 0 0 0-7.41-1.917l-38.846 5.46c-5.47.769-9.28 5.825-8.511 11.294l12.643 89.962c.769 5.469 5.825 9.279 11.294 8.511z"
stroke={theme.border.default}
fill={theme.background.subtle}
strokeWidth="2"
/>
<path
d="M87.147 43.203a1 1 0 1 0 1.701-1.052l-1.7 1.052zm.85-.526c.851-.526.85-.526.85-.527l-.002-.004a.243.243 0 0 0-.012-.019l-.022-.033a3.027 3.027 0 0 0-.293-.354 3.906 3.906 0 0 0-.885-.677c-.813-.461-2.014-.791-3.682-.557l.279 1.98c1.254-.176 2.007.085 2.417.317a1.9 1.9 0 0 1 .432.327c.04.041.065.072.076.087l.006.008a.203.203 0 0 1-.004-.007c-.002-.001-.003-.004-.004-.006l-.003-.004-.001-.002-.001-.001s0-.002.85-.527zm-4.046-2.17a.326.326 0 0 1-.01 0l-.01.002-.012.002a2.96 2.96 0 0 1-.022.003l-.01.001a.446.446 0 0 1-.012.002c-.004 0-.008 0-.012.002l-.012.001-.012.002c-.004 0-.008 0-.012.002l-.012.001-.012.002-.013.002c-.004 0-.008 0-.013.002l-.013.001-.013.002-.013.002-.013.002-.014.002-.013.002-.014.002-.014.002c-.005 0-.01 0-.014.002-.005 0-.01 0-.015.002a.711.711 0 0 1-.014.002l-.014.002a5.302 5.302 0 0 1-.03.004l-.015.002-.015.002-.016.002-.015.002a.984.984 0 0 0-.016.003l-.016.002-.016.002-.016.002-.016.003-.016.002-.017.002-.017.003a.967.967 0 0 0-.017.002l-.017.002-.017.003-.017.002-.017.003-.018.002-.018.003a1.1 1.1 0 0 0-.018.002l-.018.003-.018.002-.018.003-.019.002-.018.003-.019.003-.019.002-.019.003-.019.003-.02.002-.019.003-.02.003a1.333 1.333 0 0 0-.039.005l-.02.003-.02.003-.02.003c-.007 0-.014.002-.02.003-.008 0-.014.002-.021.003-.007 0-.014.002-.02.003l-.022.002-.02.003-.022.003-.021.003-.021.003-.022.003-.021.003-.022.003-.022.004-.022.003c-.008 0-.015.002-.022.003-.008 0-.015.002-.022.003l-.023.003-.022.003-.023.003a1.784 1.784 0 0 1-.023.004c-.008 0-.015.002-.023.003l-.023.003-.023.003-.023.004-.024.003-.023.003-.024.004-.024.003-.024.003-.024.004-.024.003-.024.004c-.009 0-.017.002-.025.003l-.025.003a2.095 2.095 0 0 0-.024.004l-.025.003a14.92 14.92 0 0 1-.05.007l-.025.004-.026.004-.025.003-.025.004c-.009 0-.018.002-.026.003l-.026.004-.026.004c-.009 0-.017.002-.026.003l-.026.004a2.082 2.082 0 0 1-.053.007l-.026.004-.027.004c-.009 0-.017.002-.026.003l-.027.004-.027.004-.027.004-.028.004c-.009 0-.018.002-.027.004l-.027.003-.028.004-.027.004-.028.004-.028.004-.028.004-.028.004a138747284157.76 138747284157.76 0 0 0-.057.008l-.028.004-.029.004-.028.004-.029.004-.029.004-.029.004-.029.004-.029.004-.03.004-.029.004-.03.005c-.009 0-.019.002-.029.004l-.03.004-.03.004-.03.004-.03.004-.03.005-.03.004-.03.004-.03.004-.03.005-.031.004-.031.004-.03.005-.032.004-.03.004-.032.005-.031.004-.032.005-.031.004-.031.004-.032.005a3.027 3.027 0 0 0-.064.009l-.032.004-.032.005-.032.004-.032.005-.032.004-.032.005-.033.004-.032.005-.033.005-.033.004-.033.005-.033.005-.033.004-.033.005a3.316 3.316 0 0 1-.033.004l-.033.005-.034.005-.033.005-.034.004-.033.005-.034.005a3.44 3.44 0 0 0-.034.004l-.034.005-.034.005-.034.005-.034.005-.034.004-.035.005-.034.005-.034.005-.035.005-.035.005-.034.005-.035.004-.035.005-.035.005-.035.005-.035.005-.035.005-.036.005-.035.005a4.326 4.326 0 0 1-.071.01l-.036.005-.035.005-.036.005-.036.005-.036.005-.036.005-.036.005-.036.005-.037.005-.036.005-.036.006-.037.005-.036.005-.037.005-.036.005-.037.005a4.65 4.65 0 0 0-.037.006l-.037.005a4.675 4.675 0 0 1-.11.015l-.038.005-.037.006-.037.005-.038.005-.037.005-.038.006-.037.005-.038.005-.038.006-.037.005-.038.005-.038.005-.038.006-.038.005-.038.005-.038.006-.038.005-.039.006-.038.005-.038.005-.039.006-.038.005a5.119 5.119 0 0 0-.039.006l-.038.005-.04.005-.038.006-.039.005a5.196 5.196 0 0 0-.077.011l-.04.006-.038.005-.04.006-.039.005-.039.006-.039.005-.04.006-.039.005-.039.006-.04.005-.039.006a6.244 6.244 0 0 0-.04.006l-.04.005-.039.006-.04.005-.04.006-.04.005-.039.006a5.464 5.464 0 0 0-.04.006l-.04.005-.04.006-.04.005-.04.006-.04.006-.04.005-.04.006-.04.006-.041.006a5.571 5.571 0 0 0-.04.005l-.041.006-.04.005-.04.006-.041.006-.041.006-.04.005-.041.006-.041.006-.04.005-.042.006-.04.006-.041.006a41.182 41.182 0 0 0-.123.017l-.041.006-.041.005-.041.006-.042.006-.04.006-.042.006a5.134 5.134 0 0 1-.041.005l-.042.006-.041.006a5.855 5.855 0 0 0-.083.012l-.041.005-.042.006-.041.006-.042.006-.041.006-.042.006-.041.005-.042.006a5.971 5.971 0 0 0-.042.006l-.041.006-.042.006-.042.006-.042.006-.042.006-.041.005-.042.006-.042.006-.042.006a6.055 6.055 0 0 0-.042.006l-.042.006a6.055 6.055 0 0 0-.042.006l-.042.006-.042.006-.042.006-.042.006a6.083 6.083 0 0 1-.043.005l-.042.006-.042.006-.042.006-.042.006a5.361 5.361 0 0 0-.043.006l-.042.006-.042.006-.043.006-.042.006-.042.006-.043.006-.042.006-.042.006-.043.006a6.167 6.167 0 0 0-.042.006l-.043.006a6.167 6.167 0 0 1-.17.024l-.042.005-.043.006-.042.006-.043.006-.042.006a6.224 6.224 0 0 1-.043.006l-.043.006-.042.006-.043.006-.042.006-.043.006-.043.006-.042.006a44.54 44.54 0 0 1-.043.006l-.043.006a44.54 44.54 0 0 0-.213.03l-.043.006-.043.006-.042.006-.043.006-.043.006-.043.006-.042.006-.043.006a6.293 6.293 0 0 0-.043.006l-.043.006-.042.006-.043.006-.043.006-.043.006-.042.006-.043.006-.043.006-.043.006-.042.006-.043.006-.043.006c-.014.002-.028.005-.043.006l-.042.006-.043.006-.043.006c-.014.002-.028.005-.043.006l-.042.006a44.54 44.54 0 0 0-.043.007l-.043.005a44.54 44.54 0 0 1-.17.025l-.043.005a44.54 44.54 0 0 0-.043.007l-.043.005-.042.007-.043.006-.042.006-.043.006-.043.006-.042.006a6.224 6.224 0 0 0-.043.005l-.043.006-.042.006-.043.006-.042.006-.043.006-.042.006-.043.006-.042.006-.043.006-.042.006-.043.006a6.167 6.167 0 0 0-.042.006l-.042.006a6.167 6.167 0 0 1-.043.006l-.042.006-.043.006-.042.006a6.14 6.14 0 0 1-.084.012l-.043.006a43.023 43.023 0 0 0-.084.012l-.042.006-.043.006a6.083 6.083 0 0 0-.042.005l-.042.006-.042.006a6.083 6.083 0 0 1-.042.006l-.042.006a6.055 6.055 0 0 0-.084.012l-.042.006a6.055 6.055 0 0 0-.126.017l-.042.006a6 6 0 0 1-.042.006l-.042.006-.042.006-.041.006-.042.006-.042.006-.041.005-.042.006-.042.006a5.211 5.211 0 0 0-.041.006l-.042.006-.041.006-.042.006a6.87 6.87 0 0 1-.041.005l-.042.006a5.185 5.185 0 0 0-.041.006l-.042.006-.041.006-.041.005-.041.006-.042.006-.041.006-.041.006-.041.005-.041.006-.041.006a5.772 5.772 0 0 0-.041.006l-.041.005-.041.006-.041.006-.041.006-.04.005-.042.006-.04.006-.041.006-.04.005-.041.006a40.3 40.3 0 0 0-.04.006l-.041.005-.04.006-.041.006-.04.005-.041.006-.04.006a5.544 5.544 0 0 1-.04.005l-.04.006a5.544 5.544 0 0 1-.081.011l-.04.006a5.49 5.49 0 0 1-.08.011l-.04.006-.04.005-.04.006.279 1.98.04-.005.04-.006.04-.005.04-.006.04-.005a5.49 5.49 0 0 0 .08-.012l.04-.005.04-.006.04-.006.04-.005.04-.006.041-.006.04-.005.04-.006.041-.006a40.3 40.3 0 0 0 .041-.005l.04-.006.041-.006a40.592 40.592 0 0 1 .082-.011l.04-.006.041-.006.041-.005.041-.006.041-.006.04-.006.042-.006.041-.005a5.8 5.8 0 0 1 .041-.006l.041-.006.041-.006.042-.005.04-.006.042-.006.041-.006a5.855 5.855 0 0 0 .083-.011l.041-.006.042-.006.041-.006.042-.006.041-.006.042-.005.042-.006.041-.006.042-.006.042-.006.041-.006.042-.006.042-.005.042-.006.041-.006.042-.006.042-.006.042-.006.042-.006.042-.006.042-.006.042-.005.042-.006.042-.006.042-.006.043-.006.042-.006.042-.006a5.361 5.361 0 0 1 .084-.012l.042-.006.043-.006.042-.006.042-.006.043-.006.042-.005.042-.006.043-.006.042-.006.042-.006.043-.006.042-.006.043-.006.042-.006.043-.006.042-.006.043-.006.042-.006.043-.006.042-.006.043-.006.042-.006.043-.006.043-.006.042-.006.043-.006.043-.006.042-.006.043-.006.042-.006.043-.006.043-.006a44.54 44.54 0 0 1 .17-.024l.043-.006.043-.006.043-.006.042-.006.043-.006.043-.006.043-.006.043-.006.042-.006.043-.006.043-.006.042-.006.043-.006.043-.006.043-.006.043-.006.042-.006.043-.006.043-.006.042-.006.043-.006.043-.006.043-.006.043-.006.042-.006.043-.006.043-.006.043-.006.042-.006.043-.006a44.54 44.54 0 0 0 .128-.018l.043-.006.042-.006.043-.006.043-.006.042-.006.043-.006.043-.006.042-.006.043-.006.043-.006.042-.006.043-.006.042-.006a6.224 6.224 0 0 1 .085-.012l.043-.006.042-.006.043-.006.042-.006.043-.006.042-.006.043-.006.042-.006.043-.006.042-.006.042-.006.043-.006a6.167 6.167 0 0 1 .084-.011l.042-.006.043-.006a6.14 6.14 0 0 0 .169-.024l.042-.006.042-.006.042-.006.042-.006.042-.006.042-.006.042-.005.042-.006.042-.006.042-.006.042-.006a7.015 7.015 0 0 0 .084-.012l.041-.006.042-.006.042-.005.042-.006.042-.006.041-.006.042-.006.041-.006.042-.006.042-.005.041-.006.042-.006.041-.006.042-.006.041-.006.041-.005.042-.006a5.855 5.855 0 0 1 .124-.018l.04-.005.042-.006.04-.006.042-.006.041-.006.041-.005.041-.006.04-.006a41.182 41.182 0 0 0 .164-.023l.04-.005.042-.006.04-.006.04-.006a40.3 40.3 0 0 0 .041-.005l.04-.006.041-.006.04-.005.041-.006.04-.006.04-.005.041-.006.04-.006.04-.005.04-.006.04-.006.04-.005.04-.006.04-.005.04-.006.04-.006.04-.005.04-.006.04-.005.039-.006.04-.005.039-.006.04-.006.039-.005.04-.006.038-.005a5.274 5.274 0 0 0 .079-.011l.039-.006a4.6 4.6 0 0 0 .039-.005l.039-.006.039-.005.039-.006.039-.005.038-.005.04-.006a5.119 5.119 0 0 1 .076-.01c.013-.003.026-.004.04-.006l.038-.006.038-.005.038-.005.039-.006.038-.005.038-.006.038-.005.038-.005.038-.006a4.93 4.93 0 0 1 .076-.01l.038-.006.038-.005.037-.005.038-.005.038-.006.037-.005.037-.005.038-.006.037-.005.037-.005.038-.005.037-.005.037-.006.037-.005.036-.005.037-.005.037-.005.037-.006.036-.005.037-.005.036-.005.037-.005.036-.005.036-.005.036-.005a4.47 4.47 0 0 1 .036-.005l.036-.005.036-.005.036-.005.036-.006.035-.005.036-.005.036-.005.035-.005.036-.005.035-.004.035-.005.035-.005.035-.005.035-.005.035-.005.035-.005.035-.005.034-.005.035-.005.034-.004.035-.005.034-.005.034-.005.035-.005.034-.005.034-.004.034-.005.033-.005.034-.005.034-.004.033-.005.034-.005a3.83 3.83 0 0 0 .066-.01.197.197 0 0 0 .034-.004l.033-.004.033-.005.033-.005.032-.004a3.238 3.238 0 0 0 .066-.01l.032-.004.033-.005.032-.004.032-.005.033-.004.032-.005.032-.004.032-.005.032-.004.031-.005.032-.004.031-.005.032-.004.031-.004.031-.005.031-.004.031-.004.031-.005.031-.004.031-.004.03-.005.031-.004.03-.004.03-.005.031-.004.03-.004.03-.004.03-.005c.01 0 .02-.002.03-.004l.03-.004.03-.004.029-.004.03-.004.028-.004a2.927 2.927 0 0 0 .059-.009c.01 0 .019-.002.029-.004l.028-.004.03-.004.028-.004.028-.004.029-.004a2.41 2.41 0 0 1 .028-.004l.028-.004.028-.004c.01 0 .019-.002.028-.004.01 0 .019-.002.028-.004.01 0 .019-.002.028-.003l.028-.004.027-.004.028-.004.027-.004a2.95 2.95 0 0 1 .081-.011L82 42.8l.027-.004.026-.004a2.8 2.8 0 0 1 .053-.007l.026-.004c.01 0 .018-.002.026-.003l.026-.004.026-.004c.009 0 .018-.002.026-.003a15.997 15.997 0 0 0 .077-.011l.025-.004c.009 0 .017-.002.025-.003l.025-.004c.009 0 .017-.002.025-.003l.025-.004.025-.003.024-.004c.009 0 .017-.002.025-.003l.024-.003.024-.004.024-.003.024-.004.024-.003.024-.003.023-.003.024-.004c.008 0 .016-.002.023-.003l.023-.003.023-.004c.008 0 .016-.002.023-.003.008 0 .016-.002.023-.003l.023-.003.022-.003.023-.004.022-.003.022-.003c.008 0 .015-.002.022-.003.008 0 .015-.002.022-.003l.022-.003.022-.003.021-.003.021-.003.022-.003.02-.003a1.74 1.74 0 0 1 .022-.003c.007 0 .014-.002.02-.003l.021-.003c.007 0 .014-.002.02-.003l.021-.003.02-.002.02-.003.02-.003.02-.003c.007 0 .013-.002.02-.003l.02-.002.019-.003.02-.003.019-.002.019-.003.018-.003.02-.002.018-.003.018-.003.019-.002.018-.003a.87.87 0 0 0 .018-.002l.017-.003.018-.002.018-.003.017-.002.018-.003.017-.002.017-.002.017-.003.016-.002a.934.934 0 0 0 .017-.003l.016-.002.017-.002.016-.002.016-.003.015-.002.016-.002.016-.002.015-.002.015-.002.015-.003.015-.002.015-.002.014-.002.015-.002.014-.002.014-.002.014-.002.014-.002.014-.002c.004 0 .009 0 .013-.002l.014-.001.013-.002.013-.002.013-.002.012-.002c.005 0 .009 0 .013-.002l.012-.001.013-.002.012-.002.012-.001.011-.002.012-.002a.527.527 0 0 1 .011-.001l.012-.002.01-.001.012-.002.01-.001.011-.002.01-.001-.278-1.98zM58.52 37.02a9295.02 9295.02 0 0 1-2.49-17.745l-1.982.27a9279.08 9279.08 0 0 0 2.492 17.754l1.98-.279zm-2.49-17.745c-.233-1.717-1.303-2.783-2.227-3.39a6.642 6.642 0 0 0-1.766-.811l-.038-.01-.013-.003a.084.084 0 0 1-.007-.002l-.238.971-.238.971h-.005l.011.002.065.02a4.632 4.632 0 0 1 1.13.535c.635.416 1.214 1.04 1.343 1.986l1.982-.269zM66.42 42.97a6.991 6.991 0 0 1-7.9-5.95l-1.98.279a8.991 8.991 0 0 0 10.159 7.652l-.279-1.98z"
fill={theme.border.default}
/>
<path
d="m128.26 122.354 63.762 8.961c5.469.768 10.526-3.042 11.295-8.511l9.141-65.046a10 10 0 0 0-1.916-7.41l-21.414-28.417a9.999 9.999 0 0 0-6.595-3.885l-38.846-5.46c-5.469-.768-10.526 3.043-11.294 8.512l-12.644 89.961c-.768 5.469 3.042 10.526 8.511 11.295z"
stroke={theme.border.default}
fill={theme.background.subtle}
strokeWidth="2"
/>
<path
d="M211.347 54.516a1 1 0 0 0 1.925-.542l-1.925.542zm.963-.27.962-.273v-.002l-.001-.003-.002-.006-.005-.015a.618.618 0 0 0-.012-.038 3.17 3.17 0 0 0-.184-.421 3.905 3.905 0 0 0-.664-.895c-.654-.668-1.717-1.316-3.385-1.55l-.279 1.98c1.255.176 1.907.634 2.237.97.171.174.271.332.325.434.027.05.042.087.049.104l.004.01a.02.02 0 0 1-.003-.008l-.002-.007-.001-.005-.001-.002v-.001c-.001-.001-.001-.002.962-.273zm-3.291-3.204-.011-.001-.01-.002-.011-.001-.011-.002-.011-.001-.011-.002a.493.493 0 0 1-.023-.003l-.012-.002-.012-.001-.012-.002-.013-.002-.012-.001-.012-.002a.417.417 0 0 1-.013-.002l-.013-.002-.013-.002c-.004 0-.009 0-.013-.002l-.014-.001-.013-.002-.014-.002-.014-.002-.014-.002a.493.493 0 0 0-.014-.002l-.014-.002-.015-.002-.014-.002-.015-.002-.015-.002-.015-.002-.015-.002a.774.774 0 0 0-.015-.003l-.016-.002-.016-.002-.015-.002a.61.61 0 0 1-.016-.003l-.016-.002-.017-.002-.016-.002-.017-.003-.016-.002-.017-.002a.42.42 0 0 1-.017-.003l-.017-.002-.018-.003a.702.702 0 0 0-.017-.002l-.018-.003-.017-.002-.018-.003-.018-.002-.018-.003a.522.522 0 0 1-.037-.005l-.019-.002-.019-.003-.018-.003-.019-.002-.02-.003-.019-.003-.019-.003-.02-.002a.98.98 0 0 0-.02-.003l-.019-.003c-.007 0-.014-.002-.02-.003l-.021-.003-.02-.002-.02-.003a1.512 1.512 0 0 0-.021-.003l-.02-.003-.021-.003-.021-.003-.021-.003-.022-.003-.021-.003a1.518 1.518 0 0 1-.021-.003c-.008 0-.015-.002-.022-.003a4.057 4.057 0 0 0-.022-.003l-.022-.003a.689.689 0 0 0-.044-.006l-.022-.003-.022-.004c-.008 0-.016-.002-.023-.003-.008 0-.015-.002-.023-.003a4.633 4.633 0 0 0-.023-.003l-.022-.003a1.971 1.971 0 0 0-.047-.007l-.023-.003-.023-.003-.024-.004-.024-.003-.024-.003a1.266 1.266 0 0 0-.023-.004l-.025-.003-.024-.004-.024-.003a1.53 1.53 0 0 0-.025-.003l-.024-.004-.025-.003a1.53 1.53 0 0 0-.025-.004l-.025-.003a1.53 1.53 0 0 0-.025-.004l-.025-.003-.025-.004-.026-.004-.025-.003-.026-.004-.026-.003-.025-.004-.026-.004a2.499 2.499 0 0 1-.027-.003l-.026-.004-.026-.004-.027-.003-.026-.004-.027-.004a2.503 2.503 0 0 1-.027-.004l-.027-.003-.027-.004-.027-.004-.027-.004a1.93 1.93 0 0 1-.028-.004l-.027-.004a1.93 1.93 0 0 1-.056-.007l-.028-.004-.028-.004a1.93 1.93 0 0 0-.028-.004l-.028-.004-.028-.004-.029-.004-.028-.004-.029-.004-.028-.004-.029-.004a2.09 2.09 0 0 1-.029-.004l-.029-.004-.03-.005a1.196 1.196 0 0 0-.029-.004l-.029-.004a3.084 3.084 0 0 1-.03-.004l-.029-.004a3.084 3.084 0 0 0-.03-.004l-.03-.004-.03-.005-.03-.004-.03-.004-.03-.004a3.093 3.093 0 0 0-.061-.009l-.03-.004a1.38 1.38 0 0 1-.062-.009l-.031-.004-.03-.005a.155.155 0 0 1-.031-.004l-.032-.004a2.324 2.324 0 0 0-.031-.005l-.031-.004-.032-.004-.031-.005-.032-.004-.031-.005-.032-.004-.032-.005-.032-.004-.032-.005a2.498 2.498 0 0 1-.097-.013l-.033-.005-.032-.004a3.736 3.736 0 0 0-.033-.005l-.032-.005-.033-.004a3.736 3.736 0 0 1-.033-.005l-.033-.005-.033-.004-.034-.005a3.741 3.741 0 0 0-.033-.005l-.033-.004-.034-.005-.033-.005-.034-.004-.034-.005a3.741 3.741 0 0 0-.067-.01l-.034-.004a2.81 2.81 0 0 1-.034-.005l-.035-.005-.034-.005-.034-.005-.034-.004-.035-.005-.035-.005-.034-.005-.035-.005-.035-.005a3.002 3.002 0 0 0-.07-.01l-.035-.005-.035-.005-.035-.004-.035-.005-.036-.005-.035-.005-.036-.005a1.732 1.732 0 0 1-.035-.005l-.036-.005-.036-.005-.036-.005-.036-.006-.036-.005-.036-.005-.036-.005-.036-.005-.036-.005-.037-.005-.036-.005-.037-.005-.036-.005a1.953 1.953 0 0 1-.037-.006l-.037-.005-.036-.005a1.953 1.953 0 0 1-.111-.016 1.953 1.953 0 0 1-.037-.005l-.038-.005-.037-.005-.037-.005-.037-.006-.038-.005-.037-.005-.038-.005-.037-.006-.038-.005-.038-.005-.038-.006a2.068 2.068 0 0 0-.038-.005l-.038-.005-.038-.006-.038-.005-.038-.005-.038-.006-.038-.005-.039-.006a3.489 3.489 0 0 0-.038-.005l-.038-.005-.039-.006-.038-.005-.039-.005-.039-.006-.038-.005-.039-.006a5.222 5.222 0 0 0-.078-.01l-.039-.006-.039-.006a5.222 5.222 0 0 0-.039-.005l-.039-.006-.039-.005a2.309 2.309 0 0 0-.04-.006l-.039-.005-.039-.006-.04-.005-.039-.006-.04-.005-.039-.006-.04-.006-.039-.005a3.92 3.92 0 0 1-.04-.006l-.04-.005a3.92 3.92 0 0 0-.08-.011l-.039-.006a3.92 3.92 0 0 1-.04-.006l-.04-.005-.04-.006-.041-.006-.04-.005a3.856 3.856 0 0 0-.04-.006l-.04-.005-.04-.006-.041-.006-.04-.006-.041-.005-.04-.006-.041-.006-.04-.005-.041-.006-.04-.006-.041-.005-.041-.006-.04-.006a4.147 4.147 0 0 1-.041-.006l-.041-.005-.041-.006-.041-.006-.041-.006-.041-.005-.041-.006-.041-.006-.041-.006a4.08 4.08 0 0 1-.082-.011l-.042-.006-.041-.006-.041-.006-.042-.006a4.08 4.08 0 0 0-.082-.011l-.042-.006-.041-.006-.042-.006-.041-.005-.042-.006a4.08 4.08 0 0 1-.041-.006l-.042-.006-.042-.006-.041-.006-.042-.006-.042-.005-.042-.006-.041-.006-.042-.006a6.055 6.055 0 0 0-.042-.006l-.042-.006-.042-.006-.042-.006-.042-.005-.042-.006-.042-.006-.042-.006-.042-.006-.042-.006-.042-.006-.042-.006a6.055 6.055 0 0 1-.085-.012l-.042-.006a6.055 6.055 0 0 1-.042-.006l-.042-.005-.042-.006a2.671 2.671 0 0 1-.085-.012l-.042-.006-.043-.006-.042-.006-.042-.006a2.671 2.671 0 0 1-.043-.006l-.042-.006-.043-.006a199029715334.29 199029715334.29 0 0 0-.085-.012l-.042-.006-.043-.006-.042-.006-.043-.006-.042-.006-.043-.006-.042-.006-.043-.006-.042-.006a4.545 4.545 0 0 1-.086-.012l-.042-.006-.043-.006-.043-.006-.042-.006-.043-.006a4.545 4.545 0 0 0-.043-.006l-.042-.006-.043-.006a4.545 4.545 0 0 0-.043-.006l-.042-.006a4.545 4.545 0 0 1-.086-.012l-.042-.006a4.545 4.545 0 0 1-.043-.006l-.043-.006a4.545 4.545 0 0 0-.043-.006l-.042-.006-.043-.006-.043-.006-.043-.006-.042-.006-.043-.006-.043-.006a4.545 4.545 0 0 0-.043-.006l-.042-.006a4.545 4.545 0 0 1-.043-.006l-.043-.006a4.545 4.545 0 0 0-.043-.006l-.042-.006-.043-.006-.043-.006-.043-.006-.042-.006-.043-.006-.043-.006a4.545 4.545 0 0 0-.043-.006l-.042-.006-.043-.006-.043-.006a4.545 4.545 0 0 0-.043-.006l-.042-.006a4.545 4.545 0 0 1-.043-.006l-.043-.006-.042-.006a4.545 4.545 0 0 1-.043-.006l-.043-.006-.042-.006a4.545 4.545 0 0 1-.043-.006l-.043-.006-.042-.006-.043-.006-.043-.006-.042-.006-.043-.006-.043-.006-.042-.006-.043-.006-.042-.006-.043-.006-.042-.006-.043-.006-.042-.006-.043-.006-.042-.006-.043-.006-.042-.006-.043-.005-.042-.006-.042-.007-.043-.005-.042-.006-.042-.006-.043-.006-.042-.006-.042-.006-.043-.006-.042-.006-.042-.006-.042-.006-.042-.006a6.055 6.055 0 0 0-.042-.006l-.043-.006a6.055 6.055 0 0 1-.042-.006l-.042-.005-.042-.006-.042-.006-.042-.006-.042-.006-.042-.006-.042-.006-.042-.006-.041-.006-.042-.006-.042-.005-.042-.006-.042-.006a2.368 2.368 0 0 0-.041-.006l-.042-.006-.042-.006-.041-.006-.042-.005-.041-.006-.042-.006-.041-.006-.042-.006a4.08 4.08 0 0 1-.041-.006l-.042-.005-.041-.006-.042-.006-.041-.006-.041-.006-.041-.005-.042-.006-.041-.006a4.08 4.08 0 0 0-.041-.006l-.041-.006-.041-.005-.041-.006-.041-.006-.041-.006-.041-.005-.041-.006-.04-.006a4.08 4.08 0 0 1-.041-.006l-.041-.005-.041-.006-.04-.006-.041-.005-.04-.006-.041-.006-.04-.005-.041-.006-.04-.006-.041-.005-.04-.006-.04-.006a3.92 3.92 0 0 1-.04-.005l-.041-.006-.04-.006-.04-.005a3.856 3.856 0 0 0-.04-.006l-.04-.006-.04-.005a3.92 3.92 0 0 0-.04-.006l-.039-.006-.279 1.981.04.006.04.005.04.006.04.005.04.006.04.006.04.005.04.006.04.006.041.005.04.006.04.006.041.005.04.006.041.006.04.005.041.006.04.006.041.005.041.006.04.006.041.006.041.005.041.006.041.006a4.08 4.08 0 0 0 .082.011l.041.006.041.006.041.006.041.006.041.005.041.006.042.006.041.006.041.005.041.006.042.006.041.006.042.006.041.006.042.005.041.006.042.006.041.006.042.006.042.006.041.005.042.006.042.006.042.006.041.006.042.006.042.006.042.006.042.006.042.005.042.006.042.006a6.055 6.055 0 0 0 .126.018l.042.006.042.006.042.006.043.006.042.006.042.005a6.055 6.055 0 0 0 .084.012l.043.006.042.006.042.006.043.006.042.006.042.006.043.006.042.006a2.671 2.671 0 0 0 .085.012l.042.006.043.006.042.006a4.545 4.545 0 0 1 .128.018l.042.006a4.545 4.545 0 0 1 .086.012l.042.006.043.006.042.006.043.006.043.006.042.006.043.006.043.006.042.006.043.006.043.006.042.006.043.006.043.006.042.006.043.006.043.006.042.006.043.006.043.006.043.006.042.006.043.006.043.006.043.006.042.006.043.006.043.006.043.006.042.006a4.545 4.545 0 0 1 .086.012l.043.006a4.545 4.545 0 0 0 .085.012l.043.006.043.006a4.545 4.545 0 0 0 .085.012l.043.006.043.006a54282225845.257 54282225845.257 0 0 0 .085.012l.043.006.043.006.042.006.043.006.043.006.042.006.043.006.043.006.042.006.043.006.043.006a199029715334.29 199029715334.29 0 0 1 .085.012l.043.006.042.006.043.006.042.006.043.006.042.006a4.545 4.545 0 0 1 .086.012l.042.006.043.006.042.006.043.006.042.006.042.006.043.005.042.006.043.006.042.006a6.055 6.055 0 0 0 .085.012l.042.006.042.006.042.006.043.006.042.006.042.006.042.006.042.006.043.006.042.005.042.006.042.006.042.006.042.006.042.006.042.006.042.006.042.006.042.006.041.005.042.006.042.006.042.006.042.006.041.006.042.006.042.006.041.005.042.006.041.006.042.006.041.006.042.006.041.005.042.006.041.006.041.006.042.006.041.006.041.005.041.006.042.006a2.39 2.39 0 0 0 .123.017l.041.006.041.006.041.005.041.006.04.006.041.006.041.005.041.006.04.006.041.006.041.005.04.006.041.006.04.005.041.006.04.006.04.005.041.006.04.006.04.005.04.006.04.006a2.287 2.287 0 0 1 .08.01l.04.006.04.006.04.006.04.005.04.006a5.228 5.228 0 0 0 .079.011l.04.006.039.005.04.006.039.005.039.006.04.005.039.006.039.005.04.006.039.005.039.006.039.005.039.006.039.005.038.006.039.005.039.006.039.005.038.005.039.006a3.489 3.489 0 0 1 .077.01l.038.006.038.006.039.005.038.005.038.006.038.005.038.005.038.006.038.005.038.005.037.006.038.005.038.005.037.005.038.006.037.005.038.005.037.005.037.006a3.283 3.283 0 0 1 .111.015 1.953 1.953 0 0 1 .074.01l.037.006.037.005.036.005.037.005.036.005.037.005.036.006a3.404 3.404 0 0 0 .073.01l.036.005.036.005a4.446 4.446 0 0 0 .108.015l.036.005.035.005a4.446 4.446 0 0 1 .107.015l.035.005.036.005.035.005.035.005.035.005.035.005.035.005.035.005.034.005.035.004.035.005.034.005.035.005.034.005.034.005.034.004.034.005.034.005.034.005.034.004.034.005.033.005.034.005.033.004.034.005.033.005.033.004.033.005.033.005.033.004.033.005.033.005.033.004.032.005a96283821767.31 96283821767.31 0 0 0 .065.009l.032.004.032.005.033.004.032.005.031.004.032.005.032.004.032.005.031.004.032.004.031.005.031.004.031.005.031.004.031.004.031.005a2.324 2.324 0 0 0 .092.013l.03.004.031.004.03.004.03.005.03.004.03.004.03.004.029.005c.01 0 .02.002.03.004l.029.004.03.004.029.004.029.004.029.004.029.004.029.004.029.004.029.004.028.004.028.004.029.004.028.004.028.004.028.004.028.004.028.004.027.004.028.004.027.004.028.003.027.004.027.004.027.004.027.004c.009 0 .017.002.026.003l.027.004.026.004.027.004c.009 0 .017.002.026.003l.026.004.026.004c.009 0 .018.002.026.003l.026.004.026.003.025.004.026.004.025.003.025.004.025.003.025.004.025.003.025.004.024.003.025.004.024.003a1.978 1.978 0 0 0 .048.007l.024.003.024.003.024.004.023.003.024.004.023.003c.008 0 .015.002.023.003l.023.003.023.004c.008 0 .015.002.023.003.008 0 .015.002.023.003l.022.003.023.003.022.003.022.003.022.003.022.004a1.215 1.215 0 0 0 .043.006l.022.003.021.003.021.003.021.003.021.003.021.002.021.003.02.003.021.003.02.003.02.003c.007 0 .014.002.02.003.007 0 .013.002.02.003l.02.002.019.003c.007 0 .013.002.02.003l.019.002.019.003.019.003.019.002.019.003.018.003.019.002.018.003.018.002.018.003.018.002.018.003.018.002.017.003a.702.702 0 0 1 .051.007l.017.002.017.003.017.002.016.002.016.003a.61.61 0 0 1 .016.002l.016.002.016.002.016.003.015.002.016.002.015.002.015.002.015.002.015.002.014.002.015.003c.004 0 .009 0 .014.002.005 0 .009 0 .014.002l.014.001.014.002.013.002.014.002.013.002.014.002.013.002.012.002.013.001.013.002.012.002.012.002.012.001.012.002.012.002.012.001.011.002c.004 0 .008 0 .011.002l.012.001.011.002.01.001.011.002.01.001.279-1.98zm-23.486-10.36c.971-6.927 2.262-16.124 2.497-17.745l-1.979-.287a9882.627 9882.627 0 0 0-2.499 17.754l1.981.277zm2.497-17.745c.249-1.714-.486-3.034-1.206-3.872a6.629 6.629 0 0 0-1.366-1.198 2.75 2.75 0 0 0-.108-.068l-.034-.02-.011-.007-.005-.003h-.001l-.001-.001-.496.868-.497.868h-.001l-.002-.002c-.001 0-.001 0 0 0l.01.006.057.036a4.657 4.657 0 0 1 .939.825c.495.577.88 1.336.743 2.281l1.979.287zm3.457 25.641a6.991 6.991 0 0 1-5.954-7.897l-1.981-.277a8.991 8.991 0 0 0 7.656 10.155l.279-1.98z"
fill={theme.border.default}
/>
<path
d="M76.806 111.905h64.388c5.523 0 10-4.477 10-9.999V36.221a9.997 9.997 0 0 0-2.929-7.071l-25.16-25.161a10.001 10.001 0 0 0-7.071-2.93H76.806c-5.523 0-10 4.478-10 10v90.846c0 5.523 4.477 10 10 10z"
fill={theme.background.default}
stroke={theme.border.default}
strokeWidth="2"
/>
<path
d="M149.643 33.165a1 1 0 1 0 1.831-.805l-1.831.805zm-28.489-10.107h-1 1zm.004-17.924-1-.005 1 .005zm29.4 27.629c.916-.403.915-.404.915-.404l-.001-.002-.001-.002-.003-.007a.254.254 0 0 1-.006-.014l-.017-.036a3.077 3.077 0 0 0-.242-.391 3.899 3.899 0 0 0-.781-.794c-.741-.57-1.884-1.064-3.568-1.064v2c1.266 0 1.976.362 2.349.65a1.873 1.873 0 0 1 .446.48l.005.01-.004-.008a.079.079 0 0 1-.003-.007l-.002-.004-.001-.003h-.001c0-.001 0-.002.915-.404zm-3.704-2.714h-17.705v2h17.705v-2zm-24.7-6.992c-.002-6.994-.004-16.281.004-17.918l-2-.01a9095.53 9095.53 0 0 0-.004 17.93l2-.002zm.004-17.918c.007-1.733-.904-2.938-1.734-3.667a6.63 6.63 0 0 0-1.519-.997 3.432 3.432 0 0 0-.165-.073l-.005-.001-.002-.001-.371.928c-.37.93-.37.93-.371.929h-.002l-.001-.001c-.001 0-.001 0 0 0l.01.004.062.028a4.635 4.635 0 0 1 1.044.687c.571.501 1.058 1.199 1.054 2.154l2 .01zm6.991 24.91a6.99 6.99 0 0 1-6.995-6.992l-2 .001a8.991 8.991 0 0 0 8.995 8.991v-2z"
fill={theme.border.default}
/>
<g clipPath="url(#a)">
<path
d="M105.204 44.343c1.556-3.123 6.011-3.124 7.569-.002l15.126 30.321c1.403 2.811-.642 6.116-3.784 6.116h-30.23c-3.14 0-5.186-3.302-3.785-6.114l15.104-30.32zm7.568 8.95c0-.817-.435-1.691-1.069-2.345-.645-.665-1.575-1.186-2.662-1.186-1.083 0-2.03.517-2.694 1.178-.651.647-1.119 1.524-1.119 2.353 0 .636.249 3.925.493 7 .122 1.55.245 3.063.337 4.187l.112 1.353.031.376.008.1.001.008a2.831 2.831 0 0 0 5.663-.002l.001-.011.007-.1.029-.376.102-1.352c.084-1.125.197-2.637.309-4.187.223-3.077.451-6.363.451-6.996zm-3.769 24.398a3.922 3.922 0 1 0 0-7.845 3.922 3.922 0 0 0 0 7.845z"
fill={theme.icon.default}
stroke={theme.icon.default}
strokeWidth="1.3"
/>
</g>
<defs>
<clipPath id="a">
<path fill={theme.background.default} transform="translate(89 41.39)" d="M0 0h40v40H0z" />
</clipPath>
</defs>
</svg>
);
``` | /content/code_sandbox/docs/ui/components/ErrorPage/ServerErrorImage.tsx | xml | 2016-08-15T17:14:25 | 2024-08-16T19:54:44 | expo | expo/expo | 32,004 | 14,045 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.