@ribbon-studios/ribbon 1.0.4 → 1.1.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.
@@ -74,7 +74,7 @@ jobs:
74
74
  - name: Build
75
75
  run: bun run build
76
76
 
77
- - uses: actions/upload-artifact@v2
77
+ - uses: actions/upload-artifact@v4
78
78
  with:
79
79
  name: build
80
80
  path: dist
@@ -92,7 +92,7 @@ jobs:
92
92
  - name: Install Packages
93
93
  run: bun install --frozen-lockfile
94
94
 
95
- - uses: actions/download-artifact@v3
95
+ - uses: actions/download-artifact@v4
96
96
  with:
97
97
  name: build
98
98
  path: dist
@@ -0,0 +1,9 @@
1
+ import { afterEach, expect } from 'vitest';
2
+ import * as matchers from '@testing-library/jest-dom/matchers';
3
+ import { cleanup } from '@testing-library/react';
4
+
5
+ expect.extend(matchers);
6
+
7
+ afterEach(() => {
8
+ cleanup();
9
+ });
package/bun.lockb CHANGED
Binary file
package/demo/App.tsx CHANGED
@@ -1,6 +1,5 @@
1
- import { useReadOnlyCachedState } from '@ribbon-studios/react-utils';
2
1
  import { Ribbon } from '../src';
3
- import { useState } from 'react';
2
+ import { useState, useMemo } from 'react';
4
3
 
5
4
  type Banner = {
6
5
  label: string;
@@ -26,7 +25,7 @@ const banners: Banner[] = [
26
25
 
27
26
  export function App() {
28
27
  const [index, setIndex] = useState(0);
29
- const banner = useReadOnlyCachedState(() => {
28
+ const banner = useMemo(() => {
30
29
  return banners[index];
31
30
  }, [index]);
32
31
 
@@ -0,0 +1 @@
1
+ export declare function App(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export {};
package/dist/index.cjs ADDED
@@ -0,0 +1,50 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./index.css');var ve={exports:{}},ae={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var Me;function Be(){if(Me)return ae;Me=1;var T=Symbol.for("react.transitional.element"),c=Symbol.for("react.fragment");function N($,w,b){var C=null;if(b!==void 0&&(C=""+b),w.key!==void 0&&(C=""+w.key),"key"in w){b={};for(var k in w)k!=="key"&&(b[k]=w[k])}else b=w;return w=b.ref,{$$typeof:T,type:$,key:C,ref:w!==void 0?w:null,props:b}}return ae.Fragment=c,ae.jsx=N,ae.jsxs=N,ae}var ie={},Ee={exports:{}},p={};/**
10
+ * @license React
11
+ * react.production.js
12
+ *
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var Ye;function Fe(){if(Ye)return p;Ye=1;var T=Symbol.for("react.transitional.element"),c=Symbol.for("react.portal"),N=Symbol.for("react.fragment"),$=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),b=Symbol.for("react.consumer"),C=Symbol.for("react.context"),k=Symbol.for("react.forward_ref"),W=Symbol.for("react.suspense"),z=Symbol.for("react.memo"),I=Symbol.for("react.lazy"),G=Symbol.iterator;function H(t){return t===null||typeof t!="object"?null:(t=G&&t[G]||t["@@iterator"],typeof t=="function"?t:null)}var B={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Z=Object.assign,F={};function D(t,n,s){this.props=t,this.context=n,this.refs=F,this.updater=s||B}D.prototype.isReactComponent={},D.prototype.setState=function(t,n){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,n,"setState")},D.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function Q(){}Q.prototype=D.prototype;function J(t,n,s){this.props=t,this.context=n,this.refs=F,this.updater=s||B}var P=J.prototype=new Q;P.constructor=J,Z(P,D.prototype),P.isPureReactComponent=!0;var ne=Array.isArray,y={H:null,A:null,T:null,S:null,V:null},ee=Object.prototype.hasOwnProperty;function te(t,n,s,a,f,h){return s=h.ref,{$$typeof:T,type:t,key:n,ref:s!==void 0?s:null,props:h}}function M(t,n){return te(t.type,n,void 0,void 0,void 0,t.props)}function U(t){return typeof t=="object"&&t!==null&&t.$$typeof===T}function ue(t){var n={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(s){return n[s]})}var g=/\/+/g;function X(t,n){return typeof t=="object"&&t!==null&&t.key!=null?ue(""+t.key):n.toString(36)}function q(){}function Y(t){switch(t.status){case"fulfilled":return t.value;case"rejected":throw t.reason;default:switch(typeof t.status=="string"?t.then(q,q):(t.status="pending",t.then(function(n){t.status==="pending"&&(t.status="fulfilled",t.value=n)},function(n){t.status==="pending"&&(t.status="rejected",t.reason=n)})),t.status){case"fulfilled":return t.value;case"rejected":throw t.reason}}throw t}function O(t,n,s,a,f){var h=typeof t;(h==="undefined"||h==="boolean")&&(t=null);var l=!1;if(t===null)l=!0;else switch(h){case"bigint":case"string":case"number":l=!0;break;case"object":switch(t.$$typeof){case T:case c:l=!0;break;case I:return l=t._init,O(l(t._payload),n,s,a,f)}}if(l)return f=f(t),l=a===""?"."+X(t,0):a,ne(f)?(s="",l!=null&&(s=l.replace(g,"$&/")+"/"),O(f,n,s,"",function(A){return A})):f!=null&&(U(f)&&(f=M(f,s+(f.key==null||t&&t.key===f.key?"":(""+f.key).replace(g,"$&/")+"/")+l)),n.push(f)),1;l=0;var S=a===""?".":a+":";if(ne(t))for(var d=0;d<t.length;d++)a=t[d],h=S+X(a,d),l+=O(a,n,s,h,f);else if(d=H(t),typeof d=="function")for(t=d.call(t),d=0;!(a=t.next()).done;)a=a.value,h=S+X(a,d++),l+=O(a,n,s,h,f);else if(h==="object"){if(typeof t.then=="function")return O(Y(t),n,s,a,f);throw n=String(t),Error("Objects are not valid as a React child (found: "+(n==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":n)+"). If you meant to render a collection of children, use an array instead.")}return l}function L(t,n,s){if(t==null)return t;var a=[],f=0;return O(t,a,"","",function(h){return n.call(s,h,f++)}),a}function V(t){if(t._status===-1){var n=t._result;n=n(),n.then(function(s){(t._status===0||t._status===-1)&&(t._status=1,t._result=s)},function(s){(t._status===0||t._status===-1)&&(t._status=2,t._result=s)}),t._status===-1&&(t._status=0,t._result=n)}if(t._status===1)return t._result.default;throw t._result}var x=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)};function re(){}return p.Children={map:L,forEach:function(t,n,s){L(t,function(){n.apply(this,arguments)},s)},count:function(t){var n=0;return L(t,function(){n++}),n},toArray:function(t){return L(t,function(n){return n})||[]},only:function(t){if(!U(t))throw Error("React.Children.only expected to receive a single React element child.");return t}},p.Component=D,p.Fragment=N,p.Profiler=w,p.PureComponent=J,p.StrictMode=$,p.Suspense=W,p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=y,p.__COMPILER_RUNTIME={__proto__:null,c:function(t){return y.H.useMemoCache(t)}},p.cache=function(t){return function(){return t.apply(null,arguments)}},p.cloneElement=function(t,n,s){if(t==null)throw Error("The argument must be a React element, but you passed "+t+".");var a=Z({},t.props),f=t.key,h=void 0;if(n!=null)for(l in n.ref!==void 0&&(h=void 0),n.key!==void 0&&(f=""+n.key),n)!ee.call(n,l)||l==="key"||l==="__self"||l==="__source"||l==="ref"&&n.ref===void 0||(a[l]=n[l]);var l=arguments.length-2;if(l===1)a.children=s;else if(1<l){for(var S=Array(l),d=0;d<l;d++)S[d]=arguments[d+2];a.children=S}return te(t.type,f,void 0,void 0,h,a)},p.createContext=function(t){return t={$$typeof:C,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null},t.Provider=t,t.Consumer={$$typeof:b,_context:t},t},p.createElement=function(t,n,s){var a,f={},h=null;if(n!=null)for(a in n.key!==void 0&&(h=""+n.key),n)ee.call(n,a)&&a!=="key"&&a!=="__self"&&a!=="__source"&&(f[a]=n[a]);var l=arguments.length-2;if(l===1)f.children=s;else if(1<l){for(var S=Array(l),d=0;d<l;d++)S[d]=arguments[d+2];f.children=S}if(t&&t.defaultProps)for(a in l=t.defaultProps,l)f[a]===void 0&&(f[a]=l[a]);return te(t,h,void 0,void 0,null,f)},p.createRef=function(){return{current:null}},p.forwardRef=function(t){return{$$typeof:k,render:t}},p.isValidElement=U,p.lazy=function(t){return{$$typeof:I,_payload:{_status:-1,_result:t},_init:V}},p.memo=function(t,n){return{$$typeof:z,type:t,compare:n===void 0?null:n}},p.startTransition=function(t){var n=y.T,s={};y.T=s;try{var a=t(),f=y.S;f!==null&&f(s,a),typeof a=="object"&&a!==null&&typeof a.then=="function"&&a.then(re,x)}catch(h){x(h)}finally{y.T=n}},p.unstable_useCacheRefresh=function(){return y.H.useCacheRefresh()},p.use=function(t){return y.H.use(t)},p.useActionState=function(t,n,s){return y.H.useActionState(t,n,s)},p.useCallback=function(t,n){return y.H.useCallback(t,n)},p.useContext=function(t){return y.H.useContext(t)},p.useDebugValue=function(){},p.useDeferredValue=function(t,n){return y.H.useDeferredValue(t,n)},p.useEffect=function(t,n,s){var a=y.H;if(typeof s=="function")throw Error("useEffect CRUD overload is not enabled in this build of React.");return a.useEffect(t,n)},p.useId=function(){return y.H.useId()},p.useImperativeHandle=function(t,n,s){return y.H.useImperativeHandle(t,n,s)},p.useInsertionEffect=function(t,n){return y.H.useInsertionEffect(t,n)},p.useLayoutEffect=function(t,n){return y.H.useLayoutEffect(t,n)},p.useMemo=function(t,n){return y.H.useMemo(t,n)},p.useOptimistic=function(t,n){return y.H.useOptimistic(t,n)},p.useReducer=function(t,n,s){return y.H.useReducer(t,n,s)},p.useRef=function(t){return y.H.useRef(t)},p.useState=function(t){return y.H.useState(t)},p.useSyncExternalStore=function(t,n,s){return y.H.useSyncExternalStore(t,n,s)},p.useTransition=function(){return y.H.useTransition()},p.version="19.1.0",p}var ce={exports:{}};/**
18
+ * @license React
19
+ * react.development.js
20
+ *
21
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */ce.exports;var Le;function Qe(){return Le||(Le=1,function(T,c){process.env.NODE_ENV!=="production"&&function(){function N(e,r){Object.defineProperty(b.prototype,e,{get:function(){console.warn("%s(...) is deprecated in plain JavaScript React classes. %s",r[0],r[1])}})}function $(e){return e===null||typeof e!="object"?null:(e=fe&&e[fe]||e["@@iterator"],typeof e=="function"?e:null)}function w(e,r){e=(e=e.constructor)&&(e.displayName||e.name)||"ReactClass";var o=e+"."+r;ge[o]||(console.error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",r,e),ge[o]=!0)}function b(e,r,o){this.props=e,this.context=r,this.refs=ye,this.updater=o||be}function C(){}function k(e,r,o){this.props=e,this.context=r,this.refs=ye,this.updater=o||be}function W(e){return""+e}function z(e){try{W(e);var r=!1}catch{r=!0}if(r){r=console;var o=r.error,u=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return o.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",u),W(e)}}function I(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===qe?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case t:return"Fragment";case s:return"Profiler";case n:return"StrictMode";case l:return"Suspense";case S:return"SuspenseList";case se:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case re:return"Portal";case f:return(e.displayName||"Context")+".Provider";case a:return(e._context.displayName||"Context")+".Consumer";case h:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case d:return r=e.displayName||null,r!==null?r:I(e.type)||"Memo";case A:r=e._payload,e=e._init;try{return I(e(r))}catch{}}return null}function G(e){if(e===t)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===A)return"<...>";try{var r=I(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function H(){var e=v.A;return e===null?null:e.getOwner()}function B(){return Error("react-stack-top-frame")}function Z(e){if(pe.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function F(e,r){function o(){Se||(Se=!0,console.error("%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://react.dev/link/special-props)",r))}o.isReactWarning=!0,Object.defineProperty(e,"key",{get:o,configurable:!0})}function D(){var e=I(this.type);return Ae[e]||(Ae[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function Q(e,r,o,u,i,E,_,R){return o=E.ref,e={$$typeof:x,type:e,key:r,props:E,_owner:i},(o!==void 0?o:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:D}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:_}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:R}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function J(e,r){return r=Q(e.type,r,void 0,void 0,e._owner,e.props,e._debugStack,e._debugTask),e._store&&(r._store.validated=e._store.validated),r}function P(e){return typeof e=="object"&&e!==null&&e.$$typeof===x}function ne(e){var r={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(o){return r[o]})}function y(e,r){return typeof e=="object"&&e!==null&&e.key!=null?(z(e.key),ne(""+e.key)):r.toString(36)}function ee(){}function te(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(ee,ee):(e.status="pending",e.then(function(r){e.status==="pending"&&(e.status="fulfilled",e.value=r)},function(r){e.status==="pending"&&(e.status="rejected",e.reason=r)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function M(e,r,o,u,i){var E=typeof e;(E==="undefined"||E==="boolean")&&(e=null);var _=!1;if(e===null)_=!0;else switch(E){case"bigint":case"string":case"number":_=!0;break;case"object":switch(e.$$typeof){case x:case re:_=!0;break;case A:return _=e._init,M(_(e._payload),r,o,u,i)}}if(_){_=e,i=i(_);var R=u===""?"."+y(_,0):u;return Te(i)?(o="",R!=null&&(o=R.replace(Pe,"$&/")+"/"),M(i,r,o,"",function(K){return K})):i!=null&&(P(i)&&(i.key!=null&&(_&&_.key===i.key||z(i.key)),o=J(i,o+(i.key==null||_&&_.key===i.key?"":(""+i.key).replace(Pe,"$&/")+"/")+R),u!==""&&_!=null&&P(_)&&_.key==null&&_._store&&!_._store.validated&&(o._store.validated=2),i=o),r.push(i)),1}if(_=0,R=u===""?".":u+":",Te(e))for(var m=0;m<e.length;m++)u=e[m],E=R+y(u,m),_+=M(u,r,o,E,i);else if(m=$(e),typeof m=="function")for(m===e.entries&&(Ce||console.warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),Ce=!0),e=m.call(e),m=0;!(u=e.next()).done;)u=u.value,E=R+y(u,m++),_+=M(u,r,o,E,i);else if(E==="object"){if(typeof e.then=="function")return M(te(e),r,o,u,i);throw r=String(e),Error("Objects are not valid as a React child (found: "+(r==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":r)+"). If you meant to render a collection of children, use an array instead.")}return _}function U(e,r,o){if(e==null)return e;var u=[],i=0;return M(e,u,"","",function(E){return r.call(o,E,i++)}),u}function ue(e){if(e._status===-1){var r=e._result;r=r(),r.then(function(o){(e._status===0||e._status===-1)&&(e._status=1,e._result=o)},function(o){(e._status===0||e._status===-1)&&(e._status=2,e._result=o)}),e._status===-1&&(e._status=0,e._result=r)}if(e._status===1)return r=e._result,r===void 0&&console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
26
+
27
+ Your code should look like:
28
+ const MyComponent = lazy(() => import('./MyComponent'))
29
+
30
+ Did you accidentally put curly braces around the import?`,r),"default"in r||console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
31
+
32
+ Your code should look like:
33
+ const MyComponent = lazy(() => import('./MyComponent'))`,r),r.default;throw e._result}function g(){var e=v.H;return e===null&&console.error(`Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
34
+ 1. You might have mismatching versions of React and the renderer (such as React DOM)
35
+ 2. You might be breaking the Rules of Hooks
36
+ 3. You might have more than one copy of React in the same app
37
+ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`),e}function X(){}function q(e){if(de===null)try{var r=("require"+Math.random()).slice(0,7);de=(T&&T[r]).call(T,"timers").setImmediate}catch{de=function(u){Ne===!1&&(Ne=!0,typeof MessageChannel>"u"&&console.error("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."));var i=new MessageChannel;i.port1.onmessage=u,i.port2.postMessage(void 0)}}return de(e)}function Y(e){return 1<e.length&&typeof AggregateError=="function"?new AggregateError(e):e[0]}function O(e,r){r!==_e-1&&console.error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "),_e=r}function L(e,r,o){var u=v.actQueue;if(u!==null)if(u.length!==0)try{V(u),q(function(){return L(e,r,o)});return}catch(i){v.thrownErrors.push(i)}else v.actQueue=null;0<v.thrownErrors.length?(u=Y(v.thrownErrors),v.thrownErrors.length=0,o(u)):r(e)}function V(e){if(!Re){Re=!0;var r=0;try{for(;r<e.length;r++){var o=e[r];do{v.didUsePromise=!1;var u=o(!1);if(u!==null){if(v.didUsePromise){e[r]=o,e.splice(0,r);return}o=u}else break}while(!0)}e.length=0}catch(i){e.splice(0,r+1),v.thrownErrors.push(i)}finally{Re=!1}}}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var x=Symbol.for("react.transitional.element"),re=Symbol.for("react.portal"),t=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),a=Symbol.for("react.consumer"),f=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),S=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),se=Symbol.for("react.activity"),fe=Symbol.iterator,ge={},be={isMounted:function(){return!1},enqueueForceUpdate:function(e){w(e,"forceUpdate")},enqueueReplaceState:function(e){w(e,"replaceState")},enqueueSetState:function(e){w(e,"setState")}},we=Object.assign,ye={};Object.freeze(ye),b.prototype.isReactComponent={},b.prototype.setState=function(e,r){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,r,"setState")},b.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};var j={isMounted:["isMounted","Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],replaceState:["replaceState","Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]},le;for(le in j)j.hasOwnProperty(le)&&N(le,j[le]);C.prototype=b.prototype,j=k.prototype=new C,j.constructor=k,we(j,b.prototype),j.isPureReactComponent=!0;var Te=Array.isArray,qe=Symbol.for("react.client.reference"),v={H:null,A:null,T:null,S:null,V:null,actQueue:null,isBatchingLegacy:!1,didScheduleLegacyUpdate:!1,didUsePromise:!1,thrownErrors:[],getCurrentStack:null,recentlyCreatedOwnerStacks:0},pe=Object.prototype.hasOwnProperty,Oe=console.createTask?console.createTask:function(){return null};j={"react-stack-bottom-frame":function(e){return e()}};var Se,ke,Ae={},xe=j["react-stack-bottom-frame"].bind(j,B)(),We=Oe(G(B)),Ce=!1,Pe=/\/+/g,je=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var r=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(r))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Ne=!1,de=null,_e=0,me=!1,Re=!1,$e=typeof queueMicrotask=="function"?function(e){queueMicrotask(function(){return queueMicrotask(e)})}:q;j=Object.freeze({__proto__:null,c:function(e){return g().useMemoCache(e)}}),c.Children={map:U,forEach:function(e,r,o){U(e,function(){r.apply(this,arguments)},o)},count:function(e){var r=0;return U(e,function(){r++}),r},toArray:function(e){return U(e,function(r){return r})||[]},only:function(e){if(!P(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},c.Component=b,c.Fragment=t,c.Profiler=s,c.PureComponent=k,c.StrictMode=n,c.Suspense=l,c.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=v,c.__COMPILER_RUNTIME=j,c.act=function(e){var r=v.actQueue,o=_e;_e++;var u=v.actQueue=r!==null?r:[],i=!1;try{var E=e()}catch(m){v.thrownErrors.push(m)}if(0<v.thrownErrors.length)throw O(r,o),e=Y(v.thrownErrors),v.thrownErrors.length=0,e;if(E!==null&&typeof E=="object"&&typeof E.then=="function"){var _=E;return $e(function(){i||me||(me=!0,console.error("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"))}),{then:function(m,K){i=!0,_.then(function(oe){if(O(r,o),o===0){try{V(u),q(function(){return L(oe,m,K)})}catch(Ge){v.thrownErrors.push(Ge)}if(0<v.thrownErrors.length){var ze=Y(v.thrownErrors);v.thrownErrors.length=0,K(ze)}}else m(oe)},function(oe){O(r,o),0<v.thrownErrors.length&&(oe=Y(v.thrownErrors),v.thrownErrors.length=0),K(oe)})}}}var R=E;if(O(r,o),o===0&&(V(u),u.length!==0&&$e(function(){i||me||(me=!0,console.error("A component suspended inside an `act` scope, but the `act` call was not awaited. When testing React components that depend on asynchronous data, you must await the result:\n\nawait act(() => ...)"))}),v.actQueue=null),0<v.thrownErrors.length)throw e=Y(v.thrownErrors),v.thrownErrors.length=0,e;return{then:function(m,K){i=!0,o===0?(v.actQueue=u,q(function(){return L(R,m,K)})):m(R)}}},c.cache=function(e){return function(){return e.apply(null,arguments)}},c.captureOwnerStack=function(){var e=v.getCurrentStack;return e===null?null:e()},c.cloneElement=function(e,r,o){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var u=we({},e.props),i=e.key,E=e._owner;if(r!=null){var _;e:{if(pe.call(r,"ref")&&(_=Object.getOwnPropertyDescriptor(r,"ref").get)&&_.isReactWarning){_=!1;break e}_=r.ref!==void 0}_&&(E=H()),Z(r)&&(z(r.key),i=""+r.key);for(R in r)!pe.call(r,R)||R==="key"||R==="__self"||R==="__source"||R==="ref"&&r.ref===void 0||(u[R]=r[R])}var R=arguments.length-2;if(R===1)u.children=o;else if(1<R){_=Array(R);for(var m=0;m<R;m++)_[m]=arguments[m+2];u.children=_}for(u=Q(e.type,i,void 0,void 0,E,u,e._debugStack,e._debugTask),i=2;i<arguments.length;i++)E=arguments[i],P(E)&&E._store&&(E._store.validated=1);return u},c.createContext=function(e){return e={$$typeof:f,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:a,_context:e},e._currentRenderer=null,e._currentRenderer2=null,e},c.createElement=function(e,r,o){for(var u=2;u<arguments.length;u++){var i=arguments[u];P(i)&&i._store&&(i._store.validated=1)}if(u={},i=null,r!=null)for(m in ke||!("__self"in r)||"key"in r||(ke=!0,console.warn("Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform")),Z(r)&&(z(r.key),i=""+r.key),r)pe.call(r,m)&&m!=="key"&&m!=="__self"&&m!=="__source"&&(u[m]=r[m]);var E=arguments.length-2;if(E===1)u.children=o;else if(1<E){for(var _=Array(E),R=0;R<E;R++)_[R]=arguments[R+2];Object.freeze&&Object.freeze(_),u.children=_}if(e&&e.defaultProps)for(m in E=e.defaultProps,E)u[m]===void 0&&(u[m]=E[m]);i&&F(u,typeof e=="function"?e.displayName||e.name||"Unknown":e);var m=1e4>v.recentlyCreatedOwnerStacks++;return Q(e,i,void 0,void 0,H(),u,m?Error("react-stack-top-frame"):xe,m?Oe(G(e)):We)},c.createRef=function(){var e={current:null};return Object.seal(e),e},c.forwardRef=function(e){e!=null&&e.$$typeof===d?console.error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):typeof e!="function"?console.error("forwardRef requires a render function but was given %s.",e===null?"null":typeof e):e.length!==0&&e.length!==2&&console.error("forwardRef render functions accept exactly two parameters: props and ref. %s",e.length===1?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),e!=null&&e.defaultProps!=null&&console.error("forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?");var r={$$typeof:h,render:e},o;return Object.defineProperty(r,"displayName",{enumerable:!1,configurable:!0,get:function(){return o},set:function(u){o=u,e.name||e.displayName||(Object.defineProperty(e,"name",{value:u}),e.displayName=u)}}),r},c.isValidElement=P,c.lazy=function(e){return{$$typeof:A,_payload:{_status:-1,_result:e},_init:ue}},c.memo=function(e,r){e==null&&console.error("memo: The first argument must be a component. Instead received: %s",e===null?"null":typeof e),r={$$typeof:d,type:e,compare:r===void 0?null:r};var o;return Object.defineProperty(r,"displayName",{enumerable:!1,configurable:!0,get:function(){return o},set:function(u){o=u,e.name||e.displayName||(Object.defineProperty(e,"name",{value:u}),e.displayName=u)}}),r},c.startTransition=function(e){var r=v.T,o={};v.T=o,o._updatedFibers=new Set;try{var u=e(),i=v.S;i!==null&&i(o,u),typeof u=="object"&&u!==null&&typeof u.then=="function"&&u.then(X,je)}catch(E){je(E)}finally{r===null&&o._updatedFibers&&(e=o._updatedFibers.size,o._updatedFibers.clear(),10<e&&console.warn("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table.")),v.T=r}},c.unstable_useCacheRefresh=function(){return g().useCacheRefresh()},c.use=function(e){return g().use(e)},c.useActionState=function(e,r,o){return g().useActionState(e,r,o)},c.useCallback=function(e,r){return g().useCallback(e,r)},c.useContext=function(e){var r=g();return e.$$typeof===a&&console.error("Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?"),r.useContext(e)},c.useDebugValue=function(e,r){return g().useDebugValue(e,r)},c.useDeferredValue=function(e,r){return g().useDeferredValue(e,r)},c.useEffect=function(e,r,o){e==null&&console.warn("React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?");var u=g();if(typeof o=="function")throw Error("useEffect CRUD overload is not enabled in this build of React.");return u.useEffect(e,r)},c.useId=function(){return g().useId()},c.useImperativeHandle=function(e,r,o){return g().useImperativeHandle(e,r,o)},c.useInsertionEffect=function(e,r){return e==null&&console.warn("React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?"),g().useInsertionEffect(e,r)},c.useLayoutEffect=function(e,r){return e==null&&console.warn("React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?"),g().useLayoutEffect(e,r)},c.useMemo=function(e,r){return g().useMemo(e,r)},c.useOptimistic=function(e,r){return g().useOptimistic(e,r)},c.useReducer=function(e,r,o){return g().useReducer(e,r,o)},c.useRef=function(e){return g().useRef(e)},c.useState=function(e){return g().useState(e)},c.useSyncExternalStore=function(e,r,o){return g().useSyncExternalStore(e,r,o)},c.useTransition=function(){return g().useTransition()},c.version="19.1.0",typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()}(ce,ce.exports)),ce.exports}var Ie;function Xe(){return Ie||(Ie=1,process.env.NODE_ENV==="production"?Ee.exports=Fe():Ee.exports=Qe()),Ee.exports}/**
38
+ * @license React
39
+ * react-jsx-runtime.development.js
40
+ *
41
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
42
+ *
43
+ * This source code is licensed under the MIT license found in the
44
+ * LICENSE file in the root directory of this source tree.
45
+ */var De;function Ve(){return De||(De=1,process.env.NODE_ENV!=="production"&&function(){function T(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===ue?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case F:return"Fragment";case Q:return"Profiler";case D:return"StrictMode";case y:return"Suspense";case ee:return"SuspenseList";case U:return"Activity"}if(typeof t=="object")switch(typeof t.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),t.$$typeof){case Z:return"Portal";case P:return(t.displayName||"Context")+".Provider";case J:return(t._context.displayName||"Context")+".Consumer";case ne:var n=t.render;return t=t.displayName,t||(t=n.displayName||n.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case te:return n=t.displayName||null,n!==null?n:T(t.type)||"Memo";case M:n=t._payload,t=t._init;try{return T(t(n))}catch{}}return null}function c(t){return""+t}function N(t){try{c(t);var n=!1}catch{n=!0}if(n){n=console;var s=n.error,a=typeof Symbol=="function"&&Symbol.toStringTag&&t[Symbol.toStringTag]||t.constructor.name||"Object";return s.call(n,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",a),c(t)}}function $(t){if(t===F)return"<>";if(typeof t=="object"&&t!==null&&t.$$typeof===M)return"<...>";try{var n=T(t);return n?"<"+n+">":"<...>"}catch{return"<...>"}}function w(){var t=g.A;return t===null?null:t.getOwner()}function b(){return Error("react-stack-top-frame")}function C(t){if(X.call(t,"key")){var n=Object.getOwnPropertyDescriptor(t,"key").get;if(n&&n.isReactWarning)return!1}return t.key!==void 0}function k(t,n){function s(){O||(O=!0,console.error("%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://react.dev/link/special-props)",n))}s.isReactWarning=!0,Object.defineProperty(t,"key",{get:s,configurable:!0})}function W(){var t=T(this.type);return L[t]||(L[t]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),t=this.props.ref,t!==void 0?t:null}function z(t,n,s,a,f,h,l,S){return s=h.ref,t={$$typeof:B,type:t,key:n,props:h,_owner:f},(s!==void 0?s:null)!==null?Object.defineProperty(t,"ref",{enumerable:!1,get:W}):Object.defineProperty(t,"ref",{enumerable:!1,value:null}),t._store={},Object.defineProperty(t._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(t,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(t,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:l}),Object.defineProperty(t,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:S}),Object.freeze&&(Object.freeze(t.props),Object.freeze(t)),t}function I(t,n,s,a,f,h,l,S){var d=n.children;if(d!==void 0)if(a)if(q(d)){for(a=0;a<d.length;a++)G(d[a]);Object.freeze&&Object.freeze(d)}else console.error("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 G(d);if(X.call(n,"key")){d=T(t);var A=Object.keys(n).filter(function(fe){return fe!=="key"});a=0<A.length?"{key: someKey, "+A.join(": ..., ")+": ...}":"{key: someKey}",re[d+a]||(A=0<A.length?"{"+A.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
46
+ let props = %s;
47
+ <%s {...props} />
48
+ React keys must be passed directly to JSX without using spread:
49
+ let props = %s;
50
+ <%s key={someKey} {...props} />`,a,d,A,d),re[d+a]=!0)}if(d=null,s!==void 0&&(N(s),d=""+s),C(n)&&(N(n.key),d=""+n.key),"key"in n){s={};for(var se in n)se!=="key"&&(s[se]=n[se])}else s=n;return d&&k(s,typeof t=="function"?t.displayName||t.name||"Unknown":t),z(t,d,h,f,w(),s,l,S)}function G(t){typeof t=="object"&&t!==null&&t.$$typeof===B&&t._store&&(t._store.validated=1)}var H=Xe(),B=Symbol.for("react.transitional.element"),Z=Symbol.for("react.portal"),F=Symbol.for("react.fragment"),D=Symbol.for("react.strict_mode"),Q=Symbol.for("react.profiler"),J=Symbol.for("react.consumer"),P=Symbol.for("react.context"),ne=Symbol.for("react.forward_ref"),y=Symbol.for("react.suspense"),ee=Symbol.for("react.suspense_list"),te=Symbol.for("react.memo"),M=Symbol.for("react.lazy"),U=Symbol.for("react.activity"),ue=Symbol.for("react.client.reference"),g=H.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=Object.prototype.hasOwnProperty,q=Array.isArray,Y=console.createTask?console.createTask:function(){return null};H={"react-stack-bottom-frame":function(t){return t()}};var O,L={},V=H["react-stack-bottom-frame"].bind(H,b)(),x=Y($(b)),re={};ie.Fragment=F,ie.jsx=function(t,n,s,a,f){var h=1e4>g.recentlyCreatedOwnerStacks++;return I(t,n,s,!1,a,f,h?Error("react-stack-top-frame"):V,h?Y($(t)):x)},ie.jsxs=function(t,n,s,a,f){var h=1e4>g.recentlyCreatedOwnerStacks++;return I(t,n,s,!0,a,f,h?Error("react-stack-top-frame"):V,h?Y($(t)):x)}}()),ie}var Ue;function Ke(){return Ue||(Ue=1,process.env.NODE_ENV==="production"?ve.exports=Be():ve.exports=Ve()),ve.exports}var He=Ke();const Ze="_ribbon_vetc9_1",Je="_content_vetc9_18",et="_bottom_vetc9_34",tt="_right_vetc9_34",rt="_top_vetc9_35",nt="_left_vetc9_35",he={ribbon:Ze,content:Je,bottom:et,right:tt,top:rt,left:nt};function ot({as:T,children:c,backgroundColor:N="white",color:$="black",position:w="top-right",...b}){const C=T??"div",[k,W]=w.split("-");return He.jsx("div",{className:`${he.ribbon} ${he[k]} ${he[W]}`,"data-testid":"ribbon",children:He.jsx(C,{...b,className:he.content,style:{backgroundColor:N,color:$},"data-testid":"ribbon-content",children:c})})}exports.Ribbon=ot;
package/dist/index.css CHANGED
@@ -1,55 +1 @@
1
- .Z10rOW_ribbon {
2
- z-index: 9999;
3
- pointer-events: none;
4
- -webkit-user-select: none;
5
- user-select: none;
6
- opacity: 1;
7
- backface-visibility: hidden;
8
- width: 80px;
9
- height: 80px;
10
- transition: opacity .15s ease-in-out;
11
- position: fixed;
12
- transform: rotate(45deg);
13
- }
14
-
15
- .Z10rOW_ribbon:hover {
16
- opacity: .75;
17
- }
18
-
19
- .Z10rOW_content {
20
- text-align: center;
21
- pointer-events: all;
22
- text-transform: uppercase;
23
- color: #333;
24
- background-color: #fafafa;
25
- width: 150px;
26
- padding: 7px 0;
27
- font: bold 15px sans-serif;
28
- position: relative;
29
- top: 50%;
30
- left: 50%;
31
- transform: translate(-50%, -50%);
32
- box-shadow: 0 0 3px #0000004d;
33
- }
34
-
35
- .Z10rOW_ribbon.Z10rOW_bottom.Z10rOW_right, .Z10rOW_ribbon.Z10rOW_top.Z10rOW_left {
36
- transform: rotate(-45deg);
37
- }
38
-
39
- .Z10rOW_ribbon.Z10rOW_bottom {
40
- bottom: -10px;
41
- }
42
-
43
- .Z10rOW_ribbon.Z10rOW_top {
44
- top: -10px;
45
- }
46
-
47
- .Z10rOW_ribbon.Z10rOW_left {
48
- left: -10px;
49
- }
50
-
51
- .Z10rOW_ribbon.Z10rOW_right {
52
- right: -10px;
53
- }
54
-
55
- /*# sourceMappingURL=index.css.map */
1
+ ._ribbon_vetc9_1{position:fixed;z-index:9999;width:80px;height:80px;pointer-events:none;-webkit-user-select:none;user-select:none;opacity:1;transform:rotate(45deg);transition:opacity .15s ease-in-out;backface-visibility:hidden}._ribbon_vetc9_1:hover{opacity:.75}._content_vetc9_18{font:bold 15px Sans-Serif;text-align:center;position:relative;padding:7px 0;width:150px;box-shadow:0 0 3px #0000004d;pointer-events:all;text-transform:uppercase;transform:translate(-50%,-50%);left:50%;top:50%;background-color:#fafafa;color:#333}._ribbon_vetc9_1._bottom_vetc9_34._right_vetc9_34,._ribbon_vetc9_1._top_vetc9_35._left_vetc9_35{transform:rotate(-45deg)}._ribbon_vetc9_1._bottom_vetc9_34{bottom:-10px}._ribbon_vetc9_1._top_vetc9_35{top:-10px}._ribbon_vetc9_1._left_vetc9_35{left:-10px}._ribbon_vetc9_1._right_vetc9_34{right:-10px}
@@ -0,0 +1,2 @@
1
+ export * from './src/index'
2
+ export {}