Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

@diceui/shared

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@diceui/shared - npm Package Compare versions

Comparing version
0.7.0
to
0.8.0
+4
-2
dist/index.d.mts

@@ -29,3 +29,3 @@ import * as React from 'react';

displayName: string;
}, <Required extends boolean = true>(consumerName: string, required?: Required) => Required extends true ? T : T | undefined];
}, <Optional extends boolean = false>(consumerName: string, optional?: Optional) => Optional extends true ? T | undefined : T];

@@ -38,2 +38,3 @@ /**

type PrimitivePropsWithRef<E extends IntrinsicElementsKeys> = Omit<React.JSX.IntrinsicElements[E], "ref"> & {
/** Whether to render the wrapped component and merge their props. */
asChild?: boolean;

@@ -49,2 +50,3 @@ ref?: React.Ref<React.ElementRef<E>>;

* Flush custom event dispatch for React 18 batching
* @see https://github.com/facebook/react/blob/a8a4742f1c54493df00da648a3f9d26e3db9c8b5/packages/react-dom/src/events/ReactDOMEventListener.js#L294-L350
*/

@@ -56,3 +58,3 @@ declare function dispatchDiscreteCustomEvent<E extends CustomEvent>(target: E["target"], event: E): void;

* The container to mount the portal into.
* @default globalThis.document?.body
* @default document.body
*/

@@ -59,0 +61,0 @@ container?: HTMLElement | DocumentFragment | null;

@@ -29,3 +29,3 @@ import * as React from 'react';

displayName: string;
}, <Required extends boolean = true>(consumerName: string, required?: Required) => Required extends true ? T : T | undefined];
}, <Optional extends boolean = false>(consumerName: string, optional?: Optional) => Optional extends true ? T | undefined : T];

@@ -38,2 +38,3 @@ /**

type PrimitivePropsWithRef<E extends IntrinsicElementsKeys> = Omit<React.JSX.IntrinsicElements[E], "ref"> & {
/** Whether to render the wrapped component and merge their props. */
asChild?: boolean;

@@ -49,2 +50,3 @@ ref?: React.Ref<React.ElementRef<E>>;

* Flush custom event dispatch for React 18 batching
* @see https://github.com/facebook/react/blob/a8a4742f1c54493df00da648a3f9d26e3db9c8b5/packages/react-dom/src/events/ReactDOMEventListener.js#L294-L350
*/

@@ -56,3 +58,3 @@ declare function dispatchDiscreteCustomEvent<E extends CustomEvent>(target: E["target"], event: E): void;

* The container to mount the portal into.
* @default globalThis.document?.body
* @default document.body
*/

@@ -59,0 +61,0 @@ container?: HTMLElement | DocumentFragment | null;

@@ -41,3 +41,3 @@ import * as React31 from 'react';

var VAR_AVAILABLE_HEIGHT = "--dice-available-height";
var DirectionContext = React31.createContext(void 0);
var DirectionContext = React31.createContext(undefined);
function useDirection(dirProp) {

@@ -115,3 +115,3 @@ const contextDir = React31.useContext(DirectionContext);

padding: collisionPadding,
limiter: sticky === "partial" ? limitShift() : void 0
limiter: sticky === "partial" ? limitShift() : undefined
})

@@ -201,3 +201,3 @@ ] : [],

middleware,
whileElementsMounted: forceMount ? void 0 : (...args) => autoUpdate(...args, autoUpdateOptions),
whileElementsMounted: forceMount ? undefined : (...args) => autoUpdate(...args, autoUpdateOptions),
strategy

@@ -222,3 +222,3 @@ });

}
return void 0;
return undefined;
}, [forceMount, open, elements, update, autoUpdateOptions]);

@@ -383,3 +383,3 @@ const [placementSide = "bottom", placementAlign = "start"] = floatingPlacement.split("-");

});
const isControlled = prop !== void 0;
const isControlled = prop !== undefined;
const value = isControlled ? prop : uncontrolledProp;

@@ -616,3 +616,3 @@ const handleChange = useCallbackRef(onChange);

const value = this.cache.get(key);
if (value !== void 0) {
if (value !== undefined) {
const index = this.keyOrder.indexOf(key);

@@ -636,3 +636,3 @@ if (index > -1) {

const lruKey = this.keyOrder.shift();
if (lruKey !== void 0) {
if (lruKey !== undefined) {
this.cache.delete(lruKey);

@@ -661,3 +661,3 @@ }

const cached = normalizedCache.get(str);
if (cached !== void 0) return cached;
if (cached !== undefined) return cached;
let normalized;

@@ -800,3 +800,3 @@ try {

items: /* @__PURE__ */ new Map(),
groups: groupMap ? /* @__PURE__ */ new Map() : void 0
groups: groupMap ? /* @__PURE__ */ new Map() : undefined
}).current;

@@ -915,3 +915,3 @@ const filter = useFilter({ sensitivity: "base", gapMatch: true });

function onFormReset() {
if (defaultValue !== void 0) {
if (defaultValue !== undefined) {
onResetCallback?.(defaultValue);

@@ -928,7 +928,7 @@ }

// src/hooks/use-id.ts
var useReactId = React31[" useId ".trim().toString()] || (() => void 0);
var useReactId = React31[" useId ".trim().toString()] || (() => undefined);
var count = 0;
function useId(deterministicId) {
const [id, setId] = React31.useState(
typeof useReactId === "function" ? useReactId() : void 0
typeof useReactId === "function" ? useReactId() : undefined
);

@@ -1075,3 +1075,3 @@ useLayoutEffect4(() => {

"data-state": state,
"data-value": value ?? void 0,
"data-value": value ?? undefined,
"data-max": max

@@ -1118,6 +1118,6 @@ }),

function getPlatform() {
return typeof window !== "undefined" && window.navigator != null ? window.navigator.platform : void 0;
return typeof window !== "undefined" && window.navigator != null ? window.navigator.platform : undefined;
}
function testPlatform(re) {
return typeof window !== "undefined" && window.navigator != null ? re.test(window.navigator.platform) : void 0;
return typeof window !== "undefined" && window.navigator != null ? re.test(window.navigator.platform) : undefined;
}

@@ -1377,3 +1377,3 @@

function useSize(element) {
const [size2, setSize] = React31.useState(void 0);
const [size2, setSize] = React31.useState(undefined);
useLayoutEffect4(() => {

@@ -1406,3 +1406,3 @@ if (element) {

}
setSize(void 0);
setSize(undefined);
}, [element]);

@@ -1428,3 +1428,3 @@ return size2;

function findNextItem(items, search, currentItem) {
if (!search) return void 0;
if (!search) return undefined;
const isRepeated = search.length > 1 && Array.from(search).every((char) => char === search[0]);

@@ -1442,3 +1442,3 @@ const normalizedSearch = isRepeated ? search[0] ?? "" : search;

});
return nextItem !== currentItem ? nextItem : void 0;
return nextItem !== currentItem ? nextItem : undefined;
}

@@ -1537,4 +1537,4 @@ function useTypeahead({

"aria-hidden": isCheckInput,
tabIndex: isCheckInput ? -1 : void 0,
defaultChecked: isCheckInput ? checked : void 0,
tabIndex: isCheckInput ? -1 : undefined,
defaultChecked: isCheckInput ? checked : undefined,
style: {

@@ -1563,7 +1563,5 @@ ...props.style,

Provider.displayName = `${rootComponentName}Provider`;
function useContext3(consumerName, required) {
function useContext3(consumerName, optional) {
const context = React31.useContext(Context);
if (context) return context;
if (defaultValue !== void 0) return defaultValue;
if (required) {
if (!context && !optional) {
throw new Error(

@@ -1573,3 +1571,5 @@ `\`${consumerName}\` must be used within \`${rootComponentName}\``

}
return void 0;
if (context) return context;
if (defaultValue !== undefined) return defaultValue;
return undefined;
}

@@ -1581,3 +1581,3 @@ return [Provider, useContext3];

ref(value);
} else if (ref !== null && ref !== void 0) {
} else if (ref !== null && ref !== undefined) {
ref.current = value;

@@ -1597,12 +1597,17 @@ }

function getElementRef(element) {
if (!React31.isValidElement(element)) return void 0;
const propDescriptor = Object.getOwnPropertyDescriptor(element.props, "ref");
const elementDescriptor = Object.getOwnPropertyDescriptor(element, "ref");
if (propDescriptor?.get && "isReactWarning" in propDescriptor.get) {
if (!React31.isValidElement(element)) return undefined;
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
if (mayWarn) {
return element.ref;
}
if (elementDescriptor?.get && "isReactWarning" in elementDescriptor.get) {
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
if (mayWarn) {
return element.props.ref;
}
return element.props.ref ?? element.ref;
return (
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
element.props.ref || element.ref
);
}

@@ -1683,3 +1688,3 @@

});
return /* @__PURE__ */ React31.createElement(SlotClone, { ...slotProps, ref: forwardedRef }, React31.isValidElement(newElement) ? React31.cloneElement(newElement, void 0, newChildren) : null);
return /* @__PURE__ */ React31.createElement(SlotClone, { ...slotProps, ref: forwardedRef }, React31.isValidElement(newElement) ? React31.cloneElement(newElement, undefined, newChildren) : null);
});

@@ -1724,10 +1729,4 @@ Slot.displayName = "Slot";

function dispatchDiscreteCustomEvent(target, event) {
if (target) {
const evt = new CustomEvent(event.type, {
bubbles: true,
cancelable: true,
detail: event.detail
});
target.dispatchEvent(evt);
}
if (!target) return;
ReactDOM.flushSync(() => target.dispatchEvent(event));
}

@@ -1734,0 +1733,0 @@

{
"name": "@diceui/shared",
"version": "0.7.0",
"version": "0.8.0",
"publishConfig": {

@@ -5,0 +5,0 @@ "access": "public"

Sorry, the diff of this file is too big to display