@react-hive/honey-css 1.5.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.dev.cjs +85 -0
- package/dist/index.dev.cjs.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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,
|
|
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:()=>s,readCssSelector:()=>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,s=()=>o()?void 0:e[n],i=()=>n+1>=e.length?void 0:e[n+1],c=()=>{for(;;){const e=s();if(!e||!/\s/.test(e))return;n++}},u=()=>{if("/"!==s()||"/"!==i())return!1;for(n+=2;!o();){if("\n"===s()){n++;break}n++}return!0},a=()=>{if("/"!==s()||"*"!==i())return!1;for(n+=2;!o();){if("*"===s()&&"/"===i())return n+=2,!0;n++}return!0},p=()=>{const e=s();if(!e)return"";n++;let t="";for(;!o();){const r=s();if(!r)break;if("\\"===r){t+=r,n++;const e=s();e&&(t+=e,n++);continue}if(r===e){n++;break}t+=r,n++}return t},f=()=>{let e=0,t="";for(;!o();){const r=s();if(!r)break;if("("===r&&e++,")"===r&&e--,t+=r,n++,0===e)break}return t},l=()=>{let e="";for(;!o();){const t=s();if(!t)break;if(r(t))break;e+=t,n++}return e.trim()};for(;!o()&&(c(),!o());){if(u()||a())continue;const e=s();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:f()});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 s=e=>{let t=0;const r=()=>t>=e.length,n=()=>r()?void 0:e[t],s=()=>r()?void 0:e[t++];return{isEof:r,peek:n,next:s,mark:()=>t,reset:e=>{t=e},expect:e=>{const t=s();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,o="";for(;!r();){const r=n();if(!r||e.includes(r.type))break;"text"===r.type?("text"===t&&o&&(o+=" "),o+=r.value):"string"===r.type?o+=`"${r.value}"`:"params"===r.type&&(o+=r.value),t=r.type,s()}return o.trim()},skipUntil:e=>{for(;!r();){const t=n();if(!t||e.includes(t.type))break;s()}}}},i=e=>{const t=[],r=()=>t.join("").trim();for(;!e.isEof();){const n=e.peek();if(!n)break;switch(n.type){case"braceOpen":case"braceClose":default:return r();case"colon":t.push(":");break;case"text":case"params":t.push(n.value);break;case"string":t.push(`"${n.value}"`)}e.next()}return r()};module.exports=t})();
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,C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fmC,EAAMV,OACfP,GAAUiB,EAAMnC,OAGlBsC,EAAWH,EAAMV,KACjBM,GACF,CAEA,OAAOb,EAAOK,QAuBdiB,UApBiBH,IACjB,MAAQ9B,KAAS,CACf,MAAM4B,EAAQ1B,IAEd,IAAK0B,GAASE,EAAUE,SAASJ,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 let prevType: HoneyCssTokenType | undefined;\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 // Only space-join consecutive text chunks\n if (prevType === 'text' && 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 prevType = token.type;\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","prevType","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,EAA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AAOmB,IAdT,IAAK,QACHD,EAAMnB,KAAK,KACX,MAEF,IAAK,OACL,IAAK,SACHmB,EAAMnB,KAAKW,EAAMnC,OACjB,MAEF,IAAK,SACH2C,EAAMnB,KAAK,IAAIW,EAAMnC,UAOzB0C,EAAOX,MACT,CAEA,OAAOa,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","webpack://@react-hive/honey-css/./src/read-css-selector.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 let prevType: HoneyCssTokenType | undefined;\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 // Only space-join consecutive text chunks\n if (prevType === 'text' && 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 prevType = token.type;\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 { HoneyTokenCursor } from './create-css-token-cursor';\n\n/**\n * Reads a CSS selector from the current token cursor position.\n *\n * The selector is reconstructed by sequentially consuming supported tokens\n * until one of the following conditions is met:\n *\n * - A `braceOpen` token (`{`) is encountered\n * - A `braceClose` token (`}`) is encountered (safety stop)\n * - An unsupported token type appears\n * - The end of the token stream is reached\n *\n * Supported token types:\n *\n * - `text` - raw selector fragments such as:\n * `.btn`, `#id`, `> .child`, `+ .item`, `&[data-open]`, `[data-id=\"x\"]`\n *\n * - `colon` - pseudo selectors and pseudo-elements:\n * `:hover`, `::before`\n *\n * - `params` - parenthesized groups used in pseudo functions or nth-expressions:\n * `(2n+1)`, `(:disabled)`\n *\n * - `string` - quoted string values (typically inside attribute selectors)\n *\n * Behavior:\n *\n * - Preserves pseudo selectors and pseudo-elements\n * - Preserves combinators (`>`, `+`, `~`)\n * - Preserves attribute selectors\n * - Preserves pseudo functions such as `:not(...)`\n * - Does **not** consume the `{` token\n *\n * This function performs no validation of selector correctness.\n * It only reconstructs the textual representation from the token stream.\n *\n * @param cursor - Token cursor positioned at the beginning of a selector.\n *\n * @returns The reconstructed selector string (trimmed).\n */\nexport const readCssSelector = (cursor: HoneyTokenCursor): string => {\n const parts: string[] = [];\n\n const finish = () => parts.join('').trim();\n\n while (!cursor.isEof()) {\n const token = cursor.peek();\n if (!token) {\n break;\n }\n\n switch (token.type) {\n case 'braceOpen':\n case 'braceClose':\n return finish();\n\n case 'colon':\n parts.push(':');\n break;\n\n case 'text':\n case 'params':\n parts.push(token.value);\n break;\n\n case 'string':\n parts.push(`\"${token.value}\"`);\n break;\n\n default:\n return finish();\n }\n\n cursor.next();\n }\n\n return finish();\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","prevType","includes","skipUntil","readCssSelector","cursor","parts","finish","join"],"sourceRoot":""}
|
package/dist/index.d.ts
CHANGED
package/dist/index.dev.cjs
CHANGED
|
@@ -89,6 +89,88 @@ const createCssTokenCursor = (tokens) => {
|
|
|
89
89
|
};
|
|
90
90
|
|
|
91
91
|
|
|
92
|
+
/***/ },
|
|
93
|
+
|
|
94
|
+
/***/ "./src/read-css-selector.ts"
|
|
95
|
+
/*!**********************************!*\
|
|
96
|
+
!*** ./src/read-css-selector.ts ***!
|
|
97
|
+
\**********************************/
|
|
98
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
99
|
+
|
|
100
|
+
__webpack_require__.r(__webpack_exports__);
|
|
101
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
102
|
+
/* harmony export */ readCssSelector: () => (/* binding */ readCssSelector)
|
|
103
|
+
/* harmony export */ });
|
|
104
|
+
/**
|
|
105
|
+
* Reads a CSS selector from the current token cursor position.
|
|
106
|
+
*
|
|
107
|
+
* The selector is reconstructed by sequentially consuming supported tokens
|
|
108
|
+
* until one of the following conditions is met:
|
|
109
|
+
*
|
|
110
|
+
* - A `braceOpen` token (`{`) is encountered
|
|
111
|
+
* - A `braceClose` token (`}`) is encountered (safety stop)
|
|
112
|
+
* - An unsupported token type appears
|
|
113
|
+
* - The end of the token stream is reached
|
|
114
|
+
*
|
|
115
|
+
* Supported token types:
|
|
116
|
+
*
|
|
117
|
+
* - `text` - raw selector fragments such as:
|
|
118
|
+
* `.btn`, `#id`, `> .child`, `+ .item`, `&[data-open]`, `[data-id="x"]`
|
|
119
|
+
*
|
|
120
|
+
* - `colon` - pseudo selectors and pseudo-elements:
|
|
121
|
+
* `:hover`, `::before`
|
|
122
|
+
*
|
|
123
|
+
* - `params` - parenthesized groups used in pseudo functions or nth-expressions:
|
|
124
|
+
* `(2n+1)`, `(:disabled)`
|
|
125
|
+
*
|
|
126
|
+
* - `string` - quoted string values (typically inside attribute selectors)
|
|
127
|
+
*
|
|
128
|
+
* Behavior:
|
|
129
|
+
*
|
|
130
|
+
* - Preserves pseudo selectors and pseudo-elements
|
|
131
|
+
* - Preserves combinators (`>`, `+`, `~`)
|
|
132
|
+
* - Preserves attribute selectors
|
|
133
|
+
* - Preserves pseudo functions such as `:not(...)`
|
|
134
|
+
* - Does **not** consume the `{` token
|
|
135
|
+
*
|
|
136
|
+
* This function performs no validation of selector correctness.
|
|
137
|
+
* It only reconstructs the textual representation from the token stream.
|
|
138
|
+
*
|
|
139
|
+
* @param cursor - Token cursor positioned at the beginning of a selector.
|
|
140
|
+
*
|
|
141
|
+
* @returns The reconstructed selector string (trimmed).
|
|
142
|
+
*/
|
|
143
|
+
const readCssSelector = (cursor) => {
|
|
144
|
+
const parts = [];
|
|
145
|
+
const finish = () => parts.join('').trim();
|
|
146
|
+
while (!cursor.isEof()) {
|
|
147
|
+
const token = cursor.peek();
|
|
148
|
+
if (!token) {
|
|
149
|
+
break;
|
|
150
|
+
}
|
|
151
|
+
switch (token.type) {
|
|
152
|
+
case 'braceOpen':
|
|
153
|
+
case 'braceClose':
|
|
154
|
+
return finish();
|
|
155
|
+
case 'colon':
|
|
156
|
+
parts.push(':');
|
|
157
|
+
break;
|
|
158
|
+
case 'text':
|
|
159
|
+
case 'params':
|
|
160
|
+
parts.push(token.value);
|
|
161
|
+
break;
|
|
162
|
+
case 'string':
|
|
163
|
+
parts.push(`"${token.value}"`);
|
|
164
|
+
break;
|
|
165
|
+
default:
|
|
166
|
+
return finish();
|
|
167
|
+
}
|
|
168
|
+
cursor.next();
|
|
169
|
+
}
|
|
170
|
+
return finish();
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
|
|
92
174
|
/***/ },
|
|
93
175
|
|
|
94
176
|
/***/ "./src/tokenize-css.ts"
|
|
@@ -647,11 +729,14 @@ var __webpack_exports__ = {};
|
|
|
647
729
|
__webpack_require__.r(__webpack_exports__);
|
|
648
730
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
649
731
|
/* harmony export */ createCssTokenCursor: () => (/* reexport safe */ _create_css_token_cursor__WEBPACK_IMPORTED_MODULE_2__.createCssTokenCursor),
|
|
732
|
+
/* harmony export */ readCssSelector: () => (/* reexport safe */ _read_css_selector__WEBPACK_IMPORTED_MODULE_3__.readCssSelector),
|
|
650
733
|
/* harmony export */ tokenizeCss: () => (/* reexport safe */ _tokenize_css__WEBPACK_IMPORTED_MODULE_1__.tokenizeCss)
|
|
651
734
|
/* harmony export */ });
|
|
652
735
|
/* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./types */ "./src/types.ts");
|
|
653
736
|
/* harmony import */ var _tokenize_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./tokenize-css */ "./src/tokenize-css.ts");
|
|
654
737
|
/* harmony import */ var _create_css_token_cursor__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./create-css-token-cursor */ "./src/create-css-token-cursor.ts");
|
|
738
|
+
/* harmony import */ var _read_css_selector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./read-css-selector */ "./src/read-css-selector.ts");
|
|
739
|
+
|
|
655
740
|
|
|
656
741
|
|
|
657
742
|
|
package/dist/index.dev.cjs.map
CHANGED
|
@@ -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;IAEF,MAAM,MAAM,GAAG,CAA8B,IAAO,EAAuC,EAAE;QAC3F,MAAM,KAAK,GAAG,IAAI,EAAE,CAAC;QAErB,+DAAM,CAAC,KAAK,EAAE,sCAAsC,IAAI,6BAA6B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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 let prevType: HoneyCssTokenType | undefined;\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 // Only space-join consecutive text chunks\n if (prevType === 'text' && 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 prevType = token.type;\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 * A single lexical token produced by the Honey CSS tokenizer.\n *\n * This discriminated union represents the minimal syntax units\n * required by the Honey CSS parser.\n *\n * Token categories:\n *\n * Structural tokens (no value):\n * - `braceOpen` → `{`\n * - `braceClose` → `}`\n * - `colon` → `:`\n * - `semicolon` → `;`\n * - `at` → `@`\n *\n * Value tokens (contain `value`):\n * - `text` → Plain text fragments (selectors, property names, raw values)\n * - `params` → Parenthesized groups including parentheses (e.g. `(min-width: 768px)`)\n * - `string` → Quoted string contents without surrounding quotes\n *\n * This discriminated union ensures:\n * - Tokens that require a value always have one\n * - Punctuation tokens never carry unnecessary data\n * - TypeScript can safely narrow tokens based on `type`\n *\n * Used throughout:\n * - Selector parsing\n * - Declaration parsing\n * - At-rule parsing\n * - AST construction\n */\nexport type HoneyCssToken =\n | { type: 'braceOpen' }\n | { type: 'braceClose' }\n | { type: 'colon' }\n | { type: 'semicolon' }\n | { type: 'at' }\n | { type: 'text'; value: string }\n | { type: 'params'; value: string }\n | { type: 'string'; value: string };\n\n/**\n * Union of all supported Honey CSS token type names.\n *\n * This is derived automatically from {@link HoneyCssToken}\n * to ensure strong type consistency between token instances\n * and token-type comparisons.\n *\n * Useful for:\n * - Cursor expectations (`expect('braceOpen')`)\n * - Stop conditions in parsing helpers (`readUntil(['braceOpen'])`)\n * - Type narrowing in switch statements\n */\nexport type HoneyCssTokenType = HoneyCssToken['type'];\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,GAAG,CAAC,CAAC;IAEd,MAAM,KAAK,GAAG,GAAY,E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,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;AACN","sources":["webpack://@react-hive/honey-css/./src/create-css-token-cursor.ts","webpack://@react-hive/honey-css/./src/read-css-selector.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 let prevType: HoneyCssTokenType | undefined;\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 // Only space-join consecutive text chunks\n if (prevType === 'text' && 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 prevType = token.type;\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 { HoneyTokenCursor } from './create-css-token-cursor';\n\n/**\n * Reads a CSS selector from the current token cursor position.\n *\n * The selector is reconstructed by sequentially consuming supported tokens\n * until one of the following conditions is met:\n *\n * - A `braceOpen` token (`{`) is encountered\n * - A `braceClose` token (`}`) is encountered (safety stop)\n * - An unsupported token type appears\n * - The end of the token stream is reached\n *\n * Supported token types:\n *\n * - `text` - raw selector fragments such as:\n * `.btn`, `#id`, `> .child`, `+ .item`, `&[data-open]`, `[data-id=\"x\"]`\n *\n * - `colon` - pseudo selectors and pseudo-elements:\n * `:hover`, `::before`\n *\n * - `params` - parenthesized groups used in pseudo functions or nth-expressions:\n * `(2n+1)`, `(:disabled)`\n *\n * - `string` - quoted string values (typically inside attribute selectors)\n *\n * Behavior:\n *\n * - Preserves pseudo selectors and pseudo-elements\n * - Preserves combinators (`>`, `+`, `~`)\n * - Preserves attribute selectors\n * - Preserves pseudo functions such as `:not(...)`\n * - Does **not** consume the `{` token\n *\n * This function performs no validation of selector correctness.\n * It only reconstructs the textual representation from the token stream.\n *\n * @param cursor - Token cursor positioned at the beginning of a selector.\n *\n * @returns The reconstructed selector string (trimmed).\n */\nexport const readCssSelector = (cursor: HoneyTokenCursor): string => {\n const parts: string[] = [];\n\n const finish = () => parts.join('').trim();\n\n while (!cursor.isEof()) {\n const token = cursor.peek();\n if (!token) {\n break;\n }\n\n switch (token.type) {\n case 'braceOpen':\n case 'braceClose':\n return finish();\n\n case 'colon':\n parts.push(':');\n break;\n\n case 'text':\n case 'params':\n parts.push(token.value);\n break;\n\n case 'string':\n parts.push(`\"${token.value}\"`);\n break;\n\n default:\n return finish();\n }\n\n cursor.next();\n }\n\n return finish();\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 * A single lexical token produced by the Honey CSS tokenizer.\n *\n * This discriminated union represents the minimal syntax units\n * required by the Honey CSS parser.\n *\n * Token categories:\n *\n * Structural tokens (no value):\n * - `braceOpen` → `{`\n * - `braceClose` → `}`\n * - `colon` → `:`\n * - `semicolon` → `;`\n * - `at` → `@`\n *\n * Value tokens (contain `value`):\n * - `text` → Plain text fragments (selectors, property names, raw values)\n * - `params` → Parenthesized groups including parentheses (e.g. `(min-width: 768px)`)\n * - `string` → Quoted string contents without surrounding quotes\n *\n * This discriminated union ensures:\n * - Tokens that require a value always have one\n * - Punctuation tokens never carry unnecessary data\n * - TypeScript can safely narrow tokens based on `type`\n *\n * Used throughout:\n * - Selector parsing\n * - Declaration parsing\n * - At-rule parsing\n * - AST construction\n */\nexport type HoneyCssToken =\n | { type: 'braceOpen' }\n | { type: 'braceClose' }\n | { type: 'colon' }\n | { type: 'semicolon' }\n | { type: 'at' }\n | { type: 'text'; value: string }\n | { type: 'params'; value: string }\n | { type: 'string'; value: string };\n\n/**\n * Union of all supported Honey CSS token type names.\n *\n * This is derived automatically from {@link HoneyCssToken}\n * to ensure strong type consistency between token instances\n * and token-type comparisons.\n *\n * Useful for:\n * - Cursor expectations (`expect('braceOpen')`)\n * - Stop conditions in parsing helpers (`readUntil(['braceOpen'])`)\n * - Type narrowing in switch statements\n */\nexport type HoneyCssTokenType = HoneyCssToken['type'];\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';\nexport * from './read-css-selector';\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
|
|
1
|
+
const e=e=>"{"===e||"}"===e||":"===e||";"===e||"@"===e||"("===e||'"'===e||"'"===e||"/"===e,t=t=>{const r=[];let n=0;const o=()=>n>=t.length,i=()=>o()?void 0:t[n],s=()=>n+1>=t.length?void 0:t[n+1],c=()=>{for(;;){const e=i();if(!e||!/\s/.test(e))return;n++}},u=()=>{if("/"!==i()||"/"!==s())return!1;for(n+=2;!o();){if("\n"===i()){n++;break}n++}return!0},a=()=>{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},l=()=>{let t="";for(;!o();){const r=i();if(!r)break;if(e(r))break;t+=r,n++}return t.trim()};for(;!o()&&(c(),!o());){if(u()||a())continue;const e=i();if(!e)break;if("{"===e){r.push({type:"braceOpen"}),n++;continue}if("}"===e){r.push({type:"braceClose"}),n++;continue}if(":"===e){r.push({type:"colon"}),n++;continue}if(";"===e){r.push({type:"semicolon"}),n++;continue}if("@"===e){r.push({type:"at"}),n++;continue}if("("===e){r.push({type:"params",value:p()});continue}if('"'===e||"'"===e){r.push({type:"string",value:f()});continue}const t=l();t?r.push({type:"text",value:t}):n++}return r};function r(e,t){if(!e)throw new Error(t)}const n=e=>{let t=0;const n=()=>t>=e.length,o=()=>n()?void 0:e[t],i=()=>n()?void 0:e[t++];return{isEof:n,peek:o,next:i,mark:()=>t,reset:e=>{t=e},expect:e=>{const t=i();return r(t,`[@react-hive/honey-css]: Expected "${e}" but reached end of input.`),r(t.type===e,`[@react-hive/honey-css]: Expected "${e}" but got "${t.type}".`),t},readUntil:e=>{let t,r="";for(;!n();){const n=o();if(!n||e.includes(n.type))break;"text"===n.type?("text"===t&&r&&(r+=" "),r+=n.value):"string"===n.type?r+=`"${n.value}"`:"params"===n.type&&(r+=n.value),t=n.type,i()}return r.trim()},skipUntil:e=>{for(;!n();){const t=o();if(!t||e.includes(t.type))break;i()}}}},o=e=>{const t=[],r=()=>t.join("").trim();for(;!e.isEof();){const n=e.peek();if(!n)break;switch(n.type){case"braceOpen":case"braceClose":default:return r();case"colon":t.push(":");break;case"text":case"params":t.push(n.value);break;case"string":t.push(`"${n.value}"`)}e.next()}return r()};export{n as createCssTokenCursor,o as readCssSelector,t as tokenizeCss};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -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,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,OAFAE,IAEM,CACfH,IACA,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WH,EAAMX,KACjBO,GACF,CAEA,OAAOd,EAAOK,QAuBdkB,UApBiBH,IACjB,MAAQ/B,KAAS,CACf,MAAM6B,EAAQ3B,IAEd,IAAK2B,GAASE,EAAUE,SAASJ,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 let prevType: HoneyCssTokenType | undefined;\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 // Only space-join consecutive text chunks\n if (prevType === 'text' && 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 prevType = token.type;\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","prevType","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,GAEDC,KAAS,CAGf,GAAW,OAFAE,IAEM,CACfH,IACA,KACF,CAEAA,GACF,CAEA,OAAO,GAcHS,EAAuB,KAC3B,GAAe,MAAXN,KAAiC,MAAfE,IACpB,OAAO,EAKT,IAFAL,GAAS,GAEDC,KAAS,CACf,GAAe,MAAXE,KAAiC,MAAfE,IAGpB,OAFAL,GAAS,GAEF,EAGTA,GACF,CAEA,OAAO,GAaHU,EAAa,KACjB,MAAMC,EAAQR,IACd,IAAKQ,EACH,MAAO,GAGTX,IACA,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CACtB,MAAM6B,EAAQO,EAAOlC,OACrB,IAAK2B,EACH,MAGF,OAAQA,EAAMX,MACZ,IAAK,YACL,IAAK,aAgBL,QACE,OAAOoB,IAdT,IAAK,QACHD,EAAMpB,KAAK,KACX,MAEF,IAAK,OACL,IAAK,SACHoB,EAAMpB,KAAKY,EAAMV,OACjB,MAEF,IAAK,SACHkB,EAAMpB,KAAK,IAAIY,EAAMV,UAOzBiB,EAAOX,MACT,CAEA,OAAOa,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","webpack://@react-hive/honey-css/./src/read-css-selector.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 let prevType: HoneyCssTokenType | undefined;\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 // Only space-join consecutive text chunks\n if (prevType === 'text' && 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 prevType = token.type;\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 { HoneyTokenCursor } from './create-css-token-cursor';\n\n/**\n * Reads a CSS selector from the current token cursor position.\n *\n * The selector is reconstructed by sequentially consuming supported tokens\n * until one of the following conditions is met:\n *\n * - A `braceOpen` token (`{`) is encountered\n * - A `braceClose` token (`}`) is encountered (safety stop)\n * - An unsupported token type appears\n * - The end of the token stream is reached\n *\n * Supported token types:\n *\n * - `text` - raw selector fragments such as:\n * `.btn`, `#id`, `> .child`, `+ .item`, `&[data-open]`, `[data-id=\"x\"]`\n *\n * - `colon` - pseudo selectors and pseudo-elements:\n * `:hover`, `::before`\n *\n * - `params` - parenthesized groups used in pseudo functions or nth-expressions:\n * `(2n+1)`, `(:disabled)`\n *\n * - `string` - quoted string values (typically inside attribute selectors)\n *\n * Behavior:\n *\n * - Preserves pseudo selectors and pseudo-elements\n * - Preserves combinators (`>`, `+`, `~`)\n * - Preserves attribute selectors\n * - Preserves pseudo functions such as `:not(...)`\n * - Does **not** consume the `{` token\n *\n * This function performs no validation of selector correctness.\n * It only reconstructs the textual representation from the token stream.\n *\n * @param cursor - Token cursor positioned at the beginning of a selector.\n *\n * @returns The reconstructed selector string (trimmed).\n */\nexport const readCssSelector = (cursor: HoneyTokenCursor): string => {\n const parts: string[] = [];\n\n const finish = () => parts.join('').trim();\n\n while (!cursor.isEof()) {\n const token = cursor.peek();\n if (!token) {\n break;\n }\n\n switch (token.type) {\n case 'braceOpen':\n case 'braceClose':\n return finish();\n\n case 'colon':\n parts.push(':');\n break;\n\n case 'text':\n case 'params':\n parts.push(token.value);\n break;\n\n case 'string':\n parts.push(`\"${token.value}\"`);\n break;\n\n default:\n return finish();\n }\n\n cursor.next();\n }\n\n return finish();\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","prevType","includes","skipUntil","readCssSelector","cursor","parts","finish","join"],"sourceRoot":""}
|