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

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

No files matched your search

@@ -0,0 +1,230 @@
"use client";
import {
useReactAriaPopover
} from "./chunk-C6TMY7KY.mjs";
// src/use-popover.ts
import { useEffect } from "react";
import { useDOMRef } from "@heroui/react-utils";
import { useOverlayTriggerState } from "@react-stately/overlays";
import { useFocusRing } from "@react-aria/focus";
import { ariaHideOutside, useOverlayTrigger, usePreventScroll } from "@react-aria/overlays";
import { getShouldUseAxisPlacement } from "@heroui/aria-utils";
import { mapPropsVariants, useProviderContext } from "@heroui/system";
import { getArrowPlacement } from "@heroui/aria-utils";
import { popover } from "@heroui/theme";
import { mergeProps, mergeRefs } from "@react-aria/utils";
import { clsx, dataAttr, objectToDeps } from "@heroui/shared-utils";
import { useMemo, useCallback, useRef } from "react";
var DEFAULT_PLACEMENT = "top";
function usePopover(originalProps) {
var _a, _b, _c;
const globalContext = useProviderContext();
const [props, variantProps] = mapPropsVariants(originalProps, popover.variantKeys);
const {
as,
ref,
children,
state: stateProp,
triggerRef: triggerRefProp,
scrollRef,
defaultOpen,
onOpenChange,
isOpen: isOpenProp,
isNonModal = true,
shouldFlip = true,
containerPadding = 12,
shouldBlockScroll = false,
isDismissable = true,
shouldCloseOnBlur,
portalContainer,
updatePositionDeps,
dialogProps: dialogPropsProp,
placement: placementProp = DEFAULT_PLACEMENT,
triggerType = "dialog",
showArrow = false,
offset = 7,
crossOffset = 0,
boundaryElement,
isKeyboardDismissDisabled,
shouldCloseOnInteractOutside,
shouldCloseOnScroll,
motionProps,
className,
classNames,
onClose,
...otherProps
} = props;
const Component = as || "div";
const domRef = useDOMRef(ref);
const domTriggerRef = useRef(null);
const wasTriggerPressedRef = useRef(false);
const triggerRef = triggerRefProp || domTriggerRef;
const disableAnimation = (_b = (_a = originalProps.disableAnimation) != null ? _a : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b : false;
const innerState = useOverlayTriggerState({
isOpen: isOpenProp,
defaultOpen,
onOpenChange: (isOpen) => {
onOpenChange == null ? void 0 : onOpenChange(isOpen);
if (!isOpen) {
onClose == null ? void 0 : onClose();
}
}
});
const state = stateProp || innerState;
const {
popoverProps,
underlayProps,
placement: ariaPlacement
} = useReactAriaPopover(
{
triggerRef,
isNonModal,
popoverRef: domRef,
placement: placementProp,
offset,
scrollRef,
isDismissable,
shouldCloseOnBlur,
boundaryElement,
crossOffset,
shouldFlip,
containerPadding,
updatePositionDeps,
isKeyboardDismissDisabled,
shouldCloseOnScroll,
shouldCloseOnInteractOutside
},
state
);
const placement = useMemo(() => {
if (!ariaPlacement) {
return null;
}
return getShouldUseAxisPlacement(ariaPlacement, placementProp) ? ariaPlacement : placementProp;
}, [ariaPlacement, placementProp]);
const { triggerProps } = useOverlayTrigger({ type: triggerType }, state, triggerRef);
const { isFocusVisible, isFocused, focusProps } = useFocusRing();
const slots = useMemo(
() => popover({
...variantProps
}),
[objectToDeps(variantProps)]
);
const baseStyles = clsx(classNames == null ? void 0 : classNames.base, className);
usePreventScroll({
isDisabled: !(shouldBlockScroll && state.isOpen)
});
const getPopoverProps = (props2 = {}) => ({
ref: domRef,
...mergeProps(popoverProps, otherProps, props2),
style: mergeProps(popoverProps.style, otherProps.style, props2.style)
});
const getDialogProps = (props2 = {}) => ({
"data-slot": "base",
"data-open": dataAttr(state.isOpen),
"data-focus": dataAttr(isFocused),
"data-arrow": dataAttr(showArrow),
"data-focus-visible": dataAttr(isFocusVisible),
"data-placement": ariaPlacement ? getArrowPlacement(ariaPlacement, placementProp) : void 0,
...mergeProps(focusProps, dialogPropsProp, props2),
className: slots.base({ class: clsx(baseStyles) }),
style: {
outline: "none"
}
});
const getContentProps = useCallback(
(props2 = {}) => ({
"data-slot": "content",
"data-open": dataAttr(state.isOpen),
"data-arrow": dataAttr(showArrow),
"data-placement": ariaPlacement ? getArrowPlacement(ariaPlacement, placementProp) : void 0,
className: slots.content({ class: clsx(classNames == null ? void 0 : classNames.content, props2.className) })
}),
[slots, state.isOpen, showArrow, placement, placementProp, classNames, ariaPlacement]
);
const onPress = useCallback(
(e) => {
var _a2;
let pressTimer;
if (e.pointerType === "touch" && ((originalProps == null ? void 0 : originalProps.backdrop) === "blur" || (originalProps == null ? void 0 : originalProps.backdrop) === "opaque")) {
pressTimer = setTimeout(() => {
wasTriggerPressedRef.current = true;
}, 100);
} else {
wasTriggerPressedRef.current = true;
}
(_a2 = triggerProps.onPress) == null ? void 0 : _a2.call(triggerProps, e);
return () => {
clearTimeout(pressTimer);
};
},
[triggerProps == null ? void 0 : triggerProps.onPress]
);
const getTriggerProps = useCallback(
(props2 = {}, _ref = null) => {
const { isDisabled, ...otherProps2 } = props2;
return {
"data-slot": "trigger",
...mergeProps({ "aria-haspopup": "dialog" }, triggerProps, otherProps2),
onPress,
isDisabled,
className: slots.trigger({
class: clsx(classNames == null ? void 0 : classNames.trigger, props2.className),
isTriggerDisabled: isDisabled
}),
ref: mergeRefs(_ref, triggerRef)
};
},
[state, triggerProps, onPress, triggerRef]
);
const getBackdropProps = useCallback(
(props2 = {}) => ({
"data-slot": "backdrop",
className: slots.backdrop({ class: classNames == null ? void 0 : classNames.backdrop }),
onClick: (e) => {
if (!wasTriggerPressedRef.current) {
e.preventDefault();
return;
}
state.close();
wasTriggerPressedRef.current = false;
},
...underlayProps,
...props2
}),
[slots, state.isOpen, classNames, underlayProps]
);
useEffect(() => {
if (state.isOpen && (domRef == null ? void 0 : domRef.current)) {
return ariaHideOutside([domRef == null ? void 0 : domRef.current]);
}
}, [state.isOpen, domRef]);
return {
state,
Component,
children,
classNames,
showArrow,
triggerRef,
placement,
isNonModal,
popoverRef: domRef,
portalContainer,
isOpen: state.isOpen,
onClose: state.close,
disableAnimation,
shouldBlockScroll,
backdrop: (_c = originalProps.backdrop) != null ? _c : "transparent",
motionProps,
getBackdropProps,
getPopoverProps,
getTriggerProps,
getDialogProps,
getContentProps
};
}
export {
usePopover
};
@@ -0,0 +1,81 @@
/**
* Like `Array#splice`, but smarter for giant arrays.
*
* `Array#splice` takes all items to be inserted as individual argument which
* causes a stack overflow in V8 when trying to insert 100k items for instance.
*
* Otherwise, this does not return the removed items, and takes `items` as an
* array instead of rest parameters.
*
* @template {unknown} T
* Item type.
* @param {Array<T>} list
* List to operate on.
* @param {number} start
* Index to remove/insert at (can be negative).
* @param {number} remove
* Number of items to remove.
* @param {Array<T>} items
* Items to inject into `list`.
* @returns {undefined}
* Nothing.
*/
export function splice(list, start, remove, items) {
const end = list.length;
let chunkStart = 0;
/** @type {Array<unknown>} */
let parameters;
// Make start between zero and `end` (included).
if (start < 0) {
start = -start > end ? 0 : end + start;
} else {
start = start > end ? end : start;
}
remove = remove > 0 ? remove : 0;
// No need to chunk the items if there’s only a couple (10k) items.
if (items.length < 10000) {
parameters = Array.from(items);
parameters.unshift(start, remove);
// @ts-expect-error Hush, it’s fine.
list.splice(...parameters);
} else {
// Delete `remove` items starting from `start`
if (remove) list.splice(start, remove);
// Insert the items in chunks to not cause stack overflows.
while (chunkStart < items.length) {
parameters = items.slice(chunkStart, chunkStart + 10000);
parameters.unshift(start, 0);
// @ts-expect-error Hush, it’s fine.
list.splice(...parameters);
chunkStart += 10000;
start += 10000;
}
}
}
/**
* Append `items` (an array) at the end of `list` (another array).
* When `list` was empty, returns `items` instead.
*
* This prevents a potentially expensive operation when `list` is empty,
* and adds items in batches to prevent V8 from hanging.
*
* @template {unknown} T
* Item type.
* @param {Array<T>} list
* List to operate on.
* @param {Array<T>} items
* Items to add to `list`.
* @returns {Array<T>}
* Either `list` or `items`.
*/
export function push(list, items) {
if (list.length > 0) {
splice(list, list.length, 0, items);
return list;
}
return items;
}
@@ -0,0 +1,16 @@
# Installation
> `npm install --save @types/resolve`
# Summary
This package contains type definitions for resolve (https://github.com/browserify/resolve).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/resolve.
### Additional Details
* Last updated: Thu, 21 Apr 2022 18:01:43 GMT
* Dependencies: none
* Global values: none
# Credits
These definitions were written by [Mario Nebl](https://github.com/marionebl), [Klaus Meinhardt](https://github.com/ajafff), and [Jordan Harband](https://github.com/ljharb).
@@ -0,0 +1,23 @@
export { B as BaseCoverageProvider } from './chunks/coverage.BUlIqJrL.js';
import 'node:fs';
import 'node:path';
import '@vitest/utils/helpers';
import 'pathe';
import 'picomatch';
import 'tinyglobby';
import 'tinyrainbow';
import './chunks/defaults.BOqNVLsY.js';
import 'node:os';
import './chunks/env.D4Lgay0q.js';
import 'std-env';
import 'node:crypto';
import 'node:module';
import 'node:process';
import 'node:fs/promises';
import 'node:url';
import 'node:assert';
import 'node:v8';
import 'node:util';
import 'vite';
import './chunks/constants.D_Q9UYh-.js';
import './chunks/coverage.D_JHT54q.js';
@@ -0,0 +1 @@
{"mappings":"AAAA,iBAAiB;IAAG,kBAAkB,CAAC,OAAS,GAAG,KAAK,IAAI,CAAC,aAAa,CAAC;IACzE,qBAAqB,CAAC,wDAAyC,CAAC;IAChE,UAAU,CAAC,OAAO,CAAC;IACnB,eAAe,CAAC,sBAAsB,CAAC;IACvC,iBAAiB,CAAC,MAAM,YAAc,GAAG,UAAU,MAAM,CAAC,KAAK,KAAK,EAAE;YAAC,MAAM,CAAC,qBAAqB,CAAC;YAAE,KAAK,IAAM,GAAG,UAAU,MAAM,CAAC,KAAK,KAAK,EAAE,gBAAgB,CAAC;YAAE,OAAO,IAAM,GAAG,UAAU,MAAM,CAAC,KAAK,KAAK,EAAE,iBAAiB,CAAC;QAAA,GAAG,CAAC,CAAC;IACxO,gBAAgB,CAAC,OAAS,GAAG,KAAK,IAAI,CAAC,UAAU,CAAC;AACpD","sources":["packages/@react-aria/grid/intl/sv-SE.json"],"sourcesContent":["{\n \"deselectedItem\": \"{item} ej markerat.\",\n \"longPressToSelect\": \"Tryck länge när du vill öppna väljarläge.\",\n \"select\": \"Markera\",\n \"selectedAll\": \"Alla markerade objekt.\",\n \"selectedCount\": \"{count, plural, =0 {Inga markerade objekt} one {# markerat objekt} other {# markerade objekt}}.\",\n \"selectedItem\": \"{item} markerat.\"\n}\n"],"names":[],"version":3,"file":"sv-SE.main.js.map"}
@@ -0,0 +1,22 @@
module.exports = extractDescription
// Extracts description from contents of a readme file in markdown format
function extractDescription (d) {
if (!d) {
return
}
if (d === 'ERROR: No README data found!') {
return
}
// the first block of text before the first heading
// that isn't the first line heading
d = d.trim().split('\n')
for (var s = 0; d[s] && d[s].trim().match(/^(#|$)/); s++) {
;
}
var l = d.length
for (var e = s + 1; e < l && d[e].trim(); e++) {
;
}
return d.slice(s, e).join(' ').trim()
}
@@ -0,0 +1,34 @@
import { isoCBOR } from './iso/index.js';
/**
* Convert authenticator extension data buffer to a proper object
*
* @param extensionData Authenticator Extension Data buffer
*/
export function decodeAuthenticatorExtensions(extensionData) {
let toCBOR;
try {
toCBOR = isoCBOR.decodeFirst(extensionData);
}
catch (err) {
const _err = err;
throw new Error(`Error decoding authenticator extensions: ${_err.message}`);
}
return convertMapToObjectDeep(toCBOR);
}
/**
* CBOR-encoded extensions can be deeply-nested Maps, which are too deep for a simple
* `Object.entries()`. This method will recursively make sure that all Maps are converted into
* basic objects.
*/
function convertMapToObjectDeep(input) {
const mapped = {};
for (const [key, value] of input) {
if (value instanceof Map) {
mapped[key] = convertMapToObjectDeep(value);
}
else {
mapped[key] = value;
}
}
return mapped;
}
@@ -0,0 +1,17 @@
const AlgSign = [
'secp256r1_ecdsa_sha256_raw',
'secp256r1_ecdsa_sha256_der',
'rsassa_pss_sha256_raw',
'rsassa_pss_sha256_der',
'secp256k1_ecdsa_sha256_raw',
'secp256k1_ecdsa_sha256_der',
'rsassa_pss_sha384_raw',
'rsassa_pkcsv15_sha256_raw',
'rsassa_pkcsv15_sha384_raw',
'rsassa_pkcsv15_sha512_raw',
'rsassa_pkcsv15_sha1_raw',
'secp384r1_ecdsa_sha384_raw',
'secp512r1_ecdsa_sha256_raw',
'ed25519_eddsa_sha512_raw',
];
export {};
@@ -0,0 +1,9 @@
"use strict";
var _check_private_redeclaration = require("./_check_private_redeclaration.cjs");
function _class_private_field_init(obj, privateMap, value) {
_check_private_redeclaration._(obj, privateMap);
privateMap.set(obj, value);
}
exports._ = _class_private_field_init;
@@ -0,0 +1,25 @@
MIT License
Copyright (c) Nicolas Gallagher
Copyright (c) Jonathan Neal
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Copyright (c) Adam Wathan
Copyright (c) Jonathan Reinink
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,334 @@
# mdast-util-gfm-autolink-literal
[![Build][build-badge]][build]
[![Coverage][coverage-badge]][coverage]
[![Downloads][downloads-badge]][downloads]
[![Size][size-badge]][size]
[![Sponsors][sponsors-badge]][collective]
[![Backers][backers-badge]][collective]
[![Chat][chat-badge]][chat]
[mdast][] extensions to parse and serialize [GFM][] autolink literals.
## Contents
* [What is this?](#what-is-this)
* [When to use this](#when-to-use-this)
* [Install](#install)
* [Use](#use)
* [API](#api)
* [`gfmAutolinkLiteralFromMarkdown()`](#gfmautolinkliteralfrommarkdown)
* [`gfmAutolinkLiteralToMarkdown()`](#gfmautolinkliteraltomarkdown)
* [HTML](#html)
* [Syntax](#syntax)
* [Syntax tree](#syntax-tree)
* [Types](#types)
* [Compatibility](#compatibility)
* [Related](#related)
* [Contribute](#contribute)
* [License](#license)
## What is this?
This package contains two extensions that add support for GFM autolink literals
syntax in markdown to [mdast][].
These extensions plug into
[`mdast-util-from-markdown`][mdast-util-from-markdown] (to support parsing
GFM autolinks in markdown into a syntax tree) and
[`mdast-util-to-markdown`][mdast-util-to-markdown] (to support serializing
GFM autolinks in syntax trees to markdown).
GitHub employs different algorithms to autolink: one at parse time and one at
transform time (similar to how `@mentions` are done at transform time).
This difference can be observed because character references and escapes are
handled differently.
But also because issues/PRs/comments omit (perhaps by accident?) the second
algorithm for `www.`, `http://`, and `https://` links (but not for email links).
As the corresponding micromark extension
[`micromark-extension-gfm-autolink-literal`][extension] is a syntax extension,
it can only perform the first algorithm.
The tree extension `gfmAutolinkLiteralFromMarkdown` from this package can
perform the second algorithm, and as they are combined, both are done.
## When to use this
You can use these extensions when you are working with
`mdast-util-from-markdown` and `mdast-util-to-markdown` already.
When working with `mdast-util-from-markdown`, you must combine this package
with
[`micromark-extension-gfm-autolink-literal`][extension].
When you don’t need a syntax tree, you can use [`micromark`][micromark]
directly with `micromark-extension-gfm-autolink-literal`.
When you are working with syntax trees and want all of GFM, use
[`mdast-util-gfm`][mdast-util-gfm] instead.
All these packages are used [`remark-gfm`][remark-gfm], which
focusses on making it easier to transform content by abstracting these
internals away.
This utility does not handle how markdown is turned to HTML.
That’s done by [`mdast-util-to-hast`][mdast-util-to-hast].
## Install
This package is [ESM only][esm].
In Node.js (version 16+), install with [npm][]:
```sh
npm install mdast-util-gfm-autolink-literal
```
In Deno with [`esm.sh`][esmsh]:
```js
import {gfmAutolinkLiteralFromMarkdown, gfmAutolinkLiteralToMarkdown} from 'https://esm.sh/mdast-util-gfm-autolink-literal@2'
```
In browsers with [`esm.sh`][esmsh]:
```html
<script type="module">
import {gfmAutolinkLiteralFromMarkdown, gfmAutolinkLiteralToMarkdown} from 'https://esm.sh/mdast-util-gfm-autolink-literal@2?bundle'
</script>
```
## Use
Say our document `example.md` contains:
```markdown
www.example.com, https://example.com, and contact@example.com.
```
…and our module `example.js` looks as follows:
```js
import fs from 'node:fs/promises'
import {gfmAutolinkLiteral} from 'micromark-extension-gfm-autolink-literal'
import {fromMarkdown} from 'mdast-util-from-markdown'
import {
gfmAutolinkLiteralFromMarkdown,
gfmAutolinkLiteralToMarkdown
} from 'mdast-util-gfm-autolink-literal'
import {toMarkdown} from 'mdast-util-to-markdown'
const doc = await fs.readFile('example.md')
const tree = fromMarkdown(doc, {
extensions: [gfmAutolinkLiteral()],
mdastExtensions: [gfmAutolinkLiteralFromMarkdown()]
})
console.log(tree)
const out = toMarkdown(tree, {extensions: [gfmAutolinkLiteralToMarkdown()]})
console.log(out)
```
…now running `node example.js` yields (positional info removed for brevity):
```js
{
type: 'root',
children: [
{
type: 'paragraph',
children: [
{
type: 'link',
title: null,
url: 'http://www.example.com',
children: [{type: 'text', value: 'www.example.com'}]
},
{type: 'text', value: ', '},
{
type: 'link',
title: null,
url: 'https://example.com',
children: [{type: 'text', value: 'https://example.com'}]
},
{type: 'text', value: ', and '},
{
type: 'link',
title: null,
url: 'mailto:contact@example.com',
children: [{type: 'text', value: 'contact@example.com'}]
},
{type: 'text', value: '.'}
]
}
]
}
```
```markdown
[www.example.com](http://www.example.com), <https://example.com>, and <contact@example.com>.
```
## API
This package exports the identifiers
[`gfmAutolinkLiteralFromMarkdown`][api-gfm-autolink-literal-from-markdown] and
[`gfmAutolinkLiteralToMarkdown`][api-gfm-autolink-literal-to-markdown].
There is no default export.
### `gfmAutolinkLiteralFromMarkdown()`
Create an extension for [`mdast-util-from-markdown`][mdast-util-from-markdown]
to enable GFM autolink literals in markdown.
###### Returns
Extension for `mdast-util-to-markdown` to enable GFM autolink literals
([`FromMarkdownExtension`][from-markdown-extension]).
### `gfmAutolinkLiteralToMarkdown()`
Create an extension for [`mdast-util-to-markdown`][mdast-util-to-markdown] to
enable GFM autolink literals in markdown.
###### Returns
Extension for `mdast-util-to-markdown` to enable GFM autolink literals
([`ToMarkdownExtension`][to-markdown-extension]).
## HTML
This utility does not handle how markdown is turned to HTML.
That’s done by [`mdast-util-to-hast`][mdast-util-to-hast].
## Syntax
See [Syntax in `micromark-extension-gfm-autolink-literal`][syntax].
## Syntax tree
There are no interfaces added to **[mdast][]** by this utility, as it reuses
the existing **[Link][dfn-link]** interface.
## Types
This package is fully typed with [TypeScript][].
It does not export additional types.
The `Link` type of the mdast nodes is exposed from `@types/mdast`.
## Compatibility
Projects maintained by the unified collective are compatible with maintained
versions of Node.js.
When we cut a new major release, we drop support for unmaintained versions of
Node.
This means we try to keep the current release line,
`mdast-util-gfm-autolink-literal@^2`, compatible with Node.js 16.
This utility works with `mdast-util-from-markdown` version 2+ and
`mdast-util-to-markdown` version 2+.
## Related
* [`remarkjs/remark-gfm`][remark-gfm]
— remark plugin to support GFM
* [`syntax-tree/mdast-util-gfm`][mdast-util-gfm]
— same but all of GFM (autolink literals, footnotes, strikethrough, tables,
tasklists)
* [`micromark/micromark-extension-gfm-autolink-literal`][extension]
— micromark extension to parse GFM autolink literals
## Contribute
See [`contributing.md`][contributing] in [`syntax-tree/.github`][health] for
ways to get started.
See [`support.md`][support] for ways to get help.
This project has a [code of conduct][coc].
By interacting with this repository, organization, or community you agree to
abide by its terms.
## License
[MIT][license] © [Titus Wormer][author]
<!-- Definitions -->
[build-badge]: https://github.com/syntax-tree/mdast-util-gfm-autolink-literal/workflows/main/badge.svg
[build]: https://github.com/syntax-tree/mdast-util-gfm-autolink-literal/actions
[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/mdast-util-gfm-autolink-literal.svg
[coverage]: https://codecov.io/github/syntax-tree/mdast-util-gfm-autolink-literal
[downloads-badge]: https://img.shields.io/npm/dm/mdast-util-gfm-autolink-literal.svg
[downloads]: https://www.npmjs.com/package/mdast-util-gfm-autolink-literal
[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=mdast-util-gfm-autolink-literal
[size]: https://bundlejs.com/?q=mdast-util-gfm-autolink-literal
[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg
[backers-badge]: https://opencollective.com/unified/backers/badge.svg
[collective]: https://opencollective.com/unified
[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg
[chat]: https://github.com/syntax-tree/unist/discussions
[npm]: https://docs.npmjs.com/cli/install
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
[esmsh]: https://esm.sh
[typescript]: https://www.typescriptlang.org
[license]: license
[author]: https://wooorm.com
[health]: https://github.com/syntax-tree/.github
[contributing]: https://github.com/syntax-tree/.github/blob/HEAD/contributing.md
[support]: https://github.com/syntax-tree/.github/blob/HEAD/support.md
[coc]: https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md
[mdast]: https://github.com/syntax-tree/mdast
[mdast-util-gfm]: https://github.com/syntax-tree/mdast-util-gfm
[mdast-util-from-markdown]: https://github.com/syntax-tree/mdast-util-from-markdown
[mdast-util-to-markdown]: https://github.com/syntax-tree/mdast-util-to-markdown
[mdast-util-to-hast]: https://github.com/syntax-tree/mdast-util-to-hast
[remark-gfm]: https://github.com/remarkjs/remark-gfm
[micromark]: https://github.com/micromark/micromark
[extension]: https://github.com/micromark/micromark-extension-gfm-autolink-literal
[syntax]: https://github.com/micromark/micromark-extension-gfm-autolink-literal#syntax
[gfm]: https://github.github.com/gfm/
[dfn-link]: https://github.com/syntax-tree/mdast#link
[from-markdown-extension]: https://github.com/syntax-tree/mdast-util-from-markdown#extension
[to-markdown-extension]: https://github.com/syntax-tree/mdast-util-to-markdown#options
[api-gfm-autolink-literal-from-markdown]: #gfmautolinkliteralfrommarkdown
[api-gfm-autolink-literal-to-markdown]: #gfmautolinkliteraltomarkdown
@@ -0,0 +1,8 @@
"use client";
import {
dropdown_trigger_default
} from "./chunk-4LJ2IKXJ.mjs";
import "./chunk-BV7BCS3N.mjs";
export {
dropdown_trigger_default as default
};
@@ -0,0 +1,3 @@
declare const _default: boolean;
export default _default;
//# sourceMappingURL=isWeb.d.ts.map
@@ -0,0 +1,31 @@
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
if (info.done) resolve(value);
else Promise.resolve(value).then(_next, _throw);
}
function _async_to_generator(fn) {
return function() {
var self = this, args = arguments;
return new Promise(function(resolve, reject) {
var gen = fn.apply(self, args);
function _next(value) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
}
function _throw(err) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
}
_next(undefined);
});
};
}
export { _async_to_generator as _ };
@@ -0,0 +1,46 @@
# jsx-a11y/no-redundant-roles
💼 This rule is enabled in the following configs: ☑️ `recommended`, 🔒 `strict`.
<!-- end auto-generated rule header -->
Some HTML elements have native semantics that are implemented by the browser. This includes default/implicit ARIA roles. Setting an ARIA role that matches its default/implicit role is redundant since it is already set by the browser.
## Rule options
The default options for this rule allow an implicit role of `navigation` to be applied to a `nav` element as is [advised by w3](https://www.w3.org/WAI/GL/wiki/Using_HTML5_nav_element#Example:The_.3Cnav.3E_element). The options are provided as an object keyed by HTML element name; the value is an array of implicit ARIA roles that are allowed on the specified element.
```js
{
'jsx-a11y/no-redundant-roles': [
'error',
{
nav: ['navigation'],
},
],
}
```
### Succeed
```jsx
<div />
<button role="presentation" />
<MyComponent role="main" />
```
### Fail
```jsx
<button role="button" />
<img role="img" src="foo.jpg" />
```
## Accessibility guidelines
General best practice (reference resources)
### Resources
- [ARIA Spec, ARIA Adds Nothing to Default Semantics of Most HTML Elements](https://www.w3.org/TR/using-aria/#aria-does-nothing)
- [Identifying SVG as an image](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#identifying_svg_as_an_image)
@@ -0,0 +1,29 @@
import { __decorate } from "tslib";
import { AsnProp, AsnPropTypes } from "@peculiar/asn1-schema";
import { AlgorithmIdentifier } from "@peculiar/asn1-x509";
export var DigestedObjectType;
(function (DigestedObjectType) {
DigestedObjectType[DigestedObjectType["publicKey"] = 0] = "publicKey";
DigestedObjectType[DigestedObjectType["publicKeyCert"] = 1] = "publicKeyCert";
DigestedObjectType[DigestedObjectType["otherObjectTypes"] = 2] = "otherObjectTypes";
})(DigestedObjectType || (DigestedObjectType = {}));
export class ObjectDigestInfo {
constructor(params = {}) {
this.digestedObjectType = DigestedObjectType.publicKey;
this.digestAlgorithm = new AlgorithmIdentifier();
this.objectDigest = new ArrayBuffer(0);
Object.assign(this, params);
}
}
__decorate([
AsnProp({ type: AsnPropTypes.Enumerated })
], ObjectDigestInfo.prototype, "digestedObjectType", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.ObjectIdentifier, optional: true })
], ObjectDigestInfo.prototype, "otherObjectTypeID", void 0);
__decorate([
AsnProp({ type: AlgorithmIdentifier })
], ObjectDigestInfo.prototype, "digestAlgorithm", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.BitString })
], ObjectDigestInfo.prototype, "objectDigest", void 0);
@@ -0,0 +1,9 @@
const pattern = /(^|;)\s*(export|import)((\s+\w)|(\s*[*={]))|import\(/m;
export function isMaybeUnambiguousModule(content) {
return pattern.test(content);
}
const unambiguousNodeType = /^(?:(?:Exp|Imp)ort.*Declaration|TSExportAssignment)$/;
export function isUnambiguousModule(ast) {
return ast.body && ast.body.some(node => unambiguousNodeType.test(node.type));
}
//# sourceMappingURL=unambiguous.js.map
@@ -0,0 +1,48 @@
/**
Get the element type of an `Iterable`/`AsyncIterable`. For example, an array or a generator.
This can be useful, for example, if you want to get the type that is yielded in a generator function. Often the return type of those functions are not specified.
This type works with both `Iterable`s and `AsyncIterable`s, so it can be use with synchronous and asynchronous generators.
Here is an example of `IterableElement` in action with a generator function:
@example
```
function * iAmGenerator() {
yield 1;
yield 2;
}
type MeNumber = IterableElement<ReturnType<typeof iAmGenerator>>
```
And here is an example with an async generator:
@example
```
async function * iAmGeneratorAsync() {
yield 'hi';
yield true;
}
type MeStringOrBoolean = IterableElement<ReturnType<typeof iAmGeneratorAsync>>
```
Many types in JavaScript/TypeScript are iterables. This type works on all types that implement those interfaces. For example, `Array`, `Set`, `Map`, `stream.Readable`, etc.
An example with an array of strings:
@example
```
type MeString = IterableElement<string[]>
```
@category Utilities
*/
export type IterableElement<TargetIterable> =
TargetIterable extends Iterable<infer ElementType> ?
ElementType :
TargetIterable extends AsyncIterable<infer ElementType> ?
ElementType :
never;
@@ -0,0 +1,19 @@
import {useTextField as $2d73ec29415bd339$export$712718f7aec83d5} from "./useTextField.mjs";
import {useFormattedTextField as $d841c8010a73d545$export$4f384c9210e583c3} from "./useFormattedTextField.mjs";
/*
* 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.
*/
export {$2d73ec29415bd339$export$712718f7aec83d5 as useTextField, $d841c8010a73d545$export$4f384c9210e583c3 as useFormattedTextField};
//# sourceMappingURL=module.js.map
@@ -0,0 +1 @@
{"mappings":"AAAA;;;;;;;;;;CAUC,GAIM,MAAM;IAaX,aAAa,GAAQ,EAAE;QACrB,IAAI,IAAI,CAAC,aAAa,EACpB,OAAO,IAAI,CAAC,UAAU,CAAC;QAEzB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B;IAEA,cAAc,GAAQ,EAAE;QACtB,IAAI,IAAI,CAAC,aAAa,EACpB,OAAO,IAAI,CAAC,cAAc,CAAC;QAE7B,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB;IAGQ,WAAW,GAAQ,EAAE;YACY,gCAAA;QAAvC,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAC,2BAAA,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,kBAAxB,gDAAA,iCAAA,yBAA8B,KAAK,cAAnC,qDAAA,+BAAqC,UAAU;IACxF;IAEA,cAAc;QACZ,IAAI,MAAM,IAAI,CAAC,UAAU,CAAC,WAAW;QACrC,IAAI,OAAO,QAAQ,IAAI,CAAC,UAAU,CAAC,MACjC,MAAM,IAAI,CAAC,UAAU,CAAC;QAExB,OAAO;IACT;IAEA,aAAa;QACX,IAAI,MAAM,IAAI,CAAC,UAAU,CAAC,UAAU;QACpC,IAAI,OAAO,QAAQ,IAAI,CAAC,UAAU,CAAC,MACjC,MAAM,IAAI,CAAC,cAAc,CAAC;QAE5B,OAAO;IACT;IAEA,YAAY,GAAQ,EAAE;QACpB,IAAI,IAAI,CAAC,YAAY,EACnB,OAAO;QAET,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B;IAEA,YAAY,GAAQ,EAAE;QACpB,IAAI,IAAI,CAAC,YAAY,EACnB,OAAO;QAET,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB;IAEA,WAAW,GAAG,EAAE;QACd,GAAG;YACD,MAAM,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC;YAClC,IAAI,OAAO,MACT,MAAM,IAAI,CAAC,UAAU,CAAC,WAAW;QAErC,QAAS,IAAI,CAAC,UAAU,CAAC,MAAM;QAC/B,OAAO;IACT;IAEA,eAAe,GAAG,EAAE;QAClB,GAAG;YACD,MAAM,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC;YACnC,IAAI,OAAO,MACT,MAAM,IAAI,CAAC,UAAU,CAAC,UAAU;QAEpC,QAAS,IAAI,CAAC,UAAU,CAAC,MAAM;QAC/B,OAAO;IACT;IA1EA,YAAY,UAA+B,EAAE,SAAoB,EAAE,WAAwB,EAAE,eAAyB,IAAI,KAAK,CAAE;QAC/H,IAAI,CAAC,UAAU,GAAG;QAClB,IAAI,CAAC,aAAa,GAAG,cAAc,SAAS,gBAAgB;QAC5D,IAAI,CAAC,YAAY,GAAG;QACpB,IAAI,CAAC,YAAY,GAAG,gBAAgB;IACtC;AAsEF","sources":["packages/@react-aria/tabs/src/TabsKeyboardDelegate.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 {Collection, Direction, Key, KeyboardDelegate, Node, Orientation} from '@react-types/shared';\n\nexport class TabsKeyboardDelegate<T> implements KeyboardDelegate {\n private collection: Collection<Node<T>>;\n private flipDirection: boolean;\n private disabledKeys: Set<Key>;\n private tabDirection: boolean;\n\n constructor(collection: Collection<Node<T>>, direction: Direction, orientation: Orientation, disabledKeys: Set<Key> = new Set()) {\n this.collection = collection;\n this.flipDirection = direction === 'rtl' && orientation === 'horizontal';\n this.disabledKeys = disabledKeys;\n this.tabDirection = orientation === 'horizontal';\n }\n\n getKeyLeftOf(key: Key) {\n if (this.flipDirection) {\n return this.getNextKey(key);\n }\n return this.getPreviousKey(key);\n }\n\n getKeyRightOf(key: Key) {\n if (this.flipDirection) {\n return this.getPreviousKey(key);\n }\n return this.getNextKey(key);\n }\n\n\n private isDisabled(key: Key) {\n return this.disabledKeys.has(key) || !!this.collection.getItem(key)?.props?.isDisabled;\n }\n\n getFirstKey() {\n let key = this.collection.getFirstKey();\n if (key != null && this.isDisabled(key)) {\n key = this.getNextKey(key);\n }\n return key;\n }\n\n getLastKey() {\n let key = this.collection.getLastKey();\n if (key != null && this.isDisabled(key)) {\n key = this.getPreviousKey(key);\n }\n return key;\n }\n \n getKeyAbove(key: Key) {\n if (this.tabDirection) {\n return null;\n }\n return this.getPreviousKey(key);\n }\n\n getKeyBelow(key: Key) {\n if (this.tabDirection) {\n return null;\n }\n return this.getNextKey(key);\n }\n\n getNextKey(key) {\n do {\n key = this.collection.getKeyAfter(key);\n if (key == null) {\n key = this.collection.getFirstKey();\n }\n } while (this.isDisabled(key));\n return key;\n }\n\n getPreviousKey(key) {\n do {\n key = this.collection.getKeyBefore(key);\n if (key == null) {\n key = this.collection.getLastKey();\n }\n } while (this.isDisabled(key));\n return key;\n }\n}\n"],"names":[],"version":3,"file":"TabsKeyboardDelegate.module.js.map"}
@@ -0,0 +1,109 @@
#!/usr/bin/env python3
# Copyright (c) 2011 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
""" Unit tests for the easy_xml.py file. """
import gyp.easy_xml as easy_xml
import unittest
from io import StringIO
class TestSequenceFunctions(unittest.TestCase):
def setUp(self):
self.stderr = StringIO()
def test_EasyXml_simple(self):
self.assertEqual(
easy_xml.XmlToString(["test"]),
'<?xml version="1.0" encoding="utf-8"?><test/>',
)
self.assertEqual(
easy_xml.XmlToString(["test"], encoding="Windows-1252"),
'<?xml version="1.0" encoding="Windows-1252"?><test/>',
)
def test_EasyXml_simple_with_attributes(self):
self.assertEqual(
easy_xml.XmlToString(["test2", {"a": "value1", "b": "value2"}]),
'<?xml version="1.0" encoding="utf-8"?><test2 a="value1" b="value2"/>',
)
def test_EasyXml_escaping(self):
original = "<test>'\"\r&\nfoo"
converted = "&lt;test&gt;'&quot;&#xD;&amp;&#xA;foo"
converted_apos = converted.replace("'", "&apos;")
self.assertEqual(
easy_xml.XmlToString(["test3", {"a": original}, original]),
'<?xml version="1.0" encoding="utf-8"?><test3 a="%s">%s</test3>'
% (converted, converted_apos),
)
def test_EasyXml_pretty(self):
self.assertEqual(
easy_xml.XmlToString(
["test3", ["GrandParent", ["Parent1", ["Child"]], ["Parent2"]]],
pretty=True,
),
'<?xml version="1.0" encoding="utf-8"?>\n'
"<test3>\n"
" <GrandParent>\n"
" <Parent1>\n"
" <Child/>\n"
" </Parent1>\n"
" <Parent2/>\n"
" </GrandParent>\n"
"</test3>\n",
)
def test_EasyXml_complex(self):
# We want to create:
target = (
'<?xml version="1.0" encoding="utf-8"?>'
"<Project>"
'<PropertyGroup Label="Globals">'
"<ProjectGuid>{D2250C20-3A94-4FB9-AF73-11BC5B73884B}</ProjectGuid>"
"<Keyword>Win32Proj</Keyword>"
"<RootNamespace>automated_ui_tests</RootNamespace>"
"</PropertyGroup>"
'<Import Project="$(VCTargetsPath)\\Microsoft.Cpp.props"/>'
"<PropertyGroup "
"Condition=\"'$(Configuration)|$(Platform)'=="
'\'Debug|Win32\'" Label="Configuration">'
"<ConfigurationType>Application</ConfigurationType>"
"<CharacterSet>Unicode</CharacterSet>"
"</PropertyGroup>"
"</Project>"
)
xml = easy_xml.XmlToString(
[
"Project",
[
"PropertyGroup",
{"Label": "Globals"},
["ProjectGuid", "{D2250C20-3A94-4FB9-AF73-11BC5B73884B}"],
["Keyword", "Win32Proj"],
["RootNamespace", "automated_ui_tests"],
],
["Import", {"Project": "$(VCTargetsPath)\\Microsoft.Cpp.props"}],
[
"PropertyGroup",
{
"Condition": "'$(Configuration)|$(Platform)'=='Debug|Win32'",
"Label": "Configuration",
},
["ConfigurationType", "Application"],
["CharacterSet", "Unicode"],
],
]
)
self.assertEqual(xml, target)
if __name__ == "__main__":
unittest.main()
@@ -0,0 +1,91 @@
{
"name": "object.fromentries",
"version": "2.0.8",
"author": "Jordan Harband <ljharb@gmail.com>",
"funding": {
"url": "https://github.com/sponsors/ljharb"
},
"description": "ES proposal-spec-compliant Object.fromEntries shim.",
"license": "MIT",
"main": "index.js",
"scripts": {
"prepublish": "not-in-publish || npm run prepublishOnly",
"prepublishOnly": "safe-publish-latest",
"pretest": "npm run lint",
"test": "npm run tests-only",
"posttest": "aud --production",
"tests-only": "nyc tape 'test/**/*.js'",
"lint": "eslint --ext=js,mjs .",
"postlint": "es-shim-api --bound",
"version": "auto-changelog && git add CHANGELOG.md",
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
},
"repository": {
"type": "git",
"url": "git://github.com/es-shims/Object.fromEntries.git"
},
"keywords": [
"Object.fromEntries",
"Object.entries",
"Object.values",
"Object.keys",
"entries",
"values",
"ES7",
"ES8",
"ES2017",
"shim",
"object",
"keys",
"polyfill",
"es-shim API"
],
"dependencies": {
"call-bind": "^1.0.7",
"define-properties": "^1.2.1",
"es-abstract": "^1.23.2",
"es-object-atoms": "^1.0.0"
},
"devDependencies": {
"@es-shims/api": "^2.4.2",
"@ljharb/eslint-config": "^21.1.0",
"aud": "^2.0.4",
"auto-changelog": "^2.4.0",
"eslint": "=8.8.0",
"has-strict-mode": "^1.0.1",
"in-publish": "^2.0.1",
"nyc": "^10.3.2",
"safe-publish-latest": "^2.0.0",
"tape": "^5.7.5"
},
"testling": {
"files": "test/index.js",
"browsers": [
"iexplore/9.0..latest",
"firefox/4.0..6.0",
"firefox/15.0..latest",
"firefox/nightly",
"chrome/4.0..10.0",
"chrome/20.0..latest",
"chrome/canary",
"opera/11.6..latest",
"opera/next",
"safari/5.0..latest",
"ipad/6.0..latest",
"iphone/6.0..latest",
"android-browser/4.2"
]
},
"auto-changelog": {
"output": "CHANGELOG.md",
"template": "keepachangelog",
"unreleased": false,
"commitLimit": false,
"backfillLimit": false,
"hideCredit": true,
"startingVersion": "2.0.6"
},
"engines": {
"node": ">= 0.4"
}
}
@@ -0,0 +1,10 @@
import { OB11GroupNoticeEvent } from './OB11GroupNoticeEvent';
import { NapCatCore } from '../../../napcat-core';
type GroupIncreaseSubType = 'approve' | 'invite';
export declare class OB11GroupIncreaseEvent extends OB11GroupNoticeEvent {
notice_type: string;
operator_id: number;
sub_type: GroupIncreaseSubType;
constructor(core: NapCatCore, groupId: number, userId: number, operatorId: number, subType?: GroupIncreaseSubType);
}
export {};
@@ -0,0 +1,421 @@
flf2a$ 4 3 9 63 12 0 8127 0
Author : Marcin Glinsky and others
Date : 2003/09/02 20:09:19
Version: 1.0
-------------------------------------------------
Font ascii_new_roman, created by Marcin Glinski
and others from alt.ascii-art
-------------------------------------------------
This font has been created using JavE's FIGlet font export assistant.
Have a look at: http://www.jave.de
Permission is hereby given to modify this font, as long as the
modifier's name is placed on a comment line.
$ #
$ #
$ #
$ ##
__, #
(-V #
_o #
( ##
"#
#
#
##
##
#
#
##
_||_, #
(-(__ #
_||_) #
( ##
_, _,#
(-o ,' #
_,',o'#
( ##
&#
#
#
##
__, #
(-/ #
#
##
____, #
(-// #
_\\_ #
( ##
___, #
(-\\ #
_//_ #
( ##
*#
#
#
##
___, #
(-_|_. #
_| #
( ##
,#
#
#
##
#
____, #
( #
##
.#
#
#
##
___, #
(-// #
_//_ #
( ##
_____,#
(-/ /\ #
_\/_/ #
( ##
___, #
(-/| #
'_|, #
( ##
__, #
(- ) #
,'_, #
( ##
__, #
(-_) #
__) #
( ##
____, #
(-/_|_,#
_|, #
( ##
____, #
(-|_ #
__) #
( ##
___, #
(-/_ #
_(__) #
( ##
___, #
(- / #
_/, #
( ##
_____,#
(-(__) #
_(__) #
( ##
_____,#
(-(__) #
__/, #
( ##
__, #
(-o #
_o #
( ##
__, #
(-o #
_p #
( ##
<#
#
#
##
=#
#
#
##
>#
#
#
##
_____,#
(-( _)#
_(, #
( ##
___, #
(-/_\ #
_((_/_#
( ##
____,#
(-/_| #
_/ |,#
( ##
____ #
(-|__) #
_|__) #
( ##
____, #
(-/ #
_\__, #
( ##
____, #
(-| \ #
_|__/ #
( ##
____, #
(-|_, #
_|__, #
( ##
____, #
(-|_, #
_| #
( ##
____, #
(-/ _, #
_\__| #
( ##
__, _,#
(-|__| #
_| |,#
( ##
__, #
(-| #
_|_, #
( ##
_, #
(-| #
__|, #
( ##
__, , #
( |_/ #
_| \, #
( ##
__, #
(-| #
_|__, #
( ##
__, _,#
(-|\/| #
_| _|,#
( ##
_, _,#
(-|\ | #
_| \|,#
( ##
____, #
(-/ \ #
_\__/,#
( ##
____, #
(-|__) #
_| #
( ##
____, #
(-/ \ #
_\_\/,#
( ##
____, #
(-|__) #
_| \,#
( ##
____, #
(-(__ #
____) #
( ##
____, #
(-| #
_|, #
( ##
_, _, #
(-| \ #
_|__/ #
( ##
__ _,#
(-\ / #
_\/ #
( ##
_ _,#
(-| | #
_|/\|,#
( ##
_, _, #
(-\_/ #
_/ \, #
( ##
_ _, #
(-\_/ #
_|, #
( ##
___, #
(- / #
_/__, #
( ##
[#
#
#
##
_, #
(-\\ #
_\\, #
( ##
]#
#
#
##
___, #
(-/\ #
' ` #
##
_#
#
#
##
`#
#
#
##
____,#
(-/_| #
_/ |,#
( ##
____ #
(-|__) #
_|__) #
( ##
____, #
(-/ #
_\__, #
( ##
____, #
(-| \ #
_|__/ #
( ##
____, #
(-|_, #
_|__, #
( ##
____, #
(-|_, #
_| #
( ##
____, #
(-/ _, #
_\__| #
( ##
__, _,#
(-|__| #
_| |,#
( ##
__, #
(-| #
_|_, #
( ##
_, #
(-| #
__|, #
( ##
__, , #
( |_/ #
_| \, #
( ##
__, #
(-| #
_|__, #
( ##
__, _,#
(-|\/| #
_| _|,#
( ##
_, _,#
(-|\ | #
_| \|,#
( ##
____, #
(-/ \ #
_\__/,#
( ##
____, #
(-|__) #
_| #
( ##
____, #
(-/ \ #
_\_\/,#
( ##
____, #
(-|__) #
_| \,#
( ##
____, #
(-(__ #
____) #
( ##
____, #
(-| #
_|, #
( ##
_, _, #
(-| \ #
_|__/ #
( ##
__ _,#
(-\ / #
_\/ #
( ##
_ _,#
(-| | #
_|/\|,#
( ##
_, _, #
(-\_/ #
_/ \, #
( ##
_ _, #
(-\_/ #
_|, #
( ##
___, #
(- / #
_/__, #
( ##
{#
#
#
##
__, #
(-| #
| #
_|, ##
}#
#
#
##
~#
#
#
##
____,#
(-/_| #
_/ |,#
( ##
____, #
(-/ \ #
_\__/,#
( ##
_, _, #
(-| \ #
_|__/ #
( ##
____,#
(-/_| #
_/ |,#
( ##
____, #
(-/ \ #
_\__/,#
( ##
_, _, #
(-| \ #
_|__/ #
( ##
ß#
#
#
##
@@ -0,0 +1,7 @@
import { URISchemeHandler, URIOptions } from "../uri";
import { URNComponents } from "./urn";
export interface UUIDComponents extends URNComponents {
uuid?: string;
}
declare const handler: URISchemeHandler<UUIDComponents, URIOptions, URNComponents>;
export default handler;
@@ -0,0 +1,10 @@
import { PluginFunc } from 'dayjs/esm'
declare const plugin: PluginFunc
export = plugin
declare module 'dayjs/esm' {
interface Dayjs {
isYesterday(): boolean
}
}
@@ -0,0 +1,54 @@
import { __read } from "tslib";
import dayjs from 'dayjs';
import { useEffect, useMemo, useState } from 'react';
import useLatest from '../useLatest';
import { isNumber } from '../utils/index';
var calcLeft = function (target) {
if (!target) {
return 0;
}
// https://stackoverflow.com/questions/4310953/invalid-date-in-safari
var left = dayjs(target).valueOf() - Date.now();
return left < 0 ? 0 : left;
};
var parseMs = function (milliseconds) {
return {
days: Math.floor(milliseconds / 86400000),
hours: Math.floor(milliseconds / 3600000) % 24,
minutes: Math.floor(milliseconds / 60000) % 60,
seconds: Math.floor(milliseconds / 1000) % 60,
milliseconds: Math.floor(milliseconds) % 1000,
};
};
var useCountdown = function (options) {
if (options === void 0) { options = {}; }
var _a = options || {}, leftTime = _a.leftTime, targetDate = _a.targetDate, _b = _a.interval, interval = _b === void 0 ? 1000 : _b, onEnd = _a.onEnd;
var memoLeftTime = useMemo(function () {
return isNumber(leftTime) && leftTime > 0 ? Date.now() + leftTime : undefined;
}, [leftTime]);
var target = 'leftTime' in options ? memoLeftTime : targetDate;
var _c = __read(useState(function () { return calcLeft(target); }), 2), timeLeft = _c[0], setTimeLeft = _c[1];
var onEndRef = useLatest(onEnd);
useEffect(function () {
if (!target) {
// for stop
setTimeLeft(0);
return;
}
// 立即执行一次
setTimeLeft(calcLeft(target));
var timer = setInterval(function () {
var _a;
var targetLeft = calcLeft(target);
setTimeLeft(targetLeft);
if (targetLeft === 0) {
clearInterval(timer);
(_a = onEndRef.current) === null || _a === void 0 ? void 0 : _a.call(onEndRef);
}
}, interval);
return function () { return clearInterval(timer); };
}, [target, interval]);
var formattedRes = useMemo(function () { return parseMs(timeLeft); }, [timeLeft]);
return [timeLeft, formattedRes];
};
export default useCountdown;
@@ -0,0 +1,397 @@
2.1.35 / 2022-03-12
===================
* deps: mime-db@1.52.0
- Add extensions from IANA for more `image/*` types
- Add extension `.asc` to `application/pgp-keys`
- Add extensions to various XML types
- Add new upstream MIME types
2.1.34 / 2021-11-08
===================
* deps: mime-db@1.51.0
- Add new upstream MIME types
2.1.33 / 2021-10-01
===================
* deps: mime-db@1.50.0
- Add deprecated iWorks mime types and extensions
- Add new upstream MIME types
2.1.32 / 2021-07-27
===================
* deps: mime-db@1.49.0
- Add extension `.trig` to `application/trig`
- Add new upstream MIME types
2.1.31 / 2021-06-01
===================
* deps: mime-db@1.48.0
- Add extension `.mvt` to `application/vnd.mapbox-vector-tile`
- Add new upstream MIME types
2.1.30 / 2021-04-02
===================
* deps: mime-db@1.47.0
- Add extension `.amr` to `audio/amr`
- Remove ambigious extensions from IANA for `application/*+xml` types
- Update primary extension to `.es` for `application/ecmascript`
2.1.29 / 2021-02-17
===================
* deps: mime-db@1.46.0
- Add extension `.amr` to `audio/amr`
- Add extension `.m4s` to `video/iso.segment`
- Add extension `.opus` to `audio/ogg`
- Add new upstream MIME types
2.1.28 / 2021-01-01
===================
* deps: mime-db@1.45.0
- Add `application/ubjson` with extension `.ubj`
- Add `image/avif` with extension `.avif`
- Add `image/ktx2` with extension `.ktx2`
- Add extension `.dbf` to `application/vnd.dbf`
- Add extension `.rar` to `application/vnd.rar`
- Add extension `.td` to `application/urc-targetdesc+xml`
- Add new upstream MIME types
- Fix extension of `application/vnd.apple.keynote` to be `.key`
2.1.27 / 2020-04-23
===================
* deps: mime-db@1.44.0
- Add charsets from IANA
- Add extension `.cjs` to `application/node`
- Add new upstream MIME types
2.1.26 / 2020-01-05
===================
* deps: mime-db@1.43.0
- Add `application/x-keepass2` with extension `.kdbx`
- Add extension `.mxmf` to `audio/mobile-xmf`
- Add extensions from IANA for `application/*+xml` types
- Add new upstream MIME types
2.1.25 / 2019-11-12
===================
* deps: mime-db@1.42.0
- Add new upstream MIME types
- Add `application/toml` with extension `.toml`
- Add `image/vnd.ms-dds` with extension `.dds`
2.1.24 / 2019-04-20
===================
* deps: mime-db@1.40.0
- Add extensions from IANA for `model/*` types
- Add `text/mdx` with extension `.mdx`
2.1.23 / 2019-04-17
===================
* deps: mime-db@~1.39.0
- Add extensions `.siv` and `.sieve` to `application/sieve`
- Add new upstream MIME types
2.1.22 / 2019-02-14
===================
* deps: mime-db@~1.38.0
- Add extension `.nq` to `application/n-quads`
- Add extension `.nt` to `application/n-triples`
- Add new upstream MIME types
2.1.21 / 2018-10-19
===================
* deps: mime-db@~1.37.0
- Add extensions to HEIC image types
- Add new upstream MIME types
2.1.20 / 2018-08-26
===================
* deps: mime-db@~1.36.0
- Add Apple file extensions from IANA
- Add extensions from IANA for `image/*` types
- Add new upstream MIME types
2.1.19 / 2018-07-17
===================
* deps: mime-db@~1.35.0
- Add extension `.csl` to `application/vnd.citationstyles.style+xml`
- Add extension `.es` to `application/ecmascript`
- Add extension `.owl` to `application/rdf+xml`
- Add new upstream MIME types
- Add UTF-8 as default charset for `text/turtle`
2.1.18 / 2018-02-16
===================
* deps: mime-db@~1.33.0
- Add `application/raml+yaml` with extension `.raml`
- Add `application/wasm` with extension `.wasm`
- Add `text/shex` with extension `.shex`
- Add extensions for JPEG-2000 images
- Add extensions from IANA for `message/*` types
- Add new upstream MIME types
- Update font MIME types
- Update `text/hjson` to registered `application/hjson`
2.1.17 / 2017-09-01
===================
* deps: mime-db@~1.30.0
- Add `application/vnd.ms-outlook`
- Add `application/x-arj`
- Add extension `.mjs` to `application/javascript`
- Add glTF types and extensions
- Add new upstream MIME types
- Add `text/x-org`
- Add VirtualBox MIME types
- Fix `source` records for `video/*` types that are IANA
- Update `font/opentype` to registered `font/otf`
2.1.16 / 2017-07-24
===================
* deps: mime-db@~1.29.0
- Add `application/fido.trusted-apps+json`
- Add extension `.wadl` to `application/vnd.sun.wadl+xml`
- Add extension `.gz` to `application/gzip`
- Add new upstream MIME types
- Update extensions `.md` and `.markdown` to be `text/markdown`
2.1.15 / 2017-03-23
===================
* deps: mime-db@~1.27.0
- Add new mime types
- Add `image/apng`
2.1.14 / 2017-01-14
===================
* deps: mime-db@~1.26.0
- Add new mime types
2.1.13 / 2016-11-18
===================
* deps: mime-db@~1.25.0
- Add new mime types
2.1.12 / 2016-09-18
===================
* deps: mime-db@~1.24.0
- Add new mime types
- Add `audio/mp3`
2.1.11 / 2016-05-01
===================
* deps: mime-db@~1.23.0
- Add new mime types
2.1.10 / 2016-02-15
===================
* deps: mime-db@~1.22.0
- Add new mime types
- Fix extension of `application/dash+xml`
- Update primary extension for `audio/mp4`
2.1.9 / 2016-01-06
==================
* deps: mime-db@~1.21.0
- Add new mime types
2.1.8 / 2015-11-30
==================
* deps: mime-db@~1.20.0
- Add new mime types
2.1.7 / 2015-09-20
==================
* deps: mime-db@~1.19.0
- Add new mime types
2.1.6 / 2015-09-03
==================
* deps: mime-db@~1.18.0
- Add new mime types
2.1.5 / 2015-08-20
==================
* deps: mime-db@~1.17.0
- Add new mime types
2.1.4 / 2015-07-30
==================
* deps: mime-db@~1.16.0
- Add new mime types
2.1.3 / 2015-07-13
==================
* deps: mime-db@~1.15.0
- Add new mime types
2.1.2 / 2015-06-25
==================
* deps: mime-db@~1.14.0
- Add new mime types
2.1.1 / 2015-06-08
==================
* perf: fix deopt during mapping
2.1.0 / 2015-06-07
==================
* Fix incorrectly treating extension-less file name as extension
- i.e. `'path/to/json'` will no longer return `application/json`
* Fix `.charset(type)` to accept parameters
* Fix `.charset(type)` to match case-insensitive
* Improve generation of extension to MIME mapping
* Refactor internals for readability and no argument reassignment
* Prefer `application/*` MIME types from the same source
* Prefer any type over `application/octet-stream`
* deps: mime-db@~1.13.0
- Add nginx as a source
- Add new mime types
2.0.14 / 2015-06-06
===================
* deps: mime-db@~1.12.0
- Add new mime types
2.0.13 / 2015-05-31
===================
* deps: mime-db@~1.11.0
- Add new mime types
2.0.12 / 2015-05-19
===================
* deps: mime-db@~1.10.0
- Add new mime types
2.0.11 / 2015-05-05
===================
* deps: mime-db@~1.9.1
- Add new mime types
2.0.10 / 2015-03-13
===================
* deps: mime-db@~1.8.0
- Add new mime types
2.0.9 / 2015-02-09
==================
* deps: mime-db@~1.7.0
- Add new mime types
- Community extensions ownership transferred from `node-mime`
2.0.8 / 2015-01-29
==================
* deps: mime-db@~1.6.0
- Add new mime types
2.0.7 / 2014-12-30
==================
* deps: mime-db@~1.5.0
- Add new mime types
- Fix various invalid MIME type entries
2.0.6 / 2014-12-30
==================
* deps: mime-db@~1.4.0
- Add new mime types
- Fix various invalid MIME type entries
- Remove example template MIME types
2.0.5 / 2014-12-29
==================
* deps: mime-db@~1.3.1
- Fix missing extensions
2.0.4 / 2014-12-10
==================
* deps: mime-db@~1.3.0
- Add new mime types
2.0.3 / 2014-11-09
==================
* deps: mime-db@~1.2.0
- Add new mime types
2.0.2 / 2014-09-28
==================
* deps: mime-db@~1.1.0
- Add new mime types
- Update charsets
2.0.1 / 2014-09-07
==================
* Support Node.js 0.6
2.0.0 / 2014-09-02
==================
* Use `mime-db`
* Remove `.define()`
1.0.2 / 2014-08-04
==================
* Set charset=utf-8 for `text/javascript`
1.0.1 / 2014-06-24
==================
* Add `text/jsx` type
1.0.0 / 2014-05-12
==================
* Return `false` for unknown types
* Set charset=utf-8 for `application/json`
0.1.0 / 2014-05-02
==================
* Initial release
@@ -0,0 +1,39 @@
// src/common/assertion.ts
var __DEV__ = process.env.NODE_ENV !== "production";
var __TEST__ = process.env.NODE_ENV === "test";
function isArray(value) {
return Array.isArray(value);
}
function isEmptyArray(value) {
return isArray(value) && value.length === 0;
}
function isObject(value) {
const type = typeof value;
return value != null && (type === "object" || type === "function") && !isArray(value);
}
function isEmptyObject(value) {
return isObject(value) && Object.keys(value).length === 0;
}
function isEmpty(value) {
if (isArray(value)) return isEmptyArray(value);
if (isObject(value)) return isEmptyObject(value);
if (value == null || value === "") return true;
return false;
}
function isFunction(value) {
return typeof value === "function";
}
var dataAttr = (condition) => condition ? "true" : void 0;
var isNumeric = (value) => value != null && parseInt(value.toString(), 10) > 0;
export {
__DEV__,
__TEST__,
dataAttr,
isArray,
isEmpty,
isEmptyArray,
isEmptyObject,
isFunction,
isNumeric,
isObject
};
@@ -0,0 +1,158 @@
/**
* Copyright (c) 2019 The xterm.js authors. All rights reserved.
* @license MIT
*/
import { IEvent } from 'common/EventEmitter';
import { IRenderDimensions, IRenderer } from 'browser/renderer/shared/Types';
import { IColorSet, ILink, ReadonlyColorSet } from 'browser/Types';
import { ISelectionRedrawRequestEvent as ISelectionRequestRedrawEvent, ISelectionRequestScrollLinesEvent } from 'browser/selection/Types';
import { createDecorator } from 'common/services/ServiceRegistry';
import { AllColorIndex, IDisposable } from 'common/Types';
export const ICharSizeService = createDecorator<ICharSizeService>('CharSizeService');
export interface ICharSizeService {
serviceBrand: undefined;
readonly width: number;
readonly height: number;
readonly hasValidSize: boolean;
readonly onCharSizeChange: IEvent<void>;
measure(): void;
}
export const ICoreBrowserService = createDecorator<ICoreBrowserService>('CoreBrowserService');
export interface ICoreBrowserService {
serviceBrand: undefined;
readonly isFocused: boolean;
readonly onDprChange: IEvent<number>;
readonly onWindowChange: IEvent<Window & typeof globalThis>;
/**
* Gets or sets the parent window that the terminal is rendered into. DOM and rendering APIs (e.g.
* requestAnimationFrame) should be invoked in the context of this window. This should be set when
* the window hosting the xterm.js instance changes.
*/
window: Window & typeof globalThis;
/**
* The document of the primary window to be used to create elements when working with multiple
* windows. This is defined by the documentOverride setting.
*/
readonly mainDocument: Document;
/**
* Helper for getting the devicePixelRatio of the parent window.
*/
readonly dpr: number;
}
export const IMouseService = createDecorator<IMouseService>('MouseService');
export interface IMouseService {
serviceBrand: undefined;
getCoords(event: {clientX: number, clientY: number}, element: HTMLElement, colCount: number, rowCount: number, isSelection?: boolean): [number, number] | undefined;
getMouseReportCoords(event: MouseEvent, element: HTMLElement): { col: number, row: number, x: number, y: number } | undefined;
}
export const IRenderService = createDecorator<IRenderService>('RenderService');
export interface IRenderService extends IDisposable {
serviceBrand: undefined;
onDimensionsChange: IEvent<IRenderDimensions>;
/**
* Fires when buffer changes are rendered. This does not fire when only cursor
* or selections are rendered.
*/
onRenderedViewportChange: IEvent<{ start: number, end: number }>;
/**
* Fires on render
*/
onRender: IEvent<{ start: number, end: number }>;
onRefreshRequest: IEvent<{ start: number, end: number }>;
dimensions: IRenderDimensions;
addRefreshCallback(callback: FrameRequestCallback): number;
refreshRows(start: number, end: number): void;
clearTextureAtlas(): void;
resize(cols: number, rows: number): void;
hasRenderer(): boolean;
setRenderer(renderer: IRenderer): void;
handleDevicePixelRatioChange(): void;
handleResize(cols: number, rows: number): void;
handleCharSizeChanged(): void;
handleBlur(): void;
handleFocus(): void;
handleSelectionChanged(start: [number, number] | undefined, end: [number, number] | undefined, columnSelectMode: boolean): void;
handleCursorMove(): void;
clear(): void;
}
export const ISelectionService = createDecorator<ISelectionService>('SelectionService');
export interface ISelectionService {
serviceBrand: undefined;
readonly selectionText: string;
readonly hasSelection: boolean;
readonly selectionStart: [number, number] | undefined;
readonly selectionEnd: [number, number] | undefined;
readonly onLinuxMouseSelection: IEvent<string>;
readonly onRequestRedraw: IEvent<ISelectionRequestRedrawEvent>;
readonly onRequestScrollLines: IEvent<ISelectionRequestScrollLinesEvent>;
readonly onSelectionChange: IEvent<void>;
disable(): void;
enable(): void;
reset(): void;
setSelection(row: number, col: number, length: number): void;
selectAll(): void;
selectLines(start: number, end: number): void;
clearSelection(): void;
rightClickSelect(event: MouseEvent): void;
shouldColumnSelect(event: KeyboardEvent | MouseEvent): boolean;
shouldForceSelection(event: MouseEvent): boolean;
refresh(isLinuxMouseSelection?: boolean): void;
handleMouseDown(event: MouseEvent): void;
isCellInSelection(x: number, y: number): boolean;
}
export const ICharacterJoinerService = createDecorator<ICharacterJoinerService>('CharacterJoinerService');
export interface ICharacterJoinerService {
serviceBrand: undefined;
register(handler: (text: string) => [number, number][]): number;
deregister(joinerId: number): boolean;
getJoinedCharacters(row: number): [number, number][];
}
export const IThemeService = createDecorator<IThemeService>('ThemeService');
export interface IThemeService {
serviceBrand: undefined;
readonly colors: ReadonlyColorSet;
readonly onChangeColors: IEvent<ReadonlyColorSet>;
restoreColor(slot?: AllColorIndex): void;
/**
* Allows external modifying of colors in the theme, this is used instead of {@link colors} to
* prevent accidental writes.
*/
modifyColors(callback: (colors: IColorSet) => void): void;
}
export const ILinkProviderService = createDecorator<ILinkProviderService>('LinkProviderService');
export interface ILinkProviderService extends IDisposable {
serviceBrand: undefined;
readonly linkProviders: ReadonlyArray<ILinkProvider>;
registerLinkProvider(linkProvider: ILinkProvider): IDisposable;
}
export interface ILinkProvider {
provideLinks(y: number, callback: (links: ILink[] | undefined) => void): void;
}
@@ -0,0 +1,87 @@
{
"name": "ignore",
"version": "7.0.5",
"description": "Ignore is a manager and filter for .gitignore rules, the one used by eslint, gitbook and many others.",
"types": "index.d.ts",
"files": [
"legacy.js",
"index.js",
"index.d.ts",
"LICENSE-MIT"
],
"scripts": {
"prepublishOnly": "npm run build",
"build": "babel -o legacy.js index.js",
"==================== linting ======================": "",
"lint": "eslint .",
"===================== import ======================": "",
"ts": "npm run test:ts && npm run test:16",
"test:ts": "ts-node ./test/import/simple.ts",
"test:16": "npm run test:ts:16 && npm run test:cjs:16 && npm run test:mjs:16",
"test:ts:16": "ts-node --compilerOptions '{\"moduleResolution\": \"Node16\", \"module\": \"Node16\"}' ./test/import/simple.ts && tsc ./test/import/simple.ts --lib ES6 --moduleResolution Node16 --module Node16 && node ./test/import/simple.js",
"test:cjs:16": "ts-node --compilerOptions '{\"moduleResolution\": \"Node16\", \"module\": \"Node16\"}' ./test/import/simple.cjs",
"test:mjs:16": "ts-node --compilerOptions '{\"moduleResolution\": \"Node16\", \"module\": \"Node16\"}' ./test/import/simple.mjs && babel -o ./test/import/simple-mjs.js ./test/import/simple.mjs && node ./test/import/simple-mjs.js",
"===================== cases =======================": "",
"test:cases": "npm run tap test/*.test.js -- --coverage",
"tap": "tap --reporter classic",
"===================== debug =======================": "",
"test:git": "npm run tap test/git-check-ignore.test.js",
"test:ignore": "npm run tap test/ignore.test.js",
"test:ignore:only": "IGNORE_ONLY_IGNORES=1 npm run tap test/ignore.test.js",
"test:others": "npm run tap test/others.test.js",
"test:no-coverage": "npm run tap test/*.test.js -- --no-check-coverage",
"test": "npm run lint && npm run ts && npm run build && npm run test:cases",
"test:win32": "IGNORE_TEST_WIN32=1 npm run test",
"report": "tap --coverage-report=html"
},
"repository": {
"type": "git",
"url": "git@github.com:kaelzhang/node-ignore.git"
},
"keywords": [
"ignore",
".gitignore",
"gitignore",
"npmignore",
"rules",
"manager",
"filter",
"regexp",
"regex",
"fnmatch",
"glob",
"asterisks",
"regular-expression"
],
"author": "kael",
"license": "MIT",
"bugs": {
"url": "https://github.com/kaelzhang/node-ignore/issues"
},
"devDependencies": {
"@babel/cli": "^7.22.9",
"@babel/core": "^7.22.9",
"@babel/preset-env": "^7.22.9",
"@typescript-eslint/eslint-plugin": "^8.19.1",
"debug": "^4.3.4",
"eslint": "^8.46.0",
"eslint-config-ostai": "^3.0.0",
"eslint-plugin-import": "^2.28.0",
"mkdirp": "^3.0.1",
"pre-suf": "^1.1.1",
"rimraf": "^6.0.1",
"spawn-sync": "^2.0.0",
"tap": "^16.3.9",
"tmp": "0.2.3",
"ts-node": "^10.9.2",
"typescript": "^5.6.2"
},
"engines": {
"node": ">= 4"
}
}
@@ -0,0 +1,19 @@
import { TypeBoxError } from '../error/index';
import type { TTemplateLiteral, TTemplateLiteralKind } from './index';
import type { TUnion } from '../union/index';
import type { TString } from '../string/index';
import type { TBoolean } from '../boolean/index';
import type { TNumber } from '../number/index';
import type { TInteger } from '../integer/index';
import type { TBigInt } from '../bigint/index';
import type { TLiteral } from '../literal/index';
import type { Expression } from './parse';
export declare class TemplateLiteralFiniteError extends TypeBoxError {
}
type TFromTemplateLiteralKind<T> = T extends TTemplateLiteral<infer U extends TTemplateLiteralKind[]> ? TFromTemplateLiteralKinds<U> : T extends TUnion<infer U extends TTemplateLiteralKind[]> ? TFromTemplateLiteralKinds<U> : T extends TString ? false : T extends TNumber ? false : T extends TInteger ? false : T extends TBigInt ? false : T extends TBoolean ? true : T extends TLiteral ? true : false;
type TFromTemplateLiteralKinds<T extends TTemplateLiteralKind[]> = T extends [infer L extends TTemplateLiteralKind, ...infer R extends TTemplateLiteralKind[]] ? TFromTemplateLiteralKind<L> extends false ? false : TFromTemplateLiteralKinds<R> : true;
export declare function IsTemplateLiteralExpressionFinite(expression: Expression): boolean;
export type TIsTemplateLiteralFinite<T> = T extends TTemplateLiteral<infer U> ? TFromTemplateLiteralKinds<U> : false;
/** Returns true if this TemplateLiteral resolves to a finite set of values */
export declare function IsTemplateLiteralFinite<T extends TTemplateLiteral>(schema: T): boolean;
export {};
@@ -0,0 +1,7 @@
import * as react_jsx_runtime from 'react/jsx-runtime';
import { IconSvgProps } from './types.js';
import 'react';
declare const CloseFilledIcon: (props: IconSvgProps) => react_jsx_runtime.JSX.Element;
export { CloseFilledIcon };
@@ -0,0 +1,43 @@
var apply = require('./_apply'),
createCtor = require('./_createCtor'),
root = require('./_root');
/** Used to compose bitmasks for function metadata. */
var WRAP_BIND_FLAG = 1;
/**
* Creates a function that wraps `func` to invoke it with the `this` binding
* of `thisArg` and `partials` prepended to the arguments it receives.
*
* @private
* @param {Function} func The function to wrap.
* @param {number} bitmask The bitmask flags. See `createWrap` for more details.
* @param {*} thisArg The `this` binding of `func`.
* @param {Array} partials The arguments to prepend to those provided to
* the new function.
* @returns {Function} Returns the new wrapped function.
*/
function createPartial(func, bitmask, thisArg, partials) {
var isBind = bitmask & WRAP_BIND_FLAG,
Ctor = createCtor(func);
function wrapper() {
var argsIndex = -1,
argsLength = arguments.length,
leftIndex = -1,
leftLength = partials.length,
args = Array(leftLength + argsLength),
fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
while (++leftIndex < leftLength) {
args[leftIndex] = partials[leftIndex];
}
while (argsLength--) {
args[leftIndex++] = arguments[++argsIndex];
}
return apply(fn, isBind ? thisArg : this, args);
}
return wrapper;
}
module.exports = createPartial;
@@ -0,0 +1,31 @@
type Key = string | number;
interface MergeObject {
[key: string]: any;
}
declare const renameProp: (oldProp: string, newProp: string, { [oldProp]: old, ...others }: {
[x: string]: any;
}) => {
[x: string]: any;
};
declare const copyObject: (obj: any) => any;
declare const omitObject: (obj: any, omitKeys: string[]) => any;
declare const cleanObject: (obj: any) => any;
declare const cleanObjectKeys: (obj: any, keys?: string[]) => any;
declare const getKeyValue: (obj: any, key: Key) => any;
/**
* Get value from a deeply nested object using a string path.
* Memorizes the value.
* @param obj - the object
* @param path - the string path
* @param fallback - the fallback value
*/
declare const getProp: (obj: Record<string, any>, path: string | number, fallback?: any, index?: number) => any;
/**
* Converting an array of objects into a single object.
* @param arr - the array of objects
* @returns the single object
*/
declare const arrayToObject: (arr: any[]) => any;
declare function compact<T extends Record<any, any>>(object: T): {} & T;
export { MergeObject, arrayToObject, cleanObject, cleanObjectKeys, compact, copyObject, getKeyValue, getProp, omitObject, renameProp };
@@ -0,0 +1,524 @@
import { Component, ComponentClass, ComponentType, CSSProperties, FunctionComponent, Key, Ref } from "react";
export type CSSDirection = "ltr" | "rtl";
export type Direction = "vertical" | "horizontal"; // TODO: deprecate in favour of Layout
export type Layout = "vertical" | "horizontal";
export type ScrollDirection = "forward" | "backward";
export type Align = "auto" | "smart" | "center" | "end" | "start";
export interface ListChildComponentProps<T = any> {
index: number;
style: CSSProperties;
data: T;
isScrolling?: boolean | undefined;
}
export interface GridChildComponentProps<T = any> {
columnIndex: number;
rowIndex: number;
style: CSSProperties;
data: T;
isScrolling?: boolean | undefined;
}
// This is supposed to represent the type of the first parameter to
// React.createElement.
export type ReactElementType =
| FunctionComponent<any>
| ComponentClass<any>
| string;
export interface CommonProps<T = any> {
/**
* Optional CSS class to attach to outermost <div> element.
*/
className?: string | undefined;
/**
* Tag name passed to document.createElement to create the inner container element. This is an advanced property; in most cases, the default ("div") should be used.
*/
innerElementType?: ReactElementType | undefined;
/**
* Ref to attach to the inner container element. This is an advanced property.
*/
innerRef?: Ref<any> | undefined;
/**
* Tag name passed to document.createElement to create the inner container element. This is an advanced property; in most cases, the default ("div") should be used.
*
* @deprecated since 1.4.0
*/
innerTagName?: string | undefined;
/**
* Contextual data to be passed to the item renderer as a data prop. This is a light-weight alternative to React's built-in context API.
*
* Item data is useful for item renderers that are class components.
*/
itemData?: T | undefined;
/**
* Tag name passed to document.createElement to create the outer container element. This is an advanced property; in most cases, the default ("div") should be used.
*/
outerElementType?: ReactElementType | undefined;
/**
* Ref to attach to the outer container element. This is an advanced property.
*/
outerRef?: Ref<any> | undefined;
/**
* Tag name passed to document.createElement to create the outer container element. This is an advanced property; in most cases, the default ("div") should be used.
*
* @deprecated since 1.4.0
*/
outerTagName?: string | undefined;
/**
* Optional inline style to attach to outermost <div> element.
*/
style?: CSSProperties | undefined;
/**
* Adds an additional isScrolling parameter to the children render function. This parameter can be used to show a placeholder row or column while the list is being scrolled.
*
* Note that using this parameter will result in an additional render call after scrolling has stopped (when isScrolling changes from true to false).
*/
useIsScrolling?: boolean | undefined;
}
export type ListItemKeySelector<T = any> = (index: number, data: T) => Key;
export interface ListOnItemsRenderedProps {
overscanStartIndex: number;
overscanStopIndex: number;
visibleStartIndex: number;
visibleStopIndex: number;
}
export interface ListOnScrollProps {
scrollDirection: ScrollDirection;
scrollOffset: number;
scrollUpdateWasRequested: boolean;
}
export interface ListProps<T = any> extends CommonProps<T> {
/**
* React component responsible for rendering the individual item specified by an index prop. This component also receives a style prop (used for positioning).
*
* If useIsScrolling is enabled for the list, the component also receives an additional isScrolling boolean prop.
*/
children: ComponentType<ListChildComponentProps<T>>;
/**
* Height of the list.
*
* For vertical lists, this must be a number. It affects the number of rows that will be rendered (and displayed) at any given time.
*
* For horizontal lists, this can be a number or a string (e.g. "50%").
*/
height: number | string;
/**
* Total number of items in the list. Note that only a few items will be rendered and displayed at a time.
*/
itemCount: number;
/**
* Width of the list.
*
* For horizontal lists, this must be a number. It affects the number of columns that will be rendered (and displayed) at any given time.
*
* For vertical lists, this can be a number or a string (e.g. "50%").
*/
width: number | string;
/**
* Determines the direction of text and horizontal scrolling.
*
* This property also automatically sets the CSS direction style for the list component.
*
* Specifying "horizontal" or "vertical" for this value is deprecated. Use "layout" prop instead.
*
* @default "ltr"
*/
direction?: CSSDirection | Direction | undefined;
/**
* Layout/orientation of the list.
*
* Acceptable values are:
* - "vertical" (default) - Up/down scrolling.
* - "horizontal" - Left/right scrolling.
*
* Note that lists may scroll in both directions (depending on CSS) but content will only be windowed in the layout direction specified.
*/
layout?: Layout | undefined;
/**
* Scroll offset for initial render.
*
* For vertical lists, this affects scrollTop. For horizontal lists, this affects scrollLeft.
*/
initialScrollOffset?: number | undefined;
/**
* By default, lists will use an item's index as its key. This is okay if:
*
* - Your collections of items is never sorted or modified
* - Your item renderer is not stateful and does not extend PureComponent
*
* If your list does not satisfy the above constraints, use the itemKey property to specify your own keys for items
*/
itemKey?: ListItemKeySelector<T> | undefined;
/**
* The number of items (rows or columns) to render outside of the visible area. This property can be important for two reasons:
*
* - Overscanning by one row or column allows the tab key to focus on the next (not yet visible) item.
* - Overscanning slightly can reduce or prevent a flash of empty space when a user first starts scrolling.
*
* Note that overscanning too much can negatively impact performance. By default, List overscans by one item.
*/
overscanCount?: number | undefined;
/**
* Called when the items rendered by the list change.
*/
onItemsRendered?: ((props: ListOnItemsRenderedProps) => any) | undefined;
/**
* Called when the list scroll positions changes, as a result of user scrolling or scroll-to method calls.
*/
onScroll?: ((props: ListOnScrollProps) => any) | undefined;
}
export type GridItemKeySelector<T = any> = (params: {
columnIndex: number;
rowIndex: number;
data: T;
}) => Key;
export interface GridOnItemsRenderedProps {
overscanColumnStartIndex: number;
overscanColumnStopIndex: number;
overscanRowStartIndex: number;
overscanRowStopIndex: number;
visibleColumnStartIndex: number;
visibleColumnStopIndex: number;
visibleRowStartIndex: number;
visibleRowStopIndex: number;
}
export interface GridOnScrollProps {
horizontalScrollDirection: ScrollDirection;
scrollLeft: number;
scrollTop: number;
scrollUpdateWasRequested: boolean;
verticalScrollDirection: ScrollDirection;
}
export interface GridProps<T = any> extends CommonProps<T> {
/**
* React component responsible for rendering the individual item specified by an index prop. This component also receives a style prop (used for positioning).
*
* If useIsScrolling is enabled for the list, the component also receives an additional isScrolling boolean prop.
*/
children: ComponentType<GridChildComponentProps<T>>;
/**
* Number of columns in the grid. Note that only a few columns will be rendered and displayed at a time.
*/
columnCount: number;
/**
* Determines the direction of text and horizontal scrolling.
*
* This property also automatically sets the CSS direction style for the grid component.
*
* @default "ltr"
*/
direction?: CSSDirection | undefined;
/**
* Height of the grid. This affects the number of rows that will be rendered (and displayed) at any given time.
*/
height: number;
/**
* Horizontal scroll offset for initial render.
*/
initialScrollLeft?: number | undefined;
/**
* Vertical scroll offset for initial render.
*/
initialScrollTop?: number | undefined;
/**
* By default, grids will use an item's indices as its key. This is okay if:
*
* - Your collections of items is never sorted or modified
* - Your item renderer is not stateful and does not extend PureComponent
*
* If your grid does not satisfy the above constraints, use the itemKey property to specify your own keys for items.
*/
itemKey?: GridItemKeySelector<T> | undefined;
/**
* Called when the items rendered by the grid change.
*/
onItemsRendered?: ((props: GridOnItemsRenderedProps) => any) | undefined;
/**
* Called when the grid scroll positions changes, as a result of user scrolling or scroll-to method calls.
*/
onScroll?: ((props: GridOnScrollProps) => any) | undefined;
/**
* @deprecated since version 1.8.2, please use overscanColumnCount
*/
overscanColumnsCount?: number | undefined;
/**
* The number of columns to render outside of the visible area. This property can be important for two reasons:
*
* - Overscanning by one row or column allows the tab key to focus on the next (not yet visible) item.
* - Overscanning slightly can reduce or prevent a flash of empty space when a user first starts scrolling.
*
* Note that overscanning too much can negatively impact performance. By default, grid overscans by one item.
*/
overscanColumnCount?: number | undefined;
/**
* @deprecated since version 1.8.2, please use overscanRowCount
*/
overscanRowsCount?: number | undefined;
/**
* The number of rows to render outside of the visible area. This property can be important for two reasons:
*
* - Overscanning by one row or column allows the tab key to focus on the next (not yet visible) item.
* - Overscanning slightly can reduce or prevent a flash of empty space when a user first starts scrolling.
*
* Note that overscanning too much can negatively impact performance. By default, grid overscans by one item.
*/
overscanRowCount?: number | undefined;
/**
* The number of items (rows or columns) to render outside of the visible area. This property can be important for two reasons:
*
* - Overscanning by one row or column allows the tab key to focus on the next (not yet visible) item.
* - Overscanning slightly can reduce or prevent a flash of empty space when a user first starts scrolling.
*
* Note that overscanning too much can negatively impact performance. By default, grid overscans by one item.
*
* @deprecated since version 1.4.0
*/
overscanCount?: number | undefined;
/**
* Number of rows in the grid. Note that only a few rows will be rendered and displayed at a time.
*/
rowCount: number;
/**
* Width of the grid. This affects the number of columns that will be rendered (and displayed) at any given time.
*/
width: number;
}
export interface FixedSizeListProps<T = any> extends ListProps<T> {
/**
* Size of a item in the direction being windowed. For vertical lists, this is the row height. For horizontal lists, this is the column width.
*/
itemSize: number;
}
export interface VariableSizeListProps<T = any> extends ListProps<T> {
/**
* Estimated size of a item in the direction being windowed. For vertical lists, this is the row height. For horizontal lists, this is the column width.
*
* This value is used to calculated the estimated total size of a list before its items have all been measured. The total size impacts user scrolling behavior.
* It is updated whenever new items are measured.
*/
estimatedItemSize?: number | undefined;
/**
* Returns the size of a item in the direction being windowed. For vertical lists, this is the row height. For horizontal lists, this is the column width.
*/
itemSize: (index: number) => number;
}
export interface FixedSizeGridProps<T = any> extends GridProps<T> {
/**
* Width of an individual column within the grid.
*/
columnWidth: number;
/**
* Height of an individual row within the grid.
*/
rowHeight: number;
}
export interface VariableSizeGridProps<T = any> extends GridProps<T> {
/**
* Returns the width of the specified column.
*/
columnWidth: (index: number) => number;
/**
* Average (or estimated) column width for unrendered columns.
*
* This value is used to calculated the estimated total width of a Grid before its columns have all been measured.
* The estimated width impacts user scrolling behavior. It is updated whenever new columns are measured.
*/
estimatedColumnWidth?: number | undefined;
/**
* Average (or estimated) row height for unrendered rows.
*
* This value is used to calculated the estimated total height of a Grid before its rows have all been measured.
* The estimated height impacts user scrolling behavior. It is updated whenever new rows are measured.
*/
estimatedRowHeight?: number | undefined;
/**
* Returns the height of the specified row.
*/
rowHeight: (index: number) => number;
}
export class FixedSizeList<T = any> extends Component<FixedSizeListProps<T>> {
/**
* Scroll to the specified offset (scrollTop or scrollLeft, depending on the direction prop).
*/
scrollTo(scrollOffset: number): void;
/**
* Scroll to the specified item.
*
* By default, the List will scroll as little as possible to ensure the item is visible.
* You can control the alignment of the item though by specifying a second alignment parameter. Acceptable values are:
*
* - auto (default) - Scroll as little as possible to ensure the item is visible. (If the item is already visible, it won't scroll at all.)
* - smart
* - If the item is already visible, don't scroll at all.
* - If it is less than one viewport away, scroll as little as possible so that it becomes visible.
* - If it is more than one viewport away, scroll so that it is centered within the list.
* - center - Center align the item within the list.
* - end - Align the item to the end of the list (the bottom for vertical lists or the right for horizontal lists).
* - start - Align the item to the beginning of the list (the top for vertical lists or the left for horizontal lists).
*/
scrollToItem(index: number, align?: Align): void;
}
export class VariableSizeList<T = any> extends Component<VariableSizeListProps<T>> {
/**
* Scroll to the specified offset (scrollTop or scrollLeft, depending on the direction prop).
*/
scrollTo(scrollOffset: number): void;
/**
* Scroll to the specified item.
*
* By default, the List will scroll as little as possible to ensure the item is visible.
* You can control the alignment of the item though by specifying a second alignment parameter. Acceptable values are:
*
* - auto (default) - Scroll as little as possible to ensure the item is visible. (If the item is already visible, it won't scroll at all.)
* - smart
* - If the item is already visible, don't scroll at all.
* - If it is less than one viewport away, scroll as little as possible so that it becomes visible.
* - If it is more than one viewport away, scroll so that it is centered within the list.
* - center - Center align the item within the list.
* - end - Align the item to the end of the list (the bottom for vertical lists or the right for horizontal lists).
* - start - Align the item to the beginning of the list (the top for vertical lists or the left for horizontal lists).
*/
scrollToItem(index: number, align?: Align): void;
/**
* VariableSizeList caches offsets and measurements for each index for performance purposes.
* This method clears that cached data for all items after (and including) the specified index.
* It should be called whenever a item's size changes. (Note that this is not a typical occurrence.)
*
* By default the list will automatically re-render after the index is reset.
* If you would like to delay this re-render until e.g. a state update has completed in the parent component,
* specify a value of false for the second, optional parameter.
*/
resetAfterIndex(index: number, shouldForceUpdate?: boolean): void;
}
export class FixedSizeGrid<T = any> extends Component<FixedSizeGridProps<T>> {
/**
* Scroll to the specified offsets.
*/
scrollTo(params: { scrollLeft?: number; scrollTop?: number }): void;
/**
* Scroll to the specified item.
*
* By default, the Grid will scroll as little as possible to ensure the item is visible.
* You can control the alignment of the item though by specifying an `align` property. Acceptable values are:
*
* - auto (default) - Scroll as little as possible to ensure the item is visible. (If the item is already visible, it won't scroll at all.)
* - smart
* - If the item is already visible, don't scroll at all.
* - If it is less than one viewport away, scroll as little as possible so that it becomes visible.
* - If it is more than one viewport away, scroll so that it is centered within the grid.
* - center - Center align the item within the grid.
* - end - Align the item to the bottom, right hand side of the grid.
* - start - Align the item to the top, left hand of the grid.
*
* If either `columnIndex` or `rowIndex` are omitted, `scrollLeft` or `scrollTop` will be unchanged (respectively).
*/
scrollToItem(params: {
align?: Align | undefined;
columnIndex?: number | undefined;
rowIndex?: number | undefined;
}): void;
}
export class VariableSizeGrid<T = any> extends Component<VariableSizeGridProps<T>> {
/**
* Scroll to the specified offsets.
*/
scrollTo(params: { scrollLeft?: number; scrollTop?: number }): void;
/**
* Scroll to the specified item.
*
* By default, the Grid will scroll as little as possible to ensure the item is visible.
* You can control the alignment of the item though by specifying an `align` property. Acceptable values are:
*
* - auto (default) - Scroll as little as possible to ensure the item is visible. (If the item is already visible, it won't scroll at all.)
* - smart
* - If the item is already visible, don't scroll at all.
* - If it is less than one viewport away, scroll as little as possible so that it becomes visible.
* - If it is more than one viewport away, scroll so that it is centered within the grid.
* - center - Center align the item within the grid.
* - end - Align the item to the bottom, right hand side of the grid.
* - start - Align the item to the top, left hand of the grid.
*
* If either `columnIndex` or `rowIndex` are omitted, `scrollLeft` or `scrollTop` will be unchanged (respectively).
*/
scrollToItem(params: {
align?: Align | undefined;
columnIndex?: number | undefined;
rowIndex?: number | undefined;
}): void;
/**
* VariableSizeGrid caches offsets and measurements for each column index for performance purposes.
* This method clears that cached data for all columns after (and including) the specified index.
* It should be called whenever a column's width changes. (Note that this is not a typical occurrence.)
*
* By default the grid will automatically re-render after the index is reset.
* If you would like to delay this re-render until e.g. a state update has completed in the parent component,
* specify a value of false for the second, optional parameter.
*/
resetAfterColumnIndex(index: number, shouldForceUpdate?: boolean): void;
/**
* VariableSizeGrid caches offsets and measurements for each item for performance purposes.
* This method clears that cached data for all items after (and including) the specified indices.
* It should be called whenever an items size changes. (Note that this is not a typical occurrence.)
*
* By default the grid will automatically re-render after the index is reset.
* If you would like to delay this re-render until e.g. a state update has completed in the parent component,
* specify a value of false for the optional shouldForceUpdate parameter.
*/
resetAfterIndices(params: {
columnIndex: number;
rowIndex: number;
shouldForceUpdate?: boolean | undefined;
}): void;
/**
* VariableSizeGrid caches offsets and measurements for each row index for performance purposes.
* This method clears that cached data for all rows after (and including) the specified index.
* It should be called whenever a row's height changes. (Note that this is not a typical occurrence.)
*
* By default the grid will automatically re-render after the index is reset.
* If you would like to delay this re-render until e.g. a state update has completed in the parent component,
* specify a value of false for the second, optional parameter.
*/
resetAfterRowIndex(index: number, shouldForceUpdate?: boolean): void;
}
/**
* Custom comparison function for React.memo().
* It knows to compare individual style props and ignore the wrapper object.
*
* @see https://reactjs.org/docs/react-api.html#reactmemo
*/
export function areEqual(
prevProps: Readonly<object>,
nextProps: Readonly<object>,
): boolean;
/**
* Custom shouldComponentUpdate for class components.
* It knows to compare individual style props and ignore the wrapper object.
*
* @see https://reactjs.org/docs/react-component.html#shouldcomponentupdate
*/
export function shouldComponentUpdate<P = {}, S = {}>(
this: { props: P; state: S },
nextProps: Readonly<P>,
nextState: Readonly<S>,
): boolean;
@@ -0,0 +1,45 @@
import { __read, __spreadArray } from "tslib";
import { useRef } from 'react';
import useUpdateEffect from '../../../useUpdateEffect';
// support refreshDeps & ready
var useAutoRunPlugin = function (fetchInstance, _a) {
var manual = _a.manual, _b = _a.ready, ready = _b === void 0 ? true : _b, _c = _a.defaultParams, defaultParams = _c === void 0 ? [] : _c, _d = _a.refreshDeps, refreshDeps = _d === void 0 ? [] : _d, refreshDepsAction = _a.refreshDepsAction;
var hasAutoRun = useRef(false);
hasAutoRun.current = false;
useUpdateEffect(function () {
if (!manual && ready) {
hasAutoRun.current = true;
fetchInstance.run.apply(fetchInstance, __spreadArray([], __read(defaultParams), false));
}
}, [ready]);
useUpdateEffect(function () {
if (hasAutoRun.current) {
return;
}
if (!manual) {
hasAutoRun.current = true;
if (refreshDepsAction) {
refreshDepsAction();
}
else {
fetchInstance.refresh();
}
}
}, __spreadArray([], __read(refreshDeps), false));
return {
onBefore: function () {
if (!ready) {
return {
stopNow: true,
};
}
},
};
};
useAutoRunPlugin.onInit = function (_a) {
var _b = _a.ready, ready = _b === void 0 ? true : _b, manual = _a.manual;
return {
loading: !manual && ready,
};
};
export default useAutoRunPlugin;
@@ -0,0 +1,305 @@
// Copyright 2013 Google Inc. All Rights Reserved.
//
// Licensed 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 CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Functions for clustering similar histograms together.
#ifndef BROTLI_ENC_CLUSTER_H_
#define BROTLI_ENC_CLUSTER_H_
#include <math.h>
#include <stdint.h>
#include <stdio.h>
#include <algorithm>
#include <complex>
#include <map>
#include <set>
#include <utility>
#include <vector>
#include "./bit_cost.h"
#include "./entropy_encode.h"
#include "./fast_log.h"
#include "./histogram.h"
namespace brotli {
struct HistogramPair {
int idx1;
int idx2;
bool valid;
double cost_combo;
double cost_diff;
};
struct HistogramPairComparator {
bool operator()(const HistogramPair& p1, const HistogramPair& p2) const {
if (p1.cost_diff != p2.cost_diff) {
return p1.cost_diff > p2.cost_diff;
}
return abs(p1.idx1 - p1.idx2) > abs(p2.idx1 - p2.idx2);
}
};
// Returns entropy reduction of the context map when we combine two clusters.
inline double ClusterCostDiff(int size_a, int size_b) {
int size_c = size_a + size_b;
return size_a * FastLog2(size_a) + size_b * FastLog2(size_b) -
size_c * FastLog2(size_c);
}
// Computes the bit cost reduction by combining out[idx1] and out[idx2] and if
// it is below a threshold, stores the pair (idx1, idx2) in the *pairs heap.
template<typename HistogramType>
void CompareAndPushToHeap(const HistogramType* out,
const int* cluster_size,
int idx1, int idx2,
std::vector<HistogramPair>* pairs) {
if (idx1 == idx2) {
return;
}
if (idx2 < idx1) {
int t = idx2;
idx2 = idx1;
idx1 = t;
}
bool store_pair = false;
HistogramPair p;
p.idx1 = idx1;
p.idx2 = idx2;
p.valid = true;
p.cost_diff = 0.5 * ClusterCostDiff(cluster_size[idx1], cluster_size[idx2]);
p.cost_diff -= out[idx1].bit_cost_;
p.cost_diff -= out[idx2].bit_cost_;
if (out[idx1].total_count_ == 0) {
p.cost_combo = out[idx2].bit_cost_;
store_pair = true;
} else if (out[idx2].total_count_ == 0) {
p.cost_combo = out[idx1].bit_cost_;
store_pair = true;
} else {
double threshold = pairs->empty() ? 1e99 :
std::max(0.0, (*pairs)[0].cost_diff);
HistogramType combo = out[idx1];
combo.AddHistogram(out[idx2]);
double cost_combo = PopulationCost(combo);
if (cost_combo < threshold - p.cost_diff) {
p.cost_combo = cost_combo;
store_pair = true;
}
}
if (store_pair) {
p.cost_diff += p.cost_combo;
pairs->push_back(p);
std::push_heap(pairs->begin(), pairs->end(), HistogramPairComparator());
}
}
template<typename HistogramType>
void HistogramCombine(HistogramType* out,
int* cluster_size,
int* symbols,
int symbols_size,
int max_clusters) {
double cost_diff_threshold = 0.0;
int min_cluster_size = 1;
std::set<int> all_symbols;
std::vector<int> clusters;
for (int i = 0; i < symbols_size; ++i) {
if (all_symbols.find(symbols[i]) == all_symbols.end()) {
all_symbols.insert(symbols[i]);
clusters.push_back(symbols[i]);
}
}
// We maintain a heap of histogram pairs, ordered by the bit cost reduction.
std::vector<HistogramPair> pairs;
for (int idx1 = 0; idx1 < clusters.size(); ++idx1) {
for (int idx2 = idx1 + 1; idx2 < clusters.size(); ++idx2) {
CompareAndPushToHeap(out, cluster_size, clusters[idx1], clusters[idx2],
&pairs);
}
}
while (clusters.size() > min_cluster_size) {
if (pairs[0].cost_diff >= cost_diff_threshold) {
cost_diff_threshold = 1e99;
min_cluster_size = max_clusters;
continue;
}
// Take the best pair from the top of heap.
int best_idx1 = pairs[0].idx1;
int best_idx2 = pairs[0].idx2;
out[best_idx1].AddHistogram(out[best_idx2]);
out[best_idx1].bit_cost_ = pairs[0].cost_combo;
cluster_size[best_idx1] += cluster_size[best_idx2];
for (int i = 0; i < symbols_size; ++i) {
if (symbols[i] == best_idx2) {
symbols[i] = best_idx1;
}
}
for (int i = 0; i + 1 < clusters.size(); ++i) {
if (clusters[i] >= best_idx2) {
clusters[i] = clusters[i + 1];
}
}
clusters.pop_back();
// Invalidate pairs intersecting the just combined best pair.
for (int i = 0; i < pairs.size(); ++i) {
HistogramPair& p = pairs[i];
if (p.idx1 == best_idx1 || p.idx2 == best_idx1 ||
p.idx1 == best_idx2 || p.idx2 == best_idx2) {
p.valid = false;
}
}
// Pop invalid pairs from the top of the heap.
while (!pairs.empty() && !pairs[0].valid) {
std::pop_heap(pairs.begin(), pairs.end(), HistogramPairComparator());
pairs.pop_back();
}
// Push new pairs formed with the combined histogram to the heap.
for (int i = 0; i < clusters.size(); ++i) {
CompareAndPushToHeap(out, cluster_size, best_idx1, clusters[i], &pairs);
}
}
}
// -----------------------------------------------------------------------------
// Histogram refinement
// What is the bit cost of moving histogram from cur_symbol to candidate.
template<typename HistogramType>
double HistogramBitCostDistance(const HistogramType& histogram,
const HistogramType& candidate) {
if (histogram.total_count_ == 0) {
return 0.0;
}
HistogramType tmp = histogram;
tmp.AddHistogram(candidate);
return PopulationCost(tmp) - candidate.bit_cost_;
}
// Find the best 'out' histogram for each of the 'in' histograms.
// Note: we assume that out[]->bit_cost_ is already up-to-date.
template<typename HistogramType>
void HistogramRemap(const HistogramType* in, int in_size,
HistogramType* out, int* symbols) {
std::set<int> all_symbols;
for (int i = 0; i < in_size; ++i) {
all_symbols.insert(symbols[i]);
}
for (int i = 0; i < in_size; ++i) {
int best_out = i == 0 ? symbols[0] : symbols[i - 1];
double best_bits = HistogramBitCostDistance(in[i], out[best_out]);
for (std::set<int>::const_iterator k = all_symbols.begin();
k != all_symbols.end(); ++k) {
const double cur_bits = HistogramBitCostDistance(in[i], out[*k]);
if (cur_bits < best_bits) {
best_bits = cur_bits;
best_out = *k;
}
}
symbols[i] = best_out;
}
// Recompute each out based on raw and symbols.
for (std::set<int>::const_iterator k = all_symbols.begin();
k != all_symbols.end(); ++k) {
out[*k].Clear();
}
for (int i = 0; i < in_size; ++i) {
out[symbols[i]].AddHistogram(in[i]);
}
}
// Reorder histograms in *out so that the new symbols in *symbols come in
// increasing order.
template<typename HistogramType>
void HistogramReindex(std::vector<HistogramType>* out,
std::vector<int>* symbols) {
std::vector<HistogramType> tmp(*out);
std::map<int, int> new_index;
int next_index = 0;
for (int i = 0; i < symbols->size(); ++i) {
if (new_index.find((*symbols)[i]) == new_index.end()) {
new_index[(*symbols)[i]] = next_index;
(*out)[next_index] = tmp[(*symbols)[i]];
++next_index;
}
}
out->resize(next_index);
for (int i = 0; i < symbols->size(); ++i) {
(*symbols)[i] = new_index[(*symbols)[i]];
}
}
template<typename HistogramType>
void ClusterHistogramsTrivial(const std::vector<HistogramType>& in,
int num_contexts, int num_blocks,
int max_histograms,
std::vector<HistogramType>* out,
std::vector<int>* histogram_symbols) {
out->resize(num_blocks);
for (int i = 0; i < num_blocks; ++i) {
(*out)[i].Clear();
for (int j = 0; j < num_contexts; ++j) {
(*out)[i].AddHistogram(in[i * num_contexts + j]);
histogram_symbols->push_back(i);
}
}
}
// Clusters similar histograms in 'in' together, the selected histograms are
// placed in 'out', and for each index in 'in', *histogram_symbols will
// indicate which of the 'out' histograms is the best approximation.
template<typename HistogramType>
void ClusterHistograms(const std::vector<HistogramType>& in,
int num_contexts, int num_blocks,
int max_histograms,
std::vector<HistogramType>* out,
std::vector<int>* histogram_symbols) {
const int in_size = num_contexts * num_blocks;
std::vector<int> cluster_size(in_size, 1);
out->resize(in_size);
histogram_symbols->resize(in_size);
for (int i = 0; i < in_size; ++i) {
(*out)[i] = in[i];
(*out)[i].bit_cost_ = PopulationCost(in[i]);
(*histogram_symbols)[i] = i;
}
// Collapse similar histograms within a block type.
if (num_contexts > 1) {
for (int i = 0; i < num_blocks; ++i) {
HistogramCombine(&(*out)[0], &cluster_size[0],
&(*histogram_symbols)[i * num_contexts], num_contexts,
max_histograms);
}
}
// Collapse similar histograms.
HistogramCombine(&(*out)[0], &cluster_size[0],
&(*histogram_symbols)[0], in_size,
max_histograms);
// Find the optimal map from original histograms to the final ones.
HistogramRemap(&in[0], in_size, &(*out)[0], &(*histogram_symbols)[0]);
// Convert the context map to a canonical form.
HistogramReindex(out, histogram_symbols);
}
} // namespace brotli
#endif // BROTLI_ENC_CLUSTER_H_
@@ -0,0 +1,8 @@
'use strict';
try {
module.exports = require('bindings')('addon.node').convert;
} catch (err) {
module.exports = require('../jssrc/index.js');
}
//# sourceMappingURL=index.js.map
@@ -0,0 +1,21 @@
/**
* DON'T EDIT THIS FILE.
* This file was generated by "scripts/update-lib-configs.js" script.
*/
"use strict"
module.exports = {
plugins: ["es-x"],
rules: {
"es-x/no-bigint": "error",
"es-x/no-dynamic-import": "error",
"es-x/no-export-ns-from": "error",
"es-x/no-global-this": "error",
"es-x/no-import-meta": "error",
"es-x/no-nullish-coalescing-operators": "error",
"es-x/no-optional-chaining": "error",
"es-x/no-promise-all-settled": "error",
"es-x/no-regexp-unicode-property-escapes-2020": "error",
"es-x/no-string-prototype-matchall": "error",
},
}
@@ -0,0 +1,8 @@
export type Options = [
{
allow: string[];
}
];
export type MessageIds = 'noVarReqs';
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"noVarReqs", Options, import("../../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
export default _default;
@@ -0,0 +1,55 @@
/**
* @author Toru Nagashima <https://github.com/mysticatea>
* See LICENSE file in root directory for full license.
*/
"use strict"
const { definePatternSearchGenerator } = require("../utils")
const iterateTargetChars = definePatternSearchGenerator(/[\u2028\u2029]/gu)
module.exports = {
meta: {
docs: {
description: "disallow `\\u2028` and `\\u2029` in string literals.",
category: "ES2019",
recommended: false,
url:
"http://mysticatea.github.io/eslint-plugin-es/rules/no-json-superset.html",
},
fixable: "code",
messages: {
forbidden: "ES2019 '\\u{{code}}' in string literals is forbidden.",
},
schema: [],
type: "problem",
},
create(context) {
const sourceCode = context.getSourceCode()
return {
Literal(node) {
if (typeof node.value !== "string") {
return
}
const offset = node.range[0]
for (const { index } of iterateTargetChars(node.raw)) {
const code = node.raw.codePointAt(index).toString(16)
const loc = sourceCode.getLocFromIndex(offset + index)
context.report({
node,
loc,
messageId: "forbidden",
data: { code },
fix(fixer) {
return fixer.replaceTextRange(
[offset + index, offset + index + 1],
`\\u${code}`
)
},
})
}
},
}
},
}
@@ -0,0 +1,384 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
/**
* @typedef {{ readonly [type: string]: ReadonlyArray<string> }} VisitorKeys
*/
/**
* @type {VisitorKeys}
*/
const KEYS = {
ArrayExpression: [
"elements"
],
ArrayPattern: [
"elements"
],
ArrowFunctionExpression: [
"params",
"body"
],
AssignmentExpression: [
"left",
"right"
],
AssignmentPattern: [
"left",
"right"
],
AwaitExpression: [
"argument"
],
BinaryExpression: [
"left",
"right"
],
BlockStatement: [
"body"
],
BreakStatement: [
"label"
],
CallExpression: [
"callee",
"arguments"
],
CatchClause: [
"param",
"body"
],
ChainExpression: [
"expression"
],
ClassBody: [
"body"
],
ClassDeclaration: [
"id",
"superClass",
"body"
],
ClassExpression: [
"id",
"superClass",
"body"
],
ConditionalExpression: [
"test",
"consequent",
"alternate"
],
ContinueStatement: [
"label"
],
DebuggerStatement: [],
DoWhileStatement: [
"body",
"test"
],
EmptyStatement: [],
ExperimentalRestProperty: [
"argument"
],
ExperimentalSpreadProperty: [
"argument"
],
ExportAllDeclaration: [
"exported",
"source"
],
ExportDefaultDeclaration: [
"declaration"
],
ExportNamedDeclaration: [
"declaration",
"specifiers",
"source"
],
ExportSpecifier: [
"exported",
"local"
],
ExpressionStatement: [
"expression"
],
ForInStatement: [
"left",
"right",
"body"
],
ForOfStatement: [
"left",
"right",
"body"
],
ForStatement: [
"init",
"test",
"update",
"body"
],
FunctionDeclaration: [
"id",
"params",
"body"
],
FunctionExpression: [
"id",
"params",
"body"
],
Identifier: [],
IfStatement: [
"test",
"consequent",
"alternate"
],
ImportDeclaration: [
"specifiers",
"source"
],
ImportDefaultSpecifier: [
"local"
],
ImportExpression: [
"source"
],
ImportNamespaceSpecifier: [
"local"
],
ImportSpecifier: [
"imported",
"local"
],
JSXAttribute: [
"name",
"value"
],
JSXClosingElement: [
"name"
],
JSXClosingFragment: [],
JSXElement: [
"openingElement",
"children",
"closingElement"
],
JSXEmptyExpression: [],
JSXExpressionContainer: [
"expression"
],
JSXFragment: [
"openingFragment",
"children",
"closingFragment"
],
JSXIdentifier: [],
JSXMemberExpression: [
"object",
"property"
],
JSXNamespacedName: [
"namespace",
"name"
],
JSXOpeningElement: [
"name",
"attributes"
],
JSXOpeningFragment: [],
JSXSpreadAttribute: [
"argument"
],
JSXSpreadChild: [
"expression"
],
JSXText: [],
LabeledStatement: [
"label",
"body"
],
Literal: [],
LogicalExpression: [
"left",
"right"
],
MemberExpression: [
"object",
"property"
],
MetaProperty: [
"meta",
"property"
],
MethodDefinition: [
"key",
"value"
],
NewExpression: [
"callee",
"arguments"
],
ObjectExpression: [
"properties"
],
ObjectPattern: [
"properties"
],
PrivateIdentifier: [],
Program: [
"body"
],
Property: [
"key",
"value"
],
PropertyDefinition: [
"key",
"value"
],
RestElement: [
"argument"
],
ReturnStatement: [
"argument"
],
SequenceExpression: [
"expressions"
],
SpreadElement: [
"argument"
],
StaticBlock: [
"body"
],
Super: [],
SwitchCase: [
"test",
"consequent"
],
SwitchStatement: [
"discriminant",
"cases"
],
TaggedTemplateExpression: [
"tag",
"quasi"
],
TemplateElement: [],
TemplateLiteral: [
"quasis",
"expressions"
],
ThisExpression: [],
ThrowStatement: [
"argument"
],
TryStatement: [
"block",
"handler",
"finalizer"
],
UnaryExpression: [
"argument"
],
UpdateExpression: [
"argument"
],
VariableDeclaration: [
"declarations"
],
VariableDeclarator: [
"id",
"init"
],
WhileStatement: [
"test",
"body"
],
WithStatement: [
"object",
"body"
],
YieldExpression: [
"argument"
]
};
// Types.
const NODE_TYPES = Object.keys(KEYS);
// Freeze the keys.
for (const type of NODE_TYPES) {
Object.freeze(KEYS[type]);
}
Object.freeze(KEYS);
/**
* @author Toru Nagashima <https://github.com/mysticatea>
* See LICENSE file in root directory for full license.
*/
/**
* @typedef {import('./visitor-keys.js').VisitorKeys} VisitorKeys
*/
// List to ignore keys.
const KEY_BLACKLIST = new Set([
"parent",
"leadingComments",
"trailingComments"
]);
/**
* Check whether a given key should be used or not.
* @param {string} key The key to check.
* @returns {boolean} `true` if the key should be used.
*/
function filterKey(key) {
return !KEY_BLACKLIST.has(key) && key[0] !== "_";
}
/**
* Get visitor keys of a given node.
* @param {object} node The AST node to get keys.
* @returns {readonly string[]} Visitor keys of the node.
*/
function getKeys(node) {
return Object.keys(node).filter(filterKey);
}
// Disable valid-jsdoc rule because it reports syntax error on the type of @returns.
// eslint-disable-next-line valid-jsdoc
/**
* Make the union set with `KEYS` and given keys.
* @param {VisitorKeys} additionalKeys The additional keys.
* @returns {VisitorKeys} The union set.
*/
function unionWith(additionalKeys) {
const retv = /** @type {{
[type: string]: ReadonlyArray<string>
}} */ (Object.assign({}, KEYS));
for (const type of Object.keys(additionalKeys)) {
if (Object.prototype.hasOwnProperty.call(retv, type)) {
const keys = new Set(additionalKeys[type]);
for (const key of retv[type]) {
keys.add(key);
}
retv[type] = Object.freeze(Array.from(keys));
} else {
retv[type] = Object.freeze(Array.from(additionalKeys[type]));
}
}
return Object.freeze(retv);
}
exports.KEYS = KEYS;
exports.getKeys = getKeys;
exports.unionWith = unionWith;
@@ -0,0 +1 @@
{"version":3,"file":"prop-types.d.ts","sourceRoot":"","sources":["prop-types.js"],"names":[],"mappings":"wBAwBW,OAAO,QAAQ,EAAE,IAAI,CAAC,UAAU"}
@@ -0,0 +1,96 @@
import {useEffectEvent as $ispOf$useEffectEvent, getOwnerDocument as $ispOf$getOwnerDocument} from "@react-aria/utils";
import {useRef as $ispOf$useRef, useEffect as $ispOf$useEffect} 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.
*/ // Portions of the code in this file are based on code from react.
// Original licensing for the following can be found in the
// NOTICE file in the root directory of this source tree.
// See https://github.com/facebook/react/tree/cc7c1aece46a6b69b41958d731e0fd27c94bfc6c/packages/react-interactions
function $e0b6e0b68ec7f50f$export$872b660ac5a1ff98(props) {
let { ref: ref, onInteractOutside: onInteractOutside, isDisabled: isDisabled, onInteractOutsideStart: onInteractOutsideStart } = props;
let stateRef = (0, $ispOf$useRef)({
isPointerDown: false,
ignoreEmulatedMouseEvents: false
});
let onPointerDown = (0, $ispOf$useEffectEvent)((e)=>{
if (onInteractOutside && $e0b6e0b68ec7f50f$var$isValidEvent(e, ref)) {
if (onInteractOutsideStart) onInteractOutsideStart(e);
stateRef.current.isPointerDown = true;
}
});
let triggerInteractOutside = (0, $ispOf$useEffectEvent)((e)=>{
if (onInteractOutside) onInteractOutside(e);
});
(0, $ispOf$useEffect)(()=>{
let state = stateRef.current;
if (isDisabled) return;
const element = ref.current;
const documentObject = (0, $ispOf$getOwnerDocument)(element);
// Use pointer events if available. Otherwise, fall back to mouse and touch events.
if (typeof PointerEvent !== 'undefined') {
let onPointerUp = (e)=>{
if (state.isPointerDown && $e0b6e0b68ec7f50f$var$isValidEvent(e, ref)) triggerInteractOutside(e);
state.isPointerDown = false;
};
// changing these to capture phase fixed combobox
documentObject.addEventListener('pointerdown', onPointerDown, true);
documentObject.addEventListener('pointerup', onPointerUp, true);
return ()=>{
documentObject.removeEventListener('pointerdown', onPointerDown, true);
documentObject.removeEventListener('pointerup', onPointerUp, true);
};
} else {
let onMouseUp = (e)=>{
if (state.ignoreEmulatedMouseEvents) state.ignoreEmulatedMouseEvents = false;
else if (state.isPointerDown && $e0b6e0b68ec7f50f$var$isValidEvent(e, ref)) triggerInteractOutside(e);
state.isPointerDown = false;
};
let onTouchEnd = (e)=>{
state.ignoreEmulatedMouseEvents = true;
if (state.isPointerDown && $e0b6e0b68ec7f50f$var$isValidEvent(e, ref)) triggerInteractOutside(e);
state.isPointerDown = false;
};
documentObject.addEventListener('mousedown', onPointerDown, true);
documentObject.addEventListener('mouseup', onMouseUp, true);
documentObject.addEventListener('touchstart', onPointerDown, true);
documentObject.addEventListener('touchend', onTouchEnd, true);
return ()=>{
documentObject.removeEventListener('mousedown', onPointerDown, true);
documentObject.removeEventListener('mouseup', onMouseUp, true);
documentObject.removeEventListener('touchstart', onPointerDown, true);
documentObject.removeEventListener('touchend', onTouchEnd, true);
};
}
}, [
ref,
isDisabled,
onPointerDown,
triggerInteractOutside
]);
}
function $e0b6e0b68ec7f50f$var$isValidEvent(event, ref) {
if (event.button > 0) return false;
if (event.target) {
// if the event target is no longer in the document, ignore
const ownerDocument = event.target.ownerDocument;
if (!ownerDocument || !ownerDocument.documentElement.contains(event.target)) return false;
// If the target is within a top layer element (e.g. toasts), ignore.
if (event.target.closest('[data-react-aria-top-layer]')) return false;
}
return ref.current && !ref.current.contains(event.target);
}
export {$e0b6e0b68ec7f50f$export$872b660ac5a1ff98 as useInteractOutside};
//# sourceMappingURL=useInteractOutside.module.js.map
@@ -0,0 +1,52 @@
import * as tailwind_variants from 'tailwind-variants';
import { VariantProps } from 'tailwind-variants';
import * as tailwind_variants_dist_config from 'tailwind-variants/dist/config';
/**
* Spacer wrapper **Tailwind Variants** component
*
* @example
*
* const styles = spacer()
*
* <span className={styles} />
*/
declare const spacer: tailwind_variants.TVReturnType<{
isInline: {
true: "inline-block";
false: "block";
};
}, undefined, "w-px h-px inline-block", tailwind_variants_dist_config.TVConfig<{
isInline: {
true: "inline-block";
false: "block";
};
}, {
isInline: {
true: "inline-block";
false: "block";
};
}>, {
isInline: {
true: "inline-block";
false: "block";
};
}, undefined, tailwind_variants.TVReturnType<{
isInline: {
true: "inline-block";
false: "block";
};
}, undefined, "w-px h-px inline-block", tailwind_variants_dist_config.TVConfig<{
isInline: {
true: "inline-block";
false: "block";
};
}, {
isInline: {
true: "inline-block";
false: "block";
};
}>, unknown, unknown, undefined>>;
type SpacerVariantProps = VariantProps<typeof spacer>;
export { SpacerVariantProps, spacer };
@@ -0,0 +1 @@
{"version":3,"file":"multiInject.d.ts","sourceRoot":"","sources":["../../../../src/metadata/decorators/multiInject.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAO/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAGlE,wBAAgB,WAAW,CACzB,iBAAiB,EAAE,iBAAiB,GAAG,qBAAqB,EAC5D,OAAO,CAAC,EAAE,kBAAkB,GAC3B,eAAe,GAAG,kBAAkB,GAAG,iBAAiB,CAU1D"}
@@ -0,0 +1,10 @@
{
"extends": "@ljharb/tsconfig",
"compilerOptions": {
"target": "es2021", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
},
"exclude": [
"coverage",
"test/list-exports"
],
}
@@ -0,0 +1 @@
{"name":"cross-spawn","version":"7.0.6","requiresBuild":false,"files":{"LICENSE":{"checkedAt":1794532094003,"integrity":"sha512-sdx6Wb/15kFQa2MCaz8/0HBqj6vEfWp8uQRPYPF+ab8n+qOh1BsOtT3JBVtWCCzcDA5BnrgK7dL27+cCD192LQ==","mode":420,"size":1105},"lib/enoent.js":{"checkedAt":1794532094003,"integrity":"sha512-ttydkyHpGiUuGS2YzPSbRCjuMs5KY9q3iN01v4STA7MfYd+TmBseEemiANX0weJLnIFpyAJsIQkWzHLF9Ue45A==","mode":420,"size":1471},"lib/util/escape.js":{"checkedAt":1794532094003,"integrity":"sha512-cs0Mv21L3Kbk/SNZhy2FSbsf95GiReBRGDsv9uIJrkSkzVxQmQ4LB2vqQuLuW8RaOe3cdg3436At8DtD/1sL1A==","mode":420,"size":1383},"index.js":{"checkedAt":1794532094003,"integrity":"sha512-3t1JwevJilhaGp18WKxElPuWYs+HtJtp/ymjL2r1iRI6fwEsnBXoniM02VG7Twlorp7A816DJIawemVcyLhvyg==","mode":420,"size":1192},"lib/parse.js":{"checkedAt":1794532094003,"integrity":"sha512-YC+tSB6G2YG43fn/1JFJa/mXBdCcLIUJeC678EKPQBPPOp3gy2cHPwgSGyhEYS90zQR+/wd+lEDaCpEMsa7o9g==","mode":420,"size":3065},"lib/util/readShebang.js":{"checkedAt":1794532094004,"integrity":"sha512-RYd3aNSqwCM772XDLLuMsNNxUaI0KPcXREssK3GznxsGJSLW/4o9xEMuP2PfZqVa5ylX7FUlyJzhAnh3X4Yryw==","mode":420,"size":549},"lib/util/resolveCommand.js":{"checkedAt":1794532094004,"integrity":"sha512-T72oZ1h7imJm+BH1N6SjeK3BfdS//DwPLGTCnhzlKg0VDeT9aJVrIF5hSZy5akyhisQvSVNplIgEzMx8qxPCBw==","mode":420,"size":1557},"package.json":{"checkedAt":1794532094004,"integrity":"sha512-PKBtouh/D4TmwZxxAMZM3XWUaY72ATmLtLGmIupFETQQxE9JOtNI+tZba4uhpu8wD/cLvwuMIBsQoKwi1g17Tw==","mode":420,"size":1655},"README.md":{"checkedAt":1794532094004,"integrity":"sha512-pNmtvrYXKoBE1mK9ERl6ko/X1JCn+Kw0Egyi5iLdUyN69B7VboIzPYQC1Uhb0NLpXx/sVYjPAcpSURqmtkqApQ==","mode":420,"size":4117}}}
@@ -0,0 +1,253 @@
import {getCollectionId as $feb5ffebff200149$export$6aeb1680a0ae8741, isNonContiguousSelectionModifier as $feb5ffebff200149$export$d3e3bd3e26688c04} from "./utils.mjs";
import {useRouter as $581M0$useRouter, useId as $581M0$useId, isCtrlKeyPressed as $581M0$isCtrlKeyPressed, mergeProps as $581M0$mergeProps, chain as $581M0$chain, openLink as $581M0$openLink} from "@react-aria/utils";
import {focusSafely as $581M0$focusSafely, usePress as $581M0$usePress, useLongPress as $581M0$useLongPress} from "@react-aria/interactions";
import {moveVirtualFocus as $581M0$moveVirtualFocus} from "@react-aria/focus";
import {useEffect as $581M0$useEffect, useRef as $581M0$useRef} 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 $880e95eb8b93ba9a$export$ecf600387e221c37(options) {
let { id: id, selectionManager: manager, key: key, ref: ref, shouldSelectOnPressUp: shouldSelectOnPressUp, shouldUseVirtualFocus: shouldUseVirtualFocus, focus: focus, isDisabled: isDisabled, onAction: onAction, allowsDifferentPressOrigin: allowsDifferentPressOrigin, linkBehavior: linkBehavior = 'action' } = options;
let router = (0, $581M0$useRouter)();
id = (0, $581M0$useId)(id);
let onSelect = (e)=>{
if (e.pointerType === 'keyboard' && (0, $feb5ffebff200149$export$d3e3bd3e26688c04)(e)) manager.toggleSelection(key);
else {
if (manager.selectionMode === 'none') return;
if (manager.isLink(key)) {
if (linkBehavior === 'selection' && ref.current) {
let itemProps = manager.getItemProps(key);
router.open(ref.current, e, itemProps.href, itemProps.routerOptions);
// Always set selected keys back to what they were so that select and combobox close.
manager.setSelectedKeys(manager.selectedKeys);
return;
} else if (linkBehavior === 'override' || linkBehavior === 'none') return;
}
if (manager.selectionMode === 'single') {
if (manager.isSelected(key) && !manager.disallowEmptySelection) manager.toggleSelection(key);
else manager.replaceSelection(key);
} else if (e && e.shiftKey) manager.extendSelection(key);
else if (manager.selectionBehavior === 'toggle' || e && ((0, $581M0$isCtrlKeyPressed)(e) || e.pointerType === 'touch' || e.pointerType === 'virtual')) // if touch or virtual (VO) then we just want to toggle, otherwise it's impossible to multi select because they don't have modifier keys
manager.toggleSelection(key);
else manager.replaceSelection(key);
}
};
// Focus the associated DOM node when this item becomes the focusedKey
// TODO: can't make this useLayoutEffect bacause it breaks menus inside dialogs
// However, if this is a useEffect, it runs twice and dispatches two blur events and immediately sets
// aria-activeDescendant in useAutocomplete... I've worked around this for now
(0, $581M0$useEffect)(()=>{
let isFocused = key === manager.focusedKey;
if (isFocused && manager.isFocused) {
if (!shouldUseVirtualFocus) {
if (focus) focus();
else if (document.activeElement !== ref.current && ref.current) (0, $581M0$focusSafely)(ref.current);
} else (0, $581M0$moveVirtualFocus)(ref.current);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [
ref,
key,
manager.focusedKey,
manager.childFocusStrategy,
manager.isFocused,
shouldUseVirtualFocus
]);
isDisabled = isDisabled || manager.isDisabled(key);
// Set tabIndex to 0 if the element is focused, or -1 otherwise so that only the last focused
// item is tabbable. If using virtual focus, don't set a tabIndex at all so that VoiceOver
// on iOS 14 doesn't try to move real DOM focus to the item anyway.
let itemProps = {};
if (!shouldUseVirtualFocus && !isDisabled) itemProps = {
tabIndex: key === manager.focusedKey ? 0 : -1,
onFocus (e) {
if (e.target === ref.current) manager.setFocusedKey(key);
}
};
else if (isDisabled) itemProps.onMouseDown = (e)=>{
// Prevent focus going to the body when clicking on a disabled item.
e.preventDefault();
};
// With checkbox selection, onAction (i.e. navigation) becomes primary, and occurs on a single click of the row.
// Clicking the checkbox enters selection mode, after which clicking anywhere on any row toggles selection for that row.
// With highlight selection, onAction is secondary, and occurs on double click. Single click selects the row.
// With touch, onAction occurs on single tap, and long press enters selection mode.
let isLinkOverride = manager.isLink(key) && linkBehavior === 'override';
let isActionOverride = onAction && options['UNSTABLE_itemBehavior'] === 'action';
let hasLinkAction = manager.isLink(key) && linkBehavior !== 'selection' && linkBehavior !== 'none';
let allowsSelection = !isDisabled && manager.canSelectItem(key) && !isLinkOverride && !isActionOverride;
let allowsActions = (onAction || hasLinkAction) && !isDisabled;
let hasPrimaryAction = allowsActions && (manager.selectionBehavior === 'replace' ? !allowsSelection : !allowsSelection || manager.isEmpty);
let hasSecondaryAction = allowsActions && allowsSelection && manager.selectionBehavior === 'replace';
let hasAction = hasPrimaryAction || hasSecondaryAction;
let modality = (0, $581M0$useRef)(null);
let longPressEnabled = hasAction && allowsSelection;
let longPressEnabledOnPressStart = (0, $581M0$useRef)(false);
let hadPrimaryActionOnPressStart = (0, $581M0$useRef)(false);
let collectionItemProps = manager.getItemProps(key);
let performAction = (e)=>{
if (onAction) {
var _ref_current;
onAction();
(_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.dispatchEvent(new CustomEvent('react-aria-item-action', {
bubbles: true
}));
}
if (hasLinkAction && ref.current) router.open(ref.current, e, collectionItemProps.href, collectionItemProps.routerOptions);
};
// By default, selection occurs on pointer down. This can be strange if selecting an
// item causes the UI to disappear immediately (e.g. menus).
// If shouldSelectOnPressUp is true, we use onPressUp instead of onPressStart.
// onPress requires a pointer down event on the same element as pointer up. For menus,
// we want to be able to have the pointer down on the trigger that opens the menu and
// the pointer up on the menu item rather than requiring a separate press.
// For keyboard events, selection still occurs on key down.
let itemPressProps = {
ref: ref
};
if (shouldSelectOnPressUp) {
itemPressProps.onPressStart = (e)=>{
modality.current = e.pointerType;
longPressEnabledOnPressStart.current = longPressEnabled;
if (e.pointerType === 'keyboard' && (!hasAction || $880e95eb8b93ba9a$var$isSelectionKey())) onSelect(e);
};
// If allowsDifferentPressOrigin and interacting with mouse, make selection happen on pressUp (e.g. open menu on press down, selection on menu item happens on press up.)
// Otherwise, have selection happen onPress (prevents listview row selection when clicking on interactable elements in the row)
if (!allowsDifferentPressOrigin) itemPressProps.onPress = (e)=>{
if (hasPrimaryAction || hasSecondaryAction && e.pointerType !== 'mouse') {
if (e.pointerType === 'keyboard' && !$880e95eb8b93ba9a$var$isActionKey()) return;
performAction(e);
} else if (e.pointerType !== 'keyboard' && allowsSelection) onSelect(e);
};
else {
itemPressProps.onPressUp = hasPrimaryAction ? undefined : (e)=>{
if (e.pointerType === 'mouse' && allowsSelection) onSelect(e);
};
itemPressProps.onPress = hasPrimaryAction ? performAction : (e)=>{
if (e.pointerType !== 'keyboard' && e.pointerType !== 'mouse' && allowsSelection) onSelect(e);
};
}
} else {
itemPressProps.onPressStart = (e)=>{
modality.current = e.pointerType;
longPressEnabledOnPressStart.current = longPressEnabled;
hadPrimaryActionOnPressStart.current = hasPrimaryAction;
// Select on mouse down unless there is a primary action which will occur on mouse up.
// For keyboard, select on key down. If there is an action, the Space key selects on key down,
// and the Enter key performs onAction on key up.
if (allowsSelection && (e.pointerType === 'mouse' && !hasPrimaryAction || e.pointerType === 'keyboard' && (!allowsActions || $880e95eb8b93ba9a$var$isSelectionKey()))) onSelect(e);
};
itemPressProps.onPress = (e)=>{
// Selection occurs on touch up. Primary actions always occur on pointer up.
// Both primary and secondary actions occur on Enter key up. The only exception
// is secondary actions, which occur on double click with a mouse.
if (e.pointerType === 'touch' || e.pointerType === 'pen' || e.pointerType === 'virtual' || e.pointerType === 'keyboard' && hasAction && $880e95eb8b93ba9a$var$isActionKey() || e.pointerType === 'mouse' && hadPrimaryActionOnPressStart.current) {
if (hasAction) performAction(e);
else if (allowsSelection) onSelect(e);
}
};
}
itemProps['data-collection'] = (0, $feb5ffebff200149$export$6aeb1680a0ae8741)(manager.collection);
itemProps['data-key'] = key;
itemPressProps.preventFocusOnPress = shouldUseVirtualFocus;
// When using virtual focus, make sure the focused key gets updated on press.
if (shouldUseVirtualFocus) itemPressProps = (0, $581M0$mergeProps)(itemPressProps, {
onPressStart (e) {
if (e.pointerType !== 'touch') {
manager.setFocused(true);
manager.setFocusedKey(key);
}
},
onPress (e) {
if (e.pointerType === 'touch') {
manager.setFocused(true);
manager.setFocusedKey(key);
}
}
});
if (collectionItemProps) {
for (let key of [
'onPressStart',
'onPressEnd',
'onPressChange',
'onPress',
'onPressUp',
'onClick'
])if (collectionItemProps[key]) itemPressProps[key] = (0, $581M0$chain)(itemPressProps[key], collectionItemProps[key]);
}
let { pressProps: pressProps, isPressed: isPressed } = (0, $581M0$usePress)(itemPressProps);
// Double clicking with a mouse with selectionBehavior = 'replace' performs an action.
let onDoubleClick = hasSecondaryAction ? (e)=>{
if (modality.current === 'mouse') {
e.stopPropagation();
e.preventDefault();
performAction(e);
}
} : undefined;
// Long pressing an item with touch when selectionBehavior = 'replace' switches the selection behavior
// to 'toggle'. This changes the single tap behavior from performing an action (i.e. navigating) to
// selecting, and may toggle the appearance of a UI affordance like checkboxes on each item.
let { longPressProps: longPressProps } = (0, $581M0$useLongPress)({
isDisabled: !longPressEnabled,
onLongPress (e) {
if (e.pointerType === 'touch') {
onSelect(e);
manager.setSelectionBehavior('toggle');
}
}
});
// Prevent native drag and drop on long press if we also select on long press.
// Once the user is in selection mode, they can long press again to drag.
// Use a capturing listener to ensure this runs before useDrag, regardless of
// the order the props get merged.
let onDragStartCapture = (e)=>{
if (modality.current === 'touch' && longPressEnabledOnPressStart.current) e.preventDefault();
};
// Prevent default on link clicks so that we control exactly
// when they open (to match selection behavior).
let onClick = linkBehavior !== 'none' && manager.isLink(key) ? (e)=>{
if (!(0, $581M0$openLink).isOpening) e.preventDefault();
} : undefined;
return {
itemProps: (0, $581M0$mergeProps)(itemProps, allowsSelection || hasPrimaryAction || shouldUseVirtualFocus && !isDisabled ? pressProps : {}, longPressEnabled ? longPressProps : {}, {
onDoubleClick: onDoubleClick,
onDragStartCapture: onDragStartCapture,
onClick: onClick,
id: id
}, // Prevent DOM focus from moving on mouse down when using virtual focus
shouldUseVirtualFocus ? {
onMouseDown: (e)=>e.preventDefault()
} : undefined),
isPressed: isPressed,
isSelected: manager.isSelected(key),
isFocused: manager.isFocused && manager.focusedKey === key,
isDisabled: isDisabled,
allowsSelection: allowsSelection,
hasAction: hasAction
};
}
function $880e95eb8b93ba9a$var$isActionKey() {
let event = window.event;
return (event === null || event === void 0 ? void 0 : event.key) === 'Enter';
}
function $880e95eb8b93ba9a$var$isSelectionKey() {
let event = window.event;
return (event === null || event === void 0 ? void 0 : event.key) === ' ' || (event === null || event === void 0 ? void 0 : event.code) === 'Space';
}
export {$880e95eb8b93ba9a$export$ecf600387e221c37 as useSelectableItem};
//# sourceMappingURL=useSelectableItem.module.js.map
@@ -0,0 +1 @@
{"name":"@codemirror/commands","version":"6.10.1","requiresBuild":false,"files":{"LICENSE":{"checkedAt":1794532110695,"integrity":"sha512-93AnA94LXftw4iulmPgONmsxHTOmEXXVnuDgrubQugXHDb6+kqBYV3LU04W4nfNUBsUNOpHH1CYTncof2riVDg==","mode":420,"size":1118},"dist/index.cjs":{"checkedAt":1794532110696,"integrity":"sha512-O1M4GlRPm6+sp6TBTHXGMXX+1G+0sU7yNQwi7ZnryCxPk54wP0Puz7Xvs4ptaHGwLhVnPViTTNKoU9YKgsjPIw==","mode":420,"size":86740},"dist/index.d.cts":{"checkedAt":1794532110696,"integrity":"sha512-AFQ9zHAiJ2HvcE4i0S9+RCE5boWSFOYNFUGaBIKrQeI4HAlNBS9O9Rr1+XMJfyUau0l06HEb7ZVXq00gHEDhjQ==","mode":420,"size":29036},"dist/index.js":{"checkedAt":1794532110697,"integrity":"sha512-4VftKl0Yjo9Immym6NnZjk2Wx6MxyUx4xhELVJ5Xh4fNHCC7owty9yLQtZH0ZsX5GC3ZPjQ9VSHHouu9se4hFw==","mode":420,"size":83278},"package.json":{"checkedAt":1794532110697,"integrity":"sha512-xSW0Zgft6MWzSZFkDrfxrEGhdY84jv/XinJ2OzPQ5Pe4CTXhQk14pg4o+nJSAp4n8cb7TWOfefmmENhyY1jlsQ==","mode":420,"size":1025},"CHANGELOG.md":{"checkedAt":1794532110697,"integrity":"sha512-gVh8Ldw+jqGTjAC3HpUbo4j9cnASQSh6trB7Yz60cslqPLQHv7vpXw5gTvpguaQ8rQMx39qiGTPxZrS0v7knxA==","mode":420,"size":10714},"README.md":{"checkedAt":1794532110697,"integrity":"sha512-E07QpvMzpvKElBiYIhIErvpRuekkb+euViHDFRCqtcHA8TJfH2GAfyMIcdTP/BrKLkFSpNZnZfln0hazPvTsXw==","mode":420,"size":1362},"dist/index.d.ts":{"checkedAt":1794532110696,"integrity":"sha512-AFQ9zHAiJ2HvcE4i0S9+RCE5boWSFOYNFUGaBIKrQeI4HAlNBS9O9Rr1+XMJfyUau0l06HEb7ZVXq00gHEDhjQ==","mode":420,"size":29036},".github/workflows/dispatch.yml":{"checkedAt":1794532110697,"integrity":"sha512-m1oo9FDcj8HyBMn9j8PAdgJGReOxejwknSt0WhQByhphBMTHHlS1n9+UPCgcv631fi+EwCNIv0+z6VZAl52zag==","mode":420,"size":415}}}
@@ -0,0 +1,93 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _ariaQuery = require("aria-query");
var _jsxAstUtils = require("jsx-ast-utils");
var _schemas = require("../util/schemas");
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
* @fileoverview Enforce onmouseover/onmouseout are
* accompanied by onfocus/onblur.
* @author Ethan Cohen
*
*/ // ----------------------------------------------------------------------------
// Rule Definition
// ----------------------------------------------------------------------------
var schema = (0, _schemas.generateObjSchema)({
hoverInHandlers: _objectSpread(_objectSpread({}, _schemas.arraySchema), {}, {
description: 'An array of events that need to be accompanied by `onFocus`'
}),
hoverOutHandlers: _objectSpread(_objectSpread({}, _schemas.arraySchema), {}, {
description: 'An array of events that need to be accompanied by `onBlur`'
})
});
// Use `onMouseOver` and `onMouseOut` by default if no config is
// passed in for backwards compatibility
var DEFAULT_HOVER_IN_HANDLERS = ['onMouseOver'];
var DEFAULT_HOVER_OUT_HANDLERS = ['onMouseOut'];
var _default = exports["default"] = {
meta: {
docs: {
url: 'https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/tree/HEAD/docs/rules/mouse-events-have-key-events.md',
description: 'Enforce that `onMouseOver`/`onMouseOut` are accompanied by `onFocus`/`onBlur` for keyboard-only users.'
},
schema: [schema]
},
create: function create(context) {
return {
JSXOpeningElement: function JSXOpeningElement(node) {
var _options$0$hoverInHan, _options$, _options$0$hoverOutHa, _options$2;
var name = node.name.name;
if (!_ariaQuery.dom.get(name)) {
return;
}
var options = context.options;
var hoverInHandlers = (_options$0$hoverInHan = (_options$ = options[0]) === null || _options$ === void 0 ? void 0 : _options$.hoverInHandlers) !== null && _options$0$hoverInHan !== void 0 ? _options$0$hoverInHan : DEFAULT_HOVER_IN_HANDLERS;
var hoverOutHandlers = (_options$0$hoverOutHa = (_options$2 = options[0]) === null || _options$2 === void 0 ? void 0 : _options$2.hoverOutHandlers) !== null && _options$0$hoverOutHa !== void 0 ? _options$0$hoverOutHa : DEFAULT_HOVER_OUT_HANDLERS;
var attributes = node.attributes;
// Check hover in / onfocus pairing
var firstHoverInHandlerWithValue = hoverInHandlers.find(function (handler) {
var prop = (0, _jsxAstUtils.getProp)(attributes, handler);
var propValue = (0, _jsxAstUtils.getPropValue)(prop);
return propValue != null;
});
if (firstHoverInHandlerWithValue != null) {
var hasOnFocus = (0, _jsxAstUtils.getProp)(attributes, 'onFocus');
var onFocusValue = (0, _jsxAstUtils.getPropValue)(hasOnFocus);
if (hasOnFocus === false || onFocusValue === null || onFocusValue === undefined) {
context.report({
node: (0, _jsxAstUtils.getProp)(attributes, firstHoverInHandlerWithValue),
message: "".concat(firstHoverInHandlerWithValue, " must be accompanied by onFocus for accessibility.")
});
}
}
// Check hover out / onblur pairing
var firstHoverOutHandlerWithValue = hoverOutHandlers.find(function (handler) {
var prop = (0, _jsxAstUtils.getProp)(attributes, handler);
var propValue = (0, _jsxAstUtils.getPropValue)(prop);
return propValue != null;
});
if (firstHoverOutHandlerWithValue != null) {
var hasOnBlur = (0, _jsxAstUtils.getProp)(attributes, 'onBlur');
var onBlurValue = (0, _jsxAstUtils.getPropValue)(hasOnBlur);
if (hasOnBlur === false || onBlurValue === null || onBlurValue === undefined) {
context.report({
node: (0, _jsxAstUtils.getProp)(attributes, firstHoverOutHandlerWithValue),
message: "".concat(firstHoverOutHandlerWithValue, " must be accompanied by onBlur for accessibility.")
});
}
}
}
};
}
};
module.exports = exports.default;
@@ -0,0 +1,5 @@
var convert = require('./convert'),
func = convert('partition', require('../partition'));
func.placeholder = require('./placeholder');
module.exports = func;
@@ -0,0 +1,61 @@
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.svelteParsers = void 0;
var compiler_1 = require("svelte/compiler");
var snip_script_content_1 = require("./snip-script-content");
function locStart(node) {
return node.start;
}
function locEnd(node) {
return node.end;
}
function hasPragma(text) {
return /^\s*<!--\s*@(format|prettier)\W/.test(text);
}
exports.svelteParsers = {
svelte: {
hasPragma: hasPragma,
parse: function (text) {
try {
return __assign(__assign({}, (0, compiler_1.parse)(text)), { __isRoot: true });
}
catch (err) {
if (err.start != null && err.end != null) {
// Prettier expects error objects to have loc.start and loc.end fields.
// Svelte uses start and end directly on the error.
err.loc = {
start: err.start,
end: err.end,
};
}
throw err;
}
},
preprocess: function (text, options) {
var result = (0, snip_script_content_1.snipScriptAndStyleTagContent)(text);
text = result.text.trim();
// Prettier sets the preprocessed text as the originalText in case
// the Svelte formatter is called directly. In case it's called
// as an embedded parser (for example when there's a Svelte code block
// inside markdown), the originalText is not updated after preprocessing.
// Therefore we do it ourselves here.
options.originalText = text;
options._svelte_ts = result.isTypescript;
return text;
},
locStart: locStart,
locEnd: locEnd,
astFormat: 'svelte-ast',
},
};
@@ -0,0 +1,49 @@
import { parseColor, formatColor } from './color'
export function withAlphaValue(color, alphaValue, defaultValue) {
if (typeof color === 'function') {
return color({ opacityValue: alphaValue })
}
let parsed = parseColor(color, { loose: true })
if (parsed === null) {
return defaultValue
}
return formatColor({ ...parsed, alpha: alphaValue })
}
export default function withAlphaVariable({ color, property, variable }) {
let properties = [].concat(property)
if (typeof color === 'function') {
return {
[variable]: '1',
...Object.fromEntries(
properties.map((p) => {
return [p, color({ opacityVariable: variable, opacityValue: `var(${variable}, 1)` })]
})
),
}
}
const parsed = parseColor(color)
if (parsed === null) {
return Object.fromEntries(properties.map((p) => [p, color]))
}
if (parsed.alpha !== undefined) {
// Has an alpha value, return color as-is
return Object.fromEntries(properties.map((p) => [p, color]))
}
return {
[variable]: '1',
...Object.fromEntries(
properties.map((p) => {
return [p, formatColor({ ...parsed, alpha: `var(${variable}, 1)` })]
})
),
}
}
@@ -0,0 +1,148 @@
import Decimal from 'decimal.js';
import { ZERO } from '../constants';
import { invariant, repeat } from '../utils';
import { ApplyUnsignedRoundingMode } from './ApplyUnsignedRoundingMode';
//IMPL: Helper function to find n1, e1, and r1
function findN1E1R1(x, p) {
var maxN1 = Decimal.pow(10, p);
var minN1 = Decimal.pow(10, p - 1);
var maxE1 = x.div(minN1).log(10).plus(p).minus(1).ceil();
var currentE1 = maxE1;
while (true) {
var currentN1 = x.div(Decimal.pow(10, currentE1.minus(p).plus(1))).floor();
if (currentN1.lessThan(maxN1) && currentN1.greaterThanOrEqualTo(minN1)) {
var currentR1 = currentN1.times(Decimal.pow(10, currentE1.minus(p).plus(1)));
if (currentR1.lessThanOrEqualTo(x)) {
return {
n1: currentN1,
e1: currentE1,
r1: currentR1,
};
}
}
currentE1 = currentE1.minus(1);
}
}
//IMPL: Helper function to find n2, e2, and r2
function findN2E2R2(x, p) {
var maxN2 = Decimal.pow(10, p);
var minN2 = Decimal.pow(10, p - 1);
var minE2 = x.div(maxN2).log(10).plus(p).minus(1).floor();
var currentE2 = minE2;
while (true) {
var currentN2 = x.div(Decimal.pow(10, currentE2.minus(p).plus(1))).ceil();
if (currentN2.lessThan(maxN2) && currentN2.greaterThanOrEqualTo(minN2)) {
var currentR2 = currentN2.times(Decimal.pow(10, currentE2.minus(p).plus(1)));
if (currentR2.greaterThanOrEqualTo(x)) {
return {
n2: currentN2,
e2: currentE2,
r2: currentR2,
};
}
}
currentE2 = currentE2.plus(1);
}
}
/**
* https://tc39.es/ecma402/#sec-torawprecision
* @param x a finite non-negative Number or BigInt
* @param minPrecision an integer between 1 and 21
* @param maxPrecision an integer between 1 and 21
*/
export function ToRawPrecision(x, minPrecision, maxPrecision, unsignedRoundingMode) {
// 1. Let p be maxPrecision.
var p = maxPrecision;
var m;
var e;
var xFinal;
// 2. If x = 0, then
if (x.isZero()) {
// a. Let m be the String value consisting of p occurrences of the character "0".
m = repeat('0', p);
// b. Let e be 0.
e = 0;
// c. Let xFinal be 0.
xFinal = ZERO;
}
else {
// 3. Else,
// a. Let {n1, e1, r1} be the result of findN1E1R1(x, p).
var _a = findN1E1R1(x, p), n1 = _a.n1, e1 = _a.e1, r1 = _a.r1;
// b. Let {n2, e2, r2} be the result of findN2E2R2(x, p).
var _b = findN2E2R2(x, p), n2 = _b.n2, e2 = _b.e2, r2 = _b.r2;
// c. Let r be ApplyUnsignedRoundingMode(x, r1, r2, unsignedRoundingMode).
var r = ApplyUnsignedRoundingMode(x, r1, r2, unsignedRoundingMode);
var n
// d. If r = r1, then
= void 0;
// d. If r = r1, then
if (r.eq(r1)) {
// i. Let n be n1.
n = n1;
// ii. Let e be e1.
e = e1.toNumber();
// iii. Let xFinal be r1.
xFinal = r1;
}
else {
// e. Else,
// i. Let n be n2.
n = n2;
// ii. Let e be e2.
e = e2.toNumber();
// iii. Let xFinal be r2.
xFinal = r2;
}
// f. Let m be the String representation of n.
m = n.toString();
}
var int;
// 4. If e ≥ p - 1, then
if (e >= p - 1) {
// a. Let m be the string-concatenation of m and p - 1 - e occurrences of the character "0".
m = m + repeat('0', e - p + 1);
// b. Let int be e + 1.
int = e + 1;
}
else if (e >= 0) {
// 5. Else if e ≥ 0, then
// a. Let m be the string-concatenation of the first e + 1 characters of m, ".", and the remaining p - (e + 1) characters of m.
m = m.slice(0, e + 1) + '.' + m.slice(m.length - (p - (e + 1)));
// b. Let int be e + 1.
int = e + 1;
}
else {
// 6. Else,
// a. Assert: e < 0.
invariant(e < 0, 'e should be less than 0');
// b. Let m be the string-concatenation of "0.", -e - 1 occurrences of the character "0", and m.
m = '0.' + repeat('0', -e - 1) + m;
// c. Let int be 1.
int = 1;
}
// 7. If m contains ".", and maxPrecision > minPrecision, then
if (m.includes('.') && maxPrecision > minPrecision) {
// a. Let cut be maxPrecision - minPrecision.
var cut = maxPrecision - minPrecision;
// b. Repeat, while cut > 0 and the last character of m is "0",
while (cut > 0 && m[m.length - 1] === '0') {
// i. Remove the last character from m.
m = m.slice(0, m.length - 1);
// ii. Decrease cut by 1.
cut--;
}
// c. If the last character of m is ".", then
if (m[m.length - 1] === '.') {
// i. Remove the last character from m.
m = m.slice(0, m.length - 1);
}
}
// 8. Return the Record { [[FormattedString]]: m, [[RoundedNumber]]: xFinal, [[IntegerDigitsCount]]: int, [[RoundingMagnitude]]: e }.
return {
formattedString: m,
roundedNumber: xFinal,
integerDigitsCount: int,
roundingMagnitude: e,
};
}
@@ -0,0 +1,211 @@
/*!
* mime-types
* Copyright(c) 2014 Jonathan Ong
* Copyright(c) 2015 Douglas Christopher Wilson
* MIT Licensed
*/
'use strict'
/**
* Module dependencies.
* @private
*/
var db = require('mime-db')
var extname = require('path').extname
var mimeScore = require('./mimeScore')
/**
* Module variables.
* @private
*/
var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/
var TEXT_TYPE_REGEXP = /^text\//i
/**
* Module exports.
* @public
*/
exports.charset = charset
exports.charsets = { lookup: charset }
exports.contentType = contentType
exports.extension = extension
exports.extensions = Object.create(null)
exports.lookup = lookup
exports.types = Object.create(null)
exports._extensionConflicts = []
// Populate the extensions/types maps
populateMaps(exports.extensions, exports.types)
/**
* Get the default charset for a MIME type.
*
* @param {string} type
* @return {boolean|string}
*/
function charset (type) {
if (!type || typeof type !== 'string') {
return false
}
// TODO: use media-typer
var match = EXTRACT_TYPE_REGEXP.exec(type)
var mime = match && db[match[1].toLowerCase()]
if (mime && mime.charset) {
return mime.charset
}
// default text/* to utf-8
if (match && TEXT_TYPE_REGEXP.test(match[1])) {
return 'UTF-8'
}
return false
}
/**
* Create a full Content-Type header given a MIME type or extension.
*
* @param {string} str
* @return {boolean|string}
*/
function contentType (str) {
// TODO: should this even be in this module?
if (!str || typeof str !== 'string') {
return false
}
var mime = str.indexOf('/') === -1 ? exports.lookup(str) : str
if (!mime) {
return false
}
// TODO: use content-type or other module
if (mime.indexOf('charset') === -1) {
var charset = exports.charset(mime)
if (charset) mime += '; charset=' + charset.toLowerCase()
}
return mime
}
/**
* Get the default extension for a MIME type.
*
* @param {string} type
* @return {boolean|string}
*/
function extension (type) {
if (!type || typeof type !== 'string') {
return false
}
// TODO: use media-typer
var match = EXTRACT_TYPE_REGEXP.exec(type)
// get extensions
var exts = match && exports.extensions[match[1].toLowerCase()]
if (!exts || !exts.length) {
return false
}
return exts[0]
}
/**
* Lookup the MIME type for a file path/extension.
*
* @param {string} path
* @return {boolean|string}
*/
function lookup (path) {
if (!path || typeof path !== 'string') {
return false
}
// get the extension ("ext" or ".ext" or full path)
var extension = extname('x.' + path)
.toLowerCase()
.slice(1)
if (!extension) {
return false
}
return exports.types[extension] || false
}
/**
* Populate the extensions and types maps.
* @private
*/
function populateMaps (extensions, types) {
Object.keys(db).forEach(function forEachMimeType (type) {
var mime = db[type]
var exts = mime.extensions
if (!exts || !exts.length) {
return
}
// mime -> extensions
extensions[type] = exts
// extension -> mime
for (var i = 0; i < exts.length; i++) {
var extension = exts[i]
types[extension] = _preferredType(extension, types[extension], type)
// DELETE (eventually): Capture extension->type maps that change as a
// result of switching to mime-score. This is just to help make reviewing
// PR #119 easier, and can be removed once that PR is approved.
const legacyType = _preferredTypeLegacy(
extension,
types[extension],
type
)
if (legacyType !== types[extension]) {
exports._extensionConflicts.push([extension, legacyType, types[extension]])
}
}
})
}
// Resolve type conflict using mime-score
function _preferredType (ext, type0, type1) {
var score0 = type0 ? mimeScore(type0, db[type0].source) : 0
var score1 = type1 ? mimeScore(type1, db[type1].source) : 0
return score0 > score1 ? type0 : type1
}
// Resolve type conflict using pre-mime-score logic
function _preferredTypeLegacy (ext, type0, type1) {
var SOURCE_RANK = ['nginx', 'apache', undefined, 'iana']
var score0 = type0 ? SOURCE_RANK.indexOf(db[type0].source) : 0
var score1 = type1 ? SOURCE_RANK.indexOf(db[type1].source) : 0
if (
exports.types[extension] !== 'application/octet-stream' &&
(score0 > score1 ||
(score0 === score1 &&
exports.types[extension]?.slice(0, 12) === 'application/'))
) {
return type0
}
return score0 > score1 ? type0 : type1
}
@@ -0,0 +1,17 @@
var $2eed782c1c110ce7$exports = {};
$2eed782c1c110ce7$exports = {
"deselectedItem": (args)=>`${args.item} non selezionato.`,
"longPressToSelect": `Premi a lungo per passare alla modalit\xe0 di selezione.`,
"select": `Seleziona`,
"selectedAll": `Tutti gli elementi selezionati.`,
"selectedCount": (args, formatter)=>`${formatter.plural(args.count, {
"=0": `Nessun elemento selezionato`,
one: ()=>`${formatter.number(args.count)} elemento selezionato`,
other: ()=>`${formatter.number(args.count)} elementi selezionati`
})}.`,
"selectedItem": (args)=>`${args.item} selezionato.`
};
export {$2eed782c1c110ce7$exports as default};
//# sourceMappingURL=it-IT.module.js.map
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"K D E F wC","132":"A B"},B:{"1":"0 1 2 3 4 5 C L M G N O P Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I"},C:{"1":"0 1 2 3 4 5 9 AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B UC 4B VC 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R WC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I XC MC YC yC zC","2":"xC TC 0C 1C","129":"6 7 8 J ZB K D E F A B C L M G N O P aB"},D:{"1":"0 1 2 3 4 5 BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B UC 4B VC 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I XC MC YC","2":"J ZB K D E F A B C L","257":"6 7 8 9 M G N O P aB AB"},E:{"1":"D E F A B C L M G 5C 6C aC NC OC 7C 8C 9C bC cC PC AD QC dC eC fC gC hC BD RC iC jC kC lC mC CD SC nC oC pC qC rC sC tC DD ED","2":"J ZB 2C ZC","257":"K 4C","260":"3C"},F:{"1":"0 1 2 3 4 5 6 7 8 9 G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R WC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z","2":"F B C FD GD HD ID NC uC JD OC"},G:{"1":"E ND OD PD QD RD SD TD UD VD WD XD YD ZD aD bD cD dD bC cC PC eD QC dC eC fC gC hC fD RC iC jC kC lC mC gD SC nC oC pC qC rC sC tC","2":"ZC KD vC","257":"MD","260":"LD"},H:{"2":"hD"},I:{"1":"I mD nD","2":"TC J iD jD kD lD vC"},J:{"2":"D","257":"A"},K:{"1":"H","2":"A B C NC uC OC"},L:{"1":"I"},M:{"1":"MC"},N:{"132":"A B"},O:{"1":"PC"},P:{"1":"6 7 8 9 J AB BB CB DB EB FB oD pD qD rD sD aC tD uD vD wD xD QC RC SC yD"},Q:{"1":"zD"},R:{"1":"0D"},S:{"1":"1D 2D"}},B:4,C:"Content Security Policy 1.0",D:true};
@@ -0,0 +1,17 @@
"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("../v4/mini/index.cjs"), exports);
@@ -0,0 +1,44 @@
"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/types.ts
var types_exports = {};
__export(types_exports, {
AnyCalendarDate: () => AnyCalendarDate,
CalendarDate: () => CalendarDate,
CalendarDateTime: () => CalendarDateTime,
ZonedDateTime: () => ZonedDateTime
});
module.exports = __toCommonJS(types_exports);
var CalendarDate = class {
};
var CalendarDateTime = class {
};
var ZonedDateTime = class {
};
var AnyCalendarDate = class {
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
AnyCalendarDate,
CalendarDate,
CalendarDateTime,
ZonedDateTime
});
@@ -0,0 +1,10 @@
'use strict';
module.exports = function some(array, predicate) {
for (var i = 0; i < array.length; i += 1) {
if (predicate(array[i], i, array)) {
return true;
}
}
return false;
};
@@ -0,0 +1,3 @@
declare function warn(message: string, component?: string, ...args: any[]): void;
export { warn };
@@ -0,0 +1 @@
{"version":3,"names":["_classPrivateMethodSet","TypeError"],"sources":["../../src/helpers/classPrivateMethodSet.js"],"sourcesContent":["/* @minVersion 7.1.6 */\n/* @onlyBabel7 */\n\n// use readOnlyError instead of attemptSet\n\nexport default function _classPrivateMethodSet() {\n throw new TypeError(\"attempted to reassign private method\");\n}\n"],"mappings":";;;;;;AAKe,SAASA,sBAAsBA,CAAA,EAAG;EAC/C,MAAM,IAAIC,SAAS,CAAC,sCAAsC,CAAC;AAC7D","ignoreList":[]}
@@ -0,0 +1,41 @@
export type Options = {
/**
By default the wrap is soft, meaning long words may extend past the column width. Setting this to `true` will make it hard wrap at the column width.
@default false
*/
readonly hard?: boolean;
/**
By default, an attempt is made to split words at spaces, ensuring that they don't extend past the configured columns. If wordWrap is `false`, each column will instead be completely filled splitting words as necessary.
@default true
*/
readonly wordWrap?: boolean;
/**
Whitespace on all lines is removed by default. Set this option to `false` if you don't want to trim.
@default true
*/
readonly trim?: boolean;
};
/**
Wrap words to the specified column width.
@param string - String with ANSI escape codes. Like one styled by [`chalk`](https://github.com/chalk/chalk). Newline characters will be normalized to `\n`.
@param columns - Number of columns to wrap the text to.
@example
```
import chalk from 'chalk';
import wrapAnsi from 'wrap-ansi';
const input = 'The quick brown ' + chalk.red('fox jumped over ') +
'the lazy ' + chalk.green('dog and then ran away with the unicorn.');
console.log(wrapAnsi(input, 20));
```
*/
export default function wrapAnsi(string: string, columns: number, options?: Options): string;
@@ -0,0 +1 @@
{"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;;;AAkBM,SAAS,0CAAe,KAA2B;IACxD,IAAI,EACF,cAAc,SAAS,EACvB,GAAG,YACJ,GAAG;IAEJ,IAAI,UAAU,CAAA,GAAA,kCAA0B,EAAE,CAAA,GAAA,oDAAW,GAAG;IACxD,OAAO;QACL,UAAU;YACR,GAAG,CAAA,GAAA,qBAAa,EAAE,YAAY;gBAAC,WAAW;YAAI,EAAE;YAChD,cAAc,aAAa,QAAQ,MAAM,CAAC;QAC5C;IACF;AACF","sources":["packages/@react-aria/breadcrumbs/src/useBreadcrumbs.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 {AriaBreadcrumbsProps} from '@react-types/breadcrumbs';\nimport {DOMAttributes} from '@react-types/shared';\nimport {filterDOMProps} from '@react-aria/utils';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\nexport interface BreadcrumbsAria {\n /** Props for the breadcrumbs navigation element. */\n navProps: DOMAttributes\n}\n\n/**\n * Provides the behavior and accessibility implementation for a breadcrumbs component.\n * Breadcrumbs display a hierarchy of links to the current page or resource in an application.\n */\nexport function useBreadcrumbs(props: AriaBreadcrumbsProps): BreadcrumbsAria {\n let {\n 'aria-label': ariaLabel,\n ...otherProps\n } = props;\n\n let strings = useLocalizedStringFormatter(intlMessages, '@react-aria/breadcrumbs');\n return {\n navProps: {\n ...filterDOMProps(otherProps, {labelable: true}),\n 'aria-label': ariaLabel || strings.format('breadcrumbs')\n }\n };\n}\n"],"names":[],"version":3,"file":"useBreadcrumbs.module.js.map"}
@@ -0,0 +1,85 @@
'use strict';
module.exports = function generate__limitLength(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;
}
if (!($isData || typeof $schema == 'number')) {
throw new Error($keyword + ' must be number');
}
var $op = $keyword == 'maxLength' ? '>' : '<';
out += 'if ( ';
if ($isData) {
out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || ';
}
if (it.opts.unicode === false) {
out += ' ' + ($data) + '.length ';
} else {
out += ' ucs2length(' + ($data) + ') ';
}
out += ' ' + ($op) + ' ' + ($schemaValue) + ') { ';
var $errorKeyword = $keyword;
var $$outStack = $$outStack || [];
$$outStack.push(out);
out = ''; /* istanbul ignore else */
if (it.createErrors !== false) {
out += ' { keyword: \'' + ($errorKeyword || '_limitLength') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } ';
if (it.opts.messages !== false) {
out += ' , message: \'should NOT be ';
if ($keyword == 'maxLength') {
out += 'longer';
} else {
out += 'shorter';
}
out += ' than ';
if ($isData) {
out += '\' + ' + ($schemaValue) + ' + \'';
} else {
out += '' + ($schema);
}
out += ' characters\' ';
}
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 @@
{"version":3,"file":"schemaErrorLookup.d.ts","sourceRoot":"","sources":["../../src/logic/schemaErrorLookup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAIrE,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,EAC3E,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,EACtB,OAAO,EAAE,WAAW,EACpB,IAAI,EAAE,MAAM,GACX;IACD,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;CACd,CAyCA"}
@@ -0,0 +1,231 @@
/*
* 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 {disableTextSelection, restoreTextSelection} from './textSelection';
import {DOMAttributes, MoveEvents, PointerType} from '@react-types/shared';
import React, {useMemo, useRef} from 'react';
import {useEffectEvent, useGlobalListeners} from '@react-aria/utils';
export interface MoveResult {
/** Props to spread on the target element. */
moveProps: DOMAttributes
}
interface EventBase {
shiftKey: boolean,
ctrlKey: boolean,
metaKey: boolean,
altKey: boolean
}
/**
* Handles move interactions across mouse, touch, and keyboard, including dragging with
* the mouse or touch, and using the arrow keys. Normalizes behavior across browsers and
* platforms, and ignores emulated mouse events on touch devices.
*/
export function useMove(props: MoveEvents): MoveResult {
let {onMoveStart, onMove, onMoveEnd} = props;
let state = useRef<{
didMove: boolean,
lastPosition: {pageX: number, pageY: number} | null,
id: number | null
}>({didMove: false, lastPosition: null, id: null});
let {addGlobalListener, removeGlobalListener} = useGlobalListeners();
let move = useEffectEvent((originalEvent: EventBase, pointerType: PointerType, deltaX: number, deltaY: number) => {
if (deltaX === 0 && deltaY === 0) {
return;
}
if (!state.current.didMove) {
state.current.didMove = true;
onMoveStart?.({
type: 'movestart',
pointerType,
shiftKey: originalEvent.shiftKey,
metaKey: originalEvent.metaKey,
ctrlKey: originalEvent.ctrlKey,
altKey: originalEvent.altKey
});
}
onMove?.({
type: 'move',
pointerType,
deltaX: deltaX,
deltaY: deltaY,
shiftKey: originalEvent.shiftKey,
metaKey: originalEvent.metaKey,
ctrlKey: originalEvent.ctrlKey,
altKey: originalEvent.altKey
});
});
let end = useEffectEvent((originalEvent: EventBase, pointerType: PointerType) => {
restoreTextSelection();
if (state.current.didMove) {
onMoveEnd?.({
type: 'moveend',
pointerType,
shiftKey: originalEvent.shiftKey,
metaKey: originalEvent.metaKey,
ctrlKey: originalEvent.ctrlKey,
altKey: originalEvent.altKey
});
}
});
let moveProps = useMemo(() => {
let moveProps: DOMAttributes = {};
let start = () => {
disableTextSelection();
state.current.didMove = false;
};
if (typeof PointerEvent === 'undefined' && process.env.NODE_ENV === 'test') {
let onMouseMove = (e: MouseEvent) => {
if (e.button === 0) {
move(e, 'mouse', e.pageX - (state.current.lastPosition?.pageX ?? 0), e.pageY - (state.current.lastPosition?.pageY ?? 0));
state.current.lastPosition = {pageX: e.pageX, pageY: e.pageY};
}
};
let onMouseUp = (e: MouseEvent) => {
if (e.button === 0) {
end(e, 'mouse');
removeGlobalListener(window, 'mousemove', onMouseMove, false);
removeGlobalListener(window, 'mouseup', onMouseUp, false);
}
};
moveProps.onMouseDown = (e: React.MouseEvent) => {
if (e.button === 0) {
start();
e.stopPropagation();
e.preventDefault();
state.current.lastPosition = {pageX: e.pageX, pageY: e.pageY};
addGlobalListener(window, 'mousemove', onMouseMove, false);
addGlobalListener(window, 'mouseup', onMouseUp, false);
}
};
let onTouchMove = (e: TouchEvent) => {
let touch = [...e.changedTouches].findIndex(({identifier}) => identifier === state.current.id);
if (touch >= 0) {
let {pageX, pageY} = e.changedTouches[touch];
move(e, 'touch', pageX - (state.current.lastPosition?.pageX ?? 0), pageY - (state.current.lastPosition?.pageY ?? 0));
state.current.lastPosition = {pageX, pageY};
}
};
let onTouchEnd = (e: TouchEvent) => {
let touch = [...e.changedTouches].findIndex(({identifier}) => identifier === state.current.id);
if (touch >= 0) {
end(e, 'touch');
state.current.id = null;
removeGlobalListener(window, 'touchmove', onTouchMove);
removeGlobalListener(window, 'touchend', onTouchEnd);
removeGlobalListener(window, 'touchcancel', onTouchEnd);
}
};
moveProps.onTouchStart = (e: React.TouchEvent) => {
if (e.changedTouches.length === 0 || state.current.id != null) {
return;
}
let {pageX, pageY, identifier} = e.changedTouches[0];
start();
e.stopPropagation();
e.preventDefault();
state.current.lastPosition = {pageX, pageY};
state.current.id = identifier;
addGlobalListener(window, 'touchmove', onTouchMove, false);
addGlobalListener(window, 'touchend', onTouchEnd, false);
addGlobalListener(window, 'touchcancel', onTouchEnd, false);
};
} else {
let onPointerMove = (e: PointerEvent) => {
if (e.pointerId === state.current.id) {
let pointerType = (e.pointerType || 'mouse') as PointerType;
// Problems with PointerEvent#movementX/movementY:
// 1. it is always 0 on macOS Safari.
// 2. On Chrome Android, it's scaled by devicePixelRatio, but not on Chrome macOS
move(e, pointerType, e.pageX - (state.current.lastPosition?.pageX ?? 0), e.pageY - (state.current.lastPosition?.pageY ?? 0));
state.current.lastPosition = {pageX: e.pageX, pageY: e.pageY};
}
};
let onPointerUp = (e: PointerEvent) => {
if (e.pointerId === state.current.id) {
let pointerType = (e.pointerType || 'mouse') as PointerType;
end(e, pointerType);
state.current.id = null;
removeGlobalListener(window, 'pointermove', onPointerMove, false);
removeGlobalListener(window, 'pointerup', onPointerUp, false);
removeGlobalListener(window, 'pointercancel', onPointerUp, false);
}
};
moveProps.onPointerDown = (e: React.PointerEvent) => {
if (e.button === 0 && state.current.id == null) {
start();
e.stopPropagation();
e.preventDefault();
state.current.lastPosition = {pageX: e.pageX, pageY: e.pageY};
state.current.id = e.pointerId;
addGlobalListener(window, 'pointermove', onPointerMove, false);
addGlobalListener(window, 'pointerup', onPointerUp, false);
addGlobalListener(window, 'pointercancel', onPointerUp, false);
}
};
}
let triggerKeyboardMove = (e: EventBase, deltaX: number, deltaY: number) => {
start();
move(e, 'keyboard', deltaX, deltaY);
end(e, 'keyboard');
};
moveProps.onKeyDown = (e) => {
switch (e.key) {
case 'Left':
case 'ArrowLeft':
e.preventDefault();
e.stopPropagation();
triggerKeyboardMove(e, -1, 0);
break;
case 'Right':
case 'ArrowRight':
e.preventDefault();
e.stopPropagation();
triggerKeyboardMove(e, 1, 0);
break;
case 'Up':
case 'ArrowUp':
e.preventDefault();
e.stopPropagation();
triggerKeyboardMove(e, 0, -1);
break;
case 'Down':
case 'ArrowDown':
e.preventDefault();
e.stopPropagation();
triggerKeyboardMove(e, 0, 1);
break;
}
};
return moveProps;
}, [state, addGlobalListener, removeGlobalListener, move, end]);
return {moveProps};
}
@@ -0,0 +1,16 @@
# Names should be added to this file like so:
# Name or Organization <email address>
Google Inc. <*@google.com>
Bloomberg Finance L.P. <*@bloomberg.net>
IBM Inc. <*@*.ibm.com>
Yandex LLC <*@yandex-team.ru>
Steven Knight <knight@baldmt.com>
Ryan Norton <rnorton10@gmail.com>
David J. Sankel <david@sankelsoftware.com>
Eric N. Vander Weele <ericvw@gmail.com>
Tom Freudenberg <th.freudenberg@gmail.com>
Julien Brianceau <jbriance@cisco.com>
Refael Ackermann <refack@gmail.com>
Ujjwal Sharma <ryzokuken@disroot.org>
@@ -0,0 +1,673 @@
import { existsSync, writeFileSync, readFileSync } from 'node:fs';
import { mkdir, writeFile } from 'node:fs/promises';
import { resolve, dirname, relative } from 'node:path';
import { detectPackageManager, installPackage } from './index.D3XRDfWc.js';
import { p as prompt, a as any } from './index.z7NPOg2E.js';
import { x } from 'tinyexec';
import c from 'tinyrainbow';
import { c as configFiles } from './constants.D_Q9UYh-.js';
import 'node:process';
import 'node:module';
import 'node:url';
import './_commonjsHelpers.BFTU3MAI.js';
import 'readline';
import 'events';
const jsxExample = {
name: "HelloWorld.jsx",
js: `
export default function HelloWorld({ name }) {
return (
<div>
<h1>Hello {name}!</h1>
</div>
)
}
`,
ts: `
export default function HelloWorld({ name }: { name: string }) {
return (
<div>
<h1>Hello {name}!</h1>
</div>
)
}
`,
test: `
import { expect, test } from 'vitest'
import { render } from '@testing-library/jsx'
import HelloWorld from './HelloWorld.<EXT>x'
test('renders name', async () => {
const { getByText } = await render(<HelloWorld name="Vitest" />)
await expect.element(getByText('Hello Vitest!')).toBeInTheDocument()
})
`
};
const vueExample = {
name: "HelloWorld.vue",
js: `
<script setup>
defineProps({
name: String
})
<\/script>
<template>
<div>
<h1>Hello {{ name }}!</h1>
</div>
</template>
`,
ts: `
<script setup lang="ts">
defineProps<{
name: string
}>()
<\/script>
<template>
<div>
<h1>Hello {{ name }}!</h1>
</div>
</template>
`,
test: `
import { expect, test } from 'vitest'
import { render } from 'vitest-browser-vue'
import HelloWorld from './HelloWorld.vue'
test('renders name', async () => {
const { getByText } = render(HelloWorld, {
props: { name: 'Vitest' },
})
await expect.element(getByText('Hello Vitest!')).toBeInTheDocument()
})
`
};
const svelteExample = {
name: "HelloWorld.svelte",
js: `
<script>
export let name
<\/script>
<h1>Hello {name}!</h1>
`,
ts: `
<script lang="ts">
export let name: string
<\/script>
<h1>Hello {name}!</h1>
`,
test: `
import { expect, test } from 'vitest'
import { render } from 'vitest-browser-svelte'
import HelloWorld from './HelloWorld.svelte'
test('renders name', async () => {
const { getByText } = render(HelloWorld, { name: 'Vitest' })
await expect.element(getByText('Hello Vitest!')).toBeInTheDocument()
})
`
};
const markoExample = {
name: "HelloWorld.marko",
js: `
class {
onCreate() {
this.state = { name: null }
}
}
<h1>Hello \${state.name}!</h1>
`,
ts: `
export interface Input {
name: string
}
<h1>Hello \${input.name}!</h1>
`,
test: `
import { expect, test } from 'vitest'
import { render } from '@marko/testing-library'
import HelloWorld from './HelloWorld.svelte'
test('renders name', async () => {
const { getByText } = await render(HelloWorld, { name: 'Vitest' })
const element = getByText('Hello Vitest!')
expect(element).toBeInTheDocument()
})
`
};
const litExample = {
name: "HelloWorld.js",
js: `
import { html, LitElement } from 'lit'
export class HelloWorld extends LitElement {
static properties = {
name: { type: String },
}
constructor() {
super()
this.name = 'World'
}
render() {
return html\`<h1>Hello \${this.name}!</h1>\`
}
}
customElements.define('hello-world', HelloWorld)
`,
ts: `
import { html, LitElement } from 'lit'
import { customElement, property } from 'lit/decorators.js'
@customElement('hello-world')
export class HelloWorld extends LitElement {
@property({ type: String })
name = 'World'
render() {
return html\`<h1>Hello \${this.name}!</h1>\`
}
}
declare global {
interface HTMLElementTagNameMap {
'hello-world': HelloWorld
}
}
`,
test: `
import { expect, test } from 'vitest'
import { render } from 'vitest-browser-lit'
import { html } from 'lit'
import './HelloWorld.js'
test('renders name', async () => {
const screen = render(html\`<hello-world name="Vitest"></hello-world>\`)
const element = screen.getByText('Hello Vitest!')
await expect.element(element).toBeInTheDocument()
})
`
};
const qwikExample = {
name: "HelloWorld.jsx",
js: `
import { component$ } from '@builder.io/qwik'
export default component$(({ name }) => {
return (
<div>
<h1>Hello {name}!</h1>
</div>
)
})
`,
ts: `
import { component$ } from '@builder.io/qwik'
export default component$(({ name }: { name: string }) => {
return (
<div>
<h1>Hello {name}!</h1>
</div>
)
})
`,
test: `
import { expect, test } from 'vitest'
import { render } from 'vitest-browser-qwik'
import HelloWorld from './HelloWorld.tsx'
test('renders name', async () => {
const { getByText } = render(<HelloWorld name="Vitest" />)
await expect.element(getByText('Hello Vitest!')).toBeInTheDocument()
})
`
};
const vanillaExample = {
name: "HelloWorld.js",
js: `
export default function HelloWorld({ name }) {
const parent = document.createElement('div')
const h1 = document.createElement('h1')
h1.textContent = 'Hello ' + name + '!'
parent.appendChild(h1)
return parent
}
`,
ts: `
export default function HelloWorld({ name }: { name: string }): HTMLDivElement {
const parent = document.createElement('div')
const h1 = document.createElement('h1')
h1.textContent = 'Hello ' + name + '!'
parent.appendChild(h1)
return parent
}
`,
test: `
import { expect, test } from 'vitest'
import { getByText } from '@testing-library/dom'
import HelloWorld from './HelloWorld.js'
test('renders name', () => {
const parent = HelloWorld({ name: 'Vitest' })
document.body.appendChild(parent)
const element = getByText(parent, 'Hello Vitest!')
expect(element).toBeInTheDocument()
})
`
};
function getExampleTest(framework) {
switch (framework) {
case "solid": return {
...jsxExample,
test: jsxExample.test.replace("@testing-library/jsx", `@testing-library/${framework}`)
};
case "preact":
case "react": return {
...jsxExample,
test: jsxExample.test.replace("@testing-library/jsx", `vitest-browser-${framework}`)
};
case "vue": return vueExample;
case "svelte": return svelteExample;
case "lit": return litExample;
case "marko": return markoExample;
case "qwik": return qwikExample;
default: return vanillaExample;
}
}
async function generateExampleFiles(framework, lang) {
const example = getExampleTest(framework);
let fileName = example.name;
const folder = resolve(process.cwd(), "vitest-example");
const fileContent = example[lang];
if (!existsSync(folder)) await mkdir(folder, { recursive: true });
const isJSX = fileName.endsWith(".jsx");
if (isJSX && lang === "ts") fileName = fileName.replace(".jsx", ".tsx");
else if (fileName.endsWith(".js") && lang === "ts") fileName = fileName.replace(".js", ".ts");
example.test = example.test.replace("<EXT>", lang);
const filePath = resolve(folder, fileName);
const testPath = resolve(folder, `HelloWorld.test.${isJSX ? `${lang}x` : lang}`);
writeFileSync(filePath, fileContent.trimStart(), "utf-8");
writeFileSync(testPath, example.test.trimStart(), "utf-8");
return testPath;
}
// eslint-disable-next-line no-console
const log = console.log;
function getProviderOptions() {
return Object.entries({
playwright: "Playwright relies on Chrome DevTools protocol. Read more: https://playwright.dev",
webdriverio: "WebdriverIO uses WebDriver protocol. Read more: https://webdriver.io",
preview: "Preview is useful to quickly run your tests in the browser, but not suitable for CI."
}).map(([provider, description]) => {
return {
title: provider,
description,
value: provider
};
});
}
function getBrowserNames(provider) {
switch (provider) {
case "webdriverio": return [
"chrome",
"firefox",
"edge",
"safari"
];
case "playwright": return [
"chromium",
"firefox",
"webkit"
];
case "preview": return [
"chrome",
"firefox",
"safari"
];
}
}
function getFramework() {
return [
{
title: "vanilla",
value: "vanilla",
description: "No framework, just plain JavaScript or TypeScript."
},
{
title: "vue",
value: "vue",
description: "\"The Progressive JavaScript Framework\""
},
{
title: "svelte",
value: "svelte",
description: "\"Svelte: cybernetically enhanced web apps\""
},
{
title: "react",
value: "react",
description: "\"The library for web and native user interfaces\""
},
{
title: "lit",
value: "lit",
description: "\"A simple library for building fast, lightweight web components.\""
},
{
title: "preact",
value: "preact",
description: "\"Fast 3kB alternative to React with the same modern API\""
},
{
title: "solid",
value: "solid",
description: "\"Simple and performant reactivity for building user interfaces\""
},
{
title: "marko",
value: "marko",
description: "\"A declarative, HTML-based language that makes building web apps fun\""
},
{
title: "qwik",
value: "qwik",
description: "\"Instantly interactive web apps at scale\""
}
];
}
function getFrameworkTestPackage(framework) {
switch (framework) {
case "vanilla": return null;
case "vue": return "vitest-browser-vue";
case "svelte": return "vitest-browser-svelte";
case "react": return "vitest-browser-react";
case "lit": return "vitest-browser-lit";
case "preact": return "vitest-browser-preact";
case "solid": return "@solidjs/testing-library";
case "marko": return "@marko/testing-library";
case "qwik": return "vitest-browser-qwik";
}
throw new Error(`Unsupported framework: ${framework}`);
}
function getFrameworkPluginPackage(framework) {
switch (framework) {
case "vue": return "@vitejs/plugin-vue";
case "svelte": return "@sveltejs/vite-plugin-svelte";
case "react": return "@vitejs/plugin-react";
case "preact": return "@preact/preset-vite";
case "solid": return "vite-plugin-solid";
case "marko": return "@marko/vite";
case "qwik": return "@builder.io/qwik/optimizer";
}
return null;
}
function getLanguageOptions() {
return [{
title: "TypeScript",
description: "Use TypeScript.",
value: "ts"
}, {
title: "JavaScript",
description: "Use plain JavaScript.",
value: "js"
}];
}
async function installPackages(pkgManager, packages) {
if (!packages.length) {
log(c.green("✔"), c.bold("All packages are already installed."));
return;
}
log(c.cyan("◼"), c.bold("Installing packages..."));
log(c.cyan("◼"), packages.join(", "));
log();
await installPackage(packages, {
dev: true,
packageManager: pkgManager ?? void 0
});
}
function readPkgJson(path) {
if (!existsSync(path)) return null;
const content = readFileSync(path, "utf-8");
return JSON.parse(content);
}
function getPossibleDefaults(dependencies) {
return {
lang: "ts",
provider: getPossibleProvider(dependencies),
framework: getPossibleFramework(dependencies)
};
}
function getPossibleFramework(dependencies) {
if (dependencies.vue || dependencies["vue-tsc"] || dependencies["@vue/reactivity"]) return "vue";
if (dependencies.react || dependencies["react-dom"]) return "react";
if (dependencies.svelte || dependencies["@sveltejs/kit"]) return "svelte";
if (dependencies.lit || dependencies["lit-html"]) return "lit";
if (dependencies.preact) return "preact";
if (dependencies["solid-js"] || dependencies["@solidjs/start"]) return "solid";
if (dependencies.marko) return "marko";
if (dependencies["@builder.io/qwik"] || dependencies["@qwik.dev/core"]) return "qwik";
return "vanilla";
}
function getPossibleProvider(dependencies) {
if (dependencies.webdriverio || dependencies["@wdio/cli"] || dependencies["@wdio/config"]) return "webdriverio";
// playwright is the default recommendation
return "playwright";
}
function getProviderDocsLink(provider) {
switch (provider) {
case "playwright": return "https://vitest.dev/guide/browser/playwright";
case "webdriverio": return "https://vitest.dev/guide/browser/webdriverio";
}
}
function sort(choices, value) {
const index = choices.findIndex((i) => i.value === value);
if (index === -1) return choices;
return [choices.splice(index, 1)[0], ...choices];
}
function fail() {
process.exitCode = 1;
}
function getFrameworkImportInfo(framework) {
switch (framework) {
case "svelte": return {
importName: "svelte",
isNamedExport: true
};
case "qwik": return {
importName: "qwikVite",
isNamedExport: true
};
default: return {
importName: framework,
isNamedExport: false
};
}
}
async function generateFrameworkConfigFile(options) {
const { importName, isNamedExport } = getFrameworkImportInfo(options.framework);
const frameworkImport = isNamedExport ? `import { ${importName} } from '${options.frameworkPlugin}'` : `import ${importName} from '${options.frameworkPlugin}'`;
const configContent = [
`import { defineConfig } from 'vitest/config'`,
`import { ${options.provider} } from '@vitest/browser-${options.provider}'`,
options.frameworkPlugin ? frameworkImport : null,
``,
"export default defineConfig({",
options.frameworkPlugin ? ` plugins: [${importName}()],` : null,
` test: {`,
` browser: {`,
` enabled: true,`,
` provider: ${options.provider}(),`,
options.provider !== "preview" && ` // ${getProviderDocsLink(options.provider)}`,
` instances: [`,
...options.browsers.map((browser) => ` { browser: '${browser}' },`),
` ],`,
` },`,
` },`,
`})`,
""
].filter((t) => typeof t === "string").join("\n");
await writeFile(options.configPath, configContent);
}
async function updatePkgJsonScripts(pkgJsonPath, vitestScript) {
if (!existsSync(pkgJsonPath)) {
const pkg = { scripts: { "test:browser": vitestScript } };
await writeFile(pkgJsonPath, `${JSON.stringify(pkg, null, 2)}\n`, "utf-8");
} else {
const pkg = JSON.parse(readFileSync(pkgJsonPath, "utf-8"));
pkg.scripts = pkg.scripts || {};
pkg.scripts["test:browser"] = vitestScript;
await writeFile(pkgJsonPath, `${JSON.stringify(pkg, null, 2)}\n`, "utf-8");
}
log(c.green("✔"), "Added \"test:browser\" script to your package.json.");
}
function getRunScript(pkgManager) {
switch (pkgManager) {
case "yarn@berry":
case "yarn": return "yarn test:browser";
case "pnpm@6":
case "pnpm": return "pnpm test:browser";
case "bun": return "bun test:browser";
default: return "npm run test:browser";
}
}
function getPlaywrightRunArgs(pkgManager) {
switch (pkgManager) {
case "yarn@berry":
case "yarn": return ["yarn", "exec"];
case "pnpm@6":
case "pnpm": return ["pnpx"];
case "bun": return ["bunx"];
default: return ["npx"];
}
}
async function create() {
log(c.cyan("◼"), "This utility will help you set up a browser testing environment.\n");
const pkgJsonPath = resolve(process.cwd(), "package.json");
const pkg = readPkgJson(pkgJsonPath) || {};
const dependencies = {
...pkg.dependencies,
...pkg.devDependencies
};
const defaults = getPossibleDefaults(dependencies);
const { lang } = await prompt({
type: "select",
name: "lang",
message: "Choose a language for your tests",
choices: sort(getLanguageOptions(), defaults?.lang)
});
if (!lang) return fail();
const { provider } = await prompt({
type: "select",
name: "provider",
message: "Choose a browser provider. Vitest will use its API to control the testing environment",
choices: sort(getProviderOptions(), defaults?.provider)
});
if (!provider) return fail();
const { browsers } = await prompt({
type: "multiselect",
name: "browsers",
message: "Choose a browser",
choices: getBrowserNames(provider).map((browser) => ({
title: browser,
value: browser
}))
});
if (!provider) return fail();
const { framework } = await prompt({
type: "select",
name: "framework",
message: "Choose your framework",
choices: sort(getFramework(), defaults?.framework)
});
if (!framework) return fail();
let installPlaywright = false;
if (provider === "playwright") ({installPlaywright} = await prompt({
type: "confirm",
name: "installPlaywright",
message: `Install Playwright browsers (can be done manually via 'pnpm exec playwright install')?`
}));
if (installPlaywright == null) return fail();
const dependenciesToInstall = [`@vitest/browser-${provider}`];
const frameworkPackage = getFrameworkTestPackage(framework);
if (frameworkPackage) dependenciesToInstall.push(frameworkPackage);
const frameworkPlugin = getFrameworkPluginPackage(framework);
if (frameworkPlugin) dependenciesToInstall.push(frameworkPlugin);
const pkgManager = await detectPackageManager();
log();
await installPackages(pkgManager, dependenciesToInstall.filter((pkg) => !dependencies[pkg]));
const rootConfig = any(configFiles, { cwd: process.cwd() });
let scriptCommand = "vitest";
log();
if (rootConfig) {
const configPath = resolve(dirname(rootConfig), `vitest.browser.config.${lang}`);
scriptCommand = `vitest --config=${relative(process.cwd(), configPath)}`;
await generateFrameworkConfigFile({
configPath,
framework,
frameworkPlugin,
provider,
browsers
});
log(
c.green("✔"),
"Created a new config file for browser tests:",
c.bold(relative(process.cwd(), configPath)),
// TODO: Can we modify the config ourselves?
"\nSince you already have a Vitest config file, it is recommended to copy the contents of the new file ",
"into your existing config located at ",
c.bold(relative(process.cwd(), rootConfig))
);
} else {
const configPath = resolve(process.cwd(), `vitest.config.${lang}`);
await generateFrameworkConfigFile({
configPath,
framework,
frameworkPlugin,
provider,
browsers
});
log(c.green("✔"), "Created a config file for browser tests:", c.bold(relative(process.cwd(), configPath)));
}
log();
await updatePkgJsonScripts(pkgJsonPath, scriptCommand);
if (installPlaywright) {
log();
const [command, ...args] = getPlaywrightRunArgs(pkgManager);
const allArgs = [
...args,
"playwright",
"install",
"--with-deps"
];
log(c.cyan("◼"), `Installing Playwright dependencies with \`${c.bold(command)} ${c.bold(allArgs.join(" "))}\`...`);
log();
await x(command, allArgs, { nodeOptions: { stdio: [
"pipe",
"inherit",
"inherit"
] } });
}
log();
const exampleTestFile = await generateExampleFiles(framework, lang);
log(c.green("✔"), "Created example test file in", c.bold(relative(process.cwd(), exampleTestFile)));
log(c.dim(" You can safely delete this file once you have written your own tests."));
log();
log(c.cyan("◼"), "All done! Run your tests with", c.bold(getRunScript(pkgManager)));
}
export { create };
@@ -0,0 +1 @@
{"version":3,"names":["_t","require","_index","isArrayTypeAnnotation","isBinaryExpression","isCallExpression","isForOfStatement","isIndexedAccessType","isMemberExpression","isObjectPattern","isOptionalMemberExpression","isYieldExpression","isStatement","PRECEDENCE","Map","getBinaryPrecedence","node","nodeType","get","operator","isTSTypeExpression","isClassExtendsClause","parent","parentType","type","superClass","hasPostfixPart","object","callee","tag","NullableTypeAnnotation","FunctionTypeAnnotation","tokenContext","Boolean","TokenContext","arrowFlowReturnType","UpdateExpression","needsParenBeforeExpressionBrace","expressionStatement","arrowBody","ObjectExpression","DoExpression","async","Binary","left","parentPos","nodePos","right","UnionTypeAnnotation","OptionalIndexedAccessType","objectType","TSAsExpression","TSConditionalType","types","checkType","extendsType","TSUnionType","TSIntersectionType","TSInferType","typeParameter","constraint","TSTypeOperator","TSInstantiationExpression","typeParameters","TSFunctionType","BinaryExpression","forInOrInitHeadAccumulate","SequenceExpression","property","YieldExpression","test","ClassExpression","exportDefault","UnaryLike","FunctionExpression","ConditionalExpression","OptionalMemberExpression","AssignmentExpression","LogicalExpression","Identifier","getRawIdentifier","_node$extra","extra","parenthesized","rightType","id","name","isFollowedByBracket","computed","optional","forInitHead","forInHead","forOfHead","await"],"sources":["../../src/node/parentheses.ts"],"sourcesContent":["import {\n isArrayTypeAnnotation,\n isBinaryExpression,\n isCallExpression,\n isForOfStatement,\n isIndexedAccessType,\n isMemberExpression,\n isObjectPattern,\n isOptionalMemberExpression,\n isYieldExpression,\n isStatement,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\n\nimport { TokenContext } from \"./index.ts\";\n\nconst PRECEDENCE = new Map([\n [\"||\", 0],\n [\"??\", 0],\n [\"|>\", 0],\n [\"&&\", 1],\n [\"|\", 2],\n [\"^\", 3],\n [\"&\", 4],\n [\"==\", 5],\n [\"===\", 5],\n [\"!=\", 5],\n [\"!==\", 5],\n [\"<\", 6],\n [\">\", 6],\n [\"<=\", 6],\n [\">=\", 6],\n [\"in\", 6],\n [\"instanceof\", 6],\n [\">>\", 7],\n [\"<<\", 7],\n [\">>>\", 7],\n [\"+\", 8],\n [\"-\", 8],\n [\"*\", 9],\n [\"/\", 9],\n [\"%\", 9],\n [\"**\", 10],\n]);\n\nfunction getBinaryPrecedence(\n node: t.Binary | t.TSAsExpression | t.TSSatisfiesExpression,\n nodeType: string,\n): number;\nfunction getBinaryPrecedence(\n node: t.Node,\n nodeType: string,\n): number | undefined;\nfunction getBinaryPrecedence(node: t.Node, nodeType: string) {\n if (nodeType === \"BinaryExpression\" || nodeType === \"LogicalExpression\") {\n return PRECEDENCE.get((node as t.Binary).operator);\n }\n if (nodeType === \"TSAsExpression\" || nodeType === \"TSSatisfiesExpression\") {\n return PRECEDENCE.get(\"in\");\n }\n}\n\nfunction isTSTypeExpression(nodeType: string) {\n return (\n nodeType === \"TSAsExpression\" ||\n nodeType === \"TSSatisfiesExpression\" ||\n nodeType === \"TSTypeAssertion\"\n );\n}\n\nconst isClassExtendsClause = (\n node: t.Node,\n parent: t.Node,\n): parent is t.Class => {\n const parentType = parent.type;\n return (\n (parentType === \"ClassDeclaration\" || parentType === \"ClassExpression\") &&\n parent.superClass === node\n );\n};\n\nconst hasPostfixPart = (node: t.Node, parent: t.Node) => {\n const parentType = parent.type;\n return (\n ((parentType === \"MemberExpression\" ||\n parentType === \"OptionalMemberExpression\") &&\n parent.object === node) ||\n ((parentType === \"CallExpression\" ||\n parentType === \"OptionalCallExpression\" ||\n parentType === \"NewExpression\") &&\n parent.callee === node) ||\n (parentType === \"TaggedTemplateExpression\" && parent.tag === node) ||\n parentType === \"TSNonNullExpression\"\n );\n};\n\nexport function NullableTypeAnnotation(\n node: t.NullableTypeAnnotation,\n parent: t.Node,\n): boolean {\n return isArrayTypeAnnotation(parent);\n}\n\nexport function FunctionTypeAnnotation(\n node: t.FunctionTypeAnnotation,\n parent: t.Node,\n tokenContext: number,\n): boolean {\n const parentType = parent.type;\n return (\n // (() => A) | (() => B)\n parentType === \"UnionTypeAnnotation\" ||\n // (() => A) & (() => B)\n parentType === \"IntersectionTypeAnnotation\" ||\n // (() => A)[]\n parentType === \"ArrayTypeAnnotation\" ||\n Boolean(tokenContext & TokenContext.arrowFlowReturnType)\n );\n}\n\nexport function UpdateExpression(\n node: t.UpdateExpression,\n parent: t.Node,\n): boolean {\n return hasPostfixPart(node, parent) || isClassExtendsClause(node, parent);\n}\n\nfunction needsParenBeforeExpressionBrace(tokenContext: number) {\n return Boolean(\n tokenContext & (TokenContext.expressionStatement | TokenContext.arrowBody),\n );\n}\n\nexport function ObjectExpression(\n node: t.ObjectExpression,\n parentLine truncated
@@ -0,0 +1,9 @@
export default (function (o, c, d) {
var proto = c.prototype;
proto.isToday = function () {
var comparisonTemplate = 'YYYY-MM-DD';
var now = d();
return this.format(comparisonTemplate) === now.format(comparisonTemplate);
};
});
@@ -0,0 +1,113 @@
#include <windows.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
static HANDLE getConout() {
HANDLE conout = GetStdHandle(STD_OUTPUT_HANDLE);
if (conout == INVALID_HANDLE_VALUE) {
fprintf(stderr, "error: cannot get stdout\n");
exit(1);
}
return conout;
}
static DWORD getConsoleMode() {
DWORD mode = 0;
if (!GetConsoleMode(getConout(), &mode)) {
fprintf(stderr, "error: GetConsoleMode failed (is stdout a console?)\n");
exit(1);
}
return mode;
}
static void setConsoleMode(DWORD mode) {
if (!SetConsoleMode(getConout(), mode)) {
fprintf(stderr, "error: SetConsoleMode failed (is stdout a console?)\n");
exit(1);
}
}
static long parseInt(const std::string &s) {
errno = 0;
char *endptr = nullptr;
long result = strtol(s.c_str(), &endptr, 0);
if (errno != 0 || !endptr || *endptr != '\0') {
fprintf(stderr, "error: could not parse integral argument '%s'\n", s.c_str());
exit(1);
}
return result;
}
static void usage() {
printf("Usage: ConoutMode [verb] [options]\n");
printf("Verbs:\n");
printf(" [info] Dumps info about mode flags.\n");
printf(" get Prints the mode DWORD.\n");
printf(" set VALUE Sets the mode to VALUE, which can be decimal, hex, or octal.\n");
printf(" set VALUE MASK\n");
printf(" Same as `set VALUE`, but only alters the bits in MASK.\n");
exit(1);
}
struct {
const char *name;
DWORD value;
} kOutputFlags[] = {
"ENABLE_PROCESSED_OUTPUT", ENABLE_PROCESSED_OUTPUT, // 0x0001
"ENABLE_WRAP_AT_EOL_OUTPUT", ENABLE_WRAP_AT_EOL_OUTPUT, // 0x0002
"ENABLE_VIRTUAL_TERMINAL_PROCESSING", 0x0004/*ENABLE_VIRTUAL_TERMINAL_PROCESSING*/, // 0x0004
"DISABLE_NEWLINE_AUTO_RETURN", 0x0008/*DISABLE_NEWLINE_AUTO_RETURN*/, // 0x0008
"ENABLE_LVB_GRID_WORLDWIDE", 0x0010/*ENABLE_LVB_GRID_WORLDWIDE*/, //0x0010
};
int main(int argc, char *argv[]) {
std::vector<std::string> args;
for (size_t i = 1; i < argc; ++i) {
args.push_back(argv[i]);
}
if (args.empty() || args.size() == 1 && args[0] == "info") {
DWORD mode = getConsoleMode();
printf("mode: 0x%lx\n", mode);
for (const auto &flag : kOutputFlags) {
printf("%-34s 0x%04lx %s\n", flag.name, flag.value, flag.value & mode ? "ON" : "off");
mode &= ~flag.value;
}
for (int i = 0; i < 32; ++i) {
if (mode & (1u << i)) {
printf("Unrecognized flag: %04x\n", (1u << i));
}
}
return 0;
}
const auto verb = args[0];
if (verb == "set") {
if (args.size() == 2) {
const DWORD newMode = parseInt(args[1]);
setConsoleMode(newMode);
} else if (args.size() == 3) {
const DWORD mode = parseInt(args[1]);
const DWORD mask = parseInt(args[2]);
const int newMode = (getConsoleMode() & ~mask) | (mode & mask);
setConsoleMode(newMode);
} else {
usage();
}
} else if (verb == "get") {
if (args.size() != 1) {
usage();
}
printf("0x%lx\n", getConsoleMode());
} else {
usage();
}
return 0;
}
@@ -0,0 +1,73 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var buttonRole = {
abstract: false,
accessibleNameRequired: true,
baseConcepts: [],
childrenPresentational: true,
nameFrom: ['author', 'contents'],
prohibitedProps: [],
props: {
'aria-disabled': null,
'aria-expanded': null,
'aria-haspopup': null,
'aria-pressed': null
},
relatedConcepts: [{
concept: {
attributes: [{
name: 'type',
value: 'button'
}],
name: 'input'
},
module: 'HTML'
}, {
concept: {
attributes: [{
name: 'type',
value: 'image'
}],
name: 'input'
},
module: 'HTML'
}, {
concept: {
attributes: [{
name: 'type',
value: 'reset'
}],
name: 'input'
},
module: 'HTML'
}, {
concept: {
attributes: [{
name: 'type',
value: 'submit'
}],
name: 'input'
},
module: 'HTML'
}, {
concept: {
name: 'button'
},
module: 'HTML'
}, {
concept: {
name: 'trigger'
},
module: 'XForms'
}],
requireContextRole: [],
requiredContextRole: [],
requiredOwnedElements: [],
requiredProps: {},
superClass: [['roletype', 'widget', 'command']]
};
var _default = exports.default = buttonRole;
@@ -0,0 +1,35 @@
/**
* @fileoverview Defining the hashing function in one place.
* @author Michael Ficarra
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const murmur = require("imurmurhash");
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Private
//------------------------------------------------------------------------------
/**
* hash the given string
* @param {string} str the string to hash
* @returns {string} the hash
*/
function hash(str) {
return murmur(str).result().toString(36);
}
//------------------------------------------------------------------------------
// Public Interface
//------------------------------------------------------------------------------
module.exports = hash;
@@ -0,0 +1,18 @@
var isKeyable = require('./_isKeyable');
/**
* Gets the data for `map`.
*
* @private
* @param {Object} map The map to query.
* @param {string} key The reference key.
* @returns {*} Returns the map data.
*/
function getMapData(map, key) {
var data = map.__data__;
return isKeyable(key)
? data[typeof key == 'string' ? 'string' : 'hash']
: data.map;
}
module.exports = getMapData;
@@ -0,0 +1 @@
{"name":"mdast-util-from-markdown","version":"2.0.2","requiresBuild":false,"files":{"license":{"checkedAt":1794532112631,"integrity":"sha512-ic4iF2Ap25Sn5T9MMw7nJ9C20WL6V01rybBBQi2Qx8cQC9/ERFEqGnove1HT65tK2TIKM30PZoOV3Qbz2FE//A==","mode":420,"size":1094},"dev/index.js":{"checkedAt":1794532112785,"integrity":"sha512-3SY6S8+x7u1k500mOXQSFvqig5Kx79rLLDpgGIbXZwh+j037fUk6wAjeqk1uteKgwraK4G6yhk1EbBMhk0P+8g==","mode":420,"size":87},"dev/lib/index.js":{"checkedAt":1794532112785,"integrity":"sha512-yjo4WuLoiyU+TZ3BvvIJRkqXOW14CVRQzZQs4nRzzXm+CP/xaGMfQofB5lbZcV4mwiTCvpjYbYOGgp+6RN6O1Q==","mode":420,"size":33455},"index.js":{"checkedAt":1794532112785,"integrity":"sha512-AMn1A17M5r+9GkDA2c421t/5ncC67j4FFga0VwOIeNOTAvVEuCLiHOheLYNixrpRyb/T9dxkAKccxt09hgWMsg==","mode":420,"size":89},"lib/index.js":{"checkedAt":1794532112786,"integrity":"sha512-qd5vUbUF1MaUTz2dKb/l1Sp3NhTxRH+dserF9X8lAtJXlRHxy352IGrW+j+98WWZK6CFAXayhur+AcsUzhPKXw==","mode":420,"size":29010},"dev/lib/types.js":{"checkedAt":1794532112786,"integrity":"sha512-AREUpaJBQ8F4uI9Wq+XMPOmfz5e0sNo/eghb/fJC3es3c2rbyzQu0QbWvU0K4euNy/LyApeEIA5cLc3JWDC7IA==","mode":420,"size":52},"lib/types.js":{"checkedAt":1794532112786,"integrity":"sha512-wYjJ3zA8ssV8R/S4xZAS5PeGJjKWuaIVHKPkY4Rc14lU4iOp9pCxda8D6p0PI8EcPG7bg52CzJ4hSA+Jy5rdGA==","mode":420,"size":52},"package.json":{"checkedAt":1794532112786,"integrity":"sha512-5+be8fvrTxpQPGdOhHzPbThvwgw/lT7OnABevPw+jc+8vhAqgKOmKAtBq5iSVJ3rl3N/PeJE/doNZClg9B7cag==","mode":420,"size":3676},"dev/lib/index.d.ts.map":{"checkedAt":1794532112786,"integrity":"sha512-VT/zWnOUqbB6DknurEe0vlyAkxZNf2V0v/KFdouyWHgfgeDU8yuDCtsU9GNIuaCqduZZPCzb4cpjhL1jNGELQA==","mode":420,"size":350},"readme.md":{"checkedAt":1794532112786,"integrity":"sha512-ThxDzvHbgyxb+s1h330rQZi0OHTKtKAeJ/XY1bi9VdyIrVHWbcM8awyrZdr+aTIpgp4TjeM7cxHsCIdqs8SiBw==","mode":420,"size":14626},"dev/index.d.ts":{"checkedAt":1794532112787,"integrity":"sha512-rjhqOIqdhakYWOA3sY1CRFQH2sfiKaUw25cTIYUcYmnLpsU41uBmtZJimzr3uiJD7VSSBsncOEUi8Yny5ldv8w==","mode":420,"size":414},"dev/lib/index.d.ts":{"checkedAt":1794532112787,"integrity":"sha512-mA7DsNxLJPOpoHNxZALRn4Nv5p4GwEWzYsQkfD7So0rPOML/k2K60jWCP2e43ToK/dVCofTftxpggCWy4XDdtQ==","mode":420,"size":1600},"index.d.ts":{"checkedAt":1794532112787,"integrity":"sha512-rjhqOIqdhakYWOA3sY1CRFQH2sfiKaUw25cTIYUcYmnLpsU41uBmtZJimzr3uiJD7VSSBsncOEUi8Yny5ldv8w==","mode":420,"size":414},"lib/index.d.ts":{"checkedAt":1794532112787,"integrity":"sha512-mA7DsNxLJPOpoHNxZALRn4Nv5p4GwEWzYsQkfD7So0rPOML/k2K60jWCP2e43ToK/dVCofTftxpggCWy4XDdtQ==","mode":420,"size":1600},"dev/lib/types.d.ts":{"checkedAt":1794532112787,"integrity":"sha512-y/NeOgIyVjJycgRJq3lxRN3ji5D7bhq26X3IHX16LQ2bRagLZTFqe9dvRo7gM0oC0emztNLd2CKQN5HugjaPiA==","mode":420,"size":5646},"lib/types.d.ts":{"checkedAt":1794532112787,"integrity":"sha512-YFoZmZ0kwV0O9+Wddyq9SDCqOlwPz0rBcYip5mjMz/O+F+OrNQc/XX9XwdQ7iaIkrTqiY/kj5ZvDjQL9ny1jjw==","mode":420,"size":5663}}}
@@ -0,0 +1,23 @@
'use strict';
var $SyntaxError = require('es-errors/syntax');
var $TypeError = require('es-errors/type');
var whichTypedArray = require('which-typed-array');
// https://262.ecma-international.org/13.0/#sec-typedarrayelementtype
var tableTAO = require('./tables/typed-array-objects');
module.exports = function TypedArrayElementType(O) {
var type = whichTypedArray(O);
if (!type) {
throw new $TypeError('Assertion failed: `O` must be a TypedArray');
}
var result = tableTAO.name['$' + type];
if (typeof result !== 'string') {
throw new $SyntaxError('Assertion failed: Unknown TypedArray type `' + type + '`');
}
return result;
};
@@ -0,0 +1,51 @@
var replaceExt = require('../');
var path = require('path');
var should = require('should');
require('mocha');
describe('replace-ext', function() {
it('should return a valid replaced extension on nested', function(done) {
var fname = path.join(__dirname, './fixtures/test.coffee');
var expected = path.join(__dirname, './fixtures/test.js');
var nu = replaceExt(fname, '.js');
should.exist(nu);
nu.should.equal(expected);
done();
});
it('should return a valid replaced extension on flat', function(done) {
var fname = 'test.coffee';
var expected = 'test.js';
var nu = replaceExt(fname, '.js');
should.exist(nu);
nu.should.equal(expected);
done();
});
it('should not return a valid replaced extension on empty string', function(done) {
var fname = '';
var expected = '';
var nu = replaceExt(fname, '.js');
should.exist(nu);
nu.should.equal(expected);
done();
});
it('should return a valid removed extension on nested', function(done) {
var fname = path.join(__dirname, './fixtures/test.coffee');
var expected = path.join(__dirname, './fixtures/test');
var nu = replaceExt(fname, '');
should.exist(nu);
nu.should.equal(expected);
done();
});
it('should return a valid added extension on nested', function(done) {
var fname = path.join(__dirname, './fixtures/test');
var expected = path.join(__dirname, './fixtures/test.js');
var nu = replaceExt(fname, '.js');
should.exist(nu);
nu.should.equal(expected);
done();
});
});
@@ -0,0 +1 @@
{"name":"@heroui/system-rsc","version":"2.3.20","requiresBuild":false,"files":{"dist/extend-variants.d.js":{"checkedAt":1794532104303,"integrity":"sha512-K2sXY0yWAEwUcHP1dU91YJGf6bC51REh80tm+p/1QuL+OQpFo7HR2GIcUnZV1X/B0D8KIFYUWMbJEsLOz3kaQQ==","mode":420,"size":794},"dist/extend-variants.js":{"checkedAt":1794532104303,"integrity":"sha512-viE0FLYXgD+60IWWPzuf72IBT0uz2xBwsRmYK56Sn9VLSK0jhe4ZLWcuoEJdkiOtM+W9IAkKeUokUnJRhRN1/g==","mode":420,"size":5915},"dist/index.js":{"checkedAt":1794532104304,"integrity":"sha512-ZXi7Fr5xrxzf5X47552V+18Lpn1dV7eTlqtGvT5fxE1KO7ljq/PBsCYxEkvyW8t2EE5nZVZfoHvDfI3Z+khFWw==","mode":420,"size":7346},"dist/types.js":{"checkedAt":1794532104219,"integrity":"sha512-8ZHIMK4jVYYYFAE1LKlMFLkH3OdiGCxIlPyXfSOSQg+SGMAbq4Za129jk2NccphNT9fw9FFO7bYtMS/Y2h38mw==","mode":420,"size":758},"dist/utils.js":{"checkedAt":1794532104304,"integrity":"sha512-j2PfPP+GbcuuhgR3aJ8rt8Yr1GEQ7y3n9o5R7isnNMioGCUSfRNs0wDe+mDW4+rQIUndJJ2Oe3Ep/LV28Kn2uA==","mode":420,"size":3052},"package.json":{"checkedAt":1794532104304,"integrity":"sha512-23aNl/Ig5tCM+q6ColnS3g6kAtfsolr/uwR/uJLGvir7tgmgUadwjIqAYmUj1/awbhrOzips8H075yn4BYXuMg==","mode":420,"size":1392},"README.md":{"checkedAt":1794532104304,"integrity":"sha512-pwdrgc9v5TE8FeLTv2qYRVcjzkf5lpWz+Yk86MlkMNbHfQbACjsNyCcRcLXS1Kh3y9j96A+q25ur1/VbWOtQPQ==","mode":420,"size":485},"dist/chunk-YFAKJTDR.mjs":{"checkedAt":1794532104304,"integrity":"sha512-poBGDNmQHPXVyPRNzKfvyievJ3bZ6bZUOMcd5EbXvNkr139qpSotTME7tB6A59EKfRW/K/KGD1nPa+nGcl8KvQ==","mode":420,"size":1874},"dist/chunk-Z7BOKSG7.mjs":{"checkedAt":1794532104304,"integrity":"sha512-ojpzGBN0kxnNUvPeMY7TjTlL+qQPmKuzeqVJFKsMRMvQndo3xjMZZHXlcZXYEiqFOTZ2MrWtfoImrhaQRkCY+g==","mode":420,"size":3618},"dist/extend-variants.d.mjs":{"checkedAt":1794532104304,"integrity":"sha512-z4PhNX7vuL3xVChQ1m2AB9Yg5AULVxXcg/SpIdNs6c5H0NE8XYXysP+DGNKHfuwvY7kxvUdBeoGlODJ6+SfaPg==","mode":420,"size":0},"dist/extend-variants.mjs":{"checkedAt":1794532104304,"integrity":"sha512-gTz4pQ1sEaLkdoONqBX6jfXD2azY+acCLaI52JfhyWBwavlbMx9U/k8lHgcKjGU7mOqHRxLa6VaeqzShKeXFzw==","mode":420,"size":117},"dist/index.mjs":{"checkedAt":1794532104305,"integrity":"sha512-jPt5zwANbzdB86+gLotiLlkC/sgc1I43HmaT6DrSVGCYVE19D/TRdIi7b/F4UFbIZJKi8grfvf56E/70OUI7NQ==","mode":420,"size":309},"dist/types.mjs":{"checkedAt":1794532104305,"integrity":"sha512-z4PhNX7vuL3xVChQ1m2AB9Yg5AULVxXcg/SpIdNs6c5H0NE8XYXysP+DGNKHfuwvY7kxvUdBeoGlODJ6+SfaPg==","mode":420,"size":0},"dist/utils.mjs":{"checkedAt":1794532104305,"integrity":"sha512-ZAOIS22GZOpqt+O9Oj42LIQOiX7NEeoHABIHislAj0JTofNnbL7hObcltHs0bRcWsUSH0hZ21QTCDgYzPySj5A==","mode":420,"size":234},"dist/extend-variants.d.d.mts":{"checkedAt":1794532104305,"integrity":"sha512-V+8tqvqEBKEzZOBnjoxbGZQyvXzMxgyo5La5dX+LjMi78TiCloKrbDmMDqasCf2Yal/iCzLU3wPtAmugt/KRaA==","mode":420,"size":3460},"dist/extend-variants.d.mts":{"checkedAt":1794532104305,"integrity":"sha512-V+8tqvqEBKEzZOBnjoxbGZQyvXzMxgyo5La5dX+LjMi78TiCloKrbDmMDqasCf2Yal/iCzLU3wPtAmugt/KRaA==","mode":420,"size":3460},"dist/index.d.mts":{"checkedAt":1794532104305,"integrity":"sha512-ichBfrww6x4GqDf//UbCrrXakBE6+PUZ6PVILPeZ2iAK+d/cLr0kRd/k2w3bOlFhw4jBW/XG5s/EM98rPjDF4A==","mode":420,"size":549},"dist/types.d.mts":{"checkedAt":1794532104305,"integrity":"sha512-qtTLyWtLbiWn8Ji4m3C7f2KEakDHcPrGWSSBaVN2pod4hE4Xhdf5iZhT+XSCK5HhbMnHi6D0IoyTtOzAkXBTbQ==","mode":420,"size":2572},"dist/utils.d.mts":{"checkedAt":1794532104305,"integrity":"sha512-YuSSDTxCsms+4xz2dIamKk1VrscqpHG/nVVpmJ8FsgekrCLBetZDTZYx2AtqWmIowN+o/ZAQN7zHDErO2ugT/A==","mode":420,"size":1257},"dist/extend-variants.d.d.ts":{"checkedAt":1794532104305,"integrity":"sha512-V+8tqvqEBKEzZOBnjoxbGZQyvXzMxgyo5La5dX+LjMi78TiCloKrbDmMDqasCf2Yal/iCzLU3wPtAmugt/KRaA==","mode":420,"size":3460},"dist/extend-variants.d.ts":{"checkedAt":1794532104305,"integrity":"sha512-V+8tqvqEBKEzZOBnjoxbGZQyvXzMxgyo5La5dX+LjMi78TiCloKrbDmMDqasCf2Yal/iCzLU3wPtAmugt/KRaA==","mode":420,"size":3460},"dist/index.d.ts":{"checkedAt":1794532104305,"integrity":"sha512-6+/DE6cM2y0cVdrrYFctjSc3GLPsrNqPRYE3AakYt5+CvdIXL4j/7WIRk/uhS/7ILi9wPxONJDDj7ocURw6biQ==","mode":420,"size":546},"dist/types.d.ts":{"checkedAt":1794532104305,"integrity":"sha512-qtTLyWtLbiWn8Ji4m3C7f2KEakDHcPrGWSSBaVN2pod4hE4Xhdf5iZhT+XSCK5HhbMnHi6D0IoyTtOzAkXBTbQ==","mode":420,"size":2572},"dist/utils.d.ts":{"checkedAt":1794532104306,"integrity":"sha512-ngdzGpW0F+lrqa/wxpzd+OSMhp2qNnMeVXixayu4UTVN++Mmeodpo330mDIkn0Iqe/4Y59UP9Or2ouYm2MV8UA==","mode":420,"size":1256},"LICENSE":{"checkedAt":1794532104306,"integrity":"sha512-fUY+MMF2uFI8CfCphWLCp6ty4uU9bKvcaTZFGiBK7qgOOULkpyNSGb2IIjBYgGT5iqdeUaZRGLbTggbAUEyPyQ==","mode":420,"size":1069}}}
@@ -0,0 +1,93 @@
let camelcase = require('camelcase-css')
let UNITLESS = {
boxFlex: true,
boxFlexGroup: true,
columnCount: true,
flex: true,
flexGrow: true,
flexPositive: true,
flexShrink: true,
flexNegative: true,
fontWeight: true,
lineClamp: true,
lineHeight: true,
opacity: true,
order: true,
orphans: true,
tabSize: true,
widows: true,
zIndex: true,
zoom: true,
fillOpacity: true,
strokeDashoffset: true,
strokeOpacity: true,
strokeWidth: true
}
function atRule(node) {
if (typeof node.nodes === 'undefined') {
return true
} else {
return process(node)
}
}
function process(node, options = {}) {
let name
let result = {}
let { stringifyImportant } = options;
node.each(child => {
if (child.type === 'atrule') {
name = '@' + child.name
if (child.params) name += ' ' + child.params
if (typeof result[name] === 'undefined') {
result[name] = atRule(child)
} else if (Array.isArray(result[name])) {
result[name].push(atRule(child))
} else {
result[name] = [result[name], atRule(child)]
}
} else if (child.type === 'rule') {
let body = process(child)
if (result[child.selector]) {
for (let i in body) {
let object = result[child.selector];
if (stringifyImportant && object[i] && object[i].endsWith('!important')) {
if (body[i].endsWith('!important')) {
object[i] = body[i]
}
} else {
object[i] = body[i]
}
}
} else {
result[child.selector] = body
}
} else if (child.type === 'decl') {
if (child.prop[0] === '-' && child.prop[1] === '-') {
name = child.prop
} else if (child.parent && child.parent.selector === ':export') {
name = child.prop
} else {
name = camelcase(child.prop)
}
let value = child.value
if (!isNaN(child.value) && UNITLESS[name]) {
value = parseFloat(child.value)
}
if (child.important) value += ' !important'
if (typeof result[name] === 'undefined') {
result[name] = value
} else if (Array.isArray(result[name])) {
result[name].push(value)
} else {
result[name] = [result[name], value]
}
}
})
return result
}
module.exports = process
@@ -0,0 +1 @@
{"mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;AA4CM,SAAS,0CAAY,KAAqB,EAAE,KAAuC,EAAE,GAAkC;IAC5H,IAAI,oBACF,gBAAgB,iBAChB,aAAa,kBACb,cAAc,UACd,MAAM,EACP,GAAG;IAEJ,0HAA0H;IAC1H,qFAAqF;IACrF,IAAI,WAAW,CAAA,GAAA,kBAAU,EAAE;QAAC,OAAO;QAAU,aAAa;IAAM;IAChE,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,gBAAQ;IAC1B,IAAI,mBAAmB,MAAM,gBAAgB,CAAC,gBAAgB;IAC9D,IAAI,WAAW,CAAA,GAAA,cAAM,EAAE,IAAM,oBAAoB,IAAI,CAAA,GAAA,yCAAoB,EAAE;YACzE,YAAY,MAAM,UAAU;YAC5B,cAAc,MAAM,YAAY;8BAChC;iBACA;uBACA;sBACA;4BACA;oBACA;QACF,IAAI;QAAC;QAAkB,MAAM,UAAU;QAAE,MAAM,YAAY;QAAE;QAAkB;QAAK;QAAW;QAAU;QAAgB;KAAO;IAChI,IAAI,KAAK,CAAA,GAAA,YAAI,EAAE,MAAM,EAAE;IACvB,CAAA,GAAA,yCAAM,EAAE,GAAG,CAAC,OAAO;IAEnB,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,cAAM,EAAE;QACxB,GAAG,KAAK;YACR;QACA,kBAAkB;IACpB,GAAG,OAAO;IAEV,kCAAkC;IAClC,IAAI,eACF,SAAS,CAAC,gBAAgB,GAAG,MAAM,UAAU,CAAC,IAAI,GAAG,MAAM,UAAU,CAAC,UAAU,CAAC,MAAM;IAGzF,IAAI,CAAA,GAAA,sBAAc,OAAO,kBAAkB,OACzC,UAAU,IAAI,GAAG;IAGnB,IAAI,UAAC,MAAM,EAAE,WAAW,aAAa,EAAC,GAAG,MAAM,cAAc,IAAI,CAAC;IAClE,IAAI,kBAAkB,CAAA,GAAA,kCAA0B,EAAE,CAAA,GAAA,oDAAW,GAAG;IAChE,IAAI,kBAAkB,CAAA,GAAA,cAAM,EAAE;YACX;YAAA;QAAjB,IAAI,aAAa,CAAA,4CAAA,iCAAA,MAAM,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA,IAAK,EAAE,GAAG,KAAK,qBAA7C,qDAAA,+BAAsD,SAAS,cAA/D,sDAAA,2CAAmE;QACpF,OAAO,iBAAiB,SAAS,gBAAgB,MAAM,CAAC,GAAG,cAAc,IAAI,CAAC,EAAE;wBAAC;QAAU,KAAK;IAClG,uDAAuD;IACvD,GAAG;QAAC;QAAe;QAAQ,MAAM,UAAU,CAAC,OAAO;KAAC;IAEpD,IAAI,mBAAmB,CAAA,GAAA,qBAAa,EAAE;IAEtC,uGAAuG;IACvG,CAAA,GAAA,sBAAc,EAAE;QACd,IAAI,iBACF,CAAA,GAAA,eAAO,EAAE,iBAAiB,aAAa;IAE3C,GAAG;QAAC;KAAgB;IAEpB,OAAO;QACL,WAAW,CAAA,GAAA,iBAAS,EAClB,WACA,kBACA;YACE,qDAAqD;YACrD,oBAAoB;gBAAC,gBAAgB,CAAC,mBAAmB;gBAAE,SAAS,CAAC,mBAAmB;aAAC,CAAC,MAAM,CAAC,SAAS,IAAI,CAAC;QACjH;IAEJ;AACF","sources":["packages/@react-aria/table/src/useTable.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 {announce} from '@react-aria/live-announcer';\nimport {GridAria, GridProps, useGrid} from '@react-aria/grid';\nimport {gridIds} from './utils';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {Key, LayoutDelegate, Rect, RefObject, Size} from '@react-types/shared';\nimport {mergeProps, useDescription, useId, useUpdateEffect} from '@react-aria/utils';\nimport {TableKeyboardDelegate} from './TableKeyboardDelegate';\nimport {tableNestedRows} from '@react-stately/flags';\nimport {TableState, TreeGridState} from '@react-stately/table';\nimport {useCollator, useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useMemo} from 'react';\n\nexport interface AriaTableProps extends GridProps {\n /** The layout object for the table. Computes what content is visible and how to position and style them. */\n layoutDelegate?: LayoutDelegate,\n /** @deprecated - Use layoutDelegate instead. */\n layout?: DeprecatedLayout\n}\n\ninterface DeprecatedLayout {\n getLayoutInfo(key: Key): DeprecatedLayoutInfo,\n getContentSize(): Size,\n virtualizer: DeprecatedVirtualizer\n}\n\ninterface DeprecatedLayoutInfo {\n rect: Rect\n}\n\ninterface DeprecatedVirtualizer {\n visibleRect: Rect\n}\n\n/**\n * Provides the behavior and accessibility implementation for a table component.\n * A table displays data in rows and columns and enables a user to navigate its contents via directional navigation keys,\n * and optionally supports row selection and sorting.\n * @param props - Props for the table.\n * @param state - State for the table, as returned by `useTableState`.\n * @param ref - The ref attached to the table element.\n */\nexport function useTable<T>(props: AriaTableProps, state: TableState<T> | TreeGridState<T>, ref: RefObject<HTMLElement | null>): GridAria {\n let {\n keyboardDelegate,\n isVirtualized,\n layoutDelegate,\n layout\n } = props;\n\n // By default, a KeyboardDelegate is provided which uses the DOM to query layout information (e.g. for page up/page down).\n // When virtualized, the layout object will be passed in as a prop and override this.\n let collator = useCollator({usage: 'search', sensitivity: 'base'});\n let {direction} = useLocale();\n let disabledBehavior = state.selectionManager.disabledBehavior;\n let delegate = useMemo(() => keyboardDelegate || new TableKeyboardDelegate({\n collection: state.collection,\n disabledKeys: state.disabledKeys,\n disabledBehavior,\n ref,\n direction,\n collator,\n layoutDelegate,\n layout\n }), [keyboardDLine truncated
@@ -0,0 +1,143 @@
export function moduleVisitor(visitor, options) {
const ignore = options?.ignore;
const amd = !!options?.amd;
const commonjs = !!options?.commonjs;
const esmodule = !!{ esmodule: true, ...options }.esmodule;
const ignoreRegExps = ignore == null ? [] : ignore.map(p => new RegExp(p));
function checkSourceValue(source, importer) {
if (source == null) {
return;
}
if (ignoreRegExps.some(re => re.test(String(source.value)))) {
return;
}
visitor(source, importer);
}
function checkSource(node) {
checkSourceValue(node.source, node);
}
function checkImportCall(node) {
let modulePath;
if (node.type === 'ImportExpression') {
modulePath = node.source;
}
else if (node.type === 'CallExpression') {
if (node.callee.type !== 'Import') {
return;
}
if (node.arguments.length !== 1) {
return;
}
modulePath = node.arguments[0];
}
else {
throw new TypeError('this should be unreachable');
}
if (modulePath.type !== 'Literal') {
return;
}
if (typeof modulePath.value !== 'string') {
return;
}
checkSourceValue(modulePath, node);
}
function checkCommon(call) {
if (call.callee.type !== 'Identifier') {
return;
}
if (call.callee.name !== 'require') {
return;
}
if (call.arguments.length !== 1) {
return;
}
const modulePath = call.arguments[0];
if (modulePath.type !== 'Literal') {
return;
}
if (typeof modulePath.value !== 'string') {
return;
}
checkSourceValue(modulePath, call);
}
function checkAMD(call) {
if (call.callee.type !== 'Identifier') {
return;
}
if (call.callee.name !== 'require' && call.callee.name !== 'define') {
return;
}
if (call.arguments.length !== 2) {
return;
}
const modules = call.arguments[0];
if (modules.type !== 'ArrayExpression') {
return;
}
for (const element of modules.elements) {
if (!element) {
continue;
}
if (element.type !== 'Literal') {
continue;
}
if (typeof element.value !== 'string') {
continue;
}
if (element.value === 'require' || element.value === 'exports') {
continue;
}
checkSourceValue(element, element);
}
}
const visitors = {};
if (esmodule) {
Object.assign(visitors, {
ImportDeclaration: checkSource,
ExportNamedDeclaration: checkSource,
ExportAllDeclaration: checkSource,
CallExpression: checkImportCall,
ImportExpression: checkImportCall,
});
}
if (commonjs || amd) {
const currentCallExpression = visitors.CallExpression;
visitors.CallExpression = function (call) {
if (currentCallExpression) {
currentCallExpression(call);
}
if (commonjs) {
checkCommon(call);
}
if (amd) {
checkAMD(call);
}
};
}
return visitors;
}
export function makeOptionsSchema(additionalProperties) {
const base = {
type: 'object',
properties: {
commonjs: { type: 'boolean' },
amd: { type: 'boolean' },
esmodule: { type: 'boolean' },
ignore: {
type: 'array',
minItems: 1,
items: { type: 'string' },
uniqueItems: true,
},
},
additionalProperties: false,
};
if (additionalProperties) {
for (const key in additionalProperties) {
base.properties[key] = additionalProperties[key];
}
}
return base;
}
export const optionsSchema = makeOptionsSchema();
//# sourceMappingURL=module-visitor.js.map
@@ -0,0 +1,249 @@
/**
* @fileoverview Rule to flag numbers that will lose significant figure precision at runtime
* @author Jacob Moore
*/
"use strict";
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
/** Class representing a number in scientific notation. */
class ScientificNotation {
/** @type {string} The digits of the coefficient. A decimal point is implied after the first digit. */
coefficient;
/** @type {number} The order of magnitude. */
magnitude;
constructor(coefficient, magnitude) {
this.coefficient = coefficient;
this.magnitude = magnitude;
}
/* c8 ignore start -- debug only */
toString() {
return `${this.coefficient[0]}${this.coefficient.length > 1 ? `.${this.coefficient.slice(1)}` : ""}e${this.magnitude}`;
}
/* c8 ignore stop */
}
/**
* Returns whether the node is number literal
* @param {Node} node the node literal being evaluated
* @returns {boolean} true if the node is a number literal
*/
function isNumber(node) {
return typeof node.value === "number";
}
/**
* Gets the source code of the given number literal. Removes `_` numeric separators from the result.
* @param {Node} node the number `Literal` node
* @returns {string} raw source code of the literal, without numeric separators
*/
function getRaw(node) {
return node.raw.replace(/_/gu, "");
}
/**
* Checks whether the number is base ten
* @param {ASTNode} node the node being evaluated
* @returns {boolean} true if the node is in base ten
*/
function isBaseTen(node) {
const prefixes = ["0x", "0X", "0b", "0B", "0o", "0O"];
return (
prefixes.every(prefix => !node.raw.startsWith(prefix)) &&
!/^0[0-7]+$/u.test(node.raw)
);
}
/**
* Checks that the user-intended non-base ten number equals the actual number after is has been converted to the Number type
* @param {Node} node the node being evaluated
* @returns {boolean} true if they do not match
*/
function notBaseTenLosesPrecision(node) {
const rawString = getRaw(node).toUpperCase();
let base;
if (rawString.startsWith("0B")) {
base = 2;
} else if (rawString.startsWith("0X")) {
base = 16;
} else {
base = 8;
}
return !rawString.endsWith(node.value.toString(base).toUpperCase());
}
/**
* Returns the number stripped of leading zeros
* @param {string} numberAsString the string representation of the number
* @returns {string} the stripped string
*/
function removeLeadingZeros(numberAsString) {
for (let i = 0; i < numberAsString.length; i++) {
if (numberAsString[i] !== "0") {
return numberAsString.slice(i);
}
}
return numberAsString;
}
/**
* Returns the number stripped of trailing zeros
* @param {string} numberAsString the string representation of the number
* @returns {string} the stripped string
*/
function removeTrailingZeros(numberAsString) {
for (let i = numberAsString.length - 1; i >= 0; i--) {
if (numberAsString[i] !== "0") {
return numberAsString.slice(0, i + 1);
}
}
return numberAsString;
}
/**
* Converts an integer to an object containing the integer's coefficient and order of magnitude
* @param {string} stringInteger the string representation of the integer being converted
* @returns {ScientificNotation} the object containing the integer's coefficient and order of magnitude
*/
function normalizeInteger(stringInteger) {
const trimmedInteger = removeLeadingZeros(stringInteger);
const significantDigits = removeTrailingZeros(trimmedInteger);
return new ScientificNotation(significantDigits, trimmedInteger.length - 1);
}
/**
* Converts a float to an object containing the float's coefficient and order of magnitude
* @param {string} stringFloat the string representation of the float being converted
* @returns {ScientificNotation} the object containing the float's coefficient and order of magnitude
*/
function normalizeFloat(stringFloat) {
const trimmedFloat = removeLeadingZeros(stringFloat);
const indexOfDecimalPoint = trimmedFloat.indexOf(".");
switch (indexOfDecimalPoint) {
case 0: {
const significantDigits = removeLeadingZeros(trimmedFloat.slice(1));
return new ScientificNotation(
significantDigits,
significantDigits.length - trimmedFloat.length,
);
}
case -1:
return new ScientificNotation(
trimmedFloat,
trimmedFloat.length - 1,
);
default:
return new ScientificNotation(
trimmedFloat.replace(".", ""),
indexOfDecimalPoint - 1,
);
}
}
/**
* Converts a base ten number to proper scientific notation
* @param {string} stringNumber the string representation of the base ten number to be converted
* @param {boolean} parseAsFloat if true, the coefficient will be always parsed as a float, regardless of whether a decimal point is present
* @returns {ScientificNotation} the object containing the number's coefficient and order of magnitude
*/
function convertNumberToScientificNotation(stringNumber, parseAsFloat) {
const splitNumber = stringNumber.split("e");
const originalCoefficient = splitNumber[0];
const normalizedNumber =
parseAsFloat || stringNumber.includes(".")
? normalizeFloat(originalCoefficient)
: normalizeInteger(originalCoefficient);
if (splitNumber.length > 1) {
normalizedNumber.magnitude += parseInt(splitNumber[1], 10);
}
return normalizedNumber;
}
/**
* Checks that the user-intended base ten number equals the actual number after is has been converted to the Number type
* @param {Node} node the node being evaluated
* @returns {boolean} true if they do not match
*/
function baseTenLosesPrecision(node) {
const rawNumber = getRaw(node).toLowerCase();
const normalizedRawNumber = convertNumberToScientificNotation(
rawNumber,
false,
);
const requestedPrecision = normalizedRawNumber.coefficient.length;
if (requestedPrecision > 100) {
return true;
}
const storedNumber = node.value.toPrecision(requestedPrecision);
const normalizedStoredNumber = convertNumberToScientificNotation(
storedNumber,
true,
);
return (
normalizedRawNumber.magnitude !== normalizedStoredNumber.magnitude ||
normalizedRawNumber.coefficient !== normalizedStoredNumber.coefficient
);
}
/**
* Checks that the user-intended number equals the actual number after is has been converted to the Number type
* @param {Node} node the node being evaluated
* @returns {boolean} true if they do not match
*/
function losesPrecision(node) {
return isBaseTen(node)
? baseTenLosesPrecision(node)
: notBaseTenLosesPrecision(node);
}
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
type: "problem",
dialects: ["typescript", "javascript"],
language: "javascript",
docs: {
description: "Disallow literal numbers that lose precision",
recommended: true,
url: "https://eslint.org/docs/latest/rules/no-loss-of-precision",
},
schema: [],
messages: {
noLossOfPrecision:
"This number literal will lose precision at runtime.",
},
},
create(context) {
return {
Literal(node) {
if (node.value && isNumber(node) && losesPrecision(node)) {
context.report({
messageId: "noLossOfPrecision",
node,
});
}
},
};
},
};
@@ -0,0 +1 @@
{"name":"send","version":"1.2.0","requiresBuild":false,"files":{"LICENSE":{"checkedAt":1794532089915,"integrity":"sha512-zKOQVOmyz+ewdtKPGad1r+BesOdkPIr4JxQ+L2qetZzGaNg90eczkJCMuANxQrgIYUEpLGRygh9Iyb7MTK0C3w==","mode":420,"size":1128},"index.js":{"checkedAt":1794532089915,"integrity":"sha512-wG2LUQYyh/jJU+lZOf/9jzE30MnzJC5dggvtoaFOJjMNYvjCFRbFGBrmndpDx6wYigiYnKES4WbO0YUM3U83hQ==","mode":420,"size":20341},"package.json":{"checkedAt":1794532089915,"integrity":"sha512-7JDnYLXE7uujY5C5x4Al4LdfONOzsTJi+F1qlIfnQ4qjglhbiD5Qi7LRR5ShyjVzTYhVajkQFo8wilcaC1GTEg==","mode":420,"size":1589},"HISTORY.md":{"checkedAt":1794532089915,"integrity":"sha512-VASPc60BCLJi+45WqDPqO4BJJhQJOIs6OVo4vMT9HkzF9GTEgmnb3Q/TMEO9D6zL4asx5nzWQXVLWTSmosqlpA==","mode":420,"size":14801},"README.md":{"checkedAt":1794532089916,"integrity":"sha512-9U/ZOwRBYw/FJwoD7DIK008CnepflIeb+PaI3OFnCRxgEo247yJEbRhC1ztZIDq4ksp+bOoqYWaDQbJrOVyTBg==","mode":420,"size":9062}}}
@@ -0,0 +1,47 @@
import {useControlledState as $69RjW$useControlledState} from "@react-stately/utils";
import {useMemo as $69RjW$useMemo} from "react";
/*
* Copyright 2024 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 $ad999b7f496648d1$export$8deac67f4addf270(props) {
let { selectionMode: selectionMode = 'single', disallowEmptySelection: disallowEmptySelection, isDisabled: isDisabled = false } = props;
let [selectedKeys, setSelectedKeys] = (0, $69RjW$useControlledState)((0, $69RjW$useMemo)(()=>props.selectedKeys ? new Set(props.selectedKeys) : undefined, [
props.selectedKeys
]), (0, $69RjW$useMemo)(()=>props.defaultSelectedKeys ? new Set(props.defaultSelectedKeys) : new Set(), [
props.defaultSelectedKeys
]), props.onSelectionChange);
return {
selectionMode: selectionMode,
isDisabled: isDisabled,
selectedKeys: selectedKeys,
setSelectedKeys: setSelectedKeys,
toggleKey (key) {
let keys;
if (selectionMode === 'multiple') {
keys = new Set(selectedKeys);
if (keys.has(key) && (!disallowEmptySelection || keys.size > 1)) keys.delete(key);
else keys.add(key);
} else keys = new Set(selectedKeys.has(key) && !disallowEmptySelection ? [] : [
key
]);
setSelectedKeys(keys);
},
setSelected (key, isSelected) {
if (isSelected !== selectedKeys.has(key)) this.toggleKey(key);
}
};
}
export {$ad999b7f496648d1$export$8deac67f4addf270 as useToggleGroupState};
//# sourceMappingURL=useToggleGroupState.module.js.map
@@ -0,0 +1,17 @@
export interface NodeIKernelAvatarService {
addAvatarListener(listener: unknown): void;
removeAvatarListener(listenerId: number): void;
getAvatarPath(arg1: unknown, arg2: unknown): unknown;
forceDownloadAvatar(uid: string, useCache: number): Promise<unknown>;
getGroupAvatarPath(arg1: unknown, arg2: unknown): unknown;
getConfGroupAvatarPath(arg: unknown): unknown;
forceDownloadGroupAvatar(arg1: unknown, arg2: unknown): unknown;
getGroupPortraitPath(arg1: unknown, arg2: unknown, arg3: unknown): unknown;
forceDownloadGroupPortrait(arg1: unknown, arg2: unknown, arg3: unknown): unknown;
getAvatarPaths(arg1: unknown, arg2: unknown): unknown;
getGroupAvatarPaths(arg1: unknown, arg2: unknown): unknown;
getConfGroupAvatarPaths(arg: unknown): unknown;
getAvatarPathByUin(arg1: unknown, arg2: unknown): unknown;
forceDownloadAvatarByUin(arg1: unknown, arg2: unknown): unknown;
isNull(): boolean;
}
@@ -0,0 +1,186 @@
// src/dom-props.ts
var DOMPropNames = /* @__PURE__ */ new Set([
"id",
"type",
"style",
"title",
"role",
"tabIndex",
"htmlFor",
"width",
"height",
"abbr",
"accept",
"acceptCharset",
"accessKey",
"action",
"allowFullScreen",
"allowTransparency",
"alt",
"async",
"autoComplete",
"autoFocus",
"autoPlay",
"cellPadding",
"cellSpacing",
"challenge",
"charset",
"checked",
"cite",
"class",
"className",
"cols",
"colSpan",
"command",
"content",
"contentEditable",
"contextMenu",
"controls",
"coords",
"crossOrigin",
"data",
"dateTime",
"default",
"defer",
"dir",
"disabled",
"download",
"draggable",
"dropzone",
"encType",
"enterKeyHint",
"for",
"form",
"formAction",
"formEncType",
"formMethod",
"formNoValidate",
"formTarget",
"frameBorder",
"headers",
"hidden",
"high",
"href",
"hrefLang",
"httpEquiv",
"icon",
"inputMode",
"isMap",
"itemId",
"itemProp",
"itemRef",
"itemScope",
"itemType",
"kind",
"label",
"lang",
"list",
"loop",
"manifest",
"max",
"maxLength",
"media",
"mediaGroup",
"method",
"min",
"minLength",
"multiple",
"muted",
"name",
"noValidate",
"open",
"optimum",
"pattern",
"ping",
"placeholder",
"poster",
"preload",
"radioGroup",
"referrerPolicy",
"readOnly",
"rel",
"required",
"rows",
"rowSpan",
"sandbox",
"scope",
"scoped",
"scrolling",
"seamless",
"selected",
"shape",
"size",
"sizes",
"slot",
"sortable",
"span",
"spellCheck",
"src",
"srcDoc",
"srcSet",
"start",
"step",
"target",
"translate",
"typeMustMatch",
"useMap",
"value",
"wmode",
"wrap"
]);
var DOMEventNames = /* @__PURE__ */ new Set([
"onCopy",
"onCut",
"onPaste",
"onLoad",
"onError",
"onWheel",
"onScroll",
"onCompositionEnd",
"onCompositionStart",
"onCompositionUpdate",
"onKeyDown",
"onKeyPress",
"onKeyUp",
"onFocus",
"onBlur",
"onChange",
"onInput",
"onSubmit",
"onClick",
"onContextMenu",
"onDoubleClick",
"onDrag",
"onDragEnd",
"onDragEnter",
"onDragExit",
"onDragLeave",
"onDragOver",
"onDragStart",
"onDrop",
"onMouseDown",
"onMouseEnter",
"onMouseLeave",
"onMouseMove",
"onMouseOut",
"onMouseOver",
"onMouseUp",
"onPointerDown",
"onPointerEnter",
"onPointerLeave",
"onPointerUp",
"onSelect",
"onTouchCancel",
"onTouchEnd",
"onTouchMove",
"onTouchStart",
"onAnimationStart",
"onAnimationEnd",
"onAnimationIteration",
"onTransitionEnd"
]);
export {
DOMPropNames,
DOMEventNames
};
@@ -0,0 +1 @@
{"mappings":";AAAA,4BAAiB;IAAG,oBAAoB,CAAC,iEAA8D,CAAC;AACxG","sources":["packages/@react-aria/menu/intl/it-IT.json"],"sourcesContent":["{\n \"longPressMessage\": \"Premere a lungo o premere Alt + Freccia giù per aprire il menu\"\n}\n"],"names":[],"version":3,"file":"it-IT.module.js.map"}
@@ -0,0 +1,6 @@
"use strict";
const addSeconds = require("./addSeconds.js");
function subSeconds(date, seconds) {
return addSeconds(date, -seconds);
}
module.exports = subSeconds;
@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2018 Mathias Buus
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
@@ -0,0 +1,4 @@
{
"main": "../../cjs/_class_static_private_field_spec_get.cjs",
"module": "../../esm/_class_static_private_field_spec_get.js"
}
@@ -0,0 +1,18 @@
import { Parser } from "../index.js";
export declare const parsers: {
__babel_estree: Parser;
__js_expression: Parser;
__ts_expression: Parser;
__vue_event_binding: Parser;
__vue_expression: Parser;
__vue_ts_event_binding: Parser;
__vue_ts_expression: Parser;
babel: Parser;
"babel-flow": Parser;
"babel-ts": Parser;
json: Parser;
"json-stringify": Parser;
json5: Parser;
jsonc: Parser;
};
@@ -0,0 +1,21 @@
import { GeneralNames } from "@peculiar/asn1-x509";
import { IssuerSerial } from "./issuer_serial";
import { ObjectDigestInfo } from "./object_digest_info";
/**
* ```asn1
* V2Form ::= SEQUENCE {
* issuerName GeneralNames OPTIONAL,
* baseCertificateID [0] IssuerSerial OPTIONAL,
* objectDigestInfo [1] ObjectDigestInfo OPTIONAL
* -- issuerName MUST be present in this profile
* -- baseCertificateID and objectDigestInfo MUST
* -- NOT be present in this profile
* }
* ```
*/
export declare class V2Form {
issuerName?: GeneralNames;
baseCertificateID?: IssuerSerial;
objectDigestInfo?: ObjectDigestInfo;
constructor(params?: Partial<V2Form>);
}
Loaded 100 of 35554 files, more files were not shown because too many files have changed in this diff. Show more