@react-hive/honey-style 4.1.0 → 4.2.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.
@@ -1,3 +1,4 @@
1
+ import type { Nullable } from '../../types';
1
2
  import type { HoneyCSSDimensionValue } from '../types';
2
3
  /**
3
4
  * Represents CSS resolution units typically used in media queries.
@@ -51,8 +52,8 @@ export interface HoneyMediaQueryRule extends MediaQueryRuleDimensionProperties,
51
52
  /**
52
53
  * @default screen
53
54
  */
54
- mediaType?: MediaQueryRuleType;
55
- orientation?: MediaQueryRuleOrientation;
55
+ mediaType?: Nullable<MediaQueryRuleType>;
56
+ orientation?: Nullable<MediaQueryRuleOrientation>;
56
57
  update?: MediaQueryRuleUpdate;
57
58
  }
58
59
  /**
@@ -1,19 +1,11 @@
1
+ import type { HexColor } from '@react-hive/honey-utils';
1
2
  import * as CSS from 'csstype';
2
3
  export type HoneyCSSClassName = string | undefined;
3
- /**
4
- * Represents a hexadecimal color value.
5
- *
6
- * Examples:
7
- * - `'#ffffff'`
8
- * - `'#123abc'`
9
- * - `'#000'`
10
- */
11
- export type HoneyHEXColor = `#${string}`;
12
4
  /**
13
5
  * Represents any valid CSS color, either a named color (like `'red'`, `'blue'`)
14
6
  * or a hexadecimal color code (like `'#ff0000'`).
15
7
  */
16
- export type HoneyCSSColor = HoneyHEXColor | CSS.DataType.ColorBase | CSS.Globals;
8
+ export type HoneyCSSColor = HexColor | CSS.DataType.ColorBase | CSS.Globals;
17
9
  /**
18
10
  * Represents absolute CSS dimension units.
19
11
  *
package/dist/index.cjs CHANGED
@@ -1,9 +1,9 @@
1
1
  /*! For license information please see index.cjs.LICENSE.txt */
2
- (()=>{"use strict";var e={131(e,t){var o=Symbol.for("react.transitional.element");Symbol.for("react.fragment"),t.jsx=function(e,t,n){var r=null;if(void 0!==n&&(r=""+n),void 0!==t.key&&(r=""+t.key),"key"in t)for(var a in n={},t)"key"!==a&&(n[a]=t[a]);else n=t;return t=n.ref,{$$typeof:o,type:e,key:r,ref:void 0!==t?t:null,props:n}}},615(e,t,o){e.exports=o(131)}},t={};function o(n){var r=t[n];if(void 0!==r)return r.exports;var a=t[n]={exports:{}};return e[n](a,a.exports,o),a.exports}o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};o.r(n),o.d(n,{CSS_COLOR_PROPERTIES:()=>k,CSS_SPACING_PROPERTIES:()=>x,HONEY_BREAKPOINTS:()=>l,HONEY_GLOBAL_STYLE_ATTR:()=>i,HONEY_STYLED_COMPONENT_ID_PROP:()=>a,HONEY_STYLE_ATTR:()=>s,HoneyStyleContext:()=>h,HoneyStyleProvider:()=>fe,VALID_DOM_ELEMENT_ATTRS:()=>y,__DEV__:()=>r,checkIsThemeColorValue:()=>ce,combineClassNames:()=>ae,convertHexToHexWithAlpha:()=>ye,createCssRule:()=>D,createGlobalStyle:()=>ge,css:()=>L,filterNonHtmlAttrs:()=>le,generateId:()=>re,isStyledComponent:()=>se,mediaQuery:()=>X,processCss:()=>ne,pxToRem:()=>pe,resolveClassName:()=>ie,resolveColor:()=>me,resolveDimension:()=>he,resolveFont:()=>de,resolveSpacing:()=>ue,styled:()=>Se,useHoneyStyle:()=>be});const r=!1;r&&console.info("[@react-hive/honey-style]: You are running in development mode. This build is not optimized for production and may include extra checks or logs.");const a="$$ComponentId",i="data-honey-global-style",s="data-honey-style",l=["xs","sm","md","lg","xl"],p=new Set(["accept","accessKey","autoCapitalize","autoComplete","autoFocus","capture","class","className","contentEditable","contextMenu","dir","draggable","hidden","id","inert","inputMode","is","lang","nonce","part","slot","spellCheck","style","tabIndex","title","translate","unselectable","checked","disabled","form","formAction","formEncType","formMethod","formNoValidate","formTarget","list","max","maxLength","min","minLength","multiple","name","pattern","placeholder","readOnly","required","size","step","type","value","alt","controls","crossOrigin","height","isMap","loop","media","muted","poster","preload","role","src","srcSet","useMap","width","download","href","hrefLang","referrerPolicy","rel","target","dangerouslySetInnerHTML","key","ref","children","char","charOff","exportparts","popover","popoverTarget","popoverTargetAction","virtualkeyboardpolicy","writingsuggestions"]),c=new Set(["colSpan","rowSpan","headers","abbr","scope","align","valign"]),u=new Set(["viewBox","fill","stroke","strokeWidth","strokeLinecap","strokeLinejoin","strokeDasharray","strokeDashoffset","strokeOpacity","fillOpacity","opacity","pointerEvents","focusable","x","y","x1","x2","y1","y2","cx","cy","r","rx","ry","d","points","height","transform","xmlns","preserveAspectRatio","mask","clipPath","pathLength","markerStart","markerMid","markerEnd","refX","refY","dominantBaseline","textAnchor"]),d=new Set(["onCopy","onCut","onPaste","onCompositionEnd","onCompositionStart","onCompositionUpdate","onFocus","onBlur","onChange","onInput","onInvalid","onReset","onSubmit","onKeyDown","onKeyPress","onKeyUp","onClick","onContextMenu","onDoubleClick","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp","onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop","onPointerDown","onPointerMove","onPointerUp","onPointerCancel","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut","onGotPointerCapture","onLostPointerCapture","onSelect","onTouchCancel","onTouchEnd","onTouchMove","onTouchStart","onScroll","onWheel","onAbort","onCanPlay","onCanPlayThrough","onDurationChange","onEmptied","onEncrypted","onEnded","onLoadedData","onLoadedMetadata","onLoadStart","onPause","onPlay","onPlaying","onProgress","onRateChange","onSeeked","onSeeking","onStalled","onSuspend","onTimeUpdate","onVolumeChange","onWaiting","onLoad","onError","onTransitionEnd","onTransitionStart","onTransitionRun","onTransitionCancel","onAnimationStart","onAnimationEnd","onAnimationIteration","onAnimationCancel"]),y=new Set([...p,...c,...u,...d]),m=require("react"),h=(0,m.createContext)(void 0);var f=o(615);const b=e=>"string"==typeof e,g=(e,...t)=>"function"==typeof e?e(...t):e,v=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),x=["margin","marginTop","marginRight","marginBottom","marginLeft","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingBlock","paddingBlockStart","paddingBlockEnd","top","right","bottom","left","inset","gap","rowGap","columnGap"],k=["color","backgroundColor","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","outlineColor","textDecorationColor","fill","stroke"],$=e=>"{"===e||"}"===e||":"===e||";"===e||"@"===e||"("===e||'"'===e||"'"===e||"/"===e;function C(e,t){if(!e)throw new Error(t)}const S=e=>{const t=[],o=()=>t.join("").trim();for(;!e.isEof();){const n=e.peek();if(!n)break;switch(n.type){case"braceOpen":case"braceClose":default:return o();case"colon":t.push(":");break;case"text":case"params":t.push(n.value);break;case"string":t.push(`"${n.value}"`)}e.next()}return o()},w=e=>{const t=e.peek();if(!t)return"";if("colon"===t.type)return S(e);const o=e.mark(),n=S(e);return"braceOpen"===e.peek()?.type?n:(e.reset(o),e.readUntil(["colon","braceOpen","semicolon","braceClose","at"]))},E=(e,t)=>{e.expect("colon");const o=e.readUntil(["semicolon","braceClose"]);return"semicolon"===e.peek()?.type&&e.next(),{type:"declaration",prop:t,value:o}},O=(e,t)=>{let o=0,n=0,r=0,a=null,i=!1;for(let s=0;s<e.length;s++){const l=e.charCodeAt(s);if(i)i=!1;else if(92!==l)if(null===a)if(34!==l&&39!==l)if(40!==l)if(41!==l)if(91!==l)if(93!==l){if(44===l&&0===n&&0===r){const n=e.slice(o,s).trim();n&&t(n),o=s+1}}else r--;else r++;else n--;else n++;else a=l;else l===a&&(a=null);else i=!0}const s=e.slice(o).trim();s&&t(s)},T=(e,t)=>{const o=e.trim();if(!o)return"";const n=t.trim();if(!n)return o;const r=-1!==n.indexOf(","),a=-1!==o.indexOf(","),i=-1!==o.indexOf("&");if(!r&&!a)return i?o.replaceAll("&",n):`${n} ${o}`;const s=[];return O(n,e=>{O(o,t=>{t.includes("&")?s.push(t.replaceAll("&",e)):s.push(`${e} ${t}`)})}),s.join(", ")},P=e=>{switch(e.type){case"declaration":return(e=>{const t=e.value.trim();return t?`${e.prop}:${t};`:""})(e);case"rule":return(e=>{const t=e.body.map(P).join("");return t?`${e.selector}{${t}}`:""})(e);case"atRule":return(e=>{const t=e.params?` ${e.params}`:"";if(null===e.body)return`@${e.name}${t};`;const o=e.body.map(P).join("");return o?`@${e.name}${t}{${o}}`:""})(e);default:return""}},R=(e,t)=>(e.expect("braceOpen"),{type:"rule",selector:t,body:_(e)}),A=(e,{stopAtBraceClose:t})=>{const o=[];for(;!e.isEof();){const n=e.peek();if(!n)break;if(t&&"braceClose"===n.type){e.next();break}if("semicolon"===n.type){e.next();continue}if("at"===n.type){o.push(M(e));continue}const r=w(e);r?"colon"!==e.peek()?.type?"braceOpen"!==e.peek()?.type?e.next():o.push(R(e,r)):o.push(E(e,r)):e.next()}return o},_=e=>A(e,{stopAtBraceClose:!0}),M=e=>{e.expect("at");const t=e.readUntil(["semicolon","braceOpen"]),{name:o,params:n}=(e=>{const t=e.trim();if(!t)return{name:"",params:void 0};let o=0;const n=t.length;for(;o<n;){const e=t[o];if(" "===e||"\t"===e||"\n"===e||"\r"===e||"\f"===e||"("===e)break;o++}const r=t.slice(0,o);for(;o<n;){const e=t[o];if(" "!==e&&"\t"!==e&&"\n"!==e&&"\r"!==e&&"\f"!==e)break;o++}return{name:r,params:t.slice(o)||void 0}})(t);let r=n;if("params"===e.peek()?.type){const t=e.expect("params").value;r=r?`${r}${t}`:t}return"braceOpen"===e.peek()?.type?{type:"atRule",name:o,params:r,body:_(e)}:("semicolon"===e.peek()?.type&&e.next(),{type:"atRule",name:o,params:r,body:null})},j=(e,t)=>{return!1===e||(""===(o=e)||(e=>null==e)(o))?"":(e=>"function"==typeof e)(e)?se(e)?`.${e[a]}`:j(e(t),t):(e=>Array.isArray(e))(e)?e.map(e=>j(e,t)).join("\n"):(e=>"object"==typeof e)(e)?Object.entries(e).filter(([,e])=>void 0!==e&&!1!==e).map(([e,t])=>`${v(e)}: ${t};`).join("\n"):e.toString?.()??"";var o},L=(e,...t)=>o=>e.reduce((e,n,r)=>e+n+j(t[r],o),""),D=(e,t)=>`${e}{${t}}`,H={media:!0,supports:!0,container:!0,layer:!0},N=(e,t)=>{const o=t?T(e.selector,t):e.selector;return B(e.body,o)},B=(e,t)=>{const o=[],n=[],r=()=>{t&&0!==n.length&&(o.push({type:"rule",selector:t,body:n.slice()}),n.length=0)};for(let a=0;a<e.length;a++){const i=e[a];if("declaration"!==i.type)if("rule"!==i.type)if("atRule"!==i.type)r(),o.push(i);else{if(r(),!H[i.name]){o.push(i);continue}o.push({...i,body:i.body&&i.body.length>0?B(i.body,t):i.body})}else r(),o.push(...N(i,t));else n.push(i)}return r(),o},I={media:!0,supports:!0,container:!0,layer:!0},W=(e,t)=>e.map(e=>"rule"===e.type?{...e,selector:T(e.selector,t)}:"atRule"===e.type&&I[e.name]?{...e,body:null===e.body?null:W(e.body,t)}:e),U=(e,t)=>o=>{const n=o=>{const r=[];for(const a of o){if("atRule"===a.type&&a.name===e){const e=n(a.body??[]),o=t({...a,body:e});r.push(...o);continue}"rule"!==a.type?"atRule"!==a.type?r.push(a):r.push({...a,body:null===a.body?null:n(a.body)}):r.push({...a,body:n(a.body)})}return r};return{...o,body:n(o.body)}},z=U("honey-absolute-fill",e=>[{type:"declaration",prop:"position",value:"absolute"},{type:"declaration",prop:"inset",value:"0"},...e.body??[]]),Y=e=>{if(!e)return"";const t=e.trim();return t.startsWith("(")&&t.endsWith(")")?t.slice(1,-1).trim():t},F=U("honey-center",e=>{const t=[];switch(Y(e.params)){case"horizontal":case"x":t.push({type:"declaration",prop:"display",value:"flex"},{type:"declaration",prop:"justify-content",value:"center"});break;case"vertical":case"y":t.push({type:"declaration",prop:"display",value:"flex"},{type:"declaration",prop:"align-items",value:"center"});break;case"block":t.push({type:"declaration",prop:"display",value:"block"},{type:"declaration",prop:"text-align",value:"center"});break;case"inline":t.push({type:"declaration",prop:"display",value:"inline-flex"},{type:"declaration",prop:"align-items",value:"center"},{type:"declaration",prop:"justify-content",value:"center"});break;default:t.push({type:"declaration",prop:"display",value:"flex"},{type:"declaration",prop:"align-items",value:"center"},{type:"declaration",prop:"justify-content",value:"center"})}return[...t,...e.body??[]]}),G=U("honey-stack",e=>{const t=Y(e.params),o=[{type:"declaration",prop:"display",value:"flex"},{type:"declaration",prop:"flex-direction",value:"column"}];return t&&o.push({type:"declaration",prop:"gap",value:t}),[...o,...e.body??[]]}),K=x.map(v),V=({theme:e})=>{const t=e?.spacings?.base??0,o=e=>e.map(e=>{if("rule"===e.type)return{...e,body:o(e.body)};if("atRule"===e.type)return{...e,body:null===e.body?null:o(e.body)};if("declaration"===e.type){if(!K.includes(e.prop))return e;if(/[()]/.test(e.value))return e;const o=e.value.trim().split(/\s+/);return{...e,value:o.map(e=>((e,t)=>{const o=e.trim();return/[a-z%]+$/i.test(o)?o:/^-?\d*\.?\d+$/.test(o)?parseFloat(o)*t+"px":o})(e,t)).join(" ")}}return e});return e=>({...e,body:o(e.body)})},q=U("honey-ellipsis",e=>[{type:"declaration",prop:"white-space",value:"nowrap"},{type:"declaration",prop:"overflow",value:"hidden"},{type:"declaration",prop:"text-overflow",value:"ellipsis"},...e.body??[]]),Q=U("honey-inline",e=>{const t=Y(e.params),o=[{type:"declaration",prop:"display",value:"flex"},{type:"declaration",prop:"align-items",value:"center"}];return t&&o.push({type:"declaration",prop:"gap",value:t}),[...o,...e.body??[]]}),X=e=>`@media ${e.map(e=>{const t=[e.width&&["width",e.width],e.minWidth&&["min-width",e.minWidth],e.maxWidth&&["max-width",e.maxWidth],e.height&&["height",e.height],e.minHeight&&["min-height",e.minHeight],e.maxHeight&&["max-height",e.maxHeight],e.orientation&&["orientation",e.orientation],e.minResolution&&["min-resolution",e.minResolution],e.maxResolution&&["max-resolution",e.maxResolution],e.resolution&&["resolution",e.resolution],e.update&&["update",e.update]],o=(r=t,r.filter(Boolean)).map(([e,t])=>`(${e}: ${t})`).join(" and "),n=o?` and ${o}`:"";var r;return`${e.operator?`${e.operator} `:""}${e.mediaType??"screen"}${n}`}).join(", ")}`,Z=e=>"portrait"===e||"landscape"===e,J=e=>"all"===e||"print"===e||"screen"===e||"speech"===e,ee=e=>/^[a-z]+\b(:up|:down)?$/i.test(e),te=e=>{const[t,o]=e.split(":");return{key:t,direction:o??"up"}},oe=({theme:e})=>U("honey-media",t=>{if(!e?.breakpoints)return[];const o=Y(t.params);if(!o)return[];const n=o.split(/\s+/);let a,i;const s=[];for(const t of n){if(Z(t)){a=t;continue}if(J(t)){i=t;continue}if(!ee(t)){r&&console.warn(`[@react-hive/honey-style]: Unknown @honey-media token: "${t}".`);continue}const o=te(t),n=o.key in e.breakpoints?e.breakpoints[o.key]:null;if(!n){r&&console.warn(`[@react-hive/honey-style]: Unknown breakpoint "${o.key}" in @honey-media.`);continue}let l;"up"===o.direction?l={minWidth:`${n}px`}:"down"===o.direction&&(l={maxWidth:`${n}px`}),l&&s.push(l)}if(!s.length)return[];const l=s.map(e=>({...e,orientation:a,mediaType:i}));return[{type:"atRule",name:"media",params:X(l).replace(/^@media\s*/,""),body:t.body}]}),ne=(e,{theme:t,selector:o}={})=>{const n=(e=>{const t=(e=>{const t=[];let o=0;const n=()=>o>=e.length,r=()=>n()?void 0:e[o],a=()=>o+1>=e.length?void 0:e[o+1],i=()=>{for(;;){const e=r();if(!e||!/\s/.test(e))return;o++}},s=()=>{if("/"!==r()||"/"!==a())return!1;for(o+=2;!n();){if("\n"===r()){o++;break}o++}return!0},l=()=>{if("/"!==r()||"*"!==a())return!1;for(o+=2;!n();){if("*"===r()&&"/"===a())return o+=2,!0;o++}return!0},p=()=>{const e=r();if(!e)return"";o++;let t="";for(;!n();){const n=r();if(!n)break;if("\\"===n){t+=n,o++;const e=r();e&&(t+=e,o++);continue}if(n===e){o++;break}t+=n,o++}return t},c=()=>{let e=0,t="";for(;!n();){const n=r();if(!n)break;if("("===n?e++:")"===n&&e--,t+=n,o++,0===e)break}return t},u=()=>{let e="";for(;!n();){const t=r();if(!t)break;if($(t))break;e+=t,o++}return e.trim()};for(;!n()&&(i(),!n());){if(s()||l())continue;const e=r();if(!e)break;if("{"===e){t.push({type:"braceOpen"}),o++;continue}if("}"===e){t.push({type:"braceClose"}),o++;continue}if(":"===e){t.push({type:"colon"}),o++;continue}if(";"===e){t.push({type:"semicolon"}),o++;continue}if("@"===e){t.push({type:"at"}),o++;continue}if("("===e){t.push({type:"params",value:c()});continue}if('"'===e||"'"===e){t.push({type:"string",value:p()});continue}const n=u();n?t.push({type:"text",value:n}):o++}return t})(e),o=(e=>{let t=0;const o=()=>t>=e.length,n=()=>o()?void 0:e[t],r=()=>o()?void 0:e[t++];return{isEof:o,peek:n,next:r,mark:()=>t,reset:e=>{t=e},expect:e=>{const t=r();return C(t,`[@react-hive/honey-css]: Expected "${e}" but reached end of input.`),C(t.type===e,`[@react-hive/honey-css]: Expected "${e}" but got "${t.type}".`),t},readUntil:e=>{let t,a="";for(;!o();){const o=n();if(!o||e.includes(o.type))break;"text"===o.type?("text"===t&&a&&(a+=" "),a+=o.value):"string"===o.type?a+=`"${o.value}"`:"params"===o.type&&(a+=o.value),t=o.type,r()}return a.trim()},skipUntil:e=>{for(;!o();){const t=n();if(!t||e.includes(t.type))break;r()}}}})(t);return{type:"stylesheet",body:A(o,{stopAtBraceClose:!1})}})(o?D(o,e):e);return((e,t)=>{const o=(e=>({...e,body:B(e.body)}))(t?{...e,body:W(e.body,t)}:e);return o.body.map(P).filter(Boolean).join("")})([G,Q,F,z,q,oe({theme:t}),V({theme:t})].reduce((e,t)=>t(e),n))},re=e=>`${e}-${Math.floor(1e3*performance.now()).toString(36)}${Math.random().toString(36).slice(2,10)}`,ae=e=>e.filter(Boolean).join(" ").trim(),ie=e=>`hscn-${(e=>{let t=5381;for(let o=0;o<e.length;o++)t=33*t^e.charCodeAt(o);return(t>>>0).toString(36)})(e)}`,se=e=>a in e,le=e=>Object.entries(e).reduce((e,[t,o])=>((y.has(t)||t.startsWith("data-")||t.startsWith("aria-"))&&(e[t]=o),e),{}),pe=(e,t=16)=>e/t+"rem",ce=e=>2===e.split(".").length,ue=(e,t="px",o="base")=>({theme:n})=>{if("string"==typeof e)return e;const r=n.spacings[o]??0;if("number"==typeof e){const o=e*r;return t?`${o}${t}`:o}return e.map(e=>{if("string"==typeof e)return e;const o=e*r;return t?`${o}${t}`:o}).join(" ")},de=e=>({theme:t})=>{const o=t.fonts[e];return L`
2
+ (()=>{"use strict";var e={131(e,t){var o=Symbol.for("react.transitional.element");Symbol.for("react.fragment"),t.jsx=function(e,t,n){var r=null;if(void 0!==n&&(r=""+n),void 0!==t.key&&(r=""+t.key),"key"in t)for(var a in n={},t)"key"!==a&&(n[a]=t[a]);else n=t;return t=n.ref,{$$typeof:o,type:e,key:r,ref:void 0!==t?t:null,props:n}}},615(e,t,o){e.exports=o(131)}},t={};function o(n){var r=t[n];if(void 0!==r)return r.exports;var a=t[n]={exports:{}};return e[n](a,a.exports,o),a.exports}o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};o.r(n),o.d(n,{CSS_COLOR_PROPERTIES:()=>$,CSS_SPACING_PROPERTIES:()=>x,HONEY_BREAKPOINTS:()=>l,HONEY_GLOBAL_STYLE_ATTR:()=>i,HONEY_STYLED_COMPONENT_ID_PROP:()=>a,HONEY_STYLE_ATTR:()=>s,HoneyStyleContext:()=>h,HoneyStyleProvider:()=>fe,VALID_DOM_ELEMENT_ATTRS:()=>y,__DEV__:()=>r,checkIsThemeColorValue:()=>ue,combineClassNames:()=>ie,createCssRule:()=>N,createGlobalStyle:()=>ge,css:()=>D,filterNonHtmlAttrs:()=>pe,generateId:()=>ae,isStyledComponent:()=>le,mediaQuery:()=>Z,processCss:()=>re,pxToRem:()=>ce,resolveClassName:()=>se,resolveColor:()=>me,resolveDimension:()=>he,resolveFont:()=>ye,resolveSpacing:()=>de,styled:()=>Se,useHoneyStyle:()=>be});const r=!1;r&&console.info("[@react-hive/honey-style]: You are running in development mode. This build is not optimized for production and may include extra checks or logs.");const a="$$ComponentId",i="data-honey-global-style",s="data-honey-style",l=["xs","sm","md","lg","xl"],p=new Set(["accept","accessKey","autoCapitalize","autoComplete","autoFocus","capture","class","className","contentEditable","contextMenu","dir","draggable","hidden","id","inert","inputMode","is","lang","nonce","part","slot","spellCheck","style","tabIndex","title","translate","unselectable","checked","disabled","form","formAction","formEncType","formMethod","formNoValidate","formTarget","list","max","maxLength","min","minLength","multiple","name","pattern","placeholder","readOnly","required","size","step","type","value","alt","controls","crossOrigin","height","isMap","loop","media","muted","poster","preload","role","src","srcSet","useMap","width","download","href","hrefLang","referrerPolicy","rel","target","dangerouslySetInnerHTML","key","ref","children","char","charOff","exportparts","popover","popoverTarget","popoverTargetAction","virtualkeyboardpolicy","writingsuggestions"]),c=new Set(["colSpan","rowSpan","headers","abbr","scope","align","valign"]),u=new Set(["viewBox","fill","stroke","strokeWidth","strokeLinecap","strokeLinejoin","strokeDasharray","strokeDashoffset","strokeOpacity","fillOpacity","opacity","pointerEvents","focusable","x","y","x1","x2","y1","y2","cx","cy","r","rx","ry","d","points","height","transform","xmlns","preserveAspectRatio","mask","clipPath","pathLength","markerStart","markerMid","markerEnd","refX","refY","dominantBaseline","textAnchor"]),d=new Set(["onCopy","onCut","onPaste","onCompositionEnd","onCompositionStart","onCompositionUpdate","onFocus","onBlur","onChange","onInput","onInvalid","onReset","onSubmit","onKeyDown","onKeyPress","onKeyUp","onClick","onContextMenu","onDoubleClick","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp","onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop","onPointerDown","onPointerMove","onPointerUp","onPointerCancel","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut","onGotPointerCapture","onLostPointerCapture","onSelect","onTouchCancel","onTouchEnd","onTouchMove","onTouchStart","onScroll","onWheel","onAbort","onCanPlay","onCanPlayThrough","onDurationChange","onEmptied","onEncrypted","onEnded","onLoadedData","onLoadedMetadata","onLoadStart","onPause","onPlay","onPlaying","onProgress","onRateChange","onSeeked","onSeeking","onStalled","onSuspend","onTimeUpdate","onVolumeChange","onWaiting","onLoad","onError","onTransitionEnd","onTransitionStart","onTransitionRun","onTransitionCancel","onAnimationStart","onAnimationEnd","onAnimationIteration","onAnimationCancel"]),y=new Set([...p,...c,...u,...d]),m=require("react"),h=(0,m.createContext)(void 0);var f=o(615);function b(e,t){if(!e)throw new Error(t)}const g=e=>"string"==typeof e,v=(e,...t)=>"function"==typeof e?e(...t):e,k=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),x=["margin","marginTop","marginRight","marginBottom","marginLeft","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingBlock","paddingBlockStart","paddingBlockEnd","top","right","bottom","left","inset","gap","rowGap","columnGap"],$=["color","backgroundColor","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","outlineColor","textDecorationColor","fill","stroke"],C=e=>"{"===e||"}"===e||":"===e||";"===e||"@"===e||"("===e||'"'===e||"'"===e||"/"===e;function S(e,t){if(!e)throw new Error(t)}const w=e=>{const t=[],o=()=>t.join("").trim();for(;!e.isEof();){const n=e.peek();if(!n)break;switch(n.type){case"braceOpen":case"braceClose":default:return o();case"colon":t.push(":");break;case"text":case"params":t.push(n.value);break;case"string":t.push(`"${n.value}"`)}e.next()}return o()},E=e=>{const t=e.peek();if(!t)return"";if("colon"===t.type)return w(e);const o=e.mark(),n=w(e);return"braceOpen"===e.peek()?.type?n:(e.reset(o),e.readUntil(["colon","braceOpen","semicolon","braceClose","at"]))},O=(e,t)=>{e.expect("colon");const o=e.readUntil(["semicolon","braceClose"]);return"semicolon"===e.peek()?.type&&e.next(),{type:"declaration",prop:t,value:o}},T=(e,t)=>{let o=0,n=0,r=0,a=null,i=!1;for(let s=0;s<e.length;s++){const l=e.charCodeAt(s);if(i)i=!1;else if(92!==l)if(null===a)if(34!==l&&39!==l)if(40!==l)if(41!==l)if(91!==l)if(93!==l){if(44===l&&0===n&&0===r){const n=e.slice(o,s).trim();n&&t(n),o=s+1}}else r--;else r++;else n--;else n++;else a=l;else l===a&&(a=null);else i=!0}const s=e.slice(o).trim();s&&t(s)},P=(e,t)=>{const o=e.trim();if(!o)return"";const n=t.trim();if(!n)return o;const r=-1!==n.indexOf(","),a=-1!==o.indexOf(","),i=-1!==o.indexOf("&");if(!r&&!a)return i?o.replaceAll("&",n):`${n} ${o}`;const s=[];return T(n,e=>{T(o,t=>{t.includes("&")?s.push(t.replaceAll("&",e)):s.push(`${e} ${t}`)})}),s.join(", ")},R=e=>{switch(e.type){case"declaration":return(e=>{const t=e.value.trim();return t?`${e.prop}:${t};`:""})(e);case"rule":return(e=>{const t=e.body.map(R).join("");return t?`${e.selector}{${t}}`:""})(e);case"atRule":return(e=>{const t=e.params?` ${e.params}`:"";if(null===e.body)return`@${e.name}${t};`;const o=e.body.map(R).join("");return o?`@${e.name}${t}{${o}}`:""})(e);default:return""}},A=(e,t)=>(e.expect("braceOpen"),{type:"rule",selector:t,body:M(e)}),_=(e,{stopAtBraceClose:t})=>{const o=[];for(;!e.isEof();){const n=e.peek();if(!n)break;if(t&&"braceClose"===n.type){e.next();break}if("semicolon"===n.type){e.next();continue}if("at"===n.type){o.push(j(e));continue}const r=E(e);r?"colon"!==e.peek()?.type?"braceOpen"!==e.peek()?.type?e.next():o.push(A(e,r)):o.push(O(e,r)):e.next()}return o},M=e=>_(e,{stopAtBraceClose:!0}),j=e=>{e.expect("at");const t=e.readUntil(["semicolon","braceOpen"]),{name:o,params:n}=(e=>{const t=e.trim();if(!t)return{name:"",params:void 0};let o=0;const n=t.length;for(;o<n;){const e=t[o];if(" "===e||"\t"===e||"\n"===e||"\r"===e||"\f"===e||"("===e)break;o++}const r=t.slice(0,o);for(;o<n;){const e=t[o];if(" "!==e&&"\t"!==e&&"\n"!==e&&"\r"!==e&&"\f"!==e)break;o++}return{name:r,params:t.slice(o)||void 0}})(t);let r=n;if("params"===e.peek()?.type){const t=e.expect("params").value;r=r?`${r}${t}`:t}return"braceOpen"===e.peek()?.type?{type:"atRule",name:o,params:r,body:M(e)}:("semicolon"===e.peek()?.type&&e.next(),{type:"atRule",name:o,params:r,body:null})},L=(e,t)=>{return!1===e||(""===(o=e)||(e=>null==e)(o))?"":(e=>"function"==typeof e)(e)?le(e)?`.${e[a]}`:L(e(t),t):(e=>Array.isArray(e))(e)?e.map(e=>L(e,t)).join("\n"):(e=>"object"==typeof e)(e)?Object.entries(e).filter(([,e])=>void 0!==e&&!1!==e).map(([e,t])=>`${k(e)}: ${t};`).join("\n"):e.toString?.()??"";var o},D=(e,...t)=>o=>e.reduce((e,n,r)=>e+n+L(t[r],o),""),N=(e,t)=>`${e}{${t}}`,H={media:!0,supports:!0,container:!0,layer:!0},B=(e,t)=>{const o=t?P(e.selector,t):e.selector;return I(e.body,o)},I=(e,t)=>{const o=[],n=[],r=()=>{t&&0!==n.length&&(o.push({type:"rule",selector:t,body:n.slice()}),n.length=0)};for(let a=0;a<e.length;a++){const i=e[a];if("declaration"!==i.type)if("rule"!==i.type)if("atRule"!==i.type)r(),o.push(i);else{if(r(),!H[i.name]){o.push(i);continue}o.push({...i,body:i.body&&i.body.length>0?I(i.body,t):i.body})}else r(),o.push(...B(i,t));else n.push(i)}return r(),o},U={media:!0,supports:!0,container:!0,layer:!0},W=(e,t)=>e.map(e=>"rule"===e.type?{...e,selector:P(e.selector,t)}:"atRule"===e.type&&U[e.name]?{...e,body:null===e.body?null:W(e.body,t)}:e),z=(e,t)=>o=>{const n=o=>{const r=[];for(const a of o){if("atRule"===a.type&&a.name===e){const e=n(a.body??[]),o=t({...a,body:e});r.push(...o);continue}"rule"!==a.type?"atRule"!==a.type?r.push(a):r.push({...a,body:null===a.body?null:n(a.body)}):r.push({...a,body:n(a.body)})}return r};return{...o,body:n(o.body)}},Y=z("honey-absolute-fill",e=>[{type:"declaration",prop:"position",value:"absolute"},{type:"declaration",prop:"inset",value:"0"},...e.body??[]]),F=e=>{if(!e)return"";const t=e.trim();return t.startsWith("(")&&t.endsWith(")")?t.slice(1,-1).trim():t},G=z("honey-center",e=>{const t=[];switch(F(e.params)){case"horizontal":case"x":t.push({type:"declaration",prop:"display",value:"flex"},{type:"declaration",prop:"justify-content",value:"center"});break;case"vertical":case"y":t.push({type:"declaration",prop:"display",value:"flex"},{type:"declaration",prop:"align-items",value:"center"});break;case"block":t.push({type:"declaration",prop:"display",value:"block"},{type:"declaration",prop:"text-align",value:"center"});break;case"inline":t.push({type:"declaration",prop:"display",value:"inline-flex"},{type:"declaration",prop:"align-items",value:"center"},{type:"declaration",prop:"justify-content",value:"center"});break;default:t.push({type:"declaration",prop:"display",value:"flex"},{type:"declaration",prop:"align-items",value:"center"},{type:"declaration",prop:"justify-content",value:"center"})}return[...t,...e.body??[]]}),K=z("honey-stack",e=>{const t=F(e.params),o=[{type:"declaration",prop:"display",value:"flex"},{type:"declaration",prop:"flex-direction",value:"column"}];return t&&o.push({type:"declaration",prop:"gap",value:t}),[...o,...e.body??[]]}),V=x.map(k),q=({theme:e})=>{const t=e?.spacings?.base??0,o=e=>e.map(e=>{if("rule"===e.type)return{...e,body:o(e.body)};if("atRule"===e.type)return{...e,body:null===e.body?null:o(e.body)};if("declaration"===e.type){if(!V.includes(e.prop))return e;if(/[()]/.test(e.value))return e;const o=e.value.trim().split(/\s+/);return{...e,value:o.map(e=>((e,t)=>{const o=e.trim();return/[a-z%]+$/i.test(o)?o:/^-?\d*\.?\d+$/.test(o)?parseFloat(o)*t+"px":o})(e,t)).join(" ")}}return e});return e=>({...e,body:o(e.body)})},Q=z("honey-ellipsis",e=>[{type:"declaration",prop:"white-space",value:"nowrap"},{type:"declaration",prop:"overflow",value:"hidden"},{type:"declaration",prop:"text-overflow",value:"ellipsis"},...e.body??[]]),X=z("honey-inline",e=>{const t=F(e.params),o=[{type:"declaration",prop:"display",value:"flex"},{type:"declaration",prop:"align-items",value:"center"}];return t&&o.push({type:"declaration",prop:"gap",value:t}),[...o,...e.body??[]]}),Z=e=>`@media ${e.map(e=>{const t=[e.width&&["width",e.width],e.minWidth&&["min-width",e.minWidth],e.maxWidth&&["max-width",e.maxWidth],e.height&&["height",e.height],e.minHeight&&["min-height",e.minHeight],e.maxHeight&&["max-height",e.maxHeight],e.orientation&&["orientation",e.orientation],e.minResolution&&["min-resolution",e.minResolution],e.maxResolution&&["max-resolution",e.maxResolution],e.resolution&&["resolution",e.resolution],e.update&&["update",e.update]],o=(r=t,r.filter(Boolean)).map(([e,t])=>`(${e}: ${t})`).join(" and "),n=o?` and ${o}`:"";var r;return`${e.operator?`${e.operator} `:""}${e.mediaType??"screen"}${n}`}).join(", ")}`,J=e=>"portrait"===e||"landscape"===e,ee=e=>"all"===e||"print"===e||"screen"===e||"speech"===e,te=e=>/^[a-z]+\b(:up|:down)?$/i.test(e),oe=e=>{const[t,o]=e.split(":");return{key:t,direction:o??"up"}},ne=({theme:e})=>z("honey-media",t=>{if(!e?.breakpoints)return[];const o=F(t.params);if(!o)return[];const n=o.split(/\s+/);let a=null,i=null;const s=[];for(const t of n){if(J(t)){a=t;continue}if(ee(t)){i=t;continue}if(!te(t)){r&&console.warn(`[@react-hive/honey-style]: Unknown @honey-media token: "${t}".`);continue}const o=oe(t),n=o.key in e.breakpoints?e.breakpoints[o.key]:null;if(!n){r&&console.warn(`[@react-hive/honey-style]: Unknown breakpoint "${o.key}" in @honey-media.`);continue}let l;"up"===o.direction?l={minWidth:`${n}px`}:"down"===o.direction&&(l={maxWidth:`${n}px`}),l&&s.push(l)}let l=[];return s.length?l=s.map(e=>({...e,orientation:a,mediaType:i})):(i&&l.push({mediaType:i}),a&&l.push({orientation:a})),l.length?[{type:"atRule",name:"media",params:Z(l).replace(/^@media\s*/,""),body:t.body}]:[]}),re=(e,{theme:t,selector:o}={})=>{const n=(e=>{const t=(e=>{const t=[];let o=0;const n=()=>o>=e.length,r=()=>n()?void 0:e[o],a=()=>o+1>=e.length?void 0:e[o+1],i=()=>{for(;;){const e=r();if(!e||!/\s/.test(e))return;o++}},s=()=>{if("/"!==r()||"/"!==a())return!1;for(o+=2;!n();){if("\n"===r()){o++;break}o++}return!0},l=()=>{if("/"!==r()||"*"!==a())return!1;for(o+=2;!n();){if("*"===r()&&"/"===a())return o+=2,!0;o++}return!0},p=()=>{const e=r();if(!e)return"";o++;let t="";for(;!n();){const n=r();if(!n)break;if("\\"===n){t+=n,o++;const e=r();e&&(t+=e,o++);continue}if(n===e){o++;break}t+=n,o++}return t},c=()=>{let e=0,t="";for(;!n();){const n=r();if(!n)break;if("("===n?e++:")"===n&&e--,t+=n,o++,0===e)break}return t},u=()=>{let e="";for(;!n();){const t=r();if(!t)break;if(C(t))break;e+=t,o++}return e.trim()};for(;!n()&&(i(),!n());){if(s()||l())continue;const e=r();if(!e)break;if("{"===e){t.push({type:"braceOpen"}),o++;continue}if("}"===e){t.push({type:"braceClose"}),o++;continue}if(":"===e){t.push({type:"colon"}),o++;continue}if(";"===e){t.push({type:"semicolon"}),o++;continue}if("@"===e){t.push({type:"at"}),o++;continue}if("("===e){t.push({type:"params",value:c()});continue}if('"'===e||"'"===e){t.push({type:"string",value:p()});continue}const n=u();n?t.push({type:"text",value:n}):o++}return t})(e),o=(e=>{let t=0;const o=()=>t>=e.length,n=()=>o()?void 0:e[t],r=()=>o()?void 0:e[t++];return{isEof:o,peek:n,next:r,mark:()=>t,reset:e=>{t=e},expect:e=>{const t=r();return S(t,`[@react-hive/honey-css]: Expected "${e}" but reached end of input.`),S(t.type===e,`[@react-hive/honey-css]: Expected "${e}" but got "${t.type}".`),t},readUntil:e=>{let t,a="";for(;!o();){const o=n();if(!o||e.includes(o.type))break;"text"===o.type?("text"===t&&a&&(a+=" "),a+=o.value):"string"===o.type?a+=`"${o.value}"`:"params"===o.type&&(a+=o.value),t=o.type,r()}return a.trim()},skipUntil:e=>{for(;!o();){const t=n();if(!t||e.includes(t.type))break;r()}}}})(t);return{type:"stylesheet",body:_(o,{stopAtBraceClose:!1})}})(o?N(o,e):e);return((e,t)=>{const o=(e=>({...e,body:I(e.body)}))(t?{...e,body:W(e.body,t)}:e);return o.body.map(R).filter(Boolean).join("")})([K,X,G,Y,Q,ne({theme:t}),q({theme:t})].reduce((e,t)=>t(e),n))},ae=e=>`${e}-${Math.floor(1e3*performance.now()).toString(36)}${Math.random().toString(36).slice(2,10)}`,ie=e=>e.filter(Boolean).join(" ").trim(),se=e=>`hscn-${(e=>{let t=5381;for(let o=0;o<e.length;o++)t=33*t^e.charCodeAt(o);return(t>>>0).toString(36)})(e)}`,le=e=>a in e,pe=e=>Object.entries(e).reduce((e,[t,o])=>((y.has(t)||t.startsWith("data-")||t.startsWith("aria-"))&&(e[t]=o),e),{}),ce=(e,t=16)=>e/t+"rem",ue=e=>2===e.split(".").length,de=(e,t="px",o="base")=>({theme:n})=>{if("string"==typeof e)return e;const r=n.spacings[o]??0;if("number"==typeof e){const o=e*r;return t?`${o}${t}`:o}return e.map(e=>{if("string"==typeof e)return e;const o=e*r;return t?`${o}${t}`:o}).join(" ")},ye=e=>({theme:t})=>{const o=t.fonts[e];return D`
3
3
  font-family: ${o.family};
4
- font-size: ${pe(o.size)};
4
+ font-size: ${ce(o.size)};
5
5
  font-weight: ${o.weight};
6
- line-height: ${void 0!==o.lineHeight&&pe(o.lineHeight)};
7
- letter-spacing: ${void 0!==o.letterSpacing&&pe(o.letterSpacing)};
8
- `},ye=(e,t)=>{if(t<0||t>1)throw new Error(`[honey-layout]: Alpha "${t}" is not a valid hex format.`);const o=e.match(/^#?([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/);if(!o)throw new Error("[honey-layout]: Invalid hex format.");const n=o[1];return`#${(3===n.length?n[0]+n[0]+n[1]+n[1]+n[2]+n[2]:n)+Math.round(255*t).toString(16).toUpperCase().padStart(2,"0")}`},me=(e,t)=>({theme:o})=>{const[n,r]=e.split("."),a=r?o.colors[n][r]:n;return void 0===t?a:ye(a,t)},he=e=>({theme:t})=>t.dimensions[e],fe=({children:e,theme:t})=>{const o=(0,m.useMemo)(()=>({theme:t,resolveSpacing:(...e)=>ue(...e)({theme:t}),resolveColor:(...e)=>me(...e)({theme:t}),resolveFont:(...e)=>de(...e)({theme:t}),resolveDimension:(...e)=>he(...e)({theme:t})}),[t]);return(0,f.jsx)(h,{value:o,children:e})},be=()=>{const e=(0,m.useContext)(h);return function(e,t){if(!e)throw new Error(t)}(e,"The `useHoneyStyle()` hook must be used inside <HoneyStyleProvider/> component!"),e},ge=(e,...t)=>{const o=re("hsg"),n=L(e,...t);return()=>{const{theme:e}=be();return(0,m.useInsertionEffect)(()=>{const t=n({theme:e}),r=ne(t,{theme:e}),a=document.createElement("style");return a.id=o,a.innerHTML=r,a.setAttribute(i,"true"),document.head.insertBefore(a,document.head.firstChild),()=>{a.remove()}},[e]),null}},ve=(window.__honeyStyleRegistry||(window.__honeyStyleRegistry=new Map),window.__honeyStyleRegistry);let xe=null;const ke=()=>{const e=(xe||(xe=document.querySelector(`style[${s}="true"]`),xe||(xe=document.createElement("style"),xe.setAttribute(s,"true"),document.head.appendChild(xe))),xe),t=Array.from(ve.entries()).sort(([,e],[,t])=>e.priority-t.priority).map(([,e])=>e.css).join("\n");e.textContent=t},$e=e=>()=>{const t=ve.get(e);t&&(t.usages--,t.usages<=0&&(ve.delete(e),ke()))},Ce=(e,t,o=0)=>{const n=ve.get(e);return n?(n.usages++,$e(e)):(ve.set(e,{css:t,priority:o,usages:1}),ke(),$e(e))},Se=(e,t,{omitProps:o}={})=>(n,...i)=>{const s=re("hsc"),l=L(n,...i),p=({as:n,className:a,__compositionDepth:i=0,css:p,...c})=>{r&&p&&console.warn('[@react-hive/honey-style]: The "css" prop is deprecated. Please use inheritance or composition instead.');const{theme:u}=be(),d=(x=c,Object.entries(x).reduce((e,[t,o])=>(void 0!==o&&(e[t]=o),e),{})),y={...g(t,{theme:u,as:n,className:a,...d})??{},...a&&{className:a}},h={...y,...d,theme:u},f=l(h),v=ie(f);var x;(0,m.useInsertionEffect)(()=>{const e=ne(f,{theme:u,selector:`.${v}`});return Ce(v,e,i)},[v]);const k=((e,t)=>e?b(e)?e:L([""],[e])(t):"")(g(p,h),h),$=k?ie(k):"";(0,m.useInsertionEffect)(()=>{if($){const e=ne(k,{theme:u,selector:`.${$}`});return Ce($,e,1)}},[$]);const C=ae([s,v,y.className,$]),S={...y,...d,className:C},w=o?Object.entries(S).reduce((e,[t,n])=>o(t)?e:{...e,[t]:n},{}):S,E=n||e;if(b(e)){const e=b(E)?le(w):w;return(0,m.createElement)(E,e)}return(0,m.createElement)(e,{...w,...n&&{as:n},...se(e)&&{__compositionDepth:i-1}})};if(p[a]=s,r){const t=b(e)?e:e.displayName||e.name||"Component";p.displayName=`HoneyStyledComponent(${t})`}return p};module.exports=n})();
6
+ line-height: ${void 0!==o.lineHeight&&ce(o.lineHeight)};
7
+ letter-spacing: ${void 0!==o.letterSpacing&&ce(o.letterSpacing)};
8
+ `},me=(e,t)=>({theme:o})=>{const[n,r]=e.split("."),a=r?o.colors[n][r]:n;return void 0===t?a:((e,t)=>{b(t>=0&&t<=1,`[@react-hive/honey-utils]: Alpha "${t}" must be a number between 0 and 1.`);const o=e.match(/^#?([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/);b(o,`[@react-hive/honey-utils]: Invalid hex format: ${e}`);const n=o[1];return`#${(3===n.length?n[0]+n[0]+n[1]+n[1]+n[2]+n[2]:n)+Math.round(255*t).toString(16).toUpperCase().padStart(2,"0")}`})(a,t)},he=e=>({theme:t})=>t.dimensions[e],fe=({children:e,theme:t})=>{const o=(0,m.useMemo)(()=>({theme:t,resolveSpacing:(...e)=>de(...e)({theme:t}),resolveColor:(...e)=>me(...e)({theme:t}),resolveFont:(...e)=>ye(...e)({theme:t}),resolveDimension:(...e)=>he(...e)({theme:t})}),[t]);return(0,f.jsx)(h,{value:o,children:e})},be=()=>{const e=(0,m.useContext)(h);return b(e,"The `useHoneyStyle()` hook must be used inside <HoneyStyleProvider/> component!"),e},ge=(e,...t)=>{const o=ae("hsg"),n=D(e,...t);return()=>{const{theme:e}=be();return(0,m.useInsertionEffect)(()=>{const t=n({theme:e}),r=re(t,{theme:e}),a=document.createElement("style");return a.id=o,a.innerHTML=r,a.setAttribute(i,"true"),document.head.insertBefore(a,document.head.firstChild),()=>{a.remove()}},[e]),null}},ve=(window.__honeyStyleRegistry||(window.__honeyStyleRegistry=new Map),window.__honeyStyleRegistry);let ke=null;const xe=()=>{const e=(ke||(ke=document.querySelector(`style[${s}="true"]`),ke||(ke=document.createElement("style"),ke.setAttribute(s,"true"),document.head.appendChild(ke))),ke),t=Array.from(ve.entries()).sort(([,e],[,t])=>e.priority-t.priority).map(([,e])=>e.css).join("\n");e.textContent=t},$e=e=>()=>{const t=ve.get(e);t&&(t.usages--,t.usages<=0&&(ve.delete(e),xe()))},Ce=(e,t,o=0)=>{const n=ve.get(e);return n?(n.usages++,$e(e)):(ve.set(e,{css:t,priority:o,usages:1}),xe(),$e(e))},Se=(e,t,{omitProps:o}={})=>(n,...i)=>{const s=ae("hsc"),l=D(n,...i),p=({as:n,className:a,__compositionDepth:i=0,css:p,...c})=>{r&&p&&console.warn('[@react-hive/honey-style]: The "css" prop is deprecated. Please use inheritance or composition instead.');const{theme:u}=be(),d=(k=c,Object.entries(k).reduce((e,[t,o])=>(void 0!==o&&(e[t]=o),e),{})),y={...v(t,{theme:u,as:n,className:a,...d})??{},...a&&{className:a}},h={...y,...d,theme:u},f=l(h),b=se(f);var k;(0,m.useInsertionEffect)(()=>{const e=re(f,{theme:u,selector:`.${b}`});return Ce(b,e,i)},[b]);const x=((e,t)=>e?g(e)?e:D([""],[e])(t):"")(v(p,h),h),$=x?se(x):"";(0,m.useInsertionEffect)(()=>{if($){const e=re(x,{theme:u,selector:`.${$}`});return Ce($,e,1)}},[$]);const C=ie([s,b,y.className,$]),S={...y,...d,className:C},w=o?Object.entries(S).reduce((e,[t,n])=>o(t)?e:{...e,[t]:n},{}):S,E=n||e;if(g(e)){const e=g(E)?pe(w):w;return(0,m.createElement)(E,e)}return(0,m.createElement)(e,{...w,...n&&{as:n},...le(e)&&{__compositionDepth:i-1}})};if(p[a]=s,r){const t=g(e)?e:e.displayName||e.name||"Component";p.displayName=`HoneyStyledComponent(${t})`}return p};module.exports=n})();
9
9
  //# sourceMappingURL=index.cjs.map