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

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

No files matched your search

@@ -0,0 +1,5 @@
var convert = require('./convert'),
func = convert('without', require('../without'));
func.placeholder = require('./placeholder');
module.exports = func;
@@ -0,0 +1,7 @@
var ResolutionContext = (function () {
function ResolutionContext() {
this.scopedResolutions = new Map();
}
return ResolutionContext;
}());
export default ResolutionContext;
@@ -0,0 +1,33 @@
/**
* @file 缩减glyf大小,去除冗余节点
* @author mengke01(kekee000@gmail.com)
*/
import reducePath from '../../graphics/reducePath';
/**
* 缩减glyf,去除冗余节点
*
* @param {Object} glyf glyf对象
* @return {Object} glyf对象
*/
export default function reduceGlyf(glyf) {
const contours = glyf.contours;
let contour;
for (let j = contours.length - 1; j >= 0; j--) {
contour = reducePath(contours[j]);
// 空轮廓
if (contour.length <= 2) {
contours.splice(j, 1);
continue;
}
}
if (0 === glyf.contours.length) {
delete glyf.contours;
}
return glyf;
}
@@ -0,0 +1,702 @@
'use strict'
var fs = require('fs')
var path = require('path')
var test = require('tape').test
var from = require('from2')
var crypto = require('crypto')
var sink = require('flush-write-stream')
var pump = require('pump')
var cloneable = require('./')
test('basic passthrough', function (t) {
t.plan(2)
var read = false
var source = from(function (size, next) {
if (read) {
this.push(null)
} else {
read = true
this.push('hello world')
}
next()
})
var instance = cloneable(source)
t.notOk(read, 'stream not started')
instance.pipe(sink(function (chunk, enc, cb) {
t.equal(chunk.toString(), 'hello world', 'chunk matches')
cb()
}))
})
test('clone sync', function (t) {
t.plan(4)
var read = false
var source = from(function (size, next) {
if (read) {
this.push(null)
} else {
read = true
this.push('hello world')
}
next()
})
var instance = cloneable(source)
t.notOk(read, 'stream not started')
var cloned = instance.clone()
t.notOk(read, 'stream not started')
instance.pipe(sink(function (chunk, enc, cb) {
t.equal(chunk.toString(), 'hello world', 'chunk matches')
cb()
}))
cloned.pipe(sink(function (chunk, enc, cb) {
t.equal(chunk.toString(), 'hello world', 'chunk matches')
cb()
}))
})
test('clone async', function (t) {
t.plan(4)
var read = false
var source = from(function (size, next) {
if (read) {
this.push(null)
} else {
read = true
this.push('hello world')
}
next()
})
var instance = cloneable(source)
t.notOk(read, 'stream not started')
var cloned = instance.clone()
t.notOk(read, 'stream not started')
instance.pipe(sink(function (chunk, enc, cb) {
t.equal(chunk.toString(), 'hello world', 'chunk matches')
cb()
}))
setImmediate(function () {
cloned.pipe(sink(function (chunk, enc, cb) {
t.equal(chunk.toString(), 'hello world', 'chunk matches')
cb()
}))
})
})
test('basic passthrough in obj mode', function (t) {
t.plan(2)
var read = false
var source = from.obj(function (size, next) {
if (read) {
return this.push(null)
} else {
read = true
this.push({ hello: 'world' })
}
next()
})
var instance = cloneable(source)
t.notOk(read, 'stream not started')
instance.pipe(sink.obj(function (chunk, enc, cb) {
t.deepEqual(chunk, { hello: 'world' }, 'chunk matches')
cb()
}))
})
test('multiple clone in object mode', function (t) {
t.plan(4)
var read = false
var source = from.obj(function (size, next) {
if (read) {
return this.push(null)
} else {
read = true
this.push({ hello: 'world' })
}
next()
})
var instance = cloneable(source)
t.notOk(read, 'stream not started')
var cloned = instance.clone()
t.notOk(read, 'stream not started')
instance.pipe(sink.obj(function (chunk, enc, cb) {
t.deepEqual(chunk, { hello: 'world' }, 'chunk matches')
cb()
}))
setImmediate(function () {
cloned.pipe(sink.obj(function (chunk, enc, cb) {
t.deepEqual(chunk, { hello: 'world' }, 'chunk matches')
cb()
}))
})
})
test('basic passthrough with data event', function (t) {
t.plan(2)
var read = false
var source = from(function (size, next) {
if (read) {
this.push(null)
} else {
read = true
this.push('hello world')
}
next()
})
var instance = cloneable(source)
t.notOk(read, 'stream not started')
var data = ''
instance.on('data', function (chunk) {
data += chunk.toString()
})
instance.on('end', function () {
t.equal(data, 'hello world', 'chunk matches')
})
})
test('basic passthrough with data event on clone', function (t) {
t.plan(3)
var read = false
var source = from(function (size, next) {
if (read) {
this.push(null)
} else {
read = true
this.push('hello world')
}
next()
})
var instance = cloneable(source)
var cloned = instance.clone()
t.notOk(read, 'stream not started')
var data = ''
cloned.on('data', function (chunk) {
data += chunk.toString()
})
cloned.on('end', function () {
t.equal(data, 'hello world', 'chunk matches in clone')
})
instance.pipe(sink(function (chunk, enc, cb) {
t.equal(chunk.toString(), 'hello world', 'chunk matches in instance')
cb()
}))
})
test('errors if cloned after start', function (t) {
t.plan(2)
var source = from(function (size, next) {
this.push('hello world')
this.push(null)
next()
})
var instance = cloneable(source)
instance.pipe(sink(function (chunk, enc, cb) {
t.equal(chunk.toString(), 'hello world', 'chunk matches')
t.throws(function () {
instance.clone()
}, 'throws if cloned after start')
cb()
}))
})
test('basic passthrough with readable event', function (t) {
t.plan(2)
var read = false
var source = from(function (size, next) {
if (read) {
this.push(null)
} else {
read = true
this.push('hello world')
}
next()
})
var instance = cloneable(source)
t.notOk(read, 'stream not started')
var data = ''
instance.on('readable', function () {
var chunk
while ((chunk = this.read()) !== null) {
data += chunk.toString()
}
})
instance.on('end', function () {
t.equal(data, 'hello world', 'chunk matches')
})
})
test('basic passthrough with readable event on clone', function (t) {
t.plan(3)
var read = false
var source = from(function (size, next) {
if (read) {
this.push(null)
} else {
read = true
this.push('hello world')
}
next()
})
var instance = cloneable(source)
var cloned = instance.clone()
t.notOk(read, 'stream not started')
var data = ''
cloned.on('readable', function () {
var chunk
while ((chunk = this.read()) !== null) {
data += chunk.toString()
}
})
cloned.on('end', function () {
t.equal(data, 'hello world', 'chunk matches in clone')
})
instance.pipe(sink(function (chunk, enc, cb) {
t.equal(chunk.toString(), 'hello world', 'chunk matches in instance')
cb()
}))
})
test('source error destroys all', function (t) {
t.plan(3)
var source = from()
var instance = cloneable(source)
var clone = instance.clone()
source.on('error', function (err) {
t.ok(err, 'source errors')
instance.on('error', function (err2) {
t.ok(err === err2, 'instance receives same error')
})
clone.on('error', function (err3) {
t.ok(err === err3, 'clone receives same error')
})
})
source.emit('error', new Error())
})
test('source destroy destroys all', function (t) {
t.plan(2)
var source = from()
var instance = cloneable(source)
var clone = instance.clone()
instance.on('end', function () {
t.pass('instance has ended')
})
clone.on('end', function () {
t.pass('clone has ended')
})
clone.resume()
instance.resume()
source.destroy()
})
test('instance error destroys all but the source', function (t) {
t.plan(2)
var source = from()
var instance = cloneable(source)
var clone = instance.clone()
source.on('close', function () {
t.fail('source should not be closed')
})
instance.on('error', function (err) {
t.is(err.message, 'beep', 'instance errors')
})
instance.on('close', function () {
t.fail('close should not be emitted')
})
clone.on('error', function (err) {
t.is(err.message, 'beep', 'instance errors')
})
clone.on('close', function () {
t.fail('close should not be emitted')
})
instance.destroy(new Error('beep'))
})
test('instance destroy destroys all but the source', function (t) {
t.plan(2)
var source = from()
var instance = cloneable(source)
var clone = instance.clone()
source.on('close', function () {
t.fail('source should not be closed')
})
instance.on('end', function () {
t.pass('instance has ended')
})
clone.on('end', function () {
t.pass('clone has ended')
})
instance.resume()
clone.resume()
instance.destroy()
})
test('clone destroy does not affect other clones, cloneable or source', function (t) {
t.plan(1)
var source = from()
var instance = cloneable(source)
var clone = instance.clone()
var other = instance.clone()
source.on('close', function () {
t.fail('source should not be closed')
})
instance.on('close', function () {
t.fail('instance should not be closed')
})
other.on('close', function () {
t.fail('other clone should not be closed')
})
clone.on('close', function () {
t.pass('clone is closed')
})
clone.destroy()
})
test('clone remains readable if other is destroyed', function (t) {
t.plan(3)
var read = false
var source = from(function (size, next) {
if (read) {
this.push(null)
} else {
read = true
this.push('hello')
}
next()
})
var instance = cloneable(source)
var clone = instance.clone()
var other = instance.clone()
instance.pipe(sink.obj(function (chunk, enc, cb) {
t.deepEqual(chunk.toString(), 'hello', 'instance chunk matches')
cb()
}))
clone.pipe(sink.obj(function (chunk, enc, cb) {
t.deepEqual(chunk.toString(), 'hello', 'clone chunk matches')
cb()
}))
clone.on('close', function () {
t.fail('clone should not be closed')
})
instance.on('close', function () {
t.fail('instance should not be closed')
})
other.on('close', function () {
t.pass('other is closed')
})
other.destroy()
})
test('clone of clone', function (t) {
t.plan(6)
var read = false
var source = from(function (size, next) {
if (read) {
this.push(null)
} else {
read = true
this.push('hello world')
}
next()
})
var instance = cloneable(source)
t.notOk(read, 'stream not started')
var cloned = instance.clone()
t.notOk(read, 'stream not started')
var replica = cloned.clone()
t.notOk(read, 'stream not started')
instance.pipe(sink(function (chunk, enc, cb) {
t.equal(chunk.toString(), 'hello world', 'chunk matches')
cb()
}))
cloned.pipe(sink(function (chunk, enc, cb) {
t.equal(chunk.toString(), 'hello world', 'chunk matches')
cb()
}))
replica.pipe(sink(function (chunk, enc, cb) {
t.equal(chunk.toString(), 'hello world', 'chunk matches')
cb()
}))
})
test('from vinyl', function (t) {
t.plan(3)
var source = from(['wa', 'dup'])
var instance = cloneable(source)
var clone = instance.clone()
var data = ''
var data2 = ''
var ends = 2
function latch () {
if (--ends === 0) {
t.equal(data, data2)
}
}
instance.on('data', function (chunk) {
data += chunk.toString()
})
process.nextTick(function () {
t.equal('', data, 'nothing was written yet')
t.equal('', data2, 'nothing was written yet')
clone.on('data', function (chunk) {
data2 += chunk.toString()
})
})
instance.on('end', latch)
clone.on('end', latch)
})
test('waits till all are flowing', function (t) {
t.plan(1)
var source = from(['wa', 'dup'])
var instance = cloneable(source)
// we create a clone
instance.clone()
instance.on('data', function (chunk) {
t.fail('this should never happen')
})
process.nextTick(function () {
t.pass('wait till nextTick')
})
})
test('isCloneable', function (t) {
t.plan(4)
var source = from(['hello', ' ', 'world'])
t.notOk(cloneable.isCloneable(source), 'a generic readable is not cloneable')
var instance = cloneable(source)
t.ok(cloneable.isCloneable(instance), 'a cloneable is cloneable')
var clone = instance.clone()
t.ok(cloneable.isCloneable(clone), 'a clone is cloneable')
var cloneClone = clone.clone()
t.ok(cloneable.isCloneable(cloneClone), 'a clone of a clone is cloneable')
})
test('emits finish', function (t) {
var chunks = ['a', 'b', 'c', 'd', null]
var e1 = ['a', 'b', 'c', 'd']
var e2 = ['a', 'b', 'c', 'd']
t.plan(2 + e1.length + e2.length)
var source = from(function (size, next) {
setImmediate(next, null, chunks.shift())
})
var instance = cloneable(source)
var clone = instance.clone()
clone.on('finish', t.pass.bind(null, 'clone emits finish'))
instance.on('finish', t.pass.bind(null, 'main emits finish'))
instance.pipe(sink(function (chunk, enc, cb) {
t.equal(chunk.toString(), e1.shift(), 'chunk matches')
cb()
}))
clone.on('data', function (chunk) {
t.equal(chunk.toString(), e2.shift(), 'chunk matches')
})
})
test('clone async w resume', function (t) {
t.plan(4)
var read = false
var source = from(function (size, next) {
if (read) {
this.push(null)
} else {
read = true
this.push('hello world')
}
next()
})
var instance = cloneable(source)
t.notOk(read, 'stream not started')
var cloned = instance.clone()
t.notOk(read, 'stream not started')
instance.on('end', t.pass.bind(null, 'end emitted'))
instance.resume()
setImmediate(function () {
cloned.on('end', t.pass.bind(null, 'end emitted'))
cloned.resume()
})
})
test('big file', function (t) {
t.plan(13)
var stream = cloneable(fs.createReadStream(path.join(__dirname, 'big')))
var hash = crypto.createHash('sha1')
hash.setEncoding('hex')
var toCheck
fs.createReadStream(path.join(__dirname, 'big'))
.pipe(hash)
.once('readable', function () {
toCheck = hash.read()
t.ok(toCheck)
})
function pipe (s, num) {
s.on('end', function () {
t.pass('end for ' + num)
})
var dest = path.join(__dirname, 'out')
s.pipe(fs.createWriteStream(dest))
.on('finish', function () {
t.pass('finish for ' + num)
var destHash = crypto.createHash('sha1')
destHash.setEncoding('hex')
fs.createReadStream(dest)
.pipe(destHash)
.once('readable', function () {
var hash = destHash.read()
t.ok(hash)
t.equal(hash, toCheck)
})
})
}
// Pipe in another event loop tick <-- this one finished only, it's the original cloneable.
setImmediate(pipe.bind(null, stream, 1))
// Pipe in the same event loop tick
pipe(stream.clone(), 0)
// Pipe a long time after
setTimeout(pipe.bind(null, stream.clone(), 2), 1000)
})
test('pump error', function (t) {
t.plan(1)
var err = new Error('kaboom')
pump([
cloneable(from(function () {
this.destroy(err)
})),
sink(function (chunk, enc, cb) {
t.fail('this should not be called')
})
], function (_err) {
t.equal(_err, err)
})
})
@@ -0,0 +1,9 @@
MIT License
Copyright (c) Kevin Mårtensson <kevinmartensson@gmail.com> (github.com/kevva)
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,27 @@
export function union(types) {
return [...new Set(types)].join(' | ')
}
export function unionValues(values) {
return union(values.map(forValue))
}
export function forKeys(value) {
return union(Object.keys(value).map((key) => `'${key}'`))
}
export function forValue(value) {
if (Array.isArray(value)) {
return `(${unionValues(value)})[]`
}
if (typeof value === 'object') {
return `Record<${forKeys(value)}, ${unionValues(Object.values(value))}>`
}
if (typeof value === 'string') {
return `string`
}
return `any`
}
@@ -0,0 +1,477 @@
import { KeyframeResolver, time, frame, isMotionValue, cancelFrame, transformProps, motionValue, findValueType, complex, getAnimatableNone, microtask } from 'motion-dom';
import { warnOnce, isNumericalString, isZeroValueString, SubscriptionManager } from 'motion-utils';
import { featureDefinitions } from '../motion/features/definitions.mjs';
import { createBox } from '../projection/geometry/models.mjs';
import { initPrefersReducedMotion } from '../utils/reduced-motion/index.mjs';
import { hasReducedMotionListener, prefersReducedMotion } from '../utils/reduced-motion/state.mjs';
import { visualElementStore } from './store.mjs';
import { isControllingVariants, isVariantNode } from './utils/is-controlling-variants.mjs';
import { updateMotionValuesFromProps } from './utils/motion-values.mjs';
import { resolveVariantFromProps } from './utils/resolve-variants.mjs';
const propEventHandlers = [
"AnimationStart",
"AnimationComplete",
"Update",
"BeforeLayoutMeasure",
"LayoutMeasure",
"LayoutAnimationStart",
"LayoutAnimationComplete",
];
/**
* A VisualElement is an imperative abstraction around UI elements such as
* HTMLElement, SVGElement, Three.Object3D etc.
*/
class VisualElement {
/**
* This method takes React props and returns found MotionValues. For example, HTML
* MotionValues will be found within the style prop, whereas for Three.js within attribute arrays.
*
* This isn't an abstract method as it needs calling in the constructor, but it is
* intended to be one.
*/
scrapeMotionValuesFromProps(_props, _prevProps, _visualElement) {
return {};
}
constructor({ parent, props, presenceContext, reducedMotionConfig, blockInitialAnimation, visualState, }, options = {}) {
/**
* A reference to the current underlying Instance, e.g. a HTMLElement
* or Three.Mesh etc.
*/
this.current = null;
/**
* A set containing references to this VisualElement's children.
*/
this.children = new Set();
/**
* Determine what role this visual element should take in the variant tree.
*/
this.isVariantNode = false;
this.isControllingVariants = false;
/**
* Decides whether this VisualElement should animate in reduced motion
* mode.
*
* TODO: This is currently set on every individual VisualElement but feels
* like it could be set globally.
*/
this.shouldReduceMotion = null;
/**
* A map of all motion values attached to this visual element. Motion
* values are source of truth for any given animated value. A motion
* value might be provided externally by the component via props.
*/
this.values = new Map();
this.KeyframeResolver = KeyframeResolver;
/**
* Cleanup functions for active features (hover/tap/exit etc)
*/
this.features = {};
/**
* A map of every subscription that binds the provided or generated
* motion values onChange listeners to this visual element.
*/
this.valueSubscriptions = new Map();
/**
* A reference to the previously-provided motion values as returned
* from scrapeMotionValuesFromProps. We use the keys in here to determine
* if any motion values need to be removed after props are updated.
*/
this.prevMotionValues = {};
/**
* An object containing a SubscriptionManager for each active event.
*/
this.events = {};
/**
* An object containing an unsubscribe function for each prop event subscription.
* For example, every "Update" event can have multiple subscribers via
* VisualElement.on(), but only one of those can be defined via the onUpdate prop.
*/
this.propEventSubscriptions = {};
this.notifyUpdate = () => this.notify("Update", this.latestValues);
this.render = () => {
if (!this.current)
return;
this.triggerBuild();
this.renderInstance(this.current, this.renderState, this.props.style, this.projection);
};
this.renderScheduledAt = 0.0;
this.scheduleRender = () => {
const now = time.now();
if (this.renderScheduledAt < now) {
this.renderScheduledAt = now;
frame.render(this.render, false, true);
}
};
const { latestValues, renderState } = visualState;
this.latestValues = latestValues;
this.baseTarget = { ...latestValues };
this.initialValues = props.initial ? { ...latestValues } : {};
this.renderState = renderState;
this.parent = parent;
this.props = props;
this.presenceContext = presenceContext;
this.depth = parent ? parent.depth + 1 : 0;
this.reducedMotionConfig = reducedMotionConfig;
this.options = options;
this.blockInitialAnimation = Boolean(blockInitialAnimation);
this.isControllingVariants = isControllingVariants(props);
this.isVariantNode = isVariantNode(props);
if (this.isVariantNode) {
this.variantChildren = new Set();
}
this.manuallyAnimateOnMount = Boolean(parent && parent.current);
/**
* Any motion values that are provided to the element when created
* aren't yet bound to the element, as this would technically be impure.
* However, we iterate through the motion values and set them to the
* initial values for this component.
*
* TODO: This is impure and we should look at changing this to run on mount.
* Doing so will break some tests but this isn't necessarily a breaking change,
* more a reflection of the test.
*/
const { willChange, ...initialMotionValues } = this.scrapeMotionValuesFromProps(props, {}, this);
for (const key in initialMotionValues) {
const value = initialMotionValues[key];
if (latestValues[key] !== undefined && isMotionValue(value)) {
value.set(latestValues[key]);
}
}
}
mount(instance) {
this.current = instance;
visualElementStore.set(instance, this);
if (this.projection && !this.projection.instance) {
this.projection.mount(instance);
}
if (this.parent && this.isVariantNode && !this.isControllingVariants) {
this.removeFromVariantTree = this.parent.addVariantChild(this);
}
this.values.forEach((value, key) => this.bindToMotionValue(key, value));
if (!hasReducedMotionListener.current) {
initPrefersReducedMotion();
}
this.shouldReduceMotion =
this.reducedMotionConfig === "never"
? false
: this.reducedMotionConfig === "always"
? true
: prefersReducedMotion.current;
if (process.env.NODE_ENV !== "production") {
warnOnce(this.shouldReduceMotion !== true, "You have Reduced Motion enabled on your device. Animations may not appear as expected.", "reduced-motion-disabled");
}
this.parent?.addChild(this);
this.update(this.props, this.presenceContext);
}
unmount() {
this.projection && this.projection.unmount();
cancelFrame(this.notifyUpdate);
cancelFrame(this.render);
this.valueSubscriptions.forEach((remove) => remove());
this.valueSubscriptions.clear();
this.removeFromVariantTree && this.removeFromVariantTree();
this.parent?.removeChild(this);
for (const key in this.events) {
this.events[key].clear();
}
for (const key in this.features) {
const feature = this.features[key];
if (feature) {
feature.unmount();
feature.isMounted = false;
}
}
this.current = null;
}
addChild(child) {
this.children.add(child);
this.enteringChildren ?? (this.enteringChildren = new Set());
this.enteringChildren.add(child);
}
removeChild(child) {
this.children.delete(child);
this.enteringChildren && this.enteringChildren.delete(child);
}
bindToMotionValue(key, value) {
if (this.valueSubscriptions.has(key)) {
this.valueSubscriptions.get(key)();
}
const valueIsTransform = transformProps.has(key);
if (valueIsTransform && this.onBindTransform) {
this.onBindTransform();
}
const removeOnChange = value.on("change", (latestValue) => {
this.latestValues[key] = latestValue;
this.props.onUpdate && frame.preRender(this.notifyUpdate);
if (valueIsTransform && this.projection) {
this.projection.isTransformDirty = true;
}
this.scheduleRender();
});
let removeSyncCheck;
if (window.MotionCheckAppearSync) {
removeSyncCheck = window.MotionCheckAppearSync(this, key, value);
}
this.valueSubscriptions.set(key, () => {
removeOnChange();
if (removeSyncCheck)
removeSyncCheck();
if (value.owner)
value.stop();
});
}
sortNodePosition(other) {
/**
* If these nodes aren't even of the same type we can't compare their depth.
*/
if (!this.current ||
!this.sortInstanceNodePosition ||
this.type !== other.type) {
return 0;
}
return this.sortInstanceNodePosition(this.current, other.current);
}
updateFeatures() {
let key = "animation";
for (key in featureDefinitions) {
const featureDefinition = featureDefinitions[key];
if (!featureDefinition)
continue;
const { isEnabled, Feature: FeatureConstructor } = featureDefinition;
/**
* If this feature is enabled but not active, make a new instance.
*/
if (!this.features[key] &&
FeatureConstructor &&
isEnabled(this.props)) {
this.features[key] = new FeatureConstructor(this);
}
/**
* If we have a feature, mount or update it.
*/
if (this.features[key]) {
const feature = this.features[key];
if (feature.isMounted) {
feature.update();
}
else {
feature.mount();
feature.isMounted = true;
}
}
}
}
triggerBuild() {
this.build(this.renderState, this.latestValues, this.props);
}
/**
* Measure the current viewport box with or without transforms.
* Only measures axis-aligned boxes, rotate and skew must be manually
* removed with a re-render to work.
*/
measureViewportBox() {
return this.current
? this.measureInstanceViewportBox(this.current, this.props)
: createBox();
}
getStaticValue(key) {
return this.latestValues[key];
}
setStaticValue(key, value) {
this.latestValues[key] = value;
}
/**
* Update the provided props. Ensure any newly-added motion values are
* added to our map, old ones removed, and listeners updated.
*/
update(props, presenceContext) {
if (props.transformTemplate || this.props.transformTemplate) {
this.scheduleRender();
}
this.prevProps = this.props;
this.props = props;
this.prevPresenceContext = this.presenceContext;
this.presenceContext = presenceContext;
/**
* Update prop event handlers ie onAnimationStart, onAnimationComplete
*/
for (let i = 0; i < propEventHandlers.length; i++) {
const key = propEventHandlers[i];
if (this.propEventSubscriptions[key]) {
this.propEventSubscriptions[key]();
delete this.propEventSubscriptions[key];
}
const listenerName = ("on" + key);
const listener = props[listenerName];
if (listener) {
this.propEventSubscriptions[key] = this.on(key, listener);
}
}
this.prevMotionValues = updateMotionValuesFromProps(this, this.scrapeMotionValuesFromProps(props, this.prevProps, this), this.prevMotionValues);
if (this.handleChildMotionValue) {
this.handleChildMotionValue();
}
}
getProps() {
return this.props;
}
/**
* Returns the variant definition with a given name.
*/
getVariant(name) {
return this.props.variants ? this.props.variants[name] : undefined;
}
/**
* Returns the defined default transition on this component.
*/
getDefaultTransition() {
return this.props.transition;
}
getTransformPagePoint() {
return this.props.transformPagePoint;
}
getClosestVariantNode() {
return this.isVariantNode
? this
: this.parent
? this.parent.getClosestVariantNode()
: undefined;
}
/**
* Add a child visual element to our set of children.
*/
addVariantChild(child) {
const closestVariantNode = this.getClosestVariantNode();
if (closestVariantNode) {
closestVariantNode.variantChildren &&
closestVariantNode.variantChildren.add(child);
return () => closestVariantNode.variantChildren.delete(child);
}
}
/**
* Add a motion value and bind it to this visual element.
*/
addValue(key, value) {
// Remove existing value if it exists
const existingValue = this.values.get(key);
if (value !== existingValue) {
if (existingValue)
this.removeValue(key);
this.bindToMotionValue(key, value);
this.values.set(key, value);
this.latestValues[key] = value.get();
}
}
/**
* Remove a motion value and unbind any active subscriptions.
*/
removeValue(key) {
this.values.delete(key);
const unsubscribe = this.valueSubscriptions.get(key);
if (unsubscribe) {
unsubscribe();
this.valueSubscriptions.delete(key);
}
delete this.latestValues[key];
this.removeValueFromRenderState(key, this.renderState);
}
/**
* Check whether we have a motion value for this key
*/
hasValue(key) {
return this.values.has(key);
}
getValue(key, defaultValue) {
if (this.props.values && this.props.values[key]) {
return this.props.values[key];
}
let value = this.values.get(key);
if (value === undefined && defaultValue !== undefined) {
value = motionValue(defaultValue === null ? undefined : defaultValue, { owner: this });
this.addValue(key, value);
}
return value;
}
/**
* If we're trying to animate to a previously unencountered value,
* we need to check for it in our state and as a last resort read it
* directly from the instance (which might have performance implications).
*/
readValue(key, target) {
let value = this.latestValues[key] !== undefined || !this.current
? this.latestValues[key]
: this.getBaseTargetFromProps(this.props, key) ??
this.readValueFromInstance(this.current, key, this.options);
if (value !== undefined && value !== null) {
if (typeof value === "string" &&
(isNumericalString(value) || isZeroValueString(value))) {
// If this is a number read as a string, ie "0" or "200", convert it to a number
value = parseFloat(value);
}
else if (!findValueType(value) && complex.test(target)) {
value = getAnimatableNone(key, target);
}
this.setBaseTarget(key, isMotionValue(value) ? value.get() : value);
}
return isMotionValue(value) ? value.get() : value;
}
/**
* Set the base target to later animate back to. This is currently
* only hydrated on creation and when we first read a value.
*/
setBaseTarget(key, value) {
this.baseTarget[key] = value;
}
/**
* Find the base target for a value thats been removed from all animation
* props.
*/
getBaseTarget(key) {
const { initial } = this.props;
let valueFromInitial;
if (typeof initial === "string" || typeof initial === "object") {
const variant = resolveVariantFromProps(this.props, initial, this.presenceContext?.custom);
if (variant) {
valueFromInitial = variant[key];
}
}
/**
* If this value still exists in the current initial variant, read that.
*/
if (initial && valueFromInitial !== undefined) {
return valueFromInitial;
}
/**
* Alternatively, if this VisualElement config has defined a getBaseTarget
* so we can read the value from an alternative source, try that.
*/
const target = this.getBaseTargetFromProps(this.props, key);
if (target !== undefined && !isMotionValue(target))
return target;
/**
* If the value was initially defined on initial, but it doesn't any more,
* return undefined. Otherwise return the value as initially read from the DOM.
*/
return this.initialValues[key] !== undefined &&
valueFromInitial === undefined
? undefined
: this.baseTarget[key];
}
on(eventName, callback) {
if (!this.events[eventName]) {
this.events[eventName] = new SubscriptionManager();
}
return this.events[eventName].add(callback);
}
notify(eventName, ...args) {
if (this.events[eventName]) {
this.events[eventName].notify(...args);
}
}
scheduleRenderMicrotask() {
microtask.render(this.render);
}
}
export { VisualElement };
@@ -0,0 +1,8 @@
import { PluginFunc } from 'dayjs/esm'
declare const plugin: PluginFunc
export = plugin
declare module 'dayjs/esm' {
export function updateLocale(localeName: string, customConfig: Record<string, unknown>): Record<string, unknown>
}
@@ -0,0 +1,5 @@
import { InstanceBindingNode } from '../../planning/models/InstanceBindingNode';
import { PlanServiceNode } from '../../planning/models/PlanServiceNode';
import { ResolutionParams } from '../models/ResolutionParams';
export declare function setInstanceProperties(resolveServiceNode: (params: ResolutionParams, serviceNode: PlanServiceNode) => unknown): (params: ResolutionParams, instance: Record<string | symbol, unknown>, node: InstanceBindingNode) => void | Promise<void>;
//# sourceMappingURL=setInstanceProperties.d.ts.map
@@ -0,0 +1,5 @@
var convert = require('./convert'),
func = convert('fromPairs', require('../fromPairs'));
func.placeholder = require('./placeholder');
module.exports = func;
@@ -0,0 +1,26 @@
'use strict';
var $TypeError = require('es-errors/type');
var ArrayBufferByteLength = require('./ArrayBufferByteLength');
var IsDetachedBuffer = require('./IsDetachedBuffer');
var isTypedArray = require('is-typed-array');
var typedArrayBuffer = require('typed-array-buffer');
// https://262.ecma-international.org/15.0/#sec-maketypedarraywithbufferwitnessrecord
module.exports = function MakeTypedArrayWithBufferWitnessRecord(obj, order) {
if (!isTypedArray(obj)) {
throw new $TypeError('Assertion failed: `obj` must be a Typed Array');
}
if (order !== 'SEQ-CST' && order !== 'UNORDERED') {
throw new $TypeError('Assertion failed: `order` must be ~SEQ-CST~ or ~UNORDERED~');
}
var buffer = typedArrayBuffer(obj); // step 1
var byteLength = IsDetachedBuffer(buffer) ? 'DETACHED' : ArrayBufferByteLength(buffer, order); // steps 2 - 3
return { '[[Object]]': obj, '[[CachedBufferByteLength]]': byteLength }; // step 4
};
@@ -0,0 +1 @@
{"mappings":";;;AAAA;;;;;;;;;;CAUC","sources":["packages/@internationalized/message/src/index.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport type {LocalizedStrings} from './MessageDictionary';\nexport {MessageDictionary} from './MessageDictionary';\nexport {MessageFormatter} from './MessageFormatter';\n"],"names":[],"version":3,"file":"module.js.map"}
@@ -0,0 +1,104 @@
import test from 'tape';
import { elementType } from 'jsx-ast-utils';
import isInteractiveElement from '../../../src/util/isInteractiveElement';
import JSXElementMock from '../../../__mocks__/JSXElementMock';
import {
genElementSymbol,
genIndeterminantInteractiveElements,
genInteractiveElements,
genInteractiveRoleElements,
genNonInteractiveElements,
genNonInteractiveRoleElements,
} from '../../../__mocks__/genInteractives';
test('isInteractiveElement', (t) => {
t.equal(
isInteractiveElement(undefined, []),
false,
'identifies them as interactive elements',
);
t.test('interactive elements', (st) => {
genInteractiveElements().forEach(({ openingElement }) => {
st.equal(
isInteractiveElement(
elementType(openingElement),
openingElement.attributes,
),
true,
`identifies \`${genElementSymbol(openingElement)}\` as an interactive element`,
);
});
st.end();
});
t.test('interactive role elements', (st) => {
genInteractiveRoleElements().forEach(({ openingElement }) => {
st.equal(
isInteractiveElement(
elementType(openingElement),
openingElement.attributes,
),
false,
`identifies \`${genElementSymbol(openingElement)}\` as an interactive element`,
);
});
st.end();
});
t.test('non-interactive elements', (st) => {
genNonInteractiveElements().forEach(({ openingElement }) => {
st.equal(
isInteractiveElement(
elementType(openingElement),
openingElement.attributes,
),
false,
`identifies \`${genElementSymbol(openingElement)}\` as an interactive element`,
);
});
st.end();
});
t.test('non-interactive role elements', (st) => {
genNonInteractiveRoleElements().forEach(({ openingElement }) => {
st.equal(
isInteractiveElement(
elementType(openingElement),
openingElement.attributes,
),
false,
`identifies \`${genElementSymbol(openingElement)}\` as an interactive element`,
);
});
st.end();
});
t.test('indeterminate elements', (st) => {
genIndeterminantInteractiveElements().forEach(({ openingElement }) => {
st.equal(
isInteractiveElement(
elementType(openingElement),
openingElement.attributes,
),
false,
`identifies \`${genElementSymbol(openingElement)}\` as an interactive element`,
);
});
st.end();
});
t.equal(
isInteractiveElement('CustomComponent', JSXElementMock()),
false,
'JSX elements are not interactive',
);
t.end();
});
@@ -0,0 +1,43 @@
/**
* @file 矩形转换成轮廓
* @author mengke01(kekee000@gmail.com)
*/
/**
* 矩形转换成轮廓
*
* @param {number} x 左上角x
* @param {number} y 左上角y
* @param {number} width 宽度
* @param {number} height 高度
* @return {Array} 轮廓数组
*/
export default function rect2contour(x, y, width, height) {
x = +x;
y = +y;
width = +width;
height = +height;
return [
{
x,
y,
onCurve: true
},
{
x: x + width,
y,
onCurve: true
},
{
x: x + width,
y: y + height,
onCurve: true
},
{
x,
y: y + height,
onCurve: true
}
];
}
@@ -0,0 +1,11 @@
export type Options = [
{
enforceForClassFields?: boolean;
exceptMethods?: string[];
ignoreClassesThatImplementAnInterface?: boolean | 'public-fields';
ignoreOverrideMethods?: boolean;
}
];
export type MessageIds = 'missingThis';
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"missingThis", Options, import("../../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
export default _default;
@@ -0,0 +1 @@
{"name":"vfile-message","version":"4.0.3","requiresBuild":false,"files":{"license":{"checkedAt":1794532114297,"integrity":"sha512-ic4iF2Ap25Sn5T9MMw7nJ9C20WL6V01rybBBQi2Qx8cQC9/ERFEqGnove1HT65tK2TIKM30PZoOV3Qbz2FE//A==","mode":420,"size":1094},"index.js":{"checkedAt":1794532114297,"integrity":"sha512-QaT49L1FiO/CGlKgUMV3HeF3MXW6t7KDm5XrZUHFZzxQ4AfZqQUQgJ/KlAPx2QndyoiRek8Vx/6xIMYrJqK31A==","mode":420,"size":108},"lib/index.js":{"checkedAt":1794532114297,"integrity":"sha512-aWhaz0bHRjadF9tdIEjGnzaptYMKD5/oLAXylZ9Mhd3j2Bn2SPnuQvv0cr1wrGeAQOOFlqIyTXnRN8KJfOg/cg==","mode":420,"size":8215},"package.json":{"checkedAt":1794532114297,"integrity":"sha512-3TjjLqmC2mORJTbaxsnCToTZpt7DpZbklKCnBSlnJI1farp9NAu/Kpj2CjwqyKAS1jFUCWCY/aJ74k/09WLUkQ==","mode":420,"size":1997},"readme.md":{"checkedAt":1794532114297,"integrity":"sha512-mgJv0j0qLbawNdLspJyw01U1UC6kLy2StIBSnNsl0qg5mJ3F59exxp9LMYKZJF0/8WSrh2XhZo6uDUrQelkDhw==","mode":420,"size":6959},"index.d.ts":{"checkedAt":1794532114298,"integrity":"sha512-Rv8W2BWQVXZ5X58AukWnuXnY0ZDJu2UO++5ytpnJ+1XaJBvJOXiETn2Xw0UAp9lXIN4NMuv3YPOXbTngHQUNgQ==","mode":420,"size":103},"lib/index.d.ts":{"checkedAt":1794532114298,"integrity":"sha512-3aGJ56L4Udkdu0OlGi3bDuJoi7iEb1c16ia/A5whOljqb8FFhysV5JXh6YetZ9+cHrDYrk/Rg6K2ffVo2vh4iQ==","mode":420,"size":15744}}}
@@ -0,0 +1,48 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = compound2simpleglyf;
var _transformGlyfContours = _interopRequireDefault(require("./transformGlyfContours"));
var _compound2simple = _interopRequireDefault(require("./compound2simple"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* @file ttf复合字形转简单字形
* @author mengke01(kekee000@gmail.com)
*/
/**
* ttf复合字形转简单字形
*
* @param {Object|number} glyf glyf对象或者glyf索引
* @param {Object} ttf ttfObject对象
* @param {boolean} recrusive 是否递归的进行转换,如果复合字形为嵌套字形,则转换每一个复合字形
* @return {Object} 转换后的对象
*/
function compound2simpleglyf(glyf, ttf, recrusive) {
var glyfIndex;
// 兼容索引和对象传入
if (typeof glyf === 'number') {
glyfIndex = glyf;
glyf = ttf.glyf[glyfIndex];
} else {
glyfIndex = ttf.glyf.indexOf(glyf);
if (-1 === glyfIndex) {
return glyf;
}
}
if (!glyf.compound || !glyf.glyfs) {
return glyf;
}
var contoursList = {};
(0, _transformGlyfContours.default)(glyf, ttf, contoursList, glyfIndex);
if (recrusive) {
Object.keys(contoursList).forEach(function (index) {
(0, _compound2simple.default)(ttf.glyf[index], contoursList[index]);
});
} else {
(0, _compound2simple.default)(glyf, contoursList[glyfIndex]);
}
return glyf;
}
@@ -0,0 +1 @@
{"version":3,"file":"handlePlanError.d.ts","sourceRoot":"","sources":["../../../../src/planning/calculations/handlePlanError.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AA6BlD,wBAAgB,eAAe,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK,CAazE"}
@@ -0,0 +1,35 @@
import { CreateType } from '../create/type.mjs';
import { Literal } from '../literal/index.mjs';
import { Number } from '../number/index.mjs';
import { Computed } from '../computed/index.mjs';
import { Ref } from '../ref/index.mjs';
import { KeyOfPropertyKeys } from './keyof-property-keys.mjs';
import { UnionEvaluated } from '../union/index.mjs';
import { KeyOfFromMappedResult } from './keyof-from-mapped-result.mjs';
// ------------------------------------------------------------------
// TypeGuard
// ------------------------------------------------------------------
import { IsMappedResult, IsRef, IsComputed } from '../guard/kind.mjs';
// prettier-ignore
function FromComputed(target, parameters) {
return Computed('KeyOf', [Computed(target, parameters)]);
}
// prettier-ignore
function FromRef($ref) {
return Computed('KeyOf', [Ref($ref)]);
}
// prettier-ignore
function KeyOfFromType(type, options) {
const propertyKeys = KeyOfPropertyKeys(type);
const propertyKeyTypes = KeyOfPropertyKeysToRest(propertyKeys);
const result = UnionEvaluated(propertyKeyTypes);
return CreateType(result, options);
}
// prettier-ignore
export function KeyOfPropertyKeysToRest(propertyKeys) {
return propertyKeys.map(L => L === '[number]' ? Number() : Literal(L));
}
/** `[Json]` Creates a KeyOf type */
export function KeyOf(type, options) {
return (IsComputed(type) ? FromComputed(type.target, type.parameters) : IsRef(type) ? FromRef(type.$ref) : IsMappedResult(type) ? KeyOfFromMappedResult(type, options) : KeyOfFromType(type, options));
}
@@ -0,0 +1,9 @@
var get = require("./get.js");
var getPrototypeOf = require("./getPrototypeOf.js");
function _superPropGet(t, o, e, r) {
var p = get(getPrototypeOf(1 & r ? t.prototype : t), o, e);
return 2 & r && "function" == typeof p ? function (t) {
return p.apply(e, t);
} : p;
}
module.exports = _superPropGet, module.exports.__esModule = true, module.exports["default"] = module.exports;
@@ -0,0 +1 @@
{"version":3,"file":"jsx-key.d.ts","sourceRoot":"","sources":["jsx-key.js"],"names":[],"mappings":"wBAmCW,OAAO,QAAQ,EAAE,IAAI,CAAC,UAAU"}
@@ -0,0 +1 @@
{"mappings":";AAAA,4BAAiB;IAAG,aAAa,CAAC,eAAS,CAAC;IAC1C,iBAAiB,CAAC,OAAS,CAAC,2CAA+B,EAAE,KAAK,UAAU,EAAE;IAC9E,cAAc,CAAC,OAAS,GAAG,KAAK,KAAK,CAAC,aAAO,CAAC;IAC9C,cAAc,CAAC,cAAQ,CAAC;IACxB,kBAAkB,CAAC,OAAS,CAAC,0CAA8B,EAAE,KAAK,UAAU,EAAE;IAC9E,sBAAsB,CAAC,iEAA+C,CAAC;IACvE,UAAU,CAAC,MAAM,CAAC;IAClB,aAAa,CAAC,gBAAU,CAAC;IACzB,YAAY,CAAC,2CAAyB,CAAC;AACzC","sources":["packages/@react-aria/table/intl/cs-CZ.json"],"sourcesContent":["{\n \"ascending\": \"vzestupně\",\n \"ascendingSort\": \"řazeno vzestupně podle sloupce {columnName}\",\n \"columnSize\": \"{value} pixelů\",\n \"descending\": \"sestupně\",\n \"descendingSort\": \"řazeno sestupně podle sloupce {columnName}\",\n \"resizerDescription\": \"Stisknutím klávesy Enter začnete měnit velikost\",\n \"select\": \"Vybrat\",\n \"selectAll\": \"Vybrat vše\",\n \"sortable\": \"sloupec s možností řazení\"\n}\n"],"names":[],"version":3,"file":"cs-CZ.module.js.map"}
@@ -0,0 +1,144 @@
/**
* Copyright (c) 2017 The xterm.js authors. All rights reserved.
* @license MIT
*/
import { IBufferService } from 'common/services/Services';
/**
* Represents a selection within the buffer. This model only cares about column
* and row coordinates, not wide characters.
*/
export class SelectionModel {
/**
* Whether select all is currently active.
*/
public isSelectAllActive: boolean = false;
/**
* The minimal length of the selection from the start position. When double
* clicking on a word, the word will be selected which makes the selection
* start at the start of the word and makes this variable the length.
*/
public selectionStartLength: number = 0;
/**
* The [x, y] position the selection starts at.
*/
public selectionStart: [number, number] | undefined;
/**
* The [x, y] position the selection ends at.
*/
public selectionEnd: [number, number] | undefined;
constructor(
private _bufferService: IBufferService
) {
}
/**
* Clears the current selection.
*/
public clearSelection(): void {
this.selectionStart = undefined;
this.selectionEnd = undefined;
this.isSelectAllActive = false;
this.selectionStartLength = 0;
}
/**
* The final selection start, taking into consideration select all.
*/
public get finalSelectionStart(): [number, number] | undefined {
if (this.isSelectAllActive) {
return [0, 0];
}
if (!this.selectionEnd || !this.selectionStart) {
return this.selectionStart;
}
return this.areSelectionValuesReversed() ? this.selectionEnd : this.selectionStart;
}
/**
* The final selection end, taking into consideration select all, double click
* word selection and triple click line selection.
*/
public get finalSelectionEnd(): [number, number] | undefined {
if (this.isSelectAllActive) {
return [this._bufferService.cols, this._bufferService.buffer.ybase + this._bufferService.rows - 1];
}
if (!this.selectionStart) {
return undefined;
}
// Use the selection start + length if the end doesn't exist or they're reversed
if (!this.selectionEnd || this.areSelectionValuesReversed()) {
const startPlusLength = this.selectionStart[0] + this.selectionStartLength;
if (startPlusLength > this._bufferService.cols) {
// Ensure the trailing EOL isn't included when the selection ends on the right edge
if (startPlusLength % this._bufferService.cols === 0) {
return [this._bufferService.cols, this.selectionStart[1] + Math.floor(startPlusLength / this._bufferService.cols) - 1];
}
return [startPlusLength % this._bufferService.cols, this.selectionStart[1] + Math.floor(startPlusLength / this._bufferService.cols)];
}
return [startPlusLength, this.selectionStart[1]];
}
// Ensure the the word/line is selected after a double/triple click
if (this.selectionStartLength) {
// Select the larger of the two when start and end are on the same line
if (this.selectionEnd[1] === this.selectionStart[1]) {
// Keep the whole wrapped word/line selected if the content wraps multiple lines
const startPlusLength = this.selectionStart[0] + this.selectionStartLength;
if (startPlusLength > this._bufferService.cols) {
return [startPlusLength % this._bufferService.cols, this.selectionStart[1] + Math.floor(startPlusLength / this._bufferService.cols)];
}
return [Math.max(startPlusLength, this.selectionEnd[0]), this.selectionEnd[1]];
}
}
return this.selectionEnd;
}
/**
* Returns whether the selection start and end are reversed.
*/
public areSelectionValuesReversed(): boolean {
const start = this.selectionStart;
const end = this.selectionEnd;
if (!start || !end) {
return false;
}
return start[1] > end[1] || (start[1] === end[1] && start[0] > end[0]);
}
/**
* Handle the buffer being trimmed, adjust the selection position.
* @param amount The amount the buffer is being trimmed.
* @returns Whether a refresh is necessary.
*/
public handleTrim(amount: number): boolean {
// Adjust the selection position based on the trimmed amount.
if (this.selectionStart) {
this.selectionStart[1] -= amount;
}
if (this.selectionEnd) {
this.selectionEnd[1] -= amount;
}
// The selection has moved off the buffer, clear it.
if (this.selectionEnd && this.selectionEnd[1] < 0) {
this.clearSelection();
return true;
}
// If the selection start is trimmed, ensure the start column is 0.
if (this.selectionStart && this.selectionStart[1] < 0) {
this.selectionStart[1] = 0;
}
return false;
}
}
@@ -0,0 +1,46 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _useLatest = _interopRequireDefault(require("../useLatest"));
var _domTarget = require("../utils/domTarget");
var _useEffectWithTarget = _interopRequireDefault(require("../utils/useEffectWithTarget"));
function useEventListener(eventName, handler, options) {
if (options === void 0) {
options = {};
}
var _a = options.enable,
enable = _a === void 0 ? true : _a;
var handlerRef = (0, _useLatest["default"])(handler);
(0, _useEffectWithTarget["default"])(function () {
if (!enable) {
return;
}
var targetElement = (0, _domTarget.getTargetElement)(options.target, window);
if (!(targetElement === null || targetElement === void 0 ? void 0 : targetElement.addEventListener)) {
return;
}
var eventListener = function eventListener(event) {
return handlerRef.current(event);
};
var eventNameArray = Array.isArray(eventName) ? eventName : [eventName];
eventNameArray.forEach(function (event) {
targetElement.addEventListener(event, eventListener, {
capture: options.capture,
once: options.once,
passive: options.passive
});
});
return function () {
eventNameArray.forEach(function (event) {
targetElement.removeEventListener(event, eventListener, {
capture: options.capture
});
});
};
}, [eventName, options.capture, options.once, options.passive, enable], options.target);
}
var _default = exports["default"] = useEventListener;
@@ -0,0 +1 @@
{"version":3,"file":"useWatch.d.ts","sourceRoot":"","sources":["../src/useWatch.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,175 @@
import { expectTypeOf, test } from "vitest";
import * as z from "zod/v4";
import type * as core from "zod/v4/core";
test("first party switch", () => {
const myType = z.string() as core.$ZodTypes;
const def = myType._zod.def;
switch (def.type) {
case "string":
break;
case "number":
break;
case "bigint":
break;
case "boolean":
break;
case "date":
break;
case "symbol":
break;
case "undefined":
break;
case "null":
break;
case "any":
break;
case "unknown":
break;
case "never":
break;
case "void":
break;
case "array":
break;
case "object":
break;
case "union":
break;
case "intersection":
break;
case "tuple":
break;
case "record":
break;
case "map":
break;
case "set":
break;
case "literal":
break;
case "enum":
break;
case "promise":
break;
case "optional":
break;
case "nonoptional":
break;
case "nullable":
break;
case "default":
break;
case "prefault":
break;
case "template_literal":
break;
case "custom":
break;
case "transform":
break;
case "readonly":
break;
case "nan":
break;
case "pipe":
break;
case "success":
break;
case "catch":
break;
case "file":
break;
case "lazy":
break;
default:
expectTypeOf(def).toEqualTypeOf<never>();
}
});
test("$ZodSchemaTypes", () => {
const type = "string" as core.$ZodTypeDef["type"];
switch (type) {
case "string":
break;
case "number":
break;
case "int":
break;
case "bigint":
break;
case "boolean":
break;
case "date":
break;
case "symbol":
break;
case "undefined":
break;
case "null":
break;
case "any":
break;
case "unknown":
break;
case "never":
break;
case "void":
break;
case "array":
break;
case "object":
break;
case "union":
break;
case "intersection":
break;
case "tuple":
break;
case "record":
break;
case "map":
break;
case "set":
break;
case "literal":
break;
case "enum":
break;
case "promise":
break;
case "optional":
break;
case "nonoptional":
break;
case "nullable":
break;
case "default":
break;
case "prefault":
break;
case "template_literal":
break;
case "custom":
break;
case "transform":
break;
case "readonly":
break;
case "nan":
break;
case "pipe":
break;
case "success":
break;
case "catch":
break;
case "file":
break;
case "lazy":
break;
default:
expectTypeOf(type).toEqualTypeOf<never>();
}
});
@@ -0,0 +1,18 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.buildClassElementMetadataFromMaybeClassElementMetadata = buildClassElementMetadataFromMaybeClassElementMetadata;
const InversifyCoreError_1 = require("../../error/models/InversifyCoreError");
const InversifyCoreErrorKind_1 = require("../../error/models/InversifyCoreErrorKind");
const ClassElementMetadataKind_1 = require("../models/ClassElementMetadataKind");
function buildClassElementMetadataFromMaybeClassElementMetadata(buildDefaultMetadata, buildMetadataFromMaybeManagedMetadata) {
return (...params) => (metadata) => {
if (metadata === undefined) {
return buildDefaultMetadata(...params);
}
if (metadata.kind === ClassElementMetadataKind_1.ClassElementMetadataKind.unmanaged) {
throw new InversifyCoreError_1.InversifyCoreError(InversifyCoreErrorKind_1.InversifyCoreErrorKind.injectionDecoratorConflict, 'Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found');
}
return buildMetadataFromMaybeManagedMetadata(metadata, ...params);
};
}
//# sourceMappingURL=buildClassElementMetadataFromMaybeClassElementMetadata.js.map
@@ -0,0 +1,150 @@
'use strict';
var hasOwn = require('hasown');
module.exports = function (toSorted, t) {
var nums = [2, 1, 3];
var result = toSorted(nums);
t.deepEqual(
result,
[1, 2, 3],
'array is sorted'
);
t.notEqual(nums, result, 'original array is not returned');
t.deepEqual(nums, [2, 1, 3], 'original array is unchanged');
nums.sort();
t.deepEqual(nums, result, 'mutated original matches result');
t.deepEqual(
toSorted('acab'),
['a', 'a', 'b', 'c'],
'string sorts to array'
);
var halfPoo = '\uD83D';
var endPoo = '\uDCA9';
var poo = halfPoo + endPoo;
t.deepEqual(
toSorted('a' + poo + 'c'),
['a', 'c', halfPoo, endPoo],
'code point is sorted as expected'
);
var arrayLikeLengthValueOf = {
length: {
valueOf: function () { return 2; }
},
0: 4,
1: 0,
2: 1
};
t.deepEqual(toSorted(arrayLikeLengthValueOf), [0, 4]);
t.test('not positive integer lengths', function (st) {
st.deepEqual(toSorted({ length: -2 }), []);
st.deepEqual(toSorted({ length: 'dog' }), []);
st.deepEqual(toSorted({ length: NaN }), []);
st.end();
});
t.test('getters', { skip: !Object.defineProperty }, function (st) {
var getCalls = [];
var arrayLike = {
0: 2,
1: 1,
2: 3,
length: 3
};
Object.defineProperty(arrayLike, '0', {
get: function () {
getCalls.push(0);
return 2;
}
});
Object.defineProperty(arrayLike, '1', {
get: function () {
getCalls.push(1);
return 1;
}
});
Object.defineProperty(arrayLike, '2', {
get: function () {
getCalls.push(2);
return 3;
}
});
var up = { gross: true };
st['throws'](
function () {
toSorted(arrayLike, function () {
throw up;
});
},
up
);
st.deepEqual(getCalls, [0, 1, 2]);
var arr1 = [5, 0, 3];
Object.defineProperty(arr1, '0', {
get: function () {
arr1.push(1);
return 5;
}
});
st.deepEqual(toSorted(arr1), [0, 3, 5]);
var arr = [5, 1, 4, 6, 3];
Array.prototype[3] = 2; // eslint-disable-line no-extend-native
st.teardown(function () {
delete Array.prototype[3];
});
Object.defineProperty(arr, '2', {
get: function () {
arr.length = 1;
return 4;
}
});
st.deepEqual(toSorted(arr), [1, 2, 4, 5, undefined]);
st.end();
});
t.test('too-large lengths', function (st) {
var arrayLike = {
0: 0,
4294967295: 4294967295,
4294967296: 4294967296,
length: Math.pow(2, 32)
};
st['throws'](
function () { toSorted(arrayLike); },
RangeError
);
st.end();
});
t.deepEqual(toSorted(true), [], 'true yields empty array');
t.deepEqual(toSorted(false), [], 'false yields empty array');
t.test('holes', function (st) {
var arr = [3, /* hole */, 4, /* hole */, 1]; // eslint-disable-line no-sparse-arrays
Array.prototype[3] = 2; // eslint-disable-line no-extend-native
st.teardown(function () {
delete Array.prototype[3];
});
var sorted = toSorted(arr);
st.deepEqual(sorted, [1, 2, 3, 4, undefined]);
st.ok(hasOwn(sorted, 4));
st.end();
});
};
@@ -0,0 +1 @@
{"name":"micromark-util-chunked","version":"2.0.1","requiresBuild":false,"files":{"license":{"checkedAt":1794532113360,"integrity":"sha512-ic4iF2Ap25Sn5T9MMw7nJ9C20WL6V01rybBBQi2Qx8cQC9/ERFEqGnove1HT65tK2TIKM30PZoOV3Qbz2FE//A==","mode":420,"size":1094},"dev/index.js":{"checkedAt":1794532113360,"integrity":"sha512-2AXW0g1t/eJbAeuvSl1ahYBUfbCIlrnVUitKpyKFkQcGcyfTHC9vQxW0Opv1XJHibQvsh6dHq6xQwSuovv38iQ==","mode":420,"size":2485},"index.js":{"checkedAt":1794532113360,"integrity":"sha512-uQHdFaT8GTNHORhbOZEuDEDABWTRRpWpl8L6tSH5UOyspvLefeig7ylwP++SZqS36P38fi6mGpwG3O2g0bSEfw==","mode":420,"size":2334},"package.json":{"checkedAt":1794532113360,"integrity":"sha512-A3qjIAvPhupMGsLTeJFIMGADn/d8Oe6oQbfjtnWVs/eAPsBHsgCi31UR7Nqvjm7aM4RKLoGOAeuPNlExFCFpoA==","mode":420,"size":1269},"dev/index.d.ts.map":{"checkedAt":1794532113360,"integrity":"sha512-ehHtOm8hPae1T62r7lJXqQnAHTF+UG7CekgN+8Q7Ux5hQ3IPd2h6dM1jD/nQy+ZS47CR8/SVfo24DMwQgcg3OA==","mode":420,"size":373},"index.d.ts.map":{"checkedAt":1794532113360,"integrity":"sha512-ehHtOm8hPae1T62r7lJXqQnAHTF+UG7CekgN+8Q7Ux5hQ3IPd2h6dM1jD/nQy+ZS47CR8/SVfo24DMwQgcg3OA==","mode":420,"size":373},"readme.md":{"checkedAt":1794532113361,"integrity":"sha512-SBrYBS82J9ARwD7drPA6DIysTQwS3KpPsfZO2An2w0byifydAjXxF7M8J1Qkqh5hykc2sHNuR6CZ9krVii8ibg==","mode":420,"size":5589},"dev/index.d.ts":{"checkedAt":1794532113361,"integrity":"sha512-6x/o1Z15DuGW+/XvyC9Hn1XDD9txc2Im/OwlfhTQiHSIGlfoqFZ1reicGMBjb1Lmr8AshDmot7jmOYvuXbYygg==","mode":420,"size":1369},"index.d.ts":{"checkedAt":1794532113361,"integrity":"sha512-6x/o1Z15DuGW+/XvyC9Hn1XDD9txc2Im/OwlfhTQiHSIGlfoqFZ1reicGMBjb1Lmr8AshDmot7jmOYvuXbYygg==","mode":420,"size":1369}}}
@@ -0,0 +1,294 @@
## 6.5.3 (2025-12-22)
### Bug fixes
Fix an issue where `RangeValue.eq` could get called with a value of a different class.
`EditorState.charCategorizer` now only uses the highest-precedence set of word characters from the language data, to allow overriding these.
## 6.5.2 (2025-02-03)
### Bug fixes
Fix a bug where reconfiguring a field with a new `init` value didn't update the value of the field.
## 6.5.1 (2025-01-10)
### Bug fixes
`countColumn` no longer loops infinitely when given a `to` that's higher than the input string's length.
## 6.5.0 (2024-12-09)
### New features
`RangeSet.compare` now supports a `boundChange` callback that is called when there's a change in the way ranges are split.
## 6.4.1 (2024-02-19)
### Bug fixes
Fix an issue that caused widgets at the end of a mark decoration to be rendered in their own separate mark DOM element.
## 6.4.0 (2023-12-28)
### Bug fixes
When multiple ranges in a single range set overlap, put the smaller ones inside the bigger ones, so that overlapping decorations don't break up each other's elements when coming from the same source.
### New features
Selection and selection range `eq` methods now support an optional argument that makes them also compare by cursor associativity.
The `RangeSet.join` function can be used to join multiple range sets together.
## 6.3.3 (2023-12-06)
### Bug fixes
Fix an issue where `Text.slice` and `Text.replace` could return objects with incorrect `length` when the given `from`/`to` values were out of range for the text.
## 6.3.2 (2023-11-27)
### Bug fixes
Make sure transactions cannot add multiple selections when `allowMultipleSelections` is false.
Fix a bug that caused `Text.iterLines` to not return empty lines at the end of the iterated ranges.
## 6.3.1 (2023-10-18)
### Bug fixes
Give the tag property on `FacetReader` the type of the output type parameter to force TypeScript to infer the proper type when converting from `Facet` to `FacetReader`.
## 6.3.0 (2023-10-12)
### New features
The new `FacetReader` type provides a way to export a read-only handle to a `Facet`.
## 6.2.1 (2023-05-23)
### Bug fixes
Fix an issue that could cause `RangeSet.compare` to miss changes in the set of active ranges around a point range.
## 6.2.0 (2022-12-26)
### New features
`EditorSelection.range` now accepts an optional 4th argument to specify the bidi level of the range's head position.
## 6.1.4 (2022-11-15)
### Bug fixes
Fix a bug that caused the `openStart` value passed to span iterators to be incorrect around widgets in some circumstances.
## 6.1.3 (2022-11-10)
### Bug fixes
Avoid unnecessary calls to computed facet getters when a state is reconfigured but no dependencies of the computed facet change.
Fix an infinite loop in `RangeSet.eq` when the `to` parameter isn't given.
## 6.1.2 (2022-09-21)
### Bug fixes
Fix an issue where, when multiple transaction extenders took effect, only the highest-precedence one was actually included in the transaction.
## 6.1.1 (2022-08-03)
### Bug fixes
Fix a bug in range set span iteration that would cause decorations to be inappropriately split in some situations.
## 6.1.0 (2022-06-30)
### Bug fixes
Refine change mapping to preserve insertions made by concurrent changes.
### New features
The `enables` option to `Facet.define` may now take a function, which will be called with the facet value to create the extensions.
## 6.0.1 (2022-06-17)
### Bug fixes
Fix a problem that caused effects' `map` methods to be called with an incorrect change set when filtering changes.
## 6.0.0 (2022-06-08)
### Breaking changes
Update dependencies to 6.0.0
## 0.20.1 (2022-06-02)
### New features
`EditorView.phrase` now accepts additional arguments, which it will interpolate into the phrase in the place of `$` markers.
## 0.20.0 (2022-04-20)
### Breaking changes
The deprecated precedence names `fallback`, `extend`, and `override` were removed from the library.
### Bug fixes
Fix a bug where, if an extension value occurs multiple times, its lowest, rather than highest precedence is used.
Fix an issue where facets with computed inputs would unneccesarily have their outputs recreated on state reconfiguration.
Fix a bug in the order in which new values for state fields and facets were computed, which could cause dynamic facets to hold the wrong value in some situations.
### New features
The exports from @codemirror/rangeset now live in this package.
The exports from @codemirror/text now live in this package.
## 0.19.9 (2022-02-16)
### Bug fixes
Mapping a non-empty selection range now always puts any newly inserted text on the sides of the range outside of the mapped version.
## 0.19.8 (2022-02-15)
### Bug fixes
Fix a bug where facet values with computed inputs could incorrectly retain their old value on reconfiguration.
## 0.19.7 (2022-02-11)
### Bug fixes
Avoid recomputing facets on state reconfiguration if that facet's inputs stayed precisely the same.
Selection ranges created with `EditorSelection.range` will now have an assoc pointing at their anchor, when non-empty.
## 0.19.6 (2021-11-19)
### Bug fixes
Fix a bug that caused facet compare functions to be called with an invalid value in some situations.
Fix a bug that caused dynamic facet values to be incorrectly kept unchanged when reconfiguration changed one of their dependencies.
## 0.19.5 (2021-11-10)
### Bug fixes
Fix a bug that would cause dynamic facet values influenced by a state reconfiguration to not properly recompute.
## 0.19.4 (2021-11-05)
### Bug fixes
When reconfiguring a state, effects from the reconfiguring transaction can now be seen by newly added state fields.
## 0.19.3 (2021-11-03)
### New features
The precedence levels (under `Prec`) now have more generic names, because their 'meaningful' names were entirely inappropriate in many situations.
## 0.19.2 (2021-09-13)
### New features
The editor state now has a `readOnly` property with a matching facet to control its value.
## 0.19.1 (2021-08-15)
### Bug fixes
Fix a bug where `wordAt` never returned a useful result.
## 0.19.0 (2021-08-11)
### Breaking changes
User event strings now work differently—the events emitted by the core packages follow a different system, and hierarchical event tags can be created by separating the words with dots.
### New features
`languageDataAt` now takes an optional `side` argument to specificy which side of the position you're interested in.
It is now possible to add a user event annotation with a direct `userEvent` property on a transaction spec.
Transactions now have an `isUserEvent` method that can be used to check if it is (a subtype of) some user event type.
## 0.18.7 (2021-05-04)
### Bug fixes
Fix an issue where state fields might be initialized with a state that they aren't actually part of during reconfiguration.
## 0.18.6 (2021-04-12)
### New features
The new `EditorState.wordAt` method finds the word at a given position.
## 0.18.5 (2021-04-08)
### Bug fixes
Fix an issue in the compiled output that would break the code when minified with terser.
## 0.18.4 (2021-04-06)
### New features
The new `Transaction.remote` annotation can be used to mark and recognize transactions created by other actors.
## 0.18.3 (2021-03-23)
### New features
The `ChangeDesc` class now has `toJSON` and `fromJSON` methods.
## 0.18.2 (2021-03-14)
### Bug fixes
Fix unintended ES2020 output (the package contains ES6 code again).
## 0.18.1 (2021-03-10)
### New features
The new `Compartment.get` method can be used to get the content of a compartment in a given state.
## 0.18.0 (2021-03-03)
### Breaking changes
`tagExtension` and the `reconfigure` transaction spec property have been replaced with the concept of configuration compartments and reconfiguration effects (see `Compartment`, `StateEffect.reconfigure`, and `StateEffect.appendConfig`).
## 0.17.2 (2021-02-19)
### New features
`EditorSelection.map` and `SelectionRange.map` now take an optional second argument to indicate which direction to map to.
## 0.17.1 (2021-01-06)
### New features
The package now also exports a CommonJS module.
## 0.17.0 (2020-12-29)
### Breaking changes
First numbered release.
@@ -0,0 +1,13 @@
import Provider from "../providers/provider";
import InjectionToken from "../providers/injection-token";
import RegistrationOptions from "../types/registration-options";
/**
* Class decorator factory that allows constructor dependencies to be registered at runtime.
*
* @return {Function} The class decorator
*/
declare function registry(registrations?: ({
token: InjectionToken;
options?: RegistrationOptions;
} & Provider<any>)[]): (target: any) => any;
export default registry;
@@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.incrementPendingClassMetadataCount = incrementPendingClassMetadataCount;
const reflect_metadata_utils_1 = require("@inversifyjs/reflect-metadata-utils");
const pendingClassMetadataCountReflectKey_1 = require("../../reflectMetadata/data/pendingClassMetadataCountReflectKey");
const getDefaultPendingClassMetadataCount_1 = require("../calculations/getDefaultPendingClassMetadataCount");
function incrementPendingClassMetadataCount(type) {
return (metadata) => {
if (metadata === undefined) {
(0, reflect_metadata_utils_1.updateOwnReflectMetadata)(type, pendingClassMetadataCountReflectKey_1.pendingClassMetadataCountReflectKey, getDefaultPendingClassMetadataCount_1.getDefaultPendingClassMetadataCount, (count) => count + 1);
}
};
}
//# sourceMappingURL=incrementPendingClassMetadataCount.js.map
@@ -0,0 +1,550 @@
'use strict'
let Container = require('./container')
let Document = require('./document')
let MapGenerator = require('./map-generator')
let parse = require('./parse')
let Result = require('./result')
let Root = require('./root')
let stringify = require('./stringify')
let { isClean, my } = require('./symbols')
let warnOnce = require('./warn-once')
const TYPE_TO_CLASS_NAME = {
atrule: 'AtRule',
comment: 'Comment',
decl: 'Declaration',
document: 'Document',
root: 'Root',
rule: 'Rule'
}
const PLUGIN_PROPS = {
AtRule: true,
AtRuleExit: true,
Comment: true,
CommentExit: true,
Declaration: true,
DeclarationExit: true,
Document: true,
DocumentExit: true,
Once: true,
OnceExit: true,
postcssPlugin: true,
prepare: true,
Root: true,
RootExit: true,
Rule: true,
RuleExit: true
}
const NOT_VISITORS = {
Once: true,
postcssPlugin: true,
prepare: true
}
const CHILDREN = 0
function isPromise(obj) {
return typeof obj === 'object' && typeof obj.then === 'function'
}
function getEvents(node) {
let key = false
let type = TYPE_TO_CLASS_NAME[node.type]
if (node.type === 'decl') {
key = node.prop.toLowerCase()
} else if (node.type === 'atrule') {
key = node.name.toLowerCase()
}
if (key && node.append) {
return [
type,
type + '-' + key,
CHILDREN,
type + 'Exit',
type + 'Exit-' + key
]
} else if (key) {
return [type, type + '-' + key, type + 'Exit', type + 'Exit-' + key]
} else if (node.append) {
return [type, CHILDREN, type + 'Exit']
} else {
return [type, type + 'Exit']
}
}
function toStack(node) {
let events
if (node.type === 'document') {
events = ['Document', CHILDREN, 'DocumentExit']
} else if (node.type === 'root') {
events = ['Root', CHILDREN, 'RootExit']
} else {
events = getEvents(node)
}
return {
eventIndex: 0,
events,
iterator: 0,
node,
visitorIndex: 0,
visitors: []
}
}
function cleanMarks(node) {
node[isClean] = false
if (node.nodes) node.nodes.forEach(i => cleanMarks(i))
return node
}
let postcss = {}
class LazyResult {
get content() {
return this.stringify().content
}
get css() {
return this.stringify().css
}
get map() {
return this.stringify().map
}
get messages() {
return this.sync().messages
}
get opts() {
return this.result.opts
}
get processor() {
return this.result.processor
}
get root() {
return this.sync().root
}
get [Symbol.toStringTag]() {
return 'LazyResult'
}
constructor(processor, css, opts) {
this.stringified = false
this.processed = false
let root
if (
typeof css === 'object' &&
css !== null &&
(css.type === 'root' || css.type === 'document')
) {
root = cleanMarks(css)
} else if (css instanceof LazyResult || css instanceof Result) {
root = cleanMarks(css.root)
if (css.map) {
if (typeof opts.map === 'undefined') opts.map = {}
if (!opts.map.inline) opts.map.inline = false
opts.map.prev = css.map
}
} else {
let parser = parse
if (opts.syntax) parser = opts.syntax.parse
if (opts.parser) parser = opts.parser
if (parser.parse) parser = parser.parse
try {
root = parser(css, opts)
} catch (error) {
this.processed = true
this.error = error
}
if (root && !root[my]) {
/* c8 ignore next 2 */
Container.rebuild(root)
}
}
this.result = new Result(processor, root, opts)
this.helpers = { ...postcss, postcss, result: this.result }
this.plugins = this.processor.plugins.map(plugin => {
if (typeof plugin === 'object' && plugin.prepare) {
return { ...plugin, ...plugin.prepare(this.result) }
} else {
return plugin
}
})
}
async() {
if (this.error) return Promise.reject(this.error)
if (this.processed) return Promise.resolve(this.result)
if (!this.processing) {
this.processing = this.runAsync()
}
return this.processing
}
catch(onRejected) {
return this.async().catch(onRejected)
}
finally(onFinally) {
return this.async().then(onFinally, onFinally)
}
getAsyncError() {
throw new Error('Use process(css).then(cb) to work with async plugins')
}
handleError(error, node) {
let plugin = this.result.lastPlugin
try {
if (node) node.addToError(error)
this.error = error
if (error.name === 'CssSyntaxError' && !error.plugin) {
error.plugin = plugin.postcssPlugin
error.setMessage()
} else if (plugin.postcssVersion) {
if (process.env.NODE_ENV !== 'production') {
let pluginName = plugin.postcssPlugin
let pluginVer = plugin.postcssVersion
let runtimeVer = this.result.processor.version
let a = pluginVer.split('.')
let b = runtimeVer.split('.')
if (a[0] !== b[0] || parseInt(a[1]) > parseInt(b[1])) {
// eslint-disable-next-line no-console
console.error(
'Unknown error from PostCSS plugin. Your current PostCSS ' +
'version is ' +
runtimeVer +
', but ' +
pluginName +
' uses ' +
pluginVer +
'. Perhaps this is the source of the error below.'
)
}
}
}
} catch (err) {
/* c8 ignore next 3 */
// eslint-disable-next-line no-console
if (console && console.error) console.error(err)
}
return error
}
prepareVisitors() {
this.listeners = {}
let add = (plugin, type, cb) => {
if (!this.listeners[type]) this.listeners[type] = []
this.listeners[type].push([plugin, cb])
}
for (let plugin of this.plugins) {
if (typeof plugin === 'object') {
for (let event in plugin) {
if (!PLUGIN_PROPS[event] && /^[A-Z]/.test(event)) {
throw new Error(
`Unknown event ${event} in ${plugin.postcssPlugin}. ` +
`Try to update PostCSS (${this.processor.version} now).`
)
}
if (!NOT_VISITORS[event]) {
if (typeof plugin[event] === 'object') {
for (let filter in plugin[event]) {
if (filter === '*') {
add(plugin, event, plugin[event][filter])
} else {
add(
plugin,
event + '-' + filter.toLowerCase(),
plugin[event][filter]
)
}
}
} else if (typeof plugin[event] === 'function') {
add(plugin, event, plugin[event])
}
}
}
}
}
this.hasListener = Object.keys(this.listeners).length > 0
}
async runAsync() {
this.plugin = 0
for (let i = 0; i < this.plugins.length; i++) {
let plugin = this.plugins[i]
let promise = this.runOnRoot(plugin)
if (isPromise(promise)) {
try {
await promise
} catch (error) {
throw this.handleError(error)
}
}
}
this.prepareVisitors()
if (this.hasListener) {
let root = this.result.root
while (!root[isClean]) {
root[isClean] = true
let stack = [toStack(root)]
while (stack.length > 0) {
let promise = this.visitTick(stack)
if (isPromise(promise)) {
try {
await promise
} catch (e) {
let node = stack[stack.length - 1].node
throw this.handleError(e, node)
}
}
}
}
if (this.listeners.OnceExit) {
for (let [plugin, visitor] of this.listeners.OnceExit) {
this.result.lastPlugin = plugin
try {
if (root.type === 'document') {
let roots = root.nodes.map(subRoot =>
visitor(subRoot, this.helpers)
)
await Promise.all(roots)
} else {
await visitor(root, this.helpers)
}
} catch (e) {
throw this.handleError(e)
}
}
}
}
this.processed = true
return this.stringify()
}
runOnRoot(plugin) {
this.result.lastPlugin = plugin
try {
if (typeof plugin === 'object' && plugin.Once) {
if (this.result.root.type === 'document') {
let roots = this.result.root.nodes.map(root =>
plugin.Once(root, this.helpers)
)
if (isPromise(roots[0])) {
return Promise.all(roots)
}
return roots
}
return plugin.Once(this.result.root, this.helpers)
} else if (typeof plugin === 'function') {
return plugin(this.result.root, this.result)
}
} catch (error) {
throw this.handleError(error)
}
}
stringify() {
if (this.error) throw this.error
if (this.stringified) return this.result
this.stringified = true
this.sync()
let opts = this.result.opts
let str = stringify
if (opts.syntax) str = opts.syntax.stringify
if (opts.stringifier) str = opts.stringifier
if (str.stringify) str = str.stringify
let map = new MapGenerator(str, this.result.root, this.result.opts)
let data = map.generate()
this.result.css = data[0]
this.result.map = data[1]
return this.result
}
sync() {
if (this.error) throw this.error
if (this.processed) return this.result
this.processed = true
if (this.processing) {
throw this.getAsyncError()
}
for (let plugin of this.plugins) {
let promise = this.runOnRoot(plugin)
if (isPromise(promise)) {
throw this.getAsyncError()
}
}
this.prepareVisitors()
if (this.hasListener) {
let root = this.result.root
while (!root[isClean]) {
root[isClean] = true
this.walkSync(root)
}
if (this.listeners.OnceExit) {
if (root.type === 'document') {
for (let subRoot of root.nodes) {
this.visitSync(this.listeners.OnceExit, subRoot)
}
} else {
this.visitSync(this.listeners.OnceExit, root)
}
}
}
return this.result
}
then(onFulfilled, onRejected) {
if (process.env.NODE_ENV !== 'production') {
if (!('from' in this.opts)) {
warnOnce(
'Without `from` option PostCSS could generate wrong source map ' +
'and will not find Browserslist config. Set it to CSS file path ' +
'or to `undefined` to prevent this warning.'
)
}
}
return this.async().then(onFulfilled, onRejected)
}
toString() {
return this.css
}
visitSync(visitors, node) {
for (let [plugin, visitor] of visitors) {
this.result.lastPlugin = plugin
let promise
try {
promise = visitor(node, this.helpers)
} catch (e) {
throw this.handleError(e, node.proxyOf)
}
if (node.type !== 'root' && node.type !== 'document' && !node.parent) {
return true
}
if (isPromise(promise)) {
throw this.getAsyncError()
}
}
}
visitTick(stack) {
let visit = stack[stack.length - 1]
let { node, visitors } = visit
if (node.type !== 'root' && node.type !== 'document' && !node.parent) {
stack.pop()
return
}
if (visitors.length > 0 && visit.visitorIndex < visitors.length) {
let [plugin, visitor] = visitors[visit.visitorIndex]
visit.visitorIndex += 1
if (visit.visitorIndex === visitors.length) {
visit.visitors = []
visit.visitorIndex = 0
}
this.result.lastPlugin = plugin
try {
return visitor(node.toProxy(), this.helpers)
} catch (e) {
throw this.handleError(e, node)
}
}
if (visit.iterator !== 0) {
let iterator = visit.iterator
let child
while ((child = node.nodes[node.indexes[iterator]])) {
node.indexes[iterator] += 1
if (!child[isClean]) {
child[isClean] = true
stack.push(toStack(child))
return
}
}
visit.iterator = 0
delete node.indexes[iterator]
}
let events = visit.events
while (visit.eventIndex < events.length) {
let event = events[visit.eventIndex]
visit.eventIndex += 1
if (event === CHILDREN) {
if (node.nodes && node.nodes.length) {
node[isClean] = true
visit.iterator = node.getIterator()
}
return
} else if (this.listeners[event]) {
visit.visitors = this.listeners[event]
return
}
}
stack.pop()
}
walkSync(node) {
node[isClean] = true
let events = getEvents(node)
for (let event of events) {
if (event === CHILDREN) {
if (node.nodes) {
node.each(child => {
if (!child[isClean]) this.walkSync(child)
})
}
} else {
let visitors = this.listeners[event]
if (visitors) {
if (this.visitSync(visitors, node.toProxy())) return
}
}
}
}
warnings() {
return this.sync().warnings()
}
}
LazyResult.registerPostcss = dependant => {
postcss = dependant
}
module.exports = LazyResult
LazyResult.default = LazyResult
Root.registerLazyResult(LazyResult)
Document.registerLazyResult(LazyResult)
@@ -0,0 +1,197 @@
/*
* 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.
*/
// We must avoid a circular dependency with @react-aria/utils, and this useLayoutEffect is
// guarded by a check that it only runs on the client side.
// eslint-disable-next-line rulesdir/useLayoutEffectRule
import React, {JSX, ReactNode, useContext, useLayoutEffect, useMemo, useRef, useState} from 'react';
// To support SSR, the auto incrementing id counter is stored in a context. This allows
// it to be reset on every request to ensure the client and server are consistent.
// There is also a prefix string that is used to support async loading components
// Each async boundary must be wrapped in an SSR provider, which appends to the prefix
// and resets the current id counter. This ensures that async loaded components have
// consistent ids regardless of the loading order.
interface SSRContextValue {
prefix: string,
current: number
}
// Default context value to use in case there is no SSRProvider. This is fine for
// client-only apps. In order to support multiple copies of React Aria potentially
// being on the page at once, the prefix is set to a random number. SSRProvider
// will reset this to zero for consistency between server and client, so in the
// SSR case multiple copies of React Aria is not supported.
const defaultContext: SSRContextValue = {
prefix: String(Math.round(Math.random() * 10000000000)),
current: 0
};
const SSRContext = React.createContext<SSRContextValue>(defaultContext);
const IsSSRContext = React.createContext(false);
export interface SSRProviderProps {
/** Your application here. */
children: ReactNode
}
// This is only used in React < 18.
function LegacySSRProvider(props: SSRProviderProps): JSX.Element {
let cur = useContext(SSRContext);
let counter = useCounter(cur === defaultContext);
let [isSSR, setIsSSR] = useState(true);
let value: SSRContextValue = useMemo(() => ({
// If this is the first SSRProvider, start with an empty string prefix, otherwise
// append and increment the counter.
prefix: cur === defaultContext ? '' : `${cur.prefix}-${counter}`,
current: 0
}), [cur, counter]);
// If on the client, and the component was initially server rendered,
// then schedule a layout effect to update the component after hydration.
if (typeof document !== 'undefined') {
// This if statement technically breaks the rules of hooks, but is safe
// because the condition never changes after mounting.
// eslint-disable-next-line react-hooks/rules-of-hooks
useLayoutEffect(() => {
setIsSSR(false);
}, []);
}
return (
<SSRContext.Provider value={value}>
<IsSSRContext.Provider value={isSSR}>
{props.children}
</IsSSRContext.Provider>
</SSRContext.Provider>
);
}
let warnedAboutSSRProvider = false;
/**
* When using SSR with React Aria in React 16 or 17, applications must be wrapped in an SSRProvider.
* This ensures that auto generated ids are consistent between the client and server.
*/
export function SSRProvider(props: SSRProviderProps): JSX.Element {
if (typeof React['useId'] === 'function') {
if (process.env.NODE_ENV !== 'test' && !warnedAboutSSRProvider) {
console.warn('In React 18, SSRProvider is not necessary and is a noop. You can remove it from your app.');
warnedAboutSSRProvider = true;
}
return <>{props.children}</>;
}
return <LegacySSRProvider {...props} />;
}
let canUseDOM = Boolean(
typeof window !== 'undefined' &&
window.document &&
window.document.createElement
);
let componentIds = new WeakMap();
function useCounter(isDisabled = false) {
let ctx = useContext(SSRContext);
let ref = useRef<number | null>(null);
// eslint-disable-next-line rulesdir/pure-render
if (ref.current === null && !isDisabled) {
// In strict mode, React renders components twice, and the ref will be reset to null on the second render.
// This means our id counter will be incremented twice instead of once. This is a problem because on the
// server, components are only rendered once and so ids generated on the server won't match the client.
// In React 18, useId was introduced to solve this, but it is not available in older versions. So to solve this
// we need to use some React internals to access the underlying Fiber instance, which is stable between renders.
// This is exposed as ReactCurrentOwner in development, which is all we need since StrictMode only runs in development.
// To ensure that we only increment the global counter once, we store the starting id for this component in
// a weak map associated with the Fiber. On the second render, we reset the global counter to this value.
// Since React runs the second render immediately after the first, this is safe.
// @ts-ignore
let currentOwner = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED?.ReactCurrentOwner?.current;
if (currentOwner) {
let prevComponentValue = componentIds.get(currentOwner);
if (prevComponentValue == null) {
// On the first render, and first call to useId, store the id and state in our weak map.
componentIds.set(currentOwner, {
id: ctx.current,
state: currentOwner.memoizedState
});
} else if (currentOwner.memoizedState !== prevComponentValue.state) {
// On the second render, the memoizedState gets reset by React.
// Reset the counter, and remove from the weak map so we don't
// do this for subsequent useId calls.
ctx.current = prevComponentValue.id;
componentIds.delete(currentOwner);
}
}
// eslint-disable-next-line rulesdir/pure-render
ref.current = ++ctx.current;
}
// eslint-disable-next-line rulesdir/pure-render
return ref.current;
}
function useLegacySSRSafeId(defaultId?: string): string {
let ctx = useContext(SSRContext);
// If we are rendering in a non-DOM environment, and there's no SSRProvider,
// provide a warning to hint to the developer to add one.
if (ctx === defaultContext && !canUseDOM) {
console.warn('When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.');
}
let counter = useCounter(!!defaultId);
let prefix = ctx === defaultContext && process.env.NODE_ENV === 'test' ? 'react-aria' : `react-aria${ctx.prefix}`;
return defaultId || `${prefix}-${counter}`;
}
function useModernSSRSafeId(defaultId?: string): string {
let id = React.useId();
let [didSSR] = useState(useIsSSR());
let prefix = didSSR || process.env.NODE_ENV === 'test' ? 'react-aria' : `react-aria${defaultContext.prefix}`;
return defaultId || `${prefix}-${id}`;
}
// Use React.useId in React 18 if available, otherwise fall back to our old implementation.
/** @private */
export const useSSRSafeId = typeof React['useId'] === 'function' ? useModernSSRSafeId : useLegacySSRSafeId;
function getSnapshot() {
return false;
}
function getServerSnapshot() {
return true;
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function subscribe(onStoreChange: () => void): () => void {
// noop
return () => {};
}
/**
* Returns whether the component is currently being server side rendered or
* hydrated on the client. Can be used to delay browser-specific rendering
* until after hydration.
*/
export function useIsSSR(): boolean {
// In React 18, we can use useSyncExternalStore to detect if we're server rendering or hydrating.
if (typeof React['useSyncExternalStore'] === 'function') {
return React['useSyncExternalStore'](subscribe, getSnapshot, getServerSnapshot);
}
// eslint-disable-next-line react-hooks/rules-of-hooks
return useContext(IsSSRContext);
}
@@ -0,0 +1,4 @@
export declare function testEvents(src: string): {
events: string[];
error: unknown;
};
@@ -0,0 +1,21 @@
{
"name": "@react-types/form",
"version": "3.7.8",
"description": "Spectrum UI components in React",
"license": "Apache-2.0",
"types": "src/index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/adobe/react-spectrum"
},
"dependencies": {
"@react-types/shared": "^3.26.0"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
},
"publishConfig": {
"access": "public"
},
"gitHead": "71f0ef23053f9e03ee7e97df736e8b083e006849"
}
@@ -0,0 +1,30 @@
/**
* Read-only token
* See https://github.com/Borewit/strtok3 for more information
*/
export interface IGetToken<Value, Array extends Uint8Array = Uint8Array> {
/**
* Length of encoded token in bytes
*/
len: number;
/**
* Decode value from buffer at offset
* @param array - Uint8Array to read the decoded value from
* @param offset - Decode offset
* @return decoded value
*/
get(array: Array, offset: number): Value;
}
export interface IToken<Value, Array extends Uint8Array = Uint8Array> extends IGetToken<Value, Array> {
/**
* Encode value to buffer
* @param array - Uint8Array to write the encoded value to
* @param offset - Buffer write offset
* @param value - Value to decode of type T
* @return offset plus number of bytes written
*/
put(array: Array, offset: number, value: Value): number
}
@@ -0,0 +1,296 @@
import type { UnknownAction } from 'redux'
import type { SerializedError } from '../../src'
import {
createAction,
createAsyncThunk,
isAllOf,
isAnyOf,
isAsyncThunkAction,
isFulfilled,
isPending,
isRejected,
isRejectedWithValue,
} from '../../src'
const action: UnknownAction = { type: 'foo' }
describe('type tests', () => {
describe('isAnyOf', () => {
test('isAnyOf correctly narrows types when used with action creators', () => {
const actionA = createAction('a', () => {
return {
payload: {
prop1: 1,
prop3: 2,
},
}
})
const actionB = createAction('b', () => {
return {
payload: {
prop1: 1,
prop2: 2,
},
}
})
if (isAnyOf(actionA, actionB)(action)) {
expectTypeOf(action.payload).toHaveProperty('prop1')
expectTypeOf(action.payload).not.toHaveProperty('prop2')
expectTypeOf(action.payload).not.toHaveProperty('prop3')
}
})
test('isAnyOf correctly narrows types when used with async thunks', () => {
const asyncThunk1 = createAsyncThunk<{ prop1: number; prop3: number }>(
'asyncThunk1',
async () => {
return {
prop1: 1,
prop3: 3,
}
},
)
const asyncThunk2 = createAsyncThunk<{ prop1: number; prop2: number }>(
'asyncThunk2',
async () => {
return {
prop1: 1,
prop2: 2,
}
},
)
if (isAnyOf(asyncThunk1.fulfilled, asyncThunk2.fulfilled)(action)) {
expectTypeOf(action.payload).toHaveProperty('prop1')
expectTypeOf(action.payload).not.toHaveProperty('prop2')
expectTypeOf(action.payload).not.toHaveProperty('prop3')
}
})
test('isAnyOf correctly narrows types when used with type guards', () => {
interface ActionA {
type: 'a'
payload: {
prop1: 1
prop3: 2
}
}
interface ActionB {
type: 'b'
payload: {
prop1: 1
prop2: 2
}
}
const guardA = (v: any): v is ActionA => {
return v.type === 'a'
}
const guardB = (v: any): v is ActionB => {
return v.type === 'b'
}
if (isAnyOf(guardA, guardB)(action)) {
expectTypeOf(action.payload).toHaveProperty('prop1')
expectTypeOf(action.payload).not.toHaveProperty('prop2')
expectTypeOf(action.payload).not.toHaveProperty('prop3')
}
})
})
describe('isAllOf', () => {
interface SpecialAction {
payload: {
special: boolean
}
}
const isSpecialAction = (v: any): v is SpecialAction => {
return v.meta.isSpecial
}
test('isAllOf correctly narrows types when used with action creators and type guards', () => {
const actionA = createAction('a', () => {
return {
payload: {
prop1: 1,
prop3: 2,
},
}
})
if (isAllOf(actionA, isSpecialAction)(action)) {
expectTypeOf(action.payload).toHaveProperty('prop1')
expectTypeOf(action.payload).not.toHaveProperty('prop2')
expectTypeOf(action.payload).toHaveProperty('prop3')
expectTypeOf(action.payload).toHaveProperty('special')
}
})
test('isAllOf correctly narrows types when used with async thunks and type guards', () => {
const asyncThunk1 = createAsyncThunk<{ prop1: number; prop3: number }>(
'asyncThunk1',
async () => {
return {
prop1: 1,
prop3: 3,
}
},
)
if (isAllOf(asyncThunk1.fulfilled, isSpecialAction)(action)) {
expectTypeOf(action.payload).toHaveProperty('prop1')
expectTypeOf(action.payload).not.toHaveProperty('prop2')
expectTypeOf(action.payload).toHaveProperty('prop3')
expectTypeOf(action.payload).toHaveProperty('special')
}
})
test('isAnyOf correctly narrows types when used with type guards', () => {
interface ActionA {
type: 'a'
payload: {
prop1: 1
prop3: 2
}
}
const guardA = (v: any): v is ActionA => {
return v.type === 'a'
}
if (isAllOf(guardA, isSpecialAction)(action)) {
expectTypeOf(action.payload).toHaveProperty('prop1')
expectTypeOf(action.payload).not.toHaveProperty('prop2')
expectTypeOf(action.payload).toHaveProperty('prop3')
expectTypeOf(action.payload).toHaveProperty('special')
}
})
test('isPending correctly narrows types', () => {
if (isPending(action)) {
expectTypeOf(action.payload).toBeUndefined()
expectTypeOf(action).not.toHaveProperty('error')
}
const thunk = createAsyncThunk<string>('a', () => 'result')
if (isPending(thunk)(action)) {
expectTypeOf(action.payload).toBeUndefined()
expectTypeOf(action).not.toHaveProperty('error')
}
})
test('isRejected correctly narrows types', () => {
if (isRejected(action)) {
// might be there if rejected with payload
expectTypeOf(action.payload).toBeUnknown()
expectTypeOf(action.error).toEqualTypeOf<SerializedError>()
}
const thunk = createAsyncThunk<string>('a', () => 'result')
if (isRejected(thunk)(action)) {
// might be there if rejected with payload
expectTypeOf(action.payload).toBeUnknown()
expectTypeOf(action.error).toEqualTypeOf<SerializedError>()
}
})
test('isFulfilled correctly narrows types', () => {
if (isFulfilled(action)) {
expectTypeOf(action.payload).toBeUnknown()
expectTypeOf(action).not.toHaveProperty('error')
}
const thunk = createAsyncThunk<string>('a', () => 'result')
if (isFulfilled(thunk)(action)) {
expectTypeOf(action.payload).toBeString()
expectTypeOf(action).not.toHaveProperty('error')
}
})
test('isAsyncThunkAction correctly narrows types', () => {
if (isAsyncThunkAction(action)) {
expectTypeOf(action.payload).toBeUnknown()
// do not expect an error property because pending/fulfilled lack it
expectTypeOf(action).not.toHaveProperty('error')
}
const thunk = createAsyncThunk<string>('a', () => 'result')
if (isAsyncThunkAction(thunk)(action)) {
// we should expect the payload to be available, but of unknown type because the action may be pending/rejected
expectTypeOf(action.payload).toBeUnknown()
// do not expect an error property because pending/fulfilled lack it
expectTypeOf(action).not.toHaveProperty('error')
}
})
test('isRejectedWithValue correctly narrows types', () => {
if (isRejectedWithValue(action)) {
expectTypeOf(action.payload).toBeUnknown()
expectTypeOf(action.error).toEqualTypeOf<SerializedError>()
}
const thunk = createAsyncThunk<
string,
void,
{ rejectValue: { message: string } }
>('a', () => 'result')
if (isRejectedWithValue(thunk)(action)) {
expectTypeOf(action.payload).toEqualTypeOf({ message: '' as string })
expectTypeOf(action.error).toEqualTypeOf<SerializedError>()
}
})
})
test('matchersAcceptSpreadArguments', () => {
const thunk1 = createAsyncThunk('a', () => 'a')
const thunk2 = createAsyncThunk('b', () => 'b')
const interestingThunks = [thunk1, thunk2]
const interestingPendingThunks = interestingThunks.map(
(thunk) => thunk.pending,
)
const interestingFulfilledThunks = interestingThunks.map(
(thunk) => thunk.fulfilled,
)
const isLoading = isAnyOf(...interestingPendingThunks)
const isNotLoading = isAnyOf(...interestingFulfilledThunks)
const isAllLoading = isAllOf(...interestingPendingThunks)
})
})
@@ -0,0 +1,44 @@
var baseFindKey = require('./_baseFindKey'),
baseForOwnRight = require('./_baseForOwnRight'),
baseIteratee = require('./_baseIteratee');
/**
* This method is like `_.findKey` except that it iterates over elements of
* a collection in the opposite order.
*
* @static
* @memberOf _
* @since 2.0.0
* @category Object
* @param {Object} object The object to inspect.
* @param {Function} [predicate=_.identity] The function invoked per iteration.
* @returns {string|undefined} Returns the key of the matched element,
* else `undefined`.
* @example
*
* var users = {
* 'barney': { 'age': 36, 'active': true },
* 'fred': { 'age': 40, 'active': false },
* 'pebbles': { 'age': 1, 'active': true }
* };
*
* _.findLastKey(users, function(o) { return o.age < 40; });
* // => returns 'pebbles' assuming `_.findKey` returns 'barney'
*
* // The `_.matches` iteratee shorthand.
* _.findLastKey(users, { 'age': 36, 'active': true });
* // => 'barney'
*
* // The `_.matchesProperty` iteratee shorthand.
* _.findLastKey(users, ['active', false]);
* // => 'fred'
*
* // The `_.property` iteratee shorthand.
* _.findLastKey(users, 'active');
* // => 'pebbles'
*/
function findLastKey(object, predicate) {
return baseFindKey(object, baseIteratee(predicate, 3), baseForOwnRight);
}
module.exports = findLastKey;
@@ -0,0 +1,20 @@
import type { SchemaOptions } from '../schema/index.mjs';
import type { TSchema } from '../schema/index.mjs';
import { Kind } from '../symbols/index.mjs';
export interface RegExpOptions extends SchemaOptions {
/** The maximum length of the string */
maxLength?: number;
/** The minimum length of the string */
minLength?: number;
}
export interface TRegExp extends TSchema {
[Kind]: 'RegExp';
static: `${string}`;
type: 'RegExp';
source: string;
flags: string;
}
/** `[JavaScript]` Creates a RegExp type */
export declare function RegExp(pattern: string, options?: RegExpOptions): TRegExp;
/** `[JavaScript]` Creates a RegExp type */
export declare function RegExp(regex: RegExp, options?: RegExpOptions): TRegExp;
@@ -0,0 +1,33 @@
# contributing to `cors`
CORS is a node.js package for providing a [connect](http://www.senchalabs.org/connect/)/[express](http://expressjs.com/) middleware that can be used to enable [CORS](http://en.wikipedia.org/wiki/Cross-origin_resource_sharing) with various options. Learn more about the project in [the README](README.md).
## The CORS Spec
[http://www.w3.org/TR/cors/](http://www.w3.org/TR/cors/)
## Pull Requests Welcome
* Include `'use strict';` in every javascript file.
* 2 space indentation.
* Please run the testing steps below before submitting.
## Testing
```bash
$ npm install
$ npm test
```
## Interactive Testing Harness
[http://node-cors-client.herokuapp.com](http://node-cors-client.herokuapp.com)
Related git repositories:
* [https://github.com/TroyGoode/node-cors-server](https://github.com/TroyGoode/node-cors-server)
* [https://github.com/TroyGoode/node-cors-client](https://github.com/TroyGoode/node-cors-client)
## License
[MIT License](http://www.opensource.org/licenses/mit-license.php)
@@ -0,0 +1,3 @@
import type { ResolvedConfig } from 'vite';
export declare function getDepsCacheDir(config: ResolvedConfig, ssr: boolean): string;
export declare function flattenId(id: string): string;
@@ -0,0 +1,71 @@
{
"name": "fs-extra",
"version": "11.3.2",
"description": "fs-extra contains methods that aren't included in the vanilla Node.js fs package. Such as recursive mkdir, copy, and remove.",
"engines": {
"node": ">=14.14"
},
"homepage": "https://github.com/jprichardson/node-fs-extra",
"repository": {
"type": "git",
"url": "https://github.com/jprichardson/node-fs-extra"
},
"keywords": [
"fs",
"file",
"file system",
"copy",
"directory",
"extra",
"mkdirp",
"mkdir",
"mkdirs",
"recursive",
"json",
"read",
"write",
"extra",
"delete",
"remove",
"touch",
"create",
"text",
"output",
"move",
"promise"
],
"author": "JP Richardson <jprichardson@gmail.com>",
"license": "MIT",
"dependencies": {
"graceful-fs": "^4.2.0",
"jsonfile": "^6.0.1",
"universalify": "^2.0.0"
},
"devDependencies": {
"klaw": "^2.1.1",
"klaw-sync": "^3.0.2",
"minimist": "^1.1.1",
"mocha": "^10.1.0",
"nyc": "^15.0.0",
"proxyquire": "^2.0.1",
"read-dir-files": "^0.1.1",
"standard": "^17.0.0"
},
"main": "./lib/index.js",
"exports": {
".": "./lib/index.js",
"./esm": "./lib/esm.mjs"
},
"files": [
"lib/",
"!lib/**/__tests__/"
],
"scripts": {
"lint": "standard",
"test-find": "find ./lib/**/__tests__ -name *.test.js | xargs mocha",
"test": "npm run lint && npm run unit && npm run unit-esm",
"unit": "nyc node test.js",
"unit-esm": "node test.mjs"
},
"sideEffects": false
}
@@ -0,0 +1,45 @@
/**
* @fileoverview Warn when using template string syntax in regular strings
* @author Jeroen Engels
*/
"use strict";
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
type: "problem",
docs: {
description:
"Disallow template literal placeholder syntax in regular strings",
recommended: false,
url: "https://eslint.org/docs/latest/rules/no-template-curly-in-string",
},
schema: [],
messages: {
unexpectedTemplateExpression:
"Unexpected template string expression.",
},
},
create(context) {
const regex = /\$\{[^}]+\}/u;
return {
Literal(node) {
if (typeof node.value === "string" && regex.test(node.value)) {
context.report({
node,
messageId: "unexpectedTemplateExpression",
});
}
},
};
},
};
@@ -0,0 +1,33 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.applyDefault = applyDefault;
const deepMerge_1 = require("./deepMerge");
/**
* Pure function - doesn't mutate either parameter!
* Uses the default options and overrides with the options provided by the user
* @param defaultOptions the defaults
* @param userOptions the user opts
* @returns the options with defaults
*/
function applyDefault(defaultOptions, userOptions) {
// clone defaults
const options = structuredClone(defaultOptions);
if (userOptions == null) {
return options;
}
// For avoiding the type error
// `This expression is not callable. Type 'unknown' has no call signatures.ts(2349)`
options.forEach((opt, i) => {
// eslint-disable-next-line @typescript-eslint/internal/eqeq-nullish
if (userOptions[i] !== undefined) {
const userOpt = userOptions[i];
if ((0, deepMerge_1.isObjectNotArray)(userOpt) && (0, deepMerge_1.isObjectNotArray)(opt)) {
options[i] = (0, deepMerge_1.deepMerge)(opt, userOpt);
}
else {
options[i] = userOpt;
}
}
});
return options;
}
@@ -0,0 +1,80 @@
'use strict';
/* globals window */
var test = require('tape');
var generatorFuncs = require('make-generator-function')();
var hasToStringTag = require('has-tostringtag/shams')();
var forEach = require('for-each');
var isGeneratorFunction = require('../index');
test('returns false for non-functions', function (t) {
var nonFuncs = [
true,
false,
null,
undefined,
{},
[],
/a/g,
'string',
42,
new Date()
];
t.plan(nonFuncs.length);
forEach(nonFuncs, function (nonFunc) {
t.notOk(isGeneratorFunction(nonFunc), nonFunc + ' is not a function');
});
t.end();
});
test('returns false for non-generator functions', function (t) {
var func = function () {};
t.notOk(isGeneratorFunction(func), 'anonymous function is not an generator function');
var namedFunc = function foo() {};
t.notOk(isGeneratorFunction(namedFunc), 'named function is not an generator function');
if (typeof window === 'undefined') {
t.skip('window.alert is not an generator function');
} else {
t.notOk(isGeneratorFunction(window.alert), 'window.alert is not an generator function');
}
t.end();
});
var fakeToString = function () { return 'function* () { return "TOTALLY REAL I SWEAR!"; }'; };
test('returns false for non-generator function with faked toString', function (t) {
var func = function () {};
func.toString = fakeToString;
t.notEqual(String(func), Function.prototype.toString.apply(func), 'faked toString is not real toString');
t.notOk(isGeneratorFunction(func), 'anonymous function with faked toString is not a generator function');
t.end();
});
test('returns false for non-generator function with faked @@toStringTag', { skip: !hasToStringTag || generatorFuncs.length === 0 }, function (t) {
var generatorFunc = generatorFuncs[0];
/** @type {{ toString(): unknown; valueOf(): unknown; [Symbol.toStringTag]?: unknown; }} */
var fakeGenFunction = {
toString: function () { return String(generatorFunc); },
valueOf: function () { return generatorFunc; }
};
fakeGenFunction[Symbol.toStringTag] = 'GeneratorFunction';
t.notOk(isGeneratorFunction(fakeGenFunction), 'fake GeneratorFunction with @@toStringTag "GeneratorFunction" is not a generator function');
t.end();
});
test('returns true for generator functions', function (t) {
if (generatorFuncs.length > 0) {
forEach(generatorFuncs, function (generatorFunc) {
t.ok(isGeneratorFunction(generatorFunc), generatorFunc + ' is generator function');
});
} else {
t.skip('generator function is generator function - this environment does not support ES6 generator functions. Please run `node --harmony`, or use a supporting browser.');
}
t.end();
});
@@ -0,0 +1 @@
{"mappings":";;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;AAmCM,SAAS,0CAAgB,KAA4B,EAAE,KAA0B,EAAE,GAAkC;IAC1H,IAAI,gBAAC,YAAY,iBAAE,aAAa,EAAC,GAAG,CAAA,GAAA,yCAAS,EAAE;QAC7C,GAAG,KAAK;QACR,QAAQ,MAAM,MAAM;QACpB,SAAS,MAAM,KAAK;IACtB,GAAG;IAEH,CAAA,GAAA,yCAAe,EAAE;QACf,YAAY,CAAC,MAAM,MAAM;IAC3B;IAEA,CAAA,GAAA,yCAAqB;IAErB,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,MAAM,MAAM,IAAI,IAAI,OAAO,EAC7B,OAAO,CAAA,GAAA,yCAAc,EAAE;YAAC,IAAI,OAAO;SAAC,EAAE;YAAC,gBAAgB;QAAI;IAE/D,GAAG;QAAC,MAAM,MAAM;QAAE;KAAI;IAEtB,OAAO;QACL,YAAY,CAAA,GAAA,iBAAS,EAAE;uBACvB;IACF;AACF","sources":["packages/@react-aria/overlays/src/useModalOverlay.ts"],"sourcesContent":["/*\n * Copyright 2022 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 {ariaHideOutside} from './ariaHideOutside';\nimport {AriaOverlayProps, useOverlay} from './useOverlay';\nimport {DOMAttributes, RefObject} from '@react-types/shared';\nimport {mergeProps} from '@react-aria/utils';\nimport {OverlayTriggerState} from '@react-stately/overlays';\nimport {useEffect} from 'react';\nimport {useOverlayFocusContain} from './Overlay';\nimport {usePreventScroll} from './usePreventScroll';\n\nexport interface AriaModalOverlayProps extends Pick<AriaOverlayProps, 'shouldCloseOnInteractOutside'> {\n /**\n * Whether to close the modal when the user interacts outside it.\n * @default false\n */\n isDismissable?: boolean,\n /**\n * Whether pressing the escape key to close the modal should be disabled.\n * @default false\n */\n isKeyboardDismissDisabled?: boolean\n}\n\nexport interface ModalOverlayAria {\n /** Props for the modal element. */\n modalProps: DOMAttributes,\n /** Props for the underlay element. */\n underlayProps: DOMAttributes\n}\n\n/**\n * Provides the behavior and accessibility implementation for a modal component.\n * A modal is an overlay element which blocks interaction with elements outside it.\n */\nexport function useModalOverlay(props: AriaModalOverlayProps, state: OverlayTriggerState, ref: RefObject<HTMLElement | null>): ModalOverlayAria {\n let {overlayProps, underlayProps} = useOverlay({\n ...props,\n isOpen: state.isOpen,\n onClose: state.close\n }, ref);\n\n usePreventScroll({\n isDisabled: !state.isOpen\n });\n\n useOverlayFocusContain();\n\n useEffect(() => {\n if (state.isOpen && ref.current) {\n return ariaHideOutside([ref.current], {shouldUseInert: true});\n }\n }, [state.isOpen, ref]);\n\n return {\n modalProps: mergeProps(overlayProps),\n underlayProps\n };\n}\n"],"names":[],"version":3,"file":"useModalOverlay.module.js.map"}
@@ -0,0 +1,111 @@
import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'
import { configureStore, createSelector } from '@reduxjs/toolkit'
describe('type tests', () => {
test('buildSelector type test', () => {
interface Todo {
userId: number
id: number
title: string
completed: boolean
}
type Todos = Array<Todo>
const exampleApi = createApi({
reducerPath: 'api',
baseQuery: fetchBaseQuery({
baseUrl: 'https://jsonplaceholder.typicode.com',
}),
endpoints: (build) => ({
getTodos: build.query<Todos, string>({
query: () => '/todos',
}),
}),
})
const exampleQuerySelector = exampleApi.endpoints.getTodos.select('/')
const todosSelector = createSelector(
[exampleQuerySelector],
(queryState) => {
return queryState?.data?.[0] ?? ({} as Todo)
},
)
const firstTodoTitleSelector = createSelector(
[todosSelector],
(todo) => todo?.title,
)
const store = configureStore({
reducer: {
[exampleApi.reducerPath]: exampleApi.reducer,
other: () => 1,
},
})
const todoTitle = firstTodoTitleSelector(store.getState())
// This only compiles if we carried the types through
const upperTitle = todoTitle.toUpperCase()
expectTypeOf(upperTitle).toBeString()
})
test('selectCachedArgsForQuery type test', () => {
interface Todo {
userId: number
id: number
title: string
completed: boolean
}
type Todos = Array<Todo>
const exampleApi = createApi({
reducerPath: 'api',
baseQuery: fetchBaseQuery({
baseUrl: 'https://jsonplaceholder.typicode.com',
}),
endpoints: (build) => ({
getTodos: build.query<Todos, string>({
query: () => '/todos',
}),
getInfiniteTodos: build.infiniteQuery<Todos, string, number>({
infiniteQueryOptions: {
initialPageParam: 0,
maxPages: 3,
getNextPageParam: (
lastPage,
allPages,
lastPageParam,
allPageParams,
) => lastPageParam + 1,
},
query({ pageParam }) {
return `/todos?page=${pageParam}`
},
}),
}),
})
const store = configureStore({
reducer: {
[exampleApi.reducerPath]: exampleApi.reducer,
other: () => 1,
},
})
expectTypeOf(
exampleApi.util.selectCachedArgsForQuery(store.getState(), 'getTodos'),
).toEqualTypeOf<string[]>()
expectTypeOf(
exampleApi.util.selectCachedArgsForQuery(
store.getState(),
'getInfiniteTodos',
),
).toEqualTypeOf<string[]>()
})
})
@@ -0,0 +1,85 @@
import * as _heroui_system from '@heroui/system';
import { HTMLHeroUIProps, PropGetter } from '@heroui/system';
import { SlotsToClasses, TabsSlots, TabsVariantProps, TabsReturnType } from '@heroui/theme';
import { ReactRef } from '@heroui/react-utils';
import { RefObject } from 'react';
import { TabListStateOptions, TabListState } from '@react-stately/tabs';
import { AriaTabListProps } from '@react-aria/tabs';
import { CollectionProps } from '@heroui/aria-utils';
import { HTMLMotionProps } from 'framer-motion';
interface Props extends Omit<HTMLHeroUIProps, "children"> {
/**
* Ref to the DOM node.
*/
ref?: ReactRef<HTMLElement | null>;
/**
* The props to modify the cursor motion animation. Use the `variants` API to create your own animation.
*/
motionProps?: HTMLMotionProps<"span">;
/**
* Whether the tabs selection should occur on press up instead of press down.
* @default true
*/
shouldSelectOnPressUp?: boolean;
/**
* Whether the cursor should be hidden.
* @default false
*/
disableCursorAnimation?: boolean;
/**
* Classname or List of classes to change the classNames of the element.
* if `className` is passed, it will be added to the base slot.
*
* @example
* ```ts
* <Tabs classNames={{
* base:"base-classes", // main wrapper (tabs + panels)
* tabList: "tab-list-classes", // tabs wrapper
* tab: "tab-classes", // tab item
* panel: "panel-classes", // tab panel
* }} />
* ``
*/
classNames?: SlotsToClasses<TabsSlots>;
/**
* The position of the tabs.
* @default 'top'
*/
placement?: "top" | "bottom" | "start" | "end";
/**
* Whether the tabs are vertical it will invalidate the placement prop when the value is true.
* @default false
*/
isVertical?: boolean;
/**
* Whether to destroy inactive tab panel when switching tabs. Inactive tab panels are inert and cannot be interacted with.
* @default true
*/
destroyInactiveTabPanel?: boolean;
}
type UseTabsProps<T> = Props & TabsVariantProps & Omit<TabListStateOptions<T>, "children" | keyof AriaTabListProps<T>> & Omit<AriaTabListProps<T>, "children" | "orientation"> & CollectionProps<T>;
type ValuesType<T = object> = {
state: TabListState<T>;
slots: TabsReturnType;
disableCursorAnimation?: boolean;
listRef?: RefObject<HTMLElement>;
shouldSelectOnPressUp?: boolean;
classNames?: SlotsToClasses<TabsSlots>;
motionProps?: HTMLMotionProps<"span">;
disableAnimation?: boolean;
isDisabled?: boolean;
};
declare function useTabs<T extends object>(originalProps: UseTabsProps<T>): {
Component: _heroui_system.As<any>;
domRef: RefObject<HTMLElement>;
state: TabListState<T>;
values: ValuesType<T>;
destroyInactiveTabPanel: boolean;
getBaseProps: PropGetter<Record<string, unknown>, _heroui_system.DOMAttributes<_heroui_system.DOMElement>>;
getTabListProps: PropGetter<Record<string, unknown>, _heroui_system.DOMAttributes<_heroui_system.DOMElement>>;
getWrapperProps: PropGetter<Record<string, unknown>, _heroui_system.DOMAttributes<_heroui_system.DOMElement>>;
};
type UseTabsReturn = ReturnType<typeof useTabs>;
export { Props, UseTabsProps, UseTabsReturn, ValuesType, useTabs };
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"K D E F A B wC"},B:{"1":"0 1 2 3 4 5 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","2":"C L M G N O P"},C:{"1":"0 1 2 3 4 5 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":"6 7 8 9 xC TC J ZB K D E F A B C L M 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 0C 1C"},D:{"1":"0 1 2 3 4 5 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":"6 7 8 9 J ZB K D E F A B C L M G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB"},E:{"1":"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 K D E F A B C L M G 2C ZC 3C 4C 5C 6C aC NC OC 7C 8C 9C bC cC PC AD"},F:{"1":"0 1 2 3 4 5 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":"6 7 8 9 F B C G N O P aB AB BB CB DB EB FB FD GD HD ID NC uC JD OC"},G:{"1":"QC dC eC fC gC hC fD RC iC jC kC lC mC gD SC nC oC pC qC rC sC tC","2":"E ZC KD vC LD MD ND OD PD QD RD SD TD UD VD WD XD YD ZD aD bD cD dD bC cC PC eD"},H:{"2":"hD"},I:{"2":"TC J I iD jD kD lD vC mD nD"},J:{"2":"D A"},K:{"1":"H","2":"A B C NC uC OC"},L:{"1":"I"},M:{"1":"MC"},N:{"2":"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:5,C:"Permissions API",D:true};
@@ -0,0 +1,21 @@
// src/text.ts
var safeText = (text) => {
if ((text == null ? void 0 : text.length) <= 4)
return text;
return text == null ? void 0 : text.slice(0, 3);
};
var safeAriaLabel = (...texts) => {
let ariaLabel = " ";
for (const text of texts) {
if (typeof text === "string" && text.length > 0) {
ariaLabel = text;
break;
}
}
return ariaLabel;
};
export {
safeText,
safeAriaLabel
};
@@ -0,0 +1,60 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _state = require('../tokenizer/state'); var _state2 = _interopRequireDefault(_state);
var _charcodes = require('../util/charcodes');
exports.isJSXEnabled;
exports.isTypeScriptEnabled;
exports.isFlowEnabled;
exports.state;
exports.input;
exports.nextContextId;
function getNextContextId() {
return exports.nextContextId++;
} exports.getNextContextId = getNextContextId;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function augmentError(error) {
if ("pos" in error) {
const loc = locationForIndex(error.pos);
error.message += ` (${loc.line}:${loc.column})`;
error.loc = loc;
}
return error;
} exports.augmentError = augmentError;
class Loc {
constructor(line, column) {
this.line = line;
this.column = column;
}
} exports.Loc = Loc;
function locationForIndex(pos) {
let line = 1;
let column = 1;
for (let i = 0; i < pos; i++) {
if (exports.input.charCodeAt(i) === _charcodes.charCodes.lineFeed) {
line++;
column = 1;
} else {
column++;
}
}
return new Loc(line, column);
} exports.locationForIndex = locationForIndex;
function initParser(
inputCode,
isJSXEnabledArg,
isTypeScriptEnabledArg,
isFlowEnabledArg,
) {
exports.input = inputCode;
exports.state = new (0, _state2.default)();
exports.nextContextId = 1;
exports.isJSXEnabled = isJSXEnabledArg;
exports.isTypeScriptEnabled = isTypeScriptEnabledArg;
exports.isFlowEnabled = isFlowEnabledArg;
} exports.initParser = initParser;
@@ -0,0 +1 @@
{"version":3,"file":"updateMetadataTag.js","sourceRoot":"","sources":["../../../../src/metadata/actions/updateMetadataTag.ts"],"names":[],"mappings":";;AAMA,8CAoBC;AA1BD,8EAA2E;AAC3E,sFAAmF;AAKnF,SAAgB,iBAAiB,CAC/B,GAAgB,EAChB,KAAc;IAId,OAAO,CACL,QAAwE,EACR,EAAE;QAClE,IAAI,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YAC3B,MAAM,IAAI,uCAAkB,CAC1B,+CAAsB,CAAC,0BAA0B,EACjD,uDAAuD,CACxD,CAAC;QACJ,CAAC;QAED,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAE9B,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,22 @@
(The MIT license)
Copyright (c) 2015 Titus Wormer <tituswormer@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1 @@
{"version":3,"names":["_browserslist","require","_helperValidatorOption","_lruCache","_utils","_targets","_options","_pretty","_debug","_filterItems","browserModulesData","ESM_SUPPORT","v","OptionValidator","validateTargetNames","targets","validTargets","Object","keys","TargetNames","target","Error","formatMessage","findSuggestion","isBrowsersQueryValid","browsers","Array","isArray","every","b","validateBrowsers","invariant","undefined","String","getLowestVersions","reduce","all","browser","browserName","browserVersion","split","browserNameMap","splitVersion","toLowerCase","isSplitUnreleased","isUnreleasedVersion","semverify","version","isUnreleased","getLowestUnreleased","parsedBrowserVersion","semverMin","_","outputDecimalWarning","decimalTargets","length","console","warn","forEach","value","semverifyTarget","nodeTargetParser","parsed","process","versions","node","defaultTargetParser","generateTargets","inputTargets","input","assign","esmodules","resolveTargets","queries","env","resolved","browserslist","mobileToDesktop","targetsCache","LruCache","max","resolveTargetsCached","cacheKey","join","cached","get","set","getTargets","options","_browsers","_browsers2","configPath","onBrowserslistConfigFound","shouldParseBrowsers","hasTargets","shouldSearchForConfig","ignoreBrowserslistConfig","BROWSERSLIST","configFile","BROWSERSLIST_CONFIG","findConfigFile","loadConfig","config","browserslistEnv","map","queryBrowsers","esmSupportVersion","getHighestUnreleased","result","decimalWarnings","sort","push","parsedTarget","parsedValue"],"sources":["../src/index.ts"],"sourcesContent":["import browserslist from \"browserslist\";\nimport { findSuggestion } from \"@babel/helper-validator-option\";\nimport browserModulesData from \"@babel/compat-data/native-modules\" with { type: \"json\" };\nimport LruCache from \"lru-cache\";\n\nimport {\n semverify,\n semverMin,\n isUnreleasedVersion,\n getLowestUnreleased,\n getHighestUnreleased,\n} from \"./utils.ts\";\nimport { OptionValidator } from \"@babel/helper-validator-option\";\nimport { browserNameMap } from \"./targets.ts\";\nimport { TargetNames } from \"./options.ts\";\nimport type {\n Target,\n Targets,\n InputTargets,\n Browsers,\n BrowserslistBrowserName,\n TargetsTuple,\n} from \"./types.d.ts\";\n\nexport type { Target, Targets, InputTargets };\n\nexport { prettifyTargets } from \"./pretty.ts\";\nexport { getInclusionReasons } from \"./debug.ts\";\nexport { default as filterItems, isRequired } from \"./filter-items.ts\";\nexport { unreleasedLabels } from \"./targets.ts\";\nexport { TargetNames };\n\nconst ESM_SUPPORT = browserModulesData[\"es6.module\"];\n\nconst v = new OptionValidator(PACKAGE_JSON.name);\n\nfunction validateTargetNames(targets: Targets): TargetsTuple {\n const validTargets = Object.keys(TargetNames);\n for (const target of Object.keys(targets)) {\n if (!(target in TargetNames)) {\n throw new Error(\n v.formatMessage(`'${target}' is not a valid target\n- Did you mean '${findSuggestion(target, validTargets)}'?`),\n );\n }\n }\n\n return targets;\n}\n\nexport function isBrowsersQueryValid(browsers: unknown): boolean {\n return (\n typeof browsers === \"string\" ||\n (Array.isArray(browsers) && browsers.every(b => typeof b === \"string\"))\n );\n}\n\nfunction validateBrowsers(browsers: Browsers | undefined) {\n v.invariant(\n browsers === undefined || isBrowsersQueryValid(browsers),\n `'${String(browsers)}' is not a valid browserslist query`,\n );\n\n return browsers;\n}\n\nfunction getLowestVersions(browsers: Array<string>): Targets {\n return browsers.reduce(\n (all, browser) => {\n const [browserName, browserVersion] = browser.split(\" \") as [\n BrowserslistBrowserName,\n string,\n ];\n const target = browserNameMap[browserName];\n\n if (!target) {\n return all;\n }\n\n try {\n // Browser version can return as \"10.0-10.2\"\n const splitVersion = browserVersion.split(\"-\")[0].toLowerCase();\n const isSplitUnreleased = isUnreleasedVersion(splitVersion, target);\n\n if (!all[target]) {\n all[target] = isSplitUnreleased\n ? splitVersion\n : semverify(splitVersion);\n return all;\n }\n\n const version = all[target];\n const isUnreleased = isUnreleasedVersion(version, target);\n\n if (isUnreleased && isSplitUnreleased) {\n all[target] = getLowestUnreleased(version, splitVersion, target);\n } else if (isUnreleased) {\n all[target] = semverify(splitVersion);\n } else if (!isUnreleased && !isSplitUnreleased) {\n const parsedBrowserVersion = semverify(splitVersion);\n\n all[target] = semverMin(version, parsedBrowserVersion);\n }\n } catch (_) {}\n\n return all;\n },\n {} as Record<Target, string>,\n );\n}\n\nfunction outputDecimalWarning(\n decimalTargets: Array<{ target: string; vLine truncated
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"K D E F A B wC"},B:{"1":"0 1 2 3 4 5 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","2":"C L M G","132":"N O P"},C:{"1":"0 1 2 3 4 5 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":"6 7 8 9 xC TC J ZB K D E F A B C L M 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 0C 1C"},D:{"1":"0 1 2 3 4 5 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":"6 7 8 9 J ZB K D E F A B C L M 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","132":"2B 3B UC"},E:{"1":"B C L M G 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 K D E F A 2C ZC 3C 4C 5C 6C","132":"aC"},F:{"1":"0 1 2 3 4 5 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":"6 7 8 9 F B C 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 FD GD HD ID NC uC JD OC","132":"pB qB rB"},G:{"1":"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":"E ZC KD vC LD MD ND OD PD QD RD","132":"SD"},H:{"2":"hD"},I:{"1":"I","2":"TC J iD jD kD lD vC mD nD"},J:{"2":"D A"},K:{"1":"H","2":"A B C NC uC OC"},L:{"1":"I"},M:{"1":"MC"},N:{"2":"A B"},O:{"1":"PC"},P:{"1":"6 7 8 9 AB BB CB DB EB FB rD sD aC tD uD vD wD xD QC RC SC yD","2":"J oD pD","132":"qD"},Q:{"1":"zD"},R:{"1":"0D"},S:{"1":"2D","132":"1D"}},B:5,C:"CSS justify-content: space-evenly",D:true};
@@ -0,0 +1,238 @@
import isBrowser from './utils/isBrowser.js';
import throttle from './utils/throttle.js';
// Minimum delay before invoking the update of observers.
const REFRESH_DELAY = 20;
// A list of substrings of CSS properties used to find transition events that
// might affect dimensions of observed elements.
const transitionKeys = ['top', 'right', 'bottom', 'left', 'width', 'height', 'size', 'weight'];
// Check if MutationObserver is available.
const mutationObserverSupported = typeof MutationObserver !== 'undefined';
/**
* Singleton controller class which handles updates of ResizeObserver instances.
*/
export default class ResizeObserverController {
/**
* Indicates whether DOM listeners have been added.
*
* @private {boolean}
*/
connected_ = false;
/**
* Tells that controller has subscribed for Mutation Events.
*
* @private {boolean}
*/
mutationEventsAdded_ = false;
/**
* Keeps reference to the instance of MutationObserver.
*
* @private {MutationObserver}
*/
mutationsObserver_ = null;
/**
* A list of connected observers.
*
* @private {Array<ResizeObserverSPI>}
*/
observers_ = [];
/**
* Holds reference to the controller's instance.
*
* @private {ResizeObserverController}
*/
static instance_ = null;
/**
* Creates a new instance of ResizeObserverController.
*
* @private
*/
constructor() {
this.onTransitionEnd_ = this.onTransitionEnd_.bind(this);
this.refresh = throttle(this.refresh.bind(this), REFRESH_DELAY);
}
/**
* Adds observer to observers list.
*
* @param {ResizeObserverSPI} observer - Observer to be added.
* @returns {void}
*/
addObserver(observer) {
if (!~this.observers_.indexOf(observer)) {
this.observers_.push(observer);
}
// Add listeners if they haven't been added yet.
if (!this.connected_) {
this.connect_();
}
}
/**
* Removes observer from observers list.
*
* @param {ResizeObserverSPI} observer - Observer to be removed.
* @returns {void}
*/
removeObserver(observer) {
const observers = this.observers_;
const index = observers.indexOf(observer);
// Remove observer if it's present in registry.
if (~index) {
observers.splice(index, 1);
}
// Remove listeners if controller has no connected observers.
if (!observers.length && this.connected_) {
this.disconnect_();
}
}
/**
* Invokes the update of observers. It will continue running updates insofar
* it detects changes.
*
* @returns {void}
*/
refresh() {
const changesDetected = this.updateObservers_();
// Continue running updates if changes have been detected as there might
// be future ones caused by CSS transitions.
if (changesDetected) {
this.refresh();
}
}
/**
* Updates every observer from observers list and notifies them of queued
* entries.
*
* @private
* @returns {boolean} Returns "true" if any observer has detected changes in
* dimensions of it's elements.
*/
updateObservers_() {
// Collect observers that have active observations.
const activeObservers = this.observers_.filter(observer => {
return observer.gatherActive(), observer.hasActive();
});
// Deliver notifications in a separate cycle in order to avoid any
// collisions between observers, e.g. when multiple instances of
// ResizeObserver are tracking the same element and the callback of one
// of them changes content dimensions of the observed target. Sometimes
// this may result in notifications being blocked for the rest of observers.
activeObservers.forEach(observer => observer.broadcastActive());
return activeObservers.length > 0;
}
/**
* Initializes DOM listeners.
*
* @private
* @returns {void}
*/
connect_() {
// Do nothing if running in a non-browser environment or if listeners
// have been already added.
if (!isBrowser || this.connected_) {
return;
}
// Subscription to the "Transitionend" event is used as a workaround for
// delayed transitions. This way it's possible to capture at least the
// final state of an element.
document.addEventListener('transitionend', this.onTransitionEnd_);
window.addEventListener('resize', this.refresh);
if (mutationObserverSupported) {
this.mutationsObserver_ = new MutationObserver(this.refresh);
this.mutationsObserver_.observe(document, {
attributes: true,
childList: true,
characterData: true,
subtree: true
});
} else {
document.addEventListener('DOMSubtreeModified', this.refresh);
this.mutationEventsAdded_ = true;
}
this.connected_ = true;
}
/**
* Removes DOM listeners.
*
* @private
* @returns {void}
*/
disconnect_() {
// Do nothing if running in a non-browser environment or if listeners
// have been already removed.
if (!isBrowser || !this.connected_) {
return;
}
document.removeEventListener('transitionend', this.onTransitionEnd_);
window.removeEventListener('resize', this.refresh);
if (this.mutationsObserver_) {
this.mutationsObserver_.disconnect();
}
if (this.mutationEventsAdded_) {
document.removeEventListener('DOMSubtreeModified', this.refresh);
}
this.mutationsObserver_ = null;
this.mutationEventsAdded_ = false;
this.connected_ = false;
}
/**
* "Transitionend" event handler.
*
* @private
* @param {TransitionEvent} event
* @returns {void}
*/
onTransitionEnd_({propertyName = ''}) {
// Detect whether transition may affect dimensions of an element.
const isReflowProperty = transitionKeys.some(key => {
return !!~propertyName.indexOf(key);
});
if (isReflowProperty) {
this.refresh();
}
}
/**
* Returns instance of the ResizeObserverController.
*
* @returns {ResizeObserverController}
*/
static getInstance() {
if (!this.instance_) {
this.instance_ = new ResizeObserverController();
}
return this.instance_;
}
}
@@ -0,0 +1,11 @@
import { OneBotAction } from '../OneBotAction';
export declare class BotExit extends OneBotAction<void, void> {
actionName: "bot_exit";
payloadSchema: import("@sinclair/typebox").TObject<{}>;
returnSchema: import("@sinclair/typebox").TObject<{}>;
actionSummary: string;
actionTags: string[];
payloadExample: {};
returnExample: null;
_handle(): Promise<void>;
}
@@ -0,0 +1,13 @@
export declare enum DefinitionType {
CatchClause = "CatchClause",
ClassName = "ClassName",
FunctionName = "FunctionName",
ImplicitGlobalVariable = "ImplicitGlobalVariable",
ImportBinding = "ImportBinding",
Parameter = "Parameter",
TSEnumName = "TSEnumName",
TSEnumMember = "TSEnumMemberName",
TSModuleName = "TSModuleName",
Type = "Type",
Variable = "Variable"
}
@@ -0,0 +1,144 @@
import {focusWithoutScrolling as $7215afc6de606d6b$export$de79e2c695e052f3} from "./focusWithoutScrolling.module.js";
import {isMac as $c87311424ea30a05$export$9ac100e40613ea10, isWebKit as $c87311424ea30a05$export$78551043582a6a98, isFirefox as $c87311424ea30a05$export$b7d78993b74f766d, isIPad as $c87311424ea30a05$export$7bef049ce92e4224} from "./platform.module.js";
import $g3jFn$react, {createContext as $g3jFn$createContext, useMemo as $g3jFn$useMemo, useContext as $g3jFn$useContext} from "react";
/*
* Copyright 2023 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.
*/
const $ea8dcbcb9ea1b556$var$RouterContext = /*#__PURE__*/ (0, $g3jFn$createContext)({
isNative: true,
open: $ea8dcbcb9ea1b556$var$openSyntheticLink,
useHref: (href)=>href
});
function $ea8dcbcb9ea1b556$export$323e4fc2fa4753fb(props) {
let { children: children, navigate: navigate, useHref: useHref } = props;
let ctx = (0, $g3jFn$useMemo)(()=>({
isNative: false,
open: (target, modifiers, href, routerOptions)=>{
$ea8dcbcb9ea1b556$var$getSyntheticLink(target, (link)=>{
if ($ea8dcbcb9ea1b556$export$efa8c9099e530235(link, modifiers)) navigate(href, routerOptions);
else $ea8dcbcb9ea1b556$export$95185d699e05d4d7(link, modifiers);
});
},
useHref: useHref || ((href)=>href)
}), [
navigate,
useHref
]);
return /*#__PURE__*/ (0, $g3jFn$react).createElement($ea8dcbcb9ea1b556$var$RouterContext.Provider, {
value: ctx
}, children);
}
function $ea8dcbcb9ea1b556$export$9a302a45f65d0572() {
return (0, $g3jFn$useContext)($ea8dcbcb9ea1b556$var$RouterContext);
}
function $ea8dcbcb9ea1b556$export$efa8c9099e530235(link, modifiers) {
// Use getAttribute here instead of link.target. Firefox will default link.target to "_parent" when inside an iframe.
let target = link.getAttribute('target');
return (!target || target === '_self') && link.origin === location.origin && !link.hasAttribute('download') && !modifiers.metaKey && // open in new tab (mac)
!modifiers.ctrlKey && // open in new tab (windows)
!modifiers.altKey && // download
!modifiers.shiftKey;
}
function $ea8dcbcb9ea1b556$export$95185d699e05d4d7(target, modifiers, setOpening = true) {
var _window_event_type, _window_event;
let { metaKey: metaKey, ctrlKey: ctrlKey, altKey: altKey, shiftKey: shiftKey } = modifiers;
// Firefox does not recognize keyboard events as a user action by default, and the popup blocker
// will prevent links with target="_blank" from opening. However, it does allow the event if the
// Command/Control key is held, which opens the link in a background tab. This seems like the best we can do.
// See https://bugzilla.mozilla.org/show_bug.cgi?id=257870 and https://bugzilla.mozilla.org/show_bug.cgi?id=746640.
if ((0, $c87311424ea30a05$export$b7d78993b74f766d)() && ((_window_event = window.event) === null || _window_event === void 0 ? void 0 : (_window_event_type = _window_event.type) === null || _window_event_type === void 0 ? void 0 : _window_event_type.startsWith('key')) && target.target === '_blank') {
if ((0, $c87311424ea30a05$export$9ac100e40613ea10)()) metaKey = true;
else ctrlKey = true;
}
// WebKit does not support firing click events with modifier keys, but does support keyboard events.
// https://github.com/WebKit/WebKit/blob/c03d0ac6e6db178f90923a0a63080b5ca210d25f/Source/WebCore/html/HTMLAnchorElement.cpp#L184
let event = (0, $c87311424ea30a05$export$78551043582a6a98)() && (0, $c87311424ea30a05$export$9ac100e40613ea10)() && !(0, $c87311424ea30a05$export$7bef049ce92e4224)() && true ? new KeyboardEvent('keydown', {
keyIdentifier: 'Enter',
metaKey: metaKey,
ctrlKey: ctrlKey,
altKey: altKey,
shiftKey: shiftKey
}) : new MouseEvent('click', {
metaKey: metaKey,
ctrlKey: ctrlKey,
altKey: altKey,
shiftKey: shiftKey,
bubbles: true,
cancelable: true
});
$ea8dcbcb9ea1b556$export$95185d699e05d4d7.isOpening = setOpening;
(0, $7215afc6de606d6b$export$de79e2c695e052f3)(target);
target.dispatchEvent(event);
$ea8dcbcb9ea1b556$export$95185d699e05d4d7.isOpening = false;
}
// https://github.com/parcel-bundler/parcel/issues/8724
$ea8dcbcb9ea1b556$export$95185d699e05d4d7.isOpening = false;
function $ea8dcbcb9ea1b556$var$getSyntheticLink(target, open) {
if (target instanceof HTMLAnchorElement) open(target);
else if (target.hasAttribute('data-href')) {
let link = document.createElement('a');
link.href = target.getAttribute('data-href');
if (target.hasAttribute('data-target')) link.target = target.getAttribute('data-target');
if (target.hasAttribute('data-rel')) link.rel = target.getAttribute('data-rel');
if (target.hasAttribute('data-download')) link.download = target.getAttribute('data-download');
if (target.hasAttribute('data-ping')) link.ping = target.getAttribute('data-ping');
if (target.hasAttribute('data-referrer-policy')) link.referrerPolicy = target.getAttribute('data-referrer-policy');
target.appendChild(link);
open(link);
target.removeChild(link);
}
}
function $ea8dcbcb9ea1b556$var$openSyntheticLink(target, modifiers) {
$ea8dcbcb9ea1b556$var$getSyntheticLink(target, (link)=>$ea8dcbcb9ea1b556$export$95185d699e05d4d7(link, modifiers));
}
function $ea8dcbcb9ea1b556$export$bdc77b0c0a3a85d6(props) {
let router = $ea8dcbcb9ea1b556$export$9a302a45f65d0572();
var _props_href;
const href = router.useHref((_props_href = props.href) !== null && _props_href !== void 0 ? _props_href : '');
return {
'data-href': props.href ? href : undefined,
'data-target': props.target,
'data-rel': props.rel,
'data-download': props.download,
'data-ping': props.ping,
'data-referrer-policy': props.referrerPolicy
};
}
function $ea8dcbcb9ea1b556$export$51437d503373d223(props) {
return {
'data-href': props.href,
'data-target': props.target,
'data-rel': props.rel,
'data-download': props.download,
'data-ping': props.ping,
'data-referrer-policy': props.referrerPolicy
};
}
function $ea8dcbcb9ea1b556$export$7e924b3091a3bd18(props) {
let router = $ea8dcbcb9ea1b556$export$9a302a45f65d0572();
var _props_href;
const href = router.useHref((_props_href = props === null || props === void 0 ? void 0 : props.href) !== null && _props_href !== void 0 ? _props_href : '');
return {
href: (props === null || props === void 0 ? void 0 : props.href) ? href : undefined,
target: props === null || props === void 0 ? void 0 : props.target,
rel: props === null || props === void 0 ? void 0 : props.rel,
download: props === null || props === void 0 ? void 0 : props.download,
ping: props === null || props === void 0 ? void 0 : props.ping,
referrerPolicy: props === null || props === void 0 ? void 0 : props.referrerPolicy
};
}
export {$ea8dcbcb9ea1b556$export$323e4fc2fa4753fb as RouterProvider, $ea8dcbcb9ea1b556$export$efa8c9099e530235 as shouldClientNavigate, $ea8dcbcb9ea1b556$export$95185d699e05d4d7 as openLink, $ea8dcbcb9ea1b556$export$9a302a45f65d0572 as useRouter, $ea8dcbcb9ea1b556$export$bdc77b0c0a3a85d6 as useSyntheticLinkProps, $ea8dcbcb9ea1b556$export$51437d503373d223 as getSyntheticLinkProps, $ea8dcbcb9ea1b556$export$7e924b3091a3bd18 as useLinkProps};
//# sourceMappingURL=openLink.module.js.map
@@ -0,0 +1,6 @@
"use strict";
const addMinutes = require("./addMinutes.js");
function subMinutes(date, minutes) {
return addMinutes(date, -minutes);
}
module.exports = subMinutes;
@@ -0,0 +1,584 @@
# safe-buffer [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url]
[travis-image]: https://img.shields.io/travis/feross/safe-buffer/master.svg
[travis-url]: https://travis-ci.org/feross/safe-buffer
[npm-image]: https://img.shields.io/npm/v/safe-buffer.svg
[npm-url]: https://npmjs.org/package/safe-buffer
[downloads-image]: https://img.shields.io/npm/dm/safe-buffer.svg
[downloads-url]: https://npmjs.org/package/safe-buffer
[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg
[standard-url]: https://standardjs.com
#### Safer Node.js Buffer API
**Use the new Node.js Buffer APIs (`Buffer.from`, `Buffer.alloc`,
`Buffer.allocUnsafe`, `Buffer.allocUnsafeSlow`) in all versions of Node.js.**
**Uses the built-in implementation when available.**
## install
```
npm install safe-buffer
```
## usage
The goal of this package is to provide a safe replacement for the node.js `Buffer`.
It's a drop-in replacement for `Buffer`. You can use it by adding one `require` line to
the top of your node.js modules:
```js
var Buffer = require('safe-buffer').Buffer
// Existing buffer code will continue to work without issues:
new Buffer('hey', 'utf8')
new Buffer([1, 2, 3], 'utf8')
new Buffer(obj)
new Buffer(16) // create an uninitialized buffer (potentially unsafe)
// But you can use these new explicit APIs to make clear what you want:
Buffer.from('hey', 'utf8') // convert from many types to a Buffer
Buffer.alloc(16) // create a zero-filled buffer (safe)
Buffer.allocUnsafe(16) // create an uninitialized buffer (potentially unsafe)
```
## api
### Class Method: Buffer.from(array)
<!-- YAML
added: v3.0.0
-->
* `array` {Array}
Allocates a new `Buffer` using an `array` of octets.
```js
const buf = Buffer.from([0x62,0x75,0x66,0x66,0x65,0x72]);
// creates a new Buffer containing ASCII bytes
// ['b','u','f','f','e','r']
```
A `TypeError` will be thrown if `array` is not an `Array`.
### Class Method: Buffer.from(arrayBuffer[, byteOffset[, length]])
<!-- YAML
added: v5.10.0
-->
* `arrayBuffer` {ArrayBuffer} The `.buffer` property of a `TypedArray` or
a `new ArrayBuffer()`
* `byteOffset` {Number} Default: `0`
* `length` {Number} Default: `arrayBuffer.length - byteOffset`
When passed a reference to the `.buffer` property of a `TypedArray` instance,
the newly created `Buffer` will share the same allocated memory as the
TypedArray.
```js
const arr = new Uint16Array(2);
arr[0] = 5000;
arr[1] = 4000;
const buf = Buffer.from(arr.buffer); // shares the memory with arr;
console.log(buf);
// Prints: <Buffer 88 13 a0 0f>
// changing the TypedArray changes the Buffer also
arr[1] = 6000;
console.log(buf);
// Prints: <Buffer 88 13 70 17>
```
The optional `byteOffset` and `length` arguments specify a memory range within
the `arrayBuffer` that will be shared by the `Buffer`.
```js
const ab = new ArrayBuffer(10);
const buf = Buffer.from(ab, 0, 2);
console.log(buf.length);
// Prints: 2
```
A `TypeError` will be thrown if `arrayBuffer` is not an `ArrayBuffer`.
### Class Method: Buffer.from(buffer)
<!-- YAML
added: v3.0.0
-->
* `buffer` {Buffer}
Copies the passed `buffer` data onto a new `Buffer` instance.
```js
const buf1 = Buffer.from('buffer');
const buf2 = Buffer.from(buf1);
buf1[0] = 0x61;
console.log(buf1.toString());
// 'auffer'
console.log(buf2.toString());
// 'buffer' (copy is not changed)
```
A `TypeError` will be thrown if `buffer` is not a `Buffer`.
### Class Method: Buffer.from(str[, encoding])
<!-- YAML
added: v5.10.0
-->
* `str` {String} String to encode.
* `encoding` {String} Encoding to use, Default: `'utf8'`
Creates a new `Buffer` containing the given JavaScript string `str`. If
provided, the `encoding` parameter identifies the character encoding.
If not provided, `encoding` defaults to `'utf8'`.
```js
const buf1 = Buffer.from('this is a tést');
console.log(buf1.toString());
// prints: this is a tést
console.log(buf1.toString('ascii'));
// prints: this is a tC)st
const buf2 = Buffer.from('7468697320697320612074c3a97374', 'hex');
console.log(buf2.toString());
// prints: this is a tést
```
A `TypeError` will be thrown if `str` is not a string.
### Class Method: Buffer.alloc(size[, fill[, encoding]])
<!-- YAML
added: v5.10.0
-->
* `size` {Number}
* `fill` {Value} Default: `undefined`
* `encoding` {String} Default: `utf8`
Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the
`Buffer` will be *zero-filled*.
```js
const buf = Buffer.alloc(5);
console.log(buf);
// <Buffer 00 00 00 00 00>
```
The `size` must be less than or equal to the value of
`require('buffer').kMaxLength` (on 64-bit architectures, `kMaxLength` is
`(2^31)-1`). Otherwise, a [`RangeError`][] is thrown. A zero-length Buffer will
be created if a `size` less than or equal to 0 is specified.
If `fill` is specified, the allocated `Buffer` will be initialized by calling
`buf.fill(fill)`. See [`buf.fill()`][] for more information.
```js
const buf = Buffer.alloc(5, 'a');
console.log(buf);
// <Buffer 61 61 61 61 61>
```
If both `fill` and `encoding` are specified, the allocated `Buffer` will be
initialized by calling `buf.fill(fill, encoding)`. For example:
```js
const buf = Buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64');
console.log(buf);
// <Buffer 68 65 6c 6c 6f 20 77 6f 72 6c 64>
```
Calling `Buffer.alloc(size)` can be significantly slower than the alternative
`Buffer.allocUnsafe(size)` but ensures that the newly created `Buffer` instance
contents will *never contain sensitive data*.
A `TypeError` will be thrown if `size` is not a number.
### Class Method: Buffer.allocUnsafe(size)
<!-- YAML
added: v5.10.0
-->
* `size` {Number}
Allocates a new *non-zero-filled* `Buffer` of `size` bytes. The `size` must
be less than or equal to the value of `require('buffer').kMaxLength` (on 64-bit
architectures, `kMaxLength` is `(2^31)-1`). Otherwise, a [`RangeError`][] is
thrown. A zero-length Buffer will be created if a `size` less than or equal to
0 is specified.
The underlying memory for `Buffer` instances created in this way is *not
initialized*. The contents of the newly created `Buffer` are unknown and
*may contain sensitive data*. Use [`buf.fill(0)`][] to initialize such
`Buffer` instances to zeroes.
```js
const buf = Buffer.allocUnsafe(5);
console.log(buf);
// <Buffer 78 e0 82 02 01>
// (octets will be different, every time)
buf.fill(0);
console.log(buf);
// <Buffer 00 00 00 00 00>
```
A `TypeError` will be thrown if `size` is not a number.
Note that the `Buffer` module pre-allocates an internal `Buffer` instance of
size `Buffer.poolSize` that is used as a pool for the fast allocation of new
`Buffer` instances created using `Buffer.allocUnsafe(size)` (and the deprecated
`new Buffer(size)` constructor) only when `size` is less than or equal to
`Buffer.poolSize >> 1` (floor of `Buffer.poolSize` divided by two). The default
value of `Buffer.poolSize` is `8192` but can be modified.
Use of this pre-allocated internal memory pool is a key difference between
calling `Buffer.alloc(size, fill)` vs. `Buffer.allocUnsafe(size).fill(fill)`.
Specifically, `Buffer.alloc(size, fill)` will *never* use the internal Buffer
pool, while `Buffer.allocUnsafe(size).fill(fill)` *will* use the internal
Buffer pool if `size` is less than or equal to half `Buffer.poolSize`. The
difference is subtle but can be important when an application requires the
additional performance that `Buffer.allocUnsafe(size)` provides.
### Class Method: Buffer.allocUnsafeSlow(size)
<!-- YAML
added: v5.10.0
-->
* `size` {Number}
Allocates a new *non-zero-filled* and non-pooled `Buffer` of `size` bytes. The
`size` must be less than or equal to the value of
`require('buffer').kMaxLength` (on 64-bit architectures, `kMaxLength` is
`(2^31)-1`). Otherwise, a [`RangeError`][] is thrown. A zero-length Buffer will
be created if a `size` less than or equal to 0 is specified.
The underlying memory for `Buffer` instances created in this way is *not
initialized*. The contents of the newly created `Buffer` are unknown and
*may contain sensitive data*. Use [`buf.fill(0)`][] to initialize such
`Buffer` instances to zeroes.
When using `Buffer.allocUnsafe()` to allocate new `Buffer` instances,
allocations under 4KB are, by default, sliced from a single pre-allocated
`Buffer`. This allows applications to avoid the garbage collection overhead of
creating many individually allocated Buffers. This approach improves both
performance and memory usage by eliminating the need to track and cleanup as
many `Persistent` objects.
However, in the case where a developer may need to retain a small chunk of
memory from a pool for an indeterminate amount of time, it may be appropriate
to create an un-pooled Buffer instance using `Buffer.allocUnsafeSlow()` then
copy out the relevant bits.
```js
// need to keep around a few small chunks of memory
const store = [];
socket.on('readable', () => {
const data = socket.read();
// allocate for retained data
const sb = Buffer.allocUnsafeSlow(10);
// copy the data into the new allocation
data.copy(sb, 0, 0, 10);
store.push(sb);
});
```
Use of `Buffer.allocUnsafeSlow()` should be used only as a last resort *after*
a developer has observed undue memory retention in their applications.
A `TypeError` will be thrown if `size` is not a number.
### All the Rest
The rest of the `Buffer` API is exactly the same as in node.js.
[See the docs](https://nodejs.org/api/buffer.html).
## Related links
- [Node.js issue: Buffer(number) is unsafe](https://github.com/nodejs/node/issues/4660)
- [Node.js Enhancement Proposal: Buffer.from/Buffer.alloc/Buffer.zalloc/Buffer() soft-deprecate](https://github.com/nodejs/node-eps/pull/4)
## Why is `Buffer` unsafe?
Today, the node.js `Buffer` constructor is overloaded to handle many different argument
types like `String`, `Array`, `Object`, `TypedArrayView` (`Uint8Array`, etc.),
`ArrayBuffer`, and also `Number`.
The API is optimized for convenience: you can throw any type at it, and it will try to do
what you want.
Because the Buffer constructor is so powerful, you often see code like this:
```js
// Convert UTF-8 strings to hex
function toHex (str) {
return new Buffer(str).toString('hex')
}
```
***But what happens if `toHex` is called with a `Number` argument?***
### Remote Memory Disclosure
If an attacker can make your program call the `Buffer` constructor with a `Number`
argument, then they can make it allocate uninitialized memory from the node.js process.
This could potentially disclose TLS private keys, user data, or database passwords.
When the `Buffer` constructor is passed a `Number` argument, it returns an
**UNINITIALIZED** block of memory of the specified `size`. When you create a `Buffer` like
this, you **MUST** overwrite the contents before returning it to the user.
From the [node.js docs](https://nodejs.org/api/buffer.html#buffer_new_buffer_size):
> `new Buffer(size)`
>
> - `size` Number
>
> The underlying memory for `Buffer` instances created in this way is not initialized.
> **The contents of a newly created `Buffer` are unknown and could contain sensitive
> data.** Use `buf.fill(0)` to initialize a Buffer to zeroes.
(Emphasis our own.)
Whenever the programmer intended to create an uninitialized `Buffer` you often see code
like this:
```js
var buf = new Buffer(16)
// Immediately overwrite the uninitialized buffer with data from another buffer
for (var i = 0; i < buf.length; i++) {
buf[i] = otherBuf[i]
}
```
### Would this ever be a problem in real code?
Yes. It's surprisingly common to forget to check the type of your variables in a
dynamically-typed language like JavaScript.
Usually the consequences of assuming the wrong type is that your program crashes with an
uncaught exception. But the failure mode for forgetting to check the type of arguments to
the `Buffer` constructor is more catastrophic.
Here's an example of a vulnerable service that takes a JSON payload and converts it to
hex:
```js
// Take a JSON payload {str: "some string"} and convert it to hex
var server = http.createServer(function (req, res) {
var data = ''
req.setEncoding('utf8')
req.on('data', function (chunk) {
data += chunk
})
req.on('end', function () {
var body = JSON.parse(data)
res.end(new Buffer(body.str).toString('hex'))
})
})
server.listen(8080)
```
In this example, an http client just has to send:
```json
{
"str": 1000
}
```
and it will get back 1,000 bytes of uninitialized memory from the server.
This is a very serious bug. It's similar in severity to the
[the Heartbleed bug](http://heartbleed.com/) that allowed disclosure of OpenSSL process
memory by remote attackers.
### Which real-world packages were vulnerable?
#### [`bittorrent-dht`](https://www.npmjs.com/package/bittorrent-dht)
[Mathias Buus](https://github.com/mafintosh) and I
([Feross Aboukhadijeh](http://feross.org/)) found this issue in one of our own packages,
[`bittorrent-dht`](https://www.npmjs.com/package/bittorrent-dht). The bug would allow
anyone on the internet to send a series of messages to a user of `bittorrent-dht` and get
them to reveal 20 bytes at a time of uninitialized memory from the node.js process.
Here's
[the commit](https://github.com/feross/bittorrent-dht/commit/6c7da04025d5633699800a99ec3fbadf70ad35b8)
that fixed it. We released a new fixed version, created a
[Node Security Project disclosure](https://nodesecurity.io/advisories/68), and deprecated all
vulnerable versions on npm so users will get a warning to upgrade to a newer version.
#### [`ws`](https://www.npmjs.com/package/ws)
That got us wondering if there were other vulnerable packages. Sure enough, within a short
period of time, we found the same issue in [`ws`](https://www.npmjs.com/package/ws), the
most popular WebSocket implementation in node.js.
If certain APIs were called with `Number` parameters instead of `String` or `Buffer` as
expected, then uninitialized server memory would be disclosed to the remote peer.
These were the vulnerable methods:
```js
socket.send(number)
socket.ping(number)
socket.pong(number)
```
Here's a vulnerable socket server with some echo functionality:
```js
server.on('connection', function (socket) {
socket.on('message', function (message) {
message = JSON.parse(message)
if (message.type === 'echo') {
socket.send(message.data) // send back the user's message
}
})
})
```
`socket.send(number)` called on the server, will disclose server memory.
Here's [the release](https://github.com/websockets/ws/releases/tag/1.0.1) where the issue
was fixed, with a more detailed explanation. Props to
[Arnout Kazemier](https://github.com/3rd-Eden) for the quick fix. Here's the
[Node Security Project disclosure](https://nodesecurity.io/advisories/67).
### What's the solution?
It's important that node.js offers a fast way to get memory otherwise performance-critical
applications would needlessly get a lot slower.
But we need a better way to *signal our intent* as programmers. **When we want
uninitialized memory, we should request it explicitly.**
Sensitive functionality should not be packed into a developer-friendly API that loosely
accepts many different types. This type of API encourages the lazy practice of passing
variables in without checking the type very carefully.
#### A new API: `Buffer.allocUnsafe(number)`
The functionality of creating buffers with uninitialized memory should be part of another
API. We propose `Buffer.allocUnsafe(number)`. This way, it's not part of an API that
frequently gets user input of all sorts of different types passed into it.
```js
var buf = Buffer.allocUnsafe(16) // careful, uninitialized memory!
// Immediately overwrite the uninitialized buffer with data from another buffer
for (var i = 0; i < buf.length; i++) {
buf[i] = otherBuf[i]
}
```
### How do we fix node.js core?
We sent [a PR to node.js core](https://github.com/nodejs/node/pull/4514) (merged as
`semver-major`) which defends against one case:
```js
var str = 16
new Buffer(str, 'utf8')
```
In this situation, it's implied that the programmer intended the first argument to be a
string, since they passed an encoding as a second argument. Today, node.js will allocate
uninitialized memory in the case of `new Buffer(number, encoding)`, which is probably not
what the programmer intended.
But this is only a partial solution, since if the programmer does `new Buffer(variable)`
(without an `encoding` parameter) there's no way to know what they intended. If `variable`
is sometimes a number, then uninitialized memory will sometimes be returned.
### What's the real long-term fix?
We could deprecate and remove `new Buffer(number)` and use `Buffer.allocUnsafe(number)` when
we need uninitialized memory. But that would break 1000s of packages.
~~We believe the best solution is to:~~
~~1. Change `new Buffer(number)` to return safe, zeroed-out memory~~
~~2. Create a new API for creating uninitialized Buffers. We propose: `Buffer.allocUnsafe(number)`~~
#### Update
We now support adding three new APIs:
- `Buffer.from(value)` - convert from any type to a buffer
- `Buffer.alloc(size)` - create a zero-filled buffer
- `Buffer.allocUnsafe(size)` - create an uninitialized buffer with given size
This solves the core problem that affected `ws` and `bittorrent-dht` which is
`Buffer(variable)` getting tricked into taking a number argument.
This way, existing code continues working and the impact on the npm ecosystem will be
minimal. Over time, npm maintainers can migrate performance-critical code to use
`Buffer.allocUnsafe(number)` instead of `new Buffer(number)`.
### Conclusion
We think there's a serious design issue with the `Buffer` API as it exists today. It
promotes insecure software by putting high-risk functionality into a convenient API
with friendly "developer ergonomics".
This wasn't merely a theoretical exercise because we found the issue in some of the
most popular npm packages.
Fortunately, there's an easy fix that can be applied today. Use `safe-buffer` in place of
`buffer`.
```js
var Buffer = require('safe-buffer').Buffer
```
Eventually, we hope that node.js core can switch to this new, safer behavior. We believe
the impact on the ecosystem would be minimal since it's not a breaking change.
Well-maintained, popular packages would be updated to use `Buffer.alloc` quickly, while
older, insecure packages would magically become safe from this attack vector.
## links
- [Node.js PR: buffer: throw if both length and enc are passed](https://github.com/nodejs/node/pull/4514)
- [Node Security Project disclosure for `ws`](https://nodesecurity.io/advisories/67)
- [Node Security Project disclosure for`bittorrent-dht`](https://nodesecurity.io/advisories/68)
## credit
The original issues in `bittorrent-dht`
([disclosure](https://nodesecurity.io/advisories/68)) and
`ws` ([disclosure](https://nodesecurity.io/advisories/67)) were discovered by
[Mathias Buus](https://github.com/mafintosh) and
[Feross Aboukhadijeh](http://feross.org/).
Thanks to [Adam Baldwin](https://github.com/evilpacket) for helping disclose these issues
and for his work running the [Node Security Project](https://nodesecurity.io/).
Thanks to [John Hiesey](https://github.com/jhiesey) for proofreading this README and
auditing the code.
## license
MIT. Copyright (C) [Feross Aboukhadijeh](http://feross.org)
@@ -0,0 +1,2 @@
"use strict";var e=require("react"),t=e=>"checkbox"===e.type,r=e=>e instanceof Date,s=e=>null==e;const a=e=>"object"==typeof e;var i=e=>!s(e)&&!Array.isArray(e)&&a(e)&&!r(e),n=e=>i(e)&&e.target?t(e.target)?e.target.checked:e.target.value:e,o=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),l="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function u(e){let t;const r=Array.isArray(e),s="undefined"!=typeof FileList&&e instanceof FileList;if(e instanceof Date)t=new Date(e);else{if(l&&(e instanceof Blob||s)||!r&&!i(e))return e;if(t=r?[]:Object.create(Object.getPrototypeOf(e)),r||(e=>{const t=e.constructor&&e.constructor.prototype;return i(t)&&t.hasOwnProperty("isPrototypeOf")})(e))for(const r in e)e.hasOwnProperty(r)&&(t[r]=u(e[r]));else t=e}return t}var d=e=>/^\w*$/.test(e),c=e=>void 0===e,f=e=>Array.isArray(e)?e.filter(Boolean):[],m=e=>f(e.replace(/["|']|\]/g,"").split(/\.|\[/)),y=(e,t,r)=>{if(!t||!i(e))return r;const a=(d(t)?[t]:m(t)).reduce((e,t)=>s(e)?e:e[t],e);return c(a)||a===e?c(e[t])?r:e[t]:a},_=e=>"boolean"==typeof e,g=(e,t,r)=>{let s=-1;const a=d(t)?[t]:m(t),n=a.length,o=n-1;for(;++s<n;){const t=a[s];let n=r;if(s!==o){const r=e[t];n=i(r)||Array.isArray(r)?r:isNaN(+a[s+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=n,e=e[t]}};const p="blur",b="focusout",h="change",v="onBlur",V="onChange",F="onSubmit",x="onTouched",A="all",S="max",k="min",w="maxLength",D="minLength",C="pattern",E="required",O="validate",M=e.createContext(null);M.displayName="HookFormContext";const j=()=>e.useContext(M);var U=(e,t,r,s=!0)=>{const a={defaultValues:t._defaultValues};for(const i in e)Object.defineProperty(a,i,{get:()=>{const a=i;return t._proxyFormState[a]!==A&&(t._proxyFormState[a]=!s||A),r&&(r[a]=!0),e[a]}});return a};const R="undefined"!=typeof window?e.useLayoutEffect:e.useEffect;function T(t){const r=j(),{control:s=r.control,disabled:a,name:i,exact:n}=t||{},[o,l]=e.useState(s._formState),u=e.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return R(()=>s._subscribe({name:i,formState:u.current,exact:n,callback:e=>{!a&&l({...s._formState,...e})}}),[i,a,n]),e.useEffect(()=>{u.current.isValid&&s._setValid(!0)},[s]),e.useMemo(()=>U(o,s,u.current,!1),[o,s])}var N=e=>"string"==typeof e,B=(e,t,r,s,a)=>N(e)?(s&&t.watch.add(e),y(r,e,a)):Array.isArray(e)?e.map(e=>(s&&t.watch.add(e),y(r,e))):(s&&(t.watchAll=!0),r),L=e=>s(e)||!a(e);function P(e,t,s=new WeakSet){if(L(e)||L(t))return e===t;if(r(e)&&r(t))return e.getTime()===t.getTime();const a=Object.keys(e),n=Object.keys(t);if(a.length!==n.length)return!1;if(s.has(e)||s.has(t))return!0;s.add(e),s.add(t);for(const o of a){const a=e[o];if(!n.includes(o))return!1;if("ref"!==o){const e=t[o];if(r(a)&&r(e)||i(a)&&i(e)||Array.isArray(a)&&Array.isArray(e)?!P(a,e,s):a!==e)return!1}}return!0}function W(t){const r=j(),{control:s=r.control,name:a,defaultValue:i,disabled:n,exact:o,compute:l}=t||{},u=e.useRef(i),d=e.useRef(l),c=e.useRef(void 0),f=e.useRef(s),m=e.useRef(a);d.current=l;const[y,_]=e.useState(()=>{const e=s._getWatch(a,u.current);return d.current?d.current(e):e}),g=e.useCallback(e=>{const t=B(a,s._names,e||s._formValues,!1,u.current);return d.current?d.current(t):t},[s._formValues,s._names,a]),p=e.useCallback(e=>{if(!n){const t=B(a,s._names,e||s._formValues,!1,u.current);if(d.current){const e=d.current(t);P(e,c.current)||(_(e),c.current=e)}else _(t)}},[s._formValues,s._names,n,a]);R(()=>(f.current===s&&P(m.current,a)||(f.current=s,m.current=a,p()),s._subscribe({name:a,formState:{values:!0},exact:o,callback:e=>{p(e.values)}})),[s,o,a,p]),e.useEffect(()=>s._removeUnmounted());const b=f.current!==s,h=m.current,v=e.useMemo(()=>{if(n)return null;const e=!b&&!P(h,a);return b||e?g():null},[n,b,a,h,g]);return null!==v?v:y}function I(t){const r=j(),{name:s,disabled:a,control:i=r.control,shouldUnregister:l,defaultValue:d}=t,f=o(i._names.array,s),m=e.useMemo(()=>y(i._formValues,s,y(i._defaultValues,s,d)),[i,s,d]),b=W({control:i,name:s,defaultValue:m,exact:!0}),v=T({control:i,name:s,exact:!0}),V=e.useRef(t),F=e.useRef(void 0),x=e.useRef(i.register(s,{...t.rules,value:b,..._(t.disabled)?{disabled:t.disabled}:{}}));V.current=t;const A=e.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!y(v.errors,s)},isDirty:{enumerable:!0,get:()=>!!y(v.dirtyFields,s)},isTouched:{enumerable:!0,get:()=>!!y(v.touchedFields,s)},isValidating:{enumerable:!0,get:()=>!!y(v.validatingFields,s)},error:{enumerable:!0,get:()=>y(v.errors,s)}}),[v,s]),S=e.useCallback(e=>x.current.onChange({target:{value:n(e),name:s},type:h}),[s]),k=e.useCallback(()=>x.current.onBlur({target:{value:y(i._formValues,s),name:s},type:p}),[s,i._formValues]),w=e.useCallback(e=>{const t=y(i._fields,s);t&&e&&(t._f.ref={focus:()=>e.focus&&e.focus(),select:()=>e.select&&e.select(),setCustomValidity:t=>e.setCustomValidity(t),reportValidity:()=>e.reportValidity()})},[i._fields,Line truncated
//# sourceMappingURL=index.cjs.js.map
@@ -0,0 +1,67 @@
module.exports = {
'chunk': require('./chunk'),
'compact': require('./compact'),
'concat': require('./concat'),
'difference': require('./difference'),
'differenceBy': require('./differenceBy'),
'differenceWith': require('./differenceWith'),
'drop': require('./drop'),
'dropRight': require('./dropRight'),
'dropRightWhile': require('./dropRightWhile'),
'dropWhile': require('./dropWhile'),
'fill': require('./fill'),
'findIndex': require('./findIndex'),
'findLastIndex': require('./findLastIndex'),
'first': require('./first'),
'flatten': require('./flatten'),
'flattenDeep': require('./flattenDeep'),
'flattenDepth': require('./flattenDepth'),
'fromPairs': require('./fromPairs'),
'head': require('./head'),
'indexOf': require('./indexOf'),
'initial': require('./initial'),
'intersection': require('./intersection'),
'intersectionBy': require('./intersectionBy'),
'intersectionWith': require('./intersectionWith'),
'join': require('./join'),
'last': require('./last'),
'lastIndexOf': require('./lastIndexOf'),
'nth': require('./nth'),
'pull': require('./pull'),
'pullAll': require('./pullAll'),
'pullAllBy': require('./pullAllBy'),
'pullAllWith': require('./pullAllWith'),
'pullAt': require('./pullAt'),
'remove': require('./remove'),
'reverse': require('./reverse'),
'slice': require('./slice'),
'sortedIndex': require('./sortedIndex'),
'sortedIndexBy': require('./sortedIndexBy'),
'sortedIndexOf': require('./sortedIndexOf'),
'sortedLastIndex': require('./sortedLastIndex'),
'sortedLastIndexBy': require('./sortedLastIndexBy'),
'sortedLastIndexOf': require('./sortedLastIndexOf'),
'sortedUniq': require('./sortedUniq'),
'sortedUniqBy': require('./sortedUniqBy'),
'tail': require('./tail'),
'take': require('./take'),
'takeRight': require('./takeRight'),
'takeRightWhile': require('./takeRightWhile'),
'takeWhile': require('./takeWhile'),
'union': require('./union'),
'unionBy': require('./unionBy'),
'unionWith': require('./unionWith'),
'uniq': require('./uniq'),
'uniqBy': require('./uniqBy'),
'uniqWith': require('./uniqWith'),
'unzip': require('./unzip'),
'unzipWith': require('./unzipWith'),
'without': require('./without'),
'xor': require('./xor'),
'xorBy': require('./xorBy'),
'xorWith': require('./xorWith'),
'zip': require('./zip'),
'zipObject': require('./zipObject'),
'zipObjectDeep': require('./zipObjectDeep'),
'zipWith': require('./zipWith')
};
@@ -0,0 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.buildEmptyArrayMetadata = buildEmptyArrayMetadata;
function buildEmptyArrayMetadata() {
return [];
}
//# sourceMappingURL=buildEmptyArrayMetadata.js.map
@@ -0,0 +1,33 @@
/*
* 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 {MutableRefObject} from 'react';
import {RefObject} from '@react-types/shared';
import {useLayoutEffect} from './';
interface ContextValue<T> {
ref?: MutableRefObject<T | null>
}
// Syncs ref from context with ref passed to hook
export function useSyncRef<T>(context?: ContextValue<T> | null, ref?: RefObject<T | null>) {
useLayoutEffect(() => {
if (context && context.ref && ref) {
context.ref.current = ref.current;
return () => {
if (context.ref) {
context.ref.current = null;
}
};
}
});
}
@@ -0,0 +1,22 @@
# Auto detect text files and perform LF normalization
* text=auto
# Custom for Visual Studio
*.cs diff=csharp
*.sln merge=union
*.csproj merge=union
*.vbproj merge=union
*.fsproj merge=union
*.dbproj merge=union
# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
@@ -0,0 +1,121 @@
/*
* 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 {AriaLabelingProps, DOMProps, RangeValue, StyleProps, ValidationState, ValueBase} from '@react-types/shared';
import type {CalendarDate, CalendarDateTime, CalendarIdentifier, Calendar as ICalendar, ZonedDateTime} from '@internationalized/date';
import {ReactNode} from 'react';
export type DateValue = CalendarDate | CalendarDateTime | ZonedDateTime;
type MappedDateValue<T> =
T extends ZonedDateTime ? ZonedDateTime :
T extends CalendarDateTime ? CalendarDateTime :
T extends CalendarDate ? CalendarDate :
never;
export interface CalendarPropsBase {
/** The minimum allowed date that a user may select. */
minValue?: DateValue | null,
/** The maximum allowed date that a user may select. */
maxValue?: DateValue | null,
/** Callback that is called for each date of the calendar. If it returns true, then the date is unavailable. */
isDateUnavailable?: (date: DateValue) => boolean,
/**
* Whether the calendar is disabled.
* @default false
*/
isDisabled?: boolean,
/**
* Whether the calendar value is immutable.
* @default false
*/
isReadOnly?: boolean,
/**
* Whether to automatically focus the calendar when it mounts.
* @default false
*/
autoFocus?: boolean,
/** Controls the currently focused date within the calendar. */
focusedValue?: DateValue | null,
/** The date that is focused when the calendar first mounts (uncountrolled). */
defaultFocusedValue?: DateValue | null,
/** Handler that is called when the focused date changes. */
onFocusChange?: (date: CalendarDate) => void,
/**
* Whether the current selection is valid or invalid according to application logic.
* @deprecated Use `isInvalid` instead.
*/
validationState?: ValidationState,
/** Whether the current selection is invalid according to application logic. */
isInvalid?: boolean,
/** An error message to display when the selected value is invalid. */
errorMessage?: ReactNode,
/**
* Controls the behavior of paging. Pagination either works by advancing the visible page by visibleDuration (default) or one unit of visibleDuration.
* @default visible
*/
pageBehavior?: PageBehavior,
/**
* The day that starts the week.
*/
firstDayOfWeek?: 'sun' | 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat',
/**
* Determines the alignment of the visible months on initial render based on the current selection or current date if there is no selection.
* @default 'center'
*/
selectionAlignment?: 'start' | 'center' | 'end'
}
export type DateRange = RangeValue<DateValue> | null;
export interface CalendarProps<T extends DateValue> extends CalendarPropsBase, ValueBase<T | null, MappedDateValue<T>> {}
export interface RangeCalendarProps<T extends DateValue> extends CalendarPropsBase, ValueBase<RangeValue<T> | null, RangeValue<MappedDateValue<T>>> {
/**
* When combined with `isDateUnavailable`, determines whether non-contiguous ranges,
* i.e. ranges containing unavailable dates, may be selected.
*/
allowsNonContiguousRanges?: boolean
}
export interface AriaCalendarProps<T extends DateValue> extends CalendarProps<T>, DOMProps, AriaLabelingProps {}
export interface AriaRangeCalendarProps<T extends DateValue> extends RangeCalendarProps<T>, DOMProps, AriaLabelingProps {}
export type PageBehavior = 'single' | 'visible';
export interface SpectrumCalendarProps<T extends DateValue> extends AriaCalendarProps<T>, StyleProps {
/**
* The number of months to display at once. Up to 3 months are supported.
* @default 1
*/
visibleMonths?: number,
/**
* A function to create a new [Calendar](https://react-spectrum.adobe.com/internationalized/date/Calendar.html)
* object for a given calendar identifier. If not provided, the `createCalendar` function
* from `@internationalized/date` will be used.
*/
createCalendar?: (identifier: CalendarIdentifier) => ICalendar
}
export interface SpectrumRangeCalendarProps<T extends DateValue> extends AriaRangeCalendarProps<T>, StyleProps {
/**
* The number of months to display at once. Up to 3 months are supported.
* @default 1
*/
visibleMonths?: number,
/**
* A function to create a new [Calendar](https://react-spectrum.adobe.com/internationalized/date/Calendar.html)
* object for a given calendar identifier. If not provided, the `createCalendar` function
* from `@internationalized/date` will be used.
*/
createCalendar?: (identifier: CalendarIdentifier) => ICalendar
}
@@ -0,0 +1 @@
{"version":3,"names":["_gensync","data","require","_full","_partial","_item","_rewriteStackTrace","loadPartialConfigRunner","gensync","loadPartialConfigImpl","loadPartialConfigAsync","args","beginHiddenCallStack","async","loadPartialConfigSync","sync","loadPartialConfig","opts","callback","undefined","errback","loadOptionsImpl","_config$options","config","loadFullConfig","options","loadOptionsRunner","loadOptionsAsync","loadOptionsSync","loadOptions","createConfigItemRunner","createConfigItemImpl","createConfigItemAsync","createConfigItemSync","createConfigItem","target"],"sources":["../../src/config/index.ts"],"sourcesContent":["import gensync, { type Handler } from \"gensync\";\n\nexport type {\n ResolvedConfig,\n InputOptions,\n PluginPasses,\n Plugin,\n} from \"./full.ts\";\n\nimport type {\n InputOptions,\n PluginTarget,\n ResolvedOptions,\n} from \"./validation/options.ts\";\nexport type { ConfigAPI } from \"./helpers/config-api.ts\";\nimport type {\n PluginAPI as basePluginAPI,\n PresetAPI as basePresetAPI,\n} from \"./helpers/config-api.ts\";\nexport type { PluginObject } from \"./validation/plugins.ts\";\ntype PluginAPI = basePluginAPI & typeof import(\"..\");\ntype PresetAPI = basePresetAPI & typeof import(\"..\");\nexport type { PluginAPI, PresetAPI };\nexport type {\n CallerMetadata,\n NormalizedOptions,\n} from \"./validation/options.ts\";\n\nimport loadFullConfig from \"./full.ts\";\nimport {\n type PartialConfig,\n loadPartialConfig as loadPartialConfigImpl,\n} from \"./partial.ts\";\n\nexport { loadFullConfig as default };\nexport type { PartialConfig } from \"./partial.ts\";\n\nimport { createConfigItem as createConfigItemImpl } from \"./item.ts\";\nimport type { ConfigItem } from \"./item.ts\";\nexport type { ConfigItem };\n\nimport { beginHiddenCallStack } from \"../errors/rewrite-stack-trace.ts\";\n\nconst loadPartialConfigRunner = gensync(loadPartialConfigImpl);\nexport function loadPartialConfigAsync(\n ...args: Parameters<typeof loadPartialConfigRunner.async>\n) {\n return beginHiddenCallStack(loadPartialConfigRunner.async)(...args);\n}\nexport function loadPartialConfigSync(\n ...args: Parameters<typeof loadPartialConfigRunner.sync>\n) {\n return beginHiddenCallStack(loadPartialConfigRunner.sync)(...args);\n}\nexport function loadPartialConfig(\n opts: Parameters<typeof loadPartialConfigImpl>[0],\n callback?: (err: Error, val: PartialConfig | null) => void,\n) {\n if (callback !== undefined) {\n beginHiddenCallStack(loadPartialConfigRunner.errback)(opts, callback);\n } else if (typeof opts === \"function\") {\n beginHiddenCallStack(loadPartialConfigRunner.errback)(\n undefined,\n opts as (err: Error, val: PartialConfig | null) => void,\n );\n } else {\n if (process.env.BABEL_8_BREAKING) {\n throw new Error(\n \"Starting from Babel 8.0.0, the 'loadPartialConfig' function expects a callback. If you need to call it synchronously, please use 'loadPartialConfigSync'.\",\n );\n } else {\n return loadPartialConfigSync(opts);\n }\n }\n}\n\nfunction* loadOptionsImpl(opts: InputOptions): Handler<ResolvedOptions | null> {\n const config = yield* loadFullConfig(opts);\n // NOTE: We want to return \"null\" explicitly, while ?. alone returns undefined\n return config?.options ?? null;\n}\nconst loadOptionsRunner = gensync(loadOptionsImpl);\nexport function loadOptionsAsync(\n ...args: Parameters<typeof loadOptionsRunner.async>\n) {\n return beginHiddenCallStack(loadOptionsRunner.async)(...args);\n}\nexport function loadOptionsSync(\n ...args: Parameters<typeof loadOptionsRunner.sync>\n) {\n return beginHiddenCallStack(loadOptionsRunner.sync)(...args);\n}\nexport function loadOptions(\n opts: Parameters<typeof loadOptionsImpl>[0],\n callback?: (err: Error, val: ResolvedOptions | null) => void,\n) {\n if (callback !== undefined) {\n beginHiddenCallStack(loadOptionsRunner.errback)(opts, callback);\n } else if (typeof opts === \"function\") {\n beginHiddenCallStack(loadOptionsRunner.errback)(\n undefined,\n opts as (err: Error, val: ResolvedOptions | null) => void,\n );\n } else {\n if (process.env.BABEL_8_BREAKING) {\n throw new Error(\n \"Starting from Babel 8.0.0, the 'loadOptions' function expects a callback. If you need to call it synchronously, please use 'loadOptionsSync'.\",\n );\n } else {\n return loadOptionsSync(opts);\n }\n }\n}\n\nconst createConfigItemRunner = gensync(createConfigItemImpl);\nexport function createConfigItemAsync(\n ...args: Parameters<typeof createConfigItemRunner.async>\n) {\n return beginHiddenCallStack(createConfigItemRunner.async)(...args);\n}\nexport function createConfigItemSync(\n ...args: Parameters<typeof createConfigItemRunner.sync>\n) {\n return beginHiddenCallStack(createConfigItemRunner.sync)(...args);\n}\nexport function createConfigItem(\n target: PluginTarget,\n options: Parameters<typeof createConfigItemImpl>[1],\Line truncated
@@ -0,0 +1,10 @@
/**
* Throw a given error.
*
* @param {Error|null|undefined} [error]
* Maybe error.
* @returns {asserts error is null|undefined}
*/
export function bail(
error?: Error | null | undefined
): asserts error is null | undefined
@@ -0,0 +1,144 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _tslib = require("tslib");
var _react = require("react");
var _useCreation = _interopRequireDefault(require("../../../useCreation"));
var _useUnmount = _interopRequireDefault(require("../../../useUnmount"));
var _cache = require("../utils/cache");
var _cachePromise = require("../utils/cachePromise");
var _cacheSubscribe = require("../utils/cacheSubscribe");
var useCachePlugin = function useCachePlugin(fetchInstance, _a) {
var cacheKey = _a.cacheKey,
_b = _a.cacheTime,
cacheTime = _b === void 0 ? 5 * 60 * 1000 : _b,
_c = _a.staleTime,
staleTime = _c === void 0 ? 0 : _c,
customSetCache = _a.setCache,
customGetCache = _a.getCache;
var unSubscribeRef = (0, _react.useRef)(undefined);
var currentPromiseRef = (0, _react.useRef)(undefined);
var _setCache = function _setCache(key, cachedData) {
if (customSetCache) {
customSetCache(cachedData);
} else {
(0, _cache.setCache)(key, cacheTime, cachedData);
}
(0, _cacheSubscribe.trigger)(key, cachedData.data);
};
var _getCache = function _getCache(key, params) {
if (params === void 0) {
params = [];
}
if (customGetCache) {
return customGetCache(params);
}
return (0, _cache.getCache)(key);
};
(0, _useCreation["default"])(function () {
if (!cacheKey) {
return;
}
// get data from cache when init
var cacheData = _getCache(cacheKey);
if (cacheData && Object.hasOwnProperty.call(cacheData, 'data')) {
fetchInstance.state.data = cacheData.data;
fetchInstance.state.params = cacheData.params;
if (staleTime === -1 || Date.now() - cacheData.time <= staleTime) {
fetchInstance.state.loading = false;
}
}
// subscribe same cachekey update, trigger update
unSubscribeRef.current = (0, _cacheSubscribe.subscribe)(cacheKey, function (data) {
fetchInstance.setState({
data: data
});
});
}, []);
(0, _useUnmount["default"])(function () {
var _a;
(_a = unSubscribeRef.current) === null || _a === void 0 ? void 0 : _a.call(unSubscribeRef);
});
if (!cacheKey) {
return {};
}
return {
onBefore: function onBefore(params) {
var cacheData = _getCache(cacheKey, params);
if (!cacheData || !Object.hasOwnProperty.call(cacheData, 'data')) {
return {};
}
// If the data is fresh, stop request
if (staleTime === -1 || Date.now() - cacheData.time <= staleTime) {
return {
loading: false,
data: cacheData === null || cacheData === void 0 ? void 0 : cacheData.data,
error: undefined,
returnNow: true
};
} else {
// If the data is stale, return data, and request continue
return {
data: cacheData === null || cacheData === void 0 ? void 0 : cacheData.data,
error: undefined
};
}
},
onRequest: function onRequest(service, args) {
var servicePromise = (0, _cachePromise.getCachePromise)(cacheKey);
// If has servicePromise, and is not trigger by self, then use it
if (servicePromise && servicePromise !== currentPromiseRef.current) {
return {
servicePromise: servicePromise
};
}
servicePromise = service.apply(void 0, (0, _tslib.__spreadArray)([], (0, _tslib.__read)(args), false));
currentPromiseRef.current = servicePromise;
(0, _cachePromise.setCachePromise)(cacheKey, servicePromise);
return {
servicePromise: servicePromise
};
},
onSuccess: function onSuccess(data, params) {
var _a;
if (cacheKey) {
// cancel subscribe, avoid trgger self
(_a = unSubscribeRef.current) === null || _a === void 0 ? void 0 : _a.call(unSubscribeRef);
_setCache(cacheKey, {
data: data,
params: params,
time: Date.now()
});
// resubscribe
unSubscribeRef.current = (0, _cacheSubscribe.subscribe)(cacheKey, function (d) {
fetchInstance.setState({
data: d
});
});
}
},
onMutate: function onMutate(data) {
var _a;
if (cacheKey) {
// cancel subscribe, avoid trigger self
(_a = unSubscribeRef.current) === null || _a === void 0 ? void 0 : _a.call(unSubscribeRef);
_setCache(cacheKey, {
data: data,
params: fetchInstance.state.params,
time: Date.now()
});
// resubscribe
unSubscribeRef.current = (0, _cacheSubscribe.subscribe)(cacheKey, function (d) {
fetchInstance.setState({
data: d
});
});
}
}
};
};
var _default = exports["default"] = useCachePlugin;
@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=resolveInstanceBindingNodeFromConstructorParams.spec.d.ts.map
@@ -0,0 +1,5 @@
var convert = require('./convert'),
func = convert('curryRight', require('../curryRight'));
func.placeholder = require('./placeholder');
module.exports = func;
@@ -0,0 +1 @@
{"name":"are-we-there-yet","version":"3.0.1","requiresBuild":false,"files":{"lib/index.js":{"checkedAt":1794532123373,"integrity":"sha512-ecj3OLI5ennxkupV5hRaQzPDtVXCMNMoQKBsqdrMxbdfVHrlbcwoVh8tauqcAzwkyrOF40TYaXI0ZUtv2Qm6LA==","mode":420,"size":163},"lib/tracker-base.js":{"checkedAt":1794532123373,"integrity":"sha512-BpiNMj0DExP8qPRZ/AbjNNOx2W3JhBvZn69quP504lNF8rn26vIRbYpFvYCko5t8O1WXyUt6chnq4tAyptJCaw==","mode":420,"size":274},"lib/tracker-group.js":{"checkedAt":1794532123373,"integrity":"sha512-fPDX8bq4y1++16EXvmKh4Qgk8ywIiKMQRWFQCD5h8+V0x18e16TVnO3zGianCVEZeb9zGQOyi3xaD/EG8aFlAw==","mode":420,"size":3280},"lib/tracker-stream.js":{"checkedAt":1794532123373,"integrity":"sha512-/hwNogbdmiqfEC1pGRV2rD9pFA1rP9RAkRBxUuTNETizKx1kjZRbx9Kga4AGzE+hZ7cng12MXkA+a4BgdzVVrg==","mode":420,"size":963},"lib/tracker.js":{"checkedAt":1794532123373,"integrity":"sha512-G+/sLG530F+hL4NjaujCOXd74X/GxILfdPczEYMs+gkFYXvis2aYhv0Vm8mJ+Wk/EBtCf4r4A5520qfVT04Gwg==","mode":420,"size":836},"package.json":{"checkedAt":1794532123373,"integrity":"sha512-wZJitorogH5DYn6r4Qd14jhA4s1fCAAGxHf/ajhHpO0uTzpQF65P20ZrVGVJyRHUsHHzEB5egG4VA01YrOGFJA==","mode":420,"size":1467},"LICENSE.md":{"checkedAt":1794532123373,"integrity":"sha512-/ySG1YnTL7NarZwCzZF7oec4yha3zMeVTNxHEqlo/F/CVhK0ifliy+jdsr5ABXzRtZQCqpyt6bZHmh0OHXdDpA==","mode":420,"size":717},"README.md":{"checkedAt":1794532123373,"integrity":"sha512-n1HiX8NRUpmGtrochYf1j+Mttt6gjAMHYJ9xOUfwQigTJM7437XHfDnSPLHVN27VIIYIEAfUKF4NPBoFX0hF4w==","mode":420,"size":6596}}}
@@ -0,0 +1,12 @@
/**
* GlobalSign Root CA - R3
*
* Downloaded from https://valid.r3.roots.globalsign.com/
*
* Valid until 2029-03-18 @ 00:00 PST
*
* SHA256 Fingerprint
* CB:B5:22:D7:B7:F1:27:AD:6A:01:13:86:5B:DF:1C:D4:10:2E:7D:07:59:AF:63:5A:7C:F4:72:0D:C9:63:C5:3B
*/
export declare const GlobalSign_Root_CA_R3 = "-----BEGIN CERTIFICATE-----\nMIIDXzCCAkegAwIBAgILBAAAAAABIVhTCKIwDQYJKoZIhvcNAQELBQAwTDEgMB4G\nA1UECxMXR2xvYmFsU2lnbiBSb290IENBIC0gUjMxEzARBgNVBAoTCkdsb2JhbFNp\nZ24xEzARBgNVBAMTCkdsb2JhbFNpZ24wHhcNMDkwMzE4MTAwMDAwWhcNMjkwMzE4\nMTAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMzETMBEG\nA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2lnbjCCASIwDQYJKoZI\nhvcNAQEBBQADggEPADCCAQoCggEBAMwldpB5BngiFvXAg7aEyiie/QV2EcWtiHL8\nRgJDx7KKnQRfJMsuS+FggkbhUqsMgUdwbN1k0ev1LKMPgj0MK66X17YUhhB5uzsT\ngHeMCOFJ0mpiLx9e+pZo34knlTifBtc+ycsmWQ1z3rDI6SYOgxXG71uL0gRgykmm\nKPZpO/bLyCiR5Z2KYVc3rHQU3HTgOu5yLy6c+9C7v/U9AOEGM+iCK65TpjoWc4zd\nQQ4gOsC0p6Hpsk+QLjJg6VfLuQSSaGjlOCZgdbKfd/+RFO+uIEn8rUAVSNECMWEZ\nXriX7613t2Saer9fwRPvm2L7DWzgVGkWqQPabumDk3F2xmmFghcCAwEAAaNCMEAw\nDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFI/wS3+o\nLkUkrk1Q+mOai97i3Ru8MA0GCSqGSIb3DQEBCwUAA4IBAQBLQNvAUKr+yAzv95ZU\nRUm7lgAJQayzE4aGKAczymvmdLm6AC2upArT9fHxD4q/c2dKg8dEe3jgr25sbwMp\njjM5RcOO5LlXbKr8EpbsU8Yt5CRsuZRj+9xTaGdWPoO4zzUhw8lo/s7awlOqzJCK\n6fBdRoyV3XpYKBovHd7NADdBj+1EbddTKJd+82cEHhXXipa0095MJ6RMG3NzdvQX\nmcIfeg7jLQitChws/zyrVQ4PkX4268NXSb7hLi18YIvDQVETI53O9zJrlAGomecs\nMx86OyXShkDOOyyGeMlhLxS67ttVb9+E7gUJTb0o2HLO02JQZR7rkpeDMdmztcpH\nWD9f\n-----END CERTIFICATE-----\n ";
//# sourceMappingURL=mds.d.ts.map
@@ -0,0 +1,24 @@
import { OneBotAction } from '../OneBotAction';
import { Static } from '@sinclair/typebox';
declare const ReturnSchema: import("@sinclair/typebox").TObject<{
clientkey: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
}>;
type ReturnType = Static<typeof ReturnSchema>;
export declare class GetClientkey extends OneBotAction<void, ReturnType> {
actionName: "get_clientkey";
payloadSchema: import("@sinclair/typebox").TObject<{}>;
returnSchema: import("@sinclair/typebox").TObject<{
clientkey: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
}>;
actionSummary: string;
actionDescription: string;
actionTags: string[];
payloadExample: {};
returnExample: {
clientkey: string;
};
_handle(): Promise<{
clientkey: string;
}>;
}
export {};
@@ -0,0 +1,9 @@
import type { TSESTree } from '@typescript-eslint/types';
import type { ScopeManager } from '../ScopeManager';
import type { Scope } from './Scope';
import { ScopeBase } from './ScopeBase';
import { ScopeType } from './ScopeType';
export declare class WithScope extends ScopeBase<ScopeType.with, TSESTree.WithStatement, Scope> {
constructor(scopeManager: ScopeManager, upperScope: WithScope['upper'], block: WithScope['block']);
close(scopeManager: ScopeManager): Scope | null;
}
@@ -0,0 +1 @@
{"version":3,"file":"feeds.js","sourceRoot":"https://raw.githubusercontent.com/fb55/domutils/0ab8bcf1ecfc70dfc93291a4cb2496578ac25e9c/src/","sources":["feeds.ts"],"names":[],"mappings":"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 truncated
@@ -0,0 +1 @@
{"version":3,"file":"resolve.int.spec.d.ts","sourceRoot":"","sources":["../../../../src/resolution/actions/resolve.int.spec.ts"],"names":[],"mappings":"AAEA,OAAO,kBAAkB,CAAC"}
@@ -0,0 +1,181 @@
#!/usr/bin/env python3
# Copyright (c) 2012 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.
"""Prints the information in a sln file in a diffable way.
It first outputs each projects in alphabetical order with their
dependencies.
Then it outputs a possible build order.
"""
import os
import re
import sys
import pretty_vcproj
__author__ = "nsylvain (Nicolas Sylvain)"
def BuildProject(project, built, projects, deps):
# if all dependencies are done, we can build it, otherwise we try to build the
# dependency.
# This is not infinite-recursion proof.
for dep in deps[project]:
if dep not in built:
BuildProject(dep, built, projects, deps)
print(project)
built.append(project)
def ParseSolution(solution_file):
# All projects, their clsid and paths.
projects = dict()
# A list of dependencies associated with a project.
dependencies = dict()
# Regular expressions that matches the SLN format.
# The first line of a project definition.
begin_project = re.compile(
r'^Project\("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942'
r'}"\) = "(.*)", "(.*)", "(.*)"$'
)
# The last line of a project definition.
end_project = re.compile("^EndProject$")
# The first line of a dependency list.
begin_dep = re.compile(r"ProjectSection\(ProjectDependencies\) = postProject$")
# The last line of a dependency list.
end_dep = re.compile("EndProjectSection$")
# A line describing a dependency.
dep_line = re.compile(" *({.*}) = ({.*})$")
in_deps = False
solution = open(solution_file)
for line in solution:
results = begin_project.search(line)
if results:
# Hack to remove icu because the diff is too different.
if results.group(1).find("icu") != -1:
continue
# We remove "_gyp" from the names because it helps to diff them.
current_project = results.group(1).replace("_gyp", "")
projects[current_project] = [
results.group(2).replace("_gyp", ""),
results.group(3),
results.group(2),
]
dependencies[current_project] = []
continue
results = end_project.search(line)
if results:
current_project = None
continue
results = begin_dep.search(line)
if results:
in_deps = True
continue
results = end_dep.search(line)
if results:
in_deps = False
continue
results = dep_line.search(line)
if results and in_deps and current_project:
dependencies[current_project].append(results.group(1))
continue
# Change all dependencies clsid to name instead.
for project in dependencies:
# For each dependencies in this project
new_dep_array = []
for dep in dependencies[project]:
# Look for the project name matching this cldis
for project_info in projects:
if projects[project_info][1] == dep:
new_dep_array.append(project_info)
dependencies[project] = sorted(new_dep_array)
return (projects, dependencies)
def PrintDependencies(projects, deps):
print("---------------------------------------")
print("Dependencies for all projects")
print("---------------------------------------")
print("-- --")
for (project, dep_list) in sorted(deps.items()):
print("Project : %s" % project)
print("Path : %s" % projects[project][0])
if dep_list:
for dep in dep_list:
print(" - %s" % dep)
print("")
print("-- --")
def PrintBuildOrder(projects, deps):
print("---------------------------------------")
print("Build order ")
print("---------------------------------------")
print("-- --")
built = []
for (project, _) in sorted(deps.items()):
if project not in built:
BuildProject(project, built, projects, deps)
print("-- --")
def PrintVCProj(projects):
for project in projects:
print("-------------------------------------")
print("-------------------------------------")
print(project)
print(project)
print(project)
print("-------------------------------------")
print("-------------------------------------")
project_path = os.path.abspath(
os.path.join(os.path.dirname(sys.argv[1]), projects[project][2])
)
pretty = pretty_vcproj
argv = [
"",
project_path,
"$(SolutionDir)=%s\\" % os.path.dirname(sys.argv[1]),
]
argv.extend(sys.argv[3:])
pretty.main(argv)
def main():
# check if we have exactly 1 parameter.
if len(sys.argv) < 2:
print('Usage: %s "c:\\path\\to\\project.sln"' % sys.argv[0])
return 1
(projects, deps) = ParseSolution(sys.argv[1])
PrintDependencies(projects, deps)
PrintBuildOrder(projects, deps)
if "--recursive" in sys.argv:
PrintVCProj(projects)
return 0
if __name__ == "__main__":
sys.exit(main())
@@ -0,0 +1,28 @@
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "mergeRefs", () => $f05dc24eafaeb7e2$export$c9058316764c140e);
/*
* 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 $f05dc24eafaeb7e2$export$c9058316764c140e(...refs) {
if (refs.length === 1 && refs[0]) return refs[0];
return (value)=>{
for (let ref of refs){
if (typeof ref === 'function') ref(value);
else if (ref != null) ref.current = value;
}
};
}
//# sourceMappingURL=mergeRefs.main.js.map
@@ -0,0 +1,55 @@
#!/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.
"""These functions are executed via gyp-flock-tool when using the Makefile
generator. Used on systems that don't have a built-in flock."""
import fcntl
import os
import struct
import subprocess
import sys
def main(args):
executor = FlockTool()
executor.Dispatch(args)
class FlockTool:
"""This class emulates the 'flock' command."""
def Dispatch(self, args):
"""Dispatches a string command to a method."""
if len(args) < 1:
raise Exception("Not enough arguments")
method = "Exec%s" % self._CommandifyName(args[0])
getattr(self, method)(*args[1:])
def _CommandifyName(self, name_string):
"""Transforms a tool name like copy-info-plist to CopyInfoPlist"""
return name_string.title().replace("-", "")
def ExecFlock(self, lockfile, *cmd_list):
"""Emulates the most basic behavior of Linux's flock(1)."""
# Rely on exception handling to report errors.
# Note that the stock python on SunOS has a bug
# where fcntl.flock(fd, LOCK_EX) always fails
# with EBADF, that's why we use this F_SETLK
# hack instead.
fd = os.open(lockfile, os.O_WRONLY | os.O_NOCTTY | os.O_CREAT, 0o666)
if sys.platform.startswith("aix") or sys.platform == "os400":
# Python on AIX is compiled with LARGEFILE support, which changes the
# struct size.
op = struct.pack("hhIllqq", fcntl.F_WRLCK, 0, 0, 0, 0, 0, 0)
else:
op = struct.pack("hhllhhl", fcntl.F_WRLCK, 0, 0, 0, 0, 0, 0)
fcntl.fcntl(fd, fcntl.F_SETLK, op)
return subprocess.call(cmd_list)
if __name__ == "__main__":
sys.exit(main(sys.argv[1:]))
@@ -0,0 +1,80 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("@typescript-eslint/utils");
const util_1 = require("../util");
exports.default = (0, util_1.createRule)({
name: 'no-array-delete',
meta: {
type: 'problem',
docs: {
description: 'Disallow using the `delete` operator on array values',
recommended: 'recommended',
requiresTypeChecking: true,
},
hasSuggestions: true,
messages: {
noArrayDelete: 'Using the `delete` operator with an array expression is unsafe.',
useSplice: 'Use `array.splice()` instead.',
},
schema: [],
},
defaultOptions: [],
create(context) {
const services = (0, util_1.getParserServices)(context);
const checker = services.program.getTypeChecker();
function isUnderlyingTypeArray(type) {
const predicate = (t) => checker.isArrayType(t) || checker.isTupleType(t);
if (type.isUnion()) {
return type.types.every(predicate);
}
if (type.isIntersection()) {
return type.types.some(predicate);
}
return predicate(type);
}
return {
'UnaryExpression[operator="delete"]'(node) {
const { argument } = node;
if (argument.type !== utils_1.AST_NODE_TYPES.MemberExpression) {
return;
}
const type = (0, util_1.getConstrainedTypeAtLocation)(services, argument.object);
if (!isUnderlyingTypeArray(type)) {
return;
}
context.report({
node,
messageId: 'noArrayDelete',
suggest: [
{
messageId: 'useSplice',
fix(fixer) {
const { object, property } = argument;
const shouldHaveParentheses = property.type === utils_1.AST_NODE_TYPES.SequenceExpression;
const nodeMap = services.esTreeNodeToTSNodeMap;
const target = nodeMap.get(object).getText();
const rawKey = nodeMap.get(property).getText();
const key = shouldHaveParentheses ? `(${rawKey})` : rawKey;
let suggestion = `${target}.splice(${key}, 1)`;
const comments = context.sourceCode.getCommentsInside(node);
if (comments.length > 0) {
const indentationCount = node.loc.start.column;
const indentation = ' '.repeat(indentationCount);
const commentsText = comments
.map(comment => {
return comment.type === utils_1.AST_TOKEN_TYPES.Line
? `//${comment.value}`
: `/*${comment.value}*/`;
})
.join(`\n${indentation}`);
suggestion = `${commentsText}\n${indentation}${suggestion}`;
}
return fixer.replaceText(node, suggestion);
},
},
],
});
},
};
},
});
@@ -0,0 +1,21 @@
Copyright (c) 2012 Heather Arthur
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,64 @@
"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/modal-transition.ts
var modal_transition_exports = {};
__export(modal_transition_exports, {
scaleInOut: () => scaleInOut
});
module.exports = __toCommonJS(modal_transition_exports);
var import_framer_utils = require("@heroui/framer-utils");
var scaleInOut = {
enter: {
scale: "var(--scale-enter)",
y: "var(--slide-enter)",
opacity: 1,
willChange: "auto",
transition: {
scale: {
duration: 0.4,
ease: import_framer_utils.TRANSITION_EASINGS.ease
},
opacity: {
duration: 0.4,
ease: import_framer_utils.TRANSITION_EASINGS.ease
},
y: {
type: "spring",
bounce: 0,
duration: 0.6
}
}
},
exit: {
scale: "var(--scale-exit)",
y: "var(--slide-exit)",
opacity: 0,
willChange: "transform",
transition: {
duration: 0.3,
ease: import_framer_utils.TRANSITION_EASINGS.ease
}
}
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
scaleInOut
});
@@ -0,0 +1,5 @@
export declare class NodeIDispatcherAdapter {
dispatchRequest(_arg: unknown): void;
dispatchCall(_arg: unknown): void;
dispatchCallWithJson(_arg: unknown): void;
}
@@ -0,0 +1,37 @@
import arrayMap from './_arrayMap.js';
import baseIteratee from './_baseIteratee.js';
import basePickBy from './_basePickBy.js';
import getAllKeysIn from './_getAllKeysIn.js';
/**
* Creates an object composed of the `object` properties `predicate` returns
* truthy for. The predicate is invoked with two arguments: (value, key).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Object
* @param {Object} object The source object.
* @param {Function} [predicate=_.identity] The function invoked per property.
* @returns {Object} Returns the new object.
* @example
*
* var object = { 'a': 1, 'b': '2', 'c': 3 };
*
* _.pickBy(object, _.isNumber);
* // => { 'a': 1, 'c': 3 }
*/
function pickBy(object, predicate) {
if (object == null) {
return {};
}
var props = arrayMap(getAllKeysIn(object), function(prop) {
return [prop];
});
predicate = baseIteratee(predicate);
return basePickBy(object, props, function(value, path) {
return predicate(value, path[0]);
});
}
export default pickBy;
@@ -0,0 +1,5 @@
/**
* @typedef {import('./lib/index.js').Options} Options
*/
export {VFileMessage} from './lib/index.js'
@@ -0,0 +1,26 @@
'use strict'
const SemVer = require('../classes/semver')
const Range = require('../classes/range')
const minSatisfying = (versions, range, options) => {
let min = null
let minSV = null
let rangeObj = null
try {
rangeObj = new Range(range, options)
} catch (er) {
return null
}
versions.forEach((v) => {
if (rangeObj.test(v)) {
// satisfies(v, range, options)
if (!min || minSV.compare(v) === 1) {
// compare(min, v, true)
min = v
minSV = new SemVer(min, options)
}
}
})
return min
}
module.exports = minSatisfying
@@ -0,0 +1 @@
{"version":3,"file":"updateReflectMetadata.spec.d.ts","sourceRoot":"","sources":["../../../../src/reflectMetadata/utils/updateReflectMetadata.spec.ts"],"names":[],"mappings":"AAUA,OAAO,kBAAkB,CAAC"}
@@ -0,0 +1 @@
{"version":3,"sources":["inspect.js"],"names":["Object","defineProperty","exports","value","util_js_1","require","zeroWidth","line","start","delimiter","postDelimiter","tag","postTag","name","postName","type","postType","description","end","lineEnd","headers","fields","keys","repr","x","isSpace","length","frame","join","align","width","tokens","map","k","padEnd","inspect","source","_a","_b","assign","f","number","Math","max","toString","lines","push","padStart","default"],"mappings":"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","sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst util_js_1 = require(\"../util.js\");\nconst zeroWidth = {\n line: 0,\n start: 0,\n delimiter: 0,\n postDelimiter: 0,\n tag: 0,\n postTag: 0,\n name: 0,\n postName: 0,\n type: 0,\n postType: 0,\n description: 0,\n end: 0,\n lineEnd: 0,\n};\nconst headers = { lineEnd: 'CR' };\nconst fields = Object.keys(zeroWidth);\nconst repr = (x) => ((0, util_js_1.isSpace)(x) ? `{${x.length}}` : x);\nconst frame = (line) => '|' + line.join('|') + '|';\nconst align = (width, tokens) => Object.keys(tokens).map((k) => repr(tokens[k]).padEnd(width[k]));\nfunction inspect({ source }) {\n var _a, _b;\n if (source.length === 0)\n return '';\n const width = Object.assign({}, zeroWidth);\n for (const f of fields)\n width[f] = ((_a = headers[f]) !== null && _a !== void 0 ? _a : f).length;\n for (const { number, tokens } of source) {\n width.line = Math.max(width.line, number.toString().length);\n for (const k in tokens)\n width[k] = Math.max(width[k], repr(tokens[k]).length);\n }\n const lines = [[], []];\n for (const f of fields)\n lines[0].push(((_b = headers[f]) !== null && _b !== void 0 ? _b : f).padEnd(width[f]));\n for (const f of fields)\n lines[1].push('-'.padEnd(width[f], '-'));\n for (const { number, tokens } of source) {\n const line = number.toString().padStart(width.line);\n lines.push([line, ...align(width, tokens)]);\n }\n return lines.map(frame).join('\\n');\n}\nexports.default = inspect;\n"],"file":"inspect.cjs"}
@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=buildUnmanagedMetadataFromMaybeManagedMetadata.spec.d.ts.map
@@ -0,0 +1,6 @@
module.exports = isPromise;
module.exports.default = isPromise;
function isPromise(obj) {
return !!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
}
@@ -0,0 +1,22 @@
(The MIT License)
Copyright (c) 2012–2024 LearnBoost <tj@learnboost.com> and other contributors;
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,14 @@
import * as proto from '../../../packet/transformer/proto';
import { OidbPacket, PacketTransformer } from '../../../packet/transformer/base';
declare class GroupSign extends PacketTransformer<typeof proto.OidbSvcTrpcTcpBase> {
build(uin: number, groupCode: number): OidbPacket;
parse(data: Buffer): import("napcat-protobuf").any;
subCommand: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
errorCode: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
body: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.BYTES, false, false>;
errorMsg: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.STRING, true, false>;
isReserved: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
}>;
}
declare const _default: GroupSign;
export default _default;
Loaded 100 of 35554 files, more files were not shown because too many files have changed in this diff. Show more