@spark-ui/internal-utils 2.2.0 → 2.3.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 +17 -0
- package/README.md +6 -6
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +18 -7
- package/dist/react-children-utilities/deepFind.d.ts +3 -0
- package/dist/react-children-utilities/hasChildren.d.ts +5 -0
- package/dist/react-children-utilities/hasComplexChildren.d.ts +5 -0
- package/package.json +6 -2
- package/vite.config.ts +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,23 @@
|
|
|
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
|
+
## [2.3.1](https://github.com/adevinta/spark/compare/@spark-ui/internal-utils@2.3.0...@spark-ui/internal-utils@2.3.1) (2024-05-30)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **internal-utils:** update rollup conf, include ext peerDeps to avoid deps mismatches at call site ([fc4ec83](https://github.com/adevinta/spark/commit/fc4ec8360965735e148316304e1e2cf3c769d2b3))
|
|
11
|
+
|
|
12
|
+
# [2.3.0](https://github.com/adevinta/spark/compare/@spark-ui/internal-utils@2.2.0...@spark-ui/internal-utils@2.3.0) (2024-03-15)
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
- doc ([5506203](https://github.com/adevinta/spark/commit/55062039dc67c3532be42a4661540052094163d9))
|
|
17
|
+
- **internal-utils:** doc ([0014463](https://github.com/adevinta/spark/commit/00144635922cfc8a082a137070a758261e9fa162))
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
|
|
21
|
+
- **internal-utils:** add deepFind internal util ([597d534](https://github.com/adevinta/spark/commit/597d53412aeac6fcb5cdf890ba6c1f86e4f540c9))
|
|
22
|
+
|
|
6
23
|
# [2.2.0](https://github.com/adevinta/spark/compare/@spark-ui/internal-utils@2.1.3...@spark-ui/internal-utils@2.2.0) (2023-09-28)
|
|
7
24
|
|
|
8
25
|
### Features
|
package/README.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# Internal utils
|
|
2
2
|
> @spark-ui/internal-utils
|
|
3
3
|
|
|
4
|
-
[//]: # (](https://sparkui.vercel.app/?path=/docs/utils-internalutils--docs))
|
|
5
|
+
[//]: # ([](https://sparkui-adv.vercel.app/docs/utils/internal-utils))
|
|
6
|
+
[](https://github.com/adevinta/spark/issues/new?&projects=4&template=bug-report.yml&assignees=&labels=util,internal-utils)
|
|
7
|
+
[](https://www.npmjs.com/package/@spark-ui/internal-utils)
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
This package is part of the [`@spark-ui`](https://github.com/adevinta/spark) react-js user interface component library project.
|
|
11
11
|
|
|
12
|
-

|
|
12
|
+
[](https://github.com/adevinta/spark/issues?q=is%3Aopen+label%3Autil+label%3Ainternal-utils)
|
|
13
|
+
[](https://github.com/adevinta/spark/blob/main/packages/utils/internal-utils/LICENSE.md)
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=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 r.isValidElement(e)&&function(n){return r.isValidElement(n)&&!!n.props.children}(e)&&r.Children.toArray(e.props.children).reduce((n,i)=>n||r.isValidElement(i),!1)}exports.VariantTypes=a,exports.deepFind=function e(n,i){let o;return r.Children.toArray(n).find((t,l,s)=>i(t,l,s)?(o=t,!0):!(!r.isValidElement(t)||!u(t))&&(o=e(t.props.children,i),o!==void 0)),o},exports.makeVariants=function(e){return e},exports.tw=function(e){return e},exports.variantConstants=d;
|
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
import { isValidElement as o, Children as a } from "react";
|
|
2
|
+
function c(e) {
|
|
2
3
|
return e;
|
|
3
4
|
}
|
|
4
|
-
function
|
|
5
|
+
function p(e) {
|
|
5
6
|
return e;
|
|
6
7
|
}
|
|
7
|
-
const
|
|
8
|
+
const f = Object.freeze(Object.defineProperty({ __proto__: null }, Symbol.toStringTag, { value: "Module" })), m = 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
|
+
function l(e) {
|
|
10
|
+
return o(e) && function(n) {
|
|
11
|
+
return o(n) && !!n.props.children;
|
|
12
|
+
}(e) && a.toArray(e.props.children).reduce((n, r) => n || o(r), !1);
|
|
13
|
+
}
|
|
14
|
+
function u(e, n) {
|
|
15
|
+
let r;
|
|
16
|
+
return a.toArray(e).find((t, s, i) => n(t, s, i) ? (r = t, !0) : !(!o(t) || !l(t)) && (r = u(t.props.children, n), r !== void 0)), r;
|
|
17
|
+
}
|
|
8
18
|
export {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
19
|
+
f as VariantTypes,
|
|
20
|
+
u as deepFind,
|
|
21
|
+
p as makeVariants,
|
|
22
|
+
c as tw,
|
|
23
|
+
m as variantConstants
|
|
13
24
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spark-ui/internal-utils",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"description": "package for sharing reusable code and resources across the codebase",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -16,6 +16,10 @@
|
|
|
16
16
|
"scripts": {
|
|
17
17
|
"build": "vite build"
|
|
18
18
|
},
|
|
19
|
+
"peerDependencies": {
|
|
20
|
+
"react": "^18.0 || ^19.0",
|
|
21
|
+
"react-dom": "^18.0 || ^19.0"
|
|
22
|
+
},
|
|
19
23
|
"repository": {
|
|
20
24
|
"type": "git",
|
|
21
25
|
"url": "https://github.com/adevinta/spark.git",
|
|
@@ -30,5 +34,5 @@
|
|
|
30
34
|
},
|
|
31
35
|
"homepage": "https://sparkui.vercel.app",
|
|
32
36
|
"license": "MIT",
|
|
33
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "374c07a266a2b772cbedcd6040b774ac2c023226"
|
|
34
38
|
}
|
package/vite.config.ts
CHANGED
|
@@ -2,6 +2,9 @@ import { terser } from 'rollup-plugin-terser'
|
|
|
2
2
|
import dts from 'vite-plugin-dts'
|
|
3
3
|
import browserslistToEsbuild from 'browserslist-to-esbuild'
|
|
4
4
|
|
|
5
|
+
const pkg = require('./package.json')
|
|
6
|
+
const peerDeps = Object.keys(pkg.peerDependencies || {})
|
|
7
|
+
|
|
5
8
|
export default {
|
|
6
9
|
build: {
|
|
7
10
|
target: browserslistToEsbuild(),
|
|
@@ -11,7 +14,7 @@ export default {
|
|
|
11
14
|
fileName: 'index',
|
|
12
15
|
},
|
|
13
16
|
rollupOptions: {
|
|
14
|
-
external: ['node:path', 'node:fs'],
|
|
17
|
+
external: ['node:path', 'node:fs', ...peerDeps],
|
|
15
18
|
plugins: [terser()],
|
|
16
19
|
},
|
|
17
20
|
},
|