Use Web Components as React Components.
Import reactCustomElements
as a module:
import * as reactCustomElements from 'https://gist.githack.com/jonathantneal/b3df57a4c59cd70e0d18437352586794/raw/reactCustomElements.esm.min.js'
/* These rules are ignored when ui-monospace is supported. */ | |
@font-face { font-family: ui-monospace; src: | |
/* MacOS (El Capitan +) */ | |
local(Menlo-Regular), | |
/* Windows (11 +) */ | |
local(CascadiaCode-Regular), | |
/* Windows (Vista +) */ | |
local(Consolas), | |
/* Android */ | |
local(RobotoMono-Regular), |
class CSSStyleRecord { | |
constructor( | |
/** @type {{ target: Element, propertyName: string, oldValue: string, newValue: string }} */ | |
init | |
) { | |
Object.assign(this, init) | |
} | |
} | |
class CSSStyleObserver { |
{ | |
let NativeHTMLElement = globalThis.HTMLElement, isContentAvailable = (element) => { | |
if (element.ownerDocument.readyState !== 'loading') return true | |
while (element) { | |
if (element.nextSibling) return true | |
element = element.parentElement | |
} | |
} |
import glob from 'fast-glob' | |
import nodeURL from 'url' | |
import process from 'process' | |
/** Returns pathnames matching the given pattern. */ | |
const sync = (source: string) => glob.sync(source, options()) as string[] | |
/** Returns pathnames matching the given pattern. */ | |
const async = (source: string) => glob(source, options()) as Promise<string[]> |
# Brew Package Manager | |
# -------------------- | |
# Brew | |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
# JavaScript & TypeScript runtime | |
brew install deno | |
# GitHub manager |
/** | |
* The **Tokens** interface represents a set of space-separated tokens. | |
* | |
* **Usage**: | |
* ```js | |
* let classTokens = new Tokens(document.body, 'class') | |
* classTokens.has('js') // boolean | |
* classTokens.add('js').has('js') // true | |
* classTokens.remove('js').has('js') // false | |
* ``` |
":" //#;exec /usr/bin/env node --input-type=module - $@<$0 | |
import process from 'process' | |
const { argv } = process | |
console.log(argv) |
Use Web Components as React Components.
Import reactCustomElements
as a module:
import * as reactCustomElements from 'https://gist.githack.com/jonathantneal/b3df57a4c59cd70e0d18437352586794/raw/reactCustomElements.esm.min.js'
/** Return a unique selector for a specific element. */ | |
let getUniqueSelector = (/** @type {Element} */ element) => { | |
/** Unique selector for this element */ | |
let selector = '' | |
/** @type {Element} */ | |
let parent | |
/** @type {number} */ | |
let nth |
<!DOCTYPE xml [ | |
<!ATTLIST xsl:stylesheet | |
id ID #FIXED '!' | |
xmlns:xsl CDATA #FIXED 'http://www.w3.org/1999/XSL/Transform' | |
version CDATA #FIXED '1.0' | |
> | |
<!ATTLIST xsl:output | |
doctype-system CDATA #FIXED 'about:legacy-compat' | |
method CDATA #FIXED 'html' | |
> |