lilact 0.23.0 → 0.24.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/README.md +19 -5
- package/dist/lilact.development.js +490 -464
- package/dist/lilact.development.js.map +4 -4
- package/dist/lilact.development.min.js +24 -24
- package/dist/lilact.development.min.js.map +4 -4
- package/dist/lilact.production.min.js +24 -24
- package/docs/assets/hierarchy.js +1 -1
- package/docs/classes/components.Component.html +1 -1
- package/docs/classes/components.HTMLComponent.html +1 -1
- package/docs/classes/components.RootComponent.html +1 -1
- package/docs/functions/components.cloneComponent.html +1 -1
- package/docs/functions/run.lazy.html +1 -1
- package/docs/functions/run.require.html +3 -4
- package/docs/functions/run.runScripts.html +1 -1
- package/docs/functions/timers.timeoutPromise.html +4 -4
- package/docs/hierarchy.html +1 -1
- package/docs/index.html +21 -5
- package/docs/static/demos/cloneelement.jsx +6 -0
- package/docs/static/demos/lazy.jsx +1 -1
- package/docs/static/demos/legacy-context.jsx +0 -7
- package/docs/static/index.html +3 -3
- package/docs/static/lilact.development.js +490 -464
- package/docs/static/lilact.development.js.map +4 -4
- package/docs/static/lilact.development.min.js +24 -24
- package/docs/static/lilact.development.min.js.map +4 -4
- package/docs/static/lilact.production.min.js +24 -24
- package/docs/variables/components.cloneElement.html +1 -1
- package/examples/demos/cloneelement.jsx +6 -0
- package/examples/demos/lazy.jsx +1 -1
- package/examples/demos/legacy-context.jsx +0 -7
- package/examples/index.html +3 -3
- package/examples/lilact.development.js +490 -464
- package/examples/lilact.development.js.map +4 -4
- package/examples/lilact.development.min.js +24 -24
- package/examples/lilact.development.min.js.map +4 -4
- package/examples/lilact.production.min.js +24 -24
- package/package.json +1 -1
- package/src/components.jsx +3 -3
- package/src/lilact.jsx +1 -1
- package/src/proptypes.jsx +38 -0
- package/src/run.jsx +10 -11
|
@@ -1679,6 +1679,323 @@ var css = _createEmotion.css;
|
|
|
1679
1679
|
var sheet = _createEmotion.sheet;
|
|
1680
1680
|
var cache = _createEmotion.cache;
|
|
1681
1681
|
|
|
1682
|
+
// .tmp/src/misc.jsx
|
|
1683
|
+
var misc_exports = {};
|
|
1684
|
+
__export(misc_exports, {
|
|
1685
|
+
Children: () => Children,
|
|
1686
|
+
Fragment: () => Fragment2,
|
|
1687
|
+
Portal: () => Portal,
|
|
1688
|
+
deepEqual: () => deepEqual,
|
|
1689
|
+
eval_num: () => eval_num,
|
|
1690
|
+
findDOMNode: () => findDOMNode,
|
|
1691
|
+
forwardRef: () => forwardRef,
|
|
1692
|
+
getComponentByPointer: () => getComponentByPointer,
|
|
1693
|
+
id_num: () => id_num,
|
|
1694
|
+
isAsync: () => isAsync,
|
|
1695
|
+
isClass: () => isClass,
|
|
1696
|
+
isEmpty: () => isEmpty,
|
|
1697
|
+
isError: () => isError2,
|
|
1698
|
+
isThenable: () => isThenable,
|
|
1699
|
+
isValidComponent: () => isValidComponent,
|
|
1700
|
+
isValidElement: () => isValidElement,
|
|
1701
|
+
shallowEqual: () => shallowEqual,
|
|
1702
|
+
toBool: () => toBool
|
|
1703
|
+
});
|
|
1704
|
+
|
|
1705
|
+
// .tmp/src/symbols.jsx
|
|
1706
|
+
var [
|
|
1707
|
+
CORE,
|
|
1708
|
+
COMPONENT,
|
|
1709
|
+
TEXT2,
|
|
1710
|
+
IS_ZOMBIE,
|
|
1711
|
+
IDX,
|
|
1712
|
+
CHILD_CLASS_ADDENDUM,
|
|
1713
|
+
MEMOIZED,
|
|
1714
|
+
LAZY,
|
|
1715
|
+
DUE,
|
|
1716
|
+
REPEAT,
|
|
1717
|
+
CLEARED,
|
|
1718
|
+
INTERVAL,
|
|
1719
|
+
CALLBACK,
|
|
1720
|
+
ARGS
|
|
1721
|
+
] = [
|
|
1722
|
+
/* @__PURE__ */ Symbol.for("LILACT:CORE"),
|
|
1723
|
+
/* @__PURE__ */ Symbol.for("LILACT:COMPONENT"),
|
|
1724
|
+
/* @__PURE__ */ Symbol.for("LILACT:TEXT"),
|
|
1725
|
+
/* @__PURE__ */ Symbol.for("LILACT:IS_ZOMBIE"),
|
|
1726
|
+
/* @__PURE__ */ Symbol.for("LILACT:IDX"),
|
|
1727
|
+
/* @__PURE__ */ Symbol.for("LILACT:CHILD_CLASS_ADDENDUM"),
|
|
1728
|
+
/* @__PURE__ */ Symbol.for("LILACT:MEMOIZED"),
|
|
1729
|
+
/* @__PURE__ */ Symbol.for("LILACT:LAZY"),
|
|
1730
|
+
/* @__PURE__ */ Symbol.for("LILACT:TIMERS:DUE"),
|
|
1731
|
+
/* @__PURE__ */ Symbol.for("LILACT:TIMERS:REPEAT"),
|
|
1732
|
+
/* @__PURE__ */ Symbol.for("LILACT:TIMERS:CLEARED"),
|
|
1733
|
+
/* @__PURE__ */ Symbol.for("LILACT:TIMERS:INTERVAL"),
|
|
1734
|
+
/* @__PURE__ */ Symbol.for("LILACT:TIMERS:CALLBACK"),
|
|
1735
|
+
/* @__PURE__ */ Symbol.for("LILACT:TIMERS:ARGS")
|
|
1736
|
+
];
|
|
1737
|
+
|
|
1738
|
+
// .tmp/src/misc.jsx
|
|
1739
|
+
var typeOf = (input) => {
|
|
1740
|
+
const rawObject = Object.prototype.toString.call(input).toLowerCase();
|
|
1741
|
+
const typeOfRegex = /\[object (.*)]/g;
|
|
1742
|
+
const type = typeOfRegex.exec(rawObject)[1];
|
|
1743
|
+
return type;
|
|
1744
|
+
};
|
|
1745
|
+
var isValidComponent = (value) => {
|
|
1746
|
+
return value[CORE] !== void 0 || value[TEXT] !== void 0;
|
|
1747
|
+
};
|
|
1748
|
+
var isValidElement = isValidComponent;
|
|
1749
|
+
var findDOMNode = (component) => {
|
|
1750
|
+
var _a, _b;
|
|
1751
|
+
if (!((_b = (_a = component[CORE]) == null ? void 0 : _a.element) == null ? void 0 : _b.parentNode)) throw new Error("findDOMNode only works on mounted components.");
|
|
1752
|
+
return component[CORE].element;
|
|
1753
|
+
};
|
|
1754
|
+
function Fragment2({ children }) {
|
|
1755
|
+
return children;
|
|
1756
|
+
}
|
|
1757
|
+
Fragment2.displayName = "Fragment";
|
|
1758
|
+
function Portal({ children, view }) {
|
|
1759
|
+
this[CORE].portal = view;
|
|
1760
|
+
return children;
|
|
1761
|
+
}
|
|
1762
|
+
Portal.displayName = "Portal";
|
|
1763
|
+
var Children = {
|
|
1764
|
+
/**
|
|
1765
|
+
* @param {any} x
|
|
1766
|
+
* @returns {boolean}
|
|
1767
|
+
*/
|
|
1768
|
+
_isNil(x) {
|
|
1769
|
+
return x === null || x === void 0;
|
|
1770
|
+
},
|
|
1771
|
+
/**
|
|
1772
|
+
* Recursively flattens nested arrays into `out`, omitting null/undefined.
|
|
1773
|
+
* @param {Array<any>} out
|
|
1774
|
+
* @param {any} input
|
|
1775
|
+
*/
|
|
1776
|
+
_flattenInto(out, input) {
|
|
1777
|
+
if (this._isNil(input)) return;
|
|
1778
|
+
if (Array.isArray(input)) {
|
|
1779
|
+
for (const v of input) this._flattenInto(out, v);
|
|
1780
|
+
return;
|
|
1781
|
+
}
|
|
1782
|
+
out.push(input);
|
|
1783
|
+
},
|
|
1784
|
+
/**
|
|
1785
|
+
* Converts an iterable children collection into a flat array,
|
|
1786
|
+
* omitting `null`/`undefined`.
|
|
1787
|
+
*
|
|
1788
|
+
* @param {Iterable<any>} children
|
|
1789
|
+
* @returns {Array<any>}
|
|
1790
|
+
*/
|
|
1791
|
+
toArray(children) {
|
|
1792
|
+
const out = [];
|
|
1793
|
+
if (!children) return out;
|
|
1794
|
+
for (const item of children) {
|
|
1795
|
+
this._flattenInto(out, item);
|
|
1796
|
+
}
|
|
1797
|
+
return out;
|
|
1798
|
+
},
|
|
1799
|
+
/**
|
|
1800
|
+
* Returns the number of non-null/undefined children (after flattening).
|
|
1801
|
+
* @param {Iterable<any>} children
|
|
1802
|
+
* @returns {number}
|
|
1803
|
+
*/
|
|
1804
|
+
count(children) {
|
|
1805
|
+
return this.toArray(children).length;
|
|
1806
|
+
},
|
|
1807
|
+
/**
|
|
1808
|
+
* Returns the single child from a children collection (after flattening & omitting nil),
|
|
1809
|
+
* or throws if the remaining count is not exactly 1.
|
|
1810
|
+
*
|
|
1811
|
+
* @param {Iterable<any>} children
|
|
1812
|
+
* @returns {any}
|
|
1813
|
+
*/
|
|
1814
|
+
only(children) {
|
|
1815
|
+
const arr = this.toArray(children);
|
|
1816
|
+
if (arr.length !== 1) {
|
|
1817
|
+
throw new Error(
|
|
1818
|
+
arr.length === 0 ? "Expected exactly one child, but received none." : "Expected exactly one child, but received more than one."
|
|
1819
|
+
);
|
|
1820
|
+
}
|
|
1821
|
+
return arr[0];
|
|
1822
|
+
},
|
|
1823
|
+
/**
|
|
1824
|
+
* Maps over children (after flattening & omitting nil).
|
|
1825
|
+
*
|
|
1826
|
+
* @param {Iterable<any>} children
|
|
1827
|
+
* @param {(child:any, index:number)=>any} fn
|
|
1828
|
+
* @returns {Array<any>}
|
|
1829
|
+
*/
|
|
1830
|
+
map(children, fn) {
|
|
1831
|
+
const arr = this.toArray(children);
|
|
1832
|
+
const out = [];
|
|
1833
|
+
for (let i2 = 0; i2 < arr.length; i2++) out.push(fn(arr[i2], i2));
|
|
1834
|
+
return out;
|
|
1835
|
+
},
|
|
1836
|
+
/**
|
|
1837
|
+
* Iterates over children (after flattening & omitting nil).
|
|
1838
|
+
* @param {Iterable<any>} children
|
|
1839
|
+
* @param {(child:any, index:number)=>void} fn
|
|
1840
|
+
*/
|
|
1841
|
+
forEach(children, fn) {
|
|
1842
|
+
const arr = this.toArray(children);
|
|
1843
|
+
for (let i2 = 0; i2 < arr.length; i2++) fn(arr[i2], i2);
|
|
1844
|
+
},
|
|
1845
|
+
/**
|
|
1846
|
+
* Finds the first child for which predicate returns true.
|
|
1847
|
+
*
|
|
1848
|
+
* @param {Iterable<any>} children
|
|
1849
|
+
* @param {(child:any, index:number)=>boolean} predicate
|
|
1850
|
+
* @returns {any|undefined}
|
|
1851
|
+
*/
|
|
1852
|
+
find(children, predicate) {
|
|
1853
|
+
const arr = this.toArray(children);
|
|
1854
|
+
for (let i2 = 0; i2 < arr.length; i2++) {
|
|
1855
|
+
if (predicate(arr[i2], i2)) return arr[i2];
|
|
1856
|
+
}
|
|
1857
|
+
return void 0;
|
|
1858
|
+
},
|
|
1859
|
+
/**
|
|
1860
|
+
* Finds exactly one matching child.
|
|
1861
|
+
* Throws if matched count is not exactly 1.
|
|
1862
|
+
*
|
|
1863
|
+
* @param {Iterable<any>} children
|
|
1864
|
+
* @param {(child:any, index:number)=>boolean} predicate
|
|
1865
|
+
* @returns {any}
|
|
1866
|
+
*/
|
|
1867
|
+
pickOne(children, predicate) {
|
|
1868
|
+
const arr = this.toArray(children);
|
|
1869
|
+
let found;
|
|
1870
|
+
let matches = 0;
|
|
1871
|
+
for (let i2 = 0; i2 < arr.length; i2++) {
|
|
1872
|
+
if (predicate(arr[i2], i2)) {
|
|
1873
|
+
matches++;
|
|
1874
|
+
found = arr[i2];
|
|
1875
|
+
if (matches > 1) break;
|
|
1876
|
+
}
|
|
1877
|
+
}
|
|
1878
|
+
if (matches !== 1) {
|
|
1879
|
+
throw new Error(
|
|
1880
|
+
matches === 0 ? "pickOne expected exactly one matching child, but matched none." : "pickOne expected exactly one matching child, but matched multiple."
|
|
1881
|
+
);
|
|
1882
|
+
}
|
|
1883
|
+
return found;
|
|
1884
|
+
},
|
|
1885
|
+
/**
|
|
1886
|
+
* Returns the first non-nil child (after flattening), or undefined.
|
|
1887
|
+
* @param {Iterable<any>} children
|
|
1888
|
+
* @returns {any|undefined}
|
|
1889
|
+
*/
|
|
1890
|
+
first(children) {
|
|
1891
|
+
const arr = this.toArray(children);
|
|
1892
|
+
return arr[0];
|
|
1893
|
+
},
|
|
1894
|
+
/**
|
|
1895
|
+
* Returns the last non-nil child (after flattening), or undefined.
|
|
1896
|
+
* @param {Iterable<any>} children
|
|
1897
|
+
* @returns {any|undefined}
|
|
1898
|
+
*/
|
|
1899
|
+
last(children) {
|
|
1900
|
+
const arr = this.toArray(children);
|
|
1901
|
+
return arr.length ? arr[arr.length - 1] : void 0;
|
|
1902
|
+
}
|
|
1903
|
+
};
|
|
1904
|
+
var forwardRef = (render2) => {
|
|
1905
|
+
const forwarded = function(props, ref) {
|
|
1906
|
+
return render2({ ...props, ref: void 0 }, ref);
|
|
1907
|
+
};
|
|
1908
|
+
forwarded.displayName = "Forwarded " + render2.displayName;
|
|
1909
|
+
return forwarded;
|
|
1910
|
+
};
|
|
1911
|
+
function getComponentByPointer() {
|
|
1912
|
+
let resolve_func;
|
|
1913
|
+
const pr = new Promise((res2, rej) => {
|
|
1914
|
+
resolve_func = res2;
|
|
1915
|
+
});
|
|
1916
|
+
function click_handler(event2) {
|
|
1917
|
+
event2.stopImmediatePropagation();
|
|
1918
|
+
window.removeEventListener("click", click_handler, true);
|
|
1919
|
+
let t = event2.target;
|
|
1920
|
+
while (!t[COMPONENT] && t.parentNode) {
|
|
1921
|
+
t = t.parentNode;
|
|
1922
|
+
}
|
|
1923
|
+
resolve_func(t[COMPONENT]);
|
|
1924
|
+
return false;
|
|
1925
|
+
}
|
|
1926
|
+
window.addEventListener("click", click_handler, true);
|
|
1927
|
+
return pr;
|
|
1928
|
+
}
|
|
1929
|
+
function isEmpty(value) {
|
|
1930
|
+
for (let i2 in value) return false;
|
|
1931
|
+
return true;
|
|
1932
|
+
}
|
|
1933
|
+
var shallowEqual = (source, target, ignore) => {
|
|
1934
|
+
if (typeOf(source) !== typeOf(target)) {
|
|
1935
|
+
return false;
|
|
1936
|
+
}
|
|
1937
|
+
if (typeOf(source) === "array") {
|
|
1938
|
+
if (source.length !== target.length) {
|
|
1939
|
+
return false;
|
|
1940
|
+
}
|
|
1941
|
+
return source.every((el, index2) => el === target[index2] || index2 === ignore);
|
|
1942
|
+
} else if (typeOf(source) === "object") {
|
|
1943
|
+
return Object.keys(source).every((key) => source[key] === target[key] || key === ignore);
|
|
1944
|
+
} else if (typeOf(source) === "date") {
|
|
1945
|
+
return source.getTime() === target.getTime();
|
|
1946
|
+
}
|
|
1947
|
+
return source === target;
|
|
1948
|
+
};
|
|
1949
|
+
function deepEqual(source, target) {
|
|
1950
|
+
if (typeOf(source) !== typeOf(target)) {
|
|
1951
|
+
return false;
|
|
1952
|
+
}
|
|
1953
|
+
if (typeOf(source) === "array") {
|
|
1954
|
+
if (source.length !== target.length) {
|
|
1955
|
+
return false;
|
|
1956
|
+
}
|
|
1957
|
+
return source.every((entry, index2) => deepEqual(entry, target[index2]));
|
|
1958
|
+
} else if (typeOf(source) === "object") {
|
|
1959
|
+
if (Object.keys(source).length !== Object.keys(target).length) {
|
|
1960
|
+
return false;
|
|
1961
|
+
}
|
|
1962
|
+
return Object.keys(source).every(
|
|
1963
|
+
(key) => deepEqual(source[key], target[key])
|
|
1964
|
+
);
|
|
1965
|
+
} else if (typeOf(source) === "date") {
|
|
1966
|
+
return source.getTime() === target.getTime();
|
|
1967
|
+
}
|
|
1968
|
+
return source === target;
|
|
1969
|
+
}
|
|
1970
|
+
function isClass(value) {
|
|
1971
|
+
if (!(value && value.constructor === Function) || value.prototype === void 0)
|
|
1972
|
+
return false;
|
|
1973
|
+
if (Function.prototype !== Object.getPrototypeOf(value))
|
|
1974
|
+
return true;
|
|
1975
|
+
return Object.getOwnPropertyNames(value.prototype).length > 1;
|
|
1976
|
+
}
|
|
1977
|
+
function isAsync(value) {
|
|
1978
|
+
return typeof value === "function" && value.constructor && value.constructor.name === "AsyncFunction";
|
|
1979
|
+
}
|
|
1980
|
+
function isThenable(value) {
|
|
1981
|
+
return value && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
|
|
1982
|
+
}
|
|
1983
|
+
function isError2(value) {
|
|
1984
|
+
return value instanceof Error || Object.prototype.toString.call(value) === "[object Error]";
|
|
1985
|
+
}
|
|
1986
|
+
function toBool(value) {
|
|
1987
|
+
if (typeof value === "boolean") return value;
|
|
1988
|
+
if (typeof value === "number") return value !== 0;
|
|
1989
|
+
if (typeof value === "string") {
|
|
1990
|
+
value = value.trim().toLowerCase();
|
|
1991
|
+
if (value === "true") return true;
|
|
1992
|
+
if (value === "false") return false;
|
|
1993
|
+
}
|
|
1994
|
+
return Boolean(value);
|
|
1995
|
+
}
|
|
1996
|
+
var id_num = Math.floor(Math.random() * 1e4);
|
|
1997
|
+
var eval_num = 0;
|
|
1998
|
+
|
|
1682
1999
|
// .tmp/src/proptypes.jsx
|
|
1683
2000
|
function isNullOrUndefined(v) {
|
|
1684
2001
|
return v === null || v === void 0;
|
|
@@ -1690,6 +2007,17 @@ function defaultGetDisplayName(x) {
|
|
|
1690
2007
|
if (!x) return "Unknown";
|
|
1691
2008
|
return x.displayName || x.name || "Unknown";
|
|
1692
2009
|
}
|
|
2010
|
+
function isNode(x) {
|
|
2011
|
+
if (x === null || x === void 0) return true;
|
|
2012
|
+
if (x === false || x === true) return true;
|
|
2013
|
+
if (typeof x === "string" || typeof x === "number") return true;
|
|
2014
|
+
if (isValidComponent(x)) return true;
|
|
2015
|
+
if (Array.isArray(x)) return x.every(isNode);
|
|
2016
|
+
return false;
|
|
2017
|
+
}
|
|
2018
|
+
function isValidElementType(x) {
|
|
2019
|
+
return typeof x === "function" || typeof x === "string";
|
|
2020
|
+
}
|
|
1693
2021
|
function createPrimitiveValidator(typeCheck) {
|
|
1694
2022
|
const validator = function validate(props, propName, componentName, location, propFullName, secret) {
|
|
1695
2023
|
const value = props[propName];
|
|
@@ -1737,6 +2065,14 @@ function createPropTypes() {
|
|
|
1737
2065
|
PropTypes2.string.expectedType = "string";
|
|
1738
2066
|
PropTypes2.symbol = createPrimitiveValidator((v) => typeof v === "symbol");
|
|
1739
2067
|
PropTypes2.symbol.expectedType = "symbol";
|
|
2068
|
+
PropTypes2.component = createPrimitiveValidator((v) => isValidComponent(v));
|
|
2069
|
+
PropTypes2.component.expectedType = "component";
|
|
2070
|
+
PropTypes2.element = createPrimitiveValidator((v) => isValidComponent(v));
|
|
2071
|
+
PropTypes2.element.expectedType = "element";
|
|
2072
|
+
PropTypes2.node = createPrimitiveValidator((v) => isNode(v));
|
|
2073
|
+
PropTypes2.node.expectedType = "node";
|
|
2074
|
+
PropTypes2.elementType = createPrimitiveValidator((v) => isValidElementType(v));
|
|
2075
|
+
PropTypes2.elementType.expectedType = "elementType";
|
|
1740
2076
|
PropTypes2.oneOf = function oneOf(values) {
|
|
1741
2077
|
const allowed = Array.isArray(values) ? values : [];
|
|
1742
2078
|
const validator = function validateOneOf(props, propName, componentName, location, propFullName) {
|
|
@@ -1841,92 +2177,7 @@ function createPropTypes() {
|
|
|
1841
2177
|
}
|
|
1842
2178
|
return null;
|
|
1843
2179
|
};
|
|
1844
|
-
validator.isRequired = function validateObjectOfRequired(props, propName, componentName, location, propFullName) {
|
|
1845
|
-
if (isNullOrUndefined(props[propName])) {
|
|
1846
|
-
return new Error(
|
|
1847
|
-
`The ${location} \`${propFullName}\` is marked as required in \`${formatComponentName(componentName)}\`, but its value is \`${props[propName]}\`.`
|
|
1848
|
-
);
|
|
1849
|
-
}
|
|
1850
|
-
return validator(props, propName, componentName, location, propFullName);
|
|
1851
|
-
};
|
|
1852
|
-
return validator;
|
|
1853
|
-
};
|
|
1854
|
-
function makeShapeValidator(spec, { exact }) {
|
|
1855
|
-
const keys = spec ? Object.keys(spec) : [];
|
|
1856
|
-
const validator = function validateShapeLike(props, propName, componentName, location, propFullName) {
|
|
1857
|
-
const value = props[propName];
|
|
1858
|
-
const propIsMissing = isNullOrUndefined(value);
|
|
1859
|
-
if (propIsMissing) return null;
|
|
1860
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
1861
|
-
return new Error(
|
|
1862
|
-
`Invalid ${location} \`${propFullName}\` of type \`${typeof value}\` supplied to \`${formatComponentName(componentName)}\`, expected an object.`
|
|
1863
|
-
);
|
|
1864
|
-
}
|
|
1865
|
-
if (exact) {
|
|
1866
|
-
const valueKeys = Object.keys(value);
|
|
1867
|
-
for (let i2 = 0; i2 < valueKeys.length; i2++) {
|
|
1868
|
-
const k = valueKeys[i2];
|
|
1869
|
-
if (!Object.prototype.hasOwnProperty.call(spec, k)) {
|
|
1870
|
-
const keyPath = `${propFullName}.${k}`;
|
|
1871
|
-
return new Error(
|
|
1872
|
-
`Invalid ${location} \`${keyPath}\` supplied to \`${formatComponentName(componentName)}\`: extra key \`${k}\` is not allowed by exact().`
|
|
1873
|
-
);
|
|
1874
|
-
}
|
|
1875
|
-
}
|
|
1876
|
-
}
|
|
1877
|
-
for (let i2 = 0; i2 < keys.length; i2++) {
|
|
1878
|
-
const k = keys[i2];
|
|
1879
|
-
const specValidator = spec[k];
|
|
1880
|
-
const nestedVal = value[k];
|
|
1881
|
-
const nestedPath = `${propFullName}.${k}`;
|
|
1882
|
-
if (isNullOrUndefined(nestedVal)) {
|
|
1883
|
-
const err2 = specValidator(
|
|
1884
|
-
{ [propName]: nestedVal },
|
|
1885
|
-
propName,
|
|
1886
|
-
componentName,
|
|
1887
|
-
location,
|
|
1888
|
-
nestedPath
|
|
1889
|
-
);
|
|
1890
|
-
if (err2 !== null) return err2;
|
|
1891
|
-
continue;
|
|
1892
|
-
}
|
|
1893
|
-
const err = specValidator(
|
|
1894
|
-
{ [propName]: nestedVal },
|
|
1895
|
-
propName,
|
|
1896
|
-
componentName,
|
|
1897
|
-
location,
|
|
1898
|
-
nestedPath
|
|
1899
|
-
);
|
|
1900
|
-
if (err !== null) return err;
|
|
1901
|
-
}
|
|
1902
|
-
return null;
|
|
1903
|
-
};
|
|
1904
|
-
validator.isRequired = function validateShapeLikeRequired(props, propName, componentName, location, propFullName) {
|
|
1905
|
-
if (isNullOrUndefined(props[propName])) {
|
|
1906
|
-
return new Error(
|
|
1907
|
-
`The ${location} \`${propFullName}\` is marked as required in \`${formatComponentName(componentName)}\`, but its value is \`${props[propName]}\`.`
|
|
1908
|
-
);
|
|
1909
|
-
}
|
|
1910
|
-
return validator(props, propName, componentName, location, propFullName);
|
|
1911
|
-
};
|
|
1912
|
-
return validator;
|
|
1913
|
-
}
|
|
1914
|
-
PropTypes2.shape = function shape(spec) {
|
|
1915
|
-
return makeShapeValidator(spec, { exact: false });
|
|
1916
|
-
};
|
|
1917
|
-
PropTypes2.exact = function exact(spec) {
|
|
1918
|
-
return makeShapeValidator(spec, { exact: true });
|
|
1919
|
-
};
|
|
1920
|
-
PropTypes2.instanceOf = function instanceOf(ClassOrConstructor) {
|
|
1921
|
-
const validator = function validateInstanceOf(props, propName, componentName, location, propFullName) {
|
|
1922
|
-
const value = props[propName];
|
|
1923
|
-
if (isNullOrUndefined(value)) return null;
|
|
1924
|
-
if (value instanceof ClassOrConstructor) return null;
|
|
1925
|
-
return new Error(
|
|
1926
|
-
`Invalid ${location} \`${propFullName}\` supplied to \`${formatComponentName(componentName)}\`: expected instance of \`${defaultGetDisplayName(ClassOrConstructor)}\`.`
|
|
1927
|
-
);
|
|
1928
|
-
};
|
|
1929
|
-
validator.isRequired = function validateInstanceOfRequired(props, propName, componentName, location, propFullName) {
|
|
2180
|
+
validator.isRequired = function validateObjectOfRequired(props, propName, componentName, location, propFullName) {
|
|
1930
2181
|
if (isNullOrUndefined(props[propName])) {
|
|
1931
2182
|
return new Error(
|
|
1932
2183
|
`The ${location} \`${propFullName}\` is marked as required in \`${formatComponentName(componentName)}\`, but its value is \`${props[propName]}\`.`
|
|
@@ -1936,383 +2187,151 @@ function createPropTypes() {
|
|
|
1936
2187
|
};
|
|
1937
2188
|
return validator;
|
|
1938
2189
|
};
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
if (typeof validator !== "function") continue;
|
|
1950
|
-
const fullName = propKey;
|
|
1951
|
-
const err = validator(values || {}, propKey, component, location, fullName);
|
|
1952
|
-
if (err instanceof Error) {
|
|
1953
|
-
const cacheKey = `${component}|${location}|${propKey}|${err.message}`;
|
|
1954
|
-
if (warningCache.has(cacheKey)) continue;
|
|
1955
|
-
warningCache.add(cacheKey);
|
|
1956
|
-
if (typeof console !== "undefined" && console.error) {
|
|
1957
|
-
console.error(
|
|
1958
|
-
`Warning: Failed prop type: ${err.message}`
|
|
1959
|
-
);
|
|
1960
|
-
}
|
|
1961
|
-
}
|
|
1962
|
-
}
|
|
1963
|
-
};
|
|
1964
|
-
return PropTypes2;
|
|
1965
|
-
}
|
|
1966
|
-
var PropTypes = createPropTypes();
|
|
1967
|
-
|
|
1968
|
-
// .tmp/src/components.jsx
|
|
1969
|
-
var components_exports = {};
|
|
1970
|
-
__export(components_exports, {
|
|
1971
|
-
Component: () => Component,
|
|
1972
|
-
HTMLComponent: () => HTMLComponent,
|
|
1973
|
-
RootComponent: () => RootComponent,
|
|
1974
|
-
boolean_html_attributes_set: () => boolean_html_attributes_set,
|
|
1975
|
-
capture_events_set: () => capture_events_set,
|
|
1976
|
-
cloneComponent: () => cloneComponent,
|
|
1977
|
-
cloneElement: () => cloneElement,
|
|
1978
|
-
createComponent: () => createComponent2,
|
|
1979
|
-
createElement: () => createElement,
|
|
1980
|
-
createPortal: () => createPortal,
|
|
1981
|
-
createRoot: () => createRoot,
|
|
1982
|
-
current_component: () => current_component,
|
|
1983
|
-
effect_timeout: () => effect_timeout,
|
|
1984
|
-
events_set: () => events_set,
|
|
1985
|
-
insertion_effects: () => insertion_effects,
|
|
1986
|
-
layout_effects: () => layout_effects,
|
|
1987
|
-
length_css_attributes_set: () => length_css_attributes_set,
|
|
1988
|
-
memo: () => memo,
|
|
1989
|
-
passive_effects: () => passive_effects,
|
|
1990
|
-
processEffects: () => processEffects,
|
|
1991
|
-
render: () => render,
|
|
1992
|
-
roots: () => roots,
|
|
1993
|
-
special_attributes: () => special_attributes,
|
|
1994
|
-
update_cbs: () => update_cbs,
|
|
1995
|
-
update_interval_margin: () => update_interval_margin,
|
|
1996
|
-
update_set: () => update_set,
|
|
1997
|
-
update_timeout: () => update_timeout
|
|
1998
|
-
});
|
|
1999
|
-
|
|
2000
|
-
// .tmp/src/symbols.jsx
|
|
2001
|
-
var [
|
|
2002
|
-
CORE,
|
|
2003
|
-
COMPONENT,
|
|
2004
|
-
TEXT2,
|
|
2005
|
-
IS_ZOMBIE,
|
|
2006
|
-
IDX,
|
|
2007
|
-
CHILD_CLASS_ADDENDUM,
|
|
2008
|
-
MEMOIZED,
|
|
2009
|
-
LAZY,
|
|
2010
|
-
DUE,
|
|
2011
|
-
REPEAT,
|
|
2012
|
-
CLEARED,
|
|
2013
|
-
INTERVAL,
|
|
2014
|
-
CALLBACK,
|
|
2015
|
-
ARGS
|
|
2016
|
-
] = [
|
|
2017
|
-
/* @__PURE__ */ Symbol.for("LILACT:CORE"),
|
|
2018
|
-
/* @__PURE__ */ Symbol.for("LILACT:COMPONENT"),
|
|
2019
|
-
/* @__PURE__ */ Symbol.for("LILACT:TEXT"),
|
|
2020
|
-
/* @__PURE__ */ Symbol.for("LILACT:IS_ZOMBIE"),
|
|
2021
|
-
/* @__PURE__ */ Symbol.for("LILACT:IDX"),
|
|
2022
|
-
/* @__PURE__ */ Symbol.for("LILACT:CHILD_CLASS_ADDENDUM"),
|
|
2023
|
-
/* @__PURE__ */ Symbol.for("LILACT:MEMOIZED"),
|
|
2024
|
-
/* @__PURE__ */ Symbol.for("LILACT:LAZY"),
|
|
2025
|
-
/* @__PURE__ */ Symbol.for("LILACT:TIMERS:DUE"),
|
|
2026
|
-
/* @__PURE__ */ Symbol.for("LILACT:TIMERS:REPEAT"),
|
|
2027
|
-
/* @__PURE__ */ Symbol.for("LILACT:TIMERS:CLEARED"),
|
|
2028
|
-
/* @__PURE__ */ Symbol.for("LILACT:TIMERS:INTERVAL"),
|
|
2029
|
-
/* @__PURE__ */ Symbol.for("LILACT:TIMERS:CALLBACK"),
|
|
2030
|
-
/* @__PURE__ */ Symbol.for("LILACT:TIMERS:ARGS")
|
|
2031
|
-
];
|
|
2032
|
-
|
|
2033
|
-
// .tmp/src/misc.jsx
|
|
2034
|
-
var misc_exports = {};
|
|
2035
|
-
__export(misc_exports, {
|
|
2036
|
-
Children: () => Children,
|
|
2037
|
-
Fragment: () => Fragment2,
|
|
2038
|
-
Portal: () => Portal,
|
|
2039
|
-
deepEqual: () => deepEqual,
|
|
2040
|
-
eval_num: () => eval_num,
|
|
2041
|
-
findDOMNode: () => findDOMNode,
|
|
2042
|
-
forwardRef: () => forwardRef,
|
|
2043
|
-
getComponentByPointer: () => getComponentByPointer,
|
|
2044
|
-
id_num: () => id_num,
|
|
2045
|
-
isAsync: () => isAsync,
|
|
2046
|
-
isClass: () => isClass,
|
|
2047
|
-
isEmpty: () => isEmpty,
|
|
2048
|
-
isError: () => isError2,
|
|
2049
|
-
isThenable: () => isThenable,
|
|
2050
|
-
isValidComponent: () => isValidComponent,
|
|
2051
|
-
isValidElement: () => isValidElement,
|
|
2052
|
-
shallowEqual: () => shallowEqual,
|
|
2053
|
-
toBool: () => toBool
|
|
2054
|
-
});
|
|
2055
|
-
var typeOf = (input) => {
|
|
2056
|
-
const rawObject = Object.prototype.toString.call(input).toLowerCase();
|
|
2057
|
-
const typeOfRegex = /\[object (.*)]/g;
|
|
2058
|
-
const type = typeOfRegex.exec(rawObject)[1];
|
|
2059
|
-
return type;
|
|
2060
|
-
};
|
|
2061
|
-
var isValidComponent = (value) => {
|
|
2062
|
-
return value[CORE] !== void 0 || value[TEXT] !== void 0;
|
|
2063
|
-
};
|
|
2064
|
-
var isValidElement = isValidComponent;
|
|
2065
|
-
var findDOMNode = (component) => {
|
|
2066
|
-
var _a, _b;
|
|
2067
|
-
if (!((_b = (_a = component[CORE]) == null ? void 0 : _a.element) == null ? void 0 : _b.parentNode)) throw new Error("findDOMNode only works on mounted components.");
|
|
2068
|
-
return component[CORE].element;
|
|
2069
|
-
};
|
|
2070
|
-
function Fragment2({ children }) {
|
|
2071
|
-
return children;
|
|
2072
|
-
}
|
|
2073
|
-
Fragment2.displayName = "Fragment";
|
|
2074
|
-
function Portal({ children, view }) {
|
|
2075
|
-
this[CORE].portal = view;
|
|
2076
|
-
return children;
|
|
2077
|
-
}
|
|
2078
|
-
Portal.displayName = "Portal";
|
|
2079
|
-
var Children = {
|
|
2080
|
-
/**
|
|
2081
|
-
* @param {any} x
|
|
2082
|
-
* @returns {boolean}
|
|
2083
|
-
*/
|
|
2084
|
-
_isNil(x) {
|
|
2085
|
-
return x === null || x === void 0;
|
|
2086
|
-
},
|
|
2087
|
-
/**
|
|
2088
|
-
* Recursively flattens nested arrays into `out`, omitting null/undefined.
|
|
2089
|
-
* @param {Array<any>} out
|
|
2090
|
-
* @param {any} input
|
|
2091
|
-
*/
|
|
2092
|
-
_flattenInto(out, input) {
|
|
2093
|
-
if (this._isNil(input)) return;
|
|
2094
|
-
if (Array.isArray(input)) {
|
|
2095
|
-
for (const v of input) this._flattenInto(out, v);
|
|
2096
|
-
return;
|
|
2097
|
-
}
|
|
2098
|
-
out.push(input);
|
|
2099
|
-
},
|
|
2100
|
-
/**
|
|
2101
|
-
* Converts an iterable children collection into a flat array,
|
|
2102
|
-
* omitting `null`/`undefined`.
|
|
2103
|
-
*
|
|
2104
|
-
* @param {Iterable<any>} children
|
|
2105
|
-
* @returns {Array<any>}
|
|
2106
|
-
*/
|
|
2107
|
-
toArray(children) {
|
|
2108
|
-
const out = [];
|
|
2109
|
-
if (!children) return out;
|
|
2110
|
-
for (const item of children) {
|
|
2111
|
-
this._flattenInto(out, item);
|
|
2112
|
-
}
|
|
2113
|
-
return out;
|
|
2114
|
-
},
|
|
2115
|
-
/**
|
|
2116
|
-
* Returns the number of non-null/undefined children (after flattening).
|
|
2117
|
-
* @param {Iterable<any>} children
|
|
2118
|
-
* @returns {number}
|
|
2119
|
-
*/
|
|
2120
|
-
count(children) {
|
|
2121
|
-
return this.toArray(children).length;
|
|
2122
|
-
},
|
|
2123
|
-
/**
|
|
2124
|
-
* Returns the single child from a children collection (after flattening & omitting nil),
|
|
2125
|
-
* or throws if the remaining count is not exactly 1.
|
|
2126
|
-
*
|
|
2127
|
-
* @param {Iterable<any>} children
|
|
2128
|
-
* @returns {any}
|
|
2129
|
-
*/
|
|
2130
|
-
only(children) {
|
|
2131
|
-
const arr = this.toArray(children);
|
|
2132
|
-
if (arr.length !== 1) {
|
|
2133
|
-
throw new Error(
|
|
2134
|
-
arr.length === 0 ? "Expected exactly one child, but received none." : "Expected exactly one child, but received more than one."
|
|
2135
|
-
);
|
|
2136
|
-
}
|
|
2137
|
-
return arr[0];
|
|
2138
|
-
},
|
|
2139
|
-
/**
|
|
2140
|
-
* Maps over children (after flattening & omitting nil).
|
|
2141
|
-
*
|
|
2142
|
-
* @param {Iterable<any>} children
|
|
2143
|
-
* @param {(child:any, index:number)=>any} fn
|
|
2144
|
-
* @returns {Array<any>}
|
|
2145
|
-
*/
|
|
2146
|
-
map(children, fn) {
|
|
2147
|
-
const arr = this.toArray(children);
|
|
2148
|
-
const out = [];
|
|
2149
|
-
for (let i2 = 0; i2 < arr.length; i2++) out.push(fn(arr[i2], i2));
|
|
2150
|
-
return out;
|
|
2151
|
-
},
|
|
2152
|
-
/**
|
|
2153
|
-
* Iterates over children (after flattening & omitting nil).
|
|
2154
|
-
* @param {Iterable<any>} children
|
|
2155
|
-
* @param {(child:any, index:number)=>void} fn
|
|
2156
|
-
*/
|
|
2157
|
-
forEach(children, fn) {
|
|
2158
|
-
const arr = this.toArray(children);
|
|
2159
|
-
for (let i2 = 0; i2 < arr.length; i2++) fn(arr[i2], i2);
|
|
2160
|
-
},
|
|
2161
|
-
/**
|
|
2162
|
-
* Finds the first child for which predicate returns true.
|
|
2163
|
-
*
|
|
2164
|
-
* @param {Iterable<any>} children
|
|
2165
|
-
* @param {(child:any, index:number)=>boolean} predicate
|
|
2166
|
-
* @returns {any|undefined}
|
|
2167
|
-
*/
|
|
2168
|
-
find(children, predicate) {
|
|
2169
|
-
const arr = this.toArray(children);
|
|
2170
|
-
for (let i2 = 0; i2 < arr.length; i2++) {
|
|
2171
|
-
if (predicate(arr[i2], i2)) return arr[i2];
|
|
2172
|
-
}
|
|
2173
|
-
return void 0;
|
|
2174
|
-
},
|
|
2175
|
-
/**
|
|
2176
|
-
* Finds exactly one matching child.
|
|
2177
|
-
* Throws if matched count is not exactly 1.
|
|
2178
|
-
*
|
|
2179
|
-
* @param {Iterable<any>} children
|
|
2180
|
-
* @param {(child:any, index:number)=>boolean} predicate
|
|
2181
|
-
* @returns {any}
|
|
2182
|
-
*/
|
|
2183
|
-
pickOne(children, predicate) {
|
|
2184
|
-
const arr = this.toArray(children);
|
|
2185
|
-
let found;
|
|
2186
|
-
let matches = 0;
|
|
2187
|
-
for (let i2 = 0; i2 < arr.length; i2++) {
|
|
2188
|
-
if (predicate(arr[i2], i2)) {
|
|
2189
|
-
matches++;
|
|
2190
|
-
found = arr[i2];
|
|
2191
|
-
if (matches > 1) break;
|
|
2190
|
+
function makeShapeValidator(spec, { exact }) {
|
|
2191
|
+
const keys = spec ? Object.keys(spec) : [];
|
|
2192
|
+
const validator = function validateShapeLike(props, propName, componentName, location, propFullName) {
|
|
2193
|
+
const value = props[propName];
|
|
2194
|
+
const propIsMissing = isNullOrUndefined(value);
|
|
2195
|
+
if (propIsMissing) return null;
|
|
2196
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
2197
|
+
return new Error(
|
|
2198
|
+
`Invalid ${location} \`${propFullName}\` of type \`${typeof value}\` supplied to \`${formatComponentName(componentName)}\`, expected an object.`
|
|
2199
|
+
);
|
|
2192
2200
|
}
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2201
|
+
if (exact) {
|
|
2202
|
+
const valueKeys = Object.keys(value);
|
|
2203
|
+
for (let i2 = 0; i2 < valueKeys.length; i2++) {
|
|
2204
|
+
const k = valueKeys[i2];
|
|
2205
|
+
if (!Object.prototype.hasOwnProperty.call(spec, k)) {
|
|
2206
|
+
const keyPath = `${propFullName}.${k}`;
|
|
2207
|
+
return new Error(
|
|
2208
|
+
`Invalid ${location} \`${keyPath}\` supplied to \`${formatComponentName(componentName)}\`: extra key \`${k}\` is not allowed by exact().`
|
|
2209
|
+
);
|
|
2210
|
+
}
|
|
2211
|
+
}
|
|
2212
|
+
}
|
|
2213
|
+
for (let i2 = 0; i2 < keys.length; i2++) {
|
|
2214
|
+
const k = keys[i2];
|
|
2215
|
+
const specValidator = spec[k];
|
|
2216
|
+
const nestedVal = value[k];
|
|
2217
|
+
const nestedPath = `${propFullName}.${k}`;
|
|
2218
|
+
if (isNullOrUndefined(nestedVal)) {
|
|
2219
|
+
const err2 = specValidator(
|
|
2220
|
+
{ [propName]: nestedVal },
|
|
2221
|
+
propName,
|
|
2222
|
+
componentName,
|
|
2223
|
+
location,
|
|
2224
|
+
nestedPath
|
|
2225
|
+
);
|
|
2226
|
+
if (err2 !== null) return err2;
|
|
2227
|
+
continue;
|
|
2228
|
+
}
|
|
2229
|
+
const err = specValidator(
|
|
2230
|
+
{ [propName]: nestedVal },
|
|
2231
|
+
propName,
|
|
2232
|
+
componentName,
|
|
2233
|
+
location,
|
|
2234
|
+
nestedPath
|
|
2235
|
+
);
|
|
2236
|
+
if (err !== null) return err;
|
|
2237
|
+
}
|
|
2238
|
+
return null;
|
|
2239
|
+
};
|
|
2240
|
+
validator.isRequired = function validateShapeLikeRequired(props, propName, componentName, location, propFullName) {
|
|
2241
|
+
if (isNullOrUndefined(props[propName])) {
|
|
2242
|
+
return new Error(
|
|
2243
|
+
`The ${location} \`${propFullName}\` is marked as required in \`${formatComponentName(componentName)}\`, but its value is \`${props[propName]}\`.`
|
|
2244
|
+
);
|
|
2245
|
+
}
|
|
2246
|
+
return validator(props, propName, componentName, location, propFullName);
|
|
2247
|
+
};
|
|
2248
|
+
return validator;
|
|
2218
2249
|
}
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
const forwarded = function(props, ref) {
|
|
2222
|
-
return render2({ ...props, ref: void 0 }, ref);
|
|
2250
|
+
PropTypes2.shape = function shape(spec) {
|
|
2251
|
+
return makeShapeValidator(spec, { exact: false });
|
|
2223
2252
|
};
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
};
|
|
2227
|
-
function
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
if (typeOf(source) === "array") {
|
|
2270
|
-
if (source.length !== target.length) {
|
|
2271
|
-
return false;
|
|
2272
|
-
}
|
|
2273
|
-
return source.every((entry, index2) => deepEqual(entry, target[index2]));
|
|
2274
|
-
} else if (typeOf(source) === "object") {
|
|
2275
|
-
if (Object.keys(source).length !== Object.keys(target).length) {
|
|
2276
|
-
return false;
|
|
2253
|
+
PropTypes2.exact = function exact(spec) {
|
|
2254
|
+
return makeShapeValidator(spec, { exact: true });
|
|
2255
|
+
};
|
|
2256
|
+
PropTypes2.instanceOf = function instanceOf(ClassOrConstructor) {
|
|
2257
|
+
const validator = function validateInstanceOf(props, propName, componentName, location, propFullName) {
|
|
2258
|
+
const value = props[propName];
|
|
2259
|
+
if (isNullOrUndefined(value)) return null;
|
|
2260
|
+
if (value instanceof ClassOrConstructor) return null;
|
|
2261
|
+
return new Error(
|
|
2262
|
+
`Invalid ${location} \`${propFullName}\` supplied to \`${formatComponentName(componentName)}\`: expected instance of \`${defaultGetDisplayName(ClassOrConstructor)}\`.`
|
|
2263
|
+
);
|
|
2264
|
+
};
|
|
2265
|
+
validator.isRequired = function validateInstanceOfRequired(props, propName, componentName, location, propFullName) {
|
|
2266
|
+
if (isNullOrUndefined(props[propName])) {
|
|
2267
|
+
return new Error(
|
|
2268
|
+
`The ${location} \`${propFullName}\` is marked as required in \`${formatComponentName(componentName)}\`, but its value is \`${props[propName]}\`.`
|
|
2269
|
+
);
|
|
2270
|
+
}
|
|
2271
|
+
return validator(props, propName, componentName, location, propFullName);
|
|
2272
|
+
};
|
|
2273
|
+
return validator;
|
|
2274
|
+
};
|
|
2275
|
+
const warningCache = /* @__PURE__ */ new Set();
|
|
2276
|
+
PropTypes2.checkPropTypes = function checkPropTypes(typeSpecs, values, location, componentName) {
|
|
2277
|
+
if (false) return;
|
|
2278
|
+
if (!typeSpecs) return;
|
|
2279
|
+
const specs = typeSpecs;
|
|
2280
|
+
const component = formatComponentName(componentName);
|
|
2281
|
+
const typeSpecKeys = Object.keys(specs);
|
|
2282
|
+
for (let i2 = 0; i2 < typeSpecKeys.length; i2++) {
|
|
2283
|
+
const propKey = typeSpecKeys[i2];
|
|
2284
|
+
const validator = specs[propKey];
|
|
2285
|
+
if (typeof validator !== "function") continue;
|
|
2286
|
+
const fullName = propKey;
|
|
2287
|
+
const err = validator(values || {}, propKey, component, location, fullName);
|
|
2288
|
+
if (err instanceof Error) {
|
|
2289
|
+
const cacheKey = `${component}|${location}|${propKey}|${err.message}`;
|
|
2290
|
+
if (warningCache.has(cacheKey)) continue;
|
|
2291
|
+
warningCache.add(cacheKey);
|
|
2292
|
+
if (typeof console !== "undefined" && console.error) {
|
|
2293
|
+
console.error(
|
|
2294
|
+
`Warning: Failed prop type: ${err.message}`
|
|
2295
|
+
);
|
|
2296
|
+
}
|
|
2297
|
+
}
|
|
2277
2298
|
}
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
);
|
|
2281
|
-
} else if (typeOf(source) === "date") {
|
|
2282
|
-
return source.getTime() === target.getTime();
|
|
2283
|
-
}
|
|
2284
|
-
return source === target;
|
|
2285
|
-
}
|
|
2286
|
-
function isClass(value) {
|
|
2287
|
-
if (!(value && value.constructor === Function) || value.prototype === void 0)
|
|
2288
|
-
return false;
|
|
2289
|
-
if (Function.prototype !== Object.getPrototypeOf(value))
|
|
2290
|
-
return true;
|
|
2291
|
-
return Object.getOwnPropertyNames(value.prototype).length > 1;
|
|
2292
|
-
}
|
|
2293
|
-
function isAsync(value) {
|
|
2294
|
-
return typeof value === "function" && value.constructor && value.constructor.name === "AsyncFunction";
|
|
2295
|
-
}
|
|
2296
|
-
function isThenable(value) {
|
|
2297
|
-
return value && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
|
|
2298
|
-
}
|
|
2299
|
-
function isError2(value) {
|
|
2300
|
-
return value instanceof Error || Object.prototype.toString.call(value) === "[object Error]";
|
|
2301
|
-
}
|
|
2302
|
-
function toBool(value) {
|
|
2303
|
-
if (typeof value === "boolean") return value;
|
|
2304
|
-
if (typeof value === "number") return value !== 0;
|
|
2305
|
-
if (typeof value === "string") {
|
|
2306
|
-
value = value.trim().toLowerCase();
|
|
2307
|
-
if (value === "true") return true;
|
|
2308
|
-
if (value === "false") return false;
|
|
2309
|
-
}
|
|
2310
|
-
return Boolean(value);
|
|
2299
|
+
};
|
|
2300
|
+
return PropTypes2;
|
|
2311
2301
|
}
|
|
2312
|
-
var
|
|
2313
|
-
var eval_num = 0;
|
|
2302
|
+
var PropTypes = createPropTypes();
|
|
2314
2303
|
|
|
2315
2304
|
// .tmp/src/components.jsx
|
|
2305
|
+
var components_exports = {};
|
|
2306
|
+
__export(components_exports, {
|
|
2307
|
+
Component: () => Component,
|
|
2308
|
+
HTMLComponent: () => HTMLComponent,
|
|
2309
|
+
RootComponent: () => RootComponent,
|
|
2310
|
+
boolean_html_attributes_set: () => boolean_html_attributes_set,
|
|
2311
|
+
capture_events_set: () => capture_events_set,
|
|
2312
|
+
cloneComponent: () => cloneComponent,
|
|
2313
|
+
cloneElement: () => cloneElement,
|
|
2314
|
+
createComponent: () => createComponent2,
|
|
2315
|
+
createElement: () => createElement,
|
|
2316
|
+
createPortal: () => createPortal,
|
|
2317
|
+
createRoot: () => createRoot,
|
|
2318
|
+
current_component: () => current_component,
|
|
2319
|
+
effect_timeout: () => effect_timeout,
|
|
2320
|
+
events_set: () => events_set,
|
|
2321
|
+
insertion_effects: () => insertion_effects,
|
|
2322
|
+
layout_effects: () => layout_effects,
|
|
2323
|
+
length_css_attributes_set: () => length_css_attributes_set,
|
|
2324
|
+
memo: () => memo,
|
|
2325
|
+
passive_effects: () => passive_effects,
|
|
2326
|
+
processEffects: () => processEffects,
|
|
2327
|
+
render: () => render,
|
|
2328
|
+
roots: () => roots,
|
|
2329
|
+
special_attributes: () => special_attributes,
|
|
2330
|
+
update_cbs: () => update_cbs,
|
|
2331
|
+
update_interval_margin: () => update_interval_margin,
|
|
2332
|
+
update_set: () => update_set,
|
|
2333
|
+
update_timeout: () => update_timeout
|
|
2334
|
+
});
|
|
2316
2335
|
var ComponentCache = class {
|
|
2317
2336
|
constructor(owner) {
|
|
2318
2337
|
__publicField(this, "owner");
|
|
@@ -3047,7 +3066,7 @@ function createComponent2(entity, props = {}, ...children) {
|
|
|
3047
3066
|
}
|
|
3048
3067
|
props.key = generateComponentKey(entity, props);
|
|
3049
3068
|
props.children = children;
|
|
3050
|
-
return { entity, props };
|
|
3069
|
+
return { entity, props, [CORE]: null };
|
|
3051
3070
|
}
|
|
3052
3071
|
function createRoot(element) {
|
|
3053
3072
|
let root;
|
|
@@ -3074,7 +3093,7 @@ function createPortal(children, element) {
|
|
|
3074
3093
|
return createComponent2(lilact_default.Portal, { "view": element }, children);
|
|
3075
3094
|
}
|
|
3076
3095
|
function cloneComponent(component, propsPatch, ...children) {
|
|
3077
|
-
return { entity: component.entity, props: { ...component.props, ...propsPatch, children } };
|
|
3096
|
+
return { entity: component.entity, props: { ...component.props, ...propsPatch, children }, [CORE]: null };
|
|
3078
3097
|
}
|
|
3079
3098
|
var cloneElement = cloneComponent;
|
|
3080
3099
|
function render(component, element) {
|
|
@@ -3087,7 +3106,7 @@ function memo(component) {
|
|
|
3087
3106
|
if (typeof component === "object") {
|
|
3088
3107
|
component[MEMOIZED] = true;
|
|
3089
3108
|
} else {
|
|
3090
|
-
component = { component, [MEMOIZED]: true };
|
|
3109
|
+
component = { component, [MEMOIZED]: true, [CORE]: null };
|
|
3091
3110
|
}
|
|
3092
3111
|
return component;
|
|
3093
3112
|
}
|
|
@@ -3612,9 +3631,16 @@ function run(jsx, path = `InlineJSX-${++lilact_default.eval_num}`, is_inline = t
|
|
|
3612
3631
|
throw e;
|
|
3613
3632
|
}
|
|
3614
3633
|
}
|
|
3615
|
-
function require2(path2
|
|
3616
|
-
var _a, _b;
|
|
3617
|
-
|
|
3634
|
+
function require2(path2) {
|
|
3635
|
+
var _a, _b, _c, _d, _e, _f;
|
|
3636
|
+
let forceUpdate, checkExport, requirer, isLazy;
|
|
3637
|
+
if (arguments.length === 2 && typeof (arguments[1] === "object")) {
|
|
3638
|
+
forceUpdate = (_a = arguments[1]) == null ? void 0 : _a.forceUpdate;
|
|
3639
|
+
checkExport = (_b = arguments[1]) == null ? void 0 : _b.checkExport;
|
|
3640
|
+
requirer = (_c = arguments[1]) == null ? void 0 : _c.requirer;
|
|
3641
|
+
isLazy = (_d = arguments[1]) == null ? void 0 : _d.isLazy;
|
|
3642
|
+
}
|
|
3643
|
+
if ((_e = lilact_default.importObjectPaths) == null ? void 0 : _e[path2]) return lilact_default.importObjectPaths[path2];
|
|
3618
3644
|
if (required_scripts[path2] && !forceUpdate) return required_scripts[path2].exports;
|
|
3619
3645
|
if (path2[0] === "#") {
|
|
3620
3646
|
const el = document.getElementById(path2);
|
|
@@ -3625,7 +3651,7 @@ function require2(path2, { forceUpdate, checkExport, requirer, isLazy }) {
|
|
|
3625
3651
|
if (requirer && requirer.path) {
|
|
3626
3652
|
path2 = joinPaths(requirer.path, path2);
|
|
3627
3653
|
}
|
|
3628
|
-
if (((
|
|
3654
|
+
if (((_f = lilact_default) == null ? void 0 : _f[LAZY]) || isLazy) {
|
|
3629
3655
|
lilact_default[LAZY] = false;
|
|
3630
3656
|
return fetch(path2).then((res2) => {
|
|
3631
3657
|
if (!res2.ok) throw new Error(`HTTP ${res2.status}`);
|
|
@@ -6398,7 +6424,7 @@ function transpileJSX(jsx2, {
|
|
|
6398
6424
|
|
|
6399
6425
|
// .tmp/src/lilact.jsx
|
|
6400
6426
|
var Lilact2 = {
|
|
6401
|
-
VERSION: "
|
|
6427
|
+
VERSION: "RC.1",
|
|
6402
6428
|
// Configuration
|
|
6403
6429
|
defaultTransitionTimeout: 300,
|
|
6404
6430
|
defaultIsEqual: Object.is,
|