@theseam/ui-common 0.4.7 → 0.4.9
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.
- package/esm2020/framework/dashboard/dashboard-widgets/dashboard-widgets.component.mjs +2 -1
- package/esm2020/framework/dashboard/dashboard-widgets/dashboard-widgets.service.mjs +12 -9
- package/esm2020/services/preferences/preferences-record.mjs +5 -7
- package/esm2020/story-helpers/story-preferences-accessor.service.mjs +2 -2
- package/fesm2015/theseam-ui-common-framework.mjs +12 -8
- package/fesm2015/theseam-ui-common-framework.mjs.map +1 -1
- package/fesm2015/theseam-ui-common-services.mjs +4 -6
- package/fesm2015/theseam-ui-common-services.mjs.map +1 -1
- package/fesm2015/theseam-ui-common-story-helpers.mjs +1 -1
- package/fesm2015/theseam-ui-common-story-helpers.mjs.map +1 -1
- package/fesm2020/theseam-ui-common-framework.mjs +12 -8
- package/fesm2020/theseam-ui-common-framework.mjs.map +1 -1
- package/fesm2020/theseam-ui-common-services.mjs +4 -6
- package/fesm2020/theseam-ui-common-services.mjs.map +1 -1
- package/fesm2020/theseam-ui-common-story-helpers.mjs +1 -1
- package/fesm2020/theseam-ui-common-story-helpers.mjs.map +1 -1
- package/package.json +1 -1
- package/story-helpers/story-preferences-accessor.service.d.ts +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { isDevMode, Injectable } from '@angular/core';
|
|
3
|
-
import { Subject, of, startWith, switchMap, map, tap, shareReplay, defer, Observable } from 'rxjs';
|
|
3
|
+
import { Subject, of, startWith, switchMap, map, tap, shareReplay, take, defer, Observable } from 'rxjs';
|
|
4
4
|
import { notNullOrUndefined, loadStyleSheet, loadStyle, hasProperty } from '@theseam/ui-common/utils';
|
|
5
5
|
import { map as map$1, filter, startWith as startWith$1 } from 'rxjs/operators';
|
|
6
6
|
import * as i1 from '@angular/router';
|
|
@@ -38,17 +38,15 @@ class TheSeamPreferencesMapRecord {
|
|
|
38
38
|
}
|
|
39
39
|
return null;
|
|
40
40
|
}
|
|
41
|
-
}), map(v => notNullOrUndefined(v) ? v : this._emptyPrefs),
|
|
42
|
-
// tap(v => console.log('preferences$', v)),
|
|
43
|
-
tap(() => {
|
|
41
|
+
}), map(v => notNullOrUndefined(v) ? v : this._emptyPrefs), tap(() => {
|
|
44
42
|
this._setStatus('loaded');
|
|
45
43
|
}))), shareReplay({ bufferSize: 1, refCount: true }));
|
|
46
44
|
}
|
|
47
45
|
update(value) {
|
|
48
|
-
this._accessor.update(this._key, JSON.stringify(value));
|
|
46
|
+
this._accessor.update(this._key, JSON.stringify(value)).pipe(take(1)).subscribe();
|
|
49
47
|
}
|
|
50
48
|
delete() {
|
|
51
|
-
this._accessor.delete(this._key);
|
|
49
|
+
this._accessor.delete(this._key).pipe(take(1)).subscribe();
|
|
52
50
|
}
|
|
53
51
|
refresh() {
|
|
54
52
|
this._setStatus('pending');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theseam-ui-common-services.mjs","sources":["../../../projects/ui-common/services/preferences/preferences-record.ts","../../../projects/ui-common/services/preferences/preferences-manager.service.ts","../../../projects/ui-common/services/asset-loader.service.ts","../../../projects/ui-common/services/router-helpers.service.ts","../../../projects/ui-common/services/font-loader.service.ts","../../../projects/ui-common/services/theseam-ui-common-services.ts"],"sourcesContent":["import { isDevMode } from '@angular/core'\r\nimport { map, Observable, of, shareReplay, startWith, Subject, switchMap, tap } from 'rxjs'\r\n\r\nimport { notNullOrUndefined } from '@theseam/ui-common/utils'\r\n\r\nimport { TheSeamPreferencesAccessor } from './preferences-accessor'\r\nimport { TheSeamPreferencesBase } from './preferences.models'\r\n\r\nexport type TheSeamPreferencesRecordStatus = 'pending' | 'loaded'\r\n\r\nexport interface TheSeamPreferencesRecordStatusChange {\r\n previous: TheSeamPreferencesRecordStatus\r\n current: TheSeamPreferencesRecordStatus\r\n}\r\n\r\nexport class TheSeamPreferencesMapRecord {\r\n\r\n private readonly _refreshSubject = new Subject<void>()\r\n private readonly _statusChangeSubject = new Subject<TheSeamPreferencesRecordStatusChange>()\r\n\r\n private _status: TheSeamPreferencesRecordStatus = 'pending'\r\n\r\n public readonly observable: Observable<TheSeamPreferencesBase>\r\n public readonly statusChange: Observable<TheSeamPreferencesRecordStatusChange>\r\n\r\n constructor(\r\n private readonly _key: string,\r\n private readonly _accessor: TheSeamPreferencesAccessor,\r\n private readonly _emptyPrefs: TheSeamPreferencesBase,\r\n ) {\r\n this.observable = this._createObservable()\r\n this.statusChange = this._statusChangeSubject.asObservable()\r\n }\r\n\r\n private _createObservable(): Observable<TheSeamPreferencesBase> {\r\n if (!this._accessor) {\r\n return of(this._emptyPrefs)\r\n }\r\n\r\n const accessor = (key: string): Observable<string> =>\r\n this._accessor ? this._accessor.get(key) : of(JSON.stringify(this._emptyPrefs))\r\n\r\n return this._refreshSubject.pipe(\r\n startWith(undefined),\r\n switchMap(() => accessor(this._key).pipe(\r\n map(v => {\r\n if (!v) {\r\n return null\r\n }\r\n\r\n // TODO: Add a schema validator and migration tool to avoid parsing issues.\r\n try {\r\n return this._descerializePreferences(v)\r\n } catch (error) {\r\n if (isDevMode()) {\r\n // eslint-disable-next-line no-console\r\n console.error(error)\r\n }\r\n return null\r\n }\r\n }),\r\n map(v => notNullOrUndefined(v) ? v : this._emptyPrefs),\r\n // tap(v => console.log('preferences$', v)),\r\n tap(() => {\r\n this._setStatus('loaded')\r\n })\r\n )),\r\n shareReplay({ bufferSize: 1, refCount: true }),\r\n )\r\n }\r\n\r\n public update(value: TheSeamPreferencesBase): void {\r\n this._accessor.update(this._key, JSON.stringify(value))\r\n }\r\n\r\n public delete(): void {\r\n this._accessor.delete(this._key)\r\n }\r\n\r\n public refresh(): void {\r\n this._setStatus('pending')\r\n this._refreshSubject.next()\r\n }\r\n\r\n public isSameAccessor(accessor: TheSeamPreferencesAccessor): boolean {\r\n return this._accessor === accessor\r\n }\r\n\r\n public isSameEmptyPrefs(emptyPrefs: TheSeamPreferencesBase): boolean {\r\n return JSON.stringify(this._emptyPrefs) === JSON.stringify(emptyPrefs)\r\n }\r\n\r\n get status(): TheSeamPreferencesRecordStatus {\r\n return this._status\r\n }\r\n\r\n private _setStatus(status: TheSeamPreferencesRecordStatus): void {\r\n if (this._status === status) {\r\n return\r\n }\r\n const prev = this._status\r\n this._status = status\r\n this._statusChangeSubject.next({ previous: prev, current: status })\r\n }\r\n\r\n private _descerializePreferences(serialized: string): TheSeamPreferencesBase {\r\n const prefs = JSON.parse(serialized)\r\n\r\n // TODO: Implement migration\r\n\r\n return prefs\r\n }\r\n}\r\n","import { Injectable } from '@angular/core'\r\nimport { map, Observable } from 'rxjs'\r\n\r\nimport { TheSeamPreferencesBase } from './preferences.models'\r\nimport { TheSeamPreferencesAccessor } from './preferences-accessor'\r\nimport { TheSeamPreferencesMapRecord } from './preferences-record'\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class TheSeamPreferencesManagerService {\r\n\r\n private readonly _tablePrefsMap = new Map<string, TheSeamPreferencesMapRecord>()\r\n\r\n public preferences(\r\n preferenceKey: string,\r\n accessor: TheSeamPreferencesAccessor,\r\n emptyPrefs: TheSeamPreferencesBase,\r\n ): Observable<TheSeamPreferencesBase> {\r\n let prefs = this._tablePrefsMap.get(preferenceKey)\r\n\r\n if (prefs && !prefs.isSameAccessor(accessor)) {\r\n throw Error(`Preferences accessor mismatch for key '${preferenceKey}'. Changing the accessor is not supported.`)\r\n }\r\n\r\n if (prefs && !prefs.isSameEmptyPrefs(emptyPrefs)) {\r\n throw Error(`Preferences emptyPrefs mismatch for key '${preferenceKey}'. Changing the emptyPrefs is not supported.`)\r\n }\r\n\r\n if (!prefs) {\r\n prefs = new TheSeamPreferencesMapRecord(preferenceKey, accessor, emptyPrefs)\r\n this._tablePrefsMap.set(preferenceKey, prefs)\r\n }\r\n return prefs.observable.pipe(\r\n map(v => {\r\n // This is for assuming the accessor returned an empty object, as a\r\n // default for a missing preference. Instead of throwing an error, we\r\n // return a valid empty preferences.\r\n //\r\n // NOTE: May remove this, when a more generic preferences implementation\r\n // is finished.\r\n if (Object.keys(v).length === 0) {\r\n return emptyPrefs\r\n }\r\n\r\n return v\r\n }),\r\n )\r\n }\r\n\r\n public update(preferenceKey: string, value: TheSeamPreferencesBase): void {\r\n const prefs = this._tablePrefsMap.get(preferenceKey)\r\n if (prefs) {\r\n prefs.update(value)\r\n }\r\n }\r\n\r\n public delete(preferenceKey: string): void {\r\n const prefs = this._tablePrefsMap.get(preferenceKey)\r\n if (prefs) {\r\n prefs.delete()\r\n }\r\n }\r\n\r\n public refresh(preferenceKey: string): void {\r\n const prefs = this._tablePrefsMap.get(preferenceKey)\r\n if (prefs) {\r\n prefs.refresh()\r\n }\r\n }\r\n\r\n public isPending(preferenceKey: string): boolean {\r\n const prefs = this._tablePrefsMap.get(preferenceKey)\r\n return prefs ? prefs.status === 'pending' : false\r\n }\r\n\r\n public isLoaded(preferenceKey: string): boolean {\r\n const prefs = this._tablePrefsMap.get(preferenceKey)\r\n return prefs ? prefs.status === 'loaded' : false\r\n }\r\n\r\n}\r\n","import { Injectable } from '@angular/core'\nimport { defer, Observable } from 'rxjs'\nimport { map } from 'rxjs/operators'\n\nimport { loadStyle, loadStyleSheet } from '@theseam/ui-common/utils'\n\nexport class LoadedAssetRef<T extends HTMLLinkElement | HTMLScriptElement | HTMLStyleElement> {\n\n constructor(\n public readonly nativeElement: T,\n public readonly path?: string,\n public readonly content?: string\n ) {\n\n }\n\n public destroy(): void {\n this.nativeElement.parentElement?.removeChild(this.nativeElement)\n }\n\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class AssetLoaderService {\n\n public loadStyleSheet(path: string): Observable<LoadedAssetRef<HTMLLinkElement>> {\n return defer(() => loadStyleSheet(path)).pipe(map(v => new LoadedAssetRef(v, path)))\n }\n\n public loadStyle(content: string): Observable<LoadedAssetRef<HTMLStyleElement>> {\n return defer(() => loadStyle(content)).pipe(map(v => new LoadedAssetRef(v, undefined, content)))\n }\n\n}\n","import { Injectable } from '@angular/core'\nimport { IsActiveMatchOptions, NavigationEnd, Router, UrlTree } from '@angular/router'\nimport { Observable } from 'rxjs'\nimport { filter, map, startWith } from 'rxjs/operators'\n\n@Injectable({\n providedIn: 'root'\n})\nexport class RouterHelpersService {\n\n constructor(\n private _router: Router\n ) { }\n\n public isActive(url: string | UrlTree, exact: boolean): Observable<boolean> {\n const opts: IsActiveMatchOptions = exact\n ? { paths: 'exact', queryParams: 'exact', fragment: 'ignored', matrixParams: 'ignored' }\n : { paths: 'subset', queryParams: 'subset', fragment: 'ignored', matrixParams: 'ignored' }\n\n return this._router.events.pipe(\n filter(event => event instanceof NavigationEnd),\n map(event => this._router.isActive(url, opts)),\n startWith(this._router.isActive(url, opts))\n )\n }\n}\n","import { Injectable } from '@angular/core'\n\nimport { Observable, Subscriber } from 'rxjs'\nimport WebFont from 'webfontloader'\n\nimport { hasProperty } from '@theseam/ui-common/utils'\n\nexport type TheSeamFontEvents =\n { type: 'loading' } |\n { type: 'active' } |\n { type: 'inactive' } |\n { type: 'fontloading', familyName: string, fvd: string } |\n { type: 'fontactive', familyName: string, fvd: string } |\n { type: 'fontinactive', familyName: string, fvd: string }\n\n/**\n * Service to help loading fonts.\n *\n * Currently this is just a wrapper for the parts of webfontloader that we need.\n * Eventually this should be generic enough that we can switch loaders without\n * config differences being confusing.\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class TheSeamFontLoaderService {\n\n /**\n * Since this method is just a wrapper for webfontloader right now it accepts\n * anything webfontloader's config accepts, so the event callbacks can still\n * be used, but you should us the emitted objects instead. If we decide to\n * support other font loaders then the event callbacks will most likely be\n * removed.\n *\n * NOTE: If you need to use the events callbacks for some reason, this\n * method's returned observable will still need to be subscribed to, because\n * it doesn't start till subscribed to.\n */\n public load(config: WebFont.Config): Observable<TheSeamFontEvents> {\n return new Observable((subscriber: Subscriber<TheSeamFontEvents>) => {\n WebFont.load({\n ...config,\n /** This event is triggered when all fonts have been requested. */\n loading: () => {\n if (hasProperty(config, 'loading')) {\n config.loading()\n }\n subscriber.next({ type: 'loading' })\n },\n /** This event is triggered when the fonts have rendered. */\n active: () => {\n if (hasProperty(config, 'active')) {\n config.active()\n }\n subscriber.next({ type: 'active' })\n },\n /** This event is triggered when the browser does not support linked fonts or if none of the fonts could be loaded. */\n inactive: () => {\n if (hasProperty(config, 'inactive')) {\n config.inactive()\n }\n subscriber.next({ type: 'inactive' })\n },\n /** This event is triggered once for each font that's loaded. */\n fontloading: (familyName: string, fvd: string) => {\n if (hasProperty(config, 'fontloading')) {\n config.fontloading(familyName, fvd)\n }\n subscriber.next({ type: 'fontloading', familyName, fvd })\n },\n /** This event is triggered once for each font that renders. */\n fontactive: (familyName: string, fvd: string) => {\n if (hasProperty(config, 'fontactive')) {\n config.fontactive(familyName, fvd)\n }\n subscriber.next({ type: 'fontactive', familyName, fvd })\n },\n /** This event is triggered if the font can't be loaded. */\n fontinactive: (familyName: string, fvd: string) => {\n if (hasProperty(config, 'fontinactive')) {\n config.fontinactive(familyName, fvd)\n }\n subscriber.next({ type: 'fontinactive', familyName, fvd })\n },\n })\n })\n }\n\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["map","startWith"],"mappings":";;;;;;;;;MAea,2BAA2B,CAAA;AAUtC,IAAA,WAAA,CACmB,IAAY,EACZ,SAAqC,EACrC,WAAmC,EAAA;AAFnC,QAAA,IAAI,CAAA,IAAA,GAAJ,IAAI,CAAQ;AACZ,QAAA,IAAS,CAAA,SAAA,GAAT,SAAS,CAA4B;AACrC,QAAA,IAAW,CAAA,WAAA,GAAX,WAAW,CAAwB;AAXrC,QAAA,IAAA,CAAA,eAAe,GAAG,IAAI,OAAO,EAAQ,CAAA;AACrC,QAAA,IAAA,CAAA,oBAAoB,GAAG,IAAI,OAAO,EAAwC,CAAA;AAEnF,QAAA,IAAO,CAAA,OAAA,GAAmC,SAAS,CAAA;AAUzD,QAAA,IAAI,CAAC,UAAU,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;iBACnB,CAAA;;;ACxBD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"theseam-ui-common-services.mjs","sources":["../../../projects/ui-common/services/preferences/preferences-record.ts","../../../projects/ui-common/services/preferences/preferences-manager.service.ts","../../../projects/ui-common/services/asset-loader.service.ts","../../../projects/ui-common/services/router-helpers.service.ts","../../../projects/ui-common/services/font-loader.service.ts","../../../projects/ui-common/services/theseam-ui-common-services.ts"],"sourcesContent":["import { isDevMode } from '@angular/core'\r\nimport { map, Observable, of, shareReplay, startWith, Subject, switchMap, take, tap } from 'rxjs'\r\n\r\nimport { notNullOrUndefined } from '@theseam/ui-common/utils'\r\n\r\nimport { TheSeamPreferencesAccessor } from './preferences-accessor'\r\nimport { TheSeamPreferencesBase } from './preferences.models'\r\n\r\nexport type TheSeamPreferencesRecordStatus = 'pending' | 'loaded'\r\n\r\nexport interface TheSeamPreferencesRecordStatusChange {\r\n previous: TheSeamPreferencesRecordStatus\r\n current: TheSeamPreferencesRecordStatus\r\n}\r\n\r\nexport class TheSeamPreferencesMapRecord {\r\n\r\n private readonly _refreshSubject = new Subject<void>()\r\n private readonly _statusChangeSubject = new Subject<TheSeamPreferencesRecordStatusChange>()\r\n\r\n private _status: TheSeamPreferencesRecordStatus = 'pending'\r\n\r\n public readonly observable: Observable<TheSeamPreferencesBase>\r\n public readonly statusChange: Observable<TheSeamPreferencesRecordStatusChange>\r\n\r\n constructor(\r\n private readonly _key: string,\r\n private readonly _accessor: TheSeamPreferencesAccessor,\r\n private readonly _emptyPrefs: TheSeamPreferencesBase,\r\n ) {\r\n this.observable = this._createObservable()\r\n this.statusChange = this._statusChangeSubject.asObservable()\r\n }\r\n\r\n private _createObservable(): Observable<TheSeamPreferencesBase> {\r\n if (!this._accessor) {\r\n return of(this._emptyPrefs)\r\n }\r\n\r\n const accessor = (key: string): Observable<string> =>\r\n this._accessor ? this._accessor.get(key) : of(JSON.stringify(this._emptyPrefs))\r\n\r\n return this._refreshSubject.pipe(\r\n startWith(undefined),\r\n switchMap(() => accessor(this._key).pipe(\r\n map(v => {\r\n if (!v) {\r\n return null\r\n }\r\n\r\n // TODO: Add a schema validator and migration tool to avoid parsing issues.\r\n try {\r\n return this._descerializePreferences(v)\r\n } catch (error) {\r\n if (isDevMode()) {\r\n // eslint-disable-next-line no-console\r\n console.error(error)\r\n }\r\n return null\r\n }\r\n }),\r\n map(v => notNullOrUndefined(v) ? v : this._emptyPrefs),\r\n tap(() => {\r\n this._setStatus('loaded')\r\n })\r\n )),\r\n shareReplay({ bufferSize: 1, refCount: true }),\r\n )\r\n }\r\n\r\n public update(value: TheSeamPreferencesBase): void {\r\n this._accessor.update(this._key, JSON.stringify(value)).pipe(take(1)).subscribe()\r\n }\r\n\r\n public delete(): void {\r\n this._accessor.delete(this._key).pipe(take(1)).subscribe()\r\n }\r\n\r\n public refresh(): void {\r\n this._setStatus('pending')\r\n this._refreshSubject.next()\r\n }\r\n\r\n public isSameAccessor(accessor: TheSeamPreferencesAccessor): boolean {\r\n return this._accessor === accessor\r\n }\r\n\r\n public isSameEmptyPrefs(emptyPrefs: TheSeamPreferencesBase): boolean {\r\n return JSON.stringify(this._emptyPrefs) === JSON.stringify(emptyPrefs)\r\n }\r\n\r\n get status(): TheSeamPreferencesRecordStatus {\r\n return this._status\r\n }\r\n\r\n private _setStatus(status: TheSeamPreferencesRecordStatus): void {\r\n if (this._status === status) {\r\n return\r\n }\r\n const prev = this._status\r\n this._status = status\r\n this._statusChangeSubject.next({ previous: prev, current: status })\r\n }\r\n\r\n private _descerializePreferences(serialized: string): TheSeamPreferencesBase {\r\n const prefs = JSON.parse(serialized)\r\n\r\n // TODO: Implement migration\r\n\r\n return prefs\r\n }\r\n}\r\n","import { Injectable } from '@angular/core'\r\nimport { map, Observable } from 'rxjs'\r\n\r\nimport { TheSeamPreferencesBase } from './preferences.models'\r\nimport { TheSeamPreferencesAccessor } from './preferences-accessor'\r\nimport { TheSeamPreferencesMapRecord } from './preferences-record'\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class TheSeamPreferencesManagerService {\r\n\r\n private readonly _tablePrefsMap = new Map<string, TheSeamPreferencesMapRecord>()\r\n\r\n public preferences(\r\n preferenceKey: string,\r\n accessor: TheSeamPreferencesAccessor,\r\n emptyPrefs: TheSeamPreferencesBase,\r\n ): Observable<TheSeamPreferencesBase> {\r\n let prefs = this._tablePrefsMap.get(preferenceKey)\r\n\r\n if (prefs && !prefs.isSameAccessor(accessor)) {\r\n throw Error(`Preferences accessor mismatch for key '${preferenceKey}'. Changing the accessor is not supported.`)\r\n }\r\n\r\n if (prefs && !prefs.isSameEmptyPrefs(emptyPrefs)) {\r\n throw Error(`Preferences emptyPrefs mismatch for key '${preferenceKey}'. Changing the emptyPrefs is not supported.`)\r\n }\r\n\r\n if (!prefs) {\r\n prefs = new TheSeamPreferencesMapRecord(preferenceKey, accessor, emptyPrefs)\r\n this._tablePrefsMap.set(preferenceKey, prefs)\r\n }\r\n return prefs.observable.pipe(\r\n map(v => {\r\n // This is for assuming the accessor returned an empty object, as a\r\n // default for a missing preference. Instead of throwing an error, we\r\n // return a valid empty preferences.\r\n //\r\n // NOTE: May remove this, when a more generic preferences implementation\r\n // is finished.\r\n if (Object.keys(v).length === 0) {\r\n return emptyPrefs\r\n }\r\n\r\n return v\r\n }),\r\n )\r\n }\r\n\r\n public update(preferenceKey: string, value: TheSeamPreferencesBase): void {\r\n const prefs = this._tablePrefsMap.get(preferenceKey)\r\n if (prefs) {\r\n prefs.update(value)\r\n }\r\n }\r\n\r\n public delete(preferenceKey: string): void {\r\n const prefs = this._tablePrefsMap.get(preferenceKey)\r\n if (prefs) {\r\n prefs.delete()\r\n }\r\n }\r\n\r\n public refresh(preferenceKey: string): void {\r\n const prefs = this._tablePrefsMap.get(preferenceKey)\r\n if (prefs) {\r\n prefs.refresh()\r\n }\r\n }\r\n\r\n public isPending(preferenceKey: string): boolean {\r\n const prefs = this._tablePrefsMap.get(preferenceKey)\r\n return prefs ? prefs.status === 'pending' : false\r\n }\r\n\r\n public isLoaded(preferenceKey: string): boolean {\r\n const prefs = this._tablePrefsMap.get(preferenceKey)\r\n return prefs ? prefs.status === 'loaded' : false\r\n }\r\n\r\n}\r\n","import { Injectable } from '@angular/core'\nimport { defer, Observable } from 'rxjs'\nimport { map } from 'rxjs/operators'\n\nimport { loadStyle, loadStyleSheet } from '@theseam/ui-common/utils'\n\nexport class LoadedAssetRef<T extends HTMLLinkElement | HTMLScriptElement | HTMLStyleElement> {\n\n constructor(\n public readonly nativeElement: T,\n public readonly path?: string,\n public readonly content?: string\n ) {\n\n }\n\n public destroy(): void {\n this.nativeElement.parentElement?.removeChild(this.nativeElement)\n }\n\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class AssetLoaderService {\n\n public loadStyleSheet(path: string): Observable<LoadedAssetRef<HTMLLinkElement>> {\n return defer(() => loadStyleSheet(path)).pipe(map(v => new LoadedAssetRef(v, path)))\n }\n\n public loadStyle(content: string): Observable<LoadedAssetRef<HTMLStyleElement>> {\n return defer(() => loadStyle(content)).pipe(map(v => new LoadedAssetRef(v, undefined, content)))\n }\n\n}\n","import { Injectable } from '@angular/core'\nimport { IsActiveMatchOptions, NavigationEnd, Router, UrlTree } from '@angular/router'\nimport { Observable } from 'rxjs'\nimport { filter, map, startWith } from 'rxjs/operators'\n\n@Injectable({\n providedIn: 'root'\n})\nexport class RouterHelpersService {\n\n constructor(\n private _router: Router\n ) { }\n\n public isActive(url: string | UrlTree, exact: boolean): Observable<boolean> {\n const opts: IsActiveMatchOptions = exact\n ? { paths: 'exact', queryParams: 'exact', fragment: 'ignored', matrixParams: 'ignored' }\n : { paths: 'subset', queryParams: 'subset', fragment: 'ignored', matrixParams: 'ignored' }\n\n return this._router.events.pipe(\n filter(event => event instanceof NavigationEnd),\n map(event => this._router.isActive(url, opts)),\n startWith(this._router.isActive(url, opts))\n )\n }\n}\n","import { Injectable } from '@angular/core'\n\nimport { Observable, Subscriber } from 'rxjs'\nimport WebFont from 'webfontloader'\n\nimport { hasProperty } from '@theseam/ui-common/utils'\n\nexport type TheSeamFontEvents =\n { type: 'loading' } |\n { type: 'active' } |\n { type: 'inactive' } |\n { type: 'fontloading', familyName: string, fvd: string } |\n { type: 'fontactive', familyName: string, fvd: string } |\n { type: 'fontinactive', familyName: string, fvd: string }\n\n/**\n * Service to help loading fonts.\n *\n * Currently this is just a wrapper for the parts of webfontloader that we need.\n * Eventually this should be generic enough that we can switch loaders without\n * config differences being confusing.\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class TheSeamFontLoaderService {\n\n /**\n * Since this method is just a wrapper for webfontloader right now it accepts\n * anything webfontloader's config accepts, so the event callbacks can still\n * be used, but you should us the emitted objects instead. If we decide to\n * support other font loaders then the event callbacks will most likely be\n * removed.\n *\n * NOTE: If you need to use the events callbacks for some reason, this\n * method's returned observable will still need to be subscribed to, because\n * it doesn't start till subscribed to.\n */\n public load(config: WebFont.Config): Observable<TheSeamFontEvents> {\n return new Observable((subscriber: Subscriber<TheSeamFontEvents>) => {\n WebFont.load({\n ...config,\n /** This event is triggered when all fonts have been requested. */\n loading: () => {\n if (hasProperty(config, 'loading')) {\n config.loading()\n }\n subscriber.next({ type: 'loading' })\n },\n /** This event is triggered when the fonts have rendered. */\n active: () => {\n if (hasProperty(config, 'active')) {\n config.active()\n }\n subscriber.next({ type: 'active' })\n },\n /** This event is triggered when the browser does not support linked fonts or if none of the fonts could be loaded. */\n inactive: () => {\n if (hasProperty(config, 'inactive')) {\n config.inactive()\n }\n subscriber.next({ type: 'inactive' })\n },\n /** This event is triggered once for each font that's loaded. */\n fontloading: (familyName: string, fvd: string) => {\n if (hasProperty(config, 'fontloading')) {\n config.fontloading(familyName, fvd)\n }\n subscriber.next({ type: 'fontloading', familyName, fvd })\n },\n /** This event is triggered once for each font that renders. */\n fontactive: (familyName: string, fvd: string) => {\n if (hasProperty(config, 'fontactive')) {\n config.fontactive(familyName, fvd)\n }\n subscriber.next({ type: 'fontactive', familyName, fvd })\n },\n /** This event is triggered if the font can't be loaded. */\n fontinactive: (familyName: string, fvd: string) => {\n if (hasProperty(config, 'fontinactive')) {\n config.fontinactive(familyName, fvd)\n }\n subscriber.next({ type: 'fontinactive', familyName, fvd })\n },\n })\n })\n }\n\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["map","startWith"],"mappings":";;;;;;;;;MAea,2BAA2B,CAAA;AAUtC,IAAA,WAAA,CACmB,IAAY,EACZ,SAAqC,EACrC,WAAmC,EAAA;AAFnC,QAAA,IAAI,CAAA,IAAA,GAAJ,IAAI,CAAQ;AACZ,QAAA,IAAS,CAAA,SAAA,GAAT,SAAS,CAA4B;AACrC,QAAA,IAAW,CAAA,WAAA,GAAX,WAAW,CAAwB;AAXrC,QAAA,IAAA,CAAA,eAAe,GAAG,IAAI,OAAO,EAAQ,CAAA;AACrC,QAAA,IAAA,CAAA,oBAAoB,GAAG,IAAI,OAAO,EAAwC,CAAA;AAEnF,QAAA,IAAO,CAAA,OAAA,GAAmC,SAAS,CAAA;AAUzD,QAAA,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAA;QAC1C,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,oBAAoB,CAAC,YAAY,EAAE,CAAA;KAC7D;IAEO,iBAAiB,GAAA;AACvB,QAAA,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;AACnB,YAAA,OAAO,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;AAC5B,SAAA;AAED,QAAA,MAAM,QAAQ,GAAG,CAAC,GAAW,KAC3B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAA;AAEjF,QAAA,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,CAC9B,SAAS,CAAC,SAAS,CAAC,EACpB,SAA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U,EAAE,GAAG,EAAE,CAAC,CAAA;iBACzD;;AAED,gBAAA,YAAY,EAAE,CAAC,UAAkB,EAAE,GAAW,KAAI;AAChD,oBAAA,IAAI,WAAW,CAAC,MAAM,EAAE,cAAc,CAAC,EAAE;AACvC,wBAAA,MAAM,CAAC,YAAY,CAAC,UAAU,EAAE,GAAG,CAAC,CAAA;AACrC,qBAAA;AACD,oBAAA,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,CAAA;AAC5D,iBAAC,IACD,CAAA;AACJ,SAAC,CAAC,CAAA;KACH;;qHA7DU,wBAAwB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAxB,wBAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,wBAAwB,cAFvB,MAAM,EAAA,CAAA,CAAA;2FAEP,wBAAwB,EAAA,UAAA,EAAA,CAAA;kBAHpC,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;iBACnB,CAAA;;;ACxBD;;AAEG;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theseam-ui-common-story-helpers.mjs","sources":["../../../projects/ui-common/story-helpers/arg-type-helpers.ts","../../../projects/ui-common/story-helpers/story-empty.component.ts","../../../projects/ui-common/story-helpers/initial-route-factory.ts","../../../projects/ui-common/story-helpers/initial-route.service.ts","../../../projects/ui-common/story-helpers/story-initial-route.ts","../../../projects/ui-common/story-helpers/route-button.ts","../../../projects/ui-common/story-helpers/routes-arg-type.ts","../../../projects/ui-common/story-helpers/story-empty-with-route.component.ts","../../../projects/ui-common/story-helpers/story-modal-container.component.ts","../../../projects/ui-common/story-helpers/story-helper-components.module.ts","../../../projects/ui-common/story-helpers/story-toastr.service.ts","../../../projects/ui-common/story-helpers/on-story-bootstrapped-exec.ts","../../../projects/ui-common/story-helpers/on-story-bootstrapped-trigger.ts","../../../projects/ui-common/story-helpers/story-preferences-accessor.service.ts","../../../projects/ui-common/story-helpers/theseam-ui-common-story-helpers.ts"],"sourcesContent":["// import { ArgType } from '@storybook/addons'\n\nimport { OutlineThemeNames, ThemeNames } from '@theseam/ui-common/models'\n\ndeclare type ArgType = any\n\nexport const themeArgType: ArgType = {\n defaultValue: 'primary',\n control: {\n type: 'select',\n options: ThemeNames\n },\n description: `Theme style.`\n}\n\nexport const themeWithOutlineArgType: ArgType = {\n defaultValue: 'primary',\n control: {\n type: 'select',\n options: [ ...ThemeNames, ...OutlineThemeNames ]\n },\n description: `Theme style.`\n}\n\nexport const sizeArgType: ArgType = {\n defaultValue: undefined,\n control: {\n type: 'select',\n options: [ undefined, 'sm', 'lg' ]\n },\n description: `Size.`\n}\n\nexport const buttonTypeArgType: ArgType = {\n defaultValue: 'button',\n control: {\n type: 'select',\n options: [ 'button', 'submit' ]\n },\n description: `Button type.`\n}\n","import { Component } from '@angular/core'\n\n@Component({ template: `` })\nexport class StoryEmptyComponent { }\n","import { StoryInitialRouteService } from './initial-route.service'\n\nexport function storyInitialRouteFactory(_storyInitialRouteService: StoryInitialRouteService) {\n return () => _storyInitialRouteService.setInitialRoute()\n}\n","import { Injectable, InjectionToken, Injector } from '@angular/core'\nimport { NavigationEnd, Router } from '@angular/router'\nimport { filter, take } from 'rxjs/operators'\n\nexport const STORY_INITIAL_ROUTE_URL = new InjectionToken<any>('STORY_INITIAL_ROUTE_URL')\n\n@Injectable()\nexport class StoryInitialRouteService {\n\n constructor(\n private _injector: Injector\n ) { }\n\n public setInitialRoute() {\n const _router = this._injector.get(Router)\n const url = this._injector.get(STORY_INITIAL_ROUTE_URL)\n if (_router.navigated) {\n _router.navigateByUrl(url)\n } else {\n _router.events.pipe(\n filter(e => e instanceof NavigationEnd),\n take(1)\n )\n .subscribe(() => { _router.navigateByUrl(url) })\n }\n }\n\n}\n","import { APP_INITIALIZER, ModuleWithProviders, NgModule } from '@angular/core'\n\nimport { storyInitialRouteFactory } from './initial-route-factory'\nimport { StoryInitialRouteService, STORY_INITIAL_ROUTE_URL } from './initial-route.service'\n\n@NgModule()\nexport class StoryInitialRouteModule {\n static forRoot(url: string): ModuleWithProviders<StoryInitialRouteModule> {\n return {\n ngModule: StoryInitialRouteModule,\n providers: [\n StoryInitialRouteService,\n {\n provide: APP_INITIALIZER,\n useFactory: storyInitialRouteFactory,\n deps: [ StoryInitialRouteService ],\n multi: true\n },\n { provide: STORY_INITIAL_ROUTE_URL, useValue: url }\n ]\n }\n }\n\n}\n","// import { button } from '@storybook/addon-knobs'\n\n/**\n * Until I find a way to avoid '@storybook/addon-knobs' from interfering with\n * NgZone I can't import it in the knob when built by ng-packagr.\n */\nexport function routeButton(buttonKnob: any, url: string) {\n return buttonKnob(url, () => {\n location.hash = `#${url}`\n return false\n })\n}\n","// import { ArgType } from '@storybook/addons'\n\ndeclare const __STORYBOOK_ADDONS: any\n\nfunction goToHashUrl(url: string): void { location.hash = `#${url}` }\n\n// __STORYBOOK_ADDONS.getChannel().on('custom/go-to-hash', (data: { hash: string }) => {\n\n// goToHashUrl(data.hash)\n// })\n\n// __STORYBOOK_ADDONS.getChannel().on('storyArgsUpdated', (data: { hash: string }) => {\n// console.log('storyArgsUpdated')\n// })\n\nexport function routesArgType(routes: string[])/*: ArgType*/ {\n return {\n options: routes,\n control: {\n type: 'select',\n // Runs in the 'manager', so I am emitting to a channel in the 'preview'.\n onChange: (e: any, a: any) => { __STORYBOOK_ADDONS.getChannel().emit('custom/go-to-hash', { hash: e }); return e }\n }\n }\n}\n","import { Component } from '@angular/core'\n\n@Component({ template: `<router-outlet></router-outlet>` })\nexport class StoryEmptyWithRouteComponent { }\n","import { Component, Injector, Input, OnDestroy } from '@angular/core'\nimport { combineLatest, Observable, of, ReplaySubject, Subject } from 'rxjs'\nimport { auditTime, map, startWith, takeUntil } from 'rxjs/operators'\n\nimport { ModalConfig, ModalRef, MODAL_DATA } from '@theseam/ui-common/modal'\nimport type { ComponentType } from '@theseam/ui-common/models'\n\nclass FakeModalRef<T, R = any> implements Partial<ModalRef<T, R>> {\n\n afterOpened() { return of(undefined) }\n\n close(dialogResult?: R): void { }\n\n}\n\n@Component({\n // eslint-disable-next-line @angular-eslint/component-selector\n selector: 'story-modal-container-component',\n template: `\n <div class=\"cdk-overlay-container\">\n <div class=\"cdk-overlay-backdrop cdk-overlay-dark-backdrop cdk-overlay-backdrop-showing\"></div>\n <div class=\"cdk-global-overlay-wrapper\"\n dir=\"ltr\"\n style=\"justify-content: flex-start; align-items: center; pointer-events: auto\"\n seamOverlayScrollbar>\n <div class=\"seam-modal-container modal-dialog modal-dialog-centered {{ modalConfig ? modalConfig.modalSize : 'modal-lg' }}\"\n tabindex=\"-1\"\n [class.modal-lg]=\"!modalConfig\">\n <div class=\"modal-content\">\n <ng-container *ngIf=\"_outletData$ | async as outletData\">\n <ng-container *ngComponentOutlet=\"outletData.component; injector: outletData.injector;\"></ng-container>\n </ng-container>\n </div>\n </div>\n </div>\n </div>\n `,\n styles: [`\n .seam-modal-container[tabindex=\"-1\"]:focus {\n outline: 0 !important;\n }\n `]\n})\nexport class StoryModalContainerComponent<T, D = any> implements OnDestroy {\n\n private readonly _ngUnsubscribe = new Subject<void>()\n\n @Input() set component(c: ComponentType<T>) { this._component.next(c) }\n @Input() set data(d: D) { this._data.next(d) }\n\n @Input() modalConfig?: ModalConfig<D>\n\n _component = new ReplaySubject<ComponentType<T>>(1)\n _data = new ReplaySubject<D>(1)\n\n _outletData$: Observable<{ component: ComponentType<T>, injector: Injector } | null>\n\n constructor(\n private _injector: Injector\n ) {\n this._outletData$ = combineLatest([\n this._component.asObservable(),\n this._data.asObservable().pipe(startWith(undefined))\n ]).pipe(\n auditTime(0),\n map(([ component, data ]) => ({\n component,\n injector: this._createInjector(data)\n })),\n takeUntil(this._ngUnsubscribe)\n )\n }\n\n ngOnDestroy() {\n this._ngUnsubscribe.next(undefined)\n this._ngUnsubscribe.complete()\n }\n\n private _createInjector(data?: D): Injector {\n return Injector.create({\n providers: [\n { provide: ModalRef, useClass: FakeModalRef, deps: [] },\n { provide: MODAL_DATA, useValue: data }\n ],\n parent: this._injector\n })\n }\n\n}\n","import { CommonModule } from '@angular/common'\nimport { NgModule } from '@angular/core'\nimport { RouterModule } from '@angular/router'\n\nimport { TheSeamScrollbarModule } from '@theseam/ui-common/scrollbar'\n\nimport { StoryEmptyWithRouteComponent } from './story-empty-with-route.component'\nimport { StoryEmptyComponent } from './story-empty.component'\nimport { StoryModalContainerComponent } from './story-modal-container.component'\n\n@NgModule({\n declarations: [\n StoryEmptyComponent,\n StoryEmptyWithRouteComponent,\n StoryModalContainerComponent\n ],\n imports: [\n CommonModule,\n RouterModule,\n TheSeamScrollbarModule\n ],\n exports: [\n StoryEmptyComponent,\n StoryEmptyWithRouteComponent,\n StoryModalContainerComponent\n ]\n})\nexport class StoryHelperComponentsModule { }\n","import { Injectable } from '@angular/core'\n\nimport { ActiveToast, GlobalConfig, IndividualConfig, ToastContainerDirective } from 'ngx-toastr'\n\n@Injectable()\nexport class StoryToastrService {\n toastrConfig?: GlobalConfig\n currentlyActive = 0\n toasts: ActiveToast<any>[] = []\n overlayContainer?: ToastContainerDirective\n previousToastMessage: string | undefined\n\n /** show toast */\n show(\n message?: string,\n title?: string,\n override: Partial<IndividualConfig> = {},\n type = ''\n ) { }\n\n /** show successful toast */\n success(\n message?: string,\n title?: string,\n override: Partial<IndividualConfig> = {}\n ) { }\n\n /** show error toast */\n error(\n message?: string,\n title?: string,\n override: Partial<IndividualConfig> = {}\n ) { }\n\n /** show info toast */\n info(\n message?: string,\n title?: string,\n override: Partial<IndividualConfig> = {}\n ) { }\n\n /** show warning toast */\n warning(\n message?: string,\n title?: string,\n override: Partial<IndividualConfig> = {}\n ) { }\n\n /**\n * Remove all or a single toast by id\n */\n clear(toastId?: number) { }\n\n /**\n * Remove and destroy a single toast by id\n */\n remove(toastId: number) { }\n\n /**\n * Determines if toast message is already shown\n */\n findDuplicate(message: string, resetOnDuplicate: boolean, countDuplicates: boolean) { }\n\n}\n","import { APP_BOOTSTRAP_LISTENER, ComponentRef } from '@angular/core'\n// import { STORY } from '@storybook/angular/dist/ts3.9/client/preview/angular/app.token'\n// import { StoryFnAngularReturnType } from '@storybook/angular/dist/ts3.9/client/preview/types'\nimport { Observable } from 'rxjs'\nimport { first } from 'rxjs/operators'\n\n/**\n * Can be used to access a stories component after the story has been bootstrapped.\n *\n * Example:\n * ```ts\n * @Component({\n * selector: 'story-example',\n * template: `Touched: {{ exControl.touched }}`\n * })\n * class StoryExampleComponent {\n * exControl = new FormControl('')\n * }\n *\n * export const TouchExample2 = () => ({\n * moduleMetadata: {\n * declarations: [ StoryExampleComponent ],\n * providers: [ onStoryBootstrappedExec((c: StoryExampleComponent) => c.exControl.markAsTouched()) ]\n * },\n * props: { },\n * component: StoryExampleComponent\n * })\n * ```\n */\n// export function onStoryBootstrappedExec<T = any>(callback: (component: T) => void) {\n// function bootstrapped(componentRef: ComponentRef<any>) {\n// const data = componentRef.instance.target.injector.get(STORY, null) as Observable<StoryFnAngularReturnType> | null\n// if (!data) {\n// console.warn(`STORY provider not found.`)\n// return\n// }\n// data?.pipe(first()).subscribe(story => {\n// if (!story.component) {\n// console.warn(`'onStoryBootstrappedExec' only supported on stories that provide 'component' property.`)\n// return\n// }\n\n// let c = null\n// for (let i = 0; i < componentRef.instance.target.length; i++) {\n// const tmp = componentRef.instance.target._embeddedViews[i].nodes?.find((f: any) => f?.instance instanceof story.component)\n// const comp = tmp?.instance\n// if (comp) {\n// c = comp\n// break\n// }\n// }\n\n// if (!c) {\n// console.warn(`Story component instance not found.`)\n// return\n// }\n\n// if (c) {\n// callback(c)\n// }\n// })\n// }\n\n// return {\n// provide: APP_BOOTSTRAP_LISTENER,\n// useValue: bootstrapped,\n// multi: true\n// }\n// }\n","import { APP_BOOTSTRAP_LISTENER, ComponentRef, ElementRef } from '@angular/core'\n\n// TODO: Consider supporting a target selection function, so that complex\n// selections that can't be expressed by a simple selector can be used.\n\n/**\n * Can be used to trigger an event on a target element when the story component has been bootstrapped.\n *\n * Example:\n * ```\n * export const TouchExample1 = () => ({\n * moduleMetadata: {\n * providers: [ onStoryBootstrappedTrigger('input', 'blur') ]\n * },\n * props: { control: new FormControl('') },\n * template: `\n * <input type=\"text\" [formControl]=\"control\">\n * Touched: {{ control.touched }}\n * `\n * })\n * ```\n */\nexport function onStoryBootstrappedTrigger(targetSelector: string, eventName: string) {\n function bootstrapped(componentRef: ComponentRef<any>) {\n const elementRef = componentRef.injector.get(ElementRef, null)\n const target = elementRef?.nativeElement.querySelector(targetSelector)\n if (!target) {\n // eslint-disable-next-line no-console\n console.warn(`Unable to trigger event '${eventName}'. Target '${targetSelector}' not found.`)\n }\n\n const e = document.createEvent('HTMLEvents')\n e.initEvent('blur', false, true)\n target.dispatchEvent(e)\n }\n\n return {\n provide: APP_BOOTSTRAP_LISTENER,\n useValue: bootstrapped,\n multi: true\n }\n}\n","import { Injectable } from '@angular/core'\r\nimport { TheSeamPreferencesAccessor } from '@theseam/ui-common/services'\r\nimport { Observable, of } from 'rxjs'\r\n\r\nconst ACCESSOR_PREFIX = 'story-pref'\r\n\r\n@Injectable()\r\nexport class StoryPreferencesAccessorService implements TheSeamPreferencesAccessor {\r\n\r\n /**\r\n * Gets a preference.\r\n */\r\n public get(name: string): Observable<string> {\r\n // console.log('get', name)\r\n return of(localStorage.getItem(`${ACCESSOR_PREFIX}-${name}`) || '{}')\r\n }\r\n\r\n /**\r\n * Update a preference.\r\n */\r\n public update(name: string, value: string): Observable<string> {\r\n // console.log('update', name)\r\n localStorage.setItem(`${ACCESSOR_PREFIX}-${name}`, value)\r\n return this.get(name)\r\n }\r\n\r\n /**\r\n * Delete a preference.\r\n */\r\n public delete(name: string): Observable<boolean> {\r\n localStorage.removeItem(`${ACCESSOR_PREFIX}-${name}`)\r\n return of(true)\r\n }\r\n\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1"],"mappings":";;;;;;;;;;;;;AAAA;AAMa,MAAA,YAAY,GAAY;AACnC,IAAA,YAAY,EAAE,SAAS;AACvB,IAAA,OAAO,EAAE;AACP,QAAA,IAAI,EAAE,QAAQ;AACd,QAAA,OAAO,EAAE,UAAU;AACpB,KAAA;AACD,IAAA,WAAW,EAAE,CAAc,YAAA,CAAA;EAC5B;AAEY,MAAA,uBAAuB,GAAY;AAC9C,IAAA,YAAY,EAAE,SAAS;AACvB,IAAA,OAAO,EAAE;AACP,QAAA,IAAI,EAAE,QAAQ;AACd,QAAA,OAAO,EAAE,CAAE,GAAG,UAAU,EAAE,GAAG,iBAAiB,CAAE;AACjD,KAAA;AACD,IAAA,WAAW,EAAE,CAAc,YAAA,CAAA;EAC5B;AAEY,MAAA,WAAW,GAAY;AAClC,IAAA,YAAY,EAAE,SAAS;AACvB,IAAA,OAAO,EAAE;AACP,QAAA,IAAI,EAAE,QAAQ;AACd,QAAA,OAAO,EAAE,CAAE,SAAS,EAAE,IAAI,EAAE,IAAI,CAAE;AACnC,KAAA;AACD,IAAA,WAAW,EAAE,CAAO,KAAA,CAAA;EACrB;AAEY,MAAA,iBAAiB,GAAY;AACxC,IAAA,YAAY,EAAE,QAAQ;AACtB,IAAA,OAAO,EAAE;AACP,QAAA,IAAI,EAAE,QAAQ;AACd,QAAA,OAAO,EAAE,CAAE,QAAQ,EAAE,QAAQ,CAAE;AAChC,KAAA;AACD,IAAA,WAAW,EAAE,CAAc,YAAA,CAAA;;;MCpChB,mBAAmB,CAAA;;gHAAnB,mBAAmB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAAnB,mBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA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;IACI,MAAM,CAAC,IAAY,EAAE,KAAa,EAAA;;QAEvC,YAAY,CAAC,OAAO,CAAC,CAAG,EAAA,eAAe,CAAI,CAAA,EAAA,IAAI,CAAE,CAAA,EAAE,KAAK,CAAC,CAAA;AACzD,QAAA,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;KACtB;AAED;;AAEG;AACI,IAAA,MAAM,CAAC,IAAY,EAAA;QACxB,YAAY,CAAC,UAAU,CAAC,CAAA,EAAG,eAAe,CAAI,CAAA,EAAA,IAAI,CAAE,CAAA,CAAC,CAAA;AACrD,QAAA,OAAO,EAAE,CAAC,IAAI,CAAC,CAAA;KAChB;;4HAzBU,+BAA+B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;gIAA/B,+BAA+B,EAAA,CAAA,CAAA;2FAA/B,+BAA+B,EAAA,UAAA,EAAA,CAAA;kBAD3C,UAAU;;;ACNX;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"theseam-ui-common-story-helpers.mjs","sources":["../../../projects/ui-common/story-helpers/arg-type-helpers.ts","../../../projects/ui-common/story-helpers/story-empty.component.ts","../../../projects/ui-common/story-helpers/initial-route-factory.ts","../../../projects/ui-common/story-helpers/initial-route.service.ts","../../../projects/ui-common/story-helpers/story-initial-route.ts","../../../projects/ui-common/story-helpers/route-button.ts","../../../projects/ui-common/story-helpers/routes-arg-type.ts","../../../projects/ui-common/story-helpers/story-empty-with-route.component.ts","../../../projects/ui-common/story-helpers/story-modal-container.component.ts","../../../projects/ui-common/story-helpers/story-helper-components.module.ts","../../../projects/ui-common/story-helpers/story-toastr.service.ts","../../../projects/ui-common/story-helpers/on-story-bootstrapped-exec.ts","../../../projects/ui-common/story-helpers/on-story-bootstrapped-trigger.ts","../../../projects/ui-common/story-helpers/story-preferences-accessor.service.ts","../../../projects/ui-common/story-helpers/theseam-ui-common-story-helpers.ts"],"sourcesContent":["// import { ArgType } from '@storybook/addons'\n\nimport { OutlineThemeNames, ThemeNames } from '@theseam/ui-common/models'\n\ndeclare type ArgType = any\n\nexport const themeArgType: ArgType = {\n defaultValue: 'primary',\n control: {\n type: 'select',\n options: ThemeNames\n },\n description: `Theme style.`\n}\n\nexport const themeWithOutlineArgType: ArgType = {\n defaultValue: 'primary',\n control: {\n type: 'select',\n options: [ ...ThemeNames, ...OutlineThemeNames ]\n },\n description: `Theme style.`\n}\n\nexport const sizeArgType: ArgType = {\n defaultValue: undefined,\n control: {\n type: 'select',\n options: [ undefined, 'sm', 'lg' ]\n },\n description: `Size.`\n}\n\nexport const buttonTypeArgType: ArgType = {\n defaultValue: 'button',\n control: {\n type: 'select',\n options: [ 'button', 'submit' ]\n },\n description: `Button type.`\n}\n","import { Component } from '@angular/core'\n\n@Component({ template: `` })\nexport class StoryEmptyComponent { }\n","import { StoryInitialRouteService } from './initial-route.service'\n\nexport function storyInitialRouteFactory(_storyInitialRouteService: StoryInitialRouteService) {\n return () => _storyInitialRouteService.setInitialRoute()\n}\n","import { Injectable, InjectionToken, Injector } from '@angular/core'\nimport { NavigationEnd, Router } from '@angular/router'\nimport { filter, take } from 'rxjs/operators'\n\nexport const STORY_INITIAL_ROUTE_URL = new InjectionToken<any>('STORY_INITIAL_ROUTE_URL')\n\n@Injectable()\nexport class StoryInitialRouteService {\n\n constructor(\n private _injector: Injector\n ) { }\n\n public setInitialRoute() {\n const _router = this._injector.get(Router)\n const url = this._injector.get(STORY_INITIAL_ROUTE_URL)\n if (_router.navigated) {\n _router.navigateByUrl(url)\n } else {\n _router.events.pipe(\n filter(e => e instanceof NavigationEnd),\n take(1)\n )\n .subscribe(() => { _router.navigateByUrl(url) })\n }\n }\n\n}\n","import { APP_INITIALIZER, ModuleWithProviders, NgModule } from '@angular/core'\n\nimport { storyInitialRouteFactory } from './initial-route-factory'\nimport { StoryInitialRouteService, STORY_INITIAL_ROUTE_URL } from './initial-route.service'\n\n@NgModule()\nexport class StoryInitialRouteModule {\n static forRoot(url: string): ModuleWithProviders<StoryInitialRouteModule> {\n return {\n ngModule: StoryInitialRouteModule,\n providers: [\n StoryInitialRouteService,\n {\n provide: APP_INITIALIZER,\n useFactory: storyInitialRouteFactory,\n deps: [ StoryInitialRouteService ],\n multi: true\n },\n { provide: STORY_INITIAL_ROUTE_URL, useValue: url }\n ]\n }\n }\n\n}\n","// import { button } from '@storybook/addon-knobs'\n\n/**\n * Until I find a way to avoid '@storybook/addon-knobs' from interfering with\n * NgZone I can't import it in the knob when built by ng-packagr.\n */\nexport function routeButton(buttonKnob: any, url: string) {\n return buttonKnob(url, () => {\n location.hash = `#${url}`\n return false\n })\n}\n","// import { ArgType } from '@storybook/addons'\n\ndeclare const __STORYBOOK_ADDONS: any\n\nfunction goToHashUrl(url: string): void { location.hash = `#${url}` }\n\n// __STORYBOOK_ADDONS.getChannel().on('custom/go-to-hash', (data: { hash: string }) => {\n\n// goToHashUrl(data.hash)\n// })\n\n// __STORYBOOK_ADDONS.getChannel().on('storyArgsUpdated', (data: { hash: string }) => {\n// console.log('storyArgsUpdated')\n// })\n\nexport function routesArgType(routes: string[])/*: ArgType*/ {\n return {\n options: routes,\n control: {\n type: 'select',\n // Runs in the 'manager', so I am emitting to a channel in the 'preview'.\n onChange: (e: any, a: any) => { __STORYBOOK_ADDONS.getChannel().emit('custom/go-to-hash', { hash: e }); return e }\n }\n }\n}\n","import { Component } from '@angular/core'\n\n@Component({ template: `<router-outlet></router-outlet>` })\nexport class StoryEmptyWithRouteComponent { }\n","import { Component, Injector, Input, OnDestroy } from '@angular/core'\nimport { combineLatest, Observable, of, ReplaySubject, Subject } from 'rxjs'\nimport { auditTime, map, startWith, takeUntil } from 'rxjs/operators'\n\nimport { ModalConfig, ModalRef, MODAL_DATA } from '@theseam/ui-common/modal'\nimport type { ComponentType } from '@theseam/ui-common/models'\n\nclass FakeModalRef<T, R = any> implements Partial<ModalRef<T, R>> {\n\n afterOpened() { return of(undefined) }\n\n close(dialogResult?: R): void { }\n\n}\n\n@Component({\n // eslint-disable-next-line @angular-eslint/component-selector\n selector: 'story-modal-container-component',\n template: `\n <div class=\"cdk-overlay-container\">\n <div class=\"cdk-overlay-backdrop cdk-overlay-dark-backdrop cdk-overlay-backdrop-showing\"></div>\n <div class=\"cdk-global-overlay-wrapper\"\n dir=\"ltr\"\n style=\"justify-content: flex-start; align-items: center; pointer-events: auto\"\n seamOverlayScrollbar>\n <div class=\"seam-modal-container modal-dialog modal-dialog-centered {{ modalConfig ? modalConfig.modalSize : 'modal-lg' }}\"\n tabindex=\"-1\"\n [class.modal-lg]=\"!modalConfig\">\n <div class=\"modal-content\">\n <ng-container *ngIf=\"_outletData$ | async as outletData\">\n <ng-container *ngComponentOutlet=\"outletData.component; injector: outletData.injector;\"></ng-container>\n </ng-container>\n </div>\n </div>\n </div>\n </div>\n `,\n styles: [`\n .seam-modal-container[tabindex=\"-1\"]:focus {\n outline: 0 !important;\n }\n `]\n})\nexport class StoryModalContainerComponent<T, D = any> implements OnDestroy {\n\n private readonly _ngUnsubscribe = new Subject<void>()\n\n @Input() set component(c: ComponentType<T>) { this._component.next(c) }\n @Input() set data(d: D) { this._data.next(d) }\n\n @Input() modalConfig?: ModalConfig<D>\n\n _component = new ReplaySubject<ComponentType<T>>(1)\n _data = new ReplaySubject<D>(1)\n\n _outletData$: Observable<{ component: ComponentType<T>, injector: Injector } | null>\n\n constructor(\n private _injector: Injector\n ) {\n this._outletData$ = combineLatest([\n this._component.asObservable(),\n this._data.asObservable().pipe(startWith(undefined))\n ]).pipe(\n auditTime(0),\n map(([ component, data ]) => ({\n component,\n injector: this._createInjector(data)\n })),\n takeUntil(this._ngUnsubscribe)\n )\n }\n\n ngOnDestroy() {\n this._ngUnsubscribe.next(undefined)\n this._ngUnsubscribe.complete()\n }\n\n private _createInjector(data?: D): Injector {\n return Injector.create({\n providers: [\n { provide: ModalRef, useClass: FakeModalRef, deps: [] },\n { provide: MODAL_DATA, useValue: data }\n ],\n parent: this._injector\n })\n }\n\n}\n","import { CommonModule } from '@angular/common'\nimport { NgModule } from '@angular/core'\nimport { RouterModule } from '@angular/router'\n\nimport { TheSeamScrollbarModule } from '@theseam/ui-common/scrollbar'\n\nimport { StoryEmptyWithRouteComponent } from './story-empty-with-route.component'\nimport { StoryEmptyComponent } from './story-empty.component'\nimport { StoryModalContainerComponent } from './story-modal-container.component'\n\n@NgModule({\n declarations: [\n StoryEmptyComponent,\n StoryEmptyWithRouteComponent,\n StoryModalContainerComponent\n ],\n imports: [\n CommonModule,\n RouterModule,\n TheSeamScrollbarModule\n ],\n exports: [\n StoryEmptyComponent,\n StoryEmptyWithRouteComponent,\n StoryModalContainerComponent\n ]\n})\nexport class StoryHelperComponentsModule { }\n","import { Injectable } from '@angular/core'\n\nimport { ActiveToast, GlobalConfig, IndividualConfig, ToastContainerDirective } from 'ngx-toastr'\n\n@Injectable()\nexport class StoryToastrService {\n toastrConfig?: GlobalConfig\n currentlyActive = 0\n toasts: ActiveToast<any>[] = []\n overlayContainer?: ToastContainerDirective\n previousToastMessage: string | undefined\n\n /** show toast */\n show(\n message?: string,\n title?: string,\n override: Partial<IndividualConfig> = {},\n type = ''\n ) { }\n\n /** show successful toast */\n success(\n message?: string,\n title?: string,\n override: Partial<IndividualConfig> = {}\n ) { }\n\n /** show error toast */\n error(\n message?: string,\n title?: string,\n override: Partial<IndividualConfig> = {}\n ) { }\n\n /** show info toast */\n info(\n message?: string,\n title?: string,\n override: Partial<IndividualConfig> = {}\n ) { }\n\n /** show warning toast */\n warning(\n message?: string,\n title?: string,\n override: Partial<IndividualConfig> = {}\n ) { }\n\n /**\n * Remove all or a single toast by id\n */\n clear(toastId?: number) { }\n\n /**\n * Remove and destroy a single toast by id\n */\n remove(toastId: number) { }\n\n /**\n * Determines if toast message is already shown\n */\n findDuplicate(message: string, resetOnDuplicate: boolean, countDuplicates: boolean) { }\n\n}\n","import { APP_BOOTSTRAP_LISTENER, ComponentRef } from '@angular/core'\n// import { STORY } from '@storybook/angular/dist/ts3.9/client/preview/angular/app.token'\n// import { StoryFnAngularReturnType } from '@storybook/angular/dist/ts3.9/client/preview/types'\nimport { Observable } from 'rxjs'\nimport { first } from 'rxjs/operators'\n\n/**\n * Can be used to access a stories component after the story has been bootstrapped.\n *\n * Example:\n * ```ts\n * @Component({\n * selector: 'story-example',\n * template: `Touched: {{ exControl.touched }}`\n * })\n * class StoryExampleComponent {\n * exControl = new FormControl('')\n * }\n *\n * export const TouchExample2 = () => ({\n * moduleMetadata: {\n * declarations: [ StoryExampleComponent ],\n * providers: [ onStoryBootstrappedExec((c: StoryExampleComponent) => c.exControl.markAsTouched()) ]\n * },\n * props: { },\n * component: StoryExampleComponent\n * })\n * ```\n */\n// export function onStoryBootstrappedExec<T = any>(callback: (component: T) => void) {\n// function bootstrapped(componentRef: ComponentRef<any>) {\n// const data = componentRef.instance.target.injector.get(STORY, null) as Observable<StoryFnAngularReturnType> | null\n// if (!data) {\n// console.warn(`STORY provider not found.`)\n// return\n// }\n// data?.pipe(first()).subscribe(story => {\n// if (!story.component) {\n// console.warn(`'onStoryBootstrappedExec' only supported on stories that provide 'component' property.`)\n// return\n// }\n\n// let c = null\n// for (let i = 0; i < componentRef.instance.target.length; i++) {\n// const tmp = componentRef.instance.target._embeddedViews[i].nodes?.find((f: any) => f?.instance instanceof story.component)\n// const comp = tmp?.instance\n// if (comp) {\n// c = comp\n// break\n// }\n// }\n\n// if (!c) {\n// console.warn(`Story component instance not found.`)\n// return\n// }\n\n// if (c) {\n// callback(c)\n// }\n// })\n// }\n\n// return {\n// provide: APP_BOOTSTRAP_LISTENER,\n// useValue: bootstrapped,\n// multi: true\n// }\n// }\n","import { APP_BOOTSTRAP_LISTENER, ComponentRef, ElementRef } from '@angular/core'\n\n// TODO: Consider supporting a target selection function, so that complex\n// selections that can't be expressed by a simple selector can be used.\n\n/**\n * Can be used to trigger an event on a target element when the story component has been bootstrapped.\n *\n * Example:\n * ```\n * export const TouchExample1 = () => ({\n * moduleMetadata: {\n * providers: [ onStoryBootstrappedTrigger('input', 'blur') ]\n * },\n * props: { control: new FormControl('') },\n * template: `\n * <input type=\"text\" [formControl]=\"control\">\n * Touched: {{ control.touched }}\n * `\n * })\n * ```\n */\nexport function onStoryBootstrappedTrigger(targetSelector: string, eventName: string) {\n function bootstrapped(componentRef: ComponentRef<any>) {\n const elementRef = componentRef.injector.get(ElementRef, null)\n const target = elementRef?.nativeElement.querySelector(targetSelector)\n if (!target) {\n // eslint-disable-next-line no-console\n console.warn(`Unable to trigger event '${eventName}'. Target '${targetSelector}' not found.`)\n }\n\n const e = document.createEvent('HTMLEvents')\n e.initEvent('blur', false, true)\n target.dispatchEvent(e)\n }\n\n return {\n provide: APP_BOOTSTRAP_LISTENER,\n useValue: bootstrapped,\n multi: true\n }\n}\n","import { Injectable } from '@angular/core'\r\nimport { Observable, of } from 'rxjs'\r\n\r\nimport { TheSeamPreferencesAccessor } from '@theseam/ui-common/services'\r\n\r\nconst ACCESSOR_PREFIX = 'story-pref'\r\n\r\n@Injectable()\r\nexport class StoryPreferencesAccessorService implements TheSeamPreferencesAccessor {\r\n\r\n /**\r\n * Gets a preference.\r\n */\r\n public get(name: string): Observable<string> {\r\n console.log('get', name)\r\n return of(localStorage.getItem(`${ACCESSOR_PREFIX}-${name}`) || '{}')\r\n }\r\n\r\n /**\r\n * Update a preference.\r\n */\r\n public update(name: string, value: string): Observable<string> {\r\n // console.log('update', name)\r\n localStorage.setItem(`${ACCESSOR_PREFIX}-${name}`, value)\r\n return this.get(name)\r\n }\r\n\r\n /**\r\n * Delete a preference.\r\n */\r\n public delete(name: string): Observable<boolean> {\r\n localStorage.removeItem(`${ACCESSOR_PREFIX}-${name}`)\r\n return of(true)\r\n }\r\n\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1"],"mappings":";;;;;;;;;;;;;AAAA;AAMa,MAAA,YAAY,GAAY;AACnC,IAAA,YAAY,EAAE,SAAS;AACvB,IAAA,OA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,QAAA,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;KACtB;AAED;;AAEG;AACI,IAAA,MAAM,CAAC,IAAY,EAAA;QACxB,YAAY,CAAC,UAAU,CAAC,CAAA,EAAG,eAAe,CAAI,CAAA,EAAA,IAAI,CAAE,CAAA,CAAC,CAAA;AACrD,QAAA,OAAO,EAAE,CAAC,IAAI,CAAC,CAAA;KAChB;;4HAzBU,+BAA+B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;gIAA/B,+BAA+B,EAAA,CAAA,CAAA;2FAA/B,+BAA+B,EAAA,UAAA,EAAA,CAAA;kBAD3C,UAAU;;;ACPX;;AAEG;;;;"}
|
|
@@ -741,21 +741,24 @@ class DashboardWidgetsService {
|
|
|
741
741
|
})));
|
|
742
742
|
}
|
|
743
743
|
createWidgetPortal(def, vcr) {
|
|
744
|
+
const injector = Injector.create({ providers: [
|
|
745
|
+
{ provide: THESEAM_WIDGET_DATA, useValue: { widgetId: def.widgetId } }
|
|
746
|
+
], parent: this._viewContainerRefSubject.value?.injector });
|
|
747
|
+
// TODO: I still use the ViewContainerRef injector, but I don't pass it to
|
|
748
|
+
// the portal, because it throws an error and I am not sure why. I would
|
|
749
|
+
// like to find out why, even though I don't think it is needed, because our
|
|
750
|
+
// code has been leaving it undefined for a while, when I thought it was
|
|
751
|
+
// being used.
|
|
744
752
|
if (typeof def.component === 'string') {
|
|
745
|
-
const injector = Injector.create({ providers: [
|
|
746
|
-
{ provide: THESEAM_WIDGET_DATA, useValue: { widgetId: def.widgetId } }
|
|
747
|
-
], parent: this._viewContainerRefSubject.value?.injector });
|
|
748
753
|
return this._dynamicComponentLoaderModule
|
|
749
754
|
.getComponentFactory(def.component)
|
|
750
755
|
.pipe(map(componentFactory => {
|
|
751
|
-
return new ComponentPortal(componentFactory.componentType,
|
|
752
|
-
// undefined,
|
|
753
|
-
injector, componentFactory /* ComponentFactoryBoundToModule */.ngModule.componentFactoryResolver);
|
|
756
|
+
return new ComponentPortal(componentFactory.componentType, undefined, injector, componentFactory /* ComponentFactoryBoundToModule */.ngModule.componentFactoryResolver);
|
|
754
757
|
}), take(1));
|
|
755
758
|
}
|
|
756
759
|
return def.componentFactoryResolver
|
|
757
|
-
? of(new ComponentPortal(def.component,
|
|
758
|
-
: of(new ComponentPortal(def.component,
|
|
760
|
+
? of(new ComponentPortal(def.component, undefined, injector, def.componentFactoryResolver))
|
|
761
|
+
: of(new ComponentPortal(def.component, undefined, injector));
|
|
759
762
|
}
|
|
760
763
|
updateOrder() {
|
|
761
764
|
return this.widgetColumns$
|
|
@@ -871,6 +874,7 @@ class DashboardWidgetsComponent {
|
|
|
871
874
|
this._layoutChange = new Subject();
|
|
872
875
|
this.widgetsChange = new EventEmitter();
|
|
873
876
|
this._widthChange = new Subject();
|
|
877
|
+
this._dashboardWidgets.setViewContainerRef(this._viewContainerRef);
|
|
874
878
|
this.containers$ = this._containers.asObservable();
|
|
875
879
|
this._gapStyleSize$ = this._gapSize.pipe(auditTime(0), map(size => size / 2), shareReplay({ bufferSize: 1, refCount: true }));
|
|
876
880
|
this._widthChange.pipe(debounceTime(30), tap(width => {
|