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

@egjs/svelte-conveyer

Package Overview
Dependencies
Maintainers
9
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@egjs/svelte-conveyer - npm Package Compare versions

Comparing version 1.3.1 to 1.4.0

9

CHANGELOG.md

@@ -6,2 +6,11 @@ # Change Log

## [1.3.1](https://github.com/naver/egjs-conveyer/compare/@egjs/svelte-conveyer@1.3.0...@egjs/svelte-conveyer@1.3.1) (2022-07-01)
### :mega: Other
* update packages versions ([037314d](https://github.com/naver/egjs-conveyer/commit/037314d60b7799066f588f073273d56eb4c308b7))
## [1.3.0](https://github.com/naver/egjs-conveyer/compare/@egjs/svelte-conveyer@1.2.0...@egjs/svelte-conveyer@1.3.0) (2022-06-23)

@@ -8,0 +17,0 @@

74

dist/conveyer.cjs.js

@@ -7,3 +7,3 @@ /*

repository: https://github.com/naver/egjs-conveyer
version: 1.3.1
version: 1.4.0
*/

@@ -13,6 +13,5 @@ 'use strict';

var conveyer = require('@egjs/conveyer');
var internal = require('svelte/internal');
var store = require('svelte/store');
var svelte = require('@cfcs/svelte');
/*! *****************************************************************************
/******************************************************************************
Copyright (c) Microsoft Corporation.

@@ -45,61 +44,2 @@

function useRef(defaultValue) {
var refFunction = function (value) {
refFunction.current = value;
return {
destroy: function () {
return;
}
};
};
refFunction.current = defaultValue;
return refFunction;
}
function useReactive(reactiveProps) {
var writables = {};
var instanceRef = useRef();
var reactiveState = reactiveProps.state;
var names = Object.keys(reactiveState);
var methods = conveyer.withReactiveMethods(instanceRef, reactiveProps.methods);
for (var name in reactiveState) {
writables[name] = store.writable(reactiveState[name]);
}
internal.onMount(function () {
var data = reactiveProps.data ? reactiveProps.data() : {};
var inst = reactiveProps.instance(data);
instanceRef.current = inst;
names.forEach(function (name) {
inst.subscribe(name, function (value) {
writables[name].set(value);
});
});
reactiveProps.init(inst, data);
});
internal.onDestroy(function () {
var data = reactiveProps.data ? reactiveProps.data() : {};
var inst = instanceRef.current;
if (inst) {
reactiveProps.destroy(inst, data);
}
});
var reactiveEvents = reactiveProps.events || [];
var events = reactiveEvents.reduce(function (result, name) {
result[conveyer.camelize("on " + name)] = function (callback) {
internal.onMount(function () {
reactiveProps.on && reactiveProps.on(instanceRef.current, name, callback);
});
internal.onDestroy(function () {
reactiveProps.off && reactiveProps.off(instanceRef.current, name, callback);
});
};
return result;
}, {});
return __assign(__assign(__assign({}, writables), methods), events);
}
function useConveyer(props) {

@@ -112,4 +52,4 @@ if (props === void 0) {

var elementRef = useRef();
var result = useReactive(__assign({
var elementRef = svelte.useRef();
var result = svelte.useReactive(__assign({
data: function () {

@@ -132,4 +72,4 @@ return {

var elementRef = useRef();
useReactive(__assign({
var elementRef = svelte.useRef();
svelte.useReactive(__assign({
data: function () {

@@ -136,0 +76,0 @@ return {

@@ -7,9 +7,8 @@ /*

repository: https://github.com/naver/egjs-conveyer
version: 1.3.1
version: 1.4.0
*/
import { withReactiveMethods, camelize, REACTIVE_CONVEYER } from '@egjs/conveyer';
import { onMount, onDestroy } from 'svelte/internal';
import { writable } from 'svelte/store';
import { REACTIVE_CONVEYER } from '@egjs/conveyer';
import { useRef, useReactive } from '@cfcs/svelte';
/*! *****************************************************************************
/******************************************************************************
Copyright (c) Microsoft Corporation.

@@ -42,61 +41,2 @@

function useRef(defaultValue) {
var refFunction = function (value) {
refFunction.current = value;
return {
destroy: function () {
return;
}
};
};
refFunction.current = defaultValue;
return refFunction;
}
function useReactive(reactiveProps) {
var writables = {};
var instanceRef = useRef();
var reactiveState = reactiveProps.state;
var names = Object.keys(reactiveState);
var methods = withReactiveMethods(instanceRef, reactiveProps.methods);
for (var name in reactiveState) {
writables[name] = writable(reactiveState[name]);
}
onMount(function () {
var data = reactiveProps.data ? reactiveProps.data() : {};
var inst = reactiveProps.instance(data);
instanceRef.current = inst;
names.forEach(function (name) {
inst.subscribe(name, function (value) {
writables[name].set(value);
});
});
reactiveProps.init(inst, data);
});
onDestroy(function () {
var data = reactiveProps.data ? reactiveProps.data() : {};
var inst = instanceRef.current;
if (inst) {
reactiveProps.destroy(inst, data);
}
});
var reactiveEvents = reactiveProps.events || [];
var events = reactiveEvents.reduce(function (result, name) {
result[camelize("on " + name)] = function (callback) {
onMount(function () {
reactiveProps.on && reactiveProps.on(instanceRef.current, name, callback);
});
onDestroy(function () {
reactiveProps.off && reactiveProps.off(instanceRef.current, name, callback);
});
};
return result;
}, {});
return __assign(__assign(__assign({}, writables), methods), events);
}
function useConveyer(props) {

@@ -103,0 +43,0 @@ if (props === void 0) {

{
"name": "@egjs/svelte-conveyer",
"version": "1.3.1",
"version": "1.4.0",
"description": "Svelte Conveyer adds Drag gestures to your Native Scroll.",

@@ -67,4 +67,5 @@ "sideEffects": false,

"dependencies": {
"@egjs/conveyer": "~1.3.1"
"@cfcs/svelte": "~0.0.4",
"@egjs/conveyer": "~1.4.0"
}
}
import type { REACTIVE_CONVEYER } from "@egjs/conveyer";
import { Ref, SvelteReactiveAdapterResult } from "./cfcs/types";
import { Ref, SvelteReactiveAdapterResult } from "@cfcs/svelte";

@@ -4,0 +4,0 @@ export interface SvelteConveyerResult extends Ref<HTMLElement>, SvelteReactiveAdapterResult<typeof REACTIVE_CONVEYER> {

import type { SvelteConveyerResult } from "./types";
import { ConveyerOptions, REACTIVE_CONVEYER } from "@egjs/conveyer";
import { useReactive, useRef } from "./cfcs/useReactive";
import { useReactive, useRef } from "@cfcs/svelte";

@@ -5,0 +5,0 @@

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