Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

prop-change-decorators

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prop-change-decorators - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

dist/chunk-7JOYWUXA.cjs

6

dist/decorators/WatchBoolean.d.ts
interface WatchBooleanOptions<Key extends string> {
name: Key;
}
type WatchBooleanDecorated<Key extends string, KeyInt extends string | symbol = `__${Key}__`> = {
[key in Key | KeyInt]: boolean;
type WatchBooleanDecorated<Key extends string> = {
[key in Key]: boolean;
};
declare const WatchBoolean: <Key extends string>(options: WatchBooleanOptions<Key>) => <KeyInt extends string | symbol>(objOrCls: WatchBooleanDecorated<Key, KeyInt>, propertyKey: KeyInt) => void;
declare const WatchBoolean: <Key extends string>(options: WatchBooleanOptions<Key>) => <KeyInt extends string | symbol = `__${Key}__`>(objOrCls: WatchBooleanDecorated<Key>, propertyKey: KeyInt) => void;
export { WatchBoolean, WatchBooleanDecorated, WatchBooleanOptions };

@@ -1,1 +0,1 @@

import{a}from"../chunk-WYOYSBDJ.js";import"../chunk-ABN2ZY4R.js";import"../chunk-ZQJHQBDQ.js";export{a as WatchBoolean};
import{a}from"../chunk-PBD76SRV.js";import"../chunk-ABN2ZY4R.js";import"../chunk-ZQJHQBDQ.js";export{a as WatchBoolean};
interface WatchNumberOptions<Key extends string> {
name: Key;
}
type WatchNumberDecorated<Key extends string, KeyInt extends string | symbol = `__${Key}__`> = {
[key in Key | KeyInt]: number;
type WatchNumberDecorated<Key extends string> = {
[key in Key]: number;
};
declare const WatchNumber: <Key extends string>(options: WatchNumberOptions<Key>) => <KeyInt extends string | symbol>(objOrCls: WatchNumberDecorated<Key, KeyInt>, propertyKey: KeyInt) => void;
declare const WatchNumber: <Key extends string>(options: WatchNumberOptions<Key>) => <KeyInt extends string | symbol>(objOrCls: WatchNumberDecorated<Key>, propertyKey: KeyInt) => void;
export { WatchNumber, WatchNumberDecorated, WatchNumberOptions };

@@ -1,1 +0,1 @@

import{a}from"../chunk-GCQZDEIJ.js";import"../chunk-ABN2ZY4R.js";import"../chunk-ZQJHQBDQ.js";export{a as WatchNumber};
import{a}from"../chunk-GK4OCQKY.js";import"../chunk-ABN2ZY4R.js";import"../chunk-ZQJHQBDQ.js";export{a as WatchNumber};

@@ -1,1 +0,1 @@

import{a as t}from"./chunk-TEKHYVWD.js";import{a as x}from"./chunk-E4RMVX7F.js";import{a as p}from"./chunk-W4QVAG7K.js";import{a}from"./chunk-WYOYSBDJ.js";import{a as b}from"./chunk-GCQZDEIJ.js";import{a as r,b as e,c as f,d as m}from"./chunk-ABN2ZY4R.js";import{a as o}from"./chunk-ZQJHQBDQ.js";export{o as Change,t as Clamp,x as ClampTarget,p as Dispatcher,a as WatchBoolean,b as WatchNumber,f as dispatchChange,e as dispatchChanges,r as getChangeDispatcher,m as hasKeys};
import{a as t}from"./chunk-TEKHYVWD.js";import{a as x}from"./chunk-E4RMVX7F.js";import{a as p}from"./chunk-W4QVAG7K.js";import{a}from"./chunk-PBD76SRV.js";import{a as b}from"./chunk-GK4OCQKY.js";import{a as r,b as e,c as f,d as m}from"./chunk-ABN2ZY4R.js";import{a as o}from"./chunk-ZQJHQBDQ.js";export{o as Change,t as Clamp,x as ClampTarget,p as Dispatcher,a as WatchBoolean,b as WatchNumber,f as dispatchChange,e as dispatchChanges,r as getChangeDispatcher,m as hasKeys};
{
"name": "prop-change-decorators",
"version": "1.0.0",
"version": "1.0.1",
"description": "",

@@ -5,0 +5,0 @@ "author": "Arumi Sakura",

@@ -8,3 +8,3 @@ import { Clamp } from './Clamp';

@Dispatcher()
change$: ChangeDispatcher<Entity>;
readonly change$: ChangeDispatcher<Entity>;

@@ -11,0 +11,0 @@ @Clamp({ name: 'numberValue' })

@@ -9,3 +9,3 @@ import { Clamp } from './Clamp';

@Dispatcher()
change$: ChangeDispatcher<Entity>;
readonly change$: ChangeDispatcher<Entity>;

@@ -12,0 +12,0 @@ @Clamp({ name: 'numberValue' })

@@ -7,3 +7,3 @@ import { Dispatcher } from './Dispatcher';

@Dispatcher()
change$: ChangeDispatcher<Entity>;
readonly change$: ChangeDispatcher<Entity>;
}

@@ -10,0 +10,0 @@

@@ -8,6 +8,6 @@ import { WatchBoolean } from './WatchBoolean';

@Dispatcher()
change$: ChangeDispatcher<Entity>;
readonly change$: ChangeDispatcher<Entity>;
@WatchBoolean({ name: 'boolValue' })
__boolValue__ = false;
private __boolValue__ = false;
boolValue: boolean;

@@ -18,3 +18,3 @@ }

@WatchBoolean({ name: 'boolValue' })
__boolValue__ = false;
private __boolValue__ = false;
boolValue: boolean;

@@ -21,0 +21,0 @@ }

@@ -7,16 +7,20 @@ import { dispatchChange } from '../internals/ChangeDispatcher';

export type WatchBooleanDecorated<Key extends string, KeyInt extends string | symbol = `__${Key}__`> = {
[key in Key | KeyInt]: boolean;
export type WatchBooleanDecorated<Key extends string> = {
[key in Key]: boolean;
};
type WatchBooleanDecoratedInt<KeyInt extends string | symbol> = {
[key in KeyInt]: boolean;
};
export const WatchBoolean = <Key extends string>(options: WatchBooleanOptions<Key>) => {
const name = options.name;
return function <KeyInt extends string | symbol>(objOrCls: WatchBooleanDecorated<Key, KeyInt>, propertyKey: KeyInt) {
return function <KeyInt extends string | symbol = `__${Key}__`>(objOrCls: WatchBooleanDecorated<Key>, propertyKey: KeyInt) {
Object.defineProperties(objOrCls, {
[name]: {
get: function (this: typeof objOrCls): boolean {
get: function (this: WatchBooleanDecorated<Key> & WatchBooleanDecoratedInt<KeyInt>): boolean {
return this[propertyKey];
},
set: function (this: typeof objOrCls, value: boolean) {
set: function (this: WatchBooleanDecorated<Key> & WatchBooleanDecoratedInt<KeyInt>, value: boolean) {
value = Boolean(value);

@@ -23,0 +27,0 @@ const oldValue = this[propertyKey];

@@ -8,10 +8,10 @@ import { WatchNumber } from './WatchNumber';

@Dispatcher()
change$: ChangeDispatcher<Entity>;
readonly change$: ChangeDispatcher<Entity>;
@WatchNumber({ name: 'numberValue' })
__numberValue__ = 0;
private __numberValue__ = 0;
numberValue: number;
@WatchNumber({ name: 'otherNumberValue' })
__otherNumberValue__ = -100;
private __otherNumberValue__ = -100;
otherNumberValue: number;

@@ -18,0 +18,0 @@ }

@@ -7,16 +7,20 @@ import { dispatchChange } from '../internals/ChangeDispatcher';

export type WatchNumberDecorated<Key extends string, KeyInt extends string | symbol = `__${Key}__`> = {
[key in Key | KeyInt]: number;
export type WatchNumberDecorated<Key extends string> = {
[key in Key]: number;
};
type WatchNumberDecoratedInt<KeyInt extends string | symbol> = {
[key in KeyInt]: number;
};
export const WatchNumber = <Key extends string>(options: WatchNumberOptions<Key>) => {
const name = options.name;
return function <KeyInt extends string | symbol>(objOrCls: WatchNumberDecorated<Key, KeyInt>, propertyKey: KeyInt) {
return function <KeyInt extends string | symbol>(objOrCls: WatchNumberDecorated<Key>, propertyKey: KeyInt) {
Object.defineProperties(objOrCls, {
[name]: {
get: function (this: typeof objOrCls): number {
get: function (this: WatchNumberDecorated<Key> & WatchNumberDecoratedInt<KeyInt>): number {
return this[propertyKey];
},
set: function (this: typeof objOrCls, value: number) {
set: function (this: WatchNumberDecorated<Key> & WatchNumberDecoratedInt<KeyInt>, value: number) {
value = Number(value);

@@ -23,0 +27,0 @@ const oldValue = this[propertyKey];

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc