native-document 1.0.67 → 1.0.69

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.
@@ -343,6 +343,7 @@ var NativeDocument = (function (exports) {
343
343
 
344
344
  operations = operations || DEFAULT_OPERATIONS;
345
345
  for(let i = 0, length = $listeners.length; i < length; i++) {
346
+ $listeners[i];
346
347
  $listeners[i]($currentValue, $previousValue, operations);
347
348
  }
348
349
  };
@@ -360,6 +361,7 @@ var NativeDocument = (function (exports) {
360
361
  callback.set ? callback.set(value) : callback(value);
361
362
  });
362
363
  };
364
+
363
365
  ObservableItem.prototype.triggerWatchers = function() {
364
366
  if(!this.$watchers) {
365
367
  return;
@@ -597,7 +599,6 @@ var NativeDocument = (function (exports) {
597
599
  },
598
600
  checkMutation: function(mutationsList) {
599
601
  for(const mutation of mutationsList) {
600
- console.log({ mutation });
601
602
  if(DocumentObserver.mountedSupposedSize > 0 ) {
602
603
  for(const node of mutation.addedNodes) {
603
604
  DocumentObserver.executeMountedCallback(node);
@@ -1357,18 +1358,18 @@ var NativeDocument = (function (exports) {
1357
1358
  * @returns {ObservableItem}
1358
1359
  * @constructor
1359
1360
  */
1360
- function Observable(value, configs = null) {
1361
+ function Observable$1(value, configs = null) {
1361
1362
  return new ObservableItem(value, configs);
1362
1363
  }
1363
1364
 
1364
- const $ = Observable;
1365
- const obs = Observable;
1365
+ const $ = Observable$1;
1366
+ const obs = Observable$1;
1366
1367
 
1367
1368
  /**
1368
1369
  *
1369
1370
  * @param {string} propertyName
1370
1371
  */
1371
- Observable.useValueProperty = function(propertyName = 'value') {
1372
+ Observable$1.useValueProperty = function(propertyName = 'value') {
1372
1373
  Object.defineProperty(ObservableItem.prototype, propertyName, {
1373
1374
  get() {
1374
1375
  return this.$currentValue;
@@ -1386,7 +1387,7 @@ var NativeDocument = (function (exports) {
1386
1387
  * @param id
1387
1388
  * @returns {ObservableItem|null}
1388
1389
  */
1389
- Observable.getById = function(id) {
1390
+ Observable$1.getById = function(id) {
1390
1391
  const item = MemoryManager.getObservableById(parseInt(id));
1391
1392
  if(!item) {
1392
1393
  throw new NativeDocumentError('Observable.getById : No observable found with id ' + id);
@@ -1398,7 +1399,7 @@ var NativeDocument = (function (exports) {
1398
1399
  *
1399
1400
  * @param {ObservableItem} observable
1400
1401
  */
1401
- Observable.cleanup = function(observable) {
1402
+ Observable$1.cleanup = function(observable) {
1402
1403
  observable.cleanup();
1403
1404
  };
1404
1405
 
@@ -1407,7 +1408,7 @@ var NativeDocument = (function (exports) {
1407
1408
  * @param {Boolean} enable
1408
1409
  * @param {{interval:Boolean, threshold:number}} options
1409
1410
  */
1410
- Observable.autoCleanup = function(enable = false, options = {}) {
1411
+ Observable$1.autoCleanup = function(enable = false, options = {}) {
1411
1412
  if(!enable) {
1412
1413
  return;
1413
1414
  }
@@ -1555,7 +1556,7 @@ var NativeDocument = (function (exports) {
1555
1556
  continue;
1556
1557
  }
1557
1558
  const observables = value.filter(item => Validator.isObservable(item));
1558
- value = Observable.computed(() => {
1559
+ value = Observable$1.computed(() => {
1559
1560
  return value.map(item => Validator.isObservable(item) ? item.val() : item).join(' ') || ' ';
1560
1561
  }, observables);
1561
1562
  }
@@ -2204,7 +2205,7 @@ var NativeDocument = (function (exports) {
2204
2205
  String.prototype.use = function(args) {
2205
2206
  const value = this;
2206
2207
 
2207
- return Observable.computed(() => {
2208
+ return Observable$1.computed(() => {
2208
2209
  return value.replace(/\$\{(.*?)}/g, (match, key) => {
2209
2210
  const data = args[key];
2210
2211
  if(Validator.isObservable(data)) {
@@ -2224,7 +2225,7 @@ var NativeDocument = (function (exports) {
2224
2225
  return value;
2225
2226
  }
2226
2227
  const [_, id] = value.match(/\{\{#ObItem::\(([0-9]+)\)\}\}/);
2227
- return Observable.getById(id);
2228
+ return Observable$1.getById(id);
2228
2229
  });
2229
2230
  };
2230
2231
 
@@ -2322,6 +2323,355 @@ var NativeDocument = (function (exports) {
2322
2323
  });
2323
2324
  };
2324
2325
 
2326
+ function toDate(value) {
2327
+ if (value instanceof Date) return value;
2328
+ return new Date(value);
2329
+ }
2330
+
2331
+ function isSameDay(date1, date2) {
2332
+ const d1 = toDate(date1);
2333
+ const d2 = toDate(date2);
2334
+ return d1.getFullYear() === d2.getFullYear() &&
2335
+ d1.getMonth() === d2.getMonth() &&
2336
+ d1.getDate() === d2.getDate();
2337
+ }
2338
+
2339
+ function getSecondsOfDay(date) {
2340
+ const d = toDate(date);
2341
+ return (d.getHours() * 3600) + (d.getMinutes() * 60) + d.getSeconds();
2342
+ }
2343
+
2344
+ function createFilter(observableOrValue, callbackFn){
2345
+ const isObservable = Validator.isObservable(observableOrValue);
2346
+
2347
+ return {
2348
+ dependencies: isObservable ? observableOrValue : null,
2349
+ callback: (value) => callbackFn(value, isObservable ? observableOrValue.val() : observableOrValue)
2350
+ };
2351
+ }
2352
+
2353
+ function createMultiSourceFilter(sources, callbackFn){
2354
+ const observables = sources.filter(Validator.isObservable);
2355
+
2356
+ const getValues = () => sources.map(src =>
2357
+ Validator.isObservable(src) ? src.val() : src
2358
+ );
2359
+
2360
+ return {
2361
+ dependencies: observables.length > 0 ? observables : null,
2362
+ callback: (value) => callbackFn(value, getValues())
2363
+ };
2364
+ }
2365
+
2366
+ function equals(observableOrValue){
2367
+ return createFilter(observableOrValue, (value, target) => value === target);
2368
+ }
2369
+
2370
+ function notEquals(observableOrValue){
2371
+ return createFilter(observableOrValue, (value, target) => value !== target);
2372
+ }
2373
+
2374
+ function greaterThan(observableOrValue){
2375
+ return createFilter(observableOrValue, (value, target) => value > target);
2376
+ }
2377
+
2378
+ function greaterThanOrEqual(observableOrValue){
2379
+ return createFilter(observableOrValue, (value, target) => value >= target);
2380
+ }
2381
+
2382
+ function lessThan(observableOrValue){
2383
+ return createFilter(observableOrValue, (value, target) => value < target);
2384
+ }
2385
+
2386
+ function lessThanOrEqual(observableOrValue){
2387
+ return createFilter(observableOrValue, (value, target) => value <= target);
2388
+ }
2389
+
2390
+ function between(minObservableOrValue, maxObservableOrValue){
2391
+ return createMultiSourceFilter(
2392
+ [minObservableOrValue, maxObservableOrValue],
2393
+ (value, [min, max]) => value >= min && value <= max
2394
+ );
2395
+ }
2396
+
2397
+ function In(observableOrArray){
2398
+ return createFilter(observableOrArray, (value, arr) => arr.includes(value));
2399
+ }
2400
+
2401
+ function notIn(observableOrArray){
2402
+ return createFilter(observableOrArray, (value, arr) => !arr.includes(value));
2403
+ }
2404
+
2405
+ function isEmpty(observableOrValue = true){
2406
+ return createFilter(observableOrValue, (value, shouldBeEmpty) => {
2407
+ const isActuallyEmpty = !value || value === '' ||
2408
+ (Array.isArray(value) && value.length === 0);
2409
+
2410
+ return shouldBeEmpty ? isActuallyEmpty : !isActuallyEmpty;
2411
+ });
2412
+ }
2413
+
2414
+ function isNotEmpty(observableOrValue = true){
2415
+ return createFilter(observableOrValue, (value, shouldBeNotEmpty) => {
2416
+ const isActuallyNotEmpty = !!value && value !== '' &&
2417
+ (!Array.isArray(value) || value.length > 0);
2418
+
2419
+ return shouldBeNotEmpty ? isActuallyNotEmpty : !isActuallyNotEmpty;
2420
+ });
2421
+ }
2422
+
2423
+ function match(patternObservableOrValue, asRegexObservableOrValue = true, flagsObservableOrValue = ''){
2424
+ return createMultiSourceFilter(
2425
+ [patternObservableOrValue, asRegexObservableOrValue, flagsObservableOrValue],
2426
+ (value, [pattern, asRegex, flags]) => {
2427
+ if (!pattern) return true;
2428
+
2429
+ if (asRegex){
2430
+ try {
2431
+ const regex = new RegExp(pattern, flags);
2432
+ return regex.test(String(value));
2433
+ } catch (error){
2434
+ console.warn('Invalid regex pattern:', pattern, error);
2435
+ return false;
2436
+ }
2437
+ }
2438
+
2439
+ if (!flags || flags === ''){
2440
+ return String(value).toLowerCase().includes(String(pattern).toLowerCase());
2441
+ }
2442
+ return String(value).includes(String(pattern));
2443
+ }
2444
+ );
2445
+ }
2446
+
2447
+ function and(...filters){
2448
+ const dependencies = filters
2449
+ .flatMap(f => f.dependencies ? (Array.isArray(f.dependencies) ? f.dependencies : [f.dependencies]) : [])
2450
+ .filter(Validator.isObservable);
2451
+
2452
+ return {
2453
+ dependencies: dependencies.length > 0 ? dependencies : null,
2454
+ callback: (value) => filters.every(f => f.callback(value))
2455
+ };
2456
+ }
2457
+
2458
+ function or(...filters){
2459
+ const dependencies = filters
2460
+ .flatMap(f => f.dependencies ? (Array.isArray(f.dependencies) ? f.dependencies : [f.dependencies]) : [])
2461
+ .filter(Validator.isObservable);
2462
+
2463
+ return {
2464
+ dependencies: dependencies.length > 0 ? dependencies : null,
2465
+ callback: (value) => filters.some(f => f.callback(value))
2466
+ };
2467
+ }
2468
+
2469
+ function not(filter){
2470
+ return {
2471
+ dependencies: filter.dependencies,
2472
+ callback: (value) => !filter.callback(value)
2473
+ };
2474
+ }
2475
+
2476
+ function custom(callbackFn, ...observables){
2477
+ const dependencies = observables.filter(Validator.isObservable);
2478
+
2479
+ return {
2480
+ dependencies: dependencies.length > 0 ? dependencies : null,
2481
+ callback: (value) => {
2482
+ const values = observables.map(o =>
2483
+ Validator.isObservable(o) ? o.val() : o
2484
+ );
2485
+ return callbackFn(value, ...values);
2486
+ }
2487
+ };
2488
+ }
2489
+
2490
+ const gt = greaterThan;
2491
+ const gte = greaterThanOrEqual;
2492
+ const lt = lessThan;
2493
+ const lte = lessThanOrEqual;
2494
+ const eq = equals;
2495
+ const neq = notEquals;
2496
+ const all = and;
2497
+ const any = or;
2498
+
2499
+ const dateEquals = (observableOrValue) => {
2500
+ return createFilter(observableOrValue, (value, target) => {
2501
+ if (!value || !target) return false;
2502
+ return isSameDay(value, target);
2503
+ });
2504
+ };
2505
+
2506
+ const dateBefore = (observableOrValue) => {
2507
+ return createFilter(observableOrValue, (value, target) => {
2508
+ if (!value || !target) return false;
2509
+ return toDate(value) < toDate(target);
2510
+ });
2511
+ };
2512
+
2513
+ const dateAfter = (observableOrValue) => {
2514
+ return createFilter(observableOrValue, (value, target) => {
2515
+ if (!value || !target) return false;
2516
+ return toDate(value) > toDate(target);
2517
+ });
2518
+ };
2519
+
2520
+ const dateBetween = (startObservableOrValue, endObservableOrValue) => {
2521
+ return createMultiSourceFilter(
2522
+ [startObservableOrValue, endObservableOrValue],
2523
+ (value, [start, end]) => {
2524
+ if (!value || !start || !end) return false;
2525
+ const date = toDate(value);
2526
+ return date >= toDate(start) && date <= toDate(end);
2527
+ }
2528
+ );
2529
+ };
2530
+
2531
+ const timeEquals = (observableOrValue) => {
2532
+ return createFilter(observableOrValue, (value, target) => {
2533
+ if (!value || !target) return false;
2534
+ const d1 = toDate(value);
2535
+ const d2 = toDate(target);
2536
+ return d1.getHours() === d2.getHours() &&
2537
+ d1.getMinutes() === d2.getMinutes() &&
2538
+ d1.getSeconds() === d2.getSeconds();
2539
+ });
2540
+ };
2541
+
2542
+ const timeAfter = (observableOrValue) => {
2543
+ return createFilter(observableOrValue, (value, target) => {
2544
+ return getSecondsOfDay(value) > getSecondsOfDay(target);
2545
+ });
2546
+ };
2547
+
2548
+ const timeBefore = (observableOrValue) => {
2549
+ return createFilter(observableOrValue, (value, target) => {
2550
+ return getSecondsOfDay(value) < getSecondsOfDay(target);
2551
+ });
2552
+ };
2553
+
2554
+ const timeBetween = (startObservableOrValue, endObservableOrValue) => {
2555
+ return createMultiSourceFilter([startObservableOrValue, endObservableOrValue],
2556
+ (value, [start, end]) => {
2557
+ if (!value || !start || !end) return false;
2558
+ const date = getSecondsOfDay(value);
2559
+ return date >= getSecondsOfDay(start) && date <= getSecondsOfDay(end);
2560
+ }
2561
+ );
2562
+ };
2563
+
2564
+ const dateTimeEquals = (observableOrValue) => {
2565
+ return createFilter(observableOrValue, (value, target) => {
2566
+ if (!value || !target) return false;
2567
+ return toDate(value).getTime() === toDate(target).getTime();
2568
+ });
2569
+ };
2570
+
2571
+ const dateTimeAfter = (observableOrValue) => {
2572
+ return createFilter(observableOrValue, (value, target) => {
2573
+ if (!value || !target) return false;
2574
+ return toDate(value) > toDate(target);
2575
+ });
2576
+ };
2577
+
2578
+ const dateTimeBefore = (observableOrValue) => {
2579
+ return createFilter(observableOrValue, (value, target) => {
2580
+ if (!value || !target) return false;
2581
+ return toDate(value) < toDate(target);
2582
+ });
2583
+ };
2584
+
2585
+ const dateTimeBetween = (startObservableOrValue, endObservableOrValue) => {
2586
+ return createMultiSourceFilter([startObservableOrValue, endObservableOrValue], (value, [start, end]) => {
2587
+ if (!value || !start || !end) return false;
2588
+ const date = toDate(value);
2589
+ return date >= toDate(start) && date <= toDate(end);
2590
+ });
2591
+ };
2592
+
2593
+ function includes(observableOrValue, caseSensitive = false){
2594
+ return createFilter(observableOrValue, (value, query) => {
2595
+ if (!value) return false;
2596
+ if (!query) return true;
2597
+ if (!caseSensitive){
2598
+ return String(value).toLowerCase().includes(String(query).toLowerCase());
2599
+ }
2600
+ return String(value).includes(String(query));
2601
+ });
2602
+ }
2603
+
2604
+ const contains = includes;
2605
+
2606
+ function startsWith(observableOrValue, caseSensitive = false){
2607
+ return createFilter(observableOrValue, (value, query) => {
2608
+ if (!query) return true;
2609
+ if (!caseSensitive){
2610
+ return String(value).toLowerCase().startsWith(String(query).toLowerCase());
2611
+ }
2612
+ return String(value).startsWith(String(query));
2613
+ });
2614
+ }
2615
+
2616
+ function endsWith(observableOrValue, caseSensitive = false){
2617
+ return createFilter(observableOrValue, (value, query) => {
2618
+ if (!query) return true;
2619
+ if (!caseSensitive){
2620
+ return String(value).toLowerCase().endsWith(String(query).toLowerCase());
2621
+ }
2622
+ return String(value).endsWith(String(query));
2623
+ });
2624
+ }
2625
+
2626
+ var index = /*#__PURE__*/Object.freeze({
2627
+ __proto__: null,
2628
+ In: In,
2629
+ all: all,
2630
+ and: and,
2631
+ any: any,
2632
+ between: between,
2633
+ contains: contains,
2634
+ createFilter: createFilter,
2635
+ createMultiSourceFilter: createMultiSourceFilter,
2636
+ custom: custom,
2637
+ dateAfter: dateAfter,
2638
+ dateBefore: dateBefore,
2639
+ dateBetween: dateBetween,
2640
+ dateEquals: dateEquals,
2641
+ dateTimeAfter: dateTimeAfter,
2642
+ dateTimeBefore: dateTimeBefore,
2643
+ dateTimeBetween: dateTimeBetween,
2644
+ dateTimeEquals: dateTimeEquals,
2645
+ endsWith: endsWith,
2646
+ eq: eq,
2647
+ equals: equals,
2648
+ getSecondsOfDay: getSecondsOfDay,
2649
+ greaterThan: greaterThan,
2650
+ greaterThanOrEqual: greaterThanOrEqual,
2651
+ gt: gt,
2652
+ gte: gte,
2653
+ includes: includes,
2654
+ isEmpty: isEmpty,
2655
+ isNotEmpty: isNotEmpty,
2656
+ isSameDay: isSameDay,
2657
+ lessThan: lessThan,
2658
+ lessThanOrEqual: lessThanOrEqual,
2659
+ lt: lt,
2660
+ lte: lte,
2661
+ match: match,
2662
+ neq: neq,
2663
+ not: not,
2664
+ notEquals: notEquals,
2665
+ notIn: notIn,
2666
+ or: or,
2667
+ startsWith: startsWith,
2668
+ timeAfter: timeAfter,
2669
+ timeBefore: timeBefore,
2670
+ timeBetween: timeBetween,
2671
+ timeEquals: timeEquals,
2672
+ toDate: toDate
2673
+ });
2674
+
2325
2675
  const mutationMethods = ['push', 'pop', 'shift', 'unshift', 'reverse', 'sort', 'splice'];
2326
2676
  const noMutationMethods = ['map', 'forEach', 'filter', 'reduce', 'some', 'every', 'find', 'findIndex', 'concat', 'includes', 'indexOf'];
2327
2677
 
@@ -2332,7 +2682,7 @@ var NativeDocument = (function (exports) {
2332
2682
  * @param {{propagation: boolean, deep: boolean, reset: boolean}|null} configs
2333
2683
  * @constructor
2334
2684
  */
2335
- const ObservableArray = function (target, configs) {
2685
+ const ObservableArray = function (target, configs = null) {
2336
2686
  if(!Array.isArray(target)) {
2337
2687
  throw new NativeDocumentError('Observable.array : target must be an array');
2338
2688
  }
@@ -2434,13 +2784,80 @@ var NativeDocument = (function (exports) {
2434
2784
  this.trigger({ action: 'populate', args: [this.$currentValue, iteration, callback] });
2435
2785
  };
2436
2786
 
2787
+
2788
+ ObservableArray.prototype.where = function(predicates) {
2789
+ const sourceArray = this;
2790
+ const observableDependencies = [sourceArray];
2791
+ const filterCallbacks = {};
2792
+
2793
+ for (const [key, rawPredicate] of Object.entries(predicates)) {
2794
+ const predicate = Validator.isObservable(rawPredicate) ? match(rawPredicate, false) : rawPredicate;
2795
+ if (predicate && typeof predicate === 'object' && 'callback' in predicate) {
2796
+ filterCallbacks[key] = predicate.callback;
2797
+
2798
+ if (predicate.dependencies) {
2799
+ const deps = Array.isArray(predicate.dependencies)
2800
+ ? predicate.dependencies
2801
+ : [predicate.dependencies];
2802
+ observableDependencies.push(...deps);
2803
+ }
2804
+ } else if(typeof predicate === 'function') {
2805
+ filterCallbacks[key] = predicate;
2806
+ } else {
2807
+ filterCallbacks[key] = (value) => value === predicate;
2808
+ }
2809
+ }
2810
+
2811
+ const viewArray = Observable.array();
2812
+
2813
+ const filters = Object.entries(filterCallbacks);
2814
+ const updateView = () => {
2815
+ const filtered = sourceArray.val().filter(item => {
2816
+ for (const [key, callback] of filters) {
2817
+ if(key === '_') {
2818
+ if (!callback(item)) return false;
2819
+ } else {
2820
+ if (!callback(item[key])) return false;
2821
+ }
2822
+ }
2823
+ return true;
2824
+ });
2825
+
2826
+ viewArray.set(filtered);
2827
+ };
2828
+
2829
+ observableDependencies.forEach(dep => dep.subscribe(updateView));
2830
+
2831
+ updateView();
2832
+
2833
+ return viewArray;
2834
+ };
2835
+
2836
+ ObservableArray.prototype.whereSome = function(fields, filter) {
2837
+ return this.where({
2838
+ _: {
2839
+ dependencies: filter.dependencies,
2840
+ callback: (item) => fields.some(field => filter.callback(item[field]))
2841
+ }
2842
+ });
2843
+ };
2844
+
2845
+ ObservableArray.prototype.whereEvery = function(fields, filter) {
2846
+ return this.where({
2847
+ _: {
2848
+ dependencies: filter.dependencies,
2849
+ callback: (item) => fields.every(field => filter.callback(item[field]))
2850
+ }
2851
+ });
2852
+ };
2853
+
2437
2854
  /**
2438
2855
  *
2439
2856
  * @param {Array} target
2440
2857
  * @param {{propagation: boolean, deep: boolean, reset: boolean}|null} configs
2441
2858
  * @returns {ObservableArray}
2442
2859
  */
2443
- Observable.array = function(target, configs = null) {
2860
+ Observable$1.array = function(target = [], configs = null) {
2444
2861
  return new ObservableArray(target, configs);
2445
2862
  };
2446
2863
 
@@ -2449,8 +2866,8 @@ var NativeDocument = (function (exports) {
2449
2866
  * @param {Function} callback
2450
2867
  * @returns {Function}
2451
2868
  */
2452
- Observable.batch = function(callback) {
2453
- const $observer = Observable(0);
2869
+ Observable$1.batch = function(callback) {
2870
+ const $observer = Observable$1(0);
2454
2871
  const batch = function() {
2455
2872
  if(Validator.isAsyncFunction(callback)) {
2456
2873
  return (callback(...arguments)).then(() => {
@@ -2508,7 +2925,7 @@ var NativeDocument = (function (exports) {
2508
2925
  * @param {{propagation: boolean, deep: boolean, reset: boolean}|null} configs
2509
2926
  * @returns {Proxy}
2510
2927
  */
2511
- Observable.init = function(initialValue, configs = null) {
2928
+ Observable$1.init = function(initialValue, configs = null) {
2512
2929
  const data = {};
2513
2930
  for(const key in initialValue) {
2514
2931
  const itemValue = initialValue[key];
@@ -2516,24 +2933,24 @@ var NativeDocument = (function (exports) {
2516
2933
  if(configs?.deep !== false) {
2517
2934
  const mappedItemValue = itemValue.map(item => {
2518
2935
  if(Validator.isJson(item)) {
2519
- return Observable.json(item, configs);
2936
+ return Observable$1.json(item, configs);
2520
2937
  }
2521
2938
  if(Validator.isArray(item)) {
2522
- return Observable.array(item, configs);
2939
+ return Observable$1.array(item, configs);
2523
2940
  }
2524
- return Observable(item, configs);
2941
+ return Observable$1(item, configs);
2525
2942
  });
2526
- data[key] = Observable.array(mappedItemValue, configs);
2943
+ data[key] = Observable$1.array(mappedItemValue, configs);
2527
2944
  continue;
2528
2945
  }
2529
- data[key] = Observable.array(itemValue, configs);
2946
+ data[key] = Observable$1.array(itemValue, configs);
2530
2947
  continue;
2531
2948
  }
2532
2949
  if(Validator.isObservable(itemValue) || Validator.isProxy(itemValue)) {
2533
2950
  data[key] = itemValue;
2534
2951
  continue;
2535
2952
  }
2536
- data[key] = Observable(itemValue, configs);
2953
+ data[key] = Observable$1(itemValue, configs);
2537
2954
  }
2538
2955
 
2539
2956
  const $reset = () => {
@@ -2545,10 +2962,10 @@ var NativeDocument = (function (exports) {
2545
2962
 
2546
2963
  const $val = () => ObservableObjectValue(data);
2547
2964
 
2548
- const $clone = () => Observable.init($val(), configs);
2965
+ const $clone = () => Observable$1.init($val(), configs);
2549
2966
 
2550
2967
  const $updateWith = (values) => {
2551
- Observable.update(proxy, values);
2968
+ Observable$1.update(proxy, values);
2552
2969
  };
2553
2970
 
2554
2971
  const $get = (key) => ObservableGet(data, key);
@@ -2586,8 +3003,8 @@ var NativeDocument = (function (exports) {
2586
3003
  * @param {any[]} data
2587
3004
  * @return Proxy[]
2588
3005
  */
2589
- Observable.arrayOfObject = function(data) {
2590
- return data.map(item => Observable.object(item));
3006
+ Observable$1.arrayOfObject = function(data) {
3007
+ return data.map(item => Observable$1.object(item));
2591
3008
  };
2592
3009
 
2593
3010
  /**
@@ -2595,7 +3012,7 @@ var NativeDocument = (function (exports) {
2595
3012
  * @param {ObservableItem|Object<ObservableItem>} data
2596
3013
  * @returns {{}|*|null}
2597
3014
  */
2598
- Observable.value = function(data) {
3015
+ Observable$1.value = function(data) {
2599
3016
  if(Validator.isObservable(data)) {
2600
3017
  return data.val();
2601
3018
  }
@@ -2606,7 +3023,7 @@ var NativeDocument = (function (exports) {
2606
3023
  const result = [];
2607
3024
  for(let i = 0, length = data.length; i < length; i++) {
2608
3025
  const item = data[i];
2609
- result.push(Observable.value(item));
3026
+ result.push(Observable$1.value(item));
2610
3027
  }
2611
3028
  return result;
2612
3029
  }
@@ -2614,7 +3031,7 @@ var NativeDocument = (function (exports) {
2614
3031
  };
2615
3032
 
2616
3033
 
2617
- Observable.update = function($target, newData) {
3034
+ Observable$1.update = function($target, newData) {
2618
3035
  const data = Validator.isProxy(newData) ? newData.$value : newData;
2619
3036
  const configs = $target.configs;
2620
3037
 
@@ -2629,9 +3046,9 @@ var NativeDocument = (function (exports) {
2629
3046
  if(Validator.isObservable(firstElementFromOriginalValue) || Validator.isProxy(firstElementFromOriginalValue)) {
2630
3047
  const newValues = newValue.map(item => {
2631
3048
  if(Validator.isProxy(firstElementFromOriginalValue)) {
2632
- return Observable.init(item, configs);
3049
+ return Observable$1.init(item, configs);
2633
3050
  }
2634
- return Observable(item, configs);
3051
+ return Observable$1(item, configs);
2635
3052
  });
2636
3053
  targetItem.set(newValues);
2637
3054
  continue;
@@ -2643,15 +3060,15 @@ var NativeDocument = (function (exports) {
2643
3060
  continue;
2644
3061
  }
2645
3062
  if(Validator.isProxy(targetItem)) {
2646
- Observable.update(targetItem, newValue);
3063
+ Observable$1.update(targetItem, newValue);
2647
3064
  continue;
2648
3065
  }
2649
3066
  $target[key] = newValue;
2650
3067
  }
2651
3068
  };
2652
3069
 
2653
- Observable.object = Observable.init;
2654
- Observable.json = Observable.init;
3070
+ Observable$1.object = Observable$1.init;
3071
+ Observable$1.json = Observable$1.init;
2655
3072
 
2656
3073
  /**
2657
3074
  *
@@ -2659,7 +3076,7 @@ var NativeDocument = (function (exports) {
2659
3076
  * @param {Array|Function} dependencies
2660
3077
  * @returns {ObservableItem}
2661
3078
  */
2662
- Observable.computed = function(callback, dependencies = []) {
3079
+ Observable$1.computed = function(callback, dependencies = []) {
2663
3080
  const initialValue = callback();
2664
3081
  const observable = new ObservableItem(initialValue);
2665
3082
  const updatedValue = () => observable.set(callback());
@@ -2699,7 +3116,7 @@ var NativeDocument = (function (exports) {
2699
3116
  */
2700
3117
  use(name) {
2701
3118
  const {observer: originalObserver, subscribers } = $stores.get(name);
2702
- const observerFollower = Observable(originalObserver.val());
3119
+ const observerFollower = Observable$1(originalObserver.val());
2703
3120
  const unSubscriber = originalObserver.subscribe(value => observerFollower.set(value));
2704
3121
  const updaterUnsubscriber = observerFollower.subscribe(value => originalObserver.set(value));
2705
3122
  observerFollower.destroy = () => {
@@ -2725,7 +3142,7 @@ var NativeDocument = (function (exports) {
2725
3142
  * @returns {ObservableItem}
2726
3143
  */
2727
3144
  create(name, value) {
2728
- const observer = Observable(value);
3145
+ const observer = Observable$1(value);
2729
3146
  $stores.set(name, { observer, subscribers: new Set()});
2730
3147
  return observer;
2731
3148
  },
@@ -2816,7 +3233,7 @@ var NativeDocument = (function (exports) {
2816
3233
  }
2817
3234
 
2818
3235
  try {
2819
- const indexObserver = callback.length >= 2 ? Observable(indexKey) : null;
3236
+ const indexObserver = callback.length >= 2 ? Observable$1(indexKey) : null;
2820
3237
  let child = ElementCreator.getChild(callback(item, indexObserver));
2821
3238
  if(!child) {
2822
3239
  throw new NativeDocumentError("ForEach child can't be null or undefined!");
@@ -2989,7 +3406,7 @@ var NativeDocument = (function (exports) {
2989
3406
  cache.delete(keyId);
2990
3407
  }
2991
3408
 
2992
- const indexObserver = isIndexRequired ? Observable(indexKey) : null;
3409
+ const indexObserver = isIndexRequired ? Observable$1(indexKey) : null;
2993
3410
  let child = ElementCreator.getChild(callback(item, indexObserver));
2994
3411
  if(!child) {
2995
3412
  throw new NativeDocumentError("ForEachArray child can't be null or undefined!");
@@ -3235,7 +3652,7 @@ var NativeDocument = (function (exports) {
3235
3652
  * @returns {DocumentFragment}
3236
3653
  */
3237
3654
  const HideIf = function(condition, child, configs) {
3238
- const hideCondition = Observable(!condition.val());
3655
+ const hideCondition = Observable$1(!condition.val());
3239
3656
  condition.subscribe(value => hideCondition.set(!value));
3240
3657
 
3241
3658
  return ShowIf(hideCondition, child, configs);
@@ -4509,6 +4926,7 @@ var NativeDocument = (function (exports) {
4509
4926
 
4510
4927
  var utils = /*#__PURE__*/Object.freeze({
4511
4928
  __proto__: null,
4929
+ Filters: index,
4512
4930
  NativeFetch: NativeFetch,
4513
4931
  Service: Service
4514
4932
  });
@@ -4517,7 +4935,7 @@ var NativeDocument = (function (exports) {
4517
4935
  exports.ElementCreator = ElementCreator;
4518
4936
  exports.HtmlElementWrapper = HtmlElementWrapper;
4519
4937
  exports.NDElement = NDElement;
4520
- exports.Observable = Observable;
4938
+ exports.Observable = Observable$1;
4521
4939
  exports.PluginsManager = PluginsManager;
4522
4940
  exports.SingletonView = SingletonView;
4523
4941
  exports.Store = Store;