docs: 仓库链接指向本镜像仓库
Build NapCat Artifacts / Windows Loader Test (push) Canceled after 0s
Build NapCat Artifacts / Type Check & Test (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Framework (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Shell (push) Canceled after 0s

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,91 @@
{
"name": "own-keys",
"version": "1.0.1",
"description": "Robustly get an object's own property keys (strings and symbols), including non-enumerables when possible",
"main": "index.js",
"exports": {
".": "./index.js",
"./package.json": "./package.json"
},
"sideEffects": false,
"scripts": {
"prepack": "npmignore --auto --commentLines=autogenerated",
"version": "auto-changelog && git add CHANGELOG.md",
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"",
"prelint": "evalmd README.md",
"lint": "eslint --ext=js,mjs .",
"postlint": "tsc && attw -P",
"prepublish": "not-in-publish || npm run prepublishOnly",
"prepublishOnly": "safe-publish-latest",
"pretest": "npm run lint",
"tests-only": "nyc tape test",
"test": "npm run tests-only",
"posttest": "npx npm@'>= 10.2' audit --production"
},
"keywords": [
"own",
"key",
"keys",
"propertykey",
"string",
"symbol",
"enumerable",
"non-enumerable",
"robust"
],
"author": "Jordan Harband <ljharb@gmail.com>",
"funding": {
"url": "https://github.com/sponsors/ljharb"
},
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/ljharb/own-keys.git"
},
"bugs": {
"url": "https://github.com/ljharb/own-keys/issues"
},
"homepage": "https://github.com/ljharb/own-keys#readme",
"dependencies": {
"get-intrinsic": "^1.2.6",
"object-keys": "^1.1.1",
"safe-push-apply": "^1.0.0"
},
"devDependencies": {
"@arethetypeswrong/cli": "^0.17.2",
"@ljharb/eslint-config": "^21.1.1",
"@ljharb/tsconfig": "^0.2.3",
"@types/get-intrinsic": "^1.2.3",
"@types/isarray": "^2.0.3",
"@types/object-keys": "^1.0.3",
"@types/tape": "^5.8.0",
"auto-changelog": "^2.5.0",
"encoding": "^0.1.13",
"eslint": "=8.8.0",
"evalmd": "^0.0.19",
"has-property-descriptors": "^1.0.2",
"has-symbols": "^1.1.0",
"in-publish": "^2.0.1",
"npmignore": "^0.3.1",
"nyc": "^10.3.2",
"safe-publish-latest": "^2.0.0",
"tape": "^5.9.0",
"typescript": "next"
},
"engines": {
"node": ">= 0.4"
},
"auto-changelog": {
"output": "CHANGELOG.md",
"template": "keepachangelog",
"unreleased": false,
"commitLimit": false,
"backfillLimit": false,
"hideCredit": true
},
"publishConfig": {
"ignore": [
".github/workflows"
]
}
}
@@ -0,0 +1,14 @@
'use strict';
var $isFinite = require('math-intrinsics/isFinite');
var msPerDay = require('../helpers/timeConstants').msPerDay;
// https://262.ecma-international.org/5.1/#sec-15.9.1.13
module.exports = function MakeDate(day, time) {
if (!$isFinite(day) || !$isFinite(time)) {
return NaN;
}
return (day * msPerDay) + time;
};
@@ -0,0 +1,28 @@
# @dnd-kit/sortable
[![Stable release](https://img.shields.io/npm/v/@dnd-kit/sortable.svg)](https://npm.im/@dnd-kit/sortable)
The sortable preset provides the building blocks to build sortable interfaces with @dnd-kit.
## Installation
To get started, install the sortable preset via npm or yarn:
```
npm install @dnd-kit/sortable
```
## Architecture
The sortable preset builds on top of the primitives exposed by `@dnd-kit/core` to help building sortable interfaces.
The sortable preset exposes two main concepts: `SortableContext` and the `useSortable` hook:
- The SortableContext provides information via context that is consumed by the `useSortable` hook.
- The useSortable hook is an abstraction that composes the `useDroppable` and `useDraggable` hooks.
![The useSortable hook is an abstraction that composes the useDroppable and useDraggable hooks](/.github/assets/use-sortable.png)
## Usage
Visit [docs.dndkit.com](https://docs.dndkit.com/presets/sortable) to learn how to use the Sortable preset.
@@ -0,0 +1 @@
{"name":"@lezer/css","version":"1.3.0","requiresBuild":false,"files":{"LICENSE":{"checkedAt":1794532103828,"integrity":"sha512-gvt9sHbEYJ9eND2/ECfBm5PbMpRZRxl8cNXkbvjuuAZAMxSM7d3D/lkcco8BBIs1SvmGpWAsNIFW2sxifiq1yw==","mode":420,"size":1113},"dist/index.cjs":{"checkedAt":1794532103829,"integrity":"sha512-LaOWPru0+eHAHgvG0ksPxZf9mS00W37ezEK6xPioidsGIQ2eP25PdNubJcScGIXy6FiJIFbFjpaBXsthGXXQRA==","mode":420,"size":17656},"dist/index.d.cts":{"checkedAt":1794532103829,"integrity":"sha512-Bqtc8xSR7b6Es0lZw3vm/A9oKXNk8l0fN6lETb3twEYGE7eFwNbpJDtszO6gOm5WrFH1SMDbCmv3KzuStosZnQ==","mode":420,"size":66},"src/css.grammar":{"checkedAt":1794532103829,"integrity":"sha512-LwTUL8SX8qm5SxoH4RngXZ/i6Dip8JpjAv4QRdCIudyKbeYeUwWRPiaBDZ27sZRXk9LmcOv7kpkW00y94Gx7Yg==","mode":420,"size":6021},"src/highlight.js":{"checkedAt":1794532103829,"integrity":"sha512-Mz6dod363asv4F0Ua9gwRKAvUht9/gssFe8SOoL5i9CIOJL8uVbK5Tok7wNjLsJHjlpxgizau6kItGKlGSwHow==","mode":420,"size":1159},"dist/index.js":{"checkedAt":1794532103829,"integrity":"sha512-1VcdGbhu/gELguyYUeFx0X6JYJioQC7DosUev7uKT3gHy1U9pfpnfsAIoL9wrAnN8fz9orrrZ/T7bDuNaEbaMA==","mode":420,"size":17263},"src/parser.js":{"checkedAt":1794532103830,"integrity":"sha512-v7Gpbq/tNXpAMvOmIUXC2dt47gHMVSTnFpOKEhL6HDAjJnp3lSxkVgpTzYAGE5YjDuJls1zq7yuADZllt+TSkw==","mode":420,"size":13359},"src/parser.terms.js":{"checkedAt":1794532103830,"integrity":"sha512-eKZ5si66eGvB7oqYoitF9qQ0HCNPOP7XVtZO1kriyPrxtxOwYeqTEN3bClZqacXmuYNW//PZ6I9VWa2VCd8KfQ==","mode":420,"size":1243},"rollup.config.js":{"checkedAt":1794532103830,"integrity":"sha512-bz8G8Lr0CxJaTFCbqGFT8eF9TGuR40tuPgLUvTiGMChafLz0vyP7CW9Phzy77q0rZh0VAJ6IJRuPhCw2Pt54Xg==","mode":420,"size":306},"test/test-css.js":{"checkedAt":1794532103830,"integrity":"sha512-Z2WZrHzkhTNdCMSFpEO281JaiVTlp7TWm8RTVND4zvyyJCrhe5k3JowklIQbe+qXSpMNwY7QxrGXR0B+kPwNwg==","mode":420,"size":522},"src/tokens.js":{"checkedAt":1794532103830,"integrity":"sha512-P/jsGcLlzx2ODewUVPoJod4rWnjkjMVdege/PT8UuwkCU69puvlqEVcuZIxV7PDOa5OeJ4BJzMD0EaIxTIX/lg==","mode":420,"size":2684},"package.json":{"checkedAt":1794532103831,"integrity":"sha512-72y7K96SMuHVTB/6k7vOY2uei4ItLGPv9vDZvjxWGkwc7aSoSqjRC3ybW6HZc5A/hzqZPo9eulhgavZvV2Pc7g==","mode":420,"size":984},"CHANGELOG.md":{"checkedAt":1794532103831,"integrity":"sha512-42yhqCWmlb9hmXMSqVN85BHW+Xb0lZAeoYw8p5Bkt3LAsb4rzzR3mT4HErfhnpR8cTl4QYNBgNgRS7jD0IRJRg==","mode":420,"size":4903},"README.md":{"checkedAt":1794532103831,"integrity":"sha512-iNoCE4mkX48qJbDe16ruKqvu57FyeILt7qjLtMydAxUgaxBR3RB4TTcfQ/cxbdesqGex2wlTSNPP94YGshZ2kQ==","mode":420,"size":142},"dist/index.d.ts":{"checkedAt":1794532103829,"integrity":"sha512-Bqtc8xSR7b6Es0lZw3vm/A9oKXNk8l0fN6lETb3twEYGE7eFwNbpJDtszO6gOm5WrFH1SMDbCmv3KzuStosZnQ==","mode":420,"size":66},"test/declarations.txt":{"checkedAt":1794532103831,"integrity":"sha512-yI2omydDWpzoMUJi44/7jwBlAxazeg8benBwOc/i+KvNdSSmDBroADsxA6rEGV7F0oNIEGNBORV3nds6KEiMSg==","mode":420,"size":4855},"test/selector.txt":{"checkedAt":1794532103831,"integrity":"sha512-UptD92wn4Gz3k0s2Vi3mt/9pXh/JyE/uOID/4IlVTSxFT8QMmmQwSGg8JlmvFczqXlV05OqoIY+3tPlW3ccuzw==","mode":420,"size":3419},"test/statements.txt":{"checkedAt":1794532103831,"integrity":"sha512-Y1a+nToLGqdL9WZnEw/c12j2tWHpxA17Bf2HmRlYtE65K1JM8N+oaL2H/5Aq9S9YGw+r52gGexVwQIdXrFge/g==","mode":420,"size":7087}}}
@@ -0,0 +1,39 @@
// Javanese [jv]
import dayjs from '../index';
var locale = {
name: 'jv',
weekdays: 'Minggu_Senen_Seloso_Rebu_Kemis_Jemuwah_Septu'.split('_'),
months: 'Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_Nopember_Desember'.split('_'),
weekStart: 1,
weekdaysShort: 'Min_Sen_Sel_Reb_Kem_Jem_Sep'.split('_'),
monthsShort: 'Jan_Feb_Mar_Apr_Mei_Jun_Jul_Ags_Sep_Okt_Nop_Des'.split('_'),
weekdaysMin: 'Mg_Sn_Sl_Rb_Km_Jm_Sp'.split('_'),
ordinal: function ordinal(n) {
return n;
},
formats: {
LT: 'HH.mm',
LTS: 'HH.mm.ss',
L: 'DD/MM/YYYY',
LL: 'D MMMM YYYY',
LLL: 'D MMMM YYYY [pukul] HH.mm',
LLLL: 'dddd, D MMMM YYYY [pukul] HH.mm'
},
relativeTime: {
future: 'wonten ing %s',
past: '%s ingkang kepengker',
s: 'sawetawis detik',
m: 'setunggal menit',
mm: '%d menit',
h: 'setunggal jam',
hh: '%d jam',
d: 'sedinten',
dd: '%d dinten',
M: 'sewulan',
MM: '%d wulan',
y: 'setaun',
yy: '%d taun'
}
};
dayjs.locale(locale, null, true);
export default locale;
@@ -0,0 +1,17 @@
"use strict";
exports.__esModule = true;
exports["default"] = void 0;
var _processor = _interopRequireDefault(require("./processor"));
var selectors = _interopRequireWildcard(require("./selectors"));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var parser = function parser(processor) {
return new _processor["default"](processor);
};
Object.assign(parser, selectors);
delete parser.__esModule;
var _default = parser;
exports["default"] = _default;
module.exports = exports.default;
@@ -0,0 +1 @@
{"mappings":"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","sources":["packages/@react-aria/interactions/src/useFocusable.tsx"],"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\nimport {DOMAttributes, FocusableDOMProps, FocusableElement, FocusableProps, RefObject} from '@react-types/shared';\nimport {focusSafely} from './';\nimport {getOwnerWindow, isFocusable, mergeProps, mergeRefs, useObjectRef, useSyncRef} from '@react-aria/utils';\nimport React, {ForwardedRef, forwardRef, MutableRefObject, ReactElement, ReactNode, useContext, useEffect, useRef} from 'react';\nimport {useFocus} from './useFocus';\nimport {useKeyboard} from './useKeyboard';\n\nexport interface FocusableOptions<T = FocusableElement> extends FocusableProps<T>, FocusableDOMProps {\n /** Whether focus should be disabled. */\n isDisabled?: boolean\n}\n\nexport interface FocusableProviderProps extends DOMAttributes {\n /** The child element to provide DOM props to. */\n children?: ReactNode\n}\n\ninterface FocusableContextValue extends FocusableProviderProps {\n ref?: MutableRefObject<FocusableElement | null>\n}\n\n// Exported for @react-aria/collections, which forwards this context.\n/** @private */\nexport let FocusableContext: React.Context<FocusableContextValue | null> = React.createContext<FocusableContextValue | null>(null);\n\nfunction useFocusableContext(ref: RefObject<FocusableElement | null>): FocusableContextValue {\n let context = useContext(FocusableContext) || {};\n useSyncRef(context, ref);\n\n // eslint-disable-next-line\n let {ref: _, ...otherProps} = context;\n return otherProps;\n}\n\n/**\n * Provides DOM props to the nearest focusable child.\n */\nexport const FocusableProvider:\n React.ForwardRefExoticComponent<FocusableProviderProps & React.RefAttributes<FocusableElement>> =\nReact.forwardRef(function FocusableProvider(props: FocusableProviderProps, ref: ForwardedRef<FocusableElement>) {\n let {children, ...otherPLine truncated
@@ -0,0 +1,52 @@
import { __read } from "tslib";
import useRafState from '../useRafState';
import useEventListener from '../useEventListener';
import { getTargetElement } from '../utils/domTarget';
var initState = {
screenX: NaN,
screenY: NaN,
clientX: NaN,
clientY: NaN,
pageX: NaN,
pageY: NaN,
elementX: NaN,
elementY: NaN,
elementH: NaN,
elementW: NaN,
elementPosX: NaN,
elementPosY: NaN,
};
export default (function (target) {
var _a = __read(useRafState(initState), 2), state = _a[0], setState = _a[1];
useEventListener('mousemove', function (event) {
var screenX = event.screenX, screenY = event.screenY, clientX = event.clientX, clientY = event.clientY, pageX = event.pageX, pageY = event.pageY;
var newState = {
screenX: screenX,
screenY: screenY,
clientX: clientX,
clientY: clientY,
pageX: pageX,
pageY: pageY,
elementX: NaN,
elementY: NaN,
elementH: NaN,
elementW: NaN,
elementPosX: NaN,
elementPosY: NaN,
};
var targetElement = getTargetElement(target);
if (targetElement) {
var _a = targetElement.getBoundingClientRect(), left = _a.left, top_1 = _a.top, width = _a.width, height = _a.height;
newState.elementPosX = left + window.pageXOffset;
newState.elementPosY = top_1 + window.pageYOffset;
newState.elementX = pageX - newState.elementPosX;
newState.elementY = pageY - newState.elementPosY;
newState.elementW = width;
newState.elementH = height;
}
setState(newState);
}, {
target: function () { return document; },
});
return state;
});
@@ -0,0 +1,4 @@
{
"main": "../../cjs/_class_extract_field_descriptor.cjs",
"module": "../../esm/_class_extract_field_descriptor.js"
}
@@ -0,0 +1 @@
{"version":3,"file":"DecoratorInfoKind.d.ts","sourceRoot":"","sources":["../../../../src/decorator/models/DecoratorInfoKind.ts"],"names":[],"mappings":"AAAA,oBAAY,iBAAiB;IAC3B,MAAM,IAAA;IACN,SAAS,IAAA;IACT,QAAQ,IAAA;CACT"}
@@ -0,0 +1,343 @@
/*
* 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 {
AnimationEventHandler,
AriaAttributes,
AriaRole,
ClipboardEventHandler,
CompositionEventHandler,
CSSProperties,
FormEventHandler,
HTMLAttributeAnchorTarget,
HTMLAttributeReferrerPolicy,
MouseEventHandler,
PointerEventHandler,
DOMAttributes as ReactDOMAttributes,
ReactEventHandler,
TouchEventHandler,
TransitionEventHandler,
UIEventHandler,
WheelEventHandler
} from 'react';
export interface AriaLabelingProps {
/**
* Defines a string value that labels the current element.
*/
'aria-label'?: string,
/**
* Identifies the element (or elements) that labels the current element.
*/
'aria-labelledby'?: string,
/**
* Identifies the element (or elements) that describes the object.
*/
'aria-describedby'?: string,
/**
* Identifies the element (or elements) that provide a detailed, extended description for the object.
*/
'aria-details'?: string
}
export interface AriaValidationProps {
// https://www.w3.org/TR/wai-aria-1.2/#aria-errormessage
/**
* Identifies the element that provides an error message for the object.
*/
'aria-errormessage'?: string
}
// A set of common DOM props that are allowed on any component
// Ensure this is synced with DOMPropNames in filterDOMProps
export interface DOMProps {
/**
* The element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id).
*/
id?: string
}
export interface FocusableDOMProps extends DOMProps {
/**
* Whether to exclude the element from the sequential tab order. If true,
* the element will not be focusable via the keyboard by tabbing. This should
* be avoided except in rare scenarios where an alternative means of accessing
* the element or its functionality via the keyboard is available.
*/
excludeFromTabOrder?: boolean
}
export interface TextInputDOMEvents {
// Clipboard events
/**
* Handler that is called when the user copies text. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/oncopy).
*/
onCopy?: ClipboardEventHandler<HTMLInputElement>,
/**
* Handler that is called when the user cuts text. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/oncut).
*/
onCut?: ClipboardEventHandler<HTMLInputElement>,
/**
* Handler that is called when the user pastes text. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/onpaste).
*/
onPaste?: ClipboardEventHandler<HTMLInputElement>,
// Composition events
/**
* Handler that is called when a text composition system starts a new text composition session. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/compositionstart_event).
*/
onCompositionStart?: CompositionEventHandler<HTMLInputElement>,
/**
* Handler that is called when a text composition system completes or cancels the current text composition session. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/compositionend_event).
*/
onCompositionEnd?: CompositionEventHandler<HTMLInputElement>,
/**
* Handler that is called when a new character is received in the current text composition session. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/compositionupdate_event).
*/
onCompositionUpdate?: CompositionEventHandler<HTMLInputElement>,
// Selection events
/**
* Handler that is called when text in the input is selected. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/select_event).
*/
onSelect?: ReactEventHandler<HTMLInputElement>,
// Input events
/**
* Handler that is called when the input value is about to be modified. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/beforeinput_event).
*/
onBeforeInput?: FormEventHandler<HTMLInputElement>,
/**
* Handler that is called when the input value is modified. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/input_event).
*/
onInput?: FormEventHandler<HTMLInputElement>
}
export interface InputDOMProps {
/**
* The name of the input element, used when submitting an HTML form. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefname).
*/
name?: string,
/**
* The `<form>` element to associate the input with.
* The value of this attribute must be the id of a `<form>` in the same document.
* See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#form).
*/
form?: string
}
// DOM props that apply to all text inputs
// Ensure this is synced with useTextField
export interface TextInputDOMProps extends DOMProps, InputDOMProps, TextInputDOMEvents {
/**
* Describes the type of autocomplete functionality the input should provide if any. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefautocomplete).
*/
autoComplete?: string,
/**
* The maximum number of characters supported by the input. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefmaxlength).
*/
maxLength?: number,
/**
* The minimum number of characters required by the input. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefminlength).
*/
minLength?: number,
/**
* Regex pattern that the value of the input must match to be valid. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefpattern).
*/
pattern?: string,
/**
* Content that appears in the input when it is empty. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefplaceholder).
*/
placeholder?: string,
/**
* The type of input to render. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdeftype).
* @default 'text'
*/
type?: 'text' | 'search' | 'url' | 'tel' | 'email' | 'password' | (string & {}),
/**
* Hints at the type of data that might be entered by the user while editing the element or its contents. See [MDN](https://html.spec.whatwg.org/multipage/interaction.html#input-modalities:-the-inputmode-attribute).
*/
inputMode?: 'none' | 'text' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search',
/**
* An attribute that takes as its value a space-separated string that describes what, if any, type of autocomplete functionality the input should provide. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#autocomplete).
*/
autoCorrect?: string,
/**
* An enumerated attribute that defines whether the element may be checked for spelling errors. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/spellcheck).
*/
spellCheck?: string
}
/**
* This type allows configuring link props with router options and type-safe URLs via TS module augmentation.
* By default, this is an empty type. Extend with `href` and `routerOptions` properties to configure your router.
*/
export interface RouterConfig {}
export type Href = RouterConfig extends {href: infer H} ? H : string;
export type RouterOptions = RouterConfig extends {routerOptions: infer O} ? O : never;
// Make sure to update filterDOMProps.ts when updating this.
export interface LinkDOMProps {
/** A URL to link to. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#href). */
href?: Href,
/** Hints at the human language of the linked URL. See[MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#hreflang). */
hrefLang?: string,
/** The target window for the link. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#target). */
target?: HTMLAttributeAnchorTarget,
/** The relationship between the linked resource and the current page. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel). */
rel?: string,
/** Causes the browser to download the linked URL. A string may be provided to suggest a file name. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#download). */
download?: boolean | string,
/** A space-separated list of URLs to ping when the link is followed. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#ping). */
ping?: string,
/** How much of the referrer to send when following the link. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#referrerpolicy). */
referrerPolicy?: HTMLAttributeReferrerPolicy,
/** Options for the configured client side router. */
routerOptions?: RouterOptions
}
/** Any focusable element, including both HTML and SVG elements. */
export interface FocusableElement extends Element, HTMLOrSVGElement {}
/** All DOM attributes supported across both HTML and SVG elements. */
export interface DOMAttributes<T = FocusableElement> extends AriaAttributes, ReactDOMAttributes<T> {
id?: string | undefined,
role?: AriaRole | undefined,
tabIndex?: number | undefined,
style?: CSSProperties | undefined,
className?: string | undefined
}
export interface GroupDOMAttributes extends Omit<DOMAttributes<HTMLElement>, 'role'> {
role?: 'group' | 'region' | 'presentation'
}
/**
* Global attributes that can be applied to any DOM element.
* @private
*/
// NOTE: id is handled elsewhere (DOMProps).
export interface GlobalDOMAttributes<T = Element> extends GlobalDOMEvents<T> {
dir?: string | undefined,
lang?: string | undefined,
hidden?: boolean | undefined,
inert?: boolean | undefined,
translate?: 'yes' | 'no' | undefined
}
/**
* Global DOM events that are supported on all DOM elements.
* @private
*/
// NOTES:
// - Drag and drop events are omitted for now.
// - Keyboard and focus events are supported directly on focusable elements (FocusableProps).
// - Text input events (e.g. onInput, onCompositionStart, onCopy) are
// supported only directly on input elements (TextInputDOMProps).
// We don't support contentEditable on our components.
// - Media events should be handled directly on the <video>/<audio><img> element.
export interface GlobalDOMEvents<T = Element> {
// MouseEvents
onClick?: MouseEventHandler<T> | undefined,
onClickCapture?: MouseEventHandler<T> | undefined,
onAuxClick?: MouseEventHandler<T> | undefined,
onAuxClickCapture?: MouseEventHandler<T> | undefined,
onContextMenu?: MouseEventHandler<T> | undefined,
onContextMenuCapture?: MouseEventHandler<T> | undefined,
onDoubleClick?: MouseEventHandler<T> | undefined,
onDoubleClickCapture?: MouseEventHandler<T> | undefined,
onMouseDown?: MouseEventHandler<T> | undefined,
onMouseDownCapture?: MouseEventHandler<T> | undefined,
onMouseEnter?: MouseEventHandler<T> | undefined,
onMouseLeave?: MouseEventHandler<T> | undefined,
onMouseMove?: MouseEventHandler<T> | undefined,
onMouseMoveCapture?: MouseEventHandler<T> | undefined,
onMouseOut?: MouseEventHandler<T> | undefined,
onMouseOutCapture?: MouseEventHandler<T> | undefined,
onMouseOver?: MouseEventHandler<T> | undefined,
onMouseOverCapture?: MouseEventHandler<T> | undefined,
onMouseUp?: MouseEventHandler<T> | undefined,
onMouseUpCapture?: MouseEventHandler<T> | undefined,
// Touch Events
onTouchCancel?: TouchEventHandler<T> | undefined,
onTouchCancelCapture?: TouchEventHandler<T> | undefined,
onTouchEnd?: TouchEventHandler<T> | undefined,
onTouchEndCapture?: TouchEventHandler<T> | undefined,
onTouchMove?: TouchEventHandler<T> | undefined,
onTouchMoveCapture?: TouchEventHandler<T> | undefined,
onTouchStart?: TouchEventHandler<T> | undefined,
onTouchStartCapture?: TouchEventHandler<T> | undefined,
// Pointer Events
onPointerDown?: PointerEventHandler<T> | undefined,
onPointerDownCapture?: PointerEventHandler<T> | undefined,
onPointerMove?: PointerEventHandler<T> | undefined,
onPointerMoveCapture?: PointerEventHandler<T> | undefined,
onPointerUp?: PointerEventHandler<T> | undefined,
onPointerUpCapture?: PointerEventHandler<T> | undefined,
onPointerCancel?: PointerEventHandler<T> | undefined,
onPointerCancelCapture?: PointerEventHandler<T> | undefined,
onPointerEnter?: PointerEventHandler<T> | undefined,
onPointerLeave?: PointerEventHandler<T> | undefined,
onPointerOver?: PointerEventHandler<T> | undefined,
onPointerOverCapture?: PointerEventHandler<T> | undefined,
onPointerOut?: PointerEventHandler<T> | undefined,
onPointerOutCapture?: PointerEventHandler<T> | undefined,
onGotPointerCapture?: PointerEventHandler<T> | undefined,
onGotPointerCaptureCapture?: PointerEventHandler<T> | undefined,
onLostPointerCapture?: PointerEventHandler<T> | undefined,
onLostPointerCaptureCapture?: PointerEventHandler<T> | undefined,
// UI Events
onScroll?: UIEventHandler<T> | undefined,
onScrollCapture?: UIEventHandler<T> | undefined,
// Wheel Events
onWheel?: WheelEventHandler<T> | undefined,
onWheelCapture?: WheelEventHandler<T> | undefined,
// Animation Events
onAnimationStart?: AnimationEventHandler<T> | undefined,
onAnimationStartCapture?: AnimationEventHandler<T> | undefined,
onAnimationEnd?: AnimationEventHandler<T> | undefined,
onAnimationEndCapture?: AnimationEventHandler<T> | undefined,
onAnimationIteration?: AnimationEventHandler<T> | undefined,
onAnimationIterationCapture?: AnimationEventHandler<T> | undefined,
// Transition Events
onTransitionCancel?: TransitionEventHandler<T> | undefined,
onTransitionCancelCapture?: TransitionEventHandler<T> | undefined,
onTransitionEnd?: TransitionEventHandler<T> | undefined,
onTransitionEndCapture?: TransitionEventHandler<T> | undefined,
onTransitionRun?: TransitionEventHandler<T> | undefined,
onTransitionRunCapture?: TransitionEventHandler<T> | undefined,
onTransitionStart?: TransitionEventHandler<T> | undefined,
onTransitionStartCapture?: TransitionEventHandler<T> | undefined
}
@@ -0,0 +1,18 @@
import getMapData from './_getMapData.js';
/**
* Removes `key` and its value from the map.
*
* @private
* @name delete
* @memberOf MapCache
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function mapCacheDelete(key) {
var result = getMapData(this, key)['delete'](key);
this.size -= result ? 1 : 0;
return result;
}
export default mapCacheDelete;
@@ -0,0 +1,68 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SIMPLE_UNITS = exports.SANCTIONED_UNITS = void 0;
exports.removeUnitNamespace = removeUnitNamespace;
exports.IsSanctionedSimpleUnitIdentifier = IsSanctionedSimpleUnitIdentifier;
/**
* https://tc39.es/ecma402/#table-sanctioned-simple-unit-identifiers
*/
exports.SANCTIONED_UNITS = [
'angle-degree',
'area-acre',
'area-hectare',
'concentr-percent',
'digital-bit',
'digital-byte',
'digital-gigabit',
'digital-gigabyte',
'digital-kilobit',
'digital-kilobyte',
'digital-megabit',
'digital-megabyte',
'digital-petabyte',
'digital-terabit',
'digital-terabyte',
'duration-day',
'duration-hour',
'duration-millisecond',
'duration-minute',
'duration-month',
'duration-second',
'duration-week',
'duration-year',
'length-centimeter',
'length-foot',
'length-inch',
'length-kilometer',
'length-meter',
'length-mile-scandinavian',
'length-mile',
'length-millimeter',
'length-yard',
'mass-gram',
'mass-kilogram',
'mass-ounce',
'mass-pound',
'mass-stone',
'temperature-celsius',
'temperature-fahrenheit',
'volume-fluid-ounce',
'volume-gallon',
'volume-liter',
'volume-milliliter',
];
// In CLDR, the unit name always follows the form `namespace-unit` pattern.
// For example: `digital-bit` instead of `bit`. This function removes the namespace prefix.
function removeUnitNamespace(unit) {
return unit.slice(unit.indexOf('-') + 1);
}
/**
* https://tc39.es/ecma402/#table-sanctioned-simple-unit-identifiers
*/
exports.SIMPLE_UNITS = exports.SANCTIONED_UNITS.map(removeUnitNamespace);
/**
* https://tc39.es/ecma402/#sec-issanctionedsimpleunitidentifier
*/
function IsSanctionedSimpleUnitIdentifier(unitIdentifier) {
return exports.SIMPLE_UNITS.indexOf(unitIdentifier) > -1;
}
@@ -0,0 +1 @@
{"version":3,"file":"extensions.js","sourceRoot":"","sources":["../../src/rules/extensions.ts"],"names":[],"mappings":"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 truncated
@@ -0,0 +1,343 @@
"use client";
"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/checkbox.tsx
var checkbox_exports = {};
__export(checkbox_exports, {
default: () => checkbox_default
});
module.exports = __toCommonJS(checkbox_exports);
var import_system2 = require("@heroui/system");
var import_react3 = require("react");
// src/use-checkbox.ts
var import_system = require("@heroui/system");
var import_react = require("react");
var import_react2 = require("react");
var import_toggle = require("@react-stately/toggle");
var import_theme = require("@heroui/theme");
var import_use_callback_ref = require("@heroui/use-callback-ref");
var import_interactions = require("@react-aria/interactions");
var import_focus = require("@react-aria/focus");
var import_utils = require("@react-aria/utils");
var import_shared_utils = require("@heroui/shared-utils");
var import_checkbox = require("@react-aria/checkbox");
var import_use_safe_layout_effect = require("@heroui/use-safe-layout-effect");
var import_react_utils2 = require("@heroui/react-utils");
var import_form = require("@heroui/form");
// src/checkbox-group-context.ts
var import_react_utils = require("@heroui/react-utils");
var [CheckboxGroupProvider, useCheckboxGroupContext] = (0, import_react_utils.createContext)({
name: "CheckboxGroupContext",
strict: false
});
// src/use-checkbox.ts
function useCheckbox(props = {}) {
var _a, _b, _c, _d, _e, _f, _g, _h;
const globalContext = (0, import_system.useProviderContext)();
const groupContext = useCheckboxGroupContext();
const { validationBehavior: formValidationBehavior } = (0, import_form.useSlottedContext)(import_form.FormContext) || {};
const isInGroup = !!groupContext;
const {
as,
ref,
value = "",
children,
icon,
name,
isRequired,
isReadOnly: isReadOnlyProp = false,
autoFocus = false,
isSelected: isSelectedProp,
size = (_a = groupContext == null ? void 0 : groupContext.size) != null ? _a : "md",
color = (_b = groupContext == null ? void 0 : groupContext.color) != null ? _b : "primary",
radius = groupContext == null ? void 0 : groupContext.radius,
lineThrough = (_c = groupContext == null ? void 0 : groupContext.lineThrough) != null ? _c : false,
isDisabled: isDisabledProp = (_d = groupContext == null ? void 0 : groupContext.isDisabled) != null ? _d : false,
disableAnimation = (_f = (_e = groupContext == null ? void 0 : groupContext.disableAnimation) != null ? _e : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _f : false,
validationState,
isInvalid: isInvalidProp = validationState ? validationState === "invalid" : (_g = groupContext == null ? void 0 : groupContext.isInvalid) != null ? _g : false,
isIndeterminate = false,
validationBehavior = isInGroup ? groupContext.validationBehavior : (_h = formValidationBehavior != null ? formValidationBehavior : globalContext == null ? void 0 : globalContext.validationBehavior) != null ? _h : "native",
defaultSelected,
classNames,
className,
onValueChange,
validate,
...otherProps
} = props;
if (groupContext && import_shared_utils.__DEV__) {
if (isSelectedProp) {
(0, import_shared_utils.warn)(
"The Checkbox.Group is being used, `isSelected` will be ignored. Use the `value` of the Checkbox.Group instead.",
"Checkbox"
);
}
if (defaultSelected) {
(0, import_shared_utils.warn)(
"The Checkbox.Group is being used, `defaultSelected` will be ignored. Use the `defaultValue` of the Checkbox.Group instead.",
"Checkbox"
);
}
}
const Component = as || "label";
const domRef = (0, import_react2.useRef)(null);
const inputRef = (0, import_react2.useRef)(null);
let onChange = props.onChange;
if (isInGroup) {
const dispatch = () => {
groupContext.groupState.resetValidation();
};
onChange = (0, import_utils.chain)(dispatch, onChange);
}
const labelId = (0, import_react.useId)();
const ariaCheckboxProps = (0, import_react2.useMemo)(
() => ({
name,
value,
children,
autoFocus,
defaultSelected,
isIndeterminate,
isRequired,
isInvalid: isInvalidProp,
isSelected: isSelectedProp,
isDisabled: isDisabledProp,
isReadOnly: isReadOnlyProp,
"aria-label": (0, import_shared_utils.safeAriaLabel)(otherProps["aria-label"], children),
"aria-labelledby": otherProps["aria-labelledby"] || labelId,
onChange: onValueChange
}),
[
name,
value,
children,
autoFocus,
defaultSelected,
isIndeterminate,
isRequired,
isInvalidProp,
isSelectedProp,
isDisabledProp,
isReadOnlyProp,
otherProps["aria-label"],
otherProps["aria-labelledby"],
labelId,
onValueChange
]
);
const toggleState = (0, import_toggle.useToggleState)(ariaCheckboxProps);
const validationProps = {
isInvalid: isInvalidProp,
isRequired,
validate,
validationState,
validationBehavior
};
const {
inputProps,
isSelected,
isDisabled,
isReadOnly,
isPressed,
isInvalid: isAriaInvalid
} = isInGroup ? (0, import_checkbox.useCheckboxGroupItem)(
{ ...ariaCheckboxProps, ...validationProps },
groupContext.groupState,
inputRef
) : (0, import_checkbox.useCheckbox)({ ...ariaCheckboxProps, ...validationProps }, toggleState, inputRef);
const isInteractionDisabled = isDisabled || isReadOnly;
const isInvalid = validationState === "invalid" || isInvalidProp || isAriaInvalid;
const pressed = isInteractionDisabled ? false : isPressed;
const { hoverProps, isHovered } = (0, import_interactions.useHover)({
isDisabled: inputProps.disabled
});
const { focusProps, isFocused, isFocusVisible } = (0, import_focus.useFocusRing)({
autoFocus: inputProps.autoFocus
});
const slots = (0, import_react2.useMemo)(
() => (0, import_theme.checkbox)({
color,
size,
radius,
isInvalid,
lineThrough,
isDisabled,
disableAnimation
}),
[color, size, radius, isInvalid, lineThrough, isDisabled, disableAnimation]
);
(0, import_use_safe_layout_effect.useSafeLayoutEffect)(() => {
if (!inputRef.current)
return;
const isInputRefChecked = !!inputRef.current.checked;
toggleState.setSelected(isInputRefChecked);
}, [inputRef.current]);
const onChangeProp = (0, import_use_callback_ref.useCallbackRef)(onChange);
const handleCheckboxChange = (0, import_react.useCallback)(
(event) => {
if (isReadOnly || isDisabled) {
event.preventDefault();
return;
}
onChangeProp == null ? void 0 : onChangeProp(event);
},
[isReadOnly, isDisabled, onChangeProp]
);
const baseStyles = (0, import_shared_utils.clsx)(classNames == null ? void 0 : classNames.base, className);
const getBaseProps = (0, import_react.useCallback)(() => {
return {
ref: domRef,
className: slots.base({ class: baseStyles }),
"data-disabled": (0, import_shared_utils.dataAttr)(isDisabled),
"data-selected": (0, import_shared_utils.dataAttr)(isSelected || isIndeterminate),
"data-invalid": (0, import_shared_utils.dataAttr)(isInvalid),
"data-hover": (0, import_shared_utils.dataAttr)(isHovered),
"data-focus": (0, import_shared_utils.dataAttr)(isFocused),
"data-pressed": (0, import_shared_utils.dataAttr)(pressed),
"data-readonly": (0, import_shared_utils.dataAttr)(inputProps.readOnly),
"data-focus-visible": (0, import_shared_utils.dataAttr)(isFocusVisible),
"data-indeterminate": (0, import_shared_utils.dataAttr)(isIndeterminate),
...(0, import_utils.mergeProps)(hoverProps, otherProps)
};
}, [
slots,
baseStyles,
isDisabled,
isSelected,
isIndeterminate,
isInvalid,
isHovered,
isFocused,
pressed,
inputProps.readOnly,
isFocusVisible,
hoverProps,
otherProps
]);
const getWrapperProps = (0, import_react.useCallback)(
(props2 = {}) => {
return {
...props2,
"aria-hidden": true,
className: (0, import_shared_utils.clsx)(slots.wrapper({ class: (0, import_shared_utils.clsx)(classNames == null ? void 0 : classNames.wrapper, props2 == null ? void 0 : props2.className) }))
};
},
[slots, classNames == null ? void 0 : classNames.wrapper]
);
const getInputProps = (0, import_react.useCallback)(() => {
return {
ref: (0, import_react_utils2.mergeRefs)(inputRef, ref),
...(0, import_utils.mergeProps)(inputProps, focusProps),
className: slots.hiddenInput({ class: classNames == null ? void 0 : classNames.hiddenInput }),
onChange: (0, import_utils.chain)(inputProps.onChange, handleCheckboxChange)
};
}, [inputProps, focusProps, handleCheckboxChange, classNames == null ? void 0 : classNames.hiddenInput]);
const getLabelProps = (0, import_react.useCallback)(
() => ({
id: labelId,
className: slots.label({ class: classNames == null ? void 0 : classNames.label })
}),
[slots, classNames == null ? void 0 : classNames.label, isDisabled, isSelected, isInvalid]
);
const getIconProps = (0, import_react.useCallback)(
() => ({
isSelected,
isIndeterminate,
disableAnimation,
className: slots.icon({ class: classNames == null ? void 0 : classNames.icon })
}),
[slots, classNames == null ? void 0 : classNames.icon, isSelected, isIndeterminate, disableAnimation]
);
return {
Component,
icon,
children,
isSelected,
isDisabled,
isInvalid,
isFocused,
isHovered,
isFocusVisible,
getBaseProps,
getWrapperProps,
getInputProps,
getLabelProps,
getIconProps
};
}
// src/checkbox-icon.tsx
var import_jsx_runtime = require("react/jsx-runtime");
function CheckIcon(props) {
const { isSelected, disableAnimation, ...otherProps } = props;
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { "aria-hidden": "true", role: "presentation", viewBox: "0 0 17 18", ...otherProps, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
"polyline",
{
fill: "none",
points: "1 9 7 14 15 4",
stroke: "currentColor",
strokeDasharray: 22,
strokeDashoffset: isSelected ? 44 : 66,
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: 2,
style: !disableAnimation && isSelected ? {
transition: "stroke-dashoffset 250ms linear 0.2s"
} : {}
}
) });
}
function IndeterminateIcon(props) {
const { isSelected, disableAnimation, ...otherProps } = props;
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { stroke: "currentColor", strokeWidth: 3, viewBox: "0 0 24 24", ...otherProps, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("line", { x1: "21", x2: "3", y1: "12", y2: "12" }) });
}
function CheckboxIcon(props) {
const { isIndeterminate, ...otherProps } = props;
const BaseIcon = isIndeterminate ? IndeterminateIcon : CheckIcon;
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BaseIcon, { ...otherProps });
}
// src/checkbox.tsx
var import_jsx_runtime2 = require("react/jsx-runtime");
var Checkbox = (0, import_system2.forwardRef)((props, ref) => {
const {
Component,
children,
icon = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CheckboxIcon, {}),
getBaseProps,
getWrapperProps,
getInputProps,
getIconProps,
getLabelProps
} = useCheckbox({ ...props, ref });
const clonedIcon = typeof icon === "function" ? icon(getIconProps()) : (0, import_react3.cloneElement)(icon, getIconProps());
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Component, { ...getBaseProps(), children: [
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("input", { ...getInputProps() }),
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { ...getWrapperProps(), children: clonedIcon }),
children && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { ...getLabelProps(), children })
] });
});
Checkbox.displayName = "HeroUI.Checkbox";
var checkbox_default = Checkbox;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {});
@@ -0,0 +1,21 @@
import { expect, expectTypeOf, test } from "vitest";
import * as z from "zod/v4";
const schema = z.nan();
test("passing validations", () => {
schema.parse(Number.NaN);
schema.parse(Number("Not a number"));
expectTypeOf<typeof schema._output>().toEqualTypeOf<number>();
});
test("failing validations", () => {
expect(() => schema.parse(5)).toThrow();
expect(() => schema.parse("John")).toThrow();
expect(() => schema.parse(true)).toThrow();
expect(() => schema.parse(null)).toThrow();
expect(() => schema.parse(undefined)).toThrow();
expect(() => schema.parse({})).toThrow();
expect(() => schema.parse([])).toThrow();
});
@@ -0,0 +1,148 @@
'use strict';
function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIndent, startOnNewline }) {
let spaceBefore = false;
let atNewline = startOnNewline;
let hasSpace = startOnNewline;
let comment = '';
let commentSep = '';
let hasNewline = false;
let reqSpace = false;
let tab = null;
let anchor = null;
let tag = null;
let newlineAfterProp = null;
let comma = null;
let found = null;
let start = null;
for (const token of tokens) {
if (reqSpace) {
if (token.type !== 'space' &&
token.type !== 'newline' &&
token.type !== 'comma')
onError(token.offset, 'MISSING_CHAR', 'Tags and anchors must be separated from the next token by white space');
reqSpace = false;
}
if (tab) {
if (atNewline && token.type !== 'comment' && token.type !== 'newline') {
onError(tab, 'TAB_AS_INDENT', 'Tabs are not allowed as indentation');
}
tab = null;
}
switch (token.type) {
case 'space':
// At the doc level, tabs at line start may be parsed
// as leading white space rather than indentation.
// In a flow collection, only the parser handles indent.
if (!flow &&
(indicator !== 'doc-start' || next?.type !== 'flow-collection') &&
token.source.includes('\t')) {
tab = token;
}
hasSpace = true;
break;
case 'comment': {
if (!hasSpace)
onError(token, 'MISSING_CHAR', 'Comments must be separated from other tokens by white space characters');
const cb = token.source.substring(1) || ' ';
if (!comment)
comment = cb;
else
comment += commentSep + cb;
commentSep = '';
atNewline = false;
break;
}
case 'newline':
if (atNewline) {
if (comment)
comment += token.source;
else if (!found || indicator !== 'seq-item-ind')
spaceBefore = true;
}
else
commentSep += token.source;
atNewline = true;
hasNewline = true;
if (anchor || tag)
newlineAfterProp = token;
hasSpace = true;
break;
case 'anchor':
if (anchor)
onError(token, 'MULTIPLE_ANCHORS', 'A node can have at most one anchor');
if (token.source.endsWith(':'))
onError(token.offset + token.source.length - 1, 'BAD_ALIAS', 'Anchor ending in : is ambiguous', true);
anchor = token;
start ?? (start = token.offset);
atNewline = false;
hasSpace = false;
reqSpace = true;
break;
case 'tag': {
if (tag)
onError(token, 'MULTIPLE_TAGS', 'A node can have at most one tag');
tag = token;
start ?? (start = token.offset);
atNewline = false;
hasSpace = false;
reqSpace = true;
break;
}
case indicator:
// Could here handle preceding comments differently
if (anchor || tag)
onError(token, 'BAD_PROP_ORDER', `Anchors and tags must be after the ${token.source} indicator`);
if (found)
onError(token, 'UNEXPECTED_TOKEN', `Unexpected ${token.source} in ${flow ?? 'collection'}`);
found = token;
atNewline =
indicator === 'seq-item-ind' || indicator === 'explicit-key-ind';
hasSpace = false;
break;
case 'comma':
if (flow) {
if (comma)
onError(token, 'UNEXPECTED_TOKEN', `Unexpected , in ${flow}`);
comma = token;
atNewline = false;
hasSpace = false;
break;
}
// else fallthrough
default:
onError(token, 'UNEXPECTED_TOKEN', `Unexpected ${token.type} token`);
atNewline = false;
hasSpace = false;
}
}
const last = tokens[tokens.length - 1];
const end = last ? last.offset + last.source.length : offset;
if (reqSpace &&
next &&
next.type !== 'space' &&
next.type !== 'newline' &&
next.type !== 'comma' &&
(next.type !== 'scalar' || next.source !== '')) {
onError(next.offset, 'MISSING_CHAR', 'Tags and anchors must be separated from the next token by white space');
}
if (tab &&
((atNewline && tab.indent <= parentIndent) ||
next?.type === 'block-map' ||
next?.type === 'block-seq'))
onError(tab, 'TAB_AS_INDENT', 'Tabs are not allowed as indentation');
return {
comma,
found,
spaceBefore,
comment,
hasNewline,
anchor,
tag,
newlineAfterProp,
end,
start: start ?? end
};
}
exports.resolveProps = resolveProps;
@@ -0,0 +1,61 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = until;
var _whilst = require('./whilst.js');
var _whilst2 = _interopRequireDefault(_whilst);
var _wrapAsync = require('./internal/wrapAsync.js');
var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Repeatedly call `iteratee` until `test` returns `true`. Calls `callback` when
* stopped, or an error occurs. `callback` will be passed an error and any
* arguments passed to the final `iteratee`'s callback.
*
* The inverse of [whilst]{@link module:ControlFlow.whilst}.
*
* @name until
* @static
* @memberOf module:ControlFlow
* @method
* @see [async.whilst]{@link module:ControlFlow.whilst}
* @category Control Flow
* @param {AsyncFunction} test - asynchronous truth test to perform before each
* execution of `iteratee`. Invoked with (callback).
* @param {AsyncFunction} iteratee - An async function which is called each time
* `test` fails. Invoked with (callback).
* @param {Function} [callback] - A callback which is called after the test
* function has passed and repeated execution of `iteratee` has stopped. `callback`
* will be passed an error and any arguments passed to the final `iteratee`'s
* callback. Invoked with (err, [results]);
* @returns {Promise} a promise, if a callback is not passed
*
* @example
* const results = []
* let finished = false
* async.until(function test(cb) {
* cb(null, finished)
* }, function iter(next) {
* fetchPage(url, (err, body) => {
* if (err) return next(err)
* results = results.concat(body.objects)
* finished = !!body.next
* next(err)
* })
* }, function done (err) {
* // all pages have been fetched
* })
*/
function until(test, iteratee, callback) {
const _test = (0, _wrapAsync2.default)(test);
return (0, _whilst2.default)(cb => _test((err, truth) => cb(err, !truth)), iteratee, callback);
}
module.exports = exports.default;
@@ -0,0 +1,24 @@
# @heroui/react-utils
A Quick description of the component
> This is an internal utility, not intended for public usage.
## Installation
```sh
yarn add @heroui/react-utils
# or
npm i @heroui/react-utils
```
## Contribution
Yes please! See the
[contributing guidelines](https://github.com/heroui-inc/heroui/blob/master/CONTRIBUTING.md)
for details.
## License
This project is licensed under the terms of the
[MIT license](https://github.com/heroui-inc/heroui/blob/master/LICENSE).
@@ -0,0 +1 @@
{"version":3,"file":"buildDefaultMaybeClassElementMetadata.d.ts","sourceRoot":"","sources":["../../../../src/metadata/calculations/buildDefaultMaybeClassElementMetadata.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gCAAgC,EAAE,MAAM,4CAA4C,CAAC;AAE9F,wBAAgB,qCAAqC,IAAI,gCAAgC,CAOxF"}
@@ -0,0 +1,527 @@
import { expect, expectTypeOf, test } from "vitest";
import * as z from "zod/v4";
declare const iss: z.core.$ZodIssueCode;
const Test = z.object({
f1: z.number(),
f2: z.string().optional(),
f3: z.string().nullable(),
f4: z.array(z.object({ t: z.union([z.string(), z.boolean()]) })),
});
// type TestFlattenedErrors = core.inferFlattenedErrors<typeof Test, { message: string; code: number }>;
// type TestFormErrors = core.inferFlattenedErrors<typeof Test>;
const parsed = Test.safeParse({});
test("regular error", () => {
expect(parsed).toMatchInlineSnapshot(`
{
"error": [ZodError: [
{
"expected": "number",
"code": "invalid_type",
"path": [
"f1"
],
"message": "Invalid input: expected number, received undefined"
},
{
"expected": "string",
"code": "invalid_type",
"path": [
"f3"
],
"message": "Invalid input: expected string, received undefined"
},
{
"expected": "array",
"code": "invalid_type",
"path": [
"f4"
],
"message": "Invalid input: expected array, received undefined"
}
]],
"success": false,
}
`);
});
test(".flatten()", () => {
const flattened = parsed.error!.flatten();
// flattened.
expectTypeOf(flattened).toMatchTypeOf<{
formErrors: string[];
fieldErrors: {
f2?: string[];
f1?: string[];
f3?: string[];
f4?: string[];
};
}>();
expect(flattened).toMatchInlineSnapshot(`
{
"fieldErrors": {
"f1": [
"Invalid input: expected number, received undefined",
],
"f3": [
"Invalid input: expected string, received undefined",
],
"f4": [
"Invalid input: expected array, received undefined",
],
},
"formErrors": [],
}
`);
});
test("custom .flatten()", () => {
type ErrorType = { message: string; code: number };
const flattened = parsed.error!.flatten((iss) => ({ message: iss.message, code: 1234 }));
expectTypeOf(flattened).toMatchTypeOf<{
formErrors: ErrorType[];
fieldErrors: {
f2?: ErrorType[];
f1?: ErrorType[];
f3?: ErrorType[];
f4?: ErrorType[];
};
}>();
expect(flattened).toMatchInlineSnapshot(`
{
"fieldErrors": {
"f1": [
{
"code": 1234,
"message": "Invalid input: expected number, received undefined",
},
],
"f3": [
{
"code": 1234,
"message": "Invalid input: expected string, received undefined",
},
],
"f4": [
{
"code": 1234,
"message": "Invalid input: expected array, received undefined",
},
],
},
"formErrors": [],
}
`);
});
test(".format()", () => {
const formatted = parsed.error!.format();
expectTypeOf(formatted).toMatchTypeOf<{
_errors: string[];
f2?: { _errors: string[] };
f1?: { _errors: string[] };
f3?: { _errors: string[] };
f4?: {
[x: number]: {
_errors: string[];
t?: {
_errors: string[];
};
};
_errors: string[];
};
}>();
expect(formatted).toMatchInlineSnapshot(`
{
"_errors": [],
"f1": {
"_errors": [
"Invalid input: expected number, received undefined",
],
},
"f3": {
"_errors": [
"Invalid input: expected string, received undefined",
],
},
"f4": {
"_errors": [
"Invalid input: expected array, received undefined",
],
},
}
`);
});
test("custom .format()", () => {
type ErrorType = { message: string; code: number };
const formatted = parsed.error!.format((iss) => ({ message: iss.message, code: 1234 }));
expectTypeOf(formatted).toMatchTypeOf<{
_errors: ErrorType[];
f2?: { _errors: ErrorType[] };
f1?: { _errors: ErrorType[] };
f3?: { _errors: ErrorType[] };
f4?: {
[x: number]: {
_errors: ErrorType[];
t?: {
_errors: ErrorType[];
};
};
_errors: ErrorType[];
};
}>();
expect(formatted).toMatchInlineSnapshot(`
{
"_errors": [],
"f1": {
"_errors": [
{
"code": 1234,
"message": "Invalid input: expected number, received undefined",
},
],
},
"f3": {
"_errors": [
{
"code": 1234,
"message": "Invalid input: expected string, received undefined",
},
],
},
"f4": {
"_errors": [
{
"code": 1234,
"message": "Invalid input: expected array, received undefined",
},
],
},
}
`);
});
test("all errors", () => {
const propertySchema = z.string();
const schema = z
.object({
a: propertySchema,
b: propertySchema,
})
.refine(
(val) => {
return val.a === val.b;
},
{ message: "Must be equal" }
);
const r1 = schema.safeParse({
a: "asdf",
b: "qwer",
});
expect(z.core.flattenError(r1.error!)).toEqual({
formErrors: ["Must be equal"],
fieldErrors: {},
});
const r2 = schema.safeParse({
a: null,
b: null,
});
// const error = _error as z.ZodError;
expect(z.core.flattenError(r2.error!)).toMatchInlineSnapshot(`
{
"fieldErrors": {
"a": [
"Invalid input: expected string, received null",
],
"b": [
"Invalid input: expected string, received null",
],
},
"formErrors": [],
}
`);
expect(z.core.flattenError(r2.error!, (iss) => iss.message.toUpperCase())).toMatchInlineSnapshot(`
{
"fieldErrors": {
"a": [
"INVALID INPUT: EXPECTED STRING, RECEIVED NULL",
],
"b": [
"INVALID INPUT: EXPECTED STRING, RECEIVED NULL",
],
},
"formErrors": [],
}
`);
// Test identity
expect(z.core.flattenError(r2.error!, (i: z.ZodIssue) => i)).toMatchInlineSnapshot(`
{
"fieldErrors": {
"a": [
{
"code": "invalid_type",
"expected": "string",
"message": "Invalid input: expected string, received null",
"path": [
"a",
],
},
],
"b": [
{
"code": "invalid_type",
"expected": "string",
"message": "Invalid input: expected string, received null",
"path": [
"b",
],
},
],
},
"formErrors": [],
}
`);
// Test mapping
const f1 = z.core.flattenError(r2.error!, (i: z.ZodIssue) => i.message.length);
expect(f1).toMatchInlineSnapshot(`
{
"fieldErrors": {
"a": [
45,
],
"b": [
45,
],
},
"formErrors": [],
}
`);
// expect(f1.fieldErrors.a![0]).toEqual("Invalid input: expected string".length);
// expect(f1).toMatchObject({
// formErrors: [],
// fieldErrors: {
// a: ["Invalid input: expected string".length],
// b: ["Invalid input: expected string".length],
// },
// });
});
const schema = z.strictObject({
username: z.string(),
favoriteNumbers: z.array(z.number()),
nesting: z.object({
a: z.string(),
}),
});
const result = schema.safeParse({
username: 1234,
favoriteNumbers: [1234, "4567"],
nesting: {
a: 123,
},
extra: 1234,
});
test("z.treeifyError", () => {
expect(z.treeifyError(result.error!)).toMatchInlineSnapshot(`
{
"errors": [
"Unrecognized key: "extra"",
],
"properties": {
"favoriteNumbers": {
"errors": [],
"items": [
,
{
"errors": [
"Invalid input: expected number, received string",
],
},
],
},
"nesting": {
"errors": [],
"properties": {
"a": {
"errors": [
"Invalid input: expected string, received number",
],
},
},
},
"username": {
"errors": [
"Invalid input: expected string, received number",
],
},
},
}
`);
});
test("z.treeifyError 2", () => {
const schema = z.strictObject({
name: z.string(),
logLevel: z.union([z.string(), z.number()]),
env: z.literal(["production", "development"]),
});
const data = {
name: 1000,
logLevel: false,
extra: 1000,
};
const result = schema.safeParse(data);
const err = z.treeifyError(result.error!);
expect(err).toMatchInlineSnapshot(`
{
"errors": [
"Unrecognized key: "extra"",
],
"properties": {
"env": {
"errors": [
"Invalid option: expected one of "production"|"development"",
],
},
"logLevel": {
"errors": [
"Invalid input: expected string, received boolean",
"Invalid input: expected number, received boolean",
],
},
"name": {
"errors": [
"Invalid input: expected string, received number",
],
},
},
}
`);
});
test("z.prettifyError", () => {
expect(z.prettifyError(result.error!)).toMatchInlineSnapshot(`
"✖ Unrecognized key: "extra"
✖ Invalid input: expected string, received number
→ at username
✖ Invalid input: expected number, received string
→ at favoriteNumbers[1]
✖ Invalid input: expected string, received number
→ at nesting.a"
`);
});
test("z.toDotPath", () => {
expect(z.core.toDotPath(["a", "b", 0, "c"])).toMatchInlineSnapshot(`"a.b[0].c"`);
expect(z.core.toDotPath(["a", Symbol("b"), 0, "c"])).toMatchInlineSnapshot(`"a["Symbol(b)"][0].c"`);
// Test with periods in keys
expect(z.core.toDotPath(["user.name", "first.last"])).toMatchInlineSnapshot(`"["user.name"]["first.last"]"`);
// Test with special characters
expect(z.core.toDotPath(["user", "$special", Symbol("#symbol")])).toMatchInlineSnapshot(
`"user.$special["Symbol(#symbol)"]"`
);
// Test with dots and quotes
expect(z.core.toDotPath(["search", `query("foo.bar"="abc")`])).toMatchInlineSnapshot(
`"search["query(\\"foo.bar\\"=\\"abc\\")"]"`
);
// Test with newlines
expect(z.core.toDotPath(["search", `foo\nbar`])).toMatchInlineSnapshot(`"search["foo\\nbar"]"`);
// Test with empty strings
expect(z.core.toDotPath(["", "empty"])).toMatchInlineSnapshot(`".empty"`);
// Test with array indices
expect(z.core.toDotPath(["items", 0, 1, 2])).toMatchInlineSnapshot(`"items[0][1][2]"`);
// Test with mixed path elements
expect(z.core.toDotPath(["users", "user.config", 0, "settings.theme"])).toMatchInlineSnapshot(
`"users["user.config"][0]["settings.theme"]"`
);
// Test with square brackets in keys
expect(z.core.toDotPath(["data[0]", "value"])).toMatchInlineSnapshot(`"["data[0]"].value"`);
// Test with empty path
expect(z.core.toDotPath([])).toMatchInlineSnapshot(`""`);
});
test("inheritance", () => {
const e1 = new z.ZodError([]);
expect(e1).toBeInstanceOf(z.core.$ZodError);
expect(e1).toBeInstanceOf(z.ZodError);
// expect(e1).not.toBeInstanceOf(Error);
const e2 = new z.ZodRealError([]);
expect(e2).toBeInstanceOf(z.ZodError);
expect(e2).toBeInstanceOf(z.ZodRealError);
expect(e2).toBeInstanceOf(Error);
});
test("disc union treeify/format", () => {
const schema = z.discriminatedUnion(
"foo",
[
z.object({
foo: z.literal("x"),
x: z.string(),
}),
z.object({
foo: z.literal("y"),
y: z.string(),
}),
],
{
error: "Invalid discriminator",
}
);
const error = schema.safeParse({ foo: "invalid" }).error;
expect(z.treeifyError(error!)).toMatchInlineSnapshot(`
{
"errors": [],
"properties": {
"foo": {
"errors": [
"Invalid discriminator",
],
},
},
}
`);
expect(z.prettifyError(error!)).toMatchInlineSnapshot(`
"✖ Invalid discriminator
→ at foo"
`);
expect(z.formatError(error!)).toMatchInlineSnapshot(`
{
"_errors": [],
"foo": {
"_errors": [
"Invalid discriminator",
],
},
}
`);
});
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"https://raw.githubusercontent.com/fb55/entities/61afd4701eaa736978b13c7351cd3de9a96b04bc/src/","sources":["index.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1 @@
{"version":3,"file":"getTokenBeforeClosingBracket.d.ts","sourceRoot":"","sources":["getTokenBeforeClosingBracket.js"],"names":[],"mappings":";AAEA;;;;GAIG;AACH,oDAHW,OAAO,GACL,KAAK,CAQjB"}
@@ -0,0 +1 @@
{"name":"lodash.isequal","version":"4.5.0","requiresBuild":false,"files":{"package.json":{"checkedAt":1794532112082,"integrity":"sha512-Si/Sl3bxsmWGxZaH9KLIVoPzfY8faUvWrfNNznrmhM7yGjlNMlFck65okZyW6gfFcPikM1fc0EGQE8cjwFGsDg==","mode":420,"size":669},"README.md":{"checkedAt":1794532112084,"integrity":"sha512-2WZUD0MlKpAkkAezK/kEv2RUe3e3rMZA9TC86UDA8T0mW1VLeARwmYZtTroSmu5k8zu8I1mGoT/xrdVf9eV+UA==","mode":420,"size":460},"LICENSE":{"checkedAt":1794532112084,"integrity":"sha512-QkqILNKCx+klUTsBmd7D3kpaSVCmTcXIPdZl3jXXonxj+iezlENhQ2kVfcVgHKe0rdFgsMn4XbLj46+k9NTs8w==","mode":420,"size":1950},"index.js":{"checkedAt":1794532112084,"integrity":"sha512-t8QH8ep/SNMht2NCiZYZXQ3bhpjwVFLccYIpWISgIdmWg8eiNjvih5D3BU0Dw+KGcZ8dFM/dSblGiXYC+Hyesg==","mode":420,"size":49598}}}
@@ -0,0 +1,80 @@
var $625ad1e1f4c43bc1$exports = require("./CalendarDate.main.js");
var $af14c9812fdceb33$exports = require("./GregorianCalendar.main.js");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "TaiwanCalendar", () => $9cc5d3577ec40243$export$65e01080afcb0799);
/*
* 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.
*/ // Portions of the code in this file are based on code from ICU.
// Original licensing can be found in the NOTICE file in the root directory of this source tree.
const $9cc5d3577ec40243$var$TAIWAN_ERA_START = 1911;
function $9cc5d3577ec40243$var$gregorianYear(date) {
return date.era === 'minguo' ? date.year + $9cc5d3577ec40243$var$TAIWAN_ERA_START : 1 - date.year + $9cc5d3577ec40243$var$TAIWAN_ERA_START;
}
function $9cc5d3577ec40243$var$gregorianToTaiwan(year) {
let y = year - $9cc5d3577ec40243$var$TAIWAN_ERA_START;
if (y > 0) return [
'minguo',
y
];
else return [
'before_minguo',
1 - y
];
}
class $9cc5d3577ec40243$export$65e01080afcb0799 extends (0, $af14c9812fdceb33$exports.GregorianCalendar) {
fromJulianDay(jd) {
let date = super.fromJulianDay(jd);
let extendedYear = (0, $af14c9812fdceb33$exports.getExtendedYear)(date.era, date.year);
let [era, year] = $9cc5d3577ec40243$var$gregorianToTaiwan(extendedYear);
return new (0, $625ad1e1f4c43bc1$exports.CalendarDate)(this, era, year, date.month, date.day);
}
toJulianDay(date) {
return super.toJulianDay($9cc5d3577ec40243$var$toGregorian(date));
}
getEras() {
return [
'before_minguo',
'minguo'
];
}
balanceDate(date) {
let [era, year] = $9cc5d3577ec40243$var$gregorianToTaiwan($9cc5d3577ec40243$var$gregorianYear(date));
date.era = era;
date.year = year;
}
isInverseEra(date) {
return date.era === 'before_minguo';
}
getDaysInMonth(date) {
return super.getDaysInMonth($9cc5d3577ec40243$var$toGregorian(date));
}
getYearsInEra(date) {
return date.era === 'before_minguo' ? 9999 : 9999 - $9cc5d3577ec40243$var$TAIWAN_ERA_START;
}
constructor(...args){
super(...args), this.identifier = 'roc' // Republic of China
;
}
}
function $9cc5d3577ec40243$var$toGregorian(date) {
let [era, year] = (0, $af14c9812fdceb33$exports.fromExtendedYear)($9cc5d3577ec40243$var$gregorianYear(date));
return new (0, $625ad1e1f4c43bc1$exports.CalendarDate)(era, year, date.month, date.day);
}
//# sourceMappingURL=TaiwanCalendar.main.js.map
@@ -0,0 +1,28 @@
[
"AGPL-1.0",
"AGPL-3.0",
"BSD-2-Clause-FreeBSD",
"BSD-2-Clause-NetBSD",
"GFDL-1.1",
"GFDL-1.2",
"GFDL-1.3",
"GPL-1.0",
"GPL-2.0",
"GPL-2.0-with-GCC-exception",
"GPL-2.0-with-autoconf-exception",
"GPL-2.0-with-bison-exception",
"GPL-2.0-with-classpath-exception",
"GPL-2.0-with-font-exception",
"GPL-3.0",
"GPL-3.0-with-GCC-exception",
"GPL-3.0-with-autoconf-exception",
"LGPL-2.0",
"LGPL-2.1",
"LGPL-3.0",
"Net-SNMP",
"Nunit",
"StandardML-NJ",
"bzip2-1.0.5",
"eCos-2.0",
"wxWindows"
]
@@ -0,0 +1,23 @@
'use strict';Object.defineProperty(exports, "__esModule", { value: true });exports.
getFilePackagePath = getFilePackagePath;exports.
getContextPackagePath = getContextPackagePath;exports.
getFilePackageName = getFilePackageName;var _path = require('path');var _contextCompat = require('eslint-module-utils/contextCompat');var _pkgUp = require('eslint-module-utils/pkgUp');var _pkgUp2 = _interopRequireDefault(_pkgUp);var _readPkgUp2 = require('eslint-module-utils/readPkgUp');var _readPkgUp3 = _interopRequireDefault(_readPkgUp2);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };}function getFilePackagePath(filePath) {var fp = (0, _pkgUp2['default'])({ cwd: filePath });return (0, _path.dirname)(fp);}function getContextPackagePath(context) {return getFilePackagePath((0, _contextCompat.getPhysicalFilename)(context));}function getFilePackageName(filePath) {var _readPkgUp =
(0, _readPkgUp3['default'])({ cwd: filePath, normalize: false }),pkg = _readPkgUp.pkg,path = _readPkgUp.path;
if (pkg) {
// recursion in case of intermediate esm package.json without name found
return pkg.name || getFilePackageName((0, _path.dirname)((0, _path.dirname)(path)));
}
return null;
}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb3JlL3BhY2thZ2VQYXRoLmpzIl0sIm5hbWVzIjpbImdldEZpbGVQYWNrYWdlUGF0aCIsImdldENvbnRleHRQYWNrYWdlUGF0aCIsImdldEZpbGVQYWNrYWdlTmFtZSIsImZpbGVQYXRoIiwiZnAiLCJjd2QiLCJjb250ZXh0Iiwibm9ybWFsaXplIiwicGtnIiwicGF0aCIsIm5hbWUiXSwibWFwcGluZ3MiOiI7Ozs7O0FBS2dCQSxrQixHQUFBQSxrQjs7Ozs7QUFLQUMscUIsR0FBQUEscUI7Ozs7QUFJQUMsa0IsR0FBQUEsa0IsQ0FkaEIsNEJBQ0Esa0VBQ0Esa0QsNkNBQ0EsMkQscUpBRU8sU0FBU0Ysa0JBQVQsQ0FBNEJHLFFBQTVCLEVBQXNDLENBQzNDLElBQU1DLEtBQUssd0JBQU0sRUFBRUMsS0FBS0YsUUFBUCxFQUFOLENBQVgsQ0FDQSxPQUFPLG1CQUFRQyxFQUFSLENBQVAsQ0FDRCxDQUVNLFNBQVNILHFCQUFULENBQStCSyxPQUEvQixFQUF3QyxDQUM3QyxPQUFPTixtQkFBbUIsd0NBQW9CTSxPQUFwQixDQUFuQixDQUFQLENBQ0QsQ0FFTSxTQUFTSixrQkFBVCxDQUE0QkMsUUFBNUIsRUFBc0M7QUFDckIsOEJBQVUsRUFBRUUsS0FBS0YsUUFBUCxFQUFpQkksV0FBVyxLQUE1QixFQUFWLENBRHFCLENBQ25DQyxHQURtQyxjQUNuQ0EsR0FEbUMsQ0FDOUJDLElBRDhCLGNBQzlCQSxJQUQ4QjtBQUUzQyxNQUFJRCxHQUFKLEVBQVM7QUFDUDtBQUNBLFdBQU9BLElBQUlFLElBQUosSUFBWVIsbUJBQW1CLG1CQUFRLG1CQUFRTyxJQUFSLENBQVIsQ0FBbkIsQ0FBbkI7QUFDRDtBQUNELFNBQU8sSUFBUDtBQUNEIiwiZmlsZSI6InBhY2thZ2VQYXRoLmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgZGlybmFtZSB9IGZyb20gJ3BhdGgnO1xuaW1wb3J0IHsgZ2V0UGh5c2ljYWxGaWxlbmFtZSB9IGZyb20gJ2VzbGludC1tb2R1bGUtdXRpbHMvY29udGV4dENvbXBhdCc7XG5pbXBvcnQgcGtnVXAgZnJvbSAnZXNsaW50LW1vZHVsZS11dGlscy9wa2dVcCc7XG5pbXBvcnQgcmVhZFBrZ1VwIGZyb20gJ2VzbGludC1tb2R1bGUtdXRpbHMvcmVhZFBrZ1VwJztcblxuZXhwb3J0IGZ1bmN0aW9uIGdldEZpbGVQYWNrYWdlUGF0aChmaWxlUGF0aCkge1xuICBjb25zdCBmcCA9IHBrZ1VwKHsgY3dkOiBmaWxlUGF0aCB9KTtcbiAgcmV0dXJuIGRpcm5hbWUoZnApO1xufVxuXG5leHBvcnQgZnVuY3Rpb24gZ2V0Q29udGV4dFBhY2thZ2VQYXRoKGNvbnRleHQpIHtcbiAgcmV0dXJuIGdldEZpbGVQYWNrYWdlUGF0aChnZXRQaHlzaWNhbEZpbGVuYW1lKGNvbnRleHQpKTtcbn1cblxuZXhwb3J0IGZ1bmN0aW9uIGdldEZpbGVQYWNrYWdlTmFtZShmaWxlUGF0aCkge1xuICBjb25zdCB7IHBrZywgcGF0aCB9ID0gcmVhZFBrZ1VwKHsgY3dkOiBmaWxlUGF0aCwgbm9ybWFsaXplOiBmYWxzZSB9KTtcbiAgaWYgKHBrZykge1xuICAgIC8vIHJlY3Vyc2lvbiBpbiBjYXNlIG9mIGludGVybWVkaWF0ZSBlc20gcGFja2FnZS5qc29uIHdpdGhvdXQgbmFtZSBmb3VuZFxuICAgIHJldHVybiBwa2cubmFtZSB8fCBnZXRGaWxlUGFja2FnZU5hbWUoZGlybmFtZShkaXJuYW1lKHBhdGgpKSk7XG4gIH1cbiAgcmV0dXJuIG51bGw7XG59XG4iXX0=
@@ -0,0 +1,5 @@
var convert = require('./convert'),
func = convert('upperFirst', require('../upperFirst'), require('./_falseOptions'));
func.placeholder = require('./placeholder');
module.exports = func;
@@ -0,0 +1,58 @@
1.3.3 / 2019-04-15
==================
* Fix Node.js 0.8 return value inconsistencies
1.3.2 / 2017-09-09
==================
* perf: reduce overhead for full URLs
* perf: unroll the "fast-path" `RegExp`
1.3.1 / 2016-01-17
==================
* perf: enable strict mode
1.3.0 / 2014-08-09
==================
* Add `parseurl.original` for parsing `req.originalUrl` with fallback
* Return `undefined` if `req.url` is `undefined`
1.2.0 / 2014-07-21
==================
* Cache URLs based on original value
* Remove no-longer-needed URL mis-parse work-around
* Simplify the "fast-path" `RegExp`
1.1.3 / 2014-07-08
==================
* Fix typo
1.1.2 / 2014-07-08
==================
* Seriously fix Node.js 0.8 compatibility
1.1.1 / 2014-07-08
==================
* Fix Node.js 0.8 compatibility
1.1.0 / 2014-07-08
==================
* Incorporate URL href-only parse fast-path
1.0.1 / 2014-03-08
==================
* Add missing `require`
1.0.0 / 2014-03-08
==================
* Genesis from `connect`
@@ -0,0 +1 @@
{"version":3,"file":"theme.js","names":["Theme","DEFAULTS","modules","themes","default","constructor","quill","options","init","Object","keys","forEach","name","addModule","ModuleClass","import"],"sources":["../../src/core/theme.ts"],"sourcesContent":["import type Quill from '../core.js';\nimport type Clipboard from '../modules/clipboard.js';\nimport type History from '../modules/history.js';\nimport type Keyboard from '../modules/keyboard.js';\nimport type { ToolbarProps } from '../modules/toolbar.js';\nimport type Uploader from '../modules/uploader.js';\n\nexport interface ThemeOptions {\n modules: Record<string, unknown> & {\n toolbar?: null | ToolbarProps;\n };\n}\n\nclass Theme {\n static DEFAULTS: ThemeOptions = {\n modules: {},\n };\n\n static themes = {\n default: Theme,\n };\n\n modules: ThemeOptions['modules'] = {};\n\n constructor(\n protected quill: Quill,\n protected options: ThemeOptions,\n ) {}\n\n init() {\n Object.keys(this.options.modules).forEach((name) => {\n if (this.modules[name] == null) {\n this.addModule(name);\n }\n });\n }\n\n addModule(name: 'clipboard'): Clipboard;\n addModule(name: 'keyboard'): Keyboard;\n addModule(name: 'uploader'): Uploader;\n addModule(name: 'history'): History;\n addModule(name: string): unknown;\n addModule(name: string) {\n // @ts-expect-error\n const ModuleClass = this.quill.constructor.import(`modules/${name}`);\n this.modules[name] = new ModuleClass(\n this.quill,\n this.options.modules[name] || {},\n );\n return this.modules[name];\n }\n}\n\nexport interface ThemeConstructor {\n new (quill: Quill, options: unknown): Theme;\n DEFAULTS: ThemeOptions;\n}\n\nexport default Theme;\n"],"mappings":"AAaA,MAAMA,KAAK,CAAC;EACV,OAAOC,QAAQ,GAAiB;IAC9BC,OAAO,EAAE,CAAC;EACZ,CAAC;EAED,OAAOC,MAAM,GAAG;IACdC,OAAO,EAAEJ;EACX,CAAC;EAEDE,OAAO,GAA4B,CAAC,CAAC;EAErCG,WAAWA,CACCC,KAAY,EACZC,OAAqB,EAC/B;IAAA,KAFUD,KAAY,GAAZA,KAAY;IAAA,KACZC,OAAqB,GAArBA,OAAqB;EAC9B;EAEHC,IAAIA,CAAA,EAAG;IACLC,MAAM,CAACC,IAAI,CAAC,IAAI,CAACH,OAAO,CAACL,OAAO,CAAC,CAACS,OAAO,CAAEC,IAAI,IAAK;MAClD,IAAI,IAAI,CAACV,OAAO,CAACU,IAAI,CAAC,IAAI,IAAI,EAAE;QAC9B,IAAI,CAACC,SAAS,CAACD,IAAI,CAAC;MACtB;IACF,CAAC,CAAC;EACJ;EAOAC,SAASA,CAACD,IAAY,EAAE;IACtB;IACA,MAAME,WAAW,GAAG,IAAI,CAACR,KAAK,CAACD,WAAW,CAACU,MAAM,CAAE,WAAUH,IAAK,EAAC,CAAC;IACpE,IAAI,CAACV,OAAO,CAACU,IAAI,CAAC,GAAG,IAAIE,WAAW,CAClC,IAAI,CAACR,KAAK,EACV,IAAI,CAACC,OAAO,CAACL,OAAO,CAACU,IAAI,CAAC,IAAI,CAAC,CACjC,CAAC;IACD,OAAO,IAAI,CAACV,OAAO,CAACU,IAAI,CAAC;EAC3B;AACF;AAOA,eAAeZ,KAAK","ignoreList":[]}
@@ -0,0 +1,41 @@
import { MutableRefObject } from 'react';
type IfEquals<X, Y, A=X, B=never> =
(<T>() => T extends X ? 1 : 2) extends
(<T>() => T extends Y ? 1 : 2) ? A : B;
type WritableKeys<T> = {
[P in keyof T]-?: IfEquals<{ [Q in P]: T[P] }, { -readonly [Q in P]: T[P] }, P>
}[keyof T];
export const websocketWrapper = (
webSocket: WebSocket,
start: MutableRefObject<() => void>,
): WebSocket => {
return new Proxy<WebSocket>(webSocket, {
get: (obj, key: keyof WebSocket) => {
const val = obj[key];
if ((key as any) === 'reconnect') return start;
if (typeof val === 'function') {
console.error('Calling methods directly on the websocket is not supported at this moment. You must use the methods returned by useWebSocket.');
//Prevent error thrown by invoking a non-function
return () => {};
} else {
return val;
}
},
set: <T extends WritableKeys<WebSocket>>(obj: WebSocket, key: T, val: WebSocket[T]) => {
if (/^on/.test(key)) {
console.warn('The websocket\'s event handlers should be defined through the options object passed into useWebSocket.')
return false;
} else {
obj[key] = val;
return true;
}
},
});
};
export default websocketWrapper;
@@ -0,0 +1,18 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./guard"), exports);
@@ -0,0 +1 @@
{"version":3,"file":"GetMultipleServicePlanOptions.js","sourceRoot":"","sources":["../../../../src/planning/models/GetMultipleServicePlanOptions.ts"],"names":[],"mappings":""}
@@ -0,0 +1,91 @@
import {useLayoutEffect as $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c} from "./useLayoutEffect.mjs";
import {flushSync as $jJMAe$flushSync} from "react-dom";
import {useState as $jJMAe$useState, useCallback as $jJMAe$useCallback} from "react";
/*
* 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.
*/
function $d3f049242431219c$export$6d3443f2c48bfc20(ref, isReady = true) {
let [isEntering, setEntering] = (0, $jJMAe$useState)(true);
let isAnimationReady = isEntering && isReady;
// There are two cases for entry animations:
// 1. CSS @keyframes. The `animation` property is set during the isEntering state, and it is removed after the animation finishes.
// 2. CSS transitions. The initial styles are applied during the isEntering state, and removed immediately, causing the transition to occur.
//
// In the second case, cancel any transitions that were triggered prior to the isEntering = false state (when the transition is supposed to start).
// This can happen when isReady starts as false (e.g. popovers prior to placement calculation).
(0, $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c)(()=>{
if (isAnimationReady && ref.current && 'getAnimations' in ref.current) {
for (let animation of ref.current.getAnimations())if (animation instanceof CSSTransition) animation.cancel();
}
}, [
ref,
isAnimationReady
]);
$d3f049242431219c$var$useAnimation(ref, isAnimationReady, (0, $jJMAe$useCallback)(()=>setEntering(false), []));
return isAnimationReady;
}
function $d3f049242431219c$export$45fda7c47f93fd48(ref, isOpen) {
let [exitState, setExitState] = (0, $jJMAe$useState)(isOpen ? 'open' : 'closed');
switch(exitState){
case 'open':
// If isOpen becomes false, set the state to exiting.
if (!isOpen) setExitState('exiting');
break;
case 'closed':
case 'exiting':
// If we are exiting and isOpen becomes true, the animation was interrupted.
// Reset the state to open.
if (isOpen) setExitState('open');
break;
}
let isExiting = exitState === 'exiting';
$d3f049242431219c$var$useAnimation(ref, isExiting, (0, $jJMAe$useCallback)(()=>{
// Set the state to closed, which will cause the element to be unmounted.
setExitState((state)=>state === 'exiting' ? 'closed' : state);
}, []));
return isExiting;
}
function $d3f049242431219c$var$useAnimation(ref, isActive, onEnd) {
(0, $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c)(()=>{
if (isActive && ref.current) {
if (!('getAnimations' in ref.current)) {
// JSDOM
onEnd();
return;
}
let animations = ref.current.getAnimations();
if (animations.length === 0) {
onEnd();
return;
}
let canceled = false;
Promise.all(animations.map((a)=>a.finished)).then(()=>{
if (!canceled) (0, $jJMAe$flushSync)(()=>{
onEnd();
});
}).catch(()=>{});
return ()=>{
canceled = true;
};
}
}, [
ref,
isActive,
onEnd
]);
}
export {$d3f049242431219c$export$6d3443f2c48bfc20 as useEnterAnimation, $d3f049242431219c$export$45fda7c47f93fd48 as useExitAnimation};
//# sourceMappingURL=animation.module.js.map
@@ -0,0 +1,83 @@
// import type { StandardSchemaV1 } from "@standard-schema/spec";
// @ts-ignore TS6133
import { expect, test } from "vitest";
import * as z from "zod/v3";
import { util } from "../helpers/util.js";
import type { StandardSchemaV1 } from "../standard-schema.js";
test("assignability", () => {
const _s1: StandardSchemaV1 = z.string();
const _s2: StandardSchemaV1<string> = z.string();
const _s3: StandardSchemaV1<string, string> = z.string();
const _s4: StandardSchemaV1<unknown, string> = z.string();
[_s1, _s2, _s3, _s4];
});
test("type inference", () => {
const stringToNumber = z.string().transform((x) => x.length);
type input = StandardSchemaV1.InferInput<typeof stringToNumber>;
util.assertEqual<input, string>(true);
type output = StandardSchemaV1.InferOutput<typeof stringToNumber>;
util.assertEqual<output, number>(true);
});
test("valid parse", () => {
const schema = z.string();
const result = schema["~standard"].validate("hello");
if (result instanceof Promise) {
throw new Error("Expected sync result");
}
expect(result.issues).toEqual(undefined);
if (result.issues) {
throw new Error("Expected no issues");
} else {
expect(result.value).toEqual("hello");
}
});
test("invalid parse", () => {
const schema = z.string();
const result = schema["~standard"].validate(1234);
if (result instanceof Promise) {
throw new Error("Expected sync result");
}
expect(result.issues).toBeDefined();
if (!result.issues) {
throw new Error("Expected issues");
}
expect(result.issues.length).toEqual(1);
expect(result.issues[0].path).toEqual([]);
});
test("valid parse async", async () => {
const schema = z.string().refine(async () => true);
const _result = schema["~standard"].validate("hello");
if (_result instanceof Promise) {
const result = await _result;
expect(result.issues).toEqual(undefined);
if (result.issues) {
throw new Error("Expected no issues");
} else {
expect(result.value).toEqual("hello");
}
} else {
throw new Error("Expected async result");
}
});
test("invalid parse async", async () => {
const schema = z.string().refine(async () => false);
const _result = schema["~standard"].validate("hello");
if (_result instanceof Promise) {
const result = await _result;
expect(result.issues).toBeDefined();
if (!result.issues) {
throw new Error("Expected issues");
}
expect(result.issues.length).toEqual(1);
expect(result.issues[0].path).toEqual([]);
} else {
throw new Error("Expected async result");
}
});
@@ -0,0 +1,50 @@
# Security Policy
The most up-to-date version of this document can be found at <https://github.com/xmldom/xmldom/security/policy>.
## Supported Versions
This repository contains the code for the libraries `xmldom` and `@xmldom/xmldom` on npm.
As long as we didn't publish v1, we aim to maintain the last two minor versions with security fixes. If it is possible we provide security fixes as path versions.
If you think there is a good reason to also patch an earlier version let us know in a github issue or the release discussion once the fix has been provided.
The maintainers will consider it and if we agree and have/find the required resources, a patch for that version will be provided.
Please notice that [we are no longer able to publish the (unscoped) `xmldom` package](https://github.com/xmldom/xmldom/issues/271),
and that all existing versions of `xmldom` are affected by at least one security vulnerability and should be considered deprecated.
You can still report issues regarding `xmldom` as described below.
If you need help with migrating from `xmldom` to `@xmldom/xmldom`, file a github issue or PR in the affected repository and mention @karfau.
## Reporting vulnerabilities
Please email reports about any security related issues you find to `security@xmldom.org`, which will forward it to the list of maintainers.
The maintainers will try to respond within 7 calendar days. (If nobody peplies after 7 days, please us send a reminder!)
As part of you communication please make sure to always hit "Reply all", so all maintainers are kept in the loop.
In addition, please include the following information along with your report:
- Your name and affiliation (if any).
- A description of the technical details of the vulnerabilities. It is very important to let us know how we can reproduce your findings.
- An explanation who can exploit this vulnerability, and what they gain when doing so -- write an attack scenario. This will help us evaluate your report quickly, especially if the issue is complex.
- Whether this vulnerability public or known to third parties. If it is, please provide details.
If you believe that an existing (public) issue is security-related, please send an email to `security@xmldom.org`.
The email should include the issue URL and a short description of why it should be handled according to this security policy.
Once an issue is reported, the maintainers use the following disclosure process:
- When a report is received, we confirm the issue, determine its severity and the affected versions.
- If we know of specific third-party services or software based on xmldom that require mitigation before publication, those projects will be notified.
- A [github security advisory](https://docs.github.com/en/code-security/security-advisories/about-github-security-advisories) is [created](https://docs.github.com/en/code-security/security-advisories/creating-a-security-advisory) (but not published) which details the problem and steps for mitigation.
- If the reporter provides a github account and agrees to it, we (add that github account as a collaborator on the advisuory)[https://docs.github.com/en/code-security/security-advisories/adding-a-collaborator-to-a-security-advisory].
- The vulnerability is fixed in a [private fork](https://docs.github.com/en/code-security/security-advisories/collaborating-in-a-temporary-private-fork-to-resolve-a-security-vulnerability) and potential workarounds are identified.
- The maintainers audit the existing code to find any potential similar problems.
- The release for the current minor version and the [security advisory are published](https://docs.github.com/en/code-security/security-advisories/publishing-a-security-advisory).
- The release(s) for previous minor version(s) are published.
We credit reporters for identifying security issues, if they confirm that they want to.
## Known vulnerabilities
See https://github.com/xmldom/xmldom/security/advisories?state=published
@@ -0,0 +1 @@
{"mappings":"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","sources":["packages/@react-aria/slider/src/useSlider.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\nimport {AriaSliderProps} from '@react-types/slider';\nimport {clamp, mergeProps, useGlobalListeners} from '@react-aria/utils';\nimport {DOMAttributes, RefObject} from '@react-types/shared';\nimport {getSliderThumbId, sliderData} from './utils';\nimport React, {LabelHTMLAttributes, OutputHTMLAttributes, useRef} from 'react';\nimport {setInteraLine truncated
@@ -0,0 +1,365 @@
/**
* @fileoverview disallow assignments that can lead to race conditions due to usage of `await` or `yield`
* @author Teddy Katz
* @author Toru Nagashima
*/
"use strict";
/**
* Make the map from identifiers to each reference.
* @param {escope.Scope} scope The scope to get references.
* @param {Map<Identifier, escope.Reference>} [outReferenceMap] The map from identifier nodes to each reference object.
* @returns {Map<Identifier, escope.Reference>} `referenceMap`.
*/
function createReferenceMap(scope, outReferenceMap = new Map()) {
for (const reference of scope.references) {
if (reference.resolved === null) {
continue;
}
outReferenceMap.set(reference.identifier, reference);
}
for (const childScope of scope.childScopes) {
if (childScope.type !== "function") {
createReferenceMap(childScope, outReferenceMap);
}
}
return outReferenceMap;
}
/**
* Get `reference.writeExpr` of a given reference.
* If it's the read reference of MemberExpression in LHS, returns RHS in order to address `a.b = await a`
* @param {escope.Reference} reference The reference to get.
* @returns {Expression|null} The `reference.writeExpr`.
*/
function getWriteExpr(reference) {
if (reference.writeExpr) {
return reference.writeExpr;
}
let node = reference.identifier;
while (node) {
const t = node.parent.type;
if (t === "AssignmentExpression" && node.parent.left === node) {
return node.parent.right;
}
if (t === "MemberExpression" && node.parent.object === node) {
node = node.parent;
continue;
}
break;
}
return null;
}
/**
* Checks if an expression is a variable that can only be observed within the given function.
* @param {Variable|null} variable The variable to check
* @param {boolean} isMemberAccess If `true` then this is a member access.
* @returns {boolean} `true` if the variable is local to the given function, and is never referenced in a closure.
*/
function isLocalVariableWithoutEscape(variable, isMemberAccess) {
if (!variable) {
return false; // A global variable which was not defined.
}
// If the reference is a property access and the variable is a parameter, it handles the variable is not local.
if (isMemberAccess && variable.defs.some(d => d.type === "Parameter")) {
return false;
}
const functionScope = variable.scope.variableScope;
return variable.references.every(
reference => reference.from.variableScope === functionScope,
);
}
/**
* Represents segment information.
*/
class SegmentInfo {
constructor() {
this.info = new WeakMap();
}
/**
* Initialize the segment information.
* @param {PathSegment} segment The segment to initialize.
* @returns {void}
*/
initialize(segment) {
const outdatedReadVariables = new Set();
const freshReadVariables = new Set();
for (const prevSegment of segment.prevSegments) {
const info = this.info.get(prevSegment);
if (info) {
info.outdatedReadVariables.forEach(
Set.prototype.add,
outdatedReadVariables,
);
info.freshReadVariables.forEach(
Set.prototype.add,
freshReadVariables,
);
}
}
this.info.set(segment, { outdatedReadVariables, freshReadVariables });
}
/**
* Mark a given variable as read on given segments.
* @param {PathSegment[]} segments The segments that it read the variable on.
* @param {Variable} variable The variable to be read.
* @returns {void}
*/
markAsRead(segments, variable) {
for (const segment of segments) {
const info = this.info.get(segment);
if (info) {
info.freshReadVariables.add(variable);
// If a variable is freshly read again, then it's no more out-dated.
info.outdatedReadVariables.delete(variable);
}
}
}
/**
* Move `freshReadVariables` to `outdatedReadVariables`.
* @param {PathSegment[]} segments The segments to process.
* @returns {void}
*/
makeOutdated(segments) {
for (const segment of segments) {
const info = this.info.get(segment);
if (info) {
info.freshReadVariables.forEach(
Set.prototype.add,
info.outdatedReadVariables,
);
info.freshReadVariables.clear();
}
}
}
/**
* Check if a given variable is outdated on the current segments.
* @param {PathSegment[]} segments The current segments.
* @param {Variable} variable The variable to check.
* @returns {boolean} `true` if the variable is outdated on the segments.
*/
isOutdated(segments, variable) {
for (const segment of segments) {
const info = this.info.get(segment);
if (info && info.outdatedReadVariables.has(variable)) {
return true;
}
}
return false;
}
}
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
type: "problem",
defaultOptions: [
{
allowProperties: false,
},
],
docs: {
description:
"Disallow assignments that can lead to race conditions due to usage of `await` or `yield`",
recommended: false,
url: "https://eslint.org/docs/latest/rules/require-atomic-updates",
},
fixable: null,
schema: [
{
type: "object",
properties: {
allowProperties: {
type: "boolean",
},
},
additionalProperties: false,
},
],
messages: {
nonAtomicUpdate:
"Possible race condition: `{{value}}` might be reassigned based on an outdated value of `{{value}}`.",
nonAtomicObjectUpdate:
"Possible race condition: `{{value}}` might be assigned based on an outdated state of `{{object}}`.",
},
},
create(context) {
const [{ allowProperties }] = context.options;
const sourceCode = context.sourceCode;
const assignmentReferences = new Map();
const segmentInfo = new SegmentInfo();
let stack = null;
return {
onCodePathStart(codePath, node) {
const scope = sourceCode.getScope(node);
const shouldVerify =
scope.type === "function" &&
(scope.block.async || scope.block.generator);
stack = {
upper: stack,
codePath,
referenceMap: shouldVerify
? createReferenceMap(scope)
: null,
currentSegments: new Set(),
};
},
onCodePathEnd() {
stack = stack.upper;
},
// Initialize the segment information.
onCodePathSegmentStart(segment) {
segmentInfo.initialize(segment);
stack.currentSegments.add(segment);
},
onUnreachableCodePathSegmentStart(segment) {
stack.currentSegments.add(segment);
},
onUnreachableCodePathSegmentEnd(segment) {
stack.currentSegments.delete(segment);
},
onCodePathSegmentEnd(segment) {
stack.currentSegments.delete(segment);
},
// Handle references to prepare verification.
Identifier(node) {
const { referenceMap } = stack;
const reference = referenceMap && referenceMap.get(node);
// Ignore if this is not a valid variable reference.
if (!reference) {
return;
}
const variable = reference.resolved;
const writeExpr = getWriteExpr(reference);
const isMemberAccess =
reference.identifier.parent.type === "MemberExpression";
// Add a fresh read variable.
if (
reference.isRead() &&
!(writeExpr && writeExpr.parent.operator === "=")
) {
segmentInfo.markAsRead(stack.currentSegments, variable);
}
/*
* Register the variable to verify after ESLint traversed the `writeExpr` node
* if this reference is an assignment to a variable which is referred from other closure.
*/
if (
writeExpr &&
writeExpr.parent.right === writeExpr && // ← exclude variable declarations.
!isLocalVariableWithoutEscape(variable, isMemberAccess)
) {
let refs = assignmentReferences.get(writeExpr);
if (!refs) {
refs = [];
assignmentReferences.set(writeExpr, refs);
}
refs.push(reference);
}
},
/*
* Verify assignments.
* If the reference exists in `outdatedReadVariables` list, report it.
*/
":expression:exit"(node) {
// referenceMap exists if this is in a resumable function scope.
if (!stack.referenceMap) {
return;
}
// Mark the read variables on this code path as outdated.
if (
node.type === "AwaitExpression" ||
node.type === "YieldExpression"
) {
segmentInfo.makeOutdated(stack.currentSegments);
}
// Verify.
const references = assignmentReferences.get(node);
if (references) {
assignmentReferences.delete(node);
for (const reference of references) {
const variable = reference.resolved;
if (
segmentInfo.isOutdated(
stack.currentSegments,
variable,
)
) {
if (node.parent.left === reference.identifier) {
context.report({
node: node.parent,
messageId: "nonAtomicUpdate",
data: {
value: variable.name,
},
});
} else if (!allowProperties) {
context.report({
node: node.parent,
messageId: "nonAtomicObjectUpdate",
data: {
value: sourceCode.getText(
node.parent.left,
),
object: variable.name,
},
});
}
}
}
}
},
};
},
};
@@ -0,0 +1,11 @@
Copyright 2008 Fair Oaks Labs, Inc.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,362 @@
import { animateVisualElement } from '../../animation/interfaces/visual-element.mjs';
import { calcChildStagger } from '../../animation/utils/calc-child-stagger.mjs';
import { isAnimationControls } from '../../animation/utils/is-animation-controls.mjs';
import { isKeyframesTarget } from '../../animation/utils/is-keyframes-target.mjs';
import { shallowCompare } from '../../utils/shallow-compare.mjs';
import { getVariantContext } from './get-variant-context.mjs';
import { isVariantLabel } from './is-variant-label.mjs';
import { resolveVariant } from './resolve-dynamic-variants.mjs';
import { variantPriorityOrder } from './variant-props.mjs';
const reversePriorityOrder = [...variantPriorityOrder].reverse();
const numAnimationTypes = variantPriorityOrder.length;
function animateList(visualElement) {
return (animations) => Promise.all(animations.map(({ animation, options }) => animateVisualElement(visualElement, animation, options)));
}
function createAnimationState(visualElement) {
let animate = animateList(visualElement);
let state = createState();
let isInitialRender = true;
/**
* This function will be used to reduce the animation definitions for
* each active animation type into an object of resolved values for it.
*/
const buildResolvedTypeValues = (type) => (acc, definition) => {
const resolved = resolveVariant(visualElement, definition, type === "exit"
? visualElement.presenceContext?.custom
: undefined);
if (resolved) {
const { transition, transitionEnd, ...target } = resolved;
acc = { ...acc, ...target, ...transitionEnd };
}
return acc;
};
/**
* This just allows us to inject mocked animation functions
* @internal
*/
function setAnimateFunction(makeAnimator) {
animate = makeAnimator(visualElement);
}
/**
* When we receive new props, we need to:
* 1. Create a list of protected keys for each type. This is a directory of
* value keys that are currently being "handled" by types of a higher priority
* so that whenever an animation is played of a given type, these values are
* protected from being animated.
* 2. Determine if an animation type needs animating.
* 3. Determine if any values have been removed from a type and figure out
* what to animate those to.
*/
function animateChanges(changedActiveType) {
const { props } = visualElement;
const context = getVariantContext(visualElement.parent) || {};
/**
* A list of animations that we'll build into as we iterate through the animation
* types. This will get executed at the end of the function.
*/
const animations = [];
/**
* Keep track of which values have been removed. Then, as we hit lower priority
* animation types, we can check if they contain removed values and animate to that.
*/
const removedKeys = new Set();
/**
* A dictionary of all encountered keys. This is an object to let us build into and
* copy it without iteration. Each time we hit an animation type we set its protected
* keys - the keys its not allowed to animate - to the latest version of this object.
*/
let encounteredKeys = {};
/**
* If a variant has been removed at a given index, and this component is controlling
* variant animations, we want to ensure lower-priority variants are forced to animate.
*/
let removedVariantIndex = Infinity;
/**
* Iterate through all animation types in reverse priority order. For each, we want to
* detect which values it's handling and whether or not they've changed (and therefore
* need to be animated). If any values have been removed, we want to detect those in
* lower priority props and flag for animation.
*/
for (let i = 0; i < numAnimationTypes; i++) {
const type = reversePriorityOrder[i];
const typeState = state[type];
const prop = props[type] !== undefined
? props[type]
: context[type];
const propIsVariant = isVariantLabel(prop);
/**
* If this type has *just* changed isActive status, set activeDelta
* to that status. Otherwise set to null.
*/
const activeDelta = type === changedActiveType ? typeState.isActive : null;
if (activeDelta === false)
removedVariantIndex = i;
/**
* If this prop is an inherited variant, rather than been set directly on the
* component itself, we want to make sure we allow the parent to trigger animations.
*
* TODO: Can probably change this to a !isControllingVariants check
*/
let isInherited = prop === context[type] &&
prop !== props[type] &&
propIsVariant;
if (isInherited &&
isInitialRender &&
visualElement.manuallyAnimateOnMount) {
isInherited = false;
}
/**
* Set all encountered keys so far as the protected keys for this type. This will
* be any key that has been animated or otherwise handled by active, higher-priortiy types.
*/
typeState.protectedKeys = { ...encounteredKeys };
// Check if we can skip analysing this prop early
if (
// If it isn't active and hasn't *just* been set as inactive
(!typeState.isActive && activeDelta === null) ||
// If we didn't and don't have any defined prop for this animation type
(!prop && !typeState.prevProp) ||
// Or if the prop doesn't define an animation
isAnimationControls(prop) ||
typeof prop === "boolean") {
continue;
}
/**
* As we go look through the values defined on this type, if we detect
* a changed value or a value that was removed in a higher priority, we set
* this to true and add this prop to the animation list.
*/
const variantDidChange = checkVariantsDidChange(typeState.prevProp, prop);
let shouldAnimateType = variantDidChange ||
// If we're making this variant active, we want to always make it active
(type === changedActiveType &&
typeState.isActive &&
!isInherited &&
propIsVariant) ||
// If we removed a higher-priority variant (i is in reverse order)
(i > removedVariantIndex && propIsVariant);
let handledRemovedValues = false;
/**
* As animations can be set as variant lists, variants or target objects, we
* coerce everything to an array if it isn't one already
*/
const definitionList = Array.isArray(prop) ? prop : [prop];
/**
* Build an object of all the resolved values. We'll use this in the subsequent
* animateChanges calls to determine whether a value has changed.
*/
let resolvedValues = definitionList.reduce(buildResolvedTypeValues(type), {});
if (activeDelta === false)
resolvedValues = {};
/**
* Now we need to loop through all the keys in the prev prop and this prop,
* and decide:
* 1. If the value has changed, and needs animating
* 2. If it has been removed, and needs adding to the removedKeys set
* 3. If it has been removed in a higher priority type and needs animating
* 4. If it hasn't been removed in a higher priority but hasn't changed, and
* needs adding to the type's protectedKeys list.
*/
const { prevResolvedValues = {} } = typeState;
const allKeys = {
...prevResolvedValues,
...resolvedValues,
};
const markToAnimate = (key) => {
shouldAnimateType = true;
if (removedKeys.has(key)) {
handledRemovedValues = true;
removedKeys.delete(key);
}
typeState.needsAnimating[key] = true;
const motionValue = visualElement.getValue(key);
if (motionValue)
motionValue.liveStyle = false;
};
for (const key in allKeys) {
const next = resolvedValues[key];
const prev = prevResolvedValues[key];
// If we've already handled this we can just skip ahead
if (encounteredKeys.hasOwnProperty(key))
continue;
/**
* If the value has changed, we probably want to animate it.
*/
let valueHasChanged = false;
if (isKeyframesTarget(next) && isKeyframesTarget(prev)) {
valueHasChanged = !shallowCompare(next, prev);
}
else {
valueHasChanged = next !== prev;
}
if (valueHasChanged) {
if (next !== undefined && next !== null) {
// If next is defined and doesn't equal prev, it needs animating
markToAnimate(key);
}
else {
// If it's undefined, it's been removed.
removedKeys.add(key);
}
}
else if (next !== undefined && removedKeys.has(key)) {
/**
* If next hasn't changed and it isn't undefined, we want to check if it's
* been removed by a higher priority
*/
markToAnimate(key);
}
else {
/**
* If it hasn't changed, we add it to the list of protected values
* to ensure it doesn't get animated.
*/
typeState.protectedKeys[key] = true;
}
}
/**
* Update the typeState so next time animateChanges is called we can compare the
* latest prop and resolvedValues to these.
*/
typeState.prevProp = prop;
typeState.prevResolvedValues = resolvedValues;
if (typeState.isActive) {
encounteredKeys = { ...encounteredKeys, ...resolvedValues };
}
if (isInitialRender && visualElement.blockInitialAnimation) {
shouldAnimateType = false;
}
/**
* If this is an inherited prop we want to skip this animation
* unless the inherited variants haven't changed on this render.
*/
const willAnimateViaParent = isInherited && variantDidChange;
const needsAnimating = !willAnimateViaParent || handledRemovedValues;
if (shouldAnimateType && needsAnimating) {
animations.push(...definitionList.map((animation) => {
const options = { type };
/**
* If we're performing the initial animation, but we're not
* rendering at the same time as the variant-controlling parent,
* we want to use the parent's transition to calculate the stagger.
*/
if (typeof animation === "string" &&
isInitialRender &&
!willAnimateViaParent &&
visualElement.manuallyAnimateOnMount &&
visualElement.parent) {
const { parent } = visualElement;
const parentVariant = resolveVariant(parent, animation);
if (parent.enteringChildren && parentVariant) {
const { delayChildren } = parentVariant.transition || {};
options.delay = calcChildStagger(parent.enteringChildren, visualElement, delayChildren);
}
}
return {
animation: animation,
options,
};
}));
}
}
/**
* If there are some removed value that haven't been dealt with,
* we need to create a new animation that falls back either to the value
* defined in the style prop, or the last read value.
*/
if (removedKeys.size) {
const fallbackAnimation = {};
/**
* If the initial prop contains a transition we can use that, otherwise
* allow the animation function to use the visual element's default.
*/
if (typeof props.initial !== "boolean") {
const initialTransition = resolveVariant(visualElement, Array.isArray(props.initial)
? props.initial[0]
: props.initial);
if (initialTransition && initialTransition.transition) {
fallbackAnimation.transition = initialTransition.transition;
}
}
removedKeys.forEach((key) => {
const fallbackTarget = visualElement.getBaseTarget(key);
const motionValue = visualElement.getValue(key);
if (motionValue)
motionValue.liveStyle = true;
// @ts-expect-error - @mattgperry to figure if we should do something here
fallbackAnimation[key] = fallbackTarget ?? null;
});
animations.push({ animation: fallbackAnimation });
}
let shouldAnimate = Boolean(animations.length);
if (isInitialRender &&
(props.initial === false || props.initial === props.animate) &&
!visualElement.manuallyAnimateOnMount) {
shouldAnimate = false;
}
isInitialRender = false;
return shouldAnimate ? animate(animations) : Promise.resolve();
}
/**
* Change whether a certain animation type is active.
*/
function setActive(type, isActive) {
// If the active state hasn't changed, we can safely do nothing here
if (state[type].isActive === isActive)
return Promise.resolve();
// Propagate active change to children
visualElement.variantChildren?.forEach((child) => child.animationState?.setActive(type, isActive));
state[type].isActive = isActive;
const animations = animateChanges(type);
for (const key in state) {
state[key].protectedKeys = {};
}
return animations;
}
return {
animateChanges,
setActive,
setAnimateFunction,
getState: () => state,
reset: () => {
state = createState();
/**
* Temporarily disabling resetting this flag as it prevents components
* with initial={false} from animating after being remounted, for instance
* as the child of an Activity component.
*/
// isInitialRender = true
},
};
}
function checkVariantsDidChange(prev, next) {
if (typeof next === "string") {
return next !== prev;
}
else if (Array.isArray(next)) {
return !shallowCompare(next, prev);
}
return false;
}
function createTypeState(isActive = false) {
return {
isActive,
protectedKeys: {},
needsAnimating: {},
prevResolvedValues: {},
};
}
function createState() {
return {
animate: createTypeState(true),
whileInView: createTypeState(),
whileHover: createTypeState(),
whileTap: createTypeState(),
whileDrag: createTypeState(),
whileFocus: createTypeState(),
exit: createTypeState(),
};
}
export { checkVariantsDidChange, createAnimationState };
@@ -0,0 +1,20 @@
// Backwards-compatible iterator interfaces, augmented with iterator helper methods by lib.esnext.iterator in TypeScript 5.6.
// The IterableIterator interface does not contain these methods, which creates assignability issues in places where IteratorObjects
// are expected (eg. DOM-compatible APIs) if lib.esnext.iterator is loaded.
// Also ensures that iterators returned by the Node API, which inherit from Iterator.prototype, correctly expose the iterator helper methods
// if lib.esnext.iterator is loaded.
// Placeholders for TS <5.6
interface IteratorObject<T, TReturn, TNext> {}
interface AsyncIteratorObject<T, TReturn, TNext> {}
declare namespace NodeJS {
// Populate iterator methods for TS <5.6
interface Iterator<T, TReturn, TNext> extends globalThis.Iterator<T, TReturn, TNext> {}
interface AsyncIterator<T, TReturn, TNext> extends globalThis.AsyncIterator<T, TReturn, TNext> {}
// Polyfill for TS 5.6's instrinsic BuiltinIteratorReturn type, required for DOM-compatible iterators
type BuiltinIteratorReturn = ReturnType<any[][typeof Symbol.iterator]> extends
globalThis.Iterator<any, infer TReturn> ? TReturn
: any;
}
@@ -0,0 +1,9 @@
/**
* https://tc39.es/ecma402/#sec-getoption
* @param opts
* @param prop
* @param type
* @param values
* @param fallback
*/
export declare function GetOption<T extends object, K extends keyof T, F>(opts: T, prop: K, type: 'string' | 'boolean', values: readonly T[K][] | undefined, fallback: F): Exclude<T[K], undefined> | F;
@@ -0,0 +1,19 @@
Copyright (c) 2017-2018 Fredrik Nicol
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,10 @@
{
"root": true,
"extends": "@ljharb",
"rules": {
"func-style": 0,
"id-length": [1],
},
}
@@ -0,0 +1,5 @@
import { RuleOptions } from './rule-options.js';
declare module 'eslint-define-config' {
export interface CustomRuleOptions extends RuleOptions {}
}
@@ -0,0 +1,7 @@
import { Node } from '@react-types/shared';
type NodeWithProps<T extends object, P = {}> = Omit<Node<T>, "props"> & {
props?: P;
};
export { NodeWithProps };
@@ -0,0 +1,172 @@
/// <reference lib="dom"/>
declare namespace screenfull {
type RawEventNames = {
readonly requestFullscreen: string;
readonly exitFullscreen: string;
readonly fullscreenElement: string;
readonly fullscreenEnabled: string;
readonly fullscreenchange: string;
readonly fullscreenerror: string;
};
type EventName = 'change' | 'error';
interface Screenfull {
/**
Whether fullscreen is active.
*/
readonly isFullscreen: boolean;
/**
The element currently in fullscreen, otherwise `null`.
*/
readonly element: Element | null;
/**
Whether you are allowed to enter fullscreen. If your page is inside an `<iframe>` you will need to add a `allowfullscreen` attribute (+ `webkitallowfullscreen` and `mozallowfullscreen`).
@example
```
if (screenfull.isEnabled) {
screenfull.request();
}
```
*/
readonly isEnabled: true;
/**
Exposes the raw properties (prefixed if needed) used internally.
*/
raw: RawEventNames;
/**
Make an element fullscreen.
If your page is inside an `<iframe>` you will need to add a `allowfullscreen` attribute (+ `webkitallowfullscreen` and `mozallowfullscreen`).
Keep in mind that the browser will only enter fullscreen when initiated by user events like click, touch, key.
@param element - Default is `<html>`. If called with another element than the currently active, it will switch to that if it's a descendant.
@param options - [`FullscreenOptions`](https://developer.mozilla.org/en-US/docs/Web/API/FullscreenOptions).
@returns A promise that resolves after the element enters fullscreen.
@example
```
// Fullscreen the page
document.getElementById('button').addEventListener('click', () => {
if (screenfull.isEnabled) {
screenfull.request();
} else {
// Ignore or do something else
}
});
// Fullscreen an element
const element = document.getElementById('target');
document.getElementById('button').addEventListener('click', () => {
if (screenfull.isEnabled) {
screenfull.request(element);
}
});
// Fullscreen an element with options
const element = document.getElementById('target');
document.getElementById('button').addEventListener('click', () => {
if (screenfull.isEnabled) {
screenfull.request(element, {navigationUI: 'hide'});
}
});
// Fullscreen an element with jQuery
const element = $('#target')[0]; // Get DOM element from jQuery collection
$('#button').on('click', () => {
if (screenfull.isEnabled) {
screenfull.request(element);
}
});
```
*/
request(element?: Element, options?: FullscreenOptions): Promise<void>;
/**
Brings you out of fullscreen.
@returns A promise that resolves after the element exits fullscreen.
*/
exit(): Promise<void>;
/**
Requests fullscreen if not active, otherwise exits.
@param element - Default is `<html>`. If called with another element than the currently active, it will switch to that if it's a descendant.
@param options - [`FullscreenOptions`](https://developer.mozilla.org/en-US/docs/Web/API/FullscreenOptions).
@returns A promise that resolves after the element enters/exits fullscreen.
@example
```
// Toggle fullscreen on a image with jQuery
$('img').on('click', event => {
if (screenfull.isEnabled) {
screenfull.toggle(event.target);
}
});
```
*/
toggle(element?: Element, options?: FullscreenOptions): Promise<void>;
/**
Add a listener for when the browser switches in and out of fullscreen or when there is an error.
@example
```
// Detect fullscreen change
if (screenfull.isEnabled) {
screenfull.on('change', () => {
console.log('Am I fullscreen?', screenfull.isFullscreen ? 'Yes' : 'No');
});
}
// Detect fullscreen error
if (screenfull.isEnabled) {
screenfull.on('error', event => {
console.error('Failed to enable fullscreen', event);
});
}
```
*/
on(name: EventName, handler: (event: Event) => void): void;
/**
Remove a previously registered event listener.
@example
```
screenfull.off('change', callback);
```
*/
off(name: EventName, handler: (event: Event) => void): void;
/**
Alias for `.on('change', function)`.
*/
onchange(handler: (event: Event) => void): void;
/**
Alias for `.on('error', function)`.
*/
onerror(handler: (event: Event) => void): void;
}
}
/**
Simple wrapper for cross-browser usage of the JavaScript [Fullscreen API](https://developer.mozilla.org/en/DOM/Using_full-screen_mode), which lets you bring the page or any element into fullscreen. Smoothens out the browser implementation differences, so you don't have to.
*/
declare const screenfull: screenfull.Screenfull;
export = screenfull;
export as namespace screenfull;
@@ -0,0 +1,15 @@
/**
* Turn an mdast `image` node into hast.
*
* @param {State} state
* Info passed around.
* @param {Image} node
* mdast node.
* @returns {Element}
* hast node.
*/
export function image(state: State, node: Image): Element;
export type Element = import("hast").Element;
export type Properties = import("hast").Properties;
export type Image = import("mdast").Image;
export type State = import("../state.js").State;
@@ -0,0 +1,24 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Clearance = void 0;
const tslib_1 = require("tslib");
const asn1_schema_1 = require("@peculiar/asn1-schema");
const class_list_1 = require("./class_list");
const security_category_1 = require("./security_category");
class Clearance {
constructor(params = {}) {
this.policyId = "";
this.classList = new class_list_1.ClassList(class_list_1.ClassListFlags.unclassified);
Object.assign(this, params);
}
}
exports.Clearance = Clearance;
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.ObjectIdentifier })
], Clearance.prototype, "policyId", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: class_list_1.ClassList, defaultValue: new class_list_1.ClassList(class_list_1.ClassListFlags.unclassified) })
], Clearance.prototype, "classList", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: security_category_1.SecurityCategory, repeated: "set" })
], Clearance.prototype, "securityCategories", void 0);
@@ -0,0 +1,5 @@
var convert = require('./convert'),
func = convert('flatMapDeep', require('../flatMapDeep'));
func.placeholder = require('./placeholder');
module.exports = func;
@@ -0,0 +1,92 @@
{
"name": "style-to-object",
"version": "1.0.12",
"description": "Parse CSS inline style to JavaScript object.",
"author": "Mark <mark@remarkablemark.org>",
"main": "./cjs/index.js",
"module": "./esm/index.mjs",
"types": "./esm/index.d.ts",
"exports": {
"import": {
"types": "./esm/index.d.ts",
"default": "./esm/index.mjs"
},
"require": {
"types": "./cjs/index.d.ts",
"default": "./cjs/index.js"
}
},
"scripts": {
"build": "run-s build:*",
"build:cjs": "tsc --project tsconfig.cjs.json",
"build:esm": "tsc --project tsconfig.json",
"build:umd": "rollup --config --failAfterWarnings",
"clean": "rm -rf cjs coverage dist esm",
"lint": "eslint .",
"lint:fix": "npm run lint -- --fix",
"lint:package": "publint",
"lint:tsc": "tsc --noEmit",
"prepare": "husky",
"prepublishOnly": "run-s lint lint:tsc test clean build",
"test": "jest",
"test:ci": "CI=true jest --ci --colors --coverage",
"test:esm": "npm run build && node --test **/*.test.mjs",
"test:watch": "npm run test -- --watch"
},
"repository": {
"type": "git",
"url": "git+https://github.com/remarkablemark/style-to-object.git"
},
"bugs": {
"url": "https://github.com/remarkablemark/style-to-object/issues"
},
"keywords": [
"style-to-object",
"inline",
"style",
"parser",
"css",
"object",
"pojo"
],
"dependencies": {
"inline-style-parser": "0.2.6"
},
"devDependencies": {
"@commitlint/cli": "20.1.0",
"@commitlint/config-conventional": "20.0.0",
"@eslint/compat": "1.4.0",
"@eslint/eslintrc": "3.3.1",
"@eslint/js": "9.38.0",
"@rollup/plugin-commonjs": "28.0.9",
"@rollup/plugin-node-resolve": "16.0.3",
"@rollup/plugin-terser": "0.4.4",
"@rollup/plugin-typescript": "12.3.0",
"@types/jest": "30.0.0",
"@types/node": "24.9.1",
"@typescript-eslint/eslint-plugin": "8.46.2",
"@typescript-eslint/parser": "8.46.2",
"eslint": "9.38.0",
"eslint-plugin-prettier": "5.5.4",
"eslint-plugin-simple-import-sort": "12.1.1",
"globals": "16.4.0",
"husky": "9.1.7",
"jest": "30.2.0",
"lint-staged": "16.2.6",
"npm-run-all": "4.1.5",
"prettier": "3.6.2",
"publint": "0.3.15",
"rollup": "4.52.5",
"ts-jest": "29.4.5",
"ts-node": "10.9.2",
"tslib": "2.8.1",
"typescript": "5.9.3"
},
"files": [
"/cjs",
"/dist",
"/esm",
"/src"
],
"license": "MIT"
}
@@ -0,0 +1,128 @@
import { __read } from "tslib";
import { useEffect, useRef, useState } from 'react';
import useLatest from '../useLatest';
import useMemoizedFn from '../useMemoizedFn';
import useUnmount from '../useUnmount';
export var ReadyState;
(function (ReadyState) {
ReadyState[ReadyState["Connecting"] = 0] = "Connecting";
ReadyState[ReadyState["Open"] = 1] = "Open";
ReadyState[ReadyState["Closing"] = 2] = "Closing";
ReadyState[ReadyState["Closed"] = 3] = "Closed";
})(ReadyState || (ReadyState = {}));
function useWebSocket(socketUrl, options) {
if (options === void 0) { options = {}; }
var _a = options.reconnectLimit, reconnectLimit = _a === void 0 ? 3 : _a, _b = options.reconnectInterval, reconnectInterval = _b === void 0 ? 3 * 1000 : _b, _c = options.manual, manual = _c === void 0 ? false : _c, onOpen = options.onOpen, onClose = options.onClose, onMessage = options.onMessage, onError = options.onError, protocols = options.protocols;
var _d = __read(useState(), 2), latestMessage = _d[0], setLatestMessage = _d[1];
var _e = __read(useState(ReadyState.Closed), 2), readyState = _e[0], setReadyState = _e[1];
var onOpenRef = useLatest(onOpen);
var onCloseRef = useLatest(onClose);
var onMessageRef = useLatest(onMessage);
var onErrorRef = useLatest(onError);
var readyStateRef = useLatest(readyState);
var reconnectTimesRef = useRef(0);
var reconnectTimerRef = useRef(undefined);
var websocketRef = useRef(undefined);
var reconnect = function () {
var _a;
if (reconnectTimesRef.current < reconnectLimit &&
((_a = websocketRef.current) === null || _a === void 0 ? void 0 : _a.readyState) !== ReadyState.Open) {
if (reconnectTimerRef.current) {
clearTimeout(reconnectTimerRef.current);
}
reconnectTimerRef.current = setTimeout(function () {
// eslint-disable-next-line @typescript-eslint/no-use-before-define
connectWs();
reconnectTimesRef.current++;
}, reconnectInterval);
}
};
var connectWs = function () {
if (reconnectTimerRef.current) {
clearTimeout(reconnectTimerRef.current);
}
if (websocketRef.current) {
websocketRef.current.close();
}
var ws = new WebSocket(socketUrl, protocols);
setReadyState(ReadyState.Connecting);
ws.onerror = function (event) {
var _a;
if (websocketRef.current !== ws) {
return;
}
reconnect();
(_a = onErrorRef.current) === null || _a === void 0 ? void 0 : _a.call(onErrorRef, event, ws);
setReadyState(ws.readyState || ReadyState.Closed);
};
ws.onopen = function (event) {
var _a;
if (websocketRef.current !== ws) {
return;
}
(_a = onOpenRef.current) === null || _a === void 0 ? void 0 : _a.call(onOpenRef, event, ws);
reconnectTimesRef.current = 0;
setReadyState(ws.readyState || ReadyState.Open);
};
ws.onmessage = function (message) {
var _a;
if (websocketRef.current !== ws) {
return;
}
(_a = onMessageRef.current) === null || _a === void 0 ? void 0 : _a.call(onMessageRef, message, ws);
setLatestMessage(message);
};
ws.onclose = function (event) {
var _a;
(_a = onCloseRef.current) === null || _a === void 0 ? void 0 : _a.call(onCloseRef, event, ws);
// closed by server
if (websocketRef.current === ws) {
reconnect();
}
// closed by disconnect or closed by server
if (!websocketRef.current || websocketRef.current === ws) {
setReadyState(ws.readyState || ReadyState.Closed);
}
};
websocketRef.current = ws;
};
var sendMessage = function (message) {
var _a;
if (readyStateRef.current === ReadyState.Open) {
(_a = websocketRef.current) === null || _a === void 0 ? void 0 : _a.send(message);
}
else {
throw new Error('WebSocket disconnected');
}
};
var connect = function () {
reconnectTimesRef.current = 0;
connectWs();
};
var disconnect = function () {
var _a;
if (reconnectTimerRef.current) {
clearTimeout(reconnectTimerRef.current);
}
reconnectTimesRef.current = reconnectLimit;
(_a = websocketRef.current) === null || _a === void 0 ? void 0 : _a.close();
websocketRef.current = undefined;
};
useEffect(function () {
if (!manual && socketUrl) {
connect();
}
}, [socketUrl, manual]);
useUnmount(function () {
disconnect();
});
return {
latestMessage: latestMessage,
sendMessage: useMemoizedFn(sendMessage),
connect: useMemoizedFn(connect),
disconnect: useMemoizedFn(disconnect),
readyState: readyState,
webSocketIns: websocketRef.current,
};
}
export default useWebSocket;
@@ -0,0 +1,52 @@
'use strict';
var $EvalError = require('es-errors/eval');
var DayWithinYear = require('./DayWithinYear');
var InLeapYear = require('./InLeapYear');
var MonthFromTime = require('./MonthFromTime');
// https://262.ecma-international.org/5.1/#sec-15.9.1.5
module.exports = function DateFromTime(t) {
var m = MonthFromTime(t);
var d = DayWithinYear(t);
if (m === 0) {
return d + 1;
}
if (m === 1) {
return d - 30;
}
var leap = InLeapYear(t);
if (m === 2) {
return d - 58 - leap;
}
if (m === 3) {
return d - 89 - leap;
}
if (m === 4) {
return d - 119 - leap;
}
if (m === 5) {
return d - 150 - leap;
}
if (m === 6) {
return d - 180 - leap;
}
if (m === 7) {
return d - 211 - leap;
}
if (m === 8) {
return d - 242 - leap;
}
if (m === 9) {
return d - 272 - leap;
}
if (m === 10) {
return d - 303 - leap;
}
if (m === 11) {
return d - 333 - leap;
}
throw new $EvalError('Assertion failed: MonthFromTime returned an impossible value: ' + m);
};
@@ -0,0 +1,18 @@
[
{
"name": "html",
"description": "Outputs results to HTML. The `html` formatter is useful for visual presentation in the browser."
},
{
"name": "json-with-metadata",
"description": "Outputs JSON-serialized results. The `json-with-metadata` provides the same linting results as the [`json`](#json) formatter with additional metadata about the rules applied. The linting results are included in the `results` property and the rules metadata is included in the `metadata` property.\n\nAlternatively, you can use the [ESLint Node.js API](../../integrate/nodejs-api) to programmatically use ESLint."
},
{
"name": "json",
"description": "Outputs JSON-serialized results. The `json` formatter is useful when you want to programmatically work with the CLI's linting results.\n\nAlternatively, you can use the [ESLint Node.js API](../../integrate/nodejs-api) to programmatically use ESLint."
},
{
"name": "stylish",
"description": "Human-readable output format. This is the default formatter."
}
]
@@ -0,0 +1,44 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v1.0.3](https://github.com/inspect-js/typed-array-byte-length/compare/v1.0.2...v1.0.3) - 2024-12-17
### Commits
- [types] oops, this is a type export, not a value export [`2fcf3e8`](https://github.com/inspect-js/typed-array-byte-length/commit/2fcf3e87f0312bca866dd24e805641f9c2c0798b)
## [v1.0.2](https://github.com/inspect-js/typed-array-byte-length/compare/v1.0.1...v1.0.2) - 2024-12-17
### Commits
- [types] improve types [`fcc9606`](https://github.com/inspect-js/typed-array-byte-length/commit/fcc9606bf4f27d1299aacbfa3011973ecf3f25bc)
- [types] use shared config [`ca29c46`](https://github.com/inspect-js/typed-array-byte-length/commit/ca29c46795620d624bcb6cbdbc32c1b0580ab0f8)
- [actions] split out node 10-20, and 20+ [`9a38c81`](https://github.com/inspect-js/typed-array-byte-length/commit/9a38c81be40d6e34b4a1cbe3d83dde8806a998cc)
- [Dev Deps] update `@arethetypeswrong/cli`, `@ljharb/eslint-config`, `@ljharb/tsconfig`, `@types/object-inspect`, `@types/tape`, `auto-changelog`, `object-inspect`, `tape` [`78cd1f2`](https://github.com/inspect-js/typed-array-byte-length/commit/78cd1f274612d46207951cf16a05615d2d14d13e)
- [Deps] update `call-bind`, `gopd`, `has-proto`, `is-typed-array` [`8c13b84`](https://github.com/inspect-js/typed-array-byte-length/commit/8c13b84060a47865c6f6f5fafdeccfdf8f304258)
- [Tests] replace `aud` with `npm audit` [`0d9aee3`](https://github.com/inspect-js/typed-array-byte-length/commit/0d9aee379568e90c7898163b43163c3287004e71)
- [Tests] use `@arethetypeswrong/cli` [`abf28fa`](https://github.com/inspect-js/typed-array-byte-length/commit/abf28fa1baff255683c3f38fe594271178199743)
- [Dev Deps] add missing peer dep [`dfd248d`](https://github.com/inspect-js/typed-array-byte-length/commit/dfd248d58080f8c74990d76202e72acd4f3e9fa0)
## [v1.0.1](https://github.com/inspect-js/typed-array-byte-length/compare/v1.0.0...v1.0.1) - 2024-02-20
### Commits
- add types [`3144671`](https://github.com/inspect-js/typed-array-byte-length/commit/3144671ca4035136c558a107ce61af255ae3e858)
- [actions] skip ls check on node &lt; 10; remove redundant finisher [`0f83947`](https://github.com/inspect-js/typed-array-byte-length/commit/0f83947bfe641fd87253330a6a83e8b7571e5c6a)
- [Refactor] use `gopd` [`507b948`](https://github.com/inspect-js/typed-array-byte-length/commit/507b948f9e754ad5b0888a15558448ec879c04c4)
- [Dev Deps] update `aud`, `available-typed-arrays`, `npmignore`, `object-inspect`, `tape` [`aba282d`](https://github.com/inspect-js/typed-array-byte-length/commit/aba282da3a3e16f648ceb4bc4f174cf4942a94e9)
- [Deps] update `call-bind`, `has-proto`, `is-typed-array` [`acfe4a9`](https://github.com/inspect-js/typed-array-byte-length/commit/acfe4a9081f35cea3b450b07a4736e1ab037a708)
- [meta] add `sideEffects` flag [`063a8a7`](https://github.com/inspect-js/typed-array-byte-length/commit/063a8a7ec8c134a012903531beccfc4418f701d0)
## v1.0.0 - 2023-07-14
### Commits
- Initial implementation, tests, readme [`b8800c8`](https://github.com/inspect-js/typed-array-byte-length/commit/b8800c8f7f0fddd8744fd13dfa6239a504b4dc8d)
- Initial commit [`72723d8`](https://github.com/inspect-js/typed-array-byte-length/commit/72723d8f8fbff27d74b19f5e096d2eb2087d90dc)
- Only apps should have lockfiles [`a7dfc57`](https://github.com/inspect-js/typed-array-byte-length/commit/a7dfc57098655049b9c43cf1c3a39f24205821be)
@@ -0,0 +1,6 @@
import { Readonly } from '../readonly/index.mjs';
import { Optional } from '../optional/index.mjs';
/** `[Json]` Creates a Readonly and Optional property */
export function ReadonlyOptional(schema) {
return Readonly(Optional(schema));
}
@@ -0,0 +1,138 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $RangeError = require('es-errors/range');
var $SyntaxError = require('es-errors/syntax');
var $TypeError = require('es-errors/type');
var $ArrayBuffer = GetIntrinsic('%ArrayBuffer%', true);
var typedArrayBuffer = require('typed-array-buffer');
var typedArrayByteLength = require('typed-array-byte-length');
var typedArrayByteOffset = require('typed-array-byte-offset');
var typedArrayLength = require('typed-array-length');
var whichTypedArray = require('which-typed-array');
var isInteger = require('math-intrinsics/isInteger');
var CloneArrayBuffer = require('./CloneArrayBuffer');
var GetValueFromBuffer = require('./GetValueFromBuffer');
var IsDetachedBuffer = require('./IsDetachedBuffer');
var IsSharedArrayBuffer = require('./IsSharedArrayBuffer');
var SameValue = require('./SameValue');
var SetValueInBuffer = require('./SetValueInBuffer');
var tableTAO = require('./tables/typed-array-objects');
// https://262.ecma-international.org/12.0/#sec-settypedarrayfromtypedarray
module.exports = function SetTypedArrayFromTypedArray(target, targetOffset, source) {
var whichTarget = whichTypedArray(target);
if (!whichTarget) {
throw new $TypeError('Assertion failed: target must be a TypedArray instance');
}
if (targetOffset !== Infinity && (!isInteger(targetOffset) || targetOffset < 0)) {
throw new $TypeError('Assertion failed: targetOffset must be a non-negative integer or +Infinity');
}
var whichSource = whichTypedArray(source);
if (!whichSource) {
throw new $TypeError('Assertion failed: source must be a TypedArray instance'); // step 1
}
var targetBuffer = typedArrayBuffer(target); // step 2
if (IsDetachedBuffer(targetBuffer)) {
throw new $TypeError('target’s buffer is detached'); // step 3
}
var targetLength = typedArrayLength(target); // step 4
var srcBuffer = typedArrayBuffer(source); // step 5
if (IsDetachedBuffer(srcBuffer)) {
throw new $TypeError('source’s buffer is detached'); // step 6
}
var targetName = whichTarget; // step 7
var targetType = tableTAO.name['$' + targetName]; // step 8
var targetElementSize = tableTAO.size['$' + targetType]; // step 9
var targetByteOffset = typedArrayByteOffset(target); // step 10
var srcName = whichSource; // step 11
var srcType = tableTAO.name['$' + srcName]; // step 12
var srcElementSize = tableTAO.size['$' + srcType]; // step 13
var srcLength = typedArrayLength(source); // step 14
var srcByteOffset = typedArrayByteOffset(source); // step 15
if (targetOffset === Infinity) {
throw new $RangeError('targetOffset must be a non-negative integer or +Infinity'); // step 16
}
if (srcLength + targetOffset > targetLength) {
throw new $RangeError('targetOffset + source.length must not be greater than target.length'); // step 17
}
var targetContentType = whichTarget === 'BigInt64Array' || whichTarget === 'BigUint64Array' ? 'BigInt' : 'Number';
var sourceContentType = whichSource === 'BigInt64Array' || whichSource === 'BigUint64Array' ? 'BigInt' : 'Number';
if (targetContentType !== sourceContentType) {
throw new $TypeError('source and target must have the same content type'); // step 18
}
var same;
if (IsSharedArrayBuffer(srcBuffer) && IsSharedArrayBuffer(targetBuffer)) { // step 19
// a. If srcBuffer.[[ArrayBufferData]] and targetBuffer.[[ArrayBufferData]] are the same Shared Data Block values, let same be true; else let same be false.
throw new $SyntaxError('SharedArrayBuffer is not supported by this implementation');
} else {
same = SameValue(srcBuffer, targetBuffer); // step 20
}
var srcByteIndex;
if (same) { // step 21
var srcByteLength = typedArrayByteLength(source); // step 21.a
srcBuffer = CloneArrayBuffer(srcBuffer, srcByteOffset, srcByteLength, $ArrayBuffer); // step 21.b
// c. NOTE: %ArrayBuffer% is used to clone srcBuffer because is it known to not have any observable side-effects.
srcByteIndex = 0; // step 21.d
} else {
srcByteIndex = srcByteOffset; // step 22
}
var targetByteIndex = (targetOffset * targetElementSize) + targetByteOffset; // step 23
var limit = targetByteIndex + (targetElementSize * srcLength); // step 24
var value;
if (srcType === targetType) { // step 25
// a. NOTE: If srcType and targetType are the same, the transfer must be performed in a manner that preserves the bit-level encoding of the source data.
while (targetByteIndex < limit) { // step 25.b
value = GetValueFromBuffer(srcBuffer, srcByteIndex, 'Uint8', true, 'Unordered'); // step 25.b.i
SetValueInBuffer(targetBuffer, targetByteIndex, 'Uint8', value, true, 'Unordered'); // step 25.b.ii
srcByteIndex += 1; // step 25.b.iii
targetByteIndex += 1; // step 25.b.iv
}
} else { // step 26
while (targetByteIndex < limit) { // step 26.a
value = GetValueFromBuffer(srcBuffer, srcByteIndex, srcType, true, 'Unordered'); // step 26.a.i
SetValueInBuffer(targetBuffer, targetByteIndex, targetType, value, true, 'Unordered'); // step 26.a.ii
srcByteIndex += srcElementSize; // step 26.a.iii
targetByteIndex += targetElementSize; // step 26.a.iv
}
}
};
@@ -0,0 +1,13 @@
/**
* The base implementation of `_.hasIn` without support for deep paths.
*
* @private
* @param {Object} [object] The object to query.
* @param {Array|string} key The key to check.
* @returns {boolean} Returns `true` if `key` exists, else `false`.
*/
function baseHasIn(object, key) {
return object != null && key in Object(object);
}
export default baseHasIn;
@@ -0,0 +1,2 @@
export declare const xmlDecodeTree: Uint16Array;
//# sourceMappingURL=decode-data-xml.d.ts.map
@@ -0,0 +1,133 @@
# hosted-git-info
This will let you identify and transform various git hosts URLs between
protocols. It also can tell you what the URL is for the raw path for
particular file for direct access without git.
## Example
```javascript
var hostedGitInfo = require("hosted-git-info")
var info = hostedGitInfo.fromUrl("git@github.com:npm/hosted-git-info.git", opts)
/* info looks like:
{
type: "github",
domain: "github.com",
user: "npm",
project: "hosted-git-info"
}
*/
```
If the URL can't be matched with a git host, `null` will be returned. We
can match git, ssh and https urls. Additionally, we can match ssh connect
strings (`git@github.com:npm/hosted-git-info`) and shortcuts (eg,
`github:npm/hosted-git-info`). GitHub specifically, is detected in the case
of a third, unprefixed, form: `npm/hosted-git-info`.
If it does match, the returned object has properties of:
* info.type -- The short name of the service
* info.domain -- The domain for git protocol use
* info.user -- The name of the user/org on the git host
* info.project -- The name of the project on the git host
## Version Contract
The major version will be bumped any time…
* The constructor stops accepting URLs that it previously accepted.
* A method is removed.
* A method can no longer accept the number and type of arguments it previously accepted.
* A method can return a different type than it currently returns.
Implications:
* I do not consider the specific format of the urls returned from, say
`.https()` to be a part of the contract. The contract is that it will
return a string that can be used to fetch the repo via HTTPS. But what
that string looks like, specifically, can change.
* Dropping support for a hosted git provider would constitute a breaking
change.
## Usage
### var info = hostedGitInfo.fromUrl(gitSpecifier[, options])
* *gitSpecifer* is a URL of a git repository or a SCP-style specifier of one.
* *options* is an optional object. It can have the following properties:
* *noCommittish* — If true then committishes won't be included in generated URLs.
* *noGitPlus* — If true then `git+` won't be prefixed on URLs.
## Methods
All of the methods take the same options as the `fromUrl` factory. Options
provided to a method override those provided to the constructor.
* info.file(path, opts)
Given the path of a file relative to the repository, returns a URL for
directly fetching it from the githost. If no committish was set then
`master` will be used as the default.
For example `hostedGitInfo.fromUrl("git@github.com:npm/hosted-git-info.git#v1.0.0").file("package.json")`
would return `https://raw.githubusercontent.com/npm/hosted-git-info/v1.0.0/package.json`
* info.shortcut(opts)
eg, `github:npm/hosted-git-info`
* info.browse(path, fragment, opts)
eg, `https://github.com/npm/hosted-git-info/tree/v1.2.0`,
`https://github.com/npm/hosted-git-info/tree/v1.2.0/package.json`,
`https://github.com/npm/hosted-git-info/tree/v1.2.0/REAMDE.md#supported-hosts`
* info.bugs(opts)
eg, `https://github.com/npm/hosted-git-info/issues`
* info.docs(opts)
eg, `https://github.com/npm/hosted-git-info/tree/v1.2.0#readme`
* info.https(opts)
eg, `git+https://github.com/npm/hosted-git-info.git`
* info.sshurl(opts)
eg, `git+ssh://git@github.com/npm/hosted-git-info.git`
* info.ssh(opts)
eg, `git@github.com:npm/hosted-git-info.git`
* info.path(opts)
eg, `npm/hosted-git-info`
* info.tarball(opts)
eg, `https://github.com/npm/hosted-git-info/archive/v1.2.0.tar.gz`
* info.getDefaultRepresentation()
Returns the default output type. The default output type is based on the
string you passed in to be parsed
* info.toString(opts)
Uses the getDefaultRepresentation to call one of the other methods to get a URL for
this resource. As such `hostedGitInfo.fromUrl(url).toString()` will give
you a normalized version of the URL that still uses the same protocol.
Shortcuts will still be returned as shortcuts, but the special case github
form of `org/project` will be normalized to `github:org/project`.
SSH connect strings will be normalized into `git+ssh` URLs.
## Supported hosts
Currently this supports GitHub, Bitbucket and GitLab. Pull requests for
additional hosts welcome.
@@ -0,0 +1,74 @@
var SetCache = require('./_SetCache'),
arrayIncludes = require('./_arrayIncludes'),
arrayIncludesWith = require('./_arrayIncludesWith'),
arrayMap = require('./_arrayMap'),
baseUnary = require('./_baseUnary'),
cacheHas = require('./_cacheHas');
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMin = Math.min;
/**
* The base implementation of methods like `_.intersection`, without support
* for iteratee shorthands, that accepts an array of arrays to inspect.
*
* @private
* @param {Array} arrays The arrays to inspect.
* @param {Function} [iteratee] The iteratee invoked per element.
* @param {Function} [comparator] The comparator invoked per element.
* @returns {Array} Returns the new array of shared values.
*/
function baseIntersection(arrays, iteratee, comparator) {
var includes = comparator ? arrayIncludesWith : arrayIncludes,
length = arrays[0].length,
othLength = arrays.length,
othIndex = othLength,
caches = Array(othLength),
maxLength = Infinity,
result = [];
while (othIndex--) {
var array = arrays[othIndex];
if (othIndex && iteratee) {
array = arrayMap(array, baseUnary(iteratee));
}
maxLength = nativeMin(array.length, maxLength);
caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
? new SetCache(othIndex && array)
: undefined;
}
array = arrays[0];
var index = -1,
seen = caches[0];
outer:
while (++index < length && result.length < maxLength) {
var value = array[index],
computed = iteratee ? iteratee(value) : value;
value = (comparator || value !== 0) ? value : 0;
if (!(seen
? cacheHas(seen, computed)
: includes(result, computed, comparator)
)) {
othIndex = othLength;
while (--othIndex) {
var cache = caches[othIndex];
if (!(cache
? cacheHas(cache, computed)
: includes(arrays[othIndex], computed, comparator))
) {
continue outer;
}
}
if (seen) {
seen.push(computed);
}
result.push(value);
}
}
return result;
}
module.exports = baseIntersection;
@@ -0,0 +1,71 @@
var $e1dbec26039c051d$exports = require("./Pressable.main.js");
var $3596bae48579386f$exports = require("./PressResponder.main.js");
var $5cb73d0ce355b0dc$exports = require("./useFocus.main.js");
var $e77252a287ef94ab$exports = require("./useFocusVisible.main.js");
var $d16842bbd0359d1b$exports = require("./useFocusWithin.main.js");
var $ffbc150311c75f01$exports = require("./useHover.main.js");
var $edcfa848c42f94f4$exports = require("./useInteractOutside.main.js");
var $892d64db2a3c53b0$exports = require("./useKeyboard.main.js");
var $c09386fc48fa427d$exports = require("./useMove.main.js");
var $0294ea432cd92340$exports = require("./usePress.main.js");
var $a3dbce0aed7087e2$exports = require("./useScrollWheel.main.js");
var $3cd7b5d0eebf0ca9$exports = require("./useLongPress.main.js");
var $15f8fd80892557ff$exports = require("./useFocusable.main.js");
var $2833058fcd3993f5$exports = require("./focusSafely.main.js");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "Pressable", () => $e1dbec26039c051d$exports.Pressable);
$parcel$export(module.exports, "PressResponder", () => $3596bae48579386f$exports.PressResponder);
$parcel$export(module.exports, "ClearPressResponder", () => $3596bae48579386f$exports.ClearPressResponder);
$parcel$export(module.exports, "useFocus", () => $5cb73d0ce355b0dc$exports.useFocus);
$parcel$export(module.exports, "isFocusVisible", () => $e77252a287ef94ab$exports.isFocusVisible);
$parcel$export(module.exports, "getInteractionModality", () => $e77252a287ef94ab$exports.getInteractionModality);
$parcel$export(module.exports, "setInteractionModality", () => $e77252a287ef94ab$exports.setInteractionModality);
$parcel$export(module.exports, "addWindowFocusTracking", () => $e77252a287ef94ab$exports.addWindowFocusTracking);
$parcel$export(module.exports, "useInteractionModality", () => $e77252a287ef94ab$exports.useInteractionModality);
$parcel$export(module.exports, "useFocusVisible", () => $e77252a287ef94ab$exports.useFocusVisible);
$parcel$export(module.exports, "useFocusVisibleListener", () => $e77252a287ef94ab$exports.useFocusVisibleListener);
$parcel$export(module.exports, "useFocusWithin", () => $d16842bbd0359d1b$exports.useFocusWithin);
$parcel$export(module.exports, "useHover", () => $ffbc150311c75f01$exports.useHover);
$parcel$export(module.exports, "useInteractOutside", () => $edcfa848c42f94f4$exports.useInteractOutside);
$parcel$export(module.exports, "useKeyboard", () => $892d64db2a3c53b0$exports.useKeyboard);
$parcel$export(module.exports, "useMove", () => $c09386fc48fa427d$exports.useMove);
$parcel$export(module.exports, "usePress", () => $0294ea432cd92340$exports.usePress);
$parcel$export(module.exports, "useScrollWheel", () => $a3dbce0aed7087e2$exports.useScrollWheel);
$parcel$export(module.exports, "useLongPress", () => $3cd7b5d0eebf0ca9$exports.useLongPress);
$parcel$export(module.exports, "useFocusable", () => $15f8fd80892557ff$exports.useFocusable);
$parcel$export(module.exports, "FocusableProvider", () => $15f8fd80892557ff$exports.FocusableProvider);
$parcel$export(module.exports, "Focusable", () => $15f8fd80892557ff$exports.Focusable);
$parcel$export(module.exports, "FocusableContext", () => $15f8fd80892557ff$exports.FocusableContext);
$parcel$export(module.exports, "focusSafely", () => $2833058fcd3993f5$exports.focusSafely);
/*
* 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.
*/
//# sourceMappingURL=main.js.map
@@ -0,0 +1,19 @@
'use strict';
var $TypeError = require('es-errors/type');
var callBound = require('call-bound');
var $dataViewByteLength = callBound('DataView.prototype.byteLength', true);
var isDataView = require('is-data-view');
// node <= 0.10, < 0.11.4 has a nonconfigurable own property instead of a prototype getter
/** @type {import('.')} */
module.exports = $dataViewByteLength || function byteLength(x) {
if (!isDataView(x)) {
throw new $TypeError('not a DataView');
}
return x.byteLength;
};
@@ -0,0 +1,15 @@
import { __decorate } from "tslib";
import { AsnProp, AsnPropTypes, AsnIntegerArrayBufferConverter } from "@peculiar/asn1-schema";
export class RSAPublicKey {
constructor(params = {}) {
this.modulus = new ArrayBuffer(0);
this.publicExponent = new ArrayBuffer(0);
Object.assign(this, params);
}
}
__decorate([
AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })
], RSAPublicKey.prototype, "modulus", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })
], RSAPublicKey.prototype, "publicExponent", void 0);
@@ -0,0 +1 @@
{"mappings":";AAAA,4BAAiB;IAAG,aAAa,CAAC,gBAAE,CAAC;IACnC,iBAAiB,CAAC,OAAS,CAAC,iBAAG,EAAE,KAAK,UAAU,CAAC,iCAAK,CAAC;IACvD,cAAc,CAAC,OAAS,GAAG,KAAK,KAAK,CAAC,iBAAG,CAAC;IAC1C,cAAc,CAAC,gBAAE,CAAC;IAClB,kBAAkB,CAAC,OAAS,CAAC,iBAAG,EAAE,KAAK,UAAU,CAAC,iCAAK,CAAC;IACxD,sBAAsB,CAAC,wGAAa,CAAC;IACrC,UAAU,CAAC,gBAAE,CAAC;IACd,aAAa,CAAC,gBAAE,CAAC;IACjB,YAAY,CAAC,wCAAK,CAAC;AACrB","sources":["packages/@react-aria/table/intl/zh-CN.json"],"sourcesContent":["{\n \"ascending\": \"升序\",\n \"ascendingSort\": \"按列 {columnName} 升序排序\",\n \"columnSize\": \"{value} 像素\",\n \"descending\": \"降序\",\n \"descendingSort\": \"按列 {columnName} 降序排序\",\n \"resizerDescription\": \"按“输入”键开始调整大小。\",\n \"select\": \"选择\",\n \"selectAll\": \"全选\",\n \"sortable\": \"可排序的列\"\n}\n"],"names":[],"version":3,"file":"zh-CN.module.js.map"}
@@ -0,0 +1,63 @@
/**
* @author Toru Nagashima
* See LICENSE file in root directory for full license.
*/
"use strict"
const { ReferenceTracker } = require("eslint-utils")
/**
* Verifier for `prefer-global/*` rules.
*/
class Verifier {
/**
* Initialize this instance.
* @param {RuleContext} context The rule context to report.
* @param {{modules:object,globals:object}} trackMap The track map.
*/
constructor(context, trackMap) {
this.context = context
this.trackMap = trackMap
this.verify =
context.options[0] === "never"
? this.verifyToPreferModules
: this.verifyToPreferGlobals
}
/**
* Verify the code to suggest the use of globals.
* @returns {void}
*/
verifyToPreferGlobals() {
const { context, trackMap } = this
const tracker = new ReferenceTracker(context.getScope(), {
mode: "legacy",
})
for (const { node } of [
...tracker.iterateCjsReferences(trackMap.modules),
...tracker.iterateEsmReferences(trackMap.modules),
]) {
context.report({ node, messageId: "preferGlobal" })
}
}
/**
* Verify the code to suggest the use of modules.
* @returns {void}
*/
verifyToPreferModules() {
const { context, trackMap } = this
const tracker = new ReferenceTracker(context.getScope())
for (const { node } of tracker.iterateGlobalReferences(
trackMap.globals
)) {
context.report({ node, messageId: "preferModule" })
}
}
}
module.exports = function checkForPreferGlobal(context, trackMap) {
new Verifier(context, trackMap).verify()
}
@@ -0,0 +1,8 @@
export type MessageIds = 'preferReadonly';
export type Options = [
{
onlyInlineLambdas?: boolean;
}
];
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferReadonly", Options, import("../../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
export default _default;
@@ -0,0 +1,6 @@
{
"private": true,
"types": "../dist/react-client.d.ts",
"main": "../dist/cjs/react-client.js",
"module": "../dist/es/react-client.mjs"
}
@@ -0,0 +1,38 @@
/**
* @import {Code} from 'micromark-util-types'
*/
import {
markdownLineEndingOrSpace,
unicodePunctuation,
unicodeWhitespace
} from 'micromark-util-character'
import {codes, constants} from 'micromark-util-symbol'
/**
* Classify whether a code represents whitespace, punctuation, or something
* else.
*
* Used for attention (emphasis, strong), whose sequences can open or close
* based on the class of surrounding characters.
*
* > 👉 **Note**: eof (`null`) is seen as whitespace.
*
* @param {Code} code
* Code.
* @returns {typeof constants.characterGroupWhitespace | typeof constants.characterGroupPunctuation | undefined}
* Group.
*/
export function classifyCharacter(code) {
if (
code === codes.eof ||
markdownLineEndingOrSpace(code) ||
unicodeWhitespace(code)
) {
return constants.characterGroupWhitespace
}
if (unicodePunctuation(code)) {
return constants.characterGroupPunctuation
}
}
@@ -0,0 +1,49 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = AsyncIterator;
var _OverloadYield = require("./OverloadYield.js");
var _regeneratorDefine = require("./regeneratorDefine.js");
function AsyncIterator(generator, PromiseImpl) {
if (!this.next) {
(0, _regeneratorDefine.default)(AsyncIterator.prototype);
(0, _regeneratorDefine.default)(AsyncIterator.prototype, typeof Symbol === "function" && Symbol.asyncIterator || "@asyncIterator", function () {
return this;
});
}
function invoke(method, arg, resolve, reject) {
try {
var result = generator[method](arg);
var value = result.value;
if (value instanceof _OverloadYield.default) {
return PromiseImpl.resolve(value.v).then(function (value) {
invoke("next", value, resolve, reject);
}, function (err) {
invoke("throw", err, resolve, reject);
});
}
return PromiseImpl.resolve(value).then(function (unwrapped) {
result.value = unwrapped;
resolve(result);
}, function (error) {
return invoke("throw", error, resolve, reject);
});
} catch (error) {
reject(error);
}
}
var previousPromise;
function enqueue(method, i, arg) {
function callInvokeWithMethodAndArg() {
return new PromiseImpl(function (resolve, reject) {
invoke(method, arg, resolve, reject);
});
}
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
}
(0, _regeneratorDefine.default)(this, "_invoke", enqueue, true);
}
//# sourceMappingURL=regeneratorAsyncIterator.js.map
@@ -0,0 +1,17 @@
export type Options = [
{
allowAny?: boolean;
allowNullableBoolean?: boolean;
allowNullableEnum?: boolean;
allowNullableNumber?: boolean;
allowNullableObject?: boolean;
allowNullableString?: boolean;
allowNumber?: boolean;
allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing?: boolean;
allowString?: boolean;
}
];
type ConditionErrorMessageId = 'conditionErrorAny' | 'conditionErrorNullableBoolean' | 'conditionErrorNullableEnum' | 'conditionErrorNullableNumber' | 'conditionErrorNullableObject' | 'conditionErrorNullableString' | 'conditionErrorNullish' | 'conditionErrorNumber' | 'conditionErrorObject' | 'conditionErrorOther' | 'conditionErrorString';
export type MessageId = 'conditionFixCastBoolean' | 'conditionFixCompareArrayLengthNonzero' | 'conditionFixCompareArrayLengthZero' | 'conditionFixCompareEmptyString' | 'conditionFixCompareFalse' | 'conditionFixCompareNaN' | 'conditionFixCompareNullish' | 'conditionFixCompareStringLength' | 'conditionFixCompareTrue' | 'conditionFixCompareZero' | 'conditionFixDefaultEmptyString' | 'conditionFixDefaultFalse' | 'conditionFixDefaultZero' | 'explicitBooleanReturnType' | 'noStrictNullCheck' | 'predicateCannotBeAsync' | ConditionErrorMessageId;
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<MessageId, Options, import("../../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
export default _default;
@@ -0,0 +1,497 @@
import { htmlDecodeTree } from "./generated/decode-data-html.js";
import { xmlDecodeTree } from "./generated/decode-data-xml.js";
import { replaceCodePoint, fromCodePoint } from "./decode-codepoint.js";
var CharCodes;
(function (CharCodes) {
CharCodes[CharCodes["NUM"] = 35] = "NUM";
CharCodes[CharCodes["SEMI"] = 59] = "SEMI";
CharCodes[CharCodes["EQUALS"] = 61] = "EQUALS";
CharCodes[CharCodes["ZERO"] = 48] = "ZERO";
CharCodes[CharCodes["NINE"] = 57] = "NINE";
CharCodes[CharCodes["LOWER_A"] = 97] = "LOWER_A";
CharCodes[CharCodes["LOWER_F"] = 102] = "LOWER_F";
CharCodes[CharCodes["LOWER_X"] = 120] = "LOWER_X";
CharCodes[CharCodes["LOWER_Z"] = 122] = "LOWER_Z";
CharCodes[CharCodes["UPPER_A"] = 65] = "UPPER_A";
CharCodes[CharCodes["UPPER_F"] = 70] = "UPPER_F";
CharCodes[CharCodes["UPPER_Z"] = 90] = "UPPER_Z";
})(CharCodes || (CharCodes = {}));
/** Bit that needs to be set to convert an upper case ASCII character to lower case */
const TO_LOWER_BIT = 32;
export var BinTrieFlags;
(function (BinTrieFlags) {
BinTrieFlags[BinTrieFlags["VALUE_LENGTH"] = 49152] = "VALUE_LENGTH";
BinTrieFlags[BinTrieFlags["BRANCH_LENGTH"] = 16256] = "BRANCH_LENGTH";
BinTrieFlags[BinTrieFlags["JUMP_TABLE"] = 127] = "JUMP_TABLE";
})(BinTrieFlags || (BinTrieFlags = {}));
function isNumber(code) {
return code >= CharCodes.ZERO && code <= CharCodes.NINE;
}
function isHexadecimalCharacter(code) {
return ((code >= CharCodes.UPPER_A && code <= CharCodes.UPPER_F) ||
(code >= CharCodes.LOWER_A && code <= CharCodes.LOWER_F));
}
function isAsciiAlphaNumeric(code) {
return ((code >= CharCodes.UPPER_A && code <= CharCodes.UPPER_Z) ||
(code >= CharCodes.LOWER_A && code <= CharCodes.LOWER_Z) ||
isNumber(code));
}
/**
* Checks if the given character is a valid end character for an entity in an attribute.
*
* Attribute values that aren't terminated properly aren't parsed, and shouldn't lead to a parser error.
* See the example in https://html.spec.whatwg.org/multipage/parsing.html#named-character-reference-state
*/
function isEntityInAttributeInvalidEnd(code) {
return code === CharCodes.EQUALS || isAsciiAlphaNumeric(code);
}
var EntityDecoderState;
(function (EntityDecoderState) {
EntityDecoderState[EntityDecoderState["EntityStart"] = 0] = "EntityStart";
EntityDecoderState[EntityDecoderState["NumericStart"] = 1] = "NumericStart";
EntityDecoderState[EntityDecoderState["NumericDecimal"] = 2] = "NumericDecimal";
EntityDecoderState[EntityDecoderState["NumericHex"] = 3] = "NumericHex";
EntityDecoderState[EntityDecoderState["NamedEntity"] = 4] = "NamedEntity";
})(EntityDecoderState || (EntityDecoderState = {}));
export var DecodingMode;
(function (DecodingMode) {
/** Entities in text nodes that can end with any character. */
DecodingMode[DecodingMode["Legacy"] = 0] = "Legacy";
/** Only allow entities terminated with a semicolon. */
DecodingMode[DecodingMode["Strict"] = 1] = "Strict";
/** Entities in attributes have limitations on ending characters. */
DecodingMode[DecodingMode["Attribute"] = 2] = "Attribute";
})(DecodingMode || (DecodingMode = {}));
/**
* Token decoder with support of writing partial entities.
*/
export class EntityDecoder {
constructor(
/** The tree used to decode entities. */
decodeTree,
/**
* The function that is called when a codepoint is decoded.
*
* For multi-byte named entities, this will be called multiple times,
* with the second codepoint, and the same `consumed` value.
*
* @param codepoint The decoded codepoint.
* @param consumed The number of bytes consumed by the decoder.
*/
emitCodePoint,
/** An object that is used to produce errors. */
errors) {
this.decodeTree = decodeTree;
this.emitCodePoint = emitCodePoint;
this.errors = errors;
/** The current state of the decoder. */
this.state = EntityDecoderState.EntityStart;
/** Characters that were consumed while parsing an entity. */
this.consumed = 1;
/**
* The result of the entity.
*
* Either the result index of a numeric entity, or the codepoint of a
* numeric entity.
*/
this.result = 0;
/** The current index in the decode tree. */
this.treeIndex = 0;
/** The number of characters that were consumed in excess. */
this.excess = 1;
/** The mode in which the decoder is operating. */
this.decodeMode = DecodingMode.Strict;
}
/** Resets the instance to make it reusable. */
startEntity(decodeMode) {
this.decodeMode = decodeMode;
this.state = EntityDecoderState.EntityStart;
this.result = 0;
this.treeIndex = 0;
this.excess = 1;
this.consumed = 1;
}
/**
* Write an entity to the decoder. This can be called multiple times with partial entities.
* If the entity is incomplete, the decoder will return -1.
*
* Mirrors the implementation of `getDecoder`, but with the ability to stop decoding if the
* entity is incomplete, and resume when the next string is written.
*
* @param input The string containing the entity (or a continuation of the entity).
* @param offset The offset at which the entity begins. Should be 0 if this is not the first call.
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
*/
write(input, offset) {
switch (this.state) {
case EntityDecoderState.EntityStart: {
if (input.charCodeAt(offset) === CharCodes.NUM) {
this.state = EntityDecoderState.NumericStart;
this.consumed += 1;
return this.stateNumericStart(input, offset + 1);
}
this.state = EntityDecoderState.NamedEntity;
return this.stateNamedEntity(input, offset);
}
case EntityDecoderState.NumericStart: {
return this.stateNumericStart(input, offset);
}
case EntityDecoderState.NumericDecimal: {
return this.stateNumericDecimal(input, offset);
}
case EntityDecoderState.NumericHex: {
return this.stateNumericHex(input, offset);
}
case EntityDecoderState.NamedEntity: {
return this.stateNamedEntity(input, offset);
}
}
}
/**
* Switches between the numeric decimal and hexadecimal states.
*
* Equivalent to the `Numeric character reference state` in the HTML spec.
*
* @param input The string containing the entity (or a continuation of the entity).
* @param offset The current offset.
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
*/
stateNumericStart(input, offset) {
if (offset >= input.length) {
return -1;
}
if ((input.charCodeAt(offset) | TO_LOWER_BIT) === CharCodes.LOWER_X) {
this.state = EntityDecoderState.NumericHex;
this.consumed += 1;
return this.stateNumericHex(input, offset + 1);
}
this.state = EntityDecoderState.NumericDecimal;
return this.stateNumericDecimal(input, offset);
}
addToNumericResult(input, start, end, base) {
if (start !== end) {
const digitCount = end - start;
this.result =
this.result * Math.pow(base, digitCount) +
Number.parseInt(input.substr(start, digitCount), base);
this.consumed += digitCount;
}
}
/**
* Parses a hexadecimal numeric entity.
*
* Equivalent to the `Hexademical character reference state` in the HTML spec.
*
* @param input The string containing the entity (or a continuation of the entity).
* @param offset The current offset.
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
*/
stateNumericHex(input, offset) {
const startIndex = offset;
while (offset < input.length) {
const char = input.charCodeAt(offset);
if (isNumber(char) || isHexadecimalCharacter(char)) {
offset += 1;
}
else {
this.addToNumericResult(input, startIndex, offset, 16);
return this.emitNumericEntity(char, 3);
}
}
this.addToNumericResult(input, startIndex, offset, 16);
return -1;
}
/**
* Parses a decimal numeric entity.
*
* Equivalent to the `Decimal character reference state` in the HTML spec.
*
* @param input The string containing the entity (or a continuation of the entity).
* @param offset The current offset.
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
*/
stateNumericDecimal(input, offset) {
const startIndex = offset;
while (offset < input.length) {
const char = input.charCodeAt(offset);
if (isNumber(char)) {
offset += 1;
}
else {
this.addToNumericResult(input, startIndex, offset, 10);
return this.emitNumericEntity(char, 2);
}
}
this.addToNumericResult(input, startIndex, offset, 10);
return -1;
}
/**
* Validate and emit a numeric entity.
*
* Implements the logic from the `Hexademical character reference start
* state` and `Numeric character reference end state` in the HTML spec.
*
* @param lastCp The last code point of the entity. Used to see if the
* entity was terminated with a semicolon.
* @param expectedLength The minimum number of characters that should be
* consumed. Used to validate that at least one digit
* was consumed.
* @returns The number of characters that were consumed.
*/
emitNumericEntity(lastCp, expectedLength) {
var _a;
// Ensure we consumed at least one digit.
if (this.consumed <= expectedLength) {
(_a = this.errors) === null || _a === void 0 ? void 0 : _a.absenceOfDigitsInNumericCharacterReference(this.consumed);
return 0;
}
// Figure out if this is a legit end of the entity
if (lastCp === CharCodes.SEMI) {
this.consumed += 1;
}
else if (this.decodeMode === DecodingMode.Strict) {
return 0;
}
this.emitCodePoint(replaceCodePoint(this.result), this.consumed);
if (this.errors) {
if (lastCp !== CharCodes.SEMI) {
this.errors.missingSemicolonAfterCharacterReference();
}
this.errors.validateNumericCharacterReference(this.result);
}
return this.consumed;
}
/**
* Parses a named entity.
*
* Equivalent to the `Named character reference state` in the HTML spec.
*
* @param input The string containing the entity (or a continuation of the entity).
* @param offset The current offset.
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
*/
stateNamedEntity(input, offset) {
const { decodeTree } = this;
let current = decodeTree[this.treeIndex];
// The mask is the number of bytes of the value, including the current byte.
let valueLength = (current & BinTrieFlags.VALUE_LENGTH) >> 14;
for (; offset < input.length; offset++, this.excess++) {
const char = input.charCodeAt(offset);
this.treeIndex = determineBranch(decodeTree, current, this.treeIndex + Math.max(1, valueLength), char);
if (this.treeIndex < 0) {
return this.result === 0 ||
// If we are parsing an attribute
(this.decodeMode === DecodingMode.Attribute &&
// We shouldn't have consumed any characters after the entity,
(valueLength === 0 ||
// And there should be no invalid characters.
isEntityInAttributeInvalidEnd(char)))
? 0
: this.emitNotTerminatedNamedEntity();
}
current = decodeTree[this.treeIndex];
valueLength = (current & BinTrieFlags.VALUE_LENGTH) >> 14;
// If the branch is a value, store it and continue
if (valueLength !== 0) {
// If the entity is terminated by a semicolon, we are done.
if (char === CharCodes.SEMI) {
return this.emitNamedEntityData(this.treeIndex, valueLength, this.consumed + this.excess);
}
// If we encounter a non-terminated (legacy) entity while parsing strictly, then ignore it.
if (this.decodeMode !== DecodingMode.Strict) {
this.result = this.treeIndex;
this.consumed += this.excess;
this.excess = 0;
}
}
}
return -1;
}
/**
* Emit a named entity that was not terminated with a semicolon.
*
* @returns The number of characters consumed.
*/
emitNotTerminatedNamedEntity() {
var _a;
const { result, decodeTree } = this;
const valueLength = (decodeTree[result] & BinTrieFlags.VALUE_LENGTH) >> 14;
this.emitNamedEntityData(result, valueLength, this.consumed);
(_a = this.errors) === null || _a === void 0 ? void 0 : _a.missingSemicolonAfterCharacterReference();
return this.consumed;
}
/**
* Emit a named entity.
*
* @param result The index of the entity in the decode tree.
* @param valueLength The number of bytes in the entity.
* @param consumed The number of characters consumed.
*
* @returns The number of characters consumed.
*/
emitNamedEntityData(result, valueLength, consumed) {
const { decodeTree } = this;
this.emitCodePoint(valueLength === 1
? decodeTree[result] & ~BinTrieFlags.VALUE_LENGTH
: decodeTree[result + 1], consumed);
if (valueLength === 3) {
// For multi-byte values, we need to emit the second byte.
this.emitCodePoint(decodeTree[result + 2], consumed);
}
return consumed;
}
/**
* Signal to the parser that the end of the input was reached.
*
* Remaining data will be emitted and relevant errors will be produced.
*
* @returns The number of characters consumed.
*/
end() {
var _a;
switch (this.state) {
case EntityDecoderState.NamedEntity: {
// Emit a named entity if we have one.
return this.result !== 0 &&
(this.decodeMode !== DecodingMode.Attribute ||
this.result === this.treeIndex)
? this.emitNotTerminatedNamedEntity()
: 0;
}
// Otherwise, emit a numeric entity if we have one.
case EntityDecoderState.NumericDecimal: {
return this.emitNumericEntity(0, 2);
}
case EntityDecoderState.NumericHex: {
return this.emitNumericEntity(0, 3);
}
case EntityDecoderState.NumericStart: {
(_a = this.errors) === null || _a === void 0 ? void 0 : _a.absenceOfDigitsInNumericCharacterReference(this.consumed);
return 0;
}
case EntityDecoderState.EntityStart: {
// Return 0 if we have no entity.
return 0;
}
}
}
}
/**
* Creates a function that decodes entities in a string.
*
* @param decodeTree The decode tree.
* @returns A function that decodes entities in a string.
*/
function getDecoder(decodeTree) {
let returnValue = "";
const decoder = new EntityDecoder(decodeTree, (data) => (returnValue += fromCodePoint(data)));
return function decodeWithTrie(input, decodeMode) {
let lastIndex = 0;
let offset = 0;
while ((offset = input.indexOf("&", offset)) >= 0) {
returnValue += input.slice(lastIndex, offset);
decoder.startEntity(decodeMode);
const length = decoder.write(input,
// Skip the "&"
offset + 1);
if (length < 0) {
lastIndex = offset + decoder.end();
break;
}
lastIndex = offset + length;
// If `length` is 0, skip the current `&` and continue.
offset = length === 0 ? lastIndex + 1 : lastIndex;
}
const result = returnValue + input.slice(lastIndex);
// Make sure we don't keep a reference to the final string.
returnValue = "";
return result;
};
}
/**
* Determines the branch of the current node that is taken given the current
* character. This function is used to traverse the trie.
*
* @param decodeTree The trie.
* @param current The current node.
* @param nodeIdx The index right after the current node and its value.
* @param char The current character.
* @returns The index of the next node, or -1 if no branch is taken.
*/
export function determineBranch(decodeTree, current, nodeIndex, char) {
const branchCount = (current & BinTrieFlags.BRANCH_LENGTH) >> 7;
const jumpOffset = current & BinTrieFlags.JUMP_TABLE;
// Case 1: Single branch encoded in jump offset
if (branchCount === 0) {
return jumpOffset !== 0 && char === jumpOffset ? nodeIndex : -1;
}
// Case 2: Multiple branches encoded in jump table
if (jumpOffset) {
const value = char - jumpOffset;
return value < 0 || value >= branchCount
? -1
: decodeTree[nodeIndex + value] - 1;
}
// Case 3: Multiple branches encoded in dictionary
// Binary search for the character.
let lo = nodeIndex;
let hi = lo + branchCount - 1;
while (lo <= hi) {
const mid = (lo + hi) >>> 1;
const midValue = decodeTree[mid];
if (midValue < char) {
lo = mid + 1;
}
else if (midValue > char) {
hi = mid - 1;
}
else {
return decodeTree[mid + branchCount];
}
}
return -1;
}
const htmlDecoder = /* #__PURE__ */ getDecoder(htmlDecodeTree);
const xmlDecoder = /* #__PURE__ */ getDecoder(xmlDecodeTree);
/**
* Decodes an HTML string.
*
* @param htmlString The string to decode.
* @param mode The decoding mode.
* @returns The decoded string.
*/
export function decodeHTML(htmlString, mode = DecodingMode.Legacy) {
return htmlDecoder(htmlString, mode);
}
/**
* Decodes an HTML string in an attribute.
*
* @param htmlAttribute The string to decode.
* @returns The decoded string.
*/
export function decodeHTMLAttribute(htmlAttribute) {
return htmlDecoder(htmlAttribute, DecodingMode.Attribute);
}
/**
* Decodes an HTML string, requiring all entities to be terminated by a semicolon.
*
* @param htmlString The string to decode.
* @returns The decoded string.
*/
export function decodeHTMLStrict(htmlString) {
return htmlDecoder(htmlString, DecodingMode.Strict);
}
/**
* Decodes an XML string, requiring all entities to be terminated by a semicolon.
*
* @param xmlString The string to decode.
* @returns The decoded string.
*/
export function decodeXML(xmlString) {
return xmlDecoder(xmlString, DecodingMode.Strict);
}
// Re-export for use by eg. htmlparser2
export { htmlDecodeTree } from "./generated/decode-data-html.js";
export { xmlDecodeTree } from "./generated/decode-data-xml.js";
export { decodeCodePoint, replaceCodePoint, fromCodePoint, } from "./decode-codepoint.js";
//# sourceMappingURL=decode.js.map
@@ -0,0 +1,61 @@
var apply = require('./_apply'),
arrayMap = require('./_arrayMap'),
baseFlatten = require('./_baseFlatten'),
baseIteratee = require('./_baseIteratee'),
baseRest = require('./_baseRest'),
baseUnary = require('./_baseUnary'),
castRest = require('./_castRest'),
isArray = require('./isArray');
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMin = Math.min;
/**
* Creates a function that invokes `func` with its arguments transformed.
*
* @static
* @since 4.0.0
* @memberOf _
* @category Function
* @param {Function} func The function to wrap.
* @param {...(Function|Function[])} [transforms=[_.identity]]
* The argument transforms.
* @returns {Function} Returns the new function.
* @example
*
* function doubled(n) {
* return n * 2;
* }
*
* function square(n) {
* return n * n;
* }
*
* var func = _.overArgs(function(x, y) {
* return [x, y];
* }, [square, doubled]);
*
* func(9, 3);
* // => [81, 6]
*
* func(10, 5);
* // => [100, 10]
*/
var overArgs = castRest(function(func, transforms) {
transforms = (transforms.length == 1 && isArray(transforms[0]))
? arrayMap(transforms[0], baseUnary(baseIteratee))
: arrayMap(baseFlatten(transforms, 1), baseUnary(baseIteratee));
var funcsLength = transforms.length;
return baseRest(function(args) {
var index = -1,
length = nativeMin(args.length, funcsLength);
while (++index < length) {
args[index] = transforms[index].call(this, args[index]);
}
return apply(func, this, args);
});
});
module.exports = overArgs;
@@ -0,0 +1,24 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v1.0.1](https://github.com/es-shims/dunder-proto/compare/v1.0.0...v1.0.1) - 2024-12-16
### Commits
- [Fix] do not crash when `--disable-proto=throw` [`6c367d9`](https://github.com/es-shims/dunder-proto/commit/6c367d919bc1604778689a297bbdbfea65752847)
- [Tests] ensure noproto tests only use the current version of dunder-proto [`b02365b`](https://github.com/es-shims/dunder-proto/commit/b02365b9cf889c4a2cac7be0c3cfc90a789af36c)
- [Dev Deps] update `@arethetypeswrong/cli`, `@types/tape` [`e3c5c3b`](https://github.com/es-shims/dunder-proto/commit/e3c5c3bd81cf8cef7dff2eca19e558f0e307f666)
- [Deps] update `call-bind-apply-helpers` [`19f1da0`](https://github.com/es-shims/dunder-proto/commit/19f1da028b8dd0d05c85bfd8f7eed2819b686450)
## v1.0.0 - 2024-12-06
### Commits
- Initial implementation, tests, readme, types [`a5b74b0`](https://github.com/es-shims/dunder-proto/commit/a5b74b0082f5270cb0905cd9a2e533cee7498373)
- Initial commit [`73fb5a3`](https://github.com/es-shims/dunder-proto/commit/73fb5a353b51ac2ab00c9fdeb0114daffd4c07a8)
- npm init [`80152dc`](https://github.com/es-shims/dunder-proto/commit/80152dc98155da4eb046d9f67a87ed96e8280a1d)
- Only apps should have lockfiles [`03e6660`](https://github.com/es-shims/dunder-proto/commit/03e6660a1d70dc401f3e217a031475ec537243dd)
@@ -0,0 +1,12 @@
// This file was generated by lezer-generator. You probably shouldn't edit it.
export const
JsonText = 1,
True = 2,
False = 3,
Null = 4,
Number = 5,
String = 6,
Object = 9,
Property = 10,
PropertyName = 11,
Array = 16
@@ -0,0 +1,65 @@
let OldValue = require('../old-value')
let Value = require('../value')
let flexSpec = require('./flex-spec')
class DisplayFlex extends Value {
constructor(name, prefixes) {
super(name, prefixes)
if (name === 'display-flex') {
this.name = 'flex'
}
}
/**
* Faster check for flex value
*/
check(decl) {
return decl.prop === 'display' && decl.value === this.name
}
/**
* Change value for old specs
*/
old(prefix) {
let prefixed = this.prefixed(prefix)
if (!prefixed) return undefined
return new OldValue(this.name, prefixed)
}
/**
* Return value by spec
*/
prefixed(prefix) {
let spec, value
;[spec, prefix] = flexSpec(prefix)
if (spec === 2009) {
if (this.name === 'flex') {
value = 'box'
} else {
value = 'inline-box'
}
} else if (spec === 2012) {
if (this.name === 'flex') {
value = 'flexbox'
} else {
value = 'inline-flexbox'
}
} else if (spec === 'final') {
value = this.name
}
return prefix + value
}
/**
* Add prefix to value depend on flebox spec version
*/
replace(string, prefix) {
return this.prefixed(prefix)
}
}
DisplayFlex.names = ['display-flex', 'inline-flex']
module.exports = DisplayFlex
@@ -0,0 +1,5 @@
var convert = require('./convert'),
func = convert('isArrayLikeObject', require('../isArrayLikeObject'), require('./_falseOptions'));
func.placeholder = require('./placeholder');
module.exports = func;
@@ -0,0 +1,115 @@
import { Pair } from '../nodes/Pair.js';
import { YAMLMap } from '../nodes/YAMLMap.js';
import { resolveProps } from './resolve-props.js';
import { containsNewline } from './util-contains-newline.js';
import { flowIndentCheck } from './util-flow-indent-check.js';
import { mapIncludes } from './util-map-includes.js';
const startColMsg = 'All mapping items must start at the same column';
function resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError, tag) {
const NodeClass = tag?.nodeClass ?? YAMLMap;
const map = new NodeClass(ctx.schema);
if (ctx.atRoot)
ctx.atRoot = false;
let offset = bm.offset;
let commentEnd = null;
for (const collItem of bm.items) {
const { start, key, sep, value } = collItem;
// key properties
const keyProps = resolveProps(start, {
indicator: 'explicit-key-ind',
next: key ?? sep?.[0],
offset,
onError,
parentIndent: bm.indent,
startOnNewline: true
});
const implicitKey = !keyProps.found;
if (implicitKey) {
if (key) {
if (key.type === 'block-seq')
onError(offset, 'BLOCK_AS_IMPLICIT_KEY', 'A block sequence may not be used as an implicit map key');
else if ('indent' in key && key.indent !== bm.indent)
onError(offset, 'BAD_INDENT', startColMsg);
}
if (!keyProps.anchor && !keyProps.tag && !sep) {
commentEnd = keyProps.end;
if (keyProps.comment) {
if (map.comment)
map.comment += '\n' + keyProps.comment;
else
map.comment = keyProps.comment;
}
continue;
}
if (keyProps.newlineAfterProp || containsNewline(key)) {
onError(key ?? start[start.length - 1], 'MULTILINE_IMPLICIT_KEY', 'Implicit keys need to be on a single line');
}
}
else if (keyProps.found?.indent !== bm.indent) {
onError(offset, 'BAD_INDENT', startColMsg);
}
// key value
ctx.atKey = true;
const keyStart = keyProps.end;
const keyNode = key
? composeNode(ctx, key, keyProps, onError)
: composeEmptyNode(ctx, keyStart, start, null, keyProps, onError);
if (ctx.schema.compat)
flowIndentCheck(bm.indent, key, onError);
ctx.atKey = false;
if (mapIncludes(ctx, map.items, keyNode))
onError(keyStart, 'DUPLICATE_KEY', 'Map keys must be unique');
// value properties
const valueProps = resolveProps(sep ?? [], {
indicator: 'map-value-ind',
next: value,
offset: keyNode.range[2],
onError,
parentIndent: bm.indent,
startOnNewline: !key || key.type === 'block-scalar'
});
offset = valueProps.end;
if (valueProps.found) {
if (implicitKey) {
if (value?.type === 'block-map' && !valueProps.hasNewline)
onError(offset, 'BLOCK_AS_IMPLICIT_KEY', 'Nested mappings are not allowed in compact mappings');
if (ctx.options.strict &&
keyProps.start < valueProps.found.offset - 1024)
onError(keyNode.range, 'KEY_OVER_1024_CHARS', 'The : indicator must be at most 1024 chars after the start of an implicit block mapping key');
}
// value value
const valueNode = value
? composeNode(ctx, value, valueProps, onError)
: composeEmptyNode(ctx, offset, sep, null, valueProps, onError);
if (ctx.schema.compat)
flowIndentCheck(bm.indent, value, onError);
offset = valueNode.range[2];
const pair = new Pair(keyNode, valueNode);
if (ctx.options.keepSourceTokens)
pair.srcToken = collItem;
map.items.push(pair);
}
else {
// key with no value
if (implicitKey)
onError(keyNode.range, 'MISSING_CHAR', 'Implicit map keys need to be followed by map values');
if (valueProps.comment) {
if (keyNode.comment)
keyNode.comment += '\n' + valueProps.comment;
else
keyNode.comment = valueProps.comment;
}
const pair = new Pair(keyNode);
if (ctx.options.keepSourceTokens)
pair.srcToken = collItem;
map.items.push(pair);
}
}
if (commentEnd && commentEnd < offset)
onError(commentEnd, 'IMPOSSIBLE', 'Map comment with trailing content');
map.range = [bm.offset, offset, commentEnd ?? offset];
return map;
}
export { resolveBlockMap };
@@ -0,0 +1,44 @@
import { PluginFunc } from 'dayjs'
declare const plugin: PluginFunc
export = plugin
declare module 'dayjs' {
type WeekdayNames = [string, string, string, string, string, string, string];
type MonthNames = [string, string, string, string, string, string, string, string, string, string, string, string];
interface InstanceLocaleDataReturn {
firstDayOfWeek(): number;
weekdays(instance?: Dayjs): WeekdayNames;
weekdaysShort(instance?: Dayjs): WeekdayNames;
weekdaysMin(instance?: Dayjs): WeekdayNames;
months(instance?: Dayjs): MonthNames;
monthsShort(instance?: Dayjs): MonthNames;
longDateFormat(format: string): string;
meridiem(hour?: number, minute?: number, isLower?: boolean): string;
ordinal(n: number): string
}
interface GlobalLocaleDataReturn {
firstDayOfWeek(): number;
weekdays(): WeekdayNames;
weekdaysShort(): WeekdayNames;
weekdaysMin(): WeekdayNames;
months(): MonthNames;
monthsShort(): MonthNames;
longDateFormat(format: string): string;
meridiem(hour?: number, minute?: number, isLower?: boolean): string;
ordinal(n: number): string
}
interface Dayjs {
localeData(): InstanceLocaleDataReturn;
}
export function weekdays(localOrder?: boolean): WeekdayNames;
export function weekdaysShort(localOrder?: boolean): WeekdayNames;
export function weekdaysMin(localOrder?: boolean): WeekdayNames;
export function monthsShort(): MonthNames;
export function months(): MonthNames;
export function localeData(): GlobalLocaleDataReturn;
}
@@ -0,0 +1,171 @@
import { decodeClientDataJSON } from '../helpers/decodeClientDataJSON.js';
import { toHash } from '../helpers/toHash.js';
import { verifySignature } from '../helpers/verifySignature.js';
import { parseAuthenticatorData } from '../helpers/parseAuthenticatorData.js';
import { parseBackupFlags } from '../helpers/parseBackupFlags.js';
import { matchExpectedRPID } from '../helpers/matchExpectedRPID.js';
import { isoBase64URL, isoUint8Array } from '../helpers/iso/index.js';
/**
* Verify that the user has legitimately completed the authentication process
*
* **Options:**
*
* @param response - Response returned by **@simplewebauthn/browser**'s `startAssertion()`
* @param expectedChallenge - The base64url-encoded `options.challenge` returned by `generateAuthenticationOptions()`
* @param expectedOrigin - Website URL (or array of URLs) that the registration should have occurred on
* @param expectedRPID - RP ID (or array of IDs) that was specified in the registration options
* @param credential - An internal {@link WebAuthnCredential} corresponding to `id` in the authentication response
* @param expectedType **(Optional)** - The response type expected ('webauthn.get')
* @param requireUserVerification **(Optional)** - Enforce user verification by the authenticator (via PIN, fingerprint, etc...) Defaults to `true`
* @param advancedFIDOConfig **(Optional)** - Options for satisfying more stringent FIDO RP feature requirements
* @param advancedFIDOConfig.userVerification **(Optional)** - Enable alternative rules for evaluating the User Presence and User Verified flags in authenticator data: UV (and UP) flags are optional unless this value is `"required"`
*/
export async function verifyAuthenticationResponse(options) {
const { response, expectedChallenge, expectedOrigin, expectedRPID, expectedType, credential, requireUserVerification = true, advancedFIDOConfig, } = options;
const { id, rawId, type: credentialType, response: assertionResponse } = response;
// Ensure credential specified an ID
if (!id) {
throw new Error('Missing credential ID');
}
// Ensure ID is base64url-encoded
if (id !== rawId) {
throw new Error('Credential ID was not base64url-encoded');
}
// Make sure credential type is public-key
if (credentialType !== 'public-key') {
throw new Error(`Unexpected credential type ${credentialType}, expected "public-key"`);
}
if (!response) {
throw new Error('Credential missing response');
}
if (typeof assertionResponse?.clientDataJSON !== 'string') {
throw new Error('Credential response clientDataJSON was not a string');
}
const clientDataJSON = decodeClientDataJSON(assertionResponse.clientDataJSON);
const { type, origin, challenge, tokenBinding } = clientDataJSON;
// Make sure we're handling an authentication
if (Array.isArray(expectedType)) {
if (!expectedType.includes(type)) {
const joinedExpectedType = expectedType.join(', ');
throw new Error(`Unexpected authentication response type "${type}", expected one of: ${joinedExpectedType}`);
}
}
else if (expectedType) {
if (type !== expectedType) {
throw new Error(`Unexpected authentication response type "${type}", expected "${expectedType}"`);
}
}
else if (type !== 'webauthn.get') {
throw new Error(`Unexpected authentication response type: ${type}`);
}
// Ensure the device provided the challenge we gave it
if (typeof expectedChallenge === 'function') {
if (!(await expectedChallenge(challenge))) {
throw new Error(`Custom challenge verifier returned false for registration response challenge "${challenge}"`);
}
}
else if (challenge !== expectedChallenge) {
throw new Error(`Unexpected authentication response challenge "${challenge}", expected "${expectedChallenge}"`);
}
// Check that the origin is our site
if (Array.isArray(expectedOrigin)) {
if (!expectedOrigin.includes(origin)) {
const joinedExpectedOrigin = expectedOrigin.join(', ');
throw new Error(`Unexpected authentication response origin "${origin}", expected one of: ${joinedExpectedOrigin}`);
}
}
else {
if (origin !== expectedOrigin) {
throw new Error(`Unexpected authentication response origin "${origin}", expected "${expectedOrigin}"`);
}
}
if (!isoBase64URL.isBase64URL(assertionResponse.authenticatorData)) {
throw new Error('Credential response authenticatorData was not a base64url string');
}
if (!isoBase64URL.isBase64URL(assertionResponse.signature)) {
throw new Error('Credential response signature was not a base64url string');
}
if (assertionResponse.userHandle &&
typeof assertionResponse.userHandle !== 'string') {
throw new Error('Credential response userHandle was not a string');
}
if (tokenBinding) {
if (typeof tokenBinding !== 'object') {
throw new Error('ClientDataJSON tokenBinding was not an object');
}
if (['present', 'supported', 'notSupported'].indexOf(tokenBinding.status) < 0) {
throw new Error(`Unexpected tokenBinding status ${tokenBinding.status}`);
}
}
const authDataBuffer = isoBase64URL.toBuffer(assertionResponse.authenticatorData);
const parsedAuthData = parseAuthenticatorData(authDataBuffer);
const { rpIdHash, flags, counter, extensionsData } = parsedAuthData;
// Make sure the response's RP ID is ours
let expectedRPIDs = [];
if (typeof expectedRPID === 'string') {
expectedRPIDs = [expectedRPID];
}
else {
expectedRPIDs = expectedRPID;
}
const matchedRPID = await matchExpectedRPID(rpIdHash, expectedRPIDs);
if (advancedFIDOConfig !== undefined) {
const { userVerification: fidoUserVerification } = advancedFIDOConfig;
/**
* Use FIDO Conformance-defined rules for verifying UP and UV flags
*/
if (fidoUserVerification === 'required') {
// Require `flags.uv` be true (implies `flags.up` is true)
if (!flags.uv) {
throw new Error('User verification required, but user could not be verified');
}
}
else if (fidoUserVerification === 'preferred' ||
fidoUserVerification === 'discouraged') {
// Ignore `flags.uv`
}
}
else {
/**
* Use WebAuthn spec-defined rules for verifying UP and UV flags
*/
// WebAuthn only requires the user presence flag be true
if (!flags.up) {
throw new Error('User not present during authentication');
}
// Enforce user verification if required
if (requireUserVerification && !flags.uv) {
throw new Error('User verification required, but user could not be verified');
}
}
const clientDataHash = await toHash(isoBase64URL.toBuffer(assertionResponse.clientDataJSON));
const signatureBase = isoUint8Array.concat([authDataBuffer, clientDataHash]);
const signature = isoBase64URL.toBuffer(assertionResponse.signature);
if ((counter > 0 || credential.counter > 0) &&
counter <= credential.counter) {
// Error out when the counter in the DB is greater than or equal to the counter in the
// dataStruct. It's related to how the authenticator maintains the number of times its been
// used for this client. If this happens, then someone's somehow increased the counter
// on the device without going through this site
throw new Error(`Response counter value ${counter} was lower than expected ${credential.counter}`);
}
const { credentialDeviceType, credentialBackedUp } = parseBackupFlags(flags);
const toReturn = {
verified: await verifySignature({
signature,
data: signatureBase,
credentialPublicKey: credential.publicKey,
}),
authenticationInfo: {
newCounter: counter,
credentialID: credential.id,
userVerified: flags.uv,
credentialDeviceType,
credentialBackedUp,
authenticatorExtensionResults: extensionsData,
origin: clientDataJSON.origin,
rpID: matchedRPID,
},
};
return toReturn;
}
@@ -0,0 +1 @@
{"version":3,"file":"curryLazyBuildPlanServiceNodeFromResolvedValueElementMetadata.d.ts","sourceRoot":"","sources":["../../../../src/planning/actions/curryLazyBuildPlanServiceNodeFromResolvedValueElementMetadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACvD,OAAO,EAAE,0BAA0B,EAAE,MAAM,uDAAuD,CAAC;AACnG,OAAO,EAAE,yBAAyB,EAAE,MAAM,+CAA+C,CAAC;AAG1F,OAAO,EAAE,4BAA4B,EAAE,MAAM,oDAAoD,CAAC;AAClG,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAGxD,wBAAgB,6DAA6D,CAC3E,wBAAwB,EAAE,CACxB,MAAM,EAAE,cAAc,EACtB,sBAAsB,EAAE,yBAAyB,CAAC,0BAA0B,CAAC,EAC7E,eAAe,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,EACnC,UAAU,EAAE,iBAAiB,EAC7B,eAAe,EAAE,OAAO,KACrB,eAAe,EAAE,GACrB,CACD,MAAM,EAAE,aAAa,EACrB,sBAAsB,EAAE,yBAAyB,CAAC,0BAA0B,CAAC,EAC7E,eAAe,EAAE,4BAA4B,KAC1C,eAAe,GAAG,SAAS,CA+B/B"}
@@ -0,0 +1,20 @@
<!-- This file is automatically added by @npmcli/template-oss. Do not edit. -->
ISC License
Copyright npm, Inc.
Permission to use, copy, modify, and/or distribute this
software for any purpose with or without fee is hereby
granted, provided that the above copyright notice and this
permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND NPM DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
EVENT SHALL NPM BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
USE OR PERFORMANCE OF THIS SOFTWARE.
@@ -0,0 +1,89 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "nesting", {
enumerable: true,
get: function() {
return nesting;
}
});
const _postcss = /*#__PURE__*/ _interop_require_default(require("postcss"));
const _postcssnested = /*#__PURE__*/ _interop_require_default(require("postcss-nested"));
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function nesting(opts = _postcssnested.default) {
return (root, result)=>{
root.walkAtRules("screen", (rule)=>{
rule.name = "media";
rule.params = `screen(${rule.params})`;
});
root.walkAtRules("apply", (rule)=>{
rule.before(_postcss.default.decl({
prop: "__apply",
value: rule.params,
source: rule.source
}));
rule.remove();
});
let plugin = (()=>{
var _opts_hasOwnProperty;
if (typeof opts === "function" || typeof opts === "object" && (opts === null || opts === void 0 ? void 0 : (_opts_hasOwnProperty = opts.hasOwnProperty) === null || _opts_hasOwnProperty === void 0 ? void 0 : _opts_hasOwnProperty.call(opts, "postcssPlugin"))) {
return opts;
}
if (typeof opts === "string") {
return require(opts);
}
if (Object.keys(opts).length <= 0) {
return _postcssnested.default;
}
throw new Error("tailwindcss/nesting should be loaded with a nesting plugin.");
})();
(0, _postcss.default)([
plugin
]).process(root, result.opts).sync();
root.walkDecls("__apply", (decl)=>{
decl.before(_postcss.default.atRule({
name: "apply",
params: decl.value,
source: decl.source
}));
decl.remove();
});
/**
* Use a private PostCSS API to remove the "clean" flag from the entire AST.
* This is done because running process() on the AST will set the "clean"
* flag on all nodes, which we don't want.
*
* This causes downstream plugins using the visitor API to be skipped.
*
* This is guarded because the PostCSS API is not public
* and may change in future versions of PostCSS.
*
* See https://github.com/postcss/postcss/issues/1712 for more details
*
* @param {import('postcss').Node} node
*/ function markDirty(node) {
if (!("markDirty" in node)) {
return;
}
// Traverse the tree down to the leaf nodes
if (node.nodes) {
node.nodes.forEach((n)=>markDirty(n));
}
// If it's a leaf node mark it as dirty
// We do this here because marking a node as dirty
// will walk up the tree and mark all parents as dirty
// resulting in a lot of unnecessary work if we did this
// for every single node
if (!node.nodes) {
node.markDirty();
}
}
markDirty(root);
return root;
};
}
@@ -0,0 +1 @@
{"version":3,"file":"style-to-object.js","sources":["../node_modules/inline-style-parser/esm/index.mjs","../src/index.ts"],"sourcesContent":["// http://www.w3.org/TR/CSS21/grammar.html\n// https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027\nvar COMMENT_REGEX = /\\/\\*[^*]*\\*+([^/*][^*]*\\*+)*\\//g;\n\nvar NEWLINE_REGEX = /\\n/g;\nvar WHITESPACE_REGEX = /^\\s*/;\n\n// declaration\nvar PROPERTY_REGEX = /^(\\*?[-#/*\\\\\\w]+(\\[[0-9a-z_-]+\\])?)\\s*/;\nvar COLON_REGEX = /^:\\s*/;\nvar VALUE_REGEX = /^((?:'(?:\\\\'|.)*?'|\"(?:\\\\\"|.)*?\"|\\([^)]*?\\)|[^};])+)/;\nvar SEMICOLON_REGEX = /^[;\\s]*/;\n\n// https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Polyfill\nvar TRIM_REGEX = /^\\s+|\\s+$/g;\n\n// strings\nvar NEWLINE = '\\n';\nvar FORWARD_SLASH = '/';\nvar ASTERISK = '*';\nvar EMPTY_STRING = '';\n\n// types\nvar TYPE_COMMENT = 'comment';\nvar TYPE_DECLARATION = 'declaration';\n\n/**\n * @param {String} style\n * @param {Object} [options]\n * @return {Object[]}\n * @throws {TypeError}\n * @throws {Error}\n */\nfunction index (style, options) {\n if (typeof style !== 'string') {\n throw new TypeError('First argument must be a string');\n }\n\n if (!style) return [];\n\n options = options || {};\n\n /**\n * Positional.\n */\n var lineno = 1;\n var column = 1;\n\n /**\n * Update lineno and column based on `str`.\n *\n * @param {String} str\n */\n function updatePosition(str) {\n var lines = str.match(NEWLINE_REGEX);\n if (lines) lineno += lines.length;\n var i = str.lastIndexOf(NEWLINE);\n column = ~i ? str.length - i : column + str.length;\n }\n\n /**\n * Mark position and patch `node.position`.\n *\n * @return {Function}\n */\n function position() {\n var start = { line: lineno, column: column };\n return function (node) {\n node.position = new Position(start);\n whitespace();\n return node;\n };\n }\n\n /**\n * Store position information for a node.\n *\n * @constructor\n * @property {Object} start\n * @property {Object} end\n * @property {undefined|String} source\n */\n function Position(start) {\n this.start = start;\n this.end = { line: lineno, column: column };\n this.source = options.source;\n }\n\n /**\n * Non-enumerable source string.\n */\n Position.prototype.content = style;\n\n /**\n * Error `msg`.\n *\n * @param {String} msg\n * @throws {Error}\n */\n function error(msg) {\n var err = new Error(\n options.source + ':' + lineno + ':' + column + ': ' + msg\n );\n err.reason = msg;\n err.filename = options.source;\n err.line = lineno;\n err.column = column;\n err.source = style;\n\n if (options.silent) ; else {\n throw err;\n }\n }\n\n /**\n * Match `re` and return captures.\n *\n * @param {RegExp} re\n * @return {undefined|Array}\n */\n function match(re) {\n var m = re.exec(style);\n if (!m) return;\n var str = m[0];\n updatePosition(str);\n style = style.slice(str.length);\n return m;\n }\n\n /**\n * Parse whitespace.\n */\n function whitespace() {\n match(WHITESPACE_REGEX);\n }\n\n /**\n * Parse comments.\n *\n * @param {Object[]} [rules]\n * @return {Object[]}\n */\n function comments(rules) {\n var c;\n rules = rules || [];\n while ((c = comment())) {\n if (c !== false) {\n rules.push(c);\n }\n }\n return rules;\n }\n\n /**\n * Parse comment.\n *\n * @return {Object}\n * @throws {Error}\n */\n function comment() {\n var pos = position();\n if (FORWARD_SLASH != style.charAt(0) || ASTERISK != style.charAt(1)) return;\n\n var i = 2;\n while (\n EMPTY_STRING != style.charAt(i) &&\n (ASTERISK != style.charAt(i) || FORWARD_SLASH != style.charAt(i + 1))\n ) {\n ++i;\n }\n i += 2;\n\n if (EMPTY_STRING === style.charAt(i - 1)) {\n return error('End of comment missing');\n }\n\n var str = style.slice(2, i - 2);\n column += 2;\n updatePosition(str);\n style = style.slice(i);\n column += 2;\n\n return pos({\n type: TYPE_COMMENT,\n comment: str\n });\n }\n\n /**\n * Parse declaration.\n *\n * @return {Object}\n * @throws {Error}\n */\n function declaration() {\n var pos = position();\n\n // prop\n var prop = match(PROPERTY_REGEX);\n if (!prop) return;\n comment();\n\n // :\n if (!match(COLON_REGEX)) return error(\"property missing ':'\");\n\n // val\n var val = match(VALUE_REGEX);\n\n var ret = pos({\n type: TYPE_DECLARATION,\n property: trim(prop[0].replace(COMMENT_REGEX, EMPTY_STRING)),\n value: val\n ? trim(val[0].replace(COMMENT_REGEX, EMPTY_STRING))\n : EMPTY_STRING\n });\n\n // ;\n match(SEMICOLON_REGEX);\n\n return ret;\n }\n\n /**\n * Parse declarations.\n *\n * @return {Object[]}\n */\n function declarations() {\n var deLine truncated
@@ -0,0 +1,36 @@
"use strict"
const {
definePrototypeMethodHandler,
} = require("../util/define-prototype-method-handler")
module.exports = {
meta: {
docs: {
description:
"disallow the `NumberFormat.prototype.formatRange` method.",
category: "ES2023-Intl-API",
recommended: false,
url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-intl-numberformat-prototype-formatrange.html",
},
fixable: null,
messages: {
forbidden: "ES2023 Intl API '{{name}}' method is forbidden.",
},
schema: [
{
type: "object",
properties: {
aggressive: { type: "boolean" },
},
additionalProperties: false,
},
],
type: "problem",
},
create(context) {
return definePrototypeMethodHandler(context, {
"Intl.NumberFormat": ["formatRange"],
})
},
}
@@ -0,0 +1,8 @@
import { r as rangeOfUnits } from "./constants-BuFquuHl.mjs";
const units = rangeOfUnits.reduce((acc, unit) => {
acc[unit.toUpperCase()] = unit;
return acc;
}, {});
export {
units as default
};
@@ -0,0 +1,459 @@
/*!
* content-disposition
* Copyright(c) 2014-2017 Douglas Christopher Wilson
* MIT Licensed
*/
'use strict'
/**
* Module exports.
* @public
*/
module.exports = contentDisposition
module.exports.parse = parse
/**
* Module dependencies.
* @private
*/
var basename = require('path').basename
var Buffer = require('safe-buffer').Buffer
/**
* RegExp to match non attr-char, *after* encodeURIComponent (i.e. not including "%")
* @private
*/
var ENCODE_URL_ATTR_CHAR_REGEXP = /[\x00-\x20"'()*,/:;<=>?@[\\\]{}\x7f]/g // eslint-disable-line no-control-regex
/**
* RegExp to match percent encoding escape.
* @private
*/
var HEX_ESCAPE_REGEXP = /%[0-9A-Fa-f]{2}/
var HEX_ESCAPE_REPLACE_REGEXP = /%([0-9A-Fa-f]{2})/g
/**
* RegExp to match non-latin1 characters.
* @private
*/
var NON_LATIN1_REGEXP = /[^\x20-\x7e\xa0-\xff]/g
/**
* RegExp to match quoted-pair in RFC 2616
*
* quoted-pair = "\" CHAR
* CHAR = <any US-ASCII character (octets 0 - 127)>
* @private
*/
var QESC_REGEXP = /\\([\u0000-\u007f])/g // eslint-disable-line no-control-regex
/**
* RegExp to match chars that must be quoted-pair in RFC 2616
* @private
*/
var QUOTE_REGEXP = /([\\"])/g
/**
* RegExp for various RFC 2616 grammar
*
* parameter = token "=" ( token | quoted-string )
* token = 1*<any CHAR except CTLs or separators>
* separators = "(" | ")" | "<" | ">" | "@"
* | "," | ";" | ":" | "\" | <">
* | "/" | "[" | "]" | "?" | "="
* | "{" | "}" | SP | HT
* quoted-string = ( <"> *(qdtext | quoted-pair ) <"> )
* qdtext = <any TEXT except <">>
* quoted-pair = "\" CHAR
* CHAR = <any US-ASCII character (octets 0 - 127)>
* TEXT = <any OCTET except CTLs, but including LWS>
* LWS = [CRLF] 1*( SP | HT )
* CRLF = CR LF
* CR = <US-ASCII CR, carriage return (13)>
* LF = <US-ASCII LF, linefeed (10)>
* SP = <US-ASCII SP, space (32)>
* HT = <US-ASCII HT, horizontal-tab (9)>
* CTL = <any US-ASCII control character (octets 0 - 31) and DEL (127)>
* OCTET = <any 8-bit sequence of data>
* @private
*/
var PARAM_REGEXP = /;[\x09\x20]*([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*=[\x09\x20]*("(?:[\x20!\x23-\x5b\x5d-\x7e\x80-\xff]|\\[\x20-\x7e])*"|[!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*/g // eslint-disable-line no-control-regex
var TEXT_REGEXP = /^[\x20-\x7e\x80-\xff]+$/
var TOKEN_REGEXP = /^[!#$%&'*+.0-9A-Z^_`a-z|~-]+$/
/**
* RegExp for various RFC 5987 grammar
*
* ext-value = charset "'" [ language ] "'" value-chars
* charset = "UTF-8" / "ISO-8859-1" / mime-charset
* mime-charset = 1*mime-charsetc
* mime-charsetc = ALPHA / DIGIT
* / "!" / "#" / "$" / "%" / "&"
* / "+" / "-" / "^" / "_" / "`"
* / "{" / "}" / "~"
* language = ( 2*3ALPHA [ extlang ] )
* / 4ALPHA
* / 5*8ALPHA
* extlang = *3( "-" 3ALPHA )
* value-chars = *( pct-encoded / attr-char )
* pct-encoded = "%" HEXDIG HEXDIG
* attr-char = ALPHA / DIGIT
* / "!" / "#" / "$" / "&" / "+" / "-" / "."
* / "^" / "_" / "`" / "|" / "~"
* @private
*/
var EXT_VALUE_REGEXP = /^([A-Za-z0-9!#$%&+\-^_`{}~]+)'(?:[A-Za-z]{2,3}(?:-[A-Za-z]{3}){0,3}|[A-Za-z]{4,8}|)'((?:%[0-9A-Fa-f]{2}|[A-Za-z0-9!#$&+.^_`|~-])+)$/
/**
* RegExp for various RFC 6266 grammar
*
* disposition-type = "inline" | "attachment" | disp-ext-type
* disp-ext-type = token
* disposition-parm = filename-parm | disp-ext-parm
* filename-parm = "filename" "=" value
* | "filename*" "=" ext-value
* disp-ext-parm = token "=" value
* | ext-token "=" ext-value
* ext-token = <the characters in token, followed by "*">
* @private
*/
var DISPOSITION_TYPE_REGEXP = /^([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*(?:$|;)/ // eslint-disable-line no-control-regex
/**
* Create an attachment Content-Disposition header.
*
* @param {string} [filename]
* @param {object} [options]
* @param {string} [options.type=attachment]
* @param {string|boolean} [options.fallback=true]
* @return {string}
* @public
*/
function contentDisposition (filename, options) {
var opts = options || {}
// get type
var type = opts.type || 'attachment'
// get parameters
var params = createparams(filename, opts.fallback)
// format into string
return format(new ContentDisposition(type, params))
}
/**
* Create parameters object from filename and fallback.
*
* @param {string} [filename]
* @param {string|boolean} [fallback=true]
* @return {object}
* @private
*/
function createparams (filename, fallback) {
if (filename === undefined) {
return
}
var params = {}
if (typeof filename !== 'string') {
throw new TypeError('filename must be a string')
}
// fallback defaults to true
if (fallback === undefined) {
fallback = true
}
if (typeof fallback !== 'string' && typeof fallback !== 'boolean') {
throw new TypeError('fallback must be a string or boolean')
}
if (typeof fallback === 'string' && NON_LATIN1_REGEXP.test(fallback)) {
throw new TypeError('fallback must be ISO-8859-1 string')
}
// restrict to file base name
var name = basename(filename)
// determine if name is suitable for quoted string
var isQuotedString = TEXT_REGEXP.test(name)
// generate fallback name
var fallbackName = typeof fallback !== 'string'
? fallback && getlatin1(name)
: basename(fallback)
var hasFallback = typeof fallbackName === 'string' && fallbackName !== name
// set extended filename parameter
if (hasFallback || !isQuotedString || HEX_ESCAPE_REGEXP.test(name)) {
params['filename*'] = name
}
// set filename parameter
if (isQuotedString || hasFallback) {
params.filename = hasFallback
? fallbackName
: name
}
return params
}
/**
* Format object to Content-Disposition header.
*
* @param {object} obj
* @param {string} obj.type
* @param {object} [obj.parameters]
* @return {string}
* @private
*/
function format (obj) {
var parameters = obj.parameters
var type = obj.type
if (!type || typeof type !== 'string' || !TOKEN_REGEXP.test(type)) {
throw new TypeError('invalid type')
}
// start with normalized type
var string = String(type).toLowerCase()
// append parameters
if (parameters && typeof parameters === 'object') {
var param
var params = Object.keys(parameters).sort()
for (var i = 0; i < params.length; i++) {
param = params[i]
var val = param.slice(-1) === '*'
? ustring(parameters[param])
: qstring(parameters[param])
string += '; ' + param + '=' + val
}
}
return string
}
/**
* Decode a RFC 5987 field value (gracefully).
*
* @param {string} str
* @return {string}
* @private
*/
function decodefield (str) {
var match = EXT_VALUE_REGEXP.exec(str)
if (!match) {
throw new TypeError('invalid extended field value')
}
var charset = match[1].toLowerCase()
var encoded = match[2]
var value
// to binary string
var binary = encoded.replace(HEX_ESCAPE_REPLACE_REGEXP, pdecode)
switch (charset) {
case 'iso-8859-1':
value = getlatin1(binary)
break
case 'utf-8':
case 'utf8':
value = Buffer.from(binary, 'binary').toString('utf8')
break
default:
throw new TypeError('unsupported charset in extended field')
}
return value
}
/**
* Get ISO-8859-1 version of string.
*
* @param {string} val
* @return {string}
* @private
*/
function getlatin1 (val) {
// simple Unicode -> ISO-8859-1 transformation
return String(val).replace(NON_LATIN1_REGEXP, '?')
}
/**
* Parse Content-Disposition header string.
*
* @param {string} string
* @return {object}
* @public
*/
function parse (string) {
if (!string || typeof string !== 'string') {
throw new TypeError('argument string is required')
}
var match = DISPOSITION_TYPE_REGEXP.exec(string)
if (!match) {
throw new TypeError('invalid type format')
}
// normalize type
var index = match[0].length
var type = match[1].toLowerCase()
var key
var names = []
var params = {}
var value
// calculate index to start at
index = PARAM_REGEXP.lastIndex = match[0].slice(-1) === ';'
? index - 1
: index
// match parameters
while ((match = PARAM_REGEXP.exec(string))) {
if (match.index !== index) {
throw new TypeError('invalid parameter format')
}
index += match[0].length
key = match[1].toLowerCase()
value = match[2]
if (names.indexOf(key) !== -1) {
throw new TypeError('invalid duplicate parameter')
}
names.push(key)
if (key.indexOf('*') + 1 === key.length) {
// decode extended value
key = key.slice(0, -1)
value = decodefield(value)
// overwrite existing value
params[key] = value
continue
}
if (typeof params[key] === 'string') {
continue
}
if (value[0] === '"') {
// remove quotes and escapes
value = value
.slice(1, -1)
.replace(QESC_REGEXP, '$1')
}
params[key] = value
}
if (index !== -1 && index !== string.length) {
throw new TypeError('invalid parameter format')
}
return new ContentDisposition(type, params)
}
/**
* Percent decode a single character.
*
* @param {string} str
* @param {string} hex
* @return {string}
* @private
*/
function pdecode (str, hex) {
return String.fromCharCode(parseInt(hex, 16))
}
/**
* Percent encode a single character.
*
* @param {string} char
* @return {string}
* @private
*/
function pencode (char) {
return '%' + String(char)
.charCodeAt(0)
.toString(16)
.toUpperCase()
}
/**
* Quote a string for HTTP.
*
* @param {string} val
* @return {string}
* @private
*/
function qstring (val) {
var str = String(val)
return '"' + str.replace(QUOTE_REGEXP, '\\$1') + '"'
}
/**
* Encode a Unicode string for HTTP (RFC 5987).
*
* @param {string} val
* @return {string}
* @private
*/
function ustring (val) {
var str = String(val)
// percent encode as UTF-8
var encoded = encodeURIComponent(str)
.replace(ENCODE_URL_ATTR_CHAR_REGEXP, pencode)
return 'UTF-8\'\'' + encoded
}
/**
* Class for parsed Content-Disposition header for v8 optimization
*
* @public
* @param {string} type
* @param {object} parameters
* @constructor
*/
function ContentDisposition (type, parameters) {
this.type = type
this.parameters = parameters
}
@@ -0,0 +1,8 @@
/**
* @param {State} state
* @returns {Exclude<Options['bullet'], null | undefined>}
*/
export function checkBulletOther(state: State): Exclude<Options["bullet"], null | undefined>;
import type { State } from 'mdast-util-to-markdown';
import type { Options } from 'mdast-util-to-markdown';
//# sourceMappingURL=check-bullet-other.d.ts.map
@@ -0,0 +1 @@
export default function areInputsEqual(newInputs: readonly unknown[], lastInputs: readonly unknown[]): boolean;
@@ -0,0 +1,163 @@
'use strict';
module.exports = function generate__limit(it, $keyword, $ruleType) {
var out = ' ';
var $lvl = it.level;
var $dataLvl = it.dataLevel;
var $schema = it.schema[$keyword];
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
var $breakOnError = !it.opts.allErrors;
var $errorKeyword;
var $data = 'data' + ($dataLvl || '');
var $isData = it.opts.$data && $schema && $schema.$data,
$schemaValue;
if ($isData) {
out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
$schemaValue = 'schema' + $lvl;
} else {
$schemaValue = $schema;
}
var $isMax = $keyword == 'maximum',
$exclusiveKeyword = $isMax ? 'exclusiveMaximum' : 'exclusiveMinimum',
$schemaExcl = it.schema[$exclusiveKeyword],
$isDataExcl = it.opts.$data && $schemaExcl && $schemaExcl.$data,
$op = $isMax ? '<' : '>',
$notOp = $isMax ? '>' : '<',
$errorKeyword = undefined;
if (!($isData || typeof $schema == 'number' || $schema === undefined)) {
throw new Error($keyword + ' must be number');
}
if (!($isDataExcl || $schemaExcl === undefined || typeof $schemaExcl == 'number' || typeof $schemaExcl == 'boolean')) {
throw new Error($exclusiveKeyword + ' must be number or boolean');
}
if ($isDataExcl) {
var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr),
$exclusive = 'exclusive' + $lvl,
$exclType = 'exclType' + $lvl,
$exclIsNumber = 'exclIsNumber' + $lvl,
$opExpr = 'op' + $lvl,
$opStr = '\' + ' + $opExpr + ' + \'';
out += ' var schemaExcl' + ($lvl) + ' = ' + ($schemaValueExcl) + '; ';
$schemaValueExcl = 'schemaExcl' + $lvl;
out += ' var ' + ($exclusive) + '; var ' + ($exclType) + ' = typeof ' + ($schemaValueExcl) + '; if (' + ($exclType) + ' != \'boolean\' && ' + ($exclType) + ' != \'undefined\' && ' + ($exclType) + ' != \'number\') { ';
var $errorKeyword = $exclusiveKeyword;
var $$outStack = $$outStack || [];
$$outStack.push(out);
out = ''; /* istanbul ignore else */
if (it.createErrors !== false) {
out += ' { keyword: \'' + ($errorKeyword || '_exclusiveLimit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';
if (it.opts.messages !== false) {
out += ' , message: \'' + ($exclusiveKeyword) + ' should be boolean\' ';
}
if (it.opts.verbose) {
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
}
out += ' } ';
} else {
out += ' {} ';
}
var __err = out;
out = $$outStack.pop();
if (!it.compositeRule && $breakOnError) {
/* istanbul ignore if */
if (it.async) {
out += ' throw new ValidationError([' + (__err) + ']); ';
} else {
out += ' validate.errors = [' + (__err) + ']; return false; ';
}
} else {
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
}
out += ' } else if ( ';
if ($isData) {
out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || ';
}
out += ' ' + ($exclType) + ' == \'number\' ? ( (' + ($exclusive) + ' = ' + ($schemaValue) + ' === undefined || ' + ($schemaValueExcl) + ' ' + ($op) + '= ' + ($schemaValue) + ') ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaValueExcl) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) : ( (' + ($exclusive) + ' = ' + ($schemaValueExcl) + ' === true) ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaValue) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) || ' + ($data) + ' !== ' + ($data) + ') { var op' + ($lvl) + ' = ' + ($exclusive) + ' ? \'' + ($op) + '\' : \'' + ($op) + '=\'; ';
if ($schema === undefined) {
$errorKeyword = $exclusiveKeyword;
$errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword;
$schemaValue = $schemaValueExcl;
$isData = $isDataExcl;
}
} else {
var $exclIsNumber = typeof $schemaExcl == 'number',
$opStr = $op;
if ($exclIsNumber && $isData) {
var $opExpr = '\'' + $opStr + '\'';
out += ' if ( ';
if ($isData) {
out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || ';
}
out += ' ( ' + ($schemaValue) + ' === undefined || ' + ($schemaExcl) + ' ' + ($op) + '= ' + ($schemaValue) + ' ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaExcl) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) || ' + ($data) + ' !== ' + ($data) + ') { ';
} else {
if ($exclIsNumber && $schema === undefined) {
$exclusive = true;
$errorKeyword = $exclusiveKeyword;
$errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword;
$schemaValue = $schemaExcl;
$notOp += '=';
} else {
if ($exclIsNumber) $schemaValue = Math[$isMax ? 'min' : 'max']($schemaExcl, $schema);
if ($schemaExcl === ($exclIsNumber ? $schemaValue : true)) {
$exclusive = true;
$errorKeyword = $exclusiveKeyword;
$errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword;
$notOp += '=';
} else {
$exclusive = false;
$opStr += '=';
}
}
var $opExpr = '\'' + $opStr + '\'';
out += ' if ( ';
if ($isData) {
out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || ';
}
out += ' ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' || ' + ($data) + ' !== ' + ($data) + ') { ';
}
}
$errorKeyword = $errorKeyword || $keyword;
var $$outStack = $$outStack || [];
$$outStack.push(out);
out = ''; /* istanbul ignore else */
if (it.createErrors !== false) {
out += ' { keyword: \'' + ($errorKeyword || '_limit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { comparison: ' + ($opExpr) + ', limit: ' + ($schemaValue) + ', exclusive: ' + ($exclusive) + ' } ';
if (it.opts.messages !== false) {
out += ' , message: \'should be ' + ($opStr) + ' ';
if ($isData) {
out += '\' + ' + ($schemaValue);
} else {
out += '' + ($schemaValue) + '\'';
}
}
if (it.opts.verbose) {
out += ' , schema: ';
if ($isData) {
out += 'validate.schema' + ($schemaPath);
} else {
out += '' + ($schema);
}
out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
}
out += ' } ';
} else {
out += ' {} ';
}
var __err = out;
out = $$outStack.pop();
if (!it.compositeRule && $breakOnError) {
/* istanbul ignore if */
if (it.async) {
out += ' throw new ValidationError([' + (__err) + ']); ';
} else {
out += ' validate.errors = [' + (__err) + ']; return false; ';
}
} else {
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
}
out += ' } ';
if ($breakOnError) {
out += ' else { ';
}
return out;
}
@@ -0,0 +1,6 @@
/**
* @fileoverview typings for "eslint/universal" module
* @author 唯然<weiran.zsd@outlook.com>
*/
export { Linter } from "./index";
@@ -0,0 +1,62 @@
import baseGetTag from './_baseGetTag.js';
import getPrototype from './_getPrototype.js';
import isObjectLike from './isObjectLike.js';
/** `Object#toString` result references. */
var objectTag = '[object Object]';
/** Used for built-in method references. */
var funcProto = Function.prototype,
objectProto = Object.prototype;
/** Used to resolve the decompiled source of functions. */
var funcToString = funcProto.toString;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/** Used to infer the `Object` constructor. */
var objectCtorString = funcToString.call(Object);
/**
* Checks if `value` is a plain object, that is, an object created by the
* `Object` constructor or one with a `[[Prototype]]` of `null`.
*
* @static
* @memberOf _
* @since 0.8.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
* @example
*
* function Foo() {
* this.a = 1;
* }
*
* _.isPlainObject(new Foo);
* // => false
*
* _.isPlainObject([1, 2, 3]);
* // => false
*
* _.isPlainObject({ 'x': 0, 'y': 0 });
* // => true
*
* _.isPlainObject(Object.create(null));
* // => true
*/
function isPlainObject(value) {
if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
return false;
}
var proto = getPrototype(value);
if (proto === null) {
return true;
}
var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
return typeof Ctor == 'function' && Ctor instanceof Ctor &&
funcToString.call(Ctor) == objectCtorString;
}
export default isPlainObject;
@@ -0,0 +1,62 @@
// ------------------------------------------------------------------
// Type: Module
// ------------------------------------------------------------------
export { Any } from '../any/index.mjs';
export { Argument } from '../argument/index.mjs';
export { Array } from '../array/index.mjs';
export { AsyncIterator } from '../async-iterator/index.mjs';
export { Awaited } from '../awaited/index.mjs';
export { BigInt } from '../bigint/index.mjs';
export { Boolean } from '../boolean/index.mjs';
export { Composite } from '../composite/index.mjs';
export { Const } from '../const/index.mjs';
export { Constructor } from '../constructor/index.mjs';
export { ConstructorParameters } from '../constructor-parameters/index.mjs';
export { Date } from '../date/index.mjs';
export { Enum } from '../enum/index.mjs';
export { Exclude } from '../exclude/index.mjs';
export { Extends } from '../extends/index.mjs';
export { Extract } from '../extract/index.mjs';
export { Function } from '../function/index.mjs';
export { Index } from '../indexed/index.mjs';
export { InstanceType } from '../instance-type/index.mjs';
export { Instantiate } from '../instantiate/index.mjs';
export { Integer } from '../integer/index.mjs';
export { Intersect } from '../intersect/index.mjs';
export { Capitalize, Uncapitalize, Lowercase, Uppercase } from '../intrinsic/index.mjs';
export { Iterator } from '../iterator/index.mjs';
export { KeyOf } from '../keyof/index.mjs';
export { Literal } from '../literal/index.mjs';
export { Mapped } from '../mapped/index.mjs';
export { Module } from '../module/index.mjs';
export { Never } from '../never/index.mjs';
export { Not } from '../not/index.mjs';
export { Null } from '../null/index.mjs';
export { Number } from '../number/index.mjs';
export { Object } from '../object/index.mjs';
export { Omit } from '../omit/index.mjs';
export { Optional } from '../optional/index.mjs';
export { Parameters } from '../parameters/index.mjs';
export { Partial } from '../partial/index.mjs';
export { Pick } from '../pick/index.mjs';
export { Promise } from '../promise/index.mjs';
export { Readonly } from '../readonly/index.mjs';
export { ReadonlyOptional } from '../readonly-optional/index.mjs';
export { Record } from '../record/index.mjs';
export { Recursive } from '../recursive/index.mjs';
export { Ref } from '../ref/index.mjs';
export { RegExp } from '../regexp/index.mjs';
export { Required } from '../required/index.mjs';
export { Rest } from '../rest/index.mjs';
export { ReturnType } from '../return-type/index.mjs';
export { String } from '../string/index.mjs';
export { Symbol } from '../symbol/index.mjs';
export { TemplateLiteral } from '../template-literal/index.mjs';
export { Transform } from '../transform/index.mjs';
export { Tuple } from '../tuple/index.mjs';
export { Uint8Array } from '../uint8array/index.mjs';
export { Undefined } from '../undefined/index.mjs';
export { Union } from '../union/index.mjs';
export { Unknown } from '../unknown/index.mjs';
export { Unsafe } from '../unsafe/index.mjs';
export { Void } from '../void/index.mjs';
@@ -0,0 +1,93 @@
import * as _codemirror_state from '@codemirror/state';
import { LRLanguage, LanguageSupport } from '@codemirror/language';
import { Completion, CompletionContext, CompletionResult, CompletionSource } from '@codemirror/autocomplete';
import { Diagnostic } from '@codemirror/lint';
import { EditorView } from '@codemirror/view';
/**
A language provider based on the [Lezer JavaScript
parser](https://github.com/lezer-parser/javascript), extended with
highlighting and indentation information.
*/
declare const javascriptLanguage: LRLanguage;
/**
A language provider for TypeScript.
*/
declare const typescriptLanguage: LRLanguage;
/**
Language provider for JSX.
*/
declare const jsxLanguage: LRLanguage;
/**
Language provider for JSX + TypeScript.
*/
declare const tsxLanguage: LRLanguage;
/**
JavaScript support. Includes [snippet](https://codemirror.net/6/docs/ref/#lang-javascript.snippets)
and local variable completion.
*/
declare function javascript(config?: {
jsx?: boolean;
typescript?: boolean;
}): LanguageSupport;
/**
Extension that will automatically insert JSX close tags when a `>` or
`/` is typed.
*/
declare const autoCloseTags: _codemirror_state.Extension;
/**
A collection of JavaScript-related
[snippets](https://codemirror.net/6/docs/ref/#autocomplete.snippet).
*/
declare const snippets: readonly Completion[];
/**
A collection of snippet completions for TypeScript. Includes the
JavaScript [snippets](https://codemirror.net/6/docs/ref/#lang-javascript.snippets).
*/
declare const typescriptSnippets: Completion[];
/**
Connects an [ESLint](https://eslint.org/) linter to CodeMirror's
[lint](https://codemirror.net/6/docs/ref/#lint) integration. `eslint` should be an instance of the
[`Linter`](https://eslint.org/docs/developer-guide/nodejs-api#linter)
class, and `config` an optional ESLint configuration. The return
value of this function can be passed to [`linter`](https://codemirror.net/6/docs/ref/#lint.linter)
to create a JavaScript linting extension.
Note that ESLint targets node, and is tricky to run in the
browser. The
[eslint-linter-browserify](https://github.com/UziTech/eslint-linter-browserify)
package may help with that (see
[example](https://github.com/UziTech/eslint-linter-browserify/blob/master/example/script.js)).
*/
declare function esLint(eslint: any, config?: any): (view: EditorView) => Diagnostic[];
/**
Completion source that looks up locally defined names in
JavaScript code.
*/
declare function localCompletionSource(context: CompletionContext): CompletionResult | null;
/**
Helper function for defining JavaScript completion sources. It
returns the completable name and object path for a completion
context, or null if no name/property completion should happen at
that position. For example, when completing after `a.b.c` it will
return `{path: ["a", "b"], name: "c"}`. When completing after `x`
it will return `{path: [], name: "x"}`. When not in a property or
name, it will return null if `context.explicit` is false, and
`{path: [], name: ""}` otherwise.
*/
declare function completionPath(context: CompletionContext): {
path: readonly string[];
name: string;
} | null;
/**
Defines a [completion source](https://codemirror.net/6/docs/ref/#autocomplete.CompletionSource) that
completes from the given scope object (for example `globalThis`).
Will enter properties of the object when completing properties on
a directly-named path.
*/
declare function scopeCompletionSource(scope: any): CompletionSource;
export { autoCloseTags, completionPath, esLint, javascript, javascriptLanguage, jsxLanguage, localCompletionSource, scopeCompletionSource, snippets, tsxLanguage, typescriptLanguage, typescriptSnippets };
@@ -0,0 +1,7 @@
import type { StringReader, StringWriter } from './strings.mts';
export declare const comma: number;
export declare const semicolon: number;
export declare function decodeInteger(reader: StringReader, relative: number): number;
export declare function encodeInteger(builder: StringWriter, num: number, relative: number): number;
export declare function hasMoreVlq(reader: StringReader, max: number): boolean;
//# sourceMappingURL=vlq.d.ts.map
Loaded 100 of 35554 files, more files were not shown because too many files have changed in this diff. Show more