@lentystyle/core 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/CHANGELOG.tr.md +13 -0
  3. package/CODE_OF_CONDUCT.md +42 -0
  4. package/CODE_OF_CONDUCT.tr.md +41 -0
  5. package/CONTRIBUTING.md +53 -0
  6. package/CONTRIBUTING.tr.md +50 -0
  7. package/LICENSE.md +281 -0
  8. package/LICENSE.tr.md +280 -0
  9. package/README.md +139 -0
  10. package/README.tr.md +136 -0
  11. package/SECURITY.md +33 -0
  12. package/SECURITY.tr.md +32 -0
  13. package/dist/compiler/imports/chars.min.cjs +2 -0
  14. package/dist/compiler/imports/chars.min.js +2 -0
  15. package/dist/compiler/imports/classify.min.cjs +2 -0
  16. package/dist/compiler/imports/classify.min.js +2 -0
  17. package/dist/compiler/imports/scan.min.cjs +3 -0
  18. package/dist/compiler/imports/scan.min.js +3 -0
  19. package/dist/compiler/incremental.min.cjs +73 -0
  20. package/dist/compiler/incremental.min.js +73 -0
  21. package/dist/compiler/index.min.cjs +67 -0
  22. package/dist/compiler/index.min.js +67 -0
  23. package/dist/compiler/profile.min.cjs +2 -0
  24. package/dist/compiler/profile.min.js +2 -0
  25. package/dist/compiler/renderer.min.cjs +8 -0
  26. package/dist/compiler/renderer.min.js +8 -0
  27. package/dist/compiler/resource-limits.min.cjs +1 -0
  28. package/dist/compiler/resource-limits.min.js +1 -0
  29. package/dist/compiler/security/guard.min.cjs +1 -0
  30. package/dist/compiler/security/guard.min.js +1 -0
  31. package/dist/compiler/variables/array-variable.min.cjs +1 -0
  32. package/dist/compiler/variables/array-variable.min.js +1 -0
  33. package/dist/config.min.cjs +1 -0
  34. package/dist/config.min.js +1 -0
  35. package/dist/guard/hybrid.min.cjs +2 -0
  36. package/dist/guard/hybrid.min.js +2 -0
  37. package/dist/guard/runtime.min.cjs +1 -0
  38. package/dist/guard/runtime.min.js +1 -0
  39. package/dist/guard/shared.min.cjs +1 -0
  40. package/dist/guard/shared.min.js +1 -0
  41. package/dist/guard/ssr.min.cjs +2 -0
  42. package/dist/guard/ssr.min.js +2 -0
  43. package/dist/index.min.cjs +103 -0
  44. package/dist/index.min.js +103 -0
  45. package/dist/runtime/diagnostics.min.cjs +1 -0
  46. package/dist/runtime/diagnostics.min.js +1 -0
  47. package/dist/runtime/features.min.cjs +2 -0
  48. package/dist/runtime/features.min.js +2 -0
  49. package/dist/runtime/index.min.cjs +103 -0
  50. package/dist/runtime/index.min.js +103 -0
  51. package/dist/runtime/lentystyle.compile.worker.min.js +83 -0
  52. package/dist/runtime/lentystyle.debug.min.js +4 -0
  53. package/dist/runtime/lentystyle.integrity.json +12 -0
  54. package/dist/runtime/lentystyle.lazy.min.js +1 -0
  55. package/dist/runtime/lentystyle.log-critical.min.js +1 -0
  56. package/dist/runtime/lentystyle.log-optional.min.js +1 -0
  57. package/dist/runtime/lentystyle.map.min.js +4 -0
  58. package/dist/runtime/lentystyle.min.js +103 -0
  59. package/dist/runtime/lentystyle.observed.min.js +9 -0
  60. package/dist/runtime/lentystyle.performance.min.js +1 -0
  61. package/dist/runtime/lentystyle.worker.min.js +2 -0
  62. package/dist/runtime/options.min.cjs +1 -0
  63. package/dist/runtime/options.min.js +1 -0
  64. package/dist/runtime/style-sheet.min.cjs +1 -0
  65. package/dist/runtime/style-sheet.min.js +1 -0
  66. package/dist/types/compiler/compiler/index.d.ts +4 -0
  67. package/dist/types/compiler/compiler/render/collect-leaves.d.ts +3 -0
  68. package/dist/types/compiler/compiler/render/index.d.ts +3 -0
  69. package/dist/types/compiler/compiler/render/render-buckets.d.ts +3 -0
  70. package/dist/types/compiler/compiler/render/types.d.ts +13 -0
  71. package/dist/types/compiler/compiler/renderer.d.ts +5 -0
  72. package/dist/types/compiler/compiler/resource-limits.d.ts +21 -0
  73. package/dist/types/compiler/compiler/types.d.ts +82 -0
  74. package/dist/types/compiler/index.d.ts +2 -0
  75. package/dist/types/compiler/reader.d.ts +5 -0
  76. package/dist/types/compiler/renderer.d.ts +1 -0
  77. package/dist/types/config.d.ts +14 -0
  78. package/dist/types/index.d.ts +3 -0
  79. package/dist/types/runtime/diagnostics.d.ts +1 -0
  80. package/dist/types/runtime/features.d.ts +1 -0
  81. package/dist/types/runtime/index.d.ts +4 -0
  82. package/dist/types/runtime/options.d.ts +12 -0
  83. package/dist/types/runtime/runtime/features/assets.d.ts +3 -0
  84. package/dist/types/runtime/runtime/features/index.d.ts +5 -0
  85. package/dist/types/runtime/runtime/features/loader.d.ts +2 -0
  86. package/dist/types/runtime/runtime/features/performance-types.d.ts +39 -0
  87. package/dist/types/runtime/runtime/features/registry.d.ts +4 -0
  88. package/dist/types/runtime/runtime/features/types.d.ts +109 -0
  89. package/dist/types/runtime/runtime/loader/context-time.d.ts +2 -0
  90. package/dist/types/runtime/runtime/loader/context-types.d.ts +19 -0
  91. package/dist/types/runtime/runtime/loader/context.d.ts +18 -0
  92. package/dist/types/runtime/runtime/loader/options.d.ts +8 -0
  93. package/dist/types/runtime/runtime/loader/process/import-resolver/types.d.ts +12 -0
  94. package/dist/types/runtime/runtime/loader/process/types.d.ts +25 -0
  95. package/dist/types/runtime/runtime/style-sheet/cache.d.ts +6 -0
  96. package/dist/types/runtime/runtime/style-sheet.d.ts +7 -0
  97. package/dist/types/runtime/runtime/stylesheet-links/auto-loader.d.ts +7 -0
  98. package/dist/types/runtime/runtime/stylesheet-links/dom-compile.d.ts +9 -0
  99. package/dist/types/runtime/runtime/stylesheet-links.d.ts +2 -0
  100. package/dist/types/runtime/style-sheet.d.ts +1 -0
  101. package/dist/types/runtime/style.d.ts +2 -0
  102. package/package.json +117 -0
@@ -0,0 +1,2 @@
1
+ "use strict";(()=>{function f(){return typeof performance!="undefined"&&typeof performance.now=="function"?performance.now():Date.now()}var y=class extends Error{constructor(r){super(r);this.code="security-check-failed";this.name="LuisSecurityError"}};function d(e,t){if(!e)throw new y(`[LentyStyle][Security] Required dependency is unavailable: ${t}.`)}function w(e){if(e instanceof y)throw e}var ue={RUN0001:{scope:"runtime",channel:"debug",severity:"error",layer:"emergency",template:"Debug feature requires core script before plugin script."},RUN0002:{scope:"runtime",channel:"performance",severity:"error",layer:"emergency",template:"Performance feature requires core script before plugin script."},RUN0003:{scope:"runtime",channel:"runtime",severity:"error",layer:"emergency",template:"Observed feature requires core script before plugin script."},RUN0004:{scope:"runtime",channel:"debug",severity:"error",layer:"emergency",template:"Map feature requires core script before plugin script."},RUN0005:{scope:"runtime",channel:"runtime",severity:"error",layer:"emergency",template:"Worker feature requires core script before plugin script."},RUN0006:{scope:"runtime",channel:"runtime",severity:"error",layer:"emergency",template:"Lazy feature requires core script before plugin script."},RUN0007:{scope:"runtime",channel:"compile",severity:"error",layer:"critical",template:"Initial runtime compile failed."},RUN0008:{scope:"runtime",channel:"runtime",severity:"error",layer:"emergency",template:"Runtime {layer} logger bundle could not load. Falling back to emergency console output."},RUN0009:{scope:"runtime",channel:"runtime",severity:"error",layer:"critical",template:'Runtime feature "{feature}" could not resolve script URL.'},RUN0010:{scope:"runtime",channel:"security",severity:"error",layer:"critical",template:'Runtime feature "{feature}" blocked: missing SRI hash for cross-origin URL {scriptUrl}.'},RUN0011:{scope:"runtime",channel:"runtime",severity:"error",layer:"critical",template:'Runtime feature "{feature}" loaded but did not register.'},RUN0012:{scope:"runtime",channel:"runtime",severity:"error",layer:"critical",template:'Runtime feature "{feature}" failed to load: {scriptUrl}'},RUN0013:{scope:"runtime",channel:"debug",severity:"warn",layer:"optional",template:"{sourceLabel}: {warningMessage} (line {line}, code: {warningCode})."},RUN0014:{scope:"runtime",channel:"debug",severity:"info",layer:"optional",template:"Loaded imported .luis: {importedHref} (from {sourceLabel})"},RUN0015:{scope:"runtime",channel:"debug",severity:"info",layer:"optional",template:"Import diagnostics: {href} (from {importerSourceId}; {sourceLength} chars; {fetchDurationMs} ms; {cacheStatus}; parent: {sourceLabel})"},RUN0016:{scope:"runtime",channel:"performance",severity:"info",layer:"optional",template:"Compiled {sourceLabel} in {headlineDuration} (css: {cssLength} chars){modeSuffix}{executionSuffix}{timingSuffix}{incrementalSuffix}"},RUN0017:{scope:"runtime",channel:"performance",severity:"info",layer:"optional",template:"Compiled {importHref} in {compileDuration} (css: {cssLength} chars) (imported by: {importerSourceId}; {cacheStatus}; parent: {sourceLabel})"},RUN0018:{scope:"runtime",channel:"performance",severity:"info",layer:"optional",template:"Compiled {sourceLabel} [observed:{event}] in {compileDuration} (css: {cssLength} chars) (observed: {activeRules}/{totalRules} active, changed: {changedRules})"},RUN0019:{scope:"runtime",channel:"debug",severity:"warn",layer:"optional",template:"{message} (code: resource-limit)."},RUN0020:{scope:"runtime",channel:"debug",severity:"warn",layer:"optional",template:'{sourceLabel}{sourceSuffix}: Invalid observed selector "{selector}"{lineSuffix}. ({reason}, code: invalid-observed-selector).'},RUN0021:{scope:"runtime",channel:"debug",severity:"info",layer:"optional",template:"Observed {event}: {sourceLabel} (tokens: {tokenCount}, affected: {changedRules}, active: {activeRules})"},RUN0022:{scope:"runtime",channel:"debug",severity:"info",layer:"optional",template:'Debug rule map ready: window.__LentyStyleRuleMap["{styleId}"]'},RUN0023:{scope:"runtime",channel:"debug",severity:"warn",layer:"optional",template:"{sourceLabel}{lineLabel} {detailMessage}"},RUN0024:{scope:"runtime",channel:"compile",severity:"error",layer:"critical",template:".luis stylesheet failed: {href}{lineSuffix}"},RUN0025:{scope:"runtime",channel:"compile",severity:"error",layer:"critical",template:"<style data-luis> failed{lineSuffix}."},GRD0001:{scope:"guard",channel:"security",severity:"error",layer:null,template:"blocked candidate changes: {changedPaths} | targets={targetCount}, blocked={blockedCount}, warning={warningCount}"},GRD0002:{scope:"guard",channel:"security",severity:"info",layer:null,template:"validated candidate changes: {changedPaths} | targets={targetCount}, blocked={blockedCount}, warning={warningCount}"},HYB0001:{scope:"hybrid",channel:"hybrid",severity:"info",layer:null,template:"Compiled {routeId} in {duration} (sources: {sourceCount}; compile {compileDuration}; evaluate {evaluateDuration}; cache: {cacheState}; runtime-features: {runtimeFeatures})"},HYB0002:{scope:"hybrid",channel:"debug",severity:"warn",layer:null,template:"{routeId}: {warningMessage} (line {line}, code: {warningCode})."},HYB0003:{scope:"hybrid",channel:"debug",severity:"info",layer:null,template:"{routeId}: {rewriteState}."}};function P(e,t={},r={}){var i;let n=(i=ue[e])!=null?i:le(e);return{id:e,...n,message:ae(n.template,t),error:r.error}}function le(e){let t=ce(e);return{scope:t,channel:{guard:"security",runtime:"runtime",compiler:"compile",hybrid:"hybrid",ssr:"ssr"}[t],severity:"error",layer:t==="runtime"?"emergency":null,template:`Unregistered log id "${e}".`}}function ce(e){return e.startsWith("RUN")?"runtime":e.startsWith("GRD")?"guard":e.startsWith("HYB")?"hybrid":e.startsWith("SSR")?"ssr":"compiler"}function ae(e,t){return e.replace(/\{([a-zA-Z0-9_]+)\}/g,(r,n)=>{let i=t[n];return i===void 0?r:String(i)})}var me="__LentyStyleDispatchLogEvent__";function j(e){let t=e.channel===e.scope?"":`[${e.channel}] `;return`[LentyStyle][${e.scope}][${e.severity}][${e.id}] ${t}${e.message}`}function U(e,t={},r={}){var i;let n=P(e,t,{error:r.error});ye(n)||F(n,(i=r.sink)!=null?i:console)}function F(e,t=console){let r=j(e),n=pe(e.severity,t);if(e.error===void 0){n(r);return}n(r,e.error)}function pe(e,t){var r,n,i,o,s,c,a,O,_;return e==="error"?(n=(r=t.error)!=null?r:t.warn)!=null?n:t.info:e==="warn"?(o=(i=t.warn)!=null?i:t.info)!=null?o:t.error:e==="debug"?(a=(c=(s=t.debug)!=null?s:t.info)!=null?c:t.warn)!=null?a:t.error:(_=(O=t.info)!=null?O:t.warn)!=null?_:t.error}function ye(e){let r=globalThis[me];return r?r(e)===!0:!1}var V="",de="";function m(){if(!Le())return null;if(V){let t=B(V,de);if(t)return t}let e=Array.from(document.querySelectorAll("script[src]"));for(let t=e.length-1;t>=0;t-=1){let r=B(e[t].src,e[t].getAttribute("data-luis-run"));if(r)return r}return null}function B(e,t){if(!e)return null;try{let r=new URL(e,document.baseURI),n=r.pathname;return/\/lentystyle(?:\.min)?\.js$/i.test(n)?{src:r.href,baseHref:new URL(".",r).toString(),origin:r.origin,minified:/\.min\.js$/i.test(n),runTokens:ge(t)}:null}catch{return null}}function ge(e){if(!e)return[];let t=new Set;for(let r of e.split(",")){let n=r.trim().toLowerCase();n&&t.add(n)}return Array.from(t)}function Le(){return typeof window!="undefined"&&typeof document!="undefined"&&typeof URL=="function"}var Re=new Set(["javascript:","vbscript:","data:","blob:"]),Se=new Set(["http:","https:"]),be=new Set(["lentystyle.min.js","lentystyle.debug.min.js","lentystyle.performance.min.js","lentystyle.map.min.js","lentystyle.lazy.min.js","lentystyle.observed.min.js","lentystyle.worker.min.js","lentystyle.compile.worker.min.js"]);function g(e,t){d(typeof URL=="function","URL API");let r=e.trim();if(!r)return null;try{return new URL(r,t)}catch(n){return w(n),null}}function h(e){let t=e.protocol.toLowerCase();return Re.has(t)?!1:Se.has(t)}function L(e){var t;return d(typeof window!="undefined"&&!!((t=window.location)!=null&&t.origin),"window.location.origin"),e.origin===window.location.origin}function H(e){return be.has(T(e))}function T(e){var t;return(t=e.pathname.split("/").pop())!=null?t:""}function v(e){let t=new Set;if(!e||e.length===0)return t;for(let r of e){let n=r.trim();if(n)try{t.add(new URL(n).origin)}catch{}}return t}function u(){var t;if(typeof window=="undefined")return{};let e=window;return{...we(),...(t=e.__LentyStyleSecurityPolicy)!=null?t:{}}}function W(e,t){let r=g(e,t);return!r||!h(r)||!H(r)?!1:L(r)?!0:v(u().cdnScriptAllowlist).has(r.origin)}function we(){let e=m();return e?e.runTokens.includes("cdn")?{cdnScriptAllowlist:[e.origin],cdnScriptIntegrityManifest:new URL("lentystyle.integrity.json",e.baseHref).href}:{}:{}}var $=new Map;async function A(e,t){let r=g(e,t);if(!r)return;let n=u(),i=z(n.cdnScriptIntegrity,r);if(i)return i;if(L(r))return;let o=he(n,t);if(!o)return;let s=await ve(o);if(s)return z(s,r)}function he(e,t){var s,c,a;let r=(s=e.cdnScriptIntegrityManifest)==null?void 0:s.trim();if(!r)return;let n=(a=(c=m())==null?void 0:c.baseHref)!=null?a:t,i=g(r,n);if(!i||!h(i))return;if(L(i)||v(e.cdnScriptAllowlist).has(i.origin))return i.href}async function ve(e){let t=$.get(e);if(t)return t;let r=ke(e);return $.set(e,r),r}async function ke(e){if(typeof fetch!="function")return null;try{let t=await fetch(e);return t.ok?Ce(await t.json()):null}catch{return null}}function Ce(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let t={};for(let[r,n]of Object.entries(e)){if(typeof n!="string")continue;let i=n.trim();i&&(t[r]=i)}return t}function z(e,t){var s,c,a;if(!e)return;let r=T(t),n=(s=e[t.href])==null?void 0:s.trim();if(n)return n;let i=(c=e[t.pathname])==null?void 0:c.trim();return i||((a=e[r])==null?void 0:a.trim())||void 0}function G(e){if(!Ie())return null;let t=K();if(!t)return null;let r=new URL(e,t.baseHref).toString();return W(r,t.baseHref)?r:null}function Y(){var t;let e=K();return(t=e==null?void 0:e.minified)!=null?t:!1}function K(){let e=m();return e?{baseHref:e.baseHref,minified:e.minified}:null}function Ie(){return typeof window!="undefined"&&typeof document!="undefined"}var l=new Map,k=new Map,M=new Map,Ee=1;function N(){return Ee++}function J(e,t,r,n){e.kind==="compile"&&(Pe(e.payload.sourceId),k.set(e.payload.sourceId,e.requestId),M.set(e.requestId,e.payload.sourceId));let i=setTimeout(()=>{let o=l.get(e.requestId);o&&(l.delete(e.requestId),C(e.requestId),o.q(new Error(`Compile worker response timed out after ${n}ms.`)))},n);l.set(e.requestId,{z:t,q:r,j:i})}function X(e){let t=l.get(e.requestId);t&&(clearTimeout(t.j),l.delete(e.requestId),C(e.requestId),e.kind==="error"?t.q(new Error(e.payload.message)):e.kind==="compile-result"?t.z(e.payload):t.z())}function D(e){for(let[t,r]of l)clearTimeout(r.j),r.q(e),C(t);l.clear()}function Pe(e){let t=k.get(e);if(!t)return;let r=l.get(t);r&&(r.q(new Error("Superseded by a newer compile request.")),clearTimeout(r.j),l.delete(t),C(t))}function C(e){let t=M.get(e);t&&(M.delete(e),k.get(t)===e&&k.delete(t))}function Z(e){if(!e||typeof e!="object")return!1;let t=e;if(!x(t,["kind","requestId","payload"])||!Number.isInteger(t.requestId)||typeof t.kind!="string")return!1;if(t.kind==="prune-cache-result")return!("payload"in t);if(t.kind==="error")return!!(t.payload&&typeof t.payload=="object"&&x(t.payload,["message"])&&typeof t.payload.message=="string");if(t.kind==="compile-result"){let r=t.payload;return!!(r&&typeof r=="object"&&x(r,["result","compileDurationMs","incremental","workerState"])&&typeof r.compileDurationMs=="number"&&r.result&&typeof r.result=="object"&&Ue(r.result))}return!1}function Ue(e){return x(e,["css","headerRules","rootVariableRule","mainRules","variables","classVariables","objectVariables","arrayVariables","warnings","debugRules","observedRules","initialObservedRules"])}function x(e,t){let r=new Set(t);for(let n of Object.keys(e))if(!r.has(n))return!1;return!0}var Te=50,We=5,Q=0,I=[];function R(e){let t=u(),r=ee(t.maxSecurityEventsPerSession,Te);if(Q>=r)return;Q+=1;let n={...e,timestamp:Date.now()};Ae(t.onSecurityViolation,n),Me(n,t.reportingEndpoint,t.securityReportBatchSize)}function S(e,t,r={}){return{type:e,message:t,...r}}function Ae(e,t){if(e)try{e(t)}catch{}}function Me(e,t,r){let n=t==null?void 0:t.trim();if(!n)return;I.push(e);let i=ee(r,We);I.length<i||Ne(n)}function Ne(e){let t=I;I=[];let r=t.map(n=>JSON.stringify(n)).join(`
2
+ `);typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function"&&navigator.sendBeacon(e,new Blob([r],{type:"application/x-ndjson"}))}function ee(e,t){return typeof e=="number"&&Number.isFinite(e)&&e>0?Math.floor(e):t}var p;function te(e){let t=De();return t?t.createScriptURL(e):e}function De(){var r;if(p!==void 0)return p;let e=globalThis.trustedTypes;if(!e)return p=null,p;let t=((r=u().trustedTypesPolicyName)==null?void 0:r.trim())||"lentystyle";try{p=e.createPolicy(t,{createScriptURL:n=>n,createScript:()=>{throw new TypeError("LentyStyle runtime does not create TrustedScript text.")}})}catch{p=null}return p}var qe=2e6,Oe=15e3;function re(e){let t=u(),r=ie(t.maxWorkerPayloadBytes,qe);if(!(_e(e)<=r))throw R(S("worker-payload-rejected","Worker compile payload exceeded the configured byte limit.",{details:{maxPayloadBytes:r}})),new Error("Worker compile payload exceeded security policy byte limit.")}function ne(){let e=u();return{maxCompileTimeMs:ie(e.maxWorkerCompileTimeMs,Oe)}}function _e(e){return typeof TextEncoder!="undefined"?new TextEncoder().encode(JSON.stringify(e)).byteLength:JSON.stringify(e).length}function ie(e,t){return typeof e=="number"&&Number.isFinite(e)&&e>0?Math.floor(e):t}var b=null;function oe(){return{compileSource:je,warmup:Ve,pruneIncrementalCache:Be}}async function je(e){let t=f(),{worker:r,bootstrapDurationMs:n}=await q(),i=await Fe(r,He(e)),o=Math.max(0,f()-t-i.compileDurationMs-n);return{...i,timing:{bootstrapDurationMs:n>0?n:void 0,transportDurationMs:o}}}async function Fe(e,t){return await se(e,t)}async function Ve(){await q()}async function Be(e){let{worker:t}=await q(),r={kind:"prune-cache",requestId:N(),payload:{activeSourceIds:e}};await se(t,r)}async function se(e,t){return new Promise((r,n)=>{J(t,r,n,3e4),e.postMessage(t)})}function He(e){return re(e),{kind:"compile",requestId:N(),payload:{...e,limits:ne()}}}async function q(){let e=b;if(e)return{worker:await e,bootstrapDurationMs:0};let t=f();return b=$e(),{worker:await b,bootstrapDurationMs:f()-t}}async function $e(){let e=Y()?".min":"",t=G(`lentystyle.compile.worker${e}.js`);if(!t)throw new Error("Worker asset url could not be resolved.");let r=new URL(t,document.baseURI),n=await A(t,document.baseURI);if(r.origin!==window.location.origin&&!n)throw R(S("runtime-script-rejected","Cross-origin worker URL was blocked without integrity metadata.",{href:t,feature:"worker"})),new Error(`Cross-origin worker URL blocked without integrity pin: ${t}`);let i=new Worker(te(t));return i.onmessage=o=>{if(!Z(o.data)){R(S("worker-payload-rejected","Compile worker returned an invalid response payload.")),D(new Error("Compile worker returned an invalid response payload.")),b=null;return}X(o.data)},i.onerror=o=>{var s;D((s=o.error)!=null?s:new Error("Compile worker crashed.")),b=null},i}var E=globalThis.LentyStyle;E!=null&&E.registerRuntimeFeature?E.registerRuntimeFeature("worker",oe()):U("RUN0005");})();
@@ -0,0 +1 @@
1
+ "use strict";var u=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var c=(t,e)=>{for(var n in e)u(t,n,{get:e[n],enumerable:!0})},k=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of m(e))!f.call(t,r)&&r!==n&&u(t,r,{get:()=>e[r],enumerable:!(o=p(e,r))||o.enumerable});return t};var L=t=>k(u({},"__esModule",{value:!0}),t);var R={};c(R,{DEFAULT_LUIS_RUNTIME_OPTIONS:()=>a,parseLuisRuntimeOptionsAttribute:()=>b,parseLuisRuntimeOptionsPatchAttribute:()=>l,stringifyLuisRuntimeOptionsAttribute:()=>g});module.exports=L(R);var a={debug:!1,performance:!1,map:!1,lazy:!1,worker:"auto"};function l(t){if(t===null||t.trim().length===0)return{};let e={},n=t.split(",");for(let o of n){let r=o.trim().toLowerCase();if(!r)continue;let s=r.startsWith("!"),i=s?r.slice(1).trim():r;i&&(i==="debug"||i==="performance"||i==="map"||i==="lazy"?e[i]=!s:i==="worker"&&(e.worker=s?"main":"worker"))}return e}function b(t){let e=l(t);return{...a,...e}}function g(t){let e=[];return t.debug&&e.push("debug"),t.performance&&e.push("performance"),t.map&&e.push("map"),t.lazy&&e.push("lazy"),t.worker==="worker"?e.push("worker"):t.worker==="main"&&e.push("!worker"),e.join(",")}
@@ -0,0 +1 @@
1
+ var u={debug:!1,performance:!1,map:!1,lazy:!1,worker:"auto"};function a(t){if(t===null||t.trim().length===0)return{};let e={},o=t.split(",");for(let s of o){let i=s.trim().toLowerCase();if(!i)continue;let n=i.startsWith("!"),r=n?i.slice(1).trim():i;r&&(r==="debug"||r==="performance"||r==="map"||r==="lazy"?e[r]=!n:r==="worker"&&(e.worker=n?"main":"worker"))}return e}function l(t){let e=a(t);return{...u,...e}}function p(t){let e=[];return t.debug&&e.push("debug"),t.performance&&e.push("performance"),t.map&&e.push("map"),t.lazy&&e.push("lazy"),t.worker==="worker"?e.push("worker"):t.worker==="main"&&e.push("!worker"),e.join(",")}export{u as DEFAULT_LUIS_RUNTIME_OPTIONS,l as parseLuisRuntimeOptionsAttribute,a as parseLuisRuntimeOptionsPatchAttribute,p as stringifyLuisRuntimeOptionsAttribute};
@@ -0,0 +1 @@
1
+ "use strict";var h=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var w=Object.prototype.hasOwnProperty;var W=(e,t)=>{for(var n in t)h(e,n,{get:t[n],enumerable:!0})},k=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of H(t))!w.call(e,l)&&l!==n&&h(e,l,{get:()=>t[l],enumerable:!(r=T(t,l))||r.enumerable});return e};var B=e=>k(h({},"__esModule",{value:!0}),e);var j={};W(j,{readCachedCssFromStyleTag:()=>x,readCssWriteModeFromStyleTag:()=>y,readSheetRulesFromStyleTag:()=>E,writeCssToStyleTag:()=>q});module.exports=B(j);var S=new WeakMap,f=new WeakMap,g=new WeakMap;function p(e){var n;let t=S.get(e);if(typeof t=="string")return t;{let r=(n=e.textContent)!=null?n:"";return S.set(e,r),r}}function a(e,t,n,r){S.set(e,t),f.set(e,n),r&&g.set(e,r)}function C(e){return g.get(e)}function x(e){return p(e)}function y(e){var t;return f.has(e)&&(t=f.get(e))!=null?t:"unchanged"}function E(e){let t=e.sheet;if(!t)return[];let n=[];for(let r=0;r<t.cssRules.length;r+=1)n.push(t.cssRules[r].cssText);return n}function b(e,t,n,r){if(e.length===t.length){let o=I(e,t,n,r);if(o.length>0)return o}let l=n,u=e.length-r,s=t.length-r;return[{deleteStart:l,deleteEndExclusive:u,insertStart:l,insertEndExclusive:s}]}function R(e,t,n){let r=F(n),l=Math.max(e,t,1),u=Math.max(60,l*2),s=r/l;return r>u?!1:!(s>1.2)}function F(e){let t=0;for(let n of e)t+=n.deleteEndExclusive-n.deleteStart,t+=n.insertEndExclusive-n.insertStart;return t}function I(e,t,n,r){let l=[],u=e.length-r,s=n;for(;s<u;){if(e[s]===t[s]){s+=1;continue}let o=s;for(;s<u&&e[s]!==t[s];)s+=1;l.push({deleteStart:o,deleteEndExclusive:s,insertStart:o,insertEndExclusive:s})}return l}function M(e){return!!(e&&typeof e.replaceSync=="function")}function v(e){var t;return!!(e&&typeof e.insertRule=="function"&&typeof e.deleteRule=="function"&&typeof((t=e.cssRules)==null?void 0:t.length)=="number")}function L(e,t,n){if(e.cssRules.length!==t.length)return!1;let r=U(t,n),l=O(t,n,r);if(r===t.length&&r===n.length)return!0;let u=b(t,n,r,l);if(!R(t.length,n.length,u))return!1;try{for(let s=u.length-1;s>=0;s-=1){let o=u[s];for(let c=o.deleteEndExclusive-1;c>=o.deleteStart;c-=1)e.deleteRule(c);let i=o.deleteStart;for(let c=o.insertStart;c<o.insertEndExclusive;c+=1)e.insertRule(n[c],i),i+=1}}catch{return!1}return!0}function U(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r]===t[r];)r+=1;return r}function O(e,t,n){let r=0,l=e.length-n,u=t.length-n,s=Math.min(l,u);for(;r<s;){let o=e.length-1-r,i=t.length-1-r;if(e[o]!==t[i])break;r+=1}return r}function m(e){var s;let t=[],n="",r=0,l=null,u=!1;for(let o=0;o<e.length;o+=1){let i=e[o],c=(s=e[o+1])!=null?s:"",P=o>0?e[o-1]:"";if(u){n+=i,i==="*"&&c==="/"&&(n+="/",o+=1,u=!1);continue}if(l){n+=i,i===l&&P!=="\\"&&(l=null);continue}if(i==="/"&&c==="*"){n+="/*",o+=1,u=!0;continue}else if(i==="'"||i==='"'){l=i,n+=i;continue}if(i==="{"){r+=1,n+=i;continue}else if(i==="}"){r>0&&(r-=1),n+=i,r===0&&(d(t,n),n="");continue}if(i===";"&&r===0){n+=i,d(t,n),n="";continue}n+=i}return d(t,n),t}function d(e,t){let n=t.trim();if(n)e.push(n);else return}function q(e,t,n={}){var u;let r=p(e);if(r===t){a(e,t,"unchanged");return}if(n.forceTextContent||!n.preferCssom){e.textContent=t,a(e,t,"textContent");return}let l=e.sheet;if(v(l)){let s=(u=C(e))!=null?u:m(r),o=m(t);if(L(l,s,o)){a(e,t,"patch",o);return}}if(M(l))try{l.replaceSync(t),a(e,t,"replaceSync");return}catch{e.textContent=t,a(e,t,"textContent");return}e.textContent=t,a(e,t,"textContent")}
@@ -0,0 +1 @@
1
+ var h=new WeakMap,S=new WeakMap,m=new WeakMap;function f(e){var n;let t=h.get(e);if(typeof t=="string")return t;{let r=(n=e.textContent)!=null?n:"";return h.set(e,r),r}}function a(e,t,n,r){h.set(e,t),S.set(e,n),r&&m.set(e,r)}function g(e){return m.get(e)}function M(e){return f(e)}function v(e){var t;return S.has(e)&&(t=S.get(e))!=null?t:"unchanged"}function L(e){let t=e.sheet;if(!t)return[];let n=[];for(let r=0;r<t.cssRules.length;r+=1)n.push(t.cssRules[r].cssText);return n}function C(e,t,n,r){if(e.length===t.length){let s=T(e,t,n,r);if(s.length>0)return s}let o=n,u=e.length-r,l=t.length-r;return[{deleteStart:o,deleteEndExclusive:u,insertStart:o,insertEndExclusive:l}]}function x(e,t,n){let r=P(n),o=Math.max(e,t,1),u=Math.max(60,o*2),l=r/o;return r>u?!1:!(l>1.2)}function P(e){let t=0;for(let n of e)t+=n.deleteEndExclusive-n.deleteStart,t+=n.insertEndExclusive-n.insertStart;return t}function T(e,t,n,r){let o=[],u=e.length-r,l=n;for(;l<u;){if(e[l]===t[l]){l+=1;continue}let s=l;for(;l<u&&e[l]!==t[l];)l+=1;o.push({deleteStart:s,deleteEndExclusive:l,insertStart:s,insertEndExclusive:l})}return o}function y(e){return!!(e&&typeof e.replaceSync=="function")}function E(e){var t;return!!(e&&typeof e.insertRule=="function"&&typeof e.deleteRule=="function"&&typeof((t=e.cssRules)==null?void 0:t.length)=="number")}function b(e,t,n){if(e.cssRules.length!==t.length)return!1;let r=H(t,n),o=w(t,n,r);if(r===t.length&&r===n.length)return!0;let u=C(t,n,r,o);if(!x(t.length,n.length,u))return!1;try{for(let l=u.length-1;l>=0;l-=1){let s=u[l];for(let c=s.deleteEndExclusive-1;c>=s.deleteStart;c-=1)e.deleteRule(c);let i=s.deleteStart;for(let c=s.insertStart;c<s.insertEndExclusive;c+=1)e.insertRule(n[c],i),i+=1}}catch{return!1}return!0}function H(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r]===t[r];)r+=1;return r}function w(e,t,n){let r=0,o=e.length-n,u=t.length-n,l=Math.min(o,u);for(;r<l;){let s=e.length-1-r,i=t.length-1-r;if(e[s]!==t[i])break;r+=1}return r}function d(e){var l;let t=[],n="",r=0,o=null,u=!1;for(let s=0;s<e.length;s+=1){let i=e[s],c=(l=e[s+1])!=null?l:"",R=s>0?e[s-1]:"";if(u){n+=i,i==="*"&&c==="/"&&(n+="/",s+=1,u=!1);continue}if(o){n+=i,i===o&&R!=="\\"&&(o=null);continue}if(i==="/"&&c==="*"){n+="/*",s+=1,u=!0;continue}else if(i==="'"||i==='"'){o=i,n+=i;continue}if(i==="{"){r+=1,n+=i;continue}else if(i==="}"){r>0&&(r-=1),n+=i,r===0&&(p(t,n),n="");continue}if(i===";"&&r===0){n+=i,p(t,n),n="";continue}n+=i}return p(t,n),t}function p(e,t){let n=t.trim();if(n)e.push(n);else return}function j(e,t,n={}){var u;let r=f(e);if(r===t){a(e,t,"unchanged");return}if(n.forceTextContent||!n.preferCssom){e.textContent=t,a(e,t,"textContent");return}let o=e.sheet;if(E(o)){let l=(u=g(e))!=null?u:d(r),s=d(t);if(b(o,l,s)){a(e,t,"patch",s);return}}if(y(o))try{o.replaceSync(t),a(e,t,"replaceSync");return}catch{e.textContent=t,a(e,t,"textContent");return}e.textContent=t,a(e,t,"textContent")}export{M as readCachedCssFromStyleTag,v as readCssWriteModeFromStyleTag,L as readSheetRulesFromStyleTag,j as writeCssToStyleTag};
@@ -0,0 +1,4 @@
1
+ import type { LuisCompileOptions, LuisCompileResult } from './types';
2
+ export type { LuisCompileMode, LuisCompileOptions, LuisCompileDebugRule, LuisCompileMainRule, LuisCompileObservedRule, LuisCompileResult, LuisCompileWarning, LuisImportResolver, LuisResolvedImport, } from './types';
3
+ export type { LuisResourceLimits, LuisResourcePolicy } from './resource-limits';
4
+ export declare function compileLuis(source: string, options?: LuisCompileOptions): LuisCompileResult;
@@ -0,0 +1,3 @@
1
+ import type { LuisCompileWarning, LuisNode } from '../types';
2
+ import type { LuisRenderLeaf } from './types';
3
+ export declare function collectRenderLeaves(root: LuisNode, warnings?: LuisCompileWarning[]): LuisRenderLeaf[];
@@ -0,0 +1,3 @@
1
+ export { collectRenderLeaves } from './collect-leaves';
2
+ export { renderCssFromLeaves, renderLeafRule } from './render-buckets';
3
+ export type { LuisRenderLeaf, LuisRenderLeafRule } from './types';
@@ -0,0 +1,3 @@
1
+ import type { LuisRenderLeaf } from './types';
2
+ export declare function renderLeafRule(leaf: LuisRenderLeaf): string;
3
+ export declare function renderCssFromLeaves(rootDeclarations: string[], leaves: LuisRenderLeaf[], ruleOverridesByKey?: Map<string, string>): string[];
@@ -0,0 +1,13 @@
1
+ export type LuisRenderLeaf = {
2
+ key: string;
3
+ atRules: string[];
4
+ selector: string;
5
+ observedMode: 'none' | 'dynamic' | 'initial';
6
+ sourceLine: number;
7
+ declarations: string[];
8
+ };
9
+ export type LuisRenderLeafRule = {
10
+ key: string;
11
+ atRules: string[];
12
+ rule: string;
13
+ };
@@ -0,0 +1,5 @@
1
+ import type { LuisNode } from './types';
2
+ import { collectRenderLeaves, renderCssFromLeaves, renderLeafRule } from './render';
3
+ export { collectRenderLeaves, renderCssFromLeaves, renderLeafRule };
4
+ export type { LuisRenderLeaf, LuisRenderLeafRule } from './render';
5
+ export declare function renderCss(root: LuisNode): string[];
@@ -0,0 +1,21 @@
1
+ import type { LuisCompileOptions, LuisCompileWarning } from './types';
2
+ export type LuisResourcePolicy = 'fail-closed' | 'fail-soft';
3
+ export type LuisResourceLimits = {
4
+ maxForIterationsPerLoop: number;
5
+ maxNestedLoopProduct: number;
6
+ maxExpandedRules: number;
7
+ maxOutputCssChars: number;
8
+ maxObservedRules: number;
9
+ maxObservedActiveRules: number;
10
+ maxObservedRuleKeysPerToken: number;
11
+ maxMutationBatchTokens: number;
12
+ maxObservedReevalPerTick: number;
13
+ maxImportDepth: number;
14
+ maxImportCount: number;
15
+ maxImportedBytes: number;
16
+ };
17
+ export declare const DEFAULT_LUIS_RESOURCE_LIMITS: LuisResourceLimits;
18
+ export declare function resolveResourcePolicy(options: LuisCompileOptions): LuisResourcePolicy;
19
+ export declare function resolveResourceLimits(options: LuisCompileOptions): LuisResourceLimits;
20
+ export declare function buildResourceLimitWarning(line: number, message: string): LuisCompileWarning;
21
+ export declare function throwResourceLimitError(message: string): never;
@@ -0,0 +1,82 @@
1
+ export type LuisCompileMode = "full" | "vendor-fast";
2
+ export type LuisResolvedImport = {
3
+ id: string;
4
+ source: string;
5
+ mode?: LuisCompileMode;
6
+ };
7
+ export type LuisImportResolver = (request: string, fromSourceId: string | null) => string | LuisResolvedImport | null;
8
+ export type LuisCompileOptions = {
9
+ sourceId?: string;
10
+ importResolver?: LuisImportResolver;
11
+ importModeResolver?: (sourceId: string) => LuisCompileMode | undefined;
12
+ compileMode?: LuisCompileMode;
13
+ resourcePolicy?: 'fail-closed' | 'fail-soft';
14
+ resourceLimits?: Partial<{
15
+ maxForIterationsPerLoop: number;
16
+ maxNestedLoopProduct: number;
17
+ maxExpandedRules: number;
18
+ maxOutputCssChars: number;
19
+ maxObservedRules: number;
20
+ maxObservedActiveRules: number;
21
+ maxObservedRuleKeysPerToken: number;
22
+ maxMutationBatchTokens: number;
23
+ maxObservedReevalPerTick: number;
24
+ maxImportDepth: number;
25
+ maxImportCount: number;
26
+ maxImportedBytes: number;
27
+ }>;
28
+ debug?: boolean;
29
+ collectWarnings?: boolean;
30
+ lineOffset?: number;
31
+ };
32
+ export type LuisCompileResult = {
33
+ css: string;
34
+ headerRules?: string[];
35
+ rootVariableRule?: string;
36
+ mainRules?: LuisCompileMainRule[];
37
+ variables: Record<string, string>;
38
+ classVariables: Record<string, string>;
39
+ objectVariables: LuisObjectVariables;
40
+ arrayVariables: LuisArrayVariables;
41
+ warnings: LuisCompileWarning[];
42
+ debugRules?: LuisCompileDebugRule[];
43
+ observedRules?: LuisCompileObservedRule[];
44
+ initialObservedRules?: LuisCompileObservedRule[];
45
+ };
46
+ export type LuisNodeType = "root" | "selector" | "at-rule";
47
+ export type LuisNode = {
48
+ type: LuisNodeType;
49
+ value: string;
50
+ line?: number;
51
+ declarations: string[];
52
+ children: LuisNode[];
53
+ };
54
+ export type LuisCompileDebugRule = {
55
+ key: string;
56
+ selector: string;
57
+ atRules: string[];
58
+ line: number;
59
+ sourceId: string;
60
+ };
61
+ export type LuisCompileObservedRule = {
62
+ key: string;
63
+ selector: string;
64
+ atRules: string[];
65
+ line: number;
66
+ rule: string;
67
+ };
68
+ export type LuisCompileMainRule = {
69
+ key: string;
70
+ selector: string;
71
+ atRules: string[];
72
+ line: number;
73
+ observedMode: "none" | "initial";
74
+ rule: string;
75
+ };
76
+ export type LuisObjectVariables = Record<string, Record<string, string>>;
77
+ export type LuisArrayVariables = Record<string, string[]>;
78
+ export type LuisCompileWarning = {
79
+ code: "missing-semicolon" | "invalid-directive-order" | "invalid-directive-position" | "unsupported-import" | "import-not-found" | "import-cycle" | "invalid-import-url" | "invalid-array-range-unit" | "invalid-object-loop-access" | "duplicate-import-variable" | "invalid-function-syntax" | "invalid-function-name" | "duplicate-function" | "unknown-function-call" | "invalid-function-call" | "function-argument-mismatch" | "function-recursion" | "invalid-manifest" | "invalid-observed-syntax" | "resource-limit" | "invalid-syntax";
80
+ line: number;
81
+ message: string;
82
+ };
@@ -0,0 +1,2 @@
1
+ export * from './compiler';
2
+ export { readLuisFile, readLuisFromUrl, readAndCompileLuisFile, readAndCompileLuisFromUrl } from './reader';
@@ -0,0 +1,5 @@
1
+ import { type LuisCompileResult } from "./compiler";
2
+ export declare function readLuisFile(file: File): Promise<string>;
3
+ export declare function readLuisFromUrl(url: string): Promise<string>;
4
+ export declare function readAndCompileLuisFile(file: File): Promise<LuisCompileResult>;
5
+ export declare function readAndCompileLuisFromUrl(url: string): Promise<LuisCompileResult>;
@@ -0,0 +1 @@
1
+ export * from './compiler/renderer';
@@ -0,0 +1,14 @@
1
+ export interface LuisConfig {
2
+ hybrid?: Record<string, unknown>;
3
+ ssr?: Record<string, unknown>;
4
+ }
5
+ export interface LuisConfigLoadOverrides {
6
+ cwd?: string;
7
+ }
8
+ export interface ResolvedLuisConfig {
9
+ config: LuisConfig;
10
+ configDir: string;
11
+ configPath: string | null;
12
+ }
13
+ export declare function defineLuisConfig<TConfig extends LuisConfig>(config: TConfig): TConfig;
14
+ export declare function loadLuisConfig(configOrPath?: LuisConfig | string, overrides?: LuisConfigLoadOverrides): Promise<ResolvedLuisConfig>;
@@ -0,0 +1,3 @@
1
+ export * from './config';
2
+ export * as compiler from './compiler/index';
3
+ export * as runtime from './runtime/index';
@@ -0,0 +1 @@
1
+ export { formatDuration, getNow } from './runtime/loader/context-time';
@@ -0,0 +1 @@
1
+ export * from './runtime/features';
@@ -0,0 +1,4 @@
1
+ export * from '@lentystyle/core/compiler';
2
+ export { applyLuisToDocument } from './style';
3
+ export { compileFromDom, loadLuisStylesheetLinks, initLuisStylesheetAutoLoader, autoInitLuisStylesheetLoader, } from './runtime/stylesheet-links';
4
+ export { registerRuntimeFeature } from './runtime/features';
@@ -0,0 +1,12 @@
1
+ export type LuisRuntimeWorkerMode = 'auto' | 'main' | 'worker';
2
+ export type LuisRuntimeOptions = {
3
+ debug: boolean;
4
+ performance: boolean;
5
+ map: boolean;
6
+ lazy: boolean;
7
+ worker: LuisRuntimeWorkerMode;
8
+ };
9
+ export declare const DEFAULT_LUIS_RUNTIME_OPTIONS: LuisRuntimeOptions;
10
+ export declare function parseLuisRuntimeOptionsPatchAttribute(raw: string | null): Partial<LuisRuntimeOptions>;
11
+ export declare function parseLuisRuntimeOptionsAttribute(raw: string | null): LuisRuntimeOptions;
12
+ export declare function stringifyLuisRuntimeOptionsAttribute(options: LuisRuntimeOptions): string;
@@ -0,0 +1,3 @@
1
+ export declare function captureRuntimeCoreScriptSource(): void;
2
+ export declare function resolveRuntimeAssetUrl(filename: string): string | null;
3
+ export declare function isRuntimeMinifiedBuild(): boolean;
@@ -0,0 +1,5 @@
1
+ export { captureRuntimeCoreScriptSource, resolveRuntimeAssetUrl, isRuntimeMinifiedBuild } from './assets';
2
+ export { ensureRuntimeFeatures } from './loader';
3
+ export { getRuntimeFeature, hasRuntimeFeature, registerRuntimeFeature } from './registry';
4
+ export type { LuisImportPerformancePayload, LuisObservedPerformancePayload, LuisPerformanceFeaturePayload, LuisRuntimeTimingBreakdown, } from './performance-types';
5
+ export type { LuisDebugFeatureApi, LuisLazyFeatureApi, LuisMapFeatureApi, LuisObservedFeatureApi, LuisObservedFeaturePayload, LuisPerformanceFeatureApi, LuisRuntimeExecution, LuisRuntimeFeatureMap, LuisRuntimeFeatureName, LuisRuntimeWorkerState, LuisWorkerCompilePayload, LuisWorkerCompileResult, LuisWorkerFeatureApi, } from './types';
@@ -0,0 +1,2 @@
1
+ import type { LuisRuntimeFeatureName } from './types';
2
+ export declare function ensureRuntimeFeatures(features: Set<LuisRuntimeFeatureName>): Promise<void>;
@@ -0,0 +1,39 @@
1
+ import type { LuisIncrementalPerf } from '../loader/context';
2
+ import type { LuisRuntimeExecution, LuisRuntimeWorkerState } from './types';
3
+ export type LuisRuntimeTimingBreakdown = {
4
+ compileDurationMs: number;
5
+ totalDurationMs?: number;
6
+ applyDurationMs?: number;
7
+ bootstrapDurationMs?: number;
8
+ transportDurationMs?: number;
9
+ featureLoadDurationMs?: number;
10
+ remapDurationMs?: number;
11
+ composeDurationMs?: number;
12
+ mapDurationMs?: number;
13
+ };
14
+ export type LuisPerformanceFeaturePayload = {
15
+ sourceLabel: string;
16
+ cssLength: number;
17
+ mode?: 'full' | 'vendor-fast';
18
+ execution?: LuisRuntimeExecution;
19
+ workerState?: LuisRuntimeWorkerState;
20
+ incremental?: LuisIncrementalPerf;
21
+ timing: LuisRuntimeTimingBreakdown;
22
+ };
23
+ export type LuisImportPerformancePayload = {
24
+ sourceLabel: string;
25
+ importHref: string;
26
+ importerSourceId: string;
27
+ compileDurationMs: number;
28
+ cssLength: number;
29
+ fromCache: boolean;
30
+ };
31
+ export type LuisObservedPerformancePayload = {
32
+ sourceLabel: string;
33
+ compileDurationMs: number;
34
+ cssLength: number;
35
+ event: 'upsert' | 'mutation' | 'mutation-noop' | 'media-change' | 'media-noop' | 'lazy-enter';
36
+ totalRules: number;
37
+ activeRules: number;
38
+ changedRules: number;
39
+ };
@@ -0,0 +1,4 @@
1
+ import type { LuisRuntimeFeatureMap, LuisRuntimeFeatureName } from './types';
2
+ export declare function registerRuntimeFeature<Name extends LuisRuntimeFeatureName>(name: Name, feature: LuisRuntimeFeatureMap[Name]): void;
3
+ export declare function getRuntimeFeature<Name extends LuisRuntimeFeatureName>(name: Name): LuisRuntimeFeatureMap[Name] | undefined;
4
+ export declare function hasRuntimeFeature(name: LuisRuntimeFeatureName): boolean;
@@ -0,0 +1,109 @@
1
+ export type AssetInfo = {
2
+ baseHref: string;
3
+ minified: boolean;
4
+ };
5
+ export type LazyRuleWatch = {
6
+ hostStyleTagId: string;
7
+ ruleKey: string;
8
+ onEnter: () => void;
9
+ elements: Set<Element>;
10
+ };
11
+ import type { LuisCompileDebugRule, LuisCompileWarning } from '@lentystyle/core/compiler';
12
+ import type { LuisCompileObservedRule } from '@lentystyle/core/compiler';
13
+ import type { BuildSourceEntry } from '../loader/process/types';
14
+ import type { RuntimeImportMetric } from '../loader/process/import-resolver/types';
15
+ import type { LuisImportPerformancePayload, LuisObservedPerformancePayload, LuisPerformanceFeaturePayload, LuisRuntimeTimingBreakdown } from './performance-types';
16
+ export type LuisRuntimeFeatureName = 'debug' | 'performance' | 'map' | 'observed' | 'worker' | 'lazy';
17
+ export type LuisRuntimeExecution = 'main' | 'worker';
18
+ export type LuisRuntimeWorkerState = 'cold' | 'warm';
19
+ export type LuisDebugFeatureApi = {
20
+ remapDebugRulesToSource: (debugRules: LuisCompileDebugRule[] | undefined, sourceText: string) => LuisCompileDebugRule[] | undefined;
21
+ applyDebugRulesToCssMarkers: (css: string, debugRules: LuisCompileDebugRule[] | undefined) => string;
22
+ logCompileWarnings: (warnings: LuisCompileWarning[], sourceLabel: string) => void;
23
+ logLoadedLuisImports: (entry: BuildSourceEntry, sourceLabel: string) => void;
24
+ logImportedLuisDiagnostics: (sourceLabel: string, importMetrics: RuntimeImportMetric[]) => void;
25
+ publishDebugRuleMap: (entry: BuildSourceEntry, sourceLabel: string, debugRules: LuisCompileDebugRule[] | undefined, shouldPublishMap: boolean, shouldLogDebug: boolean) => void;
26
+ clearDebugRuleMap: (styleId: string) => void;
27
+ };
28
+ export type LuisPerformanceFeatureApi = {
29
+ logCompilePerformance: (payload: LuisPerformanceFeaturePayload) => void;
30
+ logImportPerformance: (payload: LuisImportPerformancePayload) => void;
31
+ logObservedPerformance: (payload: LuisObservedPerformancePayload) => void;
32
+ };
33
+ export type LuisMapFeatureApi = {
34
+ buildCssWithLuisSourceMap: (styleTag: HTMLStyleElement, css: string, options: {
35
+ enabled: boolean;
36
+ sourceId: string;
37
+ sourceContent: string;
38
+ }) => string;
39
+ revokeLuisSourceMapForStyleTag: (styleTag: HTMLStyleElement) => void;
40
+ };
41
+ export type LuisLazyFeatureApi = {
42
+ isElementInViewport: (element: Element) => boolean;
43
+ watchRuleElements: (payload: {
44
+ hostStyleTagId: string;
45
+ ruleKey: string;
46
+ elements: Element[];
47
+ onEnter: () => void;
48
+ }) => void;
49
+ clearRuleWatch: (hostStyleTagId: string, ruleKey: string) => void;
50
+ clearSourceWatches: (hostStyleTagId: string) => void;
51
+ };
52
+ export type LuisObservedFeaturePayload = {
53
+ hostStyleTag: HTMLStyleElement;
54
+ sourceId: string;
55
+ sourceLabel: string;
56
+ sourceContent: string;
57
+ rules: LuisCompileObservedRule[];
58
+ initialRules?: LuisCompileObservedRule[];
59
+ debugRules?: LuisCompileDebugRule[];
60
+ debugFeature?: LuisDebugFeatureApi;
61
+ mapFeature?: LuisMapFeatureApi;
62
+ lazyFeature?: LuisLazyFeatureApi;
63
+ performanceFeature?: LuisPerformanceFeatureApi;
64
+ mapEnabled: boolean;
65
+ debugEnabled: boolean;
66
+ performanceEnabled: boolean;
67
+ lazyEnabled: boolean;
68
+ };
69
+ export type LuisObservedFeatureApi = {
70
+ upsertObservedRules: (payload: LuisObservedFeaturePayload) => void;
71
+ removeObservedRules: (hostStyleTagId: string) => void;
72
+ };
73
+ export type LuisWorkerCompilePayload = {
74
+ source: string;
75
+ sourceId: string;
76
+ contextPrelude: string;
77
+ lineOffset: number;
78
+ compileMode?: 'full' | 'vendor-fast';
79
+ debugEnabled: boolean;
80
+ serializedImportGraph: Record<string, Record<string, {
81
+ id: string;
82
+ source: string;
83
+ mode?: 'full' | 'vendor-fast';
84
+ }>>;
85
+ serializedImportModes: Record<string, 'full' | 'vendor-fast'>;
86
+ limits?: {
87
+ maxCompileTimeMs: number;
88
+ };
89
+ };
90
+ export type LuisWorkerCompileResult = {
91
+ result: import('@lentystyle/core/compiler').LuisCompileResult;
92
+ compileDurationMs: number;
93
+ incremental?: import('../loader/context').LuisIncrementalPerf;
94
+ workerState: LuisRuntimeWorkerState;
95
+ timing?: Pick<LuisRuntimeTimingBreakdown, 'bootstrapDurationMs' | 'transportDurationMs'>;
96
+ };
97
+ export type LuisWorkerFeatureApi = {
98
+ compileSource: (payload: LuisWorkerCompilePayload) => Promise<LuisWorkerCompileResult>;
99
+ warmup: () => Promise<void>;
100
+ pruneIncrementalCache: (activeSourceIds: string[]) => Promise<void>;
101
+ };
102
+ export type LuisRuntimeFeatureMap = {
103
+ debug: LuisDebugFeatureApi;
104
+ performance: LuisPerformanceFeatureApi;
105
+ map: LuisMapFeatureApi;
106
+ observed: LuisObservedFeatureApi;
107
+ worker: LuisWorkerFeatureApi;
108
+ lazy: LuisLazyFeatureApi;
109
+ };
@@ -0,0 +1,2 @@
1
+ export declare function getNow(): number;
2
+ export declare function formatDuration(durationMs: number): string;
@@ -0,0 +1,19 @@
1
+ export type LuisSourceElement = HTMLLinkElement | HTMLStyleElement;
2
+ export type LuisObjectValue = Record<string, string>;
3
+ export type LuisArrayValue = string[];
4
+ export type LuisCompileContext = {
5
+ classVariables: Record<string, string>;
6
+ objectVariables: Record<string, LuisObjectValue>;
7
+ arrayVariables: Record<string, LuisArrayValue>;
8
+ };
9
+ export type LuisIncrementalPerf = {
10
+ mode?: 'full' | 'vendor-fast';
11
+ totalBlocks: number;
12
+ reusedBlocks: number;
13
+ renderedBlocks: number;
14
+ parser: {
15
+ totalSegments: number;
16
+ reusedSegments: number;
17
+ parsedSegments: number;
18
+ };
19
+ };
@@ -0,0 +1,18 @@
1
+ import { compileLuis } from '@lentystyle/core/compiler';
2
+ import type { LuisCompileMode, LuisImportResolver } from '@lentystyle/core/compiler';
3
+ import { formatDuration, getNow } from './context-time';
4
+ import type { LuisCompileContext, LuisIncrementalPerf } from './context-types';
5
+ export type { LuisArrayValue, LuisCompileContext, LuisIncrementalPerf, LuisObjectValue, LuisSourceElement } from './context-types';
6
+ export declare function createEmptyContext(): LuisCompileContext;
7
+ export declare function cloneCompileContext(context: LuisCompileContext): LuisCompileContext;
8
+ export declare function compileWithContext(source: string, context: LuisCompileContext, sourceId?: string, importResolver?: LuisImportResolver, importModeResolver?: (sourceId: string) => LuisCompileMode | undefined, compileMode?: LuisCompileMode, debugEnabled?: boolean): {
9
+ result: ReturnType<typeof compileLuis>;
10
+ compileDurationMs: number;
11
+ incremental?: LuisIncrementalPerf;
12
+ };
13
+ export declare function compileWithPerf(source: string, sourceId?: string, importResolver?: LuisImportResolver, importModeResolver?: (sourceId: string) => LuisCompileMode | undefined, compileMode?: LuisCompileMode, debugEnabled?: boolean, lineOffset?: number): {
14
+ result: ReturnType<typeof compileLuis>;
15
+ compileDurationMs: number;
16
+ incremental?: LuisIncrementalPerf;
17
+ };
18
+ export { formatDuration, getNow };
@@ -0,0 +1,8 @@
1
+ import type { LuisRuntimeOptions } from '../../options';
2
+ import type { LuisSourceElement } from './context';
3
+ export type { LuisRuntimeOptions } from '../../options';
4
+ export type { LuisRuntimeWorkerMode } from '../../options';
5
+ type LuisRuntimeStyleOutputMode = 'full' | 'observed-only';
6
+ export declare function readLuisRuntimeOptions(source: LuisSourceElement): LuisRuntimeOptions;
7
+ export declare function readLuisStyleOutputMode(source: LuisSourceElement): LuisRuntimeStyleOutputMode;
8
+ export declare function readLuisManifestAttribute(source: LuisSourceElement): string | null;
@@ -0,0 +1,12 @@
1
+ import type { LuisCompileMode, LuisResolvedImport } from '@lentystyle/core/compiler';
2
+ export type ImportGraph = Map<string, Map<string, LuisResolvedImport>>;
3
+ export type ImportModeResolver = (sourceId: string) => LuisCompileMode | undefined;
4
+ export type SerializedImportGraph = Record<string, Record<string, LuisResolvedImport>>;
5
+ export type SerializedImportModeMap = Record<string, LuisCompileMode>;
6
+ export type RuntimeImportMetric = {
7
+ href: string;
8
+ importerSourceId: string;
9
+ sourceLength: number;
10
+ fetchDurationMs: number;
11
+ fromCache: boolean;
12
+ };
@@ -0,0 +1,25 @@
1
+ import type { LuisCompileMode, LuisCompileWarning, LuisImportResolver } from '@lentystyle/core/compiler';
2
+ import type { LuisSourceElement } from '../context';
3
+ import type { LuisRuntimeWorkerMode } from '../options';
4
+ import type { ImportModeResolver, RuntimeImportMetric, SerializedImportGraph, SerializedImportModeMap } from './import-resolver/types';
5
+ export type BuildSourceKind = 'link' | 'inline';
6
+ export type BuildSourceEntry = {
7
+ source: LuisSourceElement;
8
+ styleTag: HTMLStyleElement;
9
+ sourceId: string;
10
+ kind: BuildSourceKind;
11
+ href: string;
12
+ rawSource: string;
13
+ debugSource: string;
14
+ signature: string;
15
+ importResolver?: LuisImportResolver;
16
+ importModeResolver?: ImportModeResolver;
17
+ compileModeOverride?: LuisCompileMode;
18
+ executionOverride?: LuisRuntimeWorkerMode;
19
+ serializedImportGraph: SerializedImportGraph;
20
+ serializedImportModes: SerializedImportModeMap;
21
+ importedLuisHrefs: string[];
22
+ importMetrics: RuntimeImportMetric[];
23
+ preCompileWarnings: LuisCompileWarning[];
24
+ fetchError?: unknown;
25
+ };
@@ -0,0 +1,6 @@
1
+ export declare function resolvePreviousCss(styleTag: HTMLStyleElement): string;
2
+ export declare function setCachedCssSnapshot(styleTag: HTMLStyleElement, css: string, mode: 'patch' | 'replaceSync' | 'textContent' | 'unchanged', splitRules?: string[]): void;
3
+ export declare function readCachedSplitRules(styleTag: HTMLStyleElement): string[] | undefined;
4
+ export declare function readCachedCssFromStyleTag(styleTag: HTMLStyleElement): string;
5
+ export declare function readCssWriteModeFromStyleTag(styleTag: HTMLStyleElement): 'patch' | 'replaceSync' | 'textContent' | 'unchanged';
6
+ export declare function readSheetRulesFromStyleTag(styleTag: HTMLStyleElement): string[];
@@ -0,0 +1,7 @@
1
+ import { readCachedCssFromStyleTag, readCssWriteModeFromStyleTag, readSheetRulesFromStyleTag } from './style-sheet/cache';
2
+ export { readCachedCssFromStyleTag, readCssWriteModeFromStyleTag, readSheetRulesFromStyleTag };
3
+ export type LuisStyleWriteOptions = {
4
+ forceTextContent?: boolean;
5
+ preferCssom?: boolean;
6
+ };
7
+ export declare function writeCssToStyleTag(styleTag: HTMLStyleElement, css: string, options?: LuisStyleWriteOptions): void;
@@ -0,0 +1,7 @@
1
+ type LoaderOptions = {
2
+ watch?: boolean;
3
+ force?: boolean;
4
+ };
5
+ export declare function initLuisStylesheetAutoLoader(options?: LoaderOptions): () => void;
6
+ export declare function autoInitLuisStylesheetLoader(): void;
7
+ export {};
@@ -0,0 +1,9 @@
1
+ type LoaderOptions = {
2
+ force?: boolean;
3
+ };
4
+ export declare function loadLuisStylesheetLinks(options?: LoaderOptions): Promise<void>;
5
+ export declare function compileFromDom(options?: {
6
+ force?: boolean;
7
+ }): Promise<void>;
8
+ export declare function queueInitialRebuild(force: boolean, queueRebuild: () => void): void;
9
+ export {};
@@ -0,0 +1,2 @@
1
+ export { compileFromDom, loadLuisStylesheetLinks } from './stylesheet-links/dom-compile';
2
+ export { initLuisStylesheetAutoLoader, autoInitLuisStylesheetLoader } from './stylesheet-links/auto-loader';
@@ -0,0 +1 @@
1
+ export * from './runtime/style-sheet';
@@ -0,0 +1,2 @@
1
+ import { type LuisCompileResult } from '@lentystyle/core/compiler';
2
+ export declare function applyLuisToDocument(source: string, styleId?: string): LuisCompileResult;