Merge remote-tracking branch 'upstream/master' into AlexJ-DisplayDialog

This commit is contained in:
Alex Jerabek
2018-06-20 14:23:34 -07:00
55 changed files with 3491 additions and 722 deletions
+6
View File
@@ -0,0 +1,6 @@
import * as bencode from "bencode";
bencode.byteLength("abcde"); // $ExpectType number
bencode.encodingLength("abcde"); // $ExpectType number
bencode.encode([1, 2, 3, 4], new Buffer([]), 1); // $ExpectType Buffer
bencode.decode(new Buffer("abcde"), 1, 3); // $ExpectType any
+16
View File
@@ -0,0 +1,16 @@
// Type definitions for bencode 2.0
// Project: https://github.com/themasch/node-bencode#readme
// Definitions by: Tobenna <https://github.com/tobenna>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
export function byteLength(value: any): number;
export function encodingLength(value: any): number;
export function encode(data: any, buffer?: Buffer, offset?: number): Buffer;
export function decode(
data: Buffer,
start?: number,
end?: number,
encoding?: string
): any;
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"bencode-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+3
View File
@@ -14,3 +14,6 @@ const b6 = b4.multiply(b5);
console.log(b6);
// => BigInteger { '0': 420, '1': 0, t: 1, s: 0 }
console.log(b1.compareTo(b2));
// => 70
+1 -1
View File
@@ -23,7 +23,7 @@ declare class bigi {
clamp(): void;
clearBit(n: number): bigi;
clone(): bigi;
compareTo(a: bigi): bigi;
compareTo(a: bigi): number;
copyTo(r: any): void;
dAddOffset(n: any, w: any): void;
dMultiply(n: number): void;
+15
View File
@@ -71,3 +71,18 @@ euro = chance.euro({opt: 'abc'});
let coin = chance.coin();
coin = chance.coin();
// Make sure date works with min and max parameters
let date: string|Date = chance.date();
let min = new Date();
let max = new Date();
date = chance.date({min, max});
min = new Date();
min.setFullYear(new Date().getFullYear() - 15);
max = new Date();
max.setFullYear(new Date().getFullYear() + 15);
date = chance.date({min, max});
date = chance.date({min});
date = chance.date({max});
+3 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for Chance 1.0.13
// Type definitions for Chance 1.0.16
// Project: http://chancejs.com
// Definitions by: Chris Bowdon <https://github.com/cbowdon>
// Brice BERNARD <https://github.com/brikou>
@@ -189,6 +189,8 @@ declare namespace Chance {
year?: number;
month?: number;
day?: number;
min?: Date;
max?: Date;
}
interface Month {
+1586 -591
View File
File diff suppressed because it is too large Load Diff
+38 -3
View File
@@ -1,7 +1,7 @@
import runtime = chrome.app.runtime;
import cwindow = chrome.app.window;
var createOptions: cwindow.CreateWindowOptions = {
const createOptions: cwindow.CreateWindowOptions = {
id: "My Window",
bounds: {
left: 0,
@@ -324,5 +324,40 @@ function testSystemNetwork() {
});
}
import webview = chrome.webview;
let element: webview.HTMLWebViewElement;
const gcmMessage = <chrome.gcm.OutgoingMessage>{};
gcmMessage.data = {
/*goog: 'any', should not be allowed, and it is not :) */
test: true
};
let wve: chrome.webview.HTMLWebViewElement = (<any>document.getElementById('webview'));
wve.name = 'test';
wve.src = 'https://github.com/DefinitelyTyped';
wve.allowtransparency = true;
wve.autosize = 'on';
wve.partition = 'persist:githubwebview';
wve.addEventListener('close', () => {
return;
});
wve.addEventListener('consolemessage', (ev) => {
if (ev.level === chrome.webview.ConsoleMessageLevel.LOG_ERROR) {
const msg = ev.message;
}
});
wve.addEventListener('dialog', (ev) => {
ev.dialog.ok('Hello World!');
});
wve.addEventListener('loadstart', (ev) => {
if (ev.isTopLevel) {
return ev.url;
}
return;
});
wve.addEventListener('zoomchange', (ev) => {
return ev.newZoomFactor || ev.oldZoomFactor;
});
wve.addEventListener('loadredirect', (ev) => {
return ev.newUrl || ev.oldUrl;
});
chrome.bluetoothLowEnergy.connect('1111111', () => { });
@@ -0,0 +1,33 @@
const startupConfiguration: any = { camera_position: 'back' };
// Some code samples from the wikitude ionic starter
WikitudePlugin.loadARchitectWorld(
success => {
console.log('ARchitect World loaded successfully.');
},
fail => {
console.log('Failed to load ARchitect World!');
},
'www/assets/07_3dModels_6_3dModelAtGeoLocation/index.html',
['geo'],
<JSON> startupConfiguration
);
WikitudePlugin.setOnUrlInvokeCallback(url => {
if (url.indexOf('captureScreen') > -1) {
WikitudePlugin.captureScreen(
absoluteFilePath => {
WikitudePlugin.callJavaScript(
`World.testFunction('Screenshot saved at: ${absoluteFilePath}');`
);
},
errorMessage => {
console.log(errorMessage);
},
true,
null
);
} else {
alert(url + 'not handled');
}
});
+82
View File
@@ -0,0 +1,82 @@
// Type definitions for com.wikitude.phonegap.wikitudeplugin 7.2
// Project: https://github.com/Wikitude/wikitude-cordova-plugin
// Definitions by: zbarbuto <https://github.com/zbarbuto>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
// The following types are taken directly (unmodified) from the wikitude-ionic-3-starter-app
// https://github.com/pbreuss/wikitude-ionic-3-starter-app
// Latest commit at time of writing was 647cd546f6d1805765c4cee725566e246ca6259d
/**
* Wrapper for the Wikitude SDK Phonegap Plugin - to use with IONIC2
* (c) 2016 Schneeweis.Technology
*/
interface WikitudePlugin {
isDeviceSupported(
successCallback: (success: string) => void,
errorCallback: (message: string) => void,
requiredFeatures: [string]
): void;
loadARchitectWorld(
successCallback: (success: string) => void,
errorCallback: (message: string) => void,
architectWorldPath: string,
requiredFeatures: [string],
startupConfiguration: JSON | object
): void;
close(): void;
hide(): void;
show(): void;
// test type ok?
callJavaScript(js: any): void;
setOnUrlInvokeCallback(onUrlInvokeCallback: (success: string) => void): void;
setLocation(latitude: any, longitude: any, altitude: any, accuracy: any): void;
captureScreen(
successCallback: (success: string) => void,
errorCallback: (message: string) => void,
includeWebView: boolean,
imagePathInBundleOrNullForPhotoLibrary: string | null
): void;
setErrorHandler(errorHandler: (message: string) => void): void;
setDeviceSensorsNeedCalibrationHandler(
startCalibrationHandler: (message: string) => void
): void;
setDeviceSensorsFinishedCalibrationHandler(
finishedCalibrationHandler: (message: string) => void
): void;
setBackButtonCallback(onBackButtonCallback: (message: string) => void): void;
/* Lifecycle updates */
onResume(): void;
onBackButton(): void;
onPause(): void;
onWikitudeOK(): void;
onWikitudeError(): void;
_sdkKey: string;
FeatureGeo: string;
Feature2DTracking: string;
CameraPositionUndefined: number;
CameraPositionFront: number;
CameraPositionBack: number;
CameraFocusRangeNone: number;
CameraFocusRangeNear: number;
CameraFocusRangeFar: number;
}
declare var WikitudePlugin: WikitudePlugin;
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"com.wikitude.phonegap.wikitudeplugin-tests.ts"
]
}
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}
+40
View File
@@ -0,0 +1,40 @@
import csso = require('csso');
csso.minify('.test { color: #ff0000; }').css;
csso.minify('.test { color: #ff0000; }').map;
csso.minify('.test { color: #ff0000; }', {
sourceMap: true,
filename: '',
debug: true,
beforeCompress: () => {},
afterCompress: () => {},
restructure: false,
forceMediaMerge: true,
clone: false,
comments: '',
logger: () => {}
});
csso.minifyBlock('color: rgba(255, 0, 0, 1); color: #ff0000').css;
csso.minifyBlock('color: rgba(255, 0, 0, 1); color: #ff0000').map;
csso.minifyBlock('color: rgba(255, 0, 0, 1); color: #ff0000', {
sourceMap: true,
filename: '',
debug: true,
beforeCompress: () => {},
afterCompress: () => {},
restructure: false,
forceMediaMerge: true,
clone: false,
comments: '',
logger: () => {}
});
csso.compress({}).ast;
csso.compress({}, {
restructure: false,
forceMediaMerge: true,
clone: false,
comments: '',
logger: () => {}
}).ast;
+107
View File
@@ -0,0 +1,107 @@
// Type definitions for csso 3.5
// Project: https://github.com/css/csso
// Definitions by: Christian Rackerseder <https://github.com/screendriver>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
declare namespace csso {
interface Result {
/**
* Resulting CSS.
*/
css: string;
/**
* Instance of SourceMapGenerator or null.
*/
map: object | null;
}
interface CompressOptions {
/**
* Disable or enable a structure optimisations.
* @default true
*/
restructure?: boolean;
/**
* Enables merging of @media rules with the same media query by splitted by other rules.
* The optimisation is unsafe in general, but should work fine in most cases. Use it on your own risk.
* @default false
*/
forceMediaMerge?: boolean;
/**
* Transform a copy of input AST if true. Useful in case of AST reuse.
* @default false
*/
clone?: boolean;
/**
* Specify what comments to leave:
* - 'exclamation' or true – leave all exclamation comments
* - 'first-exclamation' – remove every comment except first one
* - false – remove all comments
* @default true
*/
comments?: string | boolean;
/**
* Usage data for advanced optimisations.
*/
usage?: object;
/**
* Function to track every step of transformation.
*/
logger?: () => void;
}
interface MinifyOptions {
/**
* Generate a source map when true.
* @default false
*/
sourceMap?: boolean;
/**
* Filename of input CSS, uses for source map generation.
* @default '<unknown>'
*/
filename?: string;
/**
* Output debug information to stderr.
* @default false
*/
debug?: boolean;
/**
* Called right after parse is run.
*/
beforeCompress?: BeforeCompressFn | BeforeCompressFn[];
/**
* Called right after compress() is run.
*/
afterCompress?: AfterCompressFn | AfterCompressFn[];
restructure?: boolean;
}
type BeforeCompressFn = (ast: object, options: CompressOptions) => void;
type AfterCompressFn = (compressResult: string, options: CompressOptions) => void;
}
interface Csso {
/**
* Minify source CSS passed as String
* @param source
* @param options
*/
minify(source: string, options?: csso.MinifyOptions & csso.CompressOptions): csso.Result;
/**
* The same as minify() but for list of declarations. Usually it's a style attribute value.
* @param source
* @param options
*/
minifyBlock(source: string, options?: csso.MinifyOptions & csso.CompressOptions): csso.Result;
/**
* Does the main task – compress an AST.
*/
compress(ast: object, options?: csso.CompressOptions): { ast: object };
}
declare const csso: Csso;
export = csso;
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"csso-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+2 -2
View File
@@ -51,8 +51,7 @@ export class GUI {
__folders: GUI[];
domElement: HTMLElement;
add(target: Object, propName:string): GUIController;
add(target: Object, propName:string, min: number, max: number): GUIController;
add(target: Object, propName:string, min?: number, max?: number, step?: number): GUIController;
add(target: Object, propName:string, status: boolean): GUIController;
add(target: Object, propName:string, items:string[]): GUIController;
add(target: Object, propName:string, items:number[]): GUIController;
@@ -64,6 +63,7 @@ export class GUI {
destroy(): void;
addFolder(propName:string): GUI;
removeFolder(subFolder:GUI):void;
open(): void;
close(): void;
+3
View File
@@ -0,0 +1,3 @@
import emojiRegex from "emoji-regex";
emojiRegex(); // $ExpectType RegExp
+7
View File
@@ -0,0 +1,7 @@
// Type definitions for emoji-regex 7.0
// Project: https://github.com/mathiasbynens/emoji-regex
// Definitions by: iKBAHT <https://github.com/iKBAHT>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function createRegExp(): RegExp;
export = createRegExp;
+24
View File
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"emoji-regex-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+7 -1
View File
@@ -2354,7 +2354,7 @@ declare namespace Highcharts {
* can be customized by defining a new array of items and assigning null to unwanted positions.
* @since 2.0
*/
menuItems?: MenuItem[];
menuItems?: string[] | MenuItem[];
/**
* A click handler callback to use on the button directly instead of the popup menu.
* @since 2.0
@@ -2661,6 +2661,12 @@ declare namespace Highcharts {
* @default ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
*/
shortMonths?: string[];
/**
* Short week days, starting Sunday. If not specified, Highcharts uses the first three letters of the lang.weekdays option.
* @default undefined
* @since 4.2.4
*/
shortWeekdays?: string[];
/**
* The default thousands separator used in the Highcharts.numberFormat method unless otherwise specified in the
* function arguments. Since Highcharts 4.1 it defaults to a single space character, which is compatible with ISO
+10
View File
@@ -0,0 +1,10 @@
// Type definitions for Highcharts Drilldown 4.2.7
// Project: http://www.highcharts.com/
// Definitions by: Konstantin Rohde <https://github.com/RohdeK>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import { Static } from "highcharts";
declare function HighchartsDrilldown(H: Static): Static;
export = HighchartsDrilldown;
export as namespace HighchartsDrilldown;
+1
View File
@@ -0,0 +1 @@
HighchartsDrilldown(Highcharts);
+2
View File
@@ -21,6 +21,7 @@
"index.d.ts",
"modules/map/index.d.ts",
"modules/boost.d.ts",
"modules/drilldown.d.ts",
"modules/exporting.d.ts",
"modules/no-data-to-display.d.ts",
"modules/offline-exporting.d.ts",
@@ -28,6 +29,7 @@
"highstock.d.ts",
"js/highcharts/index.d.ts",
"test/boost.ts",
"test/drilldown.ts",
"test/exporting.ts",
"test/highstock.ts",
"test/index.ts",
@@ -0,0 +1,21 @@
import GracefulShutdown = require('http-graceful-shutdown');
import * as http from "http";
const opts: GracefulShutdown.Options = {
signals: "SIGINT SIGTERM",
timeout: 1337,
development: false,
onShutdown: () => {
console.log('fake shutdown handler');
return Promise.resolve();
},
finally: () => {
console.log('fake finally handler');
}
};
const server = http.createServer((req, res) => {
res.end();
});
GracefulShutdown(server, opts);
+22
View File
@@ -0,0 +1,22 @@
// Type definitions for http-graceful-shutdown 2.1
// Project: https://github.com/sebhildebrandt/http-graceful-shutdown
// Definitions by: Dave Lee <https://github.com/dlee-nvisia>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
import { Server } from "http";
declare function GracefulShutdown(server: Server, options?: GracefulShutdown.Options): void;
declare namespace GracefulShutdown {
interface Options {
signals?: string;
timeout?: number;
development?: boolean;
onShutdown?: () => Promise<void>;
finally?: () => void;
}
}
export = GracefulShutdown;
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"http-graceful-shutdown-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+20 -14
View File
@@ -1,4 +1,4 @@
// Type definitions for luxon 0.5
// Type definitions for luxon 1.2
// Project: https://github.com/moment/luxon#readme
// Definitions by: Colby DeHart <https://github.com/colbydehart>
// Hyeonseok Yang <https://github.com/FourwingsY>
@@ -180,14 +180,14 @@ declare module 'luxon' {
zoneName: string;
diff(
other: DateTime,
unit?: string | string[],
unit?: DurationUnit | DurationUnit[],
options?: DiffOptions
): Duration;
diffNow(unit?: string | string[], options?: DiffOptions): Duration;
endOf(unit: string): DateTime;
diffNow(unit?: DurationUnit | DurationUnit[], options?: DiffOptions): Duration;
endOf(unit: DurationUnit): DateTime;
equals(other: DateTime): boolean;
get(unit: string): number;
hasSame(other: DateTime, unit: string): boolean;
get(unit: keyof DateTime): number;
hasSame(other: DateTime, unit: DurationUnit): boolean;
minus(duration: Duration | number | DurationObject): DateTime;
plus(duration: Duration | number | DurationObject): DateTime;
reconfigure(properties: LocaleOptions): DateTime;
@@ -195,7 +195,8 @@ declare module 'luxon' {
set(values: DateObjectUnits): DateTime;
setLocale(locale: any): DateTime;
setZone(zone: string | Zone, options?: ZoneOptions): DateTime;
startOf(unit: string): DateTime;
startOf(unit: DurationUnit): DateTime;
toBSON(): Date;
toFormat(format: string, options?: ToFormatOptions): string;
toHTTP(): string;
toISO(options?: ISOTimeOptions): string;
@@ -207,6 +208,7 @@ declare module 'luxon' {
toLocal(): DateTime;
toLocaleParts(options?: DateTimeFormatOptions): any[];
toLocaleString(options?: DateTimeFormatOptions): string;
toMillis(): number;
toObject(options?: { includeConfig?: boolean }): DateObject;
toMillis(): number;
toRFC2822(): string;
@@ -238,6 +240,9 @@ declare module 'luxon' {
type DurationObject = DurationObjectUnits & DurationOptions;
type DurationUnit = 'year' | 'years' | 'quarter' | 'quarters' | 'month' | 'months' | 'week' | 'weeks' | 'day' | 'days'
| 'hour' | 'hours' | 'minute' | 'minutes' | 'second' | 'seconds' | 'millisecond' | 'milliseconds';
class Duration {
static fromISO(text: string, options?: DurationOptions): Duration;
static fromMillis(
@@ -261,16 +266,16 @@ declare module 'luxon' {
seconds: number;
weeks: number;
years: number;
as(unit: string): number;
as(unit: DurationUnit): number;
equals(other: Duration): boolean;
get(unit: string): number;
get(unit: DurationUnit): number;
minus(duration: Duration | number | DurationObject): Duration;
negate(): Duration;
normalize(): Duration;
plus(duration: Duration | number | DurationObject): Duration;
reconfigure(objectPattern: DurationOptions): Duration;
set(values: DurationObjectUnits): Duration;
shiftTo(...units: string[]): Duration;
shiftTo(...units: DurationUnit[]): Duration;
toFormat(format: string, options?: ToFormatOptions): string;
toISO(): string;
toJSON(): string;
@@ -278,6 +283,7 @@ declare module 'luxon' {
includeConfig?: boolean;
}): DurationObject;
toString(): string;
valueOf(): number;
}
type EraLength = 'short' | 'long';
@@ -341,23 +347,23 @@ declare module 'luxon' {
abutsEnd(other: Interval): boolean;
abutsStart(other: Interval): boolean;
contains(dateTime: DateTime): boolean;
count(unit?: string): number;
count(unit?: DurationUnit): number;
difference(...intervals: Interval[]): Interval[];
divideEqually(numberOfParts?: number): Interval[];
engulfs(other: Interval): boolean;
equals(other: Interval): boolean;
hasSame(unit: string): boolean;
hasSame(unit: DurationUnit): boolean;
intersection(other: Interval): Interval;
isAfter(dateTime: DateTime): boolean;
isBefore(dateTime: DateTime): boolean;
isEmpty(): boolean;
length(unit?: string): number;
length(unit?: DurationUnit): number;
overlaps(other: Interval): boolean;
set(values: IntervalObject): Interval;
splitAt(...dateTimes: DateTime[]): Interval[];
splitBy(duration: Duration | DurationObject | number): Interval[];
toDuration(
unit: string | string[],
unit: DurationUnit | DurationUnit[],
options?: DiffOptions
): Duration;
toFormat(
+220 -26
View File
@@ -1,53 +1,247 @@
// Type definitions for Mustache 0.8.2
// Type definitions for Mustache 0.8.3
// Project: https://github.com/janl/mustache.js
// Definitions by: Mark Ashley Bell <https://github.com/markashleybell>
// Definitions by: Mark Ashley Bell <https://github.com/markashleybell>, Manuel Thalmann <https://github.com/manuth>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* Provides the functionality to render templates with `{{mustaches}}`.
*/
interface MustacheStatic {
/**
* The name of the module.
*/
name: string;
interface MustacheScanner {
/**
* The version of the module.
*/
version: string;
/**
* The opening and closing tags to parse.
*/
tags: string;
/**
* A simple string scanner that is used by the template parser to find tokens in template strings.
*/
Scanner: typeof MustacheScanner
/**
* Represents a rendering context by wrapping a view object and maintaining a reference to the parent context.
*/
Context: typeof MustacheContext;
/**
* A Writer knows how to take a stream of tokens and render them to a `string`, given a context.
*
* It also maintains a cache of templates to avoid the need to parse the same template twice.
*/
Writer: typeof MustacheWriter;
/**
* Escapes HTML-characters.
*
* @param value
* The string to escape.
*/
escape: (value: string) => string;
/**
* Clears all cached templates in this writer.
*/
clearCache(): void;
/**
* Parses and caches the given template in the default writer and returns the array of tokens it contains.
*
* Doing this ahead of time avoids the need to parse templates on the fly as they are rendered.
*
* @param template
* The template to parse.
*
* @param tags
* The tags to use.
*/
parse(template: string, tags?: string[]): any;
/**
* Renders the `template` with the given `view` and `partials` using the default writer.
*
* @param template
* The template to render.
*
* @param view
* The view to render the template with.
*
* @param partials
* Either an object that contains the names and templates of partials that are used in a template
*
* -- or --
*
* A function that is used to load partial template on the fly that takes a single argument: the name of the partial.
*/
render(template: string, view: any | MustacheContext, partials?: any): string;
/**
* Renders the `template` with the given `view` and `partials` using the default writer.
*
* @param template
* The template to render.
*
* @param view
* The view to render the template with.
*
* @param partials
* Either an object that contains the names and templates of partials that are used in a template
*
* -- or --
*
* A function that is used to load partial template on the fly that takes a single argument: the name of the partial.
*/
to_html(template: string, view: any | MustacheContext, partials?: any, send?: any): any;
}
/**
* A simple string scanner that is used by the template parser to find tokens in template strings.
*/
declare class MustacheScanner {
string: string;
tail: string;
pos: number;
/**
* Initializes a new instance of the `MustacheScanner` class.
*/
constructor(string: string);
/**
* Returns `true` if the tail is empty (end of string).
*/
eos(): boolean;
/**
* Tries to match the given regular expression at the current position.
*
* @param re
* The regex-pattern to match.
*
* @returns
* The matched text if it can match, the empty string otherwise.
*/
scan(re: RegExp): string;
/**
* Skips all text until the given regular expression can be matched.
*
* @param re
* The regex-pattern to match.
*
* @returns
* Returns the skipped string, which is the entire tail if no match can be made.
*/
scanUntil(re: RegExp): string;
}
interface MustacheContext {
/**
* Represents a rendering context by wrapping a view object and maintaining a reference to the parent context.
*/
declare class MustacheContext {
view: any;
parentContext: MustacheContext;
/**
* Initializes a new instance of the `MustacheContenxt` class.
*/
constructor(view: any, parentContext: MustacheContext);
/**
* Initializes a new instance of the `MustacheContenxt` class.
*/
constructor(view: any);
/**
* Creates a new context using the given view with this context as the parent.
*
* @param view
* The view to create the new context with.
*/
push(view: any): MustacheContext;
/**
* Returns the value of the given name in this context, traversing up the context hierarchy if the value is absent in this context's view.
*
* @param name
* The name to look up.
*/
lookup(name: string): any;
}
interface MustacheWriter {
(view: any): string;
/**
* A Writer knows how to take a stream of tokens and render them to a `string`, given a context.
*
* It also maintains a cache of templates to avoid the need to parse the same template twice.
*/
declare class MustacheWriter {
/**
* Initializes a new instance of the `MustacheWriter` class.
*/
constructor();
/**
* Clears all cached templates in this writer.
*/
clearCache(): void;
/**
* Parses and caches the given `template` and returns the array of tokens that is generated from the parse.
*
* @param template
* The template to parse.
*/
parse(template: string, tags?: any): any;
render(template: string, view: any, partials: any): string;
/**
* High-level method that is used to render the given `template` with the given `view`.
*
* @param template
* The template to render.
*
* @param view
* The view to render the template with.
*
* @param partials
* Either an object that contains the names and templates of partials that are used in a template
*
* -- or --
*
* A function that is used to load partial template on the fly that takes a single argument: the name of the partial.
*/
render(template: string, view: any | MustacheContext, partials: any): string;
/**
* Low-level method that renders the given array of `tokens` using the given `context` and `partials`.
*
* @param tokens
* The tokens to render.
*
* @param context
* The context to use for rendering the tokens.
*
* @param partials
* The partials to use for rendering the tokens.
*
* @param originalTemplate
* An object used to extract the portion of the original template that was contained in a higher-order section.
*
* If the template doesn't use higher-order sections, this argument may be omitted.
*/
renderTokens(tokens: string[], context: MustacheContext, partials: any, originalTemplate: any): string;
}
interface MustacheStatic {
name: string;
version: string;
tags: string;
Scanner: MustacheScanner;
Context: MustacheContext;
Writer: MustacheWriter;
escape: any;
clearCache(): MustacheWriter;
parse(template: string, tags?: any): any;
render(template: string, view: any, partials?: any): string;
to_html(template: string, view: any, partials?: any, send?: any): any;
}
/**
* Provides the functionality to render templates with `{{mustaches}}`.
*/
declare var Mustache: MustacheStatic;
declare module 'mustache' {
export = Mustache;
}
export = Mustache;
export as namespace Mustache;
+15
View File
@@ -12,3 +12,18 @@ var output2 = Mustache.render(template2, view2);
var view3 = { firstName: "John", lastName: "Smith", blogURL: "http://testblog.com" };
var template3 = "<h1>{{firstName}} {{lastName}}</h1>Blog: {{blogURL}}";
var html = Mustache.to_html(template3, view3);
var view4 = new class extends Mustache.Context
{
constructor()
{
super({});
}
public lookup(name: string)
{
return name.toUpperCase();
}
};
var template4 = "Hello, {{firstName}} {{lastName}}";
var html4 = Mustache.render(template4, view4);
+1 -1
View File
@@ -111,7 +111,7 @@ declare namespace NodeVault {
debug?(...args: any[]): any;
tv4?(...args: any[]): any;
commands?: Array<{ method: string, path: string, scheme: any }>;
mustache?: MustacheStatic;
mustache?: typeof mustache;
"request-promise"?: any;
Promise?: PromiseConstructor;
+17 -1
View File
@@ -13835,7 +13835,23 @@ declare namespace OfficeExtension {
declare namespace OfficeExtension {
/**
* Specifies which properties of an object should be loaded.
* Specifies which properties of an object should be loaded. This load happens when the sync() method is executed. This synchronizes the states between Office objects and corresponding JavaScript proxy objects.
*
* @remarks
*
* For Word, the preferred method for specifying the properties and paging information is by using a string literal. The first two examples show the preferred way to request the text and font size properties for paragraphs in a paragraph collection:
*
* `context.load(paragraphs, 'text, font/size');`
*
* `paragraphs.load('text, font/size');`
*
* Here is a similar example using object notation (includes paging):
*
* `context.load(paragraphs, {select: 'text, font/size', expand: 'font', top: 50, skip: 0});`
*
* `paragraphs.load({select: 'text, font/size', expand: 'font', top: 50, skip: 0});`
*
* Note that if we don't specify the specific properties on the font object in the select statement, the expand statement by itself would indicate that all of the font properties are loaded.
*/
interface LoadOption {
/**
+2 -2
View File
@@ -5,8 +5,8 @@
export = pTimeout;
declare function pTimeout<T>(input: Promise<T>, ms: number, message?: string | pTimeout.TimeoutError): Promise<T>;
declare function pTimeout<T, R>(input: Promise<T>, ms: number, fallback: () => R | Promise<R>): Promise<T | R>;
declare function pTimeout<T>(input: PromiseLike<T>, ms: number, message?: string | pTimeout.TimeoutError): Promise<T>;
declare function pTimeout<T, R>(input: PromiseLike<T>, ms: number, fallback: () => R | Promise<R>): Promise<T | R>;
declare namespace pTimeout {
class TimeoutError extends Error {
+1 -1
View File
@@ -85,7 +85,7 @@ export interface PackerOptions {
export type PNGOptions = BaseOptions & ParserOptions & PackerOptions;
export type ColorType = 0 | 1 | 2 | 4;
export type ColorType = 0 | 2 | 4 | 6;
export interface Metadata {
width: number;
+2 -1
View File
@@ -1,6 +1,7 @@
// Type definitions for pouchdb-find 6.3
// Project: https://pouchdb.com/
// Definitions by: Jakub Navratil <https://github.com/trubit>
// Sebastian Ramirez <https://github.com/tiangolo>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -100,7 +101,7 @@ declare namespace PouchDB {
}
interface FindResponse<Content extends {}> {
docs: Array<Core.Document<Content>>;
docs: Array<Core.ExistingDocument<Content>>;
}
interface CreateIndexOptions {
+20 -1
View File
@@ -143,8 +143,27 @@ declare namespace Autocomplete {
open?: boolean;
debug?: boolean;
}
interface State {
/**
* True when the menu is visible. Provided to `onMenuVisibilityChange`.
*/
isOpen: boolean;
/**
* Index of the highlighted item, `null` if none currently is.
*/
highlightedIndex: number | null;
/**
* These three `menu___` values are used in CSS to layout the menu.
*/
menuLeft?: number;
menuTop?: number;
menuWidth?: number;
}
}
declare class Autocomplete extends Component<Autocomplete.Props> {
declare class Autocomplete extends Component<Autocomplete.Props, Autocomplete.State> {
/**
* Autocomplete exposes a subset of `HTMLInputElement` properties to the parent component.
* They can be accessed through Autocomplete's `ref` prop.
+2 -1
View File
@@ -1,6 +1,7 @@
// Type definitions for sax-js 1.x
// Project: https://github.com/isaacs/sax-js
// Definitions by: Asana <https://asana.com>
// Evert Pot <https://evertpot.com/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
@@ -44,7 +45,7 @@ export interface Tag extends BaseTag {
export declare function parser(strict: boolean, opt: SAXOptions): SAXParser;
export declare class SAXParser {
constructor(strict: boolean, opt: SAXOptions);
constructor(strict: boolean, opt?: SAXOptions);
// Methods
end(): void;
+603
View File
@@ -0,0 +1,603 @@
// Type definitions for styled-system 2.3
// Project: https://github.com/jxnblk/styled-system#readme
// Definitions by: Marshall Bowers <https://github.com/maxdeviant>
// Ben McCormick <https://github.com/phobon>
// Justin Bennett <https://github.com/zephraph>
// Christopher Pappas <https://github.com/damassi>
// Eloy Durán <https://github.com/alloy>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
/**
* Core
*/
export type GlobalStyleValues = "inherit" | "initial" | "unset";
export interface BaseTheme {
breakpoints?: number[];
space?: number[];
fontSizes?: number[];
colors?: {
[name: string]: string;
};
}
/**
* Space
*/
export type ResponsiveValue<T> = T | Array<T | null>;
export type SpaceValue = number | string;
export type ResponsiveSpaceValue = ResponsiveValue<SpaceValue>;
export interface SpaceProps {
m?: ResponsiveSpaceValue;
mt?: ResponsiveSpaceValue;
mr?: ResponsiveSpaceValue;
mb?: ResponsiveSpaceValue;
ml?: ResponsiveSpaceValue;
mx?: ResponsiveSpaceValue;
my?: ResponsiveSpaceValue;
p?: ResponsiveSpaceValue;
pt?: ResponsiveSpaceValue;
pr?: ResponsiveSpaceValue;
pb?: ResponsiveSpaceValue;
pl?: ResponsiveSpaceValue;
px?: ResponsiveSpaceValue;
py?: ResponsiveSpaceValue;
}
export function space(...args: any[]): any;
/**
* Width
*/
export type WidthValue = number | string;
export type ResponsiveWidthValue = ResponsiveValue<WidthValue>;
export interface WidthProps {
width?: ResponsiveWidthValue;
}
export interface MinWidthProps {
minWidth?: ResponsiveWidthValue;
}
export interface MaxWidthProps {
maxWidth?: ResponsiveWidthValue;
}
export function width(...args: any[]): any;
export function minWidth(...args: any[]): any;
export function maxWidth(...args: any[]): any;
/**
* Height
*/
export type HeightValue = number | string;
export type ResponsiveHeightValue = ResponsiveValue<HeightValue>;
export interface HeightProps {
height?: ResponsiveHeightValue;
}
export interface MinHeightProps {
minHeight?: ResponsiveHeightValue;
}
export interface MaxHeightProps {
maxHeight?: ResponsiveHeightValue;
}
export function height(...args: any[]): any;
export function minHeight(...args: any[]): any;
export function maxHeight(...args: any[]): any;
/**
* Font Size
*/
export type FontSizeValue = number | string;
export type ResponsiveFontSizeValue = ResponsiveValue<FontSizeValue>;
export interface FontSizeProps {
fontSize?: ResponsiveFontSizeValue;
}
export function fontSize(...args: any[]): any;
/**
* Color
*/
export type ColorValue = string;
export type ResponsiveColorValue = ResponsiveValue<ColorValue>;
export interface ColorProps {
color?: ResponsiveColorValue;
}
export function color(...args: any[]): any;
/**
* Typography
*/
export interface FontFamilyProps {
fontFamily?: string;
}
export function fontFamily(...args: any[]): any;
export type TextAlignValue =
| "left"
| "right"
| "center"
| "justify"
| "justify-all"
| "start"
| "end"
| "match-parent";
export type ResponsiveTextAlignValue = ResponsiveValue<TextAlignValue>;
export interface TextAlignProps {
textAlign?: ResponsiveTextAlignValue;
}
export function textAlign(...args: any[]): any;
export type LineHeightValue = number | string;
export type ResponsiveLineHeightValue = ResponsiveValue<LineHeightValue>;
export interface LineHeightProps {
lineHeight?: ResponsiveLineHeightValue;
}
export function lineHeight(...args: any[]): any;
export type FontWeightValue =
| GlobalStyleValues
| "normal"
| "bold"
| "lighter"
| "bolder"
| number;
export interface FontWeightProps {
fontWeight?: FontWeightValue;
}
export function fontWeight(...args: any[]): any;
export type LetterSpacingValue = number | string;
export type ResponsiveLetterSpacingValue = ResponsiveValue<LetterSpacingValue>;
export interface LetterSpacingProps {
letterSpacing?: ResponsiveLetterSpacingValue;
}
export function letterSpacing(...args: any[]): any;
/**
* Layout
*/
export type DisplayValue =
| "inline"
| "block"
| "contents"
| "flex"
| "grid"
| "inline-block";
export type ResponsiveDisplayValue = ResponsiveValue<DisplayValue>;
export interface DisplayProps {
display?: ResponsiveDisplayValue;
}
export function display(...args: any[]): any;
export interface SizeProps {
size?: ResponsiveWidthValue | ResponsiveHeightValue;
}
export function size(...args: any[]): any;
export type RatioValue = SpaceValue;
export interface RatioProps {
ratio?: RatioValue;
}
export function ratio(...args: any[]): any;
/**
* Flexbox
*/
export type AlignItemsValue =
| "normal"
| "stretch"
| "center"
| "start"
| "end"
| "flex-start"
| "flex-end"
| "self-start"
| "self-end"
| "left"
| "right"
| "baseline"
| "first baseline"
| "last baseline"
| "safe center"
| "unsafe center";
export type ResponsiveAlignItemsValue = ResponsiveValue<AlignItemsValue>;
export interface AlignItemsProps {
align?: ResponsiveAlignItemsValue;
alignItems?: ResponsiveAlignItemsValue;
}
export function alignItems(...args: any[]): any;
export type JustifyContentValue =
| "center"
| "start"
| "end"
| "flex-start"
| "flex-end"
| "left"
| "right"
| "baseline"
| "first baseline"
| "last baseline"
| "space-between"
| "space-around"
| "space-evenly"
| "stretch"
| "safe center"
| "unsafe center";
export type ResponsiveJustifyContentValue = ResponsiveValue<
JustifyContentValue
>;
export interface JustifyContentProps {
justify?: ResponsiveJustifyContentValue;
justifyContent?: ResponsiveJustifyContentValue;
}
export function justifyContent(...args: any[]): any;
export type FlexWrapValue = true | "nowrap" | "wrap" | "wrap-reverse";
export interface FlexWrapProps {
flexWrap?: FlexWrapValue;
}
export function flexWrap(...args: any[]): any;
export type FlexDirectionValue =
| GlobalStyleValues
| "row"
| "row-reverse"
| "column"
| "column-reverse";
export type ResponsiveFlexDirectionValue = ResponsiveValue<FlexDirectionValue>;
export interface FlexDirectionProps {
flexDirection?: ResponsiveFlexDirectionValue;
}
export function flexDirection(...args: any[]): any;
export type FlexValue = number | string;
export type ResponsiveFlexValue = ResponsiveValue<FlexValue>;
export interface FlexProps {
flex?: ResponsiveFlexValue;
}
export function flex(...args: any[]): any;
export type AlignContentValue =
| GlobalStyleValues
| "center"
| "start"
| "end"
| "flex-start"
| "flex-end"
| "normal"
| "baseline"
| "first baseline"
| "last baseline"
| "space-between"
| "space-around"
| "space-evenly"
| "stretch"
| "safe center"
| "unsafe center";
export type ResponsiveAlignContentValue = ResponsiveValue<AlignContentValue>;
export interface AlignContentProps {
alignContent?: ResponsiveAlignItemsValue;
}
export function alignContent(...args: any[]): any;
export type JustifySelfValue =
| GlobalStyleValues
| "auto"
| "normal"
| "stretch"
| "center"
| "start"
| "end"
| "flex-start"
| "flex-end"
| "self-start"
| "self-end"
| "left"
| "right"
| "baseline"
| "first baseline"
| "last baseline"
| "safe center"
| "unsafe center";
export type ResponsiveJustifySelfValue = ResponsiveValue<JustifySelfValue>;
export interface JustifySelfProps {
justifySelf?: ResponsiveJustifySelfValue;
}
export function justifySelf(...args: any[]): any;
export type AlignSelfValue =
| "auto"
| "normal"
| "center"
| "start"
| "end"
| "self-start"
| "self-end"
| "flex-start"
| "flex-end"
| "left"
| "right"
| "baseline"
| "first baseline"
| "last baseline"
| "stretch"
| "safe center"
| "unsafe center";
export type ResponsiveAlignSelfValue = ResponsiveValue<AlignSelfValue>;
export interface AlignSelfProps {
alignSelf?: ResponsiveAlignSelfValue;
}
export function alignSelf(...args: any[]): any;
export type OrderValue = GlobalStyleValues | number;
export type ResponsiveOrderValue = ResponsiveValue<OrderValue>;
export interface OrderProps {
order?: ResponsiveOrderValue;
}
export function order(...args: any[]): any;
export type FlexBasisValue =
| GlobalStyleValues
| "auto"
| "fill"
| "max-content"
| "min-content"
| "fit-content"
| "content";
export interface FlexBasisProps {
// TODO: The FlexBasisValue currently really only exists for documentation
// purposes, because flex-basis also accepts `Nem` and `Npx` strings.
// Not sure there’s a way to still have the union values show up as
// auto-completion results.
flexBasis?: FlexBasisValue | string;
}
export function flexBasis(...args: any[]): any;
/**
* Grid Layout
*/
// TODO: Add grid values
/**
* Background
*/
export type BackgroundValue = string;
export interface BackgroundProps {
background?: BackgroundValue;
bg?: BackgroundValue;
}
export function background(...args: any[]): any;
export type BackgroundImageValue = string;
export interface BackgroundImageProps {
/**
* Value will be wrapped in url()
*/
backgroundImage?: BackgroundImageValue;
}
export function backgroundImage(...args: any[]): any;
export type BackgroundSizeValue = string;
export interface BackgroundSizeProps {
backgroundSize?: BackgroundSizeValue;
}
export function backgroundSize(...args: any[]): any;
export type BackgroundPositionValue = string;
export interface BackgroundPositionProps {
backgroundPosition?: BackgroundPositionValue;
}
export function backgroundPosition(...args: any[]): any;
export type BackgroundRepeatValue = string;
export interface BackgroundRepeatProps {
backgroundRepeat?: BackgroundRepeatValue;
}
export function backgroundRepeat(...args: any[]): any;
/**
* Misc
*/
export type BorderRadiusValue = string | number;
export interface BorderRadiusProps {
borderRadius?: BorderRadiusValue;
}
export function borderRadius(...args: any[]): any;
export type BorderColorValue = string;
export interface BorderColorProps {
borderColor?: BorderColorValue;
}
export function borderColor(...args: any[]): any;
export type BorderValue = string | number;
export type ResponsiveBorderValue = ResponsiveValue<BorderValue>;
export interface BorderProps {
border?: ResponsiveBorderValue;
borderTop?: ResponsiveBorderValue;
borderRight?: ResponsiveBorderValue;
borderBottom?: ResponsiveBorderValue;
borderLeft?: ResponsiveBorderValue;
}
export function borders(...args: any[]): any;
export type BoxShadowValue = string | number;
export interface BoxShadowProps {
boxShadow?: BoxShadowValue;
}
export function boxShadow(...arg: any[]): any;
/**
* Position
*/
export type PositionValue =
| "static"
| "relative"
| "absolute"
| "sticky"
| "fixed";
export type ResponsivePositionValue = ResponsiveValue<PositionValue>;
export interface PositionProps {
position?: ResponsivePositionValue;
}
export function position(...args: any[]): any;
export type ZIndexValue = GlobalStyleValues | "auto" | number;
export interface ZIndexProps {
zIndex?: ZIndexValue;
}
export function zIndex(...args: any[]): any;
export type TopValue = string | number;
export type ResponsiveTopValue = ResponsiveValue<TopValue>;
export interface TopProps {
top?: ResponsiveTopValue;
}
export function top(...args: any[]): any;
export type RightValue = string | number;
export type ResponsiveRightValue = ResponsiveValue<RightValue>;
export interface RightProps {
right?: ResponsiveRightValue;
}
export function right(...args: any[]): any;
export type BottomValue = string | number;
export type ResponsiveBottomValue = ResponsiveValue<BottomValue>;
export interface BottomProps {
bottom?: ResponsiveBottomValue;
}
export function bottom(...args: any[]): any;
export type LeftValue = string | number;
export type ResponsiveLeftValue = ResponsiveValue<LeftValue>;
export interface LeftProps {
left?: ResponsiveLeftValue;
}
export function left(...args: any[]): any;
/**
* Pseudo-classes
*/
export interface PseudoStyleValue {
color?: ColorValue;
backgroundColor?: ColorValue;
borderColor?: BorderColorValue;
boxShadow?: BoxShadowValue;
textDecoration?: string;
}
export type HoverValue = PseudoStyleValue;
export interface HoverProps {
hover?: HoverValue;
}
export function hover(...args: any[]): any;
export type FocusValue = PseudoStyleValue;
export interface FocusProps {
focus?: FocusValue;
}
export function focus(...args: any[]): any;
export type ActiveValue = PseudoStyleValue;
export interface ActiveProps {
active?: ActiveValue;
}
export function active(...args: any[]): any;
export type DisabledValue = PseudoStyleValue;
export interface DisabledProps {
disabledStyle?: DisabledValue;
}
export function disabled(...args: any[]): any;
/**
* Utilities
*/
export function theme(keys: string): any;
export function themeGet(keys: string, fallback?: string): any;
export function cleanElement(component: any): any;
export function removeProps(props: any): any;
/**
* Low-level style export functions
*/
export interface LowLevelStylefunctionArguments {
prop: string;
cssProperty?: string;
key?: string;
numberToPx?: boolean;
alias?: string;
getter?: () => any;
}
export function style(args: LowLevelStylefunctionArguments): any;
export function responsiveStyle(args: LowLevelStylefunctionArguments): any;
export function pseudoStyle(args: LowLevelStylefunctionArguments): any;
+6
View File
@@ -0,0 +1,6 @@
{
"private": true,
"dependencies": {
"styled-components": "^3.3.2"
}
}
+351
View File
@@ -0,0 +1,351 @@
// Example uses styled-components, but styled-system works with most other css-in-js libraries as well
import * as React from "react";
import styled from "styled-components";
import {
themeGet,
space,
width,
fontSize,
color,
fontFamily,
display,
SpaceProps,
WidthProps,
ColorProps,
DisplayProps,
FontSizeProps,
FontFamilyProps,
textAlign,
TextAlignProps,
background,
BackgroundProps,
maxWidth,
MaxWidthProps,
lineHeight,
LineHeightProps,
FontWeightProps,
fontWeight,
letterSpacing,
LetterSpacingProps,
minWidth,
MinWidthProps,
HeightProps,
height,
MaxHeightProps,
maxHeight,
minHeight,
MinHeightProps,
size,
SizeProps,
RatioProps,
ratio,
alignItems,
AlignItemsProps,
AlignContentProps,
alignContent,
justifyContent,
JustifyContentProps,
FlexWrapProps,
flexWrap,
flexBasis,
FlexBasisProps,
borderColor,
BorderColorProps,
flexDirection,
FlexDirectionProps,
flex,
FlexProps,
justifySelf,
JustifySelfProps,
alignSelf,
AlignSelfProps,
borders,
BorderProps,
borderRadius,
BorderRadiusProps,
position,
PositionProps,
zIndex,
ZIndexProps,
top,
bottom,
left,
right,
TopProps,
BottomProps,
LeftProps,
RightProps,
boxShadow,
BoxShadowProps,
backgroundImage,
backgroundPosition,
backgroundRepeat,
backgroundSize,
BackgroundImageProps,
BackgroundPositionProps,
BackgroundRepeatProps,
BackgroundSizeProps,
hover,
HoverProps,
focus,
FocusProps,
active,
ActiveProps,
disabled,
DisabledProps
} from "styled-system";
interface BoxProps
extends SpaceProps,
WidthProps,
FontSizeProps,
ColorProps,
DisplayProps,
BackgroundProps,
MaxWidthProps,
MinWidthProps,
HeightProps,
MaxHeightProps,
MinHeightProps,
SizeProps,
RatioProps,
BorderColorProps,
FlexProps,
JustifySelfProps,
AlignSelfProps,
BorderProps,
BorderRadiusProps,
PositionProps,
ZIndexProps,
TopProps,
BottomProps,
LeftProps,
RightProps,
BoxShadowProps,
BackgroundImageProps,
BackgroundPositionProps,
BackgroundRepeatProps,
BackgroundSizeProps,
HoverProps,
FocusProps,
ActiveProps,
DisabledProps {}
const Box = styled.div.attrs<BoxProps>({})`
border-radius: ${themeGet("radii.small", "4px")};
${space}
${width}
${fontSize}
${color}
${display}
${background}
${maxWidth}
${minWidth}
${height}
${maxHeight}
${minHeight}
${size}
${ratio}
${borderColor}
${flex}
${justifySelf}
${alignSelf}
${borders}
${borderRadius}
${position}
${zIndex}
${top}
${bottom}
${left}
${right}
${boxShadow}
${backgroundImage}
${backgroundPosition}
${backgroundRepeat}
${backgroundSize}
${hover}
${focus}
${active}
${disabled}
`;
interface TextProps
extends FontSizeProps,
FontFamilyProps,
TextAlignProps,
LineHeightProps,
FontWeightProps,
LetterSpacingProps {}
const Text = styled.div.attrs<TextProps>({})`
${fontSize};
${fontFamily};
${textAlign};
${lineHeight};
${fontWeight};
${letterSpacing};
`;
interface FlexComponentProps
extends AlignItemsProps,
AlignContentProps,
JustifyContentProps,
FlexWrapProps,
FlexBasisProps,
FlexDirectionProps {}
const Flex = styled.div.attrs<FlexComponentProps>({})`
${alignItems};
${alignContent};
${justifyContent};
${flexWrap};
${flexBasis};
${flexDirection};
`;
const test = () => (
<div>
// width: 50%
<Box width={1 / 2} />
// font-size: 20px (theme.fontSizes[4])
<Box fontSize={4} />
// margin: 16px (theme.space[2])
<Box m={2} />
// padding: 32px (theme.space[3])
<Box p={3} />
// color
<Box color="tomato" />
// color: #333 (theme.colors.gray[0])
<Box color="grays.0" />
// background color
<Box bg="tomato" />
// responsive width
<Box width={[1, 1 / 2, 1 / 4]} />
// responsive font-size
<Box fontSize={[2, 3, 4]} />
// responsive margin
<Box m={[1, 2, 3]} />
// responsive padding
<Box p={[1, 2, 3]} />
// examples (margin prop) // sets margin value of `theme.space[2]`
<Box m={2} />
// sets margin value of `-1 * theme.space[2]`
<Box m={-2} />
// sets a margin value of `16px` since it's greater than
`theme.space.length`
<Box m={16} />
// sets margin `'auto'`
<Box m="auto" />
// sets margin `8px` on all viewports and `16px` from the smallest
breakpoint and up
<Box m={[1, 2]} />
// examples // width `50%`
<Box width={1 / 2} />
// width `256px`
<Box width={256} />
// width `'2em'`
<Box width="2em" />
// width `100%` on all viewports and `50%` from the smallest breakpoint
and up
<Box width={[1, 1 / 2]} />
// examples // font-size of `theme.fontSizes[3]`
<Text fontSize={3} />
// font-size `32px`
<Text fontSize={32} />
// font-size `'2em'`
<Text fontSize="2em" />
// font-size `10px` on all viewports and `12px` from the smallest
breakpoint and up
<Text fontSize={[10, 12]} />
// examples // picks the value defined in `theme.colors['blue']`
<Box color="blue" />
// picks up a nested color value using dot notation //
`theme.colors['gray'][0]`
<Box color="gray.0" />
// raw CSS color value
<Box color="#f00" />
// fontFamily
<Text fontFamily="mono" />
// textAlign (responsive)
<Text textAlign="center" />
<Text textAlign={["center", "left"]} />
// lineHeight
<Text lineHeight="1.25" />
// fontWeight
<Text fontWeight="bold" />
// letterSpacing
<Text letterSpacing="0.1em" />
// display (responsive)
<Box display="inline-block" />
<Box display={["block", "inline-block"]} />
// maxWidth (responsive)
<Box maxWidth={1024} />
<Box maxWidth={[768, null, null, 1024]} />
// minWidth (responsive)
<Box minWidth={128} />
<Box minWidth={[96, 128]} />
// height (responsive)
<Box height={64} />
<Box height={[48, 64]} />
// maxHeight (responsive)
<Box maxHeight={512} />
<Box maxHeight={[384, 512]} />
// minHeight (responsive)
<Box minHeight={512} />
<Box minHeight={[384, 512]} />
// size (responsive, width & height)
<Box size={32} />
<Box size={[32, 48]} />
// ratio (height: 0 & paddingBottom)
<Box ratio={3 / 4} />
// alignItems (responsive)
<Flex alignItems="center" />
// alignContent (responsive)
<Flex alignContent="center" />
// justifyContent (responsive)
<Flex justifyContent="center" />
// flexWrap (responsive)
<Flex flexWrap="wrap" />
// flexBasis (responsive)
<Flex flexBasis="auto" />
// flexDirection (responsive)
<Flex flexDirection="column" />
// flex (responsive)
<Box flex="1 1 auto" />
// justifySelf (responsive)
<Box justifySelf="center" />
// alignSelf (responsive)
<Box alignSelf="center" />
<Box border="1px solid" />
<Box borderTop="1px solid" />
<Box borderRight="1px solid" />
<Box borderBottom="1px solid" />
<Box borderLeft="1px solid" />
// borderColor
<Box borderColor="blue" />
// borderRadius
<Box borderRadius={4} />
// position (responsive)
<Box position="absolute" />
// zIndex
<Box zIndex={2} />
// top, right, bottom, left (responsive)
<Box top="0" right="0" bottom="0" left="0" />
// boxShadow
<Box boxShadow={1} />
// backgroundImage, backgroundSize, backgroundPosition, backgroundRepeat
<Box
backgroundImage="kitten.png"
backgroundSize="cover"
backgroundPosition="center"
backgroundRepeat="repeat-x"
/>
<Box
hover={{
textDecoration: "underline",
color: "blue"
}}
/>
<Box focus={{ color: "blue" }} />
<Box active={{ color: "navy" }} />
<Box disabledStyle={{ color: "gray" }} />
</div>
);
+17
View File
@@ -0,0 +1,17 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es6"],
"jsx": "react",
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": ["../"],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": ["index.d.ts", "styled-system-tests.tsx"]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+1
View File
@@ -33,6 +33,7 @@ export * from "./three-effectcomposer";
export * from "./three-examples";
export * from "./three-fbxloader";
export * from "./three-FirstPersonControls";
export * from "./three-gltfexporter";
export * from "./three-maskpass";
export * from "./three-mtlloader";
export * from "./three-objloader";
+9
View File
@@ -0,0 +1,9 @@
import { Object3D } from "three";
export class GLTFExporter {
constructor();
parse(input: Object3D, onCompleted: (gltf: object) => void, options: object): null;
}
+3 -3
View File
@@ -24,7 +24,7 @@ declare module 'twit' {
*/
export interface Contributors {
id: number,
id_str: number,
id_str: string,
screen_name: string,
}
@@ -169,7 +169,7 @@ declare module 'twit' {
created_at: string,
current_user_retweet?: {
id: number,
id_str: number,
id_str: string,
},
entities: Entities,
favorite_count?: number,
@@ -257,7 +257,7 @@ declare module 'twit' {
id?: string,
slug?: string,
status?: string,
user_id?: number,
user_id?: number | string,
lat?: number,
long?: number,
follow?: boolean,
+2 -1
View File
@@ -62,7 +62,7 @@ declare class USBAlternateInterface {
readonly interfaceClass: number;
readonly interfaceSubclass: number;
readonly interfaceProtocol: number;
readonly alternatinterfaceName?: string;
readonly interfaceName?: string;
readonly endpoints: USBEndpoint[];
}
@@ -146,6 +146,7 @@ declare class USBDevice {
transferOut(endpointNumber: number, data: BufferSource): Promise<USBOutTransferResult>;
isochronousTransferIn(endpointNumber: number, packetLengths: number[]): Promise<USBIsochronousInTransferResult>;
isochronousTransferOut(endpointNumber: number, data: BufferSource, packetLengths: number[]): Promise<USBIsochronousOutTransferResult>;
reset(): Promise<void>;
}
interface Navigator {
+1
View File
@@ -43,6 +43,7 @@ navigator.usb.addEventListener('disconnect', evt => {
});
async function handleConnectedDevice(device: USBDevice) {
await device.reset();
connectedDevices.push(device);
await device.open();
+2 -1
View File
@@ -1,6 +1,7 @@
// Type definitions for webpack-serve 1.0
// Project: https://github.com/webpack-contrib/webpack-serve
// Definitions by: Ryan Clark <https://github.com/rynclark>
// Jokcy <https://github.com/Jokcy>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -21,7 +22,7 @@ declare module 'webpack' {
}
declare function WebpackServe(
{ config }: { config: webpack.Configuration }
options: WebpackServe.Options
): Promise<WebpackServe.Instance>;
declare namespace WebpackServe {
+39 -11
View File
@@ -1,19 +1,25 @@
import webpack = require('webpack');
import serve = require('webpack-serve');
const compiler = webpack();
const config: webpack.Configuration = {
mode: 'development',
entry: ['index.js'], // when use compiler entry must be array or object
};
const serveConfig = {
http2: true,
dev: {
publicPath: '/',
logLevel: 'info'
},
host: 'localhost'
};
const compiler = webpack(config);
const server = serve({
config: {
serve: {
http2: true,
dev: {
publicPath: '/',
logLevel: 'info'
},
host: 'localhost'
},
},
compiler,
...serveConfig
});
server
@@ -22,3 +28,25 @@ server
server.close();
});
});
const config2: webpack.Configuration = {
...config,
serve: {
...serveConfig,
port: 8888,
hot: {
port: 8889
}
},
};
const server2 = serve({
config: config2
});
server2
.then((server) => {
server.on('listening', () => {
server.close();
});
});
+26 -59
View File
@@ -61,24 +61,22 @@ declare namespace webpack {
/** Like resolve but for loaders. */
resolveLoader?: ResolveLoader;
/**
* Specify dependencies that shouldn’t be resolved by webpack, but should become dependencies of the resulting bundle.
* The kind of the dependency depends on output.libraryTarget.
* Specify dependencies that shouldn’t be resolved by webpack, but should become dependencies of the resulting bundle.
* The kind of the dependency depends on output.libraryTarget.
*/
externals?: ExternalsElement | ExternalsElement[];
/**
* <ul>
* <li>"web" Compile for usage in a browser-like environment (default)</li>
* <li>"webworker" Compile as WebWorker</li>
* <li>"node" Compile for usage in a node.js-like environment (use require to load chunks)</li>
* <li>"async-node" Compile for usage in a node.js-like environment (use fs and vm to load chunks async)</li>
* <li>"node-webkit" Compile for usage in webkit, uses jsonp chunk loading but also supports builtin node.js modules plus require(“nw.gui”) (experimental)</li>
* <li>"atom" Compile for usage in electron (formerly known as atom-shell), supports require for modules necessary to run Electron.</li>
* <li>"electron-renderer" Compile for Electron for renderer process, providing a target using JsonpTemplatePlugin, FunctionModulePlugin
* for browser environments and NodeTargetPlugin and ExternalsPlugin for CommonJS and Electron built-in modules.<li>
* <li>"electron-main" Compile for Electron for main process.</li>
* <li>"atom" Alias for electron-main</li>
* <li>"electron" Alias for electron-main</li>
* <ul>
* - "web" Compile for usage in a browser-like environment (default).
* - "webworker" Compile as WebWorker.
* - "node" Compile for usage in a node.js-like environment (use require to load chunks).
* - "async-node" Compile for usage in a node.js-like environment (use fs and vm to load chunks async).
* - "node-webkit" Compile for usage in webkit, uses jsonp chunk loading but also supports builtin node.js modules plus require(“nw.gui”) (experimental)
* - "atom" Compile for usage in electron (formerly known as atom-shell), supports require for modules necessary to run Electron.
* - "electron-renderer" Compile for Electron for renderer process, providing a target using JsonpTemplatePlugin, FunctionModulePlugin for browser
* environments and NodeTargetPlugin and ExternalsPlugin for CommonJS and Electron built-in modules.
* - "electron-main" Compile for Electron for main process.
* - "atom" Alias for electron-main.
* - "electron" Alias for electron-main.
*/
target?: 'web' | 'webworker' | 'node' | 'async-node' | 'node-webkit' | 'atom' | 'electron' | 'electron-renderer' | 'electron-main' | ((compiler?: any) => void);
/** Report the first error as a hard error instead of tolerating it. */
@@ -171,17 +169,15 @@ declare namespace webpack {
library?: string | string[];
/**
* Which format to export the library:
* <ul>
* <li>"var" - Export by setting a variable: var Library = xxx (default)</li>
* <li>"this" - Export by setting a property of this: this["Library"] = xxx</li>
* <li>"commonjs" - Export by setting a property of exports: exports["Library"] = xxx</li>
* <li>"commonjs2" - Export by setting module.exports: module.exports = xxx</li>
* <li>"amd" - Export to AMD (optionally named)</li>
* <li>"umd" - Export to AMD, CommonJS2 or as property in root</li>
* <li>"window" - Assign to window</li>
* <li>"assign" - Assign to a global variable</li>
* <li>"jsonp" - Generate Webpack JSONP module<li>
* </ul>
* - "var" - Export by setting a variable: var Library = xxx (default)
* - "this" - Export by setting a property of this: this["Library"] = xxx
* - "commonjs" - Export by setting a property of exports: exports["Library"] = xxx
* - "commonjs2" - Export by setting module.exports: module.exports = xxx
* - "amd" - Export to AMD (optionally named)
* - "umd" - Export to AMD, CommonJS2 or as property in root
* - "window" - Assign to window
* - "assign" - Assign to a global variable
* - "jsonp" - Generate Webpack JSONP module
*/
libraryTarget?: 'var' | 'this' | 'commonjs' | 'commonjs2' | 'amd' | 'umd' | 'window' | 'assign' | 'jsonp';
/** Configure which module or modules will be exposed via the `libraryTarget` */
@@ -955,42 +951,9 @@ declare namespace webpack {
usedModuleIds: any;
getStats(): Stats;
addModule(module: CompilationModule, cacheGroup: any): any;
// getModule(module)
// findModule(identifier)
// waitForBuildingFinished(module, callback)
// buildModule(module, optional, origin, dependencies, thisCallback)
// processModuleDependencies(module, callback)
// addModuleDependencies(module, dependencies, bail, cacheGroup, recursive, callback)
// tslint:disable-next-line:ban-types
addEntry(context: any, entry: any, name: any, callback: Function): void;
// prefetch(context, dependency, callback)
// rebuildModule(module, thisCallback)
// finish()
// unseal()
// seal(callback)
// sortModules(modules)
// reportDependencyErrorsAndWarnings(module, blocks)
// addChunkInGroup(name, module, loc, request)
// addChunk(name)
// assignIndex(module)
// assignDepth(module)
// processDependenciesBlocksForChunkGroups(inputChunkGroups)
// removeReasonsOfDependencyBlock(module, block)
// patchChunksAfterReasonRemoval(module, chunk)
// removeChunkFromDependencies(block, chunk)
// applyModuleIds()
// applyChunkIds()
// sortItemsWithModuleIds()
// sortItemsWithChunkIds()
// summarizeDependencies()
// createHash()
// modifyHash(update)
// createModuleAssets()
// createChunkAssets()
getPath(filename: string, data: {hash?: any, chunk?: any, filename?: string, basename?: string, query?: any}): string;
// createChildCompiler(name, outputOptions, plugins)
// checkConstraints()
/**
* @deprecated Compilation.applyPlugins is deprecated. Use new API on `.hooks` instead
*/
@@ -1131,10 +1094,14 @@ declare namespace webpack {
| 'verbose';
interface ToJsonOptionsObject {
/** fallback value for stats options when an option is not defined (has precedence over local webpack defaults) */
all?: boolean;
/** Add asset Information */
assets?: boolean;
/** Sort assets by a field */
assetsSort?: string;
/** Add built at time information */
builtAt?: boolean;
/** Add information about cached (not built) modules */
cached?: boolean;
/** Show cached assets (setting this to `false` only shows emitted files) */
+1
View File
@@ -383,6 +383,7 @@ webpack({
const jsonStatsWithAllOptions = stats.toJson({
assets: true,
assetsSort: "field",
builtAt: true,
cached: true,
children: true,
chunks: true,