@social-mail/social-mail-client 1.2.762 → 1.2.764

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1975,175 +1975,8 @@ const UMD = new UMDClass();
1975
1975
  //# sourceMappingURL=umd.js.map
1976
1976
 
1977
1977
  AmdLoader.instance.register(
1978
- ["@social-mail/social-mail-client","@web-atoms/core","reflect-metadata","@web-atoms/date-time","@web-atoms/web-controls"],
1979
- ["@social-mail/social-mail-client/dist/public/preview/video/PreviewVideo","@web-atoms/core/dist/core/XNode","@web-atoms/core/dist/core/Bind","@web-atoms/core/dist/core/ExpressionParser","@web-atoms/core/dist/core/types","reflect-metadata","@web-atoms/core/dist/core/AtomMap","@web-atoms/core/dist/Pack","@web-atoms/core/dist/style/styled","@web-atoms/core/dist/web/controls/AtomControl","@web-atoms/core/dist/core/AtomBinder","@web-atoms/core/dist/core/AtomComponent","@web-atoms/core/dist/App","@web-atoms/core/dist/core/AtomDispatcher","@web-atoms/core/dist/di/RegisterSingleton","@web-atoms/core/dist/di/Register","@web-atoms/core/dist/di/ServiceCollection","@web-atoms/core/dist/di/TypeKey","@web-atoms/core/dist/di/ServiceProvider","@web-atoms/core/dist/core/TransientDisposable","@web-atoms/core/dist/di/Inject","@web-atoms/core/dist/services/BusyIndicatorService","@web-atoms/core/dist/core/AtomDisposableList","@web-atoms/core/dist/core/AtomWatcher","@web-atoms/core/dist/core/Hacks","@web-atoms/core/dist/web/core/AtomUI","@web-atoms/core/dist/core/InheritedProperty","@web-atoms/core/dist/core/PropertyMap","@web-atoms/core/dist/core/BindableProperty","@web-atoms/core/dist/core/Command","@web-atoms/core/dist/core/EventScope","@web-atoms/date-time/dist/DateTime","@web-atoms/date-time/dist/TimeSpan","@web-atoms/core/dist/core/Route","@web-atoms/core/dist/core/StringHelper","@web-atoms/core/dist/core/FormattedString","@web-atoms/core/dist/core/WebImage","@web-atoms/core/dist/web/styles/AtomStyle","@web-atoms/core/dist/web/styles/AtomStyleSheet","@web-atoms/web-controls/dist/player/AtomVideoPlayer","@web-atoms/core/dist/web/WebApp","@web-atoms/core/dist/core/AtomOnce","@web-atoms/core/dist/core/AtomUri","@web-atoms/core/dist/services/NavigationService","@web-atoms/core/dist/services/ReferenceService","@web-atoms/core/dist/di/DISingleton","@web-atoms/core/dist/web/services/WebBusyIndicatorService","@web-atoms/core/dist/web/styles/StyleBuilder","@web-atoms/core/dist/web/services/WindowService","@web-atoms/core/dist/Atom","@web-atoms/core/dist/core/AtomLoader","@web-atoms/core/dist/services/JsonService","@web-atoms/core/dist/core/FormattedError","@web-atoms/core/dist/view-model/AtomWindowViewModel","@web-atoms/core/dist/view-model/AtomViewModel","@web-atoms/core/dist/view-model/baseTypes","@web-atoms/core/dist/web/controls/AtomAlertWindow","@web-atoms/core/dist/web/styles/AtomAlertWindowStyle","@web-atoms/core/dist/core/Colors","@web-atoms/core/dist/web/styles/AtomWindowStyle","@web-atoms/core/src/web/images/close-button-hover.svg","@web-atoms/core/dist/web/controls/AtomWindow","@web-atoms/core/dist/web/controls/AtomTemplate","@web-atoms/core/dist/web/controls/AtomNotification","@web-atoms/core/dist/web/styles/AtomNotificationStyle","@web-atoms/core/dist/web/styles/AtomPopupStyle","@web-atoms/core/dist/web/services/NotificationPopup","@web-atoms/core/dist/web/services/PopupService","@web-atoms/core/dist/web/services/PopupWindow","@web-atoms/core/dist/core/sleep","@web-atoms/core/dist/web/styles/AtomTheme"]);
1980
-
1981
- System.register([], function (_export, _context) {
1982
- "use strict";
1983
-
1984
- var viewModelParseWatchCache, viewModelParseWatchCache2;
1985
- function trimRegEx(t, r) {
1986
- const m = r.exec(t);
1987
- if (m && m.length) {
1988
- return [true, t.substring(m[0].length).trim(), m[0]];
1989
- }
1990
- return [false, t, ""];
1991
- }
1992
- function extractTill(text, search, returnOriginal = false) {
1993
- const index = text.indexOf(search);
1994
- if (index <= 0) {
1995
- return returnOriginal ? text : "";
1996
- }
1997
- return text.substring(0, index);
1998
- }
1999
- function parsePath(f, parseThis) {
2000
- let str = f.toString().trim();
2001
- str = str.split("\n").filter(s => !/^\/\//.test(s.trim())).join("\n");
2002
- const key = (parseThis === undefined ? "un:" : parseThis ? "_this:" : "_noThis:") + str;
2003
- const px1 = viewModelParseWatchCache[key];
2004
- if (px1) {
2005
- return px1;
2006
- }
2007
- if (str.endsWith("}")) {
2008
- str = str.substr(0, str.length - 1);
2009
- }
2010
- const functionRegEx = /^\w+\s*\(/;
2011
- const lambdaRegEx = /^\(?(\w+)?(\s?\,\s?\w+)*\)?\s?\=\>/;
2012
- let arg = "";
2013
- const original = str;
2014
- let [success, remaining] = trimRegEx(str, functionRegEx);
2015
- if (success) {
2016
- str = remaining;
2017
- remaining = extractTill(remaining, ")");
2018
- str = str.substring(remaining.length);
2019
- arg = extractTill(remaining, ",", true);
2020
- } else {
2021
- [success, str, remaining] = trimRegEx(str, lambdaRegEx);
2022
- if (success) {
2023
- remaining = remaining.trim();
2024
- remaining = remaining.substring(0, remaining.length - 2);
2025
- remaining = extractTill(remaining, ")", true);
2026
- arg = extractTill(remaining, ",", true);
2027
- if (arg.startsWith("(")) {
2028
- arg = arg.substring(1);
2029
- }
2030
- } else {
2031
- if (parseThis !== undefined && parseThis === false) {
2032
- return [];
2033
- } else {
2034
- parseThis = true;
2035
- }
2036
- }
2037
- }
2038
- str = str.trim();
2039
- const isThis = parseThis === undefined ? (arg ? false : true) || parseThis : parseThis;
2040
- const p = (isThis ? "(\\_this|this)" : arg || "").trim();
2041
- if (p.length === 0) {
2042
- const empty = [];
2043
- viewModelParseWatchCache[key] = empty;
2044
- return empty;
2045
- }
2046
- const regExp = `(?:(\\b${p})(?:(\\.[a-zA-Z_][a-zA-Z_0-9]*)+)\\s?(?:(\\(|\\=\\=\\=|\\=\\=|\\=)?))`;
2047
- const re = new RegExp(regExp, "gi");
2048
- let path = [];
2049
- const ms = str.replace(re, m => {
2050
- let px = m;
2051
- if (px.startsWith("this.")) {
2052
- if (parseThis !== true) {
2053
- px = px.substr(5);
2054
- }
2055
- } else if (px.startsWith("_this.")) {
2056
- if (parseThis !== true) {
2057
- px = px.substr(6);
2058
- } else {
2059
- px = px.substr(1);
2060
- }
2061
- } else {
2062
- px = px.substr(p.length + 1);
2063
- }
2064
- px = px.split(".").filter(s => !s.endsWith("(")).join(".");
2065
- if (!path.find(y => y === px)) {
2066
- path.push(px);
2067
- }
2068
- const filtered = [];
2069
- for (const iterator of path) {
2070
- if (iterator.endsWith("==") || !(iterator.endsWith("(") || iterator.endsWith("="))) {
2071
- filtered.push((iterator.endsWith("===") ? iterator.substr(0, iterator.length - 3) : iterator.endsWith("==") ? iterator.substr(0, iterator.length - 2) : iterator).trim());
2072
- }
2073
- }
2074
- path = filtered.filter(px11 => {
2075
- const search = px11 + ".";
2076
- for (const iterator of filtered) {
2077
- if (px11 !== iterator && iterator.indexOf(search) !== -1) {
2078
- return false;
2079
- }
2080
- }
2081
- return true;
2082
- });
2083
- return m;
2084
- });
2085
- path = path.sort((a, b) => b.localeCompare(a));
2086
- const duplicates = path;
2087
- path = [];
2088
- for (const iterator of duplicates) {
2089
- if (path.find(px2 => px2 === iterator)) {
2090
- continue;
2091
- }
2092
- path.push(iterator);
2093
- }
2094
- const rp = [];
2095
- for (const rpItem of path) {
2096
- if (rp.find(x => x.startsWith(rpItem))) {
2097
- continue;
2098
- }
2099
- rp.push(rpItem);
2100
- }
2101
- const pl = path.filter(p1 => p1).map(p1 => p1.split("."));
2102
- viewModelParseWatchCache[key] = pl;
2103
- return pl;
2104
- }
2105
- function parsePathLists(f) {
2106
- const str = f.toString().trim();
2107
- const key = str;
2108
- const px1 = viewModelParseWatchCache2[key];
2109
- if (px1) {
2110
- return px1;
2111
- }
2112
- const pl = {
2113
- pathList: parsePath(str, false),
2114
- thisPath: parsePath(str, true),
2115
- combined: []
2116
- };
2117
- if (pl.thisPath.length && pl.pathList.length) {
2118
- pl.combined = pl.thisPath.map(x => {
2119
- x[0] = "t";
2120
- x.splice(0, 0, "this");
2121
- return x;
2122
- }).concat(pl.pathList.map(x => {
2123
- x.splice(0, 0, "this", "x");
2124
- return x;
2125
- }));
2126
- pl.thisPath = [];
2127
- pl.pathList = [];
2128
- }
2129
- viewModelParseWatchCache2[key] = pl;
2130
- return pl;
2131
- }
2132
- _export({
2133
- parsePath: parsePath,
2134
- parsePathLists: parsePathLists
2135
- });
2136
- return {
2137
- setters: [],
2138
- execute: function () {
2139
- viewModelParseWatchCache = {};
2140
- viewModelParseWatchCache2 = {};
2141
- }
2142
- };
2143
- });
2144
- //# sourceMappingURL=ExpressionParser.js.map
2145
-
2146
- AmdLoader.instance.setup("@web-atoms/core/dist/core/ExpressionParser");
1978
+ ["@social-mail/social-mail-client","@web-atoms/core","reflect-metadata","@web-atoms/data-styles","@web-atoms/date-time","@web-atoms/web-controls"],
1979
+ ["@social-mail/social-mail-client/dist/public/preview/video/PreviewVideo","@social-mail/social-mail-client/dist/style/GlobalStyle","@web-atoms/core/dist/core/types","reflect-metadata","@web-atoms/core/dist/core/AtomMap","@web-atoms/core/dist/core/AtomList","@web-atoms/core/dist/core/AtomBinder","@social-mail/social-mail-client/dist/style/OverrideAppStyle","@web-atoms/core/dist/style/styled","@web-atoms/data-styles/data-styles","@web-atoms/core/dist/core/XNode","@web-atoms/core/dist/core/Bind","@web-atoms/core/dist/core/ExpressionParser","@web-atoms/core/dist/Pack","@web-atoms/core/dist/web/controls/AtomControl","@web-atoms/core/dist/core/AtomComponent","@web-atoms/core/dist/App","@web-atoms/core/dist/core/AtomDispatcher","@web-atoms/core/dist/di/RegisterSingleton","@web-atoms/core/dist/di/Register","@web-atoms/core/dist/di/ServiceCollection","@web-atoms/core/dist/di/TypeKey","@web-atoms/core/dist/di/ServiceProvider","@web-atoms/core/dist/core/TransientDisposable","@web-atoms/core/dist/di/Inject","@web-atoms/core/dist/services/BusyIndicatorService","@web-atoms/core/dist/core/AtomDisposableList","@web-atoms/core/dist/core/AtomWatcher","@web-atoms/core/dist/core/Hacks","@web-atoms/core/dist/web/core/AtomUI","@web-atoms/core/dist/core/InheritedProperty","@web-atoms/core/dist/core/PropertyMap","@web-atoms/core/dist/core/BindableProperty","@web-atoms/core/dist/core/Command","@web-atoms/core/dist/core/EventScope","@web-atoms/date-time/dist/DateTime","@web-atoms/date-time/dist/TimeSpan","@web-atoms/core/dist/core/Route","@web-atoms/core/dist/core/StringHelper","@web-atoms/core/dist/core/FormattedString","@web-atoms/core/dist/core/WebImage","@web-atoms/core/dist/web/styles/AtomStyle","@web-atoms/core/dist/web/styles/AtomStyleSheet","@web-atoms/web-controls/dist/player/AtomVideoPlayer","@web-atoms/core/dist/web/WebApp","@web-atoms/core/dist/core/AtomOnce","@web-atoms/core/dist/core/AtomUri","@web-atoms/core/dist/services/NavigationService","@web-atoms/core/dist/services/ReferenceService","@web-atoms/core/dist/di/DISingleton","@web-atoms/core/dist/web/services/WebBusyIndicatorService","@web-atoms/core/dist/web/styles/StyleBuilder","@web-atoms/core/dist/web/services/WindowService","@web-atoms/core/dist/Atom","@web-atoms/core/dist/core/AtomLoader","@web-atoms/core/dist/services/JsonService","@web-atoms/core/dist/core/FormattedError","@web-atoms/core/dist/view-model/AtomWindowViewModel","@web-atoms/core/dist/view-model/AtomViewModel","@web-atoms/core/dist/view-model/baseTypes","@web-atoms/core/dist/web/controls/AtomAlertWindow","@web-atoms/core/dist/web/styles/AtomAlertWindowStyle","@web-atoms/core/dist/core/Colors","@web-atoms/core/dist/web/styles/AtomWindowStyle","@web-atoms/core/src/web/images/close-button-hover.svg","@web-atoms/core/dist/web/controls/AtomWindow","@web-atoms/core/dist/web/controls/AtomTemplate","@web-atoms/core/dist/web/controls/AtomNotification","@web-atoms/core/dist/web/styles/AtomNotificationStyle","@web-atoms/core/dist/web/styles/AtomPopupStyle","@web-atoms/core/dist/web/services/NotificationPopup","@web-atoms/core/dist/web/services/PopupService","@web-atoms/core/dist/web/services/PopupWindow","@web-atoms/core/dist/core/sleep","@web-atoms/core/dist/web/styles/AtomTheme"]);
2147
1980
 
2148
1981
  /*! *****************************************************************************
2149
1982
  Copyright (C) Microsoft. All rights reserved.
@@ -3447,570 +3280,517 @@ System.register(["reflect-metadata", "./AtomMap"], function (_export, _context)
3447
3280
 
3448
3281
  AmdLoader.instance.setup("@web-atoms/core/dist/core/types");
3449
3282
 
3450
- System.register(["tslib", "./ExpressionParser", "./types"], function (_export, _context) {
3283
+ System.register(["./types"], function (_export, _context) {
3451
3284
  "use strict";
3452
3285
 
3453
- var __awaiter, parsePath, parsePathLists, CancelToken, ignoreValue, Bind, isEvent, bindSymbol;
3454
- function twoWaysConvert(name, b, control, e, creator) {
3455
- control.bind(e, name, b.thisPathList || b.pathList, b.eventList || true, null, b.thisPathList ? creator : undefined);
3456
- }
3457
- _export("default", void 0);
3286
+ var ArrayHelper, AtomBinder, symbolHandlers, symbolBindable;
3287
+ _export("AtomBinder", void 0);
3458
3288
  return {
3459
- setters: [function (_tslib) {
3460
- __awaiter = _tslib.__awaiter;
3461
- }, function (_ExpressionParser) {
3462
- parsePath = _ExpressionParser.parsePath;
3463
- parsePathLists = _ExpressionParser.parsePathLists;
3464
- }, function (_types) {
3465
- CancelToken = _types.CancelToken;
3466
- ignoreValue = _types.ignoreValue;
3289
+ setters: [function (_types) {
3290
+ ArrayHelper = _types.ArrayHelper;
3467
3291
  }],
3468
3292
  execute: function () {
3469
- isEvent = /^event/i;
3470
- _export("bindSymbol", bindSymbol = Symbol("Bind"));
3471
- _export("default", Bind = class Bind {
3472
- static forControl() {
3473
- return Bind;
3474
- }
3475
- static forData() {
3476
- return Bind;
3477
- }
3478
- static forViewModel() {
3479
- return Bind;
3480
- }
3481
- static forLocalViewModel() {
3482
- return Bind;
3293
+ _export("symbolHandlers", symbolHandlers = Symbol.for("handlers"));
3294
+ _export("symbolBindable", symbolBindable = Symbol.for("bindable"));
3295
+ _export("AtomBinder", AtomBinder = class AtomBinder {
3296
+ static refreshValue(target, key) {
3297
+ const handlers = AtomBinder.get_WatchHandler(target, key);
3298
+ if (handlers === undefined || handlers == null) {
3299
+ return;
3300
+ }
3301
+ for (const item of handlers) {
3302
+ item(target, key);
3303
+ }
3304
+ if (target.onPropertyChanged) {
3305
+ target.onPropertyChanged(key);
3306
+ }
3483
3307
  }
3484
- static presenter(name) {
3485
- return {
3486
- [bindSymbol](cn, control, e, creator) {
3487
- if (typeof name === "function") {
3488
- name(control);
3308
+ static add_WatchHandler(target, key, handler) {
3309
+ if (target == null) {
3310
+ return;
3311
+ }
3312
+ const handlers = AtomBinder.get_WatchHandler(target, key);
3313
+ handlers.push(handler);
3314
+ if (Array.isArray(target)) {
3315
+ return;
3316
+ }
3317
+ const pv = AtomBinder.getPropertyDescriptor(target, key);
3318
+ if (pv && pv.get) {
3319
+ return;
3320
+ }
3321
+ const tw = target;
3322
+ let bindables = tw[symbolBindable];
3323
+ if (bindables === undefined) {
3324
+ bindables = {};
3325
+ Object.defineProperty(tw, symbolBindable, {
3326
+ value: bindables,
3327
+ enumerable: false,
3328
+ writable: true,
3329
+ configurable: true
3330
+ });
3331
+ }
3332
+ if (!bindables[key]) {
3333
+ bindables[key] = 1;
3334
+ const o = target[key];
3335
+ const nk = Symbol.for(key);
3336
+ target[nk] = o;
3337
+ const set = function (v) {
3338
+ const ov = this[nk];
3339
+ if (ov === undefined ? ov === v : ov == v) {
3489
3340
  return;
3490
3341
  }
3491
- const n = name || cn;
3492
- let c = control.element;
3493
- while (c) {
3494
- if (c.atomControl && c.atomControl[n] !== undefined) {
3495
- break;
3496
- }
3497
- c = c._logicalParent || c.parentElement;
3498
- }
3499
- (c && c.atomControl || control)[n] = e;
3342
+ this[nk] = v;
3343
+ AtomBinder.refreshValue(this, key);
3344
+ };
3345
+ const get = function () {
3346
+ return this[nk];
3347
+ };
3348
+ if (pv) {
3349
+ delete target[key];
3350
+ Object.defineProperty(target, key, {
3351
+ get,
3352
+ set,
3353
+ configurable: true,
3354
+ enumerable: true
3355
+ });
3356
+ } else {
3357
+ Object.defineProperty(target, key, {
3358
+ get,
3359
+ set,
3360
+ enumerable: true,
3361
+ configurable: true
3362
+ });
3500
3363
  }
3501
- };
3364
+ }
3502
3365
  }
3503
- static event(sourcePath) {
3504
- return {
3505
- [bindSymbol](name, control, e) {
3506
- control.runAfterInit(() => {
3507
- if (isEvent.test(name)) {
3508
- name = name.substring(5);
3509
- if (name.startsWith("-")) {
3510
- name = name.substring(1).replace(/-([a-z])/g, g => g[1].toUpperCase());
3511
- } else {
3512
- name = name[0].toLowerCase() + name.substring(1);
3513
- }
3514
- }
3515
- control.bindEvent(e, name, e1 => {
3516
- return sourcePath(control, e1);
3517
- });
3518
- });
3366
+ static getPropertyDescriptor(target, key) {
3367
+ const pv = Object.getOwnPropertyDescriptor(target, key);
3368
+ if (!pv) {
3369
+ const pt = Object.getPrototypeOf(target);
3370
+ if (pt) {
3371
+ return AtomBinder.getPropertyDescriptor(pt, key);
3519
3372
  }
3520
- };
3373
+ }
3374
+ return pv;
3521
3375
  }
3522
- static oneTime(sourcePath, now) {
3376
+ static get_WatchHandler(target, key) {
3377
+ if (target == null) {
3378
+ return null;
3379
+ }
3380
+ let handlers = target[symbolHandlers];
3381
+ if (handlers === undefined) {
3382
+ handlers = {};
3383
+ Object.defineProperty(target, symbolHandlers, {
3384
+ value: handlers,
3385
+ enumerable: false,
3386
+ writable: true,
3387
+ configurable: true
3388
+ });
3389
+ }
3390
+ let handlersForKey = handlers[key];
3391
+ if (handlersForKey === undefined || handlersForKey == null) {
3392
+ handlersForKey = [];
3393
+ handlers[key] = handlersForKey;
3394
+ }
3395
+ return handlersForKey;
3396
+ }
3397
+ static remove_WatchHandler(target, key, handler) {
3398
+ if (target == null) {
3399
+ return;
3400
+ }
3401
+ const handlers = target[symbolHandlers];
3402
+ if (typeof handlers === "undefined") {
3403
+ return;
3404
+ }
3405
+ const handlersForKey = target[symbolHandlers][key];
3406
+ if (handlersForKey === undefined || handlersForKey == null) {
3407
+ return;
3408
+ }
3409
+ ArrayHelper.remove(handlersForKey, f => f === handler);
3410
+ if (!handlersForKey.length) {
3411
+ handlers[key] = null;
3412
+ delete handlers[key];
3413
+ }
3414
+ }
3415
+ static invokeItemsEvent(target, mode, index, item, oldItem) {
3416
+ const key = "_items";
3417
+ const handlers = AtomBinder.get_WatchHandler(target, key);
3418
+ if (!handlers) {
3419
+ return;
3420
+ }
3421
+ for (const obj of handlers) {
3422
+ obj(target, mode, index, item, oldItem);
3423
+ }
3424
+ AtomBinder.refreshValue(target, "length");
3425
+ }
3426
+ static refreshItems(ary) {
3427
+ AtomBinder.invokeItemsEvent(ary, "refresh", -1, null);
3428
+ }
3429
+ static add_CollectionChanged(target, handler) {
3430
+ if (target == null) {
3431
+ throw new Error("Target Array to watch cannot be null");
3432
+ }
3433
+ if (handler == null) {
3434
+ throw new Error("Target handle to watch an Array cannot be null");
3435
+ }
3436
+ const handlers = AtomBinder.get_WatchHandler(target, "_items");
3437
+ handlers.push(handler);
3523
3438
  return {
3524
- [bindSymbol](name, control, e) {
3525
- control.runAfterInit(() => {
3526
- control.setLocalValue(e, name, sourcePath(control, e));
3527
- });
3528
- if (typeof now !== "undefined") {
3529
- control.setLocalValue(e, name, now);
3530
- }
3439
+ dispose: () => {
3440
+ AtomBinder.remove_CollectionChanged(target, handler);
3531
3441
  }
3532
3442
  };
3533
3443
  }
3534
- static oneTimeAsync(sourcePath, now) {
3444
+ static remove_CollectionChanged(t, handler) {
3445
+ if (t == null) {
3446
+ return;
3447
+ }
3448
+ const target = t;
3449
+ const handlers = target[symbolHandlers];
3450
+ if (typeof handlers === "undefined") {
3451
+ return;
3452
+ }
3453
+ const key = "_items";
3454
+ const handlersForKey = handlers[key];
3455
+ if (handlersForKey === undefined || handlersForKey == null) {
3456
+ return;
3457
+ }
3458
+ ArrayHelper.remove(handlersForKey, f => f === handler);
3459
+ if (!handlersForKey.length) {
3460
+ handlers[key] = null;
3461
+ delete handlers[key];
3462
+ }
3463
+ }
3464
+ static watch(item, property, f) {
3465
+ AtomBinder.add_WatchHandler(item, property, f);
3535
3466
  return {
3536
- [bindSymbol](name, control, e) {
3537
- control.runAfterInit(() => {
3538
- control.app.runAsync(() => __awaiter(this, void 0, void 0, function* () {
3539
- const value = yield sourcePath(control, e, new CancelToken());
3540
- control.setLocalValue(e, name, value);
3541
- }));
3542
- });
3543
- if (typeof now !== "undefined") {
3544
- control.setLocalValue(e, name, now);
3545
- }
3467
+ dispose: () => {
3468
+ AtomBinder.remove_WatchHandler(item, property, f);
3546
3469
  }
3547
3470
  };
3548
3471
  }
3549
- static source(source, path, now) {
3550
- const lists = parsePath(path, false).map(x => ["this", ...x]);
3551
- return {
3552
- [bindSymbol](name, control, e, creator) {
3553
- const self = {
3554
- control,
3555
- source
3556
- };
3557
- control.bind(e, name, lists, false, () => {
3558
- return path.call(self, self);
3559
- }, self);
3560
- if (typeof now !== "undefined") {
3561
- control.setLocalValue(e, name, now);
3562
- }
3472
+ static clear(a) {
3473
+ a.length = 0;
3474
+ this.invokeItemsEvent(a, "refresh", -1, null);
3475
+ AtomBinder.refreshValue(a, "length");
3476
+ }
3477
+ static addItem(a, item) {
3478
+ const index = a.length;
3479
+ a.push(item);
3480
+ this.invokeItemsEvent(a, "add", index, item);
3481
+ AtomBinder.refreshValue(a, "length");
3482
+ }
3483
+ static removeItem(a, item) {
3484
+ const i = a.findIndex(x => x === item);
3485
+ if (i === -1) {
3486
+ return false;
3487
+ }
3488
+ a.splice(i, 1);
3489
+ AtomBinder.invokeItemsEvent(a, "remove", i, item);
3490
+ AtomBinder.refreshValue(a, "length");
3491
+ return true;
3492
+ }
3493
+ });
3494
+ }
3495
+ };
3496
+ });
3497
+ //# sourceMappingURL=AtomBinder.js.map
3498
+
3499
+ AmdLoader.instance.setup("@web-atoms/core/dist/core/AtomBinder");
3500
+
3501
+ System.register(["./AtomBinder"], function (_export, _context) {
3502
+ "use strict";
3503
+
3504
+ var AtomBinder, AtomList, ap;
3505
+ _export("AtomList", void 0);
3506
+ return {
3507
+ setters: [function (_AtomBinder) {
3508
+ AtomBinder = _AtomBinder.AtomBinder;
3509
+ }],
3510
+ execute: function () {
3511
+ _export("AtomList", AtomList = class AtomList extends Array {
3512
+ constructor() {
3513
+ super();
3514
+ this.startValue = 0;
3515
+ this.totalValue = 0;
3516
+ this.sizeValue = 10;
3517
+ this["__proto__"] = AtomList.prototype;
3518
+ this.next = () => {
3519
+ this.start = this.start + this.size;
3520
+ };
3521
+ this.prev = () => {
3522
+ if (this.start >= this.size) {
3523
+ this.start = this.start - this.size;
3563
3524
  }
3564
3525
  };
3565
3526
  }
3566
- static oneWayAsync(sourcePath, {
3567
- watchDelayInMS = 250,
3568
- default: defaultValue
3569
- } = {}) {
3570
- let pathList;
3571
- let combined;
3572
- let thisPathList;
3573
- if (Array.isArray(sourcePath)) {
3574
- pathList = sourcePath;
3575
- } else {
3576
- const lists = parsePathLists(sourcePath);
3577
- if (lists.combined.length) {
3578
- combined = lists.combined;
3579
- }
3580
- if (lists.pathList.length) {
3581
- pathList = lists.pathList;
3582
- }
3583
- if (lists.thisPath.length) {
3584
- thisPathList = lists.thisPath;
3527
+ get start() {
3528
+ return this.startValue;
3529
+ }
3530
+ set start(v) {
3531
+ if (v === this.startValue) {
3532
+ return;
3533
+ }
3534
+ this.startValue = v;
3535
+ AtomBinder.refreshValue(this, "start");
3536
+ }
3537
+ get total() {
3538
+ return this.totalValue;
3539
+ }
3540
+ set total(v) {
3541
+ if (v === this.totalValue) {
3542
+ return;
3543
+ }
3544
+ this.totalValue = v;
3545
+ AtomBinder.refreshValue(this, "total");
3546
+ }
3547
+ get size() {
3548
+ return this.sizeValue;
3549
+ }
3550
+ set size(v) {
3551
+ if (v === this.sizeValue) {
3552
+ return;
3553
+ }
3554
+ this.sizeValue = v;
3555
+ AtomBinder.refreshValue(this, "size");
3556
+ }
3557
+ add(item) {
3558
+ const i = this.length;
3559
+ const n = this.push(item);
3560
+ AtomBinder.invokeItemsEvent(this, "add", i, item);
3561
+ AtomBinder.refreshValue(this, "length");
3562
+ return n;
3563
+ }
3564
+ addAll(items) {
3565
+ for (const item of items) {
3566
+ const i = this.length;
3567
+ this.push(item);
3568
+ AtomBinder.invokeItemsEvent(this, "add", i, item);
3569
+ AtomBinder.refreshValue(this, "length");
3570
+ }
3571
+ const t = items["total"];
3572
+ if (t) {
3573
+ this.total = t;
3574
+ }
3575
+ }
3576
+ replace(items, start, size) {
3577
+ this.length = items.length;
3578
+ for (let i = 0; i < items.length; i++) {
3579
+ this[i] = items[i];
3580
+ }
3581
+ this.refresh();
3582
+ const t = items["total"];
3583
+ if (t) {
3584
+ this.total = t;
3585
+ }
3586
+ if (start !== undefined) {
3587
+ this.start = start;
3588
+ }
3589
+ if (size !== undefined) {
3590
+ this.size = size;
3591
+ }
3592
+ }
3593
+ insert(i, item) {
3594
+ const n = this.splice(i, 0, item);
3595
+ AtomBinder.invokeItemsEvent(this, "add", i, item);
3596
+ AtomBinder.refreshValue(this, "length");
3597
+ }
3598
+ set(i, item) {
3599
+ const old = this[i];
3600
+ this[i] = item;
3601
+ AtomBinder.invokeItemsEvent(this, "replace", i, item, old);
3602
+ AtomBinder.refreshValue(this, "length");
3603
+ }
3604
+ removeAt(i) {
3605
+ const item = this[i];
3606
+ this.splice(i, 1);
3607
+ AtomBinder.invokeItemsEvent(this, "remove", i, item);
3608
+ AtomBinder.refreshValue(this, "length");
3609
+ return item;
3610
+ }
3611
+ remove(item) {
3612
+ if (item instanceof Function) {
3613
+ let removed = false;
3614
+ for (let index = 0; index < this.length;) {
3615
+ const it = this[index];
3616
+ if (item(it)) {
3617
+ this.splice(index, 1);
3618
+ AtomBinder.invokeItemsEvent(this, "remove", index, it);
3619
+ AtomBinder.refreshValue(this, "length");
3620
+ removed = true;
3621
+ continue;
3622
+ }
3623
+ index++;
3585
3624
  }
3625
+ return removed;
3586
3626
  }
3587
- if (!(combined || pathList || thisPathList)) {
3588
- throw new Error(`Failed to setup binding for ${sourcePath}, parsing failed`);
3627
+ const n = this.indexOf(item);
3628
+ if (n !== -1) {
3629
+ this.removeAt(n);
3630
+ return true;
3589
3631
  }
3590
- return {
3591
- [bindSymbol](name, control, e, creator) {
3592
- let bindingSource;
3593
- let finalPathList = pathList;
3594
- if (combined) {
3595
- bindingSource = {
3596
- t: creator,
3597
- x: control
3598
- };
3599
- finalPathList = combined;
3600
- } else if (thisPathList) {
3601
- finalPathList = thisPathList;
3602
- bindingSource = creator;
3603
- }
3604
- const asyncState = {
3605
- token: 0,
3606
- cancelToken: undefined
3607
- };
3608
- control.bind(e, name, finalPathList, false, () => {
3609
- var _a;
3610
- const app = control.app;
3611
- (_a = asyncState.cancelToken) === null || _a === void 0 ? void 0 : _a.cancel();
3612
- asyncState.cancelToken = undefined;
3613
- asyncState.token = app.setTimeoutAsync(() => __awaiter(this, void 0, void 0, function* () {
3614
- var _b, _c;
3615
- if ((_b = asyncState.cancelToken) === null || _b === void 0 ? void 0 : _b.cancelled) {
3616
- return;
3617
- }
3618
- asyncState.token = undefined;
3619
- (_c = asyncState.cancelToken) === null || _c === void 0 ? void 0 : _c.cancel();
3620
- const ct = asyncState.cancelToken = new CancelToken();
3621
- const value = yield sourcePath.call(creator, control, e, ct);
3622
- if (!ct.cancelled) {
3623
- control.setLocalValue(e, name, value);
3624
- }
3625
- }), watchDelayInMS, asyncState.token);
3626
- return ignoreValue;
3627
- }, bindingSource);
3628
- if (typeof defaultValue !== "undefined") {
3629
- control.setLocalValue(e, name, defaultValue);
3630
- }
3631
- }
3632
- };
3632
+ return false;
3633
3633
  }
3634
- static oneWay(sourcePath, now) {
3635
- let pathList;
3636
- let combined;
3637
- let thisPathList;
3638
- if (Array.isArray(sourcePath)) {
3639
- pathList = sourcePath;
3640
- } else {
3641
- const lists = parsePathLists(sourcePath);
3642
- if (lists.combined.length) {
3643
- combined = lists.combined;
3644
- }
3645
- if (lists.pathList.length) {
3646
- pathList = lists.pathList;
3647
- }
3648
- if (lists.thisPath.length) {
3649
- thisPathList = lists.thisPath;
3650
- }
3651
- }
3652
- if (!(combined || pathList || thisPathList)) {
3653
- throw new Error(`Failed to setup binding for ${sourcePath}, parsing failed`);
3654
- }
3655
- return {
3656
- [bindSymbol](name, control, e, creator) {
3657
- if (pathList) {
3658
- control.bind(e, name, pathList, false, () => {
3659
- return sourcePath.call(creator, control, e);
3660
- });
3661
- if (typeof now !== "undefined") {
3662
- control.setLocalValue(e, name, now);
3663
- }
3664
- return;
3665
- }
3666
- if (combined) {
3667
- const a = {
3668
- t: creator,
3669
- x: control
3670
- };
3671
- control.bind(e, name, combined, false, () => {
3672
- return sourcePath.call(creator, control, e);
3673
- }, a);
3674
- if (typeof now !== "undefined") {
3675
- control.setLocalValue(e, name, now);
3676
- }
3677
- return;
3678
- }
3679
- control.bind(e, name, thisPathList, false, () => {
3680
- return sourcePath.call(creator, control, e);
3681
- }, creator);
3682
- if (typeof now !== "undefined") {
3683
- control.setLocalValue(e, name, now);
3684
- }
3685
- }
3686
- };
3634
+ clear() {
3635
+ this.length = 0;
3636
+ this.refresh();
3687
3637
  }
3688
- static twoWays(sourcePath, events, converter) {
3689
- let pathList;
3690
- let thisPathList;
3691
- if (Array.isArray(sourcePath)) {
3692
- pathList = sourcePath;
3693
- } else {
3694
- const lists = parsePathLists(sourcePath);
3695
- if (lists.combined.length) {
3696
- throw new Error("Cannot have combined binding for two ways");
3697
- }
3698
- if (lists.pathList.length) {
3699
- pathList = lists.pathList;
3700
- }
3701
- if (lists.thisPath.length) {
3702
- thisPathList = lists.thisPath;
3703
- }
3704
- }
3705
- if (!(thisPathList || pathList)) {
3706
- throw new Error(`Failed to setup twoWay binding on ${sourcePath}`);
3638
+ refresh() {
3639
+ AtomBinder.invokeItemsEvent(this, "refresh", -1, null);
3640
+ AtomBinder.refreshValue(this, "length");
3641
+ }
3642
+ watch(f, wrap) {
3643
+ if (wrap) {
3644
+ const fx = f;
3645
+ f = function () {
3646
+ const p = [];
3647
+ for (let i = 0; i < arguments.length; i++) {
3648
+ const iterator = arguments[i];
3649
+ p.push(iterator);
3650
+ }
3651
+ return fx.call(this, p);
3652
+ };
3707
3653
  }
3708
- return {
3709
- [bindSymbol](name, control, e, creator) {
3710
- control.bind(e, name, thisPathList || pathList, events || true, converter, thisPathList ? creator : undefined);
3711
- }
3712
- };
3654
+ return AtomBinder.add_CollectionChanged(this, f);
3713
3655
  }
3714
- static sourceTwoWays(source, path, events = ["input", "cut", "paste", "change"]) {
3715
- const lists = parsePath(path, false).map(x => ["this", ...x]);
3716
- return {
3717
- [bindSymbol](name, control, e, creator) {
3718
- const self = {
3719
- control,
3720
- source
3721
- };
3722
- control.bind(e, name, lists, events, lists, self);
3656
+ count(f) {
3657
+ let total = 0;
3658
+ for (const iterator of this) {
3659
+ if (f(iterator)) {
3660
+ total++;
3723
3661
  }
3724
- };
3725
- }
3726
- static twoWaysImmediate(sourcePath, converter) {
3727
- return this.twoWays(sourcePath, ["change", "input", "paste", "cut"], converter);
3662
+ }
3663
+ return total;
3728
3664
  }
3729
- constructor(setupFunction, sourcePath, name, eventList) {
3730
- this.setupFunction = setupFunction;
3731
- this.name = name;
3732
- this.eventList = eventList;
3733
- this.sourcePath = sourcePath;
3734
- this[bindSymbol] = true;
3735
- if (!this.sourcePath) {
3736
- return;
3665
+ avg(f) {
3666
+ if (!this.length) {
3667
+ return 0;
3737
3668
  }
3738
- if (Array.isArray(this.sourcePath)) {
3739
- this.pathList = this.sourcePath;
3740
- } else {
3741
- const lists = parsePathLists(this.sourcePath);
3742
- if (lists.combined.length) {
3743
- this.combined = lists.combined;
3744
- }
3745
- if (lists.pathList.length) {
3746
- this.pathList = lists.pathList;
3747
- }
3748
- if (lists.thisPath.length) {
3749
- this.thisPathList = lists.thisPath;
3750
- }
3669
+ let sum = 0;
3670
+ for (const iterator of this) {
3671
+ sum += f(iterator);
3751
3672
  }
3673
+ return sum / this.length;
3674
+ }
3675
+ includes(item) {
3676
+ return this.indexOf(item) !== -1;
3752
3677
  }
3753
3678
  });
3679
+ ap = Array.prototype;
3680
+ for (const key of Object.getOwnPropertyNames(AtomList.prototype)) {
3681
+ const {
3682
+ value
3683
+ } = Object.getOwnPropertyDescriptor(AtomList.prototype, key);
3684
+ switch (key) {
3685
+ case "add":
3686
+ case "addAll":
3687
+ case "clear":
3688
+ case "refresh":
3689
+ case "set":
3690
+ case "remove":
3691
+ case "removeAt":
3692
+ case "watch":
3693
+ case "replace":
3694
+ case "insert":
3695
+ case "count":
3696
+ case "avg":
3697
+ case "includes":
3698
+ if (key in ap) {
3699
+ continue;
3700
+ }
3701
+ Object.defineProperty(ap, key, {
3702
+ enumerable: false,
3703
+ value,
3704
+ configurable: true,
3705
+ writable: true
3706
+ });
3707
+ continue;
3708
+ }
3709
+ }
3754
3710
  }
3755
3711
  };
3756
3712
  });
3757
- //# sourceMappingURL=Bind.js.map
3713
+ //# sourceMappingURL=AtomList.js.map
3758
3714
 
3759
- AmdLoader.instance.setup("@web-atoms/core/dist/core/Bind");
3715
+ AmdLoader.instance.setup("@web-atoms/core/dist/core/AtomList");
3760
3716
 
3761
- System.register(["./Bind"], function (_export, _context) {
3717
+ System.register([], function (_export, _context) {
3762
3718
  "use strict";
3763
3719
 
3764
- var bindSymbol, RootObject, XNode, xnodeSymbol, isControl, elementFactorySymbol, isFactorySymbol, attachedSymbol, isTemplateSymbol, constructorNeedsArgumentsSymbol, attachedProperties, attachedId, attach;
3765
- _export({
3766
- RootObject: void 0,
3767
- default: void 0
3768
- });
3720
+ var StyleFragment, id, nextId, first, addMarker, globalLow, global, globalHigh, localLow, local, localHigh, styles, styled, svgAsCssDataUrl;
3721
+ function* divide(text) {
3722
+ const regex = /^(([^\{\n]+\{[\t\x20]*)|([^\n\}]*\}[^\S\n\r]*))$/gm;
3723
+ let m;
3724
+ let sentOnce = false;
3725
+ let lastIndex = 0;
3726
+ let lastMatch;
3727
+ while ((m = regex.exec(text)) !== null) {
3728
+ if (m.index === regex.lastIndex) {
3729
+ regex.lastIndex++;
3730
+ }
3731
+ const match = m[0];
3732
+ if (!sentOnce) {
3733
+ sentOnce = true;
3734
+ yield text.substring(lastIndex, m.index);
3735
+ lastIndex = m.index + match.length;
3736
+ lastMatch = match;
3737
+ continue;
3738
+ }
3739
+ if (lastMatch.includes("}")) {
3740
+ yield [lastMatch.trim()];
3741
+ lastIndex = m.index + match.length;
3742
+ lastMatch = match;
3743
+ continue;
3744
+ }
3745
+ yield [lastMatch, text.substring(lastIndex, m.index), match];
3746
+ lastIndex = m.index + match.length;
3747
+ lastMatch = match;
3748
+ }
3749
+ if (lastMatch === null || lastMatch === void 0 ? void 0 : lastMatch.includes("}")) {
3750
+ yield [lastMatch.trim()];
3751
+ }
3752
+ }
3769
3753
  return {
3770
- setters: [function (_Bind) {
3771
- bindSymbol = _Bind.bindSymbol;
3772
- }],
3754
+ setters: [],
3773
3755
  execute: function () {
3774
- _export("RootObject", RootObject = class RootObject {
3775
- get vsProps() {
3776
- return undefined;
3777
- }
3778
- addEventListener(name, handler) {
3779
- return bridge.addEventHandler(this, name, handler);
3756
+ ;
3757
+ id = 1;
3758
+ nextId = () => `styled-r${id++}`;
3759
+ first = document.head.firstElementChild;
3760
+ addMarker = name => {
3761
+ const m = document.createElement("meta");
3762
+ m.name = name;
3763
+ if (first) {
3764
+ first.insertAdjacentElement("afterend", m);
3765
+ } else {
3766
+ document.head.insertAdjacentElement("afterbegin", m);
3780
3767
  }
3781
- appendChild(e) {
3782
- bridge.appendChild(this, e);
3768
+ first = m;
3769
+ return m;
3770
+ };
3771
+ globalLow = addMarker("global-low-style");
3772
+ global = addMarker("global-style");
3773
+ globalHigh = addMarker("global-high-style");
3774
+ localLow = addMarker("local-low-style");
3775
+ local = addMarker("local-style");
3776
+ localHigh = addMarker("local-high-style");
3777
+ StyleFragment = class StyleFragment {
3778
+ static newStyle({
3779
+ selector = "",
3780
+ content = ""
3781
+ }) {
3782
+ return new StyleFragment({
3783
+ selector,
3784
+ content
3785
+ });
3783
3786
  }
3784
- dispatchEvent(evt) {
3785
- bridge.dispatchEvent(evt);
3786
- }
3787
- });
3788
- _export("xnodeSymbol", xnodeSymbol = Symbol("XNode"));
3789
- _export("isControl", isControl = Symbol("isControl"));
3790
- _export("elementFactorySymbol", elementFactorySymbol = Symbol("elementFactory"));
3791
- _export("isFactorySymbol", isFactorySymbol = Symbol("isFactory"));
3792
- _export("attachedSymbol", attachedSymbol = Symbol("attached"));
3793
- _export("isTemplateSymbol", isTemplateSymbol = Symbol("isTemplate"));
3794
- _export("constructorNeedsArgumentsSymbol", constructorNeedsArgumentsSymbol = Symbol("constructorNeedsArguments"));
3795
- _export("attachedProperties", attachedProperties = {});
3796
- attachedId = 1;
3797
- attach = (name, attacher) => {
3798
- const key = `:${attachedId++}`;
3799
- const fx = v => {
3800
- return {
3801
- [key]: v
3802
- };
3803
- };
3804
- attachedProperties[key] = attacher;
3805
- fx[attachedSymbol] = attacher;
3806
- fx[isFactorySymbol] = key;
3807
- return fx;
3808
- };
3809
- _export("default", XNode = class XNode {
3810
- static attach(n, tag) {
3811
- return {
3812
- factory: (attributes, ...nodes) => new XNode(n, attributes ? Object.assign(Object.assign({}, attributes), {
3813
- for: tag
3814
- }) : {
3815
- for: tag
3816
- }, nodes)
3817
- };
3818
- }
3819
- static prepare(n, isProperty, isTemplate) {
3820
- function px(v) {
3821
- return {
3822
- [n]: v
3823
- };
3824
- }
3825
- px.factory = (a, ...nodes) => {
3826
- return new XNode(n, a, nodes, isProperty, isTemplate);
3827
- };
3828
- px.toString = () => n;
3829
- return px;
3830
- }
3831
- static getClass(fullTypeName, assemblyName) {
3832
- const n = fullTypeName + ";" + assemblyName;
3833
- const cx = XNode.classes[n] || (XNode.classes[n] = bridge.getClass(fullTypeName, assemblyName, RootObject, (name, isProperty, isTemplate) => (a, ...nodes) => new XNode(name, a, nodes, isProperty, isTemplate)));
3834
- return cx;
3835
- }
3836
- static namespace(ns, assemblyName) {
3837
- return (type, isTemplate) => {
3838
- return c => {
3839
- for (const key in c) {
3840
- if (c.hasOwnProperty(key)) {
3841
- const element = c[key];
3842
- if (element) {
3843
- const n = ns + "." + type + ":" + key + ";" + assemblyName;
3844
- const af = a => {
3845
- const r = {
3846
- [n]: a
3847
- };
3848
- Object.defineProperty(r, "toString", {
3849
- value: () => n,
3850
- enumerable: false,
3851
- configurable: false
3852
- });
3853
- return r;
3854
- };
3855
- af.factory = (a, ...nodes) => new XNode(n, a, nodes, true, element.isTemplate);
3856
- af.toString = () => n;
3857
- c[key] = af;
3858
- }
3859
- }
3860
- }
3861
- const tn = ns + "." + type + ";" + assemblyName;
3862
- c.factory = (a, ...nodes) => {
3863
- return new XNode(tn, a, nodes, false, isTemplate);
3864
- };
3865
- c.toString = () => tn;
3866
- };
3867
- };
3868
- }
3869
- static create(name, attributes, ...children) {
3870
- if (typeof name === "string") {
3871
- return new XNode(name, attributes, children);
3872
- }
3873
- if (name[isFactorySymbol]) {
3874
- return new XNode(name, attributes, children);
3875
- }
3876
- if (name.factory) {
3877
- return name.factory(attributes, ...children);
3878
- }
3879
- switch (typeof name) {
3880
- case "object":
3881
- name = name.toString();
3882
- break;
3883
- case "function":
3884
- return name(attributes || {}, ...children);
3885
- }
3886
- return new XNode(name, attributes, children);
3887
- }
3888
- constructor(name, attributes, children, isProperty, isTemplate) {
3889
- this.name = name;
3890
- this.attributes = attributes;
3891
- this.children = children;
3892
- this.isProperty = isProperty;
3893
- this.isTemplate = isTemplate;
3894
- this[xnodeSymbol] = true;
3895
- }
3896
- toString() {
3897
- if (typeof this.name === "string") {
3898
- return `name is of type string and value is ${this.name}`;
3899
- }
3900
- return `name is of type ${typeof this.name}`;
3901
- }
3902
- });
3903
- XNode.isFactory = isFactorySymbol;
3904
- XNode.elementFactory = elementFactorySymbol;
3905
- XNode.bindSymbol = bindSymbol;
3906
- XNode.isTemplate = isTemplateSymbol;
3907
- XNode.prepareAttached = attach;
3908
- XNode.constructorNeedsArguments = constructorNeedsArgumentsSymbol;
3909
- XNode.classes = {};
3910
- XNode.factory = (name, isProperty, isTemplate) => (a, ...nodes) => {
3911
- return new XNode(name, a, nodes, isProperty, isTemplate);
3912
- };
3913
- if (typeof bridge !== "undefined") {
3914
- bridge.XNode = XNode;
3915
- }
3916
- }
3917
- };
3918
- });
3919
- //# sourceMappingURL=XNode.js.map
3920
-
3921
- AmdLoader.instance.setup("@web-atoms/core/dist/core/XNode");
3922
-
3923
- System.register([], function (_export, _context) {
3924
- "use strict";
3925
-
3926
- function Pack(...a) {}
3927
- _export("default", Pack);
3928
- return {
3929
- setters: [],
3930
- execute: function () {}
3931
- };
3932
- });
3933
- //# sourceMappingURL=Pack.js.map
3934
-
3935
- AmdLoader.instance.setup("@web-atoms/core/dist/Pack");
3936
-
3937
- System.register([], function (_export, _context) {
3938
- "use strict";
3939
-
3940
- var StyleFragment, id, nextId, first, addMarker, globalLow, global, globalHigh, localLow, local, localHigh, styles, styled, svgAsCssDataUrl;
3941
- function* divide(text) {
3942
- const regex = /^(([^\{\n]+\{[\t\x20]*)|([^\n\}]*\}[^\S\n\r]*))$/gm;
3943
- let m;
3944
- let sentOnce = false;
3945
- let lastIndex = 0;
3946
- let lastMatch;
3947
- while ((m = regex.exec(text)) !== null) {
3948
- if (m.index === regex.lastIndex) {
3949
- regex.lastIndex++;
3950
- }
3951
- const match = m[0];
3952
- if (!sentOnce) {
3953
- sentOnce = true;
3954
- yield text.substring(lastIndex, m.index);
3955
- lastIndex = m.index + match.length;
3956
- lastMatch = match;
3957
- continue;
3958
- }
3959
- if (lastMatch.includes("}")) {
3960
- yield [lastMatch.trim()];
3961
- lastIndex = m.index + match.length;
3962
- lastMatch = match;
3963
- continue;
3964
- }
3965
- yield [lastMatch, text.substring(lastIndex, m.index), match];
3966
- lastIndex = m.index + match.length;
3967
- lastMatch = match;
3968
- }
3969
- if (lastMatch === null || lastMatch === void 0 ? void 0 : lastMatch.includes("}")) {
3970
- yield [lastMatch.trim()];
3971
- }
3972
- }
3973
- return {
3974
- setters: [],
3975
- execute: function () {
3976
- ;
3977
- id = 1;
3978
- nextId = () => `styled-r${id++}`;
3979
- first = document.head.firstElementChild;
3980
- addMarker = name => {
3981
- const m = document.createElement("meta");
3982
- m.name = name;
3983
- if (first) {
3984
- first.insertAdjacentElement("afterend", m);
3985
- } else {
3986
- document.head.insertAdjacentElement("afterbegin", m);
3987
- }
3988
- first = m;
3989
- return m;
3990
- };
3991
- globalLow = addMarker("global-low-style");
3992
- global = addMarker("global-style");
3993
- globalHigh = addMarker("global-high-style");
3994
- localLow = addMarker("local-low-style");
3995
- local = addMarker("local-style");
3996
- localHigh = addMarker("local-high-style");
3997
- StyleFragment = class StyleFragment {
3998
- static newStyle({
3999
- selector = "",
4000
- content = ""
4001
- }) {
4002
- return new StyleFragment({
4003
- selector,
4004
- content
4005
- });
4006
- }
4007
- constructor({
4008
- selector,
4009
- content
4010
- }) {
4011
- this.order = "low";
4012
- this.selector = selector;
4013
- this.content = content;
3787
+ constructor({
3788
+ selector,
3789
+ content
3790
+ }) {
3791
+ this.order = "low";
3792
+ this.selector = selector;
3793
+ this.content = content;
4014
3794
  }
4015
3795
  expand(selector) {
4016
3796
  selector !== null && selector !== void 0 ? selector : selector = this.selector;
@@ -4144,223 +3924,837 @@ System.register([], function (_export, _context) {
4144
3924
 
4145
3925
  AmdLoader.instance.setup("@web-atoms/core/dist/style/styled");
4146
3926
 
4147
- System.register(["./types"], function (_export, _context) {
3927
+ System.register(["@web-atoms/core/dist/style/styled"], function (_export, _context) {
4148
3928
  "use strict";
4149
3929
 
4150
- var ArrayHelper, AtomBinder, symbolHandlers, symbolBindable;
4151
- _export("AtomBinder", void 0);
3930
+ var styled;
4152
3931
  return {
4153
- setters: [function (_types) {
4154
- ArrayHelper = _types.ArrayHelper;
3932
+ setters: [function (_webAtomsCoreDistStyleStyled) {
3933
+ styled = _webAtomsCoreDistStyleStyled.default;
4155
3934
  }],
4156
3935
  execute: function () {
4157
- _export("symbolHandlers", symbolHandlers = Symbol.for("handlers"));
4158
- _export("symbolBindable", symbolBindable = Symbol.for("bindable"));
4159
- _export("AtomBinder", AtomBinder = class AtomBinder {
4160
- static refreshValue(target, key) {
4161
- const handlers = AtomBinder.get_WatchHandler(target, key);
4162
- if (handlers === undefined || handlers == null) {
4163
- return;
4164
- }
4165
- for (const item of handlers) {
4166
- item(target, key);
4167
- }
4168
- if (target.onPropertyChanged) {
4169
- target.onPropertyChanged(key);
4170
- }
3936
+ styled.css`
3937
+
3938
+ div[data-desktop-app=desktop-app] {
3939
+ width: 100%;
3940
+ }
3941
+
3942
+ /* div[data-base-page=base-page] {
3943
+ & > [data-page-element=title] {
3944
+ overflow-y: visible;
4171
3945
  }
4172
- static add_WatchHandler(target, key, handler) {
4173
- if (target == null) {
4174
- return;
4175
- }
4176
- const handlers = AtomBinder.get_WatchHandler(target, key);
4177
- handlers.push(handler);
4178
- if (Array.isArray(target)) {
4179
- return;
4180
- }
4181
- const pv = AtomBinder.getPropertyDescriptor(target, key);
4182
- if (pv && pv.get) {
4183
- return;
4184
- }
4185
- const tw = target;
4186
- let bindables = tw[symbolBindable];
4187
- if (bindables === undefined) {
4188
- bindables = {};
4189
- Object.defineProperty(tw, symbolBindable, {
4190
- value: bindables,
4191
- enumerable: false,
4192
- writable: true,
4193
- configurable: true
4194
- });
3946
+ } */
3947
+
3948
+ `.withId("default-app-style").withOrder("medium").installGlobal();
3949
+ }
3950
+ };
3951
+ });
3952
+ //# sourceMappingURL=OverrideAppStyle.js.map
3953
+
3954
+ AmdLoader.instance.setup("@social-mail/social-mail-client/dist/style/OverrideAppStyle");
3955
+
3956
+
3957
+ System.register([], function(_export, _context) {
3958
+ return {
3959
+ setters: [],
3960
+ execute: function() {
3961
+
3962
+ // this is because in web atoms loader
3963
+ // root url may not be set when the module is registered
3964
+ setTimeout(() => {
3965
+
3966
+ const cssModule = _context.meta.resolve("./data-styles.css");
3967
+ const cssURL = System.resolve(cssModule);
3968
+
3969
+ const link = document.createElement("link");
3970
+ link.id = "data-styles";
3971
+ link.setAttribute("href", cssURL);
3972
+ link.setAttribute("rel", "stylesheet");
3973
+ link.setAttribute("as", "style");
3974
+ link.setAttribute("crossorigin", "anonymous");
3975
+ const head = document.head;
3976
+ const firstElementChild = head.firstElementChild;
3977
+ if (firstElementChild) {
3978
+ head.insertBefore(link, firstElementChild);
3979
+ } else {
3980
+ head.appendChild(link);
3981
+ }
3982
+ }, 1);
3983
+ }
3984
+ };
3985
+ });
3986
+
3987
+
3988
+ AmdLoader.instance.setup("@web-atoms/data-styles/data-styles");
3989
+
3990
+ System.register(["@web-atoms/core/dist/core/types", "@web-atoms/core/dist/core/AtomList", "./OverrideAppStyle", "@web-atoms/core/dist/style/styled", "@web-atoms/data-styles/data-styles"], function (_export, _context) {
3991
+ "use strict";
3992
+
3993
+ var UMD, styled, ___UMD;
3994
+ function addLinkTag(href, integrity, rel = "stylesheet") {
3995
+ if (!document.head.querySelector(`[href="${href}"]`)) {
3996
+ const fa = document.createElement("link");
3997
+ fa.href = href;
3998
+ fa.crossOrigin = "anonymous";
3999
+ fa.as = "style";
4000
+ fa.rel = "preload";
4001
+ if (integrity) {
4002
+ fa.integrity = integrity;
4003
+ }
4004
+ fa.onload = () => {
4005
+ fa.onload = null;
4006
+ fa.rel = rel;
4007
+ };
4008
+ document.head.insertBefore(fa, document.head.firstElementChild);
4009
+ }
4010
+ }
4011
+ return {
4012
+ setters: [function (_webAtomsCoreDistCoreTypes) {
4013
+ UMD = _webAtomsCoreDistCoreTypes.UMD;
4014
+ }, function (_webAtomsCoreDistCoreAtomList) {}, function (_OverrideAppStyle) {}, function (_webAtomsCoreDistStyleStyled) {
4015
+ styled = _webAtomsCoreDistStyleStyled.default;
4016
+ }, function (_webAtomsDataStylesDataStyles) {}],
4017
+ execute: function () {
4018
+ _export("___UMD", ___UMD = UMD);
4019
+ addLinkTag("https://fonts.googleapis.com/css2?family=Source+Sans+Pro:ital,wght@0,400;0,600;0,700;1,400;1,600;1,700&display=swap");
4020
+ addLinkTag("https://npm-git.azureedge.net/npm/package/@c8private/fa-icons@6.5.2/css/all.min.css");
4021
+ addLinkTag("https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0");
4022
+ addLinkTag("https://cdn.jsdelivr.net/npm/file-icon-vectors@1.0.0/dist/file-icon-vivid.min.css");
4023
+ styled.css`
4024
+
4025
+ :root {
4026
+ --primary-color: #294D4A;
4027
+ --accent-color: #ff6733;
4028
+ --accent2-color: #ff673375;
4029
+ --lighter-accent-color: #e6e6fa60;
4030
+ --light-accent-color: #f2e5fa;
4031
+ --accent-text-color: white;
4032
+ --background-color: #f1f1f160;
4033
+ --window-background: #50505025;
4034
+ --media-bg-color: #9F33FF0F;
4035
+ --font-size-small: 0.8125em;
4036
+
4037
+ --hover-color: #b8b88b20;
4038
+ --command-bg-color: #50505025;
4039
+ --hover-text-color: CanvasText;
4040
+ --selection-color: #b8b88b60;
4041
+ --selection-text-color: CanvasText;
4042
+ --spacing: 5px;
4043
+ --spacing-medium: 7px;
4044
+ --spacing-large: 10px;
4045
+ }
4046
+
4047
+ html, body {
4048
+ margin:0;
4049
+ }
4050
+
4051
+ * {
4052
+ scrollbar-width: thin;
4053
+ scrollbar-color: var(--accent-color) white;
4054
+ }
4055
+
4056
+
4057
+ ::-webkit-scrollbar {
4058
+ width: 5px;
4059
+ }
4060
+ ::-webkit-scrollbar-track {
4061
+ background: white;
4062
+ border-radius: 20px;
4063
+ }
4064
+ ::-webkit-scrollbar-thumb {
4065
+ background: var(--accent-color);
4066
+ border-radius: 20px;
4067
+ }
4068
+
4069
+ body {
4070
+ font-family: trebuchet ms, "Source Sans Pro";
4071
+ font-size: 16px;
4072
+ justify-content: stretch;
4073
+
4074
+ & * {
4075
+ font-family: trebuchet ms, "Source Sans Pro";
4076
+ box-sizing: border-box;
4077
+ }
4078
+
4079
+ &::placeholder {
4080
+ font-size: smaller;
4081
+ }
4082
+
4083
+ & ul {
4084
+ padding-inline-start: 15px;
4085
+ }
4086
+
4087
+ & input[type=search] {
4088
+ border: none;
4089
+ outline: none;
4090
+ border-radius: 9999px;
4091
+ padding-right: 10px;
4092
+ padding-left: 25px;
4093
+ background: canvas url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' class='bi bi-search' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'%3E%3C/path%3E%3C/svg%3E") no-repeat 5px center;
4094
+ }
4095
+ }
4096
+
4097
+ `.withId("global-styles").withOrder("medium").installGlobal();
4098
+ }
4099
+ };
4100
+ });
4101
+ //# sourceMappingURL=GlobalStyle.js.map
4102
+
4103
+ AmdLoader.instance.setup("@social-mail/social-mail-client/dist/style/GlobalStyle");
4104
+
4105
+ System.register([], function (_export, _context) {
4106
+ "use strict";
4107
+
4108
+ var viewModelParseWatchCache, viewModelParseWatchCache2;
4109
+ function trimRegEx(t, r) {
4110
+ const m = r.exec(t);
4111
+ if (m && m.length) {
4112
+ return [true, t.substring(m[0].length).trim(), m[0]];
4113
+ }
4114
+ return [false, t, ""];
4115
+ }
4116
+ function extractTill(text, search, returnOriginal = false) {
4117
+ const index = text.indexOf(search);
4118
+ if (index <= 0) {
4119
+ return returnOriginal ? text : "";
4120
+ }
4121
+ return text.substring(0, index);
4122
+ }
4123
+ function parsePath(f, parseThis) {
4124
+ let str = f.toString().trim();
4125
+ str = str.split("\n").filter(s => !/^\/\//.test(s.trim())).join("\n");
4126
+ const key = (parseThis === undefined ? "un:" : parseThis ? "_this:" : "_noThis:") + str;
4127
+ const px1 = viewModelParseWatchCache[key];
4128
+ if (px1) {
4129
+ return px1;
4130
+ }
4131
+ if (str.endsWith("}")) {
4132
+ str = str.substr(0, str.length - 1);
4133
+ }
4134
+ const functionRegEx = /^\w+\s*\(/;
4135
+ const lambdaRegEx = /^\(?(\w+)?(\s?\,\s?\w+)*\)?\s?\=\>/;
4136
+ let arg = "";
4137
+ const original = str;
4138
+ let [success, remaining] = trimRegEx(str, functionRegEx);
4139
+ if (success) {
4140
+ str = remaining;
4141
+ remaining = extractTill(remaining, ")");
4142
+ str = str.substring(remaining.length);
4143
+ arg = extractTill(remaining, ",", true);
4144
+ } else {
4145
+ [success, str, remaining] = trimRegEx(str, lambdaRegEx);
4146
+ if (success) {
4147
+ remaining = remaining.trim();
4148
+ remaining = remaining.substring(0, remaining.length - 2);
4149
+ remaining = extractTill(remaining, ")", true);
4150
+ arg = extractTill(remaining, ",", true);
4151
+ if (arg.startsWith("(")) {
4152
+ arg = arg.substring(1);
4153
+ }
4154
+ } else {
4155
+ if (parseThis !== undefined && parseThis === false) {
4156
+ return [];
4157
+ } else {
4158
+ parseThis = true;
4159
+ }
4160
+ }
4161
+ }
4162
+ str = str.trim();
4163
+ const isThis = parseThis === undefined ? (arg ? false : true) || parseThis : parseThis;
4164
+ const p = (isThis ? "(\\_this|this)" : arg || "").trim();
4165
+ if (p.length === 0) {
4166
+ const empty = [];
4167
+ viewModelParseWatchCache[key] = empty;
4168
+ return empty;
4169
+ }
4170
+ const regExp = `(?:(\\b${p})(?:(\\.[a-zA-Z_][a-zA-Z_0-9]*)+)\\s?(?:(\\(|\\=\\=\\=|\\=\\=|\\=)?))`;
4171
+ const re = new RegExp(regExp, "gi");
4172
+ let path = [];
4173
+ const ms = str.replace(re, m => {
4174
+ let px = m;
4175
+ if (px.startsWith("this.")) {
4176
+ if (parseThis !== true) {
4177
+ px = px.substr(5);
4178
+ }
4179
+ } else if (px.startsWith("_this.")) {
4180
+ if (parseThis !== true) {
4181
+ px = px.substr(6);
4182
+ } else {
4183
+ px = px.substr(1);
4184
+ }
4185
+ } else {
4186
+ px = px.substr(p.length + 1);
4187
+ }
4188
+ px = px.split(".").filter(s => !s.endsWith("(")).join(".");
4189
+ if (!path.find(y => y === px)) {
4190
+ path.push(px);
4191
+ }
4192
+ const filtered = [];
4193
+ for (const iterator of path) {
4194
+ if (iterator.endsWith("==") || !(iterator.endsWith("(") || iterator.endsWith("="))) {
4195
+ filtered.push((iterator.endsWith("===") ? iterator.substr(0, iterator.length - 3) : iterator.endsWith("==") ? iterator.substr(0, iterator.length - 2) : iterator).trim());
4196
+ }
4197
+ }
4198
+ path = filtered.filter(px11 => {
4199
+ const search = px11 + ".";
4200
+ for (const iterator of filtered) {
4201
+ if (px11 !== iterator && iterator.indexOf(search) !== -1) {
4202
+ return false;
4195
4203
  }
4196
- if (!bindables[key]) {
4197
- bindables[key] = 1;
4198
- const o = target[key];
4199
- const nk = Symbol.for(key);
4200
- target[nk] = o;
4201
- const set = function (v) {
4202
- const ov = this[nk];
4203
- if (ov === undefined ? ov === v : ov == v) {
4204
+ }
4205
+ return true;
4206
+ });
4207
+ return m;
4208
+ });
4209
+ path = path.sort((a, b) => b.localeCompare(a));
4210
+ const duplicates = path;
4211
+ path = [];
4212
+ for (const iterator of duplicates) {
4213
+ if (path.find(px2 => px2 === iterator)) {
4214
+ continue;
4215
+ }
4216
+ path.push(iterator);
4217
+ }
4218
+ const rp = [];
4219
+ for (const rpItem of path) {
4220
+ if (rp.find(x => x.startsWith(rpItem))) {
4221
+ continue;
4222
+ }
4223
+ rp.push(rpItem);
4224
+ }
4225
+ const pl = path.filter(p1 => p1).map(p1 => p1.split("."));
4226
+ viewModelParseWatchCache[key] = pl;
4227
+ return pl;
4228
+ }
4229
+ function parsePathLists(f) {
4230
+ const str = f.toString().trim();
4231
+ const key = str;
4232
+ const px1 = viewModelParseWatchCache2[key];
4233
+ if (px1) {
4234
+ return px1;
4235
+ }
4236
+ const pl = {
4237
+ pathList: parsePath(str, false),
4238
+ thisPath: parsePath(str, true),
4239
+ combined: []
4240
+ };
4241
+ if (pl.thisPath.length && pl.pathList.length) {
4242
+ pl.combined = pl.thisPath.map(x => {
4243
+ x[0] = "t";
4244
+ x.splice(0, 0, "this");
4245
+ return x;
4246
+ }).concat(pl.pathList.map(x => {
4247
+ x.splice(0, 0, "this", "x");
4248
+ return x;
4249
+ }));
4250
+ pl.thisPath = [];
4251
+ pl.pathList = [];
4252
+ }
4253
+ viewModelParseWatchCache2[key] = pl;
4254
+ return pl;
4255
+ }
4256
+ _export({
4257
+ parsePath: parsePath,
4258
+ parsePathLists: parsePathLists
4259
+ });
4260
+ return {
4261
+ setters: [],
4262
+ execute: function () {
4263
+ viewModelParseWatchCache = {};
4264
+ viewModelParseWatchCache2 = {};
4265
+ }
4266
+ };
4267
+ });
4268
+ //# sourceMappingURL=ExpressionParser.js.map
4269
+
4270
+ AmdLoader.instance.setup("@web-atoms/core/dist/core/ExpressionParser");
4271
+
4272
+ System.register(["tslib", "./ExpressionParser", "./types"], function (_export, _context) {
4273
+ "use strict";
4274
+
4275
+ var __awaiter, parsePath, parsePathLists, CancelToken, ignoreValue, Bind, isEvent, bindSymbol;
4276
+ function twoWaysConvert(name, b, control, e, creator) {
4277
+ control.bind(e, name, b.thisPathList || b.pathList, b.eventList || true, null, b.thisPathList ? creator : undefined);
4278
+ }
4279
+ _export("default", void 0);
4280
+ return {
4281
+ setters: [function (_tslib) {
4282
+ __awaiter = _tslib.__awaiter;
4283
+ }, function (_ExpressionParser) {
4284
+ parsePath = _ExpressionParser.parsePath;
4285
+ parsePathLists = _ExpressionParser.parsePathLists;
4286
+ }, function (_types) {
4287
+ CancelToken = _types.CancelToken;
4288
+ ignoreValue = _types.ignoreValue;
4289
+ }],
4290
+ execute: function () {
4291
+ isEvent = /^event/i;
4292
+ _export("bindSymbol", bindSymbol = Symbol("Bind"));
4293
+ _export("default", Bind = class Bind {
4294
+ static forControl() {
4295
+ return Bind;
4296
+ }
4297
+ static forData() {
4298
+ return Bind;
4299
+ }
4300
+ static forViewModel() {
4301
+ return Bind;
4302
+ }
4303
+ static forLocalViewModel() {
4304
+ return Bind;
4305
+ }
4306
+ static presenter(name) {
4307
+ return {
4308
+ [bindSymbol](cn, control, e, creator) {
4309
+ if (typeof name === "function") {
4310
+ name(control);
4204
4311
  return;
4205
4312
  }
4206
- this[nk] = v;
4207
- AtomBinder.refreshValue(this, key);
4208
- };
4209
- const get = function () {
4210
- return this[nk];
4211
- };
4212
- if (pv) {
4213
- delete target[key];
4214
- Object.defineProperty(target, key, {
4215
- get,
4216
- set,
4217
- configurable: true,
4218
- enumerable: true
4313
+ const n = name || cn;
4314
+ let c = control.element;
4315
+ while (c) {
4316
+ if (c.atomControl && c.atomControl[n] !== undefined) {
4317
+ break;
4318
+ }
4319
+ c = c._logicalParent || c.parentElement;
4320
+ }
4321
+ (c && c.atomControl || control)[n] = e;
4322
+ }
4323
+ };
4324
+ }
4325
+ static event(sourcePath) {
4326
+ return {
4327
+ [bindSymbol](name, control, e) {
4328
+ control.runAfterInit(() => {
4329
+ if (isEvent.test(name)) {
4330
+ name = name.substring(5);
4331
+ if (name.startsWith("-")) {
4332
+ name = name.substring(1).replace(/-([a-z])/g, g => g[1].toUpperCase());
4333
+ } else {
4334
+ name = name[0].toLowerCase() + name.substring(1);
4335
+ }
4336
+ }
4337
+ control.bindEvent(e, name, e1 => {
4338
+ return sourcePath(control, e1);
4339
+ });
4219
4340
  });
4220
- } else {
4221
- Object.defineProperty(target, key, {
4222
- get,
4223
- set,
4224
- enumerable: true,
4225
- configurable: true
4341
+ }
4342
+ };
4343
+ }
4344
+ static oneTime(sourcePath, now) {
4345
+ return {
4346
+ [bindSymbol](name, control, e) {
4347
+ control.runAfterInit(() => {
4348
+ control.setLocalValue(e, name, sourcePath(control, e));
4226
4349
  });
4350
+ if (typeof now !== "undefined") {
4351
+ control.setLocalValue(e, name, now);
4352
+ }
4227
4353
  }
4228
- }
4354
+ };
4229
4355
  }
4230
- static getPropertyDescriptor(target, key) {
4231
- const pv = Object.getOwnPropertyDescriptor(target, key);
4232
- if (!pv) {
4233
- const pt = Object.getPrototypeOf(target);
4234
- if (pt) {
4235
- return AtomBinder.getPropertyDescriptor(pt, key);
4356
+ static oneTimeAsync(sourcePath, now) {
4357
+ return {
4358
+ [bindSymbol](name, control, e) {
4359
+ control.runAfterInit(() => {
4360
+ control.app.runAsync(() => __awaiter(this, void 0, void 0, function* () {
4361
+ const value = yield sourcePath(control, e, new CancelToken());
4362
+ control.setLocalValue(e, name, value);
4363
+ }));
4364
+ });
4365
+ if (typeof now !== "undefined") {
4366
+ control.setLocalValue(e, name, now);
4367
+ }
4236
4368
  }
4237
- }
4238
- return pv;
4369
+ };
4239
4370
  }
4240
- static get_WatchHandler(target, key) {
4241
- if (target == null) {
4242
- return null;
4243
- }
4244
- let handlers = target[symbolHandlers];
4245
- if (handlers === undefined) {
4246
- handlers = {};
4247
- Object.defineProperty(target, symbolHandlers, {
4248
- value: handlers,
4249
- enumerable: false,
4250
- writable: true,
4251
- configurable: true
4252
- });
4371
+ static source(source, path, now) {
4372
+ const lists = parsePath(path, false).map(x => ["this", ...x]);
4373
+ return {
4374
+ [bindSymbol](name, control, e, creator) {
4375
+ const self = {
4376
+ control,
4377
+ source
4378
+ };
4379
+ control.bind(e, name, lists, false, () => {
4380
+ return path.call(self, self);
4381
+ }, self);
4382
+ if (typeof now !== "undefined") {
4383
+ control.setLocalValue(e, name, now);
4384
+ }
4385
+ }
4386
+ };
4387
+ }
4388
+ static oneWayAsync(sourcePath, {
4389
+ watchDelayInMS = 250,
4390
+ default: defaultValue
4391
+ } = {}) {
4392
+ let pathList;
4393
+ let combined;
4394
+ let thisPathList;
4395
+ if (Array.isArray(sourcePath)) {
4396
+ pathList = sourcePath;
4397
+ } else {
4398
+ const lists = parsePathLists(sourcePath);
4399
+ if (lists.combined.length) {
4400
+ combined = lists.combined;
4401
+ }
4402
+ if (lists.pathList.length) {
4403
+ pathList = lists.pathList;
4404
+ }
4405
+ if (lists.thisPath.length) {
4406
+ thisPathList = lists.thisPath;
4407
+ }
4253
4408
  }
4254
- let handlersForKey = handlers[key];
4255
- if (handlersForKey === undefined || handlersForKey == null) {
4256
- handlersForKey = [];
4257
- handlers[key] = handlersForKey;
4409
+ if (!(combined || pathList || thisPathList)) {
4410
+ throw new Error(`Failed to setup binding for ${sourcePath}, parsing failed`);
4258
4411
  }
4259
- return handlersForKey;
4412
+ return {
4413
+ [bindSymbol](name, control, e, creator) {
4414
+ let bindingSource;
4415
+ let finalPathList = pathList;
4416
+ if (combined) {
4417
+ bindingSource = {
4418
+ t: creator,
4419
+ x: control
4420
+ };
4421
+ finalPathList = combined;
4422
+ } else if (thisPathList) {
4423
+ finalPathList = thisPathList;
4424
+ bindingSource = creator;
4425
+ }
4426
+ const asyncState = {
4427
+ token: 0,
4428
+ cancelToken: undefined
4429
+ };
4430
+ control.bind(e, name, finalPathList, false, () => {
4431
+ var _a;
4432
+ const app = control.app;
4433
+ (_a = asyncState.cancelToken) === null || _a === void 0 ? void 0 : _a.cancel();
4434
+ asyncState.cancelToken = undefined;
4435
+ asyncState.token = app.setTimeoutAsync(() => __awaiter(this, void 0, void 0, function* () {
4436
+ var _b, _c;
4437
+ if ((_b = asyncState.cancelToken) === null || _b === void 0 ? void 0 : _b.cancelled) {
4438
+ return;
4439
+ }
4440
+ asyncState.token = undefined;
4441
+ (_c = asyncState.cancelToken) === null || _c === void 0 ? void 0 : _c.cancel();
4442
+ const ct = asyncState.cancelToken = new CancelToken();
4443
+ const value = yield sourcePath.call(creator, control, e, ct);
4444
+ if (!ct.cancelled) {
4445
+ control.setLocalValue(e, name, value);
4446
+ }
4447
+ }), watchDelayInMS, asyncState.token);
4448
+ return ignoreValue;
4449
+ }, bindingSource);
4450
+ if (typeof defaultValue !== "undefined") {
4451
+ control.setLocalValue(e, name, defaultValue);
4452
+ }
4453
+ }
4454
+ };
4260
4455
  }
4261
- static remove_WatchHandler(target, key, handler) {
4262
- if (target == null) {
4263
- return;
4456
+ static oneWay(sourcePath, now) {
4457
+ let pathList;
4458
+ let combined;
4459
+ let thisPathList;
4460
+ if (Array.isArray(sourcePath)) {
4461
+ pathList = sourcePath;
4462
+ } else {
4463
+ const lists = parsePathLists(sourcePath);
4464
+ if (lists.combined.length) {
4465
+ combined = lists.combined;
4466
+ }
4467
+ if (lists.pathList.length) {
4468
+ pathList = lists.pathList;
4469
+ }
4470
+ if (lists.thisPath.length) {
4471
+ thisPathList = lists.thisPath;
4472
+ }
4264
4473
  }
4265
- const handlers = target[symbolHandlers];
4266
- if (typeof handlers === "undefined") {
4267
- return;
4474
+ if (!(combined || pathList || thisPathList)) {
4475
+ throw new Error(`Failed to setup binding for ${sourcePath}, parsing failed`);
4268
4476
  }
4269
- const handlersForKey = target[symbolHandlers][key];
4270
- if (handlersForKey === undefined || handlersForKey == null) {
4271
- return;
4477
+ return {
4478
+ [bindSymbol](name, control, e, creator) {
4479
+ if (pathList) {
4480
+ control.bind(e, name, pathList, false, () => {
4481
+ return sourcePath.call(creator, control, e);
4482
+ });
4483
+ if (typeof now !== "undefined") {
4484
+ control.setLocalValue(e, name, now);
4485
+ }
4486
+ return;
4487
+ }
4488
+ if (combined) {
4489
+ const a = {
4490
+ t: creator,
4491
+ x: control
4492
+ };
4493
+ control.bind(e, name, combined, false, () => {
4494
+ return sourcePath.call(creator, control, e);
4495
+ }, a);
4496
+ if (typeof now !== "undefined") {
4497
+ control.setLocalValue(e, name, now);
4498
+ }
4499
+ return;
4500
+ }
4501
+ control.bind(e, name, thisPathList, false, () => {
4502
+ return sourcePath.call(creator, control, e);
4503
+ }, creator);
4504
+ if (typeof now !== "undefined") {
4505
+ control.setLocalValue(e, name, now);
4506
+ }
4507
+ }
4508
+ };
4509
+ }
4510
+ static twoWays(sourcePath, events, converter) {
4511
+ let pathList;
4512
+ let thisPathList;
4513
+ if (Array.isArray(sourcePath)) {
4514
+ pathList = sourcePath;
4515
+ } else {
4516
+ const lists = parsePathLists(sourcePath);
4517
+ if (lists.combined.length) {
4518
+ throw new Error("Cannot have combined binding for two ways");
4519
+ }
4520
+ if (lists.pathList.length) {
4521
+ pathList = lists.pathList;
4522
+ }
4523
+ if (lists.thisPath.length) {
4524
+ thisPathList = lists.thisPath;
4525
+ }
4272
4526
  }
4273
- ArrayHelper.remove(handlersForKey, f => f === handler);
4274
- if (!handlersForKey.length) {
4275
- handlers[key] = null;
4276
- delete handlers[key];
4527
+ if (!(thisPathList || pathList)) {
4528
+ throw new Error(`Failed to setup twoWay binding on ${sourcePath}`);
4277
4529
  }
4530
+ return {
4531
+ [bindSymbol](name, control, e, creator) {
4532
+ control.bind(e, name, thisPathList || pathList, events || true, converter, thisPathList ? creator : undefined);
4533
+ }
4534
+ };
4278
4535
  }
4279
- static invokeItemsEvent(target, mode, index, item, oldItem) {
4280
- const key = "_items";
4281
- const handlers = AtomBinder.get_WatchHandler(target, key);
4282
- if (!handlers) {
4536
+ static sourceTwoWays(source, path, events = ["input", "cut", "paste", "change"]) {
4537
+ const lists = parsePath(path, false).map(x => ["this", ...x]);
4538
+ return {
4539
+ [bindSymbol](name, control, e, creator) {
4540
+ const self = {
4541
+ control,
4542
+ source
4543
+ };
4544
+ control.bind(e, name, lists, events, lists, self);
4545
+ }
4546
+ };
4547
+ }
4548
+ static twoWaysImmediate(sourcePath, converter) {
4549
+ return this.twoWays(sourcePath, ["change", "input", "paste", "cut"], converter);
4550
+ }
4551
+ constructor(setupFunction, sourcePath, name, eventList) {
4552
+ this.setupFunction = setupFunction;
4553
+ this.name = name;
4554
+ this.eventList = eventList;
4555
+ this.sourcePath = sourcePath;
4556
+ this[bindSymbol] = true;
4557
+ if (!this.sourcePath) {
4283
4558
  return;
4284
4559
  }
4285
- for (const obj of handlers) {
4286
- obj(target, mode, index, item, oldItem);
4560
+ if (Array.isArray(this.sourcePath)) {
4561
+ this.pathList = this.sourcePath;
4562
+ } else {
4563
+ const lists = parsePathLists(this.sourcePath);
4564
+ if (lists.combined.length) {
4565
+ this.combined = lists.combined;
4566
+ }
4567
+ if (lists.pathList.length) {
4568
+ this.pathList = lists.pathList;
4569
+ }
4570
+ if (lists.thisPath.length) {
4571
+ this.thisPathList = lists.thisPath;
4572
+ }
4287
4573
  }
4288
- AtomBinder.refreshValue(target, "length");
4289
4574
  }
4290
- static refreshItems(ary) {
4291
- AtomBinder.invokeItemsEvent(ary, "refresh", -1, null);
4575
+ });
4576
+ }
4577
+ };
4578
+ });
4579
+ //# sourceMappingURL=Bind.js.map
4580
+
4581
+ AmdLoader.instance.setup("@web-atoms/core/dist/core/Bind");
4582
+
4583
+ System.register(["./Bind"], function (_export, _context) {
4584
+ "use strict";
4585
+
4586
+ var bindSymbol, RootObject, XNode, xnodeSymbol, isControl, elementFactorySymbol, isFactorySymbol, attachedSymbol, isTemplateSymbol, constructorNeedsArgumentsSymbol, attachedProperties, attachedId, attach;
4587
+ _export({
4588
+ RootObject: void 0,
4589
+ default: void 0
4590
+ });
4591
+ return {
4592
+ setters: [function (_Bind) {
4593
+ bindSymbol = _Bind.bindSymbol;
4594
+ }],
4595
+ execute: function () {
4596
+ _export("RootObject", RootObject = class RootObject {
4597
+ get vsProps() {
4598
+ return undefined;
4292
4599
  }
4293
- static add_CollectionChanged(target, handler) {
4294
- if (target == null) {
4295
- throw new Error("Target Array to watch cannot be null");
4296
- }
4297
- if (handler == null) {
4298
- throw new Error("Target handle to watch an Array cannot be null");
4299
- }
4300
- const handlers = AtomBinder.get_WatchHandler(target, "_items");
4301
- handlers.push(handler);
4600
+ addEventListener(name, handler) {
4601
+ return bridge.addEventHandler(this, name, handler);
4602
+ }
4603
+ appendChild(e) {
4604
+ bridge.appendChild(this, e);
4605
+ }
4606
+ dispatchEvent(evt) {
4607
+ bridge.dispatchEvent(evt);
4608
+ }
4609
+ });
4610
+ _export("xnodeSymbol", xnodeSymbol = Symbol("XNode"));
4611
+ _export("isControl", isControl = Symbol("isControl"));
4612
+ _export("elementFactorySymbol", elementFactorySymbol = Symbol("elementFactory"));
4613
+ _export("isFactorySymbol", isFactorySymbol = Symbol("isFactory"));
4614
+ _export("attachedSymbol", attachedSymbol = Symbol("attached"));
4615
+ _export("isTemplateSymbol", isTemplateSymbol = Symbol("isTemplate"));
4616
+ _export("constructorNeedsArgumentsSymbol", constructorNeedsArgumentsSymbol = Symbol("constructorNeedsArguments"));
4617
+ _export("attachedProperties", attachedProperties = {});
4618
+ attachedId = 1;
4619
+ attach = (name, attacher) => {
4620
+ const key = `:${attachedId++}`;
4621
+ const fx = v => {
4302
4622
  return {
4303
- dispose: () => {
4304
- AtomBinder.remove_CollectionChanged(target, handler);
4305
- }
4623
+ [key]: v
4624
+ };
4625
+ };
4626
+ attachedProperties[key] = attacher;
4627
+ fx[attachedSymbol] = attacher;
4628
+ fx[isFactorySymbol] = key;
4629
+ return fx;
4630
+ };
4631
+ _export("default", XNode = class XNode {
4632
+ static attach(n, tag) {
4633
+ return {
4634
+ factory: (attributes, ...nodes) => new XNode(n, attributes ? Object.assign(Object.assign({}, attributes), {
4635
+ for: tag
4636
+ }) : {
4637
+ for: tag
4638
+ }, nodes)
4306
4639
  };
4307
4640
  }
4308
- static remove_CollectionChanged(t, handler) {
4309
- if (t == null) {
4310
- return;
4311
- }
4312
- const target = t;
4313
- const handlers = target[symbolHandlers];
4314
- if (typeof handlers === "undefined") {
4315
- return;
4316
- }
4317
- const key = "_items";
4318
- const handlersForKey = handlers[key];
4319
- if (handlersForKey === undefined || handlersForKey == null) {
4320
- return;
4321
- }
4322
- ArrayHelper.remove(handlersForKey, f => f === handler);
4323
- if (!handlersForKey.length) {
4324
- handlers[key] = null;
4325
- delete handlers[key];
4641
+ static prepare(n, isProperty, isTemplate) {
4642
+ function px(v) {
4643
+ return {
4644
+ [n]: v
4645
+ };
4326
4646
  }
4647
+ px.factory = (a, ...nodes) => {
4648
+ return new XNode(n, a, nodes, isProperty, isTemplate);
4649
+ };
4650
+ px.toString = () => n;
4651
+ return px;
4327
4652
  }
4328
- static watch(item, property, f) {
4329
- AtomBinder.add_WatchHandler(item, property, f);
4330
- return {
4331
- dispose: () => {
4332
- AtomBinder.remove_WatchHandler(item, property, f);
4333
- }
4653
+ static getClass(fullTypeName, assemblyName) {
4654
+ const n = fullTypeName + ";" + assemblyName;
4655
+ const cx = XNode.classes[n] || (XNode.classes[n] = bridge.getClass(fullTypeName, assemblyName, RootObject, (name, isProperty, isTemplate) => (a, ...nodes) => new XNode(name, a, nodes, isProperty, isTemplate)));
4656
+ return cx;
4657
+ }
4658
+ static namespace(ns, assemblyName) {
4659
+ return (type, isTemplate) => {
4660
+ return c => {
4661
+ for (const key in c) {
4662
+ if (c.hasOwnProperty(key)) {
4663
+ const element = c[key];
4664
+ if (element) {
4665
+ const n = ns + "." + type + ":" + key + ";" + assemblyName;
4666
+ const af = a => {
4667
+ const r = {
4668
+ [n]: a
4669
+ };
4670
+ Object.defineProperty(r, "toString", {
4671
+ value: () => n,
4672
+ enumerable: false,
4673
+ configurable: false
4674
+ });
4675
+ return r;
4676
+ };
4677
+ af.factory = (a, ...nodes) => new XNode(n, a, nodes, true, element.isTemplate);
4678
+ af.toString = () => n;
4679
+ c[key] = af;
4680
+ }
4681
+ }
4682
+ }
4683
+ const tn = ns + "." + type + ";" + assemblyName;
4684
+ c.factory = (a, ...nodes) => {
4685
+ return new XNode(tn, a, nodes, false, isTemplate);
4686
+ };
4687
+ c.toString = () => tn;
4688
+ };
4334
4689
  };
4335
4690
  }
4336
- static clear(a) {
4337
- a.length = 0;
4338
- this.invokeItemsEvent(a, "refresh", -1, null);
4339
- AtomBinder.refreshValue(a, "length");
4691
+ static create(name, attributes, ...children) {
4692
+ if (typeof name === "string") {
4693
+ return new XNode(name, attributes, children);
4694
+ }
4695
+ if (name[isFactorySymbol]) {
4696
+ return new XNode(name, attributes, children);
4697
+ }
4698
+ if (name.factory) {
4699
+ return name.factory(attributes, ...children);
4700
+ }
4701
+ switch (typeof name) {
4702
+ case "object":
4703
+ name = name.toString();
4704
+ break;
4705
+ case "function":
4706
+ return name(attributes || {}, ...children);
4707
+ }
4708
+ return new XNode(name, attributes, children);
4340
4709
  }
4341
- static addItem(a, item) {
4342
- const index = a.length;
4343
- a.push(item);
4344
- this.invokeItemsEvent(a, "add", index, item);
4345
- AtomBinder.refreshValue(a, "length");
4710
+ constructor(name, attributes, children, isProperty, isTemplate) {
4711
+ this.name = name;
4712
+ this.attributes = attributes;
4713
+ this.children = children;
4714
+ this.isProperty = isProperty;
4715
+ this.isTemplate = isTemplate;
4716
+ this[xnodeSymbol] = true;
4346
4717
  }
4347
- static removeItem(a, item) {
4348
- const i = a.findIndex(x => x === item);
4349
- if (i === -1) {
4350
- return false;
4718
+ toString() {
4719
+ if (typeof this.name === "string") {
4720
+ return `name is of type string and value is ${this.name}`;
4351
4721
  }
4352
- a.splice(i, 1);
4353
- AtomBinder.invokeItemsEvent(a, "remove", i, item);
4354
- AtomBinder.refreshValue(a, "length");
4355
- return true;
4722
+ return `name is of type ${typeof this.name}`;
4356
4723
  }
4357
4724
  });
4725
+ XNode.isFactory = isFactorySymbol;
4726
+ XNode.elementFactory = elementFactorySymbol;
4727
+ XNode.bindSymbol = bindSymbol;
4728
+ XNode.isTemplate = isTemplateSymbol;
4729
+ XNode.prepareAttached = attach;
4730
+ XNode.constructorNeedsArguments = constructorNeedsArgumentsSymbol;
4731
+ XNode.classes = {};
4732
+ XNode.factory = (name, isProperty, isTemplate) => (a, ...nodes) => {
4733
+ return new XNode(name, a, nodes, isProperty, isTemplate);
4734
+ };
4735
+ if (typeof bridge !== "undefined") {
4736
+ bridge.XNode = XNode;
4737
+ }
4358
4738
  }
4359
4739
  };
4360
4740
  });
4361
- //# sourceMappingURL=AtomBinder.js.map
4741
+ //# sourceMappingURL=XNode.js.map
4362
4742
 
4363
- AmdLoader.instance.setup("@web-atoms/core/dist/core/AtomBinder");
4743
+ AmdLoader.instance.setup("@web-atoms/core/dist/core/XNode");
4744
+
4745
+ System.register([], function (_export, _context) {
4746
+ "use strict";
4747
+
4748
+ function Pack(...a) {}
4749
+ _export("default", Pack);
4750
+ return {
4751
+ setters: [],
4752
+ execute: function () {}
4753
+ };
4754
+ });
4755
+ //# sourceMappingURL=Pack.js.map
4756
+
4757
+ AmdLoader.instance.setup("@web-atoms/core/dist/Pack");
4364
4758
 
4365
4759
  System.register([], function (_export, _context) {
4366
4760
  "use strict";
@@ -8980,7 +9374,7 @@ System.register(["tslib", "@web-atoms/core/dist/core/AtomBinder", "@web-atoms/co
8980
9374
 
8981
9375
  AmdLoader.instance.setup("@web-atoms/web-controls/dist/player/AtomVideoPlayer");
8982
9376
 
8983
- System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/dist/Pack", "@web-atoms/core/dist/style/styled", "@web-atoms/core/dist/web/controls/AtomControl", "@web-atoms/web-controls/dist/player/AtomVideoPlayer"], function (_export, _context) {
9377
+ System.register(["tslib", "../../../style/GlobalStyle", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/dist/Pack", "@web-atoms/core/dist/style/styled", "@web-atoms/core/dist/web/controls/AtomControl", "@web-atoms/web-controls/dist/player/AtomVideoPlayer"], function (_export, _context) {
8984
9378
  "use strict";
8985
9379
 
8986
9380
  var __awaiter, __decorate, __metadata, XNode, Pack, styled, AtomControl, AtomVideoPlayer, fileInfo, PreviewVideo;
@@ -8989,7 +9383,7 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/di
8989
9383
  __awaiter = _tslib.__awaiter;
8990
9384
  __decorate = _tslib.__decorate;
8991
9385
  __metadata = _tslib.__metadata;
8992
- }, function (_webAtomsCoreDistCoreXNode) {
9386
+ }, function (_styleGlobalStyle) {}, function (_webAtomsCoreDistCoreXNode) {
8993
9387
  XNode = _webAtomsCoreDistCoreXNode.default;
8994
9388
  }, function (_webAtomsCoreDistPack) {
8995
9389
  Pack = _webAtomsCoreDistPack.default;
@@ -9003,24 +9397,33 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/di
9003
9397
  execute: function () {
9004
9398
  styled.css`
9005
9399
 
9006
- display: grid;
9007
- grid-template-columns: 1fr;
9008
- grid-template-rows: 1fr auto;
9400
+ & [data-preview-video] {
9009
9401
 
9010
- align-items: stretch;
9011
- justify-content: stretch;
9012
- justify-items: stretch;
9402
+ position: absolute;
9403
+ left: 0;
9404
+ top: 0;
9405
+ right: 0;
9406
+ bottom: 0;
9013
9407
 
9014
- & [video-player] {
9015
- grid-row: 1;
9016
- }
9408
+ display: grid;
9409
+ grid-template-columns: 1fr;
9410
+ grid-template-rows: 1fr auto;
9017
9411
 
9018
- & > footer {
9019
- grid-row: 2;
9412
+ align-items: stretch;
9413
+ justify-content: stretch;
9414
+ justify-items: stretch;
9415
+
9416
+ & [video-player] {
9417
+ grid-row: 1;
9418
+ }
9419
+
9420
+ & > footer {
9421
+ grid-row: 2;
9422
+ }
9020
9423
  }
9021
9424
 
9022
9425
 
9023
- `.installGlobal("[data-preview-video]");
9426
+ `.installGlobal("body");
9024
9427
  fileInfo = window.fileInfo;
9025
9428
  if (!fileInfo) {
9026
9429
  fileInfo = window.fileInfo = {};
@@ -9032,6 +9435,7 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/di
9032
9435
  PreviewVideo = class PreviewVideo extends AtomControl {
9033
9436
  constructor(app, e) {
9034
9437
  super(app, e);
9438
+ this.element.setAttribute("data-preview-video", "preview-video");
9035
9439
  this.pushInit();
9036
9440
  }
9037
9441
  init() {