@vitus-labs/core 0.31.0 → 0.35.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 +102 -69
- package/lib/types/config.d.ts +1 -1
- package/lib/types/{types → html}/htmlElementAttrs.d.ts +56 -24
- package/lib/types/{htmlTags.d.ts → html/htmlTags.d.ts} +1 -1
- package/lib/types/html/index.d.ts +5 -0
- package/lib/types/index.d.ts +2 -3
- package/lib/vitus-labs-core.js +1 -1
- package/lib/vitus-labs-core.js.map +1 -1
- package/lib/vitus-labs-core.module.js +1 -1
- package/lib/vitus-labs-core.module.js.map +1 -1
- package/lib/vitus-labs-core.umd.js +1 -1
- 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 +2 -2
|
@@ -6424,7 +6424,7 @@ var drawChart = (function (exports) {
|
|
|
6424
6424
|
</script>
|
|
6425
6425
|
<script>
|
|
6426
6426
|
/*<!--*/
|
|
6427
|
-
const data = {"version":2,"tree":{"name":"root","children":[{"name":"vitus-labs-core.js","children":[{"name":"src","children":[{"uid":"
|
|
6427
|
+
const data = {"version":2,"tree":{"name":"root","children":[{"name":"vitus-labs-core.js","children":[{"name":"src","children":[{"uid":"5ba4-1","name":"config.ts"},{"uid":"5ba4-3","name":"isEmpty.ts"},{"uid":"5ba4-5","name":"context.tsx"},{"uid":"5ba4-7","name":"compose.ts"},{"uid":"5ba4-9","name":"renderContent.ts"},{"name":"html/htmlTags.ts","uid":"5ba4-11"},{"uid":"5ba4-13","name":"index.ts"}]}]}],"isRoot":true},"nodeParts":{"5ba4-1":{"renderedLength":810,"gzipLength":294,"brotliLength":0,"mainUid":"5ba4-0"},"5ba4-3":{"renderedLength":358,"gzipLength":180,"brotliLength":0,"mainUid":"5ba4-2"},"5ba4-5":{"renderedLength":783,"gzipLength":332,"brotliLength":0,"mainUid":"5ba4-4"},"5ba4-7":{"renderedLength":207,"gzipLength":153,"brotliLength":0,"mainUid":"5ba4-6"},"5ba4-9":{"renderedLength":893,"gzipLength":284,"brotliLength":0,"mainUid":"5ba4-8"},"5ba4-11":{"renderedLength":1715,"gzipLength":502,"brotliLength":0,"mainUid":"5ba4-10"},"5ba4-13":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"mainUid":"5ba4-12"}},"nodeMetas":{"5ba4-0":{"id":"/src/config.ts","moduleParts":{"vitus-labs-core.js":"5ba4-1"},"imported":[{"uid":"5ba4-17"}],"importedBy":[{"uid":"5ba4-12"},{"uid":"5ba4-4"}]},"5ba4-2":{"id":"/src/isEmpty.ts","moduleParts":{"vitus-labs-core.js":"5ba4-3"},"imported":[],"importedBy":[{"uid":"5ba4-12"},{"uid":"5ba4-4"},{"uid":"5ba4-8"}]},"5ba4-4":{"id":"/src/context.tsx","moduleParts":{"vitus-labs-core.js":"5ba4-5"},"imported":[{"uid":"5ba4-18"},{"uid":"5ba4-0"},{"uid":"5ba4-2"}],"importedBy":[{"uid":"5ba4-12"}]},"5ba4-6":{"id":"/src/compose.ts","moduleParts":{"vitus-labs-core.js":"5ba4-7"},"imported":[],"importedBy":[{"uid":"5ba4-12"}]},"5ba4-8":{"id":"/src/renderContent.ts","moduleParts":{"vitus-labs-core.js":"5ba4-9"},"imported":[{"uid":"5ba4-19"},{"uid":"5ba4-18"},{"uid":"5ba4-2"}],"importedBy":[{"uid":"5ba4-12"}]},"5ba4-10":{"id":"/src/html/htmlTags.ts","moduleParts":{"vitus-labs-core.js":"5ba4-11"},"imported":[],"importedBy":[{"uid":"5ba4-16"}]},"5ba4-12":{"id":"/src/index.ts","moduleParts":{"vitus-labs-core.js":"5ba4-13"},"imported":[{"uid":"5ba4-14"},{"uid":"5ba4-15"},{"uid":"5ba4-0"},{"uid":"5ba4-4"},{"uid":"5ba4-6"},{"uid":"5ba4-2"},{"uid":"5ba4-8"},{"uid":"5ba4-16"}],"importedBy":[],"isEntry":true},"5ba4-14":{"id":"lodash","moduleParts":{},"imported":[],"importedBy":[{"uid":"5ba4-12"}],"isExternal":true},"5ba4-15":{"id":"moize","moduleParts":{},"imported":[],"importedBy":[{"uid":"5ba4-12"}],"isExternal":true},"5ba4-16":{"id":"/src/html/index.ts","moduleParts":{},"imported":[{"uid":"5ba4-10"}],"importedBy":[{"uid":"5ba4-12"}]},"5ba4-17":{"id":"styled-components","moduleParts":{},"imported":[],"importedBy":[{"uid":"5ba4-0"}],"isExternal":true},"5ba4-18":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"5ba4-4"},{"uid":"5ba4-8"}],"isExternal":true},"5ba4-19":{"id":"react-is","moduleParts":{},"imported":[],"importedBy":[{"uid":"5ba4-8"}],"isExternal":true}},"env":{"rollup":"2.67.1"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
|
|
6428
6428
|
|
|
6429
6429
|
const run = () => {
|
|
6430
6430
|
const width = window.innerWidth;
|
|
@@ -6424,7 +6424,7 @@ var drawChart = (function (exports) {
|
|
|
6424
6424
|
</script>
|
|
6425
6425
|
<script>
|
|
6426
6426
|
/*<!--*/
|
|
6427
|
-
const data = {"version":2,"tree":{"name":"root","children":[{"name":"vitus-labs-core.module.js","children":[{"name":"src","children":[{"uid":"
|
|
6427
|
+
const data = {"version":2,"tree":{"name":"root","children":[{"name":"vitus-labs-core.module.js","children":[{"name":"src","children":[{"uid":"5ba4-21","name":"config.ts"},{"uid":"5ba4-23","name":"isEmpty.ts"},{"uid":"5ba4-25","name":"context.tsx"},{"uid":"5ba4-27","name":"compose.ts"},{"uid":"5ba4-29","name":"renderContent.ts"},{"name":"html/htmlTags.ts","uid":"5ba4-31"},{"uid":"5ba4-33","name":"index.ts"}]}]}],"isRoot":true},"nodeParts":{"5ba4-21":{"renderedLength":763,"gzipLength":273,"brotliLength":0,"mainUid":"5ba4-20"},"5ba4-23":{"renderedLength":358,"gzipLength":180,"brotliLength":0,"mainUid":"5ba4-22"},"5ba4-25":{"renderedLength":671,"gzipLength":314,"brotliLength":0,"mainUid":"5ba4-24"},"5ba4-27":{"renderedLength":207,"gzipLength":153,"brotliLength":0,"mainUid":"5ba4-26"},"5ba4-29":{"renderedLength":835,"gzipLength":269,"brotliLength":0,"mainUid":"5ba4-28"},"5ba4-31":{"renderedLength":1715,"gzipLength":502,"brotliLength":0,"mainUid":"5ba4-30"},"5ba4-33":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"mainUid":"5ba4-32"}},"nodeMetas":{"5ba4-20":{"id":"/src/config.ts","moduleParts":{"vitus-labs-core.module.js":"5ba4-21"},"imported":[{"uid":"5ba4-37"}],"importedBy":[{"uid":"5ba4-32"},{"uid":"5ba4-24"}]},"5ba4-22":{"id":"/src/isEmpty.ts","moduleParts":{"vitus-labs-core.module.js":"5ba4-23"},"imported":[],"importedBy":[{"uid":"5ba4-32"},{"uid":"5ba4-24"},{"uid":"5ba4-28"}]},"5ba4-24":{"id":"/src/context.tsx","moduleParts":{"vitus-labs-core.module.js":"5ba4-25"},"imported":[{"uid":"5ba4-38"},{"uid":"5ba4-20"},{"uid":"5ba4-22"}],"importedBy":[{"uid":"5ba4-32"}]},"5ba4-26":{"id":"/src/compose.ts","moduleParts":{"vitus-labs-core.module.js":"5ba4-27"},"imported":[],"importedBy":[{"uid":"5ba4-32"}]},"5ba4-28":{"id":"/src/renderContent.ts","moduleParts":{"vitus-labs-core.module.js":"5ba4-29"},"imported":[{"uid":"5ba4-39"},{"uid":"5ba4-38"},{"uid":"5ba4-22"}],"importedBy":[{"uid":"5ba4-32"}]},"5ba4-30":{"id":"/src/html/htmlTags.ts","moduleParts":{"vitus-labs-core.module.js":"5ba4-31"},"imported":[],"importedBy":[{"uid":"5ba4-36"}]},"5ba4-32":{"id":"/src/index.ts","moduleParts":{"vitus-labs-core.module.js":"5ba4-33"},"imported":[{"uid":"5ba4-34"},{"uid":"5ba4-35"},{"uid":"5ba4-20"},{"uid":"5ba4-24"},{"uid":"5ba4-26"},{"uid":"5ba4-22"},{"uid":"5ba4-28"},{"uid":"5ba4-36"}],"importedBy":[],"isEntry":true},"5ba4-34":{"id":"lodash","moduleParts":{},"imported":[],"importedBy":[{"uid":"5ba4-32"}],"isExternal":true},"5ba4-35":{"id":"moize","moduleParts":{},"imported":[],"importedBy":[{"uid":"5ba4-32"}],"isExternal":true},"5ba4-36":{"id":"/src/html/index.ts","moduleParts":{},"imported":[{"uid":"5ba4-30"}],"importedBy":[{"uid":"5ba4-32"}]},"5ba4-37":{"id":"styled-components","moduleParts":{},"imported":[],"importedBy":[{"uid":"5ba4-20"}],"isExternal":true},"5ba4-38":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"5ba4-24"},{"uid":"5ba4-28"}],"isExternal":true},"5ba4-39":{"id":"react-is","moduleParts":{},"imported":[],"importedBy":[{"uid":"5ba4-28"}],"isExternal":true}},"env":{"rollup":"2.67.1"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
|
|
6428
6428
|
|
|
6429
6429
|
const run = () => {
|
|
6430
6430
|
const width = window.innerWidth;
|
|
@@ -6424,7 +6424,7 @@ var drawChart = (function (exports) {
|
|
|
6424
6424
|
</script>
|
|
6425
6425
|
<script>
|
|
6426
6426
|
/*<!--*/
|
|
6427
|
-
const data = {"version":2,"tree":{"name":"root","children":[{"name":"vitus-labs-core.umd.js","children":[{"name":"src","children":[{"uid":"
|
|
6427
|
+
const data = {"version":2,"tree":{"name":"root","children":[{"name":"vitus-labs-core.umd.js","children":[{"name":"src","children":[{"uid":"5ba4-41","name":"config.ts"},{"uid":"5ba4-43","name":"isEmpty.ts"},{"uid":"5ba4-45","name":"context.tsx"},{"uid":"5ba4-47","name":"compose.ts"},{"uid":"5ba4-49","name":"renderContent.ts"},{"name":"html/htmlTags.ts","uid":"5ba4-51"},{"uid":"5ba4-53","name":"index.ts"}]}]}],"isRoot":true},"nodeParts":{"5ba4-41":{"renderedLength":872,"gzipLength":297,"brotliLength":0,"mainUid":"5ba4-40"},"5ba4-43":{"renderedLength":388,"gzipLength":181,"brotliLength":0,"mainUid":"5ba4-42"},"5ba4-45":{"renderedLength":809,"gzipLength":332,"brotliLength":0,"mainUid":"5ba4-44"},"5ba4-47":{"renderedLength":213,"gzipLength":155,"brotliLength":0,"mainUid":"5ba4-46"},"5ba4-49":{"renderedLength":947,"gzipLength":287,"brotliLength":0,"mainUid":"5ba4-48"},"5ba4-51":{"renderedLength":1963,"gzipLength":510,"brotliLength":0,"mainUid":"5ba4-50"},"5ba4-53":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"mainUid":"5ba4-52"}},"nodeMetas":{"5ba4-40":{"id":"/src/config.ts","moduleParts":{"vitus-labs-core.umd.js":"5ba4-41"},"imported":[{"uid":"5ba4-57"}],"importedBy":[{"uid":"5ba4-52"},{"uid":"5ba4-44"}]},"5ba4-42":{"id":"/src/isEmpty.ts","moduleParts":{"vitus-labs-core.umd.js":"5ba4-43"},"imported":[],"importedBy":[{"uid":"5ba4-52"},{"uid":"5ba4-44"},{"uid":"5ba4-48"}]},"5ba4-44":{"id":"/src/context.tsx","moduleParts":{"vitus-labs-core.umd.js":"5ba4-45"},"imported":[{"uid":"5ba4-58"},{"uid":"5ba4-40"},{"uid":"5ba4-42"}],"importedBy":[{"uid":"5ba4-52"}]},"5ba4-46":{"id":"/src/compose.ts","moduleParts":{"vitus-labs-core.umd.js":"5ba4-47"},"imported":[],"importedBy":[{"uid":"5ba4-52"}]},"5ba4-48":{"id":"/src/renderContent.ts","moduleParts":{"vitus-labs-core.umd.js":"5ba4-49"},"imported":[{"uid":"5ba4-59"},{"uid":"5ba4-58"},{"uid":"5ba4-42"}],"importedBy":[{"uid":"5ba4-52"}]},"5ba4-50":{"id":"/src/html/htmlTags.ts","moduleParts":{"vitus-labs-core.umd.js":"5ba4-51"},"imported":[],"importedBy":[{"uid":"5ba4-56"}]},"5ba4-52":{"id":"/src/index.ts","moduleParts":{"vitus-labs-core.umd.js":"5ba4-53"},"imported":[{"uid":"5ba4-54"},{"uid":"5ba4-55"},{"uid":"5ba4-40"},{"uid":"5ba4-44"},{"uid":"5ba4-46"},{"uid":"5ba4-42"},{"uid":"5ba4-48"},{"uid":"5ba4-56"}],"importedBy":[],"isEntry":true},"5ba4-54":{"id":"lodash","moduleParts":{},"imported":[],"importedBy":[{"uid":"5ba4-52"}],"isExternal":true},"5ba4-55":{"id":"moize","moduleParts":{},"imported":[],"importedBy":[{"uid":"5ba4-52"}],"isExternal":true},"5ba4-56":{"id":"/src/html/index.ts","moduleParts":{},"imported":[{"uid":"5ba4-50"}],"importedBy":[{"uid":"5ba4-52"}]},"5ba4-57":{"id":"styled-components","moduleParts":{},"imported":[],"importedBy":[{"uid":"5ba4-40"}],"isExternal":true},"5ba4-58":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"5ba4-44"},{"uid":"5ba4-48"}],"isExternal":true},"5ba4-59":{"id":"react-is","moduleParts":{},"imported":[],"importedBy":[{"uid":"5ba4-48"}],"isExternal":true}},"env":{"rollup":"2.67.1"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
|
|
6428
6428
|
|
|
6429
6429
|
const run = () => {
|
|
6430
6430
|
const width = window.innerWidth;
|
|
@@ -6424,7 +6424,7 @@ var drawChart = (function (exports) {
|
|
|
6424
6424
|
</script>
|
|
6425
6425
|
<script>
|
|
6426
6426
|
/*<!--*/
|
|
6427
|
-
const data = {"version":2,"tree":{"name":"root","children":[{"name":"vitus-labs-core.umd.min.js","children":[{"name":"src","children":[{"uid":"
|
|
6427
|
+
const data = {"version":2,"tree":{"name":"root","children":[{"name":"vitus-labs-core.umd.min.js","children":[{"name":"src","children":[{"uid":"5ba4-61","name":"config.ts"},{"uid":"5ba4-63","name":"isEmpty.ts"},{"uid":"5ba4-65","name":"context.tsx"},{"uid":"5ba4-67","name":"compose.ts"},{"uid":"5ba4-69","name":"renderContent.ts"},{"name":"html/htmlTags.ts","uid":"5ba4-71"},{"uid":"5ba4-73","name":"index.ts"}]}]}],"isRoot":true},"nodeParts":{"5ba4-61":{"renderedLength":872,"gzipLength":297,"brotliLength":0,"mainUid":"5ba4-60"},"5ba4-63":{"renderedLength":388,"gzipLength":181,"brotliLength":0,"mainUid":"5ba4-62"},"5ba4-65":{"renderedLength":809,"gzipLength":332,"brotliLength":0,"mainUid":"5ba4-64"},"5ba4-67":{"renderedLength":213,"gzipLength":155,"brotliLength":0,"mainUid":"5ba4-66"},"5ba4-69":{"renderedLength":947,"gzipLength":287,"brotliLength":0,"mainUid":"5ba4-68"},"5ba4-71":{"renderedLength":1963,"gzipLength":510,"brotliLength":0,"mainUid":"5ba4-70"},"5ba4-73":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"mainUid":"5ba4-72"}},"nodeMetas":{"5ba4-60":{"id":"/src/config.ts","moduleParts":{"vitus-labs-core.umd.min.js":"5ba4-61"},"imported":[{"uid":"5ba4-77"}],"importedBy":[{"uid":"5ba4-72"},{"uid":"5ba4-64"}]},"5ba4-62":{"id":"/src/isEmpty.ts","moduleParts":{"vitus-labs-core.umd.min.js":"5ba4-63"},"imported":[],"importedBy":[{"uid":"5ba4-72"},{"uid":"5ba4-64"},{"uid":"5ba4-68"}]},"5ba4-64":{"id":"/src/context.tsx","moduleParts":{"vitus-labs-core.umd.min.js":"5ba4-65"},"imported":[{"uid":"5ba4-78"},{"uid":"5ba4-60"},{"uid":"5ba4-62"}],"importedBy":[{"uid":"5ba4-72"}]},"5ba4-66":{"id":"/src/compose.ts","moduleParts":{"vitus-labs-core.umd.min.js":"5ba4-67"},"imported":[],"importedBy":[{"uid":"5ba4-72"}]},"5ba4-68":{"id":"/src/renderContent.ts","moduleParts":{"vitus-labs-core.umd.min.js":"5ba4-69"},"imported":[{"uid":"5ba4-79"},{"uid":"5ba4-78"},{"uid":"5ba4-62"}],"importedBy":[{"uid":"5ba4-72"}]},"5ba4-70":{"id":"/src/html/htmlTags.ts","moduleParts":{"vitus-labs-core.umd.min.js":"5ba4-71"},"imported":[],"importedBy":[{"uid":"5ba4-76"}]},"5ba4-72":{"id":"/src/index.ts","moduleParts":{"vitus-labs-core.umd.min.js":"5ba4-73"},"imported":[{"uid":"5ba4-74"},{"uid":"5ba4-75"},{"uid":"5ba4-60"},{"uid":"5ba4-64"},{"uid":"5ba4-66"},{"uid":"5ba4-62"},{"uid":"5ba4-68"},{"uid":"5ba4-76"}],"importedBy":[],"isEntry":true},"5ba4-74":{"id":"lodash","moduleParts":{},"imported":[],"importedBy":[{"uid":"5ba4-72"}],"isExternal":true},"5ba4-75":{"id":"moize","moduleParts":{},"imported":[],"importedBy":[{"uid":"5ba4-72"}],"isExternal":true},"5ba4-76":{"id":"/src/html/index.ts","moduleParts":{},"imported":[{"uid":"5ba4-70"}],"importedBy":[{"uid":"5ba4-72"}]},"5ba4-77":{"id":"styled-components","moduleParts":{},"imported":[],"importedBy":[{"uid":"5ba4-60"}],"isExternal":true},"5ba4-78":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"5ba4-64"},{"uid":"5ba4-68"}],"isExternal":true},"5ba4-79":{"id":"react-is","moduleParts":{},"imported":[],"importedBy":[{"uid":"5ba4-68"}],"isExternal":true}},"env":{"rollup":"2.67.1"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
|
|
6428
6428
|
|
|
6429
6429
|
const run = () => {
|
|
6430
6430
|
const width = window.innerWidth;
|
package/lib/index.d.ts
CHANGED
|
@@ -4,71 +4,50 @@ import * as React from 'react';
|
|
|
4
4
|
import React__default, { ComponentType, FC, ReactNode, createElement, cloneElement } from 'react';
|
|
5
5
|
import { ThemedCssFunction, DefaultTheme, StyledInterface, ThemeProviderComponent } from 'styled-components';
|
|
6
6
|
|
|
7
|
-
declare const TAGS: readonly ["a", "abbr", "address", "area", "article", "aside", "audio", "b", "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", "header", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "meter", "nav", "object", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "section", "select", "small", "source", "span", "strong", "
|
|
7
|
+
declare const TAGS: readonly ["a", "abbr", "address", "area", "article", "aside", "audio", "b", "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", "header", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "meter", "nav", "object", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "section", "select", "small", "source", "span", "strong", "sub", "summary", "sup", "svg", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "u", "ul", "var", "video", "wbr"];
|
|
8
8
|
declare const TEXT_TAGS: readonly ["abbr", "b", "bdi", "bdo", "big", "blockquote", "cite", "code", "dl", "dt", "em", "figcaption", "h1", "h2", "h3", "h4", "h5", "h6", "i", "ins", "kbd", "label", "legend", "li", "p", "pre", "q", "rp", "rt", "s", "small", "span", "strong", "sub", "summary", "sup", "time", "u"];
|
|
9
9
|
declare type HTMLTags = typeof TAGS[number];
|
|
10
10
|
declare type HTMLTagsText = typeof TEXT_TAGS[number];
|
|
11
11
|
|
|
12
|
-
declare type
|
|
13
|
-
|
|
14
|
-
css: any;
|
|
15
|
-
context: any;
|
|
16
|
-
component?: ComponentType | HTMLTags;
|
|
17
|
-
textComponent?: ComponentType | HTMLTags;
|
|
18
|
-
}) => void;
|
|
19
|
-
declare const init: Init;
|
|
20
|
-
interface Internal {
|
|
21
|
-
css: ThemedCssFunction<DefaultTheme>;
|
|
22
|
-
styled: StyledInterface;
|
|
23
|
-
styledContext: ThemeProviderComponent<any, any>;
|
|
24
|
-
component: any;
|
|
25
|
-
textComponent: any;
|
|
26
|
-
}
|
|
27
|
-
declare const internal: Internal;
|
|
28
|
-
|
|
29
|
-
declare const context: React__default.Context<any>;
|
|
30
|
-
declare type Theme = Partial<{
|
|
31
|
-
rootSize: number;
|
|
32
|
-
breakpoints: Record<string, number | string>;
|
|
33
|
-
} & Record<string, any>>;
|
|
34
|
-
declare type ProviderType = Partial<{
|
|
35
|
-
theme: Theme;
|
|
36
|
-
} & Record<string, any>>;
|
|
37
|
-
declare const Provider: FC<ProviderType>;
|
|
38
|
-
|
|
39
|
-
declare type ArityOneFn = (arg: any) => any;
|
|
40
|
-
declare type PickLastInTuple<T extends any[]> = T extends [
|
|
41
|
-
...rest: infer U,
|
|
42
|
-
argn: infer L
|
|
43
|
-
] ? L : any;
|
|
44
|
-
declare type FirstFnParameterType<T extends any[]> = Parameters<PickLastInTuple<T>>[any];
|
|
45
|
-
declare const compose: <T extends ArityOneFn[]>(...fns: T) => (p: FirstFnParameterType<T>) => ReturnType<T[0]>;
|
|
46
|
-
|
|
47
|
-
declare type IsEmpty = <T extends Record<string, unknown> | unknown[] | null>(param?: T) => null | undefined extends T ? true : keyof T extends never ? true : false;
|
|
48
|
-
declare const isEmpty: IsEmpty;
|
|
49
|
-
|
|
50
|
-
declare type CreateTypes = Parameters<typeof createElement>[0];
|
|
51
|
-
declare type CloneTypes = Parameters<typeof cloneElement>[0];
|
|
52
|
-
declare type RenderContent = (content?: CreateTypes | CloneTypes | ReactNode | ReactNode[], attachProps?: Record<string, any>) => ReturnType<typeof createElement> | ReturnType<typeof cloneElement> | null;
|
|
53
|
-
declare const renderContent: RenderContent;
|
|
54
|
-
|
|
55
|
-
declare type HTMLElementProps = {
|
|
12
|
+
declare type Base = React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
13
|
+
declare type HTMLElementAttrs = {
|
|
56
14
|
a: React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>;
|
|
15
|
+
abbr: Base;
|
|
16
|
+
address: Base;
|
|
57
17
|
area: React.DetailedHTMLProps<React.AreaHTMLAttributes<HTMLAreaElement>, HTMLAreaElement>;
|
|
18
|
+
article: Base;
|
|
19
|
+
aside: Base;
|
|
58
20
|
audio: React.DetailedHTMLProps<React.AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>;
|
|
59
|
-
|
|
21
|
+
b: Base;
|
|
22
|
+
bdi: Base;
|
|
23
|
+
bdo: Base;
|
|
24
|
+
big: Base;
|
|
25
|
+
blockquote: React.DetailedHTMLProps<React.BlockquoteHTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>;
|
|
60
26
|
body: React.DetailedHTMLProps<React.HTMLAttributes<HTMLBodyElement>, HTMLBodyElement>;
|
|
61
27
|
br: React.DetailedHTMLProps<React.HTMLAttributes<HTMLBRElement>, HTMLBRElement>;
|
|
62
28
|
button: React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>;
|
|
63
29
|
canvas: React.DetailedHTMLProps<React.CanvasHTMLAttributes<HTMLCanvasElement>, HTMLCanvasElement>;
|
|
30
|
+
caption: Base;
|
|
31
|
+
cite: React.DetailedHTMLProps<React.HTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>;
|
|
32
|
+
code: Base;
|
|
33
|
+
col: React.DetailedHTMLProps<React.ColHTMLAttributes<HTMLTableColElement>, HTMLTableColElement>;
|
|
34
|
+
colgroup: React.DetailedHTMLProps<React.ColgroupHTMLAttributes<HTMLTableColElement>, HTMLTableColElement>;
|
|
64
35
|
data: React.DetailedHTMLProps<React.DataHTMLAttributes<HTMLDataElement>, HTMLDataElement>;
|
|
65
36
|
datalist: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDataListElement>, HTMLDataListElement>;
|
|
37
|
+
dd: Base;
|
|
38
|
+
del: React.DetailedHTMLProps<React.DelHTMLAttributes<HTMLModElement>, HTMLModElement>;
|
|
39
|
+
details: Base;
|
|
40
|
+
dfn: Base;
|
|
66
41
|
dialog: React.DetailedHTMLProps<React.DialogHTMLAttributes<HTMLDialogElement>, HTMLDialogElement>;
|
|
67
42
|
div: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
|
|
68
43
|
dl: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDListElement>, HTMLDListElement>;
|
|
69
|
-
|
|
44
|
+
dt: Base;
|
|
45
|
+
em: Base;
|
|
70
46
|
embed: React.DetailedHTMLProps<React.EmbedHTMLAttributes<HTMLEmbedElement>, HTMLEmbedElement>;
|
|
71
47
|
fieldset: React.DetailedHTMLProps<React.FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>;
|
|
48
|
+
figcaption: Base;
|
|
49
|
+
figure: Base;
|
|
50
|
+
footer: Base;
|
|
72
51
|
form: React.DetailedHTMLProps<React.FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>;
|
|
73
52
|
h1: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
|
|
74
53
|
h2: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
|
|
@@ -76,55 +55,109 @@ declare type HTMLElementProps = {
|
|
|
76
55
|
h4: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
|
|
77
56
|
h5: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
|
|
78
57
|
h6: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
|
|
79
|
-
|
|
58
|
+
header: Base;
|
|
80
59
|
hr: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHRElement>, HTMLHRElement>;
|
|
81
60
|
html: React.DetailedHTMLProps<React.HtmlHTMLAttributes<HTMLHtmlElement>, HTMLHtmlElement>;
|
|
61
|
+
i: Base;
|
|
82
62
|
iframe: React.DetailedHTMLProps<React.IframeHTMLAttributes<HTMLIFrameElement>, HTMLIFrameElement>;
|
|
83
63
|
img: React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>;
|
|
84
64
|
input: React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
|
|
85
65
|
ins: React.DetailedHTMLProps<React.InsHTMLAttributes<HTMLModElement>, HTMLModElement>;
|
|
86
|
-
|
|
66
|
+
kbd: Base;
|
|
87
67
|
label: React.DetailedHTMLProps<React.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>;
|
|
88
68
|
legend: React.DetailedHTMLProps<React.HTMLAttributes<HTMLLegendElement>, HTMLLegendElement>;
|
|
89
69
|
li: React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>;
|
|
90
|
-
|
|
70
|
+
main: Base;
|
|
91
71
|
map: React.DetailedHTMLProps<React.MapHTMLAttributes<HTMLMapElement>, HTMLMapElement>;
|
|
92
|
-
|
|
72
|
+
mark: Base;
|
|
73
|
+
meter: Base;
|
|
74
|
+
nav: Base;
|
|
93
75
|
object: React.DetailedHTMLProps<React.ObjectHTMLAttributes<HTMLObjectElement>, HTMLObjectElement>;
|
|
94
76
|
ol: React.DetailedHTMLProps<React.OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>;
|
|
95
77
|
optgroup: React.DetailedHTMLProps<React.OptgroupHTMLAttributes<HTMLOptGroupElement>, HTMLOptGroupElement>;
|
|
96
78
|
option: React.DetailedHTMLProps<React.OptionHTMLAttributes<HTMLOptionElement>, HTMLOptionElement>;
|
|
97
|
-
|
|
98
|
-
|
|
79
|
+
output: Base;
|
|
80
|
+
p: React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>;
|
|
81
|
+
picture: Base;
|
|
99
82
|
pre: React.DetailedHTMLProps<React.HTMLAttributes<HTMLPreElement>, HTMLPreElement>;
|
|
100
83
|
progress: React.DetailedHTMLProps<React.ProgressHTMLAttributes<HTMLProgressElement>, HTMLProgressElement>;
|
|
101
|
-
blockquote: React.DetailedHTMLProps<React.BlockquoteHTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>;
|
|
102
84
|
q: React.DetailedHTMLProps<React.HTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>;
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
85
|
+
rp: Base;
|
|
86
|
+
rt: Base;
|
|
87
|
+
ruby: Base;
|
|
88
|
+
s: Base;
|
|
89
|
+
samp: Base;
|
|
90
|
+
section: Base;
|
|
107
91
|
select: React.DetailedHTMLProps<React.SelectHTMLAttributes<HTMLSelectElement>, HTMLSelectElement>;
|
|
92
|
+
small: Base;
|
|
108
93
|
source: React.DetailedHTMLProps<React.SourceHTMLAttributes<HTMLSourceElement>, HTMLSourceElement>;
|
|
109
94
|
span: React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>;
|
|
110
|
-
|
|
95
|
+
strong: Base;
|
|
96
|
+
sub: Base;
|
|
97
|
+
summary: Base;
|
|
98
|
+
sup: Base;
|
|
111
99
|
svg: React.SVGProps<SVGSVGElement>;
|
|
112
100
|
table: React.DetailedHTMLProps<React.TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>;
|
|
113
|
-
col: React.DetailedHTMLProps<React.ColHTMLAttributes<HTMLTableColElement>, HTMLTableColElement>;
|
|
114
|
-
colgroup: React.DetailedHTMLProps<React.ColgroupHTMLAttributes<HTMLTableColElement>, HTMLTableColElement>;
|
|
115
|
-
td: React.DetailedHTMLProps<React.TdHTMLAttributes<HTMLTableCellElement>, HTMLTableCellElement>;
|
|
116
|
-
th: React.DetailedHTMLProps<React.ThHTMLAttributes<HTMLTableCellElement>, HTMLTableCellElement>;
|
|
117
|
-
tr: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>;
|
|
118
|
-
thead: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>;
|
|
119
101
|
tbody: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>;
|
|
120
|
-
|
|
102
|
+
td: React.DetailedHTMLProps<React.TdHTMLAttributes<HTMLTableCellElement>, HTMLTableCellElement>;
|
|
121
103
|
template: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTemplateElement>, HTMLTemplateElement>;
|
|
122
104
|
textarea: React.DetailedHTMLProps<React.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>;
|
|
123
|
-
|
|
105
|
+
tfoot: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>;
|
|
106
|
+
th: React.DetailedHTMLProps<React.ThHTMLAttributes<HTMLTableCellElement>, HTMLTableCellElement>;
|
|
107
|
+
thead: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>;
|
|
108
|
+
time: Base;
|
|
109
|
+
tr: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>;
|
|
124
110
|
track: React.DetailedHTMLProps<React.TrackHTMLAttributes<HTMLTrackElement>, HTMLTrackElement>;
|
|
111
|
+
u: Base;
|
|
125
112
|
ul: React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement>;
|
|
113
|
+
var: Base;
|
|
126
114
|
video: React.DetailedHTMLProps<React.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>;
|
|
127
|
-
|
|
115
|
+
wbr: Base;
|
|
128
116
|
};
|
|
129
117
|
|
|
130
|
-
|
|
118
|
+
declare type HTMLTagAttrsByTag<T extends HTMLTags> = T extends unknown ? {} : HTMLElementAttrs[T];
|
|
119
|
+
|
|
120
|
+
declare type Init = ({ styled, css, context, component, textComponent, }: {
|
|
121
|
+
styled: any;
|
|
122
|
+
css: any;
|
|
123
|
+
context: any;
|
|
124
|
+
component?: ComponentType | HTMLTags;
|
|
125
|
+
textComponent?: ComponentType | HTMLTags;
|
|
126
|
+
}) => void;
|
|
127
|
+
declare const init: Init;
|
|
128
|
+
interface Internal {
|
|
129
|
+
css: ThemedCssFunction<DefaultTheme>;
|
|
130
|
+
styled: StyledInterface;
|
|
131
|
+
styledContext: ThemeProviderComponent<any, any>;
|
|
132
|
+
component: any;
|
|
133
|
+
textComponent: any;
|
|
134
|
+
}
|
|
135
|
+
declare const internal: Internal;
|
|
136
|
+
|
|
137
|
+
declare const context: React__default.Context<any>;
|
|
138
|
+
declare type Theme = Partial<{
|
|
139
|
+
rootSize: number;
|
|
140
|
+
breakpoints: Record<string, number | string>;
|
|
141
|
+
} & Record<string, any>>;
|
|
142
|
+
declare type ProviderType = Partial<{
|
|
143
|
+
theme: Theme;
|
|
144
|
+
} & Record<string, any>>;
|
|
145
|
+
declare const Provider: FC<ProviderType>;
|
|
146
|
+
|
|
147
|
+
declare type ArityOneFn = (arg: any) => any;
|
|
148
|
+
declare type PickLastInTuple<T extends any[]> = T extends [
|
|
149
|
+
...rest: infer U,
|
|
150
|
+
argn: infer L
|
|
151
|
+
] ? L : any;
|
|
152
|
+
declare type FirstFnParameterType<T extends any[]> = Parameters<PickLastInTuple<T>>[any];
|
|
153
|
+
declare const compose: <T extends ArityOneFn[]>(...fns: T) => (p: FirstFnParameterType<T>) => ReturnType<T[0]>;
|
|
154
|
+
|
|
155
|
+
declare type IsEmpty = <T extends Record<string, unknown> | unknown[] | null>(param?: T) => null | undefined extends T ? true : keyof T extends never ? true : false;
|
|
156
|
+
declare const isEmpty: IsEmpty;
|
|
157
|
+
|
|
158
|
+
declare type CreateTypes = Parameters<typeof createElement>[0];
|
|
159
|
+
declare type CloneTypes = Parameters<typeof cloneElement>[0];
|
|
160
|
+
declare type RenderContent = (content?: CreateTypes | CloneTypes | ReactNode | ReactNode[], attachProps?: Record<string, any>) => ReturnType<typeof createElement> | ReturnType<typeof cloneElement> | null;
|
|
161
|
+
declare const renderContent: RenderContent;
|
|
162
|
+
|
|
163
|
+
export { HTMLElementAttrs, HTMLTagAttrsByTag, HTMLTags, HTMLTagsText, IsEmpty, Provider, RenderContent, compose, internal as config, context, TAGS as htmlTags, init, isEmpty, renderContent };
|
package/lib/types/config.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentType } from 'react';
|
|
2
2
|
import { ThemedCssFunction, StyledInterface, DefaultTheme, ThemeProviderComponent } from 'styled-components';
|
|
3
|
-
import type { HTMLTags } from "./
|
|
3
|
+
import type { HTMLTags } from "./html";
|
|
4
4
|
declare type Init = ({ styled, css, context, component, textComponent, }: {
|
|
5
5
|
styled: any;
|
|
6
6
|
css: any;
|
|
@@ -1,21 +1,43 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
2
|
+
declare type Base = React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
3
|
+
export declare type HTMLElementAttrs = {
|
|
3
4
|
a: React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>;
|
|
5
|
+
abbr: Base;
|
|
6
|
+
address: Base;
|
|
4
7
|
area: React.DetailedHTMLProps<React.AreaHTMLAttributes<HTMLAreaElement>, HTMLAreaElement>;
|
|
8
|
+
article: Base;
|
|
9
|
+
aside: Base;
|
|
5
10
|
audio: React.DetailedHTMLProps<React.AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>;
|
|
6
|
-
|
|
11
|
+
b: Base;
|
|
12
|
+
bdi: Base;
|
|
13
|
+
bdo: Base;
|
|
14
|
+
big: Base;
|
|
15
|
+
blockquote: React.DetailedHTMLProps<React.BlockquoteHTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>;
|
|
7
16
|
body: React.DetailedHTMLProps<React.HTMLAttributes<HTMLBodyElement>, HTMLBodyElement>;
|
|
8
17
|
br: React.DetailedHTMLProps<React.HTMLAttributes<HTMLBRElement>, HTMLBRElement>;
|
|
9
18
|
button: React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>;
|
|
10
19
|
canvas: React.DetailedHTMLProps<React.CanvasHTMLAttributes<HTMLCanvasElement>, HTMLCanvasElement>;
|
|
20
|
+
caption: Base;
|
|
21
|
+
cite: React.DetailedHTMLProps<React.HTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>;
|
|
22
|
+
code: Base;
|
|
23
|
+
col: React.DetailedHTMLProps<React.ColHTMLAttributes<HTMLTableColElement>, HTMLTableColElement>;
|
|
24
|
+
colgroup: React.DetailedHTMLProps<React.ColgroupHTMLAttributes<HTMLTableColElement>, HTMLTableColElement>;
|
|
11
25
|
data: React.DetailedHTMLProps<React.DataHTMLAttributes<HTMLDataElement>, HTMLDataElement>;
|
|
12
26
|
datalist: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDataListElement>, HTMLDataListElement>;
|
|
27
|
+
dd: Base;
|
|
28
|
+
del: React.DetailedHTMLProps<React.DelHTMLAttributes<HTMLModElement>, HTMLModElement>;
|
|
29
|
+
details: Base;
|
|
30
|
+
dfn: Base;
|
|
13
31
|
dialog: React.DetailedHTMLProps<React.DialogHTMLAttributes<HTMLDialogElement>, HTMLDialogElement>;
|
|
14
32
|
div: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
|
|
15
33
|
dl: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDListElement>, HTMLDListElement>;
|
|
16
|
-
|
|
34
|
+
dt: Base;
|
|
35
|
+
em: Base;
|
|
17
36
|
embed: React.DetailedHTMLProps<React.EmbedHTMLAttributes<HTMLEmbedElement>, HTMLEmbedElement>;
|
|
18
37
|
fieldset: React.DetailedHTMLProps<React.FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>;
|
|
38
|
+
figcaption: Base;
|
|
39
|
+
figure: Base;
|
|
40
|
+
footer: Base;
|
|
19
41
|
form: React.DetailedHTMLProps<React.FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>;
|
|
20
42
|
h1: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
|
|
21
43
|
h2: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
|
|
@@ -23,53 +45,63 @@ export declare type HTMLElementProps = {
|
|
|
23
45
|
h4: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
|
|
24
46
|
h5: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
|
|
25
47
|
h6: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
|
|
26
|
-
|
|
48
|
+
header: Base;
|
|
27
49
|
hr: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHRElement>, HTMLHRElement>;
|
|
28
50
|
html: React.DetailedHTMLProps<React.HtmlHTMLAttributes<HTMLHtmlElement>, HTMLHtmlElement>;
|
|
51
|
+
i: Base;
|
|
29
52
|
iframe: React.DetailedHTMLProps<React.IframeHTMLAttributes<HTMLIFrameElement>, HTMLIFrameElement>;
|
|
30
53
|
img: React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>;
|
|
31
54
|
input: React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
|
|
32
55
|
ins: React.DetailedHTMLProps<React.InsHTMLAttributes<HTMLModElement>, HTMLModElement>;
|
|
33
|
-
|
|
56
|
+
kbd: Base;
|
|
34
57
|
label: React.DetailedHTMLProps<React.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>;
|
|
35
58
|
legend: React.DetailedHTMLProps<React.HTMLAttributes<HTMLLegendElement>, HTMLLegendElement>;
|
|
36
59
|
li: React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>;
|
|
37
|
-
|
|
60
|
+
main: Base;
|
|
38
61
|
map: React.DetailedHTMLProps<React.MapHTMLAttributes<HTMLMapElement>, HTMLMapElement>;
|
|
39
|
-
|
|
62
|
+
mark: Base;
|
|
63
|
+
meter: Base;
|
|
64
|
+
nav: Base;
|
|
40
65
|
object: React.DetailedHTMLProps<React.ObjectHTMLAttributes<HTMLObjectElement>, HTMLObjectElement>;
|
|
41
66
|
ol: React.DetailedHTMLProps<React.OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>;
|
|
42
67
|
optgroup: React.DetailedHTMLProps<React.OptgroupHTMLAttributes<HTMLOptGroupElement>, HTMLOptGroupElement>;
|
|
43
68
|
option: React.DetailedHTMLProps<React.OptionHTMLAttributes<HTMLOptionElement>, HTMLOptionElement>;
|
|
44
|
-
|
|
45
|
-
|
|
69
|
+
output: Base;
|
|
70
|
+
p: React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>;
|
|
71
|
+
picture: Base;
|
|
46
72
|
pre: React.DetailedHTMLProps<React.HTMLAttributes<HTMLPreElement>, HTMLPreElement>;
|
|
47
73
|
progress: React.DetailedHTMLProps<React.ProgressHTMLAttributes<HTMLProgressElement>, HTMLProgressElement>;
|
|
48
|
-
blockquote: React.DetailedHTMLProps<React.BlockquoteHTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>;
|
|
49
74
|
q: React.DetailedHTMLProps<React.HTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
75
|
+
rp: Base;
|
|
76
|
+
rt: Base;
|
|
77
|
+
ruby: Base;
|
|
78
|
+
s: Base;
|
|
79
|
+
samp: Base;
|
|
80
|
+
section: Base;
|
|
54
81
|
select: React.DetailedHTMLProps<React.SelectHTMLAttributes<HTMLSelectElement>, HTMLSelectElement>;
|
|
82
|
+
small: Base;
|
|
55
83
|
source: React.DetailedHTMLProps<React.SourceHTMLAttributes<HTMLSourceElement>, HTMLSourceElement>;
|
|
56
84
|
span: React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>;
|
|
57
|
-
|
|
85
|
+
strong: Base;
|
|
86
|
+
sub: Base;
|
|
87
|
+
summary: Base;
|
|
88
|
+
sup: Base;
|
|
58
89
|
svg: React.SVGProps<SVGSVGElement>;
|
|
59
90
|
table: React.DetailedHTMLProps<React.TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>;
|
|
60
|
-
col: React.DetailedHTMLProps<React.ColHTMLAttributes<HTMLTableColElement>, HTMLTableColElement>;
|
|
61
|
-
colgroup: React.DetailedHTMLProps<React.ColgroupHTMLAttributes<HTMLTableColElement>, HTMLTableColElement>;
|
|
62
|
-
td: React.DetailedHTMLProps<React.TdHTMLAttributes<HTMLTableCellElement>, HTMLTableCellElement>;
|
|
63
|
-
th: React.DetailedHTMLProps<React.ThHTMLAttributes<HTMLTableCellElement>, HTMLTableCellElement>;
|
|
64
|
-
tr: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>;
|
|
65
|
-
thead: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>;
|
|
66
91
|
tbody: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>;
|
|
67
|
-
|
|
92
|
+
td: React.DetailedHTMLProps<React.TdHTMLAttributes<HTMLTableCellElement>, HTMLTableCellElement>;
|
|
68
93
|
template: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTemplateElement>, HTMLTemplateElement>;
|
|
69
94
|
textarea: React.DetailedHTMLProps<React.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>;
|
|
70
|
-
|
|
95
|
+
tfoot: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>;
|
|
96
|
+
th: React.DetailedHTMLProps<React.ThHTMLAttributes<HTMLTableCellElement>, HTMLTableCellElement>;
|
|
97
|
+
thead: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>;
|
|
98
|
+
time: Base;
|
|
99
|
+
tr: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>;
|
|
71
100
|
track: React.DetailedHTMLProps<React.TrackHTMLAttributes<HTMLTrackElement>, HTMLTrackElement>;
|
|
101
|
+
u: Base;
|
|
72
102
|
ul: React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement>;
|
|
103
|
+
var: Base;
|
|
73
104
|
video: React.DetailedHTMLProps<React.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>;
|
|
74
|
-
|
|
105
|
+
wbr: Base;
|
|
75
106
|
};
|
|
107
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const TAGS: readonly ["a", "abbr", "address", "area", "article", "aside", "audio", "b", "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", "header", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "meter", "nav", "object", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "section", "select", "small", "source", "span", "strong", "
|
|
1
|
+
declare const TAGS: readonly ["a", "abbr", "address", "area", "article", "aside", "audio", "b", "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", "header", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "meter", "nav", "object", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "section", "select", "small", "source", "span", "strong", "sub", "summary", "sup", "svg", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "u", "ul", "var", "video", "wbr"];
|
|
2
2
|
declare const TEXT_TAGS: readonly ["abbr", "b", "bdi", "bdo", "big", "blockquote", "cite", "code", "dl", "dt", "em", "figcaption", "h1", "h2", "h3", "h4", "h5", "h6", "i", "ins", "kbd", "label", "legend", "li", "p", "pre", "q", "rp", "rt", "s", "small", "span", "strong", "sub", "summary", "sup", "time", "u"];
|
|
3
3
|
export declare type HTMLTags = typeof TAGS[number];
|
|
4
4
|
export declare type HTMLTagsText = typeof TEXT_TAGS[number];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import htmlTags, { HTMLTags, HTMLTagsText } from './htmlTags';
|
|
2
|
+
import type { HTMLElementAttrs } from './htmlElementAttrs';
|
|
3
|
+
declare type HTMLTagAttrsByTag<T extends HTMLTags> = T extends unknown ? {} : HTMLElementAttrs[T];
|
|
4
|
+
export type { HTMLTags, HTMLTagsText, HTMLElementAttrs, HTMLTagAttrsByTag };
|
|
5
|
+
export { htmlTags };
|
package/lib/types/index.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ import Provider, { context } from "./context";
|
|
|
5
5
|
import compose from "./compose";
|
|
6
6
|
import isEmpty, { IsEmpty } from "./isEmpty";
|
|
7
7
|
import renderContent, { RenderContent } from "./renderContent";
|
|
8
|
-
import htmlTags,
|
|
9
|
-
|
|
10
|
-
export type { IsEmpty, RenderContent, HTMLTags, HTMLTagsText, HTMLElementProps };
|
|
8
|
+
import { htmlTags, HTMLTags, HTMLTagsText, HTMLElementAttrs, HTMLTagAttrsByTag } from "./html";
|
|
9
|
+
export type { IsEmpty, RenderContent, HTMLTags, HTMLTagsText, HTMLElementAttrs, HTMLTagAttrsByTag, };
|
|
11
10
|
export { Provider, context, init, config, compose, isEmpty, renderContent, omit, pick, set, get, throttle, merge, memoize, htmlTags, };
|
package/lib/vitus-labs-core.js
CHANGED
|
@@ -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":["import { 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, useMemo } 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, any>\n>\n\ntype ProviderType = Partial<\n {\n theme: Theme\n } & Record<string, any>\n>\n\nconst Provider: FC<ProviderType> = ({ theme, children, ...props }) => {\n // eslint-disable-next-line react/jsx-no-useless-fragment\n if (!theme || isEmpty(theme)) return <>{children}</>\n\n const StyledContext = useMemo(() => 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\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\nconst TEXT_TAGS = [\n 'abbr',\n 'b',\n 'bdi',\n 'bdo',\n 'big',\n 'blockquote',\n 'cite',\n 'code',\n 'dl',\n 'dt',\n 'em',\n 'figcaption',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'i',\n 'ins',\n 'kbd',\n 'label',\n 'legend',\n 'li',\n 'p',\n 'pre',\n 'q',\n 'rp',\n 'rt',\n 's',\n 'small',\n 'span',\n 'strong',\n 'sub',\n 'summary',\n 'sup',\n 'time',\n 'u',\n] as const\n\nexport type HTMLTags = typeof TAGS[number]\n\nexport type HTMLTagsText = typeof TEXT_TAGS[number]\n\nexport default TAGS\n"],"names":["styled","css","ThemeProvider","createContext","React","useMemo","config","isValidElement","createElement","isFragment","isValidElementType","cloneElement"],"mappings":";;;;;;;;;;;;;;;;AAWA,MAAM,OAAO,GAAa;YACxBA,0BAAM;SACNC,UAAG;IACH,aAAa,EAAEC,oBAAa;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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Q;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;;IAEN,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/html/htmlTags.ts"],"sourcesContent":["import { 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 '~/html'\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, useMemo } 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, any>\n>\n\ntype ProviderType = Partial<\n {\n theme: Theme\n } & Record<string, any>\n>\n\nconst Provider: FC<ProviderType> = ({ theme, children, ...props }) => {\n // eslint-disable-next-line react/jsx-no-useless-fragment\n if (!theme || isEmpty(theme)) return <>{children}</>\n\n const StyledContext = useMemo(() => 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\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\nconst TEXT_TAGS = [\n 'abbr',\n 'b',\n 'bdi',\n 'bdo',\n 'big',\n 'blockquote',\n 'cite',\n 'code',\n 'dl',\n 'dt',\n 'em',\n 'figcaption',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'i',\n 'ins',\n 'kbd',\n 'label',\n 'legend',\n 'li',\n 'p',\n 'pre',\n 'q',\n 'rp',\n 'rt',\n 's',\n 'small',\n 'span',\n 'strong',\n 'sub',\n 'summary',\n 'sup',\n 'time',\n 'u',\n] as const\n\nexport type HTMLTags = typeof TAGS[number]\n\nexport type HTMLTagsText = typeof TEXT_TAGS[number]\n\nexport default TAGS\n"],"names":["styled","css","ThemeProvider","createContext","React","useMemo","config","isValidElement","createElement","isFragment","isValidElementType","cloneElement"],"mappings":";;;;;;;;;;;;;;;;AAWA,MAAM,OAAO,GAAa;YACxBA,0BAAM;SACNC,UAAG;IACH,aAAa,EAAEC,oBAAa;IAC5B,SAAS,EAAE,KAAK;IAChB,aAAa,EAAE,MAAM;CACV,CAAA;MAgBP,IAAI,GAAS,CAAC,EAClB,MAAM,EACN,GAAG,EACH,OAAO,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,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,MAAM;;IAEN,QAAQ;;IAER,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;;IAEN,IAAI;IACJ,OAAO;;IAEP,GAAG;IACH,IAAI;IACJ,KAAK;IACL,OAAO;IACP,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -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":["import { 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, useMemo } 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, any>\n>\n\ntype ProviderType = Partial<\n {\n theme: Theme\n } & Record<string, any>\n>\n\nconst Provider: FC<ProviderType> = ({ theme, children, ...props }) => {\n // eslint-disable-next-line react/jsx-no-useless-fragment\n if (!theme || isEmpty(theme)) return <>{children}</>\n\n const StyledContext = useMemo(() => 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\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\nconst TEXT_TAGS = [\n 'abbr',\n 'b',\n 'bdi',\n 'bdo',\n 'big',\n 'blockquote',\n 'cite',\n 'code',\n 'dl',\n 'dt',\n 'em',\n 'figcaption',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'i',\n 'ins',\n 'kbd',\n 'label',\n 'legend',\n 'li',\n 'p',\n 'pre',\n 'q',\n 'rp',\n 'rt',\n 's',\n 'small',\n 'span',\n 'strong',\n 'sub',\n 'summary',\n 'sup',\n 'time',\n 'u',\n] as const\n\nexport type HTMLTags = typeof TAGS[number]\n\nexport type HTMLTagsText = typeof TEXT_TAGS[number]\n\nexport default TAGS\n"],"names":["config"],"mappings":";;;;;;AAWA,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,GA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O;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;;IAEN,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/html/htmlTags.ts"],"sourcesContent":["import { 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 '~/html'\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, useMemo } 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, any>\n>\n\ntype ProviderType = Partial<\n {\n theme: Theme\n } & Record<string, any>\n>\n\nconst Provider: FC<ProviderType> = ({ theme, children, ...props }) => {\n // eslint-disable-next-line react/jsx-no-useless-fragment\n if (!theme || isEmpty(theme)) return <>{children}</>\n\n const StyledContext = useMemo(() => 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\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\nconst TEXT_TAGS = [\n 'abbr',\n 'b',\n 'bdi',\n 'bdo',\n 'big',\n 'blockquote',\n 'cite',\n 'code',\n 'dl',\n 'dt',\n 'em',\n 'figcaption',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'i',\n 'ins',\n 'kbd',\n 'label',\n 'legend',\n 'li',\n 'p',\n 'pre',\n 'q',\n 'rp',\n 'rt',\n 's',\n 'small',\n 'span',\n 'strong',\n 'sub',\n 'summary',\n 'sup',\n 'time',\n 'u',\n] as const\n\nexport type HTMLTags = typeof TAGS[number]\n\nexport type HTMLTagsText = typeof TEXT_TAGS[number]\n\nexport default TAGS\n"],"names":["config"],"mappings":";;;;;;AAWA,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,aAA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AAO;IACP,MAAM;;IAEN,IAAI;IACJ,OAAO;;IAEP,GAAG;IACH,IAAI;IACJ,KAAK;IACL,OAAO;IACP,KAAK;;;;;"}
|
|
@@ -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":["import { 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, useMemo } 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, any>\n>\n\ntype ProviderType = Partial<\n {\n theme: Theme\n } & Record<string, any>\n>\n\nconst Provider: FC<ProviderType> = ({ theme, children, ...props }) => {\n // eslint-disable-next-line react/jsx-no-useless-fragment\n if (!theme || isEmpty(theme)) return <>{children}</>\n\n const StyledContext = useMemo(() => 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\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\nconst TEXT_TAGS = [\n 'abbr',\n 'b',\n 'bdi',\n 'bdo',\n 'big',\n 'blockquote',\n 'cite',\n 'code',\n 'dl',\n 'dt',\n 'em',\n 'figcaption',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'i',\n 'ins',\n 'kbd',\n 'label',\n 'legend',\n 'li',\n 'p',\n 'pre',\n 'q',\n 'rp',\n 'rt',\n 's',\n 'small',\n 'span',\n 'strong',\n 'sub',\n 'summary',\n 'sup',\n 'time',\n 'u',\n] as const\n\nexport type HTMLTags = typeof TAGS[number]\n\nexport type HTMLTagsText = typeof TEXT_TAGS[number]\n\nexport default TAGS\n"],"names":["styled","css","ThemeProvider","createContext","React","useMemo","config","isValidElement","createElement","isFragment","isValidElementType","cloneElement"],"mappings":";;;;;;;;;;;;EAWA,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,OA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AAI;MACJ,OAAO;MACP,MAAM;;MAEN,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/html/htmlTags.ts"],"sourcesContent":["import { 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 '~/html'\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, useMemo } 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, any>\n>\n\ntype ProviderType = Partial<\n {\n theme: Theme\n } & Record<string, any>\n>\n\nconst Provider: FC<ProviderType> = ({ theme, children, ...props }) => {\n // eslint-disable-next-line react/jsx-no-useless-fragment\n if (!theme || isEmpty(theme)) return <>{children}</>\n\n const StyledContext = useMemo(() => 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\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\nconst TEXT_TAGS = [\n 'abbr',\n 'b',\n 'bdi',\n 'bdo',\n 'big',\n 'blockquote',\n 'cite',\n 'code',\n 'dl',\n 'dt',\n 'em',\n 'figcaption',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'i',\n 'ins',\n 'kbd',\n 'label',\n 'legend',\n 'li',\n 'p',\n 'pre',\n 'q',\n 'rp',\n 'rt',\n 's',\n 'small',\n 'span',\n 'strong',\n 'sub',\n 'summary',\n 'sup',\n 'time',\n 'u',\n] as const\n\nexport type HTMLTags = typeof TAGS[number]\n\nexport type HTMLTagsText = typeof TEXT_TAGS[number]\n\nexport default TAGS\n"],"names":["styled","css","ThemeProvider","createContext","React","useMemo","config","isValidElement","createElement","isFragment","isValidElementType","cloneElement"],"mappings":";;;;;;;;;;;;EAWA,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,C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;MACV,UAAU;MACV,OAAO;MACP,IAAI;MACJ,OAAO;MACP,MAAM;;MAEN,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"),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 l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=l(r),s=l(n),c=l(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 a.default}}),e.Provider=({theme:e,children:t,...r})=>{if(!e||m(e))return c.default.createElement(c.default.Fragment,null,t);const n=o.useMemo((()=>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","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","header","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","map","mark","meter","nav","object","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","source","span","strong","
|
|
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 l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=l(r),s=l(n),c=l(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 a.default}}),e.Provider=({theme:e,children:t,...r})=>{if(!e||m(e))return c.default.createElement(c.default.Fragment,null,t);const n=o.useMemo((()=>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","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","header","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","map","mark","meter","nav","object","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","source","span","strong","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","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":["import { 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 '~/
|
|
1
|
+
{"version":3,"file":"vitus-labs-core.umd.min.js","sources":["../src/config.ts","../src/isEmpty.ts","../src/context.tsx","../src/compose.ts","../src/html/htmlTags.ts","../src/renderContent.ts"],"sourcesContent":["import { 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 '~/html'\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, useMemo } 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, any>\n>\n\ntype ProviderType = Partial<\n {\n theme: Theme\n } & Record<string, any>\n>\n\nconst Provider: FC<ProviderType> = ({ theme, children, ...props }) => {\n // eslint-disable-next-line react/jsx-no-useless-fragment\n if (!theme || isEmpty(theme)) return <>{children}</>\n\n const StyledContext = useMemo(() => 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\nconst TEXT_TAGS = [\n 'abbr',\n 'b',\n 'bdi',\n 'bdo',\n 'big',\n 'blockquote',\n 'cite',\n 'code',\n 'dl',\n 'dt',\n 'em',\n 'figcaption',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'i',\n 'ins',\n 'kbd',\n 'label',\n 'legend',\n 'li',\n 'p',\n 'pre',\n 'q',\n 'rp',\n 'rt',\n 's',\n 'small',\n 'span',\n 'strong',\n 'sub',\n 'summary',\n 'sup',\n 'time',\n 'u',\n] as const\n\nexport type HTMLTags = typeof TAGS[number]\n\nexport type HTMLTagsText = typeof TEXT_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\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","useMemo","config","value","fns","p","reduceRight","acc","cur","content","attachProps","isValidElement","createElement","includes","isFragment","isValidElementType","cloneElement"],"mappings":"yiBAWA,MAAMA,EAAoB,QACxBC,cACAC,MACAC,cAAeC,gBACfC,UAAW,MACXC,cAAe,QAuCXC,EAAqBC,OAAOC,OAAO,CACnCP,UACF,OAAOF,EAAQE,KAEbD,aACF,OAAOD,EAAQC,QAEbE,oBACF,OAAOH,EAAQG,eAEbE,gBACF,OAAOL,EAAQK,WAEbC,oBACF,OAAON,EAAQM,iBCjEbI,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,MAExD,IAAKF,GAASX,EAAQW,GAAQ,OAAOG,gDAAGF,GAExC,MAAMG,EAAgBC,WAAQ,IAAMC,EAAOxB,eAAe,IAE1D,OAAIsB,EAEAD,wBAACL,GAAkBS,MAAO,CAAEP,MAAAA,KAAUE,IACpCC,wBAACC,GAAcJ,MAAOA,GAAQC,IAMlCE,wBAACL,GAAkBS,MAAO,CAAEP,MAAAA,KAAUE,IACnCD,cCfL,IAA4BO,IAC3BC,GACCD,EAAIE,aAAY,CAACC,EAAUC,IAAaA,EAAID,IAAMF,qCCvBzC,CACX,IACA,OAEA,UAEA,OACA,UACA,QACA,QACA,IAGA,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,KAEA,SACA,KACA,OACA,IACA,SACA,MACA,QACA,MACA,MACA,QACA,SACA,KAEA,OACA,MACA,OAEA,QACA,MAGA,SACA,KACA,WACA,SACA,SACA,IAEA,UACA,MACA,WACA,IACA,KACA,KACA,OACA,IACA,OAEA,UACA,SACA,QACA,SACA,OAEA,SAEA,MACA,UACA,MACA,MACA,QACA,QACA,KACA,WACA,WACA,QACA,KACA,QACA,OAEA,KACA,QAEA,IACA,KACA,MACA,QACA,cJzFiB,EACjB7B,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,+BKhCW,CAAC4B,EAASC,IACxCD,EAEkB,iBAAZA,GAAwBE,iBAAeF,GACzCC,EACHE,gBAAcH,EAASC,GACvBE,gBAAcH,GAGhB,CAAC,SAAU,UAAW,UAAUI,gBAAgBJ,IAIhDtB,MAAMC,QAAQqB,IAAYK,aAAWL,GAHhCA,EAOLM,qBAAmBN,GACdC,EACHE,gBAAcH,EAASC,GACvBE,gBAAcH,GAGhBE,iBAAeF,GACbxB,EAAQyB,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.35.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Vit Bokisch <vit@bokisch.cz>",
|
|
6
6
|
"maintainers": [
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"@vitus-labs/tools-typescript": "^0.26.0",
|
|
68
68
|
"styled-components": "^5.3.3"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "68640ca2ea14b1f13d09cd7a291399078079f71c"
|
|
71
71
|
}
|