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

@rallie/vue

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rallie/vue - npm Package Compare versions

Comparing version 0.7.1 to 0.8.0

8

dist/hooks.d.ts
import { UnwrapRef } from 'vue';
import type { App, Connector } from 'rallie';
export declare function useRallieState<T extends App | Connector, U>(app: T, getter: (state: T['state']) => U): import("vue").Ref<UnwrapRef<U>>;
export declare function useRallieEvents<T extends App | Connector>(app: T, events: Partial<T['events']>): void;
export declare function useRallieMethods<T extends App>(app: T, methods: Partial<T['methods']>): void;
import type { Block, CreatedBlock } from 'rallie';
export declare function useBlockState<T extends Block<any, any, any>, U>(block: T, getter: (state: T['state']) => U): import("vue").Ref<UnwrapRef<U>>;
export declare function useBlockEvents<T extends Block<any, any, any>>(block: T, events: Partial<T['events']>): void;
export declare function useBlockMethods<T extends CreatedBlock<any, any, any>>(block: T, methods: Partial<T['methods']>): void;
import { ref, onBeforeMount, onBeforeUnmount } from 'vue';
function useRallieState(app, getter) {
var stateRef = ref(getter(app.state));
function useBlockState(block, getter) {
var stateRef = ref(getter(block.state));
var unwatch = null;
onBeforeMount(function () {
unwatch = app.watchState(getter).do(function (value) {
unwatch = block.watchState(getter).do(function (value) {
stateRef.value = value;

@@ -16,6 +16,6 @@ });

}
function useRallieEvents(app, events) {
function useBlockEvents(block, events) {
var off = null;
onBeforeMount(function () {
off = app.listenEvents(events);
off = block.listenEvents(events);
});

@@ -26,6 +26,6 @@ onBeforeUnmount(function () {

}
function useRallieMethods(app, methods) {
function useBlockMethods(block, methods) {
var off = null;
onBeforeMount(function () {
off = app.addMethods(methods);
off = block.addMethods(methods);
});

@@ -37,7 +37,7 @@ onBeforeUnmount(function () {

function mixinRallieState(app, mapStateToComputed) {
function mixinBlockState(block, mapStateToComputed) {
var unwatchState = null;
var computed = {};
var mappedState = mapStateToComputed(app.state);
var dataKey = "rallie-state-".concat(app.name);
var mappedState = mapStateToComputed(block.state);
var dataKey = "rallie-state-".concat(block.name);
Object.keys(mappedState).forEach(function (key) {

@@ -59,15 +59,17 @@ computed[key] = function () {

var _this = this;
unwatchState = app.watchState(mapStateToComputed).do(function (value) {
unwatchState = block.watchState(mapStateToComputed).do(function (value) {
_this[dataKey] = value;
});
},
// for vue2
beforeDestroy: function () {
unwatchState();
},
// for vue3
beforeUnmount: function () {
unwatchState();
}
},
};
}
function mixinRallieEvents(app, events) {
function mixinBlockEvents(block, events) {
var offEvents = null;

@@ -83,13 +85,15 @@ return {

});
offEvents = app.listenEvents(_events);
offEvents = block.listenEvents(_events);
},
// for vue2
beforeDestroy: function () {
offEvents();
},
// for vue3
beforeUnmount: function () {
offEvents();
}
},
};
}
function mixinRallieMethods(app, methods) {
function mixinBlockMethods(block, methods) {
var offMethods = null;

@@ -105,13 +109,15 @@ return {

});
offMethods = app.addMethods(_methods);
offMethods = block.addMethods(_methods);
},
// for vue2
beforeDestroy: function () {
offMethods();
},
// for vue3
beforeUnmount: function () {
offMethods();
}
},
};
}
export { mixinRallieEvents, mixinRallieMethods, mixinRallieState, useRallieEvents, useRallieMethods, useRallieState };
export { mixinBlockEvents, mixinBlockMethods, mixinBlockState, useBlockEvents, useBlockMethods, useBlockState };

@@ -7,7 +7,7 @@ (function (global, factory) {

function useRallieState(app, getter) {
var stateRef = vue.ref(getter(app.state));
function useBlockState(block, getter) {
var stateRef = vue.ref(getter(block.state));
var unwatch = null;
vue.onBeforeMount(function () {
unwatch = app.watchState(getter).do(function (value) {
unwatch = block.watchState(getter).do(function (value) {
stateRef.value = value;

@@ -21,6 +21,6 @@ });

}
function useRallieEvents(app, events) {
function useBlockEvents(block, events) {
var off = null;
vue.onBeforeMount(function () {
off = app.listenEvents(events);
off = block.listenEvents(events);
});

@@ -31,6 +31,6 @@ vue.onBeforeUnmount(function () {

}
function useRallieMethods(app, methods) {
function useBlockMethods(block, methods) {
var off = null;
vue.onBeforeMount(function () {
off = app.addMethods(methods);
off = block.addMethods(methods);
});

@@ -42,7 +42,7 @@ vue.onBeforeUnmount(function () {

function mixinRallieState(app, mapStateToComputed) {
function mixinBlockState(block, mapStateToComputed) {
var unwatchState = null;
var computed = {};
var mappedState = mapStateToComputed(app.state);
var dataKey = "rallie-state-".concat(app.name);
var mappedState = mapStateToComputed(block.state);
var dataKey = "rallie-state-".concat(block.name);
Object.keys(mappedState).forEach(function (key) {

@@ -64,15 +64,17 @@ computed[key] = function () {

var _this = this;
unwatchState = app.watchState(mapStateToComputed).do(function (value) {
unwatchState = block.watchState(mapStateToComputed).do(function (value) {
_this[dataKey] = value;
});
},
// for vue2
beforeDestroy: function () {
unwatchState();
},
// for vue3
beforeUnmount: function () {
unwatchState();
}
},
};
}
function mixinRallieEvents(app, events) {
function mixinBlockEvents(block, events) {
var offEvents = null;

@@ -88,13 +90,15 @@ return {

});
offEvents = app.listenEvents(_events);
offEvents = block.listenEvents(_events);
},
// for vue2
beforeDestroy: function () {
offEvents();
},
// for vue3
beforeUnmount: function () {
offEvents();
}
},
};
}
function mixinRallieMethods(app, methods) {
function mixinBlockMethods(block, methods) {
var offMethods = null;

@@ -110,19 +114,21 @@ return {

});
offMethods = app.addMethods(_methods);
offMethods = block.addMethods(_methods);
},
// for vue2
beforeDestroy: function () {
offMethods();
},
// for vue3
beforeUnmount: function () {
offMethods();
}
},
};
}
exports.mixinRallieEvents = mixinRallieEvents;
exports.mixinRallieMethods = mixinRallieMethods;
exports.mixinRallieState = mixinRallieState;
exports.useRallieEvents = useRallieEvents;
exports.useRallieMethods = useRallieMethods;
exports.useRallieState = useRallieState;
exports.mixinBlockEvents = mixinBlockEvents;
exports.mixinBlockMethods = mixinBlockMethods;
exports.mixinBlockState = mixinBlockState;
exports.useBlockEvents = useBlockEvents;
exports.useBlockMethods = useBlockMethods;
exports.useBlockState = useBlockState;

@@ -129,0 +135,0 @@ Object.defineProperty(exports, '__esModule', { value: true });

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

function mixinRallieState(app, mapStateToComputed) {
function mixinBlockState(block, mapStateToComputed) {
var unwatchState = null;
var computed = {};
var mappedState = mapStateToComputed(app.state);
var dataKey = "rallie-state-".concat(app.name);
var mappedState = mapStateToComputed(block.state);
var dataKey = "rallie-state-".concat(block.name);
Object.keys(mappedState).forEach(function (key) {

@@ -22,15 +22,17 @@ computed[key] = function () {

var _this = this;
unwatchState = app.watchState(mapStateToComputed).do(function (value) {
unwatchState = block.watchState(mapStateToComputed).do(function (value) {
_this[dataKey] = value;
});
},
// for vue2
beforeDestroy: function () {
unwatchState();
},
// for vue3
beforeUnmount: function () {
unwatchState();
}
},
};
}
function mixinRallieEvents(app, events) {
function mixinBlockEvents(block, events) {
var offEvents = null;

@@ -46,13 +48,15 @@ return {

});
offEvents = app.listenEvents(_events);
offEvents = block.listenEvents(_events);
},
// for vue2
beforeDestroy: function () {
offEvents();
},
// for vue3
beforeUnmount: function () {
offEvents();
}
},
};
}
function mixinRallieMethods(app, methods) {
function mixinBlockMethods(block, methods) {
var offMethods = null;

@@ -68,13 +72,15 @@ return {

});
offMethods = app.addMethods(_methods);
offMethods = block.addMethods(_methods);
},
// for vue2
beforeDestroy: function () {
offMethods();
},
// for vue3
beforeUnmount: function () {
offMethods();
}
},
};
}
export { mixinRallieEvents, mixinRallieMethods, mixinRallieState };
export { mixinBlockEvents, mixinBlockMethods, mixinBlockState };

@@ -7,7 +7,7 @@ (function (global, factory) {

function mixinRallieState(app, mapStateToComputed) {
function mixinBlockState(block, mapStateToComputed) {
var unwatchState = null;
var computed = {};
var mappedState = mapStateToComputed(app.state);
var dataKey = "rallie-state-".concat(app.name);
var mappedState = mapStateToComputed(block.state);
var dataKey = "rallie-state-".concat(block.name);
Object.keys(mappedState).forEach(function (key) {

@@ -29,15 +29,17 @@ computed[key] = function () {

var _this = this;
unwatchState = app.watchState(mapStateToComputed).do(function (value) {
unwatchState = block.watchState(mapStateToComputed).do(function (value) {
_this[dataKey] = value;
});
},
// for vue2
beforeDestroy: function () {
unwatchState();
},
// for vue3
beforeUnmount: function () {
unwatchState();
}
},
};
}
function mixinRallieEvents(app, events) {
function mixinBlockEvents(block, events) {
var offEvents = null;

@@ -53,13 +55,15 @@ return {

});
offEvents = app.listenEvents(_events);
offEvents = block.listenEvents(_events);
},
// for vue2
beforeDestroy: function () {
offEvents();
},
// for vue3
beforeUnmount: function () {
offEvents();
}
},
};
}
function mixinRallieMethods(app, methods) {
function mixinBlockMethods(block, methods) {
var offMethods = null;

@@ -75,16 +79,18 @@ return {

});
offMethods = app.addMethods(_methods);
offMethods = block.addMethods(_methods);
},
// for vue2
beforeDestroy: function () {
offMethods();
},
// for vue3
beforeUnmount: function () {
offMethods();
}
},
};
}
exports.mixinRallieEvents = mixinRallieEvents;
exports.mixinRallieMethods = mixinRallieMethods;
exports.mixinRallieState = mixinRallieState;
exports.mixinBlockEvents = mixinBlockEvents;
exports.mixinBlockMethods = mixinBlockMethods;
exports.mixinBlockState = mixinBlockState;

@@ -91,0 +97,0 @@ Object.defineProperty(exports, '__esModule', { value: true });

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

import { App, Connector } from 'rallie';
export declare function mixinRallieState<T extends App | Connector, U>(app: T, mapStateToComputed: (state: T['state']) => U): {
import type { Block, CreatedBlock } from 'rallie';
export declare function mixinBlockState<T extends Block<any, any, any>, U>(block: T, mapStateToComputed: (state: T['state']) => U): {
data(): {

@@ -11,3 +11,3 @@ [x: string]: U;

};
export declare function mixinRallieEvents<T extends App | Connector>(app: T, events: Partial<T['events']>): {
export declare function mixinBlockEvents<T extends Block<any, any, any>>(block: T, events: Partial<T['events']>): {
methods: Partial<T["events"]>;

@@ -18,3 +18,3 @@ mounted(): void;

};
export declare function mixinRallieMethods<T extends App>(app: T, methods: Partial<T['methods']>): {
export declare function mixinBlockMethods<T extends CreatedBlock<any, any, any>>(block: T, methods: Partial<T['methods']>): {
methods: Partial<T["methods"]>;

@@ -21,0 +21,0 @@ created(): void;

{
"name": "@rallie/vue",
"version": "0.7.1",
"version": "0.8.0",
"description": "vue binding for rallie",

@@ -29,5 +29,5 @@ "author": "runnan <1608272694@qq.com>",

"devDependencies": {
"rallie": "^0.7.1"
"rallie": "^0.8.0"
},
"gitHead": "dade5d8a9a43fbf0f6c3412d54937f7174de5ddd"
"gitHead": "a14f06d8fe4087ca2f468de493d43ca7ccec399c"
}
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