@pelagiccreatures/sargasso
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "@pelagiccreatures/sargasso", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Simple, Fast, Reactive, Supervised Javascript controllers for custom html elements.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -34,3 +34,3 @@ # @pelagiccreatures/sargasso | ||
### Usage Overview (Using CDN) | ||
### Usage Overview (Using CDN iife modules) | ||
@@ -51,3 +51,3 @@ ```html | ||
// define MyClass as a subclass of Sargasso | ||
class MyClass extends PelagicCreatures.Sargasso { | ||
class MyClass extends SargassoModule.Sargasso { | ||
start() { | ||
@@ -62,6 +62,6 @@ this.queueFrame(() => { | ||
// Register MyClass to the Sargasso framework | ||
PelagicCreatures.utils.registerSargassoClass('MyClass',MyClass) | ||
SargassoModule.utils.registerSargassoClass('MyClass',MyClass) | ||
// Start Sargasso | ||
PelagicCreatures.utils.bootSargasso() | ||
SargassoModule.utils.bootSargasso() | ||
</script> | ||
@@ -82,3 +82,3 @@ </body> | ||
```javascript | ||
class MyButtonClass extends PelagicCreatures.Sargasso { | ||
class MyButtonClass extends SargassoModule.Sargasso { | ||
constructor (element, options = {}) { | ||
@@ -122,3 +122,3 @@ options.watchViewport = true // tell me when I am visible | ||
PelagicCreatures.utils.registerSargassoClass('MyButtonClass', MyButtonClass) | ||
SargassoModule.utils.registerSargassoClass('MyButtonClass', MyButtonClass) | ||
``` | ||
@@ -125,0 +125,0 @@ |
@@ -13,5 +13,14 @@ import commonjs from '@rollup/plugin-commonjs' | ||
format: 'iife', | ||
name: 'PelagicCreatures', | ||
file: './dist/sargasso.iife.js', | ||
sourcemap: true | ||
name: 'SargassoModule', | ||
file: './dist/sargasso.iife.js' | ||
}, { | ||
format: 'iife', | ||
name: 'SargassoModule', | ||
file: './dist/sargasso.iife.min.js', | ||
sourcemap: true, | ||
plugins: [terser({ | ||
output: { | ||
comments: false | ||
} | ||
})] | ||
}], | ||
@@ -22,9 +31,4 @@ | ||
nodeResolve(), | ||
commonjs(), | ||
terser({ | ||
output: { | ||
comments: false | ||
} | ||
}) | ||
commonjs() | ||
] | ||
} |
@@ -1,2 +0,2 @@ | ||
const elementTools = PelagicCreatures.utils.elementTools | ||
const elementTools = PelagicCreaturesSargasso.utils.elementTools | ||
const testElement = document.getElementById('test-element') | ||
@@ -112,3 +112,3 @@ const testElement1 = document.getElementById('test-element1') | ||
class InstrumentedSubclass extends PelagicCreatures.Sargasso { | ||
class InstrumentedSubclass extends PelagicCreaturesSargasso.Sargasso { | ||
constructor (element, options) { | ||
@@ -137,3 +137,3 @@ super(element, { | ||
PelagicCreatures.utils.registerSargassoClass('InstrumentedSubclass', InstrumentedSubclass) | ||
PelagicCreaturesSargasso.utils.registerSargassoClass('InstrumentedSubclass', InstrumentedSubclass) | ||
testElement.innerHTML = '<sargasso-instrumented-subclass id="my-element"></sargasso-instrumented-subclass>' | ||
@@ -160,3 +160,3 @@ const myElement = document.querySelector('#my-element') | ||
class InstrumentedScrollClass extends PelagicCreatures.Sargasso { | ||
class InstrumentedScrollClass extends PelagicCreaturesSargasso.Sargasso { | ||
constructor (element, options) { | ||
@@ -182,3 +182,3 @@ super(element, { | ||
testElement.innerHTML = '' // kill it | ||
expect(PelagicCreatures.services.theScrollWatcher.observers.length).to.equal(1) | ||
expect(PelagicCreaturesSargasso.services.theScrollWatcher.observers.length).to.equal(1) | ||
window.scrollTo(0, 0) | ||
@@ -190,7 +190,7 @@ done() | ||
PelagicCreatures.utils.registerSargassoClass('InstrumentedScrollClass', InstrumentedScrollClass) | ||
PelagicCreaturesSargasso.utils.registerSargassoClass('InstrumentedScrollClass', InstrumentedScrollClass) | ||
testElement.innerHTML = '<sargasso-instrumented-scroll-class id="my-element"></sargasso-instrumented-scroll-class>' | ||
const myElement = document.querySelector('#my-element') | ||
const myClassInstance = elementTools.getMetaData(myElement, 'InstrumentedScrollClass') | ||
expect(PelagicCreatures.services.theScrollWatcher.observers.length).to.equal(2) | ||
expect(PelagicCreaturesSargasso.services.theScrollWatcher.observers.length).to.equal(2) | ||
expect(didScroll).to.equal(1) | ||
@@ -205,3 +205,3 @@ window.scrollTo(0, 10) | ||
it('Sargasso HijaxLoader', function (done) { | ||
class InstrumentedHijaxClass extends PelagicCreatures.Sargasso { | ||
class InstrumentedHijaxClass extends PelagicCreaturesSargasso.Sargasso { | ||
newPage (oldPage, newPage) { | ||
@@ -215,7 +215,7 @@ if (newPage === '/tests/page1.html') { | ||
} | ||
PelagicCreatures.utils.registerSargassoClass('InstrumentedHijaxClass', InstrumentedHijaxClass) | ||
PelagicCreaturesSargasso.utils.registerSargassoClass('InstrumentedHijaxClass', InstrumentedHijaxClass) | ||
testElement.innerHTML = '<sargasso-instrumented-hijax-class id="my-element"></sargasso-instrumented-hijax-class>' | ||
const myElement = document.querySelector('#my-element') | ||
const myClassInstance = elementTools.getMetaData(myElement, 'InstrumentedHijaxClass') | ||
PelagicCreatures.loadPageHandler('./page1.html') | ||
PelagicCreaturesSargasso.loadPageHandler('./page1.html') | ||
}) | ||
@@ -228,3 +228,3 @@ | ||
it('Sargasso Supervisor Instantiate by data-sargasso-class', function (done) { | ||
class InstrumentedSupervisorTest extends PelagicCreatures.Sargasso { | ||
class InstrumentedSupervisorTest extends PelagicCreaturesSargasso.Sargasso { | ||
start () { | ||
@@ -236,3 +236,3 @@ super.start() | ||
} | ||
PelagicCreatures.utils.registerSargassoClass('InstrumentedSupervisorTest', InstrumentedSupervisorTest) | ||
PelagicCreaturesSargasso.utils.registerSargassoClass('InstrumentedSupervisorTest', InstrumentedSupervisorTest) | ||
testElement.innerHTML = '<div id="my-element" data-sargasso-class="InstrumentedSupervisorTest"></div>' | ||
@@ -246,3 +246,3 @@ }) | ||
it('Sargasso LazyInstantiate by data-lazy-sargasso-class', function (done) { | ||
class InstrumentedLazyTest extends PelagicCreatures.Sargasso { | ||
class InstrumentedLazyTest extends PelagicCreaturesSargasso.Sargasso { | ||
start () { | ||
@@ -256,3 +256,3 @@ super.start() | ||
elementTools.addClass(document.querySelector('#spacer'), 'below-the-fold') | ||
PelagicCreatures.utils.registerSargassoClass('InstrumentedLazyTest', InstrumentedLazyTest) | ||
PelagicCreaturesSargasso.utils.registerSargassoClass('InstrumentedLazyTest', InstrumentedLazyTest) | ||
testElement.innerHTML = '<div id="my-element" data-lazy-sargasso-class="InstrumentedLazyTest"></div>' | ||
@@ -267,3 +267,3 @@ window.scrollTo(0, window.innerHeight) | ||
it('Sargasso LazyInstantiate by data-lazy-sargasso-class in hidden container', function (done) { | ||
class InstrumentedLazyRevealTest extends PelagicCreatures.Sargasso { | ||
class InstrumentedLazyRevealTest extends PelagicCreaturesSargasso.Sargasso { | ||
start () { | ||
@@ -276,3 +276,3 @@ super.start() | ||
} | ||
PelagicCreatures.utils.registerSargassoClass('InstrumentedLazyRevealTest', InstrumentedLazyRevealTest) | ||
PelagicCreaturesSargasso.utils.registerSargassoClass('InstrumentedLazyRevealTest', InstrumentedLazyRevealTest) | ||
testElement1.innerHTML = '<div id="my-element" data-lazy-sargasso-class="InstrumentedLazyRevealTest"></div>' | ||
@@ -279,0 +279,0 @@ elementTools.removeClass(testElement1, 'hidden-display') |
Sorry, the diff of this file is too big to display
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
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
726934
37
7644