iOS: add DoricDevPerfVC

This commit is contained in:
pengfei.zhou 2021-07-21 15:05:41 +08:00 committed by osborn
parent 74e9aa0e38
commit 8f50d2d67c
12 changed files with 387 additions and 290 deletions

View File

@ -74,6 +74,7 @@ public class MainActivity extends AppCompatActivity {
} catch (IOException e) {
e.printStackTrace();
}
DoricDev.getInstance();
}
public class MyAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {

View File

@ -51,7 +51,7 @@ public class DoricDevPerfActivity extends DoricDevBaseActivity {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_doricdev_perf);
TextView textView = findViewById(R.id.tv_title);
textView.setText(String.format("Doric %s <%s>", doricContext.getSource(), doricContext.getContextId()));
textView.setText(String.format("%s <%s>", doricContext.getSource(), doricContext.getContextId()));
RecyclerView recyclerView = findViewById(R.id.list);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
myAdapter = new MyAdapter();
@ -127,12 +127,12 @@ public class DoricDevPerfActivity extends DoricDevBaseActivity {
if (prevNode != null) {
gap = Math.min(16, anchorNode.prepare - prevNode.end);
}
position = position + gap;
position += gap;
anchorItem.position = position;
anchorItem.prepared = anchorNode.start - anchorNode.prepare;
anchorItem.worked = anchorNode.end - anchorNode.start;
anchorNodes.add(anchorItem);
position = position + anchorItem.prepared + anchorItem.worked;
position += anchorItem.prepared + anchorItem.worked;
prevNode = anchorNode;
}
duration = position;

View File

@ -0,0 +1,25 @@
/*
* Copyright [2021] [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.
*/
//
// Created by pengfei.zhou on 2021/7/20.
//
#import <Foundation/Foundation.h>
@interface DoricDevPerfVC : UIViewController
- (instancetype)initWithContextId:(NSString *)contextId;
@end

View File

@ -0,0 +1,213 @@
/*
* Copyright [2021] [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.
*/
//
// Created by pengfei.zhou on 2021/7/20.
//
#import "DoricDevPerfVC.h"
#import <DoricCore/Doric.h>
#import <DoricCore/DoricContextManager.h>
#import "DoricDevPerformanceAnchorHook.h"
@interface DoricDevAnchorItem : NSObject
@property(nonatomic, copy) NSString *name;
@property(nonatomic, assign) long position;
@property(nonatomic, assign) long prepared;
@property(nonatomic, assign) long worked;
@property(nonatomic, assign) BOOL expanded;
@end
@implementation DoricDevAnchorItem
- (CGFloat)cellHeight {
return 40;
}
@end
@interface DoricDevAnchorCell : UITableViewCell
@property(nonatomic, strong) UILabel *labelName;
@property(nonatomic, strong) UIView *waterfallPrepared;
@property(nonatomic, strong) UIView *waterfallWorked;
@property(nonatomic, assign) long duration;
@end
@implementation DoricDevAnchorCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style
reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
self.selectionStyle = UITableViewCellSelectionStyleNone;
self.labelName = [[UILabel new] also:^(UILabel *it) {
it.font = [UIFont systemFontOfSize:16];
it.width = 80;
it.height = 25;
it.backgroundColor = DoricColor(@(0xff3498db));
it.textColor = [UIColor whiteColor];
it.text = @"Destroy";
it.textAlignment = NSTextAlignmentCenter;
[self.contentView addSubview:it];
}];
self.waterfallPrepared = [[UIView new] also:^(UIView *it) {
it.backgroundColor = DoricColor(@(0xff1abc9c));
it.height = 20;
[self.contentView addSubview:it];
}];
self.waterfallWorked = [[UIView new] also:^(UIView *it) {
it.backgroundColor = DoricColor(@(0xfff1c40f));
it.height = 20;
[self.contentView addSubview:it];
}];
}
return self;
}
- (void)refreshUI:(DoricDevAnchorItem *)anchorItem {
self.contentView.width = self.width;
self.contentView.height = [anchorItem cellHeight];
self.labelName.left = 15;
self.labelName.centerY = 20;
if ([anchorItem.name hasPrefix:@"Call"]) {
self.labelName.text = @"Call";
self.labelName.backgroundColor = DoricColor(@(0xff3498db));
} else {
if ([anchorItem.name isEqualToString:@"Render"]) {
self.labelName.backgroundColor = DoricColor(@(0xffe74c3c));
} else {
self.labelName.backgroundColor = DoricColor(@(0xff2ecc71));
}
self.labelName.text = anchorItem.name;
}
self.waterfallPrepared.centerY = 20;
self.waterfallWorked.centerY = 20;
CGFloat all = self.width - 15 - self.labelName.width - 15 - 15;
self.waterfallPrepared.left = self.labelName.right + 15 + ((CGFloat) anchorItem.position / (CGFloat) self.duration) * all;
self.waterfallPrepared.width = ((CGFloat) anchorItem.prepared / (CGFloat) self.duration) * all;
self.waterfallWorked.left = self.waterfallPrepared.right;
self.waterfallWorked.width = ((CGFloat) MAX(anchorItem.worked, 1) / (CGFloat) self.duration) * all;
}
@end
@interface DoricDevPerfVC () <UITableViewDelegate, UITableViewDataSource>
@property(nonatomic, weak) DoricContext *doricContext;
@property(nonatomic, strong) UILabel *rightButton;
@property(nonatomic, strong) UIView *headerView;
@property(nonatomic, strong) UITableView *tableView;
@property(nonatomic, strong) NSMutableArray<DoricDevAnchorItem *> *anchorItems;
@property(nonatomic, assign) long duration;
@end
@implementation DoricDevPerfVC
- (instancetype)initWithContextId:(NSString *)contextId {
if (self = [super init]) {
_doricContext = [DoricContextManager.instance getContext:contextId];
_anchorItems = [NSMutableArray new];
_duration = 1;
}
return self;
}
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"Performance";
self.view.backgroundColor = [UIColor whiteColor];
self.headerView = [[UIView new] also:^(UIView *it) {
it.width = self.view.width;
it.height = 50.f;
it.backgroundColor = DoricColor(@(0xff7f8c8d));
[self.view addSubview:it];
}];
UILabel *label = [[UILabel new] also:^(UILabel *it) {
it.textColor = [UIColor whiteColor];
it.font = [UIFont systemFontOfSize:16];
it.text = [NSString stringWithFormat:@"%@ <%@>",
self.doricContext.source,
self.doricContext.contextId];
[it sizeToFit];
[self.headerView addSubview:it];
}];
label.left = 15.f;
label.centerY = self.headerView.centerY;
self.rightButton = [[UILabel new] also:^(UILabel *it) {
it.textColor = [UIColor whiteColor];
it.font = [UIFont systemFontOfSize:16];
it.text = @"Expand[+]";
[it sizeToFit];
[self.headerView addSubview:it];
}];
self.rightButton.right = self.headerView.right - 15;
self.rightButton.centerY = self.headerView.centerY;
self.tableView = [[UITableView new] also:^(UITableView *it) {
it.width = self.view.width;
it.height = self.view.height - self.headerView.height;
it.delegate = self;
it.dataSource = self;
it.separatorStyle = UITableViewCellSeparatorStyleNone;
it.allowsSelection = NO;
[self.view addSubview:it];
}];
self.tableView.top = self.headerView.bottom;
if ([self.doricContext.driver.registry.globalPerformanceAnchorHook
isKindOfClass:DoricDevPerformanceAnchorHook.class]) {
NSArray <DoricDevAnchorNode *> *nodes = [((DoricDevPerformanceAnchorHook *) self.doricContext.driver.registry.globalPerformanceAnchorHook)
getAnchorNodeList:self.doricContext.contextId];
DoricDevAnchorNode *prevNode = nil;
long position = 0;
for (DoricDevAnchorNode *node in nodes) {
DoricDevAnchorItem *item = [DoricDevAnchorItem new];
item.name = node.name;
long gap = 0;
if (prevNode) {
gap = MIN(16, node.prepare - prevNode.end);
}
position += gap;
item.position = position;
item.prepared = node.start - node.prepare;
item.worked = node.end - node.start;
[self.anchorItems addObject:item];
position += (node.end - node.prepare);
prevNode = node;
}
self.duration = position;
}
[self.tableView reloadData];
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
self.tableView.height = self.view.height - self.headerView.height;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
DoricDevAnchorCell *cell = [tableView dequeueReusableCellWithIdentifier:@"DoricDevAnchorCell"];
if (!cell) {
cell = [[DoricDevAnchorCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"DoricDevAnchorCell"];
}
cell.width = tableView.width;
cell.duration = self.duration;
NSUInteger position = (NSUInteger) indexPath.row;
cell.backgroundColor = position % 2 == 0 ? DoricColor(@(0xffecf0f1)) : [UIColor whiteColor];
[cell refreshUI:self.anchorItems[position]];
return cell;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.anchorItems.count;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
NSUInteger position = (NSUInteger) indexPath.row;
return [self.anchorItems[position] cellHeight];
}
@end

View File

@ -20,5 +20,13 @@
#import <Foundation/Foundation.h>
#import <DoricCore/Doric.h>
@interface DoricDevPerformanceAnchorHook : NSObject<DoricPerformanceGlobalAnchorHookProtocol>
@interface DoricDevAnchorNode : NSObject
@property(nonatomic, copy) NSString *name;
@property(nonatomic, assign) long prepare;
@property(nonatomic, assign) long start;
@property(nonatomic, assign) long end;
@end
@interface DoricDevPerformanceAnchorHook : NSObject <DoricPerformanceGlobalAnchorHookProtocol>
- (NSArray <DoricDevAnchorNode *> *)getAnchorNodeList:(NSString *)name;
@end

View File

@ -19,8 +19,32 @@
#import "DoricDevPerformanceAnchorHook.h"
@implementation DoricDevAnchorNode
@end
@interface DoricDevPerformanceAnchorHook ()
@property(nonatomic, strong) NSMutableDictionary<NSString *, NSMutableArray <DoricDevAnchorNode *> *> *nodeMap;
@property(nonatomic, copy) NSComparator comparator;
@end
@implementation DoricDevPerformanceAnchorHook
- (instancetype)init {
if (self = [super init]) {
_nodeMap = [NSMutableDictionary new];
_comparator = ^NSComparisonResult(DoricDevAnchorNode *obj1, DoricDevAnchorNode *obj2) {
long ret = obj1.prepare - obj2.prepare;
if (ret > 0) {
return NSOrderedDescending;
} else if (ret < 0) {
return NSOrderedAscending;
} else {
return NSOrderedSame;
}
};
}
return self;
}
- (void)onAnchorName:(NSString *)name prepare:(NSNumber *)prepare start:(NSNumber *)start end:(NSNumber *)end in:(DoricPerformanceProfile *)profile {
NSLog(@"[DoricPerformance] %@: %@ prepared %@ms, cost %@ms",
profile.name,
@ -28,10 +52,28 @@ - (void)onAnchorName:(NSString *)name prepare:(NSNumber *)prepare start:(NSNumbe
@(start.integerValue - prepare.integerValue),
@(end.integerValue - start.integerValue)
);
NSMutableArray<DoricDevAnchorNode *> *array = self.nodeMap[profile.name];
if (!array) {
array = [NSMutableArray new];
self.nodeMap[profile.name] = array;
}
[array addObject:[[DoricDevAnchorNode new] also:^(DoricDevAnchorNode *it) {
it.name = name;
it.prepare = prepare.longValue;
it.start = start.longValue;
it.end = end.longValue;
}]];
[array sortUsingComparator:self.comparator];
if ([name isEqualToString:@"Destroy"]) {
[self.nodeMap removeObjectForKey:profile.name];
}
}
- (void)onAnchorName:(NSString *)name prepare:(NSNumber *)prepare start:(NSNumber *)start end:(NSNumber *)end {
//Do nothing
}
- (NSArray <DoricDevAnchorNode *> *)getAnchorNodeList:(NSString *)name {
return [self.nodeMap[name] copy];
}
@end

View File

@ -31,6 +31,7 @@
#import "DoricShowNodeTreeViewController.h"
#import "DoricRegistry.h"
#import "DoricSnapshotView.h"
#import "DoricDevPerfVC.h"
@interface DoricContextCell : UITableViewCell
@property(nonatomic, strong) UILabel *tvId;
@ -110,20 +111,6 @@ - (void)onClick {
[alertController addAction:cancel];
[alertController addAction:viewSource];
UIAlertAction *showNodeTree = [UIAlertAction actionWithTitle:@"Show node tree" style:UIAlertActionStyleDefault handler:^(UIAlertAction *_) {
DoricShowNodeTreeViewController *doricShowNodeTreeViewController = [[DoricShowNodeTreeViewController alloc] init];
doricShowNodeTreeViewController.contextId = self.doricContext.contextId;
UIViewController *viewController = [UIApplication sharedApplication].delegate.window.rootViewController;
UINavigationController *navigationController;
if ([viewController isKindOfClass:[UINavigationController class]]) {
navigationController = (UINavigationController *) viewController;
} else {
navigationController = viewController.navigationController;
}
[navigationController pushViewController:doricShowNodeTreeViewController animated:NO];
}];
[alertController addAction:showNodeTree];
if (DoricDev.instance.isInDevMode) {
if ([self.doricContext.driver isKindOfClass:DoricDebugDriver.class]) {
@ -148,6 +135,39 @@ - (void)onClick {
[alertController addAction:snapshot];
}
if ([DoricRegistry isEnablePerformance]) {
UIAlertAction *performanceAction = [UIAlertAction
actionWithTitle:@"Performance"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *_) {
DoricDevPerfVC *doricDevPerfVc = [[DoricDevPerfVC alloc] initWithContextId:self.doricContext.contextId];
UIViewController *viewController = [UIApplication sharedApplication].delegate.window.rootViewController;
UINavigationController *navigationController;
if ([viewController isKindOfClass:[UINavigationController class]]) {
navigationController = (UINavigationController *) viewController;
} else {
navigationController = viewController.navigationController;
}
[navigationController pushViewController:doricDevPerfVc animated:NO];
}];
[alertController addAction:performanceAction];
}
UIAlertAction *showNodeTree = [UIAlertAction actionWithTitle:@"View node tree" style:UIAlertActionStyleDefault handler:^(UIAlertAction *_) {
DoricShowNodeTreeViewController *doricShowNodeTreeViewController = [[DoricShowNodeTreeViewController alloc] init];
doricShowNodeTreeViewController.contextId = self.doricContext.contextId;
UIViewController *viewController = [UIApplication sharedApplication].delegate.window.rootViewController;
UINavigationController *navigationController;
if ([viewController isKindOfClass:[UINavigationController class]]) {
navigationController = (UINavigationController *) viewController;
} else {
navigationController = viewController.navigationController;
}
[navigationController pushViewController:doricShowNodeTreeViewController animated:NO];
}];
[alertController addAction:showNodeTree];
[self.vc presentViewController:alertController animated:true completion:nil];
}
@end

View File

@ -23,6 +23,7 @@ @implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"Doric Demo";
[DoricDev instance];
[self.navigationController.navigationBar setBackgroundImage:UIImageWithColor(UIColor.whiteColor) forBarMetrics:UIBarMetricsDefault];
NSString *path = [[NSBundle mainBundle] bundlePath];
NSString *demoPath = [path stringByAppendingPathComponent:@"src"];

View File

@ -109,7 +109,7 @@ - (void)print:(NSString *)anchorName {
}
for (id <DoricPerformanceAnchorHookProtocol> hook in self.hooks) {
if ([hook conformsToProtocol:@protocol(DoricPerformanceGlobalAnchorHookProtocol)]) {
[(id <DoricPerformanceGlobalAnchorHookProtocol>) hook onAnchorName:anchorName prepare:end start:end end:end in:self];
[(id <DoricPerformanceGlobalAnchorHookProtocol>) hook onAnchorName:anchorName prepare:prepare start:start end:end in:self];
} else {
[hook onAnchorName:anchorName prepare:prepare start:start end:end];
}

View File

@ -1677,7 +1677,7 @@ var doric = (function (exports) {
var hasOwnProperty = {}.hasOwnProperty;
var has$1 = Object.hasOwn || function hasOwn(it, key) {
var has$1 = function hasOwn(it, key) {
return hasOwnProperty.call(toObject(it), key);
};
@ -1764,7 +1764,7 @@ var doric = (function (exports) {
var functionToString = Function.toString;
// this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
// this helper broken in `3.4.1-3.4.4`, so we can't use `shared` helper
if (typeof sharedStore.inspectSource != 'function') {
sharedStore.inspectSource = function (it) {
return functionToString.call(it);
@ -1783,7 +1783,7 @@ var doric = (function (exports) {
(module.exports = function (key, value) {
return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
})('versions', []).push({
version: '3.14.0',
version: '3.12.1',
mode: 'global',
copyright: '© 2021 Denis Pushkarev (zloirock.ru)'
});
@ -1911,12 +1911,12 @@ var doric = (function (exports) {
};
var ceil$2 = Math.ceil;
var floor$a = Math.floor;
var floor$9 = Math.floor;
// `ToInteger` abstract operation
// https://tc39.es/ecma262/#sec-tointeger
var toInteger = function (argument) {
return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor$a : ceil$2)(argument);
return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor$9 : ceil$2)(argument);
};
var min$9 = Math.min;
@ -2131,10 +2131,8 @@ var doric = (function (exports) {
// eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
var symbol = Symbol();
return !String(Symbol()) ||
// Chrome 38 Symbol has incorrect toString conversion
// `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
return !String(symbol) || !(Object(symbol) instanceof Symbol) ||
// Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
!Symbol.sham && engineV8Version && engineV8Version < 41;
});
@ -3288,6 +3286,7 @@ var doric = (function (exports) {
var callWithSafeIterationClosing = function (iterator, fn, value, ENTRIES) {
try {
return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);
// 7.4.6 IteratorClose(iterator, completion)
} catch (error) {
iteratorClose(iterator);
throw error;
@ -3444,8 +3443,7 @@ var doric = (function (exports) {
if (NEW_ITERATOR_PROTOTYPE) { IteratorPrototype$3 = {}; }
// `%IteratorPrototype%[@@iterator]()` method
// https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
if (!has$1(IteratorPrototype$3, ITERATOR$5)) {
createNonEnumerableProperty(IteratorPrototype$3, ITERATOR$5, returnThis$2);
}
@ -3519,7 +3517,7 @@ var doric = (function (exports) {
}
}
// fix Array.prototype.{ values, @@iterator }.name in V8 / FF
// fix Array#{values, @@iterator}.name in V8 / FF
if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
INCORRECT_VALUES_NAME = true;
defaultIterator = function values() { return nativeIterator.call(this); };
@ -3816,64 +3814,8 @@ var doric = (function (exports) {
}
});
// TODO: use something more complex like timsort?
var floor$9 = Math.floor;
var mergeSort = function (array, comparefn) {
var length = array.length;
var middle = floor$9(length / 2);
return length < 8 ? insertionSort(array, comparefn) : merge(
mergeSort(array.slice(0, middle), comparefn),
mergeSort(array.slice(middle), comparefn),
comparefn
);
};
var insertionSort = function (array, comparefn) {
var length = array.length;
var i = 1;
var element, j;
while (i < length) {
j = i;
element = array[i];
while (j && comparefn(array[j - 1], element) > 0) {
array[j] = array[--j];
}
if (j !== i++) { array[j] = element; }
} return array;
};
var merge = function (left, right, comparefn) {
var llength = left.length;
var rlength = right.length;
var lindex = 0;
var rindex = 0;
var result = [];
while (lindex < llength || rindex < rlength) {
if (lindex < llength && rindex < rlength) {
result.push(comparefn(left[lindex], right[rindex]) <= 0 ? left[lindex++] : right[rindex++]);
} else {
result.push(lindex < llength ? left[lindex++] : right[rindex++]);
}
} return result;
};
var arraySort = mergeSort;
var firefox = engineUserAgent.match(/firefox\/(\d+)/i);
var engineFfVersion = !!firefox && +firefox[1];
var engineIsIeOrEdge = /MSIE|Trident/.test(engineUserAgent);
var webkit = engineUserAgent.match(/AppleWebKit\/(\d+)\./);
var engineWebkitVersion = !!webkit && +webkit[1];
var test = [];
var nativeSort$1 = test.sort;
var nativeSort = test.sort;
// IE8-
var FAILS_ON_UNDEFINED = fails(function () {
@ -3886,78 +3828,15 @@ var doric = (function (exports) {
// Old WebKit
var STRICT_METHOD = arrayMethodIsStrict('sort');
var STABLE_SORT$1 = !fails(function () {
// feature detection can be too slow, so check engines versions
if (engineV8Version) { return engineV8Version < 70; }
if (engineFfVersion && engineFfVersion > 3) { return; }
if (engineIsIeOrEdge) { return true; }
if (engineWebkitVersion) { return engineWebkitVersion < 603; }
var result = '';
var code, chr, value, index;
// generate an array with more 512 elements (Chakra and old V8 fails only in this case)
for (code = 65; code < 76; code++) {
chr = String.fromCharCode(code);
switch (code) {
case 66: case 69: case 70: case 72: value = 3; break;
case 68: case 71: value = 4; break;
default: value = 2;
}
for (index = 0; index < 47; index++) {
test.push({ k: chr + index, v: value });
}
}
test.sort(function (a, b) { return b.v - a.v; });
for (index = 0; index < test.length; index++) {
chr = test[index].k.charAt(0);
if (result.charAt(result.length - 1) !== chr) { result += chr; }
}
return result !== 'DGBEFHACIJK';
});
var FORCED$l = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD || !STABLE_SORT$1;
var getSortCompare$1 = function (comparefn) {
return function (x, y) {
if (y === undefined) { return -1; }
if (x === undefined) { return 1; }
if (comparefn !== undefined) { return +comparefn(x, y) || 0; }
return String(x) > String(y) ? 1 : -1;
};
};
var FORCED$l = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD;
// `Array.prototype.sort` method
// https://tc39.es/ecma262/#sec-array.prototype.sort
_export({ target: 'Array', proto: true, forced: FORCED$l }, {
sort: function sort(comparefn) {
if (comparefn !== undefined) { aFunction(comparefn); }
var array = toObject(this);
if (STABLE_SORT$1) { return comparefn === undefined ? nativeSort$1.call(array) : nativeSort$1.call(array, comparefn); }
var items = [];
var arrayLength = toLength(array.length);
var itemsLength, index;
for (index = 0; index < arrayLength; index++) {
if (index in array) { items.push(array[index]); }
}
items = arraySort(items, getSortCompare$1(comparefn));
itemsLength = items.length;
index = 0;
while (index < itemsLength) { array[index] = items[index++]; }
while (index < arrayLength) { delete array[index++]; }
return array;
return comparefn === undefined
? nativeSort.call(toObject(this))
: nativeSort.call(toObject(this), aFunction(comparefn));
}
});
@ -4707,8 +4586,6 @@ var doric = (function (exports) {
}
});
// `Date.prototype[@@toPrimitive](hint)` method implementation
// https://tc39.es/ecma262/#sec-date.prototype-@@toprimitive
var dateToPrimitive = function (hint) {
if (hint !== 'string' && hint !== 'number' && hint !== 'default') {
throw TypeError('Incorrect hint');
@ -5091,9 +4968,8 @@ var doric = (function (exports) {
};
redefineAll(C.prototype, {
// `{ Map, Set }.prototype.clear()` methods
// https://tc39.es/ecma262/#sec-map.prototype.clear
// https://tc39.es/ecma262/#sec-set.prototype.clear
// 23.1.3.1 Map.prototype.clear()
// 23.2.3.2 Set.prototype.clear()
clear: function clear() {
var that = this;
var state = getInternalState(that);
@ -5109,9 +4985,8 @@ var doric = (function (exports) {
if (descriptors) { state.size = 0; }
else { that.size = 0; }
},
// `{ Map, Set }.prototype.delete(key)` methods
// https://tc39.es/ecma262/#sec-map.prototype.delete
// https://tc39.es/ecma262/#sec-set.prototype.delete
// 23.1.3.3 Map.prototype.delete(key)
// 23.2.3.4 Set.prototype.delete(value)
'delete': function (key) {
var that = this;
var state = getInternalState(that);
@ -5129,9 +5004,8 @@ var doric = (function (exports) {
else { that.size--; }
} return !!entry;
},
// `{ Map, Set }.prototype.forEach(callbackfn, thisArg = undefined)` methods
// https://tc39.es/ecma262/#sec-map.prototype.foreach
// https://tc39.es/ecma262/#sec-set.prototype.foreach
// 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)
// 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined)
forEach: function forEach(callbackfn /* , that = undefined */) {
var state = getInternalState(this);
var boundFunction = functionBindContext(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3);
@ -5142,29 +5016,25 @@ var doric = (function (exports) {
while (entry && entry.removed) { entry = entry.previous; }
}
},
// `{ Map, Set}.prototype.has(key)` methods
// https://tc39.es/ecma262/#sec-map.prototype.has
// https://tc39.es/ecma262/#sec-set.prototype.has
// 23.1.3.7 Map.prototype.has(key)
// 23.2.3.7 Set.prototype.has(value)
has: function has(key) {
return !!getEntry(this, key);
}
});
redefineAll(C.prototype, IS_MAP ? {
// `Map.prototype.get(key)` method
// https://tc39.es/ecma262/#sec-map.prototype.get
// 23.1.3.6 Map.prototype.get(key)
get: function get(key) {
var entry = getEntry(this, key);
return entry && entry.value;
},
// `Map.prototype.set(key, value)` method
// https://tc39.es/ecma262/#sec-map.prototype.set
// 23.1.3.9 Map.prototype.set(key, value)
set: function set(key, value) {
return define(this, key === 0 ? 0 : key, value);
}
} : {
// `Set.prototype.add(value)` method
// https://tc39.es/ecma262/#sec-set.prototype.add
// 23.2.3.1 Set.prototype.add(value)
add: function add(value) {
return define(this, value = value === 0 ? 0 : value, value);
}
@ -5180,15 +5050,8 @@ var doric = (function (exports) {
var ITERATOR_NAME = CONSTRUCTOR_NAME + ' Iterator';
var getInternalCollectionState = internalStateGetterFor$1(CONSTRUCTOR_NAME);
var getInternalIteratorState = internalStateGetterFor$1(ITERATOR_NAME);
// `{ Map, Set }.prototype.{ keys, values, entries, @@iterator }()` methods
// https://tc39.es/ecma262/#sec-map.prototype.entries
// https://tc39.es/ecma262/#sec-map.prototype.keys
// https://tc39.es/ecma262/#sec-map.prototype.values
// https://tc39.es/ecma262/#sec-map.prototype-@@iterator
// https://tc39.es/ecma262/#sec-set.prototype.entries
// https://tc39.es/ecma262/#sec-set.prototype.keys
// https://tc39.es/ecma262/#sec-set.prototype.values
// https://tc39.es/ecma262/#sec-set.prototype-@@iterator
// add .keys, .values, .entries, [@@iterator]
// 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11
defineIterator(C, CONSTRUCTOR_NAME, function (iterated, kind) {
setInternalState$d(this, {
type: ITERATOR_NAME,
@ -5215,9 +5078,7 @@ var doric = (function (exports) {
return { value: [entry.key, entry.value], done: false };
}, IS_MAP ? 'entries' : 'values', !IS_MAP, true);
// `{ Map, Set }.prototype[@@species]` accessors
// https://tc39.es/ecma262/#sec-get-map-@@species
// https://tc39.es/ecma262/#sec-get-set-@@species
// add [@@species], 23.1.2.2, 23.2.2.2
setSpecies(CONSTRUCTOR_NAME);
}
};
@ -5934,9 +5795,6 @@ var doric = (function (exports) {
// Forced replacement object prototype accessors methods
var objectPrototypeAccessorsForced = !fails(function () {
// This feature detection crashes old WebKit
// https://github.com/zloirock/core-js/issues/232
if (engineWebkitVersion && engineWebkitVersion < 535) { return; }
var key = Math.random();
// In FF throws only define methods
// eslint-disable-next-line no-undef, no-useless-call -- required for testing
@ -6462,8 +6320,7 @@ var doric = (function (exports) {
this.reject = aFunction(reject);
};
// `NewPromiseCapability` abstract operation
// https://tc39.es/ecma262/#sec-newpromisecapability
// 25.4.1.5 NewPromiseCapability(C)
var f = function (C) {
return new PromiseCapability(C);
};
@ -8041,7 +7898,6 @@ var doric = (function (exports) {
var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d{1,2}|<[^>]*>)/g;
var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d{1,2})/g;
// `GetSubstitution` abstract operation
// https://tc39.es/ecma262/#sec-getsubstitution
var getSubstitution = function (matched, str, position, captures, namedCaptures, replacement) {
var tailPos = position + matched.length;
@ -8464,7 +8320,7 @@ var doric = (function (exports) {
var quot = /"/g;
// `CreateHTML` abstract operation
// B.2.3.2.1 CreateHTML(string, tag, attribute, value)
// https://tc39.es/ecma262/#sec-createhtml
var createHtml = function (string, tag, attribute, value) {
var S = String(requireObjectCoercible(string));
@ -9251,78 +9107,13 @@ var doric = (function (exports) {
var aTypedArray$7 = arrayBufferViewCore.aTypedArray;
var exportTypedArrayMethod$8 = arrayBufferViewCore.exportTypedArrayMethod;
var Uint16Array = global_1.Uint16Array;
var nativeSort = Uint16Array && Uint16Array.prototype.sort;
// WebKit
var ACCEPT_INCORRECT_ARGUMENTS = !!nativeSort && !fails(function () {
var array = new Uint16Array(2);
array.sort(null);
array.sort({});
});
var STABLE_SORT = !!nativeSort && !fails(function () {
// feature detection can be too slow, so check engines versions
if (engineV8Version) { return engineV8Version < 74; }
if (engineFfVersion) { return engineFfVersion < 67; }
if (engineIsIeOrEdge) { return true; }
if (engineWebkitVersion) { return engineWebkitVersion < 602; }
var array = new Uint16Array(516);
var expected = Array(516);
var index, mod;
for (index = 0; index < 516; index++) {
mod = index % 4;
array[index] = 515 - index;
expected[index] = index - 2 * mod + 3;
}
array.sort(function (a, b) {
return (a / 4 | 0) - (b / 4 | 0);
});
for (index = 0; index < 516; index++) {
if (array[index] !== expected[index]) { return true; }
}
});
var getSortCompare = function (comparefn) {
return function (x, y) {
if (comparefn !== undefined) { return +comparefn(x, y) || 0; }
// eslint-disable-next-line no-self-compare -- NaN check
if (y !== y) { return -1; }
// eslint-disable-next-line no-self-compare -- NaN check
if (x !== x) { return 1; }
if (x === 0 && y === 0) { return 1 / x > 0 && 1 / y < 0 ? 1 : -1; }
return x > y;
};
};
var $sort = [].sort;
// `%TypedArray%.prototype.sort` method
// https://tc39.es/ecma262/#sec-%typedarray%.prototype.sort
exportTypedArrayMethod$8('sort', function sort(comparefn) {
var array = this;
if (comparefn !== undefined) { aFunction(comparefn); }
if (STABLE_SORT) { return nativeSort.call(array, comparefn); }
aTypedArray$7(array);
var arrayLength = toLength(array.length);
var items = Array(arrayLength);
var index;
for (index = 0; index < arrayLength; index++) {
items[index] = array[index];
}
items = arraySort(array, getSortCompare(comparefn));
for (index = 0; index < arrayLength; index++) {
array[index] = items[index];
}
return array;
}, !STABLE_SORT || ACCEPT_INCORRECT_ARGUMENTS);
return $sort.call(aTypedArray$7(this), comparefn);
});
var aTypedArray$6 = arrayBufferViewCore.aTypedArray;
var exportTypedArrayMethod$7 = arrayBufferViewCore.exportTypedArrayMethod;
@ -9459,9 +9250,8 @@ var doric = (function (exports) {
};
redefineAll(C.prototype, {
// `{ WeakMap, WeakSet }.prototype.delete(key)` methods
// https://tc39.es/ecma262/#sec-weakmap.prototype.delete
// https://tc39.es/ecma262/#sec-weakset.prototype.delete
// 23.3.3.2 WeakMap.prototype.delete(key)
// 23.4.3.3 WeakSet.prototype.delete(value)
'delete': function (key) {
var state = getInternalState(this);
if (!isObject(key)) { return false; }
@ -9469,9 +9259,8 @@ var doric = (function (exports) {
if (data === true) { return uncaughtFrozenStore(state)['delete'](key); }
return data && has$1(data, state.id) && delete data[state.id];
},
// `{ WeakMap, WeakSet }.prototype.has(key)` methods
// https://tc39.es/ecma262/#sec-weakmap.prototype.has
// https://tc39.es/ecma262/#sec-weakset.prototype.has
// 23.3.3.4 WeakMap.prototype.has(key)
// 23.4.3.4 WeakSet.prototype.has(value)
has: function has(key) {
var state = getInternalState(this);
if (!isObject(key)) { return false; }
@ -9482,8 +9271,7 @@ var doric = (function (exports) {
});
redefineAll(C.prototype, IS_MAP ? {
// `WeakMap.prototype.get(key)` method
// https://tc39.es/ecma262/#sec-weakmap.prototype.get
// 23.3.3.3 WeakMap.prototype.get(key)
get: function get(key) {
var state = getInternalState(this);
if (isObject(key)) {
@ -9492,14 +9280,12 @@ var doric = (function (exports) {
return data ? data[state.id] : undefined;
}
},
// `WeakMap.prototype.set(key, value)` method
// https://tc39.es/ecma262/#sec-weakmap.prototype.set
// 23.3.3.5 WeakMap.prototype.set(key, value)
set: function set(key, value) {
return define(this, key, value);
}
} : {
// `WeakSet.prototype.add(value)` method
// https://tc39.es/ecma262/#sec-weakset.prototype.add
// 23.4.3.1 WeakSet.prototype.add(value)
add: function add(value) {
return define(this, value, true);
}

View File

@ -3812,10 +3812,18 @@ __decorate$3([
Property,
__metadata$3("design:type", Number)
], Input.prototype, "textSize", void 0);
__decorate$3([
Property,
__metadata$3("design:type", String)
], Input.prototype, "font", void 0);
__decorate$3([
Property,
__metadata$3("design:type", String)
], Input.prototype, "hintText", void 0);
__decorate$3([
Property,
__metadata$3("design:type", String)
], Input.prototype, "hintFont", void 0);
__decorate$3([
Property,
__metadata$3("design:type", Number)
@ -5196,7 +5204,7 @@ var doric_web = (function (exports, axios, sandbox) {
}());
});
var __awaiter$1 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@ -5208,7 +5216,7 @@ var doric_web = (function (exports, axios, sandbox) {
const loaders = [
{
filter: () => true,
request: (source) => __awaiter$1(void 0, void 0, void 0, function* () {
request: (source) => __awaiter(void 0, void 0, void 0, function* () {
const result = yield axios__default['default'].get(source);
return result.data;
})
@ -5218,7 +5226,7 @@ var doric_web = (function (exports, axios, sandbox) {
loaders.push(loader);
}
function loadDoricJSBundle(source) {
return __awaiter$1(this, void 0, void 0, function* () {
return __awaiter(this, void 0, void 0, function* () {
const matched = loaders.filter(e => e.filter(source));
if (matched.length > 0) {
return matched[matched.length - 1].request(source);
@ -5235,7 +5243,6 @@ var doric_web = (function (exports, axios, sandbox) {
}
}
exports.LayoutSpec = void 0;
(function (LayoutSpec) {
LayoutSpec[LayoutSpec["EXACTLY"] = 0] = "EXACTLY";
LayoutSpec[LayoutSpec["WRAP_CONTENT"] = 1] = "WRAP_CONTENT";
@ -7641,7 +7648,7 @@ ${content}
}
}
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
var __awaiter$1 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@ -7655,7 +7662,7 @@ ${content}
smoothscroll.polyfill();
registerDoricJSLoader({
filter: (source) => source.startsWith("assets://"),
request: (source) => __awaiter(void 0, void 0, void 0, function* () {
request: (source) => __awaiter$1(void 0, void 0, void 0, function* () {
const ret = yield axios__default['default'].get(source.replace("assets://", `${window.location.href}/../../doric-demo/bundle/`));
return ret.data;
})
@ -7688,8 +7695,6 @@ ${content}
exports.toPixelString = toPixelString;
exports.toRGBAString = toRGBAString;
Object.defineProperty(exports, '__esModule', { value: true });
return exports;
}({}, axios, doric));

File diff suppressed because one or more lines are too long