Socket
Socket
Sign inDemoInstall

@project44-manifest/react-utils

Package Overview
Dependencies
14
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.1 to 0.2.2

2

dts/mergeRefs.d.ts

@@ -1,2 +0,2 @@

import * as React from 'react';
import type * as React from 'react';
/**

@@ -3,0 +3,0 @@ * Merge multiple refs into one ref.

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
// Bundled with Packemon: https://packemon.dev
// Platform: browser, Support: stable, Format: esm
import * as React from 'react';

@@ -13,6 +13,6 @@ import clsx from 'clsx';

export { Slot } from '@radix-ui/react-slot';
/**
* Creates react context with a provider and hook.
*/
function createContext(options = {}) {

@@ -22,8 +22,5 @@ const name = options.name;

Context.displayName = name;
const useContext = () => React.useContext(Context);
return [Context.Provider, useContext, Context];
}
const attributes = new Set(['accessKey', 'alt', 'autoCapitalize', 'autoCorrect', 'autoFocus', 'autoSave', 'cellPadding', 'cellSpacing', 'checked', 'children', 'className', 'cols', 'colSpan', 'contentEditable', 'crossOrigin', 'dir', 'disabled', 'download', 'draggable', 'form', 'formAction', 'formEncType', 'formMethod', 'formNoValidate', 'formTarget', 'headers', 'height', 'hidden', 'href', 'hrefLang', 'htmlFor', 'id', 'itemID', 'itemProp', 'itemRef', 'itemScope', 'itemType', 'lang', 'list', 'loop', 'max', 'maxLength', 'media', 'method', 'min', 'minLength', 'multiple', 'muted', 'name', 'noValidate', 'open', 'pattern', 'placeholder', 'poster', 'preload', 'readOnly', 'rel', 'required', 'role', 'rows', 'rowSpan', 'sandbox', 'scope', 'selected', 'size', 'slot', 'spellCheck', 'src', 'srcDoc', 'srcSet', 'start', 'step', 'style', 'tabIndex', 'target', 'title', 'translate', 'type', 'useMap', 'value', 'width', 'wrap']);

@@ -34,10 +31,7 @@ const events = new Set(['onAbort', 'onAbortCapture', 'onAnimationEnd', 'onAnimationEndCapture', 'onAnimationIteration', 'onAnimationIterationCapture', 'onAnimationStart', 'onAnimationStartCapture', 'onAuxClick', 'onAuxClickCapture', 'onBeforeInput', 'onBeforeInputCapture', 'onBlur', 'onBlurCapture', 'onCanPlay', 'onCanPlayCapture', 'onCanPlayThrough', 'onCanPlayThroughCapture', 'onChange', 'onChangeCapture', 'onClick', 'onClickCapture', 'onCompositionEnd', 'onCompositionEndCapture', 'onCompositionStart', 'onCompositionStartCapture', 'onCompositionUpdate', 'onCompositionUpdateCapture', 'onContextMenu', 'onContextMenuCapture', 'onCopy', 'onCopyCapture', 'onCut', 'onCutCapture', 'onDoubleClick', 'onDoubleClickCapture', 'onDrag', 'onDragCapture', 'onDragEnd', 'onDragEndCapture', 'onDragEnter', 'onDragEnterCapture', 'onDragExit', 'onDragExitCapture', 'onDragLeave', 'onDragLeaveCapture', 'onDragOver', 'onDragOverCapture', 'onDragStart', 'onDragStartCapture', 'onDrop', 'onDropCapture', 'onDurationChange', 'onDurationChangeCapture', 'onEmptied', 'onEmptiedCapture', 'onEncrypted', 'onEncryptedCapture', 'onEnded', 'onEndedCapture', 'onError', 'onErrorCapture', 'onFocus', 'onFocusCapture', 'onGotPointerCapture', 'onGotPointerCaptureCapture', 'onInput', 'onInputCapture', 'onInvalid', 'onInvalidCapture', 'onKeyDown', 'onKeyDownCapture', 'onKeyUp', 'onKeyUpCapture', 'onLoad', 'onLoadCapture', 'onLoadedData', 'onLoadedDataCapture', 'onLoadedMetadata', 'onLoadedMetadataCapture', 'onLoadStart', 'onLoadStartCapture', 'onLostPointerCapture', 'onLostPointerCaptureCapture', 'onMouseDown', 'onMouseDownCapture', 'onMouseEnter', 'onMouseLeave', 'onMouseMove', 'onMouseMoveCapture', 'onMouseOut', 'onMouseOutCapture', 'onMouseOver', 'onMouseOverCapture', 'onMouseUp', 'onMouseUpCapture', 'onPaste', 'onPasteCapture', 'onPause', 'onPauseCapture', 'onPlay', 'onPlayCapture', 'onPlaying', 'onPlayingCapture', 'onPointerCancel', 'onPointerCancelCapture', 'onPointerDown', 'onPointerDownCapture', 'onPointerEnter', 'onPointerEnterCapture', 'onPointerLeave', 'onPointerLeaveCapture', 'onPointerMove', 'onPointerMoveCapture', 'onPointerOut', 'onPointerOutCapture', 'onPointerOver', 'onPointerOverCapture', 'onPointerUp', 'onPointerUpCapture', 'onProgress', 'onProgressCapture', 'onRateChange', 'onRateChangeCapture', 'onReset', 'onResetCapture', 'onScroll', 'onScrollCapture', 'onSeeked', 'onSeekedCapture', 'onSeeking', 'onSeekingCapture', 'onSelect', 'onSelectCapture', 'onStalled', 'onStalledCapture', 'onSubmit', 'onSubmitCapture', 'onSuspend', 'onSuspendCapture', 'onTimeUpdate', 'onTimeUpdateCapture', 'onTouchCancel', 'onTouchCancelCapture', 'onTouchEnd', 'onTouchEndCapture', 'onTouchMove', 'onTouchMoveCapture', 'onTouchStart', 'onTouchStartCapture', 'onTransitionEnd', 'onTransitionEndCapture', 'onVolumeChange', 'onVolumeChangeCapture', 'onWaiting', 'onWaitingCapture', 'onWheel', 'onWheelCapture']);

const dataRegex = /^(data-.*)$/;
function filterDOMProps(props, allowedProps) {
const result = {};
for (const prop in props) {
if (Object.prototype.hasOwnProperty.call(props, prop)) {
if (Object.hasOwn(props, prop)) {
const isAllowed = domProps.has(prop) || ariaRegex.test(prop) || dataRegex.test(prop) || allowedProps?.has(prop);
if (isAllowed) {

@@ -48,10 +42,8 @@ result[prop] = props[prop];

}
return result;
}
/**
* Merge all callbacks into a single callback function.
*/
function mergeCallbacks(...fns) {

@@ -66,2 +58,3 @@ return (...args) => {

}
/**

@@ -73,19 +66,20 @@ * Merge multiple sets of props together

*/
function mergeProps(...args) {
const result = _objectSpread({}, args[0]);
for (let i = 1; i < args.length; i += 1) {
const props = args[i];
for (const prop in props) {
if (Object.prototype.hasOwnProperty.call(props, prop)) {
if (Object.hasOwn(props, prop)) {
const mergedValue = result[prop];
const propValue = props[prop]; // Merge classNames
const propValue = props[prop];
// Merge classNames
if (prop === 'className' && typeof mergedValue === 'string' && typeof propValue === 'string') {
result[prop] = clsx(mergedValue, propValue); // Merge styles
result[prop] = clsx(mergedValue, propValue);
// Merge styles
} else if (prop === 'style' && isObject(mergedValue) && isObject(propValue)) {
result[prop] = _objectSpread(_objectSpread({}, mergedValue), propValue); // Merge event handlers that start with `on`
result[prop] = _objectSpread(_objectSpread({}, mergedValue), propValue);
// Merge event handlers that start with `on`
} else if (typeof mergedValue === 'function' && typeof propValue === 'function' && /^on[A-Z]/.test(prop)) {

@@ -99,5 +93,5 @@ result[prop] = mergeCallbacks(mergedValue, propValue);

}
return result;
}
/**

@@ -109,4 +103,2 @@ * Merge multiple refs into one ref.

*/
function mergeRefs(...refs) {

@@ -125,4 +117,3 @@ return value => {

}
export { createContext, filterDOMProps, mergeCallbacks, mergeProps, mergeRefs };
//# sourceMappingURL=index.js.map
// Bundled with Packemon: https://packemon.dev
// Platform: browser, Support: stable, Format: lib
'use strict';
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
Object.defineProperty(exports, '__esModule', {
value: true
});
const React = require('react');
const clsx = require('clsx');
const utils = require('@project44-manifest/utils');
const reactSlot = require('@radix-ui/react-slot');
const _interopDefault = e => e && e.__esModule ? e : {
default: e
};
function _interopNamespace(e) {
if (e && e.__esModule) return e;
const n = Object.create(null);
if (e) {

@@ -42,15 +35,11 @@ for (const k in e) {

}
n.default = e;
return Object.freeze(n);
}
const React__namespace = /*#__PURE__*/_interopNamespace(React);
const clsx__default = /*#__PURE__*/_interopDefault(clsx);
const clsx__default = /*#__PURE__*/_interopDefault(clsx);
/**
* Creates react context with a provider and hook.
*/
function createContext(options = {}) {

@@ -60,8 +49,5 @@ const name = options.name;

Context.displayName = name;
const useContext = () => React__namespace.useContext(Context);
return [Context.Provider, useContext, Context];
}
const attributes = new Set(['accessKey', 'alt', 'autoCapitalize', 'autoCorrect', 'autoFocus', 'autoSave', 'cellPadding', 'cellSpacing', 'checked', 'children', 'className', 'cols', 'colSpan', 'contentEditable', 'crossOrigin', 'dir', 'disabled', 'download', 'draggable', 'form', 'formAction', 'formEncType', 'formMethod', 'formNoValidate', 'formTarget', 'headers', 'height', 'hidden', 'href', 'hrefLang', 'htmlFor', 'id', 'itemID', 'itemProp', 'itemRef', 'itemScope', 'itemType', 'lang', 'list', 'loop', 'max', 'maxLength', 'media', 'method', 'min', 'minLength', 'multiple', 'muted', 'name', 'noValidate', 'open', 'pattern', 'placeholder', 'poster', 'preload', 'readOnly', 'rel', 'required', 'role', 'rows', 'rowSpan', 'sandbox', 'scope', 'selected', 'size', 'slot', 'spellCheck', 'src', 'srcDoc', 'srcSet', 'start', 'step', 'style', 'tabIndex', 'target', 'title', 'translate', 'type', 'useMap', 'value', 'width', 'wrap']);

@@ -72,10 +58,7 @@ const events = new Set(['onAbort', 'onAbortCapture', 'onAnimationEnd', 'onAnimationEndCapture', 'onAnimationIteration', 'onAnimationIterationCapture', 'onAnimationStart', 'onAnimationStartCapture', 'onAuxClick', 'onAuxClickCapture', 'onBeforeInput', 'onBeforeInputCapture', 'onBlur', 'onBlurCapture', 'onCanPlay', 'onCanPlayCapture', 'onCanPlayThrough', 'onCanPlayThroughCapture', 'onChange', 'onChangeCapture', 'onClick', 'onClickCapture', 'onCompositionEnd', 'onCompositionEndCapture', 'onCompositionStart', 'onCompositionStartCapture', 'onCompositionUpdate', 'onCompositionUpdateCapture', 'onContextMenu', 'onContextMenuCapture', 'onCopy', 'onCopyCapture', 'onCut', 'onCutCapture', 'onDoubleClick', 'onDoubleClickCapture', 'onDrag', 'onDragCapture', 'onDragEnd', 'onDragEndCapture', 'onDragEnter', 'onDragEnterCapture', 'onDragExit', 'onDragExitCapture', 'onDragLeave', 'onDragLeaveCapture', 'onDragOver', 'onDragOverCapture', 'onDragStart', 'onDragStartCapture', 'onDrop', 'onDropCapture', 'onDurationChange', 'onDurationChangeCapture', 'onEmptied', 'onEmptiedCapture', 'onEncrypted', 'onEncryptedCapture', 'onEnded', 'onEndedCapture', 'onError', 'onErrorCapture', 'onFocus', 'onFocusCapture', 'onGotPointerCapture', 'onGotPointerCaptureCapture', 'onInput', 'onInputCapture', 'onInvalid', 'onInvalidCapture', 'onKeyDown', 'onKeyDownCapture', 'onKeyUp', 'onKeyUpCapture', 'onLoad', 'onLoadCapture', 'onLoadedData', 'onLoadedDataCapture', 'onLoadedMetadata', 'onLoadedMetadataCapture', 'onLoadStart', 'onLoadStartCapture', 'onLostPointerCapture', 'onLostPointerCaptureCapture', 'onMouseDown', 'onMouseDownCapture', 'onMouseEnter', 'onMouseLeave', 'onMouseMove', 'onMouseMoveCapture', 'onMouseOut', 'onMouseOutCapture', 'onMouseOver', 'onMouseOverCapture', 'onMouseUp', 'onMouseUpCapture', 'onPaste', 'onPasteCapture', 'onPause', 'onPauseCapture', 'onPlay', 'onPlayCapture', 'onPlaying', 'onPlayingCapture', 'onPointerCancel', 'onPointerCancelCapture', 'onPointerDown', 'onPointerDownCapture', 'onPointerEnter', 'onPointerEnterCapture', 'onPointerLeave', 'onPointerLeaveCapture', 'onPointerMove', 'onPointerMoveCapture', 'onPointerOut', 'onPointerOutCapture', 'onPointerOver', 'onPointerOverCapture', 'onPointerUp', 'onPointerUpCapture', 'onProgress', 'onProgressCapture', 'onRateChange', 'onRateChangeCapture', 'onReset', 'onResetCapture', 'onScroll', 'onScrollCapture', 'onSeeked', 'onSeekedCapture', 'onSeeking', 'onSeekingCapture', 'onSelect', 'onSelectCapture', 'onStalled', 'onStalledCapture', 'onSubmit', 'onSubmitCapture', 'onSuspend', 'onSuspendCapture', 'onTimeUpdate', 'onTimeUpdateCapture', 'onTouchCancel', 'onTouchCancelCapture', 'onTouchEnd', 'onTouchEndCapture', 'onTouchMove', 'onTouchMoveCapture', 'onTouchStart', 'onTouchStartCapture', 'onTransitionEnd', 'onTransitionEndCapture', 'onVolumeChange', 'onVolumeChangeCapture', 'onWaiting', 'onWaitingCapture', 'onWheel', 'onWheelCapture']);

const dataRegex = /^(data-.*)$/;
function filterDOMProps(props, allowedProps) {
const result = {};
for (const prop in props) {
if (Object.prototype.hasOwnProperty.call(props, prop)) {
if (Object.hasOwn(props, prop)) {
const isAllowed = domProps.has(prop) || ariaRegex.test(prop) || dataRegex.test(prop) || allowedProps?.has(prop);
if (isAllowed) {

@@ -86,10 +69,8 @@ result[prop] = props[prop];

}
return result;
}
/**
* Merge all callbacks into a single callback function.
*/
function mergeCallbacks(...fns) {

@@ -104,2 +85,3 @@ return (...args) => {

}
/**

@@ -111,19 +93,20 @@ * Merge multiple sets of props together

*/
function mergeProps(...args) {
const result = _objectSpread({}, args[0]);
for (let i = 1; i < args.length; i += 1) {
const props = args[i];
for (const prop in props) {
if (Object.prototype.hasOwnProperty.call(props, prop)) {
if (Object.hasOwn(props, prop)) {
const mergedValue = result[prop];
const propValue = props[prop]; // Merge classNames
const propValue = props[prop];
// Merge classNames
if (prop === 'className' && typeof mergedValue === 'string' && typeof propValue === 'string') {
result[prop] = clsx__default.default(mergedValue, propValue); // Merge styles
result[prop] = clsx__default.default(mergedValue, propValue);
// Merge styles
} else if (prop === 'style' && utils.isObject(mergedValue) && utils.isObject(propValue)) {
result[prop] = _objectSpread(_objectSpread({}, mergedValue), propValue); // Merge event handlers that start with `on`
result[prop] = _objectSpread(_objectSpread({}, mergedValue), propValue);
// Merge event handlers that start with `on`
} else if (typeof mergedValue === 'function' && typeof propValue === 'function' && /^on[A-Z]/.test(prop)) {

@@ -137,5 +120,5 @@ result[prop] = mergeCallbacks(mergedValue, propValue);

}
return result;
}
/**

@@ -147,4 +130,2 @@ * Merge multiple refs into one ref.

*/
function mergeRefs(...refs) {

@@ -163,3 +144,2 @@ return value => {

}
Object.defineProperty(exports, 'Slot', {

@@ -166,0 +146,0 @@ enumerable: true,

{
"name": "@project44-manifest/react-utils",
"version": "0.2.1",
"version": "0.2.2",
"description": "Manifest Design System react dom utilities",

@@ -14,2 +14,3 @@ "license": "MIT",

],
"sideEffects": false,
"main": "./lib/index.js",

@@ -24,13 +25,6 @@ "module": "./esm/index.js",

],
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dts/index.d.ts",
"browser": {
"module": "./esm/index.js",
"import": "./esm/index.js",
"default": "./lib/index.js"
},
"default": "./lib/index.js"
}
"repository": {
"type": "git",
"url": "git@github.com:project-44/manifest.git",
"directory": "packages/react-utils"
},

@@ -40,10 +34,10 @@ "publishConfig": {

},
"repository": {
"type": "git",
"url": "git@github.com:project-44/manifest.git"
},
"scripts": {
"build": "packemon build --addEngines --addExports --declaration --declarationConfig tsconfig.build.json",
"clean": "packemon clean && rm -rf .turbo node_modules *.tsbuildinfo",
"typecheck": "tsc -b"
"build": "packemon build --addEngines --declaration --declarationConfig tsconfig.build.json",
"clean": "rimraf .turbo && packemon clean",
"coverage": "jest --coverage",
"dev": "packemon watch",
"lint": "eslint \"**/*.{ts,tsx}\"",
"test": "jest",
"typecheck": "tsc --noEmit"
},

@@ -55,3 +49,3 @@ "peerDependencies": {

"dependencies": {
"@project44-manifest/utils": "^1.0.0",
"@project44-manifest/utils": "*",
"@radix-ui/react-slot": "^1.0.1",

@@ -61,5 +55,10 @@ "clsx": "^1.1.1"

"devDependencies": {
"@project44-manifest/react-test-utils": "^0.2.0",
"@project44-manifest/react-test-utils": "*",
"eslint": "^8.26.0",
"eslint-config-manifest": "*",
"jest": "^29.2.2",
"jest-preset-manifest": "*",
"react": "^18.1.0",
"react-dom": "^18.1.0"
"react-dom": "^18.1.0",
"tsconfig-manifest": "*"
},

@@ -66,0 +65,0 @@ "packemon": {

@@ -258,3 +258,3 @@ const attributes = new Set([

for (const prop in props) {
if (Object.prototype.hasOwnProperty.call(props, prop)) {
if (Object.hasOwn(props, prop)) {
const isAllowed =

@@ -261,0 +261,0 @@ domProps.has(prop) ||

@@ -19,3 +19,3 @@ import clsx from 'clsx';

for (const prop in props) {
if (Object.prototype.hasOwnProperty.call(props, prop)) {
if (Object.hasOwn(props, prop)) {
const mergedValue = result[prop];

@@ -22,0 +22,0 @@ const propValue = props[prop];

@@ -1,2 +0,2 @@

import * as React from 'react';
import type * as React from 'react';

@@ -3,0 +3,0 @@ /**

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc