Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@kagchi/nextify

Package Overview
Dependencies
Maintainers
0
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kagchi/nextify - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

29

dist/index.d.ts

@@ -1,3 +0,26 @@

export * from "./components/conditionals";
export * from "./components/lists";
export * from "./typings";
import React from 'react';
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
interface BaseConditionOptions {
when: boolean;
fallback: React.ReactNode;
}
interface ShowConditionOptions extends PartialBy<BaseConditionOptions, "fallback"> {
children: React.ReactNode;
}
declare const Show: ({ when, children, fallback }: ShowConditionOptions) => React.JSX.Element;
interface SwitchConditionOptions extends PartialBy<BaseConditionOptions, "fallback"> {
children: React.ReactNode;
}
declare const Switch: ({ children, fallback }: SwitchConditionOptions) => React.JSX.Element;
interface ForListOptions<T> {
each: T[];
children: (item: T, index: number) => React.ReactNode;
}
declare const For: <T>({ each, children }: ForListOptions<T>) => React.JSX.Element;
export { type BaseConditionOptions, For, type ForListOptions, type Omit, type PartialBy, Show, type ShowConditionOptions, Switch, type SwitchConditionOptions };

49

dist/index.js

@@ -1,15 +0,36 @@

(()=>{var U=Object.create;var $=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames;var H=Object.getPrototypeOf,W=Object.prototype.hasOwnProperty;var R=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var G=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let u of z(t))!W.call(e,u)&&u!==r&&$(e,u,{get:()=>t[u],enumerable:!(n=M(t,u))||n.enumerable});return e};var w=(e,t,r)=>(r=e!=null?U(H(e)):{},G(t||!e||!e.__esModule?$(r,"default",{value:e,enumerable:!0}):r,e));var D=R(o=>{"use strict";var m=Symbol.for("react.element"),J=Symbol.for("react.portal"),K=Symbol.for("react.fragment"),Q=Symbol.for("react.strict_mode"),X=Symbol.for("react.profiler"),Y=Symbol.for("react.provider"),Z=Symbol.for("react.context"),ee=Symbol.for("react.forward_ref"),te=Symbol.for("react.suspense"),re=Symbol.for("react.memo"),ne=Symbol.for("react.lazy"),j=Symbol.iterator;function oe(e){return e===null||typeof e!="object"?null:(e=j&&e[j]||e["@@iterator"],typeof e=="function"?e:null)}var T={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},B=Object.assign,I={};function y(e,t,r){this.props=e,this.context=t,this.refs=I,this.updater=r||T}y.prototype.isReactComponent={};y.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};y.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function V(){}V.prototype=y.prototype;function C(e,t,r){this.props=e,this.context=t,this.refs=I,this.updater=r||T}var E=C.prototype=new V;E.constructor=C;B(E,y.prototype);E.isPureReactComponent=!0;var P=Array.isArray,N=Object.prototype.hasOwnProperty,k={current:null},F={key:!0,ref:!0,__self:!0,__source:!0};function q(e,t,r){var n,u={},s=null,f=null;if(t!=null)for(n in t.ref!==void 0&&(f=t.ref),t.key!==void 0&&(s=""+t.key),t)N.call(t,n)&&!F.hasOwnProperty(n)&&(u[n]=t[n]);var c=arguments.length-2;if(c===1)u.children=r;else if(1<c){for(var i=Array(c),p=0;p<c;p++)i[p]=arguments[p+2];u.children=i}if(e&&e.defaultProps)for(n in c=e.defaultProps,c)u[n]===void 0&&(u[n]=c[n]);return{$$typeof:m,type:e,key:s,ref:f,props:u,_owner:k.current}}function ue(e,t){return{$$typeof:m,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function b(e){return typeof e=="object"&&e!==null&&e.$$typeof===m}function ie(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(r){return t[r]})}var g=/\/+/g;function x(e,t){return typeof e=="object"&&e!==null&&e.key!=null?ie(""+e.key):t.toString(36)}function _(e,t,r,n,u){var s=typeof e;(s==="undefined"||s==="boolean")&&(e=null);var f=!1;if(e===null)f=!0;else switch(s){case"string":case"number":f=!0;break;case"object":switch(e.$$typeof){case m:case J:f=!0}}if(f)return f=e,u=u(f),e=n===""?"."+x(f,0):n,P(u)?(r="",e!=null&&(r=e.replace(g,"$&/")+"/"),_(u,t,r,"",function(p){return p})):u!=null&&(b(u)&&(u=ue(u,r+(!u.key||f&&f.key===u.key?"":(""+u.key).replace(g,"$&/")+"/")+e)),t.push(u)),1;if(f=0,n=n===""?".":n+":",P(e))for(var c=0;c<e.length;c++){s=e[c];var i=n+x(s,c);f+=_(s,t,r,i,u)}else if(i=oe(e),typeof i=="function")for(e=i.call(e),c=0;!(s=e.next()).done;)s=s.value,i=n+x(s,c++),f+=_(s,t,r,i,u);else if(s==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return f}function h(e,t,r){if(e==null)return e;var n=[],u=0;return _(e,n,"","",function(s){return t.call(r,s,u++)}),n}function se(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(r){(e._status===0||e._status===-1)&&(e._status=1,e._result=r)},function(r){(e._status===0||e._status===-1)&&(e._status=2,e._result=r)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var l={current:null},v={transition:null},ce={ReactCurrentDispatcher:l,ReactCurrentBatchConfig:v,ReactCurrentOwner:k};function A(){throw Error("act(...) is not supported in production builds of React.")}o.Children={map:h,forEach:function(e,t,r){h(e,function(){t.apply(this,arguments)},r)},count:function(e){var t=0;return h(e,function(){t++}),t},toArray:function(e){return h(e,function(t){return t})||[]},only:function(e){if(!b(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};o.Component=y;o.Fragment=K;o.Profiler=X;o.PureComponent=C;o.StrictMode=Q;o.Suspense=te;o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ce;o.act=A;o.cloneElement=function(e,t,r){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var n=B({},e.props),u=e.key,s=e.ref,f=e._owner;if(t!=null){if(t.ref!==void 0&&(s=t.ref,f=k.current),t.key!==void 0&&(u=""+t.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(i in t)N.call(t,i)&&!F.hasOwnProperty(i)&&(n[i]=t[i]===void 0&&c!==void 0?c[i]:t[i])}var i=arguments.length-2;if(i===1)n.children=r;else if(1<i){c=Array(i);for(var p=0;p<i;p++)c[p]=arguments[p+2];n.children=c}return{$$typeof:m,type:e.type,key:u,ref:s,props:n,_owner:f}};o.createContext=function(e){return e={$$typeof:Z,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:Y,_context:e},e.Consumer=e};o.createElement=q;o.createFactory=function(e){var t=q.bind(null,e);return t.type=e,t};o.createRef=function(){return{current:null}};o.forwardRef=function(e){return{$$typeof:ee,render:e}};o.isValidElement=b;o.lazy=function(e){return{$$typeof:ne,_payload:{_status:-1,_result:e},_init:se}};o.memo=function(e,t){return{$$typeof:re,type:e,compare:t===void 0?null:t}};o.startTransition=function(e){var t=v.transition;v.transition={};try{e()}finally{v.transition=t}};o.unstable_act=A;o.useCallback=function(e,t){return l.current.useCallback(e,t)};o.useContext=function(e){return l.current.useContext(e)};o.useDebugValue=function(){};o.useDeferredValue=function(e){return l.current.useDeferredValue(e)};o.useEffect=function(e,t){return l.current.useEffect(e,t)};o.useId=function(){return l.current.useId()};o.useImperativeHandle=function(e,t,r){return l.current.useImperativeHandle(e,t,r)};o.useInsertionEffect=function(e,t){return l.current.useInsertionEffect(e,t)};o.useLayoutEffect=function(e,t){return l.current.useLayoutEffect(e,t)};o.useMemo=function(e,t){return l.current.useMemo(e,t)};o.useReducer=function(e,t,r){return l.current.useReducer(e,t,r)};o.useRef=function(e){return l.current.useRef(e)};o.useState=function(e){return l.current.useState(e)};o.useSyncExternalStore=function(e,t,r){return l.current.useSyncExternalStore(e,t,r)};o.useTransition=function(){return l.current.useTransition()};o.version="18.3.1"});var S=R((pe,L)=>{"use strict";L.exports=D()});var d=w(S(),1),ae=({when:e,children:t,fallback:r})=>e&&d.default.isValidElement(t)?d.default.createElement(d.default.Fragment,null,t):d.default.createElement(d.default.Fragment,null,r);var a=w(S(),1),de=({children:e,fallback:t})=>{let r=a.default.Children.toArray(e);for(let n of r)if(a.default.isValidElement(n)&&typeof n=="object"&&"props"in n&&n.props&&"when"in n.props&&typeof n.props.when=="boolean"&&n.props.when)return a.default.createElement(a.default.Fragment,null,n);return a.default.createElement(a.default.Fragment,null,t)};var O=w(S(),1),Se=({each:e,children:t})=>O.default.createElement(O.default.Fragment,null,e.map((r,n)=>t(r,n)));})();
/*! Bundled license information:
"use client";
var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
react/cjs/react.production.min.js:
(**
* @license React
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
*/
//# sourceMappingURL=index.js.map
// src/components/conditionals/Show.tsx
import React from "react";
var Show = /* @__PURE__ */ __name(({ when, children, fallback }) => {
if (when && React.isValidElement(children)) {
return /* @__PURE__ */ React.createElement(React.Fragment, null, children);
}
return /* @__PURE__ */ React.createElement(React.Fragment, null, fallback);
}, "Show");
// src/components/conditionals/Switch.tsx
import React2 from "react";
var Switch = /* @__PURE__ */ __name(({ children, fallback }) => {
const matches = React2.Children.toArray(children);
for (const match of matches) {
if (React2.isValidElement(match) && typeof match === "object" && "props" in match && match.props && "when" in match.props && typeof match.props.when === "boolean" && match.props.when) {
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, match);
}
}
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, fallback);
}, "Switch");
// src/components/lists/For.tsx
import React3 from "react";
var For = /* @__PURE__ */ __name(({ each, children }) => {
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, each.map((item, index) => children(item, index)));
}, "For");
export {
For,
Show,
Switch
};
//# sourceMappingURL=index.js.map
{
"name": "@kagchi/nextify",
"version": "1.0.0",
"version": "1.1.0",
"description": "A Utilities components for ReactJS",
"main": "dist",
"scripts": {

@@ -10,9 +9,20 @@ "test": "echo \"Error: no test specified\" && exit 1",

"lint:fix": "eslint src --fix",
"build": "rimraf dist && tsc && node build"
"build": "rimraf dist && tsup"
},
"types": "./dist/index.d.ts",
"exports": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
"import": {
"types": "./dist/index.d.ts",
"default": "./dist/esm/index.js"
},
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"main": "dist/index.js",
"module": "dist/index.js",
"typings": "dist/index.d.ts",
"sideEffects": [
"./dist/index.js"
],
"repository": {

@@ -52,7 +62,10 @@ "type": "git",

"eslint": "^8.57.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"rimraf": "^6.0.1",
"tsup": "^8.2.3",
"typescript": "^5.5.4"
},
"dependencies": {
"react": "^18.3.1"
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc