@egjs/svelte-conveyer
Advanced tools
Comparing version 1.4.7-beta.5 to 1.4.7
@@ -7,3 +7,3 @@ /* | ||
repository: https://github.com/naver/egjs-conveyer | ||
version: 1.4.7-beta.5 | ||
version: 1.4.7 | ||
*/ | ||
@@ -13,3 +13,5 @@ 'use strict'; | ||
var conveyer = require('@egjs/conveyer'); | ||
var svelte = require('@cfcs/svelte'); | ||
var core = require('@cfcs/core'); | ||
var internal = require('svelte/internal'); | ||
var store = require('svelte/store'); | ||
@@ -44,2 +46,92 @@ /****************************************************************************** | ||
/* | ||
Copyright (c) NAVER Corp. | ||
name: @cfcs/svelte | ||
license: MIT | ||
author: NAVER Corp. | ||
repository: https://github.com/naver/cfcs | ||
version: 0.0.12 | ||
*/ | ||
/****************************************************************************** | ||
Copyright (c) Microsoft Corporation. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */ | ||
var __assign$1 = function () { | ||
__assign$1 = Object.assign || function __assign(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign$1.apply(this, arguments); | ||
}; | ||
function useRef(defaultValue) { | ||
var refFunction = function (value) { | ||
refFunction.current = value; | ||
return { | ||
destroy: function () { | ||
return; | ||
} | ||
}; | ||
}; | ||
refFunction.current = defaultValue; | ||
return refFunction; | ||
} | ||
function useReactive(reactiveProps) { | ||
var adaptResult = core.adaptReactive(reactiveProps); | ||
var reactiveState = adaptResult.state(); | ||
var writables = {}; | ||
var names = Object.keys(reactiveState); | ||
var methods = adaptResult.methods(); | ||
for (var name in reactiveState) { | ||
writables[name] = store.writable(reactiveState[name]); | ||
} | ||
internal.onMount(function () { | ||
adaptResult.mounted(); | ||
var inst = adaptResult.instance(); | ||
names.forEach(function (name) { | ||
inst.subscribe(name, function (value) { | ||
writables[name].set(value); | ||
}); | ||
}); | ||
adaptResult.init(); | ||
}); | ||
internal.onDestroy(function () { | ||
adaptResult.destroy(); | ||
}); | ||
var reactiveEvents = reactiveProps.events || []; | ||
var events = reactiveEvents.reduce(function (result, name) { | ||
result[core.camelize("on ".concat(name))] = function (callback) { | ||
internal.onMount(function () { | ||
adaptResult.on(name, callback); | ||
}); | ||
internal.onDestroy(function () { | ||
adaptResult.off(name, callback); | ||
}); | ||
}; | ||
return result; | ||
}, {}); | ||
return __assign$1(__assign$1(__assign$1({}, writables), methods), events); | ||
} | ||
function useConveyer(props) { | ||
@@ -50,4 +142,4 @@ if (props === void 0) { | ||
var elementRef = svelte.useRef(); | ||
var result = svelte.useReactive(__assign({ | ||
var elementRef = useRef(); | ||
var result = useReactive(__assign({ | ||
data: function () { | ||
@@ -70,4 +162,4 @@ return { | ||
var elementRef = svelte.useRef(); | ||
svelte.useReactive(__assign({ | ||
var elementRef = useRef(); | ||
useReactive(__assign({ | ||
data: function () { | ||
@@ -74,0 +166,0 @@ return { |
@@ -7,6 +7,8 @@ /* | ||
repository: https://github.com/naver/egjs-conveyer | ||
version: 1.4.7-beta.5 | ||
version: 1.4.7 | ||
*/ | ||
import { REACTIVE_CONVEYER } from '@egjs/conveyer'; | ||
import { useRef, useReactive } from '@cfcs/svelte'; | ||
import { adaptReactive, camelize } from '@cfcs/core'; | ||
import { onMount, onDestroy } from 'svelte/internal'; | ||
import { writable } from 'svelte/store'; | ||
@@ -41,2 +43,92 @@ /****************************************************************************** | ||
/* | ||
Copyright (c) NAVER Corp. | ||
name: @cfcs/svelte | ||
license: MIT | ||
author: NAVER Corp. | ||
repository: https://github.com/naver/cfcs | ||
version: 0.0.12 | ||
*/ | ||
/****************************************************************************** | ||
Copyright (c) Microsoft Corporation. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */ | ||
var __assign$1 = function () { | ||
__assign$1 = Object.assign || function __assign(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign$1.apply(this, arguments); | ||
}; | ||
function useRef(defaultValue) { | ||
var refFunction = function (value) { | ||
refFunction.current = value; | ||
return { | ||
destroy: function () { | ||
return; | ||
} | ||
}; | ||
}; | ||
refFunction.current = defaultValue; | ||
return refFunction; | ||
} | ||
function useReactive(reactiveProps) { | ||
var adaptResult = adaptReactive(reactiveProps); | ||
var reactiveState = adaptResult.state(); | ||
var writables = {}; | ||
var names = Object.keys(reactiveState); | ||
var methods = adaptResult.methods(); | ||
for (var name in reactiveState) { | ||
writables[name] = writable(reactiveState[name]); | ||
} | ||
onMount(function () { | ||
adaptResult.mounted(); | ||
var inst = adaptResult.instance(); | ||
names.forEach(function (name) { | ||
inst.subscribe(name, function (value) { | ||
writables[name].set(value); | ||
}); | ||
}); | ||
adaptResult.init(); | ||
}); | ||
onDestroy(function () { | ||
adaptResult.destroy(); | ||
}); | ||
var reactiveEvents = reactiveProps.events || []; | ||
var events = reactiveEvents.reduce(function (result, name) { | ||
result[camelize("on ".concat(name))] = function (callback) { | ||
onMount(function () { | ||
adaptResult.on(name, callback); | ||
}); | ||
onDestroy(function () { | ||
adaptResult.off(name, callback); | ||
}); | ||
}; | ||
return result; | ||
}, {}); | ||
return __assign$1(__assign$1(__assign$1({}, writables), methods), events); | ||
} | ||
function useConveyer(props) { | ||
@@ -43,0 +135,0 @@ if (props === void 0) { |
{ | ||
"name": "@egjs/svelte-conveyer", | ||
"version": "1.4.7-beta.5", | ||
"version": "1.4.7", | ||
"description": "Svelte Conveyer adds Drag gestures to your Native Scroll.", | ||
@@ -44,3 +44,3 @@ "sideEffects": false, | ||
"dev": "rollup -c -w", | ||
"start": "sirv public --no-clear --port 4444", | ||
"start": "sirv public --no-clear", | ||
"build": "rollup -c rollup.build.config.js && npm run declaration", | ||
@@ -75,4 +75,4 @@ "declaration": "rm -rf declaration && tsc -p tsconfig.declaration.json" | ||
"@cfcs/svelte": "~0.0.12", | ||
"@egjs/conveyer": "~1.4.7-beta.4" | ||
"@egjs/conveyer": "~1.4.7" | ||
} | ||
} |
@@ -10,3 +10,2 @@ import buildHelper from "@egjs/build-helper"; | ||
svelte: "svelte", | ||
"@cfcs/svelte": "@cfcs/svelte", | ||
}, | ||
@@ -13,0 +12,0 @@ plugins: [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
41779
559
0
Updated@egjs/conveyer@~1.4.7