react-changes
Advanced tools
Comparing version 0.0.12 to 0.0.13
@@ -1,2 +0,2 @@ | ||
import We, { createContext as fr, useContext as dr, useState as ce, useRef as Ie } from "react"; | ||
import We, { createContext as fr, useContext as dr, useState as ce, useRef as Ie, useMemo as vr } from "react"; | ||
var fe = { exports: {} }, q = {}; | ||
@@ -13,18 +13,18 @@ /** | ||
var Ve; | ||
function vr() { | ||
function pr() { | ||
if (Ve) | ||
return q; | ||
Ve = 1; | ||
var y = We, R = Symbol.for("react.element"), w = Symbol.for("react.fragment"), h = Object.prototype.hasOwnProperty, E = y.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, d = { key: !0, ref: !0, __self: !0, __source: !0 }; | ||
function c(b, u, P) { | ||
var g, S = {}, x = null, A = null; | ||
P !== void 0 && (x = "" + P), u.key !== void 0 && (x = "" + u.key), u.ref !== void 0 && (A = u.ref); | ||
for (g in u) | ||
h.call(u, g) && !d.hasOwnProperty(g) && (S[g] = u[g]); | ||
if (b && b.defaultProps) | ||
for (g in u = b.defaultProps, u) | ||
S[g] === void 0 && (S[g] = u[g]); | ||
return { $$typeof: R, type: b, key: x, ref: A, props: S, _owner: E.current }; | ||
var b = We, R = Symbol.for("react.element"), w = Symbol.for("react.fragment"), p = Object.prototype.hasOwnProperty, y = b.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, f = { key: !0, ref: !0, __self: !0, __source: !0 }; | ||
function d(g, u, O) { | ||
var m, S = {}, x = null, A = null; | ||
O !== void 0 && (x = "" + O), u.key !== void 0 && (x = "" + u.key), u.ref !== void 0 && (A = u.ref); | ||
for (m in u) | ||
p.call(u, m) && !f.hasOwnProperty(m) && (S[m] = u[m]); | ||
if (g && g.defaultProps) | ||
for (m in u = g.defaultProps, u) | ||
S[m] === void 0 && (S[m] = u[m]); | ||
return { $$typeof: R, type: g, key: x, ref: A, props: S, _owner: y.current }; | ||
} | ||
return q.Fragment = w, q.jsx = c, q.jsxs = c, q; | ||
return q.Fragment = w, q.jsx = d, q.jsxs = d, q; | ||
} | ||
@@ -42,5 +42,5 @@ var J = {}; | ||
var $e; | ||
function pr() { | ||
function gr() { | ||
return $e || ($e = 1, process.env.NODE_ENV !== "production" && function() { | ||
var y = We, R = Symbol.for("react.element"), w = Symbol.for("react.portal"), h = Symbol.for("react.fragment"), E = Symbol.for("react.strict_mode"), d = Symbol.for("react.profiler"), c = Symbol.for("react.provider"), b = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), P = Symbol.for("react.suspense"), g = Symbol.for("react.suspense_list"), S = Symbol.for("react.memo"), x = Symbol.for("react.lazy"), A = Symbol.for("react.offscreen"), U = Symbol.iterator, W = "@@iterator"; | ||
var b = We, R = Symbol.for("react.element"), w = Symbol.for("react.portal"), p = Symbol.for("react.fragment"), y = Symbol.for("react.strict_mode"), f = Symbol.for("react.profiler"), d = Symbol.for("react.provider"), g = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), O = Symbol.for("react.suspense"), m = Symbol.for("react.suspense_list"), S = Symbol.for("react.memo"), x = Symbol.for("react.lazy"), A = Symbol.for("react.offscreen"), U = Symbol.iterator, W = "@@iterator"; | ||
function j(e) { | ||
@@ -52,4 +52,4 @@ if (e === null || typeof e != "object") | ||
} | ||
var k = y.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; | ||
function p(e) { | ||
var k = b.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; | ||
function h(e) { | ||
{ | ||
@@ -74,3 +74,3 @@ for (var r = arguments.length, t = new Array(r > 1 ? r - 1 : 0), n = 1; n < r; n++) | ||
function V(e) { | ||
return !!(typeof e == "string" || typeof e == "function" || e === h || e === d || C || e === E || e === P || e === g || v || e === A || Y || K || _ || typeof e == "object" && e !== null && (e.$$typeof === x || e.$$typeof === S || e.$$typeof === c || e.$$typeof === b || e.$$typeof === u || // This needs to include all possible module reference object | ||
return !!(typeof e == "string" || typeof e == "function" || e === p || e === f || C || e === y || e === O || e === m || v || e === A || Y || K || _ || typeof e == "object" && e !== null && (e.$$typeof === x || e.$$typeof === S || e.$$typeof === d || e.$$typeof === g || e.$$typeof === u || // This needs to include all possible module reference object | ||
// types supported by any Flight configuration anywhere since | ||
@@ -94,3 +94,3 @@ // we don't know which Flight build this will end up being used | ||
return null; | ||
if (typeof e.tag == "number" && p("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function") | ||
if (typeof e.tag == "number" && h("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function") | ||
return e.displayName || e.name || null; | ||
@@ -100,13 +100,13 @@ if (typeof e == "string") | ||
switch (e) { | ||
case h: | ||
case p: | ||
return "Fragment"; | ||
case w: | ||
return "Portal"; | ||
case d: | ||
case f: | ||
return "Profiler"; | ||
case E: | ||
case y: | ||
return "StrictMode"; | ||
case P: | ||
case O: | ||
return "Suspense"; | ||
case g: | ||
case m: | ||
return "SuspenseList"; | ||
@@ -116,6 +116,6 @@ } | ||
switch (e.$$typeof) { | ||
case b: | ||
case g: | ||
var r = e; | ||
return G(r) + ".Consumer"; | ||
case c: | ||
case d: | ||
var t = e; | ||
@@ -139,14 +139,14 @@ return G(t._context) + ".Provider"; | ||
} | ||
var $ = Object.assign, B = 0, ve, pe, he, be, ge, ye, Ee; | ||
function me() { | ||
var $ = Object.assign, B = 0, ve, pe, ge, he, be, ye, me; | ||
function Ee() { | ||
} | ||
me.__reactDisabledLog = !0; | ||
Ee.__reactDisabledLog = !0; | ||
function Le() { | ||
{ | ||
if (B === 0) { | ||
ve = console.log, pe = console.info, he = console.warn, be = console.error, ge = console.group, ye = console.groupCollapsed, Ee = console.groupEnd; | ||
ve = console.log, pe = console.info, ge = console.warn, he = console.error, be = console.group, ye = console.groupCollapsed, me = console.groupEnd; | ||
var e = { | ||
configurable: !0, | ||
enumerable: !0, | ||
value: me, | ||
value: Ee, | ||
writable: !0 | ||
@@ -167,3 +167,3 @@ }; | ||
} | ||
function Ne() { | ||
function Me() { | ||
{ | ||
@@ -184,9 +184,9 @@ if (B--, B === 0) { | ||
warn: $({}, e, { | ||
value: he | ||
value: ge | ||
}), | ||
error: $({}, e, { | ||
value: be | ||
value: he | ||
}), | ||
group: $({}, e, { | ||
value: ge | ||
value: be | ||
}), | ||
@@ -197,7 +197,7 @@ groupCollapsed: $({}, e, { | ||
groupEnd: $({}, e, { | ||
value: Ee | ||
value: me | ||
}) | ||
}); | ||
} | ||
B < 0 && p("disabledDepth fell below zero. This is a bug in React. Please file an issue."); | ||
B < 0 && h("disabledDepth fell below zero. This is a bug in React. Please file an issue."); | ||
} | ||
@@ -221,4 +221,4 @@ } | ||
{ | ||
var Me = typeof WeakMap == "function" ? WeakMap : Map; | ||
Z = new Me(); | ||
var Ne = typeof WeakMap == "function" ? WeakMap : Map; | ||
Z = new Ne(); | ||
} | ||
@@ -274,10 +274,10 @@ function Re(e, r) { | ||
for (var a = F.stack.split(` | ||
`), m = n.stack.split(` | ||
`), l = a.length - 1, f = m.length - 1; l >= 1 && f >= 0 && a[l] !== m[f]; ) | ||
f--; | ||
for (; l >= 1 && f >= 0; l--, f--) | ||
if (a[l] !== m[f]) { | ||
if (l !== 1 || f !== 1) | ||
`), E = n.stack.split(` | ||
`), l = a.length - 1, c = E.length - 1; l >= 1 && c >= 0 && a[l] !== E[c]; ) | ||
c--; | ||
for (; l >= 1 && c >= 0; l--, c--) | ||
if (a[l] !== E[c]) { | ||
if (l !== 1 || c !== 1) | ||
do | ||
if (l--, f--, f < 0 || a[l] !== m[f]) { | ||
if (l--, c--, c < 0 || a[l] !== E[c]) { | ||
var T = ` | ||
@@ -287,3 +287,3 @@ ` + a[l].replace(" at new ", " at "); | ||
} | ||
while (l >= 1 && f >= 0); | ||
while (l >= 1 && c >= 0); | ||
break; | ||
@@ -293,5 +293,5 @@ } | ||
} finally { | ||
ae = !1, te.current = s, Ne(), Error.prepareStackTrace = i; | ||
ae = !1, te.current = s, Me(), Error.prepareStackTrace = i; | ||
} | ||
var M = e ? e.displayName || e.name : "", Ae = M ? X(M) : ""; | ||
var N = e ? e.displayName || e.name : "", Ae = N ? X(N) : ""; | ||
return typeof e == "function" && Z.set(e, Ae), Ae; | ||
@@ -314,5 +314,5 @@ } | ||
switch (e) { | ||
case P: | ||
case O: | ||
return X("Suspense"); | ||
case g: | ||
case m: | ||
return X("SuspenseList"); | ||
@@ -352,4 +352,4 @@ } | ||
if (typeof e[o] != "function") { | ||
var m = Error((n || "React class") + ": " + t + " type `" + o + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[o] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."); | ||
throw m.name = "Invariant Violation", m; | ||
var E = Error((n || "React class") + ": " + t + " type `" + o + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[o] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."); | ||
throw E.name = "Invariant Violation", E; | ||
} | ||
@@ -360,3 +360,3 @@ a = e[o](r, o, n, t, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"); | ||
} | ||
a && !(a instanceof Error) && (re(i), p("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", n || "React class", t, o, typeof a), re(null)), a instanceof Error && !(a.message in _e) && (_e[a.message] = !0, re(i), p("Failed %s type: %s", t, a.message), re(null)); | ||
a && !(a instanceof Error) && (re(i), h("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", n || "React class", t, o, typeof a), re(null)), a instanceof Error && !(a.message in _e) && (_e[a.message] = !0, re(i), h("Failed %s type: %s", t, a.message), re(null)); | ||
} | ||
@@ -387,3 +387,3 @@ } | ||
if (Je(e)) | ||
return p("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", qe(e)), Ce(e); | ||
return h("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", qe(e)), Ce(e); | ||
} | ||
@@ -416,3 +416,3 @@ var H = k.ReactCurrentOwner, ze = { | ||
var t = D(H.current.type); | ||
ie[t] || (p('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', D(H.current.type), e.ref), ie[t] = !0); | ||
ie[t] || (h('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', D(H.current.type), e.ref), ie[t] = !0); | ||
} | ||
@@ -423,3 +423,3 @@ } | ||
var t = function() { | ||
we || (we = !0, p("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r)); | ||
we || (we = !0, h("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r)); | ||
}; | ||
@@ -435,3 +435,3 @@ t.isReactWarning = !0, Object.defineProperty(e, "key", { | ||
var t = function() { | ||
xe || (xe = !0, p("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r)); | ||
xe || (xe = !0, h("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r)); | ||
}; | ||
@@ -475,4 +475,4 @@ t.isReactWarning = !0, Object.defineProperty(e, "ref", { | ||
{ | ||
var s, o = {}, a = null, m = null; | ||
t !== void 0 && (Te(t), a = "" + t), Xe(r) && (Te(r.key), a = "" + r.key), Ke(r) && (m = r.ref, Ze(r, i)); | ||
var s, o = {}, a = null, E = null; | ||
t !== void 0 && (Te(t), a = "" + t), Xe(r) && (Te(r.key), a = "" + r.key), Ke(r) && (E = r.ref, Ze(r, i)); | ||
for (s in r) | ||
@@ -485,16 +485,16 @@ ee.call(r, s) && !ze.hasOwnProperty(s) && (o[s] = r[s]); | ||
} | ||
if (a || m) { | ||
var f = typeof e == "function" ? e.displayName || e.name || "Unknown" : e; | ||
a && Qe(o, f), m && er(o, f); | ||
if (a || E) { | ||
var c = typeof e == "function" ? e.displayName || e.name || "Unknown" : e; | ||
a && Qe(o, c), E && er(o, c); | ||
} | ||
return rr(e, a, m, i, n, H.current, o); | ||
return rr(e, a, E, i, n, H.current, o); | ||
} | ||
} | ||
var se = k.ReactCurrentOwner, Oe = k.ReactDebugCurrentFrame; | ||
function N(e) { | ||
var se = k.ReactCurrentOwner, Pe = k.ReactDebugCurrentFrame; | ||
function M(e) { | ||
if (e) { | ||
var r = e._owner, t = Q(e.type, e._source, r ? r.type : null); | ||
Oe.setExtraStackFrame(t); | ||
Pe.setExtraStackFrame(t); | ||
} else | ||
Oe.setExtraStackFrame(null); | ||
Pe.setExtraStackFrame(null); | ||
} | ||
@@ -506,3 +506,3 @@ var ue; | ||
} | ||
function Pe() { | ||
function Oe() { | ||
{ | ||
@@ -533,3 +533,3 @@ if (se.current) { | ||
{ | ||
var r = Pe(); | ||
var r = Oe(); | ||
if (!r) { | ||
@@ -554,3 +554,3 @@ var t = typeof e == "string" ? e : e.displayName || e.name; | ||
var n = ""; | ||
e && e._owner && e._owner !== se.current && (n = " It was passed a child from " + D(e._owner.type) + "."), N(e), p('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', t, n), N(null); | ||
e && e._owner && e._owner !== se.current && (n = " It was passed a child from " + D(e._owner.type) + "."), M(e), h('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', t, n), M(null); | ||
} | ||
@@ -597,5 +597,5 @@ } | ||
var i = D(r); | ||
p("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", i || "Unknown"); | ||
h("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", i || "Unknown"); | ||
} | ||
typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && p("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead."); | ||
typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && h("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead."); | ||
} | ||
@@ -608,7 +608,7 @@ } | ||
if (n !== "children" && n !== "key") { | ||
N(e), p("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", n), N(null); | ||
M(e), h("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", n), M(null); | ||
break; | ||
} | ||
} | ||
e.ref !== null && (N(e), p("Invalid attribute `ref` supplied to `React.Fragment`."), N(null)); | ||
e.ref !== null && (M(e), h("Invalid attribute `ref` supplied to `React.Fragment`."), M(null)); | ||
} | ||
@@ -622,10 +622,10 @@ } | ||
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (a += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."); | ||
var m = nr(i); | ||
m ? a += m : a += Pe(); | ||
var E = nr(i); | ||
E ? a += E : a += Oe(); | ||
var l; | ||
e === null ? l = "null" : oe(e) ? l = "array" : e !== void 0 && e.$$typeof === R ? (l = "<" + (D(e.type) || "Unknown") + " />", a = " Did you accidentally export a JSX literal instead of a component?") : l = typeof e, p("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", l, a); | ||
e === null ? l = "null" : oe(e) ? l = "array" : e !== void 0 && e.$$typeof === R ? (l = "<" + (D(e.type) || "Unknown") + " />", a = " Did you accidentally export a JSX literal instead of a component?") : l = typeof e, h("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", l, a); | ||
} | ||
var f = tr(e, r, t, i, s); | ||
if (f == null) | ||
return f; | ||
var c = tr(e, r, t, i, s); | ||
if (c == null) | ||
return c; | ||
if (o) { | ||
@@ -636,11 +636,11 @@ var T = r.children; | ||
if (oe(T)) { | ||
for (var M = 0; M < T.length; M++) | ||
De(T[M], e); | ||
for (var N = 0; N < T.length; N++) | ||
De(T[N], e); | ||
Object.freeze && Object.freeze(T); | ||
} else | ||
p("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."); | ||
h("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."); | ||
else | ||
De(T, e); | ||
} | ||
return e === h ? ir(f) : or(f), f; | ||
return e === p ? ir(c) : or(c), c; | ||
} | ||
@@ -655,20 +655,20 @@ } | ||
var lr = ur, cr = sr; | ||
J.Fragment = h, J.jsx = lr, J.jsxs = cr; | ||
J.Fragment = p, J.jsx = lr, J.jsxs = cr; | ||
}()), J; | ||
} | ||
process.env.NODE_ENV === "production" ? fe.exports = vr() : fe.exports = pr(); | ||
var O = fe.exports; | ||
process.env.NODE_ENV === "production" ? fe.exports = pr() : fe.exports = gr(); | ||
var P = fe.exports; | ||
const Ye = fr(null), de = () => { | ||
const y = dr(Ye); | ||
if (!y) | ||
const b = dr(Ye); | ||
if (!b) | ||
throw new Error("useGlobalState must be used within a GlobalStateProvider"); | ||
return y; | ||
return b; | ||
}, hr = ({ | ||
children: y, | ||
children: b, | ||
debug: R = !1, | ||
controls: w = !1 | ||
}) => { | ||
const [h, E] = ce({}), [d, c] = ce([]), [b, u] = ce(0), P = (_, v = !0) => { | ||
const C = { ...h, ..._ }; | ||
if (E(C), v) { | ||
const [p, y] = ce({}), [f, d] = ce([]), [g, u] = ce(0), O = (_, v = !0) => { | ||
const C = { ...p, ..._ }; | ||
if (y(C), v) { | ||
const I = { | ||
@@ -678,22 +678,22 @@ ...C, | ||
}; | ||
c([ | ||
...d.slice(0, b + 1), | ||
d([ | ||
...f.slice(0, g + 1), | ||
I | ||
]), u(b + 1); | ||
]), u(g + 1); | ||
} | ||
}, g = (_) => { | ||
let v = h; | ||
}, m = (_) => { | ||
let v = p; | ||
return _.split(".").forEach((C) => v = v == null ? void 0 : v[C]), v; | ||
}, S = (_, v) => { | ||
const C = _.split("."), I = { ...h }; | ||
const C = _.split("."), I = { ...p }; | ||
let V = I; | ||
C.forEach((L, G) => { | ||
!V.hasOwnProperty(L) && G < C.length - 1 && (V[L] = {}), G === C.length - 1 ? V[L] = v : V = V[L]; | ||
}), P(I); | ||
}), O(I); | ||
}, x = () => { | ||
b > 0 && (u(b - 1), E(d[b - 1])); | ||
g > 0 && (u(g - 1), y(f[g - 1])); | ||
}, A = () => { | ||
b < d.length - 1 && (u(b + 1), E(d[b + 1])); | ||
g < f.length - 1 && (u(g + 1), y(f[g + 1])); | ||
}, U = () => { | ||
c([]), u(0); | ||
d([]), u(0); | ||
}, W = Ie(!1), j = Ie(null), k = (_ = 100) => { | ||
@@ -703,14 +703,14 @@ j.current !== null && clearInterval(j.current); | ||
W.current = !0, j.current = setInterval(() => { | ||
W.current && v < d.length ? (E(d[v]), v++) : (j.current && clearInterval(j.current), W.current = !1); | ||
W.current && v < f.length ? (y(f[v]), v++) : (j.current && clearInterval(j.current), W.current = !1); | ||
}, _); | ||
}, p = () => { | ||
}, h = () => { | ||
W.current = !1, j.current !== null && clearInterval(j.current); | ||
}, z = () => d.map((_) => ({ ..._ })), Y = (_) => { | ||
const v = d.findIndex((C) => C._id === _); | ||
v !== -1 && (u(v), E(d[v])); | ||
}, z = () => f.map((_) => ({ ..._ })), Y = (_) => { | ||
const v = f.findIndex((C) => C._id === _); | ||
v !== -1 && (u(v), y(f[v])); | ||
}, K = { | ||
globalState: h, | ||
updateGlobalState: P, | ||
getState: g, | ||
get: g, | ||
globalState: p, | ||
updateGlobalState: O, | ||
getState: m, | ||
get: m, | ||
setState: S, | ||
@@ -730,29 +730,34 @@ set: S, | ||
load: Y, | ||
stopHistory: p, | ||
stop: p, | ||
stopHistory: h, | ||
stop: h, | ||
seekVersion: Y, | ||
seek: Y | ||
}; | ||
return R && (window.gs = K), /* @__PURE__ */ O.jsxs(Ye.Provider, { value: K, children: [ | ||
y, | ||
w && /* @__PURE__ */ O.jsx(br, {}) | ||
return R && (window.gs = K), /* @__PURE__ */ P.jsxs(Ye.Provider, { value: K, children: [ | ||
b, | ||
w && /* @__PURE__ */ P.jsx(br, {}) | ||
] }); | ||
}, yr = (y, R = null) => { | ||
const { getState: w, setState: h } = de(); | ||
return [w(y) || R, (c) => { | ||
h(y, c); | ||
}; | ||
function mr(...b) { | ||
const { getState: R, setState: w } = de(), [p, y] = b.length === 2 ? b : [g(), b[0]]; | ||
return [R(p) || y, (u) => { | ||
w(p, u); | ||
}]; | ||
}, Er = () => { | ||
const { undo: y, redo: R, play: w, stop: h, clear: E, versions: d, seek: c } = de(); | ||
function g() { | ||
return vr(() => "~" + Math.random().toString(36).substring(2, 15), []); | ||
} | ||
} | ||
const Er = () => { | ||
const { undo: b, redo: R, play: w, stop: p, clear: y, versions: f, seek: d } = de(); | ||
return { | ||
undo: y, | ||
undo: b, | ||
redo: R, | ||
play: w, | ||
stop: h, | ||
clear: E, | ||
versions: d, | ||
seek: c | ||
stop: p, | ||
clear: y, | ||
versions: f, | ||
seek: d | ||
}; | ||
}, br = () => { | ||
const { undo: y, redo: R, play: w, stop: h, clear: E, versions: d } = de(), c = { | ||
const { undo: b, redo: R, play: w, stop: p, clear: y, versions: f } = de(), d = { | ||
container: { | ||
@@ -770,22 +775,22 @@ backgroundColor: "#333", | ||
}; | ||
return /* @__PURE__ */ O.jsxs("div", { style: c.container, children: [ | ||
/* @__PURE__ */ O.jsx("button", { style: c.action, onClick: () => y(), children: "↩️ Undo" }), | ||
/* @__PURE__ */ O.jsxs("button", { style: c.action, onClick: () => R(), children: [ | ||
/* @__PURE__ */ O.jsx("span", { style: { transform: "scaleX(-1)" }, children: "↩️" }), | ||
return /* @__PURE__ */ P.jsxs("div", { style: d.container, children: [ | ||
/* @__PURE__ */ P.jsx("button", { style: d.action, onClick: () => b(), children: "↩️ Undo" }), | ||
/* @__PURE__ */ P.jsxs("button", { style: d.action, onClick: () => R(), children: [ | ||
/* @__PURE__ */ P.jsx("span", { style: { transform: "scaleX(-1)" }, children: "↩️" }), | ||
" Redo" | ||
] }), | ||
/* @__PURE__ */ O.jsx("button", { style: c.action, onClick: () => w(), children: "▶️ Play" }), | ||
/* @__PURE__ */ O.jsx("button", { style: c.action, onClick: () => h(), children: "⏹️ Stop" }), | ||
/* @__PURE__ */ O.jsx("button", { style: c.action, onClick: () => E(), children: "🚮 Clear" }), | ||
/* @__PURE__ */ O.jsx("button", { style: c.action, onClick: () => console.log(d()), children: "📁 Versions" }) | ||
/* @__PURE__ */ P.jsx("button", { style: d.action, onClick: () => w(), children: "▶️ Play" }), | ||
/* @__PURE__ */ P.jsx("button", { style: d.action, onClick: () => p(), children: "⏹️ Stop" }), | ||
/* @__PURE__ */ P.jsx("button", { style: d.action, onClick: () => y(), children: "🚮 Clear" }), | ||
/* @__PURE__ */ P.jsx("button", { style: d.action, onClick: () => console.log(f()), children: "📁 Versions" }) | ||
] }); | ||
}, mr = hr; | ||
}, Rr = hr; | ||
console.log("React-Changes Has Loaded"); | ||
export { | ||
mr as Earth, | ||
br as EarthControls, | ||
Rr as Changes, | ||
hr as GlobalStateProvider, | ||
yr as useEarth, | ||
Er as useEarthControls, | ||
br as PlayerControls, | ||
mr as useChange, | ||
Er as useChangeControls, | ||
de as useGlobalState | ||
}; |
@@ -1,2 +0,2 @@ | ||
(function(C,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],m):(C=typeof globalThis<"u"?globalThis:C||self,m(C["react-changes"]={},C.React))})(this,function(C,m){"use strict";var oe={exports:{}},H={};/** | ||
(function(C,E){typeof exports=="object"&&typeof module<"u"?E(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],E):(C=typeof globalThis<"u"?globalThis:C||self,E(C["react-changes"]={},C.React))})(this,function(C,E){"use strict";var oe={exports:{}},H={};/** | ||
* @license React | ||
@@ -9,3 +9,3 @@ * react-jsx-runtime.production.min.js | ||
* LICENSE file in the root directory of this source tree. | ||
*/var pe;function Ne(){if(pe)return H;pe=1;var y=m,_=Symbol.for("react.element"),O=Symbol.for("react.fragment"),h=Object.prototype.hasOwnProperty,E=y.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,d={key:!0,ref:!0,__self:!0,__source:!0};function c(b,u,k){var g,T={},j=null,V=null;k!==void 0&&(j=""+k),u.key!==void 0&&(j=""+u.key),u.ref!==void 0&&(V=u.ref);for(g in u)h.call(u,g)&&!d.hasOwnProperty(g)&&(T[g]=u[g]);if(b&&b.defaultProps)for(g in u=b.defaultProps,u)T[g]===void 0&&(T[g]=u[g]);return{$$typeof:_,type:b,key:j,ref:V,props:T,_owner:E.current}}return H.Fragment=O,H.jsx=c,H.jsxs=c,H}var J={};/** | ||
*/var pe;function Ne(){if(pe)return H;pe=1;var b=E,_=Symbol.for("react.element"),O=Symbol.for("react.fragment"),p=Object.prototype.hasOwnProperty,y=b.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,f={key:!0,ref:!0,__self:!0,__source:!0};function d(h,u,k){var m,T={},j=null,V=null;k!==void 0&&(j=""+k),u.key!==void 0&&(j=""+u.key),u.ref!==void 0&&(V=u.ref);for(m in u)p.call(u,m)&&!f.hasOwnProperty(m)&&(T[m]=u[m]);if(h&&h.defaultProps)for(m in u=h.defaultProps,u)T[m]===void 0&&(T[m]=u[m]);return{$$typeof:_,type:h,key:j,ref:V,props:T,_owner:y.current}}return H.Fragment=O,H.jsx=d,H.jsxs=d,H}var J={};/** | ||
* @license React | ||
@@ -18,7 +18,7 @@ * react-jsx-runtime.development.js | ||
* LICENSE file in the root directory of this source tree. | ||
*/var he;function Ue(){return he||(he=1,process.env.NODE_ENV!=="production"&&function(){var y=m,_=Symbol.for("react.element"),O=Symbol.for("react.portal"),h=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),b=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),k=Symbol.for("react.suspense"),g=Symbol.for("react.suspense_list"),T=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),V=Symbol.for("react.offscreen"),$=Symbol.iterator,M="@@iterator";function D(e){if(e===null||typeof e!="object")return null;var r=$&&e[$]||e[M];return typeof r=="function"?r:null}var F=y.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function p(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];q("error",e,t)}}function q(e,r,t){{var n=F.ReactDebugCurrentFrame,i=n.getStackAddendum();i!==""&&(r+="%s",t=t.concat([i]));var s=t.map(function(o){return String(o)});s.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,s)}}var N=!1,Q=!1,S=!1,v=!1,w=!1,W;W=Symbol.for("react.module.reference");function Y(e){return!!(typeof e=="string"||typeof e=="function"||e===h||e===d||w||e===E||e===k||e===g||v||e===V||N||Q||S||typeof e=="object"&&e!==null&&(e.$$typeof===j||e.$$typeof===T||e.$$typeof===c||e.$$typeof===b||e.$$typeof===u||e.$$typeof===W||e.getModuleId!==void 0))}function U(e,r,t){var n=e.displayName;if(n)return n;var i=r.displayName||r.name||"";return i!==""?t+"("+i+")":t}function z(e){return e.displayName||"Context"}function A(e){if(e==null)return null;if(typeof e.tag=="number"&&p("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case h:return"Fragment";case O:return"Portal";case d:return"Profiler";case E:return"StrictMode";case k:return"Suspense";case g:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case b:var r=e;return z(r)+".Consumer";case c:var t=e;return z(t._context)+".Provider";case u:return U(e,e.render,"ForwardRef");case T:var n=e.displayName||null;return n!==null?n:A(e.type)||"Memo";case j:{var i=e,s=i._payload,o=i._init;try{return A(o(s))}catch{return null}}}return null}var L=Object.assign,K=0,Ee,Re,me,_e,Se,Ce,Te;function we(){}we.__reactDisabledLog=!0;function Je(){{if(K===0){Ee=console.log,Re=console.info,me=console.warn,_e=console.error,Se=console.group,Ce=console.groupCollapsed,Te=console.groupEnd;var e={configurable:!0,enumerable:!0,value:we,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}K++}}function $e(){{if(K--,K===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:L({},e,{value:Ee}),info:L({},e,{value:Re}),warn:L({},e,{value:me}),error:L({},e,{value:_e}),group:L({},e,{value:Se}),groupCollapsed:L({},e,{value:Ce}),groupEnd:L({},e,{value:Te})})}K<0&&p("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ie=F.ReactCurrentDispatcher,se;function ee(e,r,t){{if(se===void 0)try{throw Error()}catch(i){var n=i.stack.trim().match(/\n( *(at )?)/);se=n&&n[1]||""}return` | ||
`+se+e}}var ue=!1,re;{var ze=typeof WeakMap=="function"?WeakMap:Map;re=new ze}function Pe(e,r){if(!e||ue)return"";{var t=re.get(e);if(t!==void 0)return t}var n;ue=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var s;s=ie.current,ie.current=null,Je();try{if(r){var o=function(){throw Error()};if(Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(o,[])}catch(I){n=I}Reflect.construct(e,[],o)}else{try{o.call()}catch(I){n=I}e.call(o.prototype)}}else{try{throw Error()}catch(I){n=I}e()}}catch(I){if(I&&n&&typeof I.stack=="string"){for(var a=I.stack.split(` | ||
*/var he;function Ue(){return he||(he=1,process.env.NODE_ENV!=="production"&&function(){var b=E,_=Symbol.for("react.element"),O=Symbol.for("react.portal"),p=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),d=Symbol.for("react.provider"),h=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),k=Symbol.for("react.suspense"),m=Symbol.for("react.suspense_list"),T=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),V=Symbol.for("react.offscreen"),z=Symbol.iterator,L="@@iterator";function D(e){if(e===null||typeof e!="object")return null;var r=z&&e[z]||e[L];return typeof r=="function"?r:null}var F=b.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function g(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];Q("error",e,t)}}function Q(e,r,t){{var n=F.ReactDebugCurrentFrame,i=n.getStackAddendum();i!==""&&(r+="%s",t=t.concat([i]));var s=t.map(function(o){return String(o)});s.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,s)}}var N=!1,q=!1,S=!1,v=!1,w=!1,W;W=Symbol.for("react.module.reference");function Y(e){return!!(typeof e=="string"||typeof e=="function"||e===p||e===f||w||e===y||e===k||e===m||v||e===V||N||q||S||typeof e=="object"&&e!==null&&(e.$$typeof===j||e.$$typeof===T||e.$$typeof===d||e.$$typeof===h||e.$$typeof===u||e.$$typeof===W||e.getModuleId!==void 0))}function U(e,r,t){var n=e.displayName;if(n)return n;var i=r.displayName||r.name||"";return i!==""?t+"("+i+")":t}function $(e){return e.displayName||"Context"}function A(e){if(e==null)return null;if(typeof e.tag=="number"&&g("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case p:return"Fragment";case O:return"Portal";case f:return"Profiler";case y:return"StrictMode";case k:return"Suspense";case m:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case h:var r=e;return $(r)+".Consumer";case d:var t=e;return $(t._context)+".Provider";case u:return U(e,e.render,"ForwardRef");case T:var n=e.displayName||null;return n!==null?n:A(e.type)||"Memo";case j:{var i=e,s=i._payload,o=i._init;try{return A(o(s))}catch{return null}}}return null}var M=Object.assign,K=0,me,Re,Ee,_e,Se,Ce,Te;function we(){}we.__reactDisabledLog=!0;function Je(){{if(K===0){me=console.log,Re=console.info,Ee=console.warn,_e=console.error,Se=console.group,Ce=console.groupCollapsed,Te=console.groupEnd;var e={configurable:!0,enumerable:!0,value:we,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}K++}}function ze(){{if(K--,K===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:M({},e,{value:me}),info:M({},e,{value:Re}),warn:M({},e,{value:Ee}),error:M({},e,{value:_e}),group:M({},e,{value:Se}),groupCollapsed:M({},e,{value:Ce}),groupEnd:M({},e,{value:Te})})}K<0&&g("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ie=F.ReactCurrentDispatcher,se;function ee(e,r,t){{if(se===void 0)try{throw Error()}catch(i){var n=i.stack.trim().match(/\n( *(at )?)/);se=n&&n[1]||""}return` | ||
`+se+e}}var ue=!1,re;{var $e=typeof WeakMap=="function"?WeakMap:Map;re=new $e}function Pe(e,r){if(!e||ue)return"";{var t=re.get(e);if(t!==void 0)return t}var n;ue=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var s;s=ie.current,ie.current=null,Je();try{if(r){var o=function(){throw Error()};if(Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(o,[])}catch(I){n=I}Reflect.construct(e,[],o)}else{try{o.call()}catch(I){n=I}e.call(o.prototype)}}else{try{throw Error()}catch(I){n=I}e()}}catch(I){if(I&&n&&typeof I.stack=="string"){for(var a=I.stack.split(` | ||
`),R=n.stack.split(` | ||
`),l=a.length-1,f=R.length-1;l>=1&&f>=0&&a[l]!==R[f];)f--;for(;l>=1&&f>=0;l--,f--)if(a[l]!==R[f]){if(l!==1||f!==1)do if(l--,f--,f<0||a[l]!==R[f]){var P=` | ||
`+a[l].replace(" at new "," at ");return e.displayName&&P.includes("<anonymous>")&&(P=P.replace("<anonymous>",e.displayName)),typeof e=="function"&&re.set(e,P),P}while(l>=1&&f>=0);break}}}finally{ue=!1,ie.current=s,$e(),Error.prepareStackTrace=i}var B=e?e.displayName||e.name:"",Me=B?ee(B):"";return typeof e=="function"&&re.set(e,Me),Me}function Ke(e,r,t){return Pe(e,!1)}function Xe(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function te(e,r,t){if(e==null)return"";if(typeof e=="function")return Pe(e,Xe(e));if(typeof e=="string")return ee(e);switch(e){case k:return ee("Suspense");case g:return ee("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case u:return Ke(e.render);case T:return te(e.type,r,t);case j:{var n=e,i=n._payload,s=n._init;try{return te(s(i),r,t)}catch{}}}return""}var ne=Object.prototype.hasOwnProperty,Oe={},xe=F.ReactDebugCurrentFrame;function ae(e){if(e){var r=e._owner,t=te(e.type,e._source,r?r.type:null);xe.setExtraStackFrame(t)}else xe.setExtraStackFrame(null)}function Ze(e,r,t,n,i){{var s=Function.call.bind(ne);for(var o in e)if(s(e,o)){var a=void 0;try{if(typeof e[o]!="function"){var R=Error((n||"React class")+": "+t+" type `"+o+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[o]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw R.name="Invariant Violation",R}a=e[o](r,o,n,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(l){a=l}a&&!(a instanceof Error)&&(ae(i),p("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",n||"React class",t,o,typeof a),ae(null)),a instanceof Error&&!(a.message in Oe)&&(Oe[a.message]=!0,ae(i),p("Failed %s type: %s",t,a.message),ae(null))}}}var qe=Array.isArray;function le(e){return qe(e)}function Qe(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function er(e){try{return je(e),!1}catch{return!0}}function je(e){return""+e}function ke(e){if(er(e))return p("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Qe(e)),je(e)}var X=F.ReactCurrentOwner,rr={key:!0,ref:!0,__self:!0,__source:!0},De,Fe,ce;ce={};function tr(e){if(ne.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function nr(e){if(ne.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function ar(e,r){if(typeof e.ref=="string"&&X.current&&r&&X.current.stateNode!==r){var t=A(X.current.type);ce[t]||(p('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',A(X.current.type),e.ref),ce[t]=!0)}}function or(e,r){{var t=function(){De||(De=!0,p("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}}function ir(e,r){{var t=function(){Fe||(Fe=!0,p("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}}var sr=function(e,r,t,n,i,s,o){var a={$$typeof:_,type:e,key:r,ref:t,props:o,_owner:s};return a._store={},Object.defineProperty(a._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(a,"_self",{configurable:!1,enumerable:!1,writable:!1,value:n}),Object.defineProperty(a,"_source",{configurable:!1,enumerable:!1,writable:!1,value:i}),Object.freeze&&(Object.freeze(a.props),Object.freeze(a)),a};function ur(e,r,t,n,i){{var s,o={},a=null,R=null;t!==void 0&&(ke(t),a=""+t),nr(r)&&(ke(r.key),a=""+r.key),tr(r)&&(R=r.ref,ar(r,i));for(s in r)ne.call(r,s)&&!rr.hasOwnProperty(s)&&(o[s]=r[s]);if(e&&e.defaultProps){var l=e.defaultProps;for(s in l)o[s]===void 0&&(o[s]=l[s])}if(a||R){var f=typeof e=="function"?e.displayName||e.name||"Unknown":e;a&&or(o,f),R&&ir(o,f)}return sr(e,a,R,i,n,X.current,o)}}var fe=F.ReactCurrentOwner,Ae=F.ReactDebugCurrentFrame;function G(e){if(e){var r=e._owner,t=te(e.type,e._source,r?r.type:null);Ae.setExtraStackFrame(t)}else Ae.setExtraStackFrame(null)}var de;de=!1;function ve(e){return typeof e=="object"&&e!==null&&e.$$typeof===_}function Ie(){{if(fe.current){var e=A(fe.current.type);if(e)return` | ||
`),l=a.length-1,c=R.length-1;l>=1&&c>=0&&a[l]!==R[c];)c--;for(;l>=1&&c>=0;l--,c--)if(a[l]!==R[c]){if(l!==1||c!==1)do if(l--,c--,c<0||a[l]!==R[c]){var P=` | ||
`+a[l].replace(" at new "," at ");return e.displayName&&P.includes("<anonymous>")&&(P=P.replace("<anonymous>",e.displayName)),typeof e=="function"&&re.set(e,P),P}while(l>=1&&c>=0);break}}}finally{ue=!1,ie.current=s,ze(),Error.prepareStackTrace=i}var B=e?e.displayName||e.name:"",Le=B?ee(B):"";return typeof e=="function"&&re.set(e,Le),Le}function Ke(e,r,t){return Pe(e,!1)}function Xe(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function te(e,r,t){if(e==null)return"";if(typeof e=="function")return Pe(e,Xe(e));if(typeof e=="string")return ee(e);switch(e){case k:return ee("Suspense");case m:return ee("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case u:return Ke(e.render);case T:return te(e.type,r,t);case j:{var n=e,i=n._payload,s=n._init;try{return te(s(i),r,t)}catch{}}}return""}var ne=Object.prototype.hasOwnProperty,Oe={},xe=F.ReactDebugCurrentFrame;function ae(e){if(e){var r=e._owner,t=te(e.type,e._source,r?r.type:null);xe.setExtraStackFrame(t)}else xe.setExtraStackFrame(null)}function Ze(e,r,t,n,i){{var s=Function.call.bind(ne);for(var o in e)if(s(e,o)){var a=void 0;try{if(typeof e[o]!="function"){var R=Error((n||"React class")+": "+t+" type `"+o+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[o]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw R.name="Invariant Violation",R}a=e[o](r,o,n,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(l){a=l}a&&!(a instanceof Error)&&(ae(i),g("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",n||"React class",t,o,typeof a),ae(null)),a instanceof Error&&!(a.message in Oe)&&(Oe[a.message]=!0,ae(i),g("Failed %s type: %s",t,a.message),ae(null))}}}var Qe=Array.isArray;function le(e){return Qe(e)}function qe(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function er(e){try{return je(e),!1}catch{return!0}}function je(e){return""+e}function ke(e){if(er(e))return g("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",qe(e)),je(e)}var X=F.ReactCurrentOwner,rr={key:!0,ref:!0,__self:!0,__source:!0},De,Fe,ce;ce={};function tr(e){if(ne.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function nr(e){if(ne.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function ar(e,r){if(typeof e.ref=="string"&&X.current&&r&&X.current.stateNode!==r){var t=A(X.current.type);ce[t]||(g('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',A(X.current.type),e.ref),ce[t]=!0)}}function or(e,r){{var t=function(){De||(De=!0,g("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}}function ir(e,r){{var t=function(){Fe||(Fe=!0,g("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}}var sr=function(e,r,t,n,i,s,o){var a={$$typeof:_,type:e,key:r,ref:t,props:o,_owner:s};return a._store={},Object.defineProperty(a._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(a,"_self",{configurable:!1,enumerable:!1,writable:!1,value:n}),Object.defineProperty(a,"_source",{configurable:!1,enumerable:!1,writable:!1,value:i}),Object.freeze&&(Object.freeze(a.props),Object.freeze(a)),a};function ur(e,r,t,n,i){{var s,o={},a=null,R=null;t!==void 0&&(ke(t),a=""+t),nr(r)&&(ke(r.key),a=""+r.key),tr(r)&&(R=r.ref,ar(r,i));for(s in r)ne.call(r,s)&&!rr.hasOwnProperty(s)&&(o[s]=r[s]);if(e&&e.defaultProps){var l=e.defaultProps;for(s in l)o[s]===void 0&&(o[s]=l[s])}if(a||R){var c=typeof e=="function"?e.displayName||e.name||"Unknown":e;a&&or(o,c),R&&ir(o,c)}return sr(e,a,R,i,n,X.current,o)}}var fe=F.ReactCurrentOwner,Ae=F.ReactDebugCurrentFrame;function G(e){if(e){var r=e._owner,t=te(e.type,e._source,r?r.type:null);Ae.setExtraStackFrame(t)}else Ae.setExtraStackFrame(null)}var de;de=!1;function ve(e){return typeof e=="object"&&e!==null&&e.$$typeof===_}function Ie(){{if(fe.current){var e=A(fe.current.type);if(e)return` | ||
@@ -29,2 +29,2 @@ Check the render method of \``+e+"`."}return""}}function lr(e){{if(e!==void 0){var r=e.fileName.replace(/^.*[\\\/]/,""),t=e.lineNumber;return` | ||
Check the top-level render call using <`+t+">.")}return r}}function We(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=cr(r);if(Ve[t])return;Ve[t]=!0;var n="";e&&e._owner&&e._owner!==fe.current&&(n=" It was passed a child from "+A(e._owner.type)+"."),G(e),p('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,n),G(null)}}function Ye(e,r){{if(typeof e!="object")return;if(le(e))for(var t=0;t<e.length;t++){var n=e[t];ve(n)&&We(n,r)}else if(ve(e))e._store&&(e._store.validated=!0);else if(e){var i=D(e);if(typeof i=="function"&&i!==e.entries)for(var s=i.call(e),o;!(o=s.next()).done;)ve(o.value)&&We(o.value,r)}}}function fr(e){{var r=e.type;if(r==null||typeof r=="string")return;var t;if(typeof r=="function")t=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===u||r.$$typeof===T))t=r.propTypes;else return;if(t){var n=A(r);Ze(t,e.props,"prop",n,e)}else if(r.PropTypes!==void 0&&!de){de=!0;var i=A(r);p("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",i||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&p("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function dr(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var n=r[t];if(n!=="children"&&n!=="key"){G(e),p("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),G(null);break}}e.ref!==null&&(G(e),p("Invalid attribute `ref` supplied to `React.Fragment`."),G(null))}}function Le(e,r,t,n,i,s){{var o=Y(e);if(!o){var a="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(a+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var R=lr(i);R?a+=R:a+=Ie();var l;e===null?l="null":le(e)?l="array":e!==void 0&&e.$$typeof===_?(l="<"+(A(e.type)||"Unknown")+" />",a=" Did you accidentally export a JSX literal instead of a component?"):l=typeof e,p("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",l,a)}var f=ur(e,r,t,i,s);if(f==null)return f;if(o){var P=r.children;if(P!==void 0)if(n)if(le(P)){for(var B=0;B<P.length;B++)Ye(P[B],e);Object.freeze&&Object.freeze(P)}else p("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ye(P,e)}return e===h?dr(f):fr(f),f}}function vr(e,r,t){return Le(e,r,t,!0)}function pr(e,r,t){return Le(e,r,t,!1)}var hr=pr,br=vr;J.Fragment=h,J.jsx=hr,J.jsxs=br}()),J}process.env.NODE_ENV==="production"?oe.exports=Ne():oe.exports=Ue();var x=oe.exports;const be=m.createContext(null),Z=()=>{const y=m.useContext(be);if(!y)throw new Error("useGlobalState must be used within a GlobalStateProvider");return y},ge=({children:y,debug:_=!1,controls:O=!1})=>{const[h,E]=m.useState({}),[d,c]=m.useState([]),[b,u]=m.useState(0),k=(S,v=!0)=>{const w={...h,...S};if(E(w),v){const W={...w,_id:Math.random().toString(36).substring(7)};c([...d.slice(0,b+1),W]),u(b+1)}},g=S=>{let v=h;return S.split(".").forEach(w=>v=v==null?void 0:v[w]),v},T=(S,v)=>{const w=S.split("."),W={...h};let Y=W;w.forEach((U,z)=>{!Y.hasOwnProperty(U)&&z<w.length-1&&(Y[U]={}),z===w.length-1?Y[U]=v:Y=Y[U]}),k(W)},j=()=>{b>0&&(u(b-1),E(d[b-1]))},V=()=>{b<d.length-1&&(u(b+1),E(d[b+1]))},$=()=>{c([]),u(0)},M=m.useRef(!1),D=m.useRef(null),F=(S=100)=>{D.current!==null&&clearInterval(D.current);let v=0;M.current=!0,D.current=setInterval(()=>{M.current&&v<d.length?(E(d[v]),v++):(D.current&&clearInterval(D.current),M.current=!1)},S)},p=()=>{M.current=!1,D.current!==null&&clearInterval(D.current)},q=()=>d.map(S=>({...S})),N=S=>{const v=d.findIndex(w=>w._id===S);v!==-1&&(u(v),E(d[v]))},Q={globalState:h,updateGlobalState:k,getState:g,get:g,setState:T,set:T,undoState:j,undo:j,redoState:V,redo:V,clearHistory:$,clear:$,getVersions:q,versions:q,playHistory:F,play:F,loadVersion:N,load:N,stopHistory:p,stop:p,seekVersion:N,seek:N};return _&&(window.gs=Q),x.jsxs(be.Provider,{value:Q,children:[y,O&&x.jsx(ye,{})]})},Ge=(y,_=null)=>{const{getState:O,setState:h}=Z();return[O(y)||_,c=>{h(y,c)}]},Be=()=>{const{undo:y,redo:_,play:O,stop:h,clear:E,versions:d,seek:c}=Z();return{undo:y,redo:_,play:O,stop:h,clear:E,versions:d,seek:c}},ye=()=>{const{undo:y,redo:_,play:O,stop:h,clear:E,versions:d}=Z(),c={container:{backgroundColor:"#333",position:"fixed",bottom:0,left:0,width:"100vw",display:"flex"},action:{backgroundColor:"transparent"}};return x.jsxs("div",{style:c.container,children:[x.jsx("button",{style:c.action,onClick:()=>y(),children:"↩️ Undo"}),x.jsxs("button",{style:c.action,onClick:()=>_(),children:[x.jsx("span",{style:{transform:"scaleX(-1)"},children:"↩️"})," Redo"]}),x.jsx("button",{style:c.action,onClick:()=>O(),children:"▶️ Play"}),x.jsx("button",{style:c.action,onClick:()=>h(),children:"⏹️ Stop"}),x.jsx("button",{style:c.action,onClick:()=>E(),children:"🚮 Clear"}),x.jsx("button",{style:c.action,onClick:()=>console.log(d()),children:"📁 Versions"})]})},He=ge;console.log("React-Changes Has Loaded"),C.Earth=He,C.EarthControls=ye,C.GlobalStateProvider=ge,C.useEarth=Ge,C.useEarthControls=Be,C.useGlobalState=Z,Object.defineProperty(C,Symbol.toStringTag,{value:"Module"})}); | ||
Check the top-level render call using <`+t+">.")}return r}}function We(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=cr(r);if(Ve[t])return;Ve[t]=!0;var n="";e&&e._owner&&e._owner!==fe.current&&(n=" It was passed a child from "+A(e._owner.type)+"."),G(e),g('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,n),G(null)}}function Ye(e,r){{if(typeof e!="object")return;if(le(e))for(var t=0;t<e.length;t++){var n=e[t];ve(n)&&We(n,r)}else if(ve(e))e._store&&(e._store.validated=!0);else if(e){var i=D(e);if(typeof i=="function"&&i!==e.entries)for(var s=i.call(e),o;!(o=s.next()).done;)ve(o.value)&&We(o.value,r)}}}function fr(e){{var r=e.type;if(r==null||typeof r=="string")return;var t;if(typeof r=="function")t=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===u||r.$$typeof===T))t=r.propTypes;else return;if(t){var n=A(r);Ze(t,e.props,"prop",n,e)}else if(r.PropTypes!==void 0&&!de){de=!0;var i=A(r);g("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",i||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&g("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function dr(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var n=r[t];if(n!=="children"&&n!=="key"){G(e),g("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),G(null);break}}e.ref!==null&&(G(e),g("Invalid attribute `ref` supplied to `React.Fragment`."),G(null))}}function Me(e,r,t,n,i,s){{var o=Y(e);if(!o){var a="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(a+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var R=lr(i);R?a+=R:a+=Ie();var l;e===null?l="null":le(e)?l="array":e!==void 0&&e.$$typeof===_?(l="<"+(A(e.type)||"Unknown")+" />",a=" Did you accidentally export a JSX literal instead of a component?"):l=typeof e,g("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",l,a)}var c=ur(e,r,t,i,s);if(c==null)return c;if(o){var P=r.children;if(P!==void 0)if(n)if(le(P)){for(var B=0;B<P.length;B++)Ye(P[B],e);Object.freeze&&Object.freeze(P)}else g("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ye(P,e)}return e===p?dr(c):fr(c),c}}function vr(e,r,t){return Me(e,r,t,!0)}function pr(e,r,t){return Me(e,r,t,!1)}var hr=pr,gr=vr;J.Fragment=p,J.jsx=hr,J.jsxs=gr}()),J}process.env.NODE_ENV==="production"?oe.exports=Ne():oe.exports=Ue();var x=oe.exports;const ge=E.createContext(null),Z=()=>{const b=E.useContext(ge);if(!b)throw new Error("useGlobalState must be used within a GlobalStateProvider");return b},be=({children:b,debug:_=!1,controls:O=!1})=>{const[p,y]=E.useState({}),[f,d]=E.useState([]),[h,u]=E.useState(0),k=(S,v=!0)=>{const w={...p,...S};if(y(w),v){const W={...w,_id:Math.random().toString(36).substring(7)};d([...f.slice(0,h+1),W]),u(h+1)}},m=S=>{let v=p;return S.split(".").forEach(w=>v=v==null?void 0:v[w]),v},T=(S,v)=>{const w=S.split("."),W={...p};let Y=W;w.forEach((U,$)=>{!Y.hasOwnProperty(U)&&$<w.length-1&&(Y[U]={}),$===w.length-1?Y[U]=v:Y=Y[U]}),k(W)},j=()=>{h>0&&(u(h-1),y(f[h-1]))},V=()=>{h<f.length-1&&(u(h+1),y(f[h+1]))},z=()=>{d([]),u(0)},L=E.useRef(!1),D=E.useRef(null),F=(S=100)=>{D.current!==null&&clearInterval(D.current);let v=0;L.current=!0,D.current=setInterval(()=>{L.current&&v<f.length?(y(f[v]),v++):(D.current&&clearInterval(D.current),L.current=!1)},S)},g=()=>{L.current=!1,D.current!==null&&clearInterval(D.current)},Q=()=>f.map(S=>({...S})),N=S=>{const v=f.findIndex(w=>w._id===S);v!==-1&&(u(v),y(f[v]))},q={globalState:p,updateGlobalState:k,getState:m,get:m,setState:T,set:T,undoState:j,undo:j,redoState:V,redo:V,clearHistory:z,clear:z,getVersions:Q,versions:Q,playHistory:F,play:F,loadVersion:N,load:N,stopHistory:g,stop:g,seekVersion:N,seek:N};return _&&(window.gs=q),x.jsxs(ge.Provider,{value:q,children:[b,O&&x.jsx(ye,{})]})};function Ge(...b){const{getState:_,setState:O}=Z(),[p,y]=b.length===2?b:[h(),b[0]];return[_(p)||y,u=>{O(p,u)}];function h(){return E.useMemo(()=>"~"+Math.random().toString(36).substring(2,15),[])}}const Be=()=>{const{undo:b,redo:_,play:O,stop:p,clear:y,versions:f,seek:d}=Z();return{undo:b,redo:_,play:O,stop:p,clear:y,versions:f,seek:d}},ye=()=>{const{undo:b,redo:_,play:O,stop:p,clear:y,versions:f}=Z(),d={container:{backgroundColor:"#333",position:"fixed",bottom:0,left:0,width:"100vw",display:"flex"},action:{backgroundColor:"transparent"}};return x.jsxs("div",{style:d.container,children:[x.jsx("button",{style:d.action,onClick:()=>b(),children:"↩️ Undo"}),x.jsxs("button",{style:d.action,onClick:()=>_(),children:[x.jsx("span",{style:{transform:"scaleX(-1)"},children:"↩️"})," Redo"]}),x.jsx("button",{style:d.action,onClick:()=>O(),children:"▶️ Play"}),x.jsx("button",{style:d.action,onClick:()=>p(),children:"⏹️ Stop"}),x.jsx("button",{style:d.action,onClick:()=>y(),children:"🚮 Clear"}),x.jsx("button",{style:d.action,onClick:()=>console.log(f()),children:"📁 Versions"})]})},He=be;console.log("React-Changes Has Loaded"),C.Changes=He,C.GlobalStateProvider=be,C.PlayerControls=ye,C.useChange=Ge,C.useChangeControls=Be,C.useGlobalState=Z,Object.defineProperty(C,Symbol.toStringTag,{value:"Module"})}); |
{ | ||
"name": "react-changes", | ||
"private": false, | ||
"version": "0.0.12", | ||
"version": "0.0.13", | ||
"type": "module", | ||
@@ -6,0 +6,0 @@ "main": "./dist/react-changes.umd.js", |
47648
842