fscss 1.1.12 → 1.1.14
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 +21 -22
- package/example.fscss +14 -5
- package/exec.js +2 -1
- package/index.js +3 -1
- package/lib/functions/all.js +159 -4
- package/lib/functions/procImp.js +1 -1
- package/package.json +23 -23
- package/xfscss.js +2 -1
- package/style.css +0 -9
package/README.md
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
1
|
# FSCSS
|
|
2
2
|
FSCSS (Figured Shorthand CSS) is a CSS preprocessor that extends CSS with shorthand utilities, variables, functions, and advanced transformations.
|
|
3
|
-
It works both in the browser and on the backend (Node.js).
|
|
4
3
|
|
|
5
4
|
|
|
6
5
|
---
|
|
7
6
|
|
|
8
7
|
|
|
9
8
|
|
|
10
|
-
##
|
|
9
|
+
## Features
|
|
11
10
|
|
|
12
11
|
Works in browser and backend (Node.js)
|
|
13
12
|
|
|
14
13
|
Supports:
|
|
15
14
|
|
|
16
|
-
- Variables ($var, str()) → define reusable values
|
|
17
|
-
|
|
18
|
-
-
|
|
15
|
+
- Variables ($var, str()) → define reusable values, str(boxBased, "..."), $var:...;
|
|
16
|
+
|
|
17
|
+
- Array Methods (@arr) → define array - https://github.com/fscss-ttr/FSCSS/blob/main/FSCSS_array_method.md
|
|
18
|
+
|
|
19
|
+
- Style Replacement (%n()) → shorthand repeated properties. %2(width, height[: 200px;])
|
|
20
|
+
|
|
19
21
|
- Repeat Function (rpt()) → repeat values quickly
|
|
20
22
|
|
|
21
23
|
- Copy Function (copy()) → copy parts of values
|
|
22
24
|
|
|
23
|
-
- String Extractor (@ext()) → extract substrings from values
|
|
25
|
+
- String Extractor (@ext()) → extract substrings from values.
|
|
24
26
|
|
|
25
|
-
- Drops / Shared Properties → reuse style groups
|
|
27
|
+
- Drops / Shared Properties → reuse style groups.
|
|
26
28
|
|
|
27
|
-
- Attribute Selectors → dynamic selectors
|
|
29
|
+
- Attribute Selectors → dynamic selectors. $(attribute:value){...}
|
|
28
30
|
|
|
29
31
|
- Keyframes ($(@keyframes …)) → generate animations easily
|
|
30
32
|
|
|
31
|
-
- Vendor Prefixing (-*) → auto add prefixes
|
|
32
|
-
|
|
33
|
-
- Function-based (@fun) → reusable function-like blocks
|
|
33
|
+
- Vendor Prefixing (-*) → auto add prefixes. -\*-webkit-text-stroke:...
|
|
34
34
|
|
|
35
|
-
-
|
|
35
|
+
- Function-based (@fun) → reusable function-like blocks. @fun(name){...}
|
|
36
36
|
|
|
37
|
-
- Random Function (@random()) → random values at runtime
|
|
37
|
+
- Random Function (@random()) → random values at runtime. @random([.,.,...]) or using array!.randint instead
|
|
38
38
|
|
|
39
|
-
- Number Calculation (num()) → evaluate math expressions
|
|
39
|
+
- Number Calculation (num()) → evaluate math expressions. num(4+5)
|
|
40
40
|
|
|
41
|
-
- Import (@import) → include external FSCSS files
|
|
41
|
+
- Import (@import) → include external FSCSS files. @import(exec(...))
|
|
42
42
|
|
|
43
43
|
- @event → event-based styling logic
|
|
44
44
|
|
|
45
|
-
- exec() → debugging and runtime helpers
|
|
45
|
+
- exec() → debugging and runtime helpers. exec(_log, "...")
|
|
46
46
|
|
|
47
47
|
- Variable fallback chain (property: $/var || fallback;)
|
|
48
48
|
|
|
@@ -50,7 +50,7 @@ Supports:
|
|
|
50
50
|
### Example
|
|
51
51
|
```css
|
|
52
52
|
/* FSCSS, Animation compact */
|
|
53
|
-
$(@keyframes trans, .box .card &[3s
|
|
53
|
+
$(@keyframes trans, .box, .card &[3s ase-in infinite]) {
|
|
54
54
|
from {
|
|
55
55
|
%2(width, height [: 0;])
|
|
56
56
|
background: red;
|
|
@@ -62,7 +62,7 @@ $(@keyframes trans, .box .card &[3s ease-in infinite]) {
|
|
|
62
62
|
}
|
|
63
63
|
```
|
|
64
64
|
|
|
65
|
-
###
|
|
65
|
+
### Installation
|
|
66
66
|
|
|
67
67
|
`npm install -g fscss`
|
|
68
68
|
|
|
@@ -70,9 +70,9 @@ Or locally to your project:
|
|
|
70
70
|
|
|
71
71
|
`npm install fscss`
|
|
72
72
|
|
|
73
|
-
**CDN**
|
|
73
|
+
**Browser CDN**
|
|
74
74
|
```html
|
|
75
|
-
<script src="https://cdn.jsdelivr.net/npm/fscss@1.1.
|
|
75
|
+
<script src="https://cdn.jsdelivr.net/npm/fscss@1.1.14/exec.min.js" defer></script>
|
|
76
76
|
```
|
|
77
77
|
Usage
|
|
78
78
|
|
|
@@ -86,7 +86,7 @@ Or import inside a style block:
|
|
|
86
86
|
@import(exec(style.fscss))
|
|
87
87
|
</style>
|
|
88
88
|
```
|
|
89
|
-
|
|
89
|
+
**Async or defer is required for script loading.**
|
|
90
90
|
|
|
91
91
|
|
|
92
92
|
---
|
|
@@ -99,7 +99,6 @@ Extensible with plugins
|
|
|
99
99
|
---
|
|
100
100
|
|
|
101
101
|
### https://fscss.devtem.org/
|
|
102
|
-
### https://opencollective.com/fscss
|
|
103
102
|
|
|
104
103
|
---
|
|
105
104
|
|
package/example.fscss
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
@import(exec(_init themes))
|
|
2
2
|
@import(exec(style.fscss).pick(body))
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
@arr colors[#1E2783, #8C29B2, #C41348]
|
|
4
|
+
$colors: @arr.colors!;
|
|
5
|
+
div{
|
|
6
|
+
background: @event.theme(forest);
|
|
7
|
+
%2(width, height[: 200px;])
|
|
8
|
+
tr Shape: @event.shape(star);
|
|
9
|
+
}
|
|
10
|
+
.box{
|
|
11
|
+
background: radial-gradient(40deg, $colors.list);
|
|
12
|
+
}
|
|
13
|
+
.box-b{
|
|
14
|
+
background: radial-gradient(40deg, $colors.reverse);
|
|
15
|
+
}
|
|
16
|
+
exec(_log, "Hello World!")
|
package/exec.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
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
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
3
|
const AJWinDocStyleElement = document.createElement("style");
|
|
4
4
|
AJWinDocStyleElement.innerHTML = `${fscss_style_sheet}`;
|
|
@@ -6,4 +6,5 @@ document.head.appendChild(AJWinDocStyleElement);
|
|
|
6
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
7
|
AJWinDocStyleElement.innerHTML = `${data}`;
|
|
8
8
|
document.head.appendChild(AJWinDocStyleElement);}).catch(error=>{});}}
|
|
9
|
+
})()
|
|
9
10
|
|
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
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
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
3
|
const AJWinDocStyleElement = document.createElement("style");
|
|
4
4
|
AJWinDocStyleElement.innerHTML = `${fscss_style_sheet}`;
|
|
@@ -6,3 +6,5 @@ document.head.appendChild(AJWinDocStyleElement);
|
|
|
6
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
7
|
AJWinDocStyleElement.innerHTML = `${data}`;
|
|
8
8
|
document.head.appendChild(AJWinDocStyleElement);}).catch(error=>{});}}
|
|
9
|
+
})()
|
|
10
|
+
|
package/lib/functions/all.js
CHANGED
|
@@ -22,13 +22,15 @@ function procNum(css){
|
|
|
22
22
|
const regex = /num\((.*?)\)/g;
|
|
23
23
|
function evaluateExpression(expression) {
|
|
24
24
|
try {
|
|
25
|
-
|
|
25
|
+
// function instead
|
|
26
|
+
return new Function(`return ${expression}`)();
|
|
26
27
|
} catch (e) {
|
|
27
28
|
console.error('Invalid expression:', expression);
|
|
28
29
|
return expression;
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
32
|
|
|
33
|
+
|
|
32
34
|
const processedCSS = css.replace(regex, (match, expression) => {
|
|
33
35
|
|
|
34
36
|
return evaluateExpression(expression);
|
|
@@ -258,10 +260,18 @@ function procExC(css) {
|
|
|
258
260
|
|
|
259
261
|
return modifiedCSS.trim();
|
|
260
262
|
}
|
|
263
|
+
|
|
261
264
|
function initlibraries(css){
|
|
262
265
|
css = css.replace(/exec\(\s*_init\sisjs\s*\)/g, "exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/isjs.fscss)");
|
|
263
266
|
css = css.replace(/exec\(\s*_init\sthemes\s*\)/g, "exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/trshapes.fthemes.fscss)")
|
|
264
267
|
css = css.replace(/exec\(_init\sarray1to500\s*\)/g, "exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/1to500.fscss)");
|
|
268
|
+
css = css.replace(/exec\(_init\s+([\w\d\._—\-\%\*\+\&\$\=]+)(?:\/([\w\-]+))?\s*\)/g, (match, impName, impType)=>{
|
|
269
|
+
if(!impType){
|
|
270
|
+
//`
|
|
271
|
+
return `exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${impName}.fscss)`;
|
|
272
|
+
}
|
|
273
|
+
return `exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${impName}.${impType})`;
|
|
274
|
+
});
|
|
265
275
|
return css;
|
|
266
276
|
}
|
|
267
277
|
function procVar(vcss) {
|
|
@@ -451,6 +461,7 @@ function procRan(input) {
|
|
|
451
461
|
}
|
|
452
462
|
});
|
|
453
463
|
}
|
|
464
|
+
|
|
454
465
|
function procArr(input) {
|
|
455
466
|
// 1. Parse array declarations
|
|
456
467
|
const arrayDeclarationRegex = /@arr\(?\s*([\w\-_—0-9]+)\)?\[([^\]]+)\]\)?/g;
|
|
@@ -463,6 +474,99 @@ function procArr(input) {
|
|
|
463
474
|
|
|
464
475
|
let output = input;
|
|
465
476
|
|
|
477
|
+
output = output.replace(/@arr\.([\w\-_—0-9]+)(?:\!\s*\+\s*\[([^\]]+)?\])/g, (match, arrName, newArr) => {
|
|
478
|
+
const arr = arraysExfscss[arrName];
|
|
479
|
+
if (!arr) {
|
|
480
|
+
console.warn(`fscss[@arr] Warning: Array '${arrName}' not found.`);
|
|
481
|
+
return match;
|
|
482
|
+
}
|
|
483
|
+
if (!newArr) {
|
|
484
|
+
console.warn(
|
|
485
|
+
`[FSCSS Warning] @arr push failed → Invalid or empty value at "${match}"`
|
|
486
|
+
);
|
|
487
|
+
return match;
|
|
488
|
+
}
|
|
489
|
+
newItems = newArr.split(',').map(item => item.trim());
|
|
490
|
+
arraysExfscss[arrName].push(...newItems);
|
|
491
|
+
return "";
|
|
492
|
+
})
|
|
493
|
+
|
|
494
|
+
output = output.replace(/@arr\.([\w\-_—0-9]+)(?:\!\s*\-\s*\[([\d\w\-_—\s]+)?\])/g, (match, arrName, ind) => {
|
|
495
|
+
const arr = arraysExfscss[arrName];
|
|
496
|
+
if (!arr) {
|
|
497
|
+
console.warn(`fscss[@arr] Warning: Array '${arrName}' not found.`);
|
|
498
|
+
return match;
|
|
499
|
+
}
|
|
500
|
+
ind = Number(ind?.trim());
|
|
501
|
+
if (!ind||ind<1||!Number(ind)) {
|
|
502
|
+
console.warn(
|
|
503
|
+
`[FSCSS Warning] @arr splice failed → Invalid or empty index at "${match}"`
|
|
504
|
+
);
|
|
505
|
+
return match;
|
|
506
|
+
}
|
|
507
|
+
if(ind>arr.length){
|
|
508
|
+
console.warn(
|
|
509
|
+
`[FSCSS Warning] @arr → @arr.${arrName}[${ind}] is undefined at "${match}"`);
|
|
510
|
+
return "";
|
|
511
|
+
}
|
|
512
|
+
ind = (ind-1);
|
|
513
|
+
arr.splice(ind,1);
|
|
514
|
+
return "";
|
|
515
|
+
})
|
|
516
|
+
|
|
517
|
+
|
|
518
|
+
output = output.replace(/@arr\.([\w\-_—0-9]+)(?:\!\s*\.(length|last|reverse|first|list|indices|randint|segment|sum|unique|sort|shuffle|min|max))/g, (match, arrName, obj) => {
|
|
519
|
+
const arr = arraysExfscss[arrName];
|
|
520
|
+
if (!arr) {
|
|
521
|
+
console.warn(`fscss[@arr] Warning: Array '${arrName}' not found.`);
|
|
522
|
+
return match;
|
|
523
|
+
}
|
|
524
|
+
if(obj){
|
|
525
|
+
if (obj==="length") {
|
|
526
|
+
return arr.length;
|
|
527
|
+
}
|
|
528
|
+
if(obj==="first"){
|
|
529
|
+
return arr[0];
|
|
530
|
+
}
|
|
531
|
+
if (obj==="last") {
|
|
532
|
+
return arr.at(-1);
|
|
533
|
+
}
|
|
534
|
+
if (obj==="indices") {
|
|
535
|
+
return Array(arr.length).fill().map((_, i)=>(i+1)*1);
|
|
536
|
+
}
|
|
537
|
+
if (obj==="list") {
|
|
538
|
+
return arr.join(',');
|
|
539
|
+
}
|
|
540
|
+
if (obj==="reverse") {
|
|
541
|
+
return arr.toReversed().join(',');
|
|
542
|
+
}
|
|
543
|
+
if (obj==="randint") {
|
|
544
|
+
return arr[Math.floor(Math.random() * arr.length)];
|
|
545
|
+
}
|
|
546
|
+
if(obj==="segment") {
|
|
547
|
+
return arr.map(u => `[${u}]`).join('')
|
|
548
|
+
}
|
|
549
|
+
if (obj === "unique") {
|
|
550
|
+
return [...new Set(arr)].join(',');
|
|
551
|
+
}
|
|
552
|
+
if (obj === "sort") {
|
|
553
|
+
return arr.slice().sort().join(',');
|
|
554
|
+
}
|
|
555
|
+
if (obj === "shuffle") {
|
|
556
|
+
return arr.slice().sort(() => Math.random() - 0.5).join(',');
|
|
557
|
+
}
|
|
558
|
+
if (obj === "sum") {
|
|
559
|
+
return arr.reduce((a, b) => a + Number(b), 0);
|
|
560
|
+
}
|
|
561
|
+
if (obj === "min") {
|
|
562
|
+
return Math.min(...arr.map(Number));
|
|
563
|
+
}
|
|
564
|
+
if (obj === "max") {
|
|
565
|
+
return Math.max(...arr.map(Number));
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
})
|
|
569
|
+
|
|
466
570
|
// 2. Process loops using @arr.name[]
|
|
467
571
|
output = output.replace(/([^\{\}]+)\{\s*([^}]*@arr\.([\w\-_—0-9]+)\[\][^}]*)\s*\}/g,
|
|
468
572
|
(fullMatch, selector, content, arrayName) => {
|
|
@@ -491,8 +595,49 @@ function procArr(input) {
|
|
|
491
595
|
return arr[idx] !== undefined ? arr[idx] : fullMatch;
|
|
492
596
|
});
|
|
493
597
|
|
|
598
|
+
output = output.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.unit)(?:\(([^)]*)\))/g,
|
|
599
|
+
(fullMatch, arrayName, pl) => {
|
|
600
|
+
const arr = arraysExfscss[arrayName];
|
|
601
|
+
if (!arr) {
|
|
602
|
+
console.warn(`fscss[@arr] Warning: Array '${arrayName}' not found for direct access.`);
|
|
603
|
+
return fullMatch;
|
|
604
|
+
}
|
|
605
|
+
const sep = (pl !== undefined && pl !== "") ? pl : ' ';
|
|
606
|
+
return arr.map(u=>`${u+sep}`).join(',');
|
|
607
|
+
});
|
|
608
|
+
|
|
609
|
+
output = output.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.prefix)(?:\(([^)]*)\))/g,
|
|
610
|
+
(fullMatch, arrayName, pl) => {
|
|
611
|
+
const arr = arraysExfscss[arrayName];
|
|
612
|
+
if (!arr) {
|
|
613
|
+
console.warn(`fscss[@arr] Warning: Array '${arrayName}' not found for direct access.`);
|
|
614
|
+
return fullMatch;
|
|
615
|
+
}
|
|
616
|
+
const sep = (pl !== undefined && pl !== "") ? pl : ' ';
|
|
617
|
+
return arr.map(u=>`${sep+u}`).join(',');
|
|
618
|
+
});
|
|
619
|
+
|
|
620
|
+
|
|
621
|
+
|
|
622
|
+
output = output.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.surround)(?:\(([^)]+)\))/g,
|
|
623
|
+
(fullMatch, arrayName, sur) => {
|
|
624
|
+
const arr = arraysExfscss[arrayName];
|
|
625
|
+
if (!arr) {
|
|
626
|
+
console.warn(`fscss[@arr] Warning: Array '${arrayName}' not found for direct access.`);
|
|
627
|
+
return fullMatch;
|
|
628
|
+
}
|
|
629
|
+
if(!sur||sur===undefined||sur===""||!sur.includes(",")){
|
|
630
|
+
console.warn(
|
|
631
|
+
`[FSCSS Warning] @arr surround failed → Invalid or empty value at "${fullMatch}"`);
|
|
632
|
+
return fullMatch;
|
|
633
|
+
}
|
|
634
|
+
surArr = sur.split(',');
|
|
635
|
+
return arr.map(u=>`${surArr[0]+u+surArr.at(-1)}`).join(' ');
|
|
636
|
+
});
|
|
637
|
+
|
|
638
|
+
|
|
494
639
|
// 4. Direct array access: @arr.name or @arr.name(separator)
|
|
495
|
-
output = output.replace(/@arr\.([\w\-_—0-9]+)(?:\(([^)]*)\))
|
|
640
|
+
output = output.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.join)?(?:\(([^)]*)\))/g,
|
|
496
641
|
(fullMatch, arrayName, separator) => {
|
|
497
642
|
const arr = arraysExfscss[arrayName];
|
|
498
643
|
if (!arr) {
|
|
@@ -502,8 +647,18 @@ function procArr(input) {
|
|
|
502
647
|
const sep = (separator !== undefined && separator !== "") ? separator : ' ';
|
|
503
648
|
return arr.join(sep);
|
|
504
649
|
});
|
|
505
|
-
|
|
506
|
-
|
|
650
|
+
output = output.replace(/@arr\.([\w\-_—0-9]+)(!)?/g, (match, arrName, fos)=>{
|
|
651
|
+
const arr = arraysExfscss[arrName];
|
|
652
|
+
if (!arr) {
|
|
653
|
+
console.warn(`fscss[@arr] Warning: Array '${arrName}' not found for direct access.`);
|
|
654
|
+
return match;
|
|
655
|
+
}
|
|
656
|
+
if(fos){
|
|
657
|
+
return match;
|
|
658
|
+
}
|
|
659
|
+
return arr.join(' ');
|
|
660
|
+
})
|
|
661
|
+
// Clean up array declarations
|
|
507
662
|
return output
|
|
508
663
|
.replace(arrayDeclarationRegex, '')
|
|
509
664
|
.replace(/\n{3,}/g, '\n\n')
|
package/lib/functions/procImp.js
CHANGED
|
@@ -37,7 +37,7 @@ export async function procImp(css, { inputDir }) {
|
|
|
37
37
|
}
|
|
38
38
|
importedContent = fs.readFileSync(absPath, "utf8");
|
|
39
39
|
|
|
40
|
-
//
|
|
40
|
+
// recursive support (nested imports)
|
|
41
41
|
importedContent = await procImp(importedContent, {
|
|
42
42
|
inputDir: path.dirname(absPath),
|
|
43
43
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fscss",
|
|
3
|
-
"version": "1.1.12",
|
|
4
3
|
"description": "Figured Shorthand Cascading Style Sheet",
|
|
4
|
+
"version": "1.1.14",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "lib/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"fscss": "bin/fscss.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"start": "node index.js",
|
|
12
|
+
"test": "node bin/fscss.js example.fscss example.css"
|
|
13
|
+
},
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/Figsh/xfscss.git"
|
|
17
|
+
},
|
|
5
18
|
"keywords": [
|
|
6
19
|
"node",
|
|
7
20
|
"figsh_css",
|
|
@@ -10,34 +23,21 @@
|
|
|
10
23
|
"xfscss",
|
|
11
24
|
"preprocessor"
|
|
12
25
|
],
|
|
13
|
-
"
|
|
26
|
+
"author": "Figsh",
|
|
27
|
+
"license": "MIT",
|
|
14
28
|
"bugs": {
|
|
15
29
|
"url": "https://github.com/Figsh/xfscss/issues"
|
|
16
30
|
},
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
"
|
|
31
|
+
"homepage": "https://github.com/Figsh/xfscss#readme",
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"dotenv": "^16.0.3",
|
|
34
|
+
"express": "^4.18.2"
|
|
20
35
|
},
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"main": "lib/index.js",
|
|
25
|
-
"bin": {
|
|
26
|
-
"fscss": "bin/fscss.js"
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"chai": "^4.3.4",
|
|
38
|
+
"mocha": "^10.0.0"
|
|
27
39
|
},
|
|
28
40
|
"directories": {
|
|
29
41
|
"lib": "lib"
|
|
30
|
-
},
|
|
31
|
-
"scripts": {
|
|
32
|
-
"start": "node index.js",
|
|
33
|
-
"test": "node bin/fscss.js example.fscss example.css"
|
|
34
|
-
},
|
|
35
|
-
"dependencies": {
|
|
36
|
-
"express": "^4.18.2",
|
|
37
|
-
"dotenv": "^16.0.3"
|
|
38
|
-
},
|
|
39
|
-
"devDependencies": {
|
|
40
|
-
"mocha": "^10.0.0",
|
|
41
|
-
"chai": "^4.3.4"
|
|
42
42
|
}
|
|
43
43
|
}
|
package/xfscss.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
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://
|
|
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
3
|
AJWinDocStyleElement.innerHTML = `${data}`;
|
|
4
4
|
document.head.appendChild(AJWinDocStyleElement);}).catch(error=>{});}}export{ inf };export{ exec };
|
|
5
|
+
|
package/style.css
DELETED