@spark-ui/internal-utils 5.3.9 → 5.4.0
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 +6 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +20 -12
- package/dist/object/omit.d.ts +16 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
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.0](https://github.com/adevinta/spark/compare/v5.3.9...v5.4.0) (2024-09-18)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **internal-utils:** add "omit" internal util ([288f3cc](https://github.com/adevinta/spark/commit/288f3cc2fbc6bb49a5ce4d2cf6e43088be2c49a6))
|
|
11
|
+
|
|
6
12
|
## [5.3.9](https://github.com/adevinta/spark/compare/v5.3.8...v5.3.9) (2024-09-17)
|
|
7
13
|
|
|
8
14
|
**Note:** Version bump only for package @spark-ui/internal-utils
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react"),
|
|
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
|
|
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" })),
|
|
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) &&
|
|
12
|
+
}(e) && c.toArray(e.props.children).reduce((t, n) => t || i(n), !1);
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
let
|
|
16
|
-
return
|
|
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
|
|
19
|
-
const [
|
|
20
|
-
return
|
|
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
|
-
|
|
25
|
-
|
|
31
|
+
g as createSplitProps,
|
|
32
|
+
l as deepFind,
|
|
26
33
|
f as makeVariants,
|
|
34
|
+
h as omit,
|
|
27
35
|
p as tw,
|
|
28
|
-
|
|
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
|
+
"version": "5.4.0",
|
|
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": "
|
|
37
|
+
"gitHead": "53acf762eb029c505aa80f99384be83179a6be0a"
|
|
38
38
|
}
|