fscss 1.1.15 → 1.1.17

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/README.md CHANGED
@@ -40,7 +40,7 @@ Supports:
40
40
 
41
41
  - Number Calculation (num()) → evaluate math expressions. num(4+5)
42
42
 
43
- - Import (@import) → include external FSCSS files. @import(exec(...))
43
+ - Import (@import) → include external FSCSS files. @import((*) from "location..."). https://github.com/fscss-ttr/fscss-modules/
44
44
 
45
45
  - @event → event-based styling logic
46
46
 
@@ -63,7 +63,26 @@ $(@keyframes trans, .box, .card &[3s ase-in infinite]) {
63
63
  }
64
64
  }
65
65
  ```
66
+ ### Example
67
+ ```css
68
+ @import((*) from "mymodules/style.fscss")
69
+ @import((
70
+ flex-x,
71
+ flex-wrap-center as fx-wc,
72
+ flex-responsive as fx-r
73
+ ) from flex-control/fscss)
74
+
75
+ @arr colors[#1E2783, #8C29B2, #C41348]
76
+ .container{
77
+ @fx-wc()
78
+ background: @random(@arr.colors);
79
+ }
80
+ .container .card{
81
+ @flex-x()
82
+ background: linear-gradient(40deg, @arr.colors!.list);
83
+ }
66
84
 
85
+ ```
67
86
  ### Installation
68
87
 
69
88
  `npm install -g fscss`
@@ -74,7 +93,7 @@ Or locally to your project:
74
93
 
75
94
  **Browser CDN**
76
95
  ```html
77
- <script src="https://cdn.jsdelivr.net/npm/fscss@1.1.14/exec.min.js" defer></script>
96
+ <script src="https://cdn.jsdelivr.net/npm/fscss@1.1.17/exec.min.js" defer></script>
78
97
  ```
79
98
  Usage
80
99
 
package/e/exec.js CHANGED
@@ -1,8 +1,2 @@
1
-
2
- function loadFScript(src, async = true){const script=document.createElement('script');script.type='text/javascript';script.async= async;src="https://cdn.jsdelivr.net/gh/Figsh/FSCSS@main/rtF4.js";script.src = src;document.body.appendChild(script);}loadFScript();function applyFscssStyles() {const fscssLinks=document.querySelectorAll('[type*="fscss"]');fscssLinks.forEach(link => {fetch(link.href).then(response=>response.text()).then(css =>{const style=document.createElement('style');style.textContent = css;document.head.appendChild(style);}).catch(error => {
3
- console.error(`Failed to load FSCSS from ${link.href}`, error);});});}function inf({ host, path }) {if (!host || !path) {console.error("Both 'host' and 'path' are required.");
4
- return;}const sanitizedHost = host.replace(/github/gi, 'gh');const sanitizedPath = path.replace(/\s*->\s*/g, '/').replace(/\n/g, '');const finalUrl = `https://cdn.jsdelivr.net/${sanitizedHost}/${sanitizedPath}`;loadFScript(finalUrl);
5
- }function exec({ type = 'text', content, onError, onSuccess }) {if (!content) {const errorText = 'No CSS content or URL provided.';console.error(errorText);if (onError) onError(errorText);
6
- return;
7
- }const style=document.createElement('style');const appendStyle=cssText=> {style.textContent = cssText;document.head.appendChild(style);if (onSuccess)onSuccess(style);};if (type==='text'||type==='auto'|| type==='text/fscss'||type==='text/css'){appendStyle(content);}else if (type==='fromUrl'||type==='URL' ||type==='fromURL'||type==='link') {fetch(content).then(res => {if (!res.ok) throw new Error(`HTTP error! Status: ${res.status}`);
8
- return res.text();}).then(css => appendStyle(css)).catch(err => {console.error(`Failed to load CSS from URL: ${content}`, err);if (onError) onError(err.message);});} else {const errorText = `Unsupported type "${type}". Use "text" or "fromUrl".`;console.error(errorText);if(onError) onError(errorText);}}
1
+ /* Figsh-fscss light, source v3, fscss.devtem.org */
2
+ function exec({type:e="text",content:n,onError:r,onSuccess:s}){if(!n){const e="No CSS content or URL provided.";return console.error(`[FSCSS] ${e}`),void(r&&r(e))}const t=document.createElement("style"),o=e=>{t.textContent=e,document.head.appendChild(t),s&&s(t),xfscssProcessorWrap()},c=["text","auto","text/fscss","text/css"].includes(e),i=["fromUrl","URL","fromURL","link"].includes(e);if(c)o(n);else if(i)fetch(n).then((e=>{if(!e.ok)throw new Error(`HTTP ${e.status}: ${e.statusText}`);return e.text()})).then(o).catch((e=>{const s=`Failed to load CSS from: ${n}. ${e.message}`;console.error(`[FSCSS] ${s}`),r&&r(s)}));else{const n=`Unsupported type "${e}". Use "text" or "fromUrl".`;console.error(`[FSCSS] ${n}`),r&&r(n)}}function xfscssProcessorWrap(){(async()=>{function e(e){return e=e.replace(/count\(\s*([\d\.]+)\s*(?:,\s*([\d\.]+)?)?\)/g,((e,n,r)=>{return null===r&&(r=1),s=parseInt(n),t=parseInt(r||1),`${Array(s).fill().map(((e,n)=>(n+1)*t))}`;var s,t}))}function n(e){return e=e.replace(/length\((?:([^\)]+)|\s*"([^"]*)"\s*|\s*'([^']*)'\s*)\)/g,((e,n,r,s)=>(n||r||s).length))}function r(e){return e.replace(/num\((.*?)\)/g,((e,n)=>function(e){try{return new Function(`return ${e}`)()}catch(n){return console.error("Invalid expression:",e),e}}(n)))}const s={},t={},o={},c=new Set,i=new Set;function a(e,n){let r=0,s=n;for(;s<e.length&&("{"===e[s]?r++:"}"===e[s]&&r--,0!==r);)s++;return e.slice(n,s+1)}function l(e){const n=[],r=/(if|el-if|el)\s*([^{}]*?)\s*\{([\s\S]*?)\}/g;let s;for(;null!==(s=r.exec(e));)n.push({type:s[1],condition:s[2].trim(),block:s[3].trim()});return n}function f(e){let n="";const r=e.replace(/exec\((_log|_error|_warn|_info),\s*(?:"([^"]*)"|'([^']*)'|([^)]*))\)/g,((e,r,s,t,o)=>{const c=s||t||o;return["_log","_error","_warn","_info"].includes(r)?c?(n+=`console.${r.slice(1)}("${c.replace(/"/g,'\\"')}");\n`,""):(console.warn(`fscss[exec(console)]: Empty argument for method: ${r}`),""):(console.warn(`fscss[exec(console)]: Unsupported method: ${r}`),"")}));if(n)try{new Function(n)()}catch(e){console.error("fscss[exec(console)]: Error executing transformed code:",e)}return r}function u(e){const n={},r=/@event\s+([\w-]+)\(([^)]*)\)\s*:?{/g;let s,t=e;const o=[];for(;null!==(s=r.exec(e));){const r=s[1],t=s[2],c=s.index+s[0].length-1;if(c>=e.length){console.warn(`fscss[parsing] Warning: Unexpected end of CSS after @event ${r} definition.`);continue}const i=a(e,c);if(0===i.length||"}"!==i[i.length-1]){console.warn(`fscss[parsing] Warning: Malformed block for @event '${r}'. Missing closing '}'.`);continue}e.slice(s.index,c+i.length);const f=l(i),u=t.split(",").map((e=>e.trim())).filter((e=>""!==e));n[r]&&console.warn(`fscss[definition] Warning: Duplicate @event definition for '${r}'. The last one will be used.`),n[r]={args:u,conditionBlocks:f},o.push([s.index,c+i.length])}for(let e=o.length-1;e>=0;e--){const[n,r]=o[e];t=t.slice(0,n)+t.slice(r)}return t=t.replace(/@event\.([\w-]+)\(([^)]*)\)/g,((e,r,s)=>{const t=n[r];if(!t)return console.warn(`fscss[call] Warning: @event function '${r}' not found during call.`),e;const o={},c=s.split(",").map((e=>e.trim())).filter((e=>""!==e));c.length!==t.args.length&&console.warn(`fscss[call] Warning: Argument count mismatch for @event '${r}'. Expected ${t.args.length}, got ${c.length}.`),t.args.forEach(((e,n)=>{void 0!==c[n]?o[e]=c[n]:console.warn(`fscss[call] Warning: Missing value for argument '${e}' in @event '${r}' call.`)}));let i="",a=!1,l=!1;for(const e of t.conditionBlocks)if("el"===e.type&&(l&&console.warn(`fscss[logic] Warning: Multiple 'el' (else) blocks found in @event '${r}'. Only the first 'el' block will be considered.`),l=!0),!a||"el"===e.type){if("el"===e.type){if(a)continue;a=!0}else{const n=e.condition.split(",").map((e=>e.trim())).filter((e=>""!==e));0===n.length?(console.warn(`fscss[logic] Warning: Empty condition in '${e.type}' block for @event '${r}'.`),a=!0):a=n.every((e=>{const n=e.match(/^(\w+)\s*(==|!=|>=|<=|>|<)\s*([^]+)$/);if(!n){const n=e.split(":").map((e=>e.trim()));if(2!==n.length)return console.warn(`fscss[logic] Warning: Malformed condition '${e}' in @event '${r}'. Expected 'variable operator value' or 'variable:value'.`),!1;const[s,t]=n;return s in o?o[s]===t:(console.warn(`fscss[logic] Warning: Condition variable '${s}' not provided in @event '${r}' context. Treating as false.`),!1)}{const[,e,s,t]=n;if(!(e in o))return console.warn(`fscss[logic] Warning: Condition variable '${e}' not provided in @event '${r}' context. Treating as false.`),!1;const c=o[e],i=isNaN(c)?c:Number(c),a=isNaN(t)?t:Number(t);switch(s){case"==":return i==a;case"!=":return i!=a;case">":return i>a;case"<":return i<a;case">=":return i>=a;case"<=":return i<=a;default:return!1}}}))}if(a){const n=e.block.match(/(\w+)\s*(?:\:\s*([^;]*);?|\|([^\|]+)\|?)/);n&&n[2]?i=n[2].trim():n&&n[3]?i=n[3].trim():console.warn(`fscss[logic] Warning: No valid CSS property assignment found in matched block for @event '${r}'. Block content: '${e.block}'.`);break}}return!i&&t.conditionBlocks.length>0&&!a?console.warn(`fscss[call] Warning: No condition matched for @event '${r}' with provided arguments. Returning original call string.`):i||0!==t.conditionBlocks.length||console.warn(`fscss[definition] Warning: @event '${r}' has no condition blocks defined. Returning original call string.`),i||e})),t.trim()}async function p(e){return e=(e=(e=(e=(e=e.replace(/exec\(\s*_init\sisjs\s*\)/g,"exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/isjs.fscss)")).replace(/exec\(\s*_init\sthemes\s*\)/g,"exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/trshapes.fthemes.fscss)")).replace(/exec\(_init\sarray1to500\s*\)/g,"exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/1to500.fscss)")).replace(/exec\(_init\s+([\w\d\._—\-\%\*\+\&\$\=]+)(?:\/([\w\-]+))?\s*\)/g,((e,n,r)=>r?`exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${n}.${r})`:`exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${n}.fscss)`))).replace(/(\@import\((?:\s+)?(?:exec)?\((?:[\w\d\.\@\—\-_*\#\$\s\,]+)\)(?:\s+)?from(?:\s+)?)([\w\d\._—\-\%\*\+\&\$\=]+)(?:\/([\w\-]+))?(?:\s+)?\)/g,((e,n,r,s)=>s?`${n}'https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${r}.${s}')`:`${n}'https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${r}.fscss')`))}function $(e){const n=/@define\s+([\w\_\-\—]+)\s*\(([^)]*)\)\s*\$?\{\s*(?:"([^"]*)"|'([^']*)'|`([^`]*)`|([^\}^\{]*?))\s*\}/g;let r=e.replace(n,((e,n,r,s,t,c,i)=>{const a=r.split(",").map((e=>e.trim())).filter((e=>e)),l=s??t??c??i??"";return o[n]={params:a,body:l},""}));return r=r.replace(/@([\w\_\-\—]+)\s*\(([\s\S]*?)\)/g,((e,n,r)=>{const s=o[n];if(!s)return e;const t=r?.split(",").map((e=>e.trim()));""===t[0]&&(t[0]=void 0);let c=s.body,i=[];return s.params.forEach(((e,n)=>{const r=s.params[n];r&&r.includes(":")&&(i=r?.split(":")?.map((e=>e.trim())).filter((e=>e)));const o=i[1]?i[1]:"",a=void 0!==t[n]?t[n]:o,l=new RegExp(`@use\\(\\s*${e.replace(/(\s+)?(\:(\s+)?.*)/g,"")}\\s*\\)`,"g");c=c.replace(l,a)})),c})),n.test(r)?$(r):r}function d(e){let n={},r=e;return r=r.replace(/("(?:[^"\\]|\\.)*")|('(?:[^'\\]|\\.)*')/g,(function(e){let r=e[0],s=e.slice(1,-1);const t=/@ext\((-?\d+),(\d+):\s*([^)]+)\)/g;let o,c=[];for(;null!==(o=t.exec(s));)c.push({fullMatch:o[0],start:parseInt(o[1]),length:parseInt(o[2]),varName:o[3].trim(),index:o.index});for(let e=c.length-1;e>=0;e--){let r=c[e],t=r.start<0?s.length+r.start:r.start;t=Math.max(0,t);let o=s.substring(t,t+r.length);(t+r.length>s.length||t<0)&&console.warn(`fscss:[@ext]Warning: @ext directive for variable '${r.varName}' in string literal specifies an out-of-bounds range. Extraction may be incomplete or incorrect.`),void 0!==n[r.varName]&&console.warn(`fscss:[@ext]Warning: Duplicate variable name '${r.varName}' found in string literal. The last extracted value will be used.`),n[r.varName]=o,s=s.slice(0,r.index)+s.slice(r.index+r.fullMatch.length)}return r+s+r})),r=r.replace(/([#.\w-]+)\s*@ext\((-?\d+),(\d+):\s*([^)]+)\)/g,(function(e,r,s,t,o){s=parseInt(s),t=parseInt(t),o=o.trim();let c=s<0?r.length+s:s;c=Math.max(0,c);let i=r.substring(c,c+t);return(c+t>r.length||c<0)&&console.warn(`fscss:[@ext]Warning: @ext directive for variable '${o}' on token '${r}' specifies an out-of-bounds range. Extraction may be incomplete or incorrect.`),void 0!==n[o]&&console.warn(`fscss:[@ext]Warning: Duplicate variable name '${o}' found outside string literals. The last extracted value will be used.`),n[o]=i,r})),r=r.replace(/@ext\.(\w+)\!?/g,(function(e,r){return void 0===n[r]?(console.warn(`fscss:[@ext]Warning: Reference to undefined variable '@ext.${r}'. It will not be replaced.`),e):n[r]})),r}function g(e){const n=/@arr\(?\s*([\w\-_—0-9]+)\)?\[([^\]]+)\]\)?/g;let r;for(;null!==(r=n.exec(e));){const e=r[1],n=r[2].split(",").map((e=>e.trim()));s[e]=n}let t=e;return t=t.replace(/@arr\.([\w\-_—0-9]+)(?:\!\s*\+\s*\[([^\]]+)?\])/g,((e,n,r)=>s[n]?r?(newItems=r.split(",").map((e=>e.trim())),s[n].push(...newItems),""):(console.warn(`[FSCSS Warning] @arr push failed → Invalid or empty value at "${e}"`),e):(console.warn(`fscss[@arr] Warning: Array '${n}' not found.`),e))),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:\!\s*\-\s*\[([\d\w\-_—\s]+)?\])/g,((e,n,r)=>{const t=s[n];return t?!(r=Number(r?.trim()))||r<1||!Number(r)?(console.warn(`[FSCSS Warning] @arr splice failed → Invalid or empty index at "${e}"`),e):r>t.length?(console.warn(`[FSCSS Warning] @arr → @arr.${n}[${r}] is undefined at "${e}"`),""):(r-=1,t.splice(r,1),""):(console.warn(`fscss[@arr] Warning: Array '${n}' not found.`),e)})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:\!\s*\.(length|last|reverse|first|list|indices|randint|segment|sum|unique|sort|shuffle|min|max))/g,((e,n,r)=>{const t=s[n];if(!t)return console.warn(`fscss[@arr] Warning: Array '${n}' not found.`),e;if(r){if("length"===r)return t.length;if("first"===r)return t[0];if("last"===r)return t.at(-1);if("indices"===r)return Array(t.length).fill().map(((e,n)=>1*(n+1)));if("list"===r)return t.join(",");if("reverse"===r)return t.toReversed().join(",");if("randint"===r)return t[Math.floor(Math.random()*t.length)];if("segment"===r)return t.map((e=>`[${e}]`)).join("");if("unique"===r)return[...new Set(t)].join(",");if("sort"===r)return t.slice().sort().join(",");if("shuffle"===r)return t.slice().sort((()=>Math.random()-.5)).join(",");if("sum"===r)return t.reduce(((e,n)=>e+Number(n)),0);if("min"===r)return Math.min(...t.map(Number));if("max"===r)return Math.max(...t.map(Number))}})),t=t.replace(/([^\{\}]+)\{\s*([^}]*@arr\.([\w\-_—0-9]+)\[\][^}]*)\s*\}/g,((e,n,r,t)=>{const o=s[t];return o?o.map(((e,s)=>{const o=n.replace(new RegExp(`@arr\\.${t}\\[\\]`,"g"),s+1),c=r.replace(new RegExp(`@arr\\.${t}\\[\\]`,"g"),e);return`${o.trim()} {\n ${c.trim()}\n}`})).join("\n"):(console.warn(`fscss[@arr] Warning: Array '${t}' not found for loop processing.`),e)})),t=t.replace(/@arr\.([\w\-_—0-9]+)\[(\d+)\]/g,((e,n,r)=>{const t=parseInt(r)-1,o=s[n];return o?void 0!==o[t]?o[t]:e:(console.warn(`fscss[@arr] Warning: Array '${n}' not found.`),e)})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.unit)(?:\(([^)]*)\))/g,((e,n,r)=>{const t=s[n];if(!t)return console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e;const o=void 0!==r&&""!==r?r:" ";return t.map((e=>`${e+o}`)).join(",")})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.prefix)(?:\(([^)]*)\))/g,((e,n,r)=>{const t=s[n];if(!t)return console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e;const o=void 0!==r&&""!==r?r:" ";return t.map((e=>`${o+e}`)).join(",")})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.surround)(?:\(([^)]+)\))/g,((e,n,r)=>{const t=s[n];return t?r&&void 0!==r&&""!==r&&r.includes(",")?(surArr=r.split(","),t.map((e=>`${surArr[0]+e+surArr.at(-1)}`)).join(" ")):(console.warn(`[FSCSS Warning] @arr surround failed → Invalid or empty value at "${e}"`),e):(console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e)})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.join)?(?:\(([^)]*)\))/g,((e,n,r)=>{const t=s[n];if(!t)return console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e;const o=void 0!==r&&""!==r?r:" ";return t.join(o)})),t=t.replace(/@arr\.([\w\-_—0-9]+)(!)?/g,((e,n,r)=>{const t=s[n];return t?r?e:`[${t.join(",")}]`:(console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e)})),t.replace(n,"").replace(/\n{3,}/g,"\n\n").trim()}function m(e){const n={};function r(e){const n={},r=e.split(";");for(let e of r){if(e=e.trim(),!e)continue;const r=e.indexOf(":");if(-1===r){console.warn(`fscss[@fun] Invalid style line (missing colon): "${e}"`);continue}const s=e.substring(0,r).trim(),t=e.substring(r+1).trim();s?n[s]=t:console.warn(`fscss[@fun] Empty property name in line: "${e}"`)}return n}const s=/@fun\(([\w\-\_\—0-9]+)\)\s*\{([\s\S]*?)\}\s*/g;let t;for(;null!==(t=s.exec(e));){const e=t[1],s=t[2].trim();n[e]&&console.warn(`fscss[@fun] Duplicate @fun variable declaration: "${e}". The last one will overwrite previous declarations.`),n[e]={raw:s,props:r(s)}}let o=e;return o=o.replace(/@fun\.([\w\-\_\—0-9]+)\.([\w\-\_\—0-9]+)\.value\!?/g,((e,r,s)=>n[r]&&n[r].props[s]?n[r].props[s]:(console.warn(`fscss[@fun] Value extraction failed for "@fun.${r}.${s}.value". Variable or property not found.`),e))),o=o.replace(/@fun\.([\w\-\_\—0-9]+)\.([\w\-\_\—0-9]+)\!?/g,((e,r,s)=>n[r]&&n[r].props[s]?`${s}: ${n[r].props[s]};`:(console.warn(`fscss[@fun] Single property rule failed for "@fun.${r}.${s}". Variable or property not found.`),e))),o=o.replace(/@fun\.([\w\-\_\—0-9]+)(?=[\s;}])\!?/g,((e,r)=>n[r]?n[r].raw:(console.warn(`[@fun] Full variable block replacement failed for "@fun.${r}". Variable not found.`),e))),o=o.replace(/@fun\(([\w\-\_\d\—]+)\s*\{[\s\S]*?\}\s*/g,""),o=o.replace(/^\s*[\r\n]/gm,""),o=o.trim(),o}function w(e){const n=new Set,r=e.replace(/(:\s*)(["']?)(.*?)(["']?)\s*copy\(([-]?\d+),\s*([^\;^\)^\(^,^ ]*)\)/g,((e,r,s,t,o,c,i)=>{const a=parseInt(c),l=i.replace(/[^a-zA-Z0-9_-]/g,"");let f="";return f=a>=0?t.substring(0,a):t.substring(t.length+a),n.add(`--${l}:${f};`),`${r}${s}${t}${o}`}));if(n.size>0){return r+`\n${`:root{${Array.from(n).join("\n")}\n}`}`}return r}function h(e){const n=new Map;let r,s=e.replace(/(?:store|str|re)\(\s*([^:,]+)\s*[,:]\s*(?:"([^"]*)"|'([^']*)')\s*\)/gi,((e,r,s,t)=>{const o=s||t;return r=r.trim(),n.set(r,o),""}));if(0===n.size)return s;let t=0;let o=s;do{r=!1;for(const[e,s]of n.entries()){const n=new RegExp(`\\b${c=e,c.replace(/[.*+?^${}|[\]\\]/g,"\\$&")}\\b`,"g"),t=o.replace(n,s);t!==o&&(r=!0,o=t)}t++}while(r&&t<100);var c;return t>=100&&console.warn("Maximum iterations reached. Possible circular dependency."),o}function x(e){return e=e.replace(/(?:mxs|\$p)\((([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,\s*)?("([^"]*)"|'([^']*)')\)/gi,"$2:$14$15;$4:$14$15;$6:$14$15;$8:$14$15;$10:$14$15;$12:$14$15;").replace(/(?:mx|\$m)\((([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,\s*)?("([^"]*)"|'([^']*)')\)/gi,"$2$14$15$4$14$15$6$14$15$8$14$15$10$14$15$12$14$15").replace(/rpt\((\d+)\,\s*("([^"]*)"|'([^']*)')\)/gi,((e,n,r)=>function(e,n){return e.replace(/^['"]|['"]$/g,"").repeat(Math.max(0,parseInt(n)))}(r,n))).replace(/\$(([\_\-\d\w]+)\:(\"[^\"]*\"|\'[^\']*\'|[^\;]*)\;)/gi,":root{--$1}").replace(/\$([^\!\s]+)!/gi,"var(--$1)").replace(/\$([\w\-\_\d]+)/gi,"var(--$1)").replace(/\-\*\-(([^\:]+)\:(\"[^\"]*\"|\'[^\']*\'|[^\;]*)\;)/gi,"-webkit-$1-moz-$1-ms-$1-o-$1").replace(/%i\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\]\[]*)\,)?(([^\,\]\[]*)\,)?(([^\,\[\]]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$21$4$21$6$21$8$21$10$21$12$21$14$21$16$21$18$21$20$21").replace(/%6\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\]\[]*)\,)?(([^\,\]\[]*)\,)?(([^\,\[\]]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$13$4$13$6$13$8$13$10$13$12$13").replace(/%5\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\]\[]*)\,)?(([^\,\]\[]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$11$4$11$6$11$8$11$10$11").replace(/%4\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$9$4$9$6$9$8$9").replace(/%3\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$7$4$7$6$7").replace(/%2\((([^\,\[\]]*)\,)?(([^\,\]\[]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$5$4$5").replace(/%1\((([^\,\]\[]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$3"),e=(e=e.replace(/%(\d+)\(([^[]+)\[\s*([^\]]+)\]\)/g,((e,n,r,s)=>{const t=r.split(",").map((e=>e.trim()));return t.length!=n?(console.warn(`Number of properties ${t.length} does not match %${n}`),e):t.map((e=>`${e}${s}`)).join("")}))).replace(/\$\(\s*@keyframes\s*(\S+)\)/gi,"$1{animation-name:$1;}@keyframes $1").replace(/\$\(\s*(\@[\w\-\*]*)\s*([^\{\}\,&]*)(\s*,\s*[^\{\}&]*)?&?(\[([^\{\}]*)\])?\s*\)/gi,"$2$3{animation:$2 $5;}$1 $2").replace(/\$\(\s*--([^\{\}]*)\)/gi,"$1").replace(/\$\(([^\:]*):\s*([^\)\:]*)\)/gi,"[$1='$2']").replace(/g\(([^"'\s]*)\,\s*(("([^"]*)"|'([^']*)')\,\s*)?("([^"]*)"|'([^']*)')\s*\)/gi,"$1 $4$5$1 $7$8").replace(/\$\(([^\:]*):\s*([^\)\:]*)\)/gi,"[$1='$2']").replace(/\$\(([^\:^\)]*)\)/gi,"[$1]")}async function b(e){const n=[".fscss",".css",".txt",".scss",".less","xfscss"],r=/@import\(exec\(([^)]+)\)\s*\.\s*(?:pick|find)\(([^)]+)\)\)/g,s=[...(e=await p(e)).matchAll(r)];let t=e,o=null;for(const e of s){const[r,s,c]=e;if(o=s,i.has(o)){const e=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp("@import\\(exec\\(("+e+")\\)\\s*\\.\\s*(?:pick|find)\\(([^)]+)\\)\\)","g");t=t.replace(n,`/* Can't import ${o} multiple times */`),console.warn(`[FSCSS Warning] Can't import ${o} multiple times at `)}try{const e=s.replace(/["']/g,""),o=e.slice(e.lastIndexOf(".")).toLowerCase();if(e.trim().startsWith("_init")&&e.includes(" "))return void console.warn(`fscss[@import] library not found for: ${e}`);if(!n.includes(o))return void console.warn(`fscss[@import] invalid extension for: ${e}`);const i=await fetch(e);if(!i.ok)throw new Error(`fscss[@import] HTTP ${i.status} for ${s}`);const a=v(await i.text(),c.trim());t=t.replace(r,a)}catch(e){console.error(`fscss[@import] Failed: ${s} `,e),t=t.replace(r,`/* Failed import: ${s} */`)}}return t.match(r)?(i.add(o),b(t)):t}function v(e,n){const r=new RegExp(`${n}\\s*{[^}]*}`,"g"),s=e.match(r);return s?s.join("\n"):console.warn(`fscss[@import pick] No block matches: ${n} `)}const S=new Set;async function y(e){const n=/\@import\((?:\s+)?exec\((?:\s+)?(?:"([^"]+)"|'([^']+)'|`([^`]+)`|([^\)]+)(?:\s+)?)\)(?:\s+)?\)/g,r=[...(e=await p(e)).matchAll(n)];let s=e,t=null;for(const e of r){let[n,r,o,c,i]=e;const a=(r||o||c||i).trim();if(t=a,S.has(t)){const e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp('\\@import\\((?:\\s+)?exec\\((?:\\s+)?(?:"('+e+")\"|'("+e+")'|`("+e+")`|("+e+")(?:\\s+)?)\\)(?:\\s+)?\\)","g");s=s.replace(n,`/* Can't import ${t} multiple times */`),console.warn(`[FSCSS Warning] Can't import ${t} multiple times at `)}try{const e=await fetch(a);if(!e.ok)throw new Error(`fscss[@import] HTTP ${e.status} for ${a}`);const r=await e.text();s=s.replace(n,r)}catch(e){console.error(`fscss[@import] Failed: ${a} `,e),s=s.replace(n,`/* Failed import: ${a} */`)}}return s.match(n)?(S.add(t),y(s)):s}async function k(e){const n=/\@import\((?:\s+)?(?:exec)?\(([\w\d\.\@\—\-_*\#\$\s\,]+)\)(?:\s+)?from(?:\s+)?(?:"([^"]+)"|'([^']+)'|`([^`]+)`)(?:\s+)?\)/g,r=[...(e=await p(e)).matchAll(n)];let s=e,t=null;for(const e of r){let[n,r,o,i,a]=e;r=r.trim();const l=(o||i||a).trim();if(t=l,c.has(t)){const e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp('\\@import\\((?:\\s+)?(?:exec)?\\(([\\w\\d\\.\\@\\—\\-_*\\#\\$\\s\\,]+)\\)(?:\\s+)?from(?:\\s+)?(?:"((?:\\s+)?'+e+"(?:\\s+)?)\"|'((?:\\s+)?"+e+"(?:\\s+)?)'|`((?:\\s+)?"+e+"(?:\\s+)?)`)(?:\\s+)?\\)","g");s=s.replace(n,`/* Can't import ${t} multiple times */`),console.warn(`[FSCSS Warning] Can't import ${t} multiple times at `)}try{const e=await fetch(l);if(!e.ok)throw new Error(`fscss[@import] HTTP ${e.status} for ${l}`);const t=await e.text();if("*"===r&&(s=s.replace(n,t)),"*"!==r&&r.includes("*")&&(console.warn(`[FSCSS Warning] syntax error at ${n}: unexpected *`),s=s.replace(n,"/* syntax error: unexpected * */")),"*"!==r&&!r.includes("*")){const e=j(t,r.split(",").map((e=>e.trim())));s=s.replace(n,e)}}catch(e){console.error(`fscss[@import] Failed: ${l} `,e),s=s.replace(n,`/* Failed import: ${l} */`)}}return s.match(n)?(c.add(t),k(s)):s}function j(e,n=[]){if(!e||""===e||"string"!=typeof e)return console.warn("FSCSS >Invalid input");if(!n||0===n.length)return console.warn("FSCSS >Invalid input");let r="";return n.forEach((n=>{let s="",t=n;const o=n.trim().match(/([^\s]+)(?:\s+as\s+([^\s]+))?/);if(o){const[e,r,c]=o;t=r,c?s=c:n.includes(" as")?(console.warn(`[FSCSS Warning] Can't assign @${r} to invalid or empty value`),s=r):s=r}const c=new RegExp("@define\\s+("+t+")\\s*\\(([^)]*)\\)\\s*\\$?\\{\\s*(?:\"([^\"]*)\"|'([^']*)'|`([^`]*)`|([^\\}^\\{]*?))\\s*\\}","g"),i=e.match(c);if(!i)return console.warn(`[FSCSS Warning] @${t} is undefined for import`);const a=new RegExp("(@define\\s+)("+t+")(\\s*\\(([^)]*)\\)\\s*\\$?\\{\\s*(?:\"([^\"]*)\"|'([^']*)'|`([^`]*)`|([^\\}^\\{]*?))\\s*\\})","g");r+=i.join("\n").replace(a,((e,n,r,t)=>`${n}${s}${t}`))+"\n"})),r.trim()}try{await async function(){const s=document.querySelectorAll("style");if(s.length)for(const o of s){let s=o.textContent;s.includes("exec.obj.block(all)")||(s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import pick)")||(s=await b(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import from)")||(s=await k(s)),s.includes("exec.obj.block(f import)")||(s=await y(s)),s.includes("exec.obj.block(vfc)")||(s=s.replace(/([\w-]+:\s*)(\$\/?[\w-]+!?)(\s*\|\|\s*([^\n\};]+))?/g,((e,n,r,s,t)=>/^\$\/[\w-]+!?$/.test(r)?(r.endsWith("!")&&t&&console.warn(`fscss[VFC]: Required variable "${r}" should not have fallback (${t})`),s&&!t?.trim()?(console.warn(`fscss[VFC]: Empty fallback in -> ${e}`),e):(t?.includes("$/")&&!/^\$\/[\w-]+!?$/.test(t.trim())&&console.warn(`fscss[VFC]: Invalid fallback variable syntax -> ${t}`),t?`${n}${t.trim()};${n}${r}`:`${n}${r}`)):(console.warn(`fscss[VFC]: Invalid variable escape syntax -> ${r} at ${e}`),e)))),s.includes("exec.obj.block(store:before)")&&s.includes("exec.obj.block(store)")||(s=h(s)),s.includes("exec.obj.block(ext:before)")&&s.includes("exec.obj.block(ext)")||(s=d(s)),s.includes("exec.obj.block(f var)")||(s=function(e){const n={},r=[],s=e.split("\n");let t=!1;const o={};for(let e=0;e<s.length;e++){let c=s[e].trim();if(c.includes("{")){t=!0,r.push(c);continue}if(c.includes("}")){t=!1;for(const e in o)delete o[e];r.push(c);continue}const i=/^\s*\$([a-zA-Z0-9_-]+)\s*:\s*([^;]+);/,a=c.match(i);if(a){const[,e,s]=a;t?o[e]=s.trim():(n[e]=s.trim(),r.push(c));continue}const l=/\$\/?([a-zA-Z0-9_-]+)(!)?/g;c=c.replace(l,((e,r)=>void 0!==o[r]?o[r]:void 0!==n[r]?n[r]:e)),r.push(c)}return{css:r.join("\n"),getVariable:function(e){return n[e]||null}}}(s).css),s.includes("exec.obj.block(fun)")||(s=m(s)),s.includes("exec.obj.block(length)")||(s=n(s)),s.includes("exec.obj.block(count)")||(s=e(s)),s.includes("exec.obj.block(define)")||(s=$(s)),s.includes("exec.obj.block(arr)")||(s=g(s)),s.includes("exec.obj.block(event)")||(s=u(s)),s.includes("exec.obj.block(random)")||(s=s.replace(/@random\(\[([^\]]+)\](?:, *ordered)?\)/g,((e,n)=>{const r=/, *ordered\)/.test(e),s=n.split(",").map((e=>e.trim()));if(0===s.length)return console.warn("fscss[@random] Warning: Empty array provided for @random. Returning empty string."),"";if(r){const e=s.join(":");t[e]||(t[e]={values:s,index:0},console.warn(`fscss[@random] Warning: New ordered sequence created for [${n}].`));const r=t[e],o=r.values[r.index%r.values.length];return r.index>=r.values.length&&r.index%r.values.length==0&&console.warn(`fscss[@random] Warning: Ordered sequence [${n}] is looping back to the beginning.`),r.index++,o}return s[Math.floor(Math.random()*s.length)]}))),s.includes("exec.obj.block(copy)")||(s=w(s)),s.includes("exec.obj.block(store:after)")&&s.includes("exec.obj.block(store)")||(s=h(s)),s.includes("exec.obj.block(num)")||(s=r(s)),s.includes("exec.obj.block(ext:after)")&&s.includes("exec.obj.block(ext)")||(s=d(s)),s.includes("exec.obj.block(t group)")||(s=x(s)),s.includes("exec.obj.block(length)")||(s=n(s)),s.includes("exec.obj.block(count)")||(s=e(s)),s.includes("exec.obj.block(debug)")||(s=f(s))),s=s.replace(/exec\.obj\.block\([^\)\n]*\)\;?/g,""),o.innerHTML=s}else console.warn("fscss[Obj]\n No <style> elements found.")}(),await void document.querySelectorAll(".draw").forEach((e=>{const n=e.style.color||"#000";e.style.color="transparent",e.style.webkitTextStroke=`2px ${n}`}))}catch(e){console.error("Error processing styles or draw elements:",e)}})()}function applyFscssStyles(){document.querySelectorAll('[type*="fscss"]').forEach((e=>{fetch(e.href).then((e=>e.text())).then((e=>{const n=document.createElement("style");n.textContent=e,document.head.appendChild(n),xfscssProcessorWrap()})).catch((n=>{console.error(`Failed to load FSCSS from ${e.href}`,n)}))}))}function inf({host:e,path:n}){if(!e||!n)return void console.error("Both 'host' and 'path' are required.");const r=e.replace(/github/gi,"gh"),s=n.replace(/\s*->\s*/g,"/").replace(/\n/g,"");loadFScript(`https://cdn.jsdelivr.net/${r}/${s}`)}xfscssProcessorWrap(),applyFscssStyles();
package/e/xfscss.js CHANGED
@@ -1,7 +1,2 @@
1
- function loadFScript(src, async = true){const script=document.createElement('script');script.type='text/javascript';script.async= async;src="https://cdn.jsdelivr.net/gh/Figsh/FSCSS@main/rtF4.js";script.src = src;document.body.appendChild(script);}loadFScript();export function applyFscssStyles() {const fscssLinks=document.querySelectorAll('[type*="fscss"]');fscssLinks.forEach(link => {fetch(link.href).then(response=>response.text()).then(css =>{const style=document.createElement('style');style.textContent = css;document.head.appendChild(style);}).catch(error => {
2
- console.error(`Failed to load FSCSS from ${link.href}`, error);});});}export function inf({ host, path }) {if (!host || !path) {console.error("Both 'host' and 'path' are required.");
3
- return;}const sanitizedHost = host.replace(/github/gi, 'gh');const sanitizedPath = path.replace(/\s*->\s*/g, '/').replace(/\n/g, '');const finalUrl = `https://cdn.jsdelivr.net/${sanitizedHost}/${sanitizedPath}`;loadFScript(finalUrl);
4
- }export function exec({ type = 'text', content, onError, onSuccess }) {if (!content) {const errorText = 'No CSS content or URL provided.';console.error(errorText);if (onError) onError(errorText);
5
- return;
6
- }const style=document.createElement('style');const appendStyle=cssText=> {style.textContent = cssText;document.head.appendChild(style);if (onSuccess)onSuccess(style);};if (type==='text'||type==='auto'|| type==='text/fscss'||type==='text/css'){appendStyle(content);}else if (type==='fromUrl'||type==='URL' ||type==='fromURL'||type==='link') {fetch(content).then(res => {if (!res.ok) throw new Error(`HTTP error! Status: ${res.status}`);
7
- return res.text();}).then(css => appendStyle(css)).catch(err => {console.error(`Failed to load CSS from URL: ${content}`, err);if (onError) onError(err.message);});} else {const errorText = `Unsupported type "${type}". Use "text" or "fromUrl".`;console.error(errorText);if(onError) onError(errorText);}}
1
+ /* FIGSH-FSCSS light, source v3, fscss.devtem.org */
2
+ export function exec({type:e="text",content:n,onError:r,onSuccess:s}){if(!n){const e="No CSS content or URL provided.";return console.error(`[FSCSS] ${e}`),void(r&&r(e))}const t=document.createElement("style"),o=e=>{t.textContent=e,document.head.appendChild(t),s&&s(t),xfscssProcessorWrap()},c=["text","auto","text/fscss","text/css"].includes(e),i=["fromUrl","URL","fromURL","link"].includes(e);if(c)o(n);else if(i)fetch(n).then((e=>{if(!e.ok)throw new Error(`HTTP ${e.status}: ${e.statusText}`);return e.text()})).then(o).catch((e=>{const s=`Failed to load CSS from: ${n}. ${e.message}`;console.error(`[FSCSS] ${s}`),r&&r(s)}));else{const n=`Unsupported type "${e}". Use "text" or "fromUrl".`;console.error(`[FSCSS] ${n}`),r&&r(n)}}function xfscssProcessorWrap(){(async()=>{function e(e){return e=e.replace(/count\(\s*([\d\.]+)\s*(?:,\s*([\d\.]+)?)?\)/g,((e,n,r)=>{return null===r&&(r=1),s=parseInt(n),t=parseInt(r||1),`${Array(s).fill().map(((e,n)=>(n+1)*t))}`;var s,t}))}function n(e){return e=e.replace(/length\((?:([^\)]+)|\s*"([^"]*)"\s*|\s*'([^']*)'\s*)\)/g,((e,n,r,s)=>(n||r||s).length))}function r(e){return e.replace(/num\((.*?)\)/g,((e,n)=>function(e){try{return new Function(`return ${e}`)()}catch(n){return console.error("Invalid expression:",e),e}}(n)))}const s={},t={},o={},c=new Set,i=new Set;function a(e,n){let r=0,s=n;for(;s<e.length&&("{"===e[s]?r++:"}"===e[s]&&r--,0!==r);)s++;return e.slice(n,s+1)}function l(e){const n=[],r=/(if|el-if|el)\s*([^{}]*?)\s*\{([\s\S]*?)\}/g;let s;for(;null!==(s=r.exec(e));)n.push({type:s[1],condition:s[2].trim(),block:s[3].trim()});return n}function f(e){let n="";const r=e.replace(/exec\((_log|_error|_warn|_info),\s*(?:"([^"]*)"|'([^']*)'|([^)]*))\)/g,((e,r,s,t,o)=>{const c=s||t||o;return["_log","_error","_warn","_info"].includes(r)?c?(n+=`console.${r.slice(1)}("${c.replace(/"/g,'\\"')}");\n`,""):(console.warn(`fscss[exec(console)]: Empty argument for method: ${r}`),""):(console.warn(`fscss[exec(console)]: Unsupported method: ${r}`),"")}));if(n)try{new Function(n)()}catch(e){console.error("fscss[exec(console)]: Error executing transformed code:",e)}return r}function u(e){const n={},r=/@event\s+([\w-]+)\(([^)]*)\)\s*:?{/g;let s,t=e;const o=[];for(;null!==(s=r.exec(e));){const r=s[1],t=s[2],c=s.index+s[0].length-1;if(c>=e.length){console.warn(`fscss[parsing] Warning: Unexpected end of CSS after @event ${r} definition.`);continue}const i=a(e,c);if(0===i.length||"}"!==i[i.length-1]){console.warn(`fscss[parsing] Warning: Malformed block for @event '${r}'. Missing closing '}'.`);continue}e.slice(s.index,c+i.length);const f=l(i),u=t.split(",").map((e=>e.trim())).filter((e=>""!==e));n[r]&&console.warn(`fscss[definition] Warning: Duplicate @event definition for '${r}'. The last one will be used.`),n[r]={args:u,conditionBlocks:f},o.push([s.index,c+i.length])}for(let e=o.length-1;e>=0;e--){const[n,r]=o[e];t=t.slice(0,n)+t.slice(r)}return t=t.replace(/@event\.([\w-]+)\(([^)]*)\)/g,((e,r,s)=>{const t=n[r];if(!t)return console.warn(`fscss[call] Warning: @event function '${r}' not found during call.`),e;const o={},c=s.split(",").map((e=>e.trim())).filter((e=>""!==e));c.length!==t.args.length&&console.warn(`fscss[call] Warning: Argument count mismatch for @event '${r}'. Expected ${t.args.length}, got ${c.length}.`),t.args.forEach(((e,n)=>{void 0!==c[n]?o[e]=c[n]:console.warn(`fscss[call] Warning: Missing value for argument '${e}' in @event '${r}' call.`)}));let i="",a=!1,l=!1;for(const e of t.conditionBlocks)if("el"===e.type&&(l&&console.warn(`fscss[logic] Warning: Multiple 'el' (else) blocks found in @event '${r}'. Only the first 'el' block will be considered.`),l=!0),!a||"el"===e.type){if("el"===e.type){if(a)continue;a=!0}else{const n=e.condition.split(",").map((e=>e.trim())).filter((e=>""!==e));0===n.length?(console.warn(`fscss[logic] Warning: Empty condition in '${e.type}' block for @event '${r}'.`),a=!0):a=n.every((e=>{const n=e.match(/^(\w+)\s*(==|!=|>=|<=|>|<)\s*([^]+)$/);if(!n){const n=e.split(":").map((e=>e.trim()));if(2!==n.length)return console.warn(`fscss[logic] Warning: Malformed condition '${e}' in @event '${r}'. Expected 'variable operator value' or 'variable:value'.`),!1;const[s,t]=n;return s in o?o[s]===t:(console.warn(`fscss[logic] Warning: Condition variable '${s}' not provided in @event '${r}' context. Treating as false.`),!1)}{const[,e,s,t]=n;if(!(e in o))return console.warn(`fscss[logic] Warning: Condition variable '${e}' not provided in @event '${r}' context. Treating as false.`),!1;const c=o[e],i=isNaN(c)?c:Number(c),a=isNaN(t)?t:Number(t);switch(s){case"==":return i==a;case"!=":return i!=a;case">":return i>a;case"<":return i<a;case">=":return i>=a;case"<=":return i<=a;default:return!1}}}))}if(a){const n=e.block.match(/(\w+)\s*(?:\:\s*([^;]*);?|\|([^\|]+)\|?)/);n&&n[2]?i=n[2].trim():n&&n[3]?i=n[3].trim():console.warn(`fscss[logic] Warning: No valid CSS property assignment found in matched block for @event '${r}'. Block content: '${e.block}'.`);break}}return!i&&t.conditionBlocks.length>0&&!a?console.warn(`fscss[call] Warning: No condition matched for @event '${r}' with provided arguments. Returning original call string.`):i||0!==t.conditionBlocks.length||console.warn(`fscss[definition] Warning: @event '${r}' has no condition blocks defined. Returning original call string.`),i||e})),t.trim()}async function p(e){return e=(e=(e=(e=(e=e.replace(/exec\(\s*_init\sisjs\s*\)/g,"exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/isjs.fscss)")).replace(/exec\(\s*_init\sthemes\s*\)/g,"exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/trshapes.fthemes.fscss)")).replace(/exec\(_init\sarray1to500\s*\)/g,"exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/1to500.fscss)")).replace(/exec\(_init\s+([\w\d\._—\-\%\*\+\&\$\=]+)(?:\/([\w\-]+))?\s*\)/g,((e,n,r)=>r?`exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${n}.${r})`:`exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${n}.fscss)`))).replace(/(\@import\((?:\s+)?(?:exec)?\((?:[\w\d\.\@\—\-_*\#\$\s\,]+)\)(?:\s+)?from(?:\s+)?)([\w\d\._—\-\%\*\+\&\$\=]+)(?:\/([\w\-]+))?(?:\s+)?\)/g,((e,n,r,s)=>s?`${n}'https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${r}.${s}')`:`${n}'https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${r}.fscss')`))}function $(e){const n=/@define\s+([\w\_\-\—]+)\s*\(([^)]*)\)\s*\$?\{\s*(?:"([^"]*)"|'([^']*)'|`([^`]*)`|([^\}^\{]*?))\s*\}/g;let r=e.replace(n,((e,n,r,s,t,c,i)=>{const a=r.split(",").map((e=>e.trim())).filter((e=>e)),l=s??t??c??i??"";return o[n]={params:a,body:l},""}));return r=r.replace(/@([\w\_\-\—]+)\s*\(([\s\S]*?)\)/g,((e,n,r)=>{const s=o[n];if(!s)return e;const t=r?.split(",").map((e=>e.trim()));""===t[0]&&(t[0]=void 0);let c=s.body,i=[];return s.params.forEach(((e,n)=>{const r=s.params[n];r&&r.includes(":")&&(i=r?.split(":")?.map((e=>e.trim())).filter((e=>e)));const o=i[1]?i[1]:"",a=void 0!==t[n]?t[n]:o,l=new RegExp(`@use\\(\\s*${e.replace(/(\s+)?(\:(\s+)?.*)/g,"")}\\s*\\)`,"g");c=c.replace(l,a)})),c})),n.test(r)?$(r):r}function d(e){let n={},r=e;return r=r.replace(/("(?:[^"\\]|\\.)*")|('(?:[^'\\]|\\.)*')/g,(function(e){let r=e[0],s=e.slice(1,-1);const t=/@ext\((-?\d+),(\d+):\s*([^)]+)\)/g;let o,c=[];for(;null!==(o=t.exec(s));)c.push({fullMatch:o[0],start:parseInt(o[1]),length:parseInt(o[2]),varName:o[3].trim(),index:o.index});for(let e=c.length-1;e>=0;e--){let r=c[e],t=r.start<0?s.length+r.start:r.start;t=Math.max(0,t);let o=s.substring(t,t+r.length);(t+r.length>s.length||t<0)&&console.warn(`fscss:[@ext]Warning: @ext directive for variable '${r.varName}' in string literal specifies an out-of-bounds range. Extraction may be incomplete or incorrect.`),void 0!==n[r.varName]&&console.warn(`fscss:[@ext]Warning: Duplicate variable name '${r.varName}' found in string literal. The last extracted value will be used.`),n[r.varName]=o,s=s.slice(0,r.index)+s.slice(r.index+r.fullMatch.length)}return r+s+r})),r=r.replace(/([#.\w-]+)\s*@ext\((-?\d+),(\d+):\s*([^)]+)\)/g,(function(e,r,s,t,o){s=parseInt(s),t=parseInt(t),o=o.trim();let c=s<0?r.length+s:s;c=Math.max(0,c);let i=r.substring(c,c+t);return(c+t>r.length||c<0)&&console.warn(`fscss:[@ext]Warning: @ext directive for variable '${o}' on token '${r}' specifies an out-of-bounds range. Extraction may be incomplete or incorrect.`),void 0!==n[o]&&console.warn(`fscss:[@ext]Warning: Duplicate variable name '${o}' found outside string literals. The last extracted value will be used.`),n[o]=i,r})),r=r.replace(/@ext\.(\w+)\!?/g,(function(e,r){return void 0===n[r]?(console.warn(`fscss:[@ext]Warning: Reference to undefined variable '@ext.${r}'. It will not be replaced.`),e):n[r]})),r}function g(e){const n=/@arr\(?\s*([\w\-_—0-9]+)\)?\[([^\]]+)\]\)?/g;let r;for(;null!==(r=n.exec(e));){const e=r[1],n=r[2].split(",").map((e=>e.trim()));s[e]=n}let t=e;return t=t.replace(/@arr\.([\w\-_—0-9]+)(?:\!\s*\+\s*\[([^\]]+)?\])/g,((e,n,r)=>s[n]?r?(newItems=r.split(",").map((e=>e.trim())),s[n].push(...newItems),""):(console.warn(`[FSCSS Warning] @arr push failed → Invalid or empty value at "${e}"`),e):(console.warn(`fscss[@arr] Warning: Array '${n}' not found.`),e))),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:\!\s*\-\s*\[([\d\w\-_—\s]+)?\])/g,((e,n,r)=>{const t=s[n];return t?!(r=Number(r?.trim()))||r<1||!Number(r)?(console.warn(`[FSCSS Warning] @arr splice failed → Invalid or empty index at "${e}"`),e):r>t.length?(console.warn(`[FSCSS Warning] @arr → @arr.${n}[${r}] is undefined at "${e}"`),""):(r-=1,t.splice(r,1),""):(console.warn(`fscss[@arr] Warning: Array '${n}' not found.`),e)})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:\!\s*\.(length|last|reverse|first|list|indices|randint|segment|sum|unique|sort|shuffle|min|max))/g,((e,n,r)=>{const t=s[n];if(!t)return console.warn(`fscss[@arr] Warning: Array '${n}' not found.`),e;if(r){if("length"===r)return t.length;if("first"===r)return t[0];if("last"===r)return t.at(-1);if("indices"===r)return Array(t.length).fill().map(((e,n)=>1*(n+1)));if("list"===r)return t.join(",");if("reverse"===r)return t.toReversed().join(",");if("randint"===r)return t[Math.floor(Math.random()*t.length)];if("segment"===r)return t.map((e=>`[${e}]`)).join("");if("unique"===r)return[...new Set(t)].join(",");if("sort"===r)return t.slice().sort().join(",");if("shuffle"===r)return t.slice().sort((()=>Math.random()-.5)).join(",");if("sum"===r)return t.reduce(((e,n)=>e+Number(n)),0);if("min"===r)return Math.min(...t.map(Number));if("max"===r)return Math.max(...t.map(Number))}})),t=t.replace(/([^\{\}]+)\{\s*([^}]*@arr\.([\w\-_—0-9]+)\[\][^}]*)\s*\}/g,((e,n,r,t)=>{const o=s[t];return o?o.map(((e,s)=>{const o=n.replace(new RegExp(`@arr\\.${t}\\[\\]`,"g"),s+1),c=r.replace(new RegExp(`@arr\\.${t}\\[\\]`,"g"),e);return`${o.trim()} {\n ${c.trim()}\n}`})).join("\n"):(console.warn(`fscss[@arr] Warning: Array '${t}' not found for loop processing.`),e)})),t=t.replace(/@arr\.([\w\-_—0-9]+)\[(\d+)\]/g,((e,n,r)=>{const t=parseInt(r)-1,o=s[n];return o?void 0!==o[t]?o[t]:e:(console.warn(`fscss[@arr] Warning: Array '${n}' not found.`),e)})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.unit)(?:\(([^)]*)\))/g,((e,n,r)=>{const t=s[n];if(!t)return console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e;const o=void 0!==r&&""!==r?r:" ";return t.map((e=>`${e+o}`)).join(",")})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.prefix)(?:\(([^)]*)\))/g,((e,n,r)=>{const t=s[n];if(!t)return console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e;const o=void 0!==r&&""!==r?r:" ";return t.map((e=>`${o+e}`)).join(",")})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.surround)(?:\(([^)]+)\))/g,((e,n,r)=>{const t=s[n];return t?r&&void 0!==r&&""!==r&&r.includes(",")?(surArr=r.split(","),t.map((e=>`${surArr[0]+e+surArr.at(-1)}`)).join(" ")):(console.warn(`[FSCSS Warning] @arr surround failed → Invalid or empty value at "${e}"`),e):(console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e)})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.join)?(?:\(([^)]*)\))/g,((e,n,r)=>{const t=s[n];if(!t)return console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e;const o=void 0!==r&&""!==r?r:" ";return t.join(o)})),t=t.replace(/@arr\.([\w\-_—0-9]+)(!)?/g,((e,n,r)=>{const t=s[n];return t?r?e:`[${t.join(",")}]`:(console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e)})),t.replace(n,"").replace(/\n{3,}/g,"\n\n").trim()}function m(e){const n={};function r(e){const n={},r=e.split(";");for(let e of r){if(e=e.trim(),!e)continue;const r=e.indexOf(":");if(-1===r){console.warn(`fscss[@fun] Invalid style line (missing colon): "${e}"`);continue}const s=e.substring(0,r).trim(),t=e.substring(r+1).trim();s?n[s]=t:console.warn(`fscss[@fun] Empty property name in line: "${e}"`)}return n}const s=/@fun\(([\w\-\_\—0-9]+)\)\s*\{([\s\S]*?)\}\s*/g;let t;for(;null!==(t=s.exec(e));){const e=t[1],s=t[2].trim();n[e]&&console.warn(`fscss[@fun] Duplicate @fun variable declaration: "${e}". The last one will overwrite previous declarations.`),n[e]={raw:s,props:r(s)}}let o=e;return o=o.replace(/@fun\.([\w\-\_\—0-9]+)\.([\w\-\_\—0-9]+)\.value\!?/g,((e,r,s)=>n[r]&&n[r].props[s]?n[r].props[s]:(console.warn(`fscss[@fun] Value extraction failed for "@fun.${r}.${s}.value". Variable or property not found.`),e))),o=o.replace(/@fun\.([\w\-\_\—0-9]+)\.([\w\-\_\—0-9]+)\!?/g,((e,r,s)=>n[r]&&n[r].props[s]?`${s}: ${n[r].props[s]};`:(console.warn(`fscss[@fun] Single property rule failed for "@fun.${r}.${s}". Variable or property not found.`),e))),o=o.replace(/@fun\.([\w\-\_\—0-9]+)(?=[\s;}])\!?/g,((e,r)=>n[r]?n[r].raw:(console.warn(`[@fun] Full variable block replacement failed for "@fun.${r}". Variable not found.`),e))),o=o.replace(/@fun\(([\w\-\_\d\—]+)\s*\{[\s\S]*?\}\s*/g,""),o=o.replace(/^\s*[\r\n]/gm,""),o=o.trim(),o}function w(e){const n=new Set,r=e.replace(/(:\s*)(["']?)(.*?)(["']?)\s*copy\(([-]?\d+),\s*([^\;^\)^\(^,^ ]*)\)/g,((e,r,s,t,o,c,i)=>{const a=parseInt(c),l=i.replace(/[^a-zA-Z0-9_-]/g,"");let f="";return f=a>=0?t.substring(0,a):t.substring(t.length+a),n.add(`--${l}:${f};`),`${r}${s}${t}${o}`}));if(n.size>0){return r+`\n${`:root{${Array.from(n).join("\n")}\n}`}`}return r}function h(e){const n=new Map;let r,s=e.replace(/(?:store|str|re)\(\s*([^:,]+)\s*[,:]\s*(?:"([^"]*)"|'([^']*)')\s*\)/gi,((e,r,s,t)=>{const o=s||t;return r=r.trim(),n.set(r,o),""}));if(0===n.size)return s;let t=0;let o=s;do{r=!1;for(const[e,s]of n.entries()){const n=new RegExp(`\\b${c=e,c.replace(/[.*+?^${}|[\]\\]/g,"\\$&")}\\b`,"g"),t=o.replace(n,s);t!==o&&(r=!0,o=t)}t++}while(r&&t<100);var c;return t>=100&&console.warn("Maximum iterations reached. Possible circular dependency."),o}function x(e){return e=e.replace(/(?:mxs|\$p)\((([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,\s*)?("([^"]*)"|'([^']*)')\)/gi,"$2:$14$15;$4:$14$15;$6:$14$15;$8:$14$15;$10:$14$15;$12:$14$15;").replace(/(?:mx|\$m)\((([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,\s*)?("([^"]*)"|'([^']*)')\)/gi,"$2$14$15$4$14$15$6$14$15$8$14$15$10$14$15$12$14$15").replace(/rpt\((\d+)\,\s*("([^"]*)"|'([^']*)')\)/gi,((e,n,r)=>function(e,n){return e.replace(/^['"]|['"]$/g,"").repeat(Math.max(0,parseInt(n)))}(r,n))).replace(/\$(([\_\-\d\w]+)\:(\"[^\"]*\"|\'[^\']*\'|[^\;]*)\;)/gi,":root{--$1}").replace(/\$([^\!\s]+)!/gi,"var(--$1)").replace(/\$([\w\-\_\d]+)/gi,"var(--$1)").replace(/\-\*\-(([^\:]+)\:(\"[^\"]*\"|\'[^\']*\'|[^\;]*)\;)/gi,"-webkit-$1-moz-$1-ms-$1-o-$1").replace(/%i\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\]\[]*)\,)?(([^\,\]\[]*)\,)?(([^\,\[\]]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$21$4$21$6$21$8$21$10$21$12$21$14$21$16$21$18$21$20$21").replace(/%6\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\]\[]*)\,)?(([^\,\]\[]*)\,)?(([^\,\[\]]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$13$4$13$6$13$8$13$10$13$12$13").replace(/%5\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\]\[]*)\,)?(([^\,\]\[]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$11$4$11$6$11$8$11$10$11").replace(/%4\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$9$4$9$6$9$8$9").replace(/%3\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$7$4$7$6$7").replace(/%2\((([^\,\[\]]*)\,)?(([^\,\]\[]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$5$4$5").replace(/%1\((([^\,\]\[]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$3"),e=(e=e.replace(/%(\d+)\(([^[]+)\[\s*([^\]]+)\]\)/g,((e,n,r,s)=>{const t=r.split(",").map((e=>e.trim()));return t.length!=n?(console.warn(`Number of properties ${t.length} does not match %${n}`),e):t.map((e=>`${e}${s}`)).join("")}))).replace(/\$\(\s*@keyframes\s*(\S+)\)/gi,"$1{animation-name:$1;}@keyframes $1").replace(/\$\(\s*(\@[\w\-\*]*)\s*([^\{\}\,&]*)(\s*,\s*[^\{\}&]*)?&?(\[([^\{\}]*)\])?\s*\)/gi,"$2$3{animation:$2 $5;}$1 $2").replace(/\$\(\s*--([^\{\}]*)\)/gi,"$1").replace(/\$\(([^\:]*):\s*([^\)\:]*)\)/gi,"[$1='$2']").replace(/g\(([^"'\s]*)\,\s*(("([^"]*)"|'([^']*)')\,\s*)?("([^"]*)"|'([^']*)')\s*\)/gi,"$1 $4$5$1 $7$8").replace(/\$\(([^\:]*):\s*([^\)\:]*)\)/gi,"[$1='$2']").replace(/\$\(([^\:^\)]*)\)/gi,"[$1]")}async function b(e){const n=[".fscss",".css",".txt",".scss",".less","xfscss"],r=/@import\(exec\(([^)]+)\)\s*\.\s*(?:pick|find)\(([^)]+)\)\)/g,s=[...(e=await p(e)).matchAll(r)];let t=e,o=null;for(const e of s){const[r,s,c]=e;if(o=s,i.has(o)){const e=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp("@import\\(exec\\(("+e+")\\)\\s*\\.\\s*(?:pick|find)\\(([^)]+)\\)\\)","g");t=t.replace(n,`/* Can't import ${o} multiple times */`),console.warn(`[FSCSS Warning] Can't import ${o} multiple times at `)}try{const e=s.replace(/["']/g,""),o=e.slice(e.lastIndexOf(".")).toLowerCase();if(e.trim().startsWith("_init")&&e.includes(" "))return void console.warn(`fscss[@import] library not found for: ${e}`);if(!n.includes(o))return void console.warn(`fscss[@import] invalid extension for: ${e}`);const i=await fetch(e);if(!i.ok)throw new Error(`fscss[@import] HTTP ${i.status} for ${s}`);const a=v(await i.text(),c.trim());t=t.replace(r,a)}catch(e){console.error(`fscss[@import] Failed: ${s} `,e),t=t.replace(r,`/* Failed import: ${s} */`)}}return t.match(r)?(i.add(o),b(t)):t}function v(e,n){const r=new RegExp(`${n}\\s*{[^}]*}`,"g"),s=e.match(r);return s?s.join("\n"):console.warn(`fscss[@import pick] No block matches: ${n} `)}const S=new Set;async function y(e){const n=/\@import\((?:\s+)?exec\((?:\s+)?(?:"([^"]+)"|'([^']+)'|`([^`]+)`|([^\)]+)(?:\s+)?)\)(?:\s+)?\)/g,r=[...(e=await p(e)).matchAll(n)];let s=e,t=null;for(const e of r){let[n,r,o,c,i]=e;const a=(r||o||c||i).trim();if(t=a,S.has(t)){const e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp('\\@import\\((?:\\s+)?exec\\((?:\\s+)?(?:"('+e+")\"|'("+e+")'|`("+e+")`|("+e+")(?:\\s+)?)\\)(?:\\s+)?\\)","g");s=s.replace(n,`/* Can't import ${t} multiple times */`),console.warn(`[FSCSS Warning] Can't import ${t} multiple times at `)}try{const e=await fetch(a);if(!e.ok)throw new Error(`fscss[@import] HTTP ${e.status} for ${a}`);const r=await e.text();s=s.replace(n,r)}catch(e){console.error(`fscss[@import] Failed: ${a} `,e),s=s.replace(n,`/* Failed import: ${a} */`)}}return s.match(n)?(S.add(t),y(s)):s}async function k(e){const n=/\@import\((?:\s+)?(?:exec)?\(([\w\d\.\@\—\-_*\#\$\s\,]+)\)(?:\s+)?from(?:\s+)?(?:"([^"]+)"|'([^']+)'|`([^`]+)`)(?:\s+)?\)/g,r=[...(e=await p(e)).matchAll(n)];let s=e,t=null;for(const e of r){let[n,r,o,i,a]=e;r=r.trim();const l=(o||i||a).trim();if(t=l,c.has(t)){const e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp('\\@import\\((?:\\s+)?(?:exec)?\\(([\\w\\d\\.\\@\\—\\-_*\\#\\$\\s\\,]+)\\)(?:\\s+)?from(?:\\s+)?(?:"((?:\\s+)?'+e+"(?:\\s+)?)\"|'((?:\\s+)?"+e+"(?:\\s+)?)'|`((?:\\s+)?"+e+"(?:\\s+)?)`)(?:\\s+)?\\)","g");s=s.replace(n,`/* Can't import ${t} multiple times */`),console.warn(`[FSCSS Warning] Can't import ${t} multiple times at `)}try{const e=await fetch(l);if(!e.ok)throw new Error(`fscss[@import] HTTP ${e.status} for ${l}`);const t=await e.text();if("*"===r&&(s=s.replace(n,t)),"*"!==r&&r.includes("*")&&(console.warn(`[FSCSS Warning] syntax error at ${n}: unexpected *`),s=s.replace(n,"/* syntax error: unexpected * */")),"*"!==r&&!r.includes("*")){const e=j(t,r.split(",").map((e=>e.trim())));s=s.replace(n,e)}}catch(e){console.error(`fscss[@import] Failed: ${l} `,e),s=s.replace(n,`/* Failed import: ${l} */`)}}return s.match(n)?(c.add(t),k(s)):s}function j(e,n=[]){if(!e||""===e||"string"!=typeof e)return console.warn("FSCSS >Invalid input");if(!n||0===n.length)return console.warn("FSCSS >Invalid input");let r="";return n.forEach((n=>{let s="",t=n;const o=n.trim().match(/([^\s]+)(?:\s+as\s+([^\s]+))?/);if(o){const[e,r,c]=o;t=r,c?s=c:n.includes(" as")?(console.warn(`[FSCSS Warning] Can't assign @${r} to invalid or empty value`),s=r):s=r}const c=new RegExp("@define\\s+("+t+")\\s*\\(([^)]*)\\)\\s*\\$?\\{\\s*(?:\"([^\"]*)\"|'([^']*)'|`([^`]*)`|([^\\}^\\{]*?))\\s*\\}","g"),i=e.match(c);if(!i)return console.warn(`[FSCSS Warning] @${t} is undefined for import`);const a=new RegExp("(@define\\s+)("+t+")(\\s*\\(([^)]*)\\)\\s*\\$?\\{\\s*(?:\"([^\"]*)\"|'([^']*)'|`([^`]*)`|([^\\}^\\{]*?))\\s*\\})","g");r+=i.join("\n").replace(a,((e,n,r,t)=>`${n}${s}${t}`))+"\n"})),r.trim()}try{await async function(){const s=document.querySelectorAll("style");if(s.length)for(const o of s){let s=o.textContent;s.includes("exec.obj.block(all)")||(s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import pick)")||(s=await b(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import from)")||(s=await k(s)),s.includes("exec.obj.block(f import)")||(s=await y(s)),s.includes("exec.obj.block(vfc)")||(s=s.replace(/([\w-]+:\s*)(\$\/?[\w-]+!?)(\s*\|\|\s*([^\n\};]+))?/g,((e,n,r,s,t)=>/^\$\/[\w-]+!?$/.test(r)?(r.endsWith("!")&&t&&console.warn(`fscss[VFC]: Required variable "${r}" should not have fallback (${t})`),s&&!t?.trim()?(console.warn(`fscss[VFC]: Empty fallback in -> ${e}`),e):(t?.includes("$/")&&!/^\$\/[\w-]+!?$/.test(t.trim())&&console.warn(`fscss[VFC]: Invalid fallback variable syntax -> ${t}`),t?`${n}${t.trim()};${n}${r}`:`${n}${r}`)):(console.warn(`fscss[VFC]: Invalid variable escape syntax -> ${r} at ${e}`),e)))),s.includes("exec.obj.block(store:before)")&&s.includes("exec.obj.block(store)")||(s=h(s)),s.includes("exec.obj.block(ext:before)")&&s.includes("exec.obj.block(ext)")||(s=d(s)),s.includes("exec.obj.block(f var)")||(s=function(e){const n={},r=[],s=e.split("\n");let t=!1;const o={};for(let e=0;e<s.length;e++){let c=s[e].trim();if(c.includes("{")){t=!0,r.push(c);continue}if(c.includes("}")){t=!1;for(const e in o)delete o[e];r.push(c);continue}const i=/^\s*\$([a-zA-Z0-9_-]+)\s*:\s*([^;]+);/,a=c.match(i);if(a){const[,e,s]=a;t?o[e]=s.trim():(n[e]=s.trim(),r.push(c));continue}const l=/\$\/?([a-zA-Z0-9_-]+)(!)?/g;c=c.replace(l,((e,r)=>void 0!==o[r]?o[r]:void 0!==n[r]?n[r]:e)),r.push(c)}return{css:r.join("\n"),getVariable:function(e){return n[e]||null}}}(s).css),s.includes("exec.obj.block(fun)")||(s=m(s)),s.includes("exec.obj.block(length)")||(s=n(s)),s.includes("exec.obj.block(count)")||(s=e(s)),s.includes("exec.obj.block(define)")||(s=$(s)),s.includes("exec.obj.block(arr)")||(s=g(s)),s.includes("exec.obj.block(event)")||(s=u(s)),s.includes("exec.obj.block(random)")||(s=s.replace(/@random\(\[([^\]]+)\](?:, *ordered)?\)/g,((e,n)=>{const r=/, *ordered\)/.test(e),s=n.split(",").map((e=>e.trim()));if(0===s.length)return console.warn("fscss[@random] Warning: Empty array provided for @random. Returning empty string."),"";if(r){const e=s.join(":");t[e]||(t[e]={values:s,index:0},console.warn(`fscss[@random] Warning: New ordered sequence created for [${n}].`));const r=t[e],o=r.values[r.index%r.values.length];return r.index>=r.values.length&&r.index%r.values.length==0&&console.warn(`fscss[@random] Warning: Ordered sequence [${n}] is looping back to the beginning.`),r.index++,o}return s[Math.floor(Math.random()*s.length)]}))),s.includes("exec.obj.block(copy)")||(s=w(s)),s.includes("exec.obj.block(store:after)")&&s.includes("exec.obj.block(store)")||(s=h(s)),s.includes("exec.obj.block(num)")||(s=r(s)),s.includes("exec.obj.block(ext:after)")&&s.includes("exec.obj.block(ext)")||(s=d(s)),s.includes("exec.obj.block(t group)")||(s=x(s)),s.includes("exec.obj.block(length)")||(s=n(s)),s.includes("exec.obj.block(count)")||(s=e(s)),s.includes("exec.obj.block(debug)")||(s=f(s))),s=s.replace(/exec\.obj\.block\([^\)\n]*\)\;?/g,""),o.innerHTML=s}else console.warn("fscss[Obj]\n No <style> elements found.")}(),await void document.querySelectorAll(".draw").forEach((e=>{const n=e.style.color||"#000";e.style.color="transparent",e.style.webkitTextStroke=`2px ${n}`}))}catch(e){console.error("Error processing styles or draw elements:",e)}})()}function applyFscssStyles(){document.querySelectorAll('[type*="fscss"]').forEach((e=>{fetch(e.href).then((e=>e.text())).then((e=>{const n=document.createElement("style");n.textContent=e,document.head.appendChild(n),xfscssProcessorWrap()})).catch((n=>{console.error(`Failed to load FSCSS from ${e.href}`,n)}))}))}export function inf({host:e,path:n}){if(!e||!n)return void console.error("Both 'host' and 'path' are required.");const r=e.replace(/github/gi,"gh"),s=n.replace(/\s*->\s*/g,"/").replace(/\n/g,"");loadFScript(`https://cdn.jsdelivr.net/${r}/${s}`)}xfscssProcessorWrap(),applyFscssStyles();
package/example.css ADDED
@@ -0,0 +1,17 @@
1
+ body{
2
+ Background: #f8f8f8;
3
+ color: #1a1a1a;
4
+ }
5
+
6
+ .container{
7
+ display: flex;
8
+ flex-wrap: wrap;
9
+ justify-content: center;
10
+ align-items: center;
11
+ background: #8C29B2;
12
+ }
13
+ .container .card{
14
+ display: flex;
15
+ justify-content: center;
16
+ background: linear-gradient(40deg, #1E2783,#8C29B2,#C41348);
17
+ }
package/example.fscss CHANGED
@@ -1,25 +1,16 @@
1
- @import(exec(_init themes))
2
- @import(exec(style.fscss).pick(body))
3
- @define card(bg, color: white){
4
- background: @use(bg);
5
- color: @use(color);
6
- padding: 10px;
7
- border-radius: 10px;
8
- }
1
+ @import((*) from "style.fscss")
2
+ @import((
3
+ flex-x,
4
+ flex-wrap-center as fx-wc,
5
+ flex-responsive as fx-r
6
+ ) from flex-control/fscss)
9
7
  @arr colors[#1E2783, #8C29B2, #C41348]
10
- $colors: @arr.colors!;
11
- div{
12
- background: @event.theme(forest);
13
- %2(width, height[: 200px;])
14
- tr Shape: @event.shape(star);
15
- }
16
- .box{
17
- background: radial-gradient(40deg, $colors.list);
18
- }
19
- .box-b{
20
- background: radial-gradient(40deg, $colors.reverse);
21
- }
22
- .card{
23
- @card(#007999)
24
- }
25
- exec(_log, "Hello World!")
8
+ .container{
9
+ @fx-wc()
10
+ background: @random(@arr.colors);
11
+ }
12
+ .container .card{
13
+ @flex-x()
14
+ background: linear-gradient(40deg, @arr.colors!.list);
15
+ }
16
+
package/exec.js CHANGED
@@ -1,10 +1,2 @@
1
- const DOMFSCSSEng = (async ()=>{var fsTc=document.createElement('script');fsTc.type = 'text/javascript';fsTc.async='true';fsTc.src='https://cdn.jsdelivr.net/gh/Figsh/FSCSS@main/rtF4.js';var sTcZB=document.createElement('script');sTcZB.type = 'text/javascript';sTcZB.async='true';sTcZB.text='fs_cssText = (0);';document.body.appendChild(fsTc);fstylesheet=document.querySelectorAll("[type*='fscss']");for(c=0;c<fstylesheet.length;c++){fetch(fstylesheet[c].href).then(response => response.text()).then(data => {document.body.innerHTML+=`<style>${data}</style>`;}).catch(error => {});}
2
- var text ='text';var url ='fromUrl';var fromUrl = 'fromUrl';var write = 'text';function inf(host,jsdl){if(typeof jsdl!=='undefined'&&host!=='undefined'){var ht=host.replace(/github/gi, 'gh');var cov=jsdl.replace(/\s*-\>\s*/g, '/').replace(/\n/g, '');var url=`https://cdn.jsdelivr.net/${ht}/${cov}`;var ScrT=document.createElement('script');ScrT.type='text/javascript';ScrT.async='true';ScrT.src=url;document.body.appendChild(ScrT);}}function exec(text,fscss_style_sheet){if(typeof fscss_style_sheet!=='undefined'&&text=='text'){var doc=document;
3
- const AJWinDocStyleElement = document.createElement("style");
4
- AJWinDocStyleElement.innerHTML = `${fscss_style_sheet}`;
5
- document.head.appendChild(AJWinDocStyleElement);
6
- }else if(typeof fscss_style_sheet!=='undefined'&&text=='fromUrl'){var doc=document;fetch(fscss_style_sheet).then(response =>response.text()).then(data=>{const AJWinDocStyleElement = document.createElement("style");
7
- AJWinDocStyleElement.innerHTML = `${data}`;
8
- document.head.appendChild(AJWinDocStyleElement);}).catch(error=>{});}}
9
- })()
10
-
1
+ /* Figsh-fscss light, source v3, fscss.devtem.org */
2
+ function exec({type:e="text",content:n,onError:r,onSuccess:s}){if(!n){const e="No CSS content or URL provided.";return console.error(`[FSCSS] ${e}`),void(r&&r(e))}const t=document.createElement("style"),o=e=>{t.textContent=e,document.head.appendChild(t),s&&s(t),xfscssProcessorWrap()},c=["text","auto","text/fscss","text/css"].includes(e),i=["fromUrl","URL","fromURL","link"].includes(e);if(c)o(n);else if(i)fetch(n).then((e=>{if(!e.ok)throw new Error(`HTTP ${e.status}: ${e.statusText}`);return e.text()})).then(o).catch((e=>{const s=`Failed to load CSS from: ${n}. ${e.message}`;console.error(`[FSCSS] ${s}`),r&&r(s)}));else{const n=`Unsupported type "${e}". Use "text" or "fromUrl".`;console.error(`[FSCSS] ${n}`),r&&r(n)}}function xfscssProcessorWrap(){(async()=>{function e(e){return e=e.replace(/count\(\s*([\d\.]+)\s*(?:,\s*([\d\.]+)?)?\)/g,((e,n,r)=>{return null===r&&(r=1),s=parseInt(n),t=parseInt(r||1),`${Array(s).fill().map(((e,n)=>(n+1)*t))}`;var s,t}))}function n(e){return e=e.replace(/length\((?:([^\)]+)|\s*"([^"]*)"\s*|\s*'([^']*)'\s*)\)/g,((e,n,r,s)=>(n||r||s).length))}function r(e){return e.replace(/num\((.*?)\)/g,((e,n)=>function(e){try{return new Function(`return ${e}`)()}catch(n){return console.error("Invalid expression:",e),e}}(n)))}const s={},t={},o={},c=new Set,i=new Set;function a(e,n){let r=0,s=n;for(;s<e.length&&("{"===e[s]?r++:"}"===e[s]&&r--,0!==r);)s++;return e.slice(n,s+1)}function l(e){const n=[],r=/(if|el-if|el)\s*([^{}]*?)\s*\{([\s\S]*?)\}/g;let s;for(;null!==(s=r.exec(e));)n.push({type:s[1],condition:s[2].trim(),block:s[3].trim()});return n}function f(e){let n="";const r=e.replace(/exec\((_log|_error|_warn|_info),\s*(?:"([^"]*)"|'([^']*)'|([^)]*))\)/g,((e,r,s,t,o)=>{const c=s||t||o;return["_log","_error","_warn","_info"].includes(r)?c?(n+=`console.${r.slice(1)}("${c.replace(/"/g,'\\"')}");\n`,""):(console.warn(`fscss[exec(console)]: Empty argument for method: ${r}`),""):(console.warn(`fscss[exec(console)]: Unsupported method: ${r}`),"")}));if(n)try{new Function(n)()}catch(e){console.error("fscss[exec(console)]: Error executing transformed code:",e)}return r}function u(e){const n={},r=/@event\s+([\w-]+)\(([^)]*)\)\s*:?{/g;let s,t=e;const o=[];for(;null!==(s=r.exec(e));){const r=s[1],t=s[2],c=s.index+s[0].length-1;if(c>=e.length){console.warn(`fscss[parsing] Warning: Unexpected end of CSS after @event ${r} definition.`);continue}const i=a(e,c);if(0===i.length||"}"!==i[i.length-1]){console.warn(`fscss[parsing] Warning: Malformed block for @event '${r}'. Missing closing '}'.`);continue}e.slice(s.index,c+i.length);const f=l(i),u=t.split(",").map((e=>e.trim())).filter((e=>""!==e));n[r]&&console.warn(`fscss[definition] Warning: Duplicate @event definition for '${r}'. The last one will be used.`),n[r]={args:u,conditionBlocks:f},o.push([s.index,c+i.length])}for(let e=o.length-1;e>=0;e--){const[n,r]=o[e];t=t.slice(0,n)+t.slice(r)}return t=t.replace(/@event\.([\w-]+)\(([^)]*)\)/g,((e,r,s)=>{const t=n[r];if(!t)return console.warn(`fscss[call] Warning: @event function '${r}' not found during call.`),e;const o={},c=s.split(",").map((e=>e.trim())).filter((e=>""!==e));c.length!==t.args.length&&console.warn(`fscss[call] Warning: Argument count mismatch for @event '${r}'. Expected ${t.args.length}, got ${c.length}.`),t.args.forEach(((e,n)=>{void 0!==c[n]?o[e]=c[n]:console.warn(`fscss[call] Warning: Missing value for argument '${e}' in @event '${r}' call.`)}));let i="",a=!1,l=!1;for(const e of t.conditionBlocks)if("el"===e.type&&(l&&console.warn(`fscss[logic] Warning: Multiple 'el' (else) blocks found in @event '${r}'. Only the first 'el' block will be considered.`),l=!0),!a||"el"===e.type){if("el"===e.type){if(a)continue;a=!0}else{const n=e.condition.split(",").map((e=>e.trim())).filter((e=>""!==e));0===n.length?(console.warn(`fscss[logic] Warning: Empty condition in '${e.type}' block for @event '${r}'.`),a=!0):a=n.every((e=>{const n=e.match(/^(\w+)\s*(==|!=|>=|<=|>|<)\s*([^]+)$/);if(!n){const n=e.split(":").map((e=>e.trim()));if(2!==n.length)return console.warn(`fscss[logic] Warning: Malformed condition '${e}' in @event '${r}'. Expected 'variable operator value' or 'variable:value'.`),!1;const[s,t]=n;return s in o?o[s]===t:(console.warn(`fscss[logic] Warning: Condition variable '${s}' not provided in @event '${r}' context. Treating as false.`),!1)}{const[,e,s,t]=n;if(!(e in o))return console.warn(`fscss[logic] Warning: Condition variable '${e}' not provided in @event '${r}' context. Treating as false.`),!1;const c=o[e],i=isNaN(c)?c:Number(c),a=isNaN(t)?t:Number(t);switch(s){case"==":return i==a;case"!=":return i!=a;case">":return i>a;case"<":return i<a;case">=":return i>=a;case"<=":return i<=a;default:return!1}}}))}if(a){const n=e.block.match(/(\w+)\s*(?:\:\s*([^;]*);?|\|([^\|]+)\|?)/);n&&n[2]?i=n[2].trim():n&&n[3]?i=n[3].trim():console.warn(`fscss[logic] Warning: No valid CSS property assignment found in matched block for @event '${r}'. Block content: '${e.block}'.`);break}}return!i&&t.conditionBlocks.length>0&&!a?console.warn(`fscss[call] Warning: No condition matched for @event '${r}' with provided arguments. Returning original call string.`):i||0!==t.conditionBlocks.length||console.warn(`fscss[definition] Warning: @event '${r}' has no condition blocks defined. Returning original call string.`),i||e})),t.trim()}async function p(e){return e=(e=(e=(e=(e=e.replace(/exec\(\s*_init\sisjs\s*\)/g,"exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/isjs.fscss)")).replace(/exec\(\s*_init\sthemes\s*\)/g,"exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/trshapes.fthemes.fscss)")).replace(/exec\(_init\sarray1to500\s*\)/g,"exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/1to500.fscss)")).replace(/exec\(_init\s+([\w\d\._—\-\%\*\+\&\$\=]+)(?:\/([\w\-]+))?\s*\)/g,((e,n,r)=>r?`exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${n}.${r})`:`exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${n}.fscss)`))).replace(/(\@import\((?:\s+)?(?:exec)?\((?:[\w\d\.\@\—\-_*\#\$\s\,]+)\)(?:\s+)?from(?:\s+)?)([\w\d\._—\-\%\*\+\&\$\=]+)(?:\/([\w\-]+))?(?:\s+)?\)/g,((e,n,r,s)=>s?`${n}'https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${r}.${s}')`:`${n}'https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${r}.fscss')`))}function $(e){const n=/@define\s+([\w\_\-\—]+)\s*\(([^)]*)\)\s*\$?\{\s*(?:"([^"]*)"|'([^']*)'|`([^`]*)`|([^\}^\{]*?))\s*\}/g;let r=e.replace(n,((e,n,r,s,t,c,i)=>{const a=r.split(",").map((e=>e.trim())).filter((e=>e)),l=s??t??c??i??"";return o[n]={params:a,body:l},""}));return r=r.replace(/@([\w\_\-\—]+)\s*\(([\s\S]*?)\)/g,((e,n,r)=>{const s=o[n];if(!s)return e;const t=r?.split(",").map((e=>e.trim()));""===t[0]&&(t[0]=void 0);let c=s.body,i=[];return s.params.forEach(((e,n)=>{const r=s.params[n];r&&r.includes(":")&&(i=r?.split(":")?.map((e=>e.trim())).filter((e=>e)));const o=i[1]?i[1]:"",a=void 0!==t[n]?t[n]:o,l=new RegExp(`@use\\(\\s*${e.replace(/(\s+)?(\:(\s+)?.*)/g,"")}\\s*\\)`,"g");c=c.replace(l,a)})),c})),n.test(r)?$(r):r}function d(e){let n={},r=e;return r=r.replace(/("(?:[^"\\]|\\.)*")|('(?:[^'\\]|\\.)*')/g,(function(e){let r=e[0],s=e.slice(1,-1);const t=/@ext\((-?\d+),(\d+):\s*([^)]+)\)/g;let o,c=[];for(;null!==(o=t.exec(s));)c.push({fullMatch:o[0],start:parseInt(o[1]),length:parseInt(o[2]),varName:o[3].trim(),index:o.index});for(let e=c.length-1;e>=0;e--){let r=c[e],t=r.start<0?s.length+r.start:r.start;t=Math.max(0,t);let o=s.substring(t,t+r.length);(t+r.length>s.length||t<0)&&console.warn(`fscss:[@ext]Warning: @ext directive for variable '${r.varName}' in string literal specifies an out-of-bounds range. Extraction may be incomplete or incorrect.`),void 0!==n[r.varName]&&console.warn(`fscss:[@ext]Warning: Duplicate variable name '${r.varName}' found in string literal. The last extracted value will be used.`),n[r.varName]=o,s=s.slice(0,r.index)+s.slice(r.index+r.fullMatch.length)}return r+s+r})),r=r.replace(/([#.\w-]+)\s*@ext\((-?\d+),(\d+):\s*([^)]+)\)/g,(function(e,r,s,t,o){s=parseInt(s),t=parseInt(t),o=o.trim();let c=s<0?r.length+s:s;c=Math.max(0,c);let i=r.substring(c,c+t);return(c+t>r.length||c<0)&&console.warn(`fscss:[@ext]Warning: @ext directive for variable '${o}' on token '${r}' specifies an out-of-bounds range. Extraction may be incomplete or incorrect.`),void 0!==n[o]&&console.warn(`fscss:[@ext]Warning: Duplicate variable name '${o}' found outside string literals. The last extracted value will be used.`),n[o]=i,r})),r=r.replace(/@ext\.(\w+)\!?/g,(function(e,r){return void 0===n[r]?(console.warn(`fscss:[@ext]Warning: Reference to undefined variable '@ext.${r}'. It will not be replaced.`),e):n[r]})),r}function g(e){const n=/@arr\(?\s*([\w\-_—0-9]+)\)?\[([^\]]+)\]\)?/g;let r;for(;null!==(r=n.exec(e));){const e=r[1],n=r[2].split(",").map((e=>e.trim()));s[e]=n}let t=e;return t=t.replace(/@arr\.([\w\-_—0-9]+)(?:\!\s*\+\s*\[([^\]]+)?\])/g,((e,n,r)=>s[n]?r?(newItems=r.split(",").map((e=>e.trim())),s[n].push(...newItems),""):(console.warn(`[FSCSS Warning] @arr push failed → Invalid or empty value at "${e}"`),e):(console.warn(`fscss[@arr] Warning: Array '${n}' not found.`),e))),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:\!\s*\-\s*\[([\d\w\-_—\s]+)?\])/g,((e,n,r)=>{const t=s[n];return t?!(r=Number(r?.trim()))||r<1||!Number(r)?(console.warn(`[FSCSS Warning] @arr splice failed → Invalid or empty index at "${e}"`),e):r>t.length?(console.warn(`[FSCSS Warning] @arr → @arr.${n}[${r}] is undefined at "${e}"`),""):(r-=1,t.splice(r,1),""):(console.warn(`fscss[@arr] Warning: Array '${n}' not found.`),e)})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:\!\s*\.(length|last|reverse|first|list|indices|randint|segment|sum|unique|sort|shuffle|min|max))/g,((e,n,r)=>{const t=s[n];if(!t)return console.warn(`fscss[@arr] Warning: Array '${n}' not found.`),e;if(r){if("length"===r)return t.length;if("first"===r)return t[0];if("last"===r)return t.at(-1);if("indices"===r)return Array(t.length).fill().map(((e,n)=>1*(n+1)));if("list"===r)return t.join(",");if("reverse"===r)return t.toReversed().join(",");if("randint"===r)return t[Math.floor(Math.random()*t.length)];if("segment"===r)return t.map((e=>`[${e}]`)).join("");if("unique"===r)return[...new Set(t)].join(",");if("sort"===r)return t.slice().sort().join(",");if("shuffle"===r)return t.slice().sort((()=>Math.random()-.5)).join(",");if("sum"===r)return t.reduce(((e,n)=>e+Number(n)),0);if("min"===r)return Math.min(...t.map(Number));if("max"===r)return Math.max(...t.map(Number))}})),t=t.replace(/([^\{\}]+)\{\s*([^}]*@arr\.([\w\-_—0-9]+)\[\][^}]*)\s*\}/g,((e,n,r,t)=>{const o=s[t];return o?o.map(((e,s)=>{const o=n.replace(new RegExp(`@arr\\.${t}\\[\\]`,"g"),s+1),c=r.replace(new RegExp(`@arr\\.${t}\\[\\]`,"g"),e);return`${o.trim()} {\n ${c.trim()}\n}`})).join("\n"):(console.warn(`fscss[@arr] Warning: Array '${t}' not found for loop processing.`),e)})),t=t.replace(/@arr\.([\w\-_—0-9]+)\[(\d+)\]/g,((e,n,r)=>{const t=parseInt(r)-1,o=s[n];return o?void 0!==o[t]?o[t]:e:(console.warn(`fscss[@arr] Warning: Array '${n}' not found.`),e)})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.unit)(?:\(([^)]*)\))/g,((e,n,r)=>{const t=s[n];if(!t)return console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e;const o=void 0!==r&&""!==r?r:" ";return t.map((e=>`${e+o}`)).join(",")})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.prefix)(?:\(([^)]*)\))/g,((e,n,r)=>{const t=s[n];if(!t)return console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e;const o=void 0!==r&&""!==r?r:" ";return t.map((e=>`${o+e}`)).join(",")})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.surround)(?:\(([^)]+)\))/g,((e,n,r)=>{const t=s[n];return t?r&&void 0!==r&&""!==r&&r.includes(",")?(surArr=r.split(","),t.map((e=>`${surArr[0]+e+surArr.at(-1)}`)).join(" ")):(console.warn(`[FSCSS Warning] @arr surround failed → Invalid or empty value at "${e}"`),e):(console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e)})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.join)?(?:\(([^)]*)\))/g,((e,n,r)=>{const t=s[n];if(!t)return console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e;const o=void 0!==r&&""!==r?r:" ";return t.join(o)})),t=t.replace(/@arr\.([\w\-_—0-9]+)(!)?/g,((e,n,r)=>{const t=s[n];return t?r?e:`[${t.join(",")}]`:(console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e)})),t.replace(n,"").replace(/\n{3,}/g,"\n\n").trim()}function m(e){const n={};function r(e){const n={},r=e.split(";");for(let e of r){if(e=e.trim(),!e)continue;const r=e.indexOf(":");if(-1===r){console.warn(`fscss[@fun] Invalid style line (missing colon): "${e}"`);continue}const s=e.substring(0,r).trim(),t=e.substring(r+1).trim();s?n[s]=t:console.warn(`fscss[@fun] Empty property name in line: "${e}"`)}return n}const s=/@fun\(([\w\-\_\—0-9]+)\)\s*\{([\s\S]*?)\}\s*/g;let t;for(;null!==(t=s.exec(e));){const e=t[1],s=t[2].trim();n[e]&&console.warn(`fscss[@fun] Duplicate @fun variable declaration: "${e}". The last one will overwrite previous declarations.`),n[e]={raw:s,props:r(s)}}let o=e;return o=o.replace(/@fun\.([\w\-\_\—0-9]+)\.([\w\-\_\—0-9]+)\.value\!?/g,((e,r,s)=>n[r]&&n[r].props[s]?n[r].props[s]:(console.warn(`fscss[@fun] Value extraction failed for "@fun.${r}.${s}.value". Variable or property not found.`),e))),o=o.replace(/@fun\.([\w\-\_\—0-9]+)\.([\w\-\_\—0-9]+)\!?/g,((e,r,s)=>n[r]&&n[r].props[s]?`${s}: ${n[r].props[s]};`:(console.warn(`fscss[@fun] Single property rule failed for "@fun.${r}.${s}". Variable or property not found.`),e))),o=o.replace(/@fun\.([\w\-\_\—0-9]+)(?=[\s;}])\!?/g,((e,r)=>n[r]?n[r].raw:(console.warn(`[@fun] Full variable block replacement failed for "@fun.${r}". Variable not found.`),e))),o=o.replace(/@fun\(([\w\-\_\d\—]+)\s*\{[\s\S]*?\}\s*/g,""),o=o.replace(/^\s*[\r\n]/gm,""),o=o.trim(),o}function w(e){const n=new Set,r=e.replace(/(:\s*)(["']?)(.*?)(["']?)\s*copy\(([-]?\d+),\s*([^\;^\)^\(^,^ ]*)\)/g,((e,r,s,t,o,c,i)=>{const a=parseInt(c),l=i.replace(/[^a-zA-Z0-9_-]/g,"");let f="";return f=a>=0?t.substring(0,a):t.substring(t.length+a),n.add(`--${l}:${f};`),`${r}${s}${t}${o}`}));if(n.size>0){return r+`\n${`:root{${Array.from(n).join("\n")}\n}`}`}return r}function h(e){const n=new Map;let r,s=e.replace(/(?:store|str|re)\(\s*([^:,]+)\s*[,:]\s*(?:"([^"]*)"|'([^']*)')\s*\)/gi,((e,r,s,t)=>{const o=s||t;return r=r.trim(),n.set(r,o),""}));if(0===n.size)return s;let t=0;let o=s;do{r=!1;for(const[e,s]of n.entries()){const n=new RegExp(`\\b${c=e,c.replace(/[.*+?^${}|[\]\\]/g,"\\$&")}\\b`,"g"),t=o.replace(n,s);t!==o&&(r=!0,o=t)}t++}while(r&&t<100);var c;return t>=100&&console.warn("Maximum iterations reached. Possible circular dependency."),o}function x(e){return e=e.replace(/(?:mxs|\$p)\((([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,\s*)?("([^"]*)"|'([^']*)')\)/gi,"$2:$14$15;$4:$14$15;$6:$14$15;$8:$14$15;$10:$14$15;$12:$14$15;").replace(/(?:mx|\$m)\((([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,\s*)?("([^"]*)"|'([^']*)')\)/gi,"$2$14$15$4$14$15$6$14$15$8$14$15$10$14$15$12$14$15").replace(/rpt\((\d+)\,\s*("([^"]*)"|'([^']*)')\)/gi,((e,n,r)=>function(e,n){return e.replace(/^['"]|['"]$/g,"").repeat(Math.max(0,parseInt(n)))}(r,n))).replace(/\$(([\_\-\d\w]+)\:(\"[^\"]*\"|\'[^\']*\'|[^\;]*)\;)/gi,":root{--$1}").replace(/\$([^\!\s]+)!/gi,"var(--$1)").replace(/\$([\w\-\_\d]+)/gi,"var(--$1)").replace(/\-\*\-(([^\:]+)\:(\"[^\"]*\"|\'[^\']*\'|[^\;]*)\;)/gi,"-webkit-$1-moz-$1-ms-$1-o-$1").replace(/%i\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\]\[]*)\,)?(([^\,\]\[]*)\,)?(([^\,\[\]]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$21$4$21$6$21$8$21$10$21$12$21$14$21$16$21$18$21$20$21").replace(/%6\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\]\[]*)\,)?(([^\,\]\[]*)\,)?(([^\,\[\]]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$13$4$13$6$13$8$13$10$13$12$13").replace(/%5\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\]\[]*)\,)?(([^\,\]\[]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$11$4$11$6$11$8$11$10$11").replace(/%4\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$9$4$9$6$9$8$9").replace(/%3\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$7$4$7$6$7").replace(/%2\((([^\,\[\]]*)\,)?(([^\,\]\[]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$5$4$5").replace(/%1\((([^\,\]\[]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$3"),e=(e=e.replace(/%(\d+)\(([^[]+)\[\s*([^\]]+)\]\)/g,((e,n,r,s)=>{const t=r.split(",").map((e=>e.trim()));return t.length!=n?(console.warn(`Number of properties ${t.length} does not match %${n}`),e):t.map((e=>`${e}${s}`)).join("")}))).replace(/\$\(\s*@keyframes\s*(\S+)\)/gi,"$1{animation-name:$1;}@keyframes $1").replace(/\$\(\s*(\@[\w\-\*]*)\s*([^\{\}\,&]*)(\s*,\s*[^\{\}&]*)?&?(\[([^\{\}]*)\])?\s*\)/gi,"$2$3{animation:$2 $5;}$1 $2").replace(/\$\(\s*--([^\{\}]*)\)/gi,"$1").replace(/\$\(([^\:]*):\s*([^\)\:]*)\)/gi,"[$1='$2']").replace(/g\(([^"'\s]*)\,\s*(("([^"]*)"|'([^']*)')\,\s*)?("([^"]*)"|'([^']*)')\s*\)/gi,"$1 $4$5$1 $7$8").replace(/\$\(([^\:]*):\s*([^\)\:]*)\)/gi,"[$1='$2']").replace(/\$\(([^\:^\)]*)\)/gi,"[$1]")}async function b(e){const n=[".fscss",".css",".txt",".scss",".less","xfscss"],r=/@import\(exec\(([^)]+)\)\s*\.\s*(?:pick|find)\(([^)]+)\)\)/g,s=[...(e=await p(e)).matchAll(r)];let t=e,o=null;for(const e of s){const[r,s,c]=e;if(o=s,i.has(o)){const e=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp("@import\\(exec\\(("+e+")\\)\\s*\\.\\s*(?:pick|find)\\(([^)]+)\\)\\)","g");t=t.replace(n,`/* Can't import ${o} multiple times */`),console.warn(`[FSCSS Warning] Can't import ${o} multiple times at `)}try{const e=s.replace(/["']/g,""),o=e.slice(e.lastIndexOf(".")).toLowerCase();if(e.trim().startsWith("_init")&&e.includes(" "))return void console.warn(`fscss[@import] library not found for: ${e}`);if(!n.includes(o))return void console.warn(`fscss[@import] invalid extension for: ${e}`);const i=await fetch(e);if(!i.ok)throw new Error(`fscss[@import] HTTP ${i.status} for ${s}`);const a=v(await i.text(),c.trim());t=t.replace(r,a)}catch(e){console.error(`fscss[@import] Failed: ${s} `,e),t=t.replace(r,`/* Failed import: ${s} */`)}}return t.match(r)?(i.add(o),b(t)):t}function v(e,n){const r=new RegExp(`${n}\\s*{[^}]*}`,"g"),s=e.match(r);return s?s.join("\n"):console.warn(`fscss[@import pick] No block matches: ${n} `)}const S=new Set;async function y(e){const n=/\@import\((?:\s+)?exec\((?:\s+)?(?:"([^"]+)"|'([^']+)'|`([^`]+)`|([^\)]+)(?:\s+)?)\)(?:\s+)?\)/g,r=[...(e=await p(e)).matchAll(n)];let s=e,t=null;for(const e of r){let[n,r,o,c,i]=e;const a=(r||o||c||i).trim();if(t=a,S.has(t)){const e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp('\\@import\\((?:\\s+)?exec\\((?:\\s+)?(?:"('+e+")\"|'("+e+")'|`("+e+")`|("+e+")(?:\\s+)?)\\)(?:\\s+)?\\)","g");s=s.replace(n,`/* Can't import ${t} multiple times */`),console.warn(`[FSCSS Warning] Can't import ${t} multiple times at `)}try{const e=await fetch(a);if(!e.ok)throw new Error(`fscss[@import] HTTP ${e.status} for ${a}`);const r=await e.text();s=s.replace(n,r)}catch(e){console.error(`fscss[@import] Failed: ${a} `,e),s=s.replace(n,`/* Failed import: ${a} */`)}}return s.match(n)?(S.add(t),y(s)):s}async function k(e){const n=/\@import\((?:\s+)?(?:exec)?\(([\w\d\.\@\—\-_*\#\$\s\,]+)\)(?:\s+)?from(?:\s+)?(?:"([^"]+)"|'([^']+)'|`([^`]+)`)(?:\s+)?\)/g,r=[...(e=await p(e)).matchAll(n)];let s=e,t=null;for(const e of r){let[n,r,o,i,a]=e;r=r.trim();const l=(o||i||a).trim();if(t=l,c.has(t)){const e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp('\\@import\\((?:\\s+)?(?:exec)?\\(([\\w\\d\\.\\@\\—\\-_*\\#\\$\\s\\,]+)\\)(?:\\s+)?from(?:\\s+)?(?:"((?:\\s+)?'+e+"(?:\\s+)?)\"|'((?:\\s+)?"+e+"(?:\\s+)?)'|`((?:\\s+)?"+e+"(?:\\s+)?)`)(?:\\s+)?\\)","g");s=s.replace(n,`/* Can't import ${t} multiple times */`),console.warn(`[FSCSS Warning] Can't import ${t} multiple times at `)}try{const e=await fetch(l);if(!e.ok)throw new Error(`fscss[@import] HTTP ${e.status} for ${l}`);const t=await e.text();if("*"===r&&(s=s.replace(n,t)),"*"!==r&&r.includes("*")&&(console.warn(`[FSCSS Warning] syntax error at ${n}: unexpected *`),s=s.replace(n,"/* syntax error: unexpected * */")),"*"!==r&&!r.includes("*")){const e=j(t,r.split(",").map((e=>e.trim())));s=s.replace(n,e)}}catch(e){console.error(`fscss[@import] Failed: ${l} `,e),s=s.replace(n,`/* Failed import: ${l} */`)}}return s.match(n)?(c.add(t),k(s)):s}function j(e,n=[]){if(!e||""===e||"string"!=typeof e)return console.warn("FSCSS >Invalid input");if(!n||0===n.length)return console.warn("FSCSS >Invalid input");let r="";return n.forEach((n=>{let s="",t=n;const o=n.trim().match(/([^\s]+)(?:\s+as\s+([^\s]+))?/);if(o){const[e,r,c]=o;t=r,c?s=c:n.includes(" as")?(console.warn(`[FSCSS Warning] Can't assign @${r} to invalid or empty value`),s=r):s=r}const c=new RegExp("@define\\s+("+t+")\\s*\\(([^)]*)\\)\\s*\\$?\\{\\s*(?:\"([^\"]*)\"|'([^']*)'|`([^`]*)`|([^\\}^\\{]*?))\\s*\\}","g"),i=e.match(c);if(!i)return console.warn(`[FSCSS Warning] @${t} is undefined for import`);const a=new RegExp("(@define\\s+)("+t+")(\\s*\\(([^)]*)\\)\\s*\\$?\\{\\s*(?:\"([^\"]*)\"|'([^']*)'|`([^`]*)`|([^\\}^\\{]*?))\\s*\\})","g");r+=i.join("\n").replace(a,((e,n,r,t)=>`${n}${s}${t}`))+"\n"})),r.trim()}try{await async function(){const s=document.querySelectorAll("style");if(s.length)for(const o of s){let s=o.textContent;s.includes("exec.obj.block(all)")||(s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import pick)")||(s=await b(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import from)")||(s=await k(s)),s.includes("exec.obj.block(f import)")||(s=await y(s)),s.includes("exec.obj.block(vfc)")||(s=s.replace(/([\w-]+:\s*)(\$\/?[\w-]+!?)(\s*\|\|\s*([^\n\};]+))?/g,((e,n,r,s,t)=>/^\$\/[\w-]+!?$/.test(r)?(r.endsWith("!")&&t&&console.warn(`fscss[VFC]: Required variable "${r}" should not have fallback (${t})`),s&&!t?.trim()?(console.warn(`fscss[VFC]: Empty fallback in -> ${e}`),e):(t?.includes("$/")&&!/^\$\/[\w-]+!?$/.test(t.trim())&&console.warn(`fscss[VFC]: Invalid fallback variable syntax -> ${t}`),t?`${n}${t.trim()};${n}${r}`:`${n}${r}`)):(console.warn(`fscss[VFC]: Invalid variable escape syntax -> ${r} at ${e}`),e)))),s.includes("exec.obj.block(store:before)")&&s.includes("exec.obj.block(store)")||(s=h(s)),s.includes("exec.obj.block(ext:before)")&&s.includes("exec.obj.block(ext)")||(s=d(s)),s.includes("exec.obj.block(f var)")||(s=function(e){const n={},r=[],s=e.split("\n");let t=!1;const o={};for(let e=0;e<s.length;e++){let c=s[e].trim();if(c.includes("{")){t=!0,r.push(c);continue}if(c.includes("}")){t=!1;for(const e in o)delete o[e];r.push(c);continue}const i=/^\s*\$([a-zA-Z0-9_-]+)\s*:\s*([^;]+);/,a=c.match(i);if(a){const[,e,s]=a;t?o[e]=s.trim():(n[e]=s.trim(),r.push(c));continue}const l=/\$\/?([a-zA-Z0-9_-]+)(!)?/g;c=c.replace(l,((e,r)=>void 0!==o[r]?o[r]:void 0!==n[r]?n[r]:e)),r.push(c)}return{css:r.join("\n"),getVariable:function(e){return n[e]||null}}}(s).css),s.includes("exec.obj.block(fun)")||(s=m(s)),s.includes("exec.obj.block(length)")||(s=n(s)),s.includes("exec.obj.block(count)")||(s=e(s)),s.includes("exec.obj.block(define)")||(s=$(s)),s.includes("exec.obj.block(arr)")||(s=g(s)),s.includes("exec.obj.block(event)")||(s=u(s)),s.includes("exec.obj.block(random)")||(s=s.replace(/@random\(\[([^\]]+)\](?:, *ordered)?\)/g,((e,n)=>{const r=/, *ordered\)/.test(e),s=n.split(",").map((e=>e.trim()));if(0===s.length)return console.warn("fscss[@random] Warning: Empty array provided for @random. Returning empty string."),"";if(r){const e=s.join(":");t[e]||(t[e]={values:s,index:0},console.warn(`fscss[@random] Warning: New ordered sequence created for [${n}].`));const r=t[e],o=r.values[r.index%r.values.length];return r.index>=r.values.length&&r.index%r.values.length==0&&console.warn(`fscss[@random] Warning: Ordered sequence [${n}] is looping back to the beginning.`),r.index++,o}return s[Math.floor(Math.random()*s.length)]}))),s.includes("exec.obj.block(copy)")||(s=w(s)),s.includes("exec.obj.block(store:after)")&&s.includes("exec.obj.block(store)")||(s=h(s)),s.includes("exec.obj.block(num)")||(s=r(s)),s.includes("exec.obj.block(ext:after)")&&s.includes("exec.obj.block(ext)")||(s=d(s)),s.includes("exec.obj.block(t group)")||(s=x(s)),s.includes("exec.obj.block(length)")||(s=n(s)),s.includes("exec.obj.block(count)")||(s=e(s)),s.includes("exec.obj.block(debug)")||(s=f(s))),s=s.replace(/exec\.obj\.block\([^\)\n]*\)\;?/g,""),o.innerHTML=s}else console.warn("fscss[Obj]\n No <style> elements found.")}(),await void document.querySelectorAll(".draw").forEach((e=>{const n=e.style.color||"#000";e.style.color="transparent",e.style.webkitTextStroke=`2px ${n}`}))}catch(e){console.error("Error processing styles or draw elements:",e)}})()}function applyFscssStyles(){document.querySelectorAll('[type*="fscss"]').forEach((e=>{fetch(e.href).then((e=>e.text())).then((e=>{const n=document.createElement("style");n.textContent=e,document.head.appendChild(n),xfscssProcessorWrap()})).catch((n=>{console.error(`Failed to load FSCSS from ${e.href}`,n)}))}))}function inf({host:e,path:n}){if(!e||!n)return void console.error("Both 'host' and 'path' are required.");const r=e.replace(/github/gi,"gh"),s=n.replace(/\s*->\s*/g,"/").replace(/\n/g,"");loadFScript(`https://cdn.jsdelivr.net/${r}/${s}`)}xfscssProcessorWrap(),applyFscssStyles();
@@ -262,25 +262,30 @@ function procExC(css) {
262
262
 
263
263
  return modifiedCSS.trim();
264
264
  }
265
-
266
- function initlibraries(css){
265
+ async function initlibraries(css){
267
266
  css = css.replace(/exec\(\s*_init\sisjs\s*\)/g, "exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/isjs.fscss)");
268
267
  css = css.replace(/exec\(\s*_init\sthemes\s*\)/g, "exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/trshapes.fthemes.fscss)")
269
268
  css = css.replace(/exec\(_init\sarray1to500\s*\)/g, "exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/1to500.fscss)");
270
269
  css = css.replace(/exec\(_init\s+([\w\d\._—\-\%\*\+\&\$\=]+)(?:\/([\w\-]+))?\s*\)/g, (match, impName, impType)=>{
271
270
  if(!impType){
272
- //`
273
271
  return `exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${impName}.fscss)`;
274
272
  }
275
273
  return `exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${impName}.${impType})`;
276
274
  });
275
+ css = css.replace(/(\@import\((?:\s+)?(?:exec)?\((?:[\w\d\.\@\—\-_*\#\$\s\,]+)\)(?:\s+)?from(?:\s+)?)([\w\d\._—\-\%\*\+\&\$\=]+)(?:\/([\w\-]+))?(?:\s+)?\)/g, (match, state, impName, impType) => {
276
+ if (!impType) {
277
+ return `${state}'https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${impName}.fscss')`;
278
+ }
279
+ return `${state}'https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${impName}.${impType}')`;
280
+ });
277
281
  return css;
278
282
  }
279
283
 
280
284
  function procDef(fscss) {
285
+ const pRegex = /@define\s+([\w\_\-\—]+)\s*\(([^)]*)\)\s*\$?\{\s*(?:"([^"]*)"|'([^']*)'|`([^`]*)`|([^\}^\{]*?))\s*\}/g;
286
+
281
287
  // First, extract all @define blocks and store them in defExfscss. FIGSH-FSCSS
282
- let processed = fscss.replace(
283
- /@define\s+([\w\_\-\—]+)\s*\(([^)]*)\)\s*\$?\{\s*(?:"([^"]*)"|'([^']*)'|`([^`]*)`|([^\}^\{]*?))\s*\}/g,
288
+ let processed = fscss.replace(pRegex,
284
289
  (match, name, paramsStr, body1, body2, body3, body4) => {
285
290
  const params = paramsStr.split(',').map(p =>p.trim()).filter(p =>p);
286
291
  const body = body1 ?? body2 ?? body3 ?? body4 ?? '';
@@ -320,9 +325,11 @@ const dfv = xfVal[1]?xfVal[1]:'';
320
325
  return result;
321
326
  }
322
327
  );
328
+ if(!pRegex.test(processed)) return processed;
323
329
 
324
- return processed;
330
+ return procDef(processed);
325
331
  }
332
+
326
333
  function procVar(vcss) {
327
334
  function processSCSS(scssCode) {
328
335
  const globalVars = {};
@@ -705,7 +712,7 @@ if (obj === "max") {
705
712
  if(fos){
706
713
  return match;
707
714
  }
708
- return arr.join(' ');
715
+ return `[${arr.join(',')}]`;
709
716
  })
710
717
  // Clean up array declarations
711
718
  return output
@@ -0,0 +1,123 @@
1
+ // lip/functions/impFrom.js
2
+
3
+ import fs from "fs/promises";
4
+ import path from "path";
5
+
6
+ import {initlibraries} from "./all.js";
7
+ const runnedSet = new Set();
8
+
9
+ export async function impFrom(text, {inputDir=process.cwd()} = {}) {
10
+ text = await initlibraries(text);
11
+ const regex = /\@import\((?:\s+)?(?:exec)?\(([\w\d\.\@\—\-_*\#\$\s\,]+)\)(?:\s+)?from(?:\s+)?(?:"([^"]+)"|'([^']+)'|`([^`]+)`)(?:\s+)?\)/g;
12
+
13
+ const matches = [...text.matchAll(regex)];
14
+
15
+ let result = text;
16
+ let setFile = null;
17
+
18
+
19
+ for(const match of matches){
20
+ let [fullMatch, blocks, url1, url2, url3] = match;
21
+
22
+ blocks = blocks.trim();
23
+
24
+ const impUrl = (url1||url2||url3).trim();
25
+ setFile = impUrl;
26
+
27
+ if (runnedSet.has(setFile)) {
28
+ // Helper to escape special characters in the filename (like dots or dashes)
29
+ const escapedFile = setFile.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
30
+
31
+ // Simplified regex using \s* for zero-or-more whitespace
32
+ const fregex = new RegExp("\\@import\\((?:\\s+)?(?:exec)?\\(([\\w\\d\\.\\@\\—\\-_*\\#\\$\\s\\,]+)\\)(?:\\s+)?from(?:\\s+)?(?:\"((?:\\s+)?" + escapedFile + "(?:\\s+)?)\"|'((?:\\s+)?" + escapedFile + "(?:\\s+)?)'|`((?:\\s+)?" + escapedFile + "(?:\\s+)?)`)(?:\\s+)?\\)", 'g');
33
+
34
+
35
+ result = result.replace(fregex, `/* Can't import ${setFile} multiple times */`);
36
+
37
+ console.warn(`[FSCSS Warning] Can't import ${setFile} multiple times at `);
38
+ }
39
+
40
+ try {
41
+ let resText;
42
+ if(/^https?:\/\//.test(impUrl)){
43
+ // remote
44
+ const response = await fetch(impUrl);
45
+
46
+ if (!response.ok) throw new Error(`fscss[@import] HTTP ${response.status} for ${impUrl}`);
47
+
48
+ resText = await response.text();
49
+ }
50
+ else{
51
+ // local
52
+ const fillPath = path.resolve(inputDir, impUrl);
53
+ resText = await fs.readFile(fillPath, 'utf8');
54
+ }
55
+ if (blocks === '*') {
56
+ result = result.replace(fullMatch, resText);
57
+ }
58
+ if (blocks !== '*' && blocks.includes('*')) {
59
+ console.warn(`[FSCSS Warning] syntax error at ${fullMatch}: unexpected *`);
60
+ result = result.replace(fullMatch, `/* syntax error: unexpected * */`);
61
+ }
62
+ if (blocks !== '*' && !blocks.includes('*')) {
63
+ const arblock = blocks.split(",").map(a => a.trim());
64
+ const exblocks = await findBlock(resText, arblock);
65
+ result = result.replace(fullMatch, exblocks);
66
+ }
67
+
68
+ } catch (error) {
69
+ console.error(`fscss[@import] Failed: ${impUrl} `, error);
70
+
71
+ result = result.replace(fullMatch, `/* Failed import: ${impUrl} */`);
72
+
73
+ }
74
+ }
75
+ if(!result.match(regex)) return result;
76
+ runnedSet.add(setFile);
77
+ return impFrom(result);
78
+ }
79
+
80
+ async function findBlock(text, blocks = []) {
81
+ if (!text || text === "" || typeof text !== "string") return console.warn("FSCSS >Invalid input");
82
+ if (!blocks || blocks.length === 0) return console.warn("FSCSS >Invalid input");
83
+ let resBlock = '';
84
+
85
+ blocks.forEach(key => {
86
+ let blk = '';
87
+ let keyname = key;
88
+
89
+ //Captures the source, the 'as' keyword, and
90
+ const aliasRegex = /([^\s]+)(?:\s+as\s+([^\s]+))?/;
91
+ const matchAs = key.trim().match(aliasRegex);
92
+
93
+ if (matchAs) {
94
+ const [_, name, alias] = matchAs;
95
+ keyname = name;
96
+ if (alias) {
97
+ blk = alias;
98
+ } else if (key.includes(' as')) {
99
+ // Handles the "func as " (missing alias) case
100
+ console.warn(`[FSCSS Warning] Can't assign @${name} to invalid or empty value`);
101
+ blk = name;
102
+ } else {
103
+ blk = name;
104
+ }
105
+ }
106
+
107
+ const regex = new RegExp('@define\\s+(' + keyname + ')\\s*\\(([^)]*)\\)\\s*\\$?\\{\\s*(?:"([^"]*)"|\'([^\']*)\'|`([^`]*)`|([^\\}^\\{]*?))\\s*\\}', "g");
108
+
109
+ const match = text.match(regex);
110
+ if (!match) {
111
+ return console.warn(`[FSCSS Warning] @${keyname} is undefined for import`);
112
+ }
113
+ const resRegex = new RegExp('(@define\\s+)(' + keyname + ')(\\s*\\(([^)]*)\\)\\s*\\$?\\{\\s*(?:"([^"]*)"|\'([^\']*)\'|`([^`]*)`|([^\\}^\\{]*?))\\s*\\})', 'g');
114
+
115
+ resBlock += (match.join('\n')).replace(resRegex, (m, g1, g2, g3) => {
116
+ return `${g1}${blk}${g3}`;
117
+ }) + '\n';
118
+ })
119
+ return resBlock.trim();
120
+ }
121
+
122
+
123
+
@@ -1,16 +1,38 @@
1
1
  // lib/functions/impSel.js
2
2
  import fs from "fs/promises";
3
3
  import path from "path";
4
+ import { initlibraries } from "./all.js";
5
+ const runnedSetS = new Set();
4
6
 
5
7
  export async function impSel(text, { inputDir = process.cwd() } = {}) {
8
+ text = await initlibraries(text);
6
9
  const validImpExt = [".fscss", ".css", ".txt", ".scss", ".less", ".xfscss"];
7
10
  const regex = /@import\(exec\(([^)]+)\)\s*\.\s*(?:pick|find)\(([^)]+)\)\)/g;
8
11
  const matches = [...text.matchAll(regex)];
9
12
 
13
+
10
14
  let result = text;
11
-
15
+ let setFile = null;
16
+
12
17
  for (const match of matches) {
13
18
  const [fullMatch, urlSrc, part] = match;
19
+
20
+ setFile = urlSrc;
21
+
22
+
23
+ if (runnedSetS.has(setFile)) {
24
+
25
+ // Helper to escape special characters in the filename (like dots or dashes)
26
+ const escapedFile = setFile.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
27
+
28
+ // Simplified regex using \s* for zero-or-more whitespace
29
+ const fregex = new RegExp("@import\\(exec\\(("+escapedFile+")\\)\\s*\\.\\s*(?:pick|find)\\(([^)]+)\\)\\)", 'g');
30
+
31
+
32
+ result = result.replace(fregex, `/* Can't import ${setFile} multiple times */`);
33
+
34
+ console.warn(`[FSCSS Warning] Can't import ${setFile} multiple times at `);
35
+ }
14
36
 
15
37
  try {
16
38
  const impUrl = urlSrc.replace(/["']/g, "");
@@ -49,7 +71,9 @@ export async function impSel(text, { inputDir = process.cwd() } = {}) {
49
71
  }
50
72
  }
51
73
 
52
- return result;
74
+ if(!result.match(regex)) return result;
75
+ runnedSetS.add(setFile);
76
+ return impSel(result);
53
77
  }
54
78
 
55
79
  function extractOnlyBlock(cssText, blockName) {
@@ -1,50 +1,70 @@
1
- import fs from "fs";
2
- import path from "path";
3
- import https from "https";
4
- import http from "http";
5
-
6
- function fetchRemote(url) {
7
- return new Promise((resolve, reject) => {
8
- const client = url.startsWith("https") ? https : http;
9
- client.get(url, res => {
10
- if (res.statusCode !== 200) {
11
- reject(new Error(`Failed to fetch ${url}, status ${res.statusCode}`));
12
- return;
13
- }
14
- let data = "";
15
- res.on("data", chunk => (data += chunk));
16
- res.on("end", () => resolve(data));
17
- }).on("error", reject);
18
- });
19
- }
1
+ // lip/functions/procImp.js
20
2
 
21
- export async function procImp(css, { inputDir }) {
22
- // async replace: collect promises then resolve
23
- const matches = [...css.matchAll(/@import\(exec\(([^)]+)\)\)/g)];
3
+ import fs from "fs/promises";
4
+ import path from "path";
5
+ import { initlibraries } from "./all.js";
6
+ const runnedSetImp = new Set();
24
7
 
8
+ export async function procImp(text, {inputDir=process.cwd()} = {}) {
9
+ text = await initlibraries(text);
10
+ const regex = /\@import\((?:\s+)?exec\((?:\s+)?(?:"([^"]+)"|'([^']+)'|`([^`]+)`|([^\)]+)(?:\s+)?)\)(?:\s+)?\)/g;
11
+
12
+ const matches = [...text.matchAll(regex)];
13
+
14
+ let result = text;
15
+ let setFile = null;
16
+
17
+
25
18
  for (const match of matches) {
26
- const rawPath = match[1].trim();
27
- let importedContent = "";
28
-
29
- if (rawPath.startsWith("http://") || rawPath.startsWith("https://")) {
30
- // remote import
31
- importedContent = await fetchRemote(rawPath);
32
- } else {
33
- // local import
34
- const absPath = path.resolve(inputDir, rawPath);
35
- if (!fs.existsSync(absPath)) {
36
- throw new Error(`FSCSS import failed: file not found ${absPath}`);
19
+ let [fullMatch, url1, url2, url3, url4] = match;
20
+
21
+ const impUrl = (url1 || url2 || url3 || url4).trim();
22
+ setFile = impUrl;
23
+
24
+ if (runnedSetImp.has(setFile)) {
25
+ // Helper to escape special characters in the filename (like dots or dashes)
26
+ const escapedFile = setFile.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
27
+
28
+ // Simplified regex using \s* for zero-or-more whitespace
29
+ const fregex = new RegExp("\\@import\\((?:\\s+)?exec\\((?:\\s+)?(?:\"("+ escapedFile + ")\"|'("+ escapedFile + ")'|`("+ escapedFile + ")`|("+ escapedFile + ")(?:\\s+)?)\\)(?:\\s+)?\\)", 'g');
30
+
31
+
32
+ result = result.replace(fregex, `/* Can't import ${setFile} multiple times */`);
33
+
34
+ console.warn(`[FSCSS Warning] Can't import ${setFile} multiple times at `);
35
+ }
36
+
37
+
38
+ try {
39
+
40
+ let resText;
41
+ if(/^https?:\/\//.test(impUrl)){
42
+ // remote
43
+ const response = await fetch(impUrl);
44
+
45
+ if (!response.ok) throw new Error(`fscss[@import] HTTP ${response.status} for ${impUrl}`);
46
+
47
+ resText = await response.text();
37
48
  }
38
- importedContent = fs.readFileSync(absPath, "utf8");
39
-
40
- // recursive support (nested imports)
41
- importedContent = await procImp(importedContent, {
42
- inputDir: path.dirname(absPath),
43
- });
49
+ else{
50
+ // local
51
+ const fillPath = path.resolve(inputDir, impUrl);
52
+ resText = await fs.readFile(fillPath, 'utf8');
53
+ }
54
+
55
+ result = result.replace(fullMatch, resText);
56
+
57
+ } catch (error) {
58
+ console.error(`fscss[@import] Failed: ${impUrl} `, error);
59
+
60
+ result = result.replace(fullMatch, `/* Failed import: ${impUrl} */`);
61
+
44
62
  }
45
-
46
- css = css.replace(match[0], importedContent);
47
63
  }
48
-
49
- return css;
64
+
65
+ if (!result.match(regex)) return result;
66
+ runnedSetImp.add(setFile);
67
+ return procImp(result);
50
68
  }
69
+
70
+
package/lib/processor.js CHANGED
@@ -1,6 +1,5 @@
1
1
  // lib/processor.js
2
2
  import {
3
- initlibraries,
4
3
  replaceRe,
5
4
  procExt,
6
5
  procVar,
@@ -20,15 +19,13 @@ import {
20
19
  } from "./functions/all.js";
21
20
  import { procImp } from "./functions/procImp.js";
22
21
  import { impSel } from "./functions/impSel.js";
22
+ import { impFrom } from "./functions/impFrom.js";
23
23
  export async function processFscss(css, options = {}) {
24
24
  const { inputDir = process.cwd() } = options;
25
25
 
26
26
  if (!css.includes("exec.obj.block(all)")) {
27
- if(!css.includes("exec.obj.block(init lab)"))css = initlibraries(css);
28
- if(!css.includes("exec.obj.block(f import)")||!css.includes("exec.obj.block(f import pick)")){css = await impSel(css, {inputDir});}
29
- if(!css.includes("exec.obj.block(f import)")){css = await procImp(css, {inputDir});}
30
- if(!css.includes("exec.obj.block(init lab)")||css.includes("exec.obj.block(exInit lab)"))css = initlibraries(css);
31
27
  if(!css.includes("exec.obj.block(f import)")||!css.includes("exec.obj.block(f import pick)")){css = await impSel(css, {inputDir});}
28
+ if(!css.includes("exec.obj.block(f import)")||!css.includes("exec.obj.block(f import from)")){css = await impFrom(css, {inputDir});}
32
29
  if(!css.includes("exec.obj.block(f import)")){css = await procImp(css, {inputDir});}
33
30
  if(!css.includes("exec.obj.block(vfc)")) css = vfc(css);
34
31
  if(!css.includes("exec.obj.block(store:before)")||!css.includes("exec.obj.block(store)"))css = replaceRe(css);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "fscss",
3
3
  "description": "Figured Shorthand Cascading Style Sheet",
4
- "version": "1.1.15",
4
+ "version": "1.1.17",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "bin": {
@@ -18,7 +18,7 @@
18
18
  "keywords": [
19
19
  "node",
20
20
  "figsh_css",
21
- "fs-css",
21
+ "css",
22
22
  "fscss",
23
23
  "xfscss",
24
24
  "preprocessor",
@@ -29,7 +29,7 @@
29
29
  "bugs": {
30
30
  "url": "https://github.com/Figsh/xfscss/issues"
31
31
  },
32
- "homepage": "https://github.com/Figsh/xfscss#readme",
32
+ "homepage": "https://github.com/Figsh/xfscss#breadme",
33
33
  "dependencies": {
34
34
  "dotenv": "^16.0.3",
35
35
  "express": "^4.18.2"
package/style.fscss CHANGED
@@ -1,4 +1,6 @@
1
+ @import(exec(_init themes))
2
+
1
3
  body{
2
4
  Background: @event.theme(light);
3
- color: blue;
5
+ color: @event.theme(dark);
4
6
  }
package/xfscss.js CHANGED
@@ -1,5 +1,2 @@
1
- export var text='text';export var url='fromUrl';export var external='fromUrl';export var fromUrl='fromUrl';export var write='text';function inf(host,jsdl){if(typeof jsdl!=='undefined'&&host!=='undefined'){var ht=host.replace(/github/gi, 'gh');var cov=jsdl.replace(/\s*-\>\s*/g, '/').replace(/\n/g, '');var url=`https://cdn.jsdelivr.net/${ht}/${cov}`;var ScrT=document.createElement('script');ScrT.type='text/javascript';ScrT.async='true';ScrT.src=url;document.body.appendChild(ScrT);}}function exec(text,fscss_style_sheet){if(typeof fscss_style_sheet !== 'undefined' && text == 'text'){var doc=document;var SrT = doc.createElement('script');
2
- SrT.type='text/javascript';SrT.async='true';SrT.src='https://cdn.jsdelivr.net/gh/Figsh/FSCSS@main/rtF4.js';doc.body.appendChild(SrT);doc.body.innerHTML += (`<style>${fscss_style_sheet}</style>`);}else if(typeof fscss_style_sheet!=='undefined'&&text=='fromUrl'){var doc=document;var SrT=doc.createElement('script');SrT.type = 'text/javascript';SrT.async='true';SrT.src= 'https://cdn.jsdelivr.net/gh/Figsh/FSCSS@main/rtF4.js';doc.body.appendChild(SrT);fetch(fscss_style_sheet).then(response =>response.text()).then(data=>{const AJWinDocStyleElement = document.createElement("style");
3
- AJWinDocStyleElement.innerHTML = `${data}`;
4
- document.head.appendChild(AJWinDocStyleElement);}).catch(error=>{});}}export{ inf };export{ exec };
5
-
1
+ /* FIGSH-FSCSS light, source v3, fscss.devtem.org */
2
+ export function exec({type:e="text",content:n,onError:r,onSuccess:s}){if(!n){const e="No CSS content or URL provided.";return console.error(`[FSCSS] ${e}`),void(r&&r(e))}const t=document.createElement("style"),o=e=>{t.textContent=e,document.head.appendChild(t),s&&s(t),xfscssProcessorWrap()},c=["text","auto","text/fscss","text/css"].includes(e),i=["fromUrl","URL","fromURL","link"].includes(e);if(c)o(n);else if(i)fetch(n).then((e=>{if(!e.ok)throw new Error(`HTTP ${e.status}: ${e.statusText}`);return e.text()})).then(o).catch((e=>{const s=`Failed to load CSS from: ${n}. ${e.message}`;console.error(`[FSCSS] ${s}`),r&&r(s)}));else{const n=`Unsupported type "${e}". Use "text" or "fromUrl".`;console.error(`[FSCSS] ${n}`),r&&r(n)}}function xfscssProcessorWrap(){(async()=>{function e(e){return e=e.replace(/count\(\s*([\d\.]+)\s*(?:,\s*([\d\.]+)?)?\)/g,((e,n,r)=>{return null===r&&(r=1),s=parseInt(n),t=parseInt(r||1),`${Array(s).fill().map(((e,n)=>(n+1)*t))}`;var s,t}))}function n(e){return e=e.replace(/length\((?:([^\)]+)|\s*"([^"]*)"\s*|\s*'([^']*)'\s*)\)/g,((e,n,r,s)=>(n||r||s).length))}function r(e){return e.replace(/num\((.*?)\)/g,((e,n)=>function(e){try{return new Function(`return ${e}`)()}catch(n){return console.error("Invalid expression:",e),e}}(n)))}const s={},t={},o={},c=new Set,i=new Set;function a(e,n){let r=0,s=n;for(;s<e.length&&("{"===e[s]?r++:"}"===e[s]&&r--,0!==r);)s++;return e.slice(n,s+1)}function l(e){const n=[],r=/(if|el-if|el)\s*([^{}]*?)\s*\{([\s\S]*?)\}/g;let s;for(;null!==(s=r.exec(e));)n.push({type:s[1],condition:s[2].trim(),block:s[3].trim()});return n}function f(e){let n="";const r=e.replace(/exec\((_log|_error|_warn|_info),\s*(?:"([^"]*)"|'([^']*)'|([^)]*))\)/g,((e,r,s,t,o)=>{const c=s||t||o;return["_log","_error","_warn","_info"].includes(r)?c?(n+=`console.${r.slice(1)}("${c.replace(/"/g,'\\"')}");\n`,""):(console.warn(`fscss[exec(console)]: Empty argument for method: ${r}`),""):(console.warn(`fscss[exec(console)]: Unsupported method: ${r}`),"")}));if(n)try{new Function(n)()}catch(e){console.error("fscss[exec(console)]: Error executing transformed code:",e)}return r}function u(e){const n={},r=/@event\s+([\w-]+)\(([^)]*)\)\s*:?{/g;let s,t=e;const o=[];for(;null!==(s=r.exec(e));){const r=s[1],t=s[2],c=s.index+s[0].length-1;if(c>=e.length){console.warn(`fscss[parsing] Warning: Unexpected end of CSS after @event ${r} definition.`);continue}const i=a(e,c);if(0===i.length||"}"!==i[i.length-1]){console.warn(`fscss[parsing] Warning: Malformed block for @event '${r}'. Missing closing '}'.`);continue}e.slice(s.index,c+i.length);const f=l(i),u=t.split(",").map((e=>e.trim())).filter((e=>""!==e));n[r]&&console.warn(`fscss[definition] Warning: Duplicate @event definition for '${r}'. The last one will be used.`),n[r]={args:u,conditionBlocks:f},o.push([s.index,c+i.length])}for(let e=o.length-1;e>=0;e--){const[n,r]=o[e];t=t.slice(0,n)+t.slice(r)}return t=t.replace(/@event\.([\w-]+)\(([^)]*)\)/g,((e,r,s)=>{const t=n[r];if(!t)return console.warn(`fscss[call] Warning: @event function '${r}' not found during call.`),e;const o={},c=s.split(",").map((e=>e.trim())).filter((e=>""!==e));c.length!==t.args.length&&console.warn(`fscss[call] Warning: Argument count mismatch for @event '${r}'. Expected ${t.args.length}, got ${c.length}.`),t.args.forEach(((e,n)=>{void 0!==c[n]?o[e]=c[n]:console.warn(`fscss[call] Warning: Missing value for argument '${e}' in @event '${r}' call.`)}));let i="",a=!1,l=!1;for(const e of t.conditionBlocks)if("el"===e.type&&(l&&console.warn(`fscss[logic] Warning: Multiple 'el' (else) blocks found in @event '${r}'. Only the first 'el' block will be considered.`),l=!0),!a||"el"===e.type){if("el"===e.type){if(a)continue;a=!0}else{const n=e.condition.split(",").map((e=>e.trim())).filter((e=>""!==e));0===n.length?(console.warn(`fscss[logic] Warning: Empty condition in '${e.type}' block for @event '${r}'.`),a=!0):a=n.every((e=>{const n=e.match(/^(\w+)\s*(==|!=|>=|<=|>|<)\s*([^]+)$/);if(!n){const n=e.split(":").map((e=>e.trim()));if(2!==n.length)return console.warn(`fscss[logic] Warning: Malformed condition '${e}' in @event '${r}'. Expected 'variable operator value' or 'variable:value'.`),!1;const[s,t]=n;return s in o?o[s]===t:(console.warn(`fscss[logic] Warning: Condition variable '${s}' not provided in @event '${r}' context. Treating as false.`),!1)}{const[,e,s,t]=n;if(!(e in o))return console.warn(`fscss[logic] Warning: Condition variable '${e}' not provided in @event '${r}' context. Treating as false.`),!1;const c=o[e],i=isNaN(c)?c:Number(c),a=isNaN(t)?t:Number(t);switch(s){case"==":return i==a;case"!=":return i!=a;case">":return i>a;case"<":return i<a;case">=":return i>=a;case"<=":return i<=a;default:return!1}}}))}if(a){const n=e.block.match(/(\w+)\s*(?:\:\s*([^;]*);?|\|([^\|]+)\|?)/);n&&n[2]?i=n[2].trim():n&&n[3]?i=n[3].trim():console.warn(`fscss[logic] Warning: No valid CSS property assignment found in matched block for @event '${r}'. Block content: '${e.block}'.`);break}}return!i&&t.conditionBlocks.length>0&&!a?console.warn(`fscss[call] Warning: No condition matched for @event '${r}' with provided arguments. Returning original call string.`):i||0!==t.conditionBlocks.length||console.warn(`fscss[definition] Warning: @event '${r}' has no condition blocks defined. Returning original call string.`),i||e})),t.trim()}async function p(e){return e=(e=(e=(e=(e=e.replace(/exec\(\s*_init\sisjs\s*\)/g,"exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/isjs.fscss)")).replace(/exec\(\s*_init\sthemes\s*\)/g,"exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/trshapes.fthemes.fscss)")).replace(/exec\(_init\sarray1to500\s*\)/g,"exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/1to500.fscss)")).replace(/exec\(_init\s+([\w\d\._—\-\%\*\+\&\$\=]+)(?:\/([\w\-]+))?\s*\)/g,((e,n,r)=>r?`exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${n}.${r})`:`exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${n}.fscss)`))).replace(/(\@import\((?:\s+)?(?:exec)?\((?:[\w\d\.\@\—\-_*\#\$\s\,]+)\)(?:\s+)?from(?:\s+)?)([\w\d\._—\-\%\*\+\&\$\=]+)(?:\/([\w\-]+))?(?:\s+)?\)/g,((e,n,r,s)=>s?`${n}'https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${r}.${s}')`:`${n}'https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${r}.fscss')`))}function $(e){const n=/@define\s+([\w\_\-\—]+)\s*\(([^)]*)\)\s*\$?\{\s*(?:"([^"]*)"|'([^']*)'|`([^`]*)`|([^\}^\{]*?))\s*\}/g;let r=e.replace(n,((e,n,r,s,t,c,i)=>{const a=r.split(",").map((e=>e.trim())).filter((e=>e)),l=s??t??c??i??"";return o[n]={params:a,body:l},""}));return r=r.replace(/@([\w\_\-\—]+)\s*\(([\s\S]*?)\)/g,((e,n,r)=>{const s=o[n];if(!s)return e;const t=r?.split(",").map((e=>e.trim()));""===t[0]&&(t[0]=void 0);let c=s.body,i=[];return s.params.forEach(((e,n)=>{const r=s.params[n];r&&r.includes(":")&&(i=r?.split(":")?.map((e=>e.trim())).filter((e=>e)));const o=i[1]?i[1]:"",a=void 0!==t[n]?t[n]:o,l=new RegExp(`@use\\(\\s*${e.replace(/(\s+)?(\:(\s+)?.*)/g,"")}\\s*\\)`,"g");c=c.replace(l,a)})),c})),n.test(r)?$(r):r}function d(e){let n={},r=e;return r=r.replace(/("(?:[^"\\]|\\.)*")|('(?:[^'\\]|\\.)*')/g,(function(e){let r=e[0],s=e.slice(1,-1);const t=/@ext\((-?\d+),(\d+):\s*([^)]+)\)/g;let o,c=[];for(;null!==(o=t.exec(s));)c.push({fullMatch:o[0],start:parseInt(o[1]),length:parseInt(o[2]),varName:o[3].trim(),index:o.index});for(let e=c.length-1;e>=0;e--){let r=c[e],t=r.start<0?s.length+r.start:r.start;t=Math.max(0,t);let o=s.substring(t,t+r.length);(t+r.length>s.length||t<0)&&console.warn(`fscss:[@ext]Warning: @ext directive for variable '${r.varName}' in string literal specifies an out-of-bounds range. Extraction may be incomplete or incorrect.`),void 0!==n[r.varName]&&console.warn(`fscss:[@ext]Warning: Duplicate variable name '${r.varName}' found in string literal. The last extracted value will be used.`),n[r.varName]=o,s=s.slice(0,r.index)+s.slice(r.index+r.fullMatch.length)}return r+s+r})),r=r.replace(/([#.\w-]+)\s*@ext\((-?\d+),(\d+):\s*([^)]+)\)/g,(function(e,r,s,t,o){s=parseInt(s),t=parseInt(t),o=o.trim();let c=s<0?r.length+s:s;c=Math.max(0,c);let i=r.substring(c,c+t);return(c+t>r.length||c<0)&&console.warn(`fscss:[@ext]Warning: @ext directive for variable '${o}' on token '${r}' specifies an out-of-bounds range. Extraction may be incomplete or incorrect.`),void 0!==n[o]&&console.warn(`fscss:[@ext]Warning: Duplicate variable name '${o}' found outside string literals. The last extracted value will be used.`),n[o]=i,r})),r=r.replace(/@ext\.(\w+)\!?/g,(function(e,r){return void 0===n[r]?(console.warn(`fscss:[@ext]Warning: Reference to undefined variable '@ext.${r}'. It will not be replaced.`),e):n[r]})),r}function g(e){const n=/@arr\(?\s*([\w\-_—0-9]+)\)?\[([^\]]+)\]\)?/g;let r;for(;null!==(r=n.exec(e));){const e=r[1],n=r[2].split(",").map((e=>e.trim()));s[e]=n}let t=e;return t=t.replace(/@arr\.([\w\-_—0-9]+)(?:\!\s*\+\s*\[([^\]]+)?\])/g,((e,n,r)=>s[n]?r?(newItems=r.split(",").map((e=>e.trim())),s[n].push(...newItems),""):(console.warn(`[FSCSS Warning] @arr push failed → Invalid or empty value at "${e}"`),e):(console.warn(`fscss[@arr] Warning: Array '${n}' not found.`),e))),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:\!\s*\-\s*\[([\d\w\-_—\s]+)?\])/g,((e,n,r)=>{const t=s[n];return t?!(r=Number(r?.trim()))||r<1||!Number(r)?(console.warn(`[FSCSS Warning] @arr splice failed → Invalid or empty index at "${e}"`),e):r>t.length?(console.warn(`[FSCSS Warning] @arr → @arr.${n}[${r}] is undefined at "${e}"`),""):(r-=1,t.splice(r,1),""):(console.warn(`fscss[@arr] Warning: Array '${n}' not found.`),e)})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:\!\s*\.(length|last|reverse|first|list|indices|randint|segment|sum|unique|sort|shuffle|min|max))/g,((e,n,r)=>{const t=s[n];if(!t)return console.warn(`fscss[@arr] Warning: Array '${n}' not found.`),e;if(r){if("length"===r)return t.length;if("first"===r)return t[0];if("last"===r)return t.at(-1);if("indices"===r)return Array(t.length).fill().map(((e,n)=>1*(n+1)));if("list"===r)return t.join(",");if("reverse"===r)return t.toReversed().join(",");if("randint"===r)return t[Math.floor(Math.random()*t.length)];if("segment"===r)return t.map((e=>`[${e}]`)).join("");if("unique"===r)return[...new Set(t)].join(",");if("sort"===r)return t.slice().sort().join(",");if("shuffle"===r)return t.slice().sort((()=>Math.random()-.5)).join(",");if("sum"===r)return t.reduce(((e,n)=>e+Number(n)),0);if("min"===r)return Math.min(...t.map(Number));if("max"===r)return Math.max(...t.map(Number))}})),t=t.replace(/([^\{\}]+)\{\s*([^}]*@arr\.([\w\-_—0-9]+)\[\][^}]*)\s*\}/g,((e,n,r,t)=>{const o=s[t];return o?o.map(((e,s)=>{const o=n.replace(new RegExp(`@arr\\.${t}\\[\\]`,"g"),s+1),c=r.replace(new RegExp(`@arr\\.${t}\\[\\]`,"g"),e);return`${o.trim()} {\n ${c.trim()}\n}`})).join("\n"):(console.warn(`fscss[@arr] Warning: Array '${t}' not found for loop processing.`),e)})),t=t.replace(/@arr\.([\w\-_—0-9]+)\[(\d+)\]/g,((e,n,r)=>{const t=parseInt(r)-1,o=s[n];return o?void 0!==o[t]?o[t]:e:(console.warn(`fscss[@arr] Warning: Array '${n}' not found.`),e)})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.unit)(?:\(([^)]*)\))/g,((e,n,r)=>{const t=s[n];if(!t)return console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e;const o=void 0!==r&&""!==r?r:" ";return t.map((e=>`${e+o}`)).join(",")})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.prefix)(?:\(([^)]*)\))/g,((e,n,r)=>{const t=s[n];if(!t)return console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e;const o=void 0!==r&&""!==r?r:" ";return t.map((e=>`${o+e}`)).join(",")})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.surround)(?:\(([^)]+)\))/g,((e,n,r)=>{const t=s[n];return t?r&&void 0!==r&&""!==r&&r.includes(",")?(surArr=r.split(","),t.map((e=>`${surArr[0]+e+surArr.at(-1)}`)).join(" ")):(console.warn(`[FSCSS Warning] @arr surround failed → Invalid or empty value at "${e}"`),e):(console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e)})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.join)?(?:\(([^)]*)\))/g,((e,n,r)=>{const t=s[n];if(!t)return console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e;const o=void 0!==r&&""!==r?r:" ";return t.join(o)})),t=t.replace(/@arr\.([\w\-_—0-9]+)(!)?/g,((e,n,r)=>{const t=s[n];return t?r?e:`[${t.join(",")}]`:(console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e)})),t.replace(n,"").replace(/\n{3,}/g,"\n\n").trim()}function m(e){const n={};function r(e){const n={},r=e.split(";");for(let e of r){if(e=e.trim(),!e)continue;const r=e.indexOf(":");if(-1===r){console.warn(`fscss[@fun] Invalid style line (missing colon): "${e}"`);continue}const s=e.substring(0,r).trim(),t=e.substring(r+1).trim();s?n[s]=t:console.warn(`fscss[@fun] Empty property name in line: "${e}"`)}return n}const s=/@fun\(([\w\-\_\—0-9]+)\)\s*\{([\s\S]*?)\}\s*/g;let t;for(;null!==(t=s.exec(e));){const e=t[1],s=t[2].trim();n[e]&&console.warn(`fscss[@fun] Duplicate @fun variable declaration: "${e}". The last one will overwrite previous declarations.`),n[e]={raw:s,props:r(s)}}let o=e;return o=o.replace(/@fun\.([\w\-\_\—0-9]+)\.([\w\-\_\—0-9]+)\.value\!?/g,((e,r,s)=>n[r]&&n[r].props[s]?n[r].props[s]:(console.warn(`fscss[@fun] Value extraction failed for "@fun.${r}.${s}.value". Variable or property not found.`),e))),o=o.replace(/@fun\.([\w\-\_\—0-9]+)\.([\w\-\_\—0-9]+)\!?/g,((e,r,s)=>n[r]&&n[r].props[s]?`${s}: ${n[r].props[s]};`:(console.warn(`fscss[@fun] Single property rule failed for "@fun.${r}.${s}". Variable or property not found.`),e))),o=o.replace(/@fun\.([\w\-\_\—0-9]+)(?=[\s;}])\!?/g,((e,r)=>n[r]?n[r].raw:(console.warn(`[@fun] Full variable block replacement failed for "@fun.${r}". Variable not found.`),e))),o=o.replace(/@fun\(([\w\-\_\d\—]+)\s*\{[\s\S]*?\}\s*/g,""),o=o.replace(/^\s*[\r\n]/gm,""),o=o.trim(),o}function w(e){const n=new Set,r=e.replace(/(:\s*)(["']?)(.*?)(["']?)\s*copy\(([-]?\d+),\s*([^\;^\)^\(^,^ ]*)\)/g,((e,r,s,t,o,c,i)=>{const a=parseInt(c),l=i.replace(/[^a-zA-Z0-9_-]/g,"");let f="";return f=a>=0?t.substring(0,a):t.substring(t.length+a),n.add(`--${l}:${f};`),`${r}${s}${t}${o}`}));if(n.size>0){return r+`\n${`:root{${Array.from(n).join("\n")}\n}`}`}return r}function h(e){const n=new Map;let r,s=e.replace(/(?:store|str|re)\(\s*([^:,]+)\s*[,:]\s*(?:"([^"]*)"|'([^']*)')\s*\)/gi,((e,r,s,t)=>{const o=s||t;return r=r.trim(),n.set(r,o),""}));if(0===n.size)return s;let t=0;let o=s;do{r=!1;for(const[e,s]of n.entries()){const n=new RegExp(`\\b${c=e,c.replace(/[.*+?^${}|[\]\\]/g,"\\$&")}\\b`,"g"),t=o.replace(n,s);t!==o&&(r=!0,o=t)}t++}while(r&&t<100);var c;return t>=100&&console.warn("Maximum iterations reached. Possible circular dependency."),o}function x(e){return e=e.replace(/(?:mxs|\$p)\((([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,\s*)?("([^"]*)"|'([^']*)')\)/gi,"$2:$14$15;$4:$14$15;$6:$14$15;$8:$14$15;$10:$14$15;$12:$14$15;").replace(/(?:mx|\$m)\((([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,\s*)?("([^"]*)"|'([^']*)')\)/gi,"$2$14$15$4$14$15$6$14$15$8$14$15$10$14$15$12$14$15").replace(/rpt\((\d+)\,\s*("([^"]*)"|'([^']*)')\)/gi,((e,n,r)=>function(e,n){return e.replace(/^['"]|['"]$/g,"").repeat(Math.max(0,parseInt(n)))}(r,n))).replace(/\$(([\_\-\d\w]+)\:(\"[^\"]*\"|\'[^\']*\'|[^\;]*)\;)/gi,":root{--$1}").replace(/\$([^\!\s]+)!/gi,"var(--$1)").replace(/\$([\w\-\_\d]+)/gi,"var(--$1)").replace(/\-\*\-(([^\:]+)\:(\"[^\"]*\"|\'[^\']*\'|[^\;]*)\;)/gi,"-webkit-$1-moz-$1-ms-$1-o-$1").replace(/%i\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\]\[]*)\,)?(([^\,\]\[]*)\,)?(([^\,\[\]]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$21$4$21$6$21$8$21$10$21$12$21$14$21$16$21$18$21$20$21").replace(/%6\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\]\[]*)\,)?(([^\,\]\[]*)\,)?(([^\,\[\]]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$13$4$13$6$13$8$13$10$13$12$13").replace(/%5\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\]\[]*)\,)?(([^\,\]\[]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$11$4$11$6$11$8$11$10$11").replace(/%4\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$9$4$9$6$9$8$9").replace(/%3\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$7$4$7$6$7").replace(/%2\((([^\,\[\]]*)\,)?(([^\,\]\[]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$5$4$5").replace(/%1\((([^\,\]\[]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$3"),e=(e=e.replace(/%(\d+)\(([^[]+)\[\s*([^\]]+)\]\)/g,((e,n,r,s)=>{const t=r.split(",").map((e=>e.trim()));return t.length!=n?(console.warn(`Number of properties ${t.length} does not match %${n}`),e):t.map((e=>`${e}${s}`)).join("")}))).replace(/\$\(\s*@keyframes\s*(\S+)\)/gi,"$1{animation-name:$1;}@keyframes $1").replace(/\$\(\s*(\@[\w\-\*]*)\s*([^\{\}\,&]*)(\s*,\s*[^\{\}&]*)?&?(\[([^\{\}]*)\])?\s*\)/gi,"$2$3{animation:$2 $5;}$1 $2").replace(/\$\(\s*--([^\{\}]*)\)/gi,"$1").replace(/\$\(([^\:]*):\s*([^\)\:]*)\)/gi,"[$1='$2']").replace(/g\(([^"'\s]*)\,\s*(("([^"]*)"|'([^']*)')\,\s*)?("([^"]*)"|'([^']*)')\s*\)/gi,"$1 $4$5$1 $7$8").replace(/\$\(([^\:]*):\s*([^\)\:]*)\)/gi,"[$1='$2']").replace(/\$\(([^\:^\)]*)\)/gi,"[$1]")}async function b(e){const n=[".fscss",".css",".txt",".scss",".less","xfscss"],r=/@import\(exec\(([^)]+)\)\s*\.\s*(?:pick|find)\(([^)]+)\)\)/g,s=[...(e=await p(e)).matchAll(r)];let t=e,o=null;for(const e of s){const[r,s,c]=e;if(o=s,i.has(o)){const e=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp("@import\\(exec\\(("+e+")\\)\\s*\\.\\s*(?:pick|find)\\(([^)]+)\\)\\)","g");t=t.replace(n,`/* Can't import ${o} multiple times */`),console.warn(`[FSCSS Warning] Can't import ${o} multiple times at `)}try{const e=s.replace(/["']/g,""),o=e.slice(e.lastIndexOf(".")).toLowerCase();if(e.trim().startsWith("_init")&&e.includes(" "))return void console.warn(`fscss[@import] library not found for: ${e}`);if(!n.includes(o))return void console.warn(`fscss[@import] invalid extension for: ${e}`);const i=await fetch(e);if(!i.ok)throw new Error(`fscss[@import] HTTP ${i.status} for ${s}`);const a=v(await i.text(),c.trim());t=t.replace(r,a)}catch(e){console.error(`fscss[@import] Failed: ${s} `,e),t=t.replace(r,`/* Failed import: ${s} */`)}}return t.match(r)?(i.add(o),b(t)):t}function v(e,n){const r=new RegExp(`${n}\\s*{[^}]*}`,"g"),s=e.match(r);return s?s.join("\n"):console.warn(`fscss[@import pick] No block matches: ${n} `)}const S=new Set;async function y(e){const n=/\@import\((?:\s+)?exec\((?:\s+)?(?:"([^"]+)"|'([^']+)'|`([^`]+)`|([^\)]+)(?:\s+)?)\)(?:\s+)?\)/g,r=[...(e=await p(e)).matchAll(n)];let s=e,t=null;for(const e of r){let[n,r,o,c,i]=e;const a=(r||o||c||i).trim();if(t=a,S.has(t)){const e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp('\\@import\\((?:\\s+)?exec\\((?:\\s+)?(?:"('+e+")\"|'("+e+")'|`("+e+")`|("+e+")(?:\\s+)?)\\)(?:\\s+)?\\)","g");s=s.replace(n,`/* Can't import ${t} multiple times */`),console.warn(`[FSCSS Warning] Can't import ${t} multiple times at `)}try{const e=await fetch(a);if(!e.ok)throw new Error(`fscss[@import] HTTP ${e.status} for ${a}`);const r=await e.text();s=s.replace(n,r)}catch(e){console.error(`fscss[@import] Failed: ${a} `,e),s=s.replace(n,`/* Failed import: ${a} */`)}}return s.match(n)?(S.add(t),y(s)):s}async function k(e){const n=/\@import\((?:\s+)?(?:exec)?\(([\w\d\.\@\—\-_*\#\$\s\,]+)\)(?:\s+)?from(?:\s+)?(?:"([^"]+)"|'([^']+)'|`([^`]+)`)(?:\s+)?\)/g,r=[...(e=await p(e)).matchAll(n)];let s=e,t=null;for(const e of r){let[n,r,o,i,a]=e;r=r.trim();const l=(o||i||a).trim();if(t=l,c.has(t)){const e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp('\\@import\\((?:\\s+)?(?:exec)?\\(([\\w\\d\\.\\@\\—\\-_*\\#\\$\\s\\,]+)\\)(?:\\s+)?from(?:\\s+)?(?:"((?:\\s+)?'+e+"(?:\\s+)?)\"|'((?:\\s+)?"+e+"(?:\\s+)?)'|`((?:\\s+)?"+e+"(?:\\s+)?)`)(?:\\s+)?\\)","g");s=s.replace(n,`/* Can't import ${t} multiple times */`),console.warn(`[FSCSS Warning] Can't import ${t} multiple times at `)}try{const e=await fetch(l);if(!e.ok)throw new Error(`fscss[@import] HTTP ${e.status} for ${l}`);const t=await e.text();if("*"===r&&(s=s.replace(n,t)),"*"!==r&&r.includes("*")&&(console.warn(`[FSCSS Warning] syntax error at ${n}: unexpected *`),s=s.replace(n,"/* syntax error: unexpected * */")),"*"!==r&&!r.includes("*")){const e=j(t,r.split(",").map((e=>e.trim())));s=s.replace(n,e)}}catch(e){console.error(`fscss[@import] Failed: ${l} `,e),s=s.replace(n,`/* Failed import: ${l} */`)}}return s.match(n)?(c.add(t),k(s)):s}function j(e,n=[]){if(!e||""===e||"string"!=typeof e)return console.warn("FSCSS >Invalid input");if(!n||0===n.length)return console.warn("FSCSS >Invalid input");let r="";return n.forEach((n=>{let s="",t=n;const o=n.trim().match(/([^\s]+)(?:\s+as\s+([^\s]+))?/);if(o){const[e,r,c]=o;t=r,c?s=c:n.includes(" as")?(console.warn(`[FSCSS Warning] Can't assign @${r} to invalid or empty value`),s=r):s=r}const c=new RegExp("@define\\s+("+t+")\\s*\\(([^)]*)\\)\\s*\\$?\\{\\s*(?:\"([^\"]*)\"|'([^']*)'|`([^`]*)`|([^\\}^\\{]*?))\\s*\\}","g"),i=e.match(c);if(!i)return console.warn(`[FSCSS Warning] @${t} is undefined for import`);const a=new RegExp("(@define\\s+)("+t+")(\\s*\\(([^)]*)\\)\\s*\\$?\\{\\s*(?:\"([^\"]*)\"|'([^']*)'|`([^`]*)`|([^\\}^\\{]*?))\\s*\\})","g");r+=i.join("\n").replace(a,((e,n,r,t)=>`${n}${s}${t}`))+"\n"})),r.trim()}try{await async function(){const s=document.querySelectorAll("style");if(s.length)for(const o of s){let s=o.textContent;s.includes("exec.obj.block(all)")||(s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import pick)")||(s=await b(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import from)")||(s=await k(s)),s.includes("exec.obj.block(f import)")||(s=await y(s)),s.includes("exec.obj.block(vfc)")||(s=s.replace(/([\w-]+:\s*)(\$\/?[\w-]+!?)(\s*\|\|\s*([^\n\};]+))?/g,((e,n,r,s,t)=>/^\$\/[\w-]+!?$/.test(r)?(r.endsWith("!")&&t&&console.warn(`fscss[VFC]: Required variable "${r}" should not have fallback (${t})`),s&&!t?.trim()?(console.warn(`fscss[VFC]: Empty fallback in -> ${e}`),e):(t?.includes("$/")&&!/^\$\/[\w-]+!?$/.test(t.trim())&&console.warn(`fscss[VFC]: Invalid fallback variable syntax -> ${t}`),t?`${n}${t.trim()};${n}${r}`:`${n}${r}`)):(console.warn(`fscss[VFC]: Invalid variable escape syntax -> ${r} at ${e}`),e)))),s.includes("exec.obj.block(store:before)")&&s.includes("exec.obj.block(store)")||(s=h(s)),s.includes("exec.obj.block(ext:before)")&&s.includes("exec.obj.block(ext)")||(s=d(s)),s.includes("exec.obj.block(f var)")||(s=function(e){const n={},r=[],s=e.split("\n");let t=!1;const o={};for(let e=0;e<s.length;e++){let c=s[e].trim();if(c.includes("{")){t=!0,r.push(c);continue}if(c.includes("}")){t=!1;for(const e in o)delete o[e];r.push(c);continue}const i=/^\s*\$([a-zA-Z0-9_-]+)\s*:\s*([^;]+);/,a=c.match(i);if(a){const[,e,s]=a;t?o[e]=s.trim():(n[e]=s.trim(),r.push(c));continue}const l=/\$\/?([a-zA-Z0-9_-]+)(!)?/g;c=c.replace(l,((e,r)=>void 0!==o[r]?o[r]:void 0!==n[r]?n[r]:e)),r.push(c)}return{css:r.join("\n"),getVariable:function(e){return n[e]||null}}}(s).css),s.includes("exec.obj.block(fun)")||(s=m(s)),s.includes("exec.obj.block(length)")||(s=n(s)),s.includes("exec.obj.block(count)")||(s=e(s)),s.includes("exec.obj.block(define)")||(s=$(s)),s.includes("exec.obj.block(arr)")||(s=g(s)),s.includes("exec.obj.block(event)")||(s=u(s)),s.includes("exec.obj.block(random)")||(s=s.replace(/@random\(\[([^\]]+)\](?:, *ordered)?\)/g,((e,n)=>{const r=/, *ordered\)/.test(e),s=n.split(",").map((e=>e.trim()));if(0===s.length)return console.warn("fscss[@random] Warning: Empty array provided for @random. Returning empty string."),"";if(r){const e=s.join(":");t[e]||(t[e]={values:s,index:0},console.warn(`fscss[@random] Warning: New ordered sequence created for [${n}].`));const r=t[e],o=r.values[r.index%r.values.length];return r.index>=r.values.length&&r.index%r.values.length==0&&console.warn(`fscss[@random] Warning: Ordered sequence [${n}] is looping back to the beginning.`),r.index++,o}return s[Math.floor(Math.random()*s.length)]}))),s.includes("exec.obj.block(copy)")||(s=w(s)),s.includes("exec.obj.block(store:after)")&&s.includes("exec.obj.block(store)")||(s=h(s)),s.includes("exec.obj.block(num)")||(s=r(s)),s.includes("exec.obj.block(ext:after)")&&s.includes("exec.obj.block(ext)")||(s=d(s)),s.includes("exec.obj.block(t group)")||(s=x(s)),s.includes("exec.obj.block(length)")||(s=n(s)),s.includes("exec.obj.block(count)")||(s=e(s)),s.includes("exec.obj.block(debug)")||(s=f(s))),s=s.replace(/exec\.obj\.block\([^\)\n]*\)\;?/g,""),o.innerHTML=s}else console.warn("fscss[Obj]\n No <style> elements found.")}(),await void document.querySelectorAll(".draw").forEach((e=>{const n=e.style.color||"#000";e.style.color="transparent",e.style.webkitTextStroke=`2px ${n}`}))}catch(e){console.error("Error processing styles or draw elements:",e)}})()}function applyFscssStyles(){document.querySelectorAll('[type*="fscss"]').forEach((e=>{fetch(e.href).then((e=>e.text())).then((e=>{const n=document.createElement("style");n.textContent=e,document.head.appendChild(n),xfscssProcessorWrap()})).catch((n=>{console.error(`Failed to load FSCSS from ${e.href}`,n)}))}))}export function inf({host:e,path:n}){if(!e||!n)return void console.error("Both 'host' and 'path' are required.");const r=e.replace(/github/gi,"gh"),s=n.replace(/\s*->\s*/g,"/").replace(/\n/g,"");loadFScript(`https://cdn.jsdelivr.net/${r}/${s}`)}xfscssProcessorWrap(),applyFscssStyles();
package/e/index.js DELETED
@@ -1,8 +0,0 @@
1
-
2
- function loadFScript(src, async = true){const script=document.createElement('script');script.type='text/javascript';script.async= async;src="https://cdn.jsdelivr.net/gh/Figsh/FSCSS@main/rtF4.js";script.src = src;document.body.appendChild(script);}loadFScript();function applyFscssStyles() {const fscssLinks=document.querySelectorAll('[type*="fscss"]');fscssLinks.forEach(link => {fetch(link.href).then(response=>response.text()).then(css =>{const style=document.createElement('style');style.textContent = css;document.head.appendChild(style);}).catch(error => {
3
- console.error(`Failed to load FSCSS from ${link.href}`, error);});});}function inf({ host, path }) {if (!host || !path) {console.error("Both 'host' and 'path' are required.");
4
- return;}const sanitizedHost = host.replace(/github/gi, 'gh');const sanitizedPath = path.replace(/\s*->\s*/g, '/').replace(/\n/g, '');const finalUrl = `https://cdn.jsdelivr.net/${sanitizedHost}/${sanitizedPath}`;loadFScript(finalUrl);
5
- }function exec({ type = 'text', content, onError, onSuccess }) {if (!content) {const errorText = 'No CSS content or URL provided.';console.error(errorText);if (onError) onError(errorText);
6
- return;
7
- }const style=document.createElement('style');const appendStyle=cssText=> {style.textContent = cssText;document.head.appendChild(style);if (onSuccess)onSuccess(style);};if (type==='text'||type==='auto'|| type==='text/fscss'||type==='text/css'){appendStyle(content);}else if (type==='fromUrl'||type==='URL' ||type==='fromURL'||type==='link') {fetch(content).then(res => {if (!res.ok) throw new Error(`HTTP error! Status: ${res.status}`);
8
- return res.text();}).then(css => appendStyle(css)).catch(err => {console.error(`Failed to load CSS from URL: ${content}`, err);if (onError) onError(err.message);});} else {const errorText = `Unsupported type "${type}". Use "text" or "fromUrl".`;console.error(errorText);if(onError) onError(errorText);}}
package/index.js DELETED
@@ -1,10 +0,0 @@
1
- const DOMFSCSSEng = (async ()=>{var fsTc=document.createElement('script');fsTc.type = 'text/javascript';fsTc.async='true';fsTc.src='https://cdn.jsdelivr.net/gh/Figsh/FSCSS@main/rtF4.js';var sTcZB=document.createElement('script');sTcZB.type = 'text/javascript';sTcZB.async='true';sTcZB.text='fs_cssText = (0);';document.body.appendChild(fsTc);fstylesheet=document.querySelectorAll("[type*='fscss']");for(c=0;c<fstylesheet.length;c++){fetch(fstylesheet[c].href).then(response => response.text()).then(data => {document.body.innerHTML+=`<style>${data}</style>`;}).catch(error => {});}
2
- var text ='text';var url ='fromUrl';var fromUrl = 'fromUrl';var write = 'text';function inf(host,jsdl){if(typeof jsdl!=='undefined'&&host!=='undefined'){var ht=host.replace(/github/gi, 'gh');var cov=jsdl.replace(/\s*-\>\s*/g, '/').replace(/\n/g, '');var url=`https://cdn.jsdelivr.net/${ht}/${cov}`;var ScrT=document.createElement('script');ScrT.type='text/javascript';ScrT.async='true';ScrT.src=url;document.body.appendChild(ScrT);}}function exec(text,fscss_style_sheet){if(typeof fscss_style_sheet!=='undefined'&&text=='text'){var doc=document;
3
- const AJWinDocStyleElement = document.createElement("style");
4
- AJWinDocStyleElement.innerHTML = `${fscss_style_sheet}`;
5
- document.head.appendChild(AJWinDocStyleElement);
6
- }else if(typeof fscss_style_sheet!=='undefined'&&text=='fromUrl'){var doc=document;fetch(fscss_style_sheet).then(response =>response.text()).then(data=>{const AJWinDocStyleElement = document.createElement("style");
7
- AJWinDocStyleElement.innerHTML = `${data}`;
8
- document.head.appendChild(AJWinDocStyleElement);}).catch(error=>{});}}
9
- })()
10
-