@vitus-labs/core 0.15.3 → 0.17.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/lib/analysis/vitus-labs-core.js.html +1 -1
- package/lib/analysis/vitus-labs-core.module.js.html +1 -1
- package/lib/analysis/vitus-labs-core.umd.js.html +1 -1
- package/lib/analysis/vitus-labs-core.umd.min.js.html +1 -1
- package/lib/index.d.ts +4 -2
- package/lib/types/renderContent.d.ts +4 -2
- package/lib/vitus-labs-core.js +28 -42
- package/lib/vitus-labs-core.js.map +1 -1
- package/lib/vitus-labs-core.module.js +17 -17
- package/lib/vitus-labs-core.module.js.map +1 -1
- package/lib/vitus-labs-core.umd.js +32 -47
- package/lib/vitus-labs-core.umd.js.map +1 -1
- package/lib/vitus-labs-core.umd.min.js +1 -1
- package/lib/vitus-labs-core.umd.min.js.map +1 -1
- package/package.json +10 -9
|
@@ -7060,7 +7060,7 @@ var drawChart = (function (exports) {
|
|
|
7060
7060
|
</script>
|
|
7061
7061
|
<script>
|
|
7062
7062
|
/*<!--*/
|
|
7063
|
-
const data = {"version":2,"tree":{"name":"root","children":[{"name":"vitus-labs-core.js","children":[{"name":"src","children":[{"uid":"
|
|
7063
|
+
const data = {"version":2,"tree":{"name":"root","children":[{"name":"vitus-labs-core.js","children":[{"name":"src","children":[{"uid":"0bc2-1","name":"config.ts"},{"uid":"0bc2-3","name":"isEmpty.ts"},{"uid":"0bc2-5","name":"context.tsx"},{"uid":"0bc2-7","name":"compose.ts"},{"uid":"0bc2-9","name":"renderContent.ts"},{"uid":"0bc2-11","name":"htmlTags.ts"},{"uid":"0bc2-13","name":"index.ts"}]}]}],"isRoot":true},"nodeParts":{"0bc2-1":{"renderedLength":810,"gzipLength":294,"brotliLength":0,"mainUid":"0bc2-0"},"0bc2-3":{"renderedLength":358,"gzipLength":180,"brotliLength":0,"mainUid":"0bc2-2"},"0bc2-5":{"renderedLength":695,"gzipLength":280,"brotliLength":0,"mainUid":"0bc2-4"},"0bc2-7":{"renderedLength":207,"gzipLength":153,"brotliLength":0,"mainUid":"0bc2-6"},"0bc2-9":{"renderedLength":893,"gzipLength":284,"brotliLength":0,"mainUid":"0bc2-8"},"0bc2-11":{"renderedLength":1688,"gzipLength":493,"brotliLength":0,"mainUid":"0bc2-10"},"0bc2-13":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"mainUid":"0bc2-12"}},"nodeMetas":{"0bc2-0":{"id":"/src/config.ts","moduleParts":{"vitus-labs-core.js":"0bc2-1"},"imported":[{"uid":"0bc2-16"}],"importedBy":[{"uid":"0bc2-12"},{"uid":"0bc2-4"}]},"0bc2-2":{"id":"/src/isEmpty.ts","moduleParts":{"vitus-labs-core.js":"0bc2-3"},"imported":[],"importedBy":[{"uid":"0bc2-12"},{"uid":"0bc2-4"},{"uid":"0bc2-8"}]},"0bc2-4":{"id":"/src/context.tsx","moduleParts":{"vitus-labs-core.js":"0bc2-5"},"imported":[{"uid":"0bc2-17"},{"uid":"0bc2-0"},{"uid":"0bc2-2"}],"importedBy":[{"uid":"0bc2-12"}]},"0bc2-6":{"id":"/src/compose.ts","moduleParts":{"vitus-labs-core.js":"0bc2-7"},"imported":[],"importedBy":[{"uid":"0bc2-12"}]},"0bc2-8":{"id":"/src/renderContent.ts","moduleParts":{"vitus-labs-core.js":"0bc2-9"},"imported":[{"uid":"0bc2-18"},{"uid":"0bc2-17"},{"uid":"0bc2-2"}],"importedBy":[{"uid":"0bc2-12"}]},"0bc2-10":{"id":"/src/htmlTags.ts","moduleParts":{"vitus-labs-core.js":"0bc2-11"},"imported":[],"importedBy":[{"uid":"0bc2-12"}]},"0bc2-12":{"id":"/src/index.ts","moduleParts":{"vitus-labs-core.js":"0bc2-13"},"imported":[{"uid":"0bc2-14"},{"uid":"0bc2-15"},{"uid":"0bc2-0"},{"uid":"0bc2-4"},{"uid":"0bc2-6"},{"uid":"0bc2-2"},{"uid":"0bc2-8"},{"uid":"0bc2-10"}],"importedBy":[],"isEntry":true},"0bc2-14":{"id":"lodash","moduleParts":{},"imported":[],"importedBy":[{"uid":"0bc2-12"}],"isExternal":true},"0bc2-15":{"id":"moize","moduleParts":{},"imported":[],"importedBy":[{"uid":"0bc2-12"}],"isExternal":true},"0bc2-16":{"id":"styled-components","moduleParts":{},"imported":[],"importedBy":[{"uid":"0bc2-0"}],"isExternal":true},"0bc2-17":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"0bc2-4"},{"uid":"0bc2-8"}],"isExternal":true},"0bc2-18":{"id":"react-is","moduleParts":{},"imported":[],"importedBy":[{"uid":"0bc2-8"}],"isExternal":true}},"env":{"rollup":"2.60.0"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
|
|
7064
7064
|
|
|
7065
7065
|
const run = () => {
|
|
7066
7066
|
const width = window.innerWidth;
|
|
@@ -7060,7 +7060,7 @@ var drawChart = (function (exports) {
|
|
|
7060
7060
|
</script>
|
|
7061
7061
|
<script>
|
|
7062
7062
|
/*<!--*/
|
|
7063
|
-
const data = {"version":2,"tree":{"name":"root","children":[{"name":"vitus-labs-core.module.js","children":[{"name":"src","children":[{"uid":"
|
|
7063
|
+
const data = {"version":2,"tree":{"name":"root","children":[{"name":"vitus-labs-core.module.js","children":[{"name":"src","children":[{"uid":"0bc2-20","name":"config.ts"},{"uid":"0bc2-22","name":"isEmpty.ts"},{"uid":"0bc2-24","name":"context.tsx"},{"uid":"0bc2-26","name":"compose.ts"},{"uid":"0bc2-28","name":"renderContent.ts"},{"uid":"0bc2-30","name":"htmlTags.ts"},{"uid":"0bc2-32","name":"index.ts"}]}]}],"isRoot":true},"nodeParts":{"0bc2-20":{"renderedLength":763,"gzipLength":273,"brotliLength":0,"mainUid":"0bc2-19"},"0bc2-22":{"renderedLength":358,"gzipLength":180,"brotliLength":0,"mainUid":"0bc2-21"},"0bc2-24":{"renderedLength":589,"gzipLength":261,"brotliLength":0,"mainUid":"0bc2-23"},"0bc2-26":{"renderedLength":207,"gzipLength":153,"brotliLength":0,"mainUid":"0bc2-25"},"0bc2-28":{"renderedLength":835,"gzipLength":269,"brotliLength":0,"mainUid":"0bc2-27"},"0bc2-30":{"renderedLength":1688,"gzipLength":493,"brotliLength":0,"mainUid":"0bc2-29"},"0bc2-32":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"mainUid":"0bc2-31"}},"nodeMetas":{"0bc2-19":{"id":"/src/config.ts","moduleParts":{"vitus-labs-core.module.js":"0bc2-20"},"imported":[{"uid":"0bc2-35"}],"importedBy":[{"uid":"0bc2-31"},{"uid":"0bc2-23"}]},"0bc2-21":{"id":"/src/isEmpty.ts","moduleParts":{"vitus-labs-core.module.js":"0bc2-22"},"imported":[],"importedBy":[{"uid":"0bc2-31"},{"uid":"0bc2-23"},{"uid":"0bc2-27"}]},"0bc2-23":{"id":"/src/context.tsx","moduleParts":{"vitus-labs-core.module.js":"0bc2-24"},"imported":[{"uid":"0bc2-36"},{"uid":"0bc2-19"},{"uid":"0bc2-21"}],"importedBy":[{"uid":"0bc2-31"}]},"0bc2-25":{"id":"/src/compose.ts","moduleParts":{"vitus-labs-core.module.js":"0bc2-26"},"imported":[],"importedBy":[{"uid":"0bc2-31"}]},"0bc2-27":{"id":"/src/renderContent.ts","moduleParts":{"vitus-labs-core.module.js":"0bc2-28"},"imported":[{"uid":"0bc2-37"},{"uid":"0bc2-36"},{"uid":"0bc2-21"}],"importedBy":[{"uid":"0bc2-31"}]},"0bc2-29":{"id":"/src/htmlTags.ts","moduleParts":{"vitus-labs-core.module.js":"0bc2-30"},"imported":[],"importedBy":[{"uid":"0bc2-31"}]},"0bc2-31":{"id":"/src/index.ts","moduleParts":{"vitus-labs-core.module.js":"0bc2-32"},"imported":[{"uid":"0bc2-33"},{"uid":"0bc2-34"},{"uid":"0bc2-19"},{"uid":"0bc2-23"},{"uid":"0bc2-25"},{"uid":"0bc2-21"},{"uid":"0bc2-27"},{"uid":"0bc2-29"}],"importedBy":[],"isEntry":true},"0bc2-33":{"id":"lodash","moduleParts":{},"imported":[],"importedBy":[{"uid":"0bc2-31"}],"isExternal":true},"0bc2-34":{"id":"moize","moduleParts":{},"imported":[],"importedBy":[{"uid":"0bc2-31"}],"isExternal":true},"0bc2-35":{"id":"styled-components","moduleParts":{},"imported":[],"importedBy":[{"uid":"0bc2-19"}],"isExternal":true},"0bc2-36":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"0bc2-23"},{"uid":"0bc2-27"}],"isExternal":true},"0bc2-37":{"id":"react-is","moduleParts":{},"imported":[],"importedBy":[{"uid":"0bc2-27"}],"isExternal":true}},"env":{"rollup":"2.60.0"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
|
|
7064
7064
|
|
|
7065
7065
|
const run = () => {
|
|
7066
7066
|
const width = window.innerWidth;
|
|
@@ -7060,7 +7060,7 @@ var drawChart = (function (exports) {
|
|
|
7060
7060
|
</script>
|
|
7061
7061
|
<script>
|
|
7062
7062
|
/*<!--*/
|
|
7063
|
-
const data = {"version":2,"tree":{"name":"root","children":[{"name":"vitus-labs-core.umd.js","children":[{"name":"src","children":[{"uid":"
|
|
7063
|
+
const data = {"version":2,"tree":{"name":"root","children":[{"name":"vitus-labs-core.umd.js","children":[{"name":"src","children":[{"uid":"0bc2-39","name":"config.ts"},{"uid":"0bc2-41","name":"isEmpty.ts"},{"uid":"0bc2-43","name":"context.tsx"},{"uid":"0bc2-45","name":"compose.ts"},{"uid":"0bc2-47","name":"renderContent.ts"},{"uid":"0bc2-49","name":"htmlTags.ts"},{"uid":"0bc2-51","name":"index.ts"}]}]}],"isRoot":true},"nodeParts":{"0bc2-39":{"renderedLength":872,"gzipLength":297,"brotliLength":0,"mainUid":"0bc2-38"},"0bc2-41":{"renderedLength":388,"gzipLength":181,"brotliLength":0,"mainUid":"0bc2-40"},"0bc2-43":{"renderedLength":719,"gzipLength":280,"brotliLength":0,"mainUid":"0bc2-42"},"0bc2-45":{"renderedLength":213,"gzipLength":155,"brotliLength":0,"mainUid":"0bc2-44"},"0bc2-47":{"renderedLength":947,"gzipLength":287,"brotliLength":0,"mainUid":"0bc2-46"},"0bc2-49":{"renderedLength":1936,"gzipLength":501,"brotliLength":0,"mainUid":"0bc2-48"},"0bc2-51":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"mainUid":"0bc2-50"}},"nodeMetas":{"0bc2-38":{"id":"/src/config.ts","moduleParts":{"vitus-labs-core.umd.js":"0bc2-39"},"imported":[{"uid":"0bc2-54"}],"importedBy":[{"uid":"0bc2-50"},{"uid":"0bc2-42"}]},"0bc2-40":{"id":"/src/isEmpty.ts","moduleParts":{"vitus-labs-core.umd.js":"0bc2-41"},"imported":[],"importedBy":[{"uid":"0bc2-50"},{"uid":"0bc2-42"},{"uid":"0bc2-46"}]},"0bc2-42":{"id":"/src/context.tsx","moduleParts":{"vitus-labs-core.umd.js":"0bc2-43"},"imported":[{"uid":"0bc2-55"},{"uid":"0bc2-38"},{"uid":"0bc2-40"}],"importedBy":[{"uid":"0bc2-50"}]},"0bc2-44":{"id":"/src/compose.ts","moduleParts":{"vitus-labs-core.umd.js":"0bc2-45"},"imported":[],"importedBy":[{"uid":"0bc2-50"}]},"0bc2-46":{"id":"/src/renderContent.ts","moduleParts":{"vitus-labs-core.umd.js":"0bc2-47"},"imported":[{"uid":"0bc2-56"},{"uid":"0bc2-55"},{"uid":"0bc2-40"}],"importedBy":[{"uid":"0bc2-50"}]},"0bc2-48":{"id":"/src/htmlTags.ts","moduleParts":{"vitus-labs-core.umd.js":"0bc2-49"},"imported":[],"importedBy":[{"uid":"0bc2-50"}]},"0bc2-50":{"id":"/src/index.ts","moduleParts":{"vitus-labs-core.umd.js":"0bc2-51"},"imported":[{"uid":"0bc2-52"},{"uid":"0bc2-53"},{"uid":"0bc2-38"},{"uid":"0bc2-42"},{"uid":"0bc2-44"},{"uid":"0bc2-40"},{"uid":"0bc2-46"},{"uid":"0bc2-48"}],"importedBy":[],"isEntry":true},"0bc2-52":{"id":"lodash","moduleParts":{},"imported":[],"importedBy":[{"uid":"0bc2-50"}],"isExternal":true},"0bc2-53":{"id":"moize","moduleParts":{},"imported":[],"importedBy":[{"uid":"0bc2-50"}],"isExternal":true},"0bc2-54":{"id":"styled-components","moduleParts":{},"imported":[],"importedBy":[{"uid":"0bc2-38"}],"isExternal":true},"0bc2-55":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"0bc2-42"},{"uid":"0bc2-46"}],"isExternal":true},"0bc2-56":{"id":"react-is","moduleParts":{},"imported":[],"importedBy":[{"uid":"0bc2-46"}],"isExternal":true}},"env":{"rollup":"2.60.0"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
|
|
7064
7064
|
|
|
7065
7065
|
const run = () => {
|
|
7066
7066
|
const width = window.innerWidth;
|
|
@@ -7060,7 +7060,7 @@ var drawChart = (function (exports) {
|
|
|
7060
7060
|
</script>
|
|
7061
7061
|
<script>
|
|
7062
7062
|
/*<!--*/
|
|
7063
|
-
const data = {"version":2,"tree":{"name":"root","children":[{"name":"vitus-labs-core.umd.min.js","children":[{"name":"src","children":[{"uid":"
|
|
7063
|
+
const data = {"version":2,"tree":{"name":"root","children":[{"name":"vitus-labs-core.umd.min.js","children":[{"name":"src","children":[{"uid":"0bc2-58","name":"config.ts"},{"uid":"0bc2-60","name":"isEmpty.ts"},{"uid":"0bc2-62","name":"context.tsx"},{"uid":"0bc2-64","name":"compose.ts"},{"uid":"0bc2-66","name":"renderContent.ts"},{"uid":"0bc2-68","name":"htmlTags.ts"},{"uid":"0bc2-70","name":"index.ts"}]}]}],"isRoot":true},"nodeParts":{"0bc2-58":{"renderedLength":872,"gzipLength":297,"brotliLength":0,"mainUid":"0bc2-57"},"0bc2-60":{"renderedLength":388,"gzipLength":181,"brotliLength":0,"mainUid":"0bc2-59"},"0bc2-62":{"renderedLength":719,"gzipLength":280,"brotliLength":0,"mainUid":"0bc2-61"},"0bc2-64":{"renderedLength":213,"gzipLength":155,"brotliLength":0,"mainUid":"0bc2-63"},"0bc2-66":{"renderedLength":947,"gzipLength":287,"brotliLength":0,"mainUid":"0bc2-65"},"0bc2-68":{"renderedLength":1936,"gzipLength":501,"brotliLength":0,"mainUid":"0bc2-67"},"0bc2-70":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"mainUid":"0bc2-69"}},"nodeMetas":{"0bc2-57":{"id":"/src/config.ts","moduleParts":{"vitus-labs-core.umd.min.js":"0bc2-58"},"imported":[{"uid":"0bc2-73"}],"importedBy":[{"uid":"0bc2-69"},{"uid":"0bc2-61"}]},"0bc2-59":{"id":"/src/isEmpty.ts","moduleParts":{"vitus-labs-core.umd.min.js":"0bc2-60"},"imported":[],"importedBy":[{"uid":"0bc2-69"},{"uid":"0bc2-61"},{"uid":"0bc2-65"}]},"0bc2-61":{"id":"/src/context.tsx","moduleParts":{"vitus-labs-core.umd.min.js":"0bc2-62"},"imported":[{"uid":"0bc2-74"},{"uid":"0bc2-57"},{"uid":"0bc2-59"}],"importedBy":[{"uid":"0bc2-69"}]},"0bc2-63":{"id":"/src/compose.ts","moduleParts":{"vitus-labs-core.umd.min.js":"0bc2-64"},"imported":[],"importedBy":[{"uid":"0bc2-69"}]},"0bc2-65":{"id":"/src/renderContent.ts","moduleParts":{"vitus-labs-core.umd.min.js":"0bc2-66"},"imported":[{"uid":"0bc2-75"},{"uid":"0bc2-74"},{"uid":"0bc2-59"}],"importedBy":[{"uid":"0bc2-69"}]},"0bc2-67":{"id":"/src/htmlTags.ts","moduleParts":{"vitus-labs-core.umd.min.js":"0bc2-68"},"imported":[],"importedBy":[{"uid":"0bc2-69"}]},"0bc2-69":{"id":"/src/index.ts","moduleParts":{"vitus-labs-core.umd.min.js":"0bc2-70"},"imported":[{"uid":"0bc2-71"},{"uid":"0bc2-72"},{"uid":"0bc2-57"},{"uid":"0bc2-61"},{"uid":"0bc2-63"},{"uid":"0bc2-59"},{"uid":"0bc2-65"},{"uid":"0bc2-67"}],"importedBy":[],"isEntry":true},"0bc2-71":{"id":"lodash","moduleParts":{},"imported":[],"importedBy":[{"uid":"0bc2-69"}],"isExternal":true},"0bc2-72":{"id":"moize","moduleParts":{},"imported":[],"importedBy":[{"uid":"0bc2-69"}],"isExternal":true},"0bc2-73":{"id":"styled-components","moduleParts":{},"imported":[],"importedBy":[{"uid":"0bc2-57"}],"isExternal":true},"0bc2-74":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"0bc2-61"},{"uid":"0bc2-65"}],"isExternal":true},"0bc2-75":{"id":"react-is","moduleParts":{},"imported":[],"importedBy":[{"uid":"0bc2-65"}],"isExternal":true}},"env":{"rollup":"2.60.0"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
|
|
7064
7064
|
|
|
7065
7065
|
const run = () => {
|
|
7066
7066
|
const width = window.innerWidth;
|
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { get, merge, omit, pick, set, throttle } from 'lodash';
|
|
2
2
|
export { default as memoize } from 'moize';
|
|
3
|
-
import React, { ComponentType, FC, ReactNode } from 'react';
|
|
3
|
+
import React, { ComponentType, FC, ReactNode, createElement, cloneElement } from 'react';
|
|
4
4
|
import { ThemedCssFunction, DefaultTheme, StyledInterface, ThemeProviderComponent } from 'styled-components';
|
|
5
5
|
|
|
6
6
|
declare const TAGS: readonly ["a", "abbr", "address", "area", "article", "aside", "audio", "b", "base", "bdi", "bdo", "big", "blockquote", "body", "br", "button", "canvas", "caption", "cite", "code", "col", "colgroup", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "label", "legend", "li", "link", "main", "map", "mark", "meta", "meter", "nav", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "script", "section", "select", "small", "source", "span", "strong", "style", "sub", "summary", "sup", "svg", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "u", "ul", "var", "video", "wbr"];
|
|
@@ -44,7 +44,9 @@ declare const compose: <T extends ArityOneFn[]>(...fns: T) => (p: FirstFnParamet
|
|
|
44
44
|
declare type IsEmpty = <T extends Record<string, unknown> | unknown[] | null>(param?: T) => null | undefined extends T ? true : keyof T extends never ? true : false;
|
|
45
45
|
declare const isEmpty: IsEmpty;
|
|
46
46
|
|
|
47
|
-
declare type
|
|
47
|
+
declare type CreateTypes = Parameters<typeof createElement>[0];
|
|
48
|
+
declare type CloneTypes = Parameters<typeof cloneElement>[0];
|
|
49
|
+
declare type RenderContent = (content?: CreateTypes | CloneTypes | ReactNode | ReactNode[], attachProps?: Record<string, any>) => ReturnType<typeof createElement> | ReturnType<typeof cloneElement> | null;
|
|
48
50
|
declare const renderContent: RenderContent;
|
|
49
51
|
|
|
50
52
|
export { HTMLTags, IsEmpty, Provider, RenderContent, compose, internal as config, context, TAGS as htmlTags, init, isEmpty, renderContent };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { createElement, cloneElement, ReactNode } from 'react';
|
|
2
|
+
declare type CreateTypes = Parameters<typeof createElement>[0];
|
|
3
|
+
declare type CloneTypes = Parameters<typeof cloneElement>[0];
|
|
4
|
+
export declare type RenderContent = (content?: CreateTypes | CloneTypes | ReactNode | ReactNode[], attachProps?: Record<string, any>) => ReturnType<typeof createElement> | ReturnType<typeof cloneElement> | null;
|
|
3
5
|
declare const renderContent: RenderContent;
|
|
4
6
|
export default renderContent;
|
package/lib/vitus-labs-core.js
CHANGED
|
@@ -6,6 +6,7 @@ var lodash = require('lodash');
|
|
|
6
6
|
var moize = require('moize');
|
|
7
7
|
var styled = require('styled-components');
|
|
8
8
|
var React = require('react');
|
|
9
|
+
var reactIs = require('react-is');
|
|
9
10
|
|
|
10
11
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
11
12
|
|
|
@@ -14,7 +15,7 @@ var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
|
14
15
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
15
16
|
|
|
16
17
|
const OPTIONS = {
|
|
17
|
-
styled: styled__default[
|
|
18
|
+
styled: styled__default["default"],
|
|
18
19
|
css: styled.css,
|
|
19
20
|
styledContext: styled.ThemeProvider,
|
|
20
21
|
component: 'div',
|
|
@@ -61,48 +62,47 @@ const isEmpty = (param) => {
|
|
|
61
62
|
return false;
|
|
62
63
|
};
|
|
63
64
|
|
|
64
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
65
65
|
const context = React.createContext({});
|
|
66
66
|
const VitusLabsProvider = context.Provider;
|
|
67
67
|
const Provider = ({ theme, children, ...props }) => {
|
|
68
68
|
if (!theme || isEmpty(theme))
|
|
69
|
-
return React__default[
|
|
69
|
+
return React__default["default"].createElement(React__default["default"].Fragment, null, children);
|
|
70
70
|
const StyledContext = internal.styledContext;
|
|
71
71
|
if (StyledContext) {
|
|
72
|
-
return (React__default[
|
|
73
|
-
React__default[
|
|
72
|
+
return (React__default["default"].createElement(VitusLabsProvider, { value: { theme, ...props } },
|
|
73
|
+
React__default["default"].createElement(StyledContext, { theme: theme }, children)));
|
|
74
74
|
}
|
|
75
|
-
return (React__default[
|
|
75
|
+
return (React__default["default"].createElement(VitusLabsProvider, { value: { theme, ...props } }, children));
|
|
76
76
|
};
|
|
77
77
|
|
|
78
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
79
78
|
// const compose = <R>(fn1: (a: R) => R, ...fns: Array<(a: R) => R>) =>
|
|
80
79
|
// fns.reduce((a, b) => (value) => a(b(value)), fn1)
|
|
81
80
|
const compose = (...fns) => (p) => fns.reduceRight((acc, cur) => cur(acc), p);
|
|
82
81
|
|
|
83
|
-
|
|
84
|
-
const renderContent = (content, attachProps = {}) => {
|
|
82
|
+
const renderContent = (content, attachProps) => {
|
|
85
83
|
if (!content)
|
|
86
84
|
return null;
|
|
87
|
-
if (
|
|
85
|
+
if (typeof content === 'string' && React.isValidElement(content)) {
|
|
86
|
+
return attachProps
|
|
87
|
+
? React.createElement(content, attachProps)
|
|
88
|
+
: React.createElement(content);
|
|
89
|
+
}
|
|
90
|
+
if (['number', 'boolean', 'string'].includes(typeof content)) {
|
|
91
|
+
return content;
|
|
92
|
+
}
|
|
93
|
+
if (Array.isArray(content) || reactIs.isFragment(content)) {
|
|
88
94
|
return content;
|
|
89
95
|
}
|
|
90
|
-
if (
|
|
91
|
-
|
|
92
|
-
|
|
96
|
+
if (reactIs.isValidElementType(content)) {
|
|
97
|
+
return attachProps
|
|
98
|
+
? React.createElement(content, attachProps)
|
|
99
|
+
: React.createElement(content);
|
|
93
100
|
}
|
|
94
101
|
if (React.isValidElement(content)) {
|
|
95
102
|
if (isEmpty(attachProps)) {
|
|
96
103
|
return content;
|
|
97
104
|
}
|
|
98
|
-
return React.cloneElement(
|
|
99
|
-
}
|
|
100
|
-
// @ts-ignore
|
|
101
|
-
if (typeof content === 'object' && !isEmpty(content)) {
|
|
102
|
-
// FIXME: quick fix for rendering invalid elements
|
|
103
|
-
// no idea of what is going on here yet
|
|
104
|
-
// @ts-ignore
|
|
105
|
-
return React.createElement(content, attachProps);
|
|
105
|
+
return React.cloneElement(content, attachProps);
|
|
106
106
|
}
|
|
107
107
|
return content;
|
|
108
108
|
};
|
|
@@ -234,45 +234,31 @@ const TAGS = [
|
|
|
234
234
|
|
|
235
235
|
Object.defineProperty(exports, 'get', {
|
|
236
236
|
enumerable: true,
|
|
237
|
-
get: function () {
|
|
238
|
-
return lodash.get;
|
|
239
|
-
}
|
|
237
|
+
get: function () { return lodash.get; }
|
|
240
238
|
});
|
|
241
239
|
Object.defineProperty(exports, 'merge', {
|
|
242
240
|
enumerable: true,
|
|
243
|
-
get: function () {
|
|
244
|
-
return lodash.merge;
|
|
245
|
-
}
|
|
241
|
+
get: function () { return lodash.merge; }
|
|
246
242
|
});
|
|
247
243
|
Object.defineProperty(exports, 'omit', {
|
|
248
244
|
enumerable: true,
|
|
249
|
-
get: function () {
|
|
250
|
-
return lodash.omit;
|
|
251
|
-
}
|
|
245
|
+
get: function () { return lodash.omit; }
|
|
252
246
|
});
|
|
253
247
|
Object.defineProperty(exports, 'pick', {
|
|
254
248
|
enumerable: true,
|
|
255
|
-
get: function () {
|
|
256
|
-
return lodash.pick;
|
|
257
|
-
}
|
|
249
|
+
get: function () { return lodash.pick; }
|
|
258
250
|
});
|
|
259
251
|
Object.defineProperty(exports, 'set', {
|
|
260
252
|
enumerable: true,
|
|
261
|
-
get: function () {
|
|
262
|
-
return lodash.set;
|
|
263
|
-
}
|
|
253
|
+
get: function () { return lodash.set; }
|
|
264
254
|
});
|
|
265
255
|
Object.defineProperty(exports, 'throttle', {
|
|
266
256
|
enumerable: true,
|
|
267
|
-
get: function () {
|
|
268
|
-
return lodash.throttle;
|
|
269
|
-
}
|
|
257
|
+
get: function () { return lodash.throttle; }
|
|
270
258
|
});
|
|
271
259
|
Object.defineProperty(exports, 'memoize', {
|
|
272
260
|
enumerable: true,
|
|
273
|
-
get: function () {
|
|
274
|
-
return moize__default['default'];
|
|
275
|
-
}
|
|
261
|
+
get: function () { return moize__default["default"]; }
|
|
276
262
|
});
|
|
277
263
|
exports.Provider = Provider;
|
|
278
264
|
exports.compose = compose;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vitus-labs-core.js","sources":["../src/config.ts","../src/isEmpty.ts","../src/context.tsx","../src/compose.ts","../src/renderContent.ts","../src/htmlTags.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable no-underscore-dangle */\nimport { ComponentType } from 'react'\nimport styled, {\n css,\n ThemeProvider,\n ThemedCssFunction,\n StyledInterface,\n DefaultTheme,\n ThemeProviderComponent,\n} from 'styled-components'\nimport type { HTMLTags } from '~/htmlTags'\n\nconst OPTIONS: Internal = {\n styled,\n css,\n styledContext: ThemeProvider,\n component: 'div',\n textComponent: 'span',\n} as Internal\n\ntype Init = ({\n styled,\n css,\n context,\n component,\n textComponent,\n}: {\n styled: any\n css: any\n context: any\n component?: ComponentType | HTMLTags\n textComponent?: ComponentType | HTMLTags\n}) => void\n\nconst init: Init = ({\n styled,\n css,\n context,\n component = 'div',\n textComponent = 'span',\n}) => {\n OPTIONS.css = css\n OPTIONS.styled = styled\n OPTIONS.styledContext = context\n OPTIONS.component = component\n OPTIONS.textComponent = textComponent\n}\n\ninterface Internal {\n css: ThemedCssFunction<DefaultTheme>\n styled: StyledInterface\n styledContext: ThemeProviderComponent<any, any>\n component: any\n textComponent: any\n}\n\nconst internal: Internal = Object.freeze({\n get css() {\n return OPTIONS.css\n },\n get styled() {\n return OPTIONS.styled\n },\n get styledContext() {\n return OPTIONS.styledContext\n },\n get component() {\n return OPTIONS.component\n },\n get textComponent() {\n return OPTIONS.textComponent\n },\n})\n\nexport { init }\nexport default internal\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nexport type IsEmpty = <T extends Record<string, unknown> | unknown[] | null>(\n param?: T\n) => null | undefined extends T ? true : keyof T extends never ? true : false\n\nconst isEmpty: IsEmpty = (param) => {\n if (!param) return true\n\n if (typeof param !== 'object') {\n return true as any\n }\n\n if (Array.isArray(param) && param.length === 0) {\n return true\n }\n\n if (\n Object.entries(param as any).length === 0 &&\n param.constructor === Object\n ) {\n return true\n }\n\n return false\n}\n\nexport default isEmpty\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React, { createContext, FC } from 'react'\nimport config from '~/config'\nimport isEmpty from '~/isEmpty'\n\nconst context = createContext<any>({})\nconst VitusLabsProvider = context.Provider\n\ntype Theme = Partial<\n {\n rootSize: number\n breakpoints: Record<string, number | string>\n } & Record<string, unknown>\n>\n\ntype ProviderType = Partial<\n {\n theme: Theme\n } & Record<string, unknown>\n>\n\nconst Provider: FC<ProviderType> = ({ theme, children, ...props }) => {\n if (!theme || isEmpty(theme)) return <>{children}</>\n\n const StyledContext = config.styledContext\n\n if (StyledContext) {\n return (\n <VitusLabsProvider value={{ theme, ...props }}>\n <StyledContext theme={theme}>{children}</StyledContext>\n </VitusLabsProvider>\n )\n }\n\n return (\n <VitusLabsProvider value={{ theme, ...props }}>\n {children}\n </VitusLabsProvider>\n )\n}\n\nexport { context }\n\nexport default Provider\n","/* eslint-disable @typescript-eslint/no-explicit-any */\n// const compose = <R>(fn1: (a: R) => R, ...fns: Array<(a: R) => R>) =>\n// fns.reduce((a, b) => (value) => a(b(value)), fn1)\n\n// const compose = (funcs) =>\n// funcs.reduce(\n// (a, b) => (...args) => a(b(...args)),\n// (arg) => arg\n// )\n\ntype ArityOneFn = (arg: any) => any\ntype PickLastInTuple<T extends any[]> = T extends [\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n ...rest: infer U,\n argn: infer L\n]\n ? L\n : any\ntype FirstFnParameterType<T extends any[]> = Parameters<PickLastInTuple<T>>[any]\ntype LastFnReturnType<T extends any[]> = ReturnType<T[0]>\n\nconst compose =\n <T extends ArityOneFn[]>(...fns: T) =>\n (p: FirstFnParameterType<T>): LastFnReturnType<T> =>\n fns.reduceRight((acc: any, cur: any) => cur(acc), p)\n\nexport default compose\n","/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/ban-ts-comment */\nimport {\n createElement,\n isValidElement,\n cloneElement,\n Children,\n ReactNode,\n ComponentType,\n} from 'react'\nimport isEmpty from './isEmpty'\n\nexport type RenderContent = (\n content?: ReactNode | ComponentType,\n attachProps?: Record<string, any>\n) => ReactNode\n\nconst renderContent: RenderContent = (content, attachProps = {}) => {\n if (!content) return null\n\n if (Array.isArray(content)) {\n return content\n }\n\n if (typeof content === 'function') {\n // @ts-ignore\n return createElement(content, attachProps)\n }\n\n if (isValidElement(content)) {\n if (isEmpty(attachProps)) {\n return content\n }\n\n return cloneElement(Children.only(content), attachProps)\n }\n\n // @ts-ignore\n if (typeof content === 'object' && !isEmpty(content)) {\n // FIXME: quick fix for rendering invalid elements\n // no idea of what is going on here yet\n // @ts-ignore\n return createElement(content, attachProps)\n }\n\n return content\n}\n\nexport default renderContent\n","const TAGS = [\n 'a',\n 'abbr',\n // 'acronym',\n 'address',\n // 'applet',\n 'area',\n 'article',\n 'aside',\n 'audio',\n 'b',\n 'base',\n // 'basefont',\n 'bdi',\n 'bdo',\n 'big',\n 'blockquote',\n 'body',\n 'br',\n 'button',\n 'canvas',\n 'caption',\n // 'center',\n 'cite',\n 'code',\n 'col',\n 'colgroup',\n 'data',\n 'datalist',\n 'dd',\n 'del',\n 'details',\n 'dfn',\n 'dialog',\n // 'dir',\n 'div',\n 'dl',\n 'dt',\n 'em',\n 'embed',\n 'fieldset',\n 'figcaption',\n 'figure',\n // 'font',\n 'footer',\n 'form',\n // 'frame',\n // 'frameset',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'head',\n 'header',\n 'hr',\n 'html',\n 'i',\n 'iframe',\n 'img',\n 'input',\n 'ins',\n 'kbd',\n 'label',\n 'legend',\n 'li',\n 'link',\n 'main',\n 'map',\n 'mark',\n 'meta',\n 'meter',\n 'nav',\n // 'noframes',\n 'noscript',\n 'object',\n 'ol',\n 'optgroup',\n 'option',\n 'output',\n 'p',\n 'param',\n 'picture',\n 'pre',\n 'progress',\n 'q',\n 'rp',\n 'rt',\n 'ruby',\n 's',\n 'samp',\n 'script',\n 'section',\n 'select',\n 'small',\n 'source',\n 'span',\n // 'strike',\n 'strong',\n 'style',\n 'sub',\n 'summary',\n 'sup',\n 'svg',\n 'table',\n 'tbody',\n 'td',\n 'template',\n 'textarea',\n 'tfoot',\n 'th',\n 'thead',\n 'time',\n 'title',\n 'tr',\n 'track',\n // 'tt',\n 'u',\n 'ul',\n 'var',\n 'video',\n 'wbr',\n] as const\n\nexport type HTMLTags = typeof TAGS[number]\n\nexport default TAGS\n"],"names":["styled","css","ThemeProvider","createContext","React","config","createElement","isValidElement","cloneElement","Children"],"mappings":";;;;;;;;;;;;;;;AA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G;IACH,MAAM;IACN,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,MAAM;;IAEN,QAAQ;IACR,OAAO;IACP,KAAK;IACL,SAAS;IACT,KAAK;IACL,KAAK;IACL,OAAO;IACP,OAAO;IACP,IAAI;IACJ,UAAU;IACV,UAAU;IACV,OAAO;IACP,IAAI;IACJ,OAAO;IACP,MAAM;IACN,OAAO;IACP,IAAI;IACJ,OAAO;;IAEP,GAAG;IACH,IAAI;IACJ,KAAK;IACL,OAAO;IACP,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"vitus-labs-core.js","sources":["../src/config.ts","../src/isEmpty.ts","../src/context.tsx","../src/compose.ts","../src/renderContent.ts","../src/htmlTags.ts"],"sourcesContent":["/* eslint-disable no-underscore-dangle */\nimport { ComponentType } from 'react'\nimport styled, {\n css,\n ThemeProvider,\n ThemedCssFunction,\n StyledInterface,\n DefaultTheme,\n ThemeProviderComponent,\n} from 'styled-components'\nimport type { HTMLTags } from '~/htmlTags'\n\nconst OPTIONS: Internal = {\n styled,\n css,\n styledContext: ThemeProvider,\n component: 'div',\n textComponent: 'span',\n} as Internal\n\ntype Init = ({\n styled,\n css,\n context,\n component,\n textComponent,\n}: {\n styled: any\n css: any\n context: any\n component?: ComponentType | HTMLTags\n textComponent?: ComponentType | HTMLTags\n}) => void\n\nconst init: Init = ({\n styled,\n css,\n context,\n component = 'div',\n textComponent = 'span',\n}) => {\n OPTIONS.css = css\n OPTIONS.styled = styled\n OPTIONS.styledContext = context\n OPTIONS.component = component\n OPTIONS.textComponent = textComponent\n}\n\ninterface Internal {\n css: ThemedCssFunction<DefaultTheme>\n styled: StyledInterface\n styledContext: ThemeProviderComponent<any, any>\n component: any\n textComponent: any\n}\n\nconst internal: Internal = Object.freeze({\n get css() {\n return OPTIONS.css\n },\n get styled() {\n return OPTIONS.styled\n },\n get styledContext() {\n return OPTIONS.styledContext\n },\n get component() {\n return OPTIONS.component\n },\n get textComponent() {\n return OPTIONS.textComponent\n },\n})\n\nexport { init }\nexport default internal\n","export type IsEmpty = <T extends Record<string, unknown> | unknown[] | null>(\n param?: T\n) => null | undefined extends T ? true : keyof T extends never ? true : false\n\nconst isEmpty: IsEmpty = (param) => {\n if (!param) return true\n\n if (typeof param !== 'object') {\n return true as any\n }\n\n if (Array.isArray(param) && param.length === 0) {\n return true\n }\n\n if (\n Object.entries(param as any).length === 0 &&\n param.constructor === Object\n ) {\n return true\n }\n\n return false\n}\n\nexport default isEmpty\n","import React, { createContext, FC } from 'react'\nimport config from '~/config'\nimport isEmpty from '~/isEmpty'\n\nconst context = createContext<any>({})\nconst VitusLabsProvider = context.Provider\n\ntype Theme = Partial<\n {\n rootSize: number\n breakpoints: Record<string, number | string>\n } & Record<string, unknown>\n>\n\ntype ProviderType = Partial<\n {\n theme: Theme\n } & Record<string, unknown>\n>\n\nconst Provider: FC<ProviderType> = ({ theme, children, ...props }) => {\n if (!theme || isEmpty(theme)) return <>{children}</>\n\n const StyledContext = config.styledContext\n\n if (StyledContext) {\n return (\n <VitusLabsProvider value={{ theme, ...props }}>\n <StyledContext theme={theme}>{children}</StyledContext>\n </VitusLabsProvider>\n )\n }\n\n return (\n <VitusLabsProvider value={{ theme, ...props }}>\n {children}\n </VitusLabsProvider>\n )\n}\n\nexport { context }\n\nexport default Provider\n","// const compose = <R>(fn1: (a: R) => R, ...fns: Array<(a: R) => R>) =>\n// fns.reduce((a, b) => (value) => a(b(value)), fn1)\n\n// const compose = (funcs) =>\n// funcs.reduce(\n// (a, b) => (...args) => a(b(...args)),\n// (arg) => arg\n// )\n\ntype ArityOneFn = (arg: any) => any\ntype PickLastInTuple<T extends any[]> = T extends [\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n ...rest: infer U,\n argn: infer L\n]\n ? L\n : any\ntype FirstFnParameterType<T extends any[]> = Parameters<PickLastInTuple<T>>[any]\ntype LastFnReturnType<T extends any[]> = ReturnType<T[0]>\n\nconst compose =\n <T extends ArityOneFn[]>(...fns: T) =>\n (p: FirstFnParameterType<T>): LastFnReturnType<T> =>\n fns.reduceRight((acc: any, cur: any) => cur(acc), p)\n\nexport default compose\n","import { isValidElementType, isFragment } from 'react-is'\nimport { createElement, isValidElement, cloneElement, ReactNode } from 'react'\nimport isEmpty from './isEmpty'\n\ntype CreateTypes = Parameters<typeof createElement>[0]\ntype CloneTypes = Parameters<typeof cloneElement>[0]\n\n// export type RenderContent = (\n// content?: CreateTypes | CloneTypes | ReactNode | ReactNode[],\n// attachProps?: Record<string, any>\n// ) => ReturnType<typeof createElement> | ReturnType<typeof cloneElement> | null\n\n// const renderContent: RenderContent = (content, attachProps) => {\n// if (!content) return null as any\n\n// if (typeof content === 'string') {\n// return content\n// }\n\n// if (Array.isArray(content)) {\n// return content\n// }\n\n// if (typeof content === 'function') {\n// return createElement(content, attachProps)\n// }\n\n// if (isValidElement(content)) {\n// if (isEmpty(attachProps)) {\n// return content\n// }\n\n// return cloneElement(Children.only(content), attachProps)\n// }\n\n// if (typeof content === 'object' && !isEmpty(content)) {\n// return createElement(content, attachProps)\n// }\n\n// return content\n// }\n\n// export default renderContent\n\nexport type RenderContent = (\n content?: CreateTypes | CloneTypes | ReactNode | ReactNode[],\n attachProps?: Record<string, any>\n) => ReturnType<typeof createElement> | ReturnType<typeof cloneElement> | null\n\nconst renderContent: RenderContent = (content, attachProps) => {\n if (!content) return null as any\n\n if (typeof content === 'string' && isValidElement(content)) {\n return attachProps\n ? createElement(content, attachProps)\n : createElement(content)\n }\n\n if (['number', 'boolean', 'string'].includes(typeof content)) {\n return content\n }\n\n if (Array.isArray(content) || isFragment(content)) {\n return content\n }\n\n if (isValidElementType(content)) {\n return attachProps\n ? createElement(content, attachProps)\n : createElement(content)\n }\n\n if (isValidElement(content)) {\n if (isEmpty(attachProps)) {\n return content\n }\n\n return cloneElement(content, attachProps)\n }\n\n return content\n}\n\nexport default renderContent\n","const TAGS = [\n 'a',\n 'abbr',\n // 'acronym',\n 'address',\n // 'applet',\n 'area',\n 'article',\n 'aside',\n 'audio',\n 'b',\n 'base',\n // 'basefont',\n 'bdi',\n 'bdo',\n 'big',\n 'blockquote',\n 'body',\n 'br',\n 'button',\n 'canvas',\n 'caption',\n // 'center',\n 'cite',\n 'code',\n 'col',\n 'colgroup',\n 'data',\n 'datalist',\n 'dd',\n 'del',\n 'details',\n 'dfn',\n 'dialog',\n // 'dir',\n 'div',\n 'dl',\n 'dt',\n 'em',\n 'embed',\n 'fieldset',\n 'figcaption',\n 'figure',\n // 'font',\n 'footer',\n 'form',\n // 'frame',\n // 'frameset',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'head',\n 'header',\n 'hr',\n 'html',\n 'i',\n 'iframe',\n 'img',\n 'input',\n 'ins',\n 'kbd',\n 'label',\n 'legend',\n 'li',\n 'link',\n 'main',\n 'map',\n 'mark',\n 'meta',\n 'meter',\n 'nav',\n // 'noframes',\n 'noscript',\n 'object',\n 'ol',\n 'optgroup',\n 'option',\n 'output',\n 'p',\n 'param',\n 'picture',\n 'pre',\n 'progress',\n 'q',\n 'rp',\n 'rt',\n 'ruby',\n 's',\n 'samp',\n 'script',\n 'section',\n 'select',\n 'small',\n 'source',\n 'span',\n // 'strike',\n 'strong',\n 'style',\n 'sub',\n 'summary',\n 'sup',\n 'svg',\n 'table',\n 'tbody',\n 'td',\n 'template',\n 'textarea',\n 'tfoot',\n 'th',\n 'thead',\n 'time',\n 'title',\n 'tr',\n 'track',\n // 'tt',\n 'u',\n 'ul',\n 'var',\n 'video',\n 'wbr',\n] as const\n\nexport type HTMLTags = typeof TAGS[number]\n\nexport default TAGS\n"],"names":["styled","css","ThemeProvider","createContext","React","config","isValidElement","createElement","isFragment","isValidElementType","cloneElement"],"mappings":";;;;;;;;;;;;;;;;AAYA,MAAM,OAAO,GAAa;YACxBA,0BAAM;SACNC,UAAG;IACH,aAAa,EAAEC,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;IACR,GAAG;IACH,OAAO;IACP,SAAS;IACT,KAAK;IACL,UAAU;IACV,GAAG;IACH,IAAI;IACJ,IAAI;IACJ,MAAM;IACN,GAAG;IACH,MAAM;IACN,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,MAAM;;IAEN,QAAQ;IACR,OAAO;IACP,KAAK;IACL,SAAS;IACT,KAAK;IACL,KAAK;IACL,OAAO;IACP,OAAO;IACP,IAAI;IACJ,UAAU;IACV,UAAU;IACV,OAAO;IACP,IAAI;IACJ,OAAO;IACP,MAAM;IACN,OAAO;IACP,IAAI;IACJ,OAAO;;IAEP,GAAG;IACH,IAAI;IACJ,KAAK;IACL,OAAO;IACP,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { get, merge, omit, pick, set, throttle } from 'lodash';
|
|
2
2
|
export { default as memoize } from 'moize';
|
|
3
3
|
import styled, { css, ThemeProvider } from 'styled-components';
|
|
4
|
-
import React, { createContext,
|
|
4
|
+
import React, { createContext, isValidElement, createElement, cloneElement } from 'react';
|
|
5
|
+
import { isFragment, isValidElementType } from 'react-is';
|
|
5
6
|
|
|
6
7
|
const OPTIONS = {
|
|
7
8
|
styled,
|
|
@@ -51,7 +52,6 @@ const isEmpty = (param) => {
|
|
|
51
52
|
return false;
|
|
52
53
|
};
|
|
53
54
|
|
|
54
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
55
55
|
const context = createContext({});
|
|
56
56
|
const VitusLabsProvider = context.Provider;
|
|
57
57
|
const Provider = ({ theme, children, ...props }) => {
|
|
@@ -65,34 +65,34 @@ const Provider = ({ theme, children, ...props }) => {
|
|
|
65
65
|
return (React.createElement(VitusLabsProvider, { value: { theme, ...props } }, children));
|
|
66
66
|
};
|
|
67
67
|
|
|
68
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
69
68
|
// const compose = <R>(fn1: (a: R) => R, ...fns: Array<(a: R) => R>) =>
|
|
70
69
|
// fns.reduce((a, b) => (value) => a(b(value)), fn1)
|
|
71
70
|
const compose = (...fns) => (p) => fns.reduceRight((acc, cur) => cur(acc), p);
|
|
72
71
|
|
|
73
|
-
|
|
74
|
-
const renderContent = (content, attachProps = {}) => {
|
|
72
|
+
const renderContent = (content, attachProps) => {
|
|
75
73
|
if (!content)
|
|
76
74
|
return null;
|
|
77
|
-
if (
|
|
75
|
+
if (typeof content === 'string' && isValidElement(content)) {
|
|
76
|
+
return attachProps
|
|
77
|
+
? createElement(content, attachProps)
|
|
78
|
+
: createElement(content);
|
|
79
|
+
}
|
|
80
|
+
if (['number', 'boolean', 'string'].includes(typeof content)) {
|
|
81
|
+
return content;
|
|
82
|
+
}
|
|
83
|
+
if (Array.isArray(content) || isFragment(content)) {
|
|
78
84
|
return content;
|
|
79
85
|
}
|
|
80
|
-
if (
|
|
81
|
-
|
|
82
|
-
|
|
86
|
+
if (isValidElementType(content)) {
|
|
87
|
+
return attachProps
|
|
88
|
+
? createElement(content, attachProps)
|
|
89
|
+
: createElement(content);
|
|
83
90
|
}
|
|
84
91
|
if (isValidElement(content)) {
|
|
85
92
|
if (isEmpty(attachProps)) {
|
|
86
93
|
return content;
|
|
87
94
|
}
|
|
88
|
-
return cloneElement(
|
|
89
|
-
}
|
|
90
|
-
// @ts-ignore
|
|
91
|
-
if (typeof content === 'object' && !isEmpty(content)) {
|
|
92
|
-
// FIXME: quick fix for rendering invalid elements
|
|
93
|
-
// no idea of what is going on here yet
|
|
94
|
-
// @ts-ignore
|
|
95
|
-
return createElement(content, attachProps);
|
|
95
|
+
return cloneElement(content, attachProps);
|
|
96
96
|
}
|
|
97
97
|
return content;
|
|
98
98
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vitus-labs-core.module.js","sources":["../src/config.ts","../src/isEmpty.ts","../src/context.tsx","../src/compose.ts","../src/renderContent.ts","../src/htmlTags.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable no-underscore-dangle */\nimport { ComponentType } from 'react'\nimport styled, {\n css,\n ThemeProvider,\n ThemedCssFunction,\n StyledInterface,\n DefaultTheme,\n ThemeProviderComponent,\n} from 'styled-components'\nimport type { HTMLTags } from '~/htmlTags'\n\nconst OPTIONS: Internal = {\n styled,\n css,\n styledContext: ThemeProvider,\n component: 'div',\n textComponent: 'span',\n} as Internal\n\ntype Init = ({\n styled,\n css,\n context,\n component,\n textComponent,\n}: {\n styled: any\n css: any\n context: any\n component?: ComponentType | HTMLTags\n textComponent?: ComponentType | HTMLTags\n}) => void\n\nconst init: Init = ({\n styled,\n css,\n context,\n component = 'div',\n textComponent = 'span',\n}) => {\n OPTIONS.css = css\n OPTIONS.styled = styled\n OPTIONS.styledContext = context\n OPTIONS.component = component\n OPTIONS.textComponent = textComponent\n}\n\ninterface Internal {\n css: ThemedCssFunction<DefaultTheme>\n styled: StyledInterface\n styledContext: ThemeProviderComponent<any, any>\n component: any\n textComponent: any\n}\n\nconst internal: Internal = Object.freeze({\n get css() {\n return OPTIONS.css\n },\n get styled() {\n return OPTIONS.styled\n },\n get styledContext() {\n return OPTIONS.styledContext\n },\n get component() {\n return OPTIONS.component\n },\n get textComponent() {\n return OPTIONS.textComponent\n },\n})\n\nexport { init }\nexport default internal\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nexport type IsEmpty = <T extends Record<string, unknown> | unknown[] | null>(\n param?: T\n) => null | undefined extends T ? true : keyof T extends never ? true : false\n\nconst isEmpty: IsEmpty = (param) => {\n if (!param) return true\n\n if (typeof param !== 'object') {\n return true as any\n }\n\n if (Array.isArray(param) && param.length === 0) {\n return true\n }\n\n if (\n Object.entries(param as any).length === 0 &&\n param.constructor === Object\n ) {\n return true\n }\n\n return false\n}\n\nexport default isEmpty\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React, { createContext, FC } from 'react'\nimport config from '~/config'\nimport isEmpty from '~/isEmpty'\n\nconst context = createContext<any>({})\nconst VitusLabsProvider = context.Provider\n\ntype Theme = Partial<\n {\n rootSize: number\n breakpoints: Record<string, number | string>\n } & Record<string, unknown>\n>\n\ntype ProviderType = Partial<\n {\n theme: Theme\n } & Record<string, unknown>\n>\n\nconst Provider: FC<ProviderType> = ({ theme, children, ...props }) => {\n if (!theme || isEmpty(theme)) return <>{children}</>\n\n const StyledContext = config.styledContext\n\n if (StyledContext) {\n return (\n <VitusLabsProvider value={{ theme, ...props }}>\n <StyledContext theme={theme}>{children}</StyledContext>\n </VitusLabsProvider>\n )\n }\n\n return (\n <VitusLabsProvider value={{ theme, ...props }}>\n {children}\n </VitusLabsProvider>\n )\n}\n\nexport { context }\n\nexport default Provider\n","/* eslint-disable @typescript-eslint/no-explicit-any */\n// const compose = <R>(fn1: (a: R) => R, ...fns: Array<(a: R) => R>) =>\n// fns.reduce((a, b) => (value) => a(b(value)), fn1)\n\n// const compose = (funcs) =>\n// funcs.reduce(\n// (a, b) => (...args) => a(b(...args)),\n// (arg) => arg\n// )\n\ntype ArityOneFn = (arg: any) => any\ntype PickLastInTuple<T extends any[]> = T extends [\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n ...rest: infer U,\n argn: infer L\n]\n ? L\n : any\ntype FirstFnParameterType<T extends any[]> = Parameters<PickLastInTuple<T>>[any]\ntype LastFnReturnType<T extends any[]> = ReturnType<T[0]>\n\nconst compose =\n <T extends ArityOneFn[]>(...fns: T) =>\n (p: FirstFnParameterType<T>): LastFnReturnType<T> =>\n fns.reduceRight((acc: any, cur: any) => cur(acc), p)\n\nexport default compose\n","/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/ban-ts-comment */\nimport {\n createElement,\n isValidElement,\n cloneElement,\n Children,\n ReactNode,\n ComponentType,\n} from 'react'\nimport isEmpty from './isEmpty'\n\nexport type RenderContent = (\n content?: ReactNode | ComponentType,\n attachProps?: Record<string, any>\n) => ReactNode\n\nconst renderContent: RenderContent = (content, attachProps = {}) => {\n if (!content) return null\n\n if (Array.isArray(content)) {\n return content\n }\n\n if (typeof content === 'function') {\n // @ts-ignore\n return createElement(content, attachProps)\n }\n\n if (isValidElement(content)) {\n if (isEmpty(attachProps)) {\n return content\n }\n\n return cloneElement(Children.only(content), attachProps)\n }\n\n // @ts-ignore\n if (typeof content === 'object' && !isEmpty(content)) {\n // FIXME: quick fix for rendering invalid elements\n // no idea of what is going on here yet\n // @ts-ignore\n return createElement(content, attachProps)\n }\n\n return content\n}\n\nexport default renderContent\n","const TAGS = [\n 'a',\n 'abbr',\n // 'acronym',\n 'address',\n // 'applet',\n 'area',\n 'article',\n 'aside',\n 'audio',\n 'b',\n 'base',\n // 'basefont',\n 'bdi',\n 'bdo',\n 'big',\n 'blockquote',\n 'body',\n 'br',\n 'button',\n 'canvas',\n 'caption',\n // 'center',\n 'cite',\n 'code',\n 'col',\n 'colgroup',\n 'data',\n 'datalist',\n 'dd',\n 'del',\n 'details',\n 'dfn',\n 'dialog',\n // 'dir',\n 'div',\n 'dl',\n 'dt',\n 'em',\n 'embed',\n 'fieldset',\n 'figcaption',\n 'figure',\n // 'font',\n 'footer',\n 'form',\n // 'frame',\n // 'frameset',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'head',\n 'header',\n 'hr',\n 'html',\n 'i',\n 'iframe',\n 'img',\n 'input',\n 'ins',\n 'kbd',\n 'label',\n 'legend',\n 'li',\n 'link',\n 'main',\n 'map',\n 'mark',\n 'meta',\n 'meter',\n 'nav',\n // 'noframes',\n 'noscript',\n 'object',\n 'ol',\n 'optgroup',\n 'option',\n 'output',\n 'p',\n 'param',\n 'picture',\n 'pre',\n 'progress',\n 'q',\n 'rp',\n 'rt',\n 'ruby',\n 's',\n 'samp',\n 'script',\n 'section',\n 'select',\n 'small',\n 'source',\n 'span',\n // 'strike',\n 'strong',\n 'style',\n 'sub',\n 'summary',\n 'sup',\n 'svg',\n 'table',\n 'tbody',\n 'td',\n 'template',\n 'textarea',\n 'tfoot',\n 'th',\n 'thead',\n 'time',\n 'title',\n 'tr',\n 'track',\n // 'tt',\n 'u',\n 'ul',\n 'var',\n 'video',\n 'wbr',\n] as const\n\nexport type HTMLTags = typeof TAGS[number]\n\nexport default TAGS\n"],"names":["config"],"mappings":";;;;;AAaA,MAAM,OAAO,GAAa;IACxB,MAAM;IACN,GAAG;IACH,aAAa,EAAE,aAAa;IAC5B,SAAS,EAAE,KAAK;IAChB,aAAa,EAAE,MAAM;CACV,CAAA;MAgBP,IAAI,GAAS,CAAC,EAClB,MAAM,EACN,GAAG,EACH,OAAO,EACP,SAAS,GAAG,KAAK,EACjB,aAAa,GAAG,MAAM,GACvB;IACC,OAAO,CAAC,GAAG,GAAG,GAAG,CAAA;IACjB,OAAO,CAAC,MAAM,GAAG,MAAM,CAAA;IACvB,OAAO,CAAC,aAAa,GAAG,OAAO,CAAA;IAC/B,OAAO,CAAC,SAAS,GAAG,SAAS,CAAA;IAC7B,OAAO,CAAC,aAAa,GAAG,aAAa,CAAA;AACvC,EAAC;MAUK,QAAQ,GAAa,MAAM,CAAC,MAAM,CAAC;IACvC,IAAI,GAAG;QACL,OAAO,OAAO,CAAC,GAAG,CAAA;KACnB;IACD,IAAI,MAAM;QACR,OAAO,OAAO,CAAC,MAAM,CAAA;KACtB;IACD,IAAI,aAAa;QACf,OAAO,OAAO,CAAC,aAAa,CAAA;KAC7B;IACD,IAAI,SAAS;QACX,OAAO,OAAO,CAAC,SAAS,CAAA;KACzB;IACD,IAAI,aAAa;QACf,OAAO,OAAO,CAAC,aAAa,CAAA;KAC7B;CACF;;MCpEK,OAAO,GAAY,CAAC,KAAK;IAC7B,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAA;IAEvB,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC7B,OAAO,IAAW,CAAA;KACnB;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,C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AU;IACV,QAAQ;IACR,IAAI;IACJ,UAAU;IACV,QAAQ;IACR,QAAQ;IACR,GAAG;IACH,OAAO;IACP,SAAS;IACT,KAAK;IACL,UAAU;IACV,GAAG;IACH,IAAI;IACJ,IAAI;IACJ,MAAM;IACN,GAAG;IACH,MAAM;IACN,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,MAAM;;IAEN,QAAQ;IACR,OAAO;IACP,KAAK;IACL,SAAS;IACT,KAAK;IACL,KAAK;IACL,OAAO;IACP,OAAO;IACP,IAAI;IACJ,UAAU;IACV,UAAU;IACV,OAAO;IACP,IAAI;IACJ,OAAO;IACP,MAAM;IACN,OAAO;IACP,IAAI;IACJ,OAAO;;IAEP,GAAG;IACH,IAAI;IACJ,KAAK;IACL,OAAO;IACP,KAAK;;;;;"}
|
|
1
|
+
{"version":3,"file":"vitus-labs-core.module.js","sources":["../src/config.ts","../src/isEmpty.ts","../src/context.tsx","../src/compose.ts","../src/renderContent.ts","../src/htmlTags.ts"],"sourcesContent":["/* eslint-disable no-underscore-dangle */\nimport { ComponentType } from 'react'\nimport styled, {\n css,\n ThemeProvider,\n ThemedCssFunction,\n StyledInterface,\n DefaultTheme,\n ThemeProviderComponent,\n} from 'styled-components'\nimport type { HTMLTags } from '~/htmlTags'\n\nconst OPTIONS: Internal = {\n styled,\n css,\n styledContext: ThemeProvider,\n component: 'div',\n textComponent: 'span',\n} as Internal\n\ntype Init = ({\n styled,\n css,\n context,\n component,\n textComponent,\n}: {\n styled: any\n css: any\n context: any\n component?: ComponentType | HTMLTags\n textComponent?: ComponentType | HTMLTags\n}) => void\n\nconst init: Init = ({\n styled,\n css,\n context,\n component = 'div',\n textComponent = 'span',\n}) => {\n OPTIONS.css = css\n OPTIONS.styled = styled\n OPTIONS.styledContext = context\n OPTIONS.component = component\n OPTIONS.textComponent = textComponent\n}\n\ninterface Internal {\n css: ThemedCssFunction<DefaultTheme>\n styled: StyledInterface\n styledContext: ThemeProviderComponent<any, any>\n component: any\n textComponent: any\n}\n\nconst internal: Internal = Object.freeze({\n get css() {\n return OPTIONS.css\n },\n get styled() {\n return OPTIONS.styled\n },\n get styledContext() {\n return OPTIONS.styledContext\n },\n get component() {\n return OPTIONS.component\n },\n get textComponent() {\n return OPTIONS.textComponent\n },\n})\n\nexport { init }\nexport default internal\n","export type IsEmpty = <T extends Record<string, unknown> | unknown[] | null>(\n param?: T\n) => null | undefined extends T ? true : keyof T extends never ? true : false\n\nconst isEmpty: IsEmpty = (param) => {\n if (!param) return true\n\n if (typeof param !== 'object') {\n return true as any\n }\n\n if (Array.isArray(param) && param.length === 0) {\n return true\n }\n\n if (\n Object.entries(param as any).length === 0 &&\n param.constructor === Object\n ) {\n return true\n }\n\n return false\n}\n\nexport default isEmpty\n","import React, { createContext, FC } from 'react'\nimport config from '~/config'\nimport isEmpty from '~/isEmpty'\n\nconst context = createContext<any>({})\nconst VitusLabsProvider = context.Provider\n\ntype Theme = Partial<\n {\n rootSize: number\n breakpoints: Record<string, number | string>\n } & Record<string, unknown>\n>\n\ntype ProviderType = Partial<\n {\n theme: Theme\n } & Record<string, unknown>\n>\n\nconst Provider: FC<ProviderType> = ({ theme, children, ...props }) => {\n if (!theme || isEmpty(theme)) return <>{children}</>\n\n const StyledContext = config.styledContext\n\n if (StyledContext) {\n return (\n <VitusLabsProvider value={{ theme, ...props }}>\n <StyledContext theme={theme}>{children}</StyledContext>\n </VitusLabsProvider>\n )\n }\n\n return (\n <VitusLabsProvider value={{ theme, ...props }}>\n {children}\n </VitusLabsProvider>\n )\n}\n\nexport { context }\n\nexport default Provider\n","// const compose = <R>(fn1: (a: R) => R, ...fns: Array<(a: R) => R>) =>\n// fns.reduce((a, b) => (value) => a(b(value)), fn1)\n\n// const compose = (funcs) =>\n// funcs.reduce(\n// (a, b) => (...args) => a(b(...args)),\n// (arg) => arg\n// )\n\ntype ArityOneFn = (arg: any) => any\ntype PickLastInTuple<T extends any[]> = T extends [\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n ...rest: infer U,\n argn: infer L\n]\n ? L\n : any\ntype FirstFnParameterType<T extends any[]> = Parameters<PickLastInTuple<T>>[any]\ntype LastFnReturnType<T extends any[]> = ReturnType<T[0]>\n\nconst compose =\n <T extends ArityOneFn[]>(...fns: T) =>\n (p: FirstFnParameterType<T>): LastFnReturnType<T> =>\n fns.reduceRight((acc: any, cur: any) => cur(acc), p)\n\nexport default compose\n","import { isValidElementType, isFragment } from 'react-is'\nimport { createElement, isValidElement, cloneElement, ReactNode } from 'react'\nimport isEmpty from './isEmpty'\n\ntype CreateTypes = Parameters<typeof createElement>[0]\ntype CloneTypes = Parameters<typeof cloneElement>[0]\n\n// export type RenderContent = (\n// content?: CreateTypes | CloneTypes | ReactNode | ReactNode[],\n// attachProps?: Record<string, any>\n// ) => ReturnType<typeof createElement> | ReturnType<typeof cloneElement> | null\n\n// const renderContent: RenderContent = (content, attachProps) => {\n// if (!content) return null as any\n\n// if (typeof content === 'string') {\n// return content\n// }\n\n// if (Array.isArray(content)) {\n// return content\n// }\n\n// if (typeof content === 'function') {\n// return createElement(content, attachProps)\n// }\n\n// if (isValidElement(content)) {\n// if (isEmpty(attachProps)) {\n// return content\n// }\n\n// return cloneElement(Children.only(content), attachProps)\n// }\n\n// if (typeof content === 'object' && !isEmpty(content)) {\n// return createElement(content, attachProps)\n// }\n\n// return content\n// }\n\n// export default renderContent\n\nexport type RenderContent = (\n content?: CreateTypes | CloneTypes | ReactNode | ReactNode[],\n attachProps?: Record<string, any>\n) => ReturnType<typeof createElement> | ReturnType<typeof cloneElement> | null\n\nconst renderContent: RenderContent = (content, attachProps) => {\n if (!content) return null as any\n\n if (typeof content === 'string' && isValidElement(content)) {\n return attachProps\n ? createElement(content, attachProps)\n : createElement(content)\n }\n\n if (['number', 'boolean', 'string'].includes(typeof content)) {\n return content\n }\n\n if (Array.isArray(content) || isFragment(content)) {\n return content\n }\n\n if (isValidElementType(content)) {\n return attachProps\n ? createElement(content, attachProps)\n : createElement(content)\n }\n\n if (isValidElement(content)) {\n if (isEmpty(attachProps)) {\n return content\n }\n\n return cloneElement(content, attachProps)\n }\n\n return content\n}\n\nexport default renderContent\n","const TAGS = [\n 'a',\n 'abbr',\n // 'acronym',\n 'address',\n // 'applet',\n 'area',\n 'article',\n 'aside',\n 'audio',\n 'b',\n 'base',\n // 'basefont',\n 'bdi',\n 'bdo',\n 'big',\n 'blockquote',\n 'body',\n 'br',\n 'button',\n 'canvas',\n 'caption',\n // 'center',\n 'cite',\n 'code',\n 'col',\n 'colgroup',\n 'data',\n 'datalist',\n 'dd',\n 'del',\n 'details',\n 'dfn',\n 'dialog',\n // 'dir',\n 'div',\n 'dl',\n 'dt',\n 'em',\n 'embed',\n 'fieldset',\n 'figcaption',\n 'figure',\n // 'font',\n 'footer',\n 'form',\n // 'frame',\n // 'frameset',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'head',\n 'header',\n 'hr',\n 'html',\n 'i',\n 'iframe',\n 'img',\n 'input',\n 'ins',\n 'kbd',\n 'label',\n 'legend',\n 'li',\n 'link',\n 'main',\n 'map',\n 'mark',\n 'meta',\n 'meter',\n 'nav',\n // 'noframes',\n 'noscript',\n 'object',\n 'ol',\n 'optgroup',\n 'option',\n 'output',\n 'p',\n 'param',\n 'picture',\n 'pre',\n 'progress',\n 'q',\n 'rp',\n 'rt',\n 'ruby',\n 's',\n 'samp',\n 'script',\n 'section',\n 'select',\n 'small',\n 'source',\n 'span',\n // 'strike',\n 'strong',\n 'style',\n 'sub',\n 'summary',\n 'sup',\n 'svg',\n 'table',\n 'tbody',\n 'td',\n 'template',\n 'textarea',\n 'tfoot',\n 'th',\n 'thead',\n 'time',\n 'title',\n 'tr',\n 'track',\n // 'tt',\n 'u',\n 'ul',\n 'var',\n 'video',\n 'wbr',\n] as const\n\nexport type HTMLTags = typeof TAGS[number]\n\nexport default TAGS\n"],"names":["config"],"mappings":";;;;;;AAYA,MAAM,OAAO,GAAa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AQ;IACR,QAAQ;IACR,GAAG;IACH,OAAO;IACP,SAAS;IACT,KAAK;IACL,UAAU;IACV,GAAG;IACH,IAAI;IACJ,IAAI;IACJ,MAAM;IACN,GAAG;IACH,MAAM;IACN,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,MAAM;;IAEN,QAAQ;IACR,OAAO;IACP,KAAK;IACL,SAAS;IACT,KAAK;IACL,KAAK;IACL,OAAO;IACP,OAAO;IACP,IAAI;IACJ,UAAU;IACV,UAAU;IACV,OAAO;IACP,IAAI;IACJ,OAAO;IACP,MAAM;IACN,OAAO;IACP,IAAI;IACJ,OAAO;;IAEP,GAAG;IACH,IAAI;IACJ,KAAK;IACL,OAAO;IACP,KAAK;;;;;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('lodash'), require('moize'), require('styled-components'), require('react')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'lodash', 'moize', 'styled-components', 'react'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.vitusLabsCore = {}, global.lodash, global.moize, global.styled, global.React));
|
|
5
|
-
}(this, (function (exports, lodash, moize, styled, React) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('lodash'), require('moize'), require('styled-components'), require('react'), require('react-is')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'lodash', 'moize', 'styled-components', 'react', 'react-is'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.vitusLabsCore = {}, global.lodash, global.moize, global.styled, global.React, global.ReactIs));
|
|
5
|
+
})(this, (function (exports, lodash, moize, styled, React, reactIs) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
12
12
|
|
|
13
13
|
const OPTIONS = {
|
|
14
|
-
styled: styled__default[
|
|
14
|
+
styled: styled__default["default"],
|
|
15
15
|
css: styled.css,
|
|
16
16
|
styledContext: styled.ThemeProvider,
|
|
17
17
|
component: 'div',
|
|
@@ -58,48 +58,47 @@
|
|
|
58
58
|
return false;
|
|
59
59
|
};
|
|
60
60
|
|
|
61
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
62
61
|
const context = React.createContext({});
|
|
63
62
|
const VitusLabsProvider = context.Provider;
|
|
64
63
|
const Provider = ({ theme, children, ...props }) => {
|
|
65
64
|
if (!theme || isEmpty(theme))
|
|
66
|
-
return React__default[
|
|
65
|
+
return React__default["default"].createElement(React__default["default"].Fragment, null, children);
|
|
67
66
|
const StyledContext = internal.styledContext;
|
|
68
67
|
if (StyledContext) {
|
|
69
|
-
return (React__default[
|
|
70
|
-
React__default[
|
|
68
|
+
return (React__default["default"].createElement(VitusLabsProvider, { value: { theme, ...props } },
|
|
69
|
+
React__default["default"].createElement(StyledContext, { theme: theme }, children)));
|
|
71
70
|
}
|
|
72
|
-
return (React__default[
|
|
71
|
+
return (React__default["default"].createElement(VitusLabsProvider, { value: { theme, ...props } }, children));
|
|
73
72
|
};
|
|
74
73
|
|
|
75
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
76
74
|
// const compose = <R>(fn1: (a: R) => R, ...fns: Array<(a: R) => R>) =>
|
|
77
75
|
// fns.reduce((a, b) => (value) => a(b(value)), fn1)
|
|
78
76
|
const compose = (...fns) => (p) => fns.reduceRight((acc, cur) => cur(acc), p);
|
|
79
77
|
|
|
80
|
-
|
|
81
|
-
const renderContent = (content, attachProps = {}) => {
|
|
78
|
+
const renderContent = (content, attachProps) => {
|
|
82
79
|
if (!content)
|
|
83
80
|
return null;
|
|
84
|
-
if (
|
|
81
|
+
if (typeof content === 'string' && React.isValidElement(content)) {
|
|
82
|
+
return attachProps
|
|
83
|
+
? React.createElement(content, attachProps)
|
|
84
|
+
: React.createElement(content);
|
|
85
|
+
}
|
|
86
|
+
if (['number', 'boolean', 'string'].includes(typeof content)) {
|
|
87
|
+
return content;
|
|
88
|
+
}
|
|
89
|
+
if (Array.isArray(content) || reactIs.isFragment(content)) {
|
|
85
90
|
return content;
|
|
86
91
|
}
|
|
87
|
-
if (
|
|
88
|
-
|
|
89
|
-
|
|
92
|
+
if (reactIs.isValidElementType(content)) {
|
|
93
|
+
return attachProps
|
|
94
|
+
? React.createElement(content, attachProps)
|
|
95
|
+
: React.createElement(content);
|
|
90
96
|
}
|
|
91
97
|
if (React.isValidElement(content)) {
|
|
92
98
|
if (isEmpty(attachProps)) {
|
|
93
99
|
return content;
|
|
94
100
|
}
|
|
95
|
-
return React.cloneElement(
|
|
96
|
-
}
|
|
97
|
-
// @ts-ignore
|
|
98
|
-
if (typeof content === 'object' && !isEmpty(content)) {
|
|
99
|
-
// FIXME: quick fix for rendering invalid elements
|
|
100
|
-
// no idea of what is going on here yet
|
|
101
|
-
// @ts-ignore
|
|
102
|
-
return React.createElement(content, attachProps);
|
|
101
|
+
return React.cloneElement(content, attachProps);
|
|
103
102
|
}
|
|
104
103
|
return content;
|
|
105
104
|
};
|
|
@@ -231,45 +230,31 @@
|
|
|
231
230
|
|
|
232
231
|
Object.defineProperty(exports, 'get', {
|
|
233
232
|
enumerable: true,
|
|
234
|
-
get: function () {
|
|
235
|
-
return lodash.get;
|
|
236
|
-
}
|
|
233
|
+
get: function () { return lodash.get; }
|
|
237
234
|
});
|
|
238
235
|
Object.defineProperty(exports, 'merge', {
|
|
239
236
|
enumerable: true,
|
|
240
|
-
get: function () {
|
|
241
|
-
return lodash.merge;
|
|
242
|
-
}
|
|
237
|
+
get: function () { return lodash.merge; }
|
|
243
238
|
});
|
|
244
239
|
Object.defineProperty(exports, 'omit', {
|
|
245
240
|
enumerable: true,
|
|
246
|
-
get: function () {
|
|
247
|
-
return lodash.omit;
|
|
248
|
-
}
|
|
241
|
+
get: function () { return lodash.omit; }
|
|
249
242
|
});
|
|
250
243
|
Object.defineProperty(exports, 'pick', {
|
|
251
244
|
enumerable: true,
|
|
252
|
-
get: function () {
|
|
253
|
-
return lodash.pick;
|
|
254
|
-
}
|
|
245
|
+
get: function () { return lodash.pick; }
|
|
255
246
|
});
|
|
256
247
|
Object.defineProperty(exports, 'set', {
|
|
257
248
|
enumerable: true,
|
|
258
|
-
get: function () {
|
|
259
|
-
return lodash.set;
|
|
260
|
-
}
|
|
249
|
+
get: function () { return lodash.set; }
|
|
261
250
|
});
|
|
262
251
|
Object.defineProperty(exports, 'throttle', {
|
|
263
252
|
enumerable: true,
|
|
264
|
-
get: function () {
|
|
265
|
-
return lodash.throttle;
|
|
266
|
-
}
|
|
253
|
+
get: function () { return lodash.throttle; }
|
|
267
254
|
});
|
|
268
255
|
Object.defineProperty(exports, 'memoize', {
|
|
269
256
|
enumerable: true,
|
|
270
|
-
get: function () {
|
|
271
|
-
return moize__default['default'];
|
|
272
|
-
}
|
|
257
|
+
get: function () { return moize__default["default"]; }
|
|
273
258
|
});
|
|
274
259
|
exports.Provider = Provider;
|
|
275
260
|
exports.compose = compose;
|
|
@@ -282,5 +267,5 @@
|
|
|
282
267
|
|
|
283
268
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
284
269
|
|
|
285
|
-
}))
|
|
270
|
+
}));
|
|
286
271
|
//# sourceMappingURL=vitus-labs-core.umd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vitus-labs-core.umd.js","sources":["../src/config.ts","../src/isEmpty.ts","../src/context.tsx","../src/compose.ts","../src/renderContent.ts","../src/htmlTags.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable no-underscore-dangle */\nimport { ComponentType } from 'react'\nimport styled, {\n css,\n ThemeProvider,\n ThemedCssFunction,\n StyledInterface,\n DefaultTheme,\n ThemeProviderComponent,\n} from 'styled-components'\nimport type { HTMLTags } from '~/htmlTags'\n\nconst OPTIONS: Internal = {\n styled,\n css,\n styledContext: ThemeProvider,\n component: 'div',\n textComponent: 'span',\n} as Internal\n\ntype Init = ({\n styled,\n css,\n context,\n component,\n textComponent,\n}: {\n styled: any\n css: any\n context: any\n component?: ComponentType | HTMLTags\n textComponent?: ComponentType | HTMLTags\n}) => void\n\nconst init: Init = ({\n styled,\n css,\n context,\n component = 'div',\n textComponent = 'span',\n}) => {\n OPTIONS.css = css\n OPTIONS.styled = styled\n OPTIONS.styledContext = context\n OPTIONS.component = component\n OPTIONS.textComponent = textComponent\n}\n\ninterface Internal {\n css: ThemedCssFunction<DefaultTheme>\n styled: StyledInterface\n styledContext: ThemeProviderComponent<any, any>\n component: any\n textComponent: any\n}\n\nconst internal: Internal = Object.freeze({\n get css() {\n return OPTIONS.css\n },\n get styled() {\n return OPTIONS.styled\n },\n get styledContext() {\n return OPTIONS.styledContext\n },\n get component() {\n return OPTIONS.component\n },\n get textComponent() {\n return OPTIONS.textComponent\n },\n})\n\nexport { init }\nexport default internal\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nexport type IsEmpty = <T extends Record<string, unknown> | unknown[] | null>(\n param?: T\n) => null | undefined extends T ? true : keyof T extends never ? true : false\n\nconst isEmpty: IsEmpty = (param) => {\n if (!param) return true\n\n if (typeof param !== 'object') {\n return true as any\n }\n\n if (Array.isArray(param) && param.length === 0) {\n return true\n }\n\n if (\n Object.entries(param as any).length === 0 &&\n param.constructor === Object\n ) {\n return true\n }\n\n return false\n}\n\nexport default isEmpty\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React, { createContext, FC } from 'react'\nimport config from '~/config'\nimport isEmpty from '~/isEmpty'\n\nconst context = createContext<any>({})\nconst VitusLabsProvider = context.Provider\n\ntype Theme = Partial<\n {\n rootSize: number\n breakpoints: Record<string, number | string>\n } & Record<string, unknown>\n>\n\ntype ProviderType = Partial<\n {\n theme: Theme\n } & Record<string, unknown>\n>\n\nconst Provider: FC<ProviderType> = ({ theme, children, ...props }) => {\n if (!theme || isEmpty(theme)) return <>{children}</>\n\n const StyledContext = config.styledContext\n\n if (StyledContext) {\n return (\n <VitusLabsProvider value={{ theme, ...props }}>\n <StyledContext theme={theme}>{children}</StyledContext>\n </VitusLabsProvider>\n )\n }\n\n return (\n <VitusLabsProvider value={{ theme, ...props }}>\n {children}\n </VitusLabsProvider>\n )\n}\n\nexport { context }\n\nexport default Provider\n","/* eslint-disable @typescript-eslint/no-explicit-any */\n// const compose = <R>(fn1: (a: R) => R, ...fns: Array<(a: R) => R>) =>\n// fns.reduce((a, b) => (value) => a(b(value)), fn1)\n\n// const compose = (funcs) =>\n// funcs.reduce(\n// (a, b) => (...args) => a(b(...args)),\n// (arg) => arg\n// )\n\ntype ArityOneFn = (arg: any) => any\ntype PickLastInTuple<T extends any[]> = T extends [\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n ...rest: infer U,\n argn: infer L\n]\n ? L\n : any\ntype FirstFnParameterType<T extends any[]> = Parameters<PickLastInTuple<T>>[any]\ntype LastFnReturnType<T extends any[]> = ReturnType<T[0]>\n\nconst compose =\n <T extends ArityOneFn[]>(...fns: T) =>\n (p: FirstFnParameterType<T>): LastFnReturnType<T> =>\n fns.reduceRight((acc: any, cur: any) => cur(acc), p)\n\nexport default compose\n","/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/ban-ts-comment */\nimport {\n createElement,\n isValidElement,\n cloneElement,\n Children,\n ReactNode,\n ComponentType,\n} from 'react'\nimport isEmpty from './isEmpty'\n\nexport type RenderContent = (\n content?: ReactNode | ComponentType,\n attachProps?: Record<string, any>\n) => ReactNode\n\nconst renderContent: RenderContent = (content, attachProps = {}) => {\n if (!content) return null\n\n if (Array.isArray(content)) {\n return content\n }\n\n if (typeof content === 'function') {\n // @ts-ignore\n return createElement(content, attachProps)\n }\n\n if (isValidElement(content)) {\n if (isEmpty(attachProps)) {\n return content\n }\n\n return cloneElement(Children.only(content), attachProps)\n }\n\n // @ts-ignore\n if (typeof content === 'object' && !isEmpty(content)) {\n // FIXME: quick fix for rendering invalid elements\n // no idea of what is going on here yet\n // @ts-ignore\n return createElement(content, attachProps)\n }\n\n return content\n}\n\nexport default renderContent\n","const TAGS = [\n 'a',\n 'abbr',\n // 'acronym',\n 'address',\n // 'applet',\n 'area',\n 'article',\n 'aside',\n 'audio',\n 'b',\n 'base',\n // 'basefont',\n 'bdi',\n 'bdo',\n 'big',\n 'blockquote',\n 'body',\n 'br',\n 'button',\n 'canvas',\n 'caption',\n // 'center',\n 'cite',\n 'code',\n 'col',\n 'colgroup',\n 'data',\n 'datalist',\n 'dd',\n 'del',\n 'details',\n 'dfn',\n 'dialog',\n // 'dir',\n 'div',\n 'dl',\n 'dt',\n 'em',\n 'embed',\n 'fieldset',\n 'figcaption',\n 'figure',\n // 'font',\n 'footer',\n 'form',\n // 'frame',\n // 'frameset',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'head',\n 'header',\n 'hr',\n 'html',\n 'i',\n 'iframe',\n 'img',\n 'input',\n 'ins',\n 'kbd',\n 'label',\n 'legend',\n 'li',\n 'link',\n 'main',\n 'map',\n 'mark',\n 'meta',\n 'meter',\n 'nav',\n // 'noframes',\n 'noscript',\n 'object',\n 'ol',\n 'optgroup',\n 'option',\n 'output',\n 'p',\n 'param',\n 'picture',\n 'pre',\n 'progress',\n 'q',\n 'rp',\n 'rt',\n 'ruby',\n 's',\n 'samp',\n 'script',\n 'section',\n 'select',\n 'small',\n 'source',\n 'span',\n // 'strike',\n 'strong',\n 'style',\n 'sub',\n 'summary',\n 'sup',\n 'svg',\n 'table',\n 'tbody',\n 'td',\n 'template',\n 'textarea',\n 'tfoot',\n 'th',\n 'thead',\n 'time',\n 'title',\n 'tr',\n 'track',\n // 'tt',\n 'u',\n 'ul',\n 'var',\n 'video',\n 'wbr',\n] as const\n\nexport type HTMLTags = typeof TAGS[number]\n\nexport default TAGS\n"],"names":["styled","css","ThemeProvider","createContext","React","config","createElement","isValidElement","cloneElement","Children"],"mappings":";;;;;;;;;;;;EAaA,MAAM,OAAO,GAAa;cACxBA,0BAAM;WACNC,UAAG;MACH,aAAa,EAAEC,oBAAa;MAC5B,SAAS,EAAE,KAAK;MAChB,aAAa,EAAE,MAAM;GACV,CAAA;QAgBP,IAAI,GAAS,CAAC,EAClB,MAAM,EACN,GAAG,EACH,OAAO,EACP,SAAS,GAAG,KAAK,EACjB,aAAa,GAAG,MAAM,GACvB;MACC,OAAO,CAAC,GAAG,GAAG,GAAG,CAAA;MACjB,OAAO,CAAC,MAAM,GAAG,MAAM,CAAA;MACvB,OAAO,CAAC,aAAa,GAAG,OAAO,CAAA;MAC/B,OAAO,CAAC,SAAS,GAAG,SAAS,CAAA;MAC7B,OAAO,CAAC,aAAa,GAAG,aAAa,CAAA;EACvC,EAAC;QAUK,QAAQ,GAAa,MAAM,CAAC,MAAM,CAAC;MACvC,IAAI,GAAG;UACL,OAAO,OAAO,CAAC,GAAG,CAAA;OACnB;MACD,IAAI,MAAM;UACR,OAAO,OAAO,CAAC,MAAM,CAAA;OACtB;MACD,IAAI,aAAa;UACf,OAAO,OAAO,CAAC,aAAa,CAAA;OAC7B;MACD,IAAI,SAAS;UACX,OAAO,OAAO,CAAC,SAAS,CAAA;OACzB;MACD,IAAI,aAAa;UACf,OAAO,OAAO,CAAC,aAAa,CAAA;OAC7B;GACF;;QCpEK,OAAO,GAAY,CAAC,KAAK;MAC7B,IAAI,CAAC,KAAK;UAAE,OAAO,IAAI,CAAA;MAEvB,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;UAC7B,OAAO,IAAW,CAAA;OACnB;MAED,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;UAC9C,OAAO,IAAI,CAAA;OACZ;MAED,IACE,MAAM,CAAC,OAA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ACR,QAAQ;MACR,GAAG;MACH,OAAO;MACP,SAAS;MACT,KAAK;MACL,UAAU;MACV,GAAG;MACH,IAAI;MACJ,IAAI;MACJ,MAAM;MACN,GAAG;MACH,MAAM;MACN,QAAQ;MACR,SAAS;MACT,QAAQ;MACR,OAAO;MACP,QAAQ;MACR,MAAM;;MAEN,QAAQ;MACR,OAAO;MACP,KAAK;MACL,SAAS;MACT,KAAK;MACL,KAAK;MACL,OAAO;MACP,OAAO;MACP,IAAI;MACJ,UAAU;MACV,UAAU;MACV,OAAO;MACP,IAAI;MACJ,OAAO;MACP,MAAM;MACN,OAAO;MACP,IAAI;MACJ,OAAO;;MAEP,GAAG;MACH,IAAI;MACJ,KAAK;MACL,OAAO;MACP,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"vitus-labs-core.umd.js","sources":["../src/config.ts","../src/isEmpty.ts","../src/context.tsx","../src/compose.ts","../src/renderContent.ts","../src/htmlTags.ts"],"sourcesContent":["/* eslint-disable no-underscore-dangle */\nimport { ComponentType } from 'react'\nimport styled, {\n css,\n ThemeProvider,\n ThemedCssFunction,\n StyledInterface,\n DefaultTheme,\n ThemeProviderComponent,\n} from 'styled-components'\nimport type { HTMLTags } from '~/htmlTags'\n\nconst OPTIONS: Internal = {\n styled,\n css,\n styledContext: ThemeProvider,\n component: 'div',\n textComponent: 'span',\n} as Internal\n\ntype Init = ({\n styled,\n css,\n context,\n component,\n textComponent,\n}: {\n styled: any\n css: any\n context: any\n component?: ComponentType | HTMLTags\n textComponent?: ComponentType | HTMLTags\n}) => void\n\nconst init: Init = ({\n styled,\n css,\n context,\n component = 'div',\n textComponent = 'span',\n}) => {\n OPTIONS.css = css\n OPTIONS.styled = styled\n OPTIONS.styledContext = context\n OPTIONS.component = component\n OPTIONS.textComponent = textComponent\n}\n\ninterface Internal {\n css: ThemedCssFunction<DefaultTheme>\n styled: StyledInterface\n styledContext: ThemeProviderComponent<any, any>\n component: any\n textComponent: any\n}\n\nconst internal: Internal = Object.freeze({\n get css() {\n return OPTIONS.css\n },\n get styled() {\n return OPTIONS.styled\n },\n get styledContext() {\n return OPTIONS.styledContext\n },\n get component() {\n return OPTIONS.component\n },\n get textComponent() {\n return OPTIONS.textComponent\n },\n})\n\nexport { init }\nexport default internal\n","export type IsEmpty = <T extends Record<string, unknown> | unknown[] | null>(\n param?: T\n) => null | undefined extends T ? true : keyof T extends never ? true : false\n\nconst isEmpty: IsEmpty = (param) => {\n if (!param) return true\n\n if (typeof param !== 'object') {\n return true as any\n }\n\n if (Array.isArray(param) && param.length === 0) {\n return true\n }\n\n if (\n Object.entries(param as any).length === 0 &&\n param.constructor === Object\n ) {\n return true\n }\n\n return false\n}\n\nexport default isEmpty\n","import React, { createContext, FC } from 'react'\nimport config from '~/config'\nimport isEmpty from '~/isEmpty'\n\nconst context = createContext<any>({})\nconst VitusLabsProvider = context.Provider\n\ntype Theme = Partial<\n {\n rootSize: number\n breakpoints: Record<string, number | string>\n } & Record<string, unknown>\n>\n\ntype ProviderType = Partial<\n {\n theme: Theme\n } & Record<string, unknown>\n>\n\nconst Provider: FC<ProviderType> = ({ theme, children, ...props }) => {\n if (!theme || isEmpty(theme)) return <>{children}</>\n\n const StyledContext = config.styledContext\n\n if (StyledContext) {\n return (\n <VitusLabsProvider value={{ theme, ...props }}>\n <StyledContext theme={theme}>{children}</StyledContext>\n </VitusLabsProvider>\n )\n }\n\n return (\n <VitusLabsProvider value={{ theme, ...props }}>\n {children}\n </VitusLabsProvider>\n )\n}\n\nexport { context }\n\nexport default Provider\n","// const compose = <R>(fn1: (a: R) => R, ...fns: Array<(a: R) => R>) =>\n// fns.reduce((a, b) => (value) => a(b(value)), fn1)\n\n// const compose = (funcs) =>\n// funcs.reduce(\n// (a, b) => (...args) => a(b(...args)),\n// (arg) => arg\n// )\n\ntype ArityOneFn = (arg: any) => any\ntype PickLastInTuple<T extends any[]> = T extends [\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n ...rest: infer U,\n argn: infer L\n]\n ? L\n : any\ntype FirstFnParameterType<T extends any[]> = Parameters<PickLastInTuple<T>>[any]\ntype LastFnReturnType<T extends any[]> = ReturnType<T[0]>\n\nconst compose =\n <T extends ArityOneFn[]>(...fns: T) =>\n (p: FirstFnParameterType<T>): LastFnReturnType<T> =>\n fns.reduceRight((acc: any, cur: any) => cur(acc), p)\n\nexport default compose\n","import { isValidElementType, isFragment } from 'react-is'\nimport { createElement, isValidElement, cloneElement, ReactNode } from 'react'\nimport isEmpty from './isEmpty'\n\ntype CreateTypes = Parameters<typeof createElement>[0]\ntype CloneTypes = Parameters<typeof cloneElement>[0]\n\n// export type RenderContent = (\n// content?: CreateTypes | CloneTypes | ReactNode | ReactNode[],\n// attachProps?: Record<string, any>\n// ) => ReturnType<typeof createElement> | ReturnType<typeof cloneElement> | null\n\n// const renderContent: RenderContent = (content, attachProps) => {\n// if (!content) return null as any\n\n// if (typeof content === 'string') {\n// return content\n// }\n\n// if (Array.isArray(content)) {\n// return content\n// }\n\n// if (typeof content === 'function') {\n// return createElement(content, attachProps)\n// }\n\n// if (isValidElement(content)) {\n// if (isEmpty(attachProps)) {\n// return content\n// }\n\n// return cloneElement(Children.only(content), attachProps)\n// }\n\n// if (typeof content === 'object' && !isEmpty(content)) {\n// return createElement(content, attachProps)\n// }\n\n// return content\n// }\n\n// export default renderContent\n\nexport type RenderContent = (\n content?: CreateTypes | CloneTypes | ReactNode | ReactNode[],\n attachProps?: Record<string, any>\n) => ReturnType<typeof createElement> | ReturnType<typeof cloneElement> | null\n\nconst renderContent: RenderContent = (content, attachProps) => {\n if (!content) return null as any\n\n if (typeof content === 'string' && isValidElement(content)) {\n return attachProps\n ? createElement(content, attachProps)\n : createElement(content)\n }\n\n if (['number', 'boolean', 'string'].includes(typeof content)) {\n return content\n }\n\n if (Array.isArray(content) || isFragment(content)) {\n return content\n }\n\n if (isValidElementType(content)) {\n return attachProps\n ? createElement(content, attachProps)\n : createElement(content)\n }\n\n if (isValidElement(content)) {\n if (isEmpty(attachProps)) {\n return content\n }\n\n return cloneElement(content, attachProps)\n }\n\n return content\n}\n\nexport default renderContent\n","const TAGS = [\n 'a',\n 'abbr',\n // 'acronym',\n 'address',\n // 'applet',\n 'area',\n 'article',\n 'aside',\n 'audio',\n 'b',\n 'base',\n // 'basefont',\n 'bdi',\n 'bdo',\n 'big',\n 'blockquote',\n 'body',\n 'br',\n 'button',\n 'canvas',\n 'caption',\n // 'center',\n 'cite',\n 'code',\n 'col',\n 'colgroup',\n 'data',\n 'datalist',\n 'dd',\n 'del',\n 'details',\n 'dfn',\n 'dialog',\n // 'dir',\n 'div',\n 'dl',\n 'dt',\n 'em',\n 'embed',\n 'fieldset',\n 'figcaption',\n 'figure',\n // 'font',\n 'footer',\n 'form',\n // 'frame',\n // 'frameset',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'head',\n 'header',\n 'hr',\n 'html',\n 'i',\n 'iframe',\n 'img',\n 'input',\n 'ins',\n 'kbd',\n 'label',\n 'legend',\n 'li',\n 'link',\n 'main',\n 'map',\n 'mark',\n 'meta',\n 'meter',\n 'nav',\n // 'noframes',\n 'noscript',\n 'object',\n 'ol',\n 'optgroup',\n 'option',\n 'output',\n 'p',\n 'param',\n 'picture',\n 'pre',\n 'progress',\n 'q',\n 'rp',\n 'rt',\n 'ruby',\n 's',\n 'samp',\n 'script',\n 'section',\n 'select',\n 'small',\n 'source',\n 'span',\n // 'strike',\n 'strong',\n 'style',\n 'sub',\n 'summary',\n 'sup',\n 'svg',\n 'table',\n 'tbody',\n 'td',\n 'template',\n 'textarea',\n 'tfoot',\n 'th',\n 'thead',\n 'time',\n 'title',\n 'tr',\n 'track',\n // 'tt',\n 'u',\n 'ul',\n 'var',\n 'video',\n 'wbr',\n] as const\n\nexport type HTMLTags = typeof TAGS[number]\n\nexport default TAGS\n"],"names":["styled","css","ThemeProvider","createContext","React","config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MAAM;MACN,KAAK;MACL,MAAM;MACN,MAAM;MACN,OAAO;MACP,KAAK;;MAEL,UAAU;MACV,QAAQ;MACR,IAAI;MACJ,UAAU;MACV,QAAQ;MACR,QAAQ;MACR,GAAG;MACH,OAAO;MACP,SAAS;MACT,KAAK;MACL,UAAU;MACV,GAAG;MACH,IAAI;MACJ,IAAI;MACJ,MAAM;MACN,GAAG;MACH,MAAM;MACN,QAAQ;MACR,SAAS;MACT,QAAQ;MACR,OAAO;MACP,QAAQ;MACR,MAAM;;MAEN,QAAQ;MACR,OAAO;MACP,KAAK;MACL,SAAS;MACT,KAAK;MACL,KAAK;MACL,OAAO;MACP,OAAO;MACP,IAAI;MACJ,UAAU;MACV,UAAU;MACV,OAAO;MACP,IAAI;MACJ,OAAO;MACP,MAAM;MACN,OAAO;MACP,IAAI;MACJ,OAAO;;MAEP,GAAG;MACH,IAAI;MACJ,KAAK;MACL,OAAO;MACP,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("lodash"),require("moize"),require("styled-components"),require("react")):"function"==typeof define&&define.amd?define(["exports","lodash","moize","styled-components","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).vitusLabsCore={},e.lodash,e.moize,e.styled,e.React)}(this,(function(e,t,n,
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("lodash"),require("moize"),require("styled-components"),require("react"),require("react-is")):"function"==typeof define&&define.amd?define(["exports","lodash","moize","styled-components","react","react-is"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).vitusLabsCore={},e.lodash,e.moize,e.styled,e.React,e.ReactIs)}(this,(function(e,t,r,n,o,i){"use strict";function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=a(r),s=a(n),c=a(o);const d={styled:s.default,css:n.css,styledContext:n.ThemeProvider,component:"div",textComponent:"span"},u=Object.freeze({get css(){return d.css},get styled(){return d.styled},get styledContext(){return d.styledContext},get component(){return d.component},get textComponent(){return d.textComponent}}),m=e=>!e||("object"!=typeof e||(!(!Array.isArray(e)||0!==e.length)||0===Object.entries(e).length&&e.constructor===Object)),p=o.createContext({}),f=p.Provider;Object.defineProperty(e,"get",{enumerable:!0,get:function(){return t.get}}),Object.defineProperty(e,"merge",{enumerable:!0,get:function(){return t.merge}}),Object.defineProperty(e,"omit",{enumerable:!0,get:function(){return t.omit}}),Object.defineProperty(e,"pick",{enumerable:!0,get:function(){return t.pick}}),Object.defineProperty(e,"set",{enumerable:!0,get:function(){return t.set}}),Object.defineProperty(e,"throttle",{enumerable:!0,get:function(){return t.throttle}}),Object.defineProperty(e,"memoize",{enumerable:!0,get:function(){return l.default}}),e.Provider=({theme:e,children:t,...r})=>{if(!e||m(e))return c.default.createElement(c.default.Fragment,null,t);const n=u.styledContext;return n?c.default.createElement(f,{value:{theme:e,...r}},c.default.createElement(n,{theme:e},t)):c.default.createElement(f,{value:{theme:e,...r}},t)},e.compose=(...e)=>t=>e.reduceRight(((e,t)=>t(e)),t),e.config=u,e.context=p,e.htmlTags=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"],e.init=({styled:e,css:t,context:r,component:n="div",textComponent:o="span"})=>{d.css=t,d.styled=e,d.styledContext=r,d.component=n,d.textComponent=o},e.isEmpty=m,e.renderContent=(e,t)=>e?"string"==typeof e&&o.isValidElement(e)?t?o.createElement(e,t):o.createElement(e):["number","boolean","string"].includes(typeof e)||Array.isArray(e)||i.isFragment(e)?e:i.isValidElementType(e)?t?o.createElement(e,t):o.createElement(e):o.isValidElement(e)?m(t)?e:o.cloneElement(e,t):e:null,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
2
2
|
//# sourceMappingURL=vitus-labs-core.umd.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vitus-labs-core.umd.min.js","sources":["../src/config.ts","../src/isEmpty.ts","../src/context.tsx","../src/compose.ts","../src/htmlTags.ts","../src/renderContent.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable no-underscore-dangle */\nimport { ComponentType } from 'react'\nimport styled, {\n css,\n ThemeProvider,\n ThemedCssFunction,\n StyledInterface,\n DefaultTheme,\n ThemeProviderComponent,\n} from 'styled-components'\nimport type { HTMLTags } from '~/htmlTags'\n\nconst OPTIONS: Internal = {\n styled,\n css,\n styledContext: ThemeProvider,\n component: 'div',\n textComponent: 'span',\n} as Internal\n\ntype Init = ({\n styled,\n css,\n context,\n component,\n textComponent,\n}: {\n styled: any\n css: any\n context: any\n component?: ComponentType | HTMLTags\n textComponent?: ComponentType | HTMLTags\n}) => void\n\nconst init: Init = ({\n styled,\n css,\n context,\n component = 'div',\n textComponent = 'span',\n}) => {\n OPTIONS.css = css\n OPTIONS.styled = styled\n OPTIONS.styledContext = context\n OPTIONS.component = component\n OPTIONS.textComponent = textComponent\n}\n\ninterface Internal {\n css: ThemedCssFunction<DefaultTheme>\n styled: StyledInterface\n styledContext: ThemeProviderComponent<any, any>\n component: any\n textComponent: any\n}\n\nconst internal: Internal = Object.freeze({\n get css() {\n return OPTIONS.css\n },\n get styled() {\n return OPTIONS.styled\n },\n get styledContext() {\n return OPTIONS.styledContext\n },\n get component() {\n return OPTIONS.component\n },\n get textComponent() {\n return OPTIONS.textComponent\n },\n})\n\nexport { init }\nexport default internal\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nexport type IsEmpty = <T extends Record<string, unknown> | unknown[] | null>(\n param?: T\n) => null | undefined extends T ? true : keyof T extends never ? true : false\n\nconst isEmpty: IsEmpty = (param) => {\n if (!param) return true\n\n if (typeof param !== 'object') {\n return true as any\n }\n\n if (Array.isArray(param) && param.length === 0) {\n return true\n }\n\n if (\n Object.entries(param as any).length === 0 &&\n param.constructor === Object\n ) {\n return true\n }\n\n return false\n}\n\nexport default isEmpty\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React, { createContext, FC } from 'react'\nimport config from '~/config'\nimport isEmpty from '~/isEmpty'\n\nconst context = createContext<any>({})\nconst VitusLabsProvider = context.Provider\n\ntype Theme = Partial<\n {\n rootSize: number\n breakpoints: Record<string, number | string>\n } & Record<string, unknown>\n>\n\ntype ProviderType = Partial<\n {\n theme: Theme\n } & Record<string, unknown>\n>\n\nconst Provider: FC<ProviderType> = ({ theme, children, ...props }) => {\n if (!theme || isEmpty(theme)) return <>{children}</>\n\n const StyledContext = config.styledContext\n\n if (StyledContext) {\n return (\n <VitusLabsProvider value={{ theme, ...props }}>\n <StyledContext theme={theme}>{children}</StyledContext>\n </VitusLabsProvider>\n )\n }\n\n return (\n <VitusLabsProvider value={{ theme, ...props }}>\n {children}\n </VitusLabsProvider>\n )\n}\n\nexport { context }\n\nexport default Provider\n","/* eslint-disable @typescript-eslint/no-explicit-any */\n// const compose = <R>(fn1: (a: R) => R, ...fns: Array<(a: R) => R>) =>\n// fns.reduce((a, b) => (value) => a(b(value)), fn1)\n\n// const compose = (funcs) =>\n// funcs.reduce(\n// (a, b) => (...args) => a(b(...args)),\n// (arg) => arg\n// )\n\ntype ArityOneFn = (arg: any) => any\ntype PickLastInTuple<T extends any[]> = T extends [\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n ...rest: infer U,\n argn: infer L\n]\n ? L\n : any\ntype FirstFnParameterType<T extends any[]> = Parameters<PickLastInTuple<T>>[any]\ntype LastFnReturnType<T extends any[]> = ReturnType<T[0]>\n\nconst compose =\n <T extends ArityOneFn[]>(...fns: T) =>\n (p: FirstFnParameterType<T>): LastFnReturnType<T> =>\n fns.reduceRight((acc: any, cur: any) => cur(acc), p)\n\nexport default compose\n","const TAGS = [\n 'a',\n 'abbr',\n // 'acronym',\n 'address',\n // 'applet',\n 'area',\n 'article',\n 'aside',\n 'audio',\n 'b',\n 'base',\n // 'basefont',\n 'bdi',\n 'bdo',\n 'big',\n 'blockquote',\n 'body',\n 'br',\n 'button',\n 'canvas',\n 'caption',\n // 'center',\n 'cite',\n 'code',\n 'col',\n 'colgroup',\n 'data',\n 'datalist',\n 'dd',\n 'del',\n 'details',\n 'dfn',\n 'dialog',\n // 'dir',\n 'div',\n 'dl',\n 'dt',\n 'em',\n 'embed',\n 'fieldset',\n 'figcaption',\n 'figure',\n // 'font',\n 'footer',\n 'form',\n // 'frame',\n // 'frameset',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'head',\n 'header',\n 'hr',\n 'html',\n 'i',\n 'iframe',\n 'img',\n 'input',\n 'ins',\n 'kbd',\n 'label',\n 'legend',\n 'li',\n 'link',\n 'main',\n 'map',\n 'mark',\n 'meta',\n 'meter',\n 'nav',\n // 'noframes',\n 'noscript',\n 'object',\n 'ol',\n 'optgroup',\n 'option',\n 'output',\n 'p',\n 'param',\n 'picture',\n 'pre',\n 'progress',\n 'q',\n 'rp',\n 'rt',\n 'ruby',\n 's',\n 'samp',\n 'script',\n 'section',\n 'select',\n 'small',\n 'source',\n 'span',\n // 'strike',\n 'strong',\n 'style',\n 'sub',\n 'summary',\n 'sup',\n 'svg',\n 'table',\n 'tbody',\n 'td',\n 'template',\n 'textarea',\n 'tfoot',\n 'th',\n 'thead',\n 'time',\n 'title',\n 'tr',\n 'track',\n // 'tt',\n 'u',\n 'ul',\n 'var',\n 'video',\n 'wbr',\n] as const\n\nexport type HTMLTags = typeof TAGS[number]\n\nexport default TAGS\n","/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/ban-ts-comment */\nimport {\n createElement,\n isValidElement,\n cloneElement,\n Children,\n ReactNode,\n ComponentType,\n} from 'react'\nimport isEmpty from './isEmpty'\n\nexport type RenderContent = (\n content?: ReactNode | ComponentType,\n attachProps?: Record<string, any>\n) => ReactNode\n\nconst renderContent: RenderContent = (content, attachProps = {}) => {\n if (!content) return null\n\n if (Array.isArray(content)) {\n return content\n }\n\n if (typeof content === 'function') {\n // @ts-ignore\n return createElement(content, attachProps)\n }\n\n if (isValidElement(content)) {\n if (isEmpty(attachProps)) {\n return content\n }\n\n return cloneElement(Children.only(content), attachProps)\n }\n\n // @ts-ignore\n if (typeof content === 'object' && !isEmpty(content)) {\n // FIXME: quick fix for rendering invalid elements\n // no idea of what is going on here yet\n // @ts-ignore\n return createElement(content, attachProps)\n }\n\n return content\n}\n\nexport default renderContent\n"],"names":["OPTIONS","styled","css","styledContext","ThemeProvider","component","textComponent","internal","Object","freeze","isEmpty","param","Array","isArray","length","entries","constructor","context","createContext","VitusLabsProvider","Provider","theme","children","props","React","StyledContext","config","value","fns","p","reduceRight","acc","cur","content","attachProps","createElement","isValidElement","cloneElement","Children","only"],"mappings":"8fAaA,MAAMA,EAAoB,QACxBC,cACAC,MACAC,cAAeC,gBACfC,UAAW,MACXC,cAAe,QAuCXC,EAAqBC,OAAOC,OAAO,CACvCP,UACE,OAAOF,EAAQE,KAEjBD,aACE,OAAOD,EAAQC,QAEjBE,oBACE,OAAOH,EAAQG,eAEjBE,gBACE,OAAOL,EAAQK,WAEjBC,oBACE,OAAON,EAAQM,iBClEbI,EAAoBC,IACnBA,IAEgB,iBAAVA,OAIPC,MAAMC,QAAQF,IAA2B,IAAjBA,EAAMG,SAKQ,IAAxCN,OAAOO,QAAQJ,GAAcG,QAC7BH,EAAMK,cAAgBR,SCbpBS,EAAUC,gBAAmB,IAC7BC,EAAoBF,EAAQG,kkBAeC,EAAGC,MAAAA,EAAOC,SAAAA,KAAaC,MACxD,IAAKF,GAASX,EAAQW,GAAQ,OAAOG,gDAAGF,GAExC,MAAMG,EAAgBC,EAAOvB,cAE7B,OAAIsB,EAEAD,wBAACL,GAAkBQ,MAAO,CAAEN,MAAAA,KAAUE,IACpCC,wBAACC,GAAcJ,MAAOA,GAAQC,IAMlCE,wBAACL,GAAkBQ,MAAO,CAAEN,MAAAA,KAAUE,IACnCD,cCdL,IAA4BM,IAC3BC,GACCD,EAAIE,aAAY,CAACC,EAAUC,IAAaA,EAAID,IAAMF,qCCxBzC,CACX,IACA,OAEA,UAEA,OACA,UACA,QACA,QACA,IACA,OAEA,MACA,MACA,MACA,aACA,OACA,KACA,SACA,SACA,UAEA,OACA,OACA,MACA,WACA,OACA,WACA,KACA,MACA,UACA,MACA,SAEA,MACA,KACA,KACA,KACA,QACA,WACA,aACA,SAEA,SACA,OAGA,KACA,KACA,KACA,KACA,KACA,KACA,OACA,SACA,KACA,OACA,IACA,SACA,MACA,QACA,MACA,MACA,QACA,SACA,KACA,OACA,OACA,MACA,OACA,OACA,QACA,MAEA,WACA,SACA,KACA,WACA,SACA,SACA,IACA,QACA,UACA,MACA,WACA,IACA,KACA,KACA,OACA,IACA,OACA,SACA,UACA,SACA,QACA,SACA,OAEA,SACA,QACA,MACA,UACA,MACA,MACA,QACA,QACA,KACA,WACA,WACA,QACA,KACA,QACA,OACA,QACA,KACA,QAEA,IACA,KACA,MACA,QACA,cJvFiB,EACjB5B,OAAAA,EACAC,IAAAA,EACAe,QAAAA,EACAZ,UAAAA,EAAY,MACZC,cAAAA,EAAgB,WAEhBN,EAAQE,IAAMA,EACdF,EAAQC,OAASA,EACjBD,EAAQG,cAAgBc,EACxBjB,EAAQK,UAAYA,EACpBL,EAAQM,cAAgBA,+BK7BW,CAAC2B,EAASC,EAAc,KACtDD,EAEDrB,MAAMC,QAAQoB,GACTA,EAGc,mBAAZA,EAEFE,gBAAcF,EAASC,GAG5BE,iBAAeH,GACbvB,EAAQwB,GACHD,EAGFI,eAAaC,WAASC,KAAKN,GAAUC,GAIvB,iBAAZD,GAAyBvB,EAAQuB,GAOrCA,EAHEE,gBAAcF,EAASC,GAxBX"}
|
|
1
|
+
{"version":3,"file":"vitus-labs-core.umd.min.js","sources":["../src/config.ts","../src/isEmpty.ts","../src/context.tsx","../src/compose.ts","../src/htmlTags.ts","../src/renderContent.ts"],"sourcesContent":["/* eslint-disable no-underscore-dangle */\nimport { ComponentType } from 'react'\nimport styled, {\n css,\n ThemeProvider,\n ThemedCssFunction,\n StyledInterface,\n DefaultTheme,\n ThemeProviderComponent,\n} from 'styled-components'\nimport type { HTMLTags } from '~/htmlTags'\n\nconst OPTIONS: Internal = {\n styled,\n css,\n styledContext: ThemeProvider,\n component: 'div',\n textComponent: 'span',\n} as Internal\n\ntype Init = ({\n styled,\n css,\n context,\n component,\n textComponent,\n}: {\n styled: any\n css: any\n context: any\n component?: ComponentType | HTMLTags\n textComponent?: ComponentType | HTMLTags\n}) => void\n\nconst init: Init = ({\n styled,\n css,\n context,\n component = 'div',\n textComponent = 'span',\n}) => {\n OPTIONS.css = css\n OPTIONS.styled = styled\n OPTIONS.styledContext = context\n OPTIONS.component = component\n OPTIONS.textComponent = textComponent\n}\n\ninterface Internal {\n css: ThemedCssFunction<DefaultTheme>\n styled: StyledInterface\n styledContext: ThemeProviderComponent<any, any>\n component: any\n textComponent: any\n}\n\nconst internal: Internal = Object.freeze({\n get css() {\n return OPTIONS.css\n },\n get styled() {\n return OPTIONS.styled\n },\n get styledContext() {\n return OPTIONS.styledContext\n },\n get component() {\n return OPTIONS.component\n },\n get textComponent() {\n return OPTIONS.textComponent\n },\n})\n\nexport { init }\nexport default internal\n","export type IsEmpty = <T extends Record<string, unknown> | unknown[] | null>(\n param?: T\n) => null | undefined extends T ? true : keyof T extends never ? true : false\n\nconst isEmpty: IsEmpty = (param) => {\n if (!param) return true\n\n if (typeof param !== 'object') {\n return true as any\n }\n\n if (Array.isArray(param) && param.length === 0) {\n return true\n }\n\n if (\n Object.entries(param as any).length === 0 &&\n param.constructor === Object\n ) {\n return true\n }\n\n return false\n}\n\nexport default isEmpty\n","import React, { createContext, FC } from 'react'\nimport config from '~/config'\nimport isEmpty from '~/isEmpty'\n\nconst context = createContext<any>({})\nconst VitusLabsProvider = context.Provider\n\ntype Theme = Partial<\n {\n rootSize: number\n breakpoints: Record<string, number | string>\n } & Record<string, unknown>\n>\n\ntype ProviderType = Partial<\n {\n theme: Theme\n } & Record<string, unknown>\n>\n\nconst Provider: FC<ProviderType> = ({ theme, children, ...props }) => {\n if (!theme || isEmpty(theme)) return <>{children}</>\n\n const StyledContext = config.styledContext\n\n if (StyledContext) {\n return (\n <VitusLabsProvider value={{ theme, ...props }}>\n <StyledContext theme={theme}>{children}</StyledContext>\n </VitusLabsProvider>\n )\n }\n\n return (\n <VitusLabsProvider value={{ theme, ...props }}>\n {children}\n </VitusLabsProvider>\n )\n}\n\nexport { context }\n\nexport default Provider\n","// const compose = <R>(fn1: (a: R) => R, ...fns: Array<(a: R) => R>) =>\n// fns.reduce((a, b) => (value) => a(b(value)), fn1)\n\n// const compose = (funcs) =>\n// funcs.reduce(\n// (a, b) => (...args) => a(b(...args)),\n// (arg) => arg\n// )\n\ntype ArityOneFn = (arg: any) => any\ntype PickLastInTuple<T extends any[]> = T extends [\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n ...rest: infer U,\n argn: infer L\n]\n ? L\n : any\ntype FirstFnParameterType<T extends any[]> = Parameters<PickLastInTuple<T>>[any]\ntype LastFnReturnType<T extends any[]> = ReturnType<T[0]>\n\nconst compose =\n <T extends ArityOneFn[]>(...fns: T) =>\n (p: FirstFnParameterType<T>): LastFnReturnType<T> =>\n fns.reduceRight((acc: any, cur: any) => cur(acc), p)\n\nexport default compose\n","const TAGS = [\n 'a',\n 'abbr',\n // 'acronym',\n 'address',\n // 'applet',\n 'area',\n 'article',\n 'aside',\n 'audio',\n 'b',\n 'base',\n // 'basefont',\n 'bdi',\n 'bdo',\n 'big',\n 'blockquote',\n 'body',\n 'br',\n 'button',\n 'canvas',\n 'caption',\n // 'center',\n 'cite',\n 'code',\n 'col',\n 'colgroup',\n 'data',\n 'datalist',\n 'dd',\n 'del',\n 'details',\n 'dfn',\n 'dialog',\n // 'dir',\n 'div',\n 'dl',\n 'dt',\n 'em',\n 'embed',\n 'fieldset',\n 'figcaption',\n 'figure',\n // 'font',\n 'footer',\n 'form',\n // 'frame',\n // 'frameset',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'head',\n 'header',\n 'hr',\n 'html',\n 'i',\n 'iframe',\n 'img',\n 'input',\n 'ins',\n 'kbd',\n 'label',\n 'legend',\n 'li',\n 'link',\n 'main',\n 'map',\n 'mark',\n 'meta',\n 'meter',\n 'nav',\n // 'noframes',\n 'noscript',\n 'object',\n 'ol',\n 'optgroup',\n 'option',\n 'output',\n 'p',\n 'param',\n 'picture',\n 'pre',\n 'progress',\n 'q',\n 'rp',\n 'rt',\n 'ruby',\n 's',\n 'samp',\n 'script',\n 'section',\n 'select',\n 'small',\n 'source',\n 'span',\n // 'strike',\n 'strong',\n 'style',\n 'sub',\n 'summary',\n 'sup',\n 'svg',\n 'table',\n 'tbody',\n 'td',\n 'template',\n 'textarea',\n 'tfoot',\n 'th',\n 'thead',\n 'time',\n 'title',\n 'tr',\n 'track',\n // 'tt',\n 'u',\n 'ul',\n 'var',\n 'video',\n 'wbr',\n] as const\n\nexport type HTMLTags = typeof TAGS[number]\n\nexport default TAGS\n","import { isValidElementType, isFragment } from 'react-is'\nimport { createElement, isValidElement, cloneElement, ReactNode } from 'react'\nimport isEmpty from './isEmpty'\n\ntype CreateTypes = Parameters<typeof createElement>[0]\ntype CloneTypes = Parameters<typeof cloneElement>[0]\n\n// export type RenderContent = (\n// content?: CreateTypes | CloneTypes | ReactNode | ReactNode[],\n// attachProps?: Record<string, any>\n// ) => ReturnType<typeof createElement> | ReturnType<typeof cloneElement> | null\n\n// const renderContent: RenderContent = (content, attachProps) => {\n// if (!content) return null as any\n\n// if (typeof content === 'string') {\n// return content\n// }\n\n// if (Array.isArray(content)) {\n// return content\n// }\n\n// if (typeof content === 'function') {\n// return createElement(content, attachProps)\n// }\n\n// if (isValidElement(content)) {\n// if (isEmpty(attachProps)) {\n// return content\n// }\n\n// return cloneElement(Children.only(content), attachProps)\n// }\n\n// if (typeof content === 'object' && !isEmpty(content)) {\n// return createElement(content, attachProps)\n// }\n\n// return content\n// }\n\n// export default renderContent\n\nexport type RenderContent = (\n content?: CreateTypes | CloneTypes | ReactNode | ReactNode[],\n attachProps?: Record<string, any>\n) => ReturnType<typeof createElement> | ReturnType<typeof cloneElement> | null\n\nconst renderContent: RenderContent = (content, attachProps) => {\n if (!content) return null as any\n\n if (typeof content === 'string' && isValidElement(content)) {\n return attachProps\n ? createElement(content, attachProps)\n : createElement(content)\n }\n\n if (['number', 'boolean', 'string'].includes(typeof content)) {\n return content\n }\n\n if (Array.isArray(content) || isFragment(content)) {\n return content\n }\n\n if (isValidElementType(content)) {\n return attachProps\n ? createElement(content, attachProps)\n : createElement(content)\n }\n\n if (isValidElement(content)) {\n if (isEmpty(attachProps)) {\n return content\n }\n\n return cloneElement(content, attachProps)\n }\n\n return content\n}\n\nexport default renderContent\n"],"names":["OPTIONS","styled","css","styledContext","ThemeProvider","component","textComponent","internal","Object","freeze","isEmpty","param","Array","isArray","length","entries","constructor","context","createContext","VitusLabsProvider","Provider","theme","children","props","React","StyledContext","config","value","fns","p","reduceRight","acc","cur","content","attachProps","isValidElement","createElement","includes","isFragment","isValidElementType","cloneElement"],"mappings":"yiBAYA,MAAMA,EAAoB,QACxBC,cACAC,MACAC,cAAeC,gBACfC,UAAW,MACXC,cAAe,QAuCXC,EAAqBC,OAAOC,OAAO,CACvCP,UACE,OAAOF,EAAQE,KAEjBD,aACE,OAAOD,EAAQC,QAEjBE,oBACE,OAAOH,EAAQG,eAEjBE,gBACE,OAAOL,EAAQK,WAEjBC,oBACE,OAAON,EAAQM,iBClEbI,EAAoBC,IACnBA,IAEgB,iBAAVA,OAIPC,MAAMC,QAAQF,IAA2B,IAAjBA,EAAMG,SAKQ,IAAxCN,OAAOO,QAAQJ,GAAcG,QAC7BH,EAAMK,cAAgBR,SCbpBS,EAAUC,gBAAmB,IAC7BC,EAAoBF,EAAQG,kkBAeC,EAAGC,MAAAA,EAAOC,SAAAA,KAAaC,MACxD,IAAKF,GAASX,EAAQW,GAAQ,OAAOG,gDAAGF,GAExC,MAAMG,EAAgBC,EAAOvB,cAE7B,OAAIsB,EAEAD,wBAACL,GAAkBQ,MAAO,CAAEN,MAAAA,KAAUE,IACpCC,wBAACC,GAAcJ,MAAOA,GAAQC,IAMlCE,wBAACL,GAAkBQ,MAAO,CAAEN,MAAAA,KAAUE,IACnCD,cCdL,IAA4BM,IAC3BC,GACCD,EAAIE,aAAY,CAACC,EAAUC,IAAaA,EAAID,IAAMF,qCCvBzC,CACX,IACA,OAEA,UAEA,OACA,UACA,QACA,QACA,IACA,OAEA,MACA,MACA,MACA,aACA,OACA,KACA,SACA,SACA,UAEA,OACA,OACA,MACA,WACA,OACA,WACA,KACA,MACA,UACA,MACA,SAEA,MACA,KACA,KACA,KACA,QACA,WACA,aACA,SAEA,SACA,OAGA,KACA,KACA,KACA,KACA,KACA,KACA,OACA,SACA,KACA,OACA,IACA,SACA,MACA,QACA,MACA,MACA,QACA,SACA,KACA,OACA,OACA,MACA,OACA,OACA,QACA,MAEA,WACA,SACA,KACA,WACA,SACA,SACA,IACA,QACA,UACA,MACA,WACA,IACA,KACA,KACA,OACA,IACA,OACA,SACA,UACA,SACA,QACA,SACA,OAEA,SACA,QACA,MACA,UACA,MACA,MACA,QACA,QACA,KACA,WACA,WACA,QACA,KACA,QACA,OACA,QACA,KACA,QAEA,IACA,KACA,MACA,QACA,cJxFiB,EACjB5B,OAAAA,EACAC,IAAAA,EACAe,QAAAA,EACAZ,UAAAA,EAAY,MACZC,cAAAA,EAAgB,WAEhBN,EAAQE,IAAMA,EACdF,EAAQC,OAASA,EACjBD,EAAQG,cAAgBc,EACxBjB,EAAQK,UAAYA,EACpBL,EAAQM,cAAgBA,+BKIW,CAAC2B,EAASC,IACxCD,EAEkB,iBAAZA,GAAwBE,iBAAeF,GACzCC,EACHE,gBAAcH,EAASC,GACvBE,gBAAcH,GAGhB,CAAC,SAAU,UAAW,UAAUI,gBAAgBJ,IAIhDrB,MAAMC,QAAQoB,IAAYK,aAAWL,GAHhCA,EAOLM,qBAAmBN,GACdC,EACHE,gBAAcH,EAASC,GACvBE,gBAAcH,GAGhBE,iBAAeF,GACbvB,EAAQwB,GACHD,EAGFO,eAAaP,EAASC,GAGxBD,EA9Bc"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitus-labs/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Vit Bokisch <vit@bokisch.cz>",
|
|
6
6
|
"maintainers": [
|
|
@@ -55,16 +55,17 @@
|
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"lodash": "^4.17.15",
|
|
58
|
-
"moize": "^6.1.0"
|
|
58
|
+
"moize": "^6.1.0",
|
|
59
|
+
"react-is": "^17.0.2"
|
|
59
60
|
},
|
|
60
61
|
"devDependencies": {
|
|
61
|
-
"@emotion/react": "^11.
|
|
62
|
-
"@emotion/styled": "^11.
|
|
63
|
-
"@types/lodash": "^4.14.
|
|
64
|
-
"@vitus-labs/tools-babel": "^0.
|
|
65
|
-
"@vitus-labs/tools-rollup": "^0.
|
|
66
|
-
"@vitus-labs/tools-typescript": "^0.
|
|
62
|
+
"@emotion/react": "^11.7.0",
|
|
63
|
+
"@emotion/styled": "^11.6.0",
|
|
64
|
+
"@types/lodash": "^4.14.177",
|
|
65
|
+
"@vitus-labs/tools-babel": "^0.19.0",
|
|
66
|
+
"@vitus-labs/tools-rollup": "^0.19.0",
|
|
67
|
+
"@vitus-labs/tools-typescript": "^0.19.0",
|
|
67
68
|
"styled-components": "^5.3.3"
|
|
68
69
|
},
|
|
69
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "42b51752cc1e0874853c184eacca3bf342bdbb27"
|
|
70
71
|
}
|