iOS: implement slider style gallery
This commit is contained in:
parent
bd5c5c48ee
commit
3393a474f9
29
doric-iOS/Pod/Classes/Shader/DoricSliderLayout.h
Normal file
29
doric-iOS/Pod/Classes/Shader/DoricSliderLayout.h
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright [2023] [Doric.Pub]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
//
|
||||
// DoricSliderNode.h
|
||||
// Doric
|
||||
//
|
||||
// Created by jingpeng.wang on 2023/6/13.
|
||||
//
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface DoricSliderLayout : UICollectionViewFlowLayout
|
||||
@property(nonatomic, assign) CGFloat galleryItemWidth;
|
||||
@property(nonatomic, assign) CGFloat galleryMinScale;
|
||||
@property(nonatomic, assign) CGFloat galleryMinAlpha;
|
||||
@end
|
||||
|
60
doric-iOS/Pod/Classes/Shader/DoricSliderLayout.m
Normal file
60
doric-iOS/Pod/Classes/Shader/DoricSliderLayout.m
Normal file
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright [2023] [Doric.Pub]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
//
|
||||
// DoricSliderNode.m
|
||||
// Doric
|
||||
//
|
||||
// Created by jingpeng.wang on 2023/6/13.
|
||||
//
|
||||
#import "DoricSliderLayout.h"
|
||||
|
||||
@implementation DoricSliderLayout
|
||||
|
||||
- (NSArray<UICollectionViewLayoutAttributes *> *)layoutAttributesForElementsInRect:(CGRect)rect {
|
||||
NSArray *attributes = [super layoutAttributesForElementsInRect:rect];
|
||||
CGRect visitRect = {self.collectionView.contentOffset,self.collectionView.bounds.size};
|
||||
NSMutableArray *attributesCopy = [NSMutableArray array];
|
||||
for (UICollectionViewLayoutAttributes *attribute in attributes) {
|
||||
UICollectionViewLayoutAttributes *attributeCopy = [attribute copy];
|
||||
[attributesCopy addObject:attributeCopy];
|
||||
}
|
||||
|
||||
for (UICollectionViewLayoutAttributes *attribute in attributesCopy) {
|
||||
CGFloat distance = CGRectGetMidX(visitRect) - attribute.center.x;
|
||||
float diff = fabs(distance);
|
||||
CATransform3D scaleTransform = CATransform3DIdentity;
|
||||
|
||||
if (diff >= 0 && diff <= self.galleryItemWidth) {
|
||||
float scale = 1 - (1 - self.galleryMinScale) * (diff / self.galleryItemWidth);
|
||||
scaleTransform = CATransform3DMakeScale(scale, scale, scale);
|
||||
attribute.alpha = 1 - (1 - self.galleryMinAlpha) * (diff / self.galleryItemWidth);
|
||||
} else {
|
||||
float scale = self.galleryMinScale;
|
||||
scaleTransform = CATransform3DMakeScale(scale, scale, scale);
|
||||
attribute.alpha = self.galleryMinAlpha;
|
||||
}
|
||||
|
||||
attribute.transform3D = scaleTransform;
|
||||
}
|
||||
return attributesCopy;
|
||||
}
|
||||
|
||||
- (BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds {
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -23,6 +23,7 @@
|
||||
#import "DoricSliderNode.h"
|
||||
#import "Doric.h"
|
||||
#import "DoricSlideItemNode.h"
|
||||
#import "DoricSliderLayout.h"
|
||||
|
||||
@interface DoricSliderViewCell : UICollectionViewCell
|
||||
@property(nonatomic, strong) DoricSlideItemNode *doricSlideItemNode;
|
||||
@ -47,7 +48,11 @@ @interface DoricSliderNode () <UICollectionViewDataSource, UICollectionViewDeleg
|
||||
@property(nonatomic, strong) NSString *slideStyle;
|
||||
@property(nonatomic, assign) CGFloat minScale;
|
||||
@property(nonatomic, assign) CGFloat maxScale;
|
||||
@property(nonatomic, assign) CGFloat galleryMinScale;
|
||||
@property(nonatomic, assign) CGFloat galleryMinAlpha;
|
||||
@property(nonatomic, assign) CGFloat galleryItemWidth;
|
||||
@property(nonatomic, assign) BOOL scheduledLayout;
|
||||
@property (nonatomic, assign) NSInteger currentPage;
|
||||
@end
|
||||
|
||||
@interface DoricSliderView : UICollectionView
|
||||
@ -75,7 +80,7 @@ - (instancetype)initWithContext:(DoricContext *)doricContext {
|
||||
}
|
||||
|
||||
- (UICollectionView *)build {
|
||||
UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
|
||||
DoricSliderLayout *flowLayout = [[DoricSliderLayout alloc] init];
|
||||
[flowLayout setScrollDirection:UICollectionViewScrollDirectionHorizontal];
|
||||
return [[[DoricSliderView alloc] initWithFrame:CGRectZero
|
||||
collectionViewLayout:flowLayout]
|
||||
@ -113,8 +118,21 @@ - (void)blendView:(UICollectionView *)view forPropName:(NSString *)name propValu
|
||||
} else if ([@"slideStyle" isEqualToString:name]) {
|
||||
if ([prop isKindOfClass:NSDictionary.class]) {
|
||||
self.slideStyle = prop[@"type"];
|
||||
self.maxScale = [prop[@"maxScale"] floatValue];
|
||||
self.minScale = [prop[@"minScale"] floatValue];
|
||||
if ([self.slideStyle isEqualToString:@"zoomOut"]) {
|
||||
self.maxScale = [prop[@"maxScale"] floatValue];
|
||||
self.minScale = [prop[@"minScale"] floatValue];
|
||||
} else if([self.slideStyle isEqualToString:@"gallery"]) {
|
||||
self.galleryMinScale = [prop[@"minScale"] floatValue];
|
||||
self.galleryMinAlpha = [prop[@"minAlpha"] floatValue];
|
||||
self.galleryItemWidth = [prop[@"itemWidth"] floatValue];
|
||||
self.view.pagingEnabled = NO;
|
||||
|
||||
DoricSliderLayout *layout = (DoricSliderLayout*)self.view.collectionViewLayout;
|
||||
layout.galleryItemWidth = self.galleryItemWidth;
|
||||
layout.galleryMinScale = self.galleryMinScale;
|
||||
layout.galleryMinAlpha = self.galleryMinAlpha;
|
||||
}
|
||||
|
||||
} else if ([prop isKindOfClass:NSString.class]) {
|
||||
self.slideStyle = prop;
|
||||
}
|
||||
@ -161,11 +179,18 @@ - (void)afterBlended:(NSDictionary *)props {
|
||||
__strong typeof(_self) self = _self;
|
||||
[self.view reloadData];
|
||||
NSUInteger position = (self.loop ? 1 : 0) + self.slidePosition;
|
||||
if (self.view.width == 0) {
|
||||
float itemWidth;
|
||||
if ([self.slideStyle isEqualToString:@"gallery"]) {
|
||||
itemWidth = self.galleryItemWidth;
|
||||
} else {
|
||||
itemWidth = self.view.width;
|
||||
}
|
||||
|
||||
if (itemWidth == 0) {
|
||||
self.needResetScroll = true;
|
||||
} else {
|
||||
self.needResetScroll = false;
|
||||
[self.view setContentOffset:CGPointMake(position * self.view.width, self.view.contentOffset.y) animated:false];
|
||||
[self.view setContentOffset:CGPointMake(position * itemWidth, self.view.contentOffset.y) animated:false];
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -180,6 +205,12 @@ - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSe
|
||||
}
|
||||
|
||||
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||
if ([self.slideStyle isEqualToString:@"gallery"]) {
|
||||
UICollectionViewFlowLayout *layout = (UICollectionViewFlowLayout *)self.view.collectionViewLayout;
|
||||
int margin = (self.view.width - self.galleryItemWidth) / 2;
|
||||
layout.sectionInset = UIEdgeInsetsMake(0, margin, 0, margin);
|
||||
return CGSizeMake(self.galleryItemWidth, self.view.height);
|
||||
}
|
||||
return CGSizeMake(self.view.width, self.view.height);
|
||||
}
|
||||
|
||||
@ -208,7 +239,12 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collection
|
||||
DoricSlideItemNode *node = cell.doricSlideItemNode;
|
||||
node.viewId = model[@"id"];
|
||||
[node blend:props];
|
||||
CGFloat maxWidth = collectionView.width;
|
||||
CGFloat maxWidth;
|
||||
if ([self.slideStyle isEqualToString:@"gallery"]) {
|
||||
maxWidth = self.galleryItemWidth;
|
||||
} else {
|
||||
maxWidth = collectionView.width;
|
||||
}
|
||||
if (collectionView.doricLayout.widthSpec == DoricLayoutFit) {
|
||||
maxWidth = [[UIScreen mainScreen] bounds].size.width;
|
||||
}
|
||||
@ -322,7 +358,12 @@ - (void)blendSubNode:(NSDictionary *)subModel {
|
||||
if (viewNode) {
|
||||
CGSize originSize = viewNode.view.frame.size;
|
||||
[viewNode blend:subModel[@"props"]];
|
||||
[viewNode.view.doricLayout apply:CGSizeMake(self.view.width, self.view.height)];
|
||||
|
||||
if ([self.slideStyle isEqualToString:@"gallery"]) {
|
||||
[viewNode.view.doricLayout apply:CGSizeMake(self.galleryItemWidth, self.view.height)];
|
||||
} else {
|
||||
[viewNode.view.doricLayout apply:CGSizeMake(self.view.width, self.view.height)];
|
||||
}
|
||||
[viewNode requestLayout];
|
||||
if (CGSizeEqualToSize(originSize, viewNode.view.frame.size)) {
|
||||
skipReload = YES;
|
||||
@ -343,6 +384,39 @@ - (void)blendSubNode:(NSDictionary *)subModel {
|
||||
}];
|
||||
}
|
||||
|
||||
//paging by cell | paging with one cell at a time
|
||||
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
|
||||
{
|
||||
if ([self.slideStyle isEqualToString:@"gallery"]) {
|
||||
CGFloat cellWidth = self.galleryItemWidth;
|
||||
self.currentPage = (scrollView.contentOffset.x - cellWidth / 2) / (cellWidth) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset
|
||||
{
|
||||
if ([self.slideStyle isEqualToString:@"gallery"]) {
|
||||
CGFloat cellWidth = self.galleryItemWidth;
|
||||
NSInteger page = (scrollView.contentOffset.x - cellWidth / 2) / (cellWidth) + 1;
|
||||
|
||||
if (velocity.x > 0) page++;
|
||||
if (velocity.x < 0) page--;
|
||||
page = MAX(page, 0);
|
||||
|
||||
NSInteger prePage = self.currentPage - 1;
|
||||
if(prePage > 0 && page < prePage){
|
||||
page = prePage;
|
||||
} else if (page > self.currentPage + 1){
|
||||
page = self.currentPage + 1;
|
||||
}
|
||||
|
||||
self.currentPage = page;
|
||||
|
||||
CGFloat newOffset = page * (cellWidth);
|
||||
targetContentOffset->x = newOffset;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
|
||||
if ([self.slideStyle isEqualToString:@"zoomOut"]) {
|
||||
CGFloat centerX = scrollView.width / 2.f;
|
||||
@ -357,15 +431,28 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
|
||||
}
|
||||
|
||||
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
|
||||
NSUInteger pageIndex = (NSUInteger) (scrollView.contentOffset.x / scrollView.width);
|
||||
scrollView.contentOffset = CGPointMake(pageIndex * scrollView.width, scrollView.contentOffset.y);
|
||||
NSUInteger pageIndex;
|
||||
if ([self.slideStyle isEqualToString:@"gallery"]) {
|
||||
pageIndex = (NSUInteger) (scrollView.contentOffset.x / self.galleryItemWidth);
|
||||
scrollView.contentOffset = CGPointMake(pageIndex * self.galleryItemWidth, scrollView.contentOffset.y);
|
||||
} else {
|
||||
pageIndex = (NSUInteger) (scrollView.contentOffset.x / scrollView.width);
|
||||
scrollView.contentOffset = CGPointMake(pageIndex * scrollView.width, scrollView.contentOffset.y);
|
||||
}
|
||||
|
||||
|
||||
if (self.loop) {
|
||||
float itemWidth;
|
||||
if ([self.slideStyle isEqualToString:@"gallery"]) {
|
||||
itemWidth = self.galleryItemWidth;
|
||||
} else {
|
||||
itemWidth = self.view.width;
|
||||
}
|
||||
if (pageIndex == 0) {
|
||||
[self.view setContentOffset:CGPointMake(self.itemCount * self.view.width, self.view.contentOffset.y) animated:false];
|
||||
[self.view setContentOffset:CGPointMake(self.itemCount * itemWidth, self.view.contentOffset.y) animated:false];
|
||||
pageIndex = self.itemCount - 1;
|
||||
} else if (pageIndex == self.itemCount + 1) {
|
||||
[self.view setContentOffset:CGPointMake(1 * self.view.width, self.view.contentOffset.y) animated:false];
|
||||
[self.view setContentOffset:CGPointMake(1 * itemWidth, self.view.contentOffset.y) animated:false];
|
||||
pageIndex = 0;
|
||||
} else {
|
||||
pageIndex = pageIndex - 1;
|
||||
@ -384,10 +471,17 @@ - (void)slidePage:(NSDictionary *)params withPromise:(DoricPromise *)promise {
|
||||
NSUInteger pageIndex = [params[@"page"] unsignedIntegerValue];
|
||||
BOOL smooth = [params[@"smooth"] boolValue];
|
||||
|
||||
if (self.loop) {
|
||||
[self.view setContentOffset:CGPointMake((pageIndex + 1) * self.view.width, self.view.contentOffset.y) animated:smooth];
|
||||
float itemWidth;
|
||||
if ([self.slideStyle isEqualToString:@"gallery"]) {
|
||||
itemWidth = self.galleryItemWidth;
|
||||
} else {
|
||||
[self.view setContentOffset:CGPointMake(pageIndex * self.view.width, self.view.contentOffset.y) animated:smooth];
|
||||
itemWidth = self.view.width;
|
||||
}
|
||||
|
||||
if (self.loop) {
|
||||
[self.view setContentOffset:CGPointMake((pageIndex + 1) * itemWidth, self.view.contentOffset.y) animated:smooth];
|
||||
} else {
|
||||
[self.view setContentOffset:CGPointMake(pageIndex * itemWidth, self.view.contentOffset.y) animated:smooth];
|
||||
}
|
||||
|
||||
[promise resolve:nil];
|
||||
@ -398,7 +492,13 @@ - (void)slidePage:(NSDictionary *)params withPromise:(DoricPromise *)promise {
|
||||
}
|
||||
|
||||
- (NSNumber *)getSlidedPage {
|
||||
NSUInteger pageIndex = (NSUInteger) (self.view.contentOffset.x / self.view.width);
|
||||
NSUInteger pageIndex;
|
||||
if ([self.slideStyle isEqualToString:@"gallery"]) {
|
||||
pageIndex = (NSUInteger) (self.view.contentOffset.x / self.galleryItemWidth);
|
||||
} else {
|
||||
pageIndex = (NSUInteger) (self.view.contentOffset.x / self.view.width);
|
||||
}
|
||||
|
||||
if (self.loop) {
|
||||
return @(pageIndex - 1);
|
||||
} else {
|
||||
|
@ -293,10 +293,10 @@ var doric = (function (exports) {
|
||||
(module.exports = function (key, value) {
|
||||
return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
|
||||
})('versions', []).push({
|
||||
version: '3.29.0',
|
||||
version: '3.28.0',
|
||||
mode: 'global',
|
||||
copyright: '© 2014-2023 Denis Pushkarev (zloirock.ru)',
|
||||
license: 'https://github.com/zloirock/core-js/blob/v3.29.0/LICENSE',
|
||||
license: 'https://github.com/zloirock/core-js/blob/v3.28.0/LICENSE',
|
||||
source: 'https://github.com/zloirock/core-js'
|
||||
});
|
||||
});
|
||||
@ -9562,7 +9562,7 @@ var doric = (function (exports) {
|
||||
var aTypedArray$d = arrayBufferViewCore.aTypedArray;
|
||||
var exportTypedArrayMethod$e = arrayBufferViewCore.exportTypedArrayMethod;
|
||||
|
||||
var WORKS_WITH_OBJECTS_AND_GENERIC_ON_TYPED_ARRAYS = !fails(function () {
|
||||
var WORKS_WITH_OBJECTS_AND_GEERIC_ON_TYPED_ARRAYS = !fails(function () {
|
||||
// eslint-disable-next-line es/no-typed-arrays -- required for testing
|
||||
var array = new Uint8ClampedArray(2);
|
||||
functionCall($set, array, { length: 1, 0: 3 }, 1);
|
||||
@ -9570,7 +9570,7 @@ var doric = (function (exports) {
|
||||
});
|
||||
|
||||
// https://bugs.chromium.org/p/v8/issues/detail?id=11294 and other
|
||||
var TO_OBJECT_BUG = WORKS_WITH_OBJECTS_AND_GENERIC_ON_TYPED_ARRAYS && arrayBufferViewCore.NATIVE_ARRAY_BUFFER_VIEWS && fails(function () {
|
||||
var TO_OBJECT_BUG = WORKS_WITH_OBJECTS_AND_GEERIC_ON_TYPED_ARRAYS && arrayBufferViewCore.NATIVE_ARRAY_BUFFER_VIEWS && fails(function () {
|
||||
var array = new Int8Array$2(2);
|
||||
array.set(1);
|
||||
array.set('2', 1);
|
||||
@ -9583,13 +9583,13 @@ var doric = (function (exports) {
|
||||
aTypedArray$d(this);
|
||||
var offset = toOffset(arguments.length > 1 ? arguments[1] : undefined, 1);
|
||||
var src = toObject(arrayLike);
|
||||
if (WORKS_WITH_OBJECTS_AND_GENERIC_ON_TYPED_ARRAYS) { return functionCall($set, this, src, offset); }
|
||||
if (WORKS_WITH_OBJECTS_AND_GEERIC_ON_TYPED_ARRAYS) { return functionCall($set, this, src, offset); }
|
||||
var length = this.length;
|
||||
var len = lengthOfArrayLike(src);
|
||||
var index = 0;
|
||||
if (len + offset > length) { throw RangeError$2('Wrong length'); }
|
||||
while (index < len) { this[offset + index] = src[index++]; }
|
||||
}, !WORKS_WITH_OBJECTS_AND_GENERIC_ON_TYPED_ARRAYS || TO_OBJECT_BUG);
|
||||
}, !WORKS_WITH_OBJECTS_AND_GEERIC_ON_TYPED_ARRAYS || TO_OBJECT_BUG);
|
||||
|
||||
var aTypedArray$c = arrayBufferViewCore.aTypedArray;
|
||||
var exportTypedArrayMethod$d = arrayBufferViewCore.exportTypedArrayMethod;
|
||||
@ -10566,14 +10566,14 @@ var doric = (function (exports) {
|
||||
|
||||
var Map$a = mapHelpers.Map;
|
||||
var MapPrototype = mapHelpers.proto;
|
||||
var forEach$2 = functionUncurryThis(MapPrototype.forEach);
|
||||
var forEach$1 = functionUncurryThis(MapPrototype.forEach);
|
||||
var entries = functionUncurryThis(MapPrototype.entries);
|
||||
var next$1 = entries(new Map$a()).next;
|
||||
|
||||
var mapIterate = function (map, fn, interruptible) {
|
||||
return interruptible ? iterateSimple(entries(map), function (entry) {
|
||||
return fn(entry[1], entry[0]);
|
||||
}, next$1) : forEach$2(map, fn);
|
||||
}, next$1) : forEach$1(map, fn);
|
||||
};
|
||||
|
||||
var Map$9 = mapHelpers.Map;
|
||||
@ -11447,7 +11447,7 @@ var doric = (function (exports) {
|
||||
var $TypeError$d = TypeError;
|
||||
|
||||
var $RangeIterator = iteratorCreateConstructor(function NumericRangeIterator(start, end, option, type, zero, one) {
|
||||
// TODO: Drop the first `typeof` check after removing legacy methods in `core-js@4`
|
||||
// TODO: Drop the first `typeof` check after removing lagacy methods in `core-js@4`
|
||||
if (typeof start != type || (end !== Infinity && end !== -Infinity && typeof end != type)) {
|
||||
throw $TypeError$d(INCORRECT_RANGE);
|
||||
}
|
||||
@ -12363,21 +12363,31 @@ var doric = (function (exports) {
|
||||
var i = this.skip(IS_WHITESPACE$1, this.index);
|
||||
var fork = this.fork(i);
|
||||
var chr = at$1(source, i);
|
||||
if (exec$6(IS_NUMBER_START, chr)) { return fork.number(); }
|
||||
switch (chr) {
|
||||
var result;
|
||||
if (exec$6(IS_NUMBER_START, chr)) { result = fork.number(); }
|
||||
else { switch (chr) {
|
||||
case '{':
|
||||
return fork.object();
|
||||
result = fork.object();
|
||||
break;
|
||||
case '[':
|
||||
return fork.array();
|
||||
result = fork.array();
|
||||
break;
|
||||
case '"':
|
||||
return fork.string();
|
||||
result = fork.string();
|
||||
break;
|
||||
case 't':
|
||||
return fork.keyword(true);
|
||||
result = fork.keyword(true);
|
||||
break;
|
||||
case 'f':
|
||||
return fork.keyword(false);
|
||||
result = fork.keyword(false);
|
||||
break;
|
||||
case 'n':
|
||||
return fork.keyword(null);
|
||||
} throw SyntaxError$2('Unexpected character: "' + chr + '" at: ' + i);
|
||||
result = fork.keyword(null);
|
||||
break;
|
||||
default:
|
||||
throw SyntaxError$2('Unexpected character: "' + chr + '" at: ' + i);
|
||||
} }
|
||||
return result;
|
||||
},
|
||||
node: function (type, value, start, end, nodes) {
|
||||
return new Node(value, end, type ? null : slice$1(this.source, start, end), nodes);
|
||||
@ -13794,12 +13804,12 @@ var doric = (function (exports) {
|
||||
|
||||
var Set$7 = setHelpers.Set;
|
||||
var SetPrototype = setHelpers.proto;
|
||||
var forEach$1 = functionUncurryThis(SetPrototype.forEach);
|
||||
var forEach = functionUncurryThis(SetPrototype.forEach);
|
||||
var keys = functionUncurryThis(SetPrototype.keys);
|
||||
var next = keys(new Set$7()).next;
|
||||
|
||||
var setIterate = function (set, fn, interruptible) {
|
||||
return interruptible ? iterateSimple(keys(set), fn, next) : forEach$1(set, fn);
|
||||
return interruptible ? iterateSimple(keys(set), fn, next) : forEach(set, fn);
|
||||
};
|
||||
|
||||
var Set$6 = setHelpers.Set;
|
||||
@ -15704,7 +15714,7 @@ var doric = (function (exports) {
|
||||
|
||||
var type = classof(value);
|
||||
var deep = false;
|
||||
var C, name, cloned, dataTransfer, i, length, keys, key, source, target, options;
|
||||
var C, name, cloned, dataTransfer, i, length, keys, key, source, target;
|
||||
|
||||
switch (type) {
|
||||
case 'Array':
|
||||
@ -15859,12 +15869,11 @@ var doric = (function (exports) {
|
||||
if (!C && typeof value.slice != 'function') { throwUnpolyfillable(type); }
|
||||
// detached buffers throws in `DataView` and `.slice`
|
||||
try {
|
||||
if (typeof value.slice == 'function' && !value.resizable) {
|
||||
if (typeof value.slice == 'function') {
|
||||
cloned = value.slice(0);
|
||||
} else {
|
||||
length = value.byteLength;
|
||||
options = 'maxByteLength' in value ? { maxByteLength: value.maxByteLength } : undefined;
|
||||
cloned = new ArrayBuffer(length, options);
|
||||
cloned = new ArrayBuffer(length);
|
||||
source = new C(value);
|
||||
target = new C(cloned);
|
||||
for (i = 0; i < length; i++) {
|
||||
@ -16087,7 +16096,6 @@ var doric = (function (exports) {
|
||||
result += key + value;
|
||||
});
|
||||
return (isPure && !url.toJSON)
|
||||
|| (!searchParams.size && (isPure || !descriptors))
|
||||
|| !searchParams.sort
|
||||
|| url.href !== 'http://a/c%20d?a=1&c=3'
|
||||
|| searchParams.get('c') !== '3'
|
||||
@ -16314,7 +16322,6 @@ var doric = (function (exports) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var ITERATOR = wellKnownSymbol('iterator');
|
||||
@ -16490,22 +16497,20 @@ var doric = (function (exports) {
|
||||
// `URLSearchParams` constructor
|
||||
// https://url.spec.whatwg.org/#interface-urlsearchparams
|
||||
var URLSearchParamsConstructor = function URLSearchParams(/* init */) {
|
||||
anInstance(this, URLSearchParamsPrototype$1);
|
||||
anInstance(this, URLSearchParamsPrototype);
|
||||
var init = arguments.length > 0 ? arguments[0] : undefined;
|
||||
var state = setInternalState$1(this, new URLSearchParamsState(init));
|
||||
if (!descriptors) { this.length = state.entries.length; }
|
||||
setInternalState$1(this, new URLSearchParamsState(init));
|
||||
};
|
||||
|
||||
var URLSearchParamsPrototype$1 = URLSearchParamsConstructor.prototype;
|
||||
var URLSearchParamsPrototype = URLSearchParamsConstructor.prototype;
|
||||
|
||||
defineBuiltIns(URLSearchParamsPrototype$1, {
|
||||
defineBuiltIns(URLSearchParamsPrototype, {
|
||||
// `URLSearchParams.prototype.append` method
|
||||
// https://url.spec.whatwg.org/#dom-urlsearchparams-append
|
||||
append: function append(name, value) {
|
||||
validateArgumentsLength(arguments.length, 2);
|
||||
var state = getInternalParamsState(this);
|
||||
push$1(state.entries, { key: toString_1(name), value: toString_1(value) });
|
||||
if (!descriptors) { this.length++; }
|
||||
state.updateURL();
|
||||
},
|
||||
// `URLSearchParams.prototype.delete` method
|
||||
@ -16520,7 +16525,6 @@ var doric = (function (exports) {
|
||||
if (entries[index].key === key) { splice(entries, index, 1); }
|
||||
else { index++; }
|
||||
}
|
||||
if (!descriptors) { this.length = entries.length; }
|
||||
state.updateURL();
|
||||
},
|
||||
// `URLSearchParams.prototype.get` method
|
||||
@ -16582,7 +16586,6 @@ var doric = (function (exports) {
|
||||
}
|
||||
}
|
||||
if (!found) { push$1(entries, { key: key, value: val }); }
|
||||
if (!descriptors) { this.length = entries.length; }
|
||||
state.updateURL();
|
||||
},
|
||||
// `URLSearchParams.prototype.sort` method
|
||||
@ -16620,24 +16623,14 @@ var doric = (function (exports) {
|
||||
}, { enumerable: true });
|
||||
|
||||
// `URLSearchParams.prototype[@@iterator]` method
|
||||
defineBuiltIn(URLSearchParamsPrototype$1, ITERATOR, URLSearchParamsPrototype$1.entries, { name: 'entries' });
|
||||
defineBuiltIn(URLSearchParamsPrototype, ITERATOR, URLSearchParamsPrototype.entries, { name: 'entries' });
|
||||
|
||||
// `URLSearchParams.prototype.toString` method
|
||||
// https://url.spec.whatwg.org/#urlsearchparams-stringification-behavior
|
||||
defineBuiltIn(URLSearchParamsPrototype$1, 'toString', function toString() {
|
||||
defineBuiltIn(URLSearchParamsPrototype, 'toString', function toString() {
|
||||
return getInternalParamsState(this).serialize();
|
||||
}, { enumerable: true });
|
||||
|
||||
// `URLSearchParams.prototype.size` getter
|
||||
// https://github.com/whatwg/url/pull/734
|
||||
if (descriptors) { defineBuiltInAccessor(URLSearchParamsPrototype$1, 'size', {
|
||||
get: function size() {
|
||||
return getInternalParamsState(this).entries.length;
|
||||
},
|
||||
configurable: true,
|
||||
enumerable: true
|
||||
}); }
|
||||
|
||||
setToStringTag(URLSearchParamsConstructor, URL_SEARCH_PARAMS);
|
||||
|
||||
_export({ global: true, constructor: true, forced: !urlConstructorDetection }, {
|
||||
@ -17746,23 +17739,6 @@ var doric = (function (exports) {
|
||||
}
|
||||
});
|
||||
|
||||
var URLSearchParamsPrototype = URLSearchParams.prototype;
|
||||
var forEach = functionUncurryThis(URLSearchParamsPrototype.forEach);
|
||||
|
||||
// `URLSearchParams.prototype.size` getter
|
||||
// https://github.com/whatwg/url/pull/734
|
||||
if (descriptors && !('size' in URLSearchParamsPrototype)) {
|
||||
defineBuiltInAccessor(URLSearchParamsPrototype, 'size', {
|
||||
get: function size() {
|
||||
var count = 0;
|
||||
forEach(this, function () { count++; });
|
||||
return count;
|
||||
},
|
||||
configurable: true,
|
||||
enumerable: true
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* Copyright [2019] [Doric.Pub]
|
||||
*
|
||||
|
2
doric-web/dist/index.js.map
vendored
2
doric-web/dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user