@react-hive/honey-css 1.2.0 → 1.3.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,4 +1,4 @@
1
- import type { HoneyCssToken, HoneyCssTokenType } from '~/types';
1
+ import type { HoneyCssToken, HoneyCssTokenType } from './types';
2
2
  /**
3
3
  * A lightweight cursor abstraction over a token stream.
4
4
  *
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- (()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{createCssTokenCursor:()=>i,tokenizeCss:()=>n});const r=e=>"{"===e||"}"===e||":"===e||";"===e||"@"===e||"("===e||'"'===e||"'"===e||"/"===e,n=e=>{const t=[];let n=0;const o=()=>n>=e.length,i=()=>o()?void 0:e[n],s=()=>n+1>=e.length?void 0:e[n+1],u=()=>{for(;;){const e=i();if(!e||!/\s/.test(e))return;n++}},c=()=>{if("/"!==i()||"*"!==s())return!1;for(n+=2;!o();){if("*"===i()&&"/"===s())return n+=2,!0;n++}return!0},f=()=>{const e=i();if(!e)return"";n++;let t="";for(;!o();){const r=i();if(!r)break;if("\\"===r){t+=r,n++;const e=i();e&&(t+=e,n++);continue}if(r===e){n++;break}t+=r,n++}return t},p=()=>{let e=0,t="";for(;!o();){const r=i();if(!r)break;if("("===r&&e++,")"===r&&e--,t+=r,n++,0===e)break}return t},a=()=>{let e="";for(;!o();){const t=i();if(!t)break;if(r(t))break;e+=t,n++}return e.trim()};for(;!o()&&(u(),!o());){if(c())continue;const e=i();if(!e)break;if("{"===e){t.push({type:"braceOpen"}),n++;continue}if("}"===e){t.push({type:"braceClose"}),n++;continue}if(":"===e){t.push({type:"colon"}),n++;continue}if(";"===e){t.push({type:"semicolon"}),n++;continue}if("@"===e){t.push({type:"at"}),n++;continue}if("("===e){t.push({type:"params",value:p()});continue}if('"'===e||"'"===e){t.push({type:"string",value:f()});continue}const r=a();r?t.push({type:"text",value:r}):n++}return t};function o(e,t){if(!e)throw new Error(t)}const i=e=>{let t=0;const r=()=>t>=e.length,n=()=>r()?void 0:e[t],i=()=>r()?void 0:e[t++];return{isEof:r,peek:n,next:i,mark:()=>t,reset:e=>{t=e},expect:e=>{const t=i();return o(t,`[@react-hive/honey-css]: Expected "${e}" but reached end of input.`),o(t.type===e,`[@react-hive/honey-css]: Expected "${e}" but got "${t.type}".`),t},readUntil:e=>{let t="";for(;!r();){const r=n();if(!r||e.includes(r.type))break;"text"===r.type?(t&&(t+=" "),t+=r.value):"string"===r.type?t+=`"${r.value}"`:"params"===r.type&&(t+=r.value),i()}return t.trim()},skipUntil:e=>{for(;!r();){const t=n();if(!t||e.includes(t.type))break;i()}}}};module.exports=t})();
1
+ (()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{createCssTokenCursor:()=>i,tokenizeCss:()=>n});const r=e=>"{"===e||"}"===e||":"===e||";"===e||"@"===e||"("===e||'"'===e||"'"===e||"/"===e,n=e=>{const t=[];let n=0;const o=()=>n>=e.length,i=()=>o()?void 0:e[n],u=()=>n+1>=e.length?void 0:e[n+1],s=()=>{for(;;){const e=i();if(!e||!/\s/.test(e))return;n++}},c=()=>{if("/"!==i()||"/"!==u())return!1;for(n+=2;!o();){if("\n"===i()){n++;break}n++}return!0},f=()=>{if("/"!==i()||"*"!==u())return!1;for(n+=2;!o();){if("*"===i()&&"/"===u())return n+=2,!0;n++}return!0},p=()=>{const e=i();if(!e)return"";n++;let t="";for(;!o();){const r=i();if(!r)break;if("\\"===r){t+=r,n++;const e=i();e&&(t+=e,n++);continue}if(r===e){n++;break}t+=r,n++}return t},a=()=>{let e=0,t="";for(;!o();){const r=i();if(!r)break;if("("===r&&e++,")"===r&&e--,t+=r,n++,0===e)break}return t},l=()=>{let e="";for(;!o();){const t=i();if(!t)break;if(r(t))break;e+=t,n++}return e.trim()};for(;!o()&&(s(),!o());){if(c()||f())continue;const e=i();if(!e)break;if("{"===e){t.push({type:"braceOpen"}),n++;continue}if("}"===e){t.push({type:"braceClose"}),n++;continue}if(":"===e){t.push({type:"colon"}),n++;continue}if(";"===e){t.push({type:"semicolon"}),n++;continue}if("@"===e){t.push({type:"at"}),n++;continue}if("("===e){t.push({type:"params",value:a()});continue}if('"'===e||"'"===e){t.push({type:"string",value:p()});continue}const r=l();r?t.push({type:"text",value:r}):n++}return t};function o(e,t){if(!e)throw new Error(t)}const i=e=>{let t=0;const r=()=>t>=e.length,n=()=>r()?void 0:e[t],i=()=>r()?void 0:e[t++];return{isEof:r,peek:n,next:i,mark:()=>t,reset:e=>{t=e},expect:e=>{const t=i();return o(t,`[@react-hive/honey-css]: Expected "${e}" but reached end of input.`),o(t.type===e,`[@react-hive/honey-css]: Expected "${e}" but got "${t.type}".`),t},readUntil:e=>{let t="";for(;!r();){const r=n();if(!r||e.includes(r.type))break;"text"===r.type?(t&&(t+=" "),t+=r.value):"string"===r.type?t+=`"${r.value}"`:"params"===r.type&&(t+=r.value),i()}return t.trim()},skipUntil:e=>{for(;!r();){const t=n();if(!t||e.includes(t.type))break;i()}}}};module.exports=t})();
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","mappings":"mBACA,IAAIA,EAAsB,CCA1BA,EAAwB,CAACC,EAASC,KACjC,IAAI,IAAIC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EAAE,MAAM,IAAIE,MAAMD,EAAE,CAAC,MCqIh3BE,EAAwBxB,IACnC,IAAIC,EAAQ,EAEZ,MAAMC,EAAQ,IAAeD,GAASD,EAAOG,OAEvCC,EAAO,IAAkCF,SAAUG,EAAYL,EAAOC,GAEtEwB,EAAO,IAAkCvB,SAAUG,EAAYL,EAAOC,KA8D5E,MAAO,CACLC,QACAE,OACAqB,OACAC,KAhEW,IAAczB,EAiEzB0B,MA/DaD,IACbzB,EAAQyB,GA+DRE,OA5D2CT,IAC3C,MAAMU,EAAQJ,IAQd,OANA,EAAOI,EAAO,sCAAsCV,gCACpD,EACEU,EAAMV,OAASA,EACf,sCAAsCA,eAAkBU,EAAMV,UAGzDU,GAoDPC,UAjDiBC,IACjB,IAAInB,EAAS,GAEb,MAAQV,KAAS,CACf,MAAM2B,EAAQzB,IAEd,IAAKyB,GAASE,EAAUC,SAASH,EAAMV,MACrC,MAGiB,SAAfU,EAAMV,MACJP,IACFA,GAAU,KAGZA,GAAUiB,EAAMlC,OAEQ,WAAfkC,EAAMV,KACfP,GAAU,IAAIiB,EAAMlC,SAEI,WAAfkC,EAAMV,OACfP,GAAUiB,EAAMlC,OAGlB8B,GACF,CAEA,OAAOb,EAAOK,QAuBdgB,UApBiBF,IACjB,MAAQ7B,KAAS,CACf,MAAM2B,EAAQzB,IAEd,IAAKyB,GAASE,EAAUC,SAASH,EAAMV,MACrC,MAGFM,GACF,K","sources":["webpack://@react-hive/honey-css/webpack/bootstrap","webpack://@react-hive/honey-css/webpack/runtime/define property getters","webpack://@react-hive/honey-css/webpack/runtime/hasOwnProperty shorthand","webpack://@react-hive/honey-css/webpack/runtime/make namespace object","webpack://@react-hive/honey-css/./src/tokenize-css.ts","webpack://@react-hive/honey-css/./node_modules/.pnpm/@react-hive+honey-utils@3.23.0/node_modules/@react-hive/honey-utils/dist/index.mjs","webpack://@react-hive/honey-css/./src/create-css-token-cursor.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import type { HoneyCssToken } from '~/types';\n\n/**\n * Determines whether a character should terminate a plain text read.\n *\n * These characters represent structural boundaries in CSS:\n * - Blocks: `{` `}`\n * - Declarations: `:` `;`\n * - At-rules: `@`\n * - Params: `(`\n * - Strings: `'` `\"`\n * - Comments: `/`\n */\nconst isBoundaryChar = (ch: string): boolean =>\n ch === '{' ||\n ch === '}' ||\n ch === ':' ||\n ch === ';' ||\n ch === '@' ||\n ch === '(' ||\n ch === '\"' ||\n ch === \"'\" ||\n ch === '/';\n\n/**\n * Tokenizes a CSS-like input string into a sequence of Honey CSS tokens.\n *\n * This tokenizer is intentionally lightweight and designed for parsing\n * Honey-specific CSS extensions such as:\n *\n * - Custom at-rules: `@honey-media (...) { ... }`\n * - Nested selectors: `&:hover { ... }`\n * - CSS variables: `--primary-color: red;`\n *\n * Supported syntax:\n * - Braces: `{` `}`\n * - Colons and semicolons: `:` `;`\n * - At-rule marker: `@`\n * - Parentheses groups: `(sm:down)`\n * - Quoted strings: `\"...\"`, `'...'`\n * - Block comments: `/* ... *\\/`\n *\n * @param input - Raw CSS string to tokenize.\n *\n * @returns An ordered array of tokens.\n */\nexport const tokenizeCss = (input: string): HoneyCssToken[] => {\n const tokens: HoneyCssToken[] = [];\n\n let index = 0;\n\n const isEof = (): boolean => index >= input.length;\n\n /**\n * Returns the current character without consuming it.\n */\n const peek = (): string | undefined => (isEof() ? undefined : input[index]);\n\n /**\n * Returns the next character without consuming it.\n */\n const peekNext = (): string | undefined =>\n index + 1 >= input.length ? undefined : input[index + 1];\n\n /**\n * Advances the cursor past any whitespace characters.\n */\n const skipWhitespace = () => {\n while (true) {\n const ch = peek();\n\n if (!ch || !/\\s/.test(ch)) {\n return;\n }\n\n index++;\n }\n };\n\n /**\n * Skips CSS block comments of the form:\n *\n * ```css\n * /* comment *\\/\n * ```\n *\n * If the comment is unterminated, tokenization stops safely.\n *\n * @returns `true` if a comment was skipped.\n */\n const skipComment = (): boolean => {\n if (peek() !== '/' || peekNext() !== '*') {\n return false;\n }\n\n index += 2; // skip \"/*\"\n\n while (!isEof()) {\n if (peek() === '*' && peekNext() === '/') {\n index += 2; // skip \"*/\"\n\n return true;\n }\n\n index++;\n }\n\n return true;\n };\n\n /**\n * Reads a quoted string token.\n *\n * Supports:\n * - Double quotes: `\"text\"`\n * - Single quotes: `'text'`\n * - Escaped characters: `\"a\\\\\\\"b\"`\n *\n * @returns The unwrapped string contents.\n */\n const readString = (): string => {\n const quote = peek();\n if (!quote) {\n return '';\n }\n\n index++; // skip opening quote\n let result = '';\n\n while (!isEof()) {\n const ch = peek();\n if (!ch) {\n break;\n }\n\n // Handle escape sequences\n if (ch === '\\\\') {\n result += ch;\n index++;\n\n const escaped = peek();\n if (escaped) {\n result += escaped;\n index++;\n }\n\n continue;\n }\n\n // Closing quote\n if (ch === quote) {\n index++;\n break;\n }\n\n result += ch;\n index++;\n }\n\n return result;\n };\n\n /**\n * Reads a balanced parentheses group.\n *\n * Examples:\n * - `(sm:down)`\n * - `(min-width: calc(100% - 1px))`\n *\n * Nested parentheses are supported.\n *\n * @returns The full params string including parentheses.\n */\n const readParamsGroup = (): string => {\n let depth = 0;\n let result = '';\n\n while (!isEof()) {\n const ch = peek();\n if (!ch) {\n break;\n }\n\n if (ch === '(') {\n depth++;\n }\n\n if (ch === ')') {\n depth--;\n }\n\n result += ch;\n index++;\n\n if (depth === 0) {\n break;\n }\n }\n\n return result;\n };\n\n /**\n * Reads plain text until a boundary character is reached.\n *\n * This is used for:\n * - Selectors (`.btn`, `&:hover`)\n * - Property names (`color`)\n * - Values (`red`, `12px`)\n *\n * @returns Trimmed text content.\n */\n const readText = (): string => {\n let result = '';\n\n while (!isEof()) {\n const ch = peek();\n if (!ch) {\n break;\n }\n\n if (isBoundaryChar(ch)) {\n break;\n }\n\n result += ch;\n index++;\n }\n\n return result.trim();\n };\n\n // ============================\n // Main Token Loop\n // ============================\n while (!isEof()) {\n skipWhitespace();\n\n if (isEof()) {\n break;\n }\n\n if (skipComment()) {\n continue;\n }\n\n const ch = peek();\n if (!ch) {\n break;\n }\n\n if (ch === '{') {\n tokens.push({\n type: 'braceOpen',\n });\n\n index++;\n continue;\n }\n\n if (ch === '}') {\n tokens.push({\n type: 'braceClose',\n });\n\n index++;\n continue;\n }\n\n if (ch === ':') {\n tokens.push({\n type: 'colon',\n });\n\n index++;\n continue;\n }\n\n if (ch === ';') {\n tokens.push({\n type: 'semicolon',\n });\n\n index++;\n continue;\n }\n\n if (ch === '@') {\n tokens.push({\n type: 'at',\n });\n\n index++;\n continue;\n }\n\n // Params group\n if (ch === '(') {\n tokens.push({\n type: 'params',\n value: readParamsGroup(),\n });\n\n continue;\n }\n\n // Strings\n if (ch === '\"' || ch === \"'\") {\n tokens.push({\n type: 'string',\n value: readString(),\n });\n\n continue;\n }\n\n // Text chunk\n const value = readText();\n if (value) {\n tokens.push({\n type: 'text',\n value,\n });\n } else {\n // Safety fallback to prevent infinite loops\n index++;\n }\n }\n\n return tokens;\n};\n","const e=e=>new Blob([e],{type:e.type}),t=e=>new DOMRect(e.offsetLeft,e.offsetTop,e.clientWidth,e.clientHeight),n=e=>\"A\"===e.tagName,r=e=>\"true\"===e.getAttribute(\"contenteditable\"),a=[\"INPUT\",\"SELECT\",\"TEXTAREA\",\"BUTTON\",\"A\"],l=e=>{if(!e)return!1;const t=window.getComputedStyle(e);if(\"hidden\"===t.visibility||\"none\"===t.display)return!1;if(\"disabled\"in e&&e.disabled)return!1;const l=e.getAttribute(\"tabindex\");return\"-1\"!==l&&(a.includes(e.tagName)?!n(e)||\"\"!==e.href:!!r(e)||null!==l)},i=e=>Array.from(e.querySelectorAll(\"*\")).filter(l),o=(e,t=null,{wrap:n=!0,getNextIndex:r}={})=>{const a=document.activeElement,l=t??a?.parentElement;if(!a||!l)return;const o=i(l);if(0===o.length)return;const s=o.indexOf(a);if(-1===s)return;let c;r?c=r(s,e,o):\"next\"===e?(c=s+1,c>=o.length&&(c=n?0:null)):(c=s-1,c<0&&(c=n?o.length-1:null)),null!==c&&o[c]?.focus()};function s(e,t){if(!e)throw new Error(t)}const c=e=>null===e,u=e=>null==e,h=e=>null!=e,f=e=>void 0===e,d=e=>\"number\"==typeof e,m=e=>\"boolean\"==typeof e,p=e=>\"object\"==typeof e,g=e=>p(e)&&!c(e)&&0===Object.keys(e).length,y=e=>e instanceof Date,w=e=>e instanceof Blob,b=e=>e instanceof Error,x=e=>y(e)&&!isNaN(e.getTime()),M=e=>e instanceof RegExp,S=e=>e instanceof Map,A=e=>e instanceof Set,v=e=>\"symbol\"==typeof e,C=e=>d(e)&&isFinite(e),I=e=>d(e)&&Number.isInteger(e),k=e=>C(e)&&!Number.isInteger(e),E=e=>Array.isArray(e),L=e=>E(e)&&0===e.length,P=e=>e.filter(Boolean),O=e=>[...new Set(e)],T=(e,t)=>(s(t>0,\"Chunk size must be greater than 0\"),Array.from({length:Math.ceil(e.length/t)},(n,r)=>e.slice(r*t,(r+1)*t))),X=(...e)=>{if(0===e.length)return[];if(1===e.length)return[...e[0]];const[t,...n]=e;return O(t).filter(e=>n.every(t=>t.includes(e)))},_=(e,t)=>e.filter(e=>!t.includes(e)),z=(...e)=>t=>e.reduce((e,t)=>t(e),t),Y=(...e)=>t=>e.reduceRight((e,t)=>t(e),t),R=()=>{},N=e=>\"function\"==typeof e,$=e=>(...t)=>!e(...t),F=e=>{let t,n=!1;return function(...r){return n||(n=!0,t=e.apply(this,r)),t}},j=e=>N(e?.then),U=async(e,t)=>{const n=[];for(let r=0;r<e.length;r++)n.push(await t(e[r],r,e));return n},W=async(e,t)=>Promise.all(e.map(t)),H=async(e,t)=>{const n=[];for(let r=0;r<e.length;r++){const a=e[r];await t(a,r,e)&&n.push(a)}return n},B=async(e,t)=>{const n=await W(e,async(e,n,r)=>!!await t(e,n,r)&&e);return P(n)},D=async(e,t)=>{for(let n=0;n<e.length;n++)if(await t(e[n],n,e))return!0;return!1},V=async(e,t)=>{for(let n=0;n<e.length;n++)if(!await t(e[n],n,e))return!1;return!0},Z=async(e,t,n)=>{let r=n;for(let n=0;n<e.length;n++)r=await t(r,e[n],n,e);return r},G=async(e,t)=>{for(let n=0;n<e.length;n++)if(await t(e[n],n,e))return e[n];return null},q=e=>new Promise(t=>setTimeout(t,e)),J=async(e,t,n=\"Operation timed out\")=>{try{return await Promise.race([e,q(t).then(()=>Promise.reject(new Error(n)))])}finally{}},K=(e,{maxAttempts:t=3,delayMs:n=300,backoff:r=!0,onRetry:a}={})=>async(...l)=>{let i;for(let o=1;o<=t;o++)try{return await e(...l)}catch(e){if(i=e,o<t){a?.(o,e);const t=r?n*2**(o-1):n;await q(t)}}throw i},Q=e=>\"string\"==typeof e,ee=(e,{fileName:t,target:n}={})=>{if(f(document))return;const r=document.createElement(\"a\");let a=null;try{const l=Q(e)?e:a=URL.createObjectURL(e);r.href=l,t&&(r.download=t),n&&(r.target=n),document.body.appendChild(r),r.click()}finally{r.remove(),a&&setTimeout(()=>{s(a,\"Object URL should not be null\"),URL.revokeObjectURL(a)},0)}},te=e=>e.scrollWidth>e.clientWidth,ne=e=>Math.max(0,e.scrollWidth-e.clientWidth),re=e=>e.scrollHeight>e.clientHeight,ae=e=>Math.max(0,e.scrollHeight-e.clientHeight),le=({overflowSize:e,containerSize:t,elementOffset:n,elementSize:r})=>{if(e<=0)return 0;const a=n+r/2-t/2;return-Math.max(0,Math.min(a,e))},ie=(e,t,{axis:n=\"both\"}={})=>{let r=0,a=0;\"x\"!==n&&\"both\"!==n||(r=le({overflowSize:ne(e),containerSize:e.clientWidth,elementOffset:t.offsetLeft,elementSize:t.clientWidth})),\"y\"!==n&&\"both\"!==n||(a=le({overflowSize:ae(e),containerSize:e.clientHeight,elementOffset:t.offsetTop,elementSize:t.clientHeight})),e.style.transform=`translate(${r}px, ${a}px)`},oe=e=>{const t=window.getComputedStyle(e).getPropertyValue(\"transform\").match(/^matrix\\((.+)\\)$/);if(!t)return{translateX:0,translateY:0,scaleX:1,scaleY:1,skewX:0,skewY:0};const[n,r,a,l,i,o]=t[1].split(\", \").map(parseFloat);return{translateX:i,translateY:o,scaleX:n,scaleY:l,skewX:a,skewY:r}},se=()=>{if(\"undefined\"==typeof window||!window.localStorage)return!1;try{return window.localStorage.getItem(\"__non_existing_key__\"),!0}catch{return!1}},ce=()=>{if(!se())return{readable:!1,writable:!1};try{const e=\"__test_write__\";return window.localStorage.setItem(e,\"1\"),window.localStorage.removeItem(e),{readable:!0,writable:!0}}catch{}return{readable:!0,writable:!1}},ue=e=>e instanceof File,he=e=>{if(!e)return[];const t=[];for(let n=0;n<e.length;n++)t.push(e[n]);return t},fe=(e,t)=>new File([e],t,{type:e.type}),de=async(e,{skipFiles:t=[\".DS_Store\",\"Thumbs.db\",\"desktop.ini\",\"ehthumbs.db\",\".Spotlight-V100\",\".Trashes\",\".fseventsd\",\"__MACOSX\"]}={})=>{const n=new Set(t),r=await(async e=>{const t=e.createReader(),n=async()=>new Promise((e,r)=>{t.readEntries(async t=>{if(t.length)try{const r=await n();e([...t,...r])}catch(e){r(e)}else e([])},r)});return n()})(e);return(await W(r,async e=>e.isDirectory?de(e,{skipFiles:t}):n.has(e.name)?[]:[await new Promise((t,n)=>{e.file(t,n)})])).flat()},me=async(e,t={})=>{const n=e?.items;if(!n)return[];const r=[];for(let e=0;e<n.length;e++){const a=n[e];if(\"webkitGetAsEntry\"in a){const e=a.webkitGetAsEntry?.();if(e?.isDirectory){r.push(de(e,t));continue}if(e?.isFile){r.push(new Promise((t,n)=>e.file(e=>t([e]),n)));continue}}const l=a.getAsFile();l&&r.push(Promise.resolve([l]))}return(await Promise.all(r)).flat()},pe=(e,...t)=>\"function\"==typeof e?e(...t):e,ge=({delta:e,value:t,min:n,max:r})=>{if(0===e)return null;const a=t+e;return e<0?t<=n?null:Math.max(a,n):e>0?t>=r?null:Math.min(a,r):null},ye=({value:e,min:t,max:n,velocityPxMs:r,deltaTimeMs:a,friction:l=.002,minVelocityPxMs:i=.01,emaAlpha:o=.2})=>{if(Math.abs(r)<i)return null;const s=ge({delta:r*a,value:e,min:t,max:n});if(null===s)return null;const c=r*Math.exp(-l*a),u=o>0?r*(1-o)+c*o:c;return Math.abs(u)<i?null:{value:s,velocityPxMs:u}},we=()=>`${Math.floor(1e3*performance.now()).toString(36)}${Math.random().toString(36).slice(2,10)}`,be=(e,t)=>Math.max(0,Math.min(e.right,t.right)-Math.max(e.left,t.left))*Math.max(0,Math.min(e.bottom,t.bottom)-Math.max(e.top,t.top))/(t.width*t.height),xe=(e,t,{allowFallback:n=!0,invert:r=!0}={})=>{const a=r?-1:1;switch(t){case\"x\":return{deltaX:a*(0!==e.deltaX?e.deltaX:n?e.deltaY:0),deltaY:0};case\"y\":return{deltaX:0,deltaY:a*e.deltaY};default:return{deltaX:a*e.deltaX,deltaY:a*e.deltaY}}},Me=(e,t,n,r)=>{const a=n-e,l=r-t;return Math.hypot(a,l)},Se=(e,t)=>Math.abs(e/t),Ae=(e,t)=>e*t/100,ve=e=>{let t=5381;for(let n=0;n<e.length;n++)t=33*t^e.charCodeAt(n);return(t>>>0).toString(36)},Ce=e=>Object.entries(e).reduce((e,[t,n])=>(void 0!==n&&(e[t]=n),e),{}),Ie=e=>e.replace(/([a-z0-9])([A-Z])/g,\"$1-$2\").toLowerCase(),ke=e=>{const t=e.charAt(0),n=e.slice(1);return t.toLowerCase()+n.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)},Ee=e=>e.replace(/([a-z0-9])([A-Z])/g,\"$1 $2\"),Le=e=>0===e.length?[]:e.split(\" \").filter(Boolean),Pe=e=>\"\"===e||u(e),Oe=e=>{const t=e.lastIndexOf(\".\");return t<=0||t===e.length-1?[e,\"\"]:[e.slice(0,t),e.slice(t+1).toLowerCase()]},Te=(e,t)=>{if(0===e.length)return[];const n=t.charCodeAt(0),r=[];for(let t=0;t<e.length;t++)e.charCodeAt(t)===n&&r.push(t);return r},Xe=(e,t,n)=>{if(0===e.length)return;const r=e.length;for(let a=0;a<r;a++){const l=e[a],i={charIndex:a,prevChar:a>0?e[a-1]:null,nextChar:a<r-1?e[a+1]:null};n?.(l,i)||t(l,i)}},_e=(e,t=1/0)=>0===e.length?\"\":Le(e).slice(0,t).map(e=>e[0]).join(\"\").toUpperCase(),ze=(e,t,n,r=[],a=void 0,l=0)=>(e?.forEach(e=>{const{[n]:i,...o}=e,s=e[n],c=Array.isArray(s);if(r.push({...o,parentId:a,depthLevel:l,childCount:c?s.length:0}),c){const a=e[t];ze(s,t,n,r,a,l+1)}}),r),Ye=(e,t,n)=>e.filter(e=>e.parentId===t&&(!n||n(e))),Re=(e,t,n,r)=>{const a=Le(r.toLowerCase());if(!a.length)return e;const l=e.reduce((e,n,r)=>(e[n[t]]=r,e),{});return e.reduce((r,i)=>{const o=i[n];if(!o)return r;if(r.some(e=>e[t]===i[t]))return r;const u=Le(o.toLowerCase());if(a.every(e=>u.some(t=>t.startsWith(e))))if(f(i.parentId)){r.push(i);const n=a=>{a.childCount&&e.forEach(e=>{e.parentId===a[t]&&(r.push(e),n(e))})};n(i)}else{const t=n=>{const a=l[n.parentId],i=e[a];f(i.parentId)||t(i);const o=r.length?r[r.length-1].parentId:null;(c(o)||o!==n.parentId)&&(s(i,\"[@react-hive/honey-utils]: Parent node was not found.\"),r.push(i))};t(i),r.push(i)}return r},[])};export{a as FOCUSABLE_HTML_TAGS,ye as applyInertiaStep,s as assert,fe as blobToFile,le as calculateCenterOffset,Me as calculateEuclideanDistance,Se as calculateMovingSpeed,Ae as calculatePercentage,ke as camelToDashCase,Ee as camelToWords,ie as centerElementInContainer,T as chunk,e as cloneBlob,P as compact,Y as compose,Ce as definedProps,q as delay,_ as difference,ee as downloadFile,V as everyAsync,he as fileListToFiles,B as filterParallel,H as filterSequential,G as findAsync,Te as findCharIndices,ze as flattenTree,Xe as forEachChar,we as generateEphemeralId,be as getDOMRectIntersectionRatio,t as getElementOffsetRect,i as getFocusableHtmlElements,ce as getLocalStorageCapabilities,Ye as getTreeChildren,_e as getWordsInitials,ne as getXOverflowWidth,ae as getYOverflowHeight,te as hasXOverflow,re as hasYOverflow,ve as hashString,X as intersection,pe as invokeIfFunction,n as isAnchorHtmlElement,E as isArray,w as isBlob,m as isBool,r as isContentEditableHtmlElement,y as isDate,k as isDecimal,h as isDefined,L as isEmptyArray,g as isEmptyObject,b as isError,ue as isFile,C as isFiniteNumber,N as isFunction,l as isHtmlElementFocusable,I as isInteger,se as isLocalStorageReadable,S as isMap,u as isNil,Pe as isNilOrEmptyString,c as isNull,d as isNumber,p as isObject,j as isPromise,M as isRegExp,A as isSet,Q as isString,v as isSymbol,f as isUndefined,x as isValidDate,o as moveFocusWithinContainer,R as noop,$ as not,F as once,oe as parse2DMatrix,Oe as parseFileName,z as pipe,me as readFilesFromDataTransfer,Z as reduceAsync,xe as resolveAxisDelta,ge as resolveBoundedDelta,K as retry,W as runParallel,U as runSequential,Re as searchTree,D as someAsync,Le as splitStringIntoWords,J as timeout,Ie as toKebabCase,de as traverseFileSystemDirectory,O as unique};\n//# sourceMappingURL=index.mjs.map","import { assert } from '@react-hive/honey-utils';\n\nimport type { HoneyCssToken, HoneyCssTokenType } from '~/types';\n\n/**\n * A lightweight cursor abstraction over a token stream.\n *\n * This is the core navigation primitive used by the Honey CSS parser.\n * It provides safe sequential reading, lookahead, backtracking,\n * and small helper utilities for collecting selector/value text.\n */\nexport interface HoneyTokenCursor {\n /**\n * Returns `true` when the cursor has consumed all tokens.\n */\n isEof: () => boolean;\n /**\n * Returns the current token without consuming it.\n *\n * This is primarily used for lookahead decisions in the parser:\n *\n * ```ts\n * if (cursor.peek()?.type === 'braceOpen') {\n * // parse rule block\n * }\n * ```\n */\n peek: () => HoneyCssToken | undefined;\n /**\n * Consumes and returns the current token, advancing the cursor forward.\n *\n * Returns `undefined` if the cursor is already at EOF.\n *\n * ```ts\n * const token = cursor.next();\n * ```\n */\n next: () => HoneyCssToken | undefined;\n /**\n * Creates a checkpoint of the current cursor position.\n *\n * Useful for speculative parsing or backtracking:\n *\n * ```ts\n * const mark = cursor.mark();\n *\n * if (!tryParseSomething(cursor)) {\n * cursor.reset(mark);\n * }\n * ```\n */\n mark: () => number;\n /**\n * Restores the cursor back to a previously created mark.\n *\n * @param mark - Index returned from {@link mark}.\n */\n reset: (mark: number) => void;\n /**\n * Consumes the next token and asserts that it matches the expected type.\n *\n * This is the parser's main safety mechanism and helps produce\n * clear error messages during invalid input.\n *\n * Throws if:\n * - the token stream ends unexpectedly\n * - the next token has a different type\n *\n * ```ts\n * cursor.expect('braceOpen'); // must be \"{\"\n * ```\n *\n * @param type - Expected token type.\n *\n * @returns The consumed token, narrowed to the expected type.\n */\n expect: <T extends HoneyCssTokenType>(type: T) => Extract<HoneyCssToken, { type: T }>;\n /**\n * Reads and concatenates consecutive token values until one of the stop token\n * types is encountered.\n *\n * This helper is used to collect:\n * - selectors (`.btn:hover`)\n * - declaration values (`calc(100% - 1px)`)\n * - at-rule names (`media`)\n *\n * Stops **before consuming** the stop token.\n *\n * Supported token types:\n * - `text` → appended as-is\n * - `string` → wrapped in quotes\n * - `params` → appended verbatim including parentheses\n *\n * Example:\n *\n * Tokens:\n * ```\n * text(\"var\")\n * params(\"(--color)\")\n * ```\n *\n * Result:\n * ```\n * \"var(--color)\"\n * ```\n *\n * @param stopTypes - Token types that terminate reading.\n *\n * @returns Combined string value.\n */\n readUntil: (stopTypes: HoneyCssTokenType[]) => string;\n /**\n * Advances the cursor until one of the stop token types is reached.\n *\n * This is useful for error recovery and safely skipping unknown syntax.\n *\n * Stops before consuming the stop token.\n *\n * @param stopTypes - Token types that terminate skipping.\n */\n skipUntil: (stopTypes: HoneyCssTokenType[]) => void;\n}\n\n/**\n * Creates a cursor wrapper around a list of CSS tokens.\n *\n * The cursor provides a small API surface for building\n * recursive-descent parsers without needing complex parser generators.\n *\n * @param tokens - Token list produced by the Honey tokenizer.\n *\n * @returns A reusable cursor instance.\n */\nexport const createCssTokenCursor = (tokens: HoneyCssToken[]): HoneyTokenCursor => {\n let index = 0;\n\n const isEof = (): boolean => index >= tokens.length;\n\n const peek = (): HoneyCssToken | undefined => (isEof() ? undefined : tokens[index]);\n\n const next = (): HoneyCssToken | undefined => (isEof() ? undefined : tokens[index++]);\n\n const mark = (): number => index;\n\n const reset = (mark: number): void => {\n index = mark;\n };\n\n const expect = <T extends HoneyCssTokenType>(type: T): Extract<HoneyCssToken, { type: T }> => {\n const token = next();\n\n assert(token, `[@react-hive/honey-css]: Expected \"${type}\" but reached end of input.`);\n assert(\n token.type === type,\n `[@react-hive/honey-css]: Expected \"${type}\" but got \"${token.type}\".`,\n );\n\n return token as Extract<HoneyCssToken, { type: T }>;\n };\n\n const readUntil = (stopTypes: HoneyCssTokenType[]): string => {\n let result = '';\n\n while (!isEof()) {\n const token = peek();\n\n if (!token || stopTypes.includes(token.type)) {\n break;\n }\n\n if (token.type === 'text') {\n if (result) {\n result += ' ';\n }\n\n result += token.value;\n //\n } else if (token.type === 'string') {\n result += `\"${token.value}\"`;\n //\n } else if (token.type === 'params') {\n result += token.value;\n }\n\n next();\n }\n\n return result.trim();\n };\n\n const skipUntil = (stopTypes: HoneyCssTokenType[]): void => {\n while (!isEof()) {\n const token = peek();\n\n if (!token || stopTypes.includes(token.type)) {\n break;\n }\n\n next();\n }\n };\n\n return {\n isEof,\n peek,\n next,\n mark,\n reset,\n expect,\n readUntil,\n skipUntil,\n };\n};\n"],"names":["__webpack_require__","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","isBoundaryChar","ch","tokenizeCss","input","tokens","index","isEof","length","peek","undefined","peekNext","skipWhitespace","test","skipComment","readString","quote","result","escaped","readParamsGroup","depth","readText","trim","push","type","s","e","t","Error","createCssTokenCursor","next","mark","reset","expect","token","readUntil","stopTypes","includes","skipUntil"],"sourceRoot":""}
1
+ {"version":3,"file":"index.cjs","mappings":"mBACA,IAAIA,EAAsB,CCA1BA,EAAwB,CAACC,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXF,EAAoBI,EAAEF,EAAYC,KAASH,EAAoBI,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,MCJ3EH,EAAwB,CAACS,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFV,EAAyBC,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,M,kECQvD,MAAMC,EAAkBC,GACf,MAAPA,GACO,MAAPA,GACO,MAAPA,GACO,MAAPA,GACO,MAAPA,GACO,MAAPA,GACO,MAAPA,GACO,MAAPA,GACO,MAAPA,EA+CWC,EAAeC,IAC1B,MAAMC,EAA0B,GAEhC,IAAIC,EAAQ,EAEZ,MAAMC,EAAQ,IAAeD,GAASF,EAAMI,OAKtCC,EAAO,IAA2BF,SAAUG,EAAYN,EAAME,GAK9DK,EAAW,IACfL,EAAQ,GAAKF,EAAMI,YAASE,EAAYN,EAAME,EAAQ,GAKlDM,EAAiB,KACrB,OAAa,CACX,MAAMV,EAAKO,IAEX,IAAKP,IAAO,KAAKW,KAAKX,GACpB,OAGFI,GACF,GAsBIQ,EAAwB,KAC5B,GAAe,MAAXL,KAAiC,MAAfE,IACpB,OAAO,EAKT,IAFAL,GAAS,GAEDC,KAAS,CAGf,GAAW,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MnC,OAGlB+B,GACF,CAEA,OAAOb,EAAOK,QAuBdgB,UApBiBF,IACjB,MAAQ9B,KAAS,CACf,MAAM4B,EAAQ1B,IAEd,IAAK0B,GAASE,EAAUC,SAASH,EAAMV,MACrC,MAGFM,GACF,K","sources":["webpack://@react-hive/honey-css/webpack/bootstrap","webpack://@react-hive/honey-css/webpack/runtime/define property getters","webpack://@react-hive/honey-css/webpack/runtime/hasOwnProperty shorthand","webpack://@react-hive/honey-css/webpack/runtime/make namespace object","webpack://@react-hive/honey-css/./src/tokenize-css.ts","webpack://@react-hive/honey-css/./node_modules/.pnpm/@react-hive+honey-utils@3.23.0/node_modules/@react-hive/honey-utils/dist/index.mjs","webpack://@react-hive/honey-css/./src/create-css-token-cursor.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import type { HoneyCssToken } from './types';\n\n/**\n * Determines whether a character should terminate a plain text read.\n *\n * These characters represent structural boundaries in CSS:\n * - Blocks: `{` `}`\n * - Declarations: `:` `;`\n * - At-rules: `@`\n * - Params: `(`\n * - Strings: `'` `\"`\n * - Comments: `/`\n */\nconst isBoundaryChar = (ch: string): boolean =>\n ch === '{' ||\n ch === '}' ||\n ch === ':' ||\n ch === ';' ||\n ch === '@' ||\n ch === '(' ||\n ch === '\"' ||\n ch === \"'\" ||\n ch === '/';\n\n/**\n * Tokenizes a CSS-like input string into a sequence of Honey CSS tokens.\n *\n * This function is the first stage of the Honey CSS compilation pipeline.\n * It performs a single-pass lexical scan and produces a flat stream of tokens\n * that can later be consumed by the recursive-descent parser.\n *\n * Unlike a strict CSS tokenizer, this implementation is intentional:\n *\n * - Lightweight (no external dependencies)\n * - Tolerant (fails safely on malformed input)\n * - Extended for CSS-in-JS use cases\n *\n * In addition to standard CSS constructs, it supports:\n *\n * - Custom at-rules (`@honey-media`, `@honey-stack`, etc.)\n * - Nested selectors (`&:hover`, `& > .child`)\n * - CSS variables (`--color: red`)\n * - JavaScript-style single-line comments (`// comment`)\n * - Multiline block comments (`/* comment *\\/`)\n * - Nested parentheses groups (`calc(...)`, `var(...)`)\n * - Escaped characters inside strings\n *\n * The tokenizer:\n *\n * - Skips all whitespace\n * - Skips both block (`/* *\\/`) and single-line (`//`) comments\n * - Preserves balanced parentheses as a single `params` token\n * - Preserves quoted strings as `string` tokens (without quotes)\n * - Emits structural tokens (`braceOpen`, `braceClose`, `colon`, `semicolon`, `at`)\n * - Emits all other text as trimmed `text` tokens\n *\n * Safety guarantees:\n *\n * - Unterminated comments do not crash tokenization\n * - Unterminated strings do not throw\n * - Infinite loops are prevented by fallback index advancement\n *\n * The returned token stream is order-preserving and does not perform\n * semantic validation. Structural correctness is handled by the parser stage.\n *\n * @param input - Raw CSS string to tokenize.\n *\n * @returns Ordered array of {@link HoneyCssToken} objects.\n */\nexport const tokenizeCss = (input: string): HoneyCssToken[] => {\n const tokens: HoneyCssToken[] = [];\n\n let index = 0;\n\n const isEof = (): boolean => index >= input.length;\n\n /**\n * Returns the current character without consuming it.\n */\n const peek = (): string | undefined => (isEof() ? undefined : input[index]);\n\n /**\n * Returns the next character without consuming it.\n */\n const peekNext = (): string | undefined =>\n index + 1 >= input.length ? undefined : input[index + 1];\n\n /**\n * Advances the cursor past any whitespace characters.\n */\n const skipWhitespace = () => {\n while (true) {\n const ch = peek();\n\n if (!ch || !/\\s/.test(ch)) {\n return;\n }\n\n index++;\n }\n };\n\n /**\n * Skips JavaScript-style single-line comments of the form:\n *\n * ```css\n * // comment text\n * ```\n *\n * This syntax is not part of standard CSS,\n * but is commonly used in CSS-in-JS template literals.\n *\n * The comment is skipped until a newline character (`\\n`)\n * or the end of input is reached.\n *\n * If the comment is unterminated (EOF without newline),\n * tokenization safely stops at the end of the input.\n *\n * @returns `true` if a single-line comment was detected and skipped,\n * otherwise `false`.\n */\n const skipSingleLineComment = (): boolean => {\n if (peek() !== '/' || peekNext() !== '/') {\n return false;\n }\n\n index += 2; // skip \"//\"\n\n while (!isEof()) {\n const ch = peek();\n\n if (ch === '\\n') {\n index++; // consume newline\n break;\n }\n\n index++;\n }\n\n return true;\n };\n\n /**\n * Skips CSS block comments of the form:\n *\n * ```css\n * /* comment *\\/\n * ```\n *\n * If the comment is unterminated, tokenization stops safely.\n *\n * @returns `true` if a comment was skipped.\n */\n const skipMultiLineComment = (): boolean => {\n if (peek() !== '/' || peekNext() !== '*') {\n return false;\n }\n\n index += 2; // skip \"/*\"\n\n while (!isEof()) {\n if (peek() === '*' && peekNext() === '/') {\n index += 2; // skip \"*/\"\n\n return true;\n }\n\n index++;\n }\n\n return true;\n };\n\n /**\n * Reads a quoted string token.\n *\n * Supports:\n * - Double quotes: `\"text\"`\n * - Single quotes: `'text'`\n * - Escaped characters: `\"a\\\\\\\"b\"`\n *\n * @returns The unwrapped string contents.\n */\n const readString = (): string => {\n const quote = peek();\n if (!quote) {\n return '';\n }\n\n index++; // skip opening quote\n let result = '';\n\n while (!isEof()) {\n const ch = peek();\n if (!ch) {\n break;\n }\n\n // Handle escape sequences\n if (ch === '\\\\') {\n result += ch;\n index++;\n\n const escaped = peek();\n if (escaped) {\n result += escaped;\n index++;\n }\n\n continue;\n }\n\n // Closing quote\n if (ch === quote) {\n index++;\n break;\n }\n\n result += ch;\n index++;\n }\n\n return result;\n };\n\n /**\n * Reads a balanced parentheses group.\n *\n * Examples:\n * - `(sm:down)`\n * - `(min-width: calc(100% - 1px))`\n *\n * Nested parentheses are supported.\n *\n * @returns The full params string including parentheses.\n */\n const readParamsGroup = (): string => {\n let depth = 0;\n let result = '';\n\n while (!isEof()) {\n const ch = peek();\n if (!ch) {\n break;\n }\n\n if (ch === '(') {\n depth++;\n }\n\n if (ch === ')') {\n depth--;\n }\n\n result += ch;\n index++;\n\n if (depth === 0) {\n break;\n }\n }\n\n return result;\n };\n\n /**\n * Reads a contiguous plain-text segment until a structural boundary\n * character is encountered.\n *\n * This function is responsible for collecting free-form CSS text such as:\n *\n * - Selectors (`.btn`, `&:hover`, `.parent > .child`)\n * - Property names (`color`, `border-bottom-width`)\n * - Values (`red`, `12px`, `100%`, `red!important`)\n *\n * Reading stops when a boundary character is reached.\n * Boundary characters represent structural syntax in CSS and include:\n *\n * - Block delimiters: `{` `}`\n * - Declaration delimiters: `:` `;`\n * - At-rule marker: `@`\n * - Parentheses start: `(`\n * - String delimiters: `'` `\"`\n * - Comment initiator: `/`\n *\n * The boundary character itself is NOT consumed here —\n * it is handled separately by the main tokenizer loop.\n *\n * The returned value is trimmed to remove leading/trailing whitespace,\n * ensuring clean token values without altering internal spacing.\n *\n * Safety:\n * - Stops at EOF safely\n * - Never throws\n * - Prevents infinite loops via boundary checks\n *\n * @returns Trimmed text segment, or an empty string if no text was read.\n */\n const readText = (): string => {\n let result = '';\n\n while (!isEof()) {\n const ch = peek();\n if (!ch) {\n break;\n }\n\n if (isBoundaryChar(ch)) {\n break;\n }\n\n result += ch;\n index++;\n }\n\n return result.trim();\n };\n\n // ============================\n // Main Token Loop\n // ============================\n while (!isEof()) {\n skipWhitespace();\n\n if (isEof()) {\n break;\n }\n\n if (skipSingleLineComment() || skipMultiLineComment()) {\n continue;\n }\n\n const ch = peek();\n if (!ch) {\n break;\n }\n\n if (ch === '{') {\n tokens.push({\n type: 'braceOpen',\n });\n\n index++;\n continue;\n }\n\n if (ch === '}') {\n tokens.push({\n type: 'braceClose',\n });\n\n index++;\n continue;\n }\n\n if (ch === ':') {\n tokens.push({\n type: 'colon',\n });\n\n index++;\n continue;\n }\n\n if (ch === ';') {\n tokens.push({\n type: 'semicolon',\n });\n\n index++;\n continue;\n }\n\n if (ch === '@') {\n tokens.push({\n type: 'at',\n });\n\n index++;\n continue;\n }\n\n // Params group\n if (ch === '(') {\n tokens.push({\n type: 'params',\n value: readParamsGroup(),\n });\n\n continue;\n }\n\n // Strings\n if (ch === '\"' || ch === \"'\") {\n tokens.push({\n type: 'string',\n value: readString(),\n });\n\n continue;\n }\n\n // Text chunk\n const value = readText();\n if (value) {\n tokens.push({\n type: 'text',\n value,\n });\n } else {\n // Safety fallback to prevent infinite loops\n index++;\n }\n }\n\n return tokens;\n};\n","const e=e=>new Blob([e],{type:e.type}),t=e=>new DOMRect(e.offsetLeft,e.offsetTop,e.clientWidth,e.clientHeight),n=e=>\"A\"===e.tagName,r=e=>\"true\"===e.getAttribute(\"contenteditable\"),a=[\"INPUT\",\"SELECT\",\"TEXTAREA\",\"BUTTON\",\"A\"],l=e=>{if(!e)return!1;const t=window.getComputedStyle(e);if(\"hidden\"===t.visibility||\"none\"===t.display)return!1;if(\"disabled\"in e&&e.disabled)return!1;const l=e.getAttribute(\"tabindex\");return\"-1\"!==l&&(a.includes(e.tagName)?!n(e)||\"\"!==e.href:!!r(e)||null!==l)},i=e=>Array.from(e.querySelectorAll(\"*\")).filter(l),o=(e,t=null,{wrap:n=!0,getNextIndex:r}={})=>{const a=document.activeElement,l=t??a?.parentElement;if(!a||!l)return;const o=i(l);if(0===o.length)return;const s=o.indexOf(a);if(-1===s)return;let c;r?c=r(s,e,o):\"next\"===e?(c=s+1,c>=o.length&&(c=n?0:null)):(c=s-1,c<0&&(c=n?o.length-1:null)),null!==c&&o[c]?.focus()};function s(e,t){if(!e)throw new Error(t)}const c=e=>null===e,u=e=>null==e,h=e=>null!=e,f=e=>void 0===e,d=e=>\"number\"==typeof e,m=e=>\"boolean\"==typeof e,p=e=>\"object\"==typeof e,g=e=>p(e)&&!c(e)&&0===Object.keys(e).length,y=e=>e instanceof Date,w=e=>e instanceof Blob,b=e=>e instanceof Error,x=e=>y(e)&&!isNaN(e.getTime()),M=e=>e instanceof RegExp,S=e=>e instanceof Map,A=e=>e instanceof Set,v=e=>\"symbol\"==typeof e,C=e=>d(e)&&isFinite(e),I=e=>d(e)&&Number.isInteger(e),k=e=>C(e)&&!Number.isInteger(e),E=e=>Array.isArray(e),L=e=>E(e)&&0===e.length,P=e=>e.filter(Boolean),O=e=>[...new Set(e)],T=(e,t)=>(s(t>0,\"Chunk size must be greater than 0\"),Array.from({length:Math.ceil(e.length/t)},(n,r)=>e.slice(r*t,(r+1)*t))),X=(...e)=>{if(0===e.length)return[];if(1===e.length)return[...e[0]];const[t,...n]=e;return O(t).filter(e=>n.every(t=>t.includes(e)))},_=(e,t)=>e.filter(e=>!t.includes(e)),z=(...e)=>t=>e.reduce((e,t)=>t(e),t),Y=(...e)=>t=>e.reduceRight((e,t)=>t(e),t),R=()=>{},N=e=>\"function\"==typeof e,$=e=>(...t)=>!e(...t),F=e=>{let t,n=!1;return function(...r){return n||(n=!0,t=e.apply(this,r)),t}},j=e=>N(e?.then),U=async(e,t)=>{const n=[];for(let r=0;r<e.length;r++)n.push(await t(e[r],r,e));return n},W=async(e,t)=>Promise.all(e.map(t)),H=async(e,t)=>{const n=[];for(let r=0;r<e.length;r++){const a=e[r];await t(a,r,e)&&n.push(a)}return n},B=async(e,t)=>{const n=await W(e,async(e,n,r)=>!!await t(e,n,r)&&e);return P(n)},D=async(e,t)=>{for(let n=0;n<e.length;n++)if(await t(e[n],n,e))return!0;return!1},V=async(e,t)=>{for(let n=0;n<e.length;n++)if(!await t(e[n],n,e))return!1;return!0},Z=async(e,t,n)=>{let r=n;for(let n=0;n<e.length;n++)r=await t(r,e[n],n,e);return r},G=async(e,t)=>{for(let n=0;n<e.length;n++)if(await t(e[n],n,e))return e[n];return null},q=e=>new Promise(t=>setTimeout(t,e)),J=async(e,t,n=\"Operation timed out\")=>{try{return await Promise.race([e,q(t).then(()=>Promise.reject(new Error(n)))])}finally{}},K=(e,{maxAttempts:t=3,delayMs:n=300,backoff:r=!0,onRetry:a}={})=>async(...l)=>{let i;for(let o=1;o<=t;o++)try{return await e(...l)}catch(e){if(i=e,o<t){a?.(o,e);const t=r?n*2**(o-1):n;await q(t)}}throw i},Q=e=>\"string\"==typeof e,ee=(e,{fileName:t,target:n}={})=>{if(f(document))return;const r=document.createElement(\"a\");let a=null;try{const l=Q(e)?e:a=URL.createObjectURL(e);r.href=l,t&&(r.download=t),n&&(r.target=n),document.body.appendChild(r),r.click()}finally{r.remove(),a&&setTimeout(()=>{s(a,\"Object URL should not be null\"),URL.revokeObjectURL(a)},0)}},te=e=>e.scrollWidth>e.clientWidth,ne=e=>Math.max(0,e.scrollWidth-e.clientWidth),re=e=>e.scrollHeight>e.clientHeight,ae=e=>Math.max(0,e.scrollHeight-e.clientHeight),le=({overflowSize:e,containerSize:t,elementOffset:n,elementSize:r})=>{if(e<=0)return 0;const a=n+r/2-t/2;return-Math.max(0,Math.min(a,e))},ie=(e,t,{axis:n=\"both\"}={})=>{let r=0,a=0;\"x\"!==n&&\"both\"!==n||(r=le({overflowSize:ne(e),containerSize:e.clientWidth,elementOffset:t.offsetLeft,elementSize:t.clientWidth})),\"y\"!==n&&\"both\"!==n||(a=le({overflowSize:ae(e),containerSize:e.clientHeight,elementOffset:t.offsetTop,elementSize:t.clientHeight})),e.style.transform=`translate(${r}px, ${a}px)`},oe=e=>{const t=window.getComputedStyle(e).getPropertyValue(\"transform\").match(/^matrix\\((.+)\\)$/);if(!t)return{translateX:0,translateY:0,scaleX:1,scaleY:1,skewX:0,skewY:0};const[n,r,a,l,i,o]=t[1].split(\", \").map(parseFloat);return{translateX:i,translateY:o,scaleX:n,scaleY:l,skewX:a,skewY:r}},se=()=>{if(\"undefined\"==typeof window||!window.localStorage)return!1;try{return window.localStorage.getItem(\"__non_existing_key__\"),!0}catch{return!1}},ce=()=>{if(!se())return{readable:!1,writable:!1};try{const e=\"__test_write__\";return window.localStorage.setItem(e,\"1\"),window.localStorage.removeItem(e),{readable:!0,writable:!0}}catch{}return{readable:!0,writable:!1}},ue=e=>e instanceof File,he=e=>{if(!e)return[];const t=[];for(let n=0;n<e.length;n++)t.push(e[n]);return t},fe=(e,t)=>new File([e],t,{type:e.type}),de=async(e,{skipFiles:t=[\".DS_Store\",\"Thumbs.db\",\"desktop.ini\",\"ehthumbs.db\",\".Spotlight-V100\",\".Trashes\",\".fseventsd\",\"__MACOSX\"]}={})=>{const n=new Set(t),r=await(async e=>{const t=e.createReader(),n=async()=>new Promise((e,r)=>{t.readEntries(async t=>{if(t.length)try{const r=await n();e([...t,...r])}catch(e){r(e)}else e([])},r)});return n()})(e);return(await W(r,async e=>e.isDirectory?de(e,{skipFiles:t}):n.has(e.name)?[]:[await new Promise((t,n)=>{e.file(t,n)})])).flat()},me=async(e,t={})=>{const n=e?.items;if(!n)return[];const r=[];for(let e=0;e<n.length;e++){const a=n[e];if(\"webkitGetAsEntry\"in a){const e=a.webkitGetAsEntry?.();if(e?.isDirectory){r.push(de(e,t));continue}if(e?.isFile){r.push(new Promise((t,n)=>e.file(e=>t([e]),n)));continue}}const l=a.getAsFile();l&&r.push(Promise.resolve([l]))}return(await Promise.all(r)).flat()},pe=(e,...t)=>\"function\"==typeof e?e(...t):e,ge=({delta:e,value:t,min:n,max:r})=>{if(0===e)return null;const a=t+e;return e<0?t<=n?null:Math.max(a,n):e>0?t>=r?null:Math.min(a,r):null},ye=({value:e,min:t,max:n,velocityPxMs:r,deltaTimeMs:a,friction:l=.002,minVelocityPxMs:i=.01,emaAlpha:o=.2})=>{if(Math.abs(r)<i)return null;const s=ge({delta:r*a,value:e,min:t,max:n});if(null===s)return null;const c=r*Math.exp(-l*a),u=o>0?r*(1-o)+c*o:c;return Math.abs(u)<i?null:{value:s,velocityPxMs:u}},we=()=>`${Math.floor(1e3*performance.now()).toString(36)}${Math.random().toString(36).slice(2,10)}`,be=(e,t)=>Math.max(0,Math.min(e.right,t.right)-Math.max(e.left,t.left))*Math.max(0,Math.min(e.bottom,t.bottom)-Math.max(e.top,t.top))/(t.width*t.height),xe=(e,t,{allowFallback:n=!0,invert:r=!0}={})=>{const a=r?-1:1;switch(t){case\"x\":return{deltaX:a*(0!==e.deltaX?e.deltaX:n?e.deltaY:0),deltaY:0};case\"y\":return{deltaX:0,deltaY:a*e.deltaY};default:return{deltaX:a*e.deltaX,deltaY:a*e.deltaY}}},Me=(e,t,n,r)=>{const a=n-e,l=r-t;return Math.hypot(a,l)},Se=(e,t)=>Math.abs(e/t),Ae=(e,t)=>e*t/100,ve=e=>{let t=5381;for(let n=0;n<e.length;n++)t=33*t^e.charCodeAt(n);return(t>>>0).toString(36)},Ce=e=>Object.entries(e).reduce((e,[t,n])=>(void 0!==n&&(e[t]=n),e),{}),Ie=e=>e.replace(/([a-z0-9])([A-Z])/g,\"$1-$2\").toLowerCase(),ke=e=>{const t=e.charAt(0),n=e.slice(1);return t.toLowerCase()+n.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)},Ee=e=>e.replace(/([a-z0-9])([A-Z])/g,\"$1 $2\"),Le=e=>0===e.length?[]:e.split(\" \").filter(Boolean),Pe=e=>\"\"===e||u(e),Oe=e=>{const t=e.lastIndexOf(\".\");return t<=0||t===e.length-1?[e,\"\"]:[e.slice(0,t),e.slice(t+1).toLowerCase()]},Te=(e,t)=>{if(0===e.length)return[];const n=t.charCodeAt(0),r=[];for(let t=0;t<e.length;t++)e.charCodeAt(t)===n&&r.push(t);return r},Xe=(e,t,n)=>{if(0===e.length)return;const r=e.length;for(let a=0;a<r;a++){const l=e[a],i={charIndex:a,prevChar:a>0?e[a-1]:null,nextChar:a<r-1?e[a+1]:null};n?.(l,i)||t(l,i)}},_e=(e,t=1/0)=>0===e.length?\"\":Le(e).slice(0,t).map(e=>e[0]).join(\"\").toUpperCase(),ze=(e,t,n,r=[],a=void 0,l=0)=>(e?.forEach(e=>{const{[n]:i,...o}=e,s=e[n],c=Array.isArray(s);if(r.push({...o,parentId:a,depthLevel:l,childCount:c?s.length:0}),c){const a=e[t];ze(s,t,n,r,a,l+1)}}),r),Ye=(e,t,n)=>e.filter(e=>e.parentId===t&&(!n||n(e))),Re=(e,t,n,r)=>{const a=Le(r.toLowerCase());if(!a.length)return e;const l=e.reduce((e,n,r)=>(e[n[t]]=r,e),{});return e.reduce((r,i)=>{const o=i[n];if(!o)return r;if(r.some(e=>e[t]===i[t]))return r;const u=Le(o.toLowerCase());if(a.every(e=>u.some(t=>t.startsWith(e))))if(f(i.parentId)){r.push(i);const n=a=>{a.childCount&&e.forEach(e=>{e.parentId===a[t]&&(r.push(e),n(e))})};n(i)}else{const t=n=>{const a=l[n.parentId],i=e[a];f(i.parentId)||t(i);const o=r.length?r[r.length-1].parentId:null;(c(o)||o!==n.parentId)&&(s(i,\"[@react-hive/honey-utils]: Parent node was not found.\"),r.push(i))};t(i),r.push(i)}return r},[])};export{a as FOCUSABLE_HTML_TAGS,ye as applyInertiaStep,s as assert,fe as blobToFile,le as calculateCenterOffset,Me as calculateEuclideanDistance,Se as calculateMovingSpeed,Ae as calculatePercentage,ke as camelToDashCase,Ee as camelToWords,ie as centerElementInContainer,T as chunk,e as cloneBlob,P as compact,Y as compose,Ce as definedProps,q as delay,_ as difference,ee as downloadFile,V as everyAsync,he as fileListToFiles,B as filterParallel,H as filterSequential,G as findAsync,Te as findCharIndices,ze as flattenTree,Xe as forEachChar,we as generateEphemeralId,be as getDOMRectIntersectionRatio,t as getElementOffsetRect,i as getFocusableHtmlElements,ce as getLocalStorageCapabilities,Ye as getTreeChildren,_e as getWordsInitials,ne as getXOverflowWidth,ae as getYOverflowHeight,te as hasXOverflow,re as hasYOverflow,ve as hashString,X as intersection,pe as invokeIfFunction,n as isAnchorHtmlElement,E as isArray,w as isBlob,m as isBool,r as isContentEditableHtmlElement,y as isDate,k as isDecimal,h as isDefined,L as isEmptyArray,g as isEmptyObject,b as isError,ue as isFile,C as isFiniteNumber,N as isFunction,l as isHtmlElementFocusable,I as isInteger,se as isLocalStorageReadable,S as isMap,u as isNil,Pe as isNilOrEmptyString,c as isNull,d as isNumber,p as isObject,j as isPromise,M as isRegExp,A as isSet,Q as isString,v as isSymbol,f as isUndefined,x as isValidDate,o as moveFocusWithinContainer,R as noop,$ as not,F as once,oe as parse2DMatrix,Oe as parseFileName,z as pipe,me as readFilesFromDataTransfer,Z as reduceAsync,xe as resolveAxisDelta,ge as resolveBoundedDelta,K as retry,W as runParallel,U as runSequential,Re as searchTree,D as someAsync,Le as splitStringIntoWords,J as timeout,Ie as toKebabCase,de as traverseFileSystemDirectory,O as unique};\n//# sourceMappingURL=index.mjs.map","import { assert } from '@react-hive/honey-utils';\n\nimport type { HoneyCssToken, HoneyCssTokenType } from './types';\n\n/**\n * A lightweight cursor abstraction over a token stream.\n *\n * This is the core navigation primitive used by the Honey CSS parser.\n * It provides safe sequential reading, lookahead, backtracking,\n * and small helper utilities for collecting selector/value text.\n */\nexport interface HoneyTokenCursor {\n /**\n * Returns `true` when the cursor has consumed all tokens.\n */\n isEof: () => boolean;\n /**\n * Returns the current token without consuming it.\n *\n * This is primarily used for lookahead decisions in the parser:\n *\n * ```ts\n * if (cursor.peek()?.type === 'braceOpen') {\n * // parse rule block\n * }\n * ```\n */\n peek: () => HoneyCssToken | undefined;\n /**\n * Consumes and returns the current token, advancing the cursor forward.\n *\n * Returns `undefined` if the cursor is already at EOF.\n *\n * ```ts\n * const token = cursor.next();\n * ```\n */\n next: () => HoneyCssToken | undefined;\n /**\n * Creates a checkpoint of the current cursor position.\n *\n * Useful for speculative parsing or backtracking:\n *\n * ```ts\n * const mark = cursor.mark();\n *\n * if (!tryParseSomething(cursor)) {\n * cursor.reset(mark);\n * }\n * ```\n */\n mark: () => number;\n /**\n * Restores the cursor back to a previously created mark.\n *\n * @param mark - Index returned from {@link mark}.\n */\n reset: (mark: number) => void;\n /**\n * Consumes the next token and asserts that it matches the expected type.\n *\n * This is the parser's main safety mechanism and helps produce\n * clear error messages during invalid input.\n *\n * Throws if:\n * - the token stream ends unexpectedly\n * - the next token has a different type\n *\n * ```ts\n * cursor.expect('braceOpen'); // must be \"{\"\n * ```\n *\n * @param type - Expected token type.\n *\n * @returns The consumed token, narrowed to the expected type.\n */\n expect: <T extends HoneyCssTokenType>(type: T) => Extract<HoneyCssToken, { type: T }>;\n /**\n * Reads and concatenates consecutive token values until one of the stop token\n * types is encountered.\n *\n * This helper is used to collect:\n * - selectors (`.btn:hover`)\n * - declaration values (`calc(100% - 1px)`)\n * - at-rule names (`media`)\n *\n * Stops **before consuming** the stop token.\n *\n * Supported token types:\n * - `text` → appended as-is\n * - `string` → wrapped in quotes\n * - `params` → appended verbatim including parentheses\n *\n * Example:\n *\n * Tokens:\n * ```\n * text(\"var\")\n * params(\"(--color)\")\n * ```\n *\n * Result:\n * ```\n * \"var(--color)\"\n * ```\n *\n * @param stopTypes - Token types that terminate reading.\n *\n * @returns Combined string value.\n */\n readUntil: (stopTypes: HoneyCssTokenType[]) => string;\n /**\n * Advances the cursor until one of the stop token types is reached.\n *\n * This is useful for error recovery and safely skipping unknown syntax.\n *\n * Stops before consuming the stop token.\n *\n * @param stopTypes - Token types that terminate skipping.\n */\n skipUntil: (stopTypes: HoneyCssTokenType[]) => void;\n}\n\n/**\n * Creates a cursor wrapper around a list of CSS tokens.\n *\n * The cursor provides a small API surface for building\n * recursive-descent parsers without needing complex parser generators.\n *\n * @param tokens - Token list produced by the Honey tokenizer.\n *\n * @returns A reusable cursor instance.\n */\nexport const createCssTokenCursor = (tokens: HoneyCssToken[]): HoneyTokenCursor => {\n let index = 0;\n\n const isEof = (): boolean => index >= tokens.length;\n\n const peek = (): HoneyCssToken | undefined => (isEof() ? undefined : tokens[index]);\n\n const next = (): HoneyCssToken | undefined => (isEof() ? undefined : tokens[index++]);\n\n const mark = (): number => index;\n\n const reset = (mark: number): void => {\n index = mark;\n };\n\n const expect = <T extends HoneyCssTokenType>(type: T): Extract<HoneyCssToken, { type: T }> => {\n const token = next();\n\n assert(token, `[@react-hive/honey-css]: Expected \"${type}\" but reached end of input.`);\n assert(\n token.type === type,\n `[@react-hive/honey-css]: Expected \"${type}\" but got \"${token.type}\".`,\n );\n\n return token as Extract<HoneyCssToken, { type: T }>;\n };\n\n const readUntil = (stopTypes: HoneyCssTokenType[]): string => {\n let result = '';\n\n while (!isEof()) {\n const token = peek();\n\n if (!token || stopTypes.includes(token.type)) {\n break;\n }\n\n if (token.type === 'text') {\n if (result) {\n result += ' ';\n }\n\n result += token.value;\n //\n } else if (token.type === 'string') {\n result += `\"${token.value}\"`;\n //\n } else if (token.type === 'params') {\n result += token.value;\n }\n\n next();\n }\n\n return result.trim();\n };\n\n const skipUntil = (stopTypes: HoneyCssTokenType[]): void => {\n while (!isEof()) {\n const token = peek();\n\n if (!token || stopTypes.includes(token.type)) {\n break;\n }\n\n next();\n }\n };\n\n return {\n isEof,\n peek,\n next,\n mark,\n reset,\n expect,\n readUntil,\n skipUntil,\n };\n};\n"],"names":["__webpack_require__","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","isBoundaryChar","ch","tokenizeCss","input","tokens","index","isEof","length","peek","undefined","peekNext","skipWhitespace","test","skipSingleLineComment","skipMultiLineComment","readString","quote","result","escaped","readParamsGroup","depth","readText","trim","push","type","s","e","t","Error","createCssTokenCursor","next","mark","reset","expect","token","readUntil","stopTypes","includes","skipUntil"],"sourceRoot":""}
@@ -121,24 +121,47 @@ const isBoundaryChar = (ch) => ch === '{' ||
121
121
  /**
122
122
  * Tokenizes a CSS-like input string into a sequence of Honey CSS tokens.
123
123
  *
124
- * This tokenizer is intentionally lightweight and designed for parsing
125
- * Honey-specific CSS extensions such as:
124
+ * This function is the first stage of the Honey CSS compilation pipeline.
125
+ * It performs a single-pass lexical scan and produces a flat stream of tokens
126
+ * that can later be consumed by the recursive-descent parser.
126
127
  *
127
- * - Custom at-rules: `@honey-media (...) { ... }`
128
- * - Nested selectors: `&:hover { ... }`
129
- * - CSS variables: `--primary-color: red;`
128
+ * Unlike a strict CSS tokenizer, this implementation is intentional:
130
129
  *
131
- * Supported syntax:
132
- * - Braces: `{` `}`
133
- * - Colons and semicolons: `:` `;`
134
- * - At-rule marker: `@`
135
- * - Parentheses groups: `(sm:down)`
136
- * - Quoted strings: `"..."`, `'...'`
137
- * - Block comments: `/* ... *\/`
130
+ * - Lightweight (no external dependencies)
131
+ * - Tolerant (fails safely on malformed input)
132
+ * - Extended for CSS-in-JS use cases
133
+ *
134
+ * In addition to standard CSS constructs, it supports:
135
+ *
136
+ * - Custom at-rules (`@honey-media`, `@honey-stack`, etc.)
137
+ * - Nested selectors (`&:hover`, `& > .child`)
138
+ * - CSS variables (`--color: red`)
139
+ * - JavaScript-style single-line comments (`// comment`)
140
+ * - Multiline block comments (`/* comment *\/`)
141
+ * - Nested parentheses groups (`calc(...)`, `var(...)`)
142
+ * - Escaped characters inside strings
143
+ *
144
+ * The tokenizer:
145
+ *
146
+ * - Skips all whitespace
147
+ * - Skips both block (`/* *\/`) and single-line (`//`) comments
148
+ * - Preserves balanced parentheses as a single `params` token
149
+ * - Preserves quoted strings as `string` tokens (without quotes)
150
+ * - Emits structural tokens (`braceOpen`, `braceClose`, `colon`, `semicolon`, `at`)
151
+ * - Emits all other text as trimmed `text` tokens
152
+ *
153
+ * Safety guarantees:
154
+ *
155
+ * - Unterminated comments do not crash tokenization
156
+ * - Unterminated strings do not throw
157
+ * - Infinite loops are prevented by fallback index advancement
158
+ *
159
+ * The returned token stream is order-preserving and does not perform
160
+ * semantic validation. Structural correctness is handled by the parser stage.
138
161
  *
139
162
  * @param input - Raw CSS string to tokenize.
140
163
  *
141
- * @returns An ordered array of tokens.
164
+ * @returns Ordered array of {@link HoneyCssToken} objects.
142
165
  */
143
166
  const tokenizeCss = (input) => {
144
167
  const tokens = [];
@@ -164,6 +187,40 @@ const tokenizeCss = (input) => {
164
187
  index++;
165
188
  }
166
189
  };
190
+ /**
191
+ * Skips JavaScript-style single-line comments of the form:
192
+ *
193
+ * ```css
194
+ * // comment text
195
+ * ```
196
+ *
197
+ * This syntax is not part of standard CSS,
198
+ * but is commonly used in CSS-in-JS template literals.
199
+ *
200
+ * The comment is skipped until a newline character (`\n`)
201
+ * or the end of input is reached.
202
+ *
203
+ * If the comment is unterminated (EOF without newline),
204
+ * tokenization safely stops at the end of the input.
205
+ *
206
+ * @returns `true` if a single-line comment was detected and skipped,
207
+ * otherwise `false`.
208
+ */
209
+ const skipSingleLineComment = () => {
210
+ if (peek() !== '/' || peekNext() !== '/') {
211
+ return false;
212
+ }
213
+ index += 2; // skip "//"
214
+ while (!isEof()) {
215
+ const ch = peek();
216
+ if (ch === '\n') {
217
+ index++; // consume newline
218
+ break;
219
+ }
220
+ index++;
221
+ }
222
+ return true;
223
+ };
167
224
  /**
168
225
  * Skips CSS block comments of the form:
169
226
  *
@@ -175,7 +232,7 @@ const tokenizeCss = (input) => {
175
232
  *
176
233
  * @returns `true` if a comment was skipped.
177
234
  */
178
- const skipComment = () => {
235
+ const skipMultiLineComment = () => {
179
236
  if (peek() !== '/' || peekNext() !== '*') {
180
237
  return false;
181
238
  }
@@ -266,14 +323,37 @@ const tokenizeCss = (input) => {
266
323
  return result;
267
324
  };
268
325
  /**
269
- * Reads plain text until a boundary character is reached.
326
+ * Reads a contiguous plain-text segment until a structural boundary
327
+ * character is encountered.
328
+ *
329
+ * This function is responsible for collecting free-form CSS text such as:
330
+ *
331
+ * - Selectors (`.btn`, `&:hover`, `.parent > .child`)
332
+ * - Property names (`color`, `border-bottom-width`)
333
+ * - Values (`red`, `12px`, `100%`, `red!important`)
334
+ *
335
+ * Reading stops when a boundary character is reached.
336
+ * Boundary characters represent structural syntax in CSS and include:
337
+ *
338
+ * - Block delimiters: `{` `}`
339
+ * - Declaration delimiters: `:` `;`
340
+ * - At-rule marker: `@`
341
+ * - Parentheses start: `(`
342
+ * - String delimiters: `'` `"`
343
+ * - Comment initiator: `/`
344
+ *
345
+ * The boundary character itself is NOT consumed here —
346
+ * it is handled separately by the main tokenizer loop.
347
+ *
348
+ * The returned value is trimmed to remove leading/trailing whitespace,
349
+ * ensuring clean token values without altering internal spacing.
270
350
  *
271
- * This is used for:
272
- * - Selectors (`.btn`, `&:hover`)
273
- * - Property names (`color`)
274
- * - Values (`red`, `12px`)
351
+ * Safety:
352
+ * - Stops at EOF safely
353
+ * - Never throws
354
+ * - Prevents infinite loops via boundary checks
275
355
  *
276
- * @returns Trimmed text content.
356
+ * @returns Trimmed text segment, or an empty string if no text was read.
277
357
  */
278
358
  const readText = () => {
279
359
  let result = '';
@@ -298,7 +378,7 @@ const tokenizeCss = (input) => {
298
378
  if (isEof()) {
299
379
  break;
300
380
  }
301
- if (skipComment()) {
381
+ if (skipSingleLineComment() || skipMultiLineComment()) {
302
382
  continue;
303
383
  }
304
384
  const ch = peek();
@@ -1 +1 @@
1
- {"version":3,"file":"index.dev.cjs","mappings":";;;;;;;;;;;;;;;AAAiD;AA2HjD;;;;;;;;;GASG;AACI,MAAM,oBAAoB,GAAG,CAAC,MAAuB,EAAoB,EAAE;IAChF,IAAI,KAAK,GAAG,CAAC,CAAC;IAEd,MAAM,KAAK,GAAG,GAAY,EAAE,CAAC,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC;IAEpD,MAAM,IAAI,GAAG,GAA8B,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IAEpF,MAAM,IAAI,GAAG,GAA8B,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IAEtF,MAAM,IAAI,GAAG,GAAW,EAAE,CAAC,KAAK,CAAC;IAEjC,MAAM,KAAK,GAAG,CAAC,IAAY,EAAQ,EAAE;QACnC,KAAK,GAAG,IAAI,CAAC;IACf,CAAC,CAAC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AAwB,WAAW,+CAA+C,EAAE,uCAAuC,oKAAoK,+BAA+B,GAAG,IAAI,eAAe,UAAU,eAAe,wDAAwD,eAAe,4BAA4B,eAAe,sCAAsC,gBAAgB,kBAAkB,uBAAuB,kDAAkD,WAAW,YAAY,WAAW,2BAA2B,2BAA2B,sEAAsE,qEAAqE,iCAAiC,iDAAiD,gBAAgB,GAAG,4HAA4H,2BAA2B,6EAA6E,YAAY,yBAAyB,6BAA6B,YAAY,WAAW,mCAAmC,SAAS,cAAc,uBAAuB,iBAAiB,YAAY,IAAI,KAAK,gBAAgB,iEAAiE,kBAAkB,kIAAkI,MAAM,WAAW,6BAA6B,WAAW,qDAAqD,KAAK,aAAa,mBAAmB,wEAAwE,4BAA4B,sBAAsB,0CAA0C,EAAE,wBAAwB,aAAa,eAAe,mCAAmC,4BAA4B,4DAA4D,UAAU,YAAY,4BAA4B,oCAAoC,GAAG,KAAK,KAAK,YAAY,6BAA6B,oBAAoB,6CAA6C,kGAAkG,eAAe,SAAS,MAA+uD;AACtlU,kC;;;;;;UCDA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WC5BA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA,E;;;;;WCPA,wF;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D,E;;;;;;;;;;;;;;;;;;ACNwB;AACO;AACW","sources":["webpack://@react-hive/honey-css/./src/create-css-token-cursor.ts","webpack://@react-hive/honey-css/./src/tokenize-css.ts","webpack://@react-hive/honey-css/./src/types.ts","webpack://@react-hive/honey-css/./node_modules/.pnpm/@react-hive+honey-utils@3.23.0/node_modules/@react-hive/honey-utils/dist/index.mjs","webpack://@react-hive/honey-css/webpack/bootstrap","webpack://@react-hive/honey-css/webpack/runtime/define property getters","webpack://@react-hive/honey-css/webpack/runtime/hasOwnProperty shorthand","webpack://@react-hive/honey-css/webpack/runtime/make namespace object","webpack://@react-hive/honey-css/./src/index.ts"],"sourcesContent":["import { assert } from '@react-hive/honey-utils';\n\nimport type { HoneyCssToken, HoneyCssTokenType } from '~/types';\n\n/**\n * A lightweight cursor abstraction over a token stream.\n *\n * This is the core navigation primitive used by the Honey CSS parser.\n * It provides safe sequential reading, lookahead, backtracking,\n * and small helper utilities for collecting selector/value text.\n */\nexport interface HoneyTokenCursor {\n /**\n * Returns `true` when the cursor has consumed all tokens.\n */\n isEof: () => boolean;\n /**\n * Returns the current token without consuming it.\n *\n * This is primarily used for lookahead decisions in the parser:\n *\n * ```ts\n * if (cursor.peek()?.type === 'braceOpen') {\n * // parse rule block\n * }\n * ```\n */\n peek: () => HoneyCssToken | undefined;\n /**\n * Consumes and returns the current token, advancing the cursor forward.\n *\n * Returns `undefined` if the cursor is already at EOF.\n *\n * ```ts\n * const token = cursor.next();\n * ```\n */\n next: () => HoneyCssToken | undefined;\n /**\n * Creates a checkpoint of the current cursor position.\n *\n * Useful for speculative parsing or backtracking:\n *\n * ```ts\n * const mark = cursor.mark();\n *\n * if (!tryParseSomething(cursor)) {\n * cursor.reset(mark);\n * }\n * ```\n */\n mark: () => number;\n /**\n * Restores the cursor back to a previously created mark.\n *\n * @param mark - Index returned from {@link mark}.\n */\n reset: (mark: number) => void;\n /**\n * Consumes the next token and asserts that it matches the expected type.\n *\n * This is the parser's main safety mechanism and helps produce\n * clear error messages during invalid input.\n *\n * Throws if:\n * - the token stream ends unexpectedly\n * - the next token has a different type\n *\n * ```ts\n * cursor.expect('braceOpen'); // must be \"{\"\n * ```\n *\n * @param type - Expected token type.\n *\n * @returns The consumed token, narrowed to the expected type.\n */\n expect: <T extends HoneyCssTokenType>(type: T) => Extract<HoneyCssToken, { type: T }>;\n /**\n * Reads and concatenates consecutive token values until one of the stop token\n * types is encountered.\n *\n * This helper is used to collect:\n * - selectors (`.btn:hover`)\n * - declaration values (`calc(100% - 1px)`)\n * - at-rule names (`media`)\n *\n * Stops **before consuming** the stop token.\n *\n * Supported token types:\n * - `text` → appended as-is\n * - `string` → wrapped in quotes\n * - `params` → appended verbatim including parentheses\n *\n * Example:\n *\n * Tokens:\n * ```\n * text(\"var\")\n * params(\"(--color)\")\n * ```\n *\n * Result:\n * ```\n * \"var(--color)\"\n * ```\n *\n * @param stopTypes - Token types that terminate reading.\n *\n * @returns Combined string value.\n */\n readUntil: (stopTypes: HoneyCssTokenType[]) => string;\n /**\n * Advances the cursor until one of the stop token types is reached.\n *\n * This is useful for error recovery and safely skipping unknown syntax.\n *\n * Stops before consuming the stop token.\n *\n * @param stopTypes - Token types that terminate skipping.\n */\n skipUntil: (stopTypes: HoneyCssTokenType[]) => void;\n}\n\n/**\n * Creates a cursor wrapper around a list of CSS tokens.\n *\n * The cursor provides a small API surface for building\n * recursive-descent parsers without needing complex parser generators.\n *\n * @param tokens - Token list produced by the Honey tokenizer.\n *\n * @returns A reusable cursor instance.\n */\nexport const createCssTokenCursor = (tokens: HoneyCssToken[]): HoneyTokenCursor => {\n let index = 0;\n\n const isEof = (): boolean => index >= tokens.length;\n\n const peek = (): HoneyCssToken | undefined => (isEof() ? undefined : tokens[index]);\n\n const next = (): HoneyCssToken | undefined => (isEof() ? undefined : tokens[index++]);\n\n const mark = (): number => index;\n\n const reset = (mark: number): void => {\n index = mark;\n };\n\n const expect = <T extends HoneyCssTokenType>(type: T): Extract<HoneyCssToken, { type: T }> => {\n const token = next();\n\n assert(token, `[@react-hive/honey-css]: Expected \"${type}\" but reached end of input.`);\n assert(\n token.type === type,\n `[@react-hive/honey-css]: Expected \"${type}\" but got \"${token.type}\".`,\n );\n\n return token as Extract<HoneyCssToken, { type: T }>;\n };\n\n const readUntil = (stopTypes: HoneyCssTokenType[]): string => {\n let result = '';\n\n while (!isEof()) {\n const token = peek();\n\n if (!token || stopTypes.includes(token.type)) {\n break;\n }\n\n if (token.type === 'text') {\n if (result) {\n result += ' ';\n }\n\n result += token.value;\n //\n } else if (token.type === 'string') {\n result += `\"${token.value}\"`;\n //\n } else if (token.type === 'params') {\n result += token.value;\n }\n\n next();\n }\n\n return result.trim();\n };\n\n const skipUntil = (stopTypes: HoneyCssTokenType[]): void => {\n while (!isEof()) {\n const token = peek();\n\n if (!token || stopTypes.includes(token.type)) {\n break;\n }\n\n next();\n }\n };\n\n return {\n isEof,\n peek,\n next,\n mark,\n reset,\n expect,\n readUntil,\n skipUntil,\n };\n};\n","import type { HoneyCssToken } from '~/types';\n\n/**\n * Determines whether a character should terminate a plain text read.\n *\n * These characters represent structural boundaries in CSS:\n * - Blocks: `{` `}`\n * - Declarations: `:` `;`\n * - At-rules: `@`\n * - Params: `(`\n * - Strings: `'` `\"`\n * - Comments: `/`\n */\nconst isBoundaryChar = (ch: string): boolean =>\n ch === '{' ||\n ch === '}' ||\n ch === ':' ||\n ch === ';' ||\n ch === '@' ||\n ch === '(' ||\n ch === '\"' ||\n ch === \"'\" ||\n ch === '/';\n\n/**\n * Tokenizes a CSS-like input string into a sequence of Honey CSS tokens.\n *\n * This tokenizer is intentionally lightweight and designed for parsing\n * Honey-specific CSS extensions such as:\n *\n * - Custom at-rules: `@honey-media (...) { ... }`\n * - Nested selectors: `&:hover { ... }`\n * - CSS variables: `--primary-color: red;`\n *\n * Supported syntax:\n * - Braces: `{` `}`\n * - Colons and semicolons: `:` `;`\n * - At-rule marker: `@`\n * - Parentheses groups: `(sm:down)`\n * - Quoted strings: `\"...\"`, `'...'`\n * - Block comments: `/* ... *\\/`\n *\n * @param input - Raw CSS string to tokenize.\n *\n * @returns An ordered array of tokens.\n */\nexport const tokenizeCss = (input: string): HoneyCssToken[] => {\n const tokens: HoneyCssToken[] = [];\n\n let index = 0;\n\n const isEof = (): boolean => index >= input.length;\n\n /**\n * Returns the current character without consuming it.\n */\n const peek = (): string | undefined => (isEof() ? undefined : input[index]);\n\n /**\n * Returns the next character without consuming it.\n */\n const peekNext = (): string | undefined =>\n index + 1 >= input.length ? undefined : input[index + 1];\n\n /**\n * Advances the cursor past any whitespace characters.\n */\n const skipWhitespace = () => {\n while (true) {\n const ch = peek();\n\n if (!ch || !/\\s/.test(ch)) {\n return;\n }\n\n index++;\n }\n };\n\n /**\n * Skips CSS block comments of the form:\n *\n * ```css\n * /* comment *\\/\n * ```\n *\n * If the comment is unterminated, tokenization stops safely.\n *\n * @returns `true` if a comment was skipped.\n */\n const skipComment = (): boolean => {\n if (peek() !== '/' || peekNext() !== '*') {\n return false;\n }\n\n index += 2; // skip \"/*\"\n\n while (!isEof()) {\n if (peek() === '*' && peekNext() === '/') {\n index += 2; // skip \"*/\"\n\n return true;\n }\n\n index++;\n }\n\n return true;\n };\n\n /**\n * Reads a quoted string token.\n *\n * Supports:\n * - Double quotes: `\"text\"`\n * - Single quotes: `'text'`\n * - Escaped characters: `\"a\\\\\\\"b\"`\n *\n * @returns The unwrapped string contents.\n */\n const readString = (): string => {\n const quote = peek();\n if (!quote) {\n return '';\n }\n\n index++; // skip opening quote\n let result = '';\n\n while (!isEof()) {\n const ch = peek();\n if (!ch) {\n break;\n }\n\n // Handle escape sequences\n if (ch === '\\\\') {\n result += ch;\n index++;\n\n const escaped = peek();\n if (escaped) {\n result += escaped;\n index++;\n }\n\n continue;\n }\n\n // Closing quote\n if (ch === quote) {\n index++;\n break;\n }\n\n result += ch;\n index++;\n }\n\n return result;\n };\n\n /**\n * Reads a balanced parentheses group.\n *\n * Examples:\n * - `(sm:down)`\n * - `(min-width: calc(100% - 1px))`\n *\n * Nested parentheses are supported.\n *\n * @returns The full params string including parentheses.\n */\n const readParamsGroup = (): string => {\n let depth = 0;\n let result = '';\n\n while (!isEof()) {\n const ch = peek();\n if (!ch) {\n break;\n }\n\n if (ch === '(') {\n depth++;\n }\n\n if (ch === ')') {\n depth--;\n }\n\n result += ch;\n index++;\n\n if (depth === 0) {\n break;\n }\n }\n\n return result;\n };\n\n /**\n * Reads plain text until a boundary character is reached.\n *\n * This is used for:\n * - Selectors (`.btn`, `&:hover`)\n * - Property names (`color`)\n * - Values (`red`, `12px`)\n *\n * @returns Trimmed text content.\n */\n const readText = (): string => {\n let result = '';\n\n while (!isEof()) {\n const ch = peek();\n if (!ch) {\n break;\n }\n\n if (isBoundaryChar(ch)) {\n break;\n }\n\n result += ch;\n index++;\n }\n\n return result.trim();\n };\n\n // ============================\n // Main Token Loop\n // ============================\n while (!isEof()) {\n skipWhitespace();\n\n if (isEof()) {\n break;\n }\n\n if (skipComment()) {\n continue;\n }\n\n const ch = peek();\n if (!ch) {\n break;\n }\n\n if (ch === '{') {\n tokens.push({\n type: 'braceOpen',\n });\n\n index++;\n continue;\n }\n\n if (ch === '}') {\n tokens.push({\n type: 'braceClose',\n });\n\n index++;\n continue;\n }\n\n if (ch === ':') {\n tokens.push({\n type: 'colon',\n });\n\n index++;\n continue;\n }\n\n if (ch === ';') {\n tokens.push({\n type: 'semicolon',\n });\n\n index++;\n continue;\n }\n\n if (ch === '@') {\n tokens.push({\n type: 'at',\n });\n\n index++;\n continue;\n }\n\n // Params group\n if (ch === '(') {\n tokens.push({\n type: 'params',\n value: readParamsGroup(),\n });\n\n continue;\n }\n\n // Strings\n if (ch === '\"' || ch === \"'\") {\n tokens.push({\n type: 'string',\n value: readString(),\n });\n\n continue;\n }\n\n // Text chunk\n const value = readText();\n if (value) {\n tokens.push({\n type: 'text',\n value,\n });\n } else {\n // Safety fallback to prevent infinite loops\n index++;\n }\n }\n\n return tokens;\n};\n","/**\n * All supported token types produced by the Honey CSS tokenizer.\n *\n * These tokens represent the minimal syntax units needed for parsing:\n * - Structural braces (`{` / `}`)\n * - Punctuation (`:` / `;`)\n * - At-rules (`@`)\n * - Parenthesized groups (`(...)`)\n * - Strings (`\"...\"`, `'...'`)\n * - Plain text chunks (selectors, property names, values)\n */\nexport type HoneyCssTokenType =\n | 'braceOpen'\n | 'braceClose'\n | 'colon'\n | 'semicolon'\n | 'at'\n | 'params'\n | 'string'\n | 'text';\n\n/**\n * A single token produced by {@link tokenizeCss}.\n *\n * Some token types (like `text`, `params`, `string`) include a `value`,\n * while punctuation tokens do not.\n */\nexport interface HoneyCssToken {\n type: HoneyCssTokenType;\n value?: string;\n}\n","const e=e=>new Blob([e],{type:e.type}),t=e=>new DOMRect(e.offsetLeft,e.offsetTop,e.clientWidth,e.clientHeight),n=e=>\"A\"===e.tagName,r=e=>\"true\"===e.getAttribute(\"contenteditable\"),a=[\"INPUT\",\"SELECT\",\"TEXTAREA\",\"BUTTON\",\"A\"],l=e=>{if(!e)return!1;const t=window.getComputedStyle(e);if(\"hidden\"===t.visibility||\"none\"===t.display)return!1;if(\"disabled\"in e&&e.disabled)return!1;const l=e.getAttribute(\"tabindex\");return\"-1\"!==l&&(a.includes(e.tagName)?!n(e)||\"\"!==e.href:!!r(e)||null!==l)},i=e=>Array.from(e.querySelectorAll(\"*\")).filter(l),o=(e,t=null,{wrap:n=!0,getNextIndex:r}={})=>{const a=document.activeElement,l=t??a?.parentElement;if(!a||!l)return;const o=i(l);if(0===o.length)return;const s=o.indexOf(a);if(-1===s)return;let c;r?c=r(s,e,o):\"next\"===e?(c=s+1,c>=o.length&&(c=n?0:null)):(c=s-1,c<0&&(c=n?o.length-1:null)),null!==c&&o[c]?.focus()};function s(e,t){if(!e)throw new Error(t)}const c=e=>null===e,u=e=>null==e,h=e=>null!=e,f=e=>void 0===e,d=e=>\"number\"==typeof e,m=e=>\"boolean\"==typeof e,p=e=>\"object\"==typeof e,g=e=>p(e)&&!c(e)&&0===Object.keys(e).length,y=e=>e instanceof Date,w=e=>e instanceof Blob,b=e=>e instanceof Error,x=e=>y(e)&&!isNaN(e.getTime()),M=e=>e instanceof RegExp,S=e=>e instanceof Map,A=e=>e instanceof Set,v=e=>\"symbol\"==typeof e,C=e=>d(e)&&isFinite(e),I=e=>d(e)&&Number.isInteger(e),k=e=>C(e)&&!Number.isInteger(e),E=e=>Array.isArray(e),L=e=>E(e)&&0===e.length,P=e=>e.filter(Boolean),O=e=>[...new Set(e)],T=(e,t)=>(s(t>0,\"Chunk size must be greater than 0\"),Array.from({length:Math.ceil(e.length/t)},(n,r)=>e.slice(r*t,(r+1)*t))),X=(...e)=>{if(0===e.length)return[];if(1===e.length)return[...e[0]];const[t,...n]=e;return O(t).filter(e=>n.every(t=>t.includes(e)))},_=(e,t)=>e.filter(e=>!t.includes(e)),z=(...e)=>t=>e.reduce((e,t)=>t(e),t),Y=(...e)=>t=>e.reduceRight((e,t)=>t(e),t),R=()=>{},N=e=>\"function\"==typeof e,$=e=>(...t)=>!e(...t),F=e=>{let t,n=!1;return function(...r){return n||(n=!0,t=e.apply(this,r)),t}},j=e=>N(e?.then),U=async(e,t)=>{const n=[];for(let r=0;r<e.length;r++)n.push(await t(e[r],r,e));return n},W=async(e,t)=>Promise.all(e.map(t)),H=async(e,t)=>{const n=[];for(let r=0;r<e.length;r++){const a=e[r];await t(a,r,e)&&n.push(a)}return n},B=async(e,t)=>{const n=await W(e,async(e,n,r)=>!!await t(e,n,r)&&e);return P(n)},D=async(e,t)=>{for(let n=0;n<e.length;n++)if(await t(e[n],n,e))return!0;return!1},V=async(e,t)=>{for(let n=0;n<e.length;n++)if(!await t(e[n],n,e))return!1;return!0},Z=async(e,t,n)=>{let r=n;for(let n=0;n<e.length;n++)r=await t(r,e[n],n,e);return r},G=async(e,t)=>{for(let n=0;n<e.length;n++)if(await t(e[n],n,e))return e[n];return null},q=e=>new Promise(t=>setTimeout(t,e)),J=async(e,t,n=\"Operation timed out\")=>{try{return await Promise.race([e,q(t).then(()=>Promise.reject(new Error(n)))])}finally{}},K=(e,{maxAttempts:t=3,delayMs:n=300,backoff:r=!0,onRetry:a}={})=>async(...l)=>{let i;for(let o=1;o<=t;o++)try{return await e(...l)}catch(e){if(i=e,o<t){a?.(o,e);const t=r?n*2**(o-1):n;await q(t)}}throw i},Q=e=>\"string\"==typeof e,ee=(e,{fileName:t,target:n}={})=>{if(f(document))return;const r=document.createElement(\"a\");let a=null;try{const l=Q(e)?e:a=URL.createObjectURL(e);r.href=l,t&&(r.download=t),n&&(r.target=n),document.body.appendChild(r),r.click()}finally{r.remove(),a&&setTimeout(()=>{s(a,\"Object URL should not be null\"),URL.revokeObjectURL(a)},0)}},te=e=>e.scrollWidth>e.clientWidth,ne=e=>Math.max(0,e.scrollWidth-e.clientWidth),re=e=>e.scrollHeight>e.clientHeight,ae=e=>Math.max(0,e.scrollHeight-e.clientHeight),le=({overflowSize:e,containerSize:t,elementOffset:n,elementSize:r})=>{if(e<=0)return 0;const a=n+r/2-t/2;return-Math.max(0,Math.min(a,e))},ie=(e,t,{axis:n=\"both\"}={})=>{let r=0,a=0;\"x\"!==n&&\"both\"!==n||(r=le({overflowSize:ne(e),containerSize:e.clientWidth,elementOffset:t.offsetLeft,elementSize:t.clientWidth})),\"y\"!==n&&\"both\"!==n||(a=le({overflowSize:ae(e),containerSize:e.clientHeight,elementOffset:t.offsetTop,elementSize:t.clientHeight})),e.style.transform=`translate(${r}px, ${a}px)`},oe=e=>{const t=window.getComputedStyle(e).getPropertyValue(\"transform\").match(/^matrix\\((.+)\\)$/);if(!t)return{translateX:0,translateY:0,scaleX:1,scaleY:1,skewX:0,skewY:0};const[n,r,a,l,i,o]=t[1].split(\", \").map(parseFloat);return{translateX:i,translateY:o,scaleX:n,scaleY:l,skewX:a,skewY:r}},se=()=>{if(\"undefined\"==typeof window||!window.localStorage)return!1;try{return window.localStorage.getItem(\"__non_existing_key__\"),!0}catch{return!1}},ce=()=>{if(!se())return{readable:!1,writable:!1};try{const e=\"__test_write__\";return window.localStorage.setItem(e,\"1\"),window.localStorage.removeItem(e),{readable:!0,writable:!0}}catch{}return{readable:!0,writable:!1}},ue=e=>e instanceof File,he=e=>{if(!e)return[];const t=[];for(let n=0;n<e.length;n++)t.push(e[n]);return t},fe=(e,t)=>new File([e],t,{type:e.type}),de=async(e,{skipFiles:t=[\".DS_Store\",\"Thumbs.db\",\"desktop.ini\",\"ehthumbs.db\",\".Spotlight-V100\",\".Trashes\",\".fseventsd\",\"__MACOSX\"]}={})=>{const n=new Set(t),r=await(async e=>{const t=e.createReader(),n=async()=>new Promise((e,r)=>{t.readEntries(async t=>{if(t.length)try{const r=await n();e([...t,...r])}catch(e){r(e)}else e([])},r)});return n()})(e);return(await W(r,async e=>e.isDirectory?de(e,{skipFiles:t}):n.has(e.name)?[]:[await new Promise((t,n)=>{e.file(t,n)})])).flat()},me=async(e,t={})=>{const n=e?.items;if(!n)return[];const r=[];for(let e=0;e<n.length;e++){const a=n[e];if(\"webkitGetAsEntry\"in a){const e=a.webkitGetAsEntry?.();if(e?.isDirectory){r.push(de(e,t));continue}if(e?.isFile){r.push(new Promise((t,n)=>e.file(e=>t([e]),n)));continue}}const l=a.getAsFile();l&&r.push(Promise.resolve([l]))}return(await Promise.all(r)).flat()},pe=(e,...t)=>\"function\"==typeof e?e(...t):e,ge=({delta:e,value:t,min:n,max:r})=>{if(0===e)return null;const a=t+e;return e<0?t<=n?null:Math.max(a,n):e>0?t>=r?null:Math.min(a,r):null},ye=({value:e,min:t,max:n,velocityPxMs:r,deltaTimeMs:a,friction:l=.002,minVelocityPxMs:i=.01,emaAlpha:o=.2})=>{if(Math.abs(r)<i)return null;const s=ge({delta:r*a,value:e,min:t,max:n});if(null===s)return null;const c=r*Math.exp(-l*a),u=o>0?r*(1-o)+c*o:c;return Math.abs(u)<i?null:{value:s,velocityPxMs:u}},we=()=>`${Math.floor(1e3*performance.now()).toString(36)}${Math.random().toString(36).slice(2,10)}`,be=(e,t)=>Math.max(0,Math.min(e.right,t.right)-Math.max(e.left,t.left))*Math.max(0,Math.min(e.bottom,t.bottom)-Math.max(e.top,t.top))/(t.width*t.height),xe=(e,t,{allowFallback:n=!0,invert:r=!0}={})=>{const a=r?-1:1;switch(t){case\"x\":return{deltaX:a*(0!==e.deltaX?e.deltaX:n?e.deltaY:0),deltaY:0};case\"y\":return{deltaX:0,deltaY:a*e.deltaY};default:return{deltaX:a*e.deltaX,deltaY:a*e.deltaY}}},Me=(e,t,n,r)=>{const a=n-e,l=r-t;return Math.hypot(a,l)},Se=(e,t)=>Math.abs(e/t),Ae=(e,t)=>e*t/100,ve=e=>{let t=5381;for(let n=0;n<e.length;n++)t=33*t^e.charCodeAt(n);return(t>>>0).toString(36)},Ce=e=>Object.entries(e).reduce((e,[t,n])=>(void 0!==n&&(e[t]=n),e),{}),Ie=e=>e.replace(/([a-z0-9])([A-Z])/g,\"$1-$2\").toLowerCase(),ke=e=>{const t=e.charAt(0),n=e.slice(1);return t.toLowerCase()+n.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)},Ee=e=>e.replace(/([a-z0-9])([A-Z])/g,\"$1 $2\"),Le=e=>0===e.length?[]:e.split(\" \").filter(Boolean),Pe=e=>\"\"===e||u(e),Oe=e=>{const t=e.lastIndexOf(\".\");return t<=0||t===e.length-1?[e,\"\"]:[e.slice(0,t),e.slice(t+1).toLowerCase()]},Te=(e,t)=>{if(0===e.length)return[];const n=t.charCodeAt(0),r=[];for(let t=0;t<e.length;t++)e.charCodeAt(t)===n&&r.push(t);return r},Xe=(e,t,n)=>{if(0===e.length)return;const r=e.length;for(let a=0;a<r;a++){const l=e[a],i={charIndex:a,prevChar:a>0?e[a-1]:null,nextChar:a<r-1?e[a+1]:null};n?.(l,i)||t(l,i)}},_e=(e,t=1/0)=>0===e.length?\"\":Le(e).slice(0,t).map(e=>e[0]).join(\"\").toUpperCase(),ze=(e,t,n,r=[],a=void 0,l=0)=>(e?.forEach(e=>{const{[n]:i,...o}=e,s=e[n],c=Array.isArray(s);if(r.push({...o,parentId:a,depthLevel:l,childCount:c?s.length:0}),c){const a=e[t];ze(s,t,n,r,a,l+1)}}),r),Ye=(e,t,n)=>e.filter(e=>e.parentId===t&&(!n||n(e))),Re=(e,t,n,r)=>{const a=Le(r.toLowerCase());if(!a.length)return e;const l=e.reduce((e,n,r)=>(e[n[t]]=r,e),{});return e.reduce((r,i)=>{const o=i[n];if(!o)return r;if(r.some(e=>e[t]===i[t]))return r;const u=Le(o.toLowerCase());if(a.every(e=>u.some(t=>t.startsWith(e))))if(f(i.parentId)){r.push(i);const n=a=>{a.childCount&&e.forEach(e=>{e.parentId===a[t]&&(r.push(e),n(e))})};n(i)}else{const t=n=>{const a=l[n.parentId],i=e[a];f(i.parentId)||t(i);const o=r.length?r[r.length-1].parentId:null;(c(o)||o!==n.parentId)&&(s(i,\"[@react-hive/honey-utils]: Parent node was not found.\"),r.push(i))};t(i),r.push(i)}return r},[])};export{a as FOCUSABLE_HTML_TAGS,ye as applyInertiaStep,s as assert,fe as blobToFile,le as calculateCenterOffset,Me as calculateEuclideanDistance,Se as calculateMovingSpeed,Ae as calculatePercentage,ke as camelToDashCase,Ee as camelToWords,ie as centerElementInContainer,T as chunk,e as cloneBlob,P as compact,Y as compose,Ce as definedProps,q as delay,_ as difference,ee as downloadFile,V as everyAsync,he as fileListToFiles,B as filterParallel,H as filterSequential,G as findAsync,Te as findCharIndices,ze as flattenTree,Xe as forEachChar,we as generateEphemeralId,be as getDOMRectIntersectionRatio,t as getElementOffsetRect,i as getFocusableHtmlElements,ce as getLocalStorageCapabilities,Ye as getTreeChildren,_e as getWordsInitials,ne as getXOverflowWidth,ae as getYOverflowHeight,te as hasXOverflow,re as hasYOverflow,ve as hashString,X as intersection,pe as invokeIfFunction,n as isAnchorHtmlElement,E as isArray,w as isBlob,m as isBool,r as isContentEditableHtmlElement,y as isDate,k as isDecimal,h as isDefined,L as isEmptyArray,g as isEmptyObject,b as isError,ue as isFile,C as isFiniteNumber,N as isFunction,l as isHtmlElementFocusable,I as isInteger,se as isLocalStorageReadable,S as isMap,u as isNil,Pe as isNilOrEmptyString,c as isNull,d as isNumber,p as isObject,j as isPromise,M as isRegExp,A as isSet,Q as isString,v as isSymbol,f as isUndefined,x as isValidDate,o as moveFocusWithinContainer,R as noop,$ as not,F as once,oe as parse2DMatrix,Oe as parseFileName,z as pipe,me as readFilesFromDataTransfer,Z as reduceAsync,xe as resolveAxisDelta,ge as resolveBoundedDelta,K as retry,W as runParallel,U as runSequential,Re as searchTree,D as someAsync,Le as splitStringIntoWords,J as timeout,Ie as toKebabCase,de as traverseFileSystemDirectory,O as unique};\n//# sourceMappingURL=index.mjs.map","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Check if module exists (development only)\n\tif (__webpack_modules__[moduleId] === undefined) {\n\t\tvar e = new Error(\"Cannot find module '\" + moduleId + \"'\");\n\t\te.code = 'MODULE_NOT_FOUND';\n\t\tthrow e;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export * from './types';\nexport * from './tokenize-css';\nexport * from './create-css-token-cursor';\n"],"names":[],"sourceRoot":""}
1
+ {"version":3,"file":"index.dev.cjs","mappings":";;;;;;;;;;;;;;;AAAiD;AA2HjD;;;;;;;;;GASG;AACI,MAAM,oBAAoB,GAAG,CAAC,MAAuB,EAAoB,EAAE;IAChF,IAAI,KAAK,GAA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B,kBAAkB,uBAAuB,kDAAkD,WAAW,YAAY,WAAW,2BAA2B,2BAA2B,sEAAsE,qEAAqE,iCAAiC,iDAAiD,gBAAgB,GAAG,4HAA4H,2BAA2B,6EAA6E,YAAY,yBAAyB,6BAA6B,YAAY,WAAW,mCAAmC,SAAS,cAAc,uBAAuB,iBAAiB,YAAY,IAAI,KAAK,gBAAgB,iEAAiE,kBAAkB,kIAAkI,MAAM,WAAW,6BAA6B,WAAW,qDAAqD,KAAK,aAAa,mBAAmB,wEAAwE,4BAA4B,sBAAsB,0CAA0C,EAAE,wBAAwB,aAAa,eAAe,mCAAmC,4BAA4B,4DAA4D,UAAU,YAAY,4BAA4B,oCAAoC,GAAG,KAAK,KAAK,YAAY,6BAA6B,oBAAoB,6CAA6C,kGAAkG,eAAe,SAAS,MAA+uD;AACtlU,kC;;;;;;UCDA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WC5BA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA,E;;;;;WCPA,wF;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D,E;;;;;;;;;;;;;;;;;;ACNwB;AACO;AACW","sources":["webpack://@react-hive/honey-css/./src/create-css-token-cursor.ts","webpack://@react-hive/honey-css/./src/tokenize-css.ts","webpack://@react-hive/honey-css/./src/types.ts","webpack://@react-hive/honey-css/./node_modules/.pnpm/@react-hive+honey-utils@3.23.0/node_modules/@react-hive/honey-utils/dist/index.mjs","webpack://@react-hive/honey-css/webpack/bootstrap","webpack://@react-hive/honey-css/webpack/runtime/define property getters","webpack://@react-hive/honey-css/webpack/runtime/hasOwnProperty shorthand","webpack://@react-hive/honey-css/webpack/runtime/make namespace object","webpack://@react-hive/honey-css/./src/index.ts"],"sourcesContent":["import { assert } from '@react-hive/honey-utils';\n\nimport type { HoneyCssToken, HoneyCssTokenType } from './types';\n\n/**\n * A lightweight cursor abstraction over a token stream.\n *\n * This is the core navigation primitive used by the Honey CSS parser.\n * It provides safe sequential reading, lookahead, backtracking,\n * and small helper utilities for collecting selector/value text.\n */\nexport interface HoneyTokenCursor {\n /**\n * Returns `true` when the cursor has consumed all tokens.\n */\n isEof: () => boolean;\n /**\n * Returns the current token without consuming it.\n *\n * This is primarily used for lookahead decisions in the parser:\n *\n * ```ts\n * if (cursor.peek()?.type === 'braceOpen') {\n * // parse rule block\n * }\n * ```\n */\n peek: () => HoneyCssToken | undefined;\n /**\n * Consumes and returns the current token, advancing the cursor forward.\n *\n * Returns `undefined` if the cursor is already at EOF.\n *\n * ```ts\n * const token = cursor.next();\n * ```\n */\n next: () => HoneyCssToken | undefined;\n /**\n * Creates a checkpoint of the current cursor position.\n *\n * Useful for speculative parsing or backtracking:\n *\n * ```ts\n * const mark = cursor.mark();\n *\n * if (!tryParseSomething(cursor)) {\n * cursor.reset(mark);\n * }\n * ```\n */\n mark: () => number;\n /**\n * Restores the cursor back to a previously created mark.\n *\n * @param mark - Index returned from {@link mark}.\n */\n reset: (mark: number) => void;\n /**\n * Consumes the next token and asserts that it matches the expected type.\n *\n * This is the parser's main safety mechanism and helps produce\n * clear error messages during invalid input.\n *\n * Throws if:\n * - the token stream ends unexpectedly\n * - the next token has a different type\n *\n * ```ts\n * cursor.expect('braceOpen'); // must be \"{\"\n * ```\n *\n * @param type - Expected token type.\n *\n * @returns The consumed token, narrowed to the expected type.\n */\n expect: <T extends HoneyCssTokenType>(type: T) => Extract<HoneyCssToken, { type: T }>;\n /**\n * Reads and concatenates consecutive token values until one of the stop token\n * types is encountered.\n *\n * This helper is used to collect:\n * - selectors (`.btn:hover`)\n * - declaration values (`calc(100% - 1px)`)\n * - at-rule names (`media`)\n *\n * Stops **before consuming** the stop token.\n *\n * Supported token types:\n * - `text` → appended as-is\n * - `string` → wrapped in quotes\n * - `params` → appended verbatim including parentheses\n *\n * Example:\n *\n * Tokens:\n * ```\n * text(\"var\")\n * params(\"(--color)\")\n * ```\n *\n * Result:\n * ```\n * \"var(--color)\"\n * ```\n *\n * @param stopTypes - Token types that terminate reading.\n *\n * @returns Combined string value.\n */\n readUntil: (stopTypes: HoneyCssTokenType[]) => string;\n /**\n * Advances the cursor until one of the stop token types is reached.\n *\n * This is useful for error recovery and safely skipping unknown syntax.\n *\n * Stops before consuming the stop token.\n *\n * @param stopTypes - Token types that terminate skipping.\n */\n skipUntil: (stopTypes: HoneyCssTokenType[]) => void;\n}\n\n/**\n * Creates a cursor wrapper around a list of CSS tokens.\n *\n * The cursor provides a small API surface for building\n * recursive-descent parsers without needing complex parser generators.\n *\n * @param tokens - Token list produced by the Honey tokenizer.\n *\n * @returns A reusable cursor instance.\n */\nexport const createCssTokenCursor = (tokens: HoneyCssToken[]): HoneyTokenCursor => {\n let index = 0;\n\n const isEof = (): boolean => index >= tokens.length;\n\n const peek = (): HoneyCssToken | undefined => (isEof() ? undefined : tokens[index]);\n\n const next = (): HoneyCssToken | undefined => (isEof() ? undefined : tokens[index++]);\n\n const mark = (): number => index;\n\n const reset = (mark: number): void => {\n index = mark;\n };\n\n const expect = <T extends HoneyCssTokenType>(type: T): Extract<HoneyCssToken, { type: T }> => {\n const token = next();\n\n assert(token, `[@react-hive/honey-css]: Expected \"${type}\" but reached end of input.`);\n assert(\n token.type === type,\n `[@react-hive/honey-css]: Expected \"${type}\" but got \"${token.type}\".`,\n );\n\n return token as Extract<HoneyCssToken, { type: T }>;\n };\n\n const readUntil = (stopTypes: HoneyCssTokenType[]): string => {\n let result = '';\n\n while (!isEof()) {\n const token = peek();\n\n if (!token || stopTypes.includes(token.type)) {\n break;\n }\n\n if (token.type === 'text') {\n if (result) {\n result += ' ';\n }\n\n result += token.value;\n //\n } else if (token.type === 'string') {\n result += `\"${token.value}\"`;\n //\n } else if (token.type === 'params') {\n result += token.value;\n }\n\n next();\n }\n\n return result.trim();\n };\n\n const skipUntil = (stopTypes: HoneyCssTokenType[]): void => {\n while (!isEof()) {\n const token = peek();\n\n if (!token || stopTypes.includes(token.type)) {\n break;\n }\n\n next();\n }\n };\n\n return {\n isEof,\n peek,\n next,\n mark,\n reset,\n expect,\n readUntil,\n skipUntil,\n };\n};\n","import type { HoneyCssToken } from './types';\n\n/**\n * Determines whether a character should terminate a plain text read.\n *\n * These characters represent structural boundaries in CSS:\n * - Blocks: `{` `}`\n * - Declarations: `:` `;`\n * - At-rules: `@`\n * - Params: `(`\n * - Strings: `'` `\"`\n * - Comments: `/`\n */\nconst isBoundaryChar = (ch: string): boolean =>\n ch === '{' ||\n ch === '}' ||\n ch === ':' ||\n ch === ';' ||\n ch === '@' ||\n ch === '(' ||\n ch === '\"' ||\n ch === \"'\" ||\n ch === '/';\n\n/**\n * Tokenizes a CSS-like input string into a sequence of Honey CSS tokens.\n *\n * This function is the first stage of the Honey CSS compilation pipeline.\n * It performs a single-pass lexical scan and produces a flat stream of tokens\n * that can later be consumed by the recursive-descent parser.\n *\n * Unlike a strict CSS tokenizer, this implementation is intentional:\n *\n * - Lightweight (no external dependencies)\n * - Tolerant (fails safely on malformed input)\n * - Extended for CSS-in-JS use cases\n *\n * In addition to standard CSS constructs, it supports:\n *\n * - Custom at-rules (`@honey-media`, `@honey-stack`, etc.)\n * - Nested selectors (`&:hover`, `& > .child`)\n * - CSS variables (`--color: red`)\n * - JavaScript-style single-line comments (`// comment`)\n * - Multiline block comments (`/* comment *\\/`)\n * - Nested parentheses groups (`calc(...)`, `var(...)`)\n * - Escaped characters inside strings\n *\n * The tokenizer:\n *\n * - Skips all whitespace\n * - Skips both block (`/* *\\/`) and single-line (`//`) comments\n * - Preserves balanced parentheses as a single `params` token\n * - Preserves quoted strings as `string` tokens (without quotes)\n * - Emits structural tokens (`braceOpen`, `braceClose`, `colon`, `semicolon`, `at`)\n * - Emits all other text as trimmed `text` tokens\n *\n * Safety guarantees:\n *\n * - Unterminated comments do not crash tokenization\n * - Unterminated strings do not throw\n * - Infinite loops are prevented by fallback index advancement\n *\n * The returned token stream is order-preserving and does not perform\n * semantic validation. Structural correctness is handled by the parser stage.\n *\n * @param input - Raw CSS string to tokenize.\n *\n * @returns Ordered array of {@link HoneyCssToken} objects.\n */\nexport const tokenizeCss = (input: string): HoneyCssToken[] => {\n const tokens: HoneyCssToken[] = [];\n\n let index = 0;\n\n const isEof = (): boolean => index >= input.length;\n\n /**\n * Returns the current character without consuming it.\n */\n const peek = (): string | undefined => (isEof() ? undefined : input[index]);\n\n /**\n * Returns the next character without consuming it.\n */\n const peekNext = (): string | undefined =>\n index + 1 >= input.length ? undefined : input[index + 1];\n\n /**\n * Advances the cursor past any whitespace characters.\n */\n const skipWhitespace = () => {\n while (true) {\n const ch = peek();\n\n if (!ch || !/\\s/.test(ch)) {\n return;\n }\n\n index++;\n }\n };\n\n /**\n * Skips JavaScript-style single-line comments of the form:\n *\n * ```css\n * // comment text\n * ```\n *\n * This syntax is not part of standard CSS,\n * but is commonly used in CSS-in-JS template literals.\n *\n * The comment is skipped until a newline character (`\\n`)\n * or the end of input is reached.\n *\n * If the comment is unterminated (EOF without newline),\n * tokenization safely stops at the end of the input.\n *\n * @returns `true` if a single-line comment was detected and skipped,\n * otherwise `false`.\n */\n const skipSingleLineComment = (): boolean => {\n if (peek() !== '/' || peekNext() !== '/') {\n return false;\n }\n\n index += 2; // skip \"//\"\n\n while (!isEof()) {\n const ch = peek();\n\n if (ch === '\\n') {\n index++; // consume newline\n break;\n }\n\n index++;\n }\n\n return true;\n };\n\n /**\n * Skips CSS block comments of the form:\n *\n * ```css\n * /* comment *\\/\n * ```\n *\n * If the comment is unterminated, tokenization stops safely.\n *\n * @returns `true` if a comment was skipped.\n */\n const skipMultiLineComment = (): boolean => {\n if (peek() !== '/' || peekNext() !== '*') {\n return false;\n }\n\n index += 2; // skip \"/*\"\n\n while (!isEof()) {\n if (peek() === '*' && peekNext() === '/') {\n index += 2; // skip \"*/\"\n\n return true;\n }\n\n index++;\n }\n\n return true;\n };\n\n /**\n * Reads a quoted string token.\n *\n * Supports:\n * - Double quotes: `\"text\"`\n * - Single quotes: `'text'`\n * - Escaped characters: `\"a\\\\\\\"b\"`\n *\n * @returns The unwrapped string contents.\n */\n const readString = (): string => {\n const quote = peek();\n if (!quote) {\n return '';\n }\n\n index++; // skip opening quote\n let result = '';\n\n while (!isEof()) {\n const ch = peek();\n if (!ch) {\n break;\n }\n\n // Handle escape sequences\n if (ch === '\\\\') {\n result += ch;\n index++;\n\n const escaped = peek();\n if (escaped) {\n result += escaped;\n index++;\n }\n\n continue;\n }\n\n // Closing quote\n if (ch === quote) {\n index++;\n break;\n }\n\n result += ch;\n index++;\n }\n\n return result;\n };\n\n /**\n * Reads a balanced parentheses group.\n *\n * Examples:\n * - `(sm:down)`\n * - `(min-width: calc(100% - 1px))`\n *\n * Nested parentheses are supported.\n *\n * @returns The full params string including parentheses.\n */\n const readParamsGroup = (): string => {\n let depth = 0;\n let result = '';\n\n while (!isEof()) {\n const ch = peek();\n if (!ch) {\n break;\n }\n\n if (ch === '(') {\n depth++;\n }\n\n if (ch === ')') {\n depth--;\n }\n\n result += ch;\n index++;\n\n if (depth === 0) {\n break;\n }\n }\n\n return result;\n };\n\n /**\n * Reads a contiguous plain-text segment until a structural boundary\n * character is encountered.\n *\n * This function is responsible for collecting free-form CSS text such as:\n *\n * - Selectors (`.btn`, `&:hover`, `.parent > .child`)\n * - Property names (`color`, `border-bottom-width`)\n * - Values (`red`, `12px`, `100%`, `red!important`)\n *\n * Reading stops when a boundary character is reached.\n * Boundary characters represent structural syntax in CSS and include:\n *\n * - Block delimiters: `{` `}`\n * - Declaration delimiters: `:` `;`\n * - At-rule marker: `@`\n * - Parentheses start: `(`\n * - String delimiters: `'` `\"`\n * - Comment initiator: `/`\n *\n * The boundary character itself is NOT consumed here —\n * it is handled separately by the main tokenizer loop.\n *\n * The returned value is trimmed to remove leading/trailing whitespace,\n * ensuring clean token values without altering internal spacing.\n *\n * Safety:\n * - Stops at EOF safely\n * - Never throws\n * - Prevents infinite loops via boundary checks\n *\n * @returns Trimmed text segment, or an empty string if no text was read.\n */\n const readText = (): string => {\n let result = '';\n\n while (!isEof()) {\n const ch = peek();\n if (!ch) {\n break;\n }\n\n if (isBoundaryChar(ch)) {\n break;\n }\n\n result += ch;\n index++;\n }\n\n return result.trim();\n };\n\n // ============================\n // Main Token Loop\n // ============================\n while (!isEof()) {\n skipWhitespace();\n\n if (isEof()) {\n break;\n }\n\n if (skipSingleLineComment() || skipMultiLineComment()) {\n continue;\n }\n\n const ch = peek();\n if (!ch) {\n break;\n }\n\n if (ch === '{') {\n tokens.push({\n type: 'braceOpen',\n });\n\n index++;\n continue;\n }\n\n if (ch === '}') {\n tokens.push({\n type: 'braceClose',\n });\n\n index++;\n continue;\n }\n\n if (ch === ':') {\n tokens.push({\n type: 'colon',\n });\n\n index++;\n continue;\n }\n\n if (ch === ';') {\n tokens.push({\n type: 'semicolon',\n });\n\n index++;\n continue;\n }\n\n if (ch === '@') {\n tokens.push({\n type: 'at',\n });\n\n index++;\n continue;\n }\n\n // Params group\n if (ch === '(') {\n tokens.push({\n type: 'params',\n value: readParamsGroup(),\n });\n\n continue;\n }\n\n // Strings\n if (ch === '\"' || ch === \"'\") {\n tokens.push({\n type: 'string',\n value: readString(),\n });\n\n continue;\n }\n\n // Text chunk\n const value = readText();\n if (value) {\n tokens.push({\n type: 'text',\n value,\n });\n } else {\n // Safety fallback to prevent infinite loops\n index++;\n }\n }\n\n return tokens;\n};\n","/**\n * All supported token types produced by the Honey CSS tokenizer.\n *\n * These tokens represent the minimal syntax units needed for parsing:\n * - Structural braces (`{` / `}`)\n * - Punctuation (`:` / `;`)\n * - At-rules (`@`)\n * - Parenthesized groups (`(...)`)\n * - Strings (`\"...\"`, `'...'`)\n * - Plain text chunks (selectors, property names, values)\n */\nexport type HoneyCssTokenType =\n | 'braceOpen'\n | 'braceClose'\n | 'colon'\n | 'semicolon'\n | 'at'\n | 'params'\n | 'string'\n | 'text';\n\n/**\n * A single token produced by {@link tokenizeCss}.\n *\n * Some token types (like `text`, `params`, `string`) include a `value`,\n * while punctuation tokens do not.\n */\nexport interface HoneyCssToken {\n type: HoneyCssTokenType;\n value?: string;\n}\n","const e=e=>new Blob([e],{type:e.type}),t=e=>new DOMRect(e.offsetLeft,e.offsetTop,e.clientWidth,e.clientHeight),n=e=>\"A\"===e.tagName,r=e=>\"true\"===e.getAttribute(\"contenteditable\"),a=[\"INPUT\",\"SELECT\",\"TEXTAREA\",\"BUTTON\",\"A\"],l=e=>{if(!e)return!1;const t=window.getComputedStyle(e);if(\"hidden\"===t.visibility||\"none\"===t.display)return!1;if(\"disabled\"in e&&e.disabled)return!1;const l=e.getAttribute(\"tabindex\");return\"-1\"!==l&&(a.includes(e.tagName)?!n(e)||\"\"!==e.href:!!r(e)||null!==l)},i=e=>Array.from(e.querySelectorAll(\"*\")).filter(l),o=(e,t=null,{wrap:n=!0,getNextIndex:r}={})=>{const a=document.activeElement,l=t??a?.parentElement;if(!a||!l)return;const o=i(l);if(0===o.length)return;const s=o.indexOf(a);if(-1===s)return;let c;r?c=r(s,e,o):\"next\"===e?(c=s+1,c>=o.length&&(c=n?0:null)):(c=s-1,c<0&&(c=n?o.length-1:null)),null!==c&&o[c]?.focus()};function s(e,t){if(!e)throw new Error(t)}const c=e=>null===e,u=e=>null==e,h=e=>null!=e,f=e=>void 0===e,d=e=>\"number\"==typeof e,m=e=>\"boolean\"==typeof e,p=e=>\"object\"==typeof e,g=e=>p(e)&&!c(e)&&0===Object.keys(e).length,y=e=>e instanceof Date,w=e=>e instanceof Blob,b=e=>e instanceof Error,x=e=>y(e)&&!isNaN(e.getTime()),M=e=>e instanceof RegExp,S=e=>e instanceof Map,A=e=>e instanceof Set,v=e=>\"symbol\"==typeof e,C=e=>d(e)&&isFinite(e),I=e=>d(e)&&Number.isInteger(e),k=e=>C(e)&&!Number.isInteger(e),E=e=>Array.isArray(e),L=e=>E(e)&&0===e.length,P=e=>e.filter(Boolean),O=e=>[...new Set(e)],T=(e,t)=>(s(t>0,\"Chunk size must be greater than 0\"),Array.from({length:Math.ceil(e.length/t)},(n,r)=>e.slice(r*t,(r+1)*t))),X=(...e)=>{if(0===e.length)return[];if(1===e.length)return[...e[0]];const[t,...n]=e;return O(t).filter(e=>n.every(t=>t.includes(e)))},_=(e,t)=>e.filter(e=>!t.includes(e)),z=(...e)=>t=>e.reduce((e,t)=>t(e),t),Y=(...e)=>t=>e.reduceRight((e,t)=>t(e),t),R=()=>{},N=e=>\"function\"==typeof e,$=e=>(...t)=>!e(...t),F=e=>{let t,n=!1;return function(...r){return n||(n=!0,t=e.apply(this,r)),t}},j=e=>N(e?.then),U=async(e,t)=>{const n=[];for(let r=0;r<e.length;r++)n.push(await t(e[r],r,e));return n},W=async(e,t)=>Promise.all(e.map(t)),H=async(e,t)=>{const n=[];for(let r=0;r<e.length;r++){const a=e[r];await t(a,r,e)&&n.push(a)}return n},B=async(e,t)=>{const n=await W(e,async(e,n,r)=>!!await t(e,n,r)&&e);return P(n)},D=async(e,t)=>{for(let n=0;n<e.length;n++)if(await t(e[n],n,e))return!0;return!1},V=async(e,t)=>{for(let n=0;n<e.length;n++)if(!await t(e[n],n,e))return!1;return!0},Z=async(e,t,n)=>{let r=n;for(let n=0;n<e.length;n++)r=await t(r,e[n],n,e);return r},G=async(e,t)=>{for(let n=0;n<e.length;n++)if(await t(e[n],n,e))return e[n];return null},q=e=>new Promise(t=>setTimeout(t,e)),J=async(e,t,n=\"Operation timed out\")=>{try{return await Promise.race([e,q(t).then(()=>Promise.reject(new Error(n)))])}finally{}},K=(e,{maxAttempts:t=3,delayMs:n=300,backoff:r=!0,onRetry:a}={})=>async(...l)=>{let i;for(let o=1;o<=t;o++)try{return await e(...l)}catch(e){if(i=e,o<t){a?.(o,e);const t=r?n*2**(o-1):n;await q(t)}}throw i},Q=e=>\"string\"==typeof e,ee=(e,{fileName:t,target:n}={})=>{if(f(document))return;const r=document.createElement(\"a\");let a=null;try{const l=Q(e)?e:a=URL.createObjectURL(e);r.href=l,t&&(r.download=t),n&&(r.target=n),document.body.appendChild(r),r.click()}finally{r.remove(),a&&setTimeout(()=>{s(a,\"Object URL should not be null\"),URL.revokeObjectURL(a)},0)}},te=e=>e.scrollWidth>e.clientWidth,ne=e=>Math.max(0,e.scrollWidth-e.clientWidth),re=e=>e.scrollHeight>e.clientHeight,ae=e=>Math.max(0,e.scrollHeight-e.clientHeight),le=({overflowSize:e,containerSize:t,elementOffset:n,elementSize:r})=>{if(e<=0)return 0;const a=n+r/2-t/2;return-Math.max(0,Math.min(a,e))},ie=(e,t,{axis:n=\"both\"}={})=>{let r=0,a=0;\"x\"!==n&&\"both\"!==n||(r=le({overflowSize:ne(e),containerSize:e.clientWidth,elementOffset:t.offsetLeft,elementSize:t.clientWidth})),\"y\"!==n&&\"both\"!==n||(a=le({overflowSize:ae(e),containerSize:e.clientHeight,elementOffset:t.offsetTop,elementSize:t.clientHeight})),e.style.transform=`translate(${r}px, ${a}px)`},oe=e=>{const t=window.getComputedStyle(e).getPropertyValue(\"transform\").match(/^matrix\\((.+)\\)$/);if(!t)return{translateX:0,translateY:0,scaleX:1,scaleY:1,skewX:0,skewY:0};const[n,r,a,l,i,o]=t[1].split(\", \").map(parseFloat);return{translateX:i,translateY:o,scaleX:n,scaleY:l,skewX:a,skewY:r}},se=()=>{if(\"undefined\"==typeof window||!window.localStorage)return!1;try{return window.localStorage.getItem(\"__non_existing_key__\"),!0}catch{return!1}},ce=()=>{if(!se())return{readable:!1,writable:!1};try{const e=\"__test_write__\";return window.localStorage.setItem(e,\"1\"),window.localStorage.removeItem(e),{readable:!0,writable:!0}}catch{}return{readable:!0,writable:!1}},ue=e=>e instanceof File,he=e=>{if(!e)return[];const t=[];for(let n=0;n<e.length;n++)t.push(e[n]);return t},fe=(e,t)=>new File([e],t,{type:e.type}),de=async(e,{skipFiles:t=[\".DS_Store\",\"Thumbs.db\",\"desktop.ini\",\"ehthumbs.db\",\".Spotlight-V100\",\".Trashes\",\".fseventsd\",\"__MACOSX\"]}={})=>{const n=new Set(t),r=await(async e=>{const t=e.createReader(),n=async()=>new Promise((e,r)=>{t.readEntries(async t=>{if(t.length)try{const r=await n();e([...t,...r])}catch(e){r(e)}else e([])},r)});return n()})(e);return(await W(r,async e=>e.isDirectory?de(e,{skipFiles:t}):n.has(e.name)?[]:[await new Promise((t,n)=>{e.file(t,n)})])).flat()},me=async(e,t={})=>{const n=e?.items;if(!n)return[];const r=[];for(let e=0;e<n.length;e++){const a=n[e];if(\"webkitGetAsEntry\"in a){const e=a.webkitGetAsEntry?.();if(e?.isDirectory){r.push(de(e,t));continue}if(e?.isFile){r.push(new Promise((t,n)=>e.file(e=>t([e]),n)));continue}}const l=a.getAsFile();l&&r.push(Promise.resolve([l]))}return(await Promise.all(r)).flat()},pe=(e,...t)=>\"function\"==typeof e?e(...t):e,ge=({delta:e,value:t,min:n,max:r})=>{if(0===e)return null;const a=t+e;return e<0?t<=n?null:Math.max(a,n):e>0?t>=r?null:Math.min(a,r):null},ye=({value:e,min:t,max:n,velocityPxMs:r,deltaTimeMs:a,friction:l=.002,minVelocityPxMs:i=.01,emaAlpha:o=.2})=>{if(Math.abs(r)<i)return null;const s=ge({delta:r*a,value:e,min:t,max:n});if(null===s)return null;const c=r*Math.exp(-l*a),u=o>0?r*(1-o)+c*o:c;return Math.abs(u)<i?null:{value:s,velocityPxMs:u}},we=()=>`${Math.floor(1e3*performance.now()).toString(36)}${Math.random().toString(36).slice(2,10)}`,be=(e,t)=>Math.max(0,Math.min(e.right,t.right)-Math.max(e.left,t.left))*Math.max(0,Math.min(e.bottom,t.bottom)-Math.max(e.top,t.top))/(t.width*t.height),xe=(e,t,{allowFallback:n=!0,invert:r=!0}={})=>{const a=r?-1:1;switch(t){case\"x\":return{deltaX:a*(0!==e.deltaX?e.deltaX:n?e.deltaY:0),deltaY:0};case\"y\":return{deltaX:0,deltaY:a*e.deltaY};default:return{deltaX:a*e.deltaX,deltaY:a*e.deltaY}}},Me=(e,t,n,r)=>{const a=n-e,l=r-t;return Math.hypot(a,l)},Se=(e,t)=>Math.abs(e/t),Ae=(e,t)=>e*t/100,ve=e=>{let t=5381;for(let n=0;n<e.length;n++)t=33*t^e.charCodeAt(n);return(t>>>0).toString(36)},Ce=e=>Object.entries(e).reduce((e,[t,n])=>(void 0!==n&&(e[t]=n),e),{}),Ie=e=>e.replace(/([a-z0-9])([A-Z])/g,\"$1-$2\").toLowerCase(),ke=e=>{const t=e.charAt(0),n=e.slice(1);return t.toLowerCase()+n.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)},Ee=e=>e.replace(/([a-z0-9])([A-Z])/g,\"$1 $2\"),Le=e=>0===e.length?[]:e.split(\" \").filter(Boolean),Pe=e=>\"\"===e||u(e),Oe=e=>{const t=e.lastIndexOf(\".\");return t<=0||t===e.length-1?[e,\"\"]:[e.slice(0,t),e.slice(t+1).toLowerCase()]},Te=(e,t)=>{if(0===e.length)return[];const n=t.charCodeAt(0),r=[];for(let t=0;t<e.length;t++)e.charCodeAt(t)===n&&r.push(t);return r},Xe=(e,t,n)=>{if(0===e.length)return;const r=e.length;for(let a=0;a<r;a++){const l=e[a],i={charIndex:a,prevChar:a>0?e[a-1]:null,nextChar:a<r-1?e[a+1]:null};n?.(l,i)||t(l,i)}},_e=(e,t=1/0)=>0===e.length?\"\":Le(e).slice(0,t).map(e=>e[0]).join(\"\").toUpperCase(),ze=(e,t,n,r=[],a=void 0,l=0)=>(e?.forEach(e=>{const{[n]:i,...o}=e,s=e[n],c=Array.isArray(s);if(r.push({...o,parentId:a,depthLevel:l,childCount:c?s.length:0}),c){const a=e[t];ze(s,t,n,r,a,l+1)}}),r),Ye=(e,t,n)=>e.filter(e=>e.parentId===t&&(!n||n(e))),Re=(e,t,n,r)=>{const a=Le(r.toLowerCase());if(!a.length)return e;const l=e.reduce((e,n,r)=>(e[n[t]]=r,e),{});return e.reduce((r,i)=>{const o=i[n];if(!o)return r;if(r.some(e=>e[t]===i[t]))return r;const u=Le(o.toLowerCase());if(a.every(e=>u.some(t=>t.startsWith(e))))if(f(i.parentId)){r.push(i);const n=a=>{a.childCount&&e.forEach(e=>{e.parentId===a[t]&&(r.push(e),n(e))})};n(i)}else{const t=n=>{const a=l[n.parentId],i=e[a];f(i.parentId)||t(i);const o=r.length?r[r.length-1].parentId:null;(c(o)||o!==n.parentId)&&(s(i,\"[@react-hive/honey-utils]: Parent node was not found.\"),r.push(i))};t(i),r.push(i)}return r},[])};export{a as FOCUSABLE_HTML_TAGS,ye as applyInertiaStep,s as assert,fe as blobToFile,le as calculateCenterOffset,Me as calculateEuclideanDistance,Se as calculateMovingSpeed,Ae as calculatePercentage,ke as camelToDashCase,Ee as camelToWords,ie as centerElementInContainer,T as chunk,e as cloneBlob,P as compact,Y as compose,Ce as definedProps,q as delay,_ as difference,ee as downloadFile,V as everyAsync,he as fileListToFiles,B as filterParallel,H as filterSequential,G as findAsync,Te as findCharIndices,ze as flattenTree,Xe as forEachChar,we as generateEphemeralId,be as getDOMRectIntersectionRatio,t as getElementOffsetRect,i as getFocusableHtmlElements,ce as getLocalStorageCapabilities,Ye as getTreeChildren,_e as getWordsInitials,ne as getXOverflowWidth,ae as getYOverflowHeight,te as hasXOverflow,re as hasYOverflow,ve as hashString,X as intersection,pe as invokeIfFunction,n as isAnchorHtmlElement,E as isArray,w as isBlob,m as isBool,r as isContentEditableHtmlElement,y as isDate,k as isDecimal,h as isDefined,L as isEmptyArray,g as isEmptyObject,b as isError,ue as isFile,C as isFiniteNumber,N as isFunction,l as isHtmlElementFocusable,I as isInteger,se as isLocalStorageReadable,S as isMap,u as isNil,Pe as isNilOrEmptyString,c as isNull,d as isNumber,p as isObject,j as isPromise,M as isRegExp,A as isSet,Q as isString,v as isSymbol,f as isUndefined,x as isValidDate,o as moveFocusWithinContainer,R as noop,$ as not,F as once,oe as parse2DMatrix,Oe as parseFileName,z as pipe,me as readFilesFromDataTransfer,Z as reduceAsync,xe as resolveAxisDelta,ge as resolveBoundedDelta,K as retry,W as runParallel,U as runSequential,Re as searchTree,D as someAsync,Le as splitStringIntoWords,J as timeout,Ie as toKebabCase,de as traverseFileSystemDirectory,O as unique};\n//# sourceMappingURL=index.mjs.map","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Check if module exists (development only)\n\tif (__webpack_modules__[moduleId] === undefined) {\n\t\tvar e = new Error(\"Cannot find module '\" + moduleId + \"'\");\n\t\te.code = 'MODULE_NOT_FOUND';\n\t\tthrow e;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export * from './types';\nexport * from './tokenize-css';\nexport * from './create-css-token-cursor';\n"],"names":[],"sourceRoot":""}
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- const e=e=>"{"===e||"}"===e||":"===e||";"===e||"@"===e||"("===e||'"'===e||"'"===e||"/"===e,t=t=>{const n=[];let r=0;const i=()=>r>=t.length,o=()=>i()?void 0:t[r],s=()=>r+1>=t.length?void 0:t[r+1],u=()=>{for(;;){const e=o();if(!e||!/\s/.test(e))return;r++}},c=()=>{if("/"!==o()||"*"!==s())return!1;for(r+=2;!i();){if("*"===o()&&"/"===s())return r+=2,!0;r++}return!0},f=()=>{const e=o();if(!e)return"";r++;let t="";for(;!i();){const n=o();if(!n)break;if("\\"===n){t+=n,r++;const e=o();e&&(t+=e,r++);continue}if(n===e){r++;break}t+=n,r++}return t},p=()=>{let e=0,t="";for(;!i();){const n=o();if(!n)break;if("("===n&&e++,")"===n&&e--,t+=n,r++,0===e)break}return t},a=()=>{let t="";for(;!i();){const n=o();if(!n)break;if(e(n))break;t+=n,r++}return t.trim()};for(;!i()&&(u(),!i());){if(c())continue;const e=o();if(!e)break;if("{"===e){n.push({type:"braceOpen"}),r++;continue}if("}"===e){n.push({type:"braceClose"}),r++;continue}if(":"===e){n.push({type:"colon"}),r++;continue}if(";"===e){n.push({type:"semicolon"}),r++;continue}if("@"===e){n.push({type:"at"}),r++;continue}if("("===e){n.push({type:"params",value:p()});continue}if('"'===e||"'"===e){n.push({type:"string",value:f()});continue}const t=a();t?n.push({type:"text",value:t}):r++}return n};function n(e,t){if(!e)throw new Error(t)}const r=e=>{let t=0;const r=()=>t>=e.length,i=()=>r()?void 0:e[t],o=()=>r()?void 0:e[t++];return{isEof:r,peek:i,next:o,mark:()=>t,reset:e=>{t=e},expect:e=>{const t=o();return n(t,`[@react-hive/honey-css]: Expected "${e}" but reached end of input.`),n(t.type===e,`[@react-hive/honey-css]: Expected "${e}" but got "${t.type}".`),t},readUntil:e=>{let t="";for(;!r();){const n=i();if(!n||e.includes(n.type))break;"text"===n.type?(t&&(t+=" "),t+=n.value):"string"===n.type?t+=`"${n.value}"`:"params"===n.type&&(t+=n.value),o()}return t.trim()},skipUntil:e=>{for(;!r();){const t=i();if(!t||e.includes(t.type))break;o()}}}};export{r as createCssTokenCursor,t as tokenizeCss};
1
+ const e=e=>"{"===e||"}"===e||":"===e||";"===e||"@"===e||"("===e||'"'===e||"'"===e||"/"===e,t=t=>{const n=[];let r=0;const i=()=>r>=t.length,o=()=>i()?void 0:t[r],u=()=>r+1>=t.length?void 0:t[r+1],s=()=>{for(;;){const e=o();if(!e||!/\s/.test(e))return;r++}},c=()=>{if("/"!==o()||"/"!==u())return!1;for(r+=2;!i();){if("\n"===o()){r++;break}r++}return!0},f=()=>{if("/"!==o()||"*"!==u())return!1;for(r+=2;!i();){if("*"===o()&&"/"===u())return r+=2,!0;r++}return!0},p=()=>{const e=o();if(!e)return"";r++;let t="";for(;!i();){const n=o();if(!n)break;if("\\"===n){t+=n,r++;const e=o();e&&(t+=e,r++);continue}if(n===e){r++;break}t+=n,r++}return t},a=()=>{let e=0,t="";for(;!i();){const n=o();if(!n)break;if("("===n&&e++,")"===n&&e--,t+=n,r++,0===e)break}return t},l=()=>{let t="";for(;!i();){const n=o();if(!n)break;if(e(n))break;t+=n,r++}return t.trim()};for(;!i()&&(s(),!i());){if(c()||f())continue;const e=o();if(!e)break;if("{"===e){n.push({type:"braceOpen"}),r++;continue}if("}"===e){n.push({type:"braceClose"}),r++;continue}if(":"===e){n.push({type:"colon"}),r++;continue}if(";"===e){n.push({type:"semicolon"}),r++;continue}if("@"===e){n.push({type:"at"}),r++;continue}if("("===e){n.push({type:"params",value:a()});continue}if('"'===e||"'"===e){n.push({type:"string",value:p()});continue}const t=l();t?n.push({type:"text",value:t}):r++}return n};function n(e,t){if(!e)throw new Error(t)}const r=e=>{let t=0;const r=()=>t>=e.length,i=()=>r()?void 0:e[t],o=()=>r()?void 0:e[t++];return{isEof:r,peek:i,next:o,mark:()=>t,reset:e=>{t=e},expect:e=>{const t=o();return n(t,`[@react-hive/honey-css]: Expected "${e}" but reached end of input.`),n(t.type===e,`[@react-hive/honey-css]: Expected "${e}" but got "${t.type}".`),t},readUntil:e=>{let t="";for(;!r();){const n=i();if(!n||e.includes(n.type))break;"text"===n.type?(t&&(t+=" "),t+=n.value):"string"===n.type?t+=`"${n.value}"`:"params"===n.type&&(t+=n.value),o()}return t.trim()},skipUntil:e=>{for(;!r();){const t=i();if(!t||e.includes(t.type))break;o()}}}};export{r as createCssTokenCursor,t as tokenizeCss};
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","mappings":"AAaA,MAAMA,EAAkBC,GACf,MAAPA,GACO,MAAPA,GACO,MAAPA,GACO,MAAPA,GACO,MAAPA,GACO,MAAPA,GACO,MAAPA,GACO,MAAPA,GACO,MAAPA,EAwBWC,EAAeC,IAC1B,MAAMC,EAA0B,GAEhC,IAAIC,EAAQ,EAEZ,MAAMC,EAAQ,IAAeD,GAASF,EAAMI,OAKtCC,EAAO,IAA2BF,SAAUG,EAAYN,EAAME,GAK9DK,EAAW,IACfL,EAAQ,GAAKF,EAAMI,YAASE,EAAYN,EAAME,EAAQ,GAKlDM,EAAiB,KACrB,OAAa,CACX,MAAMV,EAAKO,IAEX,IAAKP,IAAO,KAAKW,KAAKX,GACpB,OAGFI,GACF,GAcIQ,EAAc,KAClB,GAAe,MAAXL,KAAiC,MAAfE,IACpB,OAAO,EAKT,IAFAL,GAAS,GAEDC,KAAS,CACf,GAAe,MAAXE,KAAiC,MAAfE,IAGpB,OAFAL,GAAS,GAEF,EAGTA,GACF,CAEA,OAAO,GAaHS,EAAa,KACjB,MAAMC,EAAQP,IACd,IAAKO,EACH,MAAO,GAGTV,IACA,IAAIW,EAAS,GAEb,MAAQV,KAAS,CACf,MAAML,EAAKO,IACX,IAAKP,EACH,MAIF,GAAW,OAAPA,EAAa,CACfe,GAAUf,EACVI,IAEA,MAAMY,EAAUT,IACZS,IACFD,GAAUC,EACVZ,KAGF,QACF,CAGA,GAAIJ,IAAOc,EAAO,CAChBV,IACA,KACF,CAEAW,GAAUf,EACVI,GACF,CAEA,OAAOW,GAcHE,EAAkB,KACtB,IAAIC,EAAQ,EACRH,EAAS,GAEb,MAAQV,KAAS,CAC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CF,SAAUG,EAAYL,EAAOC,GAEtEyB,EAAO,IAAkCxB,SAAUG,EAAYL,EAAOC,KA8D5E,MAAO,CACLC,QACAE,OACAsB,OACAC,KAhEW,IAAc1B,EAiEzB2B,MA/DaD,IACb1B,EAAQ0B,GA+DRE,OA5D2CV,IAC3C,MAAMW,EAAQJ,IAQd,OANA,EAAOI,EAAO,sCAAsCX,gCACpD,EACEW,EAAMX,OAASA,EACf,sCAAsCA,eAAkBW,EAAMX,UAGzDW,GAoDPC,UAjDiBC,IACjB,IAAIpB,EAAS,GAEb,MAAQV,KAAS,CACf,MAAM4B,EAAQ1B,IAEd,IAAK0B,GAASE,EAAUC,SAASH,EAAMX,MACrC,MAGiB,SAAfW,EAAMX,MACJP,IACFA,GAAU,KAGZA,GAAUkB,EAAMV,OAEQ,WAAfU,EAAMX,KACfP,GAAU,IAAIkB,EAAMV,SAEI,WAAfU,EAAMX,OACfP,GAAUkB,EAAMV,OAGlBM,GACF,CAEA,OAAOd,EAAOK,QAuBdiB,UApBiBF,IACjB,MAAQ9B,KAAS,CACf,MAAM4B,EAAQ1B,IAEd,IAAK0B,GAASE,EAAUC,SAASH,EAAMX,MACrC,MAGFO,GACF,Y","sources":["webpack://@react-hive/honey-css/./src/tokenize-css.ts","webpack://@react-hive/honey-css/./node_modules/.pnpm/@react-hive+honey-utils@3.23.0/node_modules/@react-hive/honey-utils/dist/index.mjs","webpack://@react-hive/honey-css/./src/create-css-token-cursor.ts"],"sourcesContent":["import type { HoneyCssToken } from '~/types';\n\n/**\n * Determines whether a character should terminate a plain text read.\n *\n * These characters represent structural boundaries in CSS:\n * - Blocks: `{` `}`\n * - Declarations: `:` `;`\n * - At-rules: `@`\n * - Params: `(`\n * - Strings: `'` `\"`\n * - Comments: `/`\n */\nconst isBoundaryChar = (ch: string): boolean =>\n ch === '{' ||\n ch === '}' ||\n ch === ':' ||\n ch === ';' ||\n ch === '@' ||\n ch === '(' ||\n ch === '\"' ||\n ch === \"'\" ||\n ch === '/';\n\n/**\n * Tokenizes a CSS-like input string into a sequence of Honey CSS tokens.\n *\n * This tokenizer is intentionally lightweight and designed for parsing\n * Honey-specific CSS extensions such as:\n *\n * - Custom at-rules: `@honey-media (...) { ... }`\n * - Nested selectors: `&:hover { ... }`\n * - CSS variables: `--primary-color: red;`\n *\n * Supported syntax:\n * - Braces: `{` `}`\n * - Colons and semicolons: `:` `;`\n * - At-rule marker: `@`\n * - Parentheses groups: `(sm:down)`\n * - Quoted strings: `\"...\"`, `'...'`\n * - Block comments: `/* ... *\\/`\n *\n * @param input - Raw CSS string to tokenize.\n *\n * @returns An ordered array of tokens.\n */\nexport const tokenizeCss = (input: string): HoneyCssToken[] => {\n const tokens: HoneyCssToken[] = [];\n\n let index = 0;\n\n const isEof = (): boolean => index >= input.length;\n\n /**\n * Returns the current character without consuming it.\n */\n const peek = (): string | undefined => (isEof() ? undefined : input[index]);\n\n /**\n * Returns the next character without consuming it.\n */\n const peekNext = (): string | undefined =>\n index + 1 >= input.length ? undefined : input[index + 1];\n\n /**\n * Advances the cursor past any whitespace characters.\n */\n const skipWhitespace = () => {\n while (true) {\n const ch = peek();\n\n if (!ch || !/\\s/.test(ch)) {\n return;\n }\n\n index++;\n }\n };\n\n /**\n * Skips CSS block comments of the form:\n *\n * ```css\n * /* comment *\\/\n * ```\n *\n * If the comment is unterminated, tokenization stops safely.\n *\n * @returns `true` if a comment was skipped.\n */\n const skipComment = (): boolean => {\n if (peek() !== '/' || peekNext() !== '*') {\n return false;\n }\n\n index += 2; // skip \"/*\"\n\n while (!isEof()) {\n if (peek() === '*' && peekNext() === '/') {\n index += 2; // skip \"*/\"\n\n return true;\n }\n\n index++;\n }\n\n return true;\n };\n\n /**\n * Reads a quoted string token.\n *\n * Supports:\n * - Double quotes: `\"text\"`\n * - Single quotes: `'text'`\n * - Escaped characters: `\"a\\\\\\\"b\"`\n *\n * @returns The unwrapped string contents.\n */\n const readString = (): string => {\n const quote = peek();\n if (!quote) {\n return '';\n }\n\n index++; // skip opening quote\n let result = '';\n\n while (!isEof()) {\n const ch = peek();\n if (!ch) {\n break;\n }\n\n // Handle escape sequences\n if (ch === '\\\\') {\n result += ch;\n index++;\n\n const escaped = peek();\n if (escaped) {\n result += escaped;\n index++;\n }\n\n continue;\n }\n\n // Closing quote\n if (ch === quote) {\n index++;\n break;\n }\n\n result += ch;\n index++;\n }\n\n return result;\n };\n\n /**\n * Reads a balanced parentheses group.\n *\n * Examples:\n * - `(sm:down)`\n * - `(min-width: calc(100% - 1px))`\n *\n * Nested parentheses are supported.\n *\n * @returns The full params string including parentheses.\n */\n const readParamsGroup = (): string => {\n let depth = 0;\n let result = '';\n\n while (!isEof()) {\n const ch = peek();\n if (!ch) {\n break;\n }\n\n if (ch === '(') {\n depth++;\n }\n\n if (ch === ')') {\n depth--;\n }\n\n result += ch;\n index++;\n\n if (depth === 0) {\n break;\n }\n }\n\n return result;\n };\n\n /**\n * Reads plain text until a boundary character is reached.\n *\n * This is used for:\n * - Selectors (`.btn`, `&:hover`)\n * - Property names (`color`)\n * - Values (`red`, `12px`)\n *\n * @returns Trimmed text content.\n */\n const readText = (): string => {\n let result = '';\n\n while (!isEof()) {\n const ch = peek();\n if (!ch) {\n break;\n }\n\n if (isBoundaryChar(ch)) {\n break;\n }\n\n result += ch;\n index++;\n }\n\n return result.trim();\n };\n\n // ============================\n // Main Token Loop\n // ============================\n while (!isEof()) {\n skipWhitespace();\n\n if (isEof()) {\n break;\n }\n\n if (skipComment()) {\n continue;\n }\n\n const ch = peek();\n if (!ch) {\n break;\n }\n\n if (ch === '{') {\n tokens.push({\n type: 'braceOpen',\n });\n\n index++;\n continue;\n }\n\n if (ch === '}') {\n tokens.push({\n type: 'braceClose',\n });\n\n index++;\n continue;\n }\n\n if (ch === ':') {\n tokens.push({\n type: 'colon',\n });\n\n index++;\n continue;\n }\n\n if (ch === ';') {\n tokens.push({\n type: 'semicolon',\n });\n\n index++;\n continue;\n }\n\n if (ch === '@') {\n tokens.push({\n type: 'at',\n });\n\n index++;\n continue;\n }\n\n // Params group\n if (ch === '(') {\n tokens.push({\n type: 'params',\n value: readParamsGroup(),\n });\n\n continue;\n }\n\n // Strings\n if (ch === '\"' || ch === \"'\") {\n tokens.push({\n type: 'string',\n value: readString(),\n });\n\n continue;\n }\n\n // Text chunk\n const value = readText();\n if (value) {\n tokens.push({\n type: 'text',\n value,\n });\n } else {\n // Safety fallback to prevent infinite loops\n index++;\n }\n }\n\n return tokens;\n};\n","const e=e=>new Blob([e],{type:e.type}),t=e=>new DOMRect(e.offsetLeft,e.offsetTop,e.clientWidth,e.clientHeight),n=e=>\"A\"===e.tagName,r=e=>\"true\"===e.getAttribute(\"contenteditable\"),a=[\"INPUT\",\"SELECT\",\"TEXTAREA\",\"BUTTON\",\"A\"],l=e=>{if(!e)return!1;const t=window.getComputedStyle(e);if(\"hidden\"===t.visibility||\"none\"===t.display)return!1;if(\"disabled\"in e&&e.disabled)return!1;const l=e.getAttribute(\"tabindex\");return\"-1\"!==l&&(a.includes(e.tagName)?!n(e)||\"\"!==e.href:!!r(e)||null!==l)},i=e=>Array.from(e.querySelectorAll(\"*\")).filter(l),o=(e,t=null,{wrap:n=!0,getNextIndex:r}={})=>{const a=document.activeElement,l=t??a?.parentElement;if(!a||!l)return;const o=i(l);if(0===o.length)return;const s=o.indexOf(a);if(-1===s)return;let c;r?c=r(s,e,o):\"next\"===e?(c=s+1,c>=o.length&&(c=n?0:null)):(c=s-1,c<0&&(c=n?o.length-1:null)),null!==c&&o[c]?.focus()};function s(e,t){if(!e)throw new Error(t)}const c=e=>null===e,u=e=>null==e,h=e=>null!=e,f=e=>void 0===e,d=e=>\"number\"==typeof e,m=e=>\"boolean\"==typeof e,p=e=>\"object\"==typeof e,g=e=>p(e)&&!c(e)&&0===Object.keys(e).length,y=e=>e instanceof Date,w=e=>e instanceof Blob,b=e=>e instanceof Error,x=e=>y(e)&&!isNaN(e.getTime()),M=e=>e instanceof RegExp,S=e=>e instanceof Map,A=e=>e instanceof Set,v=e=>\"symbol\"==typeof e,C=e=>d(e)&&isFinite(e),I=e=>d(e)&&Number.isInteger(e),k=e=>C(e)&&!Number.isInteger(e),E=e=>Array.isArray(e),L=e=>E(e)&&0===e.length,P=e=>e.filter(Boolean),O=e=>[...new Set(e)],T=(e,t)=>(s(t>0,\"Chunk size must be greater than 0\"),Array.from({length:Math.ceil(e.length/t)},(n,r)=>e.slice(r*t,(r+1)*t))),X=(...e)=>{if(0===e.length)return[];if(1===e.length)return[...e[0]];const[t,...n]=e;return O(t).filter(e=>n.every(t=>t.includes(e)))},_=(e,t)=>e.filter(e=>!t.includes(e)),z=(...e)=>t=>e.reduce((e,t)=>t(e),t),Y=(...e)=>t=>e.reduceRight((e,t)=>t(e),t),R=()=>{},N=e=>\"function\"==typeof e,$=e=>(...t)=>!e(...t),F=e=>{let t,n=!1;return function(...r){return n||(n=!0,t=e.apply(this,r)),t}},j=e=>N(e?.then),U=async(e,t)=>{const n=[];for(let r=0;r<e.length;r++)n.push(await t(e[r],r,e));return n},W=async(e,t)=>Promise.all(e.map(t)),H=async(e,t)=>{const n=[];for(let r=0;r<e.length;r++){const a=e[r];await t(a,r,e)&&n.push(a)}return n},B=async(e,t)=>{const n=await W(e,async(e,n,r)=>!!await t(e,n,r)&&e);return P(n)},D=async(e,t)=>{for(let n=0;n<e.length;n++)if(await t(e[n],n,e))return!0;return!1},V=async(e,t)=>{for(let n=0;n<e.length;n++)if(!await t(e[n],n,e))return!1;return!0},Z=async(e,t,n)=>{let r=n;for(let n=0;n<e.length;n++)r=await t(r,e[n],n,e);return r},G=async(e,t)=>{for(let n=0;n<e.length;n++)if(await t(e[n],n,e))return e[n];return null},q=e=>new Promise(t=>setTimeout(t,e)),J=async(e,t,n=\"Operation timed out\")=>{try{return await Promise.race([e,q(t).then(()=>Promise.reject(new Error(n)))])}finally{}},K=(e,{maxAttempts:t=3,delayMs:n=300,backoff:r=!0,onRetry:a}={})=>async(...l)=>{let i;for(let o=1;o<=t;o++)try{return await e(...l)}catch(e){if(i=e,o<t){a?.(o,e);const t=r?n*2**(o-1):n;await q(t)}}throw i},Q=e=>\"string\"==typeof e,ee=(e,{fileName:t,target:n}={})=>{if(f(document))return;const r=document.createElement(\"a\");let a=null;try{const l=Q(e)?e:a=URL.createObjectURL(e);r.href=l,t&&(r.download=t),n&&(r.target=n),document.body.appendChild(r),r.click()}finally{r.remove(),a&&setTimeout(()=>{s(a,\"Object URL should not be null\"),URL.revokeObjectURL(a)},0)}},te=e=>e.scrollWidth>e.clientWidth,ne=e=>Math.max(0,e.scrollWidth-e.clientWidth),re=e=>e.scrollHeight>e.clientHeight,ae=e=>Math.max(0,e.scrollHeight-e.clientHeight),le=({overflowSize:e,containerSize:t,elementOffset:n,elementSize:r})=>{if(e<=0)return 0;const a=n+r/2-t/2;return-Math.max(0,Math.min(a,e))},ie=(e,t,{axis:n=\"both\"}={})=>{let r=0,a=0;\"x\"!==n&&\"both\"!==n||(r=le({overflowSize:ne(e),containerSize:e.clientWidth,elementOffset:t.offsetLeft,elementSize:t.clientWidth})),\"y\"!==n&&\"both\"!==n||(a=le({overflowSize:ae(e),containerSize:e.clientHeight,elementOffset:t.offsetTop,elementSize:t.clientHeight})),e.style.transform=`translate(${r}px, ${a}px)`},oe=e=>{const t=window.getComputedStyle(e).getPropertyValue(\"transform\").match(/^matrix\\((.+)\\)$/);if(!t)return{translateX:0,translateY:0,scaleX:1,scaleY:1,skewX:0,skewY:0};const[n,r,a,l,i,o]=t[1].split(\", \").map(parseFloat);return{translateX:i,translateY:o,scaleX:n,scaleY:l,skewX:a,skewY:r}},se=()=>{if(\"undefined\"==typeof window||!window.localStorage)return!1;try{return window.localStorage.getItem(\"__non_existing_key__\"),!0}catch{return!1}},ce=()=>{if(!se())return{readable:!1,writable:!1};try{const e=\"__test_write__\";return window.localStorage.setItem(e,\"1\"),window.localStorage.removeItem(e),{readable:!0,writable:!0}}catch{}return{readable:!0,writable:!1}},ue=e=>e instanceof File,he=e=>{if(!e)return[];const t=[];for(let n=0;n<e.length;n++)t.push(e[n]);return t},fe=(e,t)=>new File([e],t,{type:e.type}),de=async(e,{skipFiles:t=[\".DS_Store\",\"Thumbs.db\",\"desktop.ini\",\"ehthumbs.db\",\".Spotlight-V100\",\".Trashes\",\".fseventsd\",\"__MACOSX\"]}={})=>{const n=new Set(t),r=await(async e=>{const t=e.createReader(),n=async()=>new Promise((e,r)=>{t.readEntries(async t=>{if(t.length)try{const r=await n();e([...t,...r])}catch(e){r(e)}else e([])},r)});return n()})(e);return(await W(r,async e=>e.isDirectory?de(e,{skipFiles:t}):n.has(e.name)?[]:[await new Promise((t,n)=>{e.file(t,n)})])).flat()},me=async(e,t={})=>{const n=e?.items;if(!n)return[];const r=[];for(let e=0;e<n.length;e++){const a=n[e];if(\"webkitGetAsEntry\"in a){const e=a.webkitGetAsEntry?.();if(e?.isDirectory){r.push(de(e,t));continue}if(e?.isFile){r.push(new Promise((t,n)=>e.file(e=>t([e]),n)));continue}}const l=a.getAsFile();l&&r.push(Promise.resolve([l]))}return(await Promise.all(r)).flat()},pe=(e,...t)=>\"function\"==typeof e?e(...t):e,ge=({delta:e,value:t,min:n,max:r})=>{if(0===e)return null;const a=t+e;return e<0?t<=n?null:Math.max(a,n):e>0?t>=r?null:Math.min(a,r):null},ye=({value:e,min:t,max:n,velocityPxMs:r,deltaTimeMs:a,friction:l=.002,minVelocityPxMs:i=.01,emaAlpha:o=.2})=>{if(Math.abs(r)<i)return null;const s=ge({delta:r*a,value:e,min:t,max:n});if(null===s)return null;const c=r*Math.exp(-l*a),u=o>0?r*(1-o)+c*o:c;return Math.abs(u)<i?null:{value:s,velocityPxMs:u}},we=()=>`${Math.floor(1e3*performance.now()).toString(36)}${Math.random().toString(36).slice(2,10)}`,be=(e,t)=>Math.max(0,Math.min(e.right,t.right)-Math.max(e.left,t.left))*Math.max(0,Math.min(e.bottom,t.bottom)-Math.max(e.top,t.top))/(t.width*t.height),xe=(e,t,{allowFallback:n=!0,invert:r=!0}={})=>{const a=r?-1:1;switch(t){case\"x\":return{deltaX:a*(0!==e.deltaX?e.deltaX:n?e.deltaY:0),deltaY:0};case\"y\":return{deltaX:0,deltaY:a*e.deltaY};default:return{deltaX:a*e.deltaX,deltaY:a*e.deltaY}}},Me=(e,t,n,r)=>{const a=n-e,l=r-t;return Math.hypot(a,l)},Se=(e,t)=>Math.abs(e/t),Ae=(e,t)=>e*t/100,ve=e=>{let t=5381;for(let n=0;n<e.length;n++)t=33*t^e.charCodeAt(n);return(t>>>0).toString(36)},Ce=e=>Object.entries(e).reduce((e,[t,n])=>(void 0!==n&&(e[t]=n),e),{}),Ie=e=>e.replace(/([a-z0-9])([A-Z])/g,\"$1-$2\").toLowerCase(),ke=e=>{const t=e.charAt(0),n=e.slice(1);return t.toLowerCase()+n.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)},Ee=e=>e.replace(/([a-z0-9])([A-Z])/g,\"$1 $2\"),Le=e=>0===e.length?[]:e.split(\" \").filter(Boolean),Pe=e=>\"\"===e||u(e),Oe=e=>{const t=e.lastIndexOf(\".\");return t<=0||t===e.length-1?[e,\"\"]:[e.slice(0,t),e.slice(t+1).toLowerCase()]},Te=(e,t)=>{if(0===e.length)return[];const n=t.charCodeAt(0),r=[];for(let t=0;t<e.length;t++)e.charCodeAt(t)===n&&r.push(t);return r},Xe=(e,t,n)=>{if(0===e.length)return;const r=e.length;for(let a=0;a<r;a++){const l=e[a],i={charIndex:a,prevChar:a>0?e[a-1]:null,nextChar:a<r-1?e[a+1]:null};n?.(l,i)||t(l,i)}},_e=(e,t=1/0)=>0===e.length?\"\":Le(e).slice(0,t).map(e=>e[0]).join(\"\").toUpperCase(),ze=(e,t,n,r=[],a=void 0,l=0)=>(e?.forEach(e=>{const{[n]:i,...o}=e,s=e[n],c=Array.isArray(s);if(r.push({...o,parentId:a,depthLevel:l,childCount:c?s.length:0}),c){const a=e[t];ze(s,t,n,r,a,l+1)}}),r),Ye=(e,t,n)=>e.filter(e=>e.parentId===t&&(!n||n(e))),Re=(e,t,n,r)=>{const a=Le(r.toLowerCase());if(!a.length)return e;const l=e.reduce((e,n,r)=>(e[n[t]]=r,e),{});return e.reduce((r,i)=>{const o=i[n];if(!o)return r;if(r.some(e=>e[t]===i[t]))return r;const u=Le(o.toLowerCase());if(a.every(e=>u.some(t=>t.startsWith(e))))if(f(i.parentId)){r.push(i);const n=a=>{a.childCount&&e.forEach(e=>{e.parentId===a[t]&&(r.push(e),n(e))})};n(i)}else{const t=n=>{const a=l[n.parentId],i=e[a];f(i.parentId)||t(i);const o=r.length?r[r.length-1].parentId:null;(c(o)||o!==n.parentId)&&(s(i,\"[@react-hive/honey-utils]: Parent node was not found.\"),r.push(i))};t(i),r.push(i)}return r},[])};export{a as FOCUSABLE_HTML_TAGS,ye as applyInertiaStep,s as assert,fe as blobToFile,le as calculateCenterOffset,Me as calculateEuclideanDistance,Se as calculateMovingSpeed,Ae as calculatePercentage,ke as camelToDashCase,Ee as camelToWords,ie as centerElementInContainer,T as chunk,e as cloneBlob,P as compact,Y as compose,Ce as definedProps,q as delay,_ as difference,ee as downloadFile,V as everyAsync,he as fileListToFiles,B as filterParallel,H as filterSequential,G as findAsync,Te as findCharIndices,ze as flattenTree,Xe as forEachChar,we as generateEphemeralId,be as getDOMRectIntersectionRatio,t as getElementOffsetRect,i as getFocusableHtmlElements,ce as getLocalStorageCapabilities,Ye as getTreeChildren,_e as getWordsInitials,ne as getXOverflowWidth,ae as getYOverflowHeight,te as hasXOverflow,re as hasYOverflow,ve as hashString,X as intersection,pe as invokeIfFunction,n as isAnchorHtmlElement,E as isArray,w as isBlob,m as isBool,r as isContentEditableHtmlElement,y as isDate,k as isDecimal,h as isDefined,L as isEmptyArray,g as isEmptyObject,b as isError,ue as isFile,C as isFiniteNumber,N as isFunction,l as isHtmlElementFocusable,I as isInteger,se as isLocalStorageReadable,S as isMap,u as isNil,Pe as isNilOrEmptyString,c as isNull,d as isNumber,p as isObject,j as isPromise,M as isRegExp,A as isSet,Q as isString,v as isSymbol,f as isUndefined,x as isValidDate,o as moveFocusWithinContainer,R as noop,$ as not,F as once,oe as parse2DMatrix,Oe as parseFileName,z as pipe,me as readFilesFromDataTransfer,Z as reduceAsync,xe as resolveAxisDelta,ge as resolveBoundedDelta,K as retry,W as runParallel,U as runSequential,Re as searchTree,D as someAsync,Le as splitStringIntoWords,J as timeout,Ie as toKebabCase,de as traverseFileSystemDirectory,O as unique};\n//# sourceMappingURL=index.mjs.map","import { assert } from '@react-hive/honey-utils';\n\nimport type { HoneyCssToken, HoneyCssTokenType } from '~/types';\n\n/**\n * A lightweight cursor abstraction over a token stream.\n *\n * This is the core navigation primitive used by the Honey CSS parser.\n * It provides safe sequential reading, lookahead, backtracking,\n * and small helper utilities for collecting selector/value text.\n */\nexport interface HoneyTokenCursor {\n /**\n * Returns `true` when the cursor has consumed all tokens.\n */\n isEof: () => boolean;\n /**\n * Returns the current token without consuming it.\n *\n * This is primarily used for lookahead decisions in the parser:\n *\n * ```ts\n * if (cursor.peek()?.type === 'braceOpen') {\n * // parse rule block\n * }\n * ```\n */\n peek: () => HoneyCssToken | undefined;\n /**\n * Consumes and returns the current token, advancing the cursor forward.\n *\n * Returns `undefined` if the cursor is already at EOF.\n *\n * ```ts\n * const token = cursor.next();\n * ```\n */\n next: () => HoneyCssToken | undefined;\n /**\n * Creates a checkpoint of the current cursor position.\n *\n * Useful for speculative parsing or backtracking:\n *\n * ```ts\n * const mark = cursor.mark();\n *\n * if (!tryParseSomething(cursor)) {\n * cursor.reset(mark);\n * }\n * ```\n */\n mark: () => number;\n /**\n * Restores the cursor back to a previously created mark.\n *\n * @param mark - Index returned from {@link mark}.\n */\n reset: (mark: number) => void;\n /**\n * Consumes the next token and asserts that it matches the expected type.\n *\n * This is the parser's main safety mechanism and helps produce\n * clear error messages during invalid input.\n *\n * Throws if:\n * - the token stream ends unexpectedly\n * - the next token has a different type\n *\n * ```ts\n * cursor.expect('braceOpen'); // must be \"{\"\n * ```\n *\n * @param type - Expected token type.\n *\n * @returns The consumed token, narrowed to the expected type.\n */\n expect: <T extends HoneyCssTokenType>(type: T) => Extract<HoneyCssToken, { type: T }>;\n /**\n * Reads and concatenates consecutive token values until one of the stop token\n * types is encountered.\n *\n * This helper is used to collect:\n * - selectors (`.btn:hover`)\n * - declaration values (`calc(100% - 1px)`)\n * - at-rule names (`media`)\n *\n * Stops **before consuming** the stop token.\n *\n * Supported token types:\n * - `text` → appended as-is\n * - `string` → wrapped in quotes\n * - `params` → appended verbatim including parentheses\n *\n * Example:\n *\n * Tokens:\n * ```\n * text(\"var\")\n * params(\"(--color)\")\n * ```\n *\n * Result:\n * ```\n * \"var(--color)\"\n * ```\n *\n * @param stopTypes - Token types that terminate reading.\n *\n * @returns Combined string value.\n */\n readUntil: (stopTypes: HoneyCssTokenType[]) => string;\n /**\n * Advances the cursor until one of the stop token types is reached.\n *\n * This is useful for error recovery and safely skipping unknown syntax.\n *\n * Stops before consuming the stop token.\n *\n * @param stopTypes - Token types that terminate skipping.\n */\n skipUntil: (stopTypes: HoneyCssTokenType[]) => void;\n}\n\n/**\n * Creates a cursor wrapper around a list of CSS tokens.\n *\n * The cursor provides a small API surface for building\n * recursive-descent parsers without needing complex parser generators.\n *\n * @param tokens - Token list produced by the Honey tokenizer.\n *\n * @returns A reusable cursor instance.\n */\nexport const createCssTokenCursor = (tokens: HoneyCssToken[]): HoneyTokenCursor => {\n let index = 0;\n\n const isEof = (): boolean => index >= tokens.length;\n\n const peek = (): HoneyCssToken | undefined => (isEof() ? undefined : tokens[index]);\n\n const next = (): HoneyCssToken | undefined => (isEof() ? undefined : tokens[index++]);\n\n const mark = (): number => index;\n\n const reset = (mark: number): void => {\n index = mark;\n };\n\n const expect = <T extends HoneyCssTokenType>(type: T): Extract<HoneyCssToken, { type: T }> => {\n const token = next();\n\n assert(token, `[@react-hive/honey-css]: Expected \"${type}\" but reached end of input.`);\n assert(\n token.type === type,\n `[@react-hive/honey-css]: Expected \"${type}\" but got \"${token.type}\".`,\n );\n\n return token as Extract<HoneyCssToken, { type: T }>;\n };\n\n const readUntil = (stopTypes: HoneyCssTokenType[]): string => {\n let result = '';\n\n while (!isEof()) {\n const token = peek();\n\n if (!token || stopTypes.includes(token.type)) {\n break;\n }\n\n if (token.type === 'text') {\n if (result) {\n result += ' ';\n }\n\n result += token.value;\n //\n } else if (token.type === 'string') {\n result += `\"${token.value}\"`;\n //\n } else if (token.type === 'params') {\n result += token.value;\n }\n\n next();\n }\n\n return result.trim();\n };\n\n const skipUntil = (stopTypes: HoneyCssTokenType[]): void => {\n while (!isEof()) {\n const token = peek();\n\n if (!token || stopTypes.includes(token.type)) {\n break;\n }\n\n next();\n }\n };\n\n return {\n isEof,\n peek,\n next,\n mark,\n reset,\n expect,\n readUntil,\n skipUntil,\n };\n};\n"],"names":["isBoundaryChar","ch","tokenizeCss","input","tokens","index","isEof","length","peek","undefined","peekNext","skipWhitespace","test","skipComment","readString","quote","result","escaped","readParamsGroup","depth","readText","trim","push","type","value","s","e","t","Error","createCssTokenCursor","next","mark","reset","expect","token","readUntil","stopTypes","includes","skipUntil"],"sourceRoot":""}
1
+ {"version":3,"file":"index.mjs","mappings":"AAaA,MAAMA,EAAkBC,GACf,MAAPA,GACO,MAAPA,GACO,MAAPA,GACO,MAAPA,GACO,MAAPA,GACO,MAAPA,GACO,MAAPA,GACO,MAAPA,GACO,MAAPA,EA+CWC,EAAeC,IAC1B,MAAMC,EAA0B,GAEhC,IAAIC,EAAQ,EAEZ,MAAMC,EAAQ,IAAeD,GAASF,EAAMI,OAKtCC,EAAO,IAA2BF,SAAUG,EAAYN,EAAME,GAK9DK,EAAW,IACfL,EAAQ,GAAKF,EAAMI,YAASE,EAAYN,EAAME,EAAQ,GAKlDM,EAAiB,KACrB,OAAa,CACX,MAAMV,EAAKO,IAEX,IAAKP,IAAO,KAAKW,KAAKX,GACpB,OAGFI,GACF,GAsBIQ,EAAwB,KAC5B,GAAe,MAAXL,KAAiC,MAAfE,IACpB,OAAO,EAKT,IAFAL,GAAS,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P,GAAUkB,EAAMV,OAGlBM,GACF,CAEA,OAAOd,EAAOK,QAuBdiB,UApBiBF,IACjB,MAAQ/B,KAAS,CACf,MAAM6B,EAAQ3B,IAEd,IAAK2B,GAASE,EAAUC,SAASH,EAAMX,MACrC,MAGFO,GACF,Y","sources":["webpack://@react-hive/honey-css/./src/tokenize-css.ts","webpack://@react-hive/honey-css/./node_modules/.pnpm/@react-hive+honey-utils@3.23.0/node_modules/@react-hive/honey-utils/dist/index.mjs","webpack://@react-hive/honey-css/./src/create-css-token-cursor.ts"],"sourcesContent":["import type { HoneyCssToken } from './types';\n\n/**\n * Determines whether a character should terminate a plain text read.\n *\n * These characters represent structural boundaries in CSS:\n * - Blocks: `{` `}`\n * - Declarations: `:` `;`\n * - At-rules: `@`\n * - Params: `(`\n * - Strings: `'` `\"`\n * - Comments: `/`\n */\nconst isBoundaryChar = (ch: string): boolean =>\n ch === '{' ||\n ch === '}' ||\n ch === ':' ||\n ch === ';' ||\n ch === '@' ||\n ch === '(' ||\n ch === '\"' ||\n ch === \"'\" ||\n ch === '/';\n\n/**\n * Tokenizes a CSS-like input string into a sequence of Honey CSS tokens.\n *\n * This function is the first stage of the Honey CSS compilation pipeline.\n * It performs a single-pass lexical scan and produces a flat stream of tokens\n * that can later be consumed by the recursive-descent parser.\n *\n * Unlike a strict CSS tokenizer, this implementation is intentional:\n *\n * - Lightweight (no external dependencies)\n * - Tolerant (fails safely on malformed input)\n * - Extended for CSS-in-JS use cases\n *\n * In addition to standard CSS constructs, it supports:\n *\n * - Custom at-rules (`@honey-media`, `@honey-stack`, etc.)\n * - Nested selectors (`&:hover`, `& > .child`)\n * - CSS variables (`--color: red`)\n * - JavaScript-style single-line comments (`// comment`)\n * - Multiline block comments (`/* comment *\\/`)\n * - Nested parentheses groups (`calc(...)`, `var(...)`)\n * - Escaped characters inside strings\n *\n * The tokenizer:\n *\n * - Skips all whitespace\n * - Skips both block (`/* *\\/`) and single-line (`//`) comments\n * - Preserves balanced parentheses as a single `params` token\n * - Preserves quoted strings as `string` tokens (without quotes)\n * - Emits structural tokens (`braceOpen`, `braceClose`, `colon`, `semicolon`, `at`)\n * - Emits all other text as trimmed `text` tokens\n *\n * Safety guarantees:\n *\n * - Unterminated comments do not crash tokenization\n * - Unterminated strings do not throw\n * - Infinite loops are prevented by fallback index advancement\n *\n * The returned token stream is order-preserving and does not perform\n * semantic validation. Structural correctness is handled by the parser stage.\n *\n * @param input - Raw CSS string to tokenize.\n *\n * @returns Ordered array of {@link HoneyCssToken} objects.\n */\nexport const tokenizeCss = (input: string): HoneyCssToken[] => {\n const tokens: HoneyCssToken[] = [];\n\n let index = 0;\n\n const isEof = (): boolean => index >= input.length;\n\n /**\n * Returns the current character without consuming it.\n */\n const peek = (): string | undefined => (isEof() ? undefined : input[index]);\n\n /**\n * Returns the next character without consuming it.\n */\n const peekNext = (): string | undefined =>\n index + 1 >= input.length ? undefined : input[index + 1];\n\n /**\n * Advances the cursor past any whitespace characters.\n */\n const skipWhitespace = () => {\n while (true) {\n const ch = peek();\n\n if (!ch || !/\\s/.test(ch)) {\n return;\n }\n\n index++;\n }\n };\n\n /**\n * Skips JavaScript-style single-line comments of the form:\n *\n * ```css\n * // comment text\n * ```\n *\n * This syntax is not part of standard CSS,\n * but is commonly used in CSS-in-JS template literals.\n *\n * The comment is skipped until a newline character (`\\n`)\n * or the end of input is reached.\n *\n * If the comment is unterminated (EOF without newline),\n * tokenization safely stops at the end of the input.\n *\n * @returns `true` if a single-line comment was detected and skipped,\n * otherwise `false`.\n */\n const skipSingleLineComment = (): boolean => {\n if (peek() !== '/' || peekNext() !== '/') {\n return false;\n }\n\n index += 2; // skip \"//\"\n\n while (!isEof()) {\n const ch = peek();\n\n if (ch === '\\n') {\n index++; // consume newline\n break;\n }\n\n index++;\n }\n\n return true;\n };\n\n /**\n * Skips CSS block comments of the form:\n *\n * ```css\n * /* comment *\\/\n * ```\n *\n * If the comment is unterminated, tokenization stops safely.\n *\n * @returns `true` if a comment was skipped.\n */\n const skipMultiLineComment = (): boolean => {\n if (peek() !== '/' || peekNext() !== '*') {\n return false;\n }\n\n index += 2; // skip \"/*\"\n\n while (!isEof()) {\n if (peek() === '*' && peekNext() === '/') {\n index += 2; // skip \"*/\"\n\n return true;\n }\n\n index++;\n }\n\n return true;\n };\n\n /**\n * Reads a quoted string token.\n *\n * Supports:\n * - Double quotes: `\"text\"`\n * - Single quotes: `'text'`\n * - Escaped characters: `\"a\\\\\\\"b\"`\n *\n * @returns The unwrapped string contents.\n */\n const readString = (): string => {\n const quote = peek();\n if (!quote) {\n return '';\n }\n\n index++; // skip opening quote\n let result = '';\n\n while (!isEof()) {\n const ch = peek();\n if (!ch) {\n break;\n }\n\n // Handle escape sequences\n if (ch === '\\\\') {\n result += ch;\n index++;\n\n const escaped = peek();\n if (escaped) {\n result += escaped;\n index++;\n }\n\n continue;\n }\n\n // Closing quote\n if (ch === quote) {\n index++;\n break;\n }\n\n result += ch;\n index++;\n }\n\n return result;\n };\n\n /**\n * Reads a balanced parentheses group.\n *\n * Examples:\n * - `(sm:down)`\n * - `(min-width: calc(100% - 1px))`\n *\n * Nested parentheses are supported.\n *\n * @returns The full params string including parentheses.\n */\n const readParamsGroup = (): string => {\n let depth = 0;\n let result = '';\n\n while (!isEof()) {\n const ch = peek();\n if (!ch) {\n break;\n }\n\n if (ch === '(') {\n depth++;\n }\n\n if (ch === ')') {\n depth--;\n }\n\n result += ch;\n index++;\n\n if (depth === 0) {\n break;\n }\n }\n\n return result;\n };\n\n /**\n * Reads a contiguous plain-text segment until a structural boundary\n * character is encountered.\n *\n * This function is responsible for collecting free-form CSS text such as:\n *\n * - Selectors (`.btn`, `&:hover`, `.parent > .child`)\n * - Property names (`color`, `border-bottom-width`)\n * - Values (`red`, `12px`, `100%`, `red!important`)\n *\n * Reading stops when a boundary character is reached.\n * Boundary characters represent structural syntax in CSS and include:\n *\n * - Block delimiters: `{` `}`\n * - Declaration delimiters: `:` `;`\n * - At-rule marker: `@`\n * - Parentheses start: `(`\n * - String delimiters: `'` `\"`\n * - Comment initiator: `/`\n *\n * The boundary character itself is NOT consumed here —\n * it is handled separately by the main tokenizer loop.\n *\n * The returned value is trimmed to remove leading/trailing whitespace,\n * ensuring clean token values without altering internal spacing.\n *\n * Safety:\n * - Stops at EOF safely\n * - Never throws\n * - Prevents infinite loops via boundary checks\n *\n * @returns Trimmed text segment, or an empty string if no text was read.\n */\n const readText = (): string => {\n let result = '';\n\n while (!isEof()) {\n const ch = peek();\n if (!ch) {\n break;\n }\n\n if (isBoundaryChar(ch)) {\n break;\n }\n\n result += ch;\n index++;\n }\n\n return result.trim();\n };\n\n // ============================\n // Main Token Loop\n // ============================\n while (!isEof()) {\n skipWhitespace();\n\n if (isEof()) {\n break;\n }\n\n if (skipSingleLineComment() || skipMultiLineComment()) {\n continue;\n }\n\n const ch = peek();\n if (!ch) {\n break;\n }\n\n if (ch === '{') {\n tokens.push({\n type: 'braceOpen',\n });\n\n index++;\n continue;\n }\n\n if (ch === '}') {\n tokens.push({\n type: 'braceClose',\n });\n\n index++;\n continue;\n }\n\n if (ch === ':') {\n tokens.push({\n type: 'colon',\n });\n\n index++;\n continue;\n }\n\n if (ch === ';') {\n tokens.push({\n type: 'semicolon',\n });\n\n index++;\n continue;\n }\n\n if (ch === '@') {\n tokens.push({\n type: 'at',\n });\n\n index++;\n continue;\n }\n\n // Params group\n if (ch === '(') {\n tokens.push({\n type: 'params',\n value: readParamsGroup(),\n });\n\n continue;\n }\n\n // Strings\n if (ch === '\"' || ch === \"'\") {\n tokens.push({\n type: 'string',\n value: readString(),\n });\n\n continue;\n }\n\n // Text chunk\n const value = readText();\n if (value) {\n tokens.push({\n type: 'text',\n value,\n });\n } else {\n // Safety fallback to prevent infinite loops\n index++;\n }\n }\n\n return tokens;\n};\n","const e=e=>new Blob([e],{type:e.type}),t=e=>new DOMRect(e.offsetLeft,e.offsetTop,e.clientWidth,e.clientHeight),n=e=>\"A\"===e.tagName,r=e=>\"true\"===e.getAttribute(\"contenteditable\"),a=[\"INPUT\",\"SELECT\",\"TEXTAREA\",\"BUTTON\",\"A\"],l=e=>{if(!e)return!1;const t=window.getComputedStyle(e);if(\"hidden\"===t.visibility||\"none\"===t.display)return!1;if(\"disabled\"in e&&e.disabled)return!1;const l=e.getAttribute(\"tabindex\");return\"-1\"!==l&&(a.includes(e.tagName)?!n(e)||\"\"!==e.href:!!r(e)||null!==l)},i=e=>Array.from(e.querySelectorAll(\"*\")).filter(l),o=(e,t=null,{wrap:n=!0,getNextIndex:r}={})=>{const a=document.activeElement,l=t??a?.parentElement;if(!a||!l)return;const o=i(l);if(0===o.length)return;const s=o.indexOf(a);if(-1===s)return;let c;r?c=r(s,e,o):\"next\"===e?(c=s+1,c>=o.length&&(c=n?0:null)):(c=s-1,c<0&&(c=n?o.length-1:null)),null!==c&&o[c]?.focus()};function s(e,t){if(!e)throw new Error(t)}const c=e=>null===e,u=e=>null==e,h=e=>null!=e,f=e=>void 0===e,d=e=>\"number\"==typeof e,m=e=>\"boolean\"==typeof e,p=e=>\"object\"==typeof e,g=e=>p(e)&&!c(e)&&0===Object.keys(e).length,y=e=>e instanceof Date,w=e=>e instanceof Blob,b=e=>e instanceof Error,x=e=>y(e)&&!isNaN(e.getTime()),M=e=>e instanceof RegExp,S=e=>e instanceof Map,A=e=>e instanceof Set,v=e=>\"symbol\"==typeof e,C=e=>d(e)&&isFinite(e),I=e=>d(e)&&Number.isInteger(e),k=e=>C(e)&&!Number.isInteger(e),E=e=>Array.isArray(e),L=e=>E(e)&&0===e.length,P=e=>e.filter(Boolean),O=e=>[...new Set(e)],T=(e,t)=>(s(t>0,\"Chunk size must be greater than 0\"),Array.from({length:Math.ceil(e.length/t)},(n,r)=>e.slice(r*t,(r+1)*t))),X=(...e)=>{if(0===e.length)return[];if(1===e.length)return[...e[0]];const[t,...n]=e;return O(t).filter(e=>n.every(t=>t.includes(e)))},_=(e,t)=>e.filter(e=>!t.includes(e)),z=(...e)=>t=>e.reduce((e,t)=>t(e),t),Y=(...e)=>t=>e.reduceRight((e,t)=>t(e),t),R=()=>{},N=e=>\"function\"==typeof e,$=e=>(...t)=>!e(...t),F=e=>{let t,n=!1;return function(...r){return n||(n=!0,t=e.apply(this,r)),t}},j=e=>N(e?.then),U=async(e,t)=>{const n=[];for(let r=0;r<e.length;r++)n.push(await t(e[r],r,e));return n},W=async(e,t)=>Promise.all(e.map(t)),H=async(e,t)=>{const n=[];for(let r=0;r<e.length;r++){const a=e[r];await t(a,r,e)&&n.push(a)}return n},B=async(e,t)=>{const n=await W(e,async(e,n,r)=>!!await t(e,n,r)&&e);return P(n)},D=async(e,t)=>{for(let n=0;n<e.length;n++)if(await t(e[n],n,e))return!0;return!1},V=async(e,t)=>{for(let n=0;n<e.length;n++)if(!await t(e[n],n,e))return!1;return!0},Z=async(e,t,n)=>{let r=n;for(let n=0;n<e.length;n++)r=await t(r,e[n],n,e);return r},G=async(e,t)=>{for(let n=0;n<e.length;n++)if(await t(e[n],n,e))return e[n];return null},q=e=>new Promise(t=>setTimeout(t,e)),J=async(e,t,n=\"Operation timed out\")=>{try{return await Promise.race([e,q(t).then(()=>Promise.reject(new Error(n)))])}finally{}},K=(e,{maxAttempts:t=3,delayMs:n=300,backoff:r=!0,onRetry:a}={})=>async(...l)=>{let i;for(let o=1;o<=t;o++)try{return await e(...l)}catch(e){if(i=e,o<t){a?.(o,e);const t=r?n*2**(o-1):n;await q(t)}}throw i},Q=e=>\"string\"==typeof e,ee=(e,{fileName:t,target:n}={})=>{if(f(document))return;const r=document.createElement(\"a\");let a=null;try{const l=Q(e)?e:a=URL.createObjectURL(e);r.href=l,t&&(r.download=t),n&&(r.target=n),document.body.appendChild(r),r.click()}finally{r.remove(),a&&setTimeout(()=>{s(a,\"Object URL should not be null\"),URL.revokeObjectURL(a)},0)}},te=e=>e.scrollWidth>e.clientWidth,ne=e=>Math.max(0,e.scrollWidth-e.clientWidth),re=e=>e.scrollHeight>e.clientHeight,ae=e=>Math.max(0,e.scrollHeight-e.clientHeight),le=({overflowSize:e,containerSize:t,elementOffset:n,elementSize:r})=>{if(e<=0)return 0;const a=n+r/2-t/2;return-Math.max(0,Math.min(a,e))},ie=(e,t,{axis:n=\"both\"}={})=>{let r=0,a=0;\"x\"!==n&&\"both\"!==n||(r=le({overflowSize:ne(e),containerSize:e.clientWidth,elementOffset:t.offsetLeft,elementSize:t.clientWidth})),\"y\"!==n&&\"both\"!==n||(a=le({overflowSize:ae(e),containerSize:e.clientHeight,elementOffset:t.offsetTop,elementSize:t.clientHeight})),e.style.transform=`translate(${r}px, ${a}px)`},oe=e=>{const t=window.getComputedStyle(e).getPropertyValue(\"transform\").match(/^matrix\\((.+)\\)$/);if(!t)return{translateX:0,translateY:0,scaleX:1,scaleY:1,skewX:0,skewY:0};const[n,r,a,l,i,o]=t[1].split(\", \").map(parseFloat);return{translateX:i,translateY:o,scaleX:n,scaleY:l,skewX:a,skewY:r}},se=()=>{if(\"undefined\"==typeof window||!window.localStorage)return!1;try{return window.localStorage.getItem(\"__non_existing_key__\"),!0}catch{return!1}},ce=()=>{if(!se())return{readable:!1,writable:!1};try{const e=\"__test_write__\";return window.localStorage.setItem(e,\"1\"),window.localStorage.removeItem(e),{readable:!0,writable:!0}}catch{}return{readable:!0,writable:!1}},ue=e=>e instanceof File,he=e=>{if(!e)return[];const t=[];for(let n=0;n<e.length;n++)t.push(e[n]);return t},fe=(e,t)=>new File([e],t,{type:e.type}),de=async(e,{skipFiles:t=[\".DS_Store\",\"Thumbs.db\",\"desktop.ini\",\"ehthumbs.db\",\".Spotlight-V100\",\".Trashes\",\".fseventsd\",\"__MACOSX\"]}={})=>{const n=new Set(t),r=await(async e=>{const t=e.createReader(),n=async()=>new Promise((e,r)=>{t.readEntries(async t=>{if(t.length)try{const r=await n();e([...t,...r])}catch(e){r(e)}else e([])},r)});return n()})(e);return(await W(r,async e=>e.isDirectory?de(e,{skipFiles:t}):n.has(e.name)?[]:[await new Promise((t,n)=>{e.file(t,n)})])).flat()},me=async(e,t={})=>{const n=e?.items;if(!n)return[];const r=[];for(let e=0;e<n.length;e++){const a=n[e];if(\"webkitGetAsEntry\"in a){const e=a.webkitGetAsEntry?.();if(e?.isDirectory){r.push(de(e,t));continue}if(e?.isFile){r.push(new Promise((t,n)=>e.file(e=>t([e]),n)));continue}}const l=a.getAsFile();l&&r.push(Promise.resolve([l]))}return(await Promise.all(r)).flat()},pe=(e,...t)=>\"function\"==typeof e?e(...t):e,ge=({delta:e,value:t,min:n,max:r})=>{if(0===e)return null;const a=t+e;return e<0?t<=n?null:Math.max(a,n):e>0?t>=r?null:Math.min(a,r):null},ye=({value:e,min:t,max:n,velocityPxMs:r,deltaTimeMs:a,friction:l=.002,minVelocityPxMs:i=.01,emaAlpha:o=.2})=>{if(Math.abs(r)<i)return null;const s=ge({delta:r*a,value:e,min:t,max:n});if(null===s)return null;const c=r*Math.exp(-l*a),u=o>0?r*(1-o)+c*o:c;return Math.abs(u)<i?null:{value:s,velocityPxMs:u}},we=()=>`${Math.floor(1e3*performance.now()).toString(36)}${Math.random().toString(36).slice(2,10)}`,be=(e,t)=>Math.max(0,Math.min(e.right,t.right)-Math.max(e.left,t.left))*Math.max(0,Math.min(e.bottom,t.bottom)-Math.max(e.top,t.top))/(t.width*t.height),xe=(e,t,{allowFallback:n=!0,invert:r=!0}={})=>{const a=r?-1:1;switch(t){case\"x\":return{deltaX:a*(0!==e.deltaX?e.deltaX:n?e.deltaY:0),deltaY:0};case\"y\":return{deltaX:0,deltaY:a*e.deltaY};default:return{deltaX:a*e.deltaX,deltaY:a*e.deltaY}}},Me=(e,t,n,r)=>{const a=n-e,l=r-t;return Math.hypot(a,l)},Se=(e,t)=>Math.abs(e/t),Ae=(e,t)=>e*t/100,ve=e=>{let t=5381;for(let n=0;n<e.length;n++)t=33*t^e.charCodeAt(n);return(t>>>0).toString(36)},Ce=e=>Object.entries(e).reduce((e,[t,n])=>(void 0!==n&&(e[t]=n),e),{}),Ie=e=>e.replace(/([a-z0-9])([A-Z])/g,\"$1-$2\").toLowerCase(),ke=e=>{const t=e.charAt(0),n=e.slice(1);return t.toLowerCase()+n.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)},Ee=e=>e.replace(/([a-z0-9])([A-Z])/g,\"$1 $2\"),Le=e=>0===e.length?[]:e.split(\" \").filter(Boolean),Pe=e=>\"\"===e||u(e),Oe=e=>{const t=e.lastIndexOf(\".\");return t<=0||t===e.length-1?[e,\"\"]:[e.slice(0,t),e.slice(t+1).toLowerCase()]},Te=(e,t)=>{if(0===e.length)return[];const n=t.charCodeAt(0),r=[];for(let t=0;t<e.length;t++)e.charCodeAt(t)===n&&r.push(t);return r},Xe=(e,t,n)=>{if(0===e.length)return;const r=e.length;for(let a=0;a<r;a++){const l=e[a],i={charIndex:a,prevChar:a>0?e[a-1]:null,nextChar:a<r-1?e[a+1]:null};n?.(l,i)||t(l,i)}},_e=(e,t=1/0)=>0===e.length?\"\":Le(e).slice(0,t).map(e=>e[0]).join(\"\").toUpperCase(),ze=(e,t,n,r=[],a=void 0,l=0)=>(e?.forEach(e=>{const{[n]:i,...o}=e,s=e[n],c=Array.isArray(s);if(r.push({...o,parentId:a,depthLevel:l,childCount:c?s.length:0}),c){const a=e[t];ze(s,t,n,r,a,l+1)}}),r),Ye=(e,t,n)=>e.filter(e=>e.parentId===t&&(!n||n(e))),Re=(e,t,n,r)=>{const a=Le(r.toLowerCase());if(!a.length)return e;const l=e.reduce((e,n,r)=>(e[n[t]]=r,e),{});return e.reduce((r,i)=>{const o=i[n];if(!o)return r;if(r.some(e=>e[t]===i[t]))return r;const u=Le(o.toLowerCase());if(a.every(e=>u.some(t=>t.startsWith(e))))if(f(i.parentId)){r.push(i);const n=a=>{a.childCount&&e.forEach(e=>{e.parentId===a[t]&&(r.push(e),n(e))})};n(i)}else{const t=n=>{const a=l[n.parentId],i=e[a];f(i.parentId)||t(i);const o=r.length?r[r.length-1].parentId:null;(c(o)||o!==n.parentId)&&(s(i,\"[@react-hive/honey-utils]: Parent node was not found.\"),r.push(i))};t(i),r.push(i)}return r},[])};export{a as FOCUSABLE_HTML_TAGS,ye as applyInertiaStep,s as assert,fe as blobToFile,le as calculateCenterOffset,Me as calculateEuclideanDistance,Se as calculateMovingSpeed,Ae as calculatePercentage,ke as camelToDashCase,Ee as camelToWords,ie as centerElementInContainer,T as chunk,e as cloneBlob,P as compact,Y as compose,Ce as definedProps,q as delay,_ as difference,ee as downloadFile,V as everyAsync,he as fileListToFiles,B as filterParallel,H as filterSequential,G as findAsync,Te as findCharIndices,ze as flattenTree,Xe as forEachChar,we as generateEphemeralId,be as getDOMRectIntersectionRatio,t as getElementOffsetRect,i as getFocusableHtmlElements,ce as getLocalStorageCapabilities,Ye as getTreeChildren,_e as getWordsInitials,ne as getXOverflowWidth,ae as getYOverflowHeight,te as hasXOverflow,re as hasYOverflow,ve as hashString,X as intersection,pe as invokeIfFunction,n as isAnchorHtmlElement,E as isArray,w as isBlob,m as isBool,r as isContentEditableHtmlElement,y as isDate,k as isDecimal,h as isDefined,L as isEmptyArray,g as isEmptyObject,b as isError,ue as isFile,C as isFiniteNumber,N as isFunction,l as isHtmlElementFocusable,I as isInteger,se as isLocalStorageReadable,S as isMap,u as isNil,Pe as isNilOrEmptyString,c as isNull,d as isNumber,p as isObject,j as isPromise,M as isRegExp,A as isSet,Q as isString,v as isSymbol,f as isUndefined,x as isValidDate,o as moveFocusWithinContainer,R as noop,$ as not,F as once,oe as parse2DMatrix,Oe as parseFileName,z as pipe,me as readFilesFromDataTransfer,Z as reduceAsync,xe as resolveAxisDelta,ge as resolveBoundedDelta,K as retry,W as runParallel,U as runSequential,Re as searchTree,D as someAsync,Le as splitStringIntoWords,J as timeout,Ie as toKebabCase,de as traverseFileSystemDirectory,O as unique};\n//# sourceMappingURL=index.mjs.map","import { assert } from '@react-hive/honey-utils';\n\nimport type { HoneyCssToken, HoneyCssTokenType } from './types';\n\n/**\n * A lightweight cursor abstraction over a token stream.\n *\n * This is the core navigation primitive used by the Honey CSS parser.\n * It provides safe sequential reading, lookahead, backtracking,\n * and small helper utilities for collecting selector/value text.\n */\nexport interface HoneyTokenCursor {\n /**\n * Returns `true` when the cursor has consumed all tokens.\n */\n isEof: () => boolean;\n /**\n * Returns the current token without consuming it.\n *\n * This is primarily used for lookahead decisions in the parser:\n *\n * ```ts\n * if (cursor.peek()?.type === 'braceOpen') {\n * // parse rule block\n * }\n * ```\n */\n peek: () => HoneyCssToken | undefined;\n /**\n * Consumes and returns the current token, advancing the cursor forward.\n *\n * Returns `undefined` if the cursor is already at EOF.\n *\n * ```ts\n * const token = cursor.next();\n * ```\n */\n next: () => HoneyCssToken | undefined;\n /**\n * Creates a checkpoint of the current cursor position.\n *\n * Useful for speculative parsing or backtracking:\n *\n * ```ts\n * const mark = cursor.mark();\n *\n * if (!tryParseSomething(cursor)) {\n * cursor.reset(mark);\n * }\n * ```\n */\n mark: () => number;\n /**\n * Restores the cursor back to a previously created mark.\n *\n * @param mark - Index returned from {@link mark}.\n */\n reset: (mark: number) => void;\n /**\n * Consumes the next token and asserts that it matches the expected type.\n *\n * This is the parser's main safety mechanism and helps produce\n * clear error messages during invalid input.\n *\n * Throws if:\n * - the token stream ends unexpectedly\n * - the next token has a different type\n *\n * ```ts\n * cursor.expect('braceOpen'); // must be \"{\"\n * ```\n *\n * @param type - Expected token type.\n *\n * @returns The consumed token, narrowed to the expected type.\n */\n expect: <T extends HoneyCssTokenType>(type: T) => Extract<HoneyCssToken, { type: T }>;\n /**\n * Reads and concatenates consecutive token values until one of the stop token\n * types is encountered.\n *\n * This helper is used to collect:\n * - selectors (`.btn:hover`)\n * - declaration values (`calc(100% - 1px)`)\n * - at-rule names (`media`)\n *\n * Stops **before consuming** the stop token.\n *\n * Supported token types:\n * - `text` → appended as-is\n * - `string` → wrapped in quotes\n * - `params` → appended verbatim including parentheses\n *\n * Example:\n *\n * Tokens:\n * ```\n * text(\"var\")\n * params(\"(--color)\")\n * ```\n *\n * Result:\n * ```\n * \"var(--color)\"\n * ```\n *\n * @param stopTypes - Token types that terminate reading.\n *\n * @returns Combined string value.\n */\n readUntil: (stopTypes: HoneyCssTokenType[]) => string;\n /**\n * Advances the cursor until one of the stop token types is reached.\n *\n * This is useful for error recovery and safely skipping unknown syntax.\n *\n * Stops before consuming the stop token.\n *\n * @param stopTypes - Token types that terminate skipping.\n */\n skipUntil: (stopTypes: HoneyCssTokenType[]) => void;\n}\n\n/**\n * Creates a cursor wrapper around a list of CSS tokens.\n *\n * The cursor provides a small API surface for building\n * recursive-descent parsers without needing complex parser generators.\n *\n * @param tokens - Token list produced by the Honey tokenizer.\n *\n * @returns A reusable cursor instance.\n */\nexport const createCssTokenCursor = (tokens: HoneyCssToken[]): HoneyTokenCursor => {\n let index = 0;\n\n const isEof = (): boolean => index >= tokens.length;\n\n const peek = (): HoneyCssToken | undefined => (isEof() ? undefined : tokens[index]);\n\n const next = (): HoneyCssToken | undefined => (isEof() ? undefined : tokens[index++]);\n\n const mark = (): number => index;\n\n const reset = (mark: number): void => {\n index = mark;\n };\n\n const expect = <T extends HoneyCssTokenType>(type: T): Extract<HoneyCssToken, { type: T }> => {\n const token = next();\n\n assert(token, `[@react-hive/honey-css]: Expected \"${type}\" but reached end of input.`);\n assert(\n token.type === type,\n `[@react-hive/honey-css]: Expected \"${type}\" but got \"${token.type}\".`,\n );\n\n return token as Extract<HoneyCssToken, { type: T }>;\n };\n\n const readUntil = (stopTypes: HoneyCssTokenType[]): string => {\n let result = '';\n\n while (!isEof()) {\n const token = peek();\n\n if (!token || stopTypes.includes(token.type)) {\n break;\n }\n\n if (token.type === 'text') {\n if (result) {\n result += ' ';\n }\n\n result += token.value;\n //\n } else if (token.type === 'string') {\n result += `\"${token.value}\"`;\n //\n } else if (token.type === 'params') {\n result += token.value;\n }\n\n next();\n }\n\n return result.trim();\n };\n\n const skipUntil = (stopTypes: HoneyCssTokenType[]): void => {\n while (!isEof()) {\n const token = peek();\n\n if (!token || stopTypes.includes(token.type)) {\n break;\n }\n\n next();\n }\n };\n\n return {\n isEof,\n peek,\n next,\n mark,\n reset,\n expect,\n readUntil,\n skipUntil,\n };\n};\n"],"names":["isBoundaryChar","ch","tokenizeCss","input","tokens","index","isEof","length","peek","undefined","peekNext","skipWhitespace","test","skipSingleLineComment","skipMultiLineComment","readString","quote","result","escaped","readParamsGroup","depth","readText","trim","push","type","value","s","e","t","Error","createCssTokenCursor","next","mark","reset","expect","token","readUntil","stopTypes","includes","skipUntil"],"sourceRoot":""}
@@ -1,24 +1,47 @@
1
- import type { HoneyCssToken } from '~/types';
1
+ import type { HoneyCssToken } from './types';
2
2
  /**
3
3
  * Tokenizes a CSS-like input string into a sequence of Honey CSS tokens.
4
4
  *
5
- * This tokenizer is intentionally lightweight and designed for parsing
6
- * Honey-specific CSS extensions such as:
5
+ * This function is the first stage of the Honey CSS compilation pipeline.
6
+ * It performs a single-pass lexical scan and produces a flat stream of tokens
7
+ * that can later be consumed by the recursive-descent parser.
7
8
  *
8
- * - Custom at-rules: `@honey-media (...) { ... }`
9
- * - Nested selectors: `&:hover { ... }`
10
- * - CSS variables: `--primary-color: red;`
9
+ * Unlike a strict CSS tokenizer, this implementation is intentional:
11
10
  *
12
- * Supported syntax:
13
- * - Braces: `{` `}`
14
- * - Colons and semicolons: `:` `;`
15
- * - At-rule marker: `@`
16
- * - Parentheses groups: `(sm:down)`
17
- * - Quoted strings: `"..."`, `'...'`
18
- * - Block comments: `/* ... *\/`
11
+ * - Lightweight (no external dependencies)
12
+ * - Tolerant (fails safely on malformed input)
13
+ * - Extended for CSS-in-JS use cases
14
+ *
15
+ * In addition to standard CSS constructs, it supports:
16
+ *
17
+ * - Custom at-rules (`@honey-media`, `@honey-stack`, etc.)
18
+ * - Nested selectors (`&:hover`, `& > .child`)
19
+ * - CSS variables (`--color: red`)
20
+ * - JavaScript-style single-line comments (`// comment`)
21
+ * - Multiline block comments (`/* comment *\/`)
22
+ * - Nested parentheses groups (`calc(...)`, `var(...)`)
23
+ * - Escaped characters inside strings
24
+ *
25
+ * The tokenizer:
26
+ *
27
+ * - Skips all whitespace
28
+ * - Skips both block (`/* *\/`) and single-line (`//`) comments
29
+ * - Preserves balanced parentheses as a single `params` token
30
+ * - Preserves quoted strings as `string` tokens (without quotes)
31
+ * - Emits structural tokens (`braceOpen`, `braceClose`, `colon`, `semicolon`, `at`)
32
+ * - Emits all other text as trimmed `text` tokens
33
+ *
34
+ * Safety guarantees:
35
+ *
36
+ * - Unterminated comments do not crash tokenization
37
+ * - Unterminated strings do not throw
38
+ * - Infinite loops are prevented by fallback index advancement
39
+ *
40
+ * The returned token stream is order-preserving and does not perform
41
+ * semantic validation. Structural correctness is handled by the parser stage.
19
42
  *
20
43
  * @param input - Raw CSS string to tokenize.
21
44
  *
22
- * @returns An ordered array of tokens.
45
+ * @returns Ordered array of {@link HoneyCssToken} objects.
23
46
  */
24
47
  export declare const tokenizeCss: (input: string) => HoneyCssToken[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-hive/honey-css",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "A lightweight CSS tokenizer and parser that produces a simple AST for custom CSS processing.",
5
5
  "keywords": [
6
6
  "css",