New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@rhtml/decorators

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rhtml/decorators

Reactive HyperText Markup Language

Source
npmnpm
Version
0.0.144
Version published
Maintainers
1
Created
Source

@rhtml/decorators

Installation

npm i @rhtml/decorators

Usage

import { Attribute, Options, Input } from '@rhtml/custom-attributes';
import { HostListener } from '@rhtml/decorators';

@Modifier({
  selector: 'test',
})
export class TestDirective extends Attribute {
  @Input()
  myProperty: string;

  @HostListener('mouseenter')
  enter(event: Event) {
    console.log('ENTER', this, event);
    console.log(this.myProperty);
  }

  @HostListener('mouseleave')
  leave(event: Event) {
    console.log('LEAVE', this, event);
    console.log(this.myProperty);
  }
}
<div test myProperty="12312">111</div>

Usage inside @rxdi/lit-html

import { Component, html, LitElement } from '@rxdi/lit-html';

import { HostListener } from '@rhtml/decorators';

/**
 * @customElement home-component
 */
@Component({
  selector: 'home-component',
  template(this) {
    return html` Home Component `;
  },
})
export class HomeComponent extends LitElement {
  @HostListener('mouseenter') onEnter() {
    console.log('Enter home');
  }

  @HostListener('mouseleave') onLeave() {
    console.log('Leave home');
  }
}

Add window event listener

import { Component, html, LitElement } from '@rxdi/lit-html';

import { HostListener } from '@rhtml/decorators';

/**
 * @customElement home-component
 */
@Component({
  selector: 'home-component',
  template(this) {
    return html` Home Component `;
  },
})
export class HomeComponent extends LitElement {
  @HostListener('window:mouseenter')
  onEnter() {
    console.log('Enter home');
  }

  @HostListener('window:mouseleave')
  onLeave() {
    console.log('Leave home');
  }
}

@HostBinding and @Input decorators

Specifiyng Input and HostBinding decorator gives you an reactive ability to assign styles directly to input properties This way by editing padding, color or background will reflect to the style associated with By doing this we can skip OnInit, OnDestroy, OnUpdate manual assign inside hooks

import { Attribute, Input, Modifier } from '@rhtml/custom-attributes';
import { HostBinding } from '@rhtml/decorators';

@Modifier({
  selector: 'layout',
})
export class CustomLayout extends Attribute {
  @Input({ observe: true })
  @HostBinding('style.padding')
  padding: string;

  @Input({ observe: true })
  @HostBinding('style.color')
  color: string;

  @Input({ observe: true })
  @HostBinding('style.background')
  background: string;
}

FAQs

Package last updated on 29 Jan 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts