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

@frui.ts/dirtycheck

Package Overview
Dependencies
Maintainers
5
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@frui.ts/dirtycheck - npm Package Compare versions

Comparing version 1.0.0-beta.1 to 1.0.0-beta.2

8

dist/automaticDirtyWatcher.d.ts

@@ -8,3 +8,3 @@ import type { PropertyName } from "@frui.ts/helpers";

}
export default class AutomaticDirtyWatcher<TEntity = any> extends DirtyWatcherBase<TEntity> {
export default class AutomaticDirtyWatcher<TEntity extends object = any> extends DirtyWatcherBase<TEntity> {
private target;

@@ -21,4 +21,4 @@ private _includedProperties?;

}
export declare function attachAutomaticDirtyWatcher<TEntity>(target: TEntity): AutomaticDirtyWatcher<TEntity>;
export declare function attachAutomaticDirtyWatcher<TEntity>(target: TEntity, isVisible: boolean): AutomaticDirtyWatcher<TEntity>;
export declare function attachAutomaticDirtyWatcher<TEntity>(target: TEntity, params: AutomaticDirtyWatcherParams<TEntity>): AutomaticDirtyWatcher<TEntity>;
export declare function attachAutomaticDirtyWatcher<TEntity extends object>(target: TEntity): AutomaticDirtyWatcher<TEntity>;
export declare function attachAutomaticDirtyWatcher<TEntity extends object>(target: TEntity, isVisible: boolean): AutomaticDirtyWatcher<TEntity>;
export declare function attachAutomaticDirtyWatcher<TEntity extends object>(target: TEntity, params: AutomaticDirtyWatcherParams<TEntity>): AutomaticDirtyWatcher<TEntity>;

@@ -1,21 +0,18 @@

import { isSet, isMap } from "@frui.ts/helpers";
import { observable, computed, get, isArrayLike, action } from "mobx";
var __defProp$1 = Object.defineProperty;
var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
var __decorateClass$1 = (decorators, target, key, kind) => {
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target;
for (var i = decorators.length - 1, decorator; i >= 0; i--)
if (decorator = decorators[i])
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
if (kind && result)
__defProp$1(target, key, result);
return result;
var W = Object.defineProperty;
var j = (s, r, e) => r in s ? W(s, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[r] = e;
var u = (s, r, e) => (j(s, typeof r != "symbol" ? r + "" : r, e), e);
import { isArrayLike as v, isSet as V, isMap as w } from "@frui.ts/helpers";
import { makeObservable as b, observable as y, computed as x, get as h, action as D } from "mobx";
var E = Object.defineProperty, A = Object.getOwnPropertyDescriptor, p = (s, r, e, i) => {
for (var t = i > 1 ? void 0 : i ? A(r, e) : r, c = s.length - 1, n; c >= 0; c--)
(n = s[c]) && (t = (i ? n(r, e, t) : n(t)) || t);
return i && t && E(r, e, t), t;
};
const emptyResults = [];
Object.freeze(emptyResults);
class DirtyWatcherBase {
constructor(isVisible = true) {
this.isEnabled = true;
this.isVisible = false;
this.isVisible = isVisible;
const P = [];
Object.freeze(P);
class d {
constructor(r = !0) {
u(this, "isEnabled", !0);
u(this, "isVisible", !1);
b(this), this.isVisible = r;
}

@@ -25,225 +22,158 @@ get isDirty() {

}
checkDirtyVisible(propertyName) {
if (!this.isEnabled || !this.isVisible) {
return false;
}
return this.checkDirty(propertyName);
checkDirtyVisible(r) {
return !this.isEnabled || !this.isVisible ? !1 : this.checkDirty(r);
}
getDirtyVisibleProperties() {
if (this.isEnabled && this.isVisible) {
return this.getDirtyProperties();
} else {
return emptyResults;
}
return this.isEnabled && this.isVisible ? this.getDirtyProperties() : P;
}
}
__decorateClass$1([
observable
], DirtyWatcherBase.prototype, "isEnabled", 2);
__decorateClass$1([
observable
], DirtyWatcherBase.prototype, "isVisible", 2);
__decorateClass$1([
computed
], DirtyWatcherBase.prototype, "isDirty", 1);
const configuration = {
p([
y
], d.prototype, "isEnabled", 2);
p([
y
], d.prototype, "isVisible", 2);
p([
x
], d.prototype, "isDirty", 1);
const _ = {
dirtyWatcherAttachedProperty: Symbol("DirtyWatch")
};
function attachDirtyWatcher(target, dirtyWatcher) {
target[configuration.dirtyWatcherAttachedProperty] = dirtyWatcher;
function S(s, r) {
s[_.dirtyWatcherAttachedProperty] = r;
}
function getDirtyWatcher(target) {
if (!target) {
return void 0;
}
return target[configuration.dirtyWatcherAttachedProperty];
function f(s) {
if (!!s)
return s[_.dirtyWatcherAttachedProperty];
}
class AutomaticDirtyWatcher extends DirtyWatcherBase {
constructor(target, params) {
super(params == null ? void 0 : params.isVisible);
this.target = target;
this._watchedProperties = [];
if (typeof params === "object") {
this._includedProperties = params.includedProperties;
this._excludedProperties = params.excludedProperties;
}
this.reset();
class z extends d {
constructor(e, i) {
super(i == null ? void 0 : i.isVisible);
u(this, "_includedProperties");
u(this, "_excludedProperties");
u(this, "_results");
u(this, "_watchedProperties", []);
this.target = e, typeof i == "object" && (this._includedProperties = i.includedProperties, this._excludedProperties = i.excludedProperties), this.reset();
}
checkDirty(propertyName) {
if (!this.isEnabled) {
return false;
}
if (propertyName) {
return !!this._results[propertyName];
} else {
for (const propertyName2 of this._watchedProperties) {
if (this._results[propertyName2]) {
return true;
}
}
return false;
}
checkDirty(e) {
if (!this.isEnabled)
return !1;
if (e)
return !!this._results[e];
for (const i of this._watchedProperties)
if (this._results[i])
return !0;
return !1;
}
*getDirtyProperties() {
if (!this.isEnabled) {
return;
}
for (const propertyName of this._watchedProperties) {
if (this._results[propertyName]) {
yield propertyName;
}
}
if (!!this.isEnabled)
for (const e of this._watchedProperties)
this._results[e] && (yield e);
}
reset() {
const resultsObject = {};
const e = {};
this._watchedProperties.length = 0;
for (const name of Object.keys(this.target)) {
const propertyName = name;
if ((!this._includedProperties || this._includedProperties.includes(propertyName)) && (!this._excludedProperties || !this._excludedProperties.includes(propertyName))) {
this._watchedProperties.push(propertyName);
const entity = this.target;
const originalValue = get(entity, propertyName);
if (isArrayLike(originalValue)) {
defineArrayDirtyWatchProperty(resultsObject, originalValue, propertyName, entity);
} else if (isSet(originalValue)) {
defineSetDirtyCheckProperty(resultsObject, originalValue, propertyName, entity);
} else if (isMap(originalValue)) {
defineMapDirtyCheckProperty(resultsObject, originalValue, propertyName, entity);
} else if (typeof originalValue === "object") {
defineObjectDirtyWatchProperty(resultsObject, originalValue, propertyName, entity);
} else {
Object.defineProperty(resultsObject, propertyName, {
get: () => {
const currentValue = get(entity, propertyName);
return originalValue !== currentValue;
}
});
}
for (const i of Object.keys(this.target)) {
const t = i;
if ((!this._includedProperties || this._includedProperties.includes(t)) && (!this._excludedProperties || !this._excludedProperties.includes(t))) {
this._watchedProperties.push(t);
const c = this.target, n = h(c, t);
v(n) ? C(e, n, t, c) : V(n) ? M(e, n, t, c) : w(n) ? $(e, n, t, c) : typeof n == "object" ? k(e, n, t, c) : Object.defineProperty(e, t, {
get: () => {
const o = h(c, t);
return n !== o;
}
});
}
}
this._results = observable(resultsObject);
this._results = y(e);
}
}
function defineArrayDirtyWatchProperty(resultsObject, originalValue, propertyName, entity) {
const arraySnapshot = originalValue.slice();
const hasNestedDirtyWatcher = !!getDirtyWatcher(arraySnapshot[0]);
if (hasNestedDirtyWatcher) {
Object.defineProperty(resultsObject, propertyName, {
get: () => {
const currentValue = get(entity, propertyName);
return !currentValue || currentValue.length !== arraySnapshot.length || arraySnapshot.some((originalItem, index) => {
var _a;
return originalItem !== currentValue[index] || ((_a = getDirtyWatcher(originalItem)) == null ? void 0 : _a.isDirty) === true;
});
}
});
} else {
Object.defineProperty(resultsObject, propertyName, {
get: () => {
const currentValue = get(entity, propertyName);
return !currentValue || currentValue.length !== arraySnapshot.length || arraySnapshot.some((originalItem, index) => originalItem !== currentValue[index]);
}
});
}
}
function defineSetDirtyCheckProperty(resultsObject, originalValue, propertyName, entity) {
const setSnapshot = new Set(originalValue);
Object.defineProperty(resultsObject, propertyName, {
function C(s, r, e, i) {
const t = r.slice();
!!f(t[0]) ? Object.defineProperty(s, e, {
get: () => {
var _a;
const currentValue = get(entity, propertyName);
if (!currentValue || currentValue.size !== setSnapshot.size) {
return true;
}
for (const item of setSnapshot.values()) {
if (!currentValue.has(item) || ((_a = getDirtyWatcher(item)) == null ? void 0 : _a.isDirty)) {
return true;
const n = h(i, e);
return !n || n.length !== t.length || t.some(
(o, l) => {
var a;
return o !== n[l] || ((a = f(o)) == null ? void 0 : a.isDirty) === !0;
}
}
return false;
);
}
}) : Object.defineProperty(s, e, {
get: () => {
const n = h(i, e);
return !n || n.length !== t.length || t.some((o, l) => o !== n[l]);
}
});
}
function defineMapDirtyCheckProperty(resultsObject, originalValue, propertyName, entity) {
const setSnapshot = new Map(originalValue);
Object.defineProperty(resultsObject, propertyName, {
function M(s, r, e, i) {
const t = new Set(r);
Object.defineProperty(s, e, {
get: () => {
var _a;
const currentValue = get(entity, propertyName);
if (!currentValue || currentValue.size !== setSnapshot.size) {
return true;
}
for (const [key, item] of setSnapshot.entries()) {
const currentItem = currentValue.get(key);
if (item !== currentItem || ((_a = getDirtyWatcher(item)) == null ? void 0 : _a.isDirty)) {
return true;
}
}
return false;
var n;
const c = h(i, e);
if (!c || c.size !== t.size)
return !0;
for (const o of t.values())
if (!c.has(o) || ((n = f(o)) == null ? void 0 : n.isDirty))
return !0;
return !1;
}
});
}
function defineObjectDirtyWatchProperty(resultsObject, originalValue, propertyName, entity) {
const hasNestedDirtyWatcher = getDirtyWatcher(originalValue);
if (hasNestedDirtyWatcher) {
Object.defineProperty(resultsObject, propertyName, {
get: () => {
var _a;
return ((_a = getDirtyWatcher(get(entity, propertyName))) == null ? void 0 : _a.isDirty) === true;
function $(s, r, e, i) {
const t = new Map(r);
Object.defineProperty(s, e, {
get: () => {
var n;
const c = h(i, e);
if (!c || c.size !== t.size)
return !0;
for (const [o, l] of t.entries()) {
const a = c.get(o);
if (l !== a || ((n = f(l)) == null ? void 0 : n.isDirty))
return !0;
}
});
} else {
Object.defineProperty(resultsObject, propertyName, {
get: () => {
const currentValue = get(entity, propertyName);
return originalValue !== currentValue;
}
});
}
return !1;
}
});
}
function attachAutomaticDirtyWatcher(target, params) {
const paramsObject = typeof params === "boolean" ? { isVisible: params } : params;
const automaticDirtyWatcher = new AutomaticDirtyWatcher(target, paramsObject);
attachDirtyWatcher(target, automaticDirtyWatcher);
return automaticDirtyWatcher;
function k(s, r, e, i) {
f(r) ? Object.defineProperty(s, e, {
get: () => {
var c;
return ((c = f(h(i, e))) == null ? void 0 : c.isDirty) === !0;
}
}) : Object.defineProperty(s, e, {
get: () => {
const c = h(i, e);
return r !== c;
}
});
}
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __decorateClass = (decorators, target, key, kind) => {
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
for (var i = decorators.length - 1, decorator; i >= 0; i--)
if (decorator = decorators[i])
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
if (kind && result)
__defProp(target, key, result);
return result;
function F(s, r) {
const e = typeof r == "boolean" ? { isVisible: r } : r, i = new z(s, e);
return S(s, i), i;
}
var B = Object.defineProperty, L = Object.getOwnPropertyDescriptor, g = (s, r, e, i) => {
for (var t = i > 1 ? void 0 : i ? L(r, e) : r, c = s.length - 1, n; c >= 0; c--)
(n = s[c]) && (t = (i ? n(r, e, t) : n(t)) || t);
return i && t && B(r, e, t), t;
};
class ManualDirtyWatcher extends DirtyWatcherBase {
constructor() {
super(...arguments);
this._dirtyProperties = observable.set();
class O extends d {
constructor(e = !0) {
super(e);
u(this, "_dirtyProperties", y.set());
b(this);
}
checkDirty(propertyName) {
if (!this.isEnabled) {
return false;
}
if (propertyName) {
return this._dirtyProperties.has(propertyName);
} else {
return this._dirtyProperties.size > 0;
}
checkDirty(e) {
return this.isEnabled ? e ? this._dirtyProperties.has(e) : this._dirtyProperties.size > 0 : !1;
}
getDirtyProperties() {
if (this.isEnabled) {
return this._dirtyProperties;
} else {
return emptyResults;
}
return this.isEnabled ? this._dirtyProperties : P;
}
setDirty(propertyName, isDirty = true) {
if (isDirty) {
this._dirtyProperties.add(propertyName);
} else {
this._dirtyProperties.delete(propertyName);
}
setDirty(e, i = !0) {
i ? this._dirtyProperties.add(e) : this._dirtyProperties.delete(e);
}

@@ -254,9 +184,16 @@ reset() {

}
__decorateClass([
action
], ManualDirtyWatcher.prototype, "setDirty", 1);
__decorateClass([
action
], ManualDirtyWatcher.prototype, "reset", 1);
export { AutomaticDirtyWatcher, configuration as Configuration, ManualDirtyWatcher, attachAutomaticDirtyWatcher, attachDirtyWatcher, getDirtyWatcher };
g([
D
], O.prototype, "setDirty", 1);
g([
D
], O.prototype, "reset", 1);
export {
z as AutomaticDirtyWatcher,
_ as Configuration,
O as ManualDirtyWatcher,
F as attachAutomaticDirtyWatcher,
S as attachDirtyWatcher,
f as getDirtyWatcher
};
//# sourceMappingURL=fruits-dirtycheck.es.js.map

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

(function(u,l){typeof exports=="object"&&typeof module!="undefined"?l(exports,require("@frui.ts/helpers"),require("mobx")):typeof define=="function"&&define.amd?define(["exports","@frui.ts/helpers","mobx"],l):(u=typeof globalThis!="undefined"?globalThis:u||self,l(u["fruits-dirtycheck"]={},u.helpers,u.mobx))})(this,function(u,l,o){"use strict";var v=Object.defineProperty,O=Object.getOwnPropertyDescriptor,p=(n,e,t,i)=>{for(var r=i>1?void 0:i?O(e,t):e,s=n.length-1,c;s>=0;s--)(c=n[s])&&(r=(i?c(e,t,r):c(r))||r);return i&&r&&v(e,t,r),r};const P=[];Object.freeze(P);class d{constructor(e=!0){this.isEnabled=!0,this.isVisible=!1,this.isVisible=e}get isDirty(){return this.checkDirty()}checkDirtyVisible(e){return!this.isEnabled||!this.isVisible?!1:this.checkDirty(e)}getDirtyVisibleProperties(){return this.isEnabled&&this.isVisible?this.getDirtyProperties():P}}p([o.observable],d.prototype,"isEnabled",2),p([o.observable],d.prototype,"isVisible",2),p([o.computed],d.prototype,"isDirty",1);const D={dirtyWatcherAttachedProperty:Symbol("DirtyWatch")};function b(n,e){n[D.dirtyWatcherAttachedProperty]=e}function f(n){if(!!n)return n[D.dirtyWatcherAttachedProperty]}class g extends d{constructor(e,t){super(t==null?void 0:t.isVisible),this.target=e,this._watchedProperties=[],typeof t=="object"&&(this._includedProperties=t.includedProperties,this._excludedProperties=t.excludedProperties),this.reset()}checkDirty(e){if(!this.isEnabled)return!1;if(e)return!!this._results[e];for(const t of this._watchedProperties)if(this._results[t])return!0;return!1}*getDirtyProperties(){if(!!this.isEnabled)for(const e of this._watchedProperties)this._results[e]&&(yield e)}reset(){const e={};this._watchedProperties.length=0;for(const t of Object.keys(this.target)){const i=t;if((!this._includedProperties||this._includedProperties.includes(i))&&(!this._excludedProperties||!this._excludedProperties.includes(i))){this._watchedProperties.push(i);const r=this.target,s=o.get(r,i);o.isArrayLike(s)?j(e,s,i,r):l.isSet(s)?V(e,s,i,r):l.isMap(s)?w(e,s,i,r):typeof s=="object"?A(e,s,i,r):Object.defineProperty(e,i,{get:()=>{const c=o.get(r,i);return s!==c}})}}this._results=o.observable(e)}}function j(n,e,t,i){const r=e.slice();!!f(r[0])?Object.defineProperty(n,t,{get:()=>{const c=o.get(i,t);return!c||c.length!==r.length||r.some((h,a)=>{var y;return h!==c[a]||((y=f(h))==null?void 0:y.isDirty)===!0})}}):Object.defineProperty(n,t,{get:()=>{const c=o.get(i,t);return!c||c.length!==r.length||r.some((h,a)=>h!==c[a])}})}function V(n,e,t,i){const r=new Set(e);Object.defineProperty(n,t,{get:()=>{var c;const s=o.get(i,t);if(!s||s.size!==r.size)return!0;for(const h of r.values())if(!s.has(h)||((c=f(h))==null?void 0:c.isDirty))return!0;return!1}})}function w(n,e,t,i){const r=new Map(e);Object.defineProperty(n,t,{get:()=>{var c;const s=o.get(i,t);if(!s||s.size!==r.size)return!0;for(const[h,a]of r.entries()){const y=s.get(h);if(a!==y||((c=f(a))==null?void 0:c.isDirty))return!0}return!1}})}function A(n,e,t,i){f(e)?Object.defineProperty(n,t,{get:()=>{var s;return((s=f(o.get(i,t)))==null?void 0:s.isDirty)===!0}}):Object.defineProperty(n,t,{get:()=>{const s=o.get(i,t);return e!==s}})}function S(n,e){const t=typeof e=="boolean"?{isVisible:e}:e,i=new g(n,t);return b(n,i),i}var E=Object.defineProperty,M=Object.getOwnPropertyDescriptor,W=(n,e,t,i)=>{for(var r=i>1?void 0:i?M(e,t):e,s=n.length-1,c;s>=0;s--)(c=n[s])&&(r=(i?c(e,t,r):c(r))||r);return i&&r&&E(e,t,r),r};class _ extends d{constructor(){super(...arguments),this._dirtyProperties=o.observable.set()}checkDirty(e){return this.isEnabled?e?this._dirtyProperties.has(e):this._dirtyProperties.size>0:!1}getDirtyProperties(){return this.isEnabled?this._dirtyProperties:P}setDirty(e,t=!0){t?this._dirtyProperties.add(e):this._dirtyProperties.delete(e)}reset(){this._dirtyProperties.clear()}}W([o.action],_.prototype,"setDirty",1),W([o.action],_.prototype,"reset",1),u.AutomaticDirtyWatcher=g,u.Configuration=D,u.ManualDirtyWatcher=_,u.attachAutomaticDirtyWatcher=S,u.attachDirtyWatcher=b,u.getDirtyWatcher=f,Object.defineProperties(u,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
(function(u,h){typeof exports=="object"&&typeof module<"u"?h(exports,require("@frui.ts/helpers"),require("mobx")):typeof define=="function"&&define.amd?define(["exports","@frui.ts/helpers","mobx"],h):(u=typeof globalThis<"u"?globalThis:u||self,h(u["fruits-dirtycheck"]={},u.helpers,u.mobx))})(this,function(u,h,o){"use strict";var C=Object.defineProperty;var k=(u,h,o)=>h in u?C(u,h,{enumerable:!0,configurable:!0,writable:!0,value:o}):u[h]=o;var l=(u,h,o)=>(k(u,typeof h!="symbol"?h+"":h,o),o);var O=Object.defineProperty,j=Object.getOwnPropertyDescriptor,P=(c,s,e,r)=>{for(var t=r>1?void 0:r?j(s,e):s,n=c.length-1,i;n>=0;n--)(i=c[n])&&(t=(r?i(s,e,t):i(t))||t);return r&&t&&O(s,e,t),t};const D=[];Object.freeze(D);class y{constructor(s=!0){l(this,"isEnabled",!0);l(this,"isVisible",!1);o.makeObservable(this),this.isVisible=s}get isDirty(){return this.checkDirty()}checkDirtyVisible(s){return!this.isEnabled||!this.isVisible?!1:this.checkDirty(s)}getDirtyVisibleProperties(){return this.isEnabled&&this.isVisible?this.getDirtyProperties():D}}P([o.observable],y.prototype,"isEnabled",2),P([o.observable],y.prototype,"isVisible",2),P([o.computed],y.prototype,"isDirty",1);const _={dirtyWatcherAttachedProperty:Symbol("DirtyWatch")};function g(c,s){c[_.dirtyWatcherAttachedProperty]=s}function a(c){if(!!c)return c[_.dirtyWatcherAttachedProperty]}class v extends y{constructor(e,r){super(r==null?void 0:r.isVisible);l(this,"_includedProperties");l(this,"_excludedProperties");l(this,"_results");l(this,"_watchedProperties",[]);this.target=e,typeof r=="object"&&(this._includedProperties=r.includedProperties,this._excludedProperties=r.excludedProperties),this.reset()}checkDirty(e){if(!this.isEnabled)return!1;if(e)return!!this._results[e];for(const r of this._watchedProperties)if(this._results[r])return!0;return!1}*getDirtyProperties(){if(!!this.isEnabled)for(const e of this._watchedProperties)this._results[e]&&(yield e)}reset(){const e={};this._watchedProperties.length=0;for(const r of Object.keys(this.target)){const t=r;if((!this._includedProperties||this._includedProperties.includes(t))&&(!this._excludedProperties||!this._excludedProperties.includes(t))){this._watchedProperties.push(t);const n=this.target,i=o.get(n,t);h.isArrayLike(i)?V(e,i,t,n):h.isSet(i)?w(e,i,t,n):h.isMap(i)?A(e,i,t,n):typeof i=="object"?S(e,i,t,n):Object.defineProperty(e,t,{get:()=>{const f=o.get(n,t);return i!==f}})}}this._results=o.observable(e)}}function V(c,s,e,r){const t=s.slice();!!a(t[0])?Object.defineProperty(c,e,{get:()=>{const i=o.get(r,e);return!i||i.length!==t.length||t.some((f,d)=>{var p;return f!==i[d]||((p=a(f))==null?void 0:p.isDirty)===!0})}}):Object.defineProperty(c,e,{get:()=>{const i=o.get(r,e);return!i||i.length!==t.length||t.some((f,d)=>f!==i[d])}})}function w(c,s,e,r){const t=new Set(s);Object.defineProperty(c,e,{get:()=>{var i;const n=o.get(r,e);if(!n||n.size!==t.size)return!0;for(const f of t.values())if(!n.has(f)||((i=a(f))==null?void 0:i.isDirty))return!0;return!1}})}function A(c,s,e,r){const t=new Map(s);Object.defineProperty(c,e,{get:()=>{var i;const n=o.get(r,e);if(!n||n.size!==t.size)return!0;for(const[f,d]of t.entries()){const p=n.get(f);if(d!==p||((i=a(d))==null?void 0:i.isDirty))return!0}return!1}})}function S(c,s,e,r){a(s)?Object.defineProperty(c,e,{get:()=>{var n;return((n=a(o.get(r,e)))==null?void 0:n.isDirty)===!0}}):Object.defineProperty(c,e,{get:()=>{const n=o.get(r,e);return s!==n}})}function E(c,s){const e=typeof s=="boolean"?{isVisible:s}:s,r=new v(c,e);return g(c,r),r}var M=Object.defineProperty,z=Object.getOwnPropertyDescriptor,W=(c,s,e,r)=>{for(var t=r>1?void 0:r?z(s,e):s,n=c.length-1,i;n>=0;n--)(i=c[n])&&(t=(r?i(s,e,t):i(t))||t);return r&&t&&M(s,e,t),t};class b extends y{constructor(e=!0){super(e);l(this,"_dirtyProperties",o.observable.set());o.makeObservable(this)}checkDirty(e){return this.isEnabled?e?this._dirtyProperties.has(e):this._dirtyProperties.size>0:!1}getDirtyProperties(){return this.isEnabled?this._dirtyProperties:D}setDirty(e,r=!0){r?this._dirtyProperties.add(e):this._dirtyProperties.delete(e)}reset(){this._dirtyProperties.clear()}}W([o.action],b.prototype,"setDirty",1),W([o.action],b.prototype,"reset",1),u.AutomaticDirtyWatcher=v,u.Configuration=_,u.ManualDirtyWatcher=b,u.attachAutomaticDirtyWatcher=E,u.attachDirtyWatcher=g,u.getDirtyWatcher=a,Object.defineProperties(u,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
//# sourceMappingURL=fruits-dirtycheck.umd.js.map
import type { PropertyName } from "@frui.ts/helpers";
import DirtyWatcherBase from "./dirtyWatcherBase";
export default class ManualDirtyWatcher<TEntity = any> extends DirtyWatcherBase<TEntity> {
protected _dirtyProperties: import("mobx").ObservableSet<PropertyName<TEntity>>;
protected _dirtyProperties: import("mobx").ObservableSet<PropertyName<TEntity, any>>;
constructor(isVisible?: boolean);
checkDirty(): boolean;
checkDirty(propertyName: PropertyName<TEntity>): boolean;
getDirtyProperties(): Iterable<PropertyName<TEntity>>;

@@ -8,0 +8,0 @@ setDirty(propertyName: PropertyName<TEntity>, isDirty?: boolean): void;

@@ -6,3 +6,3 @@ {

},
"version": "1.0.0-beta.1",
"version": "1.0.0-beta.2",
"description": "Observable dirty checking",

@@ -47,8 +47,8 @@ "keywords": [

"dependencies": {
"@frui.ts/helpers": "^1.0.0-beta.1"
"@frui.ts/helpers": "^1.0.0-beta.2"
},
"peerDependencies": {
"mobx": "^4.0.0 || ^5.0.0"
"mobx": "6"
},
"gitHead": "1a7897ad15a6a5be5adc7e67725f174a1dbc6394"
"gitHead": "5d7b8915490794c56dcad28698a47e6e2a904e4e"
}

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