Skip to content

@0xdolan/deq-elements

The <deq-icon> custom element for any page or framework.

<script type="module">
import "@0xdolan/deq-elements/define";
</script>
<deq-icon name="roj-half-sun" size="32" stroke-width="1.5"></deq-icon>

Source: packages/elements. Install with npm install @0xdolan/deq-elements.

Functions

defineDeqElements

function defineDeqElements(tag?: string): void

Register <deq-icon> (or another tag name). Safe to call more than once and on servers, where it does nothing.

drawIcon

function drawIcon(doc: Document, icon: DeqIcon, options?: IconOptions): SVGSVGElement

Build the <svg> element for icon with DOM calls (no HTML parsing).

Classes

DeqIconElement

class DeqIconElement

<deq-icon name="roj-half-sun">: draws a Deq icon inline (light DOM, so CSS color and selectors work). Attributes: name, size, color, stroke-width, absolute-stroke-width and label (the accessible title; label="" marks the icon decorative). Set the icon property to draw custom icon data instead of name.

  • #icon: DeqIcon | undefined
  • icon: DeqIcon | undefined: Custom icon data; takes precedence over the name attribute.
  • connectedCallback: () => void
  • attributeChangedCallback: () => void
  • options: () => IconOptions: The icon options from the attributes.
  • update: () => void: Redraw the icon now. Lifecycle callbacks redraw automatically and leave the element empty for an unknown name or invalid attributes; this method throws instead.
  • #draw: () => void

Constants

packageName

const packageName: '@0xdolan/deq-elements'

The npm package name.