@spark-ui/internal-utils 5.3.9 → 5.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,16 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [5.4.1](https://github.com/adevinta/spark/compare/v5.4.0...v5.4.1) (2024-09-24)
7
+
8
+ **Note:** Version bump only for package @spark-ui/internal-utils
9
+
10
+ # [5.4.0](https://github.com/adevinta/spark/compare/v5.3.9...v5.4.0) (2024-09-18)
11
+
12
+ ### Features
13
+
14
+ - **internal-utils:** add "omit" internal util ([288f3cc](https://github.com/adevinta/spark/commit/288f3cc2fbc6bb49a5ce4d2cf6e43088be2c49a6))
15
+
6
16
  ## [5.3.9](https://github.com/adevinta/spark/compare/v5.3.8...v5.3.9) (2024-09-17)
7
17
 
8
18
  **Note:** Version bump only for package @spark-ui/internal-utils
package/dist/index.d.ts CHANGED
@@ -4,3 +4,4 @@ export * as VariantTypes from './variants/types';
4
4
  export * as variantConstants from './variants/constants';
5
5
  export { deepFind } from './react-children-utilities/deepFind';
6
6
  export { createSplitProps } from './create-split-props';
7
+ export { omit } from './object/omit';
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react"),a=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),d=Object.freeze(Object.defineProperty({__proto__:null,designs:["filled","outlined","tinted","ghost","contrast","dashed"],intents:["current","main","support","success","error","info","alert","danger","neutral","surface","accent","basic"],shapes:["rounded","square","pill"],sizes:["current","sm","md","lg","xl"]},Symbol.toStringTag,{value:"Module"}));function u(e){return s.isValidElement(e)&&function(r){return s.isValidElement(r)&&!!r.props.children}(e)&&s.Children.toArray(e.props.children).reduce((r,t)=>r||s.isValidElement(t),!1)}exports.VariantTypes=a,exports.createSplitProps=()=>(e,r)=>r.reduce((t,i)=>{const[n,o]=t,l=i;return o[l]!==void 0&&(n[l]=o[l]),delete o[l],[n,o]},[{},{...e}]),exports.deepFind=function e(r,t){let i;return s.Children.toArray(r).find((n,o,l)=>t(n,o,l)?(i=n,!0):!(!s.isValidElement(n)||!u(n))&&(i=e(n.props.children,t),i!==void 0)),i},exports.makeVariants=function(e){return e},exports.tw=function(e){return e},exports.variantConstants=d;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react"),c=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),u=Object.freeze(Object.defineProperty({__proto__:null,designs:["filled","outlined","tinted","ghost","contrast","dashed"],intents:["current","main","support","success","error","info","alert","danger","neutral","surface","accent","basic"],shapes:["rounded","square","pill"],sizes:["current","sm","md","lg","xl"]},Symbol.toStringTag,{value:"Module"}));function a(e){return s.isValidElement(e)&&function(n){return s.isValidElement(n)&&!!n.props.children}(e)&&s.Children.toArray(e.props.children).reduce((n,r)=>n||s.isValidElement(r),!1)}exports.VariantTypes=c,exports.createSplitProps=()=>(e,n)=>n.reduce((r,i)=>{const[t,o]=r,l=i;return o[l]!==void 0&&(t[l]=o[l]),delete o[l],[t,o]},[{},{...e}]),exports.deepFind=function e(n,r){let i;return s.Children.toArray(n).find((t,o,l)=>r(t,o,l)?(i=t,!0):!(!s.isValidElement(t)||!a(t))&&(i=e(t.props.children,r),i!==void 0)),i},exports.makeVariants=function(e){return e},exports.omit=function(e,n){const r={};return Object.keys(e).forEach(i=>{const t=i;n.includes(t)||(r[t]=e[t])}),r},exports.tw=function(e){return e},exports.variantConstants=u;
package/dist/index.mjs CHANGED
@@ -1,29 +1,37 @@
1
- import { isValidElement as i, Children as l } from "react";
1
+ import { isValidElement as i, Children as c } from "react";
2
2
  function p(e) {
3
3
  return e;
4
4
  }
5
5
  function f(e) {
6
6
  return e;
7
7
  }
8
- const m = Object.freeze(Object.defineProperty({ __proto__: null }, Symbol.toStringTag, { value: "Module" })), g = Object.freeze(Object.defineProperty({ __proto__: null, designs: ["filled", "outlined", "tinted", "ghost", "contrast", "dashed"], intents: ["current", "main", "support", "success", "error", "info", "alert", "danger", "neutral", "surface", "accent", "basic"], shapes: ["rounded", "square", "pill"], sizes: ["current", "sm", "md", "lg", "xl"] }, Symbol.toStringTag, { value: "Module" }));
8
+ const m = Object.freeze(Object.defineProperty({ __proto__: null }, Symbol.toStringTag, { value: "Module" })), b = Object.freeze(Object.defineProperty({ __proto__: null, designs: ["filled", "outlined", "tinted", "ghost", "contrast", "dashed"], intents: ["current", "main", "support", "success", "error", "info", "alert", "danger", "neutral", "surface", "accent", "basic"], shapes: ["rounded", "square", "pill"], sizes: ["current", "sm", "md", "lg", "xl"] }, Symbol.toStringTag, { value: "Module" }));
9
9
  function u(e) {
10
10
  return i(e) && function(t) {
11
11
  return i(t) && !!t.props.children;
12
- }(e) && l.toArray(e.props.children).reduce((t, r) => t || i(r), !1);
12
+ }(e) && c.toArray(e.props.children).reduce((t, n) => t || i(n), !1);
13
13
  }
14
- function c(e, t) {
15
- let r;
16
- return l.toArray(e).find((n, s, o) => t(n, s, o) ? (r = n, !0) : !(!i(n) || !u(n)) && (r = c(n.props.children, t), r !== void 0)), r;
14
+ function l(e, t) {
15
+ let n;
16
+ return c.toArray(e).find((r, o, s) => t(r, o, s) ? (n = r, !0) : !(!i(r) || !u(r)) && (n = l(r.props.children, t), n !== void 0)), n;
17
17
  }
18
- const _ = () => (e, t) => t.reduce((r, n) => {
19
- const [s, o] = r, a = n;
20
- return o[a] !== void 0 && (s[a] = o[a]), delete o[a], [s, o];
18
+ const g = () => (e, t) => t.reduce((n, r) => {
19
+ const [o, s] = n, a = r;
20
+ return s[a] !== void 0 && (o[a] = s[a]), delete s[a], [o, s];
21
21
  }, [{}, { ...e }]);
22
+ function h(e, t) {
23
+ const n = {};
24
+ return Object.keys(e).forEach((r) => {
25
+ const o = r;
26
+ t.includes(o) || (n[o] = e[o]);
27
+ }), n;
28
+ }
22
29
  export {
23
30
  m as VariantTypes,
24
- _ as createSplitProps,
25
- c as deepFind,
31
+ g as createSplitProps,
32
+ l as deepFind,
26
33
  f as makeVariants,
34
+ h as omit,
27
35
  p as tw,
28
- g as variantConstants
36
+ b as variantConstants
29
37
  };
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Returns a partial copy of an object omitting the keys specified.
3
+ *
4
+ * @example
5
+ *
6
+ * const item = {
7
+ * label: 'ten',
8
+ * id: 10,
9
+ * isValid: true
10
+ * }
11
+ *
12
+ * const updatedItem = omit(item, ['label', 'isValid'])
13
+ * // updatedItem === { id: 10 }
14
+ *
15
+ */
16
+ export declare function omit<T extends object, K extends keyof T>(obj: T, keys: readonly (K | undefined)[]): Omit<T, K>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spark-ui/internal-utils",
3
- "version": "5.3.9",
3
+ "version": "5.4.1",
4
4
  "description": "package for sharing reusable code and resources across the codebase",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -34,5 +34,5 @@
34
34
  },
35
35
  "homepage": "https://sparkui.vercel.app",
36
36
  "license": "MIT",
37
- "gitHead": "530447275e5959a9c531ff2ab28d9bc3bef24c6f"
37
+ "gitHead": "d21f736624a2744e453b3774db1bb4f1a0a95892"
38
38
  }