new license file version [CI SKIP]
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
# es-array-method-boxes-properly
|
||||
|
||||
Utility package to determine if an `Array.prototype` method properly boxes the callback's receiver and third argument.
|
||||
@@ -0,0 +1,23 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2012-2014 TJ Holowaychuk <tj@vision-media.ca>
|
||||
Copyright (c) 2015 Jed Watson <jed.watson@me.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -0,0 +1,216 @@
|
||||
var common = require('./common');
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
|
||||
var PERMS = (function (base) {
|
||||
return {
|
||||
OTHER_EXEC: base.EXEC,
|
||||
OTHER_WRITE: base.WRITE,
|
||||
OTHER_READ: base.READ,
|
||||
|
||||
GROUP_EXEC: base.EXEC << 3,
|
||||
GROUP_WRITE: base.WRITE << 3,
|
||||
GROUP_READ: base.READ << 3,
|
||||
|
||||
OWNER_EXEC: base.EXEC << 6,
|
||||
OWNER_WRITE: base.WRITE << 6,
|
||||
OWNER_READ: base.READ << 6,
|
||||
|
||||
// Literal octal numbers are apparently not allowed in "strict" javascript.
|
||||
STICKY: parseInt('01000', 8),
|
||||
SETGID: parseInt('02000', 8),
|
||||
SETUID: parseInt('04000', 8),
|
||||
|
||||
TYPE_MASK: parseInt('0770000', 8),
|
||||
};
|
||||
}({
|
||||
EXEC: 1,
|
||||
WRITE: 2,
|
||||
READ: 4,
|
||||
}));
|
||||
|
||||
common.register('chmod', _chmod, {
|
||||
});
|
||||
|
||||
//@
|
||||
//@ ### chmod([options,] octal_mode || octal_string, file)
|
||||
//@ ### chmod([options,] symbolic_mode, file)
|
||||
//@
|
||||
//@ Available options:
|
||||
//@
|
||||
//@ + `-v`: output a diagnostic for every file processed//@
|
||||
//@ + `-c`: like verbose, but report only when a change is made//@
|
||||
//@ + `-R`: change files and directories recursively//@
|
||||
//@
|
||||
//@ Examples:
|
||||
//@
|
||||
//@ ```javascript
|
||||
//@ chmod(755, '/Users/brandon');
|
||||
//@ chmod('755', '/Users/brandon'); // same as above
|
||||
//@ chmod('u+x', '/Users/brandon');
|
||||
//@ chmod('-R', 'a-w', '/Users/brandon');
|
||||
//@ ```
|
||||
//@
|
||||
//@ Alters the permissions of a file or directory by either specifying the
|
||||
//@ absolute permissions in octal form or expressing the changes in symbols.
|
||||
//@ This command tries to mimic the POSIX behavior as much as possible.
|
||||
//@ Notable exceptions:
|
||||
//@
|
||||
//@ + In symbolic modes, `a-r` and `-r` are identical. No consideration is
|
||||
//@ given to the `umask`.
|
||||
//@ + There is no "quiet" option, since default behavior is to run silent.
|
||||
function _chmod(options, mode, filePattern) {
|
||||
if (!filePattern) {
|
||||
if (options.length > 0 && options.charAt(0) === '-') {
|
||||
// Special case where the specified file permissions started with - to subtract perms, which
|
||||
// get picked up by the option parser as command flags.
|
||||
// If we are down by one argument and options starts with -, shift everything over.
|
||||
[].unshift.call(arguments, '');
|
||||
} else {
|
||||
common.error('You must specify a file.');
|
||||
}
|
||||
}
|
||||
|
||||
options = common.parseOptions(options, {
|
||||
'R': 'recursive',
|
||||
'c': 'changes',
|
||||
'v': 'verbose',
|
||||
});
|
||||
|
||||
filePattern = [].slice.call(arguments, 2);
|
||||
|
||||
var files;
|
||||
|
||||
// TODO: replace this with a call to common.expand()
|
||||
if (options.recursive) {
|
||||
files = [];
|
||||
filePattern.forEach(function addFile(expandedFile) {
|
||||
var stat = common.statNoFollowLinks(expandedFile);
|
||||
|
||||
if (!stat.isSymbolicLink()) {
|
||||
files.push(expandedFile);
|
||||
|
||||
if (stat.isDirectory()) { // intentionally does not follow symlinks.
|
||||
fs.readdirSync(expandedFile).forEach(function (child) {
|
||||
addFile(expandedFile + '/' + child);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
files = filePattern;
|
||||
}
|
||||
|
||||
files.forEach(function innerChmod(file) {
|
||||
file = path.resolve(file);
|
||||
if (!fs.existsSync(file)) {
|
||||
common.error('File not found: ' + file);
|
||||
}
|
||||
|
||||
// When recursing, don't follow symlinks.
|
||||
if (options.recursive && common.statNoFollowLinks(file).isSymbolicLink()) {
|
||||
return;
|
||||
}
|
||||
|
||||
var stat = common.statFollowLinks(file);
|
||||
var isDir = stat.isDirectory();
|
||||
var perms = stat.mode;
|
||||
var type = perms & PERMS.TYPE_MASK;
|
||||
|
||||
var newPerms = perms;
|
||||
|
||||
if (isNaN(parseInt(mode, 8))) {
|
||||
// parse options
|
||||
mode.split(',').forEach(function (symbolicMode) {
|
||||
var pattern = /([ugoa]*)([=\+-])([rwxXst]*)/i;
|
||||
var matches = pattern.exec(symbolicMode);
|
||||
|
||||
if (matches) {
|
||||
var applyTo = matches[1];
|
||||
var operator = matches[2];
|
||||
var change = matches[3];
|
||||
|
||||
var changeOwner = applyTo.indexOf('u') !== -1 || applyTo === 'a' || applyTo === '';
|
||||
var changeGroup = applyTo.indexOf('g') !== -1 || applyTo === 'a' || applyTo === '';
|
||||
var changeOther = applyTo.indexOf('o') !== -1 || applyTo === 'a' || applyTo === '';
|
||||
|
||||
var changeRead = change.indexOf('r') !== -1;
|
||||
var changeWrite = change.indexOf('w') !== -1;
|
||||
var changeExec = change.indexOf('x') !== -1;
|
||||
var changeExecDir = change.indexOf('X') !== -1;
|
||||
var changeSticky = change.indexOf('t') !== -1;
|
||||
var changeSetuid = change.indexOf('s') !== -1;
|
||||
|
||||
if (changeExecDir && isDir) {
|
||||
changeExec = true;
|
||||
}
|
||||
|
||||
var mask = 0;
|
||||
if (changeOwner) {
|
||||
mask |= (changeRead ? PERMS.OWNER_READ : 0) + (changeWrite ? PERMS.OWNER_WRITE : 0) + (changeExec ? PERMS.OWNER_EXEC : 0) + (changeSetuid ? PERMS.SETUID : 0);
|
||||
}
|
||||
if (changeGroup) {
|
||||
mask |= (changeRead ? PERMS.GROUP_READ : 0) + (changeWrite ? PERMS.GROUP_WRITE : 0) + (changeExec ? PERMS.GROUP_EXEC : 0) + (changeSetuid ? PERMS.SETGID : 0);
|
||||
}
|
||||
if (changeOther) {
|
||||
mask |= (changeRead ? PERMS.OTHER_READ : 0) + (changeWrite ? PERMS.OTHER_WRITE : 0) + (changeExec ? PERMS.OTHER_EXEC : 0);
|
||||
}
|
||||
|
||||
// Sticky bit is special - it's not tied to user, group or other.
|
||||
if (changeSticky) {
|
||||
mask |= PERMS.STICKY;
|
||||
}
|
||||
|
||||
switch (operator) {
|
||||
case '+':
|
||||
newPerms |= mask;
|
||||
break;
|
||||
|
||||
case '-':
|
||||
newPerms &= ~mask;
|
||||
break;
|
||||
|
||||
case '=':
|
||||
newPerms = type + mask;
|
||||
|
||||
// According to POSIX, when using = to explicitly set the
|
||||
// permissions, setuid and setgid can never be cleared.
|
||||
if (common.statFollowLinks(file).isDirectory()) {
|
||||
newPerms |= (PERMS.SETUID + PERMS.SETGID) & perms;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
common.error('Could not recognize operator: `' + operator + '`');
|
||||
}
|
||||
|
||||
if (options.verbose) {
|
||||
console.log(file + ' -> ' + newPerms.toString(8));
|
||||
}
|
||||
|
||||
if (perms !== newPerms) {
|
||||
if (!options.verbose && options.changes) {
|
||||
console.log(file + ' -> ' + newPerms.toString(8));
|
||||
}
|
||||
fs.chmodSync(file, newPerms);
|
||||
perms = newPerms; // for the next round of changes!
|
||||
}
|
||||
} else {
|
||||
common.error('Invalid symbolic mode change: ' + symbolicMode);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// they gave us a full number
|
||||
newPerms = type + parseInt(mode, 8);
|
||||
|
||||
// POSIX rules are that setuid and setgid can only be added using numeric
|
||||
// form, but not cleared.
|
||||
if (common.statFollowLinks(file).isDirectory()) {
|
||||
newPerms |= (PERMS.SETUID + PERMS.SETGID) & perms;
|
||||
}
|
||||
|
||||
fs.chmodSync(file, newPerms);
|
||||
}
|
||||
});
|
||||
return '';
|
||||
}
|
||||
module.exports = _chmod;
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"combineLatestWith.js","sourceRoot":"","sources":["../../../../src/internal/operators/combineLatestWith.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AA0ChD,MAAM,UAAU,iBAAiB;IAC/B,sBAA6C;SAA7C,UAA6C,EAA7C,qBAA6C,EAA7C,IAA6C;QAA7C,iCAA6C;;IAE7C,OAAO,aAAa,wCAAI,YAAY,IAAE;AACxC,CAAC"}
|
||||
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (C) 2013-2017 Mariusz Nowak (www.medikoo.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
@@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
"#": require("./#"),
|
||||
"ensureTimeValue": require("./ensure-time-value"),
|
||||
"isDate": require("./is-date"),
|
||||
"isTimeValue": require("./is-time-value"),
|
||||
"validDate": require("./valid-date")
|
||||
};
|
||||
@@ -0,0 +1,21 @@
|
||||
import { isFunction } from "./isFunction.js";
|
||||
const isAsyncIterable = (value) => (isFunction(value[Symbol.asyncIterator]));
|
||||
async function* readStream(readable) {
|
||||
const reader = readable.getReader();
|
||||
while (true) {
|
||||
const { done, value } = await reader.read();
|
||||
if (done) {
|
||||
break;
|
||||
}
|
||||
yield value;
|
||||
}
|
||||
}
|
||||
export const getStreamIterator = (source) => {
|
||||
if (isAsyncIterable(source)) {
|
||||
return source;
|
||||
}
|
||||
if (isFunction(source.getReader)) {
|
||||
return readStream(source);
|
||||
}
|
||||
throw new TypeError("Unsupported data source: Expected either ReadableStream or async iterable.");
|
||||
};
|
||||
@@ -0,0 +1,21 @@
|
||||
'use strict'
|
||||
|
||||
const tape = require('tape')
|
||||
const { BufferList, BufferListStream } = require('../')
|
||||
const { Buffer } = require('buffer')
|
||||
|
||||
tape('convert from BufferList to BufferListStream', (t) => {
|
||||
const data = Buffer.from(`TEST-${Date.now()}`)
|
||||
const bl = new BufferList(data)
|
||||
const bls = new BufferListStream(bl)
|
||||
t.ok(bl.slice().equals(bls.slice()))
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('convert from BufferListStream to BufferList', (t) => {
|
||||
const data = Buffer.from(`TEST-${Date.now()}`)
|
||||
const bls = new BufferListStream(data)
|
||||
const bl = new BufferList(bls)
|
||||
t.ok(bl.slice().equals(bls.slice()))
|
||||
t.end()
|
||||
})
|
||||
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"Commands:": "Comandos:",
|
||||
"Options:": "Opciones:",
|
||||
"Examples:": "Ejemplos:",
|
||||
"boolean": "booleano",
|
||||
"count": "cuenta",
|
||||
"string": "cadena de caracteres",
|
||||
"number": "número",
|
||||
"array": "tabla",
|
||||
"required": "requerido",
|
||||
"default": "defecto",
|
||||
"default:": "defecto:",
|
||||
"choices:": "selección:",
|
||||
"aliases:": "alias:",
|
||||
"generated-value": "valor-generado",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "Hacen falta argumentos no-opcionales: Número recibido %s, necesita por lo menos %s",
|
||||
"other": "Hacen falta argumentos no-opcionales: Número recibido %s, necesita por lo menos %s"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "Demasiados argumentos no-opcionales: Número recibido %s, máximo es %s",
|
||||
"other": "Demasiados argumentos no-opcionales: Número recibido %s, máximo es %s"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "Falta argumento: %s",
|
||||
"other": "Faltan argumentos: %s"
|
||||
},
|
||||
"Missing required argument: %s": {
|
||||
"one": "Falta argumento requerido: %s",
|
||||
"other": "Faltan argumentos requeridos: %s"
|
||||
},
|
||||
"Unknown argument: %s": {
|
||||
"one": "Argumento desconocido: %s",
|
||||
"other": "Argumentos desconocidos: %s"
|
||||
},
|
||||
"Invalid values:": "Valores inválidos:",
|
||||
"Argument: %s, Given: %s, Choices: %s": "Argumento: %s, Recibido: %s, Seleccionados: %s",
|
||||
"Argument check failed: %s": "Verificación de argumento ha fallado: %s",
|
||||
"Implications failed:": "Implicaciones fallidas:",
|
||||
"Not enough arguments following: %s": "No hay suficientes argumentos después de: %s",
|
||||
"Invalid JSON config file: %s": "Archivo de configuración JSON inválido: %s",
|
||||
"Path to JSON config file": "Ruta al archivo de configuración JSON",
|
||||
"Show help": "Muestra ayuda",
|
||||
"Show version number": "Muestra número de versión",
|
||||
"Did you mean %s?": "Quisiste decir %s?"
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
import { __read, __spreadArray } from "tslib";
|
||||
import { Subscription } from '../Subscription';
|
||||
export var animationFrameProvider = {
|
||||
schedule: function (callback) {
|
||||
var request = requestAnimationFrame;
|
||||
var cancel = cancelAnimationFrame;
|
||||
var delegate = animationFrameProvider.delegate;
|
||||
if (delegate) {
|
||||
request = delegate.requestAnimationFrame;
|
||||
cancel = delegate.cancelAnimationFrame;
|
||||
}
|
||||
var handle = request(function (timestamp) {
|
||||
cancel = undefined;
|
||||
callback(timestamp);
|
||||
});
|
||||
return new Subscription(function () { return cancel === null || cancel === void 0 ? void 0 : cancel(handle); });
|
||||
},
|
||||
requestAnimationFrame: function () {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
var delegate = animationFrameProvider.delegate;
|
||||
return ((delegate === null || delegate === void 0 ? void 0 : delegate.requestAnimationFrame) || requestAnimationFrame).apply(void 0, __spreadArray([], __read(args)));
|
||||
},
|
||||
cancelAnimationFrame: function () {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
var delegate = animationFrameProvider.delegate;
|
||||
return ((delegate === null || delegate === void 0 ? void 0 : delegate.cancelAnimationFrame) || cancelAnimationFrame).apply(void 0, __spreadArray([], __read(args)));
|
||||
},
|
||||
delegate: undefined,
|
||||
};
|
||||
//# sourceMappingURL=animationFrameProvider.js.map
|
||||
@@ -0,0 +1,88 @@
|
||||
/**
|
||||
* License for programmatically and manually incorporated
|
||||
* documentation aka. `JSDoc` from https://github.com/nodejs/node/tree/master/doc
|
||||
*
|
||||
* Copyright Node.js contributors. All rights reserved.
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal in the Software without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
// NOTE: These definitions support NodeJS and TypeScript 4.8 and earlier.
|
||||
|
||||
// Reference required types from the default lib:
|
||||
/// <reference lib="es2020" />
|
||||
/// <reference lib="esnext.asynciterable" />
|
||||
/// <reference lib="esnext.intl" />
|
||||
/// <reference lib="esnext.bigint" />
|
||||
|
||||
// Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
|
||||
/// <reference path="assert.d.ts" />
|
||||
/// <reference path="assert/strict.d.ts" />
|
||||
/// <reference path="globals.d.ts" />
|
||||
/// <reference path="async_hooks.d.ts" />
|
||||
/// <reference path="buffer.d.ts" />
|
||||
/// <reference path="child_process.d.ts" />
|
||||
/// <reference path="cluster.d.ts" />
|
||||
/// <reference path="console.d.ts" />
|
||||
/// <reference path="constants.d.ts" />
|
||||
/// <reference path="crypto.d.ts" />
|
||||
/// <reference path="dgram.d.ts" />
|
||||
/// <reference path="diagnostics_channel.d.ts" />
|
||||
/// <reference path="dns.d.ts" />
|
||||
/// <reference path="dns/promises.d.ts" />
|
||||
/// <reference path="dns/promises.d.ts" />
|
||||
/// <reference path="domain.d.ts" />
|
||||
/// <reference path="dom-events.d.ts" />
|
||||
/// <reference path="events.d.ts" />
|
||||
/// <reference path="fs.d.ts" />
|
||||
/// <reference path="fs/promises.d.ts" />
|
||||
/// <reference path="http.d.ts" />
|
||||
/// <reference path="http2.d.ts" />
|
||||
/// <reference path="https.d.ts" />
|
||||
/// <reference path="inspector.d.ts" />
|
||||
/// <reference path="module.d.ts" />
|
||||
/// <reference path="net.d.ts" />
|
||||
/// <reference path="os.d.ts" />
|
||||
/// <reference path="path.d.ts" />
|
||||
/// <reference path="perf_hooks.d.ts" />
|
||||
/// <reference path="process.d.ts" />
|
||||
/// <reference path="punycode.d.ts" />
|
||||
/// <reference path="querystring.d.ts" />
|
||||
/// <reference path="readline.d.ts" />
|
||||
/// <reference path="readline/promises.d.ts" />
|
||||
/// <reference path="repl.d.ts" />
|
||||
/// <reference path="stream.d.ts" />
|
||||
/// <reference path="stream/promises.d.ts" />
|
||||
/// <reference path="stream/consumers.d.ts" />
|
||||
/// <reference path="stream/web.d.ts" />
|
||||
/// <reference path="string_decoder.d.ts" />
|
||||
/// <reference path="test.d.ts" />
|
||||
/// <reference path="timers.d.ts" />
|
||||
/// <reference path="timers/promises.d.ts" />
|
||||
/// <reference path="tls.d.ts" />
|
||||
/// <reference path="trace_events.d.ts" />
|
||||
/// <reference path="tty.d.ts" />
|
||||
/// <reference path="url.d.ts" />
|
||||
/// <reference path="util.d.ts" />
|
||||
/// <reference path="v8.d.ts" />
|
||||
/// <reference path="vm.d.ts" />
|
||||
/// <reference path="wasi.d.ts" />
|
||||
/// <reference path="worker_threads.d.ts" />
|
||||
/// <reference path="zlib.d.ts" />
|
||||
|
||||
/// <reference path="globals.global.d.ts" />
|
||||
@@ -0,0 +1,4 @@
|
||||
1.0.0 / 2015-06-14
|
||||
==================
|
||||
|
||||
* Initial release
|
||||
@@ -0,0 +1,22 @@
|
||||
var compactable = require('../compactable');
|
||||
|
||||
function isComponentOf(property1, property2, shallow) {
|
||||
return isDirectComponentOf(property1, property2) ||
|
||||
!shallow && !!compactable[property1.name].shorthandComponents && isSubComponentOf(property1, property2);
|
||||
}
|
||||
|
||||
function isDirectComponentOf(property1, property2) {
|
||||
var descriptor = compactable[property1.name];
|
||||
|
||||
return 'components' in descriptor && descriptor.components.indexOf(property2.name) > -1;
|
||||
}
|
||||
|
||||
function isSubComponentOf(property1, property2) {
|
||||
return property1
|
||||
.components
|
||||
.some(function (component) {
|
||||
return isDirectComponentOf(component, property2);
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = isComponentOf;
|
||||
@@ -0,0 +1,11 @@
|
||||
import EventHandler from '../../../nodes/EventHandler';
|
||||
import Wrapper from '../shared/Wrapper';
|
||||
import Block from '../../Block';
|
||||
import { Expression } from 'estree';
|
||||
export default class EventHandlerWrapper {
|
||||
node: EventHandler;
|
||||
parent: Wrapper;
|
||||
constructor(node: EventHandler, parent: Wrapper);
|
||||
get_snippet(block: Block): any;
|
||||
render(block: Block, target: string | Expression): void;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0.00353,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0.00353,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0.00353,"51":0,"52":0.00353,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0.00353,"67":0,"68":0.02468,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0.00353,"79":0,"80":0.00353,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0.00353,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0.01058,"103":0,"104":0,"105":0,"106":0,"107":0.00353,"108":0.17983,"109":0.20451,"110":0.11636,"111":0.00353,"112":0.00353,"3.5":0,"3.6":0},D:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0.16572,"36":0,"37":0,"38":0.00353,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0.00705,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0.00353,"57":0,"58":0,"59":0,"60":0.00353,"61":0,"62":0,"63":0,"64":0,"65":0.00353,"66":0,"67":0.00353,"68":0.00353,"69":0.00353,"70":0,"71":0,"72":0.00353,"73":0,"74":0.00353,"75":0.00705,"76":0.01058,"77":0,"78":0.00705,"79":0.01763,"80":0.00705,"81":0.00353,"83":0.01058,"84":0.0141,"85":0.02116,"86":0.0141,"87":0.0141,"88":0.00353,"89":0.00353,"90":0.00705,"91":0.02116,"92":0.01058,"93":0.03173,"94":0,"95":0.00705,"96":0.00353,"97":0.00705,"98":0.01058,"99":0.00705,"100":0.01058,"101":0.01058,"102":0.01058,"103":0.09168,"104":0.0141,"105":0.02821,"106":0.02116,"107":0.20803,"108":0.18688,"109":4.49212,"110":2.99357,"111":0.00353,"112":0.00353,"113":0},F:{"9":0,"11":0,"12":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0.00353,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0.00353,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0.00353,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"60":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0.02116,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0.00353,"74":0.0141,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0.00353,"91":0,"92":0.00353,"93":0.02468,"94":0.19746,"95":0.09873,"9.5-9.6":0,"10.0-10.1":0,"10.5":0,"10.6":0,"11.1":0,"11.5":0,"11.6":0,"12.1":0},B:{"12":0,"13":0,"14":0,"15":0.00353,"16":0.00353,"17":0,"18":0.00353,"79":0,"80":0,"81":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0.00353,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0,"104":0,"105":0.00353,"106":0.00353,"107":0.00705,"108":0.02116,"109":0.46896,"110":0.57826},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0.01058,"14":0.02821,"15":0.00705,_:"0","3.1":0,"3.2":0,"5.1":0.00353,"6.1":0,"7.1":0,"9.1":0,"10.1":0,"11.1":0,"12.1":0.00705,"13.1":0.02821,"14.1":0.0811,"15.1":0.01058,"15.2-15.3":0.0141,"15.4":0.04231,"15.5":0.05642,"15.6":0.25035,"16.0":0.03173,"16.1":0.12694,"16.2":0.23977,"16.3":0.17983,"16.4":0},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0,"5.0-5.1":0,"6.0-6.1":0,"7.0-7.1":0.02837,"8.1-8.4":0.00218,"9.0-9.2":0,"9.3":0.13312,"10.0-10.2":0.00436,"10.3":0.09384,"11.0-11.2":0.01091,"11.3-11.4":0.01309,"12.0-12.1":0.01309,"12.2-12.5":0.40809,"13.0-13.1":0.00655,"13.2":0.00436,"13.3":0.02182,"13.4-13.7":0.09602,"14.0-14.4":0.22041,"14.5-14.8":0.56522,"15.0-15.1":0.17895,"15.2-15.3":0.19204,"15.4":0.25097,"15.5":0.53248,"15.6":1.74803,"16.0":2.3438,"16.1":4.51301,"16.2":5.11314,"16.3":3.89542,"16.4":0.02182},P:{"4":0.08221,"20":0.70909,"5.0-5.4":0.01028,"6.2-6.4":0,"7.2-7.4":0.03083,"8.2":0,"9.2":0,"10.1":0,"11.1-11.2":0.01028,"12.0":0,"13.0":0.01028,"14.0":0.02055,"15.0":0.01028,"16.0":0.03083,"17.0":0.03083,"18.0":0.05138,"19.0":1.12016},I:{"0":0,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0,"4.4":0,"4.4.3-4.4.4":0.06468},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0.00411,"9":0.00411,"10":0,"11":0.04114,"5.5":0},N:{"10":0,"11":0},S:{"2.5":0,_:"3.0-3.1"},J:{"7":0,"10":0},O:{"0":3.03631},H:{"0":0.6313},L:{"0":59.42968},R:{_:"0"},M:{"0":0.13595},Q:{"13.1":0}};
|
||||
@@ -0,0 +1,101 @@
|
||||
'use strict';
|
||||
|
||||
var fnToStr = Function.prototype.toString;
|
||||
var reflectApply = typeof Reflect === 'object' && Reflect !== null && Reflect.apply;
|
||||
var badArrayLike;
|
||||
var isCallableMarker;
|
||||
if (typeof reflectApply === 'function' && typeof Object.defineProperty === 'function') {
|
||||
try {
|
||||
badArrayLike = Object.defineProperty({}, 'length', {
|
||||
get: function () {
|
||||
throw isCallableMarker;
|
||||
}
|
||||
});
|
||||
isCallableMarker = {};
|
||||
// eslint-disable-next-line no-throw-literal
|
||||
reflectApply(function () { throw 42; }, null, badArrayLike);
|
||||
} catch (_) {
|
||||
if (_ !== isCallableMarker) {
|
||||
reflectApply = null;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
reflectApply = null;
|
||||
}
|
||||
|
||||
var constructorRegex = /^\s*class\b/;
|
||||
var isES6ClassFn = function isES6ClassFunction(value) {
|
||||
try {
|
||||
var fnStr = fnToStr.call(value);
|
||||
return constructorRegex.test(fnStr);
|
||||
} catch (e) {
|
||||
return false; // not a function
|
||||
}
|
||||
};
|
||||
|
||||
var tryFunctionObject = function tryFunctionToStr(value) {
|
||||
try {
|
||||
if (isES6ClassFn(value)) { return false; }
|
||||
fnToStr.call(value);
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
var toStr = Object.prototype.toString;
|
||||
var objectClass = '[object Object]';
|
||||
var fnClass = '[object Function]';
|
||||
var genClass = '[object GeneratorFunction]';
|
||||
var ddaClass = '[object HTMLAllCollection]'; // IE 11
|
||||
var ddaClass2 = '[object HTML document.all class]';
|
||||
var ddaClass3 = '[object HTMLCollection]'; // IE 9-10
|
||||
var hasToStringTag = typeof Symbol === 'function' && !!Symbol.toStringTag; // better: use `has-tostringtag`
|
||||
|
||||
var isIE68 = !(0 in [,]); // eslint-disable-line no-sparse-arrays, comma-spacing
|
||||
|
||||
var isDDA = function isDocumentDotAll() { return false; };
|
||||
if (typeof document === 'object') {
|
||||
// Firefox 3 canonicalizes DDA to undefined when it's not accessed directly
|
||||
var all = document.all;
|
||||
if (toStr.call(all) === toStr.call(document.all)) {
|
||||
isDDA = function isDocumentDotAll(value) {
|
||||
/* globals document: false */
|
||||
// in IE 6-8, typeof document.all is "object" and it's truthy
|
||||
if ((isIE68 || !value) && (typeof value === 'undefined' || typeof value === 'object')) {
|
||||
try {
|
||||
var str = toStr.call(value);
|
||||
return (
|
||||
str === ddaClass
|
||||
|| str === ddaClass2
|
||||
|| str === ddaClass3 // opera 12.16
|
||||
|| str === objectClass // IE 6-8
|
||||
) && value('') == null; // eslint-disable-line eqeqeq
|
||||
} catch (e) { /**/ }
|
||||
}
|
||||
return false;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = reflectApply
|
||||
? function isCallable(value) {
|
||||
if (isDDA(value)) { return true; }
|
||||
if (!value) { return false; }
|
||||
if (typeof value !== 'function' && typeof value !== 'object') { return false; }
|
||||
try {
|
||||
reflectApply(value, null, badArrayLike);
|
||||
} catch (e) {
|
||||
if (e !== isCallableMarker) { return false; }
|
||||
}
|
||||
return !isES6ClassFn(value) && tryFunctionObject(value);
|
||||
}
|
||||
: function isCallable(value) {
|
||||
if (isDDA(value)) { return true; }
|
||||
if (!value) { return false; }
|
||||
if (typeof value !== 'function' && typeof value !== 'object') { return false; }
|
||||
if (hasToStringTag) { return tryFunctionObject(value); }
|
||||
if (isES6ClassFn(value)) { return false; }
|
||||
var strClass = toStr.call(value);
|
||||
if (strClass !== fnClass && strClass !== genClass && !(/^\[object HTML/).test(strClass)) { return false; }
|
||||
return tryFunctionObject(value);
|
||||
};
|
||||
@@ -0,0 +1,95 @@
|
||||
import { Plugin } from 'postcss'
|
||||
import { Stats } from 'browserslist'
|
||||
|
||||
declare function autoprefixer<T extends string[]>(
|
||||
...args: [...T, autoprefixer.Options]
|
||||
): Plugin & autoprefixer.ExportedAPI
|
||||
|
||||
declare function autoprefixer(
|
||||
browsers: string[],
|
||||
options?: autoprefixer.Options
|
||||
): Plugin & autoprefixer.ExportedAPI
|
||||
|
||||
declare function autoprefixer(
|
||||
options?: autoprefixer.Options
|
||||
): Plugin & autoprefixer.ExportedAPI
|
||||
|
||||
declare namespace autoprefixer {
|
||||
type GridValue = 'autoplace' | 'no-autoplace'
|
||||
|
||||
interface Options {
|
||||
/** environment for `Browserslist` */
|
||||
env?: string
|
||||
|
||||
/** should Autoprefixer use Visual Cascade, if CSS is uncompressed */
|
||||
cascade?: boolean
|
||||
|
||||
/** should Autoprefixer add prefixes. */
|
||||
add?: boolean
|
||||
|
||||
/** should Autoprefixer [remove outdated] prefixes */
|
||||
remove?: boolean
|
||||
|
||||
/** should Autoprefixer add prefixes for @supports parameters. */
|
||||
supports?: boolean
|
||||
|
||||
/** should Autoprefixer add prefixes for flexbox properties */
|
||||
flexbox?: boolean | 'no-2009'
|
||||
|
||||
/** should Autoprefixer add IE 10-11 prefixes for Grid Layout properties */
|
||||
grid?: boolean | GridValue
|
||||
|
||||
/** custom usage statistics for > 10% in my stats browsers query */
|
||||
stats?: Stats
|
||||
|
||||
/**
|
||||
* list of queries for target browsers.
|
||||
* Try to not use it.
|
||||
* The best practice is to use `.browserslistrc` config or `browserslist` key in `package.json`
|
||||
* to share target browsers with Babel, ESLint and Stylelint
|
||||
*/
|
||||
overrideBrowserslist?: string | string[]
|
||||
|
||||
/** do not raise error on unknown browser version in `Browserslist` config. */
|
||||
ignoreUnknownVersions?: boolean
|
||||
}
|
||||
|
||||
interface ExportedAPI {
|
||||
/** Autoprefixer data */
|
||||
data: {
|
||||
browsers: { [browser: string]: object | undefined }
|
||||
prefixes: { [prefixName: string]: object | undefined }
|
||||
}
|
||||
|
||||
/** Autoprefixer default browsers */
|
||||
defaults: string[]
|
||||
|
||||
/** Inspect with default Autoprefixer */
|
||||
info(options?: { from?: string }): string
|
||||
|
||||
options: Options
|
||||
|
||||
browsers: string | string[]
|
||||
}
|
||||
|
||||
/** Autoprefixer data */
|
||||
let data: ExportedAPI['data']
|
||||
|
||||
/** Autoprefixer default browsers */
|
||||
let defaults: ExportedAPI['defaults']
|
||||
|
||||
/** Inspect with default Autoprefixer */
|
||||
let info: ExportedAPI['info']
|
||||
|
||||
let postcss: true
|
||||
}
|
||||
|
||||
declare global {
|
||||
namespace NodeJS {
|
||||
interface ProcessEnv {
|
||||
AUTOPREFIXER_GRID?: autoprefixer.GridValue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export = autoprefixer
|
||||
@@ -0,0 +1,19 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
var $fromCharCode = GetIntrinsic('%String.fromCharCode%');
|
||||
|
||||
var isLeadingSurrogate = require('../helpers/isLeadingSurrogate');
|
||||
var isTrailingSurrogate = require('../helpers/isTrailingSurrogate');
|
||||
|
||||
// https://tc39.es/ecma262/2020/#sec-utf16decodesurrogatepair
|
||||
|
||||
module.exports = function UTF16SurrogatePairToCodePoint(lead, trail) {
|
||||
if (!isLeadingSurrogate(lead) || !isTrailingSurrogate(trail)) {
|
||||
throw new $TypeError('Assertion failed: `lead` must be a leading surrogate char code, and `trail` must be a trailing surrogate char code');
|
||||
}
|
||||
// var cp = (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000;
|
||||
return $fromCharCode(lead) + $fromCharCode(trail);
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
var convert = require('./convert'),
|
||||
func = convert('toPairs', require('../toPairs'), require('./_falseOptions'));
|
||||
|
||||
func.placeholder = require('./placeholder');
|
||||
module.exports = func;
|
||||
@@ -0,0 +1,58 @@
|
||||
/**
|
||||
Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.
|
||||
|
||||
@example
|
||||
```
|
||||
import type {Simplify} from 'type-fest';
|
||||
|
||||
type PositionProps = {
|
||||
top: number;
|
||||
left: number;
|
||||
};
|
||||
|
||||
type SizeProps = {
|
||||
width: number;
|
||||
height: number;
|
||||
};
|
||||
|
||||
// In your editor, hovering over `Props` will show a flattened object with all the properties.
|
||||
type Props = Simplify<PositionProps & SizeProps>;
|
||||
```
|
||||
|
||||
Sometimes it is desired to pass a value as a function argument that has a different type. At first inspection it may seem assignable, and then you discover it is not because the `value`'s type definition was defined as an interface. In the following example, `fn` requires an argument of type `Record<string, unknown>`. If the value is defined as a literal, then it is assignable. And if the `value` is defined as type using the `Simplify` utility the value is assignable. But if the `value` is defined as an interface, it is not assignable because the interface is not sealed and elsewhere a non-string property could be added to the interface.
|
||||
|
||||
If the type definition must be an interface (perhaps it was defined in a third-party npm package), then the `value` can be defined as `const value: Simplify<SomeInterface> = ...`. Then `value` will be assignable to the `fn` argument. Or the `value` can be cast as `Simplify<SomeInterface>` if you can't re-declare the `value`.
|
||||
|
||||
@example
|
||||
```
|
||||
import type {Simplify} from 'type-fest';
|
||||
|
||||
interface SomeInterface {
|
||||
foo: number;
|
||||
bar?: string;
|
||||
baz: number | undefined;
|
||||
}
|
||||
|
||||
type SomeType = {
|
||||
foo: number;
|
||||
bar?: string;
|
||||
baz: number | undefined;
|
||||
};
|
||||
|
||||
const literal = {foo: 123, bar: 'hello', baz: 456};
|
||||
const someType: SomeType = literal;
|
||||
const someInterface: SomeInterface = literal;
|
||||
|
||||
function fn(object: Record<string, unknown>): void {}
|
||||
|
||||
fn(literal); // Good: literal object type is sealed
|
||||
fn(someType); // Good: type is sealed
|
||||
fn(someInterface); // Error: Index signature for type 'string' is missing in type 'someInterface'. Because `interface` can be re-opened
|
||||
fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface` into a `type`
|
||||
```
|
||||
|
||||
@link https://github.com/microsoft/TypeScript/issues/15300
|
||||
|
||||
@category Object
|
||||
*/
|
||||
export type Simplify<T> = {[KeyType in keyof T]: T[KeyType]} & {};
|
||||
@@ -0,0 +1,182 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.formatToParts = exports.isFormatXMLElementFn = exports.PART_TYPE = void 0;
|
||||
var icu_messageformat_parser_1 = require("@formatjs/icu-messageformat-parser");
|
||||
var error_1 = require("./error");
|
||||
var PART_TYPE;
|
||||
(function (PART_TYPE) {
|
||||
PART_TYPE[PART_TYPE["literal"] = 0] = "literal";
|
||||
PART_TYPE[PART_TYPE["object"] = 1] = "object";
|
||||
})(PART_TYPE = exports.PART_TYPE || (exports.PART_TYPE = {}));
|
||||
function mergeLiteral(parts) {
|
||||
if (parts.length < 2) {
|
||||
return parts;
|
||||
}
|
||||
return parts.reduce(function (all, part) {
|
||||
var lastPart = all[all.length - 1];
|
||||
if (!lastPart ||
|
||||
lastPart.type !== PART_TYPE.literal ||
|
||||
part.type !== PART_TYPE.literal) {
|
||||
all.push(part);
|
||||
}
|
||||
else {
|
||||
lastPart.value += part.value;
|
||||
}
|
||||
return all;
|
||||
}, []);
|
||||
}
|
||||
function isFormatXMLElementFn(el) {
|
||||
return typeof el === 'function';
|
||||
}
|
||||
exports.isFormatXMLElementFn = isFormatXMLElementFn;
|
||||
// TODO(skeleton): add skeleton support
|
||||
function formatToParts(els, locales, formatters, formats, values, currentPluralValue,
|
||||
// For debugging
|
||||
originalMessage) {
|
||||
// Hot path for straight simple msg translations
|
||||
if (els.length === 1 && (0, icu_messageformat_parser_1.isLiteralElement)(els[0])) {
|
||||
return [
|
||||
{
|
||||
type: PART_TYPE.literal,
|
||||
value: els[0].value,
|
||||
},
|
||||
];
|
||||
}
|
||||
var result = [];
|
||||
for (var _i = 0, els_1 = els; _i < els_1.length; _i++) {
|
||||
var el = els_1[_i];
|
||||
// Exit early for string parts.
|
||||
if ((0, icu_messageformat_parser_1.isLiteralElement)(el)) {
|
||||
result.push({
|
||||
type: PART_TYPE.literal,
|
||||
value: el.value,
|
||||
});
|
||||
continue;
|
||||
}
|
||||
// TODO: should this part be literal type?
|
||||
// Replace `#` in plural rules with the actual numeric value.
|
||||
if ((0, icu_messageformat_parser_1.isPoundElement)(el)) {
|
||||
if (typeof currentPluralValue === 'number') {
|
||||
result.push({
|
||||
type: PART_TYPE.literal,
|
||||
value: formatters.getNumberFormat(locales).format(currentPluralValue),
|
||||
});
|
||||
}
|
||||
continue;
|
||||
}
|
||||
var varName = el.value;
|
||||
// Enforce that all required values are provided by the caller.
|
||||
if (!(values && varName in values)) {
|
||||
throw new error_1.MissingValueError(varName, originalMessage);
|
||||
}
|
||||
var value = values[varName];
|
||||
if ((0, icu_messageformat_parser_1.isArgumentElement)(el)) {
|
||||
if (!value || typeof value === 'string' || typeof value === 'number') {
|
||||
value =
|
||||
typeof value === 'string' || typeof value === 'number'
|
||||
? String(value)
|
||||
: '';
|
||||
}
|
||||
result.push({
|
||||
type: typeof value === 'string' ? PART_TYPE.literal : PART_TYPE.object,
|
||||
value: value,
|
||||
});
|
||||
continue;
|
||||
}
|
||||
// Recursively format plural and select parts' option — which can be a
|
||||
// nested pattern structure. The choosing of the option to use is
|
||||
// abstracted-by and delegated-to the part helper object.
|
||||
if ((0, icu_messageformat_parser_1.isDateElement)(el)) {
|
||||
var style = typeof el.style === 'string'
|
||||
? formats.date[el.style]
|
||||
: (0, icu_messageformat_parser_1.isDateTimeSkeleton)(el.style)
|
||||
? el.style.parsedOptions
|
||||
: undefined;
|
||||
result.push({
|
||||
type: PART_TYPE.literal,
|
||||
value: formatters
|
||||
.getDateTimeFormat(locales, style)
|
||||
.format(value),
|
||||
});
|
||||
continue;
|
||||
}
|
||||
if ((0, icu_messageformat_parser_1.isTimeElement)(el)) {
|
||||
var style = typeof el.style === 'string'
|
||||
? formats.time[el.style]
|
||||
: (0, icu_messageformat_parser_1.isDateTimeSkeleton)(el.style)
|
||||
? el.style.parsedOptions
|
||||
: formats.time.medium;
|
||||
result.push({
|
||||
type: PART_TYPE.literal,
|
||||
value: formatters
|
||||
.getDateTimeFormat(locales, style)
|
||||
.format(value),
|
||||
});
|
||||
continue;
|
||||
}
|
||||
if ((0, icu_messageformat_parser_1.isNumberElement)(el)) {
|
||||
var style = typeof el.style === 'string'
|
||||
? formats.number[el.style]
|
||||
: (0, icu_messageformat_parser_1.isNumberSkeleton)(el.style)
|
||||
? el.style.parsedOptions
|
||||
: undefined;
|
||||
if (style && style.scale) {
|
||||
value =
|
||||
value *
|
||||
(style.scale || 1);
|
||||
}
|
||||
result.push({
|
||||
type: PART_TYPE.literal,
|
||||
value: formatters
|
||||
.getNumberFormat(locales, style)
|
||||
.format(value),
|
||||
});
|
||||
continue;
|
||||
}
|
||||
if ((0, icu_messageformat_parser_1.isTagElement)(el)) {
|
||||
var children = el.children, value_1 = el.value;
|
||||
var formatFn = values[value_1];
|
||||
if (!isFormatXMLElementFn(formatFn)) {
|
||||
throw new error_1.InvalidValueTypeError(value_1, 'function', originalMessage);
|
||||
}
|
||||
var parts = formatToParts(children, locales, formatters, formats, values, currentPluralValue);
|
||||
var chunks = formatFn(parts.map(function (p) { return p.value; }));
|
||||
if (!Array.isArray(chunks)) {
|
||||
chunks = [chunks];
|
||||
}
|
||||
result.push.apply(result, chunks.map(function (c) {
|
||||
return {
|
||||
type: typeof c === 'string' ? PART_TYPE.literal : PART_TYPE.object,
|
||||
value: c,
|
||||
};
|
||||
}));
|
||||
}
|
||||
if ((0, icu_messageformat_parser_1.isSelectElement)(el)) {
|
||||
var opt = el.options[value] || el.options.other;
|
||||
if (!opt) {
|
||||
throw new error_1.InvalidValueError(el.value, value, Object.keys(el.options), originalMessage);
|
||||
}
|
||||
result.push.apply(result, formatToParts(opt.value, locales, formatters, formats, values));
|
||||
continue;
|
||||
}
|
||||
if ((0, icu_messageformat_parser_1.isPluralElement)(el)) {
|
||||
var opt = el.options["=".concat(value)];
|
||||
if (!opt) {
|
||||
if (!Intl.PluralRules) {
|
||||
throw new error_1.FormatError("Intl.PluralRules is not available in this environment.\nTry polyfilling it using \"@formatjs/intl-pluralrules\"\n", error_1.ErrorCode.MISSING_INTL_API, originalMessage);
|
||||
}
|
||||
var rule = formatters
|
||||
.getPluralRules(locales, { type: el.pluralType })
|
||||
.select(value - (el.offset || 0));
|
||||
opt = el.options[rule] || el.options.other;
|
||||
}
|
||||
if (!opt) {
|
||||
throw new error_1.InvalidValueError(el.value, value, Object.keys(el.options), originalMessage);
|
||||
}
|
||||
result.push.apply(result, formatToParts(opt.value, locales, formatters, formats, values, value - (el.offset || 0)));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return mergeLiteral(result);
|
||||
}
|
||||
exports.formatToParts = formatToParts;
|
||||
@@ -0,0 +1,33 @@
|
||||
var LodashWrapper = require('./_LodashWrapper');
|
||||
|
||||
/**
|
||||
* Executes the chain sequence and returns the wrapped result.
|
||||
*
|
||||
* @name commit
|
||||
* @memberOf _
|
||||
* @since 3.2.0
|
||||
* @category Seq
|
||||
* @returns {Object} Returns the new `lodash` wrapper instance.
|
||||
* @example
|
||||
*
|
||||
* var array = [1, 2];
|
||||
* var wrapped = _(array).push(3);
|
||||
*
|
||||
* console.log(array);
|
||||
* // => [1, 2]
|
||||
*
|
||||
* wrapped = wrapped.commit();
|
||||
* console.log(array);
|
||||
* // => [1, 2, 3]
|
||||
*
|
||||
* wrapped.last();
|
||||
* // => 3
|
||||
*
|
||||
* console.log(array);
|
||||
* // => [1, 2, 3]
|
||||
*/
|
||||
function wrapperCommit() {
|
||||
return new LodashWrapper(this.value(), this.__chain__);
|
||||
}
|
||||
|
||||
module.exports = wrapperCommit;
|
||||
@@ -0,0 +1,172 @@
|
||||
/* eslint-env browser */
|
||||
|
||||
import { createProxy, hasFatalError } from './proxy.js'
|
||||
|
||||
const logPrefix = '[HMR:Svelte]'
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
const log = (...args) => console.log(logPrefix, ...args)
|
||||
|
||||
const domReload = () => {
|
||||
// eslint-disable-next-line no-undef
|
||||
const win = typeof window !== 'undefined' && window
|
||||
if (win && win.location && win.location.reload) {
|
||||
log('Reload')
|
||||
win.location.reload()
|
||||
} else {
|
||||
log('Full reload required')
|
||||
}
|
||||
}
|
||||
|
||||
const replaceCss = (previousId, newId) => {
|
||||
if (typeof document === 'undefined') return false
|
||||
if (!previousId) return false
|
||||
if (!newId) return false
|
||||
// svelte-xxx-style => svelte-xxx
|
||||
const previousClass = previousId.slice(0, -6)
|
||||
const newClass = newId.slice(0, -6)
|
||||
// eslint-disable-next-line no-undef
|
||||
document.querySelectorAll('.' + previousClass).forEach(el => {
|
||||
el.classList.remove(previousClass)
|
||||
el.classList.add(newClass)
|
||||
})
|
||||
return true
|
||||
}
|
||||
|
||||
const removeStylesheet = cssId => {
|
||||
if (cssId == null) return
|
||||
if (typeof document === 'undefined') return
|
||||
// eslint-disable-next-line no-undef
|
||||
const el = document.getElementById(cssId)
|
||||
if (el) el.remove()
|
||||
return
|
||||
}
|
||||
|
||||
const defaultArgs = {
|
||||
reload: domReload,
|
||||
}
|
||||
|
||||
export const makeApplyHmr = transformArgs => args => {
|
||||
const allArgs = transformArgs({ ...defaultArgs, ...args })
|
||||
return applyHmr(allArgs)
|
||||
}
|
||||
|
||||
let needsReload = false
|
||||
|
||||
function applyHmr(args) {
|
||||
const {
|
||||
id,
|
||||
cssId,
|
||||
nonCssHash,
|
||||
reload = domReload,
|
||||
// normalized hot API (must conform to rollup-plugin-hot)
|
||||
hot,
|
||||
hotOptions,
|
||||
Component,
|
||||
acceptable, // some types of components are impossible to HMR correctly
|
||||
preserveLocalState,
|
||||
ProxyAdapter,
|
||||
emitCss,
|
||||
} = args
|
||||
|
||||
const existing = hot.data && hot.data.record
|
||||
|
||||
const canAccept = acceptable && (!existing || existing.current.canAccept)
|
||||
|
||||
const r =
|
||||
existing ||
|
||||
createProxy({
|
||||
Adapter: ProxyAdapter,
|
||||
id,
|
||||
Component,
|
||||
hotOptions,
|
||||
canAccept,
|
||||
preserveLocalState,
|
||||
})
|
||||
|
||||
const cssOnly =
|
||||
hotOptions.injectCss &&
|
||||
existing &&
|
||||
nonCssHash &&
|
||||
existing.current.nonCssHash === nonCssHash
|
||||
|
||||
r.update({
|
||||
Component,
|
||||
hotOptions,
|
||||
canAccept,
|
||||
nonCssHash,
|
||||
cssId,
|
||||
previousCssId: r.current.cssId,
|
||||
cssOnly,
|
||||
preserveLocalState,
|
||||
})
|
||||
|
||||
hot.dispose(data => {
|
||||
// handle previous fatal errors
|
||||
if (needsReload || hasFatalError()) {
|
||||
if (hotOptions && hotOptions.noReload) {
|
||||
log('Full reload required')
|
||||
} else {
|
||||
reload()
|
||||
}
|
||||
}
|
||||
|
||||
// 2020-09-21 Snowpack master doesn't pass data as arg to dispose handler
|
||||
data = data || hot.data
|
||||
|
||||
data.record = r
|
||||
|
||||
if (!emitCss && cssId && r.current.cssId !== cssId) {
|
||||
if (hotOptions.cssEjectDelay) {
|
||||
setTimeout(() => removeStylesheet(cssId), hotOptions.cssEjectDelay)
|
||||
} else {
|
||||
removeStylesheet(cssId)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
if (canAccept) {
|
||||
hot.accept(async arg => {
|
||||
const { bubbled } = arg || {}
|
||||
|
||||
// NOTE Snowpack registers accept handlers only once, so we can NOT rely
|
||||
// on the surrounding scope variables -- they're not the last version!
|
||||
const { cssId: newCssId, previousCssId } = r.current
|
||||
const cssChanged = newCssId !== previousCssId
|
||||
// ensure old style sheet has been removed by now
|
||||
if (!emitCss && cssChanged) removeStylesheet(previousCssId)
|
||||
// guard: css only change
|
||||
if (
|
||||
// NOTE bubbled is provided only by rollup-plugin-hot, and we
|
||||
// can't safely assume a CSS only change without it... this means we
|
||||
// can't support CSS only injection with Nollup or Webpack currently
|
||||
bubbled === false && // WARNING check false, not falsy!
|
||||
r.current.cssOnly &&
|
||||
(!cssChanged || replaceCss(previousCssId, newCssId))
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
||||
const success = await r.reload()
|
||||
|
||||
if (hasFatalError() || (!success && !hotOptions.optimistic)) {
|
||||
needsReload = true
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// well, endgame... we won't be able to render next updates, even successful,
|
||||
// if we don't have proxies in svelte's tree
|
||||
//
|
||||
// since we won't return the proxy and the app will expect a svelte component,
|
||||
// it's gonna crash... so it's best to report the real cause
|
||||
//
|
||||
// full reload required
|
||||
//
|
||||
const proxyOk = r && r.proxy
|
||||
if (!proxyOk) {
|
||||
throw new Error(`Failed to create HMR proxy for Svelte component ${id}`)
|
||||
}
|
||||
|
||||
return r.proxy
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
|
||||
var isObject = require("../object/is-object")
|
||||
, is = require("./is");
|
||||
|
||||
module.exports = function (value) {
|
||||
if (is(value) && isObject(value)) return value;
|
||||
throw new TypeError(value + " is not an iterable or array-like object");
|
||||
};
|
||||
@@ -0,0 +1,434 @@
|
||||
const typedArrayTypeNames = [
|
||||
'Int8Array',
|
||||
'Uint8Array',
|
||||
'Uint8ClampedArray',
|
||||
'Int16Array',
|
||||
'Uint16Array',
|
||||
'Int32Array',
|
||||
'Uint32Array',
|
||||
'Float32Array',
|
||||
'Float64Array',
|
||||
'BigInt64Array',
|
||||
'BigUint64Array',
|
||||
];
|
||||
function isTypedArrayName(name) {
|
||||
return typedArrayTypeNames.includes(name);
|
||||
}
|
||||
const objectTypeNames = [
|
||||
'Function',
|
||||
'Generator',
|
||||
'AsyncGenerator',
|
||||
'GeneratorFunction',
|
||||
'AsyncGeneratorFunction',
|
||||
'AsyncFunction',
|
||||
'Observable',
|
||||
'Array',
|
||||
'Buffer',
|
||||
'Blob',
|
||||
'Object',
|
||||
'RegExp',
|
||||
'Date',
|
||||
'Error',
|
||||
'Map',
|
||||
'Set',
|
||||
'WeakMap',
|
||||
'WeakSet',
|
||||
'WeakRef',
|
||||
'ArrayBuffer',
|
||||
'SharedArrayBuffer',
|
||||
'DataView',
|
||||
'Promise',
|
||||
'URL',
|
||||
'FormData',
|
||||
'URLSearchParams',
|
||||
'HTMLElement',
|
||||
'NaN',
|
||||
...typedArrayTypeNames,
|
||||
];
|
||||
function isObjectTypeName(name) {
|
||||
return objectTypeNames.includes(name);
|
||||
}
|
||||
const primitiveTypeNames = [
|
||||
'null',
|
||||
'undefined',
|
||||
'string',
|
||||
'number',
|
||||
'bigint',
|
||||
'boolean',
|
||||
'symbol',
|
||||
];
|
||||
function isPrimitiveTypeName(name) {
|
||||
return primitiveTypeNames.includes(name);
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
function isOfType(type) {
|
||||
return (value) => typeof value === type;
|
||||
}
|
||||
const { toString } = Object.prototype;
|
||||
const getObjectType = (value) => {
|
||||
const objectTypeName = toString.call(value).slice(8, -1);
|
||||
if (/HTML\w+Element/.test(objectTypeName) && is.domElement(value)) {
|
||||
return 'HTMLElement';
|
||||
}
|
||||
if (isObjectTypeName(objectTypeName)) {
|
||||
return objectTypeName;
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
const isObjectOfType = (type) => (value) => getObjectType(value) === type;
|
||||
function is(value) {
|
||||
if (value === null) {
|
||||
return 'null';
|
||||
}
|
||||
switch (typeof value) {
|
||||
case 'undefined':
|
||||
return 'undefined';
|
||||
case 'string':
|
||||
return 'string';
|
||||
case 'number':
|
||||
return Number.isNaN(value) ? 'NaN' : 'number';
|
||||
case 'boolean':
|
||||
return 'boolean';
|
||||
case 'function':
|
||||
return 'Function';
|
||||
case 'bigint':
|
||||
return 'bigint';
|
||||
case 'symbol':
|
||||
return 'symbol';
|
||||
default:
|
||||
}
|
||||
if (is.observable(value)) {
|
||||
return 'Observable';
|
||||
}
|
||||
if (is.array(value)) {
|
||||
return 'Array';
|
||||
}
|
||||
if (is.buffer(value)) {
|
||||
return 'Buffer';
|
||||
}
|
||||
const tagType = getObjectType(value);
|
||||
if (tagType) {
|
||||
return tagType;
|
||||
}
|
||||
if (value instanceof String || value instanceof Boolean || value instanceof Number) {
|
||||
throw new TypeError('Please don\'t use object wrappers for primitive types');
|
||||
}
|
||||
return 'Object';
|
||||
}
|
||||
is.undefined = isOfType('undefined');
|
||||
is.string = isOfType('string');
|
||||
const isNumberType = isOfType('number');
|
||||
is.number = (value) => isNumberType(value) && !is.nan(value);
|
||||
is.bigint = isOfType('bigint');
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
is.function_ = isOfType('function');
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
is.null_ = (value) => value === null;
|
||||
is.class_ = (value) => is.function_(value) && value.toString().startsWith('class ');
|
||||
is.boolean = (value) => value === true || value === false;
|
||||
is.symbol = isOfType('symbol');
|
||||
is.numericString = (value) => is.string(value) && !is.emptyStringOrWhitespace(value) && !Number.isNaN(Number(value));
|
||||
is.array = (value, assertion) => {
|
||||
if (!Array.isArray(value)) {
|
||||
return false;
|
||||
}
|
||||
if (!is.function_(assertion)) {
|
||||
return true;
|
||||
}
|
||||
return value.every(element => assertion(element));
|
||||
};
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call
|
||||
is.buffer = (value) => value?.constructor?.isBuffer?.(value) ?? false;
|
||||
is.blob = (value) => isObjectOfType('Blob')(value);
|
||||
is.nullOrUndefined = (value) => is.null_(value) || is.undefined(value); // eslint-disable-line @typescript-eslint/ban-types
|
||||
is.object = (value) => !is.null_(value) && (typeof value === 'object' || is.function_(value)); // eslint-disable-line @typescript-eslint/ban-types
|
||||
is.iterable = (value) => is.function_(value?.[Symbol.iterator]);
|
||||
is.asyncIterable = (value) => is.function_(value?.[Symbol.asyncIterator]);
|
||||
is.generator = (value) => is.iterable(value) && is.function_(value?.next) && is.function_(value?.throw);
|
||||
is.asyncGenerator = (value) => is.asyncIterable(value) && is.function_(value.next) && is.function_(value.throw);
|
||||
is.nativePromise = (value) => isObjectOfType('Promise')(value);
|
||||
const hasPromiseApi = (value) => is.function_(value?.then)
|
||||
&& is.function_(value?.catch);
|
||||
is.promise = (value) => is.nativePromise(value) || hasPromiseApi(value);
|
||||
is.generatorFunction = isObjectOfType('GeneratorFunction');
|
||||
is.asyncGeneratorFunction = (value) => getObjectType(value) === 'AsyncGeneratorFunction';
|
||||
is.asyncFunction = (value) => getObjectType(value) === 'AsyncFunction';
|
||||
// eslint-disable-next-line no-prototype-builtins, @typescript-eslint/ban-types
|
||||
is.boundFunction = (value) => is.function_(value) && !value.hasOwnProperty('prototype');
|
||||
is.regExp = isObjectOfType('RegExp');
|
||||
is.date = isObjectOfType('Date');
|
||||
is.error = isObjectOfType('Error');
|
||||
is.map = (value) => isObjectOfType('Map')(value);
|
||||
is.set = (value) => isObjectOfType('Set')(value);
|
||||
is.weakMap = (value) => isObjectOfType('WeakMap')(value); // eslint-disable-line @typescript-eslint/ban-types
|
||||
is.weakSet = (value) => isObjectOfType('WeakSet')(value); // eslint-disable-line @typescript-eslint/ban-types
|
||||
is.weakRef = (value) => isObjectOfType('WeakRef')(value); // eslint-disable-line @typescript-eslint/ban-types
|
||||
is.int8Array = isObjectOfType('Int8Array');
|
||||
is.uint8Array = isObjectOfType('Uint8Array');
|
||||
is.uint8ClampedArray = isObjectOfType('Uint8ClampedArray');
|
||||
is.int16Array = isObjectOfType('Int16Array');
|
||||
is.uint16Array = isObjectOfType('Uint16Array');
|
||||
is.int32Array = isObjectOfType('Int32Array');
|
||||
is.uint32Array = isObjectOfType('Uint32Array');
|
||||
is.float32Array = isObjectOfType('Float32Array');
|
||||
is.float64Array = isObjectOfType('Float64Array');
|
||||
is.bigInt64Array = isObjectOfType('BigInt64Array');
|
||||
is.bigUint64Array = isObjectOfType('BigUint64Array');
|
||||
is.arrayBuffer = isObjectOfType('ArrayBuffer');
|
||||
is.sharedArrayBuffer = isObjectOfType('SharedArrayBuffer');
|
||||
is.dataView = isObjectOfType('DataView');
|
||||
is.enumCase = (value, targetEnum) => Object.values(targetEnum).includes(value);
|
||||
is.directInstanceOf = (instance, class_) => Object.getPrototypeOf(instance) === class_.prototype;
|
||||
is.urlInstance = (value) => isObjectOfType('URL')(value);
|
||||
is.urlString = (value) => {
|
||||
if (!is.string(value)) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
new URL(value); // eslint-disable-line no-new
|
||||
return true;
|
||||
}
|
||||
catch {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
// Example: `is.truthy = (value: unknown): value is (not false | not 0 | not '' | not undefined | not null) => Boolean(value);`
|
||||
is.truthy = (value) => Boolean(value); // eslint-disable-line unicorn/prefer-native-coercion-functions
|
||||
// Example: `is.falsy = (value: unknown): value is (not true | 0 | '' | undefined | null) => Boolean(value);`
|
||||
is.falsy = (value) => !value;
|
||||
is.nan = (value) => Number.isNaN(value);
|
||||
is.primitive = (value) => is.null_(value) || isPrimitiveTypeName(typeof value);
|
||||
is.integer = (value) => Number.isInteger(value);
|
||||
is.safeInteger = (value) => Number.isSafeInteger(value);
|
||||
is.plainObject = (value) => {
|
||||
// From: https://github.com/sindresorhus/is-plain-obj/blob/main/index.js
|
||||
if (typeof value !== 'object' || value === null) {
|
||||
return false;
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
const prototype = Object.getPrototypeOf(value);
|
||||
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
|
||||
};
|
||||
is.typedArray = (value) => isTypedArrayName(getObjectType(value));
|
||||
const isValidLength = (value) => is.safeInteger(value) && value >= 0;
|
||||
is.arrayLike = (value) => !is.nullOrUndefined(value) && !is.function_(value) && isValidLength(value.length);
|
||||
is.inRange = (value, range) => {
|
||||
if (is.number(range)) {
|
||||
return value >= Math.min(0, range) && value <= Math.max(range, 0);
|
||||
}
|
||||
if (is.array(range) && range.length === 2) {
|
||||
return value >= Math.min(...range) && value <= Math.max(...range);
|
||||
}
|
||||
throw new TypeError(`Invalid range: ${JSON.stringify(range)}`);
|
||||
};
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
const NODE_TYPE_ELEMENT = 1;
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
const DOM_PROPERTIES_TO_CHECK = [
|
||||
'innerHTML',
|
||||
'ownerDocument',
|
||||
'style',
|
||||
'attributes',
|
||||
'nodeValue',
|
||||
];
|
||||
is.domElement = (value) => is.object(value)
|
||||
&& value.nodeType === NODE_TYPE_ELEMENT
|
||||
&& is.string(value.nodeName)
|
||||
&& !is.plainObject(value)
|
||||
&& DOM_PROPERTIES_TO_CHECK.every(property => property in value);
|
||||
is.observable = (value) => {
|
||||
if (!value) {
|
||||
return false;
|
||||
}
|
||||
// eslint-disable-next-line no-use-extend-native/no-use-extend-native, @typescript-eslint/no-unsafe-call
|
||||
if (value === value[Symbol.observable]?.()) {
|
||||
return true;
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
||||
if (value === value['@@observable']?.()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
is.nodeStream = (value) => is.object(value) && is.function_(value.pipe) && !is.observable(value);
|
||||
is.infinite = (value) => value === Number.POSITIVE_INFINITY || value === Number.NEGATIVE_INFINITY;
|
||||
const isAbsoluteMod2 = (remainder) => (value) => is.integer(value) && Math.abs(value % 2) === remainder;
|
||||
is.evenInteger = isAbsoluteMod2(0);
|
||||
is.oddInteger = isAbsoluteMod2(1);
|
||||
is.emptyArray = (value) => is.array(value) && value.length === 0;
|
||||
is.nonEmptyArray = (value) => is.array(value) && value.length > 0;
|
||||
is.emptyString = (value) => is.string(value) && value.length === 0;
|
||||
const isWhiteSpaceString = (value) => is.string(value) && !/\S/.test(value);
|
||||
is.emptyStringOrWhitespace = (value) => is.emptyString(value) || isWhiteSpaceString(value);
|
||||
// TODO: Use `not ''` when the `not` operator is available.
|
||||
is.nonEmptyString = (value) => is.string(value) && value.length > 0;
|
||||
// TODO: Use `not ''` when the `not` operator is available.
|
||||
is.nonEmptyStringAndNotWhitespace = (value) => is.string(value) && !is.emptyStringOrWhitespace(value);
|
||||
// eslint-disable-next-line unicorn/no-array-callback-reference
|
||||
is.emptyObject = (value) => is.object(value) && !is.map(value) && !is.set(value) && Object.keys(value).length === 0;
|
||||
// TODO: Use `not` operator here to remove `Map` and `Set` from type guard:
|
||||
// - https://github.com/Microsoft/TypeScript/pull/29317
|
||||
// eslint-disable-next-line unicorn/no-array-callback-reference
|
||||
is.nonEmptyObject = (value) => is.object(value) && !is.map(value) && !is.set(value) && Object.keys(value).length > 0;
|
||||
is.emptySet = (value) => is.set(value) && value.size === 0;
|
||||
is.nonEmptySet = (value) => is.set(value) && value.size > 0;
|
||||
// eslint-disable-next-line unicorn/no-array-callback-reference
|
||||
is.emptyMap = (value) => is.map(value) && value.size === 0;
|
||||
// eslint-disable-next-line unicorn/no-array-callback-reference
|
||||
is.nonEmptyMap = (value) => is.map(value) && value.size > 0;
|
||||
// `PropertyKey` is any value that can be used as an object key (string, number, or symbol)
|
||||
is.propertyKey = (value) => is.any([is.string, is.number, is.symbol], value);
|
||||
is.formData = (value) => isObjectOfType('FormData')(value);
|
||||
is.urlSearchParams = (value) => isObjectOfType('URLSearchParams')(value);
|
||||
const predicateOnArray = (method, predicate, values) => {
|
||||
if (!is.function_(predicate)) {
|
||||
throw new TypeError(`Invalid predicate: ${JSON.stringify(predicate)}`);
|
||||
}
|
||||
if (values.length === 0) {
|
||||
throw new TypeError('Invalid number of values');
|
||||
}
|
||||
return method.call(values, predicate);
|
||||
};
|
||||
is.any = (predicate, ...values) => {
|
||||
const predicates = is.array(predicate) ? predicate : [predicate];
|
||||
return predicates.some(singlePredicate => predicateOnArray(Array.prototype.some, singlePredicate, values));
|
||||
};
|
||||
is.all = (predicate, ...values) => predicateOnArray(Array.prototype.every, predicate, values);
|
||||
const assertType = (condition, description, value, options = {}) => {
|
||||
if (!condition) {
|
||||
const { multipleValues } = options;
|
||||
const valuesMessage = multipleValues
|
||||
? `received values of types ${[
|
||||
...new Set(value.map(singleValue => `\`${is(singleValue)}\``)),
|
||||
].join(', ')}`
|
||||
: `received value of type \`${is(value)}\``;
|
||||
throw new TypeError(`Expected value which is \`${description}\`, ${valuesMessage}.`);
|
||||
}
|
||||
};
|
||||
/* eslint-disable @typescript-eslint/no-confusing-void-expression */
|
||||
export const assert = {
|
||||
// Unknowns.
|
||||
undefined: (value) => assertType(is.undefined(value), 'undefined', value),
|
||||
string: (value) => assertType(is.string(value), 'string', value),
|
||||
number: (value) => assertType(is.number(value), 'number', value),
|
||||
bigint: (value) => assertType(is.bigint(value), 'bigint', value),
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
function_: (value) => assertType(is.function_(value), 'Function', value),
|
||||
null_: (value) => assertType(is.null_(value), 'null', value),
|
||||
class_: (value) => assertType(is.class_(value), "Class" /* AssertionTypeDescription.class_ */, value),
|
||||
boolean: (value) => assertType(is.boolean(value), 'boolean', value),
|
||||
symbol: (value) => assertType(is.symbol(value), 'symbol', value),
|
||||
numericString: (value) => assertType(is.numericString(value), "string with a number" /* AssertionTypeDescription.numericString */, value),
|
||||
array: (value, assertion) => {
|
||||
const assert = assertType;
|
||||
assert(is.array(value), 'Array', value);
|
||||
if (assertion) {
|
||||
// eslint-disable-next-line unicorn/no-array-for-each, unicorn/no-array-callback-reference
|
||||
value.forEach(assertion);
|
||||
}
|
||||
},
|
||||
buffer: (value) => assertType(is.buffer(value), 'Buffer', value),
|
||||
blob: (value) => assertType(is.blob(value), 'Blob', value),
|
||||
nullOrUndefined: (value) => assertType(is.nullOrUndefined(value), "null or undefined" /* AssertionTypeDescription.nullOrUndefined */, value),
|
||||
object: (value) => assertType(is.object(value), 'Object', value),
|
||||
iterable: (value) => assertType(is.iterable(value), "Iterable" /* AssertionTypeDescription.iterable */, value),
|
||||
asyncIterable: (value) => assertType(is.asyncIterable(value), "AsyncIterable" /* AssertionTypeDescription.asyncIterable */, value),
|
||||
generator: (value) => assertType(is.generator(value), 'Generator', value),
|
||||
asyncGenerator: (value) => assertType(is.asyncGenerator(value), 'AsyncGenerator', value),
|
||||
nativePromise: (value) => assertType(is.nativePromise(value), "native Promise" /* AssertionTypeDescription.nativePromise */, value),
|
||||
promise: (value) => assertType(is.promise(value), 'Promise', value),
|
||||
generatorFunction: (value) => assertType(is.generatorFunction(value), 'GeneratorFunction', value),
|
||||
asyncGeneratorFunction: (value) => assertType(is.asyncGeneratorFunction(value), 'AsyncGeneratorFunction', value),
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
asyncFunction: (value) => assertType(is.asyncFunction(value), 'AsyncFunction', value),
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
boundFunction: (value) => assertType(is.boundFunction(value), 'Function', value),
|
||||
regExp: (value) => assertType(is.regExp(value), 'RegExp', value),
|
||||
date: (value) => assertType(is.date(value), 'Date', value),
|
||||
error: (value) => assertType(is.error(value), 'Error', value),
|
||||
map: (value) => assertType(is.map(value), 'Map', value),
|
||||
set: (value) => assertType(is.set(value), 'Set', value),
|
||||
weakMap: (value) => assertType(is.weakMap(value), 'WeakMap', value),
|
||||
weakSet: (value) => assertType(is.weakSet(value), 'WeakSet', value),
|
||||
weakRef: (value) => assertType(is.weakRef(value), 'WeakRef', value),
|
||||
int8Array: (value) => assertType(is.int8Array(value), 'Int8Array', value),
|
||||
uint8Array: (value) => assertType(is.uint8Array(value), 'Uint8Array', value),
|
||||
uint8ClampedArray: (value) => assertType(is.uint8ClampedArray(value), 'Uint8ClampedArray', value),
|
||||
int16Array: (value) => assertType(is.int16Array(value), 'Int16Array', value),
|
||||
uint16Array: (value) => assertType(is.uint16Array(value), 'Uint16Array', value),
|
||||
int32Array: (value) => assertType(is.int32Array(value), 'Int32Array', value),
|
||||
uint32Array: (value) => assertType(is.uint32Array(value), 'Uint32Array', value),
|
||||
float32Array: (value) => assertType(is.float32Array(value), 'Float32Array', value),
|
||||
float64Array: (value) => assertType(is.float64Array(value), 'Float64Array', value),
|
||||
bigInt64Array: (value) => assertType(is.bigInt64Array(value), 'BigInt64Array', value),
|
||||
bigUint64Array: (value) => assertType(is.bigUint64Array(value), 'BigUint64Array', value),
|
||||
arrayBuffer: (value) => assertType(is.arrayBuffer(value), 'ArrayBuffer', value),
|
||||
sharedArrayBuffer: (value) => assertType(is.sharedArrayBuffer(value), 'SharedArrayBuffer', value),
|
||||
dataView: (value) => assertType(is.dataView(value), 'DataView', value),
|
||||
enumCase: (value, targetEnum) => assertType(is.enumCase(value, targetEnum), 'EnumCase', value),
|
||||
urlInstance: (value) => assertType(is.urlInstance(value), 'URL', value),
|
||||
urlString: (value) => assertType(is.urlString(value), "string with a URL" /* AssertionTypeDescription.urlString */, value),
|
||||
truthy: (value) => assertType(is.truthy(value), "truthy" /* AssertionTypeDescription.truthy */, value),
|
||||
falsy: (value) => assertType(is.falsy(value), "falsy" /* AssertionTypeDescription.falsy */, value),
|
||||
nan: (value) => assertType(is.nan(value), "NaN" /* AssertionTypeDescription.nan */, value),
|
||||
primitive: (value) => assertType(is.primitive(value), "primitive" /* AssertionTypeDescription.primitive */, value),
|
||||
integer: (value) => assertType(is.integer(value), "integer" /* AssertionTypeDescription.integer */, value),
|
||||
safeInteger: (value) => assertType(is.safeInteger(value), "integer" /* AssertionTypeDescription.safeInteger */, value),
|
||||
plainObject: (value) => assertType(is.plainObject(value), "plain object" /* AssertionTypeDescription.plainObject */, value),
|
||||
typedArray: (value) => assertType(is.typedArray(value), "TypedArray" /* AssertionTypeDescription.typedArray */, value),
|
||||
arrayLike: (value) => assertType(is.arrayLike(value), "array-like" /* AssertionTypeDescription.arrayLike */, value),
|
||||
domElement: (value) => assertType(is.domElement(value), "HTMLElement" /* AssertionTypeDescription.domElement */, value),
|
||||
observable: (value) => assertType(is.observable(value), 'Observable', value),
|
||||
nodeStream: (value) => assertType(is.nodeStream(value), "Node.js Stream" /* AssertionTypeDescription.nodeStream */, value),
|
||||
infinite: (value) => assertType(is.infinite(value), "infinite number" /* AssertionTypeDescription.infinite */, value),
|
||||
emptyArray: (value) => assertType(is.emptyArray(value), "empty array" /* AssertionTypeDescription.emptyArray */, value),
|
||||
nonEmptyArray: (value) => assertType(is.nonEmptyArray(value), "non-empty array" /* AssertionTypeDescription.nonEmptyArray */, value),
|
||||
emptyString: (value) => assertType(is.emptyString(value), "empty string" /* AssertionTypeDescription.emptyString */, value),
|
||||
emptyStringOrWhitespace: (value) => assertType(is.emptyStringOrWhitespace(value), "empty string or whitespace" /* AssertionTypeDescription.emptyStringOrWhitespace */, value),
|
||||
nonEmptyString: (value) => assertType(is.nonEmptyString(value), "non-empty string" /* AssertionTypeDescription.nonEmptyString */, value),
|
||||
nonEmptyStringAndNotWhitespace: (value) => assertType(is.nonEmptyStringAndNotWhitespace(value), "non-empty string and not whitespace" /* AssertionTypeDescription.nonEmptyStringAndNotWhitespace */, value),
|
||||
emptyObject: (value) => assertType(is.emptyObject(value), "empty object" /* AssertionTypeDescription.emptyObject */, value),
|
||||
nonEmptyObject: (value) => assertType(is.nonEmptyObject(value), "non-empty object" /* AssertionTypeDescription.nonEmptyObject */, value),
|
||||
emptySet: (value) => assertType(is.emptySet(value), "empty set" /* AssertionTypeDescription.emptySet */, value),
|
||||
nonEmptySet: (value) => assertType(is.nonEmptySet(value), "non-empty set" /* AssertionTypeDescription.nonEmptySet */, value),
|
||||
emptyMap: (value) => assertType(is.emptyMap(value), "empty map" /* AssertionTypeDescription.emptyMap */, value),
|
||||
nonEmptyMap: (value) => assertType(is.nonEmptyMap(value), "non-empty map" /* AssertionTypeDescription.nonEmptyMap */, value),
|
||||
propertyKey: (value) => assertType(is.propertyKey(value), 'PropertyKey', value),
|
||||
formData: (value) => assertType(is.formData(value), 'FormData', value),
|
||||
urlSearchParams: (value) => assertType(is.urlSearchParams(value), 'URLSearchParams', value),
|
||||
// Numbers.
|
||||
evenInteger: (value) => assertType(is.evenInteger(value), "even integer" /* AssertionTypeDescription.evenInteger */, value),
|
||||
oddInteger: (value) => assertType(is.oddInteger(value), "odd integer" /* AssertionTypeDescription.oddInteger */, value),
|
||||
// Two arguments.
|
||||
directInstanceOf: (instance, class_) => assertType(is.directInstanceOf(instance, class_), "T" /* AssertionTypeDescription.directInstanceOf */, instance),
|
||||
inRange: (value, range) => assertType(is.inRange(value, range), "in range" /* AssertionTypeDescription.inRange */, value),
|
||||
// Variadic functions.
|
||||
any: (predicate, ...values) => assertType(is.any(predicate, ...values), "predicate returns truthy for any value" /* AssertionTypeDescription.any */, values, { multipleValues: true }),
|
||||
all: (predicate, ...values) => assertType(is.all(predicate, ...values), "predicate returns truthy for all values" /* AssertionTypeDescription.all */, values, { multipleValues: true }),
|
||||
};
|
||||
/* eslint-enable @typescript-eslint/no-confusing-void-expression */
|
||||
// Some few keywords are reserved, but we'll populate them for Node.js users
|
||||
// See https://github.com/Microsoft/TypeScript/issues/2536
|
||||
Object.defineProperties(is, {
|
||||
class: {
|
||||
value: is.class_,
|
||||
},
|
||||
function: {
|
||||
value: is.function_,
|
||||
},
|
||||
null: {
|
||||
value: is.null_,
|
||||
},
|
||||
});
|
||||
Object.defineProperties(assert, {
|
||||
class: {
|
||||
value: assert.class_,
|
||||
},
|
||||
function: {
|
||||
value: assert.function_,
|
||||
},
|
||||
null: {
|
||||
value: assert.null_,
|
||||
},
|
||||
});
|
||||
export default is;
|
||||
@@ -0,0 +1,11 @@
|
||||
const urlVariableRegex = /\{[^}]+\}/g;
|
||||
function removeNonChars(variableName) {
|
||||
return variableName.replace(/^\W+|\W+$/g, "").split(/,/);
|
||||
}
|
||||
export function extractUrlVariableNames(url) {
|
||||
const matches = url.match(urlVariableRegex);
|
||||
if (!matches) {
|
||||
return [];
|
||||
}
|
||||
return matches.map(removeNonChars).reduce((a, b) => a.concat(b), []);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"timeRange.js","sourceRoot":"","sources":["../src/timeRange.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;;AAEH,SAAwB,SAAS;IAChC,8CAA8C;IAC9C,MAAM,IAAI,GAAG,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACnD,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAC3B,MAAM,UAAU,GAAG,OAAO,KAAK,KAAK,CAAC;IACrC,MAAM,WAAW,GAAG,IAAI,IAAI,EAAE,CAAC;IAE/B,IAAI,CAAC,UAAU,EAAE;QAChB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;KACnB;IAED,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC;IAC7B,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,IAAI,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IAEnD,kBAAkB;IAClB,IAAI,QAAQ,KAAK,CAAC,EAAE;QACnB,MAAM,GAAG,cAAc,CAAC,UAAU,EAAE,WAAW,CAAC,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC;QAEpE,0BAA0B;KAC1B;SAAM,IAAI,QAAQ,KAAK,CAAC,EAAE;QAC1B,MAAM,WAAW,GAAG,cAAc,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;QAC5D,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,IAAI,WAAW,IAAI,WAAW,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;QAEvE,sCAAsC;KACtC;SAAM,IAAI,QAAQ,KAAK,CAAC,EAAE;QAC1B,MAAM,GAAG,YAAY,CACpB,mBAAmB,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EACtD,mBAAmB,CAClB,cAAc,CAAC,UAAU,EAAE,WAAW,CAAC,EACvC,gBAAgB,CAAC,UAAU,EAAE,WAAW,CAAC,EACzC,CAAC,CACD,EACD,mBAAmB,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CACvD,CAAC;QAEF,kDAAkD;KAClD;SAAM,IAAI,QAAQ,KAAK,CAAC,EAAE;QAC1B,MAAM,GAAG,YAAY,CACpB,mBAAmB,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,EACnE,mBAAmB,CAClB,cAAc,CAAC,UAAU,EAAE,WAAW,CAAC,EACvC,gBAAgB,CAAC,UAAU,EAAE,WAAW,CAAC,EACzC,gBAAgB,CAAC,UAAU,EAAE,WAAW,CAAC,CACzC,EACD,mBAAmB,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CACnE,CAAC;KACF;IAED,OAAO,MAAM,CAAC;AACf,CAAC;AAlDD,4BAkDC;AAED,SAAS,mBAAmB,CAAC,EAAU,EAAE,EAAU,EAAE,EAAU;IAC9D,OAAO,EAAE,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AACjC,CAAC;AAED,SAAS,cAAc,CAAC,GAAY,EAAE,WAAiB;IACtD,OAAO,GAAG,CAAC,CAAC,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;AACjE,CAAC;AAED,SAAS,gBAAgB,CAAC,GAAY,EAAE,WAAiB;IACxD,OAAO,GAAG,CAAC,CAAC,CAAC,WAAW,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,UAAU,EAAE,CAAC;AACrE,CAAC;AAED,SAAS,gBAAgB,CAAC,GAAY,EAAE,WAAiB;IACxD,OAAO,GAAG,CAAC,CAAC,CAAC,WAAW,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,UAAU,EAAE,CAAC;AACrE,CAAC;AAED,2BAA2B;AAC3B,SAAS,YAAY,CAAC,KAAa,EAAE,KAAa,EAAE,MAAc;IACjE,OAAO,KAAK,IAAI,KAAK,IAAI,KAAK,IAAI,MAAM,CAAC;AAC1C,CAAC"}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"concatMapTo.js","sourceRoot":"","sources":["../../../../src/internal/operators/concatMapTo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAuEhD,MAAM,UAAU,WAAW,CACzB,eAAkB,EAClB,cAA6G;IAE7G,OAAO,UAAU,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,cAAM,OAAA,eAAe,EAAf,CAAe,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,cAAM,OAAA,eAAe,EAAf,CAAe,CAAC,CAAC;AAC1H,CAAC"}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"name": "picocolors",
|
||||
"version": "1.0.0",
|
||||
"main": "./picocolors.js",
|
||||
"types": "./picocolors.d.ts",
|
||||
"browser": {
|
||||
"./picocolors.js": "./picocolors.browser.js"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"description": "The tiniest and the fastest library for terminal output formatting with ANSI colors",
|
||||
"files": [
|
||||
"picocolors.*",
|
||||
"types.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"terminal",
|
||||
"colors",
|
||||
"formatting",
|
||||
"cli",
|
||||
"console"
|
||||
],
|
||||
"author": "Alexey Raspopov",
|
||||
"repository": "alexeyraspopov/picocolors",
|
||||
"license": "ISC"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: [ljharb]
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: npm/is-callable
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
||||
@@ -0,0 +1,29 @@
|
||||
var capitalize = require('./capitalize'),
|
||||
createCompounder = require('./_createCompounder');
|
||||
|
||||
/**
|
||||
* Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 3.0.0
|
||||
* @category String
|
||||
* @param {string} [string=''] The string to convert.
|
||||
* @returns {string} Returns the camel cased string.
|
||||
* @example
|
||||
*
|
||||
* _.camelCase('Foo Bar');
|
||||
* // => 'fooBar'
|
||||
*
|
||||
* _.camelCase('--foo-bar--');
|
||||
* // => 'fooBar'
|
||||
*
|
||||
* _.camelCase('__FOO_BAR__');
|
||||
* // => 'fooBar'
|
||||
*/
|
||||
var camelCase = createCompounder(function(result, word, index) {
|
||||
word = word.toLowerCase();
|
||||
return result + (index ? capitalize(word) : word);
|
||||
});
|
||||
|
||||
module.exports = camelCase;
|
||||
@@ -0,0 +1,2 @@
|
||||
declare function coerceToFinite(value: any): number | null;
|
||||
export default coerceToFinite;
|
||||
@@ -0,0 +1,132 @@
|
||||
import { Observable } from '../../Observable';
|
||||
import { TimestampProvider } from '../../types';
|
||||
import { performanceTimestampProvider } from '../../scheduler/performanceTimestampProvider';
|
||||
import { animationFrameProvider } from '../../scheduler/animationFrameProvider';
|
||||
|
||||
/**
|
||||
* An observable of animation frames
|
||||
*
|
||||
* Emits the amount of time elapsed since subscription and the timestamp on each animation frame.
|
||||
* Defaults to milliseconds provided to the requestAnimationFrame's callback. Does not end on its own.
|
||||
*
|
||||
* Every subscription will start a separate animation loop. Since animation frames are always scheduled
|
||||
* by the browser to occur directly before a repaint, scheduling more than one animation frame synchronously
|
||||
* should not be much different or have more overhead than looping over an array of events during
|
||||
* a single animation frame. However, if for some reason the developer would like to ensure the
|
||||
* execution of animation-related handlers are all executed during the same task by the engine,
|
||||
* the `share` operator can be used.
|
||||
*
|
||||
* This is useful for setting up animations with RxJS.
|
||||
*
|
||||
* ## Examples
|
||||
*
|
||||
* Tweening a div to move it on the screen
|
||||
*
|
||||
* ```ts
|
||||
* import { animationFrames, map, takeWhile, endWith } from 'rxjs';
|
||||
*
|
||||
* function tween(start: number, end: number, duration: number) {
|
||||
* const diff = end - start;
|
||||
* return animationFrames().pipe(
|
||||
* // Figure out what percentage of time has passed
|
||||
* map(({ elapsed }) => elapsed / duration),
|
||||
* // Take the vector while less than 100%
|
||||
* takeWhile(v => v < 1),
|
||||
* // Finish with 100%
|
||||
* endWith(1),
|
||||
* // Calculate the distance traveled between start and end
|
||||
* map(v => v * diff + start)
|
||||
* );
|
||||
* }
|
||||
*
|
||||
* // Setup a div for us to move around
|
||||
* const div = document.createElement('div');
|
||||
* document.body.appendChild(div);
|
||||
* div.style.position = 'absolute';
|
||||
* div.style.width = '40px';
|
||||
* div.style.height = '40px';
|
||||
* div.style.backgroundColor = 'lime';
|
||||
* div.style.transform = 'translate3d(10px, 0, 0)';
|
||||
*
|
||||
* tween(10, 200, 4000).subscribe(x => {
|
||||
* div.style.transform = `translate3d(${ x }px, 0, 0)`;
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* Providing a custom timestamp provider
|
||||
*
|
||||
* ```ts
|
||||
* import { animationFrames, TimestampProvider } from 'rxjs';
|
||||
*
|
||||
* // A custom timestamp provider
|
||||
* let now = 0;
|
||||
* const customTSProvider: TimestampProvider = {
|
||||
* now() { return now++; }
|
||||
* };
|
||||
*
|
||||
* const source$ = animationFrames(customTSProvider);
|
||||
*
|
||||
* // Log increasing numbers 0...1...2... on every animation frame.
|
||||
* source$.subscribe(({ elapsed }) => console.log(elapsed));
|
||||
* ```
|
||||
*
|
||||
* @param timestampProvider An object with a `now` method that provides a numeric timestamp
|
||||
*/
|
||||
export function animationFrames(timestampProvider?: TimestampProvider) {
|
||||
return timestampProvider ? animationFramesFactory(timestampProvider) : DEFAULT_ANIMATION_FRAMES;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does the work of creating the observable for `animationFrames`.
|
||||
* @param timestampProvider The timestamp provider to use to create the observable
|
||||
*/
|
||||
function animationFramesFactory(timestampProvider?: TimestampProvider) {
|
||||
return new Observable<{ timestamp: number; elapsed: number }>((subscriber) => {
|
||||
// If no timestamp provider is specified, use performance.now() - as it
|
||||
// will return timestamps 'compatible' with those passed to the run
|
||||
// callback and won't be affected by NTP adjustments, etc.
|
||||
const provider = timestampProvider || performanceTimestampProvider;
|
||||
|
||||
// Capture the start time upon subscription, as the run callback can remain
|
||||
// queued for a considerable period of time and the elapsed time should
|
||||
// represent the time elapsed since subscription - not the time since the
|
||||
// first rendered animation frame.
|
||||
const start = provider.now();
|
||||
|
||||
let id = 0;
|
||||
const run = () => {
|
||||
if (!subscriber.closed) {
|
||||
id = animationFrameProvider.requestAnimationFrame((timestamp: DOMHighResTimeStamp | number) => {
|
||||
id = 0;
|
||||
// Use the provider's timestamp to calculate the elapsed time. Note that
|
||||
// this means - if the caller hasn't passed a provider - that
|
||||
// performance.now() will be used instead of the timestamp that was
|
||||
// passed to the run callback. The reason for this is that the timestamp
|
||||
// passed to the callback can be earlier than the start time, as it
|
||||
// represents the time at which the browser decided it would render any
|
||||
// queued frames - and that time can be earlier the captured start time.
|
||||
const now = provider.now();
|
||||
subscriber.next({
|
||||
timestamp: timestampProvider ? now : timestamp,
|
||||
elapsed: now - start,
|
||||
});
|
||||
run();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
run();
|
||||
|
||||
return () => {
|
||||
if (id) {
|
||||
animationFrameProvider.cancelAnimationFrame(id);
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* In the common case, where the timestamp provided by the rAF API is used,
|
||||
* we use this shared observable to reduce overhead.
|
||||
*/
|
||||
const DEFAULT_ANIMATION_FRAMES = animationFramesFactory();
|
||||
@@ -0,0 +1 @@
|
||||
(function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"==typeof window?"undefined"==typeof global?"undefined"==typeof self?this:self:global:window,b.base64js=a()}})(function(){return function(){function b(d,e,g){function a(j,i){if(!e[j]){if(!d[j]){var f="function"==typeof require&&require;if(!i&&f)return f(j,!0);if(h)return h(j,!0);var c=new Error("Cannot find module '"+j+"'");throw c.code="MODULE_NOT_FOUND",c}var k=e[j]={exports:{}};d[j][0].call(k.exports,function(b){var c=d[j][1][b];return a(c||b)},k,k.exports,b,d,e,g)}return e[j].exports}for(var h="function"==typeof require&&require,c=0;c<g.length;c++)a(g[c]);return a}return b}()({"/":[function(a,b,c){'use strict';function d(a){var b=a.length;if(0<b%4)throw new Error("Invalid string. Length must be a multiple of 4");var c=a.indexOf("=");-1===c&&(c=b);var d=c===b?0:4-c%4;return[c,d]}function e(a,b,c){return 3*(b+c)/4-c}function f(a){var b,c,f=d(a),g=f[0],h=f[1],j=new m(e(a,g,h)),k=0,n=0<h?g-4:g;for(c=0;c<n;c+=4)b=l[a.charCodeAt(c)]<<18|l[a.charCodeAt(c+1)]<<12|l[a.charCodeAt(c+2)]<<6|l[a.charCodeAt(c+3)],j[k++]=255&b>>16,j[k++]=255&b>>8,j[k++]=255&b;return 2===h&&(b=l[a.charCodeAt(c)]<<2|l[a.charCodeAt(c+1)]>>4,j[k++]=255&b),1===h&&(b=l[a.charCodeAt(c)]<<10|l[a.charCodeAt(c+1)]<<4|l[a.charCodeAt(c+2)]>>2,j[k++]=255&b>>8,j[k++]=255&b),j}function g(a){return k[63&a>>18]+k[63&a>>12]+k[63&a>>6]+k[63&a]}function h(a,b,c){for(var d,e=[],f=b;f<c;f+=3)d=(16711680&a[f]<<16)+(65280&a[f+1]<<8)+(255&a[f+2]),e.push(g(d));return e.join("")}function j(a){for(var b,c=a.length,d=c%3,e=[],f=16383,g=0,j=c-d;g<j;g+=f)e.push(h(a,g,g+f>j?j:g+f));return 1===d?(b=a[c-1],e.push(k[b>>2]+k[63&b<<4]+"==")):2===d&&(b=(a[c-2]<<8)+a[c-1],e.push(k[b>>10]+k[63&b>>4]+k[63&b<<2]+"=")),e.join("")}c.byteLength=function(a){var b=d(a),c=b[0],e=b[1];return 3*(c+e)/4-e},c.toByteArray=f,c.fromByteArray=j;for(var k=[],l=[],m="undefined"==typeof Uint8Array?Array:Uint8Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,p=n.length;o<p;++o)k[o]=n[o],l[n.charCodeAt(o)]=o;l[45]=62,l[95]=63},{}]},{},[])("/")});
|
||||
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
|
||||
var object = require("es5-ext/object/valid-object")
|
||||
, stringifiable = require("es5-ext/object/validate-stringifiable-value")
|
||||
, forOf = require("es6-iterator/for-of");
|
||||
|
||||
module.exports = function (text, style) {
|
||||
var result = "";
|
||||
text = stringifiable(text);
|
||||
object(style);
|
||||
forOf(text, function (char) { result += style[char] || char; });
|
||||
return result;
|
||||
};
|
||||
@@ -0,0 +1,7 @@
|
||||
import { Observable } from './Observable';
|
||||
export interface LastValueFromConfig<T> {
|
||||
defaultValue: T;
|
||||
}
|
||||
export declare function lastValueFrom<T, D>(source: Observable<T>, config: LastValueFromConfig<D>): Promise<T | D>;
|
||||
export declare function lastValueFrom<T>(source: Observable<T>): Promise<T>;
|
||||
//# sourceMappingURL=lastValueFrom.d.ts.map
|
||||
@@ -0,0 +1,19 @@
|
||||
import './colors.scss';
|
||||
import './button.scss';
|
||||
import './shadow.scss';
|
||||
import './head.scss';
|
||||
import './container.scss';
|
||||
import './footer.scss';
|
||||
import './input.scss';
|
||||
import './pagination.scss';
|
||||
import './sort.scss';
|
||||
import './table.scss';
|
||||
import './tbody.scss';
|
||||
import './td.scss';
|
||||
import './th.scss';
|
||||
import './tr.scss';
|
||||
import './thead.scss';
|
||||
import './wrapper.scss';
|
||||
import './search.scss';
|
||||
import './loadingBar.scss';
|
||||
import './checkbox.scss';
|
||||
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.executeSchedule = void 0;
|
||||
function executeSchedule(parentSubscription, scheduler, work, delay, repeat) {
|
||||
if (delay === void 0) { delay = 0; }
|
||||
if (repeat === void 0) { repeat = false; }
|
||||
var scheduleSubscription = scheduler.schedule(function () {
|
||||
work();
|
||||
if (repeat) {
|
||||
parentSubscription.add(this.schedule(null, delay));
|
||||
}
|
||||
else {
|
||||
this.unsubscribe();
|
||||
}
|
||||
}, delay);
|
||||
parentSubscription.add(scheduleSubscription);
|
||||
if (!repeat) {
|
||||
return scheduleSubscription;
|
||||
}
|
||||
}
|
||||
exports.executeSchedule = executeSchedule;
|
||||
//# sourceMappingURL=executeSchedule.js.map
|
||||
@@ -0,0 +1,32 @@
|
||||
var mapCacheClear = require('./_mapCacheClear'),
|
||||
mapCacheDelete = require('./_mapCacheDelete'),
|
||||
mapCacheGet = require('./_mapCacheGet'),
|
||||
mapCacheHas = require('./_mapCacheHas'),
|
||||
mapCacheSet = require('./_mapCacheSet');
|
||||
|
||||
/**
|
||||
* Creates a map cache object to store key-value pairs.
|
||||
*
|
||||
* @private
|
||||
* @constructor
|
||||
* @param {Array} [entries] The key-value pairs to cache.
|
||||
*/
|
||||
function MapCache(entries) {
|
||||
var index = -1,
|
||||
length = entries == null ? 0 : entries.length;
|
||||
|
||||
this.clear();
|
||||
while (++index < length) {
|
||||
var entry = entries[index];
|
||||
this.set(entry[0], entry[1]);
|
||||
}
|
||||
}
|
||||
|
||||
// Add methods to `MapCache`.
|
||||
MapCache.prototype.clear = mapCacheClear;
|
||||
MapCache.prototype['delete'] = mapCacheDelete;
|
||||
MapCache.prototype.get = mapCacheGet;
|
||||
MapCache.prototype.has = mapCacheHas;
|
||||
MapCache.prototype.set = mapCacheSet;
|
||||
|
||||
module.exports = MapCache;
|
||||
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"name": "unbox-primitive",
|
||||
"version": "1.0.2",
|
||||
"description": "Unbox a boxed JS primitive value.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"prepublish": "not-in-publish || npm run prepublishOnly",
|
||||
"prepublishOnly": "safe-publish-latest",
|
||||
"lint": "eslint --ext=js,mjs .",
|
||||
"pretest": "npm run lint",
|
||||
"tests-only": "nyc tape 'test/**/*.js'",
|
||||
"test": "npm run tests-only",
|
||||
"posttest": "aud --production",
|
||||
"version": "auto-changelog && git add CHANGELOG.md",
|
||||
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/ljharb/unbox-primitive.git"
|
||||
},
|
||||
"keywords": [
|
||||
"unbox",
|
||||
"boxed",
|
||||
"primitive",
|
||||
"object",
|
||||
"javascript",
|
||||
"ecmascript"
|
||||
],
|
||||
"author": "Jordan Harband <ljharb@gmail.com>",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
},
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/ljharb/unbox-primitive/issues"
|
||||
},
|
||||
"homepage": "https://github.com/ljharb/unbox-primitive#readme",
|
||||
"devDependencies": {
|
||||
"@ljharb/eslint-config": "^21.0.0",
|
||||
"aud": "^2.0.0",
|
||||
"auto-changelog": "^2.4.0",
|
||||
"eslint": "=8.8.0",
|
||||
"for-each": "^0.3.3",
|
||||
"in-publish": "^2.0.1",
|
||||
"nyc": "^10.3.2",
|
||||
"object-inspect": "^1.12.0",
|
||||
"object-is": "^1.1.5",
|
||||
"safe-publish-latest": "^2.0.0",
|
||||
"tape": "^5.5.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"call-bind": "^1.0.2",
|
||||
"has-bigints": "^1.0.2",
|
||||
"has-symbols": "^1.0.3",
|
||||
"which-boxed-primitive": "^1.0.2"
|
||||
},
|
||||
"auto-changelog": {
|
||||
"output": "CHANGELOG.md",
|
||||
"template": "keepachangelog",
|
||||
"unreleased": false,
|
||||
"commitLimit": false,
|
||||
"backfillLimit": false,
|
||||
"hideCredit": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* Assign properties from `props` to `obj`
|
||||
* @template O, P The obj and props types
|
||||
* @param {O} obj The object to copy properties to
|
||||
* @param {P} props The object to copy properties from
|
||||
* @returns {O & P}
|
||||
*/
|
||||
export function assign(obj, props) {
|
||||
for (let i in props) obj[i] = props[i];
|
||||
return /** @type {O & P} */ (obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if two objects have a different shape
|
||||
* @param {object} a
|
||||
* @param {object} b
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function shallowDiffers(a, b) {
|
||||
for (let i in a) if (i !== '__source' && !(i in b)) return true;
|
||||
for (let i in b) if (i !== '__source' && a[i] !== b[i]) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
export function removeNode(node) {
|
||||
let parentNode = node.parentNode;
|
||||
if (parentNode) parentNode.removeChild(node);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if two values are the same value
|
||||
* @param {*} x
|
||||
* @param {*} y
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function is(x, y) {
|
||||
return (x === y && (x !== 0 || 1 / x === 1 / y)) || (x !== x && y !== y);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
import { AppendTarget, CompileOptions } from '../../interfaces';
|
||||
import { INode } from '../nodes/interfaces';
|
||||
import { Expression, TemplateLiteral, Identifier } from 'estree';
|
||||
export interface RenderOptions extends CompileOptions {
|
||||
locate: (c: number) => {
|
||||
line: number;
|
||||
column: number;
|
||||
};
|
||||
head_id?: string;
|
||||
}
|
||||
export default class Renderer {
|
||||
has_bindings: boolean;
|
||||
name: Identifier;
|
||||
stack: Array<{
|
||||
current: {
|
||||
value: string;
|
||||
};
|
||||
literal: TemplateLiteral;
|
||||
}>;
|
||||
current: {
|
||||
value: string;
|
||||
};
|
||||
literal: TemplateLiteral;
|
||||
targets: AppendTarget[];
|
||||
constructor({ name }: {
|
||||
name: any;
|
||||
});
|
||||
add_string(str: string): void;
|
||||
add_expression(node: Expression): void;
|
||||
push(): void;
|
||||
pop(): TemplateLiteral;
|
||||
render(nodes: INode[], options: RenderOptions): void;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"once","version":"1.4.0","files":{"LICENSE":{"checkedAt":1678883670198,"integrity":"sha512-P6dI5Z+zrwxSk1MIRPqpYG2ScYNkidLIATQXd50QzBgBh/XmcEd/nsd9NB4O9k6rfc+4dsY5DwJ7xvhpoS0PRg==","mode":420,"size":765},"package.json":{"checkedAt":1678883673340,"integrity":"sha512-jfG3icVNhEy7rDq5noKJP5cfjz1Db3MZpNLtd1erhblF2C8CHpqx1tu7Nfq3/R+fhORw5SX1bE9DCK2/p2ho3A==","mode":420,"size":574},"README.md":{"checkedAt":1678883673340,"integrity":"sha512-zbuLOfJaovEpoeOZJZSwPlfRIP4/bgRoS/8AdEkZ7lxFAJ+f4/fl4Wbm9l1xnhqkr24lbZpDBwC8nAzis3vTog==","mode":420,"size":1772},"once.js":{"checkedAt":1678883673340,"integrity":"sha512-nZZn8IDhU0JgxopXqvHR2zaL0D2MmY1LXdPfaN3hiJ4je7c11z0p1lvaUMBb+HzDY3zlBLyIXjLSyQjXBvPcnw==","mode":420,"size":935}}}
|
||||
@@ -0,0 +1,5 @@
|
||||
import Attribute from '../../../nodes/Attribute';
|
||||
import { Expression as ESTreeExpression } from 'estree';
|
||||
export declare function get_class_attribute_value(attribute: Attribute): ESTreeExpression;
|
||||
export declare function get_attribute_value(attribute: Attribute): ESTreeExpression;
|
||||
export declare function get_attribute_expression(attribute: Attribute): ESTreeExpression;
|
||||
@@ -0,0 +1,24 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
|
||||
var Call = require('./Call');
|
||||
var IsArray = require('./IsArray');
|
||||
var GetV = require('./GetV');
|
||||
var IsPropertyKey = require('./IsPropertyKey');
|
||||
|
||||
// https://262.ecma-international.org/6.0/#sec-invoke
|
||||
|
||||
module.exports = function Invoke(O, P) {
|
||||
if (!IsPropertyKey(P)) {
|
||||
throw new $TypeError('Assertion failed: P must be a Property Key');
|
||||
}
|
||||
var argumentsList = arguments.length > 2 ? arguments[2] : [];
|
||||
if (!IsArray(argumentsList)) {
|
||||
throw new $TypeError('Assertion failed: optional `argumentsList`, if provided, must be a List');
|
||||
}
|
||||
var func = GetV(O, P);
|
||||
return Call(func, O, argumentsList);
|
||||
};
|
||||
@@ -0,0 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function bigIntMod(BigIntRemainder, bigint, modulo) {
|
||||
var remain = BigIntRemainder(bigint, modulo);
|
||||
return remain >= 0 ? remain : remain + modulo;
|
||||
};
|
||||
@@ -0,0 +1,62 @@
|
||||
"use strict";
|
||||
|
||||
var ensureNaturalNumber = require("type/natural-number/ensure")
|
||||
, ensurePlainFunction = require("type/plain-function/ensure")
|
||||
, ensure = require("type/ensure")
|
||||
, defineFunctionLength = require("../lib/private/define-function-length");
|
||||
|
||||
module.exports = function (limit, callback) {
|
||||
limit = ensure(
|
||||
["limit", limit, ensureNaturalNumber, { min: 1 }],
|
||||
["callback", callback, ensurePlainFunction]
|
||||
)[0];
|
||||
|
||||
var Promise = this, ongoingCount = 0, pending = [];
|
||||
var onSuccess, onFailure;
|
||||
|
||||
var release = function () {
|
||||
--ongoingCount;
|
||||
if (ongoingCount >= limit) return;
|
||||
var next = pending.shift();
|
||||
if (!next) return;
|
||||
++ongoingCount;
|
||||
try {
|
||||
next.resolve(
|
||||
Promise.resolve(callback.apply(next.context, next.arguments)).then(
|
||||
onSuccess, onFailure
|
||||
)
|
||||
);
|
||||
} catch (exception) {
|
||||
release();
|
||||
next.reject(exception);
|
||||
}
|
||||
};
|
||||
|
||||
onSuccess = function (value) {
|
||||
release();
|
||||
return value;
|
||||
};
|
||||
|
||||
onFailure = function (exception) {
|
||||
release();
|
||||
throw exception;
|
||||
};
|
||||
|
||||
return defineFunctionLength(callback.length, function () {
|
||||
if (ongoingCount >= limit) {
|
||||
var context = this, args = arguments;
|
||||
return new Promise(function (resolve, reject) {
|
||||
pending.push({
|
||||
context: context,
|
||||
arguments: args,
|
||||
resolve: resolve,
|
||||
reject: reject
|
||||
});
|
||||
});
|
||||
}
|
||||
++ongoingCount;
|
||||
try {
|
||||
return Promise.resolve(callback.apply(this, arguments)).then(onSuccess, onFailure);
|
||||
} catch (exception) { return onFailure(exception); }
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,61 @@
|
||||
// HSL to RGB converter. Both methods adapted from:
|
||||
// http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript
|
||||
|
||||
function hslToRgb(h, s, l) {
|
||||
var r, g, b;
|
||||
|
||||
// normalize hue orientation b/w 0 and 360 degrees
|
||||
h = h % 360;
|
||||
if (h < 0)
|
||||
h += 360;
|
||||
h = ~~h / 360;
|
||||
|
||||
if (s < 0)
|
||||
s = 0;
|
||||
else if (s > 100)
|
||||
s = 100;
|
||||
s = ~~s / 100;
|
||||
|
||||
if (l < 0)
|
||||
l = 0;
|
||||
else if (l > 100)
|
||||
l = 100;
|
||||
l = ~~l / 100;
|
||||
|
||||
if (s === 0) {
|
||||
r = g = b = l; // achromatic
|
||||
} else {
|
||||
var q = l < 0.5 ?
|
||||
l * (1 + s) :
|
||||
l + s - l * s;
|
||||
var p = 2 * l - q;
|
||||
r = hueToRgb(p, q, h + 1/3);
|
||||
g = hueToRgb(p, q, h);
|
||||
b = hueToRgb(p, q, h - 1/3);
|
||||
}
|
||||
|
||||
return [~~(r * 255), ~~(g * 255), ~~(b * 255)];
|
||||
}
|
||||
|
||||
function hueToRgb(p, q, t) {
|
||||
if (t < 0) t += 1;
|
||||
if (t > 1) t -= 1;
|
||||
if (t < 1/6) return p + (q - p) * 6 * t;
|
||||
if (t < 1/2) return q;
|
||||
if (t < 2/3) return p + (q - p) * (2/3 - t) * 6;
|
||||
return p;
|
||||
}
|
||||
|
||||
function shortenHsl(hue, saturation, lightness) {
|
||||
var asRgb = hslToRgb(hue, saturation, lightness);
|
||||
var redAsHex = asRgb[0].toString(16);
|
||||
var greenAsHex = asRgb[1].toString(16);
|
||||
var blueAsHex = asRgb[2].toString(16);
|
||||
|
||||
return '#' +
|
||||
((redAsHex.length == 1 ? '0' : '') + redAsHex) +
|
||||
((greenAsHex.length == 1 ? '0' : '') + greenAsHex) +
|
||||
((blueAsHex.length == 1 ? '0' : '') + blueAsHex);
|
||||
}
|
||||
|
||||
module.exports = shortenHsl;
|
||||
@@ -0,0 +1,35 @@
|
||||
<script>
|
||||
|
||||
import {createRouteObject} from './../dist/tinro_lib';
|
||||
|
||||
export let path = '/*';
|
||||
export let fallback = false;
|
||||
export let redirect = false;
|
||||
export let firstmatch = false;
|
||||
export let breadcrumb = null;
|
||||
|
||||
let showContent = false;
|
||||
let params = {}; /* DEPRECATED */
|
||||
let meta = {};
|
||||
|
||||
const route = createRouteObject({
|
||||
fallback,
|
||||
onShow(){showContent=true},
|
||||
onHide(){showContent=false},
|
||||
onMeta(newmeta){
|
||||
meta=newmeta;
|
||||
params = meta.params /* DEPRECATED */
|
||||
}
|
||||
});
|
||||
|
||||
$: route.update({
|
||||
path,
|
||||
redirect,
|
||||
firstmatch,
|
||||
breadcrumb,
|
||||
});
|
||||
</script>
|
||||
|
||||
{#if showContent}
|
||||
<slot {params} {meta}></slot>
|
||||
{/if}
|
||||
@@ -0,0 +1,120 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [v1.1.10](https://github.com/inspect-js/is-typed-array/compare/v1.1.9...v1.1.10) - 2022-11-02
|
||||
|
||||
### Commits
|
||||
|
||||
- [meta] add `auto-changelog` [`cf6d86b`](https://github.com/inspect-js/is-typed-array/commit/cf6d86bf2f693eca357439d4d12e76d641f91f92)
|
||||
- [actions] update rebase action to use reusable workflow [`8da51a5`](https://github.com/inspect-js/is-typed-array/commit/8da51a5dce6d2442ae31ccbc2be136f2e04d6bef)
|
||||
- [Dev Deps] update `aud`, `is-callable`, `object-inspect`, `tape` [`554e3de`](https://github.com/inspect-js/is-typed-array/commit/554e3deec59dec926d0badc628e589ab363e465b)
|
||||
- [Refactor] use `gopd` instead of an `es-abstract` helper` [`cdaa465`](https://github.com/inspect-js/is-typed-array/commit/cdaa465d5f94bfc9e32475e31209e1c2458a9603)
|
||||
- [Deps] update `es-abstract` [`677ae4b`](https://github.com/inspect-js/is-typed-array/commit/677ae4b3c8323b59d6650a9254ab945045c33f79)
|
||||
|
||||
<!-- auto-changelog-above -->
|
||||
|
||||
1.1.9 / 2022-05-13
|
||||
=================
|
||||
* [Refactor] use `foreach` instead of `for-each`
|
||||
* [readme] markdown URL cleanup
|
||||
* [Deps] update `es-abstract`
|
||||
* [meta] use `npmignore` to autogenerate an npmignore file
|
||||
* [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `object-inspect`, `safe-publish-latest`, `tape`
|
||||
* [actions] reuse common workflows
|
||||
* [actions] update codecov uploader
|
||||
|
||||
1.1.8 / 2021-08-30
|
||||
=================
|
||||
* [Refactor] use `globalThis` if available (#53)
|
||||
* [Deps] update `available-typed-arrays`
|
||||
* [Dev Deps] update `@ljharb/eslint-config`
|
||||
|
||||
1.1.7 / 2021-08-07
|
||||
=================
|
||||
* [Fix] if Symbol.toStringTag exists but is not present, use Object.prototype.toString
|
||||
* [Dev Deps] update `is-callable`, `tape`
|
||||
|
||||
1.1.6 / 2021-08-05
|
||||
=================
|
||||
* [Fix] use `has-tostringtag` to behave correctly in the presence of symbol shams
|
||||
* [readme] add actions and codecov badges
|
||||
* [meta] use `prepublishOnly` script for npm 7+
|
||||
* [Deps] update `available-typed-arrays`, `es-abstract`
|
||||
* [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `object-inspect`, `tape`
|
||||
* [actions] use `node/install` instead of `node/run`; use `codecov` action
|
||||
|
||||
1.1.5 / 2021-02-14
|
||||
=================
|
||||
* [meta] do not publish github action workflow files or nyc output
|
||||
* [Deps] update `call-bind`, `es-abstract`
|
||||
* [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `is-callable`, `tape`
|
||||
|
||||
1.1.4 / 2020-12-05
|
||||
=================
|
||||
* [readme] fix repo URLs, remove defunct badges
|
||||
* [Deps] update `available-typed-arrays`, `es-abstract`; use `call-bind` where applicable
|
||||
* [meta] gitignore nyc output
|
||||
* [meta] only audit prod deps
|
||||
* [actions] add "Allow Edits" workflow
|
||||
* [actions] switch Automatic Rebase workflow to `pull_request_target` event
|
||||
* [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `is-callable`, `make-arrow-function`, `make-generator-function`, `object-inspect`, `tape`; add `aud`
|
||||
* [Tests] migrate tests to Github Actions
|
||||
* [Tests] run `nyc` on all tests
|
||||
|
||||
1.1.3 / 2020-01-24
|
||||
=================
|
||||
* [Refactor] use `es-abstract`’s `callBound`, `available-typed-arrays`, `has-symbols`
|
||||
|
||||
1.1.2 / 2020-01-20
|
||||
=================
|
||||
* [Fix] in envs without Symbol.toStringTag, dc8a8cc made arrays return `true`
|
||||
* [Tests] add `evalmd` to `prelint`
|
||||
|
||||
1.1.1 / 2020-01-18
|
||||
=================
|
||||
* [Robustness] don’t rely on Array.prototype.indexOf existing
|
||||
* [meta] remove unused Makefile and associated utilities
|
||||
* [meta] add `funding` field; create FUNDING.yml
|
||||
* [actions] add automatic rebasing / merge commit blocking
|
||||
* [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `is-callable`, `replace`, `semver`, `tape`; add `safe-publish-latest`
|
||||
* [Tests] use shared travis-ci configs
|
||||
* [Tests] use `npx aud` instead of `nsp` or `npm audit` with hoops
|
||||
|
||||
1.1.0 / 2019-02-16
|
||||
=================
|
||||
* [New] add `BigInt64Array` and `BigUint64Array`
|
||||
* [Refactor] use an array instead of an object for storing Typed Array names
|
||||
* [meta] ignore `test.html`
|
||||
* [Tests] up to `node` `v11.10`, `v10.15`, `v8.15`, `v7.10`, `v6.16`, `v5.10`, `v4.9`
|
||||
* [Tests] remove `jscs`
|
||||
* [Tests] use `npm audit` instead of `nsp`
|
||||
* [Dev Deps] update `eslint`,` @ljharb/eslint-config`, `is-callable`, `tape`, `replace`, `semver`
|
||||
* [Dev Deps] remove unused eccheck script + dep
|
||||
|
||||
1.0.4 / 2016-03-19
|
||||
=================
|
||||
* [Fix] `Symbol.toStringTag` is on the super-`[[Prototype]]` of Float32Array, not the `[[Prototype]]` (#3)
|
||||
* [Tests] up to `node` `v5.9`, `v4.4`
|
||||
* [Tests] use pretest/posttest for linting/security
|
||||
* [Dev Deps] update `tape`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config`, `semver`, `is-callable`
|
||||
|
||||
1.0.3 / 2015-10-13
|
||||
=================
|
||||
* [Deps] Add missing `foreach` dependency (#1)
|
||||
|
||||
1.0.2 / 2015-10-05
|
||||
=================
|
||||
* [Deps] Remove unneeded "isarray" dependency
|
||||
* [Dev Deps] update `eslint`, `@ljharb/eslint-config`
|
||||
|
||||
1.0.1 / 2015-10-02
|
||||
=================
|
||||
* Rerelease: avoid instanceof and the constructor property; work cross-realm; work with Symbol.toStringTag.
|
||||
|
||||
1.0.0 / 2015-05-06
|
||||
=================
|
||||
* Initial release.
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"1":"F A B","2":"J D E CC"},B:{"1":"C K L G M N O P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H"},C:{"1":"0 1 2 3 4 5 6 7 8 9 I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB","2":"DC tB EC FC"},D:{"1":"0 1 2 3 4 5 6 7 8 9 I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB GC"},E:{"1":"J D E F A B C K L G IC JC KC LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","2":"I HC zB","16":"v"},F:{"1":"0 1 2 3 4 5 6 7 8 9 B C G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e qB AC TC rB","2":"F PC QC RC SC"},G:{"1":"E UC BC VC WC XC YC ZC aC bC cC dC eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B","16":"zB"},H:{"1":"oC"},I:{"1":"tB I f rC sC BC tC uC","16":"pC qC"},J:{"1":"D A"},K:{"1":"B C h qB AC rB","2":"A"},L:{"1":"H"},M:{"1":"H"},N:{"1":"A B"},O:{"1":"vC"},P:{"1":"I g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C"},Q:{"1":"1B"},R:{"1":"9C"},S:{"1":"AD BD"}},B:1,C:"document.head"};
|
||||
@@ -0,0 +1,71 @@
|
||||
// based on @types/postcss-load-config@2.0.1
|
||||
// Type definitions for postcss-load-config 2.1
|
||||
import Processor from 'postcss/lib/processor';
|
||||
import { Plugin, ProcessOptions, Transformer } from 'postcss';
|
||||
import { Options as ConfigOptions } from "lilconfig";
|
||||
|
||||
declare function postcssrc(
|
||||
ctx?: postcssrc.ConfigContext,
|
||||
path?: string,
|
||||
options?: ConfigOptions
|
||||
): Promise<postcssrc.Result>;
|
||||
|
||||
declare namespace postcssrc {
|
||||
function sync(
|
||||
ctx?: ConfigContext,
|
||||
path?: string,
|
||||
options?: ConfigOptions
|
||||
): Result;
|
||||
|
||||
// In the ConfigContext, these three options can be instances of the
|
||||
// appropriate class, or strings. If they are strings, postcss-load-config will
|
||||
// require() them and pass the instances along.
|
||||
export interface ProcessOptionsPreload {
|
||||
parser?: string | ProcessOptions['parser'];
|
||||
stringifier?: string | ProcessOptions['stringifier'];
|
||||
syntax?: string | ProcessOptions['syntax'];
|
||||
}
|
||||
|
||||
// The remaining ProcessOptions, sans the three above.
|
||||
export type RemainingProcessOptions = Pick<
|
||||
ProcessOptions,
|
||||
Exclude<keyof ProcessOptions, keyof ProcessOptionsPreload>
|
||||
>;
|
||||
|
||||
// Additional context options that postcss-load-config understands.
|
||||
export interface Context {
|
||||
cwd?: string;
|
||||
env?: string;
|
||||
}
|
||||
|
||||
// The full shape of the ConfigContext.
|
||||
export type ConfigContext = Context &
|
||||
ProcessOptionsPreload &
|
||||
RemainingProcessOptions;
|
||||
|
||||
// Result of postcssrc is a Promise containing the filename plus the options
|
||||
// and plugins that are ready to pass on to postcss.
|
||||
export type ResultPlugin = Plugin | Transformer | Processor;
|
||||
|
||||
export interface Result {
|
||||
file: string;
|
||||
options: ProcessOptions;
|
||||
plugins: ResultPlugin[];
|
||||
}
|
||||
|
||||
export type ConfigPlugin = Transformer | Plugin | Processor;
|
||||
|
||||
export interface Config {
|
||||
parser?: string | ProcessOptions['parser'] | false;
|
||||
stringifier?: string | ProcessOptions['stringifier'] | false;
|
||||
syntax?: string | ProcessOptions['syntax'] | false;
|
||||
map?: string | false;
|
||||
from?: string;
|
||||
to?: string;
|
||||
plugins?: Array<ConfigPlugin | false> | Record<string, object | false>;
|
||||
}
|
||||
|
||||
export type ConfigFn = (ctx: ConfigContext) => Config | Promise<Config>;
|
||||
}
|
||||
|
||||
export = postcssrc;
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J D E F A B CC"},B:{"1":"P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H","2":"C K L G M N O"},C:{"1":"CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB","2":"0 1 2 3 4 5 6 7 8 9 DC tB I v J D E F A B C K L G M N O w g x y z AB BB EC FC"},D:{"1":"vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB GC","2":"0 1 2 3 4 5 6 7 8 9 I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB"},E:{"1":"L G MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","2":"I v J D E F HC zB IC JC KC LC","132":"A B C K 0B qB rB 1B"},F:{"1":"OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e","2":"0 1 2 3 4 5 6 7 8 9 F B C G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB PC QC RC SC qB AC TC rB"},G:{"1":"mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B","2":"E zB UC BC VC WC XC YC ZC aC","132":"bC cC dC eC fC gC hC iC jC kC lC"},H:{"2":"oC"},I:{"1":"f","2":"tB I pC qC rC sC BC tC uC"},J:{"2":"D A"},K:{"1":"h","2":"A B C qB AC rB"},L:{"1":"H"},M:{"1":"H"},N:{"2":"A B"},O:{"1":"vC"},P:{"1":"g zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C","2":"I wC xC yC"},Q:{"1":"1B"},R:{"1":"9C"},S:{"1":"AD BD"}},B:5,C:"Scroll methods on elements (scroll, scrollTo, scrollBy)"};
|
||||
Reference in New Issue
Block a user