This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* --rnd1k is set from 0 - 1023 seemingly randomly as page is scrolled */ | |
| @property --scrpos { | |
| syntax: "<number>"; | |
| inherits: true; | |
| initial-value: 0; | |
| } | |
| @property --rnd1k { | |
| syntax: "<number>"; | |
| inherits: true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function json2css(o, selector, blnMinify) { | |
| if(!Array.isArray(o)) { | |
| let sepItems = blnMinify ? "" : "\n\t", | |
| sepLines = blnMinify ? "}\n" : ";\n}", | |
| sepProp = blnMinify ? "" : " "; | |
| return(`${selector||":root"}${sepProp}{${sepItems}` + Object.entries(o).map(([k, v], i) => { | |
| return `--${k.replace(/\s/g, "-")}:${sepProp}${JSON.stringify(v).replace(/\\n/g,"\\A")}`; | |
| }).join(`;${sepItems}`) + `${sepLines}`); | |
| } // end if !array |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [data-mixin] { /* lashes attribs to animation names to load mixins in CSV list */ | |
| animation: 1ms paused --none; | |
| animation-name: attr(data-mixin type(<custom-ident>#)); | |
| } | |
| /* mixins are defined here, can have many rules each */ | |
| @keyframes red {from{ | |
| color:red; | |
| }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* chrome-only at time of writing, but fingers crossed... <style>/* */ | |
| @keyframes cars { | |
| 10% { | |
| --make: "GMC"; | |
| --country: "USA"; | |
| --kind: "Truck"; | |
| --model: "Sierra"; | |
| } | |
| 20% { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @function --mix(--name type(<custom-ident>)) { | |
| result: 1ms paused var(--name); | |
| } | |
| @keyframes testMixin {from{ | |
| color:red; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function processMixins(sheet) { | |
| /* | |
| enables mixins in css. works on <style> tag content and cors-enabled css with link tags like | |
| <link crossorigin="anonymous" href="..." rel=stylesheet > | |
| css-based inclusions: | |
| \/ --uglyBorder { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let esc = { | |
| html: s=>new Option(s).innerHTML, | |
| js : s=>JSON.stringify(s).slice(1,-1), | |
| json: JSON.stringify, | |
| css : CSS.escape, | |
| rx : RegExp.escape, | |
| url : encodeURIComponent, | |
| }; // end esc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Elm(tag = "div", contents = "", attrs = {}) { | |
| var elm = tag instanceof Element ? tag : document.createElement(tag); | |
| Object.entries(attrs).forEach(([k, v]) => { | |
| if(typeof v === "function") return elm.addEventListener(k, v); | |
| if(k === "dataset") return Object.keys(v).forEach(x => elm.dataset[x] = v[x]); | |
| elm.setAttribute(k, v); | |
| }); | |
| if(/</.test(contents)) { elm.innerHTML = contents; } else { elm.append(contents); } | |
| return elm; | |
| }//end Elm() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function ael(dest, type, fn, ops){ | |
| let ret={ dest, type, fn, ops, elm: dest }; | |
| if(typeof dest === "string"){ | |
| ret.elm = document; | |
| ret.fn = function(e){ if(e.target.matches(dest)) return ret.fn.call(this, e, ret); }; | |
| } | |
| ret.remove = x=>ret.elm.removeEventListener(ret.elm, type, ret.fn, ops); | |
| ret.add = ael.bind(this, dest); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // dan's naive css formatter for editors | |
| // reliably parses and formats css using browser's CSS engine: | |
| // sorts properties in rules, removes property repeats (and fallbacks), removes vendor-specific syntax, and removes comments. | |
| // punctuationReplacements are executed while quoted strings are removed, making rule content predictable | |
| //////////////////// | |
| // DOES NOT SUPPORT NESTED RULES - MAINLY TO FORMAT SNIPPETS IN A TEXT EDITOR - NOT PRODUCTION MACHINERY!!!! | |
| //////////////////// |
NewerOlder