docs: 仓库链接指向本镜像仓库
Build NapCat Artifacts / Type Check & Test (push) Waiting to run

This commit is contained in:
TanTan committed 2026-11-13 09:25:58 +08:00
1 parent f954252a34
commit e311ca3275
35554 files changed
+6229626 -4

No files matched your search

@@ -0,0 +1,21 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const reflection_helpers_1 = require("../reflection-helpers");
const dependency_container_1 = require("../dependency-container");
const dependency_container_2 = require("../dependency-container");
function injectable(options) {
return function (target) {
dependency_container_1.typeInfo.set(target, reflection_helpers_1.getParamInfo(target));
if (options && options.token) {
if (!Array.isArray(options.token)) {
dependency_container_2.instance.register(options.token, target);
}
else {
options.token.forEach(token => {
dependency_container_2.instance.register(token, target);
});
}
}
};
}
exports.default = injectable;
@@ -0,0 +1,14 @@
export { default as Checkbox, CheckboxProps } from './checkbox.mjs';
export { default as CheckboxGroup, CheckboxGroupProps } from './checkbox-group.mjs';
export { CheckboxIconProps, useCheckbox } from './use-checkbox.mjs';
export { useCheckboxGroup } from './use-checkbox-group.mjs';
export { CheckboxGroupProvider, useCheckboxGroupContext } from './checkbox-group-context.mjs';
export { CheckboxIcon } from './checkbox-icon.mjs';
import '@heroui/system';
import '@heroui/theme';
import '@react-types/checkbox';
import 'react';
import '@react-types/shared';
import '@heroui/react-utils';
import '@react-stately/checkbox';
import 'react/jsx-runtime';
@@ -0,0 +1,72 @@
// Copyright (c) 2016 Ryan Prichard
//
// 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.
#ifndef LIBWINPTY_WINPTY_INTERNAL_H
#define LIBWINPTY_WINPTY_INTERNAL_H
#include <memory>
#include <string>
#include "../include/winpty.h"
#include "../shared/Mutex.h"
#include "../shared/OwnedHandle.h"
// The structures in this header are not intended to be accessed directly by
// client programs.
struct winpty_error_s {
winpty_result_t code;
const wchar_t *msgStatic;
// Use a pointer to a std::shared_ptr so that the struct remains simple
// enough to statically initialize, for the benefit of static error
// objects like kOutOfMemory.
std::shared_ptr<std::wstring> *msgDynamic;
};
struct winpty_config_s {
uint64_t flags = 0;
int cols = 80;
int rows = 25;
int mouseMode = WINPTY_MOUSE_MODE_AUTO;
DWORD timeoutMs = 30000;
};
struct winpty_s {
Mutex mutex;
OwnedHandle agentProcess;
OwnedHandle controlPipe;
DWORD agentTimeoutMs = 0;
OwnedHandle ioEvent;
std::wstring spawnDesktopName;
std::wstring coninPipeName;
std::wstring conoutPipeName;
std::wstring conerrPipeName;
};
struct winpty_spawn_config_s {
uint64_t winptyFlags = 0;
std::wstring appname;
std::wstring cmdline;
std::wstring cwd;
std::wstring env;
};
#endif // LIBWINPTY_WINPTY_INTERNAL_H
@@ -0,0 +1 @@
{"name":"yallist","version":"4.0.0","requiresBuild":false,"files":{"LICENSE":{"checkedAt":1794532119584,"integrity":"sha512-P6dI5Z+zrwxSk1MIRPqpYG2ScYNkidLIATQXd50QzBgBh/XmcEd/nsd9NB4O9k6rfc+4dsY5DwJ7xvhpoS0PRg==","mode":420,"size":765},"iterator.js":{"checkedAt":1794532119584,"integrity":"sha512-gdEBfYpX2q8L4tHZwoKV39GhQ2qnmpbwvu+K+8y8fp7lVGhdXPpacQtlGn2Xo/kooGqITRLY69eA22wu6NeDWw==","mode":420,"size":207},"yallist.js":{"checkedAt":1794532119584,"integrity":"sha512-MU4uXuqGeBGRAKzaslH9tyMEDVYrNP83Pev9va1xBzmdM8YVRdAxkCB+XDLlvYWJfVJsdYL7LOQ2PsSav3G7Ng==","mode":420,"size":8411},"package.json":{"checkedAt":1794532119584,"integrity":"sha512-vIVxLDkmlFd0i5hbmVampMB0KXbo5X2jLhL547BcH8OpFvVtgxlDds7KorQeDifK03JaaOB5PokaACJxD1HO1A==","mode":420,"size":652},"README.md":{"checkedAt":1794532119585,"integrity":"sha512-r+xy8CtSKInl7bODQ7P3Q0gPrK/lM9eEXzgUF7UxghBQbrH1Xb8k6PKpUunSSAa7dTSZ+JtRaQx39sLXF5Klpw==","mode":420,"size":4717}}}
@@ -0,0 +1,21 @@
(The MIT License)
Copyright (c) 2014 Titus Wormer <tituswormer@gmail.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,4 @@
import type { ScalarTag } from '../types';
export declare const floatNaN: ScalarTag;
export declare const floatExp: ScalarTag;
export declare const float: ScalarTag;
@@ -0,0 +1 @@
{"mappings":";;;;;AAAA;;;;;;;;;;CAUC;;;;AASD,MAAM,gCAAU;AAChB,MAAM,gCAAU;AAChB,MAAM,qCAAe;AACrB,MAAM,2CAAqB;AAC3B,MAAM,oCAAc;AACpB,MAAM,8CACF;AACJ,MAAM,mDAA6B;IAAC;IAAS;IAAW;CAAU;AAClE,MAAM,+CAAyB;IAAC;IAAS;IAAU;IAAS;OAAW;CAA2B;AAG3F,SAAS,0CAAU,KAAa;IACrC,IAAI,IAAI,MAAM,KAAK,CAAC;IACpB,IAAI,CAAC,GACH,MAAM,IAAI,MAAM,mCAAmC;IAGrD,OAAO,IAAI,CAAA,GAAA,wCAAG,EACZ,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,KACrB,CAAC,CAAC,EAAE,GAAG,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,MAAM,GAClC,CAAC,CAAC,EAAE,GAAG,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,MAAM,GAClC,CAAC,CAAC,EAAE,GAAG,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,YAAY,OAAO;AAEnD;AAGO,SAAS,yCAAU,KAAa;IACrC,IAAI,IAAI,MAAM,KAAK,CAAC;IACpB,IAAI,CAAC,GACH,MAAM,IAAI,MAAM,mCAAmC;IAGrD,IAAI,OAA8B,IAAI,CAAA,GAAA,yCAAW,EAC/C,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,OACrB,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,KACrB;IAGF,KAAK,GAAG,GAAG,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,KAAK,QAAQ,CAAC,cAAc,CAAC;IAC7D,OAAO;AACT;AAGO,SAAS,0CAAc,KAAa;IACzC,IAAI,IAAI,MAAM,KAAK,CAAC;IACpB,IAAI,CAAC,GACH,MAAM,IAAI,MAAM,wCAAwC;IAG1D,IAAI,OAAO,kCAAY,CAAC,CAAC,EAAE,EAAE,OAAO;IACpC,IAAI,MAAM,OAAO,IAAI,OAAO;IAE5B,IAAI,OAAkC,IAAI,CAAA,GAAA,yCAAe,EACvD,KACA,OAAO,IAAI,CAAC,OAAO,IAAI,MACvB,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,KACrB,GACA,CAAC,CAAC,EAAE,GAAG,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,MAAM,GAClC,CAAC,CAAC,EAAE,GAAG,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,MAAM,GAClC,CAAC,CAAC,EAAE,GAAG,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,MAAM,GAClC,CAAC,CAAC,EAAE,GAAG,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,YAAY,OAAO;IAGjD,KAAK,GAAG,GAAG,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,KAAK,QAAQ,CAAC,cAAc,CAAC;IAC7D,OAAO;AACT;AAQO,SAAS,0CAAmB,KAAa,EAAE,cAA+B;IAC/E,IAAI,IAAI,MAAM,KAAK,CAAC;IACpB,IAAI,CAAC,GACH,MAAM,IAAI,MAAM,wCAAwC;IAG1D,IAAI,OAAO,kCAAY,CAAC,CAAC,EAAE,EAAE,OAAO;IACpC,IAAI,MAAM,OAAO,IAAI,OAAO;IAE5B,IAAI,OAA+B,IAAI,CAAA,GAAA,yCAAY,EACjD,KACA,OAAO,IAAI,CAAC,OAAO,IAAI,MACvB,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,KACrB,GACA,CAAC,CAAC,GAAG,EACL,GACA,CAAC,CAAC,EAAE,GAAG,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,MAAM,GAClC,CAAC,CAAC,EAAE,GAAG,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,MAAM,GAClC,CAAC,CAAC,EAAE,GAAG,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,MAAM,GAClC,CAAC,CAAC,EAAE,GAAG,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,YAAY,OAAO;IAGjD,KAAK,GAAG,GAAG,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,KAAK,QAAQ,CAAC,cAAc,CAAC;IAE7D,IAAI,gBAAgB,CAAA,GAAA,yCAAiB,EAAE;IAEvC,IAAI;IACJ,IAAI,CAAC,CAAC,EAAE,EAAE;QACR,IAAI,aAAa,kCAAY,CAAC,CAAC,EAAE,EAAE,KAAK;YACmD,KAA8C;QAAzI,KAAK,MAAM,GAAG,KAAK,IAAI,CAAC,cAAe,CAAA,KAAK,GAAG,CAAC,cAAT,UAAwC,kCAAY,CAAA,MAAA,CAAC,CAAC,EAAE,cAAJ,iBAAA,MAAQ,KAAK,GAAG,MAA5B,QAA8C,kCAAY,CAAA,OAAA,CAAC,CAAC,GAAG,cAAL,kBAAA,OAAS,KAAK,GAAG,MAAM,IAAG;QACnK,KAAK,CAAA,GAAA,wCAAY,EAAE,QAAyB,KAAK,MAAM;QAEvD,uCAAuC;QACvC,IAAI,YAAY,CAAA,GAAA,yCAAgB,EAAE,eAAe,KAAK,QAAQ;QAC9D,IAAI,CAAC,UAAU,QAAQ,CAAC,KACtB,MAAM,IAAI,MAAM,CAAC,OAAO,EAAE,qCAAe,KAAK,MAAM,EAAE,gBAAgB,EAAE,0CAAiB,MAAM,IAAI,EAAE,KAAK,QAAQ,EAAE;IAExH,OACE,gEAAgE;IAChE,KAAK,CAAA,GAAA,yCAAS,EAAE,CAAA,GAAA,yCAAiB,EAAE,gBAAgB,KAAK,QAAQ,EAAE;IAGpE,OAAO,CAAA,GAAA,yCAAW,EAAE,IAAI,KAAK,QAAQ;AACvC;AAMO,SAAS,0CAAc,KAAa,EAAE,QAAgB;IAC3D,IAAI,IAAI,MAAM,KAAK,CAAC;IACpB,IAAI,CAAC,GACH,MAAM,IAAI,MAAM,wCAAwC;IAG1D,IAAI,OAAO,kCAAY,CAAC,CAAC,EAAE,EAAE,OAAO;IACpC,IAAI,MAAM,OAAO,IAAI,OAAO;IAE5B,IAAI,OAA+B,IAAI,CAAA,GAAA,yCAAY,EACjD,KACA,OAAO,IAAI,CAAC,OAAO,IAAI,MACvB,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,KACrB,GACA,UACA,GACA,CAAC,CAAC,EAAE,GAAG,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,MAAM,GAClC,CAAC,CAAC,EAAE,GAAG,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,MAAM,GAClC,CAAC,CAAC,EAAE,GAAG,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,MAAM,GAClC,CAAC,CAAC,EAAE,GAAG,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,YAAY,OAAO;IAGjD,KAAK,GAAG,GAAG,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,KAAK,QAAQ,CAAC,cAAc,CAAC;QAGa;IAD1E,IAAI,CAAC,CAAC,EAAE,EACN,KAAK,MAAM,GAAG,kCAAY,CAAC,CAAC,EAAE,EAAE,KAAK,MAAvB,UAA8C,kCAAY,CAAA,MAAA,CAAC,CAAC,EAAE,cAAJ,iBAAA,MAAQ,KAAK,GAAG,MAA5B;IAG9D,OAAO,CAAA,GAAA,yCAAS,EAAE,MAAuB;AAC3C;AAMO,SAAS,0CAAqB,KAAa;IAChD,OAAO,0CAAc,OAAO,CAAA,GAAA,yCAAe;AAC7C;AAEA,SAAS,kCAAY,KAAa,EAAE,GAAW,EAAE,GAAW;IAC1D,IAAI,MAAM,OAAO;IACjB,IAAI,MAAM,OAAO,MAAM,KACrB,MAAM,IAAI,WAAW,CAAC,oBAAoB,EAAE,IAAI,IAAI,EAAE,IAAI,IAAI,EAAE,KAAK;IAGvE,OAAO;AACT;AAEO,SAAS,0CAAa,IAAU;IACrC,OAAO,GAAG,OAAO,KAAK,IAAI,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC,EAAE,OAAO,KAAK,MAAM,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC,EAAE,OAAO,KAAK,MAAM,EAAE,QAAQ,CAAC,GAAG,OAAO,KAAK,WAAW,GAAG,OAAO,KAAK,WAAW,GAAG,MAAM,KAAK,CAAC,KAAK,IAAI;AACnM;AAEO,SAAS,0CAAa,IAAkB;IAC7C,IAAI,gBAAgB,CAAA,GAAA,yCAAS,EAAE,MAAM,IAAI,CAAA,GAAA,yCAAgB;IACzD,IAAI;IACJ,IAAI,cAAc,GAAG,KAAK,MACxB,OAAO,cAAc,IAAI,KAAK,IAC1B,SACA,MAAM,OAAO,KAAK,GAAG,CAAC,IAAI,cAAc,IAAI,GAAG,QAAQ,CAAC,GAAG;SAE/D,OAAO,OAAO,cAAc,IAAI,EAAE,QAAQ,CAAC,GAAG;IAEhD,OAAO,GAAG,KAAK,CAAC,EAAE,OAAO,cAAc,KAAK,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC,EAAE,OAAO,cAAc,GAAG,EAAE,QAAQ,CAAC,GAAG,MAAM;AAChH;AAEO,SAAS,0CAAiB,IAAiB;IAChD,aAAa;IACb,OAAO,GAAG,0CAAa,MAAM,CAAC,EAAE,0CAAa,OAAO;AACtD;AAEA,SAAS,qCAAe,MAAc;IACpC,IAAI,OAAO,KAAK,IAAI,CAAC,UAAU,IAAI,MAAM;IACzC,SAAS,KAAK,GAAG,CAAC;IAClB,IAAI,cAAc,KAAK,KAAK,CAAC,SAAU;IACvC,IAAI,gBAAgB,KAAK,KAAK,CAAC,AAAC,SAAU,UAAoB;IAC9D,IAAI,gBAAgB,KAAK,KAAK,CAAC,AAAC,SAAU,UAAoB,QAAa;IAC3E,IAAI,eAAe,GAAG,OAAO,OAALine truncated
@@ -0,0 +1,13 @@
import * as _heroui_system from '@heroui/system';
import { UsePaginationProps } from './use-pagination.js';
import 'tailwind-variants';
import '@heroui/theme';
import 'react';
import '@heroui/use-pagination';
import '@react-types/shared';
interface PaginationProps extends UsePaginationProps {
}
declare const Pagination: _heroui_system.InternalForwardRefRenderFunction<"nav", PaginationProps, never>;
export { type PaginationProps, Pagination as default };
@@ -0,0 +1,22 @@
{
"name": "@react-types/calendar",
"version": "3.8.0",
"description": "Spectrum UI components in React",
"license": "Apache-2.0",
"types": "src/index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/adobe/react-spectrum"
},
"dependencies": {
"@internationalized/date": "^3.10.0",
"@react-types/shared": "^3.32.1"
},
"publishConfig": {
"access": "public"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
},
"gitHead": "0bda51183baa23306342af32a82012ea0fe0f2dc"
}
@@ -0,0 +1,52 @@
var arrayFilter = require('./_arrayFilter'),
baseFilter = require('./_baseFilter'),
baseIteratee = require('./_baseIteratee'),
isArray = require('./isArray');
/**
* Iterates over elements of `collection`, returning an array of all elements
* `predicate` returns truthy for. The predicate is invoked with three
* arguments: (value, index|key, collection).
*
* **Note:** Unlike `_.remove`, this method returns a new array.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} [predicate=_.identity] The function invoked per iteration.
* @returns {Array} Returns the new filtered array.
* @see _.reject
* @example
*
* var users = [
* { 'user': 'barney', 'age': 36, 'active': true },
* { 'user': 'fred', 'age': 40, 'active': false }
* ];
*
* _.filter(users, function(o) { return !o.active; });
* // => objects for ['fred']
*
* // The `_.matches` iteratee shorthand.
* _.filter(users, { 'age': 36, 'active': true });
* // => objects for ['barney']
*
* // The `_.matchesProperty` iteratee shorthand.
* _.filter(users, ['active', false]);
* // => objects for ['fred']
*
* // The `_.property` iteratee shorthand.
* _.filter(users, 'active');
* // => objects for ['barney']
*
* // Combining several predicates using `_.overEvery` or `_.overSome`.
* _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]]));
* // => objects for ['fred', 'barney']
*/
function filter(collection, predicate) {
var func = isArray(collection) ? arrayFilter : baseFilter;
return func(collection, baseIteratee(predicate, 3));
}
module.exports = filter;
@@ -0,0 +1,27 @@
// @ts-ignore TS6133
import { expect, test } from "vitest";
import * as z from "zod/v3";
const stringSchema = z.string();
test("safeparse fail", () => {
const safe = stringSchema.safeParse(12);
expect(safe.success).toEqual(false);
expect(safe.error).toBeInstanceOf(z.ZodError);
});
test("safeparse pass", () => {
const safe = stringSchema.safeParse("12");
expect(safe.success).toEqual(true);
expect(safe.data).toEqual("12");
});
test("safeparse unexpected error", () => {
expect(() =>
stringSchema
.refine((data) => {
throw new Error(data);
})
.safeParse("12")
).toThrow();
});
@@ -0,0 +1,29 @@
{
"name": "rc",
"version": "1.2.8",
"description": "hardwired configuration loader",
"main": "index.js",
"browser": "browser.js",
"scripts": {
"test": "set -e; node test/test.js; node test/ini.js; node test/nested-env-vars.js"
},
"repository": {
"type": "git",
"url": "https://github.com/dominictarr/rc.git"
},
"license": "(BSD-2-Clause OR MIT OR Apache-2.0)",
"keywords": [
"config",
"rc",
"unix",
"defaults"
],
"bin": "./cli.js",
"author": "Dominic Tarr <dominic.tarr@gmail.com> (dominictarr.com)",
"dependencies": {
"deep-extend": "^0.6.0",
"ini": "~1.3.0",
"minimist": "^1.2.0",
"strip-json-comments": "~2.0.1"
}
}
@@ -0,0 +1,52 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.buildPlanServiceNodeFromResolvedValueElementMetadata = exports.buildPlanServiceNodeFromClassElementMetadata = void 0;
exports.plan = plan;
const buildGetPlanOptionsFromPlanParams_1 = require("../calculations/buildGetPlanOptionsFromPlanParams");
const handlePlanError_1 = require("../calculations/handlePlanError");
const LazyPlanServiceNode_1 = require("../models/LazyPlanServiceNode");
const curryBuildPlanServiceNode_1 = require("./curryBuildPlanServiceNode");
const curryBuildPlanServiceNodeFromClassElementMetadata_1 = require("./curryBuildPlanServiceNodeFromClassElementMetadata");
const curryBuildPlanServiceNodeFromResolvedValueElementMetadata_1 = require("./curryBuildPlanServiceNodeFromResolvedValueElementMetadata");
const curryBuildServiceNodeBindings_1 = require("./curryBuildServiceNodeBindings");
const currySubplan_1 = require("./currySubplan");
class LazyRootPlanServiceNode extends LazyPlanServiceNode_1.LazyPlanServiceNode {
#params;
constructor(params, serviceNode) {
super(serviceNode, serviceNode.serviceIdentifier);
this.#params = params;
}
_buildPlanServiceNode() {
return buildPlanServiceNode(this.#params);
}
}
exports.buildPlanServiceNodeFromClassElementMetadata = (0, curryBuildPlanServiceNodeFromClassElementMetadata_1.curryBuildPlanServiceNodeFromClassElementMetadata)(circularBuildServiceNodeBindings);
exports.buildPlanServiceNodeFromResolvedValueElementMetadata = (0, curryBuildPlanServiceNodeFromResolvedValueElementMetadata_1.curryBuildPlanServiceNodeFromResolvedValueElementMetadata)(circularBuildServiceNodeBindings);
const subplan = (0, currySubplan_1.currySubplan)(exports.buildPlanServiceNodeFromClassElementMetadata, exports.buildPlanServiceNodeFromResolvedValueElementMetadata, exports.buildPlanServiceNodeFromClassElementMetadata, exports.buildPlanServiceNodeFromResolvedValueElementMetadata);
const buildServiceNodeBindings = (0, curryBuildServiceNodeBindings_1.curryBuildServiceNodeBindings)(subplan);
function circularBuildServiceNodeBindings(params, bindingConstraintsList, serviceBindings, parentNode, chainedBindings) {
return buildServiceNodeBindings(params, bindingConstraintsList, serviceBindings, parentNode, chainedBindings);
}
const buildPlanServiceNode = (0, curryBuildPlanServiceNode_1.curryBuildPlanServiceNode)(buildServiceNodeBindings);
function plan(params) {
try {
const getPlanOptions = (0, buildGetPlanOptionsFromPlanParams_1.buildGetPlanOptionsFromPlanParams)(params);
const planResultFromCache = params.operations.getPlan(getPlanOptions);
if (planResultFromCache !== undefined) {
return planResultFromCache;
}
const serviceNode = buildPlanServiceNode(params);
const planResult = {
tree: {
root: new LazyRootPlanServiceNode(params, serviceNode),
},
};
// Set the plan result in the cache no matter what, even if the plan is context dependent
params.operations.setPlan(getPlanOptions, planResult);
return planResult;
}
catch (error) {
(0, handlePlanError_1.handlePlanError)(params, error);
}
}
//# sourceMappingURL=plan.js.map
@@ -0,0 +1,88 @@
import { PluginFunc } from 'dayjs'
import { OpUnitType, UnitTypeLongPlural } from 'dayjs';
declare const plugin: PluginFunc
export as namespace plugin;
export = plugin
declare namespace plugin {
/**
* @deprecated Please use more strict types
*/
type DurationInputType = string | number | object
/**
* @deprecated Please use more strict types
*/
type DurationAddType = number | object | Duration
type DurationUnitsObjectType = Partial<{
[unit in Exclude<UnitTypeLongPlural, "dates"> | "weeks"]: number
}>;
type DurationUnitType = Exclude<OpUnitType, "date" | "dates">
type CreateDurationType =
((units: DurationUnitsObjectType) => Duration)
& ((time: number, unit?: DurationUnitType) => Duration)
& ((ISO_8601: string) => Duration)
type AddDurationType = CreateDurationType & ((duration: Duration) => Duration)
interface Duration {
new (input: string | number | object, unit?: string, locale?: string): Duration
clone(): Duration
humanize(withSuffix?: boolean): string
milliseconds(): number
asMilliseconds(): number
seconds(): number
asSeconds(): number
minutes(): number
asMinutes(): number
hours(): number
asHours(): number
days(): number
asDays(): number
weeks(): number
asWeeks(): number
months(): number
asMonths(): number
years(): number
asYears(): number
as(unit: DurationUnitType): number
get(unit: DurationUnitType): number
add: AddDurationType
subtract: AddDurationType
toJSON(): string
toISOString(): string
format(formatStr?: string): string
locale(locale: string): Duration
}
}
declare module 'dayjs' {
interface Dayjs {
add(duration: plugin.Duration): Dayjs
subtract(duration: plugin.Duration): Dayjs
}
/**
* @param time If unit is not present, time treated as number of milliseconds
*/
export const duration: plugin.CreateDurationType;
export function isDuration(d: any): d is plugin.Duration
}
@@ -0,0 +1,4 @@
import type { TSESLint } from '@typescript-eslint/utils';
export type MessageIds = 'noNonNull' | 'suggestOptionalChain';
declare const _default: TSESLint.RuleModule<MessageIds, [], import("../../rules").ESLintPluginDocs, TSESLint.RuleListener>;
export default _default;
@@ -0,0 +1,26 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var RadioButtonRole = {
relatedConcepts: [{
module: 'ARIA',
concept: {
name: 'radio'
}
}, {
module: 'HTML',
concept: {
name: 'input',
attributes: [{
name: 'type',
value: 'radio'
}]
}
}],
type: 'widget'
};
var _default = RadioButtonRole;
exports.default = _default;
@@ -0,0 +1 @@
{"version":3,"names":["_helperCompilationTargets","data","require","_options","msg","loc","type","parent","name","index","JSON","stringify","Error","access","assertRootMode","value","undefined","assertSourceMaps","assertCompact","assertSourceType","assertCallerMetadata","obj","assertObject","prop","Object","keys","propLoc","assertInputSourceMap","assertString","assertFunction","assertBoolean","Array","isArray","assertArray","assertIgnoreList","arr","forEach","item","i","assertIgnoreItem","RegExp","assertConfigApplicableTest","checkValidTest","assertConfigFileSearch","assertBabelrcSearch","assertPluginList","assertPluginItem","length","assertPluginTarget","opts","assertTargets","isBrowsersQueryValid","browsersLoc","esmodulesLoc","assertBrowsersList","browsers","esmodules","key","val","subLoc","hasOwnProperty","call","TargetNames","validTargets","join","assertBrowserVersion","Math","round","assertAssumptions","root","inPreset","source","assumptionsNames","has"],"sources":["../../../src/config/validation/option-assertions.ts"],"sourcesContent":["import {\n isBrowsersQueryValid,\n TargetNames,\n} from \"@babel/helper-compilation-targets\";\n\nimport type {\n ConfigFileSearch,\n BabelrcSearch,\n MatchItem,\n PluginTarget,\n ConfigApplicableTest,\n SourceMapsOption,\n SourceTypeOption,\n CompactOption,\n RootInputSourceMapOption,\n NestingPath,\n CallerMetadata,\n RootMode,\n TargetsListOrObject,\n AssumptionName,\n PluginItem,\n} from \"./options.ts\";\n\nimport { assumptionsNames } from \"./options.ts\";\n\nexport type { RootPath } from \"./options.ts\";\n\nexport type ValidatorSet = {\n [name: string]: Validator<any>;\n};\n\nexport type Validator<T> = (loc: OptionPath, value: unknown) => T;\n\nexport function msg(loc: NestingPath | GeneralPath): string {\n switch (loc.type) {\n case \"root\":\n return ``;\n case \"env\":\n return `${msg(loc.parent)}.env[\"${loc.name}\"]`;\n case \"overrides\":\n return `${msg(loc.parent)}.overrides[${loc.index}]`;\n case \"option\":\n return `${msg(loc.parent)}.${loc.name}`;\n case \"access\":\n return `${msg(loc.parent)}[${JSON.stringify(loc.name)}]`;\n default:\n // @ts-expect-error should not happen when code is type checked\n throw new Error(`Assertion failure: Unknown type ${loc.type}`);\n }\n}\n\nexport function access(loc: GeneralPath, name: string | number): AccessPath {\n return {\n type: \"access\",\n name,\n parent: loc,\n };\n}\n\nexport type OptionPath = Readonly<{\n type: \"option\";\n name: string;\n parent: NestingPath;\n}>;\ntype AccessPath = Readonly<{\n type: \"access\";\n name: string | number;\n parent: GeneralPath;\n}>;\ntype GeneralPath = OptionPath | AccessPath;\n\nexport function assertRootMode(\n loc: OptionPath,\n value: unknown,\n): RootMode | void {\n if (\n value !== undefined &&\n value !== \"root\" &&\n value !== \"upward\" &&\n value !== \"upward-optional\"\n ) {\n throw new Error(\n `${msg(loc)} must be a \"root\", \"upward\", \"upward-optional\" or undefined`,\n );\n }\n // @ts-expect-error: TS can only narrow down the type when \"strictNullCheck\" is true\n return value;\n}\n\nexport function assertSourceMaps(\n loc: OptionPath,\n value: unknown,\n): SourceMapsOption | void {\n if (\n value !== undefined &&\n typeof value !== \"boolean\" &&\n value !== \"inline\" &&\n value !== \"both\"\n ) {\n throw new Error(\n `${msg(loc)} must be a boolean, \"inline\", \"both\", or undefined`,\n );\n }\n // @ts-expect-error: TS can only narrow down the type when \"strictNullCheck\" is true\n return value;\n}\n\nexport function assertCompact(\n loc: OptionPath,\n value: unknown,\n): CompactOption | void {\n if (value !== undefined && typeof value !== \"boolean\" && value !== \"auto\") {\n throw new Error(`${msg(loc)} must be a boolean, \"auto\", or undefined`);\n }\n // @ts-expect-error: TS can only narrow down the type when \"strictNullCheck\" is true\n return value;\n}\n\nexport function assertSourceType(\n loc: OptionPath,\n value: unknown,\n): SourceTypeOption | void {\n if (\n value !== undefined &&\n value !== \"module\" &&\n value !== \"commonjs\" &&\n value !== \"script\" &&\n value !== \"unambiguous\"\n ) {\n throw new Error(\n `${msg(loc)} must be \"module\", \"commonjs\", \"script\", \"unambiguous\", or undefined`,\n );\n }\n // @ts-expect-error: TS can only narrow down the type when \"strictNullCheck\" is true\n return value;\n}\n\nexport function assertCallerMetadata(\n loc: OptionPath,\n value: unknown,\n): CallerMetadata | undefined {\n const obj = assertObject(loc, value);\n if (obj) {\n if (typeof obj.name !== \"string\") {\n throw new Error(\n `${msg(loc)} set but does not contain \"name\" property string`,\n );\n }\n\n for (const prop of Object.keys(obj)) {\n const propLoc = access(loc, prop);\n const value Line truncated
@@ -0,0 +1,218 @@
# @jridgewell/remapping
> Remap sequential sourcemaps through transformations to point at the original source code
Remapping allows you to take the sourcemaps generated through transforming your code and "remap"
them to the original source locations. Think "my minified code, transformed with babel and bundled
with webpack", all pointing to the correct location in your original source code.
With remapping, none of your source code transformations need to be aware of the input's sourcemap,
they only need to generate an output sourcemap. This greatly simplifies building custom
transformations (think a find-and-replace).
## Installation
```sh
npm install @jridgewell/remapping
```
## Usage
```typescript
function remapping(
map: SourceMap | SourceMap[],
loader: (file: string, ctx: LoaderContext) => (SourceMap | null | undefined),
options?: { excludeContent: boolean, decodedMappings: boolean }
): SourceMap;
// LoaderContext gives the loader the importing sourcemap, tree depth, the ability to override the
// "source" location (where child sources are resolved relative to, or the location of original
// source), and the ability to override the "content" of an original source for inclusion in the
// output sourcemap.
type LoaderContext = {
readonly importer: string;
readonly depth: number;
source: string;
content: string | null | undefined;
}
```
`remapping` takes the final output sourcemap, and a `loader` function. For every source file pointer
in the sourcemap, the `loader` will be called with the resolved path. If the path itself represents
a transformed file (it has a sourcmap associated with it), then the `loader` should return that
sourcemap. If not, the path will be treated as an original, untransformed source code.
```js
// Babel transformed "helloworld.js" into "transformed.js"
const transformedMap = JSON.stringify({
file: 'transformed.js',
// 1st column of 2nd line of output file translates into the 1st source
// file, line 3, column 2
mappings: ';CAEE',
sources: ['helloworld.js'],
version: 3,
});
// Uglify minified "transformed.js" into "transformed.min.js"
const minifiedTransformedMap = JSON.stringify({
file: 'transformed.min.js',
// 0th column of 1st line of output file translates into the 1st source
// file, line 2, column 1.
mappings: 'AACC',
names: [],
sources: ['transformed.js'],
version: 3,
});
const remapped = remapping(
minifiedTransformedMap,
(file, ctx) => {
// The "transformed.js" file is an transformed file.
if (file === 'transformed.js') {
// The root importer is empty.
console.assert(ctx.importer === '');
// The depth in the sourcemap tree we're currently loading.
// The root `minifiedTransformedMap` is depth 0, and its source children are depth 1, etc.
console.assert(ctx.depth === 1);
return transformedMap;
}
// Loader will be called to load transformedMap's source file pointers as well.
console.assert(file === 'helloworld.js');
// `transformed.js`'s sourcemap points into `helloworld.js`.
console.assert(ctx.importer === 'transformed.js');
// This is a source child of `transformed`, which is a source child of `minifiedTransformedMap`.
console.assert(ctx.depth === 2);
return null;
}
);
console.log(remapped);
// {
// file: 'transpiled.min.js',
// mappings: 'AAEE',
// sources: ['helloworld.js'],
// version: 3,
// };
```
In this example, `loader` will be called twice:
1. `"transformed.js"`, the first source file pointer in the `minifiedTransformedMap`. We return the
associated sourcemap for it (its a transformed file, after all) so that sourcemap locations can
be traced through it into the source files it represents.
2. `"helloworld.js"`, our original, unmodified source code. This file does not have a sourcemap, so
we return `null`.
The `remapped` sourcemap now points from `transformed.min.js` into locations in `helloworld.js`. If
you were to read the `mappings`, it says "0th column of the first line output line points to the 1st
column of the 2nd line of the file `helloworld.js`".
### Multiple transformations of a file
As a convenience, if you have multiple single-source transformations of a file, you may pass an
array of sourcemap files in the order of most-recent transformation sourcemap first. Note that this
changes the `importer` and `depth` of each call to our loader. So our above example could have been
written as:
```js
const remapped = remapping(
[minifiedTransformedMap, transformedMap],
() => null
);
console.log(remapped);
// {
// file: 'transpiled.min.js',
// mappings: 'AAEE',
// sources: ['helloworld.js'],
// version: 3,
// };
```
### Advanced control of the loading graph
#### `source`
The `source` property can overridden to any value to change the location of the current load. Eg,
for an original source file, it allows us to change the location to the original source regardless
of what the sourcemap source entry says. And for transformed files, it allows us to change the
relative resolving location for child sources of the loaded sourcemap.
```js
const remapped = remapping(
minifiedTransformedMap,
(file, ctx) => {
if (file === 'transformed.js') {
// We pretend the transformed.js file actually exists in the 'src/' directory. When the nested
// source files are loaded, they will now be relative to `src/`.
ctx.source = 'src/transformed.js';
return transformedMap;
}
console.assert(file === 'src/helloworld.js');
// We could futher change the source of this original file, eg, to be inside a nested directory
// itself. This will be reflected in the remapped sourcemap.
ctx.source = 'src/nested/transformed.js';
return null;
}
);
console.log(remapped);
// {
// …,
// sources: ['src/nested/helloworld.js'],
// };
```
#### `content`
The `content` property can be overridden when we encounter an original source file. Eg, this allows
you to manually provide the source content of the original file regardless of whether the
`sourcesContent` field is present in the parent sourcemap. It can also be set to `null` to remove
the source content.
```js
const remapped = remapping(
minifiedTransformedMap,
(file, ctx) => {
if (file === 'transformed.js') {
// transformedMap does not include a `sourcesContent` field, so usually the remapped sourcemap
// would not include any `sourcesContent` values.
return transformedMap;
}
console.assert(file === 'helloworld.js');
// We can read the file to provide the source content.
ctx.content = fs.readFileSync(file, 'utf8');
return null;
}
);
console.log(remapped);
// {
// …,
// sourcesContent: [
// 'console.log("Hello world!")',
// ],
// };
```
### Options
#### excludeContent
By default, `excludeContent` is `false`. Passing `{ excludeContent: true }` will exclude the
`sourcesContent` field from the returned sourcemap. This is mainly useful when you want to reduce
the size out the sourcemap.
#### decodedMappings
By default, `decodedMappings` is `false`. Passing `{ decodedMappings: true }` will leave the
`mappings` field in a [decoded state](https://github.com/rich-harris/sourcemap-codec) instead of
encoding into a VLQ string.
@@ -0,0 +1,166 @@
"use client";
// src/use-accordion.ts
import { useProviderContext } from "@heroui/system";
import { filterDOMProps } from "@heroui/react-utils";
import React, { useCallback } from "react";
import { useTreeState } from "@react-stately/tree";
import { mergeProps } from "@heroui/shared-utils";
import { accordion } from "@heroui/theme";
import { useDOMRef } from "@heroui/react-utils";
import { useMemo, useState } from "react";
import { useReactAriaAccordion } from "@heroui/use-aria-accordion";
function useAccordion(props) {
var _a;
const globalContext = useProviderContext();
const {
ref,
as,
className,
items,
variant,
motionProps,
expandedKeys,
disabledKeys,
selectedKeys,
children: childrenProp,
defaultExpandedKeys,
selectionMode = "single",
selectionBehavior = "toggle",
keepContentMounted = false,
disallowEmptySelection,
defaultSelectedKeys,
onExpandedChange,
onSelectionChange,
dividerProps = {},
isCompact = false,
isDisabled = false,
showDivider = true,
hideIndicator = false,
disableAnimation = (_a = globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _a : false,
disableIndicatorAnimation = false,
itemClasses,
...otherProps
} = props;
const [focusedKey, setFocusedKey] = useState(null);
const Component = as || "div";
const shouldFilterDOMProps = typeof Component === "string";
const domRef = useDOMRef(ref);
const classNames = useMemo(
() => accordion({
variant,
className
}),
[variant, className]
);
const children = useMemo(() => {
let treeChildren = [];
React.Children.map(childrenProp, (child) => {
var _a2;
if (React.isValidElement(child) && typeof ((_a2 = child.props) == null ? void 0 : _a2.children) !== "string") {
const clonedChild = React.cloneElement(child, {
// @ts-ignore
hasChildItems: false
});
treeChildren.push(clonedChild);
} else {
treeChildren.push(child);
}
});
return treeChildren;
}, [childrenProp]);
const commonProps = {
children,
items
};
const expandableProps = {
expandedKeys,
defaultExpandedKeys,
onExpandedChange
};
const treeProps = {
disabledKeys,
selectedKeys,
selectionMode,
selectionBehavior,
disallowEmptySelection,
defaultSelectedKeys: defaultSelectedKeys != null ? defaultSelectedKeys : defaultExpandedKeys,
onSelectionChange,
...commonProps,
...expandableProps
};
const state = useTreeState(treeProps);
state.selectionManager.setFocusedKey = (key) => {
setFocusedKey(key);
};
const { accordionProps } = useReactAriaAccordion(
{
...commonProps,
...expandableProps
},
state,
domRef
);
const values = useMemo(
() => ({
state,
focusedKey,
motionProps,
isCompact,
isDisabled,
hideIndicator,
disableAnimation,
keepContentMounted,
disableIndicatorAnimation
}),
[
focusedKey,
isCompact,
isDisabled,
hideIndicator,
selectedKeys,
disableAnimation,
keepContentMounted,
state == null ? void 0 : state.expandedKeys.values,
disableIndicatorAnimation,
state.expandedKeys.size,
state.disabledKeys.size,
motionProps
]
);
const getBaseProps = useCallback((props2 = {}) => {
return {
ref: domRef,
className: classNames,
"data-orientation": "vertical",
...mergeProps(
accordionProps,
filterDOMProps(otherProps, {
enabled: shouldFilterDOMProps
}),
props2
)
};
}, []);
const handleFocusChanged = useCallback((isFocused, key) => {
isFocused && setFocusedKey(key);
}, []);
return {
Component,
values,
state,
focusedKey,
getBaseProps,
isSplitted: variant === "splitted",
classNames,
showDivider,
dividerProps,
disableAnimation,
handleFocusChanged,
itemClasses
};
}
export {
useAccordion
};
@@ -0,0 +1,46 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExpiringCache = exports.DEFAULT_TSCONFIG_CACHE_DURATION_SECONDS = void 0;
exports.DEFAULT_TSCONFIG_CACHE_DURATION_SECONDS = 30;
const ZERO_HR_TIME = [0, 0];
/**
* A map with key-level expiration.
*/
class ExpiringCache {
#cacheDurationSeconds;
#map = new Map();
constructor(cacheDurationSeconds) {
this.#cacheDurationSeconds = cacheDurationSeconds;
}
clear() {
this.#map.clear();
}
get(key) {
const entry = this.#map.get(key);
if (entry?.value != null) {
if (this.#cacheDurationSeconds === 'Infinity') {
return entry.value;
}
const ageSeconds = process.hrtime(entry.lastSeen)[0];
if (ageSeconds < this.#cacheDurationSeconds) {
// cache hit woo!
return entry.value;
}
// key has expired - clean it up to free up memory
this.#map.delete(key);
}
// no hit :'(
return undefined;
}
set(key, value) {
this.#map.set(key, {
lastSeen: this.#cacheDurationSeconds === 'Infinity'
? // no need to waste time calculating the hrtime in infinity mode as there's no expiry
ZERO_HR_TIME
: process.hrtime(),
value,
});
return this;
}
}
exports.ExpiringCache = ExpiringCache;
@@ -0,0 +1 @@
{"name":"eslint-compat-utils","version":"0.5.1","requiresBuild":false,"files":{"LICENSE":{"checkedAt":1794532125540,"integrity":"sha512-OAJeJCSNKtKjQUjkPnpwmDDlFB31vPpQJdGyzcV76/GiIF4wyMfrhAmQjVqAOXsIL8JA6gZaELCL+FZ4yqgXWQ==","mode":420,"size":1067},"dist/shared/eslint-compat-utils.503aeaae.cjs":{"checkedAt":1794532125540,"integrity":"sha512-/PoQeqrIQfDCGcyekBm0detpCjbRT7jwUPczMmmMalZiTIhgYfqnuyvDIU1ZGOEuQU5yuzPCNBRZykLB6yIYWA==","mode":420,"size":5344},"dist/shared/eslint-compat-utils.808b5669.cjs":{"checkedAt":1794532125540,"integrity":"sha512-NC17kKVQbime27T6ddy5bxaOc3i8x3sDGsD94vxARgYisM1CtMoUCPf96wIumeeH95BKvdual+vDvfjNDvazDg==","mode":420,"size":1914},"dist/shared/eslint-compat-utils.cb53cf36.cjs":{"checkedAt":1794532125540,"integrity":"sha512-q0cBfBvRP+Y4g9H/ffi7A45NlfOqhHFoZGiXD41Bjrh6/hfT8/ENVyebHM0FRlJ6cmfTvg6WxeWtJCjFQKo82Q==","mode":420,"size":177},"dist/eslint.cjs":{"checkedAt":1794532125541,"integrity":"sha512-jIZRAsDW+iKgbghAZpkQ2IpWhxOGduOdyvh6pU8xnjnBEFBIQBHIfUH+epouajgoO6VwdEjMJlKkrrswQH4PZw==","mode":420,"size":5911},"dist/index.cjs":{"checkedAt":1794532125541,"integrity":"sha512-EWnROGNd8yEY+zDNVGwvcqwt8O17lTi8onHSyQuU0lkHpF9+NtquCoM5hJZi3mkfb5uRMiP3FwHVwiZQMTpZxA==","mode":420,"size":3818},"dist/linter.cjs":{"checkedAt":1794532125541,"integrity":"sha512-35wZtHSkLJXXQbTScO97j6/+7WECeI29WWm1Rn3spAYbnsqQIifkKWrB7vx0apf8xQv82RieAlf4rDwnCmuozw==","mode":420,"size":1517},"dist/rule-tester.cjs":{"checkedAt":1794532125541,"integrity":"sha512-XZyLe53RzsNV592dGNd8X2zkS5rXmHr4Bug/P0+e5kv5Q873aeBj/zv77ZkhzPsUDkGc1nQ47H0RgusAVTkyog==","mode":420,"size":3483},"dist/eslint.d.cts":{"checkedAt":1794532125541,"integrity":"sha512-ftlytfyRTqNAv6TWZOmJq2G6dU6QXwrfYt48zByOVX8I4UgZIvSohvi/f3ldHFkSTFrk6RIq2ThNLft5rnn38Q==","mode":420,"size":247},"dist/index.d.cts":{"checkedAt":1794532125541,"integrity":"sha512-EW6Ly7+wOx7O5kepGCNuPAyt3RdhWU+tuOFDTBxxs6MWm/zXYG8EsOxFmvYNda8sw0TY2NPHbiXuAqcZ52389A==","mode":420,"size":1155},"dist/linter.d.cts":{"checkedAt":1794532125541,"integrity":"sha512-CM1pvCAUcOrCEABEEIivLcMVtNHOmiAOV/M9DxqHP5q79Clo73rc6ngTCOFciKY8cuqXFMDwoCEnrmGqNQzkHg==","mode":420,"size":138},"dist/rule-tester.d.cts":{"checkedAt":1794532125542,"integrity":"sha512-c7SMY20KsdqjsEg5qkK1C2ot8inzE6zVSjk1RkIHdLTrhhi2NmQG0wmv07TZOhPG+M4FP8KNI1bCLODFjSgJ4w==","mode":420,"size":280},"package.json":{"checkedAt":1794532125542,"integrity":"sha512-vfvq81iHOxCMoOQY/5X0+wg8/jjywaqJe2AGmp/QRUW6ye6yxkimOkh8qAgCQ5AZVYQCUnhJ1NO43XIYlicjDQ==","mode":420,"size":2978},"README.md":{"checkedAt":1794532125542,"integrity":"sha512-KEFRpNDEY1jq/Bz5bY/G5PEmVJwXkfdvPUgV09Y0NbQ4ar3FHrbgwDWcsUDdyndd4YXKQbXxVr9DujOD4pwFmg==","mode":420,"size":1394},"dist/shared/eslint-compat-utils.1a5060cf.mjs":{"checkedAt":1794532125542,"integrity":"sha512-M94Le8YF3YV5b9jBnO3hkIL8p6gP+IUlbY5FoUATxw+EiHimAXuZTFswcX87R+0UR3sfxUpBRLXeRBa6A8ddsw==","mode":420,"size":4873},"dist/shared/eslint-compat-utils.3ecba7ac.mjs":{"checkedAt":1794532125542,"integrity":"sha512-VAGQ58UJD/xwq77w8iVhJi1/mzZcW994gl0U49vdB47QLLtpLIqMbRuZeL5sfLCSjWwXQaaMY6ZjYGMgg3z2hQ==","mode":420,"size":153},"dist/shared/eslint-compat-utils.cb6790c2.mjs":{"checkedAt":1794532125542,"integrity":"sha512-3DPtU9I0Ym4Idw7srA2BbLf8VqDzTz+cohBHZHkQZ4hgR8atCrrP3x1VqlIsfFVdDHlJzyiOECD+1FtGm+ElEw==","mode":420,"size":1883},"dist/eslint.mjs":{"checkedAt":1794532125542,"integrity":"sha512-cIlBZjDQUvaIQ+ZbsU7T6scU+r4Blwnoo6v47hMR27zpqLCGWYiKWU9COt4+kgQGsrOU/1TRYwiJWXX45WnleQ==","mode":420,"size":5369},"dist/index.mjs":{"checkedAt":1794532125543,"integrity":"sha512-YzGWBmawunJsXLsS2iTeGz/wCBOklEuzO+7frlthkSSwZMTz9Oc4UPWf/LxQykqRxsw46TNal0IAaXqJGrePgA==","mode":420,"size":3731},"dist/linter.mjs":{"checkedAt":1794532125543,"integrity":"sha512-sn2/XgOzdWalDPQf3Q3biL5/GDDvwcI1xvb9kzLjmpDL8MKz0AXbaE5Xhso1eN/v8DVTyc+hNUhg/tgIdrH3qg==","mode":420,"size":1053},"dist/rule-tester.mjs":{"checkedAt":1794532125543,"integrity":"sha512-PMum2h90RiVaz7J5LSntlOa8rs1KEIlFna0/rH+COxEExy7kvDfXFQ83dHFcmGBRB7IzPdapSijjS2yCJyCo8Q==","mode":420,"size":2975},"dist/eslint.d.mts":{"checkedAt":1794532125541,"integrity":"sha512-ftlytfyRTqNAv6TWZOmJq2G6dU6QXwrfYt48zByOVX8I4UgZIvSohvi/f3ldHFkSTFrk6RIq2ThNLft5rnn38Q==","mode":420,"size":247},"dist/index.d.mts":{"checkedAt":1794532125541,"integrity":"sha512-EW6Ly7+wOx7O5kepGCNuPAyt3RdhWU+tuOFDTBxxs6MWm/zXYG8EsOxFmvYNda8sw0TY2NPHbiXuAqcZ52389A==","mode":420,"size":1155},"dist/linter.d.mts":{"checkedAt":1794532125541,"integrity":"sha512-CM1pvCAUcOrCEABEEIivLcMVtNHOmiAOV/M9DxqHP5q79Clo73rc6ngTCOFciKY8cuqXFMDwoCEnrmGqNQzkHg==","mode":420,"size":138},"dist/rule-tester.d.mts":{"checkedAt":1794532125542,"integrity":"sha512-c7SMY20KsdqjsEg5qkK1C2ot8inzE6zVSjk1RkIHdLTrhhi2NmQG0wmv07TZOhPG+M4FP8KNI1bCLODFjSgJ4w==","mode":420,"size":280},"dist/eslint.d.ts":{"checkedAt":1794532125541,"integrity":"sha512-ftlytfyRTqNAv6TWZOmJq2G6dU6QXwrfYt48zByOVX8I4UgZIvSohvi/f3ldHFkSTFrk6RIq2ThNLft5rnn38Q==","mode":420,"size":247},"dist/index.d.ts":{"checkedAt":1794532125541,"integrity":"sha512-EW6Ly7+wOx7O5kepGCNuLine truncated
@@ -0,0 +1,652 @@
/**
* @fileoverview Rule to enforce concise object methods and properties.
* @author Jamund Ferguson
*/
"use strict";
const OPTIONS = {
always: "always",
never: "never",
methods: "methods",
properties: "properties",
consistent: "consistent",
consistentAsNeeded: "consistent-as-needed",
};
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const astUtils = require("./utils/ast-utils");
//--------------------------------------------------------------------------
// Helpers
//--------------------------------------------------------------------------
const CTOR_PREFIX_REGEX = /[^_$0-9]/u;
const JSDOC_COMMENT_REGEX = /^\s*\*/u;
/**
* Determines if the first character of the name is a capital letter.
* @param {string} name The name of the node to evaluate.
* @returns {boolean} True if the first character of the property name is a capital letter, false if not.
* @private
*/
function isConstructor(name) {
const match = CTOR_PREFIX_REGEX.exec(name);
// Not a constructor if name has no characters apart from '_', '$' and digits e.g. '_', '$$', '_8'
if (!match) {
return false;
}
const firstChar = name.charAt(match.index);
return firstChar === firstChar.toUpperCase();
}
/**
* Determines if the property can have a shorthand form.
* @param {ASTNode} property Property AST node
* @returns {boolean} True if the property can have a shorthand form
* @private
*/
function canHaveShorthand(property) {
return (
property.kind !== "set" &&
property.kind !== "get" &&
property.type !== "SpreadElement" &&
property.type !== "SpreadProperty" &&
property.type !== "ExperimentalSpreadProperty"
);
}
/**
* Checks whether a node is a string literal.
* @param {ASTNode} node Any AST node.
* @returns {boolean} `true` if it is a string literal.
*/
function isStringLiteral(node) {
return node.type === "Literal" && typeof node.value === "string";
}
/**
* Determines if the property is a shorthand or not.
* @param {ASTNode} property Property AST node
* @returns {boolean} True if the property is considered shorthand, false if not.
* @private
*/
function isShorthand(property) {
// property.method is true when `{a(){}}`.
return property.shorthand || property.method;
}
/**
* Determines if the property's key and method or value are named equally.
* @param {ASTNode} property Property AST node
* @returns {boolean} True if the key and value are named equally, false if not.
* @private
*/
function isRedundant(property) {
const value = property.value;
if (value.type === "FunctionExpression") {
return !value.id; // Only anonymous should be shorthand method.
}
if (value.type === "Identifier") {
return astUtils.getStaticPropertyName(property) === value.name;
}
return false;
}
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
type: "suggestion",
docs: {
description:
"Require or disallow method and property shorthand syntax for object literals",
recommended: false,
frozen: true,
url: "https://eslint.org/docs/latest/rules/object-shorthand",
},
fixable: "code",
schema: {
anyOf: [
{
type: "array",
items: [
{
enum: [
"always",
"methods",
"properties",
"never",
"consistent",
"consistent-as-needed",
],
},
],
minItems: 0,
maxItems: 1,
},
{
type: "array",
items: [
{
enum: ["always", "methods", "properties"],
},
{
type: "object",
properties: {
avoidQuotes: {
type: "boolean",
},
},
additionalProperties: false,
},
],
minItems: 0,
maxItems: 2,
},
{
type: "array",
items: [
{
enum: ["always", "methods"],
},
{
type: "object",
properties: {
ignoreConstructors: {
type: "boolean",
},
methodsIgnorePattern: {
type: "string",
},
avoidQuotes: {
type: "boolean",
},
avoidExplicitReturnArrows: {
type: "boolean",
},
},
additionalProperties: false,
},
],
minItems: 0,
maxItems: 2,
},
],
},
messages: {
expectedAllPropertiesShorthanded:
"Expected shorthand for all properties.",
expectedLiteralMethodLongform:
"Expected longform method syntax for string literal keys.",
expectedPropertyShorthand: "Expected property shorthand.",
expectedPropertyLongform: "Expected longform property syntax.",
expectedMethodShorthand: "Expected method shorthand.",
expectedMethodLongform: "Expected longform method syntax.",
unexpectedMix:
"Unexpected mix of shorthand and non-shorthand properties.",
},
},
create(context) {
const APPLY = context.options[0] || OPTIONS.always;
const APPLY_TO_METHODS =
APPLY === OPTIONS.methods || APPLY === OPTIONS.always;
const APPLY_TO_PROPS =
APPLY === OPTIONS.properties || APPLY === OPTIONS.always;
const APPLY_NEVER = APPLY === OPTIONS.never;
const APPLY_CONSISTENT = APPLY === OPTIONS.consistent;
const APPLY_CONSISTENT_AS_NEEDED = APPLY === OPTIONS.consistentAsNeeded;
const PARAMS = context.options[1] || {};
const IGNORE_CONSTRUCTORS = PARAMS.ignoreConstructors;
const METHODS_IGNORE_PATTERN = PARAMS.methodsIgnorePattern
? new RegExp(PARAMS.methodsIgnorePattern, "u")
: null;
const AVOID_QUOTES = PARAMS.avoidQuotes;
const AVOID_EXPLICIT_RETURN_ARROWS = !!PARAMS.avoidExplicitReturnArrows;
const sourceCode = context.sourceCode;
/**
* Ensures that an object's properties are consistently shorthand, or not shorthand at all.
* @param {ASTNode} node Property AST node
* @param {boolean} checkRedundancy Whether to check longform redundancy
* @returns {void}
*/
function checkConsistency(node, checkRedundancy) {
// We are excluding getters/setters and spread properties as they are considered neither longform nor shorthand.
const properties = node.properties.filter(canHaveShorthand);
// Do we still have properties left after filtering the getters and setters?
if (properties.length > 0) {
const shorthandProperties = properties.filter(isShorthand);
/*
* If we do not have an equal number of longform properties as
* shorthand properties, we are using the annotations inconsistently
*/
if (shorthandProperties.length !== properties.length) {
// We have at least 1 shorthand property
if (shorthandProperties.length > 0) {
context.report({ node, messageId: "unexpectedMix" });
} else if (checkRedundancy) {
/*
* If all properties of the object contain a method or value with a name matching it's key,
* all the keys are redundant.
*/
const canAlwaysUseShorthand =
properties.every(isRedundant);
if (canAlwaysUseShorthand) {
context.report({
node,
messageId: "expectedAllPropertiesShorthanded",
});
}
}
}
}
}
/**
* Fixes a FunctionExpression node by making it into a shorthand property.
* @param {SourceCodeFixer} fixer The fixer object
* @param {ASTNode} node A `Property` node that has a `FunctionExpression` or `ArrowFunctionExpression` as its value
* @returns {Object} A fix for this node
*/
function makeFunctionShorthand(fixer, node) {
const firstKeyToken = node.computed
? sourceCode.getFirstToken(node, astUtils.isOpeningBracketToken)
: sourceCode.getFirstToken(node.key);
const lastKeyToken = node.computed
? sourceCode.getFirstTokenBetween(
node.key,
node.value,
astUtils.isClosingBracketToken,
)
: sourceCode.getLastToken(node.key);
const keyText = sourceCode.text.slice(
firstKeyToken.range[0],
lastKeyToken.range[1],
);
let keyPrefix = "";
// key: /* */ () => {}
if (sourceCode.commentsExistBetween(lastKeyToken, node.value)) {
return null;
}
if (node.value.async) {
keyPrefix += "async ";
}
if (node.value.generator) {
keyPrefix += "*";
}
const fixRange = [firstKeyToken.range[0], node.range[1]];
const methodPrefix = keyPrefix + keyText;
if (node.value.type === "FunctionExpression") {
const functionToken = sourceCode
.getTokens(node.value)
.find(
token =>
token.type === "Keyword" &&
token.value === "function",
);
const tokenBeforeParams = node.value.generator
? sourceCode.getTokenAfter(functionToken)
: functionToken;
return fixer.replaceTextRange(
fixRange,
methodPrefix +
sourceCode.text.slice(
tokenBeforeParams.range[1],
node.value.range[1],
),
);
}
const arrowToken = sourceCode.getTokenBefore(
node.value.body,
astUtils.isArrowToken,
);
const fnBody = sourceCode.text.slice(
arrowToken.range[1],
node.value.range[1],
);
// First token should not be `async`
const firstValueToken = sourceCode.getFirstToken(node.value, {
skip: node.value.async ? 1 : 0,
});
const sliceStart = firstValueToken.range[0];
const sliceEnd = sourceCode.getTokenBefore(arrowToken).range[1];
const shouldAddParens =
node.value.params.length === 1 &&
node.value.params[0].range[0] === sliceStart;
const oldParamText = sourceCode.text.slice(sliceStart, sliceEnd);
const newParamText = shouldAddParens
? `(${oldParamText})`
: oldParamText;
return fixer.replaceTextRange(
fixRange,
methodPrefix + newParamText + fnBody,
);
}
/**
* Fixes a FunctionExpression node by making it into a longform property.
* @param {SourceCodeFixer} fixer The fixer object
* @param {ASTNode} node A `Property` node that has a `FunctionExpression` as its value
* @returns {Object} A fix for this node
*/
function makeFunctionLongform(fixer, node) {
const firstKeyToken = node.computed
? sourceCode.getTokens(node).find(token => token.value === "[")
: sourceCode.getFirstToken(node.key);
const lastKeyToken = node.computed
? sourceCode
.getTokensBetween(node.key, node.value)
.find(token => token.value === "]")
: sourceCode.getLastToken(node.key);
const keyText = sourceCode.text.slice(
firstKeyToken.range[0],
lastKeyToken.range[1],
);
let functionHeader = "function";
if (node.value.async) {
functionHeader = `async ${functionHeader}`;
}
if (node.value.generator) {
functionHeader = `${functionHeader}*`;
}
return fixer.replaceTextRange(
[node.range[0], lastKeyToken.range[1]],
`${keyText}: ${functionHeader}`,
);
}
/*
* To determine whether a given arrow function has a lexical identifier (`this`, `arguments`, `super`, or `new.target`),
* create a stack of functions that define these identifiers (i.e. all functions except arrow functions) as the AST is
* traversed. Whenever a new function is encountered, create a new entry on the stack (corresponding to a different lexical
* scope of `this`), and whenever a function is exited, pop that entry off the stack. When an arrow function is entered,
* keep a reference to it on the current stack entry, and remove that reference when the arrow function is exited.
* When a lexical identifier is encountered, mark all the arrow functions on the current stack entry by adding them
* to an `arrowsWithLexicalIdentifiers` set. Any arrow function in that set will not be reported by this rule,
* because converting it into a method would change the value of one of the lexical identifiers.
*/
const lexicalScopeStack = [];
const arrowsWithLexicalIdentifiers = new WeakSet();
const argumentsIdentifiers = new WeakSet();
/**
* Enters a function. This creates a new lexical identifier scope, so a new Set of arrow functions is pushed onto the stack.
* Also, this marks all `arguments` identifiers so that they can be detected later.
* @param {ASTNode} node The node representing the function.
* @returns {void}
*/
function enterFunction(node) {
lexicalScopeStack.unshift(new Set());
sourceCode
.getScope(node)
.variables.filter(variable => variable.name === "arguments")
.forEach(variable => {
variable.references
.map(ref => ref.identifier)
.forEach(identifier =>
argumentsIdentifiers.add(identifier),
);
});
}
/**
* Exits a function. This pops the current set of arrow functions off the lexical scope stack.
* @returns {void}
*/
function exitFunction() {
lexicalScopeStack.shift();
}
/**
* Marks the current function as having a lexical keyword. This implies that all arrow functions
* in the current lexical scope contain a reference to this lexical keyword.
* @returns {void}
*/
function reportLexicalIdentifier() {
lexicalScopeStack[0].forEach(arrowFunction =>
arrowsWithLexicalIdentifiers.add(arrowFunction),
);
}
//--------------------------------------------------------------------------
// Public
//--------------------------------------------------------------------------
return {
Program: enterFunction,
FunctionDeclaration: enterFunction,
FunctionExpression: enterFunction,
"Program:exit": exitFunction,
"FunctionDeclaration:exit": exitFunction,
"FunctionExpression:exit": exitFunction,
ArrowFunctionExpression(node) {
lexicalScopeStack[0].add(node);
},
"ArrowFunctionExpression:exit"(node) {
lexicalScopeStack[0].delete(node);
},
ThisExpression: reportLexicalIdentifier,
Super: reportLexicalIdentifier,
MetaProperty(node) {
if (
node.meta.name === "new" &&
node.property.name === "target"
) {
reportLexicalIdentifier();
}
},
Identifier(node) {
if (argumentsIdentifiers.has(node)) {
reportLexicalIdentifier();
}
},
ObjectExpression(node) {
if (APPLY_CONSISTENT) {
checkConsistency(node, false);
} else if (APPLY_CONSISTENT_AS_NEEDED) {
checkConsistency(node, true);
}
},
"Property:exit"(node) {
const isConciseProperty = node.method || node.shorthand;
// Ignore destructuring assignment
if (node.parent.type === "ObjectPattern") {
return;
}
// getters and setters are ignored
if (node.kind === "get" || node.kind === "set") {
return;
}
// only computed methods can fail the following checks
if (
node.computed &&
node.value.type !== "FunctionExpression" &&
node.value.type !== "ArrowFunctionExpression"
) {
return;
}
//--------------------------------------------------------------
// Checks for property/method shorthand.
if (isConciseProperty) {
if (
node.method &&
(APPLY_NEVER ||
(AVOID_QUOTES && isStringLiteral(node.key)))
) {
const messageId = APPLY_NEVER
? "expectedMethodLongform"
: "expectedLiteralMethodLongform";
// { x() {} } should be written as { x: function() {} }
context.report({
node,
messageId,
fix: fixer => makeFunctionLongform(fixer, node),
});
} else if (APPLY_NEVER) {
// { x } should be written as { x: x }
context.report({
node,
messageId: "expectedPropertyLongform",
fix: fixer =>
fixer.insertTextAfter(
node.key,
`: ${node.key.name}`,
),
});
}
} else if (
APPLY_TO_METHODS &&
!node.value.id &&
(node.value.type === "FunctionExpression" ||
node.value.type === "ArrowFunctionExpression")
) {
if (
IGNORE_CONSTRUCTORS &&
node.key.type === "Identifier" &&
isConstructor(node.key.name)
) {
return;
}
if (METHODS_IGNORE_PATTERN) {
const propertyName =
astUtils.getStaticPropertyName(node);
if (
propertyName !== null &&
METHODS_IGNORE_PATTERN.test(propertyName)
) {
return;
}
}
if (AVOID_QUOTES && isStringLiteral(node.key)) {
return;
}
// {[x]: function(){}} should be written as {[x]() {}}
if (
node.value.type === "FunctionExpression" ||
(node.value.type === "ArrowFunctionExpression" &&
node.value.body.type === "BlockStatement" &&
AVOID_EXPLICIT_RETURN_ARROWS &&
!arrowsWithLexicalIdentifiers.has(node.value))
) {
context.report({
node,
messageId: "expectedMethodShorthand",
fix: fixer => makeFunctionShorthand(fixer, node),
});
}
} else if (
node.value.type === "Identifier" &&
node.key.name === node.value.name &&
APPLY_TO_PROPS
) {
// Skip if there are JSDoc comments inside the property (e.g., JSDoc type annotations)
const comments = sourceCode.getCommentsInside(node);
if (
comments.some(
comment =>
comment.type === "Block" &&
JSDOC_COMMENT_REGEX.test(comment.value) &&
comment.value.includes("@type"),
)
) {
return;
}
// {x: x} should be written as {x}
context.report({
node,
messageId: "expectedPropertyShorthand",
fix(fixer) {
// x: /* */ x
// x: (/* */ x)
if (sourceCode.getCommentsInside(node).length > 0) {
return null;
}
return fixer.replaceText(node, node.value.name);
},
});
} else if (
node.value.type === "Identifier" &&
node.key.type === "Literal" &&
node.key.value === node.value.name &&
APPLY_TO_PROPS
) {
if (AVOID_QUOTES) {
return;
}
const comments = sourceCode.getCommentsInside(node);
if (
comments.some(
comment =>
comment.type === "Block" &&
comment.value.startsWith("*") &&
comment.value.includes("@type"),
)
) {
return;
}
// {"x": x} should be written as {x}
context.report({
node,
messageId: "expectedPropertyShorthand",
fix(fixer) {
// "x": /* */ x
// "x": (/* */ x)
if (sourceCode.getCommentsInside(node).length > 0) {
return null;
}
return fixer.replaceText(node, node.value.name);
},
});
}
},
};
},
};
@@ -0,0 +1,294 @@
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
import {chain, getScrollParent, isIOS, useLayoutEffect} from '@react-aria/utils';
interface PreventScrollOptions {
/** Whether the scroll lock is disabled. */
isDisabled?: boolean
}
const visualViewport = typeof document !== 'undefined' && window.visualViewport;
// HTML input types that do not cause the software keyboard to appear.
const nonTextInputTypes = new Set([
'checkbox',
'radio',
'range',
'color',
'file',
'image',
'button',
'submit',
'reset'
]);
// The number of active usePreventScroll calls. Used to determine whether to revert back to the original page style/scroll position
let preventScrollCount = 0;
let restore;
/**
* Prevents scrolling on the document body on mount, and
* restores it on unmount. Also ensures that content does not
* shift due to the scrollbars disappearing.
*/
export function usePreventScroll(options: PreventScrollOptions = {}) {
let {isDisabled} = options;
useLayoutEffect(() => {
if (isDisabled) {
return;
}
preventScrollCount++;
if (preventScrollCount === 1) {
if (isIOS()) {
restore = preventScrollMobileSafari();
} else {
restore = preventScrollStandard();
}
}
return () => {
preventScrollCount--;
if (preventScrollCount === 0) {
restore();
}
};
}, [isDisabled]);
}
// For most browsers, all we need to do is set `overflow: hidden` on the root element, and
// add some padding to prevent the page from shifting when the scrollbar is hidden.
function preventScrollStandard() {
return chain(
setStyle(document.documentElement, 'paddingRight', `${window.innerWidth - document.documentElement.clientWidth}px`),
setStyle(document.documentElement, 'overflow', 'hidden')
);
}
// Mobile Safari is a whole different beast. Even with overflow: hidden,
// it still scrolls the page in many situations:
//
// 1. When the bottom toolbar and address bar are collapsed, page scrolling is always allowed.
// 2. When the keyboard is visible, the viewport does not resize. Instead, the keyboard covers part of
// it, so it becomes scrollable.
// 3. When tapping on an input, the page always scrolls so that the input is centered in the visual viewport.
// This may cause even fixed position elements to scroll off the screen.
// 4. When using the next/previous buttons in the keyboard to navigate between inputs, the whole page always
// scrolls, even if the input is inside a nested scrollable element that could be scrolled instead.
//
// In order to work around these cases, and prevent scrolling without jankiness, we do a few things:
//
// 1. Prevent default on `touchmove` events that are not in a scrollable element. This prevents touch scrolling
// on the window.
// 2. Set `overscroll-behavior: contain` on nested scrollable regions so they do not scroll the page when at
// the top or bottom. Work around a bug where this does not work when the element does not actually overflow
// by preventing default in a `touchmove` event.
// 3. Prevent default on `touchend` events on input elements and handle focusing the element ourselves.
// 4. When focusing an input, apply a transform to trick Safari into thinking the input is at the top
// of the page, which prevents it from scrolling the page. After the input is focused, scroll the element
// into view ourselves, without scrolling the whole page.
// 5. Offset the body by the scroll position using a negative margin and scroll to the top. This should appear the
// same visually, but makes the actual scroll position always zero. This is required to make all of the
// above work or Safari will still try to scroll the page when focusing an input.
// 6. As a last resort, handle window scroll events, and scroll back to the top. This can happen when attempting
// to navigate to an input with the next/previous buttons that's outside a modal.
function preventScrollMobileSafari() {
let scrollable: Element;
let restoreScrollableStyles;
let onTouchStart = (e: TouchEvent) => {
// Store the nearest scrollable parent element from the element that the user touched.
scrollable = getScrollParent(e.target as Element, true);
if (scrollable === document.documentElement && scrollable === document.body) {
return;
}
// Prevent scrolling up when at the top and scrolling down when at the bottom
// of a nested scrollable area, otherwise mobile Safari will start scrolling
// the window instead.
if (scrollable instanceof HTMLElement && window.getComputedStyle(scrollable).overscrollBehavior === 'auto') {
restoreScrollableStyles = setStyle(scrollable, 'overscrollBehavior', 'contain');
}
};
let onTouchMove = (e: TouchEvent) => {
// Prevent scrolling the window.
if (!scrollable || scrollable === document.documentElement || scrollable === document.body) {
e.preventDefault();
return;
}
// overscroll-behavior should prevent scroll chaining, but currently does not
// if the element doesn't actually overflow. https://bugs.webkit.org/show_bug.cgi?id=243452
// This checks that both the width and height do not overflow, otherwise we might
// block horizontal scrolling too. In that case, adding `touch-action: pan-x` to
// the element will prevent vertical page scrolling. We can't add that automatically
// because it must be set before the touchstart event.
if (scrollable.scrollHeight === scrollable.clientHeight && scrollable.scrollWidth === scrollable.clientWidth) {
e.preventDefault();
}
};
let onTouchEnd = (e: TouchEvent) => {
let target = e.target as HTMLElement;
// Apply this change if we're not already focused on the target element
if (willOpenKeyboard(target) && target !== document.activeElement) {
e.preventDefault();
setupStyles();
// Apply a transform to trick Safari into thinking the input is at the top of the page
// so it doesn't try to scroll it into view. When tapping on an input, this needs to
// be done before the "focus" event, so we have to focus the element ourselves.
target.style.transform = 'translateY(-2000px)';
target.focus();
requestAnimationFrame(() => {
target.style.transform = '';
});
}
if (restoreScrollableStyles) {
restoreScrollableStyles();
}
};
let onFocus = (e: FocusEvent) => {
let target = e.target as HTMLElement;
if (willOpenKeyboard(target)) {
setupStyles();
// Transform also needs to be applied in the focus event in cases where focus moves
// other than tapping on an input directly, e.g. the next/previous buttons in the
// software keyboard. In these cases, it seems applying the transform in the focus event
// is good enough, whereas when tapping an input, it must be done before the focus event. 🤷‍♂️
target.style.transform = 'translateY(-2000px)';
requestAnimationFrame(() => {
target.style.transform = '';
// This will have prevented the browser from scrolling the focused element into view,
// so we need to do this ourselves in a way that doesn't cause the whole page to scroll.
if (visualViewport) {
if (visualViewport.height < window.innerHeight) {
// If the keyboard is already visible, do this after one additional frame
// to wait for the transform to be removed.
requestAnimationFrame(() => {
scrollIntoView(target);
});
} else {
// Otherwise, wait for the visual viewport to resize before scrolling so we can
// measure the correct position to scroll to.
visualViewport.addEventListener('resize', () => scrollIntoView(target), {once: true});
}
}
});
}
};
let restoreStyles: null | (() => void) = null;
let setupStyles = () => {
if (restoreStyles) {
return;
}
let onWindowScroll = () => {
// Last resort. If the window scrolled, scroll it back to the top.
// It should always be at the top because the body will have a negative margin (see below).
window.scrollTo(0, 0);
};
// Record the original scroll position so we can restore it.
// Then apply a negative margin to the body to offset it by the scroll position. This will
// enable us to scroll the window to the top, which is required for the rest of this to work.
let scrollX = window.pageXOffset;
let scrollY = window.pageYOffset;
restoreStyles = chain(
addEvent(window, 'scroll', onWindowScroll),
setStyle(document.documentElement, 'paddingRight', `${window.innerWidth - document.documentElement.clientWidth}px`),
setStyle(document.documentElement, 'overflow', 'hidden'),
setStyle(document.body, 'marginTop', `-${scrollY}px`),
() => {
window.scrollTo(scrollX, scrollY);
}
);
// Scroll to the top. The negative margin on the body will make this appear the same.
window.scrollTo(0, 0);
};
let removeEvents = chain(
addEvent(document, 'touchstart', onTouchStart, {passive: false, capture: true}),
addEvent(document, 'touchmove', onTouchMove, {passive: false, capture: true}),
addEvent(document, 'touchend', onTouchEnd, {passive: false, capture: true}),
addEvent(document, 'focus', onFocus, true)
);
return () => {
// Restore styles and scroll the page back to where it was.
restoreScrollableStyles?.();
restoreStyles?.();
removeEvents();
};
}
// Sets a CSS property on an element, and returns a function to revert it to the previous value.
function setStyle(element: HTMLElement, style: string, value: string) {
let cur = element.style[style];
element.style[style] = value;
return () => {
element.style[style] = cur;
};
}
// Adds an event listener to an element, and returns a function to remove it.
function addEvent<K extends keyof GlobalEventHandlersEventMap>(
target: Document | Window,
event: K,
handler: (this: Document | Window, ev: GlobalEventHandlersEventMap[K]) => any,
options?: boolean | AddEventListenerOptions
) {
// internal function, so it's ok to ignore the difficult to fix type error
// @ts-ignore
target.addEventListener(event, handler, options);
return () => {
// @ts-ignore
target.removeEventListener(event, handler, options);
};
}
function scrollIntoView(target: Element) {
let root = document.scrollingElement || document.documentElement;
let nextTarget: Element | null = target;
while (nextTarget && nextTarget !== root) {
// Find the parent scrollable element and adjust the scroll position if the target is not already in view.
let scrollable = getScrollParent(nextTarget);
if (scrollable !== document.documentElement && scrollable !== document.body && scrollable !== nextTarget) {
let scrollableTop = scrollable.getBoundingClientRect().top;
let targetTop = nextTarget.getBoundingClientRect().top;
if (targetTop > scrollableTop + nextTarget.clientHeight) {
scrollable.scrollTop += targetTop - scrollableTop;
}
}
nextTarget = scrollable.parentElement;
}
}
function willOpenKeyboard(target: Element) {
return (
(target instanceof HTMLInputElement && !nonTextInputTypes.has(target.type)) ||
target instanceof HTMLTextAreaElement ||
(target instanceof HTMLElement && target.isContentEditable)
);
}
@@ -0,0 +1,41 @@
{
"name": "@react-aria/selection",
"version": "3.21.0",
"description": "Spectrum UI components in React",
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
"exports": {
"types": "./dist/types.d.ts",
"import": "./dist/import.mjs",
"require": "./dist/main.js"
},
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
"dist",
"src"
],
"sideEffects": false,
"repository": {
"type": "git",
"url": "https://github.com/adobe/react-spectrum"
},
"dependencies": {
"@react-aria/focus": "^3.19.0",
"@react-aria/i18n": "^3.12.4",
"@react-aria/interactions": "^3.22.5",
"@react-aria/utils": "^3.26.0",
"@react-stately/selection": "^3.18.0",
"@react-types/shared": "^3.26.0",
"@swc/helpers": "^0.5.0"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1",
"react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
},
"publishConfig": {
"access": "public"
},
"gitHead": "71f0ef23053f9e03ee7e97df736e8b083e006849"
}
@@ -0,0 +1 @@
{"version":3,"file":"assert-valid-pattern.js","sourceRoot":"","sources":["../../src/assert-valid-pattern.ts"],"names":[],"mappings":";;;AAAA,MAAM,kBAAkB,GAAG,IAAI,GAAG,EAAE,CAAA;AAC7B,MAAM,kBAAkB,GAA2B,CACxD,OAAY,EACe,EAAE;IAC7B,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAChC,MAAM,IAAI,SAAS,CAAC,iBAAiB,CAAC,CAAA;IACxC,CAAC;IAED,IAAI,OAAO,CAAC,MAAM,GAAG,kBAAkB,EAAE,CAAC;QACxC,MAAM,IAAI,SAAS,CAAC,qBAAqB,CAAC,CAAA;IAC5C,CAAC;AACH,CAAC,CAAA;AAVY,QAAA,kBAAkB,sBAU9B","sourcesContent":["const MAX_PATTERN_LENGTH = 1024 * 64\nexport const assertValidPattern: (pattern: any) => void = (\n pattern: any,\n): asserts pattern is string => {\n if (typeof pattern !== 'string') {\n throw new TypeError('invalid pattern')\n }\n\n if (pattern.length > MAX_PATTERN_LENGTH) {\n throw new TypeError('pattern is too long')\n }\n}\n"]}
@@ -0,0 +1,43 @@
"use strict"
const { READ } = require("@eslint-community/eslint-utils")
/**
* @satisfies {import('../types.js').SupportVersionTraceMap}
*/
const tls = {
checkServerIdentity: { [READ]: { supported: ["0.8.4"] } },
connect: { [READ]: { supported: ["0.11.3"] } },
createSecureContext: { [READ]: { supported: ["0.11.13"] } },
createSecurePair: {
[READ]: { supported: ["0.3.2"], deprecated: ["0.11.3"] },
},
createServer: { [READ]: { supported: ["0.3.2"] } },
CryptoStream: { [READ]: { supported: ["0.3.4"], deprecated: ["0.11.3"] } },
DEFAULT_CIPHERS: { [READ]: { supported: ["0.11.3"] } },
DEFAULT_ECDH_CURVE: { [READ]: { supported: ["0.11.13"] } },
DEFAULT_MAX_VERSION: { [READ]: { supported: ["11.4.0"] } },
DEFAULT_MIN_VERSION: { [READ]: { supported: ["11.4.0"] } },
getCACertificates: { [READ]: { supported: ["22.15.0", "23.10.0"] } },
getCiphers: { [READ]: { supported: ["0.10.2"] } },
rootCertificates: { [READ]: { supported: ["12.3.0"] } },
SecureContext: { [READ]: { supported: ["0.11.13"] } },
SecurePair: { [READ]: { supported: ["0.3.2"], deprecated: ["0.11.3"] } },
Server: { [READ]: { supported: ["0.3.2"] } },
setDefaultCACertificates: { [READ]: { supported: ["22.19.0"] } },
TLSSocket: { [READ]: { supported: ["0.11.4"] } },
}
/**
* @satisfies {import('../types.js').SupportVersionTraceMap}
*/
module.exports = {
tls: {
[READ]: { supported: ["0.3.2"] },
...tls,
},
"node:tls": {
[READ]: { supported: ["14.13.1", "12.20.0"] },
...tls,
},
}
@@ -0,0 +1,35 @@
// @ts-check
import { SyncWalker } from './sync.js';
import { AsyncWalker } from './async.js';
/** @typedef { import('estree').BaseNode} BaseNode */
/** @typedef { import('./sync.js').SyncHandler} SyncHandler */
/** @typedef { import('./async.js').AsyncHandler} AsyncHandler */
/**
*
* @param {BaseNode} ast
* @param {{
* enter?: SyncHandler
* leave?: SyncHandler
* }} walker
* @returns {BaseNode}
*/
export function walk(ast, { enter, leave }) {
const instance = new SyncWalker(enter, leave);
return instance.visit(ast, null);
}
/**
*
* @param {BaseNode} ast
* @param {{
* enter?: AsyncHandler
* leave?: AsyncHandler
* }} walker
* @returns {Promise<BaseNode>}
*/
export async function asyncWalk(ast, { enter, leave }) {
const instance = new AsyncWalker(enter, leave);
return await instance.visit(ast, null);
}
@@ -0,0 +1,71 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = bezierCubic2Q2;
/**
* @file 三次贝塞尔转二次贝塞尔
* @author mengke01(kekee000@gmail.com)
*
* references:
* https://github.com/search?utf8=%E2%9C%93&q=svg2ttf
* http://www.caffeineowl.com/graphics/2d/vectorial/cubic2quad01.html
*
*/
function toQuad(p1, c1, c2, p2) {
// Quad control point is (3*c2 - p2 + 3*c1 - p1)/4
var x = (3 * c2.x - p2.x + 3 * c1.x - p1.x) / 4;
var y = (3 * c2.y - p2.y + 3 * c1.y - p1.y) / 4;
return [p1, {
x: x,
y: y
}, p2];
}
/**
* 三次贝塞尔转二次贝塞尔
*
* @param {Object} p1 开始点
* @param {Object} c1 控制点1
* @param {Object} c2 控制点2
* @param {Object} p2 结束点
* @return {Array} 二次贝塞尔控制点
*/
function bezierCubic2Q2(p1, c1, c2, p2) {
// 判断极端情况,控制点和起止点一样
if (p1.x === c1.x && p1.y === c1.y && c2.x === p2.x && c2.y === p2.y) {
return [[p1, {
x: (p1.x + p2.x) / 2,
y: (p1.y + p2.y) / 2
}, p2]];
}
var mx = p2.x - 3 * c2.x + 3 * c1.x - p1.x;
var my = p2.y - 3 * c2.y + 3 * c1.y - p1.y;
// control points near
if (mx * mx + my * my <= 4) {
return [toQuad(p1, c1, c2, p2)];
}
// Split to 2 qubic beziers by midpoints
// (p2 + 3*c2 + 3*c1 + p1)/8
var mp = {
x: (p2.x + 3 * c2.x + 3 * c1.x + p1.x) / 8,
y: (p2.y + 3 * c2.y + 3 * c1.y + p1.y) / 8
};
return [toQuad(p1, {
x: (p1.x + c1.x) / 2,
y: (p1.y + c1.y) / 2
}, {
x: (p1.x + 2 * c1.x + c2.x) / 4,
y: (p1.y + 2 * c1.y + c2.y) / 4
}, mp), toQuad(mp, {
x: (p2.x + c1.x + 2 * c2.x) / 4,
y: (p2.y + c1.y + 2 * c2.y) / 4
}, {
x: (p2.x + c2.x) / 2,
y: (p2.y + c2.y) / 2
}, p2)];
}
@@ -0,0 +1,4 @@
export interface BaseClassElementMetadata<TKind> {
kind: TKind;
}
//# sourceMappingURL=BaseClassElementMetadata.d.ts.map
@@ -0,0 +1,118 @@
'use strict';
/**
* Kuler: Color text using CSS colors
*
* @constructor
* @param {String} text The text that needs to be styled
* @param {String} color Optional color for alternate API.
* @api public
*/
function Kuler(text, color) {
if (color) return (new Kuler(text)).style(color);
if (!(this instanceof Kuler)) return new Kuler(text);
this.text = text;
}
/**
* ANSI color codes.
*
* @type {String}
* @private
*/
Kuler.prototype.prefix = '\x1b[';
Kuler.prototype.suffix = 'm';
/**
* Parse a hex color string and parse it to it's RGB equiv.
*
* @param {String} color
* @returns {Array}
* @api private
*/
Kuler.prototype.hex = function hex(color) {
color = color[0] === '#' ? color.substring(1) : color;
//
// Pre-parse for shorthand hex colors.
//
if (color.length === 3) {
color = color.split('');
color[5] = color[2]; // F60##0
color[4] = color[2]; // F60#00
color[3] = color[1]; // F60600
color[2] = color[1]; // F66600
color[1] = color[0]; // FF6600
color = color.join('');
}
var r = color.substring(0, 2)
, g = color.substring(2, 4)
, b = color.substring(4, 6);
return [ parseInt(r, 16), parseInt(g, 16), parseInt(b, 16) ];
};
/**
* Transform a 255 RGB value to an RGV code.
*
* @param {Number} r Red color channel.
* @param {Number} g Green color channel.
* @param {Number} b Blue color channel.
* @returns {String}
* @api public
*/
Kuler.prototype.rgb = function rgb(r, g, b) {
var red = r / 255 * 5
, green = g / 255 * 5
, blue = b / 255 * 5;
return this.ansi(red, green, blue);
};
/**
* Turns RGB 0-5 values into a single ANSI code.
*
* @param {Number} r Red color channel.
* @param {Number} g Green color channel.
* @param {Number} b Blue color channel.
* @returns {String}
* @api public
*/
Kuler.prototype.ansi = function ansi(r, g, b) {
var red = Math.round(r)
, green = Math.round(g)
, blue = Math.round(b);
return 16 + (red * 36) + (green * 6) + blue;
};
/**
* Marks an end of color sequence.
*
* @returns {String} Reset sequence.
* @api public
*/
Kuler.prototype.reset = function reset() {
return this.prefix +'39;49'+ this.suffix;
};
/**
* Colour the terminal using CSS.
*
* @param {String} color The HEX color code.
* @returns {String} the escape code.
* @api public
*/
Kuler.prototype.style = function style(color) {
return this.prefix +'38;5;'+ this.rgb.apply(this, this.hex(color)) + this.suffix + this.text + this.reset();
};
//
// Expose the actual interface.
//
module.exports = Kuler;
@@ -0,0 +1,21 @@
'use strict';
module.exports = function isValidGlob(glob) {
if (typeof glob === 'string' && glob.length > 0) {
return true;
}
if (Array.isArray(glob)) {
return glob.length !== 0 && every(glob);
}
return false;
};
function every(arr) {
var len = arr.length;
while (len--) {
if (typeof arr[len] !== 'string' || arr[len].length <= 0) {
return false;
}
}
return true;
}
@@ -0,0 +1,81 @@
// Adapted from https://github.com/mathiasbynens/he/blob/36afe179392226cf1b6ccdb16ebbb7a5a844d93a/src/he.js#L106-L134
const decodeMap = new Map([
[0, 65_533],
// C1 Unicode control character reference replacements
[128, 8364],
[130, 8218],
[131, 402],
[132, 8222],
[133, 8230],
[134, 8224],
[135, 8225],
[136, 710],
[137, 8240],
[138, 352],
[139, 8249],
[140, 338],
[142, 381],
[145, 8216],
[146, 8217],
[147, 8220],
[148, 8221],
[149, 8226],
[150, 8211],
[151, 8212],
[152, 732],
[153, 8482],
[154, 353],
[155, 8250],
[156, 339],
[158, 382],
[159, 376],
]);
/**
* Polyfill for `String.fromCodePoint`. It is used to create a string from a Unicode code point.
*/
export const fromCodePoint: (...codePoints: number[]) => string =
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, n/no-unsupported-features/es-builtins
String.fromCodePoint ??
function (codePoint: number): string {
let output = "";
if (codePoint > 0xff_ff) {
codePoint -= 0x1_00_00;
output += String.fromCharCode(
((codePoint >>> 10) & 0x3_ff) | 0xd8_00,
);
codePoint = 0xdc_00 | (codePoint & 0x3_ff);
}
output += String.fromCharCode(codePoint);
return output;
};
/**
* Replace the given code point with a replacement character if it is a
* surrogate or is outside the valid range. Otherwise return the code
* point unchanged.
*/
export function replaceCodePoint(codePoint: number): number {
if (
(codePoint >= 0xd8_00 && codePoint <= 0xdf_ff) ||
codePoint > 0x10_ff_ff
) {
return 0xff_fd;
}
return decodeMap.get(codePoint) ?? codePoint;
}
/**
* Replace the code point if relevant, then convert it to a string.
*
* @deprecated Use `fromCodePoint(replaceCodePoint(codePoint))` instead.
* @param codePoint The code point to decode.
* @returns The decoded code point.
*/
export function decodeCodePoint(codePoint: number): string {
return fromCodePoint(replaceCodePoint(codePoint));
}
@@ -0,0 +1 @@
{"version":3,"names":["_t","require","FLIPPED_ALIAS_KEYS","isArrayExpression","isAssignmentExpression","isBinary","isBlockStatement","isCallExpression","isFunction","isIdentifier","isLiteral","isMemberExpression","isObjectExpression","isOptionalCallExpression","isOptionalMemberExpression","isStringLiteral","crawlInternal","node","state","object","computed","property","left","right","hasCall","callee","hasFunction","hasHelper","isHelper","crawl","name","charCodeAt","isType","nodes","exports","AssignmentExpression","SwitchCase","parent","consequent","length","cases","LogicalExpression","Literal","value","CallExpression","OptionalCallExpression","VariableDeclaration","i","declarations","declar","enabled","id","init","IfStatement","ObjectProperty","ObjectTypeProperty","ObjectMethod","properties","ObjectTypeCallProperty","_parent$properties","callProperties","ObjectTypeIndexer","_parent$properties2","_parent$callPropertie","indexers","ObjectTypeInternalSlot","_parent$properties3","_parent$callPropertie2","_parent$indexers","internalSlots","forEach","type","amounts","concat","ret"],"sources":["../../src/node/whitespace.ts"],"sourcesContent":["import {\n FLIPPED_ALIAS_KEYS,\n isArrayExpression,\n isAssignmentExpression,\n isBinary,\n isBlockStatement,\n isCallExpression,\n isFunction,\n isIdentifier,\n isLiteral,\n isMemberExpression,\n isObjectExpression,\n isOptionalCallExpression,\n isOptionalMemberExpression,\n isStringLiteral,\n} from \"@babel/types\";\n\n// We inline this package\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport * as charCodes from \"charcodes\";\n\nimport type { NodeHandlers } from \"./index.ts\";\n\nimport type * as t from \"@babel/types\";\n\nconst enum WhitespaceFlag {\n none = 0,\n before = 1 << 0,\n after = 1 << 1,\n}\n\nexport type { WhitespaceFlag };\n\nfunction crawlInternal(\n node: t.Node,\n state: { hasCall: boolean; hasFunction: boolean; hasHelper: boolean },\n) {\n if (!node) return state;\n\n if (isMemberExpression(node) || isOptionalMemberExpression(node)) {\n crawlInternal(node.object, state);\n if (node.computed) crawlInternal(node.property, state);\n } else if (isBinary(node) || isAssignmentExpression(node)) {\n crawlInternal(node.left, state);\n crawlInternal(node.right, state);\n } else if (isCallExpression(node) || isOptionalCallExpression(node)) {\n state.hasCall = true;\n crawlInternal(node.callee, state);\n } else if (isFunction(node)) {\n state.hasFunction = true;\n } else if (isIdentifier(node)) {\n state.hasHelper =\n // @ts-expect-error todo(flow->ts): node.callee is not really expected here…\n state.hasHelper || (node.callee && isHelper(node.callee));\n }\n\n return state;\n}\n\n/**\n * Crawl a node to test if it contains a CallExpression, a Function, or a Helper.\n *\n * @example\n * crawl(node)\n * // { hasCall: false, hasFunction: true, hasHelper: false }\n */\n\nfunction crawl(node: t.Node) {\n return crawlInternal(node, {\n hasCall: false,\n hasFunction: false,\n hasHelper: false,\n });\n}\n\n/**\n * Test if a node is or has a helper.\n */\n\nfunction isHelper(node: t.Node): boolean {\n if (!node) return false;\n\n if (isMemberExpression(node)) {\n return isHelper(node.object) || isHelper(node.property);\n } else if (isIdentifier(node)) {\n return (\n node.name === \"require\" ||\n node.name.charCodeAt(0) === charCodes.underscore\n );\n } else if (isCallExpression(node)) {\n return isHelper(node.callee);\n } else if (isBinary(node) || isAssignmentExpression(node)) {\n return (\n (isIdentifier(node.left) && isHelper(node.left)) || isHelper(node.right)\n );\n } else {\n return false;\n }\n}\n\nfunction isType(node: t.Node | null | undefined) {\n return (\n isLiteral(node) ||\n isObjectExpression(node) ||\n isArrayExpression(node) ||\n isIdentifier(node) ||\n isMemberExpression(node)\n );\n}\n\n/**\n * Tests for node types that need whitespace.\n */\n\nexport const nodes: NodeHandlers<WhitespaceFlag> = {\n /**\n * Test if AssignmentExpression needs whitespace.\n */\n\n AssignmentExpression(node: t.AssignmentExpression): WhitespaceFlag {\n const state = crawl(node.right);\n if ((state.hasCall && state.hasHelper) || state.hasFunction) {\n return state.hasFunction\n ? WhitespaceFlag.before | WhitespaceFlag.after\n : WhitespaceFlag.after;\n }\n return WhitespaceFlag.none;\n },\n\n /**\n * Test if SwitchCase needs whitespace.\n */\n\n SwitchCase(node: t.SwitchCase, parent: t.SwitchStatement): WhitespaceFlag {\n return (\n (!!node.consequent.length || parent.cases[0] === node\n ? WhitespaceFlag.before\n : WhitespaceFlag.none) |\n (!node.consequent.length && parent.cases[parent.cases.length - 1] === node\n ? WhitespaceFlag.after\n : WhitespaceFlag.none)\n );\n },\n\n /**\n * Test if LogicalExpression needs whitespace.\n *Line truncated
@@ -0,0 +1,201 @@
import { GeneralCallResult } from './common';
import { SendStatus, StartFlashTaskRequests, createFlashTransferResult, FlashBaseRequest, FlashFileSetInfo, FileListInfoRequests, FileListResponse, DownloadStatusInfo, SendTargetRequests, FlashOneFileInfo, DownloadSceneType } from '../data/flash';
export interface NodeIKernelFlashTransferService {
/**
* 开始闪传服务 并上传文件/文件夹(可以多选,非常好用)
* @param timestamp
* @param fileInfo
*/
createFlashTransferUploadTask(timestamp: number, fileInfo: StartFlashTaskRequests): Promise<GeneralCallResult & {
createFlashTransferResult: createFlashTransferResult;
seq: number;
}>;
createMergeShareTask(...args: unknown[]): unknown;
updateFlashTransfer(...args: unknown[]): unknown;
getFileSetList(...args: unknown[]): unknown;
getFileSetListCount(...args: unknown[]): unknown;
/**
* 获取file set 的信息
* @param fileSetIdDict
*/
getFileSet(fileSetIdDict: FlashBaseRequest): Promise<GeneralCallResult & {
seq: number;
isCache: boolean;
fileSet: FlashFileSetInfo;
}>;
/**
* 获取file set 里面的文件信息(文件夹结构)
* @param requestArgs
*/
getFileList(requestArgs: FileListInfoRequests): Promise<{
rsp: FileListResponse;
}>;
getDownloadedFileCount(...args: unknown[]): unknown;
getLocalFileList(...args: unknown[]): unknown;
batchRemoveUserFileSetHistory(...args: unknown[]): unknown;
/**
* 获取分享链接
* @param fileSetId
*/
getShareLinkReq(fileSetId: string): Promise<GeneralCallResult & {
shareLink: string;
expireTimestamp: string;
}>;
/**
* 由分享链接到fileSetId
* @param shareCode
*/
getFileSetIdByCode(shareCode: string): Promise<GeneralCallResult & {
fileSetId: string;
}>;
batchRemoveFile(...args: unknown[]): unknown;
checkUploadPathValid(...args: unknown[]): unknown;
cleanFailedFiles(...args: unknown[]): unknown;
/**
* 暂停所有的任务
*/
resumeAllUnfinishedTasks(): unknown;
addFileSetUploadListener(...args: unknown[]): unknown;
removeFileSetUploadListener(...args: unknown[]): unknown;
/**
* 开始上传任务 适用于已暂停的
* @param fileSetId
*/
startFileSetUpload(fileSetId: string): void;
/**
* 结束,无法再次启动
* @param fileSetId
*/
stopFileSetUpload(fileSetId: string): void;
/**
* 暂停上传
* @param fileSetId
*/
pauseFileSetUpload(fileSetId: string): void;
/**
* 继续上传
* @param args
*/
resumeFileSetUpload(...args: unknown[]): unknown;
pauseFileUpload(...args: unknown[]): unknown;
resumeFileUpload(...args: unknown[]): unknown;
stopFileUpload(...args: unknown[]): unknown;
asyncGetThumbnailPath(...args: unknown[]): unknown;
setDownLoadDefaultFileDir(...args: unknown[]): unknown;
setFileSetDownloadDir(...args: unknown[]): unknown;
getFileSetDownloadDir(...args: unknown[]): unknown;
setFlashTransferDir(...args: unknown[]): unknown;
addFileSetDownloadListener(...args: unknown[]): unknown;
removeFileSetDownloadListener(...args: unknown[]): unknown;
/**
* 开始下载file set的函数 同开始上传
* @param fileSetId
* @param downloadSceneType 下载类型 //因为没有peer,其实可以硬编码为1 (好友私聊)
* @param arg // 默认为false
*/
startFileSetDownload(fileSetId: string, downloadSceneType: DownloadSceneType, downloadOptionParams: {
isIncludeCompressInnerFiles: boolean;
}): Promise<GeneralCallResult & {
extraInfo: 0;
}>;
stopFileSetDownload(fileSetId: string, downloadOptionParams: {
isIncludeCompressInnerFiles: boolean;
}): Promise<GeneralCallResult & {
extraInfo: 0;
}>;
pauseFileSetDownload(fileSetId: string, downloadOptionParams: {
isIncludeCompressInnerFiles: boolean;
}): Promise<GeneralCallResult & {
extraInfo: 0;
}>;
resumeFileSetDownload(fileSetId: string, downloadOptionParams: {
isIncludeCompressInnerFiles: boolean;
}): Promise<GeneralCallResult & {
extraInfo: 0;
}>;
startFileListDownLoad(...args: unknown[]): unknown;
pauseFileListDownLoad(...args: unknown[]): unknown;
resumeFileListDownLoad(...args: unknown[]): unknown;
stopFileListDownLoad(...args: unknown[]): unknown;
startThumbnailListDownload(fileSetId: string): Promise<GeneralCallResult>;
stopThumbnailListDownload(fileSetId: string): Promise<GeneralCallResult>;
asyncRequestDownLoadStatus(fileSetId: string): Promise<DownloadStatusInfo>;
startFileTransferUrl(fileInfo: FlashOneFileInfo): Promise<{
ret: number;
url: string;
expireTimestampSeconds: string;
}>;
startFileListDownLoadBySessionId(...args: unknown[]): unknown;
addFileSetSimpleStatusListener(...args: unknown[]): unknown;
addFileSetSimpleStatusMonitoring(...args: unknown[]): unknown;
removeFileSetSimpleStatusMonitoring(...args: unknown[]): unknown;
removeFileSetSimpleStatusListener(...args: unknown[]): unknown;
addDesktopFileSetSimpleStatusListener(...args: unknown[]): unknown;
addDesktopFileSetSimpleStatusMonitoring(...args: unknown[]): unknown;
removeDesktopFileSetSimpleStatusMonitoring(...args: unknown[]): unknown;
removeDesktopFileSetSimpleStatusListener(...args: unknown[]): unknown;
addFileSetSimpleUploadInfoListener(...args: unknown[]): unknown;
addFileSetSimpleUploadInfoMonitoring(...args: unknown[]): unknown;
removeFileSetSimpleUploadInfoMonitoring(...args: unknown[]): unknown;
removeFileSetSimpleUploadInfoListener(...args: unknown[]): unknown;
/**
* 发送闪传消息
* @param sendArgs
*/
sendFlashTransferMsg(sendArgs: SendTargetRequests): Promise<{
errCode: number;
errMsg: string;
rsp: {
sendStatus: SendStatus[];
};
}>;
addFlashTransferTaskInfoListener(...args: unknown[]): unknown;
removeFlashTransferTaskInfoListener(...args: unknown[]): unknown;
retrieveLocalLastFailedSetTasksInfo(): unknown;
getFailedFileList(fileSetId: string): Promise<{
rsp: {
seq: number;
result: number;
errMs: string;
fileSetId: string;
fileList: [];
};
}>;
getLocalFileListByStatuses(...args: unknown[]): unknown;
addTransferStateListener(...args: unknown[]): unknown;
removeTransferStateListener(...args: unknown[]): unknown;
getFileSetFirstClusteringList(...args: unknown[]): unknown;
getFileSetClusteringList(...args: unknown[]): unknown;
addFileSetClusteringListListener(...args: unknown[]): unknown;
removeFileSetClusteringListListener(...args: unknown[]): unknown;
getFileSetClusteringDetail(...args: unknown[]): unknown;
doAIOFlashTransferBubbleActionWithStatus(...args: unknown[]): unknown;
getFilesTransferProgress(...args: unknown[]): unknown;
pollFilesTransferProgress(...args: unknown[]): unknown;
cancelPollFilesTransferProgress(...args: unknown[]): unknown;
checkDownloadStatusBeforeLocalFileOper(...args: unknown[]): unknown;
getCompressedFileFolder(...args: unknown[]): unknown;
addFolderListener(...args: unknown[]): unknown;
removeFolderListener(...args: unknown[]): unknown;
addCompressedFileListener(...args: unknown[]): unknown;
removeCompressedFileListener(...args: unknown[]): unknown;
getFileCategoryList(...args: unknown[]): unknown;
addDeviceStatusListener(...args: unknown[]): unknown;
removeDeviceStatusListener(...args: unknown[]): unknown;
checkDeviceStatus(...args: unknown[]): unknown;
pauseAllTasks(...args: unknown[]): unknown;
resumePausedTasksAfterDeviceStatus(...args: unknown[]): unknown;
onSystemGoingToSleep(...args: unknown[]): unknown;
onSystemWokeUp(...args: unknown[]): unknown;
getFileMetas(...args: unknown[]): unknown;
addDownloadCntStatisticsListener(...args: unknown[]): unknown;
removeDownloadCntStatisticsListener(...args: unknown[]): unknown;
detectPrivacyInfoInPaths(...args: unknown[]): unknown;
getFileThumbnailUrl(...args: unknown[]): unknown;
handleDownloadFinishAfterSaveToAlbum(...args: unknown[]): unknown;
checkBatchFilesDownloadStatus(...args: unknown[]): unknown;
onCheckAlbumStorageStatusResult(...args: unknown[]): unknown;
addFileAlbumStorageListener(...args: unknown[]): unknown;
removeFileAlbumStorageListener(...args: unknown[]): unknown;
refreshFolderStatus(...args: unknown[]): unknown;
}
@@ -0,0 +1,81 @@
# import/no-import-module-exports
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
<!-- end auto-generated rule header -->
Reports the use of import declarations with CommonJS exports in any module
except for the [main module](https://docs.npmjs.com/files/package.json#main).
If you have multiple entry points or are using `js:next` this rule includes an
`exceptions` option which you can use to exclude those files from the rule.
## Options
### `exceptions`
- An array of globs. The rule will be omitted from any file that matches a glob
in the options array. For example, the following setting will omit the rule
in the `some-file.js` file.
```json
"import/no-import-module-exports": ["error", {
"exceptions": ["**/*/some-file.js"]
}]
```
## Rule Details
### Fail
```js
import { stuff } from 'starwars'
module.exports = thing
import * as allThings from 'starwars'
exports.bar = thing
import thing from 'other-thing'
exports.foo = bar
import thing from 'starwars'
const baz = module.exports = thing
console.log(baz)
```
### Pass
Given the following package.json:
```json
{
"main": "lib/index.js",
}
```
```js
import thing from 'other-thing'
export default thing
const thing = require('thing')
module.exports = thing
const thing = require('thing')
exports.foo = bar
import thing from 'otherthing'
console.log(thing.module.exports)
// in lib/index.js
import foo from 'path';
module.exports = foo;
// in some-file.js
// eslint import/no-import-module-exports: ["error", {"exceptions": ["**/*/some-file.js"]}]
import foo from 'path';
module.exports = foo;
```
### Further Reading
- [webpack issue #4039](https://github.com/webpack/webpack/issues/4039)
@@ -0,0 +1,203 @@
'use strict'
/**
* Ponyfill for `Array.prototype.find` which is only available in ES6 runtimes.
*
* Works with anything that has a `length` property and index access properties, including NodeList.
*
* @template {unknown} T
* @param {Array<T> | ({length:number, [number]: T})} list
* @param {function (item: T, index: number, list:Array<T> | ({length:number, [number]: T})):boolean} predicate
* @param {Partial<Pick<ArrayConstructor['prototype'], 'find'>>?} ac `Array.prototype` by default,
* allows injecting a custom implementation in tests
* @returns {T | undefined}
*
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find
* @see https://tc39.es/ecma262/multipage/indexed-collections.html#sec-array.prototype.find
*/
function find(list, predicate, ac) {
if (ac === undefined) {
ac = Array.prototype;
}
if (list && typeof ac.find === 'function') {
return ac.find.call(list, predicate);
}
for (var i = 0; i < list.length; i++) {
if (Object.prototype.hasOwnProperty.call(list, i)) {
var item = list[i];
if (predicate.call(undefined, item, i, list)) {
return item;
}
}
}
}
/**
* "Shallow freezes" an object to render it immutable.
* Uses `Object.freeze` if available,
* otherwise the immutability is only in the type.
*
* Is used to create "enum like" objects.
*
* @template T
* @param {T} object the object to freeze
* @param {Pick<ObjectConstructor, 'freeze'> = Object} oc `Object` by default,
* allows to inject custom object constructor for tests
* @returns {Readonly<T>}
*
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze
*/
function freeze(object, oc) {
if (oc === undefined) {
oc = Object
}
return oc && typeof oc.freeze === 'function' ? oc.freeze(object) : object
}
/**
* Since we can not rely on `Object.assign` we provide a simplified version
* that is sufficient for our needs.
*
* @param {Object} target
* @param {Object | null | undefined} source
*
* @returns {Object} target
* @throws TypeError if target is not an object
*
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
* @see https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-object.assign
*/
function assign(target, source) {
if (target === null || typeof target !== 'object') {
throw new TypeError('target is not an object')
}
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key]
}
}
return target
}
/**
* All mime types that are allowed as input to `DOMParser.parseFromString`
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString#Argument02 MDN
* @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#domparsersupportedtype WHATWG HTML Spec
* @see DOMParser.prototype.parseFromString
*/
var MIME_TYPE = freeze({
/**
* `text/html`, the only mime type that triggers treating an XML document as HTML.
*
* @see DOMParser.SupportedType.isHTML
* @see https://www.iana.org/assignments/media-types/text/html IANA MimeType registration
* @see https://en.wikipedia.org/wiki/HTML Wikipedia
* @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString MDN
* @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring WHATWG HTML Spec
*/
HTML: 'text/html',
/**
* Helper method to check a mime type if it indicates an HTML document
*
* @param {string} [value]
* @returns {boolean}
*
* @see https://www.iana.org/assignments/media-types/text/html IANA MimeType registration
* @see https://en.wikipedia.org/wiki/HTML Wikipedia
* @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString MDN
* @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring */
isHTML: function (value) {
return value === MIME_TYPE.HTML
},
/**
* `application/xml`, the standard mime type for XML documents.
*
* @see https://www.iana.org/assignments/media-types/application/xml IANA MimeType registration
* @see https://tools.ietf.org/html/rfc7303#section-9.1 RFC 7303
* @see https://en.wikipedia.org/wiki/XML_and_MIME Wikipedia
*/
XML_APPLICATION: 'application/xml',
/**
* `text/html`, an alias for `application/xml`.
*
* @see https://tools.ietf.org/html/rfc7303#section-9.2 RFC 7303
* @see https://www.iana.org/assignments/media-types/text/xml IANA MimeType registration
* @see https://en.wikipedia.org/wiki/XML_and_MIME Wikipedia
*/
XML_TEXT: 'text/xml',
/**
* `application/xhtml+xml`, indicates an XML document that has the default HTML namespace,
* but is parsed as an XML document.
*
* @see https://www.iana.org/assignments/media-types/application/xhtml+xml IANA MimeType registration
* @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocument WHATWG DOM Spec
* @see https://en.wikipedia.org/wiki/XHTML Wikipedia
*/
XML_XHTML_APPLICATION: 'application/xhtml+xml',
/**
* `image/svg+xml`,
*
* @see https://www.iana.org/assignments/media-types/image/svg+xml IANA MimeType registration
* @see https://www.w3.org/TR/SVG11/ W3C SVG 1.1
* @see https://en.wikipedia.org/wiki/Scalable_Vector_Graphics Wikipedia
*/
XML_SVG_IMAGE: 'image/svg+xml',
})
/**
* Namespaces that are used in this code base.
*
* @see http://www.w3.org/TR/REC-xml-names
*/
var NAMESPACE = freeze({
/**
* The XHTML namespace.
*
* @see http://www.w3.org/1999/xhtml
*/
HTML: 'http://www.w3.org/1999/xhtml',
/**
* Checks if `uri` equals `NAMESPACE.HTML`.
*
* @param {string} [uri]
*
* @see NAMESPACE.HTML
*/
isHTML: function (uri) {
return uri === NAMESPACE.HTML
},
/**
* The SVG namespace.
*
* @see http://www.w3.org/2000/svg
*/
SVG: 'http://www.w3.org/2000/svg',
/**
* The `xml:` namespace.
*
* @see http://www.w3.org/XML/1998/namespace
*/
XML: 'http://www.w3.org/XML/1998/namespace',
/**
* The `xmlns:` namespace
*
* @see https://www.w3.org/2000/xmlns/
*/
XMLNS: 'http://www.w3.org/2000/xmlns/',
})
exports.assign = assign;
exports.find = find;
exports.freeze = freeze;
exports.MIME_TYPE = MIME_TYPE;
exports.NAMESPACE = NAMESPACE;
@@ -0,0 +1,21 @@
var eq = require('./eq');
/**
* Gets the index at which the `key` is found in `array` of key-value pairs.
*
* @private
* @param {Array} array The array to inspect.
* @param {*} key The key to search for.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function assocIndexOf(array, key) {
var length = array.length;
while (length--) {
if (eq(array[length][0], key)) {
return length;
}
}
return -1;
}
module.exports = assocIndexOf;
@@ -0,0 +1,716 @@
import {
tv
} from "./chunk-UWE6H66T.mjs";
import {
dataFocusVisibleClasses
} from "./chunk-GH5E4FQB.mjs";
// src/components/select.ts
var select = tv({
slots: {
base: ["group inline-flex flex-col relative"],
label: [
"block",
"absolute",
"z-10",
"origin-top-left",
"rtl:origin-top-right",
"subpixel-antialiased",
"text-small",
"text-foreground-500",
"pointer-events-none"
],
mainWrapper: "w-full flex flex-col",
trigger: "relative px-3 gap-3 w-full inline-flex flex-row items-center shadow-sm outline-none tap-highlight-transparent",
innerWrapper: "inline-flex h-full w-[calc(100%_-_theme(spacing.6))] min-h-4 items-center gap-1.5 box-border",
selectorIcon: "absolute end-3 w-4 h-4",
spinner: "absolute end-3",
value: ["text-foreground-500", "font-normal", "w-full", "text-start"],
listboxWrapper: "scroll-py-6 w-full",
listbox: "",
popoverContent: "w-full p-1 overflow-hidden",
helperWrapper: "p-1 flex relative flex-col gap-1.5",
description: "text-tiny text-foreground-400",
errorMessage: "text-tiny text-danger"
},
variants: {
variant: {
flat: {
trigger: [
"bg-default-100",
"data-[hover=true]:bg-default-200",
"group-data-[focus=true]:bg-default-200"
]
},
faded: {
trigger: [
"bg-default-100",
"border-medium",
"border-default-200",
"data-[hover=true]:border-default-400 data-[focus=true]:border-default-400 data-[open=true]:border-default-400"
],
value: "group-data-[has-value=true]:text-default-foreground"
},
bordered: {
trigger: [
"border-medium",
"border-default-200",
"data-[hover=true]:border-default-400",
"data-[open=true]:border-default-foreground",
"data-[focus=true]:border-default-foreground"
],
value: "group-data-[has-value=true]:text-default-foreground"
},
underlined: {
trigger: [
"!px-1",
"!pb-0",
"!gap-0",
"relative",
"box-border",
"border-b-medium",
"shadow-[0_1px_0px_0_rgba(0,0,0,0.05)]",
"border-default-200",
"!rounded-none",
"hover:border-default-300",
"after:content-['']",
"after:w-0",
"after:origin-center",
"after:bg-default-foreground",
"after:absolute",
"after:left-1/2",
"after:-translate-x-1/2",
"after:-bottom-[2px]",
"after:h-[2px]",
"data-[open=true]:after:w-full",
"data-[focus=true]:after:w-full"
],
value: "group-data-[has-value=true]:text-default-foreground"
}
},
color: {
default: {},
primary: {
selectorIcon: "text-primary"
},
secondary: {
selectorIcon: "text-secondary"
},
success: {
selectorIcon: "text-success"
},
warning: {
selectorIcon: "text-warning"
},
danger: {
selectorIcon: "text-danger"
}
},
size: {
sm: {
label: "text-tiny",
trigger: "h-8 min-h-8 px-2 rounded-small",
value: "text-small"
},
md: {
trigger: "h-10 min-h-10 rounded-medium",
value: "text-small"
},
lg: {
trigger: "h-12 min-h-12 rounded-large",
value: "text-medium"
}
},
radius: {
none: {
trigger: "rounded-none"
},
sm: {
trigger: "rounded-small"
},
md: {
trigger: "rounded-medium"
},
lg: {
trigger: "rounded-large"
},
full: {
trigger: "rounded-full"
}
},
labelPlacement: {
outside: {
base: "flex flex-col"
},
"outside-left": {
base: "flex-row items-center flex-nowrap items-start",
label: "relative pe-2 text-foreground"
},
inside: {
label: "text-tiny cursor-pointer",
trigger: "flex-col items-start justify-center gap-0"
}
},
fullWidth: {
true: {
base: "w-full"
},
false: {
base: "min-w-40"
}
},
isDisabled: {
true: {
base: "opacity-disabled pointer-events-none",
trigger: "pointer-events-none"
}
},
isInvalid: {
true: {
label: "!text-danger",
value: "!text-danger",
selectorIcon: "text-danger"
}
},
isRequired: {
true: {
label: "after:content-['*'] after:text-danger after:ms-0.5"
}
},
isMultiline: {
true: {
label: "relative",
trigger: "!h-auto"
},
false: {
value: "truncate"
}
},
disableAnimation: {
true: {
trigger: "after:transition-none",
base: "transition-none",
label: "transition-none",
selectorIcon: "transition-none"
},
false: {
base: "transition-background motion-reduce:transition-none !duration-150",
label: [
"will-change-auto",
"origin-top-left",
"rtl:origin-top-right",
"!duration-200",
"!ease-out",
"transition-[transform,color,left,opacity]",
"motion-reduce:transition-none"
],
selectorIcon: "transition-transform duration-150 ease motion-reduce:transition-none"
}
},
disableSelectorIconRotation: {
true: {},
false: {
selectorIcon: "data-[open=true]:rotate-180"
}
}
},
defaultVariants: {
variant: "flat",
color: "default",
size: "md",
labelPlacement: "inside",
fullWidth: true,
isDisabled: false,
isMultiline: false,
disableSelectorIconRotation: false
},
compoundVariants: [
{
variant: "flat",
color: "default",
class: {
value: "group-data-[has-value=true]:text-default-foreground",
trigger: ["bg-default-100", "data-[hover=true]:bg-default-200"]
}
},
{
variant: "flat",
color: "primary",
class: {
trigger: [
"bg-primary-100",
"text-primary",
"data-[hover=true]:bg-primary-50",
"group-data-[focus=true]:bg-primary-50"
],
value: "text-primary",
label: "text-primary"
}
},
{
variant: "flat",
color: "secondary",
class: {
trigger: [
"bg-secondary-100",
"text-secondary",
"data-[hover=true]:bg-secondary-50",
"group-data-[focus=true]:bg-secondary-50"
],
value: "text-secondary",
label: "text-secondary"
}
},
{
variant: "flat",
color: "success",
class: {
trigger: [
"bg-success-100",
"text-success-600",
"dark:text-success",
"data-[hover=true]:bg-success-50",
"group-data-[focus=true]:bg-success-50"
],
value: "text-success-600 dark:text-success",
label: "text-success-600 dark:text-success"
}
},
{
variant: "flat",
color: "warning",
class: {
trigger: [
"bg-warning-100",
"text-warning-600",
"dark:text-warning",
"data-[hover=true]:bg-warning-50",
"group-data-[focus=true]:bg-warning-50"
],
value: "text-warning-600 dark:text-warning",
label: "text-warning-600 dark:text-warning"
}
},
{
variant: "flat",
color: "danger",
class: {
trigger: [
"bg-danger-100",
"text-danger",
"dark:text-danger-500",
"data-[hover=true]:bg-danger-50",
"group-data-[focus=true]:bg-danger-50"
],
value: "text-danger dark:text-danger-500",
label: "text-danger dark:text-danger-500"
}
},
{
variant: "faded",
color: "primary",
class: {
trigger: "data-[hover=true]:border-primary data-[focus=true]:border-primary data-[open=true]:border-primary",
label: "text-primary"
}
},
{
variant: "faded",
color: "secondary",
class: {
trigger: "data-[hover=true]:border-secondary data-[focus=true]:border-secondary data-[open=true]:border-secondary",
label: "text-secondary"
}
},
{
variant: "faded",
color: "success",
class: {
trigger: "data-[hover=true]:border-success data-[focus=true]:border-success data-[open=true]:border-success",
label: "text-success"
}
},
{
variant: "faded",
color: "warning",
class: {
trigger: "data-[hover=true]:border-warning data-[focus=true]:border-warning data-[open=true]:border-warning",
label: "text-warning"
}
},
{
variant: "faded",
color: "danger",
class: {
trigger: "data-[hover=true]:border-danger data-[focus=true]:border-danger data-[open=true]:border-danger",
label: "text-danger"
}
},
{
variant: "underlined",
color: "default",
class: {
value: "group-data-[has-value=true]:text-foreground"
}
},
{
variant: "underlined",
color: "primary",
class: {
trigger: "after:bg-primary",
label: "text-primary"
}
},
{
variant: "underlined",
color: "secondary",
class: {
trigger: "after:bg-secondary",
label: "text-secondary"
}
},
{
variant: "underlined",
color: "success",
class: {
trigger: "after:bg-success",
label: "text-success"
}
},
{
variant: "underlined",
color: "warning",
class: {
trigger: "after:bg-warning",
label: "text-warning"
}
},
{
variant: "underlined",
color: "danger",
class: {
trigger: "after:bg-danger",
label: "text-danger"
}
},
{
variant: "bordered",
color: "primary",
class: {
trigger: ["data-[open=true]:border-primary", "data-[focus=true]:border-primary"],
label: "text-primary"
}
},
{
variant: "bordered",
color: "secondary",
class: {
trigger: ["data-[open=true]:border-secondary", "data-[focus=true]:border-secondary"],
label: "text-secondary"
}
},
{
variant: "bordered",
color: "success",
class: {
trigger: ["data-[open=true]:border-success", "data-[focus=true]:border-success"],
label: "text-success"
}
},
{
variant: "bordered",
color: "warning",
class: {
trigger: ["data-[open=true]:border-warning", "data-[focus=true]:border-warning"],
label: "text-warning"
}
},
{
variant: "bordered",
color: "danger",
class: {
trigger: ["data-[open=true]:border-danger", "data-[focus=true]:border-danger"],
label: "text-danger"
}
},
{
labelPlacement: "inside",
color: "default",
class: {
label: "group-data-[filled=true]:text-default-600"
}
},
{
labelPlacement: "outside",
color: "default",
class: {
label: "group-data-[filled=true]:text-foreground"
}
},
{
radius: "full",
size: ["sm"],
class: {
trigger: "px-3"
}
},
{
radius: "full",
size: "md",
class: {
trigger: "px-4"
}
},
{
radius: "full",
size: "lg",
class: {
trigger: "px-5"
}
},
{
disableAnimation: false,
variant: ["faded", "bordered"],
class: {
trigger: "transition-colors motion-reduce:transition-none"
}
},
{
disableAnimation: false,
variant: "underlined",
class: {
trigger: "after:transition-width motion-reduce:after:transition-none"
}
},
{
variant: ["flat", "faded"],
class: {
trigger: [
...dataFocusVisibleClasses
]
}
},
{
isInvalid: true,
variant: "flat",
class: {
trigger: [
"bg-danger-50",
"data-[hover=true]:bg-danger-100",
"group-data-[focus=true]:bg-danger-50"
]
}
},
{
isInvalid: true,
variant: "bordered",
class: {
trigger: "!border-danger group-data-[focus=true]:border-danger"
}
},
{
isInvalid: true,
variant: "underlined",
class: {
trigger: "after:bg-danger"
}
},
{
labelPlacement: "inside",
size: "sm",
class: {
trigger: "h-12 min-h-12 py-1.5 px-3"
}
},
{
labelPlacement: "inside",
size: "md",
class: {
trigger: "h-14 min-h-14 py-2"
}
},
{
labelPlacement: "inside",
size: "lg",
class: {
label: "text-medium",
trigger: "h-16 min-h-16 py-2.5 gap-0"
}
},
{
labelPlacement: "outside",
isMultiline: false,
class: {
base: "group relative justify-end",
label: ["pb-0", "z-20", "top-1/2", "-translate-y-1/2", "group-data-[filled=true]:start-0"]
}
},
{
labelPlacement: ["inside"],
class: {
label: "group-data-[filled=true]:scale-85"
}
},
{
labelPlacement: "inside",
size: ["sm", "md"],
class: {
label: "text-small"
}
},
{
labelPlacement: "inside",
isMultiline: false,
size: "sm",
class: {
label: ["group-data-[filled=true]:-translate-y-[calc(50%_+_theme(fontSize.tiny)/2_-_8px)]"],
innerWrapper: "group-data-[has-label=true]:pt-4"
}
},
{
labelPlacement: "inside",
isMultiline: false,
size: "md",
class: {
label: [
"group-data-[filled=true]:-translate-y-[calc(50%_+_theme(fontSize.small)/2_-_6px)]"
],
innerWrapper: "group-data-[has-label=true]:pt-4"
}
},
{
labelPlacement: "inside",
isMultiline: false,
size: "lg",
class: {
label: [
"text-medium",
"group-data-[filled=true]:-translate-y-[calc(50%_+_theme(fontSize.small)/2_-_8px)]"
],
innerWrapper: "group-data-[has-label=true]:pt-5"
}
},
{
labelPlacement: "inside",
variant: ["faded", "bordered"],
isMultiline: false,
size: "sm",
class: {
label: [
"group-data-[filled=true]:-translate-y-[calc(50%_+_theme(fontSize.tiny)/2_-_8px_-_theme(borderWidth.medium))]"
]
}
},
{
labelPlacement: "inside",
variant: ["faded", "bordered"],
isMultiline: false,
size: "md",
class: {
label: [
"group-data-[filled=true]:-translate-y-[calc(50%_+_theme(fontSize.small)/2_-_6px_-_theme(borderWidth.medium))]"
]
}
},
{
labelPlacement: "inside",
variant: ["faded", "bordered"],
isMultiline: false,
size: "lg",
class: {
label: [
"text-medium",
"group-data-[filled=true]:-translate-y-[calc(50%_+_theme(fontSize.small)/2_-_8px_-_theme(borderWidth.medium))]"
]
}
},
{
labelPlacement: "inside",
variant: "underlined",
isMultiline: false,
size: "sm",
class: {
label: ["group-data-[filled=true]:-translate-y-[calc(50%_+_theme(fontSize.tiny)/2_-_5px)]"]
}
},
{
labelPlacement: "inside",
variant: "underlined",
isMultiline: false,
size: "md",
class: {
label: [
"group-data-[filled=true]:-translate-y-[calc(50%_+_theme(fontSize.small)/2_-_3.5px)]"
]
}
},
{
labelPlacement: "inside",
variant: "underlined",
isMultiline: false,
size: "lg",
class: {
label: [
"text-medium",
"group-data-[filled=true]:-translate-y-[calc(50%_+_theme(fontSize.small)/2_-_4px)]"
]
}
},
{
labelPlacement: "outside",
size: "sm",
isMultiline: false,
class: {
label: [
"start-2",
"text-tiny",
"group-data-[filled=true]:-translate-y-[calc(100%_+_theme(fontSize.tiny)/2_+_16px)]"
],
base: "data-[has-label=true]:mt-[calc(theme(fontSize.small)_+_8px)]"
}
},
{
labelPlacement: "outside",
isMultiline: false,
size: "md",
class: {
label: [
"start-3",
"text-small",
"group-data-[filled=true]:-translate-y-[calc(100%_+_theme(fontSize.small)/2_+_20px)]"
],
base: "data-[has-label=true]:mt-[calc(theme(fontSize.small)_+_10px)]"
}
},
{
labelPlacement: "outside",
isMultiline: false,
size: "lg",
class: {
label: [
"start-3",
"text-medium",
"group-data-[filled=true]:-translate-y-[calc(100%_+_theme(fontSize.small)/2_+_24px)]"
],
base: "data-[has-label=true]:mt-[calc(theme(fontSize.small)_+_12px)]"
}
},
{
labelPlacement: "outside",
isMultiline: true,
class: {
label: "pb-1.5"
}
},
{
labelPlacement: ["inside", "outside"],
class: {
label: ["pe-2", "max-w-full", "text-ellipsis", "overflow-hidden"]
}
}
]
});
export {
select
};
@@ -0,0 +1,20 @@
import * as react from 'react';
import * as _heroui_system_rsc from '@heroui/system-rsc';
import { HTMLHeroUIProps, PropGetter } from '@heroui/system-rsc';
import { CodeVariantProps } from '@heroui/theme';
import { ReactRef } from '@heroui/react-utils';
interface UseCodeProps extends HTMLHeroUIProps<"code">, CodeVariantProps {
/**
* Ref to the DOM node.
*/
ref?: ReactRef<HTMLElement | null>;
}
declare function useCode(originalProps: UseCodeProps): {
Component: _heroui_system_rsc.As<any>;
children: react.ReactNode;
getCodeProps: PropGetter<Record<string, unknown>, _heroui_system_rsc.DOMAttributes<_heroui_system_rsc.DOMElement>>;
};
type UseCodeReturn = ReturnType<typeof useCode>;
export { UseCodeProps, UseCodeReturn, useCode };
@@ -0,0 +1,4 @@
import { BaseBinding, BindingType } from '@inversifyjs/core';
import { BindingIdentifier } from '../models/BindingIdentifier';
export declare function buildBindingIdentifier(binding: BaseBinding<BindingType, unknown>): BindingIdentifier;
//# sourceMappingURL=buildBindingIdentifier.d.ts.map
@@ -0,0 +1,8 @@
var $d8e2640a066567a9$exports = {};
$d8e2640a066567a9$exports = {
"breadcrumbs": `Navigasjonsstier`
};
export {$d8e2640a066567a9$exports as default};
//# sourceMappingURL=nb-NO.module.js.map
@@ -0,0 +1,23 @@
'use strict';
var inspect = require('../');
var Buffer = require('safer-buffer').Buffer;
var holes = ['a', 'b'];
holes[4] = 'e';
holes[6] = 'g';
var obj = {
a: 1,
b: [3, 4, undefined, null],
c: undefined,
d: null,
e: {
regex: /^x/i,
buf: Buffer.from('abc'),
holes: holes
},
now: new Date()
};
obj.self = obj;
console.log(inspect(obj));
@@ -0,0 +1,24 @@
"use client";
import {
listbox_item_base_default
} from "./chunk-BJFJ4DRR.mjs";
import {
listbox_section_base_default
} from "./chunk-ANTZPR32.mjs";
import {
listbox_default
} from "./chunk-O4OUNAUT.mjs";
import {
useListbox
} from "./chunk-JEEKNW4E.mjs";
import "./chunk-VE6UBSD2.mjs";
import "./chunk-L637PYVS.mjs";
import "./chunk-V45NB7OG.mjs";
import "./chunk-65JTUBIW.mjs";
import "./chunk-IXUWKP6S.mjs";
export {
listbox_default as Listbox,
listbox_item_base_default as ListboxItem,
listbox_section_base_default as ListboxSection,
useListbox
};
@@ -0,0 +1,45 @@
{
"name": "is-arrayish",
"description": "Determines if an object can be used as an array",
"version": "0.3.4",
"author": "Qix (http://github.com/qix-)",
"keywords": [
"is",
"array",
"duck",
"type",
"arrayish",
"similar",
"proto",
"prototype",
"type"
],
"license": "MIT",
"scripts": {
"test": "mocha --require coffeescript/register ./test/**/*.coffee",
"lint": "zeit-eslint --ext .jsx,.js .",
"lint-staged": "git diff --diff-filter=ACMRT --cached --name-only '*.js' '*.jsx' | xargs zeit-eslint"
},
"repository": {
"type": "git",
"url": "https://github.com/qix-/node-is-arrayish.git"
},
"devDependencies": {
"@zeit/eslint-config-node": "^0.3.0",
"@zeit/git-hooks": "^0.1.4",
"coffeescript": "^2.3.1",
"coveralls": "^3.0.1",
"eslint": "^4.19.1",
"istanbul": "^0.4.5",
"mocha": "^5.2.0",
"should": "^13.2.1"
},
"eslintConfig": {
"extends": [
"@zeit/eslint-config-node"
]
},
"git": {
"pre-commit": "lint-staged"
}
}
@@ -0,0 +1,13 @@
"use strict";
var _class_apply_descriptor_destructure = require("./_class_apply_descriptor_destructure.cjs");
var _class_check_private_static_access = require("./_class_check_private_static_access.cjs");
var _class_check_private_static_field_descriptor = require("./_class_check_private_static_field_descriptor.cjs");
function _class_static_private_field_destructure(receiver, classConstructor, descriptor) {
_class_check_private_static_access._(receiver, classConstructor);
_class_check_private_static_field_descriptor._(descriptor, "set");
return _class_apply_descriptor_destructure._(receiver, descriptor);
}
exports._ = _class_static_private_field_destructure;
@@ -0,0 +1,78 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/edit.tsx
var edit_exports = {};
__export(edit_exports, {
EditIcon: () => EditIcon
});
module.exports = __toCommonJS(edit_exports);
var import_jsx_runtime = require("react/jsx-runtime");
var EditIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
"svg",
{
"aria-hidden": "true",
fill: "none",
focusable: "false",
height: "1em",
role: "presentation",
viewBox: "0 0 20 20",
width: "1em",
...props,
children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
"path",
{
d: "M11.05 3.00002L4.20835 10.2417C3.95002 10.5167 3.70002 11.0584 3.65002 11.4334L3.34169 14.1334C3.23335 15.1084 3.93335 15.775 4.90002 15.6084L7.58335 15.15C7.95835 15.0834 8.48335 14.8084 8.74168 14.525L15.5834 7.28335C16.7667 6.03335 17.3 4.60835 15.4583 2.86668C13.625 1.14168 12.2334 1.75002 11.05 3.00002Z",
stroke: "currentColor",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeMiterlimit: 10,
strokeWidth: 1.5
}
),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
"path",
{
d: "M9.90833 4.20831C10.2667 6.50831 12.1333 8.26665 14.45 8.49998",
stroke: "currentColor",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeMiterlimit: 10,
strokeWidth: 1.5
}
),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
"path",
{
d: "M2.5 18.3333H17.5",
stroke: "currentColor",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeMiterlimit: 10,
strokeWidth: 1.5
}
)
]
}
);
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
EditIcon
});
@@ -0,0 +1,65 @@
import React from 'react';
import type { FieldValues, FormProviderProps, UseFormReturn } from './types';
/**
* This custom hook allows you to access the form context. useFormContext is intended to be used in deeply nested structures, where it would become inconvenient to pass the context as a prop. To be used with {@link FormProvider}.
*
* @remarks
* [API](https://react-hook-form.com/docs/useformcontext) • [Demo](https://codesandbox.io/s/react-hook-form-v7-form-context-ytudi)
*
* @returns return all useForm methods
*
* @example
* ```tsx
* function App() {
* const methods = useForm();
* const onSubmit = data => console.log(data);
*
* return (
* <FormProvider {...methods} >
* <form onSubmit={methods.handleSubmit(onSubmit)}>
* <NestedInput />
* <input type="submit" />
* </form>
* </FormProvider>
* );
* }
*
* function NestedInput() {
* const { register } = useFormContext(); // retrieve all hook methods
* return <input {...register("test")} />;
* }
* ```
*/
export declare const useFormContext: <TFieldValues extends FieldValues, TContext = any, TTransformedValues = TFieldValues>() => UseFormReturn<TFieldValues, TContext, TTransformedValues>;
/**
* A provider component that propagates the `useForm` methods to all children components via [React Context](https://react.dev/reference/react/useContext) API. To be used with {@link useFormContext}.
*
* @remarks
* [API](https://react-hook-form.com/docs/useformcontext) • [Demo](https://codesandbox.io/s/react-hook-form-v7-form-context-ytudi)
*
* @param props - all useForm methods
*
* @example
* ```tsx
* function App() {
* const methods = useForm();
* const onSubmit = data => console.log(data);
*
* return (
* <FormProvider {...methods} >
* <form onSubmit={methods.handleSubmit(onSubmit)}>
* <NestedInput />
* <input type="submit" />
* </form>
* </FormProvider>
* );
* }
*
* function NestedInput() {
* const { register } = useFormContext(); // retrieve all hook methods
* return <input {...register("test")} />;
* }
* ```
*/
export declare const FormProvider: <TFieldValues extends FieldValues, TContext = any, TTransformedValues = TFieldValues>(props: FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React.JSX.Element;
//# sourceMappingURL=useFormContext.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"postConstruct.js","sourceRoot":"","sources":["../../../../src/metadata/decorators/postConstruct.ts"],"names":[],"mappings":";;AAOA,sCAiBC;AAxBD,gFAA+E;AAE/E,gGAA6F;AAC7F,gHAA6G;AAC7G,qFAAkF;AAClF,+EAA4E;AAE5E,SAAgB,aAAa;IAC3B,OAAO,CACL,MAAc,EACd,WAA4B,EAC5B,WAAuC,EACjC,EAAE;QACR,IAAI,CAAC;YACH,IAAA,iDAAwB,EACtB,MAAM,CAAC,WAAW,EAClB,iDAAuB,EACvB,iDAAuB,EACvB,IAAA,iFAAuC,EAAC,WAAW,CAAC,CACrD,CAAC;QACJ,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,IAAA,2CAAoB,EAAC,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1 @@
{"version":3,"file":"check-strong.d.ts","sourceRoot":"","sources":["check-strong.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AACH,mCAHW,KAAK,GACH,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC,CAcxD;2BAnBgC,wBAAwB;6BAAxB,wBAAwB"}
@@ -0,0 +1 @@
{"version":3,"file":"no-namespace.d.ts","sourceRoot":"","sources":["no-namespace.js"],"names":[],"mappings":"wBAoBW,OAAO,QAAQ,EAAE,IAAI,CAAC,UAAU"}
@@ -0,0 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ClassStaticBlockScope = void 0;
const ScopeBase_1 = require("./ScopeBase");
const ScopeType_1 = require("./ScopeType");
class ClassStaticBlockScope extends ScopeBase_1.ScopeBase {
constructor(scopeManager, upperScope, block) {
super(scopeManager, ScopeType_1.ScopeType.classStaticBlock, upperScope, block, false);
}
}
exports.ClassStaticBlockScope = ClassStaticBlockScope;
@@ -0,0 +1,52 @@
import { type TSchema, SchemaOptions } from '../schema/index.mjs';
import { type Assert } from '../helpers/index.mjs';
import { type TComputed } from '../computed/index.mjs';
import { type TNever } from '../never/index.mjs';
import { type TArray } from '../array/index.mjs';
import { type TIntersect } from '../intersect/index.mjs';
import { type TMappedResult, type TMappedKey } from '../mapped/index.mjs';
import { type TObject, type TProperties } from '../object/index.mjs';
import { type TUnion } from '../union/index.mjs';
import { type TRecursive } from '../recursive/index.mjs';
import { type TRef } from '../ref/index.mjs';
import { type TTuple } from '../tuple/index.mjs';
import { type TIntersectEvaluated } from '../intersect/index.mjs';
import { type TUnionEvaluated } from '../union/index.mjs';
import { type TIndexPropertyKeys } from './indexed-property-keys.mjs';
import { type TIndexFromMappedKey } from './indexed-from-mapped-key.mjs';
import { type TIndexFromMappedResult } from './indexed-from-mapped-result.mjs';
type TFromRest<Types extends TSchema[], Key extends PropertyKey, Result extends TSchema[] = []> = (Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? TFromRest<Right, Key, [...Result, Assert<TIndexFromPropertyKey<Left, Key>, TSchema>]> : Result);
type TFromIntersectRest<Types extends TSchema[], Result extends TSchema[] = []> = (Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? Left extends TNever ? TFromIntersectRest<Right, [...Result]> : TFromIntersectRest<Right, [...Result, Left]> : Result);
type TFromIntersect<Types extends TSchema[], Key extends PropertyKey> = (TIntersectEvaluated<TFromIntersectRest<TFromRest<Types, Key>>>);
type TFromUnionRest<Types extends TSchema[], Result extends TSchema[] = []> = Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? Left extends TNever ? [] : TFromUnionRest<Right, [Left, ...Result]> : Result;
type TFromUnion<Types extends TSchema[], Key extends PropertyKey> = (TUnionEvaluated<TFromUnionRest<TFromRest<Types, Key>>>);
type TFromTuple<Types extends TSchema[], Key extends PropertyKey> = (Key extends keyof Types ? Types[Key] : Key extends '[number]' ? TUnionEvaluated<Types> : TNever);
type TFromArray<Type extends TSchema, Key extends PropertyKey> = (Key extends '[number]' ? Type : TNever);
type AssertPropertyKey<T> = Assert<T, string | number>;
type TFromProperty<Properties extends TProperties, Key extends PropertyKey> = (Key extends keyof Properties ? Properties[Key] : `${AssertPropertyKey<Key>}` extends `${AssertPropertyKey<keyof Properties>}` ? Properties[AssertPropertyKey<Key>] : TNever);
export type TIndexFromPropertyKey<Type extends TSchema, Key extends PropertyKey> = (Type extends TRecursive<infer Type extends TSchema> ? TIndexFromPropertyKey<Type, Key> : Type extends TIntersect<infer Types extends TSchema[]> ? TFromIntersect<Types, Key> : Type extends TUnion<infer Types extends TSchema[]> ? TFromUnion<Types, Key> : Type extends TTuple<infer Types extends TSchema[]> ? TFromTuple<Types, Key> : Type extends TArray<infer Type extends TSchema> ? TFromArray<Type, Key> : Type extends TObject<infer Properties extends TProperties> ? TFromProperty<Properties, Key> : TNever);
export declare function IndexFromPropertyKey<Type extends TSchema, Key extends PropertyKey>(type: Type, propertyKey: Key): TIndexFromPropertyKey<Type, Key>;
export type TIndexFromPropertyKeys<Type extends TSchema, PropertyKeys extends PropertyKey[], Result extends TSchema[] = []> = (PropertyKeys extends [infer Left extends PropertyKey, ...infer Right extends PropertyKey[]] ? TIndexFromPropertyKeys<Type, Right, [...Result, Assert<TIndexFromPropertyKey<Type, Left>, TSchema>]> : Result);
export declare function IndexFromPropertyKeys<Type extends TSchema, PropertyKeys extends PropertyKey[]>(type: Type, propertyKeys: [...PropertyKeys]): TIndexFromPropertyKeys<Type, PropertyKeys>;
type FromSchema<Type extends TSchema, PropertyKeys extends PropertyKey[]> = (TUnionEvaluated<TIndexFromPropertyKeys<Type, PropertyKeys>>);
declare function FromSchema<Type extends TSchema, PropertyKeys extends PropertyKey[]>(type: Type, propertyKeys: [...PropertyKeys]): FromSchema<Type, PropertyKeys>;
export type TIndexFromComputed<Type extends TSchema, Key extends TSchema> = (TComputed<'Index', [Type, Key]>);
export declare function IndexFromComputed<Type extends TSchema, Key extends TSchema>(type: Type, key: Key): TIndexFromComputed<Type, Key>;
export type TIndex<Type extends TSchema, PropertyKeys extends PropertyKey[]> = (FromSchema<Type, PropertyKeys>);
/** `[Json]` Returns an Indexed property type for the given keys */
export declare function Index<Type extends TRef, Key extends TSchema>(type: Type, key: Key, options?: SchemaOptions): TIndexFromComputed<Type, Key>;
/** `[Json]` Returns an Indexed property type for the given keys */
export declare function Index<Type extends TSchema, Key extends TRef>(type: Type, key: Key, options?: SchemaOptions): TIndexFromComputed<Type, Key>;
/** `[Json]` Returns an Indexed property type for the given keys */
export declare function Index<Type extends TRef, Key extends TRef>(type: Type, key: Key, options?: SchemaOptions): TIndexFromComputed<Type, Key>;
/** `[Json]` Returns an Indexed property type for the given keys */
export declare function Index<Type extends TSchema, MappedResult extends TMappedResult>(type: Type, mappedResult: MappedResult, options?: SchemaOptions): TIndexFromMappedResult<Type, MappedResult>;
/** `[Json]` Returns an Indexed property type for the given keys */
export declare function Index<Type extends TSchema, MappedResult extends TMappedResult>(type: Type, mappedResult: MappedResult, options?: SchemaOptions): TIndexFromMappedResult<Type, MappedResult>;
/** `[Json]` Returns an Indexed property type for the given keys */
export declare function Index<Type extends TSchema, MappedKey extends TMappedKey>(type: Type, mappedKey: MappedKey, options?: SchemaOptions): TIndexFromMappedKey<Type, MappedKey>;
/** `[Json]` Returns an Indexed property type for the given keys */
export declare function Index<Type extends TSchema, Key extends TSchema, PropertyKeys extends PropertyKey[] = TIndexPropertyKeys<Key>>(T: Type, K: Key, options?: SchemaOptions): TIndex<Type, PropertyKeys>;
/** `[Json]` Returns an Indexed property type for the given keys */
export declare function Index<Type extends TSchema, PropertyKeys extends PropertyKey[]>(type: Type, propertyKeys: readonly [...PropertyKeys], options?: SchemaOptions): TIndex<Type, PropertyKeys>;
export {};
@@ -0,0 +1,94 @@
/**
* Copyright (c) 2018 The xterm.js authors. All rights reserved.
* @license MIT
*/
import { CharData, ICellData, IExtendedAttrs } from 'common/Types';
import { stringFromCodePoint } from 'common/input/TextDecoder';
import { CHAR_DATA_CHAR_INDEX, CHAR_DATA_WIDTH_INDEX, CHAR_DATA_ATTR_INDEX, Content } from 'common/buffer/Constants';
import { AttributeData, ExtendedAttrs } from 'common/buffer/AttributeData';
/**
* CellData - represents a single Cell in the terminal buffer.
*/
export class CellData extends AttributeData implements ICellData {
/** Helper to create CellData from CharData. */
public static fromCharData(value: CharData): CellData {
const obj = new CellData();
obj.setFromCharData(value);
return obj;
}
/** Primitives from terminal buffer. */
public content = 0;
public fg = 0;
public bg = 0;
public extended: IExtendedAttrs = new ExtendedAttrs();
public combinedData = '';
/** Whether cell contains a combined string. */
public isCombined(): number {
return this.content & Content.IS_COMBINED_MASK;
}
/** Width of the cell. */
public getWidth(): number {
return this.content >> Content.WIDTH_SHIFT;
}
/** JS string of the content. */
public getChars(): string {
if (this.content & Content.IS_COMBINED_MASK) {
return this.combinedData;
}
if (this.content & Content.CODEPOINT_MASK) {
return stringFromCodePoint(this.content & Content.CODEPOINT_MASK);
}
return '';
}
/**
* Codepoint of cell
* Note this returns the UTF32 codepoint of single chars,
* if content is a combined string it returns the codepoint
* of the last char in string to be in line with code in CharData.
*/
public getCode(): number {
return (this.isCombined())
? this.combinedData.charCodeAt(this.combinedData.length - 1)
: this.content & Content.CODEPOINT_MASK;
}
/** Set data from CharData */
public setFromCharData(value: CharData): void {
this.fg = value[CHAR_DATA_ATTR_INDEX];
this.bg = 0;
let combined = false;
// surrogates and combined strings need special treatment
if (value[CHAR_DATA_CHAR_INDEX].length > 2) {
combined = true;
}
else if (value[CHAR_DATA_CHAR_INDEX].length === 2) {
const code = value[CHAR_DATA_CHAR_INDEX].charCodeAt(0);
// if the 2-char string is a surrogate create single codepoint
// everything else is combined
if (0xD800 <= code && code <= 0xDBFF) {
const second = value[CHAR_DATA_CHAR_INDEX].charCodeAt(1);
if (0xDC00 <= second && second <= 0xDFFF) {
this.content = ((code - 0xD800) * 0x400 + second - 0xDC00 + 0x10000) | (value[CHAR_DATA_WIDTH_INDEX] << Content.WIDTH_SHIFT);
}
else {
combined = true;
}
}
else {
combined = true;
}
}
else {
this.content = value[CHAR_DATA_CHAR_INDEX].charCodeAt(0) | (value[CHAR_DATA_WIDTH_INDEX] << Content.WIDTH_SHIFT);
}
if (combined) {
this.combinedData = value[CHAR_DATA_CHAR_INDEX];
this.content = Content.IS_COMBINED_MASK | (value[CHAR_DATA_WIDTH_INDEX] << Content.WIDTH_SHIFT);
}
}
/** Get data as CharData. */
public getAsCharData(): CharData {
return [this.fg, this.getChars(), this.getWidth(), this.getCode()];
}
}
@@ -0,0 +1,50 @@
# is-set <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
[![github actions][actions-image]][actions-url]
[![coverage][codecov-image]][codecov-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]
[![npm badge][npm-badge-png]][package-url]
Is this value a JS Set? This module works cross-realm/iframe, and despite ES6 @@toStringTag.
## Example
```js
var isSet = require('is-set');
assert(!isSet(function () {}));
assert(!isSet(null));
assert(!isSet(function* () { yield 42; return Infinity; });
assert(!isSet(Symbol('foo')));
assert(!isSet(1n));
assert(!isSet(Object(1n)));
assert(!isSet(new Map()));
assert(!isSet(new WeakSet()));
assert(!isSet(new WeakMap()));
assert(isSet(new Set()));
class MySet extends Set {}
assert(isSet(new MySet()));
```
## Tests
Simply clone the repo, `npm install`, and run `npm test`
[package-url]: https://npmjs.org/package/is-set
[npm-version-svg]: https://versionbadg.es/inspect-js/is-set.svg
[deps-svg]: https://david-dm.org/inspect-js/is-set.svg
[deps-url]: https://david-dm.org/inspect-js/is-set
[dev-deps-svg]: https://david-dm.org/inspect-js/is-set/dev-status.svg
[dev-deps-url]: https://david-dm.org/inspect-js/is-set#info=devDependencies
[npm-badge-png]: https://nodei.co/npm/is-set.png?downloads=true&stars=true
[license-image]: https://img.shields.io/npm/l/is-set.svg
[license-url]: LICENSE
[downloads-image]: https://img.shields.io/npm/dm/is-set.svg
[downloads-url]: https://npm-stat.com/charts.html?package=is-set
[codecov-image]: https://codecov.io/gh/inspect-js/is-set/branch/main/graphs/badge.svg
[codecov-url]: https://app.codecov.io/gh/inspect-js/is-set/
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/is-set
[actions-url]: https://github.com/inspect-js/is-set/actions
@@ -0,0 +1,4 @@
import getAsyncFunction from './index.js';
/** @type {import('./index.d.mts').default} */
export default getAsyncFunction;
@@ -0,0 +1,14 @@
import * as goober from '../index';
describe('goober', () => {
it('exports', () => {
expect(Object.keys(goober).sort()).toEqual([
'css',
'extractCss',
'glob',
'keyframes',
'setup',
'styled'
]);
});
});
@@ -0,0 +1,126 @@
"use strict";
var _utils = require("./utils.js");
(0, _utils.default)("ArgumentPlaceholder", {});
(0, _utils.default)("BindExpression", {
visitor: ["object", "callee"],
aliases: ["Expression"],
fields: !process.env.BABEL_TYPES_8_BREAKING ? {
object: {
validate: Object.assign(() => {}, {
oneOfNodeTypes: ["Expression"]
})
},
callee: {
validate: Object.assign(() => {}, {
oneOfNodeTypes: ["Expression"]
})
}
} : {
object: {
validate: (0, _utils.assertNodeType)("Expression")
},
callee: {
validate: (0, _utils.assertNodeType)("Expression")
}
}
});
(0, _utils.default)("Decorator", {
visitor: ["expression"],
fields: {
expression: {
validate: (0, _utils.assertNodeType)("Expression")
}
}
});
(0, _utils.default)("DoExpression", {
visitor: ["body"],
builder: ["body", "async"],
aliases: ["Expression"],
fields: {
body: {
validate: (0, _utils.assertNodeType)("BlockStatement")
},
async: {
validate: (0, _utils.assertValueType)("boolean"),
default: false
}
}
});
(0, _utils.default)("ExportDefaultSpecifier", {
visitor: ["exported"],
aliases: ["ModuleSpecifier"],
fields: {
exported: {
validate: (0, _utils.assertNodeType)("Identifier")
}
}
});
(0, _utils.default)("RecordExpression", {
visitor: ["properties"],
aliases: ["Expression"],
fields: {
properties: (0, _utils.validateArrayOfType)("ObjectProperty", "SpreadElement")
}
});
(0, _utils.default)("TupleExpression", {
fields: {
elements: {
validate: (0, _utils.arrayOfType)("Expression", "SpreadElement"),
default: []
}
},
visitor: ["elements"],
aliases: ["Expression"]
});
{
(0, _utils.default)("DecimalLiteral", {
builder: ["value"],
fields: {
value: {
validate: (0, _utils.assertValueType)("string")
}
},
aliases: ["Expression", "Pureish", "Literal", "Immutable"]
});
}
(0, _utils.default)("ModuleExpression", {
visitor: ["body"],
fields: {
body: {
validate: (0, _utils.assertNodeType)("Program")
}
},
aliases: ["Expression"]
});
(0, _utils.default)("TopicReference", {
aliases: ["Expression"]
});
(0, _utils.default)("PipelineTopicExpression", {
builder: ["expression"],
visitor: ["expression"],
fields: {
expression: {
validate: (0, _utils.assertNodeType)("Expression")
}
},
aliases: ["Expression"]
});
(0, _utils.default)("PipelineBareFunction", {
builder: ["callee"],
visitor: ["callee"],
fields: {
callee: {
validate: (0, _utils.assertNodeType)("Expression")
}
},
aliases: ["Expression"]
});
(0, _utils.default)("PipelinePrimaryTopicReference", {
aliases: ["Expression"]
});
(0, _utils.default)("VoidPattern", {
aliases: ["Pattern", "PatternLike", "FunctionParameter"]
});
//# sourceMappingURL=experimental.js.map
@@ -0,0 +1 @@
module.exports={C:{"34":0.006,"52":0.006,"59":0.003,"78":0.003,"115":0.04199,"127":0.003,"128":0.003,"132":0.003,"136":0.006,"140":0.015,"141":0.006,"142":0.012,"143":0.21893,"144":0.20693,"145":0.003,_:"2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 53 54 55 56 57 58 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 116 117 118 119 120 121 122 123 124 125 126 129 130 131 133 134 135 137 138 139 146 147 3.5 3.6"},D:{"39":0.006,"40":0.006,"41":0.006,"42":0.006,"43":0.006,"44":0.006,"45":0.006,"46":0.006,"47":0.006,"48":0.006,"49":0.006,"50":0.006,"51":0.006,"52":0.07797,"53":0.006,"54":0.006,"55":0.006,"56":0.006,"57":0.006,"58":0.006,"59":0.006,"60":0.006,"65":0.003,"66":0.009,"69":0.003,"70":0.006,"74":0.003,"75":0.003,"78":0.006,"79":0.012,"81":0.003,"83":0.003,"86":0.003,"87":0.015,"88":0.012,"90":0.003,"91":0.015,"93":0.003,"94":0.003,"98":0.6118,"100":0.009,"101":0.003,"102":0.003,"103":0.009,"104":0.006,"106":0.003,"108":0.009,"109":0.32089,"110":0.003,"111":0.02099,"112":1.42153,"114":0.04499,"116":0.02399,"117":0.006,"118":0.003,"119":0.01799,"120":0.012,"121":0.006,"122":0.02399,"123":0.006,"124":0.02999,"125":1.83239,"126":0.14995,"127":0.009,"128":0.02099,"129":0.006,"130":0.25791,"131":0.03899,"132":0.02099,"133":0.03899,"134":0.02099,"135":0.02399,"136":0.03899,"137":0.04199,"138":0.15895,"139":0.27291,"140":2.75308,"141":5.60213,"142":0.05998,_:"4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 61 62 63 64 67 68 71 72 73 76 77 80 84 85 89 92 95 96 97 99 105 107 113 115 143 144 145"},F:{"84":0.003,"85":0.003,"86":0.006,"89":0.003,"90":0.009,"91":0.07198,"92":0.08097,"95":0.02099,"109":0.003,"120":0.04199,"121":0.01799,"122":0.26691,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 87 88 93 94 96 97 98 99 100 101 102 103 104 105 106 107 108 110 111 112 113 114 115 116 117 118 119 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"17":0.003,"18":0.003,"92":0.009,"100":0.003,"109":0.012,"114":0.02999,"118":0.03299,"122":0.003,"126":0.003,"127":0.003,"131":0.003,"132":0.003,"133":0.003,"134":0.015,"135":0.009,"136":0.003,"137":0.012,"138":0.01799,"139":0.02999,"140":0.47084,"141":2.0873,"142":0.003,_:"12 13 14 15 16 79 80 81 83 84 85 86 87 88 89 90 91 93 94 95 96 97 98 99 101 102 103 104 105 106 107 108 110 111 112 113 115 116 117 119 120 121 123 124 125 128 129 130"},E:{_:"0 4 5 6 7 8 9 10 11 12 13 14 15 3.1 3.2 5.1 6.1 7.1 9.1 10.1 15.2-15.3 15.4 26.2","11.1":0.003,"12.1":0.003,"13.1":0.009,"14.1":0.006,"15.1":0.003,"15.5":0.006,"15.6":0.04798,"16.0":0.003,"16.1":0.003,"16.2":0.003,"16.3":0.006,"16.4":0.003,"16.5":0.006,"16.6":0.05698,"17.0":0.003,"17.1":0.03599,"17.2":0.003,"17.3":0.003,"17.4":0.006,"17.5":0.006,"17.6":0.04199,"18.0":0.003,"18.1":0.009,"18.2":0.003,"18.3":0.01799,"18.4":0.009,"18.5-18.6":0.05098,"26.0":0.12596,"26.1":0.006},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00088,"5.0-5.1":0,"6.0-6.1":0.00353,"7.0-7.1":0.00265,"8.1-8.4":0,"9.0-9.2":0,"9.3":0.00794,"10.0-10.2":0.00088,"10.3":0.015,"11.0-11.2":0.2223,"11.3-11.4":0.00529,"12.0-12.1":0.00176,"12.2-12.5":0.04322,"13.0-13.1":0,"13.2":0.00441,"13.3":0.00176,"13.4-13.7":0.00706,"14.0-14.4":0.015,"14.5-14.8":0.01588,"15.0-15.1":0.015,"15.2-15.3":0.01147,"15.4":0.01323,"15.5":0.015,"15.6-15.8":0.19583,"16.0":0.02646,"16.1":0.0494,"16.2":0.02558,"16.3":0.04587,"16.4":0.01147,"16.5":0.02029,"16.6-16.7":0.26199,"17.0":0.01852,"17.1":0.02823,"17.2":0.02029,"17.3":0.02999,"17.4":0.05293,"17.5":0.09086,"17.6-17.7":0.22935,"18.0":0.05205,"18.1":0.10762,"18.2":0.05822,"18.3":0.18701,"18.4":0.09615,"18.5-18.6":4.90286,"26.0":0.60602,"26.1":0.02205},P:{"4":0.05061,"20":0.01012,"21":0.02024,"22":0.03037,"23":0.03037,"24":0.12146,"25":0.06073,"26":0.06073,"27":0.13159,"28":5.53669,"29":0.42512,_:"5.0-5.4 6.2-6.4 8.2 9.2 10.1 13.0 15.0 16.0","7.2-7.4":0.15183,"11.1-11.2":0.02024,"12.0":0.01012,"14.0":0.02024,"17.0":0.01012,"18.0":0.01012,"19.0":0.02024},I:{"0":0.02796,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0.00001,"4.4":0,"4.4.3-4.4.4":0.00001},K:{"0":2.80541,_:"10 11 12 11.1 11.5 12.1"},A:{"11":0.006,_:"6 7 8 9 10 5.5"},S:{_:"2.5 3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},R:{_:"0"},M:{"0":0.45507},Q:{_:"14.9"},O:{"0":0.11202},H:{"0":0.03},L:{"0":61.49763}};
@@ -0,0 +1,39 @@
var $085250522aa37816$exports = require("./intlStrings.main.js");
var $kbAeD$reactariautils = require("@react-aria/utils");
var $kbAeD$reactariai18n = require("@react-aria/i18n");
function $parcel$interopDefault(a) {
return a && a.__esModule ? a.default : a;
}
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "useGridSelectionCheckbox", () => $d8385f73d3701365$export$70e2eed1a92976ad);
function $d8385f73d3701365$export$70e2eed1a92976ad(props, state) {
let { key: key } = props;
let manager = state.selectionManager;
let checkboxId = (0, $kbAeD$reactariautils.useId)();
let isDisabled = !state.selectionManager.canSelectItem(key);
let isSelected = state.selectionManager.isSelected(key);
// Checkbox should always toggle selection, regardless of selectionBehavior.
let onChange = ()=>manager.toggleSelection(key);
const stringFormatter = (0, $kbAeD$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($085250522aa37816$exports))), '@react-aria/grid');
return {
checkboxProps: {
id: checkboxId,
'aria-label': stringFormatter.format('select'),
isSelected: isSelected,
isDisabled: isDisabled,
onChange: onChange
}
};
}
//# sourceMappingURL=useGridSelectionCheckbox.main.js.map
@@ -0,0 +1,50 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getImportNodesMatchedGroup = void 0;
var constants_1 = require("../constants");
/**
* Get the regexp group to keep the import nodes.
* @param node
* @param importOrder
*/
var getImportNodesMatchedGroup = function (node, importOrder) {
var groupWithRegExp = importOrder.map(function (group) { return ({
group: group,
regExp: group.startsWith(constants_1.TYPES_SPECIAL_WORD)
? new RegExp(group.replace(constants_1.TYPES_SPECIAL_WORD, ''))
: new RegExp(group),
}); });
// finding the group for non-type imports is easy: it's the first group that matches.
// however, for type imports, we need to make sure that we don't match a non-type group
// that's earlier in the list than a type-specific group that would otherwise match.
// so we need to get all matching groups, look for the first matching _type-specific_ group,
// and if it exists, return it. otherwise, return the first matching group if there is one.
var matchingGroups = groupWithRegExp.filter(function (_a) {
var group = _a.group, regExp = _a.regExp;
if (group.startsWith(constants_1.TYPES_SPECIAL_WORD) &&
node.importKind !== 'type') {
return false;
}
else {
return node.source.value.match(regExp) !== null;
}
});
if (matchingGroups.length === 0) {
return node.importKind === 'type' &&
importOrder.find(function (group) { return group === constants_1.THIRD_PARTY_TYPES_SPECIAL_WORD; })
? constants_1.THIRD_PARTY_TYPES_SPECIAL_WORD
: constants_1.THIRD_PARTY_MODULES_SPECIAL_WORD;
}
else if (node.importKind !== 'type') {
return matchingGroups[0].group;
}
else {
for (var _i = 0, matchingGroups_1 = matchingGroups; _i < matchingGroups_1.length; _i++) {
var group = matchingGroups_1[_i].group;
if (group.startsWith(constants_1.TYPES_SPECIAL_WORD))
return group;
}
return matchingGroups[0].group;
}
};
exports.getImportNodesMatchedGroup = getImportNodesMatchedGroup;
@@ -0,0 +1,72 @@
'use strict';
// do not edit .js files directly - edit src/index.jst
var envHasBigInt64Array = typeof BigInt64Array !== 'undefined';
module.exports = function equal(a, b) {
if (a === b) return true;
if (a && b && typeof a == 'object' && typeof b == 'object') {
if (a.constructor !== b.constructor) return false;
var length, i, keys;
if (Array.isArray(a)) {
length = a.length;
if (length != b.length) return false;
for (i = length; i-- !== 0;)
if (!equal(a[i], b[i])) return false;
return true;
}
if ((a instanceof Map) && (b instanceof Map)) {
if (a.size !== b.size) return false;
for (i of a.entries())
if (!b.has(i[0])) return false;
for (i of a.entries())
if (!equal(i[1], b.get(i[0]))) return false;
return true;
}
if ((a instanceof Set) && (b instanceof Set)) {
if (a.size !== b.size) return false;
for (i of a.entries())
if (!b.has(i[0])) return false;
return true;
}
if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
length = a.length;
if (length != b.length) return false;
for (i = length; i-- !== 0;)
if (a[i] !== b[i]) return false;
return true;
}
if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
keys = Object.keys(a);
length = keys.length;
if (length !== Object.keys(b).length) return false;
for (i = length; i-- !== 0;)
if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
for (i = length; i-- !== 0;) {
var key = keys[i];
if (!equal(a[key], b[key])) return false;
}
return true;
}
// true if both NaN, false otherwise
return a!==a && b!==b;
};
@@ -0,0 +1,53 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _jsxAstUtils = require("jsx-ast-utils");
var _schemas = require("../util/schemas");
/**
* @fileoverview Enforce tabIndex value is not greater than zero.
* @author Ethan Cohen
*/
// ----------------------------------------------------------------------------
// Rule Definition
// ----------------------------------------------------------------------------
var errorMessage = 'Avoid positive integer values for tabIndex.';
var schema = (0, _schemas.generateObjSchema)();
var _default = exports["default"] = {
meta: {
docs: {
url: 'https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/tree/HEAD/docs/rules/tabindex-no-positive.md',
description: 'Enforce `tabIndex` value is not greater than zero.'
},
schema: [schema]
},
create: function create(context) {
return {
JSXAttribute: function JSXAttribute(attribute) {
var name = (0, _jsxAstUtils.propName)(attribute).toUpperCase();
// Check if tabIndex is the attribute
if (name !== 'TABINDEX') {
return;
}
// Only check literals because we can't infer values from certain expressions.
var value = Number((0, _jsxAstUtils.getLiteralPropValue)(attribute));
// eslint-disable-next-line no-restricted-globals
if (isNaN(value) || value <= 0) {
return;
}
context.report({
node: attribute,
message: errorMessage
});
}
};
}
};
module.exports = exports.default;
@@ -0,0 +1,236 @@
import {
IProduceWithPatches,
IProduce,
ImmerState,
Drafted,
isDraftable,
processResult,
Patch,
Objectish,
DRAFT_STATE,
Draft,
PatchListener,
isDraft,
isMap,
isSet,
createProxyProxy,
getPlugin,
die,
enterScope,
revokeScope,
leaveScope,
usePatchesInScope,
getCurrentScope,
NOTHING,
freeze,
current
} from "../internal"
interface ProducersFns {
produce: IProduce
produceWithPatches: IProduceWithPatches
}
export type StrictMode = boolean | "class_only"
export class Immer implements ProducersFns {
autoFreeze_: boolean = true
useStrictShallowCopy_: StrictMode = false
useStrictIteration_: boolean = true
constructor(config?: {
autoFreeze?: boolean
useStrictShallowCopy?: StrictMode
useStrictIteration?: boolean
}) {
if (typeof config?.autoFreeze === "boolean")
this.setAutoFreeze(config!.autoFreeze)
if (typeof config?.useStrictShallowCopy === "boolean")
this.setUseStrictShallowCopy(config!.useStrictShallowCopy)
if (typeof config?.useStrictIteration === "boolean")
this.setUseStrictIteration(config!.useStrictIteration)
}
/**
* The `produce` function takes a value and a "recipe function" (whose
* return value often depends on the base state). The recipe function is
* free to mutate its first argument however it wants. All mutations are
* only ever applied to a __copy__ of the base state.
*
* Pass only a function to create a "curried producer" which relieves you
* from passing the recipe function every time.
*
* Only plain objects and arrays are made mutable. All other objects are
* considered uncopyable.
*
* Note: This function is __bound__ to its `Immer` instance.
*
* @param {any} base - the initial state
* @param {Function} recipe - function that receives a proxy of the base state as first argument and which can be freely modified
* @param {Function} patchListener - optional function that will be called with all the patches produced here
* @returns {any} a new state, or the initial state if nothing was modified
*/
produce: IProduce = (base: any, recipe?: any, patchListener?: any) => {
// curried invocation
if (typeof base === "function" && typeof recipe !== "function") {
const defaultBase = recipe
recipe = base
const self = this
return function curriedProduce(
this: any,
base = defaultBase,
...args: any[]
) {
return self.produce(base, (draft: Drafted) => recipe.call(this, draft, ...args)) // prettier-ignore
}
}
if (typeof recipe !== "function") die(6)
if (patchListener !== undefined && typeof patchListener !== "function")
die(7)
let result
// Only plain objects, arrays, and "immerable classes" are drafted.
if (isDraftable(base)) {
const scope = enterScope(this)
const proxy = createProxy(base, undefined)
let hasError = true
try {
result = recipe(proxy)
hasError = false
} finally {
// finally instead of catch + rethrow better preserves original stack
if (hasError) revokeScope(scope)
else leaveScope(scope)
}
usePatchesInScope(scope, patchListener)
return processResult(result, scope)
} else if (!base || typeof base !== "object") {
result = recipe(base)
if (result === undefined) result = base
if (result === NOTHING) result = undefined
if (this.autoFreeze_) freeze(result, true)
if (patchListener) {
const p: Patch[] = []
const ip: Patch[] = []
getPlugin("Patches").generateReplacementPatches_(base, result, p, ip)
patchListener(p, ip)
}
return result
} else die(1, base)
}
produceWithPatches: IProduceWithPatches = (base: any, recipe?: any): any => {
// curried invocation
if (typeof base === "function") {
return (state: any, ...args: any[]) =>
this.produceWithPatches(state, (draft: any) => base(draft, ...args))
}
let patches: Patch[], inversePatches: Patch[]
const result = this.produce(base, recipe, (p: Patch[], ip: Patch[]) => {
patches = p
inversePatches = ip
})
return [result, patches!, inversePatches!]
}
createDraft<T extends Objectish>(base: T): Draft<T> {
if (!isDraftable(base)) die(8)
if (isDraft(base)) base = current(base)
const scope = enterScope(this)
const proxy = createProxy(base, undefined)
proxy[DRAFT_STATE].isManual_ = true
leaveScope(scope)
return proxy as any
}
finishDraft<D extends Draft<any>>(
draft: D,
patchListener?: PatchListener
): D extends Draft<infer T> ? T : never {
const state: ImmerState = draft && (draft as any)[DRAFT_STATE]
if (!state || !state.isManual_) die(9)
const {scope_: scope} = state
usePatchesInScope(scope, patchListener)
return processResult(undefined, scope)
}
/**
* Pass true to automatically freeze all copies created by Immer.
*
* By default, auto-freezing is enabled.
*/
setAutoFreeze(value: boolean) {
this.autoFreeze_ = value
}
/**
* Pass true to enable strict shallow copy.
*
* By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.
*/
setUseStrictShallowCopy(value: StrictMode) {
this.useStrictShallowCopy_ = value
}
/**
* Pass false to use faster iteration that skips non-enumerable properties
* but still handles symbols for compatibility.
*
* By default, strict iteration is enabled (includes all own properties).
*/
setUseStrictIteration(value: boolean) {
this.useStrictIteration_ = value
}
shouldUseStrictIteration(): boolean {
return this.useStrictIteration_
}
applyPatches<T extends Objectish>(base: T, patches: readonly Patch[]): T {
// If a patch replaces the entire state, take that replacement as base
// before applying patches
let i: number
for (i = patches.length - 1; i >= 0; i--) {
const patch = patches[i]
if (patch.path.length === 0 && patch.op === "replace") {
base = patch.value
break
}
}
// If there was a patch that replaced the entire state, start from the
// patch after that.
if (i > -1) {
patches = patches.slice(i + 1)
}
const applyPatchesImpl = getPlugin("Patches").applyPatches_
if (isDraft(base)) {
// N.B: never hits if some patch a replacement, patches are never drafts
return applyPatchesImpl(base, patches)
}
// Otherwise, produce a copy of the base state.
return this.produce(base, (draft: Drafted) =>
applyPatchesImpl(draft, patches)
)
}
}
export function createProxy<T extends Objectish>(
value: T,
parent?: ImmerState
): Drafted<T, ImmerState> {
// precondition: createProxy should be guarded by isDraftable, so we know we can safely draft
const draft: Drafted = isMap(value)
? getPlugin("MapSet").proxyMap_(value, parent)
: isSet(value)
? getPlugin("MapSet").proxySet_(value, parent)
: createProxyProxy(value, parent)
const scope = parent ? parent.scope_ : getCurrentScope()
scope.drafts_.push(draft)
return draft
}
@@ -0,0 +1,28 @@
declare const pathExists: {
/**
Check if a path exists.
@returns Whether the path exists.
@example
```
// foo.ts
import pathExists = require('path-exists');
(async () => {
console.log(await pathExists('foo.ts'));
//=> true
})();
```
*/
(path: string): Promise<boolean>;
/**
Synchronously check if a path exists.
@returns Whether the path exists.
*/
sync(path: string): boolean;
};
export = pathExists;
@@ -0,0 +1,3 @@
<svg viewBox="0 0 18 18">
<path class="ql-fill" d="M16.74023,12.18555a2.75131,2.75131,0,0,1-2.91553,2.80566,3.908,3.908,0,0,1-2.25537-.68164.54809.54809,0,0,1-.13184-.8252L11.73438,13c.209-.34082.48389-.36328.8252-.1543a2.23757,2.23757,0,0,0,1.1001.33008,1.01827,1.01827,0,0,0,1.1001-.96777c0-.61621-.53906-.97949-1.25439-.97949a2.15554,2.15554,0,0,0-.64893.09961,1.15209,1.15209,0,0,1-.814.01074l-.12109-.04395a.64116.64116,0,0,1-.45117-.71484l.231-3.00391a.56666.56666,0,0,1,.62744-.583H15.541a.54085.54085,0,0,1,.605.60547v.43945a.54085.54085,0,0,1-.605.60547H13.41748l-.04395.72559a1.29306,1.29306,0,0,1-.04395.30859h.022a2.39776,2.39776,0,0,1,.57227-.07715A2.53266,2.53266,0,0,1,16.74023,12.18555ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z"/>
</svg>

After

Width:  |  Height:  |  Size: 825 B

@@ -0,0 +1,421 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = applyDecs2301;
var _checkInRHS = require("checkInRHS");
var _setFunctionName = require("setFunctionName");
var _toPropertyKey = require("toPropertyKey");
function applyDecs2301Factory() {
function createAddInitializerMethod(initializers, decoratorFinishedRef) {
return function addInitializer(initializer) {
assertNotFinished(decoratorFinishedRef, "addInitializer");
assertCallable(initializer, "An initializer");
initializers.push(initializer);
};
}
function assertInstanceIfPrivate(has, target) {
if (!has(target)) {
throw new TypeError("Attempted to access private element on non-instance");
}
}
function memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, value, hasPrivateBrand) {
var kindStr;
switch (kind) {
case 1:
kindStr = "accessor";
break;
case 2:
kindStr = "method";
break;
case 3:
kindStr = "getter";
break;
case 4:
kindStr = "setter";
break;
default:
kindStr = "field";
}
var ctx = {
kind: kindStr,
name: isPrivate ? "#" + name : _toPropertyKey(name),
static: isStatic,
private: isPrivate
};
var decoratorFinishedRef = {
v: false
};
if (kind !== 0) {
ctx.addInitializer = createAddInitializerMethod(initializers, decoratorFinishedRef);
}
var get, set;
if (!isPrivate && (kind === 0 || kind === 2)) {
get = function (target) {
return target[name];
};
if (kind === 0) {
set = function (target, v) {
target[name] = v;
};
}
} else if (kind === 2) {
get = function (target) {
assertInstanceIfPrivate(hasPrivateBrand, target);
return desc.value;
};
} else {
var t = kind === 0 || kind === 1;
if (t || kind === 3) {
if (isPrivate) {
get = function (target) {
assertInstanceIfPrivate(hasPrivateBrand, target);
return desc.get.call(target);
};
} else {
get = function (target) {
return desc.get.call(target);
};
}
}
if (t || kind === 4) {
if (isPrivate) {
set = function (target, value) {
assertInstanceIfPrivate(hasPrivateBrand, target);
desc.set.call(target, value);
};
} else {
set = function (target, value) {
desc.set.call(target, value);
};
}
}
}
var has = isPrivate ? hasPrivateBrand.bind() : function (target) {
return name in target;
};
ctx.access = get && set ? {
get: get,
set: set,
has: has
} : get ? {
get: get,
has: has
} : {
set: set,
has: has
};
try {
return dec(value, ctx);
} finally {
decoratorFinishedRef.v = true;
}
}
function assertNotFinished(decoratorFinishedRef, fnName) {
if (decoratorFinishedRef.v) {
throw new Error("attempted to call " + fnName + " after decoration was finished");
}
}
function assertCallable(fn, hint) {
if (typeof fn !== "function") {
throw new TypeError(hint + " must be a function");
}
}
function assertValidReturnValue(kind, value) {
var type = typeof value;
if (kind === 1) {
if (type !== "object" || value === null) {
throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
}
if (value.get !== undefined) {
assertCallable(value.get, "accessor.get");
}
if (value.set !== undefined) {
assertCallable(value.set, "accessor.set");
}
if (value.init !== undefined) {
assertCallable(value.init, "accessor.init");
}
} else if (type !== "function") {
var hint;
if (kind === 0) {
hint = "field";
} else if (kind === 10) {
hint = "class";
} else {
hint = "method";
}
throw new TypeError(hint + " decorators must return a function or void 0");
}
}
function curryThis1(fn) {
return function () {
return fn(this);
};
}
function curryThis2(fn) {
return function (value) {
fn(this, value);
};
}
function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, hasPrivateBrand) {
var decs = decInfo[0];
var desc, init, prefix, value;
if (isPrivate) {
if (kind === 0 || kind === 1) {
desc = {
get: curryThis1(decInfo[3]),
set: curryThis2(decInfo[4])
};
prefix = "get";
} else {
if (kind === 3) {
desc = {
get: decInfo[3]
};
prefix = "get";
} else if (kind === 4) {
desc = {
set: decInfo[3]
};
prefix = "set";
} else {
desc = {
value: decInfo[3]
};
}
}
if (kind !== 0) {
if (kind === 1) {
_setFunctionName(desc.set, "#" + name, "set");
}
_setFunctionName(desc[prefix || "value"], "#" + name, prefix);
}
} else if (kind !== 0) {
desc = Object.getOwnPropertyDescriptor(base, name);
}
if (kind === 1) {
value = {
get: desc.get,
set: desc.set
};
} else if (kind === 2) {
value = desc.value;
} else if (kind === 3) {
value = desc.get;
} else if (kind === 4) {
value = desc.set;
}
var newValue, get, set;
if (typeof decs === "function") {
newValue = memberDec(decs, name, desc, initializers, kind, isStatic, isPrivate, value, hasPrivateBrand);
if (newValue !== void 0) {
assertValidReturnValue(kind, newValue);
if (kind === 0) {
init = newValue;
} else if (kind === 1) {
init = newValue.init;
get = newValue.get || value.get;
set = newValue.set || value.set;
value = {
get: get,
set: set
};
} else {
value = newValue;
}
}
} else {
for (var i = decs.length - 1; i >= 0; i--) {
var dec = decs[i];
newValue = memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, value, hasPrivateBrand);
if (newValue !== void 0) {
assertValidReturnValue(kind, newValue);
var newInit;
if (kind === 0) {
newInit = newValue;
} else if (kind === 1) {
newInit = newValue.init;
get = newValue.get || value.get;
set = newValue.set || value.set;
value = {
get: get,
set: set
};
} else {
value = newValue;
}
if (newInit !== void 0) {
if (init === void 0) {
init = newInit;
} else if (typeof init === "function") {
init = [init, newInit];
} else {
init.push(newInit);
}
}
}
}
}
if (kind === 0 || kind === 1) {
if (init === void 0) {
init = function (instance, init) {
return init;
};
} else if (typeof init !== "function") {
var ownInitializers = init;
init = function (instance, init) {
var value = init;
for (var i = 0; i < ownInitializers.length; i++) {
value = ownInitializers[i].call(instance, value);
}
return value;
};
} else {
var originalInitializer = init;
init = function (instance, init) {
return originalInitializer.call(instance, init);
};
}
ret.push(init);
}
if (kind !== 0) {
if (kind === 1) {
desc.get = value.get;
desc.set = value.set;
} else if (kind === 2) {
desc.value = value;
} else if (kind === 3) {
desc.get = value;
} else if (kind === 4) {
desc.set = value;
}
if (isPrivate) {
if (kind === 1) {
ret.push(function (instance, args) {
return value.get.call(instance, args);
});
ret.push(function (instance, args) {
return value.set.call(instance, args);
});
} else if (kind === 2) {
ret.push(value);
} else {
ret.push(function (instance, args) {
return value.call(instance, args);
});
}
} else {
Object.defineProperty(base, name, desc);
}
}
}
function applyMemberDecs(Class, decInfos, instanceBrand) {
var ret = [];
var protoInitializers;
var staticInitializers;
var staticBrand;
var existingProtoNonFields = new Map();
var existingStaticNonFields = new Map();
for (var i = 0; i < decInfos.length; i++) {
var decInfo = decInfos[i];
if (!Array.isArray(decInfo)) continue;
var kind = decInfo[1];
var name = decInfo[2];
var isPrivate = decInfo.length > 3;
var isStatic = kind >= 5;
var base;
var initializers;
var hasPrivateBrand = instanceBrand;
if (isStatic) {
base = Class;
kind = kind - 5;
if (kind !== 0) {
staticInitializers = staticInitializers || [];
initializers = staticInitializers;
}
if (isPrivate && !staticBrand) {
staticBrand = function (_) {
return _checkInRHS(_) === Class;
};
}
hasPrivateBrand = staticBrand;
} else {
base = Class.prototype;
if (kind !== 0) {
protoInitializers = protoInitializers || [];
initializers = protoInitializers;
}
}
if (kind !== 0 && !isPrivate) {
var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields;
var existingKind = existingNonFields.get(name) || 0;
if (existingKind === true || existingKind === 3 && kind !== 4 || existingKind === 4 && kind !== 3) {
throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + name);
} else if (!existingKind && kind > 2) {
existingNonFields.set(name, kind);
} else {
existingNonFields.set(name, true);
}
}
applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, hasPrivateBrand);
}
pushInitializers(ret, protoInitializers);
pushInitializers(ret, staticInitializers);
return ret;
}
function pushInitializers(ret, initializers) {
if (initializers) {
ret.push(function (instance) {
for (var i = 0; i < initializers.length; i++) {
initializers[i].call(instance);
}
return instance;
});
}
}
function applyClassDecs(targetClass, classDecs) {
if (classDecs.length > 0) {
var initializers = [];
var newClass = targetClass;
var name = targetClass.name;
for (var i = classDecs.length - 1; i >= 0; i--) {
var decoratorFinishedRef = {
v: false
};
try {
var nextNewClass = classDecs[i](newClass, {
kind: "class",
name: name,
addInitializer: createAddInitializerMethod(initializers, decoratorFinishedRef)
});
} finally {
decoratorFinishedRef.v = true;
}
if (nextNewClass !== undefined) {
assertValidReturnValue(10, nextNewClass);
newClass = nextNewClass;
}
}
return [newClass, function () {
for (var i = 0; i < initializers.length; i++) {
initializers[i].call(newClass);
}
}];
}
}
return function applyDecs2301(targetClass, memberDecs, classDecs, instanceBrand) {
return {
e: applyMemberDecs(targetClass, memberDecs, instanceBrand),
get c() {
return applyClassDecs(targetClass, classDecs);
}
};
};
}
function applyDecs2301(targetClass, memberDecs, classDecs, instanceBrand) {
return (exports.default = applyDecs2301 = applyDecs2301Factory())(targetClass, memberDecs, classDecs, instanceBrand);
}
//# sourceMappingURL=applyDecs2301.js.map
@@ -0,0 +1,12 @@
import * as _heroui_system_rsc from '@heroui/system-rsc';
import { UseDividerProps } from './use-divider.js';
import '@heroui/theme';
import 'react';
import './use-separator.js';
import '@react-types/shared';
interface DividerProps extends Omit<UseDividerProps, "children"> {
}
declare const Divider: _heroui_system_rsc.InternalForwardRefRenderFunction<"div", DividerProps, never>;
export { DividerProps, Divider as default };
@@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var get_experimental_parser_plugins_1 = require("../get-experimental-parser-plugins");
test('it should return empty list', function () {
expect((0, get_experimental_parser_plugins_1.getExperimentalParserPlugins)([])).toEqual([]);
});
test('it should return flow and decorators', function () {
expect((0, get_experimental_parser_plugins_1.getExperimentalParserPlugins)(['flow', 'decorators'])).toEqual([
'flow',
'decorators',
]);
});
test('it should return decorators with parsed options', function () {
expect((0, get_experimental_parser_plugins_1.getExperimentalParserPlugins)([
'["decorators", { "decoratorsBeforeExport": true }]',
])).toEqual([['decorators', { decoratorsBeforeExport: true }]]);
});
test('it should return decorators with parsed options', function () {
expect((0, get_experimental_parser_plugins_1.getExperimentalParserPlugins)([
'flow',
'["decorators", { "decoratorsBeforeExport": true }]',
])).toEqual(['flow', ['decorators', { decoratorsBeforeExport: true }]]);
});
test('it should throw an Error for invalid JSON', function () {
expect(function () {
return (0, get_experimental_parser_plugins_1.getExperimentalParserPlugins)([
'flow',
'["decorators", { decoratorsBeforeExport: true }]',
]);
}).toThrowError('Invalid JSON in importOrderParserPlugins: ');
});
@@ -0,0 +1,4 @@
function _writeOnlyError(r) {
throw new TypeError('"' + r + '" is write-only');
}
module.exports = _writeOnlyError, module.exports.__esModule = true, module.exports["default"] = module.exports;
@@ -0,0 +1 @@
{"version":3,"file":"getClassMetadata.d.ts","sourceRoot":"","sources":["../../../../src/metadata/calculations/getClassMetadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAI9C,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAMxD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,GAAG,aAAa,CAY7D"}
@@ -0,0 +1,59 @@
// src/utilities/transition.ts
var DEFAULT_TRANSITION_DURATION = "250ms";
var transition_default = {
".transition-background": {
"transition-property": "background",
"transition-timing-function": "ease",
"transition-duration": DEFAULT_TRANSITION_DURATION
},
".transition-colors-opacity": {
"transition-property": "color, background-color, border-color, text-decoration-color, fill, stroke, opacity",
"transition-timing-function": "ease",
"transition-duration": DEFAULT_TRANSITION_DURATION
},
".transition-width": {
"transition-property": "width",
"transition-timing-function": "ease",
"transition-duration": DEFAULT_TRANSITION_DURATION
},
".transition-height": {
"transition-property": "height",
"transition-timing-function": "ease",
"transition-duration": DEFAULT_TRANSITION_DURATION
},
".transition-size": {
"transition-property": "width, height",
"transition-timing-function": "ease",
"transition-duration": DEFAULT_TRANSITION_DURATION
},
".transition-left": {
"transition-property": "left",
"transition-timing-function": "ease",
"transition-duration": DEFAULT_TRANSITION_DURATION
},
".transition-transform-opacity": {
"transition-property": "transform, opacity",
"transition-timing-function": "ease",
"transition-duration": DEFAULT_TRANSITION_DURATION
},
".transition-transform-background": {
"transition-property": "transform, background",
"transition-timing-function": "ease",
"transition-duration": DEFAULT_TRANSITION_DURATION
},
".transition-transform-colors": {
"transition-property": "transform, color, background, background-color, border-color, text-decoration-color, fill, stroke",
"transition-timing-function": "ease",
"transition-duration": DEFAULT_TRANSITION_DURATION
},
".transition-transform-colors-opacity": {
"transition-property": "transform, color, background, background-color, border-color, text-decoration-color, fill, stroke, opacity",
"transition-timing-function": "ease",
"transition-duration": DEFAULT_TRANSITION_DURATION
}
};
export {
DEFAULT_TRANSITION_DURATION,
transition_default
};
@@ -0,0 +1,107 @@
// Copyright (c) 2011-2016 Ryan Prichard
//
// 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.
#include "Win32Console.h"
#include <windows.h>
#include <wchar.h>
#include <string>
#include "../shared/DebugClient.h"
#include "../shared/WinptyAssert.h"
Win32Console::Win32Console() : m_titleWorkBuf(16)
{
// The console window must be non-NULL. It is used for two purposes:
// (1) "Freezing" the console to detect the exact number of lines that
// have scrolled.
// (2) Killing processes attached to the console, by posting a WM_CLOSE
// message to the console window.
m_hwnd = GetConsoleWindow();
ASSERT(m_hwnd != nullptr);
}
std::wstring Win32Console::title()
{
while (true) {
// Calling GetConsoleTitleW is tricky, because its behavior changed
// from XP->Vista, then again from Win7->Win8. The Vista+Win7 behavior
// is especially broken.
//
// The MSDN documentation documents nSize as the "size of the buffer
// pointed to by the lpConsoleTitle parameter, in characters" and the
// successful return value as "the length of the console window's
// title, in characters."
//
// On XP, the function returns the title length, AFTER truncation
// (excluding the NUL terminator). If the title is blank, the API
// returns 0 and does not NUL-terminate the buffer. To accommodate
// XP, the function must:
// * Terminate the buffer itself.
// * Double the size of the title buffer in a loop.
//
// On Vista and up, the function returns the non-truncated title
// length (excluding the NUL terminator).
//
// On Vista and Windows 7, there is a bug where the buffer size is
// interpreted as a byte count rather than a wchar_t count. To
// work around this, we must pass GetConsoleTitleW a buffer that is
// twice as large as what is actually needed.
//
// See misc/*/Test_GetConsoleTitleW.cc for tests demonstrating Windows'
// behavior.
DWORD count = GetConsoleTitleW(m_titleWorkBuf.data(),
m_titleWorkBuf.size());
const size_t needed = (count + 1) * sizeof(wchar_t);
if (m_titleWorkBuf.size() < needed) {
m_titleWorkBuf.resize(needed);
continue;
}
m_titleWorkBuf[count] = L'\0';
return m_titleWorkBuf.data();
}
}
void Win32Console::setTitle(const std::wstring &title)
{
if (!SetConsoleTitleW(title.c_str())) {
trace("SetConsoleTitleW failed");
}
}
void Win32Console::setFrozen(bool frozen) {
const int SC_CONSOLE_MARK = 0xFFF2;
const int SC_CONSOLE_SELECT_ALL = 0xFFF5;
if (frozen == m_frozen) {
// Do nothing.
} else if (frozen) {
// Enter selection mode by activating either Mark or SelectAll.
const int command = m_freezeUsesMark ? SC_CONSOLE_MARK
: SC_CONSOLE_SELECT_ALL;
SendMessage(m_hwnd, WM_SYSCOMMAND, command, 0);
m_frozen = true;
} else {
// Send Escape to cancel the selection.
SendMessage(m_hwnd, WM_CHAR, 27, 0x00010001);
m_frozen = false;
}
}
@@ -0,0 +1,9 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _react = require("react");
var _createDeepCompareEffect = require("../createDeepCompareEffect");
var _default = exports["default"] = (0, _createDeepCompareEffect.createDeepCompareEffect)(_react.useLayoutEffect);
@@ -0,0 +1,794 @@
import { EntityDecoder, DecodingMode, htmlDecodeTree, xmlDecodeTree, } from "entities/decode";
var CharCodes;
(function (CharCodes) {
CharCodes[CharCodes["Tab"] = 9] = "Tab";
CharCodes[CharCodes["NewLine"] = 10] = "NewLine";
CharCodes[CharCodes["FormFeed"] = 12] = "FormFeed";
CharCodes[CharCodes["CarriageReturn"] = 13] = "CarriageReturn";
CharCodes[CharCodes["Space"] = 32] = "Space";
CharCodes[CharCodes["ExclamationMark"] = 33] = "ExclamationMark";
CharCodes[CharCodes["Number"] = 35] = "Number";
CharCodes[CharCodes["Amp"] = 38] = "Amp";
CharCodes[CharCodes["SingleQuote"] = 39] = "SingleQuote";
CharCodes[CharCodes["DoubleQuote"] = 34] = "DoubleQuote";
CharCodes[CharCodes["Dash"] = 45] = "Dash";
CharCodes[CharCodes["Slash"] = 47] = "Slash";
CharCodes[CharCodes["Zero"] = 48] = "Zero";
CharCodes[CharCodes["Nine"] = 57] = "Nine";
CharCodes[CharCodes["Semi"] = 59] = "Semi";
CharCodes[CharCodes["Lt"] = 60] = "Lt";
CharCodes[CharCodes["Eq"] = 61] = "Eq";
CharCodes[CharCodes["Gt"] = 62] = "Gt";
CharCodes[CharCodes["Questionmark"] = 63] = "Questionmark";
CharCodes[CharCodes["UpperA"] = 65] = "UpperA";
CharCodes[CharCodes["LowerA"] = 97] = "LowerA";
CharCodes[CharCodes["UpperF"] = 70] = "UpperF";
CharCodes[CharCodes["LowerF"] = 102] = "LowerF";
CharCodes[CharCodes["UpperZ"] = 90] = "UpperZ";
CharCodes[CharCodes["LowerZ"] = 122] = "LowerZ";
CharCodes[CharCodes["LowerX"] = 120] = "LowerX";
CharCodes[CharCodes["OpeningSquareBracket"] = 91] = "OpeningSquareBracket";
})(CharCodes || (CharCodes = {}));
/** All the states the tokenizer can be in. */
var State;
(function (State) {
State[State["Text"] = 1] = "Text";
State[State["BeforeTagName"] = 2] = "BeforeTagName";
State[State["InTagName"] = 3] = "InTagName";
State[State["InSelfClosingTag"] = 4] = "InSelfClosingTag";
State[State["BeforeClosingTagName"] = 5] = "BeforeClosingTagName";
State[State["InClosingTagName"] = 6] = "InClosingTagName";
State[State["AfterClosingTagName"] = 7] = "AfterClosingTagName";
// Attributes
State[State["BeforeAttributeName"] = 8] = "BeforeAttributeName";
State[State["InAttributeName"] = 9] = "InAttributeName";
State[State["AfterAttributeName"] = 10] = "AfterAttributeName";
State[State["BeforeAttributeValue"] = 11] = "BeforeAttributeValue";
State[State["InAttributeValueDq"] = 12] = "InAttributeValueDq";
State[State["InAttributeValueSq"] = 13] = "InAttributeValueSq";
State[State["InAttributeValueNq"] = 14] = "InAttributeValueNq";
// Declarations
State[State["BeforeDeclaration"] = 15] = "BeforeDeclaration";
State[State["InDeclaration"] = 16] = "InDeclaration";
// Processing instructions
State[State["InProcessingInstruction"] = 17] = "InProcessingInstruction";
// Comments & CDATA
State[State["BeforeComment"] = 18] = "BeforeComment";
State[State["CDATASequence"] = 19] = "CDATASequence";
State[State["InSpecialComment"] = 20] = "InSpecialComment";
State[State["InCommentLike"] = 21] = "InCommentLike";
// Special tags
State[State["BeforeSpecialS"] = 22] = "BeforeSpecialS";
State[State["BeforeSpecialT"] = 23] = "BeforeSpecialT";
State[State["SpecialStartSequence"] = 24] = "SpecialStartSequence";
State[State["InSpecialTag"] = 25] = "InSpecialTag";
State[State["InEntity"] = 26] = "InEntity";
})(State || (State = {}));
function isWhitespace(c) {
return (c === CharCodes.Space ||
c === CharCodes.NewLine ||
c === CharCodes.Tab ||
c === CharCodes.FormFeed ||
c === CharCodes.CarriageReturn);
}
function isEndOfTagSection(c) {
return c === CharCodes.Slash || c === CharCodes.Gt || isWhitespace(c);
}
function isASCIIAlpha(c) {
return ((c >= CharCodes.LowerA && c <= CharCodes.LowerZ) ||
(c >= CharCodes.UpperA && c <= CharCodes.UpperZ));
}
export var QuoteType;
(function (QuoteType) {
QuoteType[QuoteType["NoValue"] = 0] = "NoValue";
QuoteType[QuoteType["Unquoted"] = 1] = "Unquoted";
QuoteType[QuoteType["Single"] = 2] = "Single";
QuoteType[QuoteType["Double"] = 3] = "Double";
})(QuoteType || (QuoteType = {}));
/**
* Sequences used to match longer strings.
*
* We don't have `Script`, `Style`, or `Title` here. Instead, we re-use the *End
* sequences with an increased offset.
*/
const Sequences = {
Cdata: new Uint8Array([0x43, 0x44, 0x41, 0x54, 0x41, 0x5b]), // CDATA[
CdataEnd: new Uint8Array([0x5d, 0x5d, 0x3e]), // ]]>
CommentEnd: new Uint8Array([0x2d, 0x2d, 0x3e]), // `-->`
ScriptEnd: new Uint8Array([0x3c, 0x2f, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74]), // `</script`
StyleEnd: new Uint8Array([0x3c, 0x2f, 0x73, 0x74, 0x79, 0x6c, 0x65]), // `</style`
TitleEnd: new Uint8Array([0x3c, 0x2f, 0x74, 0x69, 0x74, 0x6c, 0x65]), // `</title`
TextareaEnd: new Uint8Array([
0x3c, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x61, 0x72, 0x65, 0x61,
]), // `</textarea`
XmpEnd: new Uint8Array([0x3c, 0x2f, 0x78, 0x6d, 0x70]), // `</xmp`
};
export default class Tokenizer {
constructor({ xmlMode = false, decodeEntities = true, }, cbs) {
this.cbs = cbs;
/** The current state the tokenizer is in. */
this.state = State.Text;
/** The read buffer. */
this.buffer = "";
/** The beginning of the section that is currently being read. */
this.sectionStart = 0;
/** The index within the buffer that we are currently looking at. */
this.index = 0;
/** The start of the last entity. */
this.entityStart = 0;
/** Some behavior, eg. when decoding entities, is done while we are in another state. This keeps track of the other state type. */
this.baseState = State.Text;
/** For special parsing behavior inside of script and style tags. */
this.isSpecial = false;
/** Indicates whether the tokenizer has been paused. */
this.running = true;
/** The offset of the current buffer. */
this.offset = 0;
this.currentSequence = undefined;
this.sequenceIndex = 0;
this.xmlMode = xmlMode;
this.decodeEntities = decodeEntities;
this.entityDecoder = new EntityDecoder(xmlMode ? xmlDecodeTree : htmlDecodeTree, (cp, consumed) => this.emitCodePoint(cp, consumed));
}
reset() {
this.state = State.Text;
this.buffer = "";
this.sectionStart = 0;
this.index = 0;
this.baseState = State.Text;
this.currentSequence = undefined;
this.running = true;
this.offset = 0;
}
write(chunk) {
this.offset += this.buffer.length;
this.buffer = chunk;
this.parse();
}
end() {
if (this.running)
this.finish();
}
pause() {
this.running = false;
}
resume() {
this.running = true;
if (this.index < this.buffer.length + this.offset) {
this.parse();
}
}
stateText(c) {
if (c === CharCodes.Lt ||
(!this.decodeEntities && this.fastForwardTo(CharCodes.Lt))) {
if (this.index > this.sectionStart) {
this.cbs.ontext(this.sectionStart, this.index);
}
this.state = State.BeforeTagName;
this.sectionStart = this.index;
}
else if (this.decodeEntities && c === CharCodes.Amp) {
this.startEntity();
}
}
stateSpecialStartSequence(c) {
const isEnd = this.sequenceIndex === this.currentSequence.length;
const isMatch = isEnd
? // If we are at the end of the sequence, make sure the tag name has ended
isEndOfTagSection(c)
: // Otherwise, do a case-insensitive comparison
(c | 0x20) === this.currentSequence[this.sequenceIndex];
if (!isMatch) {
this.isSpecial = false;
}
else if (!isEnd) {
this.sequenceIndex++;
return;
}
this.sequenceIndex = 0;
this.state = State.InTagName;
this.stateInTagName(c);
}
/** Look for an end tag. For <title> tags, also decode entities. */
stateInSpecialTag(c) {
if (this.sequenceIndex === this.currentSequence.length) {
if (c === CharCodes.Gt || isWhitespace(c)) {
const endOfText = this.index - this.currentSequence.length;
if (this.sectionStart < endOfText) {
// Spoof the index so that reported locations match up.
const actualIndex = this.index;
this.index = endOfText;
this.cbs.ontext(this.sectionStart, endOfText);
this.index = actualIndex;
}
this.isSpecial = false;
this.sectionStart = endOfText + 2; // Skip over the `</`
this.stateInClosingTagName(c);
return; // We are done; skip the rest of the function.
}
this.sequenceIndex = 0;
}
if ((c | 0x20) === this.currentSequence[this.sequenceIndex]) {
this.sequenceIndex += 1;
}
else if (this.sequenceIndex === 0) {
if (this.currentSequence === Sequences.TitleEnd) {
// We have to parse entities in <title> tags.
if (this.decodeEntities && c === CharCodes.Amp) {
this.startEntity();
}
}
else if (this.fastForwardTo(CharCodes.Lt)) {
// Outside of <title> tags, we can fast-forward.
this.sequenceIndex = 1;
}
}
else {
// If we see a `<`, set the sequence index to 1; useful for eg. `<</script>`.
this.sequenceIndex = Number(c === CharCodes.Lt);
}
}
stateCDATASequence(c) {
if (c === Sequences.Cdata[this.sequenceIndex]) {
if (++this.sequenceIndex === Sequences.Cdata.length) {
this.state = State.InCommentLike;
this.currentSequence = Sequences.CdataEnd;
this.sequenceIndex = 0;
this.sectionStart = this.index + 1;
}
}
else {
this.sequenceIndex = 0;
this.state = State.InDeclaration;
this.stateInDeclaration(c); // Reconsume the character
}
}
/**
* When we wait for one specific character, we can speed things up
* by skipping through the buffer until we find it.
*
* @returns Whether the character was found.
*/
fastForwardTo(c) {
while (++this.index < this.buffer.length + this.offset) {
if (this.buffer.charCodeAt(this.index - this.offset) === c) {
return true;
}
}
/*
* We increment the index at the end of the `parse` loop,
* so set it to `buffer.length - 1` here.
*
* TODO: Refactor `parse` to increment index before calling states.
*/
this.index = this.buffer.length + this.offset - 1;
return false;
}
/**
* Comments and CDATA end with `-->` and `]]>`.
*
* Their common qualities are:
* - Their end sequences have a distinct character they start with.
* - That character is then repeated, so we have to check multiple repeats.
* - All characters but the start character of the sequence can be skipped.
*/
stateInCommentLike(c) {
if (c === this.currentSequence[this.sequenceIndex]) {
if (++this.sequenceIndex === this.currentSequence.length) {
if (this.currentSequence === Sequences.CdataEnd) {
this.cbs.oncdata(this.sectionStart, this.index, 2);
}
else {
this.cbs.oncomment(this.sectionStart, this.index, 2);
}
this.sequenceIndex = 0;
this.sectionStart = this.index + 1;
this.state = State.Text;
}
}
else if (this.sequenceIndex === 0) {
// Fast-forward to the first character of the sequence
if (this.fastForwardTo(this.currentSequence[0])) {
this.sequenceIndex = 1;
}
}
else if (c !== this.currentSequence[this.sequenceIndex - 1]) {
// Allow long sequences, eg. --->, ]]]>
this.sequenceIndex = 0;
}
}
/**
* HTML only allows ASCII alpha characters (a-z and A-Z) at the beginning of a tag name.
*
* XML allows a lot more characters here (@see https://www.w3.org/TR/REC-xml/#NT-NameStartChar).
* We allow anything that wouldn't end the tag.
*/
isTagStartChar(c) {
return this.xmlMode ? !isEndOfTagSection(c) : isASCIIAlpha(c);
}
startSpecial(sequence, offset) {
this.isSpecial = true;
this.currentSequence = sequence;
this.sequenceIndex = offset;
this.state = State.SpecialStartSequence;
}
stateBeforeTagName(c) {
if (c === CharCodes.ExclamationMark) {
this.state = State.BeforeDeclaration;
this.sectionStart = this.index + 1;
}
else if (c === CharCodes.Questionmark) {
this.state = State.InProcessingInstruction;
this.sectionStart = this.index + 1;
}
else if (this.isTagStartChar(c)) {
const lower = c | 0x20;
this.sectionStart = this.index;
if (this.xmlMode) {
this.state = State.InTagName;
}
else if (lower === Sequences.ScriptEnd[2]) {
this.state = State.BeforeSpecialS;
}
else if (lower === Sequences.TitleEnd[2] ||
lower === Sequences.XmpEnd[2]) {
this.state = State.BeforeSpecialT;
}
else {
this.state = State.InTagName;
}
}
else if (c === CharCodes.Slash) {
this.state = State.BeforeClosingTagName;
}
else {
this.state = State.Text;
this.stateText(c);
}
}
stateInTagName(c) {
if (isEndOfTagSection(c)) {
this.cbs.onopentagname(this.sectionStart, this.index);
this.sectionStart = -1;
this.state = State.BeforeAttributeName;
this.stateBeforeAttributeName(c);
}
}
stateBeforeClosingTagName(c) {
if (isWhitespace(c)) {
// Ignore
}
else if (c === CharCodes.Gt) {
this.state = State.Text;
}
else {
this.state = this.isTagStartChar(c)
? State.InClosingTagName
: State.InSpecialComment;
this.sectionStart = this.index;
}
}
stateInClosingTagName(c) {
if (c === CharCodes.Gt || isWhitespace(c)) {
this.cbs.onclosetag(this.sectionStart, this.index);
this.sectionStart = -1;
this.state = State.AfterClosingTagName;
this.stateAfterClosingTagName(c);
}
}
stateAfterClosingTagName(c) {
// Skip everything until ">"
if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {
this.state = State.Text;
this.sectionStart = this.index + 1;
}
}
stateBeforeAttributeName(c) {
if (c === CharCodes.Gt) {
this.cbs.onopentagend(this.index);
if (this.isSpecial) {
this.state = State.InSpecialTag;
this.sequenceIndex = 0;
}
else {
this.state = State.Text;
}
this.sectionStart = this.index + 1;
}
else if (c === CharCodes.Slash) {
this.state = State.InSelfClosingTag;
}
else if (!isWhitespace(c)) {
this.state = State.InAttributeName;
this.sectionStart = this.index;
}
}
stateInSelfClosingTag(c) {
if (c === CharCodes.Gt) {
this.cbs.onselfclosingtag(this.index);
this.state = State.Text;
this.sectionStart = this.index + 1;
this.isSpecial = false; // Reset special state, in case of self-closing special tags
}
else if (!isWhitespace(c)) {
this.state = State.BeforeAttributeName;
this.stateBeforeAttributeName(c);
}
}
stateInAttributeName(c) {
if (c === CharCodes.Eq || isEndOfTagSection(c)) {
this.cbs.onattribname(this.sectionStart, this.index);
this.sectionStart = this.index;
this.state = State.AfterAttributeName;
this.stateAfterAttributeName(c);
}
}
stateAfterAttributeName(c) {
if (c === CharCodes.Eq) {
this.state = State.BeforeAttributeValue;
}
else if (c === CharCodes.Slash || c === CharCodes.Gt) {
this.cbs.onattribend(QuoteType.NoValue, this.sectionStart);
this.sectionStart = -1;
this.state = State.BeforeAttributeName;
this.stateBeforeAttributeName(c);
}
else if (!isWhitespace(c)) {
this.cbs.onattribend(QuoteType.NoValue, this.sectionStart);
this.state = State.InAttributeName;
this.sectionStart = this.index;
}
}
stateBeforeAttributeValue(c) {
if (c === CharCodes.DoubleQuote) {
this.state = State.InAttributeValueDq;
this.sectionStart = this.index + 1;
}
else if (c === CharCodes.SingleQuote) {
this.state = State.InAttributeValueSq;
this.sectionStart = this.index + 1;
}
else if (!isWhitespace(c)) {
this.sectionStart = this.index;
this.state = State.InAttributeValueNq;
this.stateInAttributeValueNoQuotes(c); // Reconsume token
}
}
handleInAttributeValue(c, quote) {
if (c === quote ||
(!this.decodeEntities && this.fastForwardTo(quote))) {
this.cbs.onattribdata(this.sectionStart, this.index);
this.sectionStart = -1;
this.cbs.onattribend(quote === CharCodes.DoubleQuote
? QuoteType.Double
: QuoteType.Single, this.index + 1);
this.state = State.BeforeAttributeName;
}
else if (this.decodeEntities && c === CharCodes.Amp) {
this.startEntity();
}
}
stateInAttributeValueDoubleQuotes(c) {
this.handleInAttributeValue(c, CharCodes.DoubleQuote);
}
stateInAttributeValueSingleQuotes(c) {
this.handleInAttributeValue(c, CharCodes.SingleQuote);
}
stateInAttributeValueNoQuotes(c) {
if (isWhitespace(c) || c === CharCodes.Gt) {
this.cbs.onattribdata(this.sectionStart, this.index);
this.sectionStart = -1;
this.cbs.onattribend(QuoteType.Unquoted, this.index);
this.state = State.BeforeAttributeName;
this.stateBeforeAttributeName(c);
}
else if (this.decodeEntities && c === CharCodes.Amp) {
this.startEntity();
}
}
stateBeforeDeclaration(c) {
if (c === CharCodes.OpeningSquareBracket) {
this.state = State.CDATASequence;
this.sequenceIndex = 0;
}
else {
this.state =
c === CharCodes.Dash
? State.BeforeComment
: State.InDeclaration;
}
}
stateInDeclaration(c) {
if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {
this.cbs.ondeclaration(this.sectionStart, this.index);
this.state = State.Text;
this.sectionStart = this.index + 1;
}
}
stateInProcessingInstruction(c) {
if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {
this.cbs.onprocessinginstruction(this.sectionStart, this.index);
this.state = State.Text;
this.sectionStart = this.index + 1;
}
}
stateBeforeComment(c) {
if (c === CharCodes.Dash) {
this.state = State.InCommentLike;
this.currentSequence = Sequences.CommentEnd;
// Allow short comments (eg. <!-->)
this.sequenceIndex = 2;
this.sectionStart = this.index + 1;
}
else {
this.state = State.InDeclaration;
}
}
stateInSpecialComment(c) {
if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {
this.cbs.oncomment(this.sectionStart, this.index, 0);
this.state = State.Text;
this.sectionStart = this.index + 1;
}
}
stateBeforeSpecialS(c) {
const lower = c | 0x20;
if (lower === Sequences.ScriptEnd[3]) {
this.startSpecial(Sequences.ScriptEnd, 4);
}
else if (lower === Sequences.StyleEnd[3]) {
this.startSpecial(Sequences.StyleEnd, 4);
}
else {
this.state = State.InTagName;
this.stateInTagName(c); // Consume the token again
}
}
stateBeforeSpecialT(c) {
const lower = c | 0x20;
switch (lower) {
case Sequences.TitleEnd[3]: {
this.startSpecial(Sequences.TitleEnd, 4);
break;
}
case Sequences.TextareaEnd[3]: {
this.startSpecial(Sequences.TextareaEnd, 4);
break;
}
case Sequences.XmpEnd[3]: {
this.startSpecial(Sequences.XmpEnd, 4);
break;
}
default: {
this.state = State.InTagName;
this.stateInTagName(c); // Consume the token again
}
}
}
startEntity() {
this.baseState = this.state;
this.state = State.InEntity;
this.entityStart = this.index;
this.entityDecoder.startEntity(this.xmlMode
? DecodingMode.Strict
: this.baseState === State.Text ||
this.baseState === State.InSpecialTag
? DecodingMode.Legacy
: DecodingMode.Attribute);
}
stateInEntity() {
const length = this.entityDecoder.write(this.buffer, this.index - this.offset);
// If `length` is positive, we are done with the entity.
if (length >= 0) {
this.state = this.baseState;
if (length === 0) {
this.index = this.entityStart;
}
}
else {
// Mark buffer as consumed.
this.index = this.offset + this.buffer.length - 1;
}
}
/**
* Remove data that has already been consumed from the buffer.
*/
cleanup() {
// If we are inside of text or attributes, emit what we already have.
if (this.running && this.sectionStart !== this.index) {
if (this.state === State.Text ||
(this.state === State.InSpecialTag && this.sequenceIndex === 0)) {
this.cbs.ontext(this.sectionStart, this.index);
this.sectionStart = this.index;
}
else if (this.state === State.InAttributeValueDq ||
this.state === State.InAttributeValueSq ||
this.state === State.InAttributeValueNq) {
this.cbs.onattribdata(this.sectionStart, this.index);
this.sectionStart = this.index;
}
}
}
shouldContinue() {
return this.index < this.buffer.length + this.offset && this.running;
}
/**
* Iterates through the buffer, calling the function corresponding to the current state.
*
* States that are more likely to be hit are higher up, as a performance improvement.
*/
parse() {
while (this.shouldContinue()) {
const c = this.buffer.charCodeAt(this.index - this.offset);
switch (this.state) {
case State.Text: {
this.stateText(c);
break;
}
case State.SpecialStartSequence: {
this.stateSpecialStartSequence(c);
break;
}
case State.InSpecialTag: {
this.stateInSpecialTag(c);
break;
}
case State.CDATASequence: {
this.stateCDATASequence(c);
break;
}
case State.InAttributeValueDq: {
this.stateInAttributeValueDoubleQuotes(c);
break;
}
case State.InAttributeName: {
this.stateInAttributeName(c);
break;
}
case State.InCommentLike: {
this.stateInCommentLike(c);
break;
}
case State.InSpecialComment: {
this.stateInSpecialComment(c);
break;
}
case State.BeforeAttributeName: {
this.stateBeforeAttributeName(c);
break;
}
case State.InTagName: {
this.stateInTagName(c);
break;
}
case State.InClosingTagName: {
this.stateInClosingTagName(c);
break;
}
case State.BeforeTagName: {
this.stateBeforeTagName(c);
break;
}
case State.AfterAttributeName: {
this.stateAfterAttributeName(c);
break;
}
case State.InAttributeValueSq: {
this.stateInAttributeValueSingleQuotes(c);
break;
}
case State.BeforeAttributeValue: {
this.stateBeforeAttributeValue(c);
break;
}
case State.BeforeClosingTagName: {
this.stateBeforeClosingTagName(c);
break;
}
case State.AfterClosingTagName: {
this.stateAfterClosingTagName(c);
break;
}
case State.BeforeSpecialS: {
this.stateBeforeSpecialS(c);
break;
}
case State.BeforeSpecialT: {
this.stateBeforeSpecialT(c);
break;
}
case State.InAttributeValueNq: {
this.stateInAttributeValueNoQuotes(c);
break;
}
case State.InSelfClosingTag: {
this.stateInSelfClosingTag(c);
break;
}
case State.InDeclaration: {
this.stateInDeclaration(c);
break;
}
case State.BeforeDeclaration: {
this.stateBeforeDeclaration(c);
break;
}
case State.BeforeComment: {
this.stateBeforeComment(c);
break;
}
case State.InProcessingInstruction: {
this.stateInProcessingInstruction(c);
break;
}
case State.InEntity: {
this.stateInEntity();
break;
}
}
this.index++;
}
this.cleanup();
}
finish() {
if (this.state === State.InEntity) {
this.entityDecoder.end();
this.state = this.baseState;
}
this.handleTrailingData();
this.cbs.onend();
}
/** Handle any trailing data. */
handleTrailingData() {
const endIndex = this.buffer.length + this.offset;
// If there is no remaining data, we are done.
if (this.sectionStart >= endIndex) {
return;
}
if (this.state === State.InCommentLike) {
if (this.currentSequence === Sequences.CdataEnd) {
this.cbs.oncdata(this.sectionStart, endIndex, 0);
}
else {
this.cbs.oncomment(this.sectionStart, endIndex, 0);
}
}
else if (this.state === State.InTagName ||
this.state === State.BeforeAttributeName ||
this.state === State.BeforeAttributeValue ||
this.state === State.AfterAttributeName ||
this.state === State.InAttributeName ||
this.state === State.InAttributeValueSq ||
this.state === State.InAttributeValueDq ||
this.state === State.InAttributeValueNq ||
this.state === State.InClosingTagName) {
/*
* If we are currently in an opening or closing tag, us not calling the
* respective callback signals that the tag should be ignored.
*/
}
else {
this.cbs.ontext(this.sectionStart, endIndex);
}
}
emitCodePoint(cp, consumed) {
if (this.baseState !== State.Text &&
this.baseState !== State.InSpecialTag) {
if (this.sectionStart < this.entityStart) {
this.cbs.onattribdata(this.sectionStart, this.entityStart);
}
this.sectionStart = this.entityStart + consumed;
this.index = this.sectionStart - 1;
this.cbs.onattribentity(cp);
}
else {
if (this.sectionStart < this.entityStart) {
this.cbs.ontext(this.sectionStart, this.entityStart);
}
this.sectionStart = this.entityStart + consumed;
this.index = this.sectionStart - 1;
this.cbs.ontextentity(cp, this.sectionStart);
}
}
}
//# sourceMappingURL=Tokenizer.js.map
@@ -0,0 +1,15 @@
var test = require('tape');
var inspect = require('../');
var xs = ['a', 'b'];
xs[5] = 'f';
xs[7] = 'j';
xs[8] = 'k';
test('holes', function (t) {
t.plan(1);
t.equal(
inspect(xs),
"[ 'a', 'b', , , , 'f', , 'j', 'k' ]"
);
});
@@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.buildMaybeClassElementMetadataFromMaybeClassElementMetadata = buildMaybeClassElementMetadataFromMaybeClassElementMetadata;
const InversifyCoreError_1 = require("../../error/models/InversifyCoreError");
const InversifyCoreErrorKind_1 = require("../../error/models/InversifyCoreErrorKind");
const ClassElementMetadataKind_1 = require("../models/ClassElementMetadataKind");
const buildDefaultMaybeClassElementMetadata_1 = require("./buildDefaultMaybeClassElementMetadata");
function buildMaybeClassElementMetadataFromMaybeClassElementMetadata(updateMetadata) {
return (metadata) => {
const definedMetadata = metadata ?? (0, buildDefaultMaybeClassElementMetadata_1.buildDefaultMaybeClassElementMetadata)();
switch (definedMetadata.kind) {
case ClassElementMetadataKind_1.ClassElementMetadataKind.unmanaged:
throw new InversifyCoreError_1.InversifyCoreError(InversifyCoreErrorKind_1.InversifyCoreErrorKind.injectionDecoratorConflict, 'Unexpected injection found. Found @unmanaged injection with additional @named, @optional, @tagged or @targetName injections');
default:
return updateMetadata(definedMetadata);
}
};
}
//# sourceMappingURL=buildMaybeClassElementMetadataFromMaybeClassElementMetadata.js.map
@@ -0,0 +1 @@
{"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-stately/checkbox/src/index.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport {useCheckboxGroupState} from './useCheckboxGroupState';\n\nexport type {CheckboxGroupProps} from '@react-types/checkbox';\nexport type {CheckboxGroupState} from './useCheckboxGroupState';\n"],"names":[],"version":3,"file":"main.js.map"}
@@ -0,0 +1,131 @@
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.attachListeners = void 0;
var socket_io_1 = require("./socket-io");
var heartbeat_1 = require("./heartbeat");
var constants_1 = require("./constants");
var util_1 = require("./util");
var bindMessageHandler = function (webSocketInstance, optionsRef, setLastMessage, lastMessageTime) {
webSocketInstance.onmessage = function (message) {
var _a;
optionsRef.current.onMessage && optionsRef.current.onMessage(message);
if (typeof (lastMessageTime === null || lastMessageTime === void 0 ? void 0 : lastMessageTime.current) === 'number') {
lastMessageTime.current = Date.now();
}
if (typeof optionsRef.current.filter === 'function' && optionsRef.current.filter(message) !== true) {
return;
}
if (optionsRef.current.heartbeat &&
typeof optionsRef.current.heartbeat !== "boolean" &&
((_a = optionsRef.current.heartbeat) === null || _a === void 0 ? void 0 : _a.returnMessage) === message.data) {
return;
}
setLastMessage(message);
};
};
var bindOpenHandler = function (webSocketInstance, optionsRef, setReadyState, reconnectCount, lastMessageTime) {
webSocketInstance.onopen = function (event) {
optionsRef.current.onOpen && optionsRef.current.onOpen(event);
reconnectCount.current = 0;
setReadyState(constants_1.ReadyState.OPEN);
//start heart beat here
if (optionsRef.current.heartbeat && webSocketInstance instanceof WebSocket) {
var heartbeatOptions = typeof optionsRef.current.heartbeat === "boolean"
? undefined
: optionsRef.current.heartbeat;
lastMessageTime.current = Date.now();
(0, heartbeat_1.heartbeat)(webSocketInstance, lastMessageTime, heartbeatOptions);
}
};
};
var bindCloseHandler = function (webSocketInstance, optionsRef, setReadyState, reconnect, reconnectCount) {
if (constants_1.isEventSourceSupported && webSocketInstance instanceof EventSource) {
return function () { };
}
(0, util_1.assertIsWebSocket)(webSocketInstance, optionsRef.current.skipAssert);
var reconnectTimeout;
webSocketInstance.onclose = function (event) {
var _a;
optionsRef.current.onClose && optionsRef.current.onClose(event);
setReadyState(constants_1.ReadyState.CLOSED);
if (optionsRef.current.shouldReconnect && optionsRef.current.shouldReconnect(event)) {
var reconnectAttempts = (_a = optionsRef.current.reconnectAttempts) !== null && _a !== void 0 ? _a : constants_1.DEFAULT_RECONNECT_LIMIT;
if (reconnectCount.current < reconnectAttempts) {
var nextReconnectInterval = typeof optionsRef.current.reconnectInterval === 'function' ?
optionsRef.current.reconnectInterval(reconnectCount.current) :
optionsRef.current.reconnectInterval;
reconnectTimeout = window.setTimeout(function () {
reconnectCount.current++;
reconnect();
}, nextReconnectInterval !== null && nextReconnectInterval !== void 0 ? nextReconnectInterval : constants_1.DEFAULT_RECONNECT_INTERVAL_MS);
}
else {
optionsRef.current.onReconnectStop && optionsRef.current.onReconnectStop(reconnectAttempts);
console.warn("Max reconnect attempts of ".concat(reconnectAttempts, " exceeded"));
}
}
};
return function () { return reconnectTimeout && window.clearTimeout(reconnectTimeout); };
};
var bindErrorHandler = function (webSocketInstance, optionsRef, setReadyState, reconnect, reconnectCount) {
var reconnectTimeout;
webSocketInstance.onerror = function (error) {
var _a;
optionsRef.current.onError && optionsRef.current.onError(error);
if (constants_1.isEventSourceSupported && webSocketInstance instanceof EventSource) {
optionsRef.current.onClose && optionsRef.current.onClose(__assign(__assign({}, error), { code: 1006, reason: "An error occurred with the EventSource: ".concat(error), wasClean: false }));
setReadyState(constants_1.ReadyState.CLOSED);
webSocketInstance.close();
}
if (optionsRef.current.retryOnError) {
if (reconnectCount.current < ((_a = optionsRef.current.reconnectAttempts) !== null && _a !== void 0 ? _a : constants_1.DEFAULT_RECONNECT_LIMIT)) {
var nextReconnectInterval = typeof optionsRef.current.reconnectInterval === 'function' ?
optionsRef.current.reconnectInterval(reconnectCount.current) :
optionsRef.current.reconnectInterval;
reconnectTimeout = window.setTimeout(function () {
reconnectCount.current++;
reconnect();
}, nextReconnectInterval !== null && nextReconnectInterval !== void 0 ? nextReconnectInterval : constants_1.DEFAULT_RECONNECT_INTERVAL_MS);
}
else {
optionsRef.current.onReconnectStop && optionsRef.current.onReconnectStop(optionsRef.current.reconnectAttempts);
console.warn("Max reconnect attempts of ".concat(optionsRef.current.reconnectAttempts, " exceeded"));
}
}
};
return function () { return reconnectTimeout && window.clearTimeout(reconnectTimeout); };
};
var attachListeners = function (webSocketInstance, setters, optionsRef, reconnect, reconnectCount, lastMessageTime, sendMessage) {
var setLastMessage = setters.setLastMessage, setReadyState = setters.setReadyState;
var interval;
var cancelReconnectOnClose;
var cancelReconnectOnError;
if (optionsRef.current.fromSocketIO) {
interval = (0, socket_io_1.setUpSocketIOPing)(sendMessage);
}
bindMessageHandler(webSocketInstance, optionsRef, setLastMessage, lastMessageTime);
bindOpenHandler(webSocketInstance, optionsRef, setReadyState, reconnectCount, lastMessageTime);
cancelReconnectOnClose = bindCloseHandler(webSocketInstance, optionsRef, setReadyState, reconnect, reconnectCount);
cancelReconnectOnError = bindErrorHandler(webSocketInstance, optionsRef, setReadyState, reconnect, reconnectCount);
return function () {
setReadyState(constants_1.ReadyState.CLOSING);
cancelReconnectOnClose();
cancelReconnectOnError();
webSocketInstance.close();
if (interval)
clearInterval(interval);
};
};
exports.attachListeners = attachListeners;
//# sourceMappingURL=attach-listener.js.map
@@ -0,0 +1,63 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = reducePath;
/**
* @file 缩减path大小,去除冗余节点
* @author mengke01(kekee000@gmail.com)
*/
/**
* 判断点是否多余的点
*
* @param {Object} prev 上一个
* @param {Object} p 当前
* @param {Object} next 下一个
* @return {boolean}
*/
function redundant(prev, p, next) {
// 是否重合的点, 只有两个点同在曲线上或者同不在曲线上移出
if ((p.onCurve && next.onCurve || !p.onCurve && !next.onCurve) && Math.pow(p.x - next.x, 2) + Math.pow(p.y - next.y, 2) <= 1) {
return true;
}
// 三点同线 检查直线点
if (p.onCurve && prev.onCurve && next.onCurve && Math.abs((next.y - p.y) * (prev.x - p.x) - (prev.y - p.y) * (next.x - p.x)) <= 0.001) {
return true;
}
// 三点同线 检查控制点
if (!p.onCurve && prev.onCurve && next.onCurve && Math.abs((next.y - p.y) * (prev.x - p.x) - (prev.y - p.y) * (next.x - p.x)) <= 0.001) {
return true;
}
return false;
}
/**
* 缩减glyf,去除冗余节点
*
* @param {Array} contour 路径对象
* @return {Array} 路径对象
*/
function reducePath(contour) {
if (!contour.length) {
return contour;
}
var prev;
var next;
var p;
for (var i = contour.length - 1, last = i; i >= 0; i--) {
// 这里注意逆序
p = contour[i];
next = i === last ? contour[0] : contour[i + 1];
prev = i === 0 ? contour[last] : contour[i - 1];
if (redundant(prev, p, next)) {
contour.splice(i, 1);
last--;
continue;
}
}
return contour;
}
@@ -0,0 +1,37 @@
'use strict';
var metaSchema = require('./refs/json-schema-draft-07.json');
module.exports = {
$id: 'https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js',
definitions: {
simpleTypes: metaSchema.definitions.simpleTypes
},
type: 'object',
dependencies: {
schema: ['validate'],
$data: ['validate'],
statements: ['inline'],
valid: {not: {required: ['macro']}}
},
properties: {
type: metaSchema.properties.type,
schema: {type: 'boolean'},
statements: {type: 'boolean'},
dependencies: {
type: 'array',
items: {type: 'string'}
},
metaSchema: {type: 'object'},
modifying: {type: 'boolean'},
valid: {type: 'boolean'},
$data: {type: 'boolean'},
async: {type: 'boolean'},
errors: {
anyOf: [
{type: 'boolean'},
{const: 'full'}
]
}
}
};
@@ -0,0 +1 @@
{"name":"doctrine","version":"2.1.0","requiresBuild":false,"files":{"package.json":{"checkedAt":1794532097950,"integrity":"sha512-N2jFhhY8AMHSa/ez/T7OBSDFLAb3wEp28WhuDyPiu7lTNkreLALXTYTmh4Qz2VcqW+IL5GJxz63AtaIIj/f3Fw==","mode":420,"size":1356},"CHANGELOG.md":{"checkedAt":1794532097950,"integrity":"sha512-ey9AzotYFNkAmRfNE9SBo97VupHTsU5gBLbEPiTlBF3siGWzDUGBzbB74I+1JJbM/sogejyvtCcLDbYAVqTimA==","mode":420,"size":4046},"LICENSE":{"checkedAt":1794532097950,"integrity":"sha512-AyfVce20fOxxUK9V3N5T4Q77kw00OY7RPOjdkg81q9a/0umDIj1iLxPzDgMTFuD3HPaR51z8tcrZE533yJ1HSA==","mode":420,"size":9585},"LICENSE.closure-compiler":{"checkedAt":1794532097950,"integrity":"sha512-mPa3m3ePewoVQVvXUMOooJfWUFEctOyBFRiOEVxHBT/nAPV4iVwJcFHJvD37YZfCsToV3iAyc+GjIYiE+G6Q6A==","mode":420,"size":11358},"LICENSE.esprima":{"checkedAt":1794532097950,"integrity":"sha512-YKl79smr20vdIKCy+fyP+zscyQHwyqDMNEZOwVLEOjQxIxgts1z0klBrcDsCIR2JPrcB00nhm8bCz47uCx24SA==","mode":420,"size":1231},"README.md":{"checkedAt":1794532097951,"integrity":"sha512-ls/5o+znbvyDQRP8aY/fDG3IGeU8jWpjXLnhuHW6HIZHi0Z0GM0+g4IQiAScMybvUH52DOOYVQ2AcaHC06Vv2Q==","mode":420,"size":6615},"lib/doctrine.js":{"checkedAt":1794532097951,"integrity":"sha512-WbRk8rKEfS+JiiQIPpkvjsJA+iymjPuwdkB9fnraaF7bWep5f6QssIFfBDXl+rf/KnO9BkUPmSDKt5yUInRAyw==","mode":420,"size":32445},"lib/typed.js":{"checkedAt":1794532097951,"integrity":"sha512-trdkLfeV7QTxMfG5hHbgRTBNozoAihd3A19HrSo/BLA/FvT4fyOIQ8XHeRytRZ8IAQ8lRnVJeBUwlf/aICCVlw==","mode":420,"size":38505},"lib/utility.js":{"checkedAt":1794532097951,"integrity":"sha512-2cnlvaQuiJuNqR7dANAheOczDCpcV/2J4Z4we5RVL2YcgQvo9iTTS4YFQ1ab/Ypg8RiO1FBrtl/0gJnGmn4a/A==","mode":420,"size":816}}}
@@ -0,0 +1 @@
{"version":3,"names":["_index","require","getBindingIdentifiers","node","duplicates","outerOnly","newBindingsOnly","search","concat","ids","Object","create","length","id","shift","isAssignmentExpression","isUnaryExpression","isUpdateExpression","isIdentifier","_ids","name","push","isExportDeclaration","isExportAllDeclaration","isDeclaration","declaration","isFunctionDeclaration","isFunctionExpression","keys","type","i","key","nodes","Array","isArray","DeclareClass","DeclareFunction","DeclareModule","DeclareVariable","DeclareInterface","DeclareTypeAlias","DeclareOpaqueType","InterfaceDeclaration","TypeAlias","OpaqueType","CatchClause","LabeledStatement","UnaryExpression","AssignmentExpression","ImportSpecifier","ImportNamespaceSpecifier","ImportDefaultSpecifier","ImportDeclaration","TSImportEqualsDeclaration","ExportSpecifier","ExportNamespaceSpecifier","ExportDefaultSpecifier","FunctionDeclaration","FunctionExpression","ArrowFunctionExpression","ObjectMethod","ClassMethod","ClassPrivateMethod","ForInStatement","ForOfStatement","ClassDeclaration","ClassExpression","RestElement","UpdateExpression","ObjectProperty","AssignmentPattern","ArrayPattern","ObjectPattern","VariableDeclaration","VariableDeclarator"],"sources":["../../src/retrievers/getBindingIdentifiers.ts"],"sourcesContent":["import {\n isExportDeclaration,\n isIdentifier,\n isClassExpression,\n isDeclaration,\n isFunctionDeclaration,\n isFunctionExpression,\n isExportAllDeclaration,\n isAssignmentExpression,\n isUnaryExpression,\n isUpdateExpression,\n} from \"../validators/generated/index.ts\";\nimport type * as t from \"../index.ts\";\n\nexport { getBindingIdentifiers as default };\n\nfunction getBindingIdentifiers(\n node: t.Node,\n duplicates: true,\n outerOnly?: boolean,\n newBindingsOnly?: boolean,\n): Record<string, Array<t.Identifier>>;\n\nfunction getBindingIdentifiers(\n node: t.Node,\n duplicates?: false,\n outerOnly?: boolean,\n newBindingsOnly?: boolean,\n): Record<string, t.Identifier>;\n\nfunction getBindingIdentifiers(\n node: t.Node,\n duplicates?: boolean,\n outerOnly?: boolean,\n newBindingsOnly?: boolean,\n): Record<string, t.Identifier> | Record<string, Array<t.Identifier>>;\n\n/**\n * Return a list of binding identifiers associated with the input `node`.\n */\nfunction getBindingIdentifiers(\n node: t.Node,\n duplicates?: boolean,\n outerOnly?: boolean,\n newBindingsOnly?: boolean,\n): Record<string, t.Identifier> | Record<string, Array<t.Identifier>> {\n const search: t.Node[] = [].concat(node);\n const ids = Object.create(null);\n\n while (search.length) {\n const id = search.shift();\n if (!id) continue;\n\n if (\n newBindingsOnly &&\n // These nodes do not introduce _new_ bindings, but they are included\n // in getBindingIdentifiers.keys for backwards compatibility.\n // TODO(@nicolo-ribaudo): Check if we can remove them from .keys in a\n // backward-compatible way, and if not what we need to do to remove them\n // in Babel 8.\n (isAssignmentExpression(id) ||\n isUnaryExpression(id) ||\n isUpdateExpression(id))\n ) {\n continue;\n }\n\n if (isIdentifier(id)) {\n if (duplicates) {\n const _ids = (ids[id.name] = ids[id.name] || []);\n _ids.push(id);\n } else {\n ids[id.name] = id;\n }\n continue;\n }\n\n if (isExportDeclaration(id) && !isExportAllDeclaration(id)) {\n if (isDeclaration(id.declaration)) {\n search.push(id.declaration);\n }\n continue;\n }\n\n if (outerOnly) {\n if (isFunctionDeclaration(id)) {\n search.push(id.id);\n continue;\n }\n\n if (\n isFunctionExpression(id) ||\n (process.env.BABEL_8_BREAKING && isClassExpression(id))\n ) {\n continue;\n }\n }\n\n const keys = getBindingIdentifiers.keys[id.type];\n\n if (keys) {\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n const nodes =\n // @ts-expect-error key must present in id\n id[key] as t.Node[] | t.Node | undefined | null;\n if (nodes) {\n if (Array.isArray(nodes)) {\n search.push(...nodes);\n } else {\n search.push(nodes);\n }\n }\n }\n }\n }\n return ids;\n}\n\n/**\n * Mapping of types to their identifier keys.\n */\ntype KeysMap = {\n [N in t.Node as N[\"type\"]]?: (keyof N)[];\n};\n\nconst keys: KeysMap = {\n DeclareClass: [\"id\"],\n DeclareFunction: [\"id\"],\n DeclareModule: [\"id\"],\n DeclareVariable: [\"id\"],\n DeclareInterface: [\"id\"],\n DeclareTypeAlias: [\"id\"],\n DeclareOpaqueType: [\"id\"],\n InterfaceDeclaration: [\"id\"],\n TypeAlias: [\"id\"],\n OpaqueType: [\"id\"],\n\n CatchClause: [\"param\"],\n LabeledStatement: [\"label\"],\n UnaryExpression: [\"argument\"],\n AssignmentExpression: [\"left\"],\n\n ImportSpecifier: [\"local\"],\n ImportNamespaceSpecLine truncated
@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,oBAAY,WAAW;IACnB,8CAA8C;IAC9C,IAAI,SAAS;IACb,oBAAoB;IACpB,IAAI,SAAS;IACb,yBAAyB;IACzB,SAAS,cAAc;IACvB,4BAA4B;IAC5B,OAAO,YAAY;IACnB,6BAA6B;IAC7B,MAAM,WAAW;IACjB,4BAA4B;IAC5B,KAAK,UAAU;IACf,uBAAuB;IACvB,GAAG,QAAQ;IACX,iCAAiC;IACjC,KAAK,UAAU;IACf,8BAA8B;IAC9B,OAAO,YAAY;CACtB;AAED;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,GAAG,OAAO,CAM1D;AAGD,8CAA8C;AAC9C,eAAO,MAAM,IAAI,mBAAmB,CAAC;AACrC,oBAAoB;AACpB,eAAO,MAAM,IAAI,mBAAmB,CAAC;AACrC,yBAAyB;AACzB,eAAO,MAAM,SAAS,wBAAwB,CAAC;AAC/C,4BAA4B;AAC5B,eAAO,MAAM,OAAO,sBAAsB,CAAC;AAC3C,6BAA6B;AAC7B,eAAO,MAAM,MAAM,qBAAqB,CAAC;AACzC,4BAA4B;AAC5B,eAAO,MAAM,KAAK,oBAAoB,CAAC;AACvC,uBAAuB;AACvB,eAAO,MAAM,GAAG,kBAAkB,CAAC;AACnC,iCAAiC;AACjC,eAAO,MAAM,KAAK,oBAAoB,CAAC;AACvC,8BAA8B;AAC9B,eAAO,MAAM,OAAO,sBAAsB,CAAC"}
@@ -0,0 +1,48 @@
'use strict';
const eslint = require('eslint');
const semver = require('semver');
const convertConfig = require('./shared/eslint-compat-utils.503aeaae.cjs');
const convertOption = require('./shared/eslint-compat-utils.808b5669.cjs');
require('module');
function _interopNamespaceCompat(e) {
if (e && typeof e === 'object' && 'default' in e) return e;
const n = Object.create(null);
if (e) {
for (const k in e) {
n[k] = e[k];
}
}
n.default = e;
return n;
}
const eslint__namespace = /*#__PURE__*/_interopNamespaceCompat(eslint);
const semver__namespace = /*#__PURE__*/_interopNamespaceCompat(semver);
let cacheLinter;
function getLinter() {
return cacheLinter != null ? cacheLinter : cacheLinter = getLinterInternal();
function getLinterInternal() {
if (semver__namespace.gte(eslint__namespace.Linter.version, "9.0.0-0")) {
return eslint__namespace.Linter;
}
return getLinterClassFromLegacyLinter();
}
}
function getLinterClassFromLegacyLinter() {
return class LinterFromLegacyLinter extends eslint__namespace.Linter {
static get version() {
return eslint__namespace.Linter.version;
}
verify(code, config, option) {
const { processor, ...otherConfig } = config || {};
const newConfig = convertConfig.convertConfigToRc(otherConfig, this);
const newOption = convertOption.convertOptionToLegacy(processor, option, config || {});
return super.verify(code, newConfig, newOption);
}
};
}
exports.getLinter = getLinter;
@@ -0,0 +1,25 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AttributeCertificate = void 0;
const tslib_1 = require("tslib");
const asn1_schema_1 = require("@peculiar/asn1-schema");
const asn1_x509_1 = require("@peculiar/asn1-x509");
const attribute_certificate_info_1 = require("./attribute_certificate_info");
class AttributeCertificate {
constructor(params = {}) {
this.acinfo = new attribute_certificate_info_1.AttributeCertificateInfo();
this.signatureAlgorithm = new asn1_x509_1.AlgorithmIdentifier();
this.signatureValue = new ArrayBuffer(0);
Object.assign(this, params);
}
}
exports.AttributeCertificate = AttributeCertificate;
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: attribute_certificate_info_1.AttributeCertificateInfo })
], AttributeCertificate.prototype, "acinfo", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_x509_1.AlgorithmIdentifier })
], AttributeCertificate.prototype, "signatureAlgorithm", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.BitString })
], AttributeCertificate.prototype, "signatureValue", void 0);
@@ -0,0 +1,82 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const DescriptionFileUtils = require("./DescriptionFileUtils");
/** @typedef {import("./Resolver")} Resolver */
/** @typedef {import("./Resolver").JsonObject} JsonObject */
/** @typedef {import("./Resolver").ResolveRequest} ResolveRequest */
/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */
const slashCode = "/".charCodeAt(0);
module.exports = class SelfReferencePlugin {
/**
* @param {string | ResolveStepHook} source source
* @param {string | string[]} fieldNamePath name path
* @param {string | ResolveStepHook} target target
*/
constructor(source, fieldNamePath, target) {
this.source = source;
this.target = target;
this.fieldName = fieldNamePath;
}
/**
* @param {Resolver} resolver the resolver
* @returns {void}
*/
apply(resolver) {
const target = resolver.ensureHook(this.target);
resolver
.getHook(this.source)
.tapAsync("SelfReferencePlugin", (request, resolveContext, callback) => {
if (!request.descriptionFilePath) return callback();
const req = request.request;
if (!req) return callback();
// Feature is only enabled when an exports field is present
const exportsField = DescriptionFileUtils.getField(
/** @type {JsonObject} */ (request.descriptionFileData),
this.fieldName,
);
if (!exportsField) return callback();
const name = DescriptionFileUtils.getField(
/** @type {JsonObject} */ (request.descriptionFileData),
"name",
);
if (typeof name !== "string") return callback();
if (
req.startsWith(name) &&
(req.length === name.length ||
req.charCodeAt(name.length) === slashCode)
) {
const remainingRequest = `.${req.slice(name.length)}`;
/** @type {ResolveRequest} */
const obj = {
...request,
request: remainingRequest,
path: /** @type {string} */ (request.descriptionFileRoot),
relativePath: ".",
};
resolver.doResolve(
target,
obj,
"self reference",
resolveContext,
callback,
);
} else {
return callback();
}
});
}
};
@@ -0,0 +1 @@
export type { DebugLevel, EcmaVersion, ParserOptions, SourceType, } from '@typescript-eslint/types';
@@ -0,0 +1,68 @@
import { Location } from './types';
export interface ParserError {
kind: ErrorKind;
message: string;
location: Location;
}
export declare enum ErrorKind {
/** Argument is unclosed (e.g. `{0`) */
EXPECT_ARGUMENT_CLOSING_BRACE = 1,
/** Argument is empty (e.g. `{}`). */
EMPTY_ARGUMENT = 2,
/** Argument is malformed (e.g. `{foo!}``) */
MALFORMED_ARGUMENT = 3,
/** Expect an argument type (e.g. `{foo,}`) */
EXPECT_ARGUMENT_TYPE = 4,
/** Unsupported argument type (e.g. `{foo,foo}`) */
INVALID_ARGUMENT_TYPE = 5,
/** Expect an argument style (e.g. `{foo, number, }`) */
EXPECT_ARGUMENT_STYLE = 6,
/** The number skeleton is invalid. */
INVALID_NUMBER_SKELETON = 7,
/** The date time skeleton is invalid. */
INVALID_DATE_TIME_SKELETON = 8,
/** Exepct a number skeleton following the `::` (e.g. `{foo, number, ::}`) */
EXPECT_NUMBER_SKELETON = 9,
/** Exepct a date time skeleton following the `::` (e.g. `{foo, date, ::}`) */
EXPECT_DATE_TIME_SKELETON = 10,
/** Unmatched apostrophes in the argument style (e.g. `{foo, number, 'test`) */
UNCLOSED_QUOTE_IN_ARGUMENT_STYLE = 11,
/** Missing select argument options (e.g. `{foo, select}`) */
EXPECT_SELECT_ARGUMENT_OPTIONS = 12,
/** Expecting an offset value in `plural` or `selectordinal` argument (e.g `{foo, plural, offset}`) */
EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE = 13,
/** Offset value in `plural` or `selectordinal` is invalid (e.g. `{foo, plural, offset: x}`) */
INVALID_PLURAL_ARGUMENT_OFFSET_VALUE = 14,
/** Expecting a selector in `select` argument (e.g `{foo, select}`) */
EXPECT_SELECT_ARGUMENT_SELECTOR = 15,
/** Expecting a selector in `plural` or `selectordinal` argument (e.g `{foo, plural}`) */
EXPECT_PLURAL_ARGUMENT_SELECTOR = 16,
/** Expecting a message fragment after the `select` selector (e.g. `{foo, select, apple}`) */
EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT = 17,
/**
* Expecting a message fragment after the `plural` or `selectordinal` selector
* (e.g. `{foo, plural, one}`)
*/
EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT = 18,
/** Selector in `plural` or `selectordinal` is malformed (e.g. `{foo, plural, =x {#}}`) */
INVALID_PLURAL_ARGUMENT_SELECTOR = 19,
/**
* Duplicate selectors in `plural` or `selectordinal` argument.
* (e.g. {foo, plural, one {#} one {#}})
*/
DUPLICATE_PLURAL_ARGUMENT_SELECTOR = 20,
/** Duplicate selectors in `select` argument.
* (e.g. {foo, select, apple {apple} apple {apple}})
*/
DUPLICATE_SELECT_ARGUMENT_SELECTOR = 21,
/** Plural or select argument option must have `other` clause. */
MISSING_OTHER_CLAUSE = 22,
/** The tag is malformed. (e.g. `<bold!>foo</bold!>) */
INVALID_TAG = 23,
/** The tag name is invalid. (e.g. `<123>foo</123>`) */
INVALID_TAG_NAME = 25,
/** The closing tag does not match the opening tag. (e.g. `<bold>foo</italic>`) */
UNMATCHED_CLOSING_TAG = 26,
/** The opening tag has unmatched closing tag. (e.g. `<bold>foo`) */
UNCLOSED_TAG = 27
}
@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=findInPrototypeChain.spec.d.ts.map
@@ -0,0 +1,49 @@
{
"name": "@react-aria/overlays",
"version": "3.30.0",
"description": "Spectrum UI components in React",
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
"exports": {
"source": "./src/index.ts",
"types": [
"./dist/types.d.ts",
"./src/index.ts"
],
"import": "./dist/import.mjs",
"require": "./dist/main.js"
},
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
"dist",
"src"
],
"sideEffects": false,
"repository": {
"type": "git",
"url": "https://github.com/adobe/react-spectrum"
},
"dependencies": {
"@react-aria/focus": "^3.21.2",
"@react-aria/i18n": "^3.12.13",
"@react-aria/interactions": "^3.25.6",
"@react-aria/ssr": "^3.9.10",
"@react-aria/utils": "^3.31.0",
"@react-aria/visually-hidden": "^3.8.28",
"@react-stately/overlays": "^3.6.20",
"@react-types/button": "^3.14.1",
"@react-types/overlays": "^3.9.2",
"@react-types/shared": "^3.32.1",
"@swc/helpers": "^0.5.0"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1",
"react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
},
"publishConfig": {
"access": "public"
},
"gitHead": "0bda51183baa23306342af32a82012ea0fe0f2dc"
}
@@ -0,0 +1,32 @@
# import/no-self-import
<!-- end auto-generated rule header -->
Forbid a module from importing itself. This can sometimes happen during refactoring.
## Rule Details
### Fail
```js
// foo.js
import foo from './foo';
const foo = require('./foo');
```
```js
// index.js
import index from '.';
const index = require('.');
```
### Pass
```js
// foo.js
import bar from './bar';
const bar = require('./bar');
```
@@ -0,0 +1 @@
{"mappings":";;;AAAA;;;;;;;;;;CAUC,GAED,gEAAgE;AAChE,gGAAgG;;;AAMhG,MAAM,2CAAqB;AAOpB,MAAM,kDAAyB,CAAA,GAAA,yCAAgB;IAGpD,cAAc,EAAU,EAAgB;QACtC,IAAI,gBAAgB,KAAK,CAAC,cAAc;QACxC,IAAI,OAAO,CAAA,GAAA,yCAAc,EAAE,cAAc,GAAG,EAAE,cAAc,IAAI;QAChE,OAAO,IAAI,CAAA,GAAA,yCAAW,EACpB,IAAI,EACJ,OAAO,0CACP,cAAc,KAAK,EACnB,cAAc,GAAG;IAErB;IAEA,YAAY,IAAqB,EAAE;QACjC,OAAO,KAAK,CAAC,YAAY,kCAAY;IACvC;IAEA,UAAU;QACR,OAAO;YAAC;SAAK;IACf;IAEA,eAAe,IAAqB,EAAU;QAC5C,OAAO,KAAK,CAAC,eAAe,kCAAY;IAC1C;IAEA,cAAc,CAAC;;6BAzBf,aAAa;;AA0Bf;AAEA,SAAS,kCAAY,IAAqB;IACxC,IAAI,CAAC,KAAK,KAAK,GAAG,CAAA,GAAA,yCAAe,EAAE,KAAK,IAAI,GAAG;IAC/C,OAAO,IAAI,CAAA,GAAA,yCAAW,EACpB,KACA,MACA,KAAK,KAAK,EACV,KAAK,GAAG;AAEZ","sources":["packages/@internationalized/date/src/calendars/BuddhistCalendar.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Portions of the code in this file are based on code from ICU.\n// Original licensing can be found in the NOTICE file in the root directory of this source tree.\n\nimport {AnyCalendarDate} from '../types';\nimport {CalendarDate} from '../CalendarDate';\nimport {fromExtendedYear, getExtendedYear, GregorianCalendar} from './GregorianCalendar';\n\nconst BUDDHIST_ERA_START = -543;\n\n/**\n * The Buddhist calendar is the same as the Gregorian calendar, but counts years\n * starting from the birth of Buddha in 543 BC (Gregorian). It supports only one\n * era, identified as 'BE'.\n */\nexport class BuddhistCalendar extends GregorianCalendar {\n identifier = 'buddhist';\n\n fromJulianDay(jd: number): CalendarDate {\n let gregorianDate = super.fromJulianDay(jd);\n let year = getExtendedYear(gregorianDate.era, gregorianDate.year);\n return new CalendarDate(\n this,\n year - BUDDHIST_ERA_START,\n gregorianDate.month,\n gregorianDate.day\n );\n }\n\n toJulianDay(date: AnyCalendarDate) {\n return super.toJulianDay(toGregorian(date));\n }\n\n getEras() {\n return ['BE'];\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n return super.getDaysInMonth(toGregorian(date));\n }\n\n balanceDate() {}\n}\n\nfunction toGregorian(date: AnyCalendarDate) {\n let [era, year] = fromExtendedYear(date.year + BUDDHIST_ERA_START);\n return new CalendarDate(\n era,\n year,\n date.month,\n date.day\n );\n}\n"],"names":[],"version":3,"file":"BuddhistCalendar.module.js.map"}
Loaded 100 of 35554 files, more files were not shown because too many files have changed in this diff. Show more