Skip to content

Commit

Permalink
chore(all): prepare release 0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed Mar 29, 2016
1 parent 6038310 commit 931f8c0
Show file tree
Hide file tree
Showing 48 changed files with 4,762 additions and 1,976 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aurelia-ui-virtualization",
"version": "0.3.2",
"version": "0.4.0",
"description": "A plugin that provides a virtualized repeater and other virtualization services.",
"keywords": [
"aurelia",
Expand Down
314 changes: 183 additions & 131 deletions dist/amd/array-virtual-repeat-strategy.js

Large diffs are not rendered by default.

131 changes: 131 additions & 0 deletions dist/amd/aurelia-ui-virtualization.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
declare module 'aurelia-ui-virtualization' {
import {
updateOverrideContext,
createFullOverrideContext,
getItemsSourceExpression,
isOneTime,
unwrapExpression,
updateOneTimeBinding
} from 'aurelia-templating-resources/repeat-utilities';
import {
ArrayRepeatStrategy
} from 'aurelia-templating-resources/array-repeat-strategy';
import {
RepeatStrategyLocator
} from 'aurelia-templating-resources/repeat-strategy-locator';
import {
inject
} from 'aurelia-dependency-injection';
import {
ObserverLocator
} from 'aurelia-binding';
import {
BoundViewFactory,
ViewSlot,
TargetInstruction,
customAttribute,
bindable,
templateController
} from 'aurelia-templating';
import {
AbstractRepeater
} from 'aurelia-templating-resources';
import {
viewsRequireLifecycle
} from 'aurelia-templating-resources/analyze-view-factory';
export function calcOuterHeight(element: any): any;
export function insertBeforeNode(view: any, bottomBuffer: any): any;

/**
* Update the override context.
* @param startIndex index in collection where to start updating.
*/
export function updateVirtualOverrideContexts(repeat: any, startIndex: any): any;
export function rebindAndMoveView(repeat: VirtualRepeat, view: View, index: number, moveToBottom: boolean): void;
export function getStyleValue(element: any, style: any): any;
export function getElementDistanceToBottomViewPort(element: any): any;

/**
* A strategy for repeating a template over an array.
*/
export class ArrayVirtualRepeatStrategy extends ArrayRepeatStrategy {

// create first item to calculate the heights
createFirstItem(repeat: any): any;

/**
* Handle the repeat's collection instance changing.
* @param repeat The repeater instance.
* @param items The new array instance.
*/
instanceChanged(repeat: any, items: any): any;

/**
* Handle the repeat's collection instance mutating.
* @param repeat The repeat instance.
* @param array The modified array.
* @param splices Records of array changes.
*/
instanceMutated(repeat: any, array: any, splices: any): any;
}
export class ViewStrategyLocator {
getStrategy(element: any): any;
}
export class TableStrategy {
getScrollContainer(element: any): any;
moveViewFirst(view: any, topBuffer: any): any;
moveViewLast(view: any, bottomBuffer: any): any;
createTopBufferElement(element: any): any;
createBottomBufferElement(element: any): any;
removeBufferElements(element: any, topBuffer: any, bottomBuffer: any): any;
}
export class DefaultStrategy {
getScrollContainer(element: any): any;
moveViewFirst(view: any, topBuffer: any): any;
moveViewLast(view: any, bottomBuffer: any): any;
createTopBufferElement(element: any): any;
createBottomBufferElement(element: any): any;
removeBufferElements(element: any, topBuffer: any, bottomBuffer: any): any;
}
export class VirtualRepeatStrategyLocator extends RepeatStrategyLocator {
constructor();
}
export class VirtualRepeat extends AbstractRepeater {
_first: any;
_previousFirst: any;
_viewsLength: any;
_lastRebind: any;
_topBufferHeight: any;
_bottomBufferHeight: any;
_bufferSize: any;
_scrollingDown: any;
_scrollingUp: any;
_switchedDirection: any;
_isAttached: any;
_ticking: any;
_fixedHeightContainer: any;
_hasCalculatedSizes: any;
_isAtTop: any;
items: any;
local: any;
constructor(element: any, viewFactory: any, instruction: any, viewSlot: any, observerLocator: any, strategyLocator: any, viewStrategyLocator: any);
attached(): any;
bind(bindingContext: any, overrideContext: any): any;
call(context: any, changes: any): any;
detached(): any;
itemsChanged(): any;
unbind(): any;
handleCollectionMutated(collection: any, changes: any): any;
handleInnerCollectionMutated(collection: any, changes: any): any;

// @override AbstractRepeater
viewCount(): any;
views(): any;
view(index: any): any;
addView(bindingContext: any, overrideContext: any): any;
insertView(index: any, bindingContext: any, overrideContext: any): any;
removeAllViews(returnToCache: any, skipAnimation: any): any;
removeView(index: any, returnToCache: any, skipAnimation: any): any;
updateBindings(view: View): any;
}
}
11 changes: 6 additions & 5 deletions dist/amd/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
define(['exports', './virtual-repeat', './virtual-list'], function (exports, _virtualRepeat, _virtualList) {
define(['exports', './virtual-repeat'], function (exports, _virtualRepeat) {
'use strict';

exports.__esModule = true;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.VirtualRepeat = undefined;
exports.configure = configure;

function configure(config) {
config.globalResources('./virtual-repeat', './virtual-list');
config.globalResources('./virtual-repeat');
}

exports.VirtualRepeat = _virtualRepeat.VirtualRepeat;
exports.VirtualList = _virtualList.VirtualList;
});
70 changes: 51 additions & 19 deletions dist/amd/utilities.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,73 @@
define(['exports'], function (exports) {
define(['exports', 'aurelia-templating-resources/repeat-utilities'], function (exports, _repeatUtilities) {
'use strict';

exports.__esModule = true;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.calcOuterHeight = calcOuterHeight;
exports.calcScrollHeight = calcScrollHeight;
exports.insertBeforeNode = insertBeforeNode;

exports.updateVirtualOverrideContexts = updateVirtualOverrideContexts;
exports.rebindAndMoveView = rebindAndMoveView;
exports.getStyleValue = getStyleValue;
exports.getElementDistanceToBottomViewPort = getElementDistanceToBottomViewPort;
function calcOuterHeight(element) {
var height;
var height = void 0;
height = element.getBoundingClientRect().height;
height += getStyleValue(element, 'marginTop');
height += getStyleValue(element, 'marginBottom');
return height;
}

function calcScrollHeight(element) {
var height;
height = element.getBoundingClientRect().height;
height -= getStyleValue(element, 'borderTopWidth');
height -= getStyleValue(element, 'borderBottomWidth');
return height;
}

function insertBeforeNode(view, scrollView, node) {
function insertBeforeNode(view, bottomBuffer) {
var viewStart = view.firstChild;
var element = viewStart.nextSibling;
var viewEnd = view.lastChild;
var parentElement = bottomBuffer.parentElement;

parentElement.insertBefore(viewEnd, bottomBuffer);
parentElement.insertBefore(element, viewEnd);
parentElement.insertBefore(viewStart, element);
}

scrollView.insertBefore(viewEnd, node);
scrollView.insertBefore(element, viewEnd);
scrollView.insertBefore(viewStart, element);
function updateVirtualOverrideContexts(repeat, startIndex) {
var views = repeat.viewSlot.children;
var viewLength = views.length;
var collectionLength = repeat.items.length;

if (startIndex > 0) {
startIndex = startIndex - 1;
}

var delta = repeat._topBufferHeight / repeat.itemHeight;

for (; startIndex < viewLength; ++startIndex) {
(0, _repeatUtilities.updateOverrideContext)(views[startIndex].overrideContext, startIndex + delta, collectionLength);
}
}

function rebindAndMoveView(repeat, view, index, moveToBottom) {
var items = repeat.items;
var viewSlot = repeat.viewSlot;
(0, _repeatUtilities.updateOverrideContext)(view.overrideContext, index, items.length);
view.bindingContext[repeat.local] = items[index];
if (moveToBottom) {
viewSlot.children.push(viewSlot.children.shift());
repeat.viewStrategy.moveViewLast(view, repeat.bottomBuffer);
} else {
viewSlot.children.unshift(viewSlot.children.splice(-1, 1)[0]);
repeat.viewStrategy.moveViewFirst(view, repeat.topBuffer);
}
}

function getStyleValue(element, style) {
var currentStyle, styleValue;
var currentStyle = void 0;
var styleValue = void 0;
currentStyle = element.currentStyle || window.getComputedStyle(element);
styleValue = parseInt(currentStyle[style]);
styleValue = parseInt(currentStyle[style], 10);
return Number.isNaN(styleValue) ? 0 : styleValue;
}

function getElementDistanceToBottomViewPort(element) {
return document.documentElement.clientHeight - element.getBoundingClientRect().bottom;
}
});
14 changes: 8 additions & 6 deletions dist/amd/view-strategy.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ define(['exports', './utilities'], function (exports, _utilities) {
return buffer;
};

TableStrategy.prototype.removeBufferElements = function removeBufferElements(scrollList, topBuffer, bottomBuffer) {
scrollList.removeChild(topBuffer.parentElement);
scrollList.removeChild(bottomBuffer.parentElement);
TableStrategy.prototype.removeBufferElements = function removeBufferElements(element, topBuffer, bottomBuffer) {
element.parentElement.removeChild(topBuffer.parentElement);
element.parentElement.removeChild(bottomBuffer.parentElement);
};

return TableStrategy;
Expand All @@ -84,7 +84,9 @@ define(['exports', './utilities'], function (exports, _utilities) {
};

DefaultStrategy.prototype.moveViewLast = function moveViewLast(view, bottomBuffer) {
(0, _utilities.insertBeforeNode)(view, bottomBuffer);
var previousSibling = bottomBuffer.previousSibling;
var referenceNode = previousSibling.nodeType === 8 && previousSibling.data === 'anchor' ? previousSibling : bottomBuffer;
(0, _utilities.insertBeforeNode)(view, referenceNode);
};

DefaultStrategy.prototype.createTopBufferElement = function createTopBufferElement(element) {
Expand All @@ -104,8 +106,8 @@ define(['exports', './utilities'], function (exports, _utilities) {
};

DefaultStrategy.prototype.removeBufferElements = function removeBufferElements(element, topBuffer, bottomBuffer) {
element.removeChild(topBuffer);
element.removeChild(bottomBuffer);
element.parentElement.removeChild(topBuffer);
element.parentElement.removeChild(bottomBuffer);
};

return DefaultStrategy;
Expand Down
7 changes: 0 additions & 7 deletions dist/amd/virtual-list.html

This file was deleted.

36 changes: 0 additions & 36 deletions dist/amd/virtual-list.js

This file was deleted.

Loading

0 comments on commit 931f8c0

Please sign in to comment.