@ngxs-labs/select-snapshot
Advanced tools
Comparing version 2.0.1 to 3.0.0
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@ngxs/store'), require('@angular/core')) : | ||
typeof define === 'function' && define.amd ? define('@ngxs-labs/select-snapshot', ['exports', '@ngxs/store', '@angular/core'], factory) : | ||
(global = global || self, factory((global['ngxs-labs'] = global['ngxs-labs'] || {}, global['ngxs-labs']['select-snapshot'] = {}), global['ngxs-store'], global.ng.core)); | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global['ngxs-labs'] = global['ngxs-labs'] || {}, global['ngxs-labs']['select-snapshot'] = {}), global['ngxs-store'], global.ng.core)); | ||
}(this, (function (exports, store, core) { 'use strict'; | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. All rights reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use | ||
this file except in compliance with the License. You may obtain a copy of the | ||
License at http://www.apache.org/licenses/LICENSE-2.0 | ||
Copyright (c) Microsoft Corporation. | ||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED | ||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, | ||
MERCHANTABLITY OR NON-INFRINGEMENT. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
See the Apache Version 2.0 License for specific language governing permissions | ||
and limitations under the License. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */ | ||
/* global Reflect, Promise */ | ||
var extendStatics = function(d, b) { | ||
var extendStatics = function (d, b) { | ||
extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
function (d, b) { for (var p in b) | ||
if (Object.prototype.hasOwnProperty.call(b, p)) | ||
d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
}; | ||
function __extends(d, b) { | ||
if (typeof b !== "function" && b !== null) | ||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); | ||
extendStatics(d, b); | ||
@@ -35,8 +37,9 @@ function __() { this.constructor = d; } | ||
} | ||
var __assign = function() { | ||
var __assign = function () { | ||
__assign = Object.assign || function __assign(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; | ||
for (var p in s) | ||
if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
@@ -47,7 +50,7 @@ return t; | ||
}; | ||
function __rest(s, e) { | ||
var t = {}; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) | ||
t[p] = s[p]; | ||
for (var p in s) | ||
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) | ||
t[p] = s[p]; | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") | ||
@@ -60,23 +63,34 @@ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
} | ||
function __decorate(decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") | ||
r = Reflect.decorate(decorators, target, key, desc); | ||
else | ||
for (var i = decorators.length - 1; i >= 0; i--) | ||
if (d = decorators[i]) | ||
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
} | ||
function __param(paramIndex, decorator) { | ||
return function (target, key) { decorator(target, key, paramIndex); } | ||
return function (target, key) { decorator(target, key, paramIndex); }; | ||
} | ||
function __metadata(metadataKey, metadataValue) { | ||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); | ||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") | ||
return Reflect.metadata(metadataKey, metadataValue); | ||
} | ||
function __awaiter(thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function fulfilled(value) { try { | ||
step(generator.next(value)); | ||
} | ||
catch (e) { | ||
reject(e); | ||
} } | ||
function rejected(value) { try { | ||
step(generator["throw"](value)); | ||
} | ||
catch (e) { | ||
reject(e); | ||
} } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
@@ -86,64 +100,124 @@ step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
} | ||
function __generator(thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
var _ = { label: 0, sent: function () { if (t[0] & 1) | ||
throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
function step(op) { | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (_) try { | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [op[0] & 2, t.value]; | ||
switch (op[0]) { | ||
case 0: case 1: t = op; break; | ||
case 4: _.label++; return { value: op[1], done: false }; | ||
case 5: _.label++; y = op[1]; op = [0]; continue; | ||
case 7: op = _.ops.pop(); _.trys.pop(); continue; | ||
default: | ||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | ||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | ||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | ||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | ||
if (t[2]) _.ops.pop(); | ||
_.trys.pop(); continue; | ||
if (f) | ||
throw new TypeError("Generator is already executing."); | ||
while (_) | ||
try { | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) | ||
return t; | ||
if (y = 0, t) | ||
op = [op[0] & 2, t.value]; | ||
switch (op[0]) { | ||
case 0: | ||
case 1: | ||
t = op; | ||
break; | ||
case 4: | ||
_.label++; | ||
return { value: op[1], done: false }; | ||
case 5: | ||
_.label++; | ||
y = op[1]; | ||
op = [0]; | ||
continue; | ||
case 7: | ||
op = _.ops.pop(); | ||
_.trys.pop(); | ||
continue; | ||
default: | ||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { | ||
_ = 0; | ||
continue; | ||
} | ||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { | ||
_.label = op[1]; | ||
break; | ||
} | ||
if (op[0] === 6 && _.label < t[1]) { | ||
_.label = t[1]; | ||
t = op; | ||
break; | ||
} | ||
if (t && _.label < t[2]) { | ||
_.label = t[2]; | ||
_.ops.push(op); | ||
break; | ||
} | ||
if (t[2]) | ||
_.ops.pop(); | ||
_.trys.pop(); | ||
continue; | ||
} | ||
op = body.call(thisArg, _); | ||
} | ||
op = body.call(thisArg, _); | ||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | ||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||
catch (e) { | ||
op = [6, e]; | ||
y = 0; | ||
} | ||
finally { | ||
f = t = 0; | ||
} | ||
if (op[0] & 5) | ||
throw op[1]; | ||
return { value: op[0] ? op[1] : void 0, done: true }; | ||
} | ||
} | ||
function __exportStar(m, exports) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
var __createBinding = Object.create ? (function (o, m, k, k2) { | ||
if (k2 === undefined) | ||
k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } }); | ||
}) : (function (o, m, k, k2) { | ||
if (k2 === undefined) | ||
k2 = k; | ||
o[k2] = m[k]; | ||
}); | ||
function __exportStar(m, o) { | ||
for (var p in m) | ||
if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) | ||
__createBinding(o, m, p); | ||
} | ||
function __values(o) { | ||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; | ||
if (m) return m.call(o); | ||
if (o && typeof o.length === "number") return { | ||
next: function () { | ||
if (o && i >= o.length) o = void 0; | ||
return { value: o && o[i++], done: !o }; | ||
} | ||
}; | ||
if (m) | ||
return m.call(o); | ||
if (o && typeof o.length === "number") | ||
return { | ||
next: function () { | ||
if (o && i >= o.length) | ||
o = void 0; | ||
return { value: o && o[i++], done: !o }; | ||
} | ||
}; | ||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); | ||
} | ||
function __read(o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
if (!m) | ||
return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) | ||
ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
catch (error) { | ||
e = { error: error }; | ||
} | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
if (r && !r.done && (m = i["return"])) | ||
m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
finally { | ||
if (e) | ||
throw e.error; | ||
} | ||
} | ||
return ar; | ||
} | ||
/** @deprecated */ | ||
function __spread() { | ||
@@ -154,5 +228,6 @@ for (var ar = [], i = 0; i < arguments.length; i++) | ||
} | ||
/** @deprecated */ | ||
function __spreadArrays() { | ||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; | ||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) | ||
s += arguments[i].length; | ||
for (var r = Array(s), k = 0, i = 0; i < il; i++) | ||
@@ -162,20 +237,30 @@ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) | ||
return r; | ||
}; | ||
} | ||
function __spreadArray(to, from) { | ||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) | ||
to[j] = from[i]; | ||
return to; | ||
} | ||
function __await(v) { | ||
return this instanceof __await ? (this.v = v, this) : new __await(v); | ||
} | ||
function __asyncGenerator(thisArg, _arguments, generator) { | ||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); | ||
if (!Symbol.asyncIterator) | ||
throw new TypeError("Symbol.asyncIterator is not defined."); | ||
var g = generator.apply(thisArg, _arguments || []), i, q = []; | ||
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; | ||
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } | ||
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } | ||
function verb(n) { if (g[n]) | ||
i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } | ||
function resume(n, v) { try { | ||
step(g[n](v)); | ||
} | ||
catch (e) { | ||
settle(q[0][3], e); | ||
} } | ||
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } | ||
function fulfill(value) { resume("next", value); } | ||
function reject(value) { resume("throw", value); } | ||
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } | ||
function settle(f, v) { if (f(v), q.shift(), q.length) | ||
resume(q[0][0], q[0][1]); } | ||
} | ||
function __asyncDelegator(o) { | ||
@@ -186,41 +271,54 @@ var i, p; | ||
} | ||
function __asyncValues(o) { | ||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); | ||
if (!Symbol.asyncIterator) | ||
throw new TypeError("Symbol.asyncIterator is not defined."); | ||
var m = o[Symbol.asyncIterator], i; | ||
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); | ||
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } | ||
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } | ||
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); } | ||
} | ||
function __makeTemplateObject(cooked, raw) { | ||
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } | ||
if (Object.defineProperty) { | ||
Object.defineProperty(cooked, "raw", { value: raw }); | ||
} | ||
else { | ||
cooked.raw = raw; | ||
} | ||
return cooked; | ||
} | ||
; | ||
var __setModuleDefault = Object.create ? (function (o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function (o, v) { | ||
o["default"] = v; | ||
}; | ||
function __importStar(mod) { | ||
if (mod && mod.__esModule) return mod; | ||
if (mod && mod.__esModule) | ||
return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result.default = mod; | ||
if (mod != null) | ||
for (var k in mod) | ||
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) | ||
__createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
} | ||
function __importDefault(mod) { | ||
return (mod && mod.__esModule) ? mod : { default: mod }; | ||
} | ||
function __classPrivateFieldGet(receiver, privateMap) { | ||
if (!privateMap.has(receiver)) { | ||
throw new TypeError("attempted to get private field on non-instance"); | ||
} | ||
return privateMap.get(receiver); | ||
function __classPrivateFieldGet(receiver, state, kind, f) { | ||
if (kind === "a" && !f) | ||
throw new TypeError("Private accessor was defined without a getter"); | ||
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) | ||
throw new TypeError("Cannot read private member from an object whose class did not declare it"); | ||
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); | ||
} | ||
function __classPrivateFieldSet(receiver, privateMap, value) { | ||
if (!privateMap.has(receiver)) { | ||
throw new TypeError("attempted to set private field on non-instance"); | ||
} | ||
privateMap.set(receiver, value); | ||
return value; | ||
function __classPrivateFieldSet(receiver, state, value, kind, f) { | ||
if (kind === "m") | ||
throw new TypeError("Private method is not writable"); | ||
if (kind === "a" && !f) | ||
throw new TypeError("Private accessor was defined without a setter"); | ||
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) | ||
throw new TypeError("Cannot write private member to an object whose class did not declare it"); | ||
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; | ||
} | ||
@@ -258,2 +356,5 @@ | ||
function removeDollarAtTheEnd(name) { | ||
if (typeof name !== 'string') { | ||
name = name.toString(); | ||
} | ||
var lastCharIndex = name.length - 1; | ||
@@ -290,5 +391,5 @@ var dollarAtTheEnd = name.charCodeAt(lastCharIndex) === DOLLAR_CHAR_CODE; | ||
} | ||
function defineSelectSnapshotProperties(selectorOrFeature, paths, target, name) { | ||
function defineSelectSnapshotProperties(selectorOrFeature, paths, target, name, store) { | ||
var _a; | ||
var selectorFnName = "__" + name + "__selector"; | ||
var selectorFnName = "__" + name.toString() + "__selector"; | ||
var createSelector = createSelectorFactory(paths); | ||
@@ -306,3 +407,3 @@ Object.defineProperties(target, (_a = {}, | ||
// during view creation. | ||
var store = getStore(); | ||
store = store || getStore(); | ||
return store.selectSnapshot(selector); | ||
@@ -331,7 +432,5 @@ }, | ||
/** | ||
* This decorator has to be used only with components since only components | ||
* can have templates and interpolated properties. The purpose of this decorator | ||
* is also to make `selectSnapshot` working in OnPush components. | ||
*/ | ||
var targetToScheduledMicrotaskMap = new Map(); | ||
var targetToCreateSelectorParamsMap = new Map(); | ||
var SUBSCRIPTIONS = Symbol('SUBSCRIPTIONS'); | ||
function ViewSelectSnapshot(selectorOrFeature) { | ||
@@ -343,29 +442,68 @@ var paths = []; | ||
return function (target, name) { | ||
// Means we're running in AOT mode. | ||
if (!!getDef(target.constructor)) { | ||
decorateView(selectorOrFeature, paths, target, name); | ||
var createSelectorParams = targetToCreateSelectorParamsMap.get(target) || []; | ||
createSelectorParams.push({ | ||
name: name, | ||
paths: paths, | ||
selectorOrFeature: selectorOrFeature, | ||
}); | ||
if (!targetToCreateSelectorParamsMap.has(target)) { | ||
targetToCreateSelectorParamsMap.set(target, createSelectorParams); | ||
// Since this is a property decorator we're not able to get the component definition and factory | ||
// synchronously in the current message loop tick. Note that this `Promise` will be resolved | ||
// before the `APP_INITIALIZER` is resolved. | ||
targetToScheduledMicrotaskMap.set(target, Promise.resolve().then(function () { return decorateTarget(target); })); | ||
} | ||
else { | ||
// This means that application is running in the JIT mode. TypeScript invokes | ||
// property decorators first before class decorators. That means that the `ɵcmp` | ||
// property is not available yet | ||
// NOTE: This is safe! Because that micro task is scheduled before | ||
// the application initialized. | ||
// Angular waits for the completion of the `APP_INITIALIZER` | ||
// promise factories later. | ||
Promise.resolve().then(function () { return decorateView(selectorOrFeature, paths, target, name); }); | ||
} | ||
}; | ||
} | ||
function decorateView(selectorOrFeature, paths, target, name) { | ||
var properties = defineSelectSnapshotProperties(selectorOrFeature, paths, target, name); | ||
function decorateTarget(target) { | ||
var createSelectorParams = targetToCreateSelectorParamsMap.get(target); | ||
var def = getDef(target.constructor); | ||
var factory = getFactory(target.constructor); | ||
// `factory` is a readonly property, but still overridable. | ||
def.factory = function () { | ||
var e_1, _a; | ||
var instance = factory(); | ||
var selector = getSelectorFromInstance(instance, properties.selectorFnName, properties.createSelector, properties.selectorOrFeature); | ||
overrideOnDestroy(def, selector); | ||
var store$1 = core.ɵɵdirectiveInject(store.Store); | ||
var ref = core.ɵɵdirectiveInject(core.ChangeDetectorRef); | ||
try { | ||
for (var createSelectorParams_1 = __values(createSelectorParams), createSelectorParams_1_1 = createSelectorParams_1.next(); !createSelectorParams_1_1.done; createSelectorParams_1_1 = createSelectorParams_1.next()) { | ||
var _b = createSelectorParams_1_1.value, name = _b.name, paths = _b.paths, selectorOrFeature = _b.selectorOrFeature; | ||
var properties = defineSelectSnapshotProperties(selectorOrFeature, paths, target, name, store$1); | ||
var selector = getSelectorFromInstance(instance, properties.selectorFnName, properties.createSelector, properties.selectorOrFeature); | ||
var subscription = store$1.select(selector).subscribe(function () { return ref.markForCheck(); }); | ||
var subscriptions = getSubscriptionsOnTheInstance(instance); | ||
subscriptions.push(subscription); | ||
} | ||
} | ||
catch (e_1_1) { e_1 = { error: e_1_1 }; } | ||
finally { | ||
try { | ||
if (createSelectorParams_1_1 && !createSelectorParams_1_1.done && (_a = createSelectorParams_1.return)) _a.call(createSelectorParams_1); | ||
} | ||
finally { if (e_1) throw e_1.error; } | ||
} | ||
return instance; | ||
}; | ||
overrideNgOnDestroy(target); | ||
targetToScheduledMicrotaskMap.delete(target); | ||
targetToCreateSelectorParamsMap.delete(target); | ||
} | ||
function overrideNgOnDestroy(target) { | ||
// Angular 10.0.5+ doesn't store `ngOnDestroy` hook on the component definition anymore and | ||
// allows to override lifecycle hooks through prototypes. | ||
// Previously, it was stored on the `type[NG_CMP_DEF].onDestroy` property, unfortunately, | ||
// it's a breaking change that'll require to use Angular 10.0.5+. | ||
var ngOnDestroy = target.constructor.prototype.ngOnDestroy; | ||
// Since Angular 10.0.5+ it's possible to override the `ngOnDestroy` directly on the prototype. | ||
target.constructor.prototype.ngOnDestroy = function () { | ||
// Invoke the original `ngOnDestroy`. | ||
ngOnDestroy && ngOnDestroy.call(this); | ||
var subscriptions = this[SUBSCRIPTIONS]; | ||
if (Array.isArray(subscriptions)) { | ||
while (subscriptions.length) { | ||
subscriptions.pop().unsubscribe(); | ||
} | ||
} | ||
}; | ||
} | ||
function getFactory(type) { | ||
@@ -377,19 +515,5 @@ return type.ɵfac; | ||
} | ||
function createStoreSubscription(selector) { | ||
var store$1 = core.ɵɵdirectiveInject(store.Store); | ||
// `<any>` is needed here because `ChangeDetectorRef` is an abstract class, | ||
// abstract classes cannot be assigned to `Type<T>`. | ||
var ref = core.ɵɵdirectiveInject(core.ChangeDetectorRef); | ||
return store$1.select(selector).subscribe(function () { return ref.markForCheck(); }); | ||
function getSubscriptionsOnTheInstance(instance) { | ||
return instance[SUBSCRIPTIONS] || (instance[SUBSCRIPTIONS] = []); | ||
} | ||
function overrideOnDestroy(def, selector) { | ||
var subscription = createStoreSubscription(selector); | ||
var onDestroy = def.onDestroy; | ||
def.onDestroy = function () { | ||
// Invoke the original `ngOnDestroy` if it exists. | ||
// tslint:disable-next-line | ||
onDestroy && onDestroy.call(this); | ||
subscription.unsubscribe(); | ||
}; | ||
} | ||
@@ -401,18 +525,20 @@ var NgxsSelectSnapshotModule = /** @class */ (function () { | ||
} | ||
NgxsSelectSnapshotModule_1 = NgxsSelectSnapshotModule; | ||
NgxsSelectSnapshotModule.forRoot = function () { | ||
return { | ||
ngModule: NgxsSelectSnapshotModule_1, | ||
ngModule: NgxsSelectSnapshotModule, | ||
}; | ||
}; | ||
var NgxsSelectSnapshotModule_1; | ||
NgxsSelectSnapshotModule.ctorParameters = function () { return [ | ||
{ type: core.NgModuleRef } | ||
]; }; | ||
NgxsSelectSnapshotModule = NgxsSelectSnapshotModule_1 = __decorate([ | ||
core.NgModule() | ||
], NgxsSelectSnapshotModule); | ||
return NgxsSelectSnapshotModule; | ||
}()); | ||
NgxsSelectSnapshotModule.decorators = [ | ||
{ type: core.NgModule } | ||
]; | ||
NgxsSelectSnapshotModule.ctorParameters = function () { return [ | ||
{ type: core.NgModuleRef } | ||
]; }; | ||
/** | ||
* Generated bundle index. Do not edit. | ||
*/ | ||
exports.NgxsSelectSnapshotModule = NgxsSelectSnapshotModule; | ||
@@ -419,0 +545,0 @@ exports.SelectSnapshot = SelectSnapshot; |
@@ -1,16 +0,16 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@ngxs/store"),require("@angular/core")):"function"==typeof define&&define.amd?define("@ngxs-labs/select-snapshot",["exports","@ngxs/store","@angular/core"],t):t(((e=e||self)["ngxs-labs"]=e["ngxs-labs"]||{},e["ngxs-labs"]["select-snapshot"]={}),e["ngxs-store"],e.ng.core)}(this,(function(e,t,r){"use strict"; | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@ngxs/store"),require("@angular/core")):"function"==typeof define&&define.amd?define("@ngxs-labs/select-snapshot",["exports","@ngxs/store","@angular/core"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self)["ngxs-labs"]=t["ngxs-labs"]||{},t["ngxs-labs"]["select-snapshot"]={}),t["ngxs-store"],t.ng.core)}(this,(function(t,e,r){"use strict"; | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. All rights reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use | ||
this file except in compliance with the License. You may obtain a copy of the | ||
License at http://www.apache.org/licenses/LICENSE-2.0 | ||
Copyright (c) Microsoft Corporation. | ||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED | ||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, | ||
MERCHANTABLITY OR NON-INFRINGEMENT. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
See the Apache Version 2.0 License for specific language governing permissions | ||
and limitations under the License. | ||
***************************************************************************** */var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function o(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,c=r.call(e),u=[];try{for(;(void 0===t||t-- >0)&&!(n=c.next()).done;)u.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=c.return)&&r.call(c)}finally{if(o)throw o.error}}return u}function c(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(o(arguments[t]));return e}var u=function(e){function t(){return e.call(this,'You\'ve forgotten to import "NgxsSelectSnapshotModule"!')||this}return function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}(t,e),t}(Error),i=null;function f(){i=null}function l(){return function(e){if(null==e)throw new u}(i),i.get(t.Store)}function a(e){var t=e.length-1;return 36===e.charCodeAt(t)?e.slice(0,t):e}function s(e){var t=c(e);return function(e){return t.reduce((function(e,t){return e&&e[t]}),e)}}function p(e){return function(t){return"string"==typeof t?s(function(e,t){return t.length?c([e],t):e.split(".")}(t,e)):t.NGXS_META&&t.NGXS_META.path?s(t.NGXS_META.path.split(".")):t}}function h(e,t,r,n){return e[t]||(e[t]=r(n))}function g(e,t,r,n){var o,c="__"+n+"__selector",u=p(t);return Object.defineProperties(r,((o={})[c]={writable:!0,enumerable:!1,configurable:!0},o[n]={get:function(){var t=h(this,c,u,e);return l().selectSnapshot(t)},enumerable:!0,configurable:!0},o)),{selectorFnName:c,createSelector:u,selectorOrFeature:e||a(n)}}function v(e,n,o,c){var u=g(e,n,o,c),i=y(o.constructor),f=o.constructor.ɵfac;i.factory=function(){var e=f(),n=h(e,u.selectorFnName,u.createSelector,u.selectorOrFeature);return function(e,n){var o=function(e){var n=r.ɵɵdirectiveInject(t.Store),o=r.ɵɵdirectiveInject(r.ChangeDetectorRef);return n.select(e).subscribe((function(){return o.markForCheck()}))}(n),c=e.onDestroy;e.onDestroy=function(){c&&c.call(this),o.unsubscribe()}}(i,n),e}}function y(e){return e[r.ɵNG_COMP_DEF]||e[r.ɵNG_DIR_DEF]}var d=function(){function e(e){var t;t=e.injector,i=t,e.onDestroy(f)}var t;return t=e,e.forRoot=function(){return{ngModule:t}},e.ctorParameters=function(){return[{type:r.NgModuleRef}]},e=t=function(e,t,r,n){var o,c=arguments.length,u=c<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)u=Reflect.decorate(e,t,r,n);else for(var i=e.length-1;i>=0;i--)(o=e[i])&&(u=(c<3?o(u):c>3?o(t,r,u):o(t,r))||u);return c>3&&u&&Object.defineProperty(t,r,u),u}([r.NgModule()],e)}();e.NgxsSelectSnapshotModule=d,e.SelectSnapshot=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return function(r,n){g(e,t,r,n)}},e.ViewSelectSnapshot=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return function(r,n){y(r.constructor)?v(e,t,r,n):Promise.resolve().then((function(){return v(e,t,r,n)}))}},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */var n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)};Object.create;function o(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function u(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,u=r.call(t),c=[];try{for(;(void 0===e||e-- >0)&&!(n=u.next()).done;)c.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=u.return)&&r.call(u)}finally{if(o)throw o.error}}return c}function c(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(u(arguments[e]));return t}Object.create;var i=function(t){function e(){return t.call(this,'You\'ve forgotten to import "NgxsSelectSnapshotModule"!')||this}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}(e,t),e}(Error),a=null;function l(){a=null}function f(){return function(t){if(null==t)throw new i}(a),a.get(e.Store)}function s(t){"string"!=typeof t&&(t=t.toString());var e=t.length-1;return 36===t.charCodeAt(e)?t.slice(0,e):t}function p(t){var e=c(t);return function(t){return e.reduce((function(t,e){return t&&t[e]}),t)}}function h(t){return function(e){return"string"==typeof e?p(function(t,e){return e.length?c([t],e):t.split(".")}(e,t)):e.NGXS_META&&e.NGXS_META.path?p(e.NGXS_META.path.split(".")):e}}function y(t,e,r,n){return t[e]||(t[e]=r(n))}function g(t,e,r,n,o){var u,c="__"+n.toString()+"__selector",i=h(e);return Object.defineProperties(r,((u={})[c]={writable:!0,enumerable:!1,configurable:!0},u[n]={get:function(){var e=y(this,c,i,t);return(o=o||f()).selectSnapshot(e)},enumerable:!0,configurable:!0},u)),{selectorFnName:c,createSelector:i,selectorOrFeature:t||s(n)}}var d=new Map,v=new Map,b=Symbol("SUBSCRIPTIONS");function S(t){var n,u=v.get(t),c=(n=t.constructor)[r.ɵNG_COMP_DEF]||n[r.ɵNG_DIR_DEF],i=function(t){return t.ɵfac}(t.constructor);c.factory=function(){var n,c,a=i(),l=r.ɵɵdirectiveInject(e.Store),f=r.ɵɵdirectiveInject(r.ChangeDetectorRef);try{for(var s=o(u),p=s.next();!p.done;p=s.next()){var h=p.value,d=h.name,v=h.paths,b=g(h.selectorOrFeature,v,t,d,l),S=y(a,b.selectorFnName,b.createSelector,b.selectorOrFeature),m=l.select(S).subscribe((function(){return f.markForCheck()}));_(a).push(m)}}catch(t){n={error:t}}finally{try{p&&!p.done&&(c=s.return)&&c.call(s)}finally{if(n)throw n.error}}return a},function(t){var e=t.constructor.prototype.ngOnDestroy;t.constructor.prototype.ngOnDestroy=function(){e&&e.call(this);var t=this[b];if(Array.isArray(t))for(;t.length;)t.pop().unsubscribe()}}(t),d.delete(t),v.delete(t)}function _(t){return t[b]||(t[b]=[])}var m=function(){function t(t){var e;e=t.injector,a=e,t.onDestroy(l)}return t.forRoot=function(){return{ngModule:t}},t}();m.decorators=[{type:r.NgModule}],m.ctorParameters=function(){return[{type:r.NgModuleRef}]},t.NgxsSelectSnapshotModule=m,t.SelectSnapshot=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return function(r,n){g(t,e,r,n)}},t.ViewSelectSnapshot=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return function(r,n){var o=v.get(r)||[];o.push({name:n,paths:e,selectorOrFeature:t}),v.has(r)||(v.set(r,o),d.set(r,Promise.resolve().then((function(){return S(r)}))))}},Object.defineProperty(t,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=ngxs-labs-select-snapshot.umd.min.js.map |
export * from './public_api'; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290Ijoibmc6Ly9Abmd4cy1sYWJzL3NlbGVjdC1zbmFwc2hvdC8iLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsY0FBYyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0ICogZnJvbSAnLi9wdWJsaWNfYXBpJztcbiJdfQ== | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYyxjQUFjLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgKiBmcm9tICcuL3B1YmxpY19hcGknO1xuIl19 |
@@ -7,2 +7,2 @@ import { defineSelectSnapshotProperties } from '../internals/select-snapshot'; | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VsZWN0LXNuYXBzaG90LmpzIiwic291cmNlUm9vdCI6Im5nOi8vQG5neHMtbGFicy9zZWxlY3Qtc25hcHNob3QvIiwic291cmNlcyI6WyJsaWIvY29yZS9kZWNvcmF0b3JzL3NlbGVjdC1zbmFwc2hvdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsOEJBQThCLEVBQUUsTUFBTSw4QkFBOEIsQ0FBQztBQUU5RSxNQUFNLFVBQVUsY0FBYyxDQUFDLGlCQUF1QixFQUFFLEdBQUcsS0FBZTtJQUN4RSxPQUFPLENBQUMsSUFBUyxFQUFFLElBQVksRUFBRSxFQUFFO1FBQ2pDLDhCQUE4QixDQUFDLGlCQUFpQixFQUFFLEtBQUssRUFBRSxJQUFJLEVBQUUsSUFBSSxDQUFDLENBQUM7SUFDdkUsQ0FBQyxDQUFDO0FBQ0osQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGRlZmluZVNlbGVjdFNuYXBzaG90UHJvcGVydGllcyB9IGZyb20gJy4uL2ludGVybmFscy9zZWxlY3Qtc25hcHNob3QnO1xuXG5leHBvcnQgZnVuY3Rpb24gU2VsZWN0U25hcHNob3Qoc2VsZWN0b3JPckZlYXR1cmU/OiBhbnksIC4uLnBhdGhzOiBzdHJpbmdbXSkge1xuICByZXR1cm4gKHR5cGU6IGFueSwgbmFtZTogc3RyaW5nKSA9PiB7XG4gICAgZGVmaW5lU2VsZWN0U25hcHNob3RQcm9wZXJ0aWVzKHNlbGVjdG9yT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ular/core'; | ||
import { Store } from '@ngxs/store'; | ||
import { defineSelectSnapshotProperties, getSelectorFromInstance, } from '../internals/select-snapshot'; | ||
/** | ||
* This decorator has to be used only with components since only components | ||
* can have templates and interpolated properties. The purpose of this decorator | ||
* is also to make `selectSnapshot` working in OnPush components. | ||
*/ | ||
const targetToScheduledMicrotaskMap = new Map(); | ||
const targetToCreateSelectorParamsMap = new Map(); | ||
const SUBSCRIPTIONS = Symbol('SUBSCRIPTIONS'); | ||
export function ViewSelectSnapshot(selectorOrFeature, ...paths) { | ||
return (target, name) => { | ||
// Means we're running in AOT mode. | ||
if (!!getDef(target.constructor)) { | ||
decorateView(selectorOrFeature, paths, target, name); | ||
const createSelectorParams = targetToCreateSelectorParamsMap.get(target) || []; | ||
createSelectorParams.push({ | ||
name, | ||
paths, | ||
selectorOrFeature, | ||
}); | ||
if (!targetToCreateSelectorParamsMap.has(target)) { | ||
targetToCreateSelectorParamsMap.set(target, createSelectorParams); | ||
// Since this is a property decorator we're not able to get the component definition and factory | ||
// synchronously in the current message loop tick. Note that this `Promise` will be resolved | ||
// before the `APP_INITIALIZER` is resolved. | ||
targetToScheduledMicrotaskMap.set(target, Promise.resolve().then(() => decorateTarget(target))); | ||
} | ||
else { | ||
// This means that application is running in the JIT mode. TypeScript invokes | ||
// property decorators first before class decorators. That means that the `ɵcmp` | ||
// property is not available yet | ||
// NOTE: This is safe! Because that micro task is scheduled before | ||
// the application initialized. | ||
// Angular waits for the completion of the `APP_INITIALIZER` | ||
// promise factories later. | ||
Promise.resolve().then(() => decorateView(selectorOrFeature, paths, target, name)); | ||
} | ||
}; | ||
} | ||
function decorateView(selectorOrFeature, paths, target, name) { | ||
const properties = defineSelectSnapshotProperties(selectorOrFeature, paths, target, name); | ||
function decorateTarget(target) { | ||
const createSelectorParams = targetToCreateSelectorParamsMap.get(target); | ||
const def = getDef(target.constructor); | ||
const factory = getFactory(target.constructor); | ||
// `factory` is a readonly property, but still overridable. | ||
def.factory = () => { | ||
const instance = factory(); | ||
const selector = getSelectorFromInstance(instance, properties.selectorFnName, properties.createSelector, properties.selectorOrFeature); | ||
overrideOnDestroy(def, selector); | ||
const store = ɵɵdirectiveInject(Store); | ||
const ref = ɵɵdirectiveInject(ChangeDetectorRef); | ||
for (const { name, paths, selectorOrFeature } of createSelectorParams) { | ||
const properties = defineSelectSnapshotProperties(selectorOrFeature, paths, target, name, store); | ||
const selector = getSelectorFromInstance(instance, properties.selectorFnName, properties.createSelector, properties.selectorOrFeature); | ||
const subscription = store.select(selector).subscribe(() => ref.markForCheck()); | ||
const subscriptions = getSubscriptionsOnTheInstance(instance); | ||
subscriptions.push(subscription); | ||
} | ||
return instance; | ||
}; | ||
overrideNgOnDestroy(target); | ||
targetToScheduledMicrotaskMap.delete(target); | ||
targetToCreateSelectorParamsMap.delete(target); | ||
} | ||
function overrideNgOnDestroy(target) { | ||
// Angular 10.0.5+ doesn't store `ngOnDestroy` hook on the component definition anymore and | ||
// allows to override lifecycle hooks through prototypes. | ||
// Previously, it was stored on the `type[NG_CMP_DEF].onDestroy` property, unfortunately, | ||
// it's a breaking change that'll require to use Angular 10.0.5+. | ||
const ngOnDestroy = target.constructor.prototype.ngOnDestroy; | ||
// Since Angular 10.0.5+ it's possible to override the `ngOnDestroy` directly on the prototype. | ||
target.constructor.prototype.ngOnDestroy = function () { | ||
// Invoke the original `ngOnDestroy`. | ||
ngOnDestroy && ngOnDestroy.call(this); | ||
const subscriptions = this[SUBSCRIPTIONS]; | ||
if (Array.isArray(subscriptions)) { | ||
while (subscriptions.length) { | ||
subscriptions.pop().unsubscribe(); | ||
} | ||
} | ||
}; | ||
} | ||
function getFactory(type) { | ||
@@ -44,19 +70,5 @@ return type.ɵfac; | ||
} | ||
function createStoreSubscription(selector) { | ||
const store = ɵɵdirectiveInject(Store); | ||
// `<any>` is needed here because `ChangeDetectorRef` is an abstract class, | ||
// abstract classes cannot be assigned to `Type<T>`. | ||
const ref = ɵɵdirectiveInject(ChangeDetectorRef); | ||
return store.select(selector).subscribe(() => ref.markForCheck()); | ||
function getSubscriptionsOnTheInstance(instance) { | ||
return instance[SUBSCRIPTIONS] || (instance[SUBSCRIPTIONS] = []); | ||
} | ||
function overrideOnDestroy(def, selector) { | ||
const subscription = createStoreSubscription(selector); | ||
const onDestroy = def.onDestroy; | ||
def.onDestroy = function () { | ||
// Invoke the original `ngOnDestroy` if it exists. | ||
// tslint:disable-next-line | ||
onDestroy && onDestroy.call(this); | ||
subscription.unsubscribe(); | ||
}; | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmlldy1zZWxlY3Qtc25hcHNob3QuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9Abmd4cy1sYWJzL3NlbGVjdC1zbmFwc2hvdC8iLCJzb3VyY2VzIjpbImxpYi9jb3JlL2RlY29yYXRvcnMvdmlldy1zZWxlY3Qtc25hcHNob3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUNMLFdBQVcsRUFDWCxZQUFZLEVBS1osaUJBQWlCLEVBQ2pCLGlCQUFpQixHQUNsQixNQUFNLGVBQWUsQ0FBQztBQUV2QixPQUFPLEVBQUUsS0FBSyxFQUFFLE1BQU0sYUFBYSxDQUFDO0FBRXBDLE9BQU8sRUFDTCw4QkFBOEIsRUFDOUIsdUJBQXVCLEdBQ3hCLE1BQU0sOEJBQThCLENBQUM7QUFFdEM7Ozs7R0FJRztBQUNILE1BQU0sVUFBVSxrQkFBa0IsQ0FBQyxpQkFBdUIsRUFBRSxHQUFHLEtBQWU7SUFDNUUsT0FBTyxDQUFDLE1BQVcsRUFBRSxJQUFZLEVBQUUsRUFBRTtRQUNuQyxtQ0FBbUM7UUFDbkMsSUFBSSxDQUFDLENBQUMsTUFBTSxDQUFDLE1BQU0sQ0FBQyxXQUFXLENBQUMsRUFBRTtZQUNoQyxZQUFZLENBQUMsaUJBQWlCLEVBQUUsS0FBSyxFQUFFLE1BQU0sRUF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NyaXB0aW9uW107XG59XG4iXX0= |
const DOLLAR_CHAR_CODE = 36; | ||
export function removeDollarAtTheEnd(name) { | ||
if (typeof name !== 'string') { | ||
name = name.toString(); | ||
} | ||
const lastCharIndex = name.length - 1; | ||
@@ -18,2 +21,2 @@ const dollarAtTheEnd = name.charCodeAt(lastCharIndex) === DOLLAR_CHAR_CODE; | ||
export const META_KEY = 'NGXS_META'; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZXJuYWxzLmpzIiwic291cmNlUm9vdCI6Im5nOi8vQG5neHMtbGFicy9zZWxlY3Qtc25hcHNob3QvIiwic291cmNlcyI6WyJsaWIvY29yZS9pbnRlcm5hbHMvaW50ZXJuYWxzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE1BQU0sZ0JBQWdCLEdBQUcsRUFBRSxDQUFDO0FBRTVCLE1BQU0sVUFBVSxvQkFBb0IsQ0FBQyxJQUFZO0lBQy9DLE1BQU0sYUFBYSxHQUFHLElBQUksQ0FBQyxNQUFNLEdBQUcsQ0FBQyxDQUFDO0lBQ3RDLE1BQU0sY0FBYyxHQUFHLElBQUksQ0FBQyxVQUFVLENBQUMsYUFBYSxDQUFDLEtBQUssZ0JBQWdCLENBQUM7SUFDM0UsT0FBTyxjQUFjLENBQUMsQ0FBQyxDQUFDLElBQUksQ0FBQyxLQUFLLENBQUMsQ0FBQyxFQUFFLGFBQWEsQ0FBQyxDQUFDLENBQUMsQ0FBQyxJQUFJLENBQUM7QUFDOUQsQ0FBQztBQUVELE1BQU0sVUFBVSxhQUFhLENBQUMsaUJBQXlCLEVBQUUsS0FBZTtJQUN0RSxJQUFJLEtBQUssQ0FBQyxNQUFNLEVBQUU7UUFDaEIsT0FBTyxDQUFDLGlCQUFpQixFQUFFLEdBQUcsS0FBSyxDQUFDLENBQUM7S0FDdEM7SUFDRCxPQUFPLGlCQUFpQixDQUFDLEtBQUssQ0FBQyxHQUF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V4cG9ydCBmdW5jdGlvbiBnZXRQcm9wc0FycmF5KHNlbGVjdG9yT3JGZWF0dXJlOiBzdHJpbmcsIHBhdGhzOiBzdHJpbmdbXSk6IHN0cmluZ1tdIHtcbiAgaWYgKHBhdGhzLmxlbmd0aCkge1xuICAgIHJldHVybiBbc2VsZWN0b3JPckZlYXR1cmUsIC4uLnBhdGhzXTtcbiAgfVxuICByZXR1cm4gc2VsZWN0b3JPckZlYXR1cmUuc3BsaXQoJy4nKTtcbn1cblxuZXhwb3J0IGZ1bmN0aW9uIGNvbXBsaWFudFByb3BHZXR0ZXIocGF0aHM6IHN0cmluZ1tdKTogKHg6IGFueSkgPT4gYW55IHtcbiAgY29uc3QgY29weU9mUGF0aHMgPSBbLi4ucGF0aHNdO1xuICByZXR1cm4gb2JqID0+IGNvcHlPZlBhdGhzLnJlZHVjZSgoYWNjOiBhbnksIHBhcnQ6IHN0cmluZykgPT4gYWNjICYmIGFjY1twYXJ0XSwgb2JqKTtcbn1cblxuZXhwb3J0IGNvbnN0IE1FVEFfS0VZID0gJ05HWFNfTUVUQSc7XG4iXX0= |
@@ -18,4 +18,4 @@ import { getStore } from './static-injector'; | ||
} | ||
export function defineSelectSnapshotProperties(selectorOrFeature, paths, target, name) { | ||
const selectorFnName = `__${name}__selector`; | ||
export function defineSelectSnapshotProperties(selectorOrFeature, paths, target, name, store) { | ||
const selectorFnName = `__${name.toString()}__selector`; | ||
const createSelector = createSelectorFactory(paths); | ||
@@ -33,3 +33,3 @@ Object.defineProperties(target, { | ||
// during view creation. | ||
const store = getStore(); | ||
store = store || getStore(); | ||
return store.selectSnapshot(selector); | ||
@@ -47,2 +47,2 @@ }, | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VsZWN0LXNuYXBzaG90LmpzIiwic291cmNlUm9vdCI6Im5nOi8vQG5neHMtbGFicy9zZWxlY3Qtc25hcHNob3QvIiwic291cmNlcyI6WyJsaWIvY29yZS9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||
import { NgModule, ModuleWithProviders, NgModuleRef } from '@angular/core'; | ||
import { NgModule, NgModuleRef } from '@angular/core'; | ||
import { setInjector, clearInjector } from './core/internals/static-injector'; | ||
let NgxsSelectSnapshotModule = NgxsSelectSnapshotModule_1 = class NgxsSelectSnapshotModule { | ||
export class NgxsSelectSnapshotModule { | ||
constructor(ngModuleRef) { | ||
@@ -12,13 +10,12 @@ setInjector(ngModuleRef.injector); | ||
return { | ||
ngModule: NgxsSelectSnapshotModule_1, | ||
ngModule: NgxsSelectSnapshotModule, | ||
}; | ||
} | ||
}; | ||
} | ||
NgxsSelectSnapshotModule.decorators = [ | ||
{ type: NgModule } | ||
]; | ||
NgxsSelectSnapshotModule.ctorParameters = () => [ | ||
{ type: NgModuleRef } | ||
]; | ||
NgxsSelectSnapshotModule = NgxsSelectSnapshotModule_1 = __decorate([ | ||
NgModule() | ||
], NgxsSelectSnapshotModule); | ||
export { NgxsSelectSnapshotModule }; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VsZWN0LXNuYXBzaG90Lm1vZHVsZS5qcyIsInNvdXJjZVJvb3QiOiJuZzovL0BuZ3hzLWxhYnMvc2VsZWN0LXNuYXBzaG90LyIsInNvdXJjZXMiOlsibGliL3NlbGVjdC1zbmFwc2hvdC5tb2R1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxPQUFPLEVBQUUsUUFBUSxFQUFFLG1CQUFtQixFQUFFLFdBQVcsRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUUzRSxPQUFPLEVBQUUsV0FBVyxFQUFFLGFBQWEsRUFBRSxNQUFNLGtDQUFrQyxDQUFDO0FBRzlFLElBQWEsd0JBQXdCLGdDQUFyQyxNQUFhLHdCQUF3QjtJQUNuQyxZQUFZLFdBQTZCO1FBQ3ZDLFdBQVcsQ0FBQyxXQUFXLENBQUMsUUFBUSxDQUFDLENBQUM7UUFDbEMsV0FBVyxDQU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OiBNb2R1bGVXaXRoUHJvdmlkZXJzPE5neHNTZWxlY3RTbmFwc2hvdE1vZHVsZT4ge1xuICAgIHJldHVybiB7XG4gICAgICBuZ01vZHVsZTogTmd4c1NlbGVjdFNuYXBzaG90TW9kdWxlLFxuICAgIH07XG4gIH1cbn1cbiJdfQ== |
@@ -5,2 +5,2 @@ /** | ||
export * from './index'; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmd4cy1sYWJzLXNlbGVjdC1zbmFwc2hvdC5qcyIsInNvdXJjZVJvb3QiOiJuZzovL0BuZ3hzLWxhYnMvc2VsZWN0LXNuYXBzaG90LyIsInNvdXJjZXMiOlsibmd4cy1sYWJzLXNlbGVjdC1zbmFwc2hvdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRztBQUVILGNBQWMsU0FBUyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBHZW5lcmF0ZWQgYnVuZGxlIGluZGV4LiBEbyBub3QgZWRpdC5cbiAqL1xuXG5leHBvcnQgKiBmcm9tICcuL2luZGV4JztcbiJdfQ== | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmd4cy1sYWJzLXNlbGVjdC1zbmFwc2hvdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9uZ3hzLWxhYnMtc2VsZWN0LXNuYXBzaG90LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBRUgsY0FBYyxTQUFTLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEdlbmVyYXRlZCBidW5kbGUgaW5kZXguIERvIG5vdCBlZGl0LlxuICovXG5cbmV4cG9ydCAqIGZyb20gJy4vaW5kZXgnO1xuIl19 |
export { SelectSnapshot } from './lib/core/decorators/select-snapshot'; | ||
export { ViewSelectSnapshot } from './lib/core/decorators/view-select-snapshot'; | ||
export { NgxsSelectSnapshotModule } from './lib/select-snapshot.module'; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljX2FwaS5qcyIsInNvdXJjZVJvb3QiOiJuZzovL0BuZ3hzLWxhYnMvc2VsZWN0LXNuYXBzaG90LyIsInNvdXJjZXMiOlsicHVibGljX2FwaS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsY0FBYyxFQUFFLE1BQU0sdUNBQXVDLENBQUM7QUFDdkUsT0FBTyxFQUFFLGtCQUFrQixFQUFFLE1BQU0sNENBQTRDLENBQUM7QUFDaEYsT0FBTyxFQUFFLHdCQUF3QixFQUFFLE1BQU0sOEJBQThCLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgeyBTZWxlY3RTbmFwc2hvdCB9IGZyb20gJy4vbGliL2NvcmUvZGVjb3JhdG9ycy9zZWxlY3Qtc25hcHNob3QnO1xuZXhwb3J0IHsgVmlld1NlbGVjdFNuYXBzaG90IH0gZnJvbSAnLi9saWIvY29yZS9kZWNvcmF0b3JzL3ZpZXctc2VsZWN0LXNuYXBzaG90JztcbmV4cG9ydCB7IE5neHNTZWxlY3RTbmFwc2hvdE1vZHVsZSB9IGZyb20gJy4vbGliL3NlbGVjdC1zbmFwc2hvdC5tb2R1bGUnO1xuIl19 | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljX2FwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wdWJsaWNfYXBpLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxjQUFjLEVBQUUsTUFBTSx1Q0FBdUMsQ0FBQztBQUN2RSxPQUFPLEVBQUUsa0JBQWtCLEVBQUUsTUFBTSw0Q0FBNEMsQ0FBQztBQUNoRixPQUFPLEVBQUUsd0JBQXdCLEVBQUUsTUFBTSw4QkFBOEIsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCB7IFNlbGVjdFNuYXBzaG90IH0gZnJvbSAnLi9saWIvY29yZS9kZWNvcmF0b3JzL3NlbGVjdC1zbmFwc2hvdCc7XG5leHBvcnQgeyBWaWV3U2VsZWN0U25hcHNob3QgfSBmcm9tICcuL2xpYi9jb3JlL2RlY29yYXRvcnMvdmlldy1zZWxlY3Qtc25hcHNob3QnO1xuZXhwb3J0IHsgTmd4c1NlbGVjdFNuYXBzaG90TW9kdWxlIH0gZnJvbSAnLi9saWIvc2VsZWN0LXNuYXBzaG90Lm1vZHVsZSc7XG4iXX0= |
import { Store } from '@ngxs/store'; | ||
import { ɵNG_COMP_DEF, ɵNG_DIR_DEF, ɵɵdirectiveInject, ChangeDetectorRef, NgModuleRef, NgModule } from '@angular/core'; | ||
import { __decorate } from 'tslib'; | ||
import { ɵNG_COMP_DEF, ɵNG_DIR_DEF, ɵɵdirectiveInject, ChangeDetectorRef, NgModule, NgModuleRef } from '@angular/core'; | ||
@@ -33,2 +32,5 @@ class NgxsSelectSnapshotModuleIsNotImported extends Error { | ||
function removeDollarAtTheEnd(name) { | ||
if (typeof name !== 'string') { | ||
name = name.toString(); | ||
} | ||
const lastCharIndex = name.length - 1; | ||
@@ -65,4 +67,4 @@ const dollarAtTheEnd = name.charCodeAt(lastCharIndex) === DOLLAR_CHAR_CODE; | ||
} | ||
function defineSelectSnapshotProperties(selectorOrFeature, paths, target, name) { | ||
const selectorFnName = `__${name}__selector`; | ||
function defineSelectSnapshotProperties(selectorOrFeature, paths, target, name, store) { | ||
const selectorFnName = `__${name.toString()}__selector`; | ||
const createSelector = createSelectorFactory(paths); | ||
@@ -80,3 +82,3 @@ Object.defineProperties(target, { | ||
// during view creation. | ||
const store = getStore(); | ||
store = store || getStore(); | ||
return store.selectSnapshot(selector); | ||
@@ -101,36 +103,62 @@ }, | ||
/** | ||
* This decorator has to be used only with components since only components | ||
* can have templates and interpolated properties. The purpose of this decorator | ||
* is also to make `selectSnapshot` working in OnPush components. | ||
*/ | ||
const targetToScheduledMicrotaskMap = new Map(); | ||
const targetToCreateSelectorParamsMap = new Map(); | ||
const SUBSCRIPTIONS = Symbol('SUBSCRIPTIONS'); | ||
function ViewSelectSnapshot(selectorOrFeature, ...paths) { | ||
return (target, name) => { | ||
// Means we're running in AOT mode. | ||
if (!!getDef(target.constructor)) { | ||
decorateView(selectorOrFeature, paths, target, name); | ||
const createSelectorParams = targetToCreateSelectorParamsMap.get(target) || []; | ||
createSelectorParams.push({ | ||
name, | ||
paths, | ||
selectorOrFeature, | ||
}); | ||
if (!targetToCreateSelectorParamsMap.has(target)) { | ||
targetToCreateSelectorParamsMap.set(target, createSelectorParams); | ||
// Since this is a property decorator we're not able to get the component definition and factory | ||
// synchronously in the current message loop tick. Note that this `Promise` will be resolved | ||
// before the `APP_INITIALIZER` is resolved. | ||
targetToScheduledMicrotaskMap.set(target, Promise.resolve().then(() => decorateTarget(target))); | ||
} | ||
else { | ||
// This means that application is running in the JIT mode. TypeScript invokes | ||
// property decorators first before class decorators. That means that the `ɵcmp` | ||
// property is not available yet | ||
// NOTE: This is safe! Because that micro task is scheduled before | ||
// the application initialized. | ||
// Angular waits for the completion of the `APP_INITIALIZER` | ||
// promise factories later. | ||
Promise.resolve().then(() => decorateView(selectorOrFeature, paths, target, name)); | ||
} | ||
}; | ||
} | ||
function decorateView(selectorOrFeature, paths, target, name) { | ||
const properties = defineSelectSnapshotProperties(selectorOrFeature, paths, target, name); | ||
function decorateTarget(target) { | ||
const createSelectorParams = targetToCreateSelectorParamsMap.get(target); | ||
const def = getDef(target.constructor); | ||
const factory = getFactory(target.constructor); | ||
// `factory` is a readonly property, but still overridable. | ||
def.factory = () => { | ||
const instance = factory(); | ||
const selector = getSelectorFromInstance(instance, properties.selectorFnName, properties.createSelector, properties.selectorOrFeature); | ||
overrideOnDestroy(def, selector); | ||
const store = ɵɵdirectiveInject(Store); | ||
const ref = ɵɵdirectiveInject(ChangeDetectorRef); | ||
for (const { name, paths, selectorOrFeature } of createSelectorParams) { | ||
const properties = defineSelectSnapshotProperties(selectorOrFeature, paths, target, name, store); | ||
const selector = getSelectorFromInstance(instance, properties.selectorFnName, properties.createSelector, properties.selectorOrFeature); | ||
const subscription = store.select(selector).subscribe(() => ref.markForCheck()); | ||
const subscriptions = getSubscriptionsOnTheInstance(instance); | ||
subscriptions.push(subscription); | ||
} | ||
return instance; | ||
}; | ||
overrideNgOnDestroy(target); | ||
targetToScheduledMicrotaskMap.delete(target); | ||
targetToCreateSelectorParamsMap.delete(target); | ||
} | ||
function overrideNgOnDestroy(target) { | ||
// Angular 10.0.5+ doesn't store `ngOnDestroy` hook on the component definition anymore and | ||
// allows to override lifecycle hooks through prototypes. | ||
// Previously, it was stored on the `type[NG_CMP_DEF].onDestroy` property, unfortunately, | ||
// it's a breaking change that'll require to use Angular 10.0.5+. | ||
const ngOnDestroy = target.constructor.prototype.ngOnDestroy; | ||
// Since Angular 10.0.5+ it's possible to override the `ngOnDestroy` directly on the prototype. | ||
target.constructor.prototype.ngOnDestroy = function () { | ||
// Invoke the original `ngOnDestroy`. | ||
ngOnDestroy && ngOnDestroy.call(this); | ||
const subscriptions = this[SUBSCRIPTIONS]; | ||
if (Array.isArray(subscriptions)) { | ||
while (subscriptions.length) { | ||
subscriptions.pop().unsubscribe(); | ||
} | ||
} | ||
}; | ||
} | ||
function getFactory(type) { | ||
@@ -142,22 +170,7 @@ return type.ɵfac; | ||
} | ||
function createStoreSubscription(selector) { | ||
const store = ɵɵdirectiveInject(Store); | ||
// `<any>` is needed here because `ChangeDetectorRef` is an abstract class, | ||
// abstract classes cannot be assigned to `Type<T>`. | ||
const ref = ɵɵdirectiveInject(ChangeDetectorRef); | ||
return store.select(selector).subscribe(() => ref.markForCheck()); | ||
function getSubscriptionsOnTheInstance(instance) { | ||
return instance[SUBSCRIPTIONS] || (instance[SUBSCRIPTIONS] = []); | ||
} | ||
function overrideOnDestroy(def, selector) { | ||
const subscription = createStoreSubscription(selector); | ||
const onDestroy = def.onDestroy; | ||
def.onDestroy = function () { | ||
// Invoke the original `ngOnDestroy` if it exists. | ||
// tslint:disable-next-line | ||
onDestroy && onDestroy.call(this); | ||
subscription.unsubscribe(); | ||
}; | ||
} | ||
var NgxsSelectSnapshotModule_1; | ||
let NgxsSelectSnapshotModule = NgxsSelectSnapshotModule_1 = class NgxsSelectSnapshotModule { | ||
class NgxsSelectSnapshotModule { | ||
constructor(ngModuleRef) { | ||
@@ -169,12 +182,12 @@ setInjector(ngModuleRef.injector); | ||
return { | ||
ngModule: NgxsSelectSnapshotModule_1, | ||
ngModule: NgxsSelectSnapshotModule, | ||
}; | ||
} | ||
}; | ||
} | ||
NgxsSelectSnapshotModule.decorators = [ | ||
{ type: NgModule } | ||
]; | ||
NgxsSelectSnapshotModule.ctorParameters = () => [ | ||
{ type: NgModuleRef } | ||
]; | ||
NgxsSelectSnapshotModule = NgxsSelectSnapshotModule_1 = __decorate([ | ||
NgModule() | ||
], NgxsSelectSnapshotModule); | ||
@@ -181,0 +194,0 @@ /** |
@@ -1,6 +0,1 @@ | ||
/** | ||
* This decorator has to be used only with components since only components | ||
* can have templates and interpolated properties. The purpose of this decorator | ||
* is also to make `selectSnapshot` working in OnPush components. | ||
*/ | ||
export declare function ViewSelectSnapshot(selectorOrFeature?: any, ...paths: string[]): (target: any, name: string) => void; | ||
export declare function ViewSelectSnapshot(selectorOrFeature?: any, ...paths: string[]): PropertyDecorator; |
@@ -1,4 +0,4 @@ | ||
export declare function removeDollarAtTheEnd(name: string): string; | ||
export declare function removeDollarAtTheEnd(name: string | symbol): string; | ||
export declare function getPropsArray(selectorOrFeature: string, paths: string[]): string[]; | ||
export declare function compliantPropGetter(paths: string[]): (x: any) => any; | ||
export declare const META_KEY = "NGXS_META"; |
@@ -1,5 +0,5 @@ | ||
import { Type } from '@angular/core'; | ||
import { Store } from '@ngxs/store'; | ||
declare type CreateSelectorFactory = (selectorOrFeature: any) => any; | ||
export declare function getSelectorFromInstance(instance: any, selectorFnName: string, createSelector: CreateSelectorFactory, selectorOrFeature: any): any; | ||
export declare function defineSelectSnapshotProperties(selectorOrFeature: any, paths: string[], target: Type<unknown>, name: string): { | ||
export declare function defineSelectSnapshotProperties(selectorOrFeature: any, paths: string[], target: Object, name: string | symbol, store?: Store): { | ||
selectorFnName: string; | ||
@@ -6,0 +6,0 @@ createSelector: CreateSelectorFactory; |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":4,"metadata":{"SelectSnapshot":{"__symbolic":"function","parameters":["selectorOrFeature","paths"],"value":{"__symbolic":"error","message":"Lambda not supported","line":3,"character":9,"module":"./lib/core/decorators/select-snapshot"}},"ViewSelectSnapshot":{"__symbolic":"function","parameters":["selectorOrFeature","paths"],"value":{"__symbolic":"error","message":"Lambda not supported","line":24,"character":9,"module":"./lib/core/decorators/view-select-snapshot"}},"NgxsSelectSnapshotModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":4,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"NgModuleRef","module":"@angular/core","arguments":[{"__symbolic":"reference","name":"any"}]}]}]},"statics":{"forRoot":{"__symbolic":"function","parameters":[],"value":{"ngModule":{"__symbolic":"reference","name":"NgxsSelectSnapshotModule"}}}}}},"origins":{"SelectSnapshot":"./lib/core/decorators/select-snapshot","ViewSelectSnapshot":"./lib/core/decorators/view-select-snapshot","NgxsSelectSnapshotModule":"./lib/select-snapshot.module"},"importAs":"@ngxs-labs/select-snapshot"} | ||
{"__symbolic":"module","version":4,"metadata":{"SelectSnapshot":{"__symbolic":"function","parameters":["selectorOrFeature","paths"],"value":{"__symbolic":"error","message":"Lambda not supported","line":3,"character":9,"module":"./lib/core/decorators/select-snapshot"}},"ViewSelectSnapshot":{"__symbolic":"function","parameters":["selectorOrFeature","paths"],"value":{"__symbolic":"error","message":"Lambda not supported","line":30,"character":9,"module":"./lib/core/decorators/view-select-snapshot"}},"NgxsSelectSnapshotModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":4,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"NgModuleRef","module":"@angular/core","arguments":[{"__symbolic":"reference","name":"any"}]}]}]},"statics":{"forRoot":{"__symbolic":"function","parameters":[],"value":{"ngModule":{"__symbolic":"reference","name":"NgxsSelectSnapshotModule"}}}}}},"origins":{"SelectSnapshot":"./lib/core/decorators/select-snapshot","ViewSelectSnapshot":"./lib/core/decorators/view-select-snapshot","NgxsSelectSnapshotModule":"./lib/select-snapshot.module"},"importAs":"@ngxs-labs/select-snapshot"} |
{ | ||
"$schema": "../node_modules/ng-packagr/package.schema.json", | ||
"name": "@ngxs-labs/select-snapshot", | ||
"version": "2.0.1", | ||
"version": "3.0.0", | ||
"repository": { | ||
@@ -21,16 +21,16 @@ "type": "git", | ||
"peerDependencies": { | ||
"@angular/core": ">=9", | ||
"@angular/core": ">=10.0.5", | ||
"@ngxs/store": ">=3.4.3", | ||
"rxjs": ">=6.5.2", | ||
"tslib": "^1.10.0" | ||
"rxjs": ">=6.5.2" | ||
}, | ||
"main": "bundles/ngxs-labs-select-snapshot.umd.js", | ||
"module": "fesm5/ngxs-labs-select-snapshot.js", | ||
"module": "fesm2015/ngxs-labs-select-snapshot.js", | ||
"es2015": "fesm2015/ngxs-labs-select-snapshot.js", | ||
"esm5": "esm5/ngxs-labs-select-snapshot.js", | ||
"esm2015": "esm2015/ngxs-labs-select-snapshot.js", | ||
"fesm5": "fesm5/ngxs-labs-select-snapshot.js", | ||
"fesm2015": "fesm2015/ngxs-labs-select-snapshot.js", | ||
"typings": "ngxs-labs-select-snapshot.d.ts", | ||
"metadata": "ngxs-labs-select-snapshot.metadata.json" | ||
} | ||
"metadata": "ngxs-labs-select-snapshot.metadata.json", | ||
"dependencies": { | ||
"tslib": "^2.0.0" | ||
} | ||
} |
@@ -15,2 +15,3 @@ <p align="center"> | ||
- [Angular Compatibility](#angular-compatibility) | ||
- [Install](#📦-install) | ||
@@ -23,2 +24,6 @@ - [Usage](#🔨-usage) | ||
## Angular Compatibility | ||
`@ngxs-labs/select-snapshot@3+` is compatible only with Angular starting from 10.0.5 version. | ||
## 📦 Install | ||
@@ -25,0 +30,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
0
126
160022
27
969
1
+ Addedtslib@^2.0.0
- Removedtslib@1.14.1(transitive)