mirror of
https://github.com/luxfi/consensus.git
synced 2026-09-24 00:26:58 +00:00
- Removed all Snow consensus code and dependencies - Replaced snow.Context with consensuscontext.Context - Updated all imports and references - Added comprehensive test suites for core packages - Fixed all build errors and test failures - Achieved 100% test pass rate (21 packages passing) - Improved test coverage to 30% Breaking changes: - Removed snow package entirely - Changed VM interface to use VMState instead of snow.State - Updated ChainContext structure Tests added: - core/app_error_test.go: 100% coverage - core/bootstrap_test.go: comprehensive concurrent tests - core/health_test.go: full integration tests - validators/validators_test.go: complete interface tests - version/version_test.go: 100% coverage - codec/codec_test.go: marshal/unmarshal tests - context/context_test.go: all functions tested
53 lines
2.7 KiB
TypeScript
53 lines
2.7 KiB
TypeScript
import * as React from 'react';
|
||
|
||
declare const NODES: readonly ["a", "button", "div", "form", "h2", "h3", "img", "input", "label", "li", "nav", "ol", "p", "select", "span", "svg", "ul"];
|
||
type Primitives = {
|
||
[E in (typeof NODES)[number]]: PrimitiveForwardRefComponent<E>;
|
||
};
|
||
type PrimitivePropsWithRef<E extends React.ElementType> = React.ComponentPropsWithRef<E> & {
|
||
asChild?: boolean;
|
||
};
|
||
interface PrimitiveForwardRefComponent<E extends React.ElementType> extends React.ForwardRefExoticComponent<PrimitivePropsWithRef<E>> {
|
||
}
|
||
declare const Primitive: Primitives;
|
||
/**
|
||
* Flush custom event dispatch
|
||
* https://github.com/radix-ui/primitives/pull/1378
|
||
*
|
||
* React batches *all* event handlers since version 18, this introduces certain considerations when using custom event types.
|
||
*
|
||
* Internally, React prioritises events in the following order:
|
||
* - discrete
|
||
* - continuous
|
||
* - default
|
||
*
|
||
* https://github.com/facebook/react/blob/a8a4742f1c54493df00da648a3f9d26e3db9c8b5/packages/react-dom/src/events/ReactDOMEventListener.js#L294-L350
|
||
*
|
||
* `discrete` is an important distinction as updates within these events are applied immediately.
|
||
* React however, is not able to infer the priority of custom event types due to how they are detected internally.
|
||
* Because of this, it's possible for updates from custom events to be unexpectedly batched when
|
||
* dispatched by another `discrete` event.
|
||
*
|
||
* In order to ensure that updates from custom events are applied predictably, we need to manually flush the batch.
|
||
* This utility should be used when dispatching a custom event from within another `discrete` event, this utility
|
||
* is not necessary when dispatching known event types, or if dispatching a custom type inside a non-discrete event.
|
||
* For example:
|
||
*
|
||
* dispatching a known click 👎
|
||
* target.dispatchEvent(new Event(‘click’))
|
||
*
|
||
* dispatching a custom type within a non-discrete event 👎
|
||
* onScroll={(event) => event.target.dispatchEvent(new CustomEvent(‘customType’))}
|
||
*
|
||
* dispatching a custom type within a `discrete` event 👍
|
||
* onPointerDown={(event) => dispatchDiscreteCustomEvent(event.target, new CustomEvent(‘customType’))}
|
||
*
|
||
* Note: though React classifies `focus`, `focusin` and `focusout` events as `discrete`, it's not recommended to use
|
||
* this utility with them. This is because it's possible for those handlers to be called implicitly during render
|
||
* e.g. when focus is within a component as it is unmounted, or when managing focus on mount.
|
||
*/
|
||
declare function dispatchDiscreteCustomEvent<E extends CustomEvent>(target: E['target'], event: E): void;
|
||
declare const Root: Primitives;
|
||
|
||
export { Primitive, type PrimitivePropsWithRef, Root, dispatchDiscreteCustomEvent };
|