@ssv/ngx.ux 1.3.0 → 1.4.1
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/CHANGELOG.md +13 -0
- package/README.md +15 -0
- package/bundles/ssv-ngx.ux.umd.js +130 -51
- package/bundles/ssv-ngx.ux.umd.js.map +1 -1
- package/bundles/ssv-ngx.ux.umd.min.js +1 -1
- package/bundles/ssv-ngx.ux.umd.min.js.map +1 -1
- package/esm2015/module.js +3 -2
- package/esm2015/version.js +2 -2
- package/esm2015/viewport/index.js +6 -5
- package/esm2015/viewport/viewport-data/viewport-data.service.js +3 -3
- package/esm2015/viewport/viewport-matcher-var.directive.js +66 -0
- package/esm2015/viewport/viewport-matcher.directive.js +38 -38
- package/esm2015/viewport/viewport.service.js +10 -5
- package/esm5/module.js +3 -2
- package/esm5/version.js +2 -2
- package/esm5/viewport/index.js +6 -5
- package/esm5/viewport/viewport-data/viewport-data.service.js +4 -3
- package/esm5/viewport/viewport-matcher-var.directive.js +78 -0
- package/esm5/viewport/viewport-matcher.directive.js +45 -45
- package/esm5/viewport/viewport.service.js +10 -5
- package/fesm2015/ssv-ngx.ux.js +113 -48
- package/fesm2015/ssv-ngx.ux.js.map +1 -1
- package/fesm5/ssv-ngx.ux.js +132 -55
- package/fesm5/ssv-ngx.ux.js.map +1 -1
- package/package.json +1 -1
- package/ssv-ngx.ux.metadata.json +1 -1
- package/version.d.ts +1 -1
- package/viewport/index.d.ts +5 -4
- package/viewport/viewport-data/viewport-data.service.d.ts +1 -1
- package/viewport/viewport-matcher-var.directive.d.ts +22 -0
- package/viewport/viewport-matcher.directive.d.ts +4 -4
- package/viewport/viewport.service.d.ts +8 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssv-ngx.ux.js","sources":["ng://@ssv/ngx.ux/viewport/viewport-data/viewport-data-matcher.ts","ng://@ssv/ngx.ux/viewport/viewport.const.ts","ng://@ssv/ngx.ux/config.ts","ng://@ssv/ngx.ux/platform/window.ts","ng://@ssv/ngx.ux/viewport/viewport.model.ts","ng://@ssv/ngx.ux/viewport/viewport-server-size.service.ts","ng://@ssv/ngx.ux/viewport/viewport.util.ts","ng://@ssv/ngx.ux/viewport/viewport.service.ts","ng://@ssv/ngx.ux/viewport/viewport-data/viewport-data.utils.ts","ng://@ssv/ngx.ux/viewport/viewport-data/viewport-data.service.ts","ng://@ssv/ngx.ux/viewport/viewport-data/viewport-data.pipe.ts","ng://@ssv/ngx.ux/viewport/viewport-matcher.directive.ts","ng://@ssv/ngx.ux/module.ts","ng://@ssv/ngx.ux/version.ts","ng://@ssv/ngx.ux/ssv-ngx.ux.ts"],"sourcesContent":["import { Dictionary } from \"../../internal/internal.model\";\nimport { ViewportSizeTypeInfo } from \"../viewport.model\";\n\nexport type ViewportDataConfig<TValue = unknown, TData = Dictionary<TValue>> = TData & {\n\tdefault?: TValue\n};\n\nexport enum ViewportDataMatchStrategy {\n\t/** Indicates that size should match exact or default. */\n\texact,\n\n\t/** Indicates that size matches when exact match, first match smaller (down) or default. */\n\tsmaller,\n\n\t/** Indicates that size matches when exact match, first match larger (up) or default. */\n\tlarger,\n\n\t/** Indicates that size matches when exact match, or it tries both smaller/larger (smaller is preferred) until match or default. */\n\tclosestSmallerFirst,\n\n\t/** Indicates that size matches when exact match, or it tries both larger/smaller (larger is preferred) until match or default. */\n\tclosestLargerFirst,\n}\nexport type ViewportDataMatchStrategyLiteral = keyof typeof ViewportDataMatchStrategy;\n\nexport interface ViewportDataMatcher<T = unknown> {\n\t(\n\t\tdataConfig: ViewportDataConfig<T>,\n\t\tcurrentSizeType: ViewportSizeTypeInfo,\n\t\tsizeTypes: ViewportSizeTypeInfo[],\n\t\tsizeTypeMap: Dictionary<ViewportSizeTypeInfo>,\n\t): T | undefined;\n}\n\n/**\n * Utility function to match data based on strategy and size.\n *\n * @param dataConfig Data config to generate rules based on.\n * @param sizeType Size type to get data for.\n * @param strategy Strategy to use when building rules.\n * @param sizeTypes Available size types ordered by index type. (Can be obtained from `ViewportService`)\n * @param sizeTypeMap Available size type map. (Can be obtained from `ViewportService`)\n * @returns Returns the matched data value.\n */\nexport function matchViewportData<T>(\n\tdataConfig: ViewportDataConfig<T>,\n\tsizeType: ViewportSizeTypeInfo,\n\tstrategy: ViewportDataMatchStrategy,\n\tsizeTypes: ViewportSizeTypeInfo[],\n\tsizeTypeMap: Dictionary<ViewportSizeTypeInfo>,\n): T | undefined {\n\tconst matchFn = matchStrategyHandlerMap[strategy];\n\tif (!matchFn) {\n\t\tthrow Error(`matchViewportData: Viewport Data strategy not implemented. Strategy: '${strategy}'`);\n\t}\n\tconst data = matchFn(dataConfig, sizeType, sizeTypes, sizeTypeMap) as T;\n\tif (data !== undefined) {\n\t\treturn data;\n\t}\n\treturn dataConfig.default;\n}\n\n\nconst matchStrategyHandlerMap: Dictionary<ViewportDataMatcher> = {\n\t[ViewportDataMatchStrategy.exact]: matchWithExact,\n\t[ViewportDataMatchStrategy.larger]: matchWithLargerMatch,\n\t[ViewportDataMatchStrategy.smaller]: matchWithSmallerMatch,\n\t[ViewportDataMatchStrategy.closestSmallerFirst]: matchWithClosestSmallerFirstMatch,\n\t[ViewportDataMatchStrategy.closestLargerFirst]: matchWithClosestLargerFirstMatch,\n};\n\nfunction matchWithExact<T>(\n\tdataConfig: ViewportDataConfig<T>,\n\tcurrentSizeType: ViewportSizeTypeInfo,\n): T | undefined {\n\treturn dataConfig[currentSizeType.name];\n}\n\nfunction matchWithLargerMatch<T>(\n\tdataConfig: ViewportDataConfig<T>,\n\tcurrentSizeType: ViewportSizeTypeInfo,\n\tsizeTypes: ViewportSizeTypeInfo[],\n): T | undefined {\n\tlet data = dataConfig[currentSizeType.name];\n\tif (data !== undefined) {\n\t\treturn data;\n\t}\n\n\tconst largestTypeIdx = sizeTypes[sizeTypes.length - 1].type;\n\tif (currentSizeType.type >= largestTypeIdx) {\n\t\treturn undefined;\n\t}\n\n\tfor (let index = currentSizeType.type; index < sizeTypes.length; index++) {\n\t\tconst sizeType = sizeTypes[index];\n\t\tdata = dataConfig[sizeType.name];\n\t\tif (data !== undefined) {\n\t\t\treturn data;\n\t\t}\n\t}\n\n\treturn undefined;\n}\n\nfunction matchWithSmallerMatch<T>(\n\tdataConfig: ViewportDataConfig<T>,\n\tcurrentSizeType: ViewportSizeTypeInfo,\n\tsizeTypes: ViewportSizeTypeInfo[],\n): T | undefined {\n\tlet data = dataConfig[currentSizeType.name];\n\tif (data !== undefined) {\n\t\treturn data;\n\t}\n\n\tif (currentSizeType.type <= 0) {\n\t\treturn undefined;\n\t}\n\n\t// eslint-disable-next-line for-direction\n\tfor (let index = currentSizeType.type; index < sizeTypes.length; index--) {\n\t\tconst sizeType = sizeTypes[index];\n\t\tdata = dataConfig[sizeType.name];\n\t\tif (data !== undefined) {\n\t\t\treturn data;\n\t\t}\n\t}\n\n\treturn undefined;\n}\n\nfunction matchWithClosestSmallerFirstMatch<T>(\n\tdataConfig: ViewportDataConfig<T>,\n\tcurrentSizeType: ViewportSizeTypeInfo,\n\tsizeTypes: ViewportSizeTypeInfo[],\n): T | undefined {\n\treturn closestMatch(dataConfig, currentSizeType, sizeTypes, true);\n}\n\nfunction matchWithClosestLargerFirstMatch<T>(\n\tdataConfig: ViewportDataConfig<T>,\n\tcurrentSizeType: ViewportSizeTypeInfo,\n\tsizeTypes: ViewportSizeTypeInfo[],\n): T | undefined {\n\treturn closestMatch(dataConfig, currentSizeType, sizeTypes, false);\n}\n\nfunction closestMatch<T>(\n\tdataConfig: ViewportDataConfig<T>,\n\tcurrentSizeType: ViewportSizeTypeInfo,\n\tsizeTypes: ViewportSizeTypeInfo[],\n\tisSmallerFirst: boolean\n): T | undefined {\n\tlet data = dataConfig[currentSizeType.name];\n\tif (data !== undefined) {\n\t\treturn data;\n\t}\n\n\tlet downIndex = currentSizeType.type;\n\tlet upIndex = currentSizeType.type;\n\n\t// eslint-disable-next-line @typescript-eslint/prefer-for-of\n\tfor (let index = 0; index < sizeTypes.length; index++) {\n\t\tfor (const idx of isSmallerFirst ? [--downIndex, ++upIndex] : [++upIndex, --downIndex]) {\n\t\t\tconst sizeType = sizeTypes[idx];\n\t\t\tif (sizeType) {\n\t\t\t\tdata = dataConfig[sizeType.name];\n\t\t\t\tif (data !== undefined) {\n\t\t\t\t\treturn data;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn undefined;\n}\n","import { Dictionary } from \"../internal/internal.model\";\nimport { ViewportDataMatchStrategy } from \"./viewport-data/viewport-data-matcher\";\nimport { UxViewportOptions } from \"./viewport.model\";\n\n/** Default viewport breakpoints. */\nexport const UX_VIEWPORT_DEFAULT_BREAKPOINTS: Dictionary<number> = {\n\txsmall: 450,\n\tsmall: 767,\n\tmedium: 992,\n\tlarge: 1200,\n\txlarge: 1500,\n\txxlarge: 1920,\n\txxlarge1: 2100,\n};\n\nexport const UX_VIEWPORT_DEFAULT_CONFIG: UxViewportOptions = {\n\tresizePollingSpeed: 33,\n\tbreakpoints: UX_VIEWPORT_DEFAULT_BREAKPOINTS,\n\tdefaultDataMatchStrategy: ViewportDataMatchStrategy.smaller,\n};\n","import { InjectionToken } from \"@angular/core\";\nimport { UX_VIEWPORT_DEFAULT_CONFIG } from \"./viewport/viewport.const\";\nimport { UxViewportOptions } from \"./viewport/viewport.model\";\n\nexport interface UxOptions {\n\tviewport: UxViewportOptions;\n}\n\nexport const UX_DEFAULT_CONFIG: UxOptions = {\n\tviewport: UX_VIEWPORT_DEFAULT_CONFIG,\n};\n\nexport const UX_CONFIG = new InjectionToken<UxOptions>(\"@ssv/ngx.ux-config\");\n","import { InjectionToken, Injectable, Inject } from \"@angular/core\";\n\nexport const WINDOW = new InjectionToken<Window>(\"Window\");\n\n@Injectable({\n\tprovidedIn: \"root\",\n})\nexport class WindowRef {\n\n\tconstructor(\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\n\t\t@Inject(WINDOW) private window: any\n\t) {\n\t}\n\n\t/** Window underlying native object. */\n\tget native(): Window {\n\t\treturn this.window as Window;\n\t}\n\n\t/** Determines whether native element is supported or not. Generally `false` when executing in SSR. */\n\tget hasNative(): boolean {\n\t\treturn !!this.native.window;\n\t}\n\n}\n","import { Dictionary } from \"../internal/internal.model\";\nimport { ViewportDataMatchStrategy } from \"./viewport-data\";\n\n/**\n * The indices of each breakpoint provided based on the `UX_VIEWPORT_DEFAULT_BREAKPOINTS`.\n * @see UX_VIEWPORT_DEFAULT_BREAKPOINTS\n */\nexport enum ViewportSizeType {\n\txsmall = 0,\n\tsmall = 1,\n\tmedium = 2,\n\tlarge = 3,\n\txlarge = 4,\n\txxlarge = 5,\n\txxlarge1 = 6,\n}\n\nexport enum ComparisonOperation {\n\tequals = \"=\",\n\tnotEquals = \"<>\",\n\tlessThan = \"<\",\n\tlessOrEqualThan = \"<=\",\n\tgreaterThan = \">\",\n\tgreaterOrEqualThan = \">=\",\n}\n\nexport enum DeviceType {\n\tdesktop = \"desktop\",\n\tmobile = \"mobile\",\n\ttablet = \"tablet\"\n}\n\nexport interface UxViewportOptions {\n\t/** Polling speed on resizing (in milliseconds). e.g. the higher the number the longer it takes to recalculate. */\n\tresizePollingSpeed: number;\n\n\t/** Breakpoints to use. Key needs to match the size type and the value the width threshold.\n\t * e.g. given width '1000' and `medium` is set to '992' => `large`.\n\t */\n\tbreakpoints: Dictionary<number>;\n\n\t/** Default data match strategy to use. */\n\tdefaultDataMatchStrategy: ViewportDataMatchStrategy;\n}\n\nexport interface ViewportSize {\n\twidth: number;\n\theight: number;\n}\n\nexport interface ViewportSizeTypeInfo {\n\ttype: number;\n\tname: string;\n\twidthThreshold: number;\n}\n\nexport interface ViewportMatchConditions {\n\tsizeType?: string | string[] | null;\n\tsizeTypeExclude?: string | string[] | null;\n\texpression?: ViewportSizeMatcherExpression;\n}\n\nexport interface ViewportSizeMatcherExpression {\n\tsize: string;\n\toperation: ComparisonOperation;\n}\n","import { Injectable, Inject, InjectionToken, Optional } from \"@angular/core\";\n\nimport { Dictionary } from \"../internal/internal.model\";\nimport { DeviceType, ViewportSize } from \"./viewport.model\";\nimport { UxOptions } from \"../config\";\n\n// todo: make this configurable\n/** Viewport size for SSR. */\nconst viewportSizeSSR: Dictionary<ViewportSize> = {\n\t[DeviceType.desktop]: {\n\t\twidth: 1366,\n\t\theight: 768,\n\t},\n\t[DeviceType.tablet]: {\n\t\twidth: 768,\n\t\theight: 1024,\n\t},\n\t[DeviceType.mobile]: {\n\t\twidth: 414,\n\t\theight: 736,\n\t},\n};\n\nexport const UX_VIEWPORT_SSR_DEVICE = new InjectionToken<UxOptions>(\"@ssv/ngx.ux-config/viewport/ssr-device\");\n\n@Injectable({\n\tprovidedIn: \"root\",\n})\nexport class ViewportServerSizeService {\n\n\tconstructor(\n\t\t@Optional() @Inject(UX_VIEWPORT_SSR_DEVICE) private deviceType: DeviceType,\n\t) {\n\t}\n\n\tget(): ViewportSize {\n\t\treturn viewportSizeSSR[this.deviceType] || viewportSizeSSR[DeviceType.desktop];\n\t}\n\n}\n","import { Dictionary } from \"../internal/internal.model\";\nimport {\n\tComparisonOperation,\n\tViewportSizeMatcherExpression,\n\tViewportSizeTypeInfo,\n\tViewportMatchConditions\n} from \"./viewport.model\";\n\nexport function isViewportSizeMatcherExpression(value: unknown): value is ViewportSizeMatcherExpression {\n\tif (typeof value !== \"object\" || !value) {\n\t\treturn false;\n\t}\n\tconst args: Partial<ViewportSizeMatcherExpression> = value;\n\tif (args.size && args.operation) {\n\t\treturn true;\n\t}\n\treturn false;\n}\n\nexport function isViewportSizeMatcherTupleExpression(arg: unknown): arg is [ComparisonOperation, string] {\n\tif (!arg) {\n\t\treturn false;\n\t}\n\tif (Array.isArray(arg)) {\n\t\tif (arg.length === 2) {\n\t\t\tconst [op] = arg;\n\t\t\treturn operations.includes(op);\n\t\t}\n\t}\n\treturn false;\n}\n\n\nconst operations = Object.values(ComparisonOperation);\n\nexport const COMPARISON_OPERATION_FUNC_MAPPING: Dictionary<(a: number, b: number) => boolean> = {\n\t[ComparisonOperation.equals]: (a: number, b: number) => a === b,\n\t[ComparisonOperation.notEquals]: (a: number, b: number) => a !== b,\n\t[ComparisonOperation.lessThan]: (a: number, b: number) => a < b,\n\t[ComparisonOperation.lessOrEqualThan]: (a: number, b: number) => a <= b,\n\t[ComparisonOperation.greaterThan]: (a: number, b: number) => a > b,\n\t[ComparisonOperation.greaterOrEqualThan]: (a: number, b: number) => a >= b,\n};\n\nexport function isViewportConditionMatch(\n\tevaluateSize: ViewportSizeTypeInfo,\n\tconditions: ViewportMatchConditions,\n\tviewportSizeTypeInfoRefs: Dictionary<ViewportSizeTypeInfo>\n): boolean {\n\tconst isExcluded = match(conditions.sizeTypeExclude, evaluateSize.name, false);\n\tlet isIncluded;\n\tlet isExpressionTruthy;\n\n\tif (!isExcluded && conditions.expression) {\n\t\tconst ref = viewportSizeTypeInfoRefs[conditions.expression.size];\n\t\tif(!ref) {\n\t\t\tthrow new Error(`Viewport size type is invalid. Size type: '${conditions.expression.size}'`);\n\t\t}\n\t\tconst expMatcher = COMPARISON_OPERATION_FUNC_MAPPING[conditions.expression.operation];\n\n\t\tisExpressionTruthy = expMatcher(evaluateSize.type, ref.type);\n\t} else {\n\t\tisIncluded = match(conditions.sizeType, evaluateSize.name, true);\n\t}\n\n\tconst shouldRender = (isExpressionTruthy || isIncluded) && !isExcluded;\n\t// console.warn(\">>> shouldRender\", { evaluateSize, conditions, shouldRender });\n\treturn !!shouldRender;\n}\n\nfunction match(value: string | string[] | null | undefined, targetValue: string, defaultValue: boolean) {\n\tif (!value) {\n\t\treturn defaultValue;\n\t}\n\n\treturn Array.isArray(value)\n\t\t? value.includes(targetValue)\n\t\t: value === targetValue;\n}\n\nexport function getSizeTypeInfo(width: number, sizeTypes: ViewportSizeTypeInfo[]): ViewportSizeTypeInfo {\n\tconst lastEntryIndex = sizeTypes.length - 1;\n\n\tfor (let idx = 0; idx < lastEntryIndex; idx++) {\n\t\tconst viewportSizeTypeInfo = sizeTypes[idx];\n\n\t\tif (width <= viewportSizeTypeInfo.widthThreshold) {\n\t\t\treturn viewportSizeTypeInfo;\n\t\t}\n\t}\n\n\treturn sizeTypes[lastEntryIndex];\n}\n\n/**\n * Converts the breakpoints into a 2 dimensional array containing the name and width, and sorted from\n * smallest to largest.\n * @param breakpoints the breakpoints obtained from the config\n * @internal\n */\nfunction getSortedBreakpoints(breakpoints: Dictionary<number>): [string, number][] {\n\treturn Object.entries(breakpoints)\n\t\t.sort(([, widthA], [, widthB]) => widthA - widthB);\n}\n\n/**\n * A util function which generates the ViewportSizeTypeInfo.type for each breakpoint.\n * @param breakpoints the custom breakpoints\n */\nexport function generateViewportSizeType<T extends Record<string, number>>(breakpoints: T): T & Record<number, string> {\n\treturn Object.freeze(\n\t\tgetSortedBreakpoints(breakpoints).reduce<Record<number | string, string | number>>(\n\t\t\t(dictionary, [name], index) => {\n\t\t\t\tdictionary[name] = index;\n\t\t\t\tdictionary[index] = name;\n\t\t\t\treturn dictionary;\n\t\t\t}, {}\n\t\t)\n\t) as T & Record<number, string>;\n}\n\n/**\n * Pre-processes the given breakpoints into an ordered list from smallest to largest while generating\n * all the necessary information on the viewport.\n * @param breakpoints the breakpoints obtained from the config\n * @internal\n */\nexport function generateViewportSizeTypeInfoList(breakpoints: Dictionary<number>): ViewportSizeTypeInfo[] {\n\treturn getSortedBreakpoints(breakpoints)\n\t\t.map(([name, width], index) =>\n\t\t\t(Object.freeze({\n\t\t\t\tname,\n\t\t\t\ttype: index,\n\t\t\t\twidthThreshold: width\n\t\t\t}))\n\t\t);\n}\n\n/**\n * Converts the breakpoint list into a dictionary while using the name as key.\n * @param breakpointList the list of breakpoints\n * @internal\n */\nexport function generateViewportSizeTypeInfoRefs(breakpointList: ViewportSizeTypeInfo[]): Dictionary<ViewportSizeTypeInfo> {\n\treturn Object.freeze(\n\t\tbreakpointList.reduce<Dictionary<ViewportSizeTypeInfo>>((dictionary, breakpoint) => {\n\t\t\tdictionary[breakpoint.name] = breakpoint;\n\t\t\tdictionary[breakpoint.type] = breakpoint;\n\t\t\treturn dictionary;\n\t\t}, {})\n\t);\n}\n","import { Injectable, Inject } from \"@angular/core\";\nimport { Observable, fromEvent, of } from \"rxjs\";\nimport {\n\tmap,\n\ttap,\n\tdistinctUntilChanged,\n\tstartWith,\n\tshare,\n\tshareReplay,\n\tauditTime,\n} from \"rxjs/operators\";\n\nimport { UxOptions, UX_CONFIG } from \"../config\";\nimport { ViewportSizeTypeInfo, ViewportSize } from \"./viewport.model\";\nimport { WindowRef } from \"../platform/window\";\nimport { ViewportServerSizeService } from \"./viewport-server-size.service\";\nimport { generateViewportSizeTypeInfoList, generateViewportSizeTypeInfoRefs, getSizeTypeInfo } from \"./viewport.util\";\nimport { Dictionary } from \"../internal/internal.model\";\n\n@Injectable({\n\tprovidedIn: \"root\",\n})\nexport class ViewportService {\n\n\t/** Window resize observable (which is also throttled). */\n\treadonly resize$: Observable<ViewportSize>;\n\n\t/** Viewport size type observable. */\n\treadonly sizeType$: Observable<ViewportSizeTypeInfo>;\n\n\t/** Viewport size type snapshot of the last value. (Prefer use `sizeType$` observable when possible.) */\n\tget sizeTypeSnapshot(): ViewportSizeTypeInfo { return this._sizeTypeSnapshot; }\n\n\t/** Viewport size observable. */\n\treadonly size$: Observable<ViewportSize>;\n\n\t/** Size types refs of the generated viewport size type info. */\n\tget sizeTypeMap(): Dictionary<ViewportSizeTypeInfo> { return this._sizeTypeMap; }\n\n\t/** Viewport size types list ordered by type, smallest to largest. */\n\tget sizeTypes(): ViewportSizeTypeInfo[] { return this._sizeTypes; }\n\n\tprivate _sizeTypeMap: Dictionary<ViewportSizeTypeInfo>;\n\tprivate _sizeTypes: ViewportSizeTypeInfo[];\n\tprivate _sizeTypeSnapshot: ViewportSizeTypeInfo;\n\n\tconstructor(\n\t\tprivate windowRef: WindowRef,\n\t\tprivate viewportServerSize: ViewportServerSizeService,\n\t\t@Inject(UX_CONFIG) config: UxOptions,\n\t) {\n\t\tthis._sizeTypes = generateViewportSizeTypeInfoList(config.viewport.breakpoints);\n\t\tthis._sizeTypeMap = generateViewportSizeTypeInfoRefs(this._sizeTypes);\n\n\t\tif (windowRef.hasNative) {\n\t\t\tthis.resize$ = fromEvent<Event>(window, \"resize\").pipe(\n\t\t\t\tmap(() => this.getViewportSize()),\n\t\t\t\tauditTime(config.viewport.resizePollingSpeed),\n\t\t\t\tshare(),\n\t\t\t);\n\t\t} else {\n\t\t\tthis.resize$ = of(viewportServerSize.get());\n\t\t}\n\t\tconst size = this.getViewportSize();\n\t\tthis._sizeTypeSnapshot = getSizeTypeInfo(size.width, this.sizeTypes);\n\n\t\tthis.size$ = this.resize$.pipe(\n\t\t\tstartWith(size),\n\t\t\tdistinctUntilChanged((a, b) => a.width === b.width && a.height === b.height),\n\t\t\tshareReplay(1),\n\t\t);\n\n\t\tthis.sizeType$ = this.size$.pipe(\n\t\t\tdistinctUntilChanged((a, b) => a.width === b.width),\n\t\t\tmap(x => getSizeTypeInfo(x.width, this.sizeTypes)),\n\t\t\tdistinctUntilChanged(),\n\t\t\ttap(x => this._sizeTypeSnapshot = x),\n\t\t\tshareReplay(1),\n\t\t);\n\t}\n\n\t/**\n\t * Calculates amount of items that fits into container's width.\n\t * @param containerWidth\n\t * @param itemWidth\n\t * @returns\n\t */\n\tcalculateItemsPerRow(containerWidth: number, itemWidth: number): number {\n\t\tif (containerWidth === 0) {\n\t\t\treturn 0;\n\t\t}\n\t\tif (!containerWidth && !this.windowRef.hasNative) {\n\t\t\t// todo: find a way to get container width for ssr\n\t\t\tcontainerWidth = this.viewportServerSize.get().width;\n\t\t}\n\n\t\treturn containerWidth / itemWidth;\n\t}\n\n\t/** Returns the current viewport size */\n\tprivate getViewportSize(): ViewportSize {\n\t\tif (!this.windowRef.hasNative) {\n\t\t\treturn this.viewportServerSize.get();\n\t\t}\n\n\t\tconst ua = navigator.userAgent.toLowerCase();\n\t\tif (ua.indexOf(\"safari\") !== -1 && ua.indexOf(\"chrome\") === -1) { // safari subtracts the scrollbar width\n\t\t\treturn {\n\t\t\t\twidth: this.windowRef.native.document.documentElement.clientWidth,\n\t\t\t\theight: this.windowRef.native.document.documentElement.clientHeight,\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\twidth: this.windowRef.native.innerWidth,\n\t\t\theight: this.windowRef.native.innerHeight,\n\t\t};\n\t}\n\n}\n","import { Dictionary } from \"../../internal/internal.model\";\nimport { ViewportSizeTypeInfo } from \"../viewport.model\";\nimport { ViewportDataConfig, ViewportDataMatchStrategy } from \"./viewport-data-matcher\";\n\nexport interface ViewportDataRule<T> {\n\tmin?: number;\n\tmax?: number;\n\tvalue: T;\n}\n\n/**\n * Utility function to generate rules based on strategies.\n *\n * @param dataConfig Data config to generate rules based on.\n * @param strategy Strategy to use when building rules.\n * @param sizeTypes Available size types ordered by index type. (Can be obtained from `ViewportService`)\n * @param sizeTypeMap Available size type map. (Can be obtained from `ViewportService`)\n * @returns Returns a collection of rules (ordered).\n */\nexport function generateViewportRulesRangeFromDataMatcher<T>(\n\tdataConfig: ViewportDataConfig<T>,\n\tstrategy: ViewportDataMatchStrategy,\n\tsizeTypes: ViewportSizeTypeInfo[],\n\tsizeTypeMap: Dictionary<ViewportSizeTypeInfo>,\n): ViewportDataRule<T>[] {\n\tconst ruleBuilderFn = matchStrategyHandlerMap[strategy];\n\tif (!ruleBuilderFn) {\n\t\tthrow Error(`generateViewportRulesRangeFromDataMatcher: Viewport Data strategy not implemented. Strategy: '${strategy}'`);\n\t}\n\n\tlet dataSizes: ViewportSizeTypeInfo[] = [];\n\tfor (const key in dataConfig) {\n\t\tif (Object.prototype.hasOwnProperty.call(dataConfig, key)) {\n\t\t\tconst data = dataConfig[key];\n\t\t\tif (data === undefined) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst size = sizeTypeMap[key];\n\t\t\tif (size) {\n\t\t\t\tdataSizes.push(size);\n\t\t\t}\n\t\t}\n\t}\n\tdataSizes = dataSizes.sort(({ type: typeA }, { type: typeB }) => typeA - typeB);\n\n\tconst rules: ViewportDataRule<T>[] = [];\n\tif (dataConfig.default) {\n\t\trules.push({ value: dataConfig.default, min: undefined, max: undefined });\n\t}\n\n\tlet prevRule: ViewportDataRule<T> | undefined;\n\tfor (let index = 0; index < dataSizes.length; index++) {\n\t\tconst prevDataSize = dataSizes[index - 1];\n\t\tconst nextDataSize = dataSizes[index + 1];\n\t\tconst dataSize = dataSizes[index];\n\t\tconst prevSize = sizeTypes[dataSize.type - 1];\n\t\t// const nextSize = sizeTypes[dataSize.type + 1];\n\t\tconst data = dataConfig[dataSize.name];\n\t\tconst rule: ViewportDataRule<T> = {\n\t\t\tvalue: data,\n\t\t\tmin: undefined,\n\t\t\tmax: undefined,\n\t\t};\n\n\t\truleBuilderFn(rule, dataSize, nextDataSize, prevDataSize, prevSize, prevRule, sizeTypes);\n\n\t\tprevRule = rule;\n\t\trules.push(rule);\n\t}\n\treturn rules;\n}\n\nexport interface ViewportRuleRangeBuilder<T = unknown> {\n\t(\n\t\trule: ViewportDataRule<T>,\n\t\tdataSize: ViewportSizeTypeInfo,\n\t\tnextDataSize: ViewportSizeTypeInfo | undefined,\n\t\tprevDataSize: ViewportSizeTypeInfo | undefined,\n\t\tprevSize: ViewportSizeTypeInfo | undefined,\n\t\tprevRule: ViewportDataRule<T> | undefined,\n\t\tsizeTypes: ViewportSizeTypeInfo[],\n\t): void;\n}\n\nconst matchStrategyHandlerMap: Dictionary<ViewportRuleRangeBuilder> = {\n\t[ViewportDataMatchStrategy.exact]: (rule, dataSize, _nextDataSize, _prevDataSize, prevSize) => {\n\t\trule.max = dataSize.widthThreshold;\n\t\tif (prevSize) {\n\t\t\trule.min = prevSize.widthThreshold + 1;\n\t\t}\n\t},\n\t[ViewportDataMatchStrategy.smaller]: (rule, dataSize, nextDataSize, _prevDataSize, prevSize) => {\n\t\tif (nextDataSize) {\n\t\t\trule.max = dataSize.widthThreshold;\n\t\t}\n\t\tif (prevSize) {\n\t\t\trule.min = prevSize.widthThreshold + 1;\n\t\t}\n\t},\n\t[ViewportDataMatchStrategy.larger]: (rule, dataSize, _nextDataSize, prevDataSize) => {\n\t\tif (dataSize) {\n\t\t\trule.max = dataSize.widthThreshold;\n\t\t}\n\t\tif (prevDataSize) {\n\t\t\trule.min = prevDataSize.widthThreshold + 1;\n\t\t}\n\t},\n\t[ViewportDataMatchStrategy.closestSmallerFirst]: (rule, dataSize, nextDataSize, _prevDataSize, _prevSize, prevRule, sizeTypes) => {\n\t\tif (nextDataSize) {\n\t\t\trule.max = calculateClosestWidthThreshold(nextDataSize, dataSize, sizeTypes, true);\n\t\t}\n\t\tif (prevRule?.max) {\n\t\t\trule.min = prevRule.max + 1;\n\t\t}\n\t},\n\t[ViewportDataMatchStrategy.closestLargerFirst]: (rule, dataSize, nextDataSize, _prevDataSize, _prevSize, prevRule, sizeTypes) => {\n\t\tif (nextDataSize) {\n\t\t\trule.max = calculateClosestWidthThreshold(nextDataSize, dataSize, sizeTypes, false);\n\t\t}\n\t\tif (prevRule?.max) {\n\t\t\trule.min = prevRule.max + 1;\n\t\t}\n\t},\n};\n\nfunction calculateClosestWidthThreshold(\n\tnextDataSize: ViewportSizeTypeInfo,\n\tdataSize: ViewportSizeTypeInfo,\n\tsizeTypes: ViewportSizeTypeInfo[],\n\tisSmallerPreferred: boolean,\n) {\n\tconst fn = isSmallerPreferred ? Math.ceil : Math.floor;\n\t// get closest between curr and next\n\tconst diffIndex = fn((nextDataSize.type - dataSize.type - 1) / 2);\n\tconst diffNextSize = sizeTypes[dataSize.type + diffIndex];\n\treturn (diffNextSize || dataSize).widthThreshold;\n}\n","import { Inject, Injectable } from \"@angular/core\";\nimport { Observable } from \"rxjs\";\nimport { distinctUntilChanged, map } from \"rxjs/operators\";\nimport { UX_CONFIG, UxOptions } from \"../../config\";\n\nimport { ViewportSizeTypeInfo } from \"../viewport.model\";\nimport { ViewportService } from \"../viewport.service\";\nimport { matchViewportData, ViewportDataConfig, ViewportDataMatchStrategy } from \"./viewport-data-matcher\";\nimport { generateViewportRulesRangeFromDataMatcher, ViewportDataRule } from \"./viewport-data.utils\";\n\n@Injectable({\n\tprovidedIn: \"root\",\n})\nexport class ViewportDataService {\n\n\tconstructor(\n\t\tprivate viewport: ViewportService,\n\t\t@Inject(UX_CONFIG) private config: UxOptions,\n\t) {\n\t}\n\n\t/** Get data for match. */\n\tget<T>(\n\t\tdataConfig: ViewportDataConfig<T>,\n\t\tstrategy: ViewportDataMatchStrategy = this.config.viewport.defaultDataMatchStrategy,\n\t\tsizeType: ViewportSizeTypeInfo = this.viewport.sizeTypeSnapshot\n\t): T | undefined {\n\t\treturn matchViewportData(dataConfig, sizeType, strategy, this.viewport.sizeTypes, this.viewport.sizeTypeMap);\n\t}\n\n\t/** Get data for match as observable. */\n\tget$<T>(dataConfig: ViewportDataConfig<T>, strategy?: ViewportDataMatchStrategy): Observable<T | undefined> {\n\t\treturn this.viewport.sizeType$.pipe(\n\t\t\tmap(sizeType => this.get<T>(dataConfig, strategy, sizeType)),\n\t\t\tdistinctUntilChanged(),\n\t\t);\n\t}\n\n\t/** Generate rules based on strategies for data. */\n\tgenerateRules<T>(\n\t\tdataConfig: ViewportDataConfig<T>,\n\t\tstrategy: ViewportDataMatchStrategy = this.config.viewport.defaultDataMatchStrategy,\n\t): ViewportDataRule<T>[] {\n\t\treturn generateViewportRulesRangeFromDataMatcher(\n\t\t\tdataConfig,\n\t\t\tstrategy,\n\t\t\tthis.viewport.sizeTypes,\n\t\t\tthis.viewport.sizeTypeMap\n\t\t);\n\t}\n\n}\n","import { Subscription } from \"rxjs\";\nimport { tap } from \"rxjs/operators\";\nimport { Pipe, PipeTransform, OnDestroy, ChangeDetectorRef } from \"@angular/core\";\n\nimport { ViewportDataConfig, ViewportDataMatchStrategy, ViewportDataMatchStrategyLiteral } from \"./viewport-data-matcher\";\nimport { ViewportDataService } from \"./viewport-data.service\";\n\n/* eslint-disable @angular-eslint/no-pipe-impure */\n@Pipe({\n\tname: \"ssvViewportData\",\n\tpure: false\n})\nexport class ViewportDataPipe implements PipeTransform, OnDestroy {\n\n\tprivate markForTransform = true;\n\tprivate value: unknown;\n\tprivate data: ViewportDataConfig | undefined;\n\tprivate strategy: ViewportDataMatchStrategyLiteral | undefined;\n\tprivate data$$ = Subscription.EMPTY;\n\n\tconstructor(\n\t\tprivate viewportData: ViewportDataService,\n\t\tprivate cdr: ChangeDetectorRef\n\t) {\n\t}\n\n\ttransform(data: ViewportDataConfig, strategy: ViewportDataMatchStrategyLiteral): unknown {\n\t\tif (!this.markForTransform && data === this.data && strategy === this.strategy) {\n\t\t\treturn this.value;\n\t\t}\n\t\tthis.data = data;\n\t\tthis.strategy = strategy;\n\n\t\tthis.data$$.unsubscribe();\n\t\tthis.data$$ = this.viewportData.get$(data, ViewportDataMatchStrategy[strategy]).pipe(\n\t\t\ttap(value => {\n\t\t\t\tthis.markForTransform = true;\n\t\t\t\tthis.value = value;\n\t\t\t\tthis.cdr.markForCheck();\n\t\t\t}),\n\t\t).subscribe();\n\n\t\tthis.markForTransform = false;\n\t\treturn this.value;\n\t}\n\n\tngOnDestroy(): void {\n\t\tthis.data$$.unsubscribe();\n\t}\n\n}\n","import {\n\tOnInit,\n\tOnDestroy,\n\tDirective,\n\tRenderer2,\n\tViewContainerRef,\n\tInput,\n\tEmbeddedViewRef,\n\tTemplateRef,\n\tChangeDetectorRef,\n} from \"@angular/core\";\nimport { Subscription, Subject } from \"rxjs\";\nimport { tap, filter, pairwise, startWith } from \"rxjs/operators\";\n\nimport { ViewportService } from \"./viewport.service\";\nimport {\n\tisViewportSizeMatcherExpression,\n\tisViewportSizeMatcherTupleExpression,\n\tisViewportConditionMatch\n} from \"./viewport.util\";\nimport { ViewportSizeTypeInfo, ViewportMatchConditions, ViewportSizeMatcherExpression } from \"./viewport.model\";\n\nexport class SsvViewportMatcherContext implements ViewportMatchConditions {\n\n\tsizeType: string | string[] | null = null;\n\tsizeTypeExclude: string | string[] | null = null;\n\texpression?: ViewportSizeMatcherExpression;\n\n}\n\n@Directive({\n\tselector: \"[ssvViewportMatcher]\",\n\texportAs: \"ssvViewportMatcher\",\n})\nexport class SsvViewportMatcherDirective implements OnInit, OnDestroy {\n\n\tsizeInfo: ViewportSizeTypeInfo | undefined;\n\n\tprivate _context: SsvViewportMatcherContext = new SsvViewportMatcherContext();\n\tprivate _thenTemplateRef: TemplateRef<SsvViewportMatcherContext> | null = null;\n\tprivate _elseTemplateRef: TemplateRef<SsvViewportMatcherContext> | null = null;\n\tprivate _thenViewRef: EmbeddedViewRef<SsvViewportMatcherContext> | null = null;\n\tprivate _elseViewRef: EmbeddedViewRef<SsvViewportMatcherContext> | null = null;\n\tprivate sizeType$$ = Subscription.EMPTY;\n\tprivate cssClass$$ = Subscription.EMPTY;\n\tprivate readonly _update$ = new Subject<SsvViewportMatcherContext>();\n\n\tconstructor(\n\t\tprivate viewport: ViewportService,\n\t\tprivate renderer: Renderer2,\n\t\tprivate _viewContainer: ViewContainerRef,\n\t\tprivate cdr: ChangeDetectorRef,\n\t\ttemplateRef: TemplateRef<SsvViewportMatcherContext>,\n\t) {\n\t\tthis._thenTemplateRef = templateRef;\n\t}\n\n\tngOnInit(): void {\n\t\t// console.log(\"ssvViewportMatcher init\");\n\n\t\tthis._update$\n\t\t\t.pipe(\n\t\t\t\t// tap(x => console.log(\">>> ssvViewportMatcher - update triggered\", x)),\n\t\t\t\tfilter(() => !!this.sizeInfo),\n\t\t\t\t// tap(x => console.log(\">>> ssvViewportMatcher - updating...\", x)),\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\ttap(() => this._updateView(this.sizeInfo!)),\n\t\t\t\ttap(() => this.cdr.markForCheck())\n\t\t\t)\n\t\t\t.subscribe();\n\n\t\tthis.sizeType$$ = this.viewport.sizeType$\n\t\t\t.pipe(\n\t\t\t\t// tap(x => console.log(\"ssvViewportMatcher - sizeType changed\", x)),\n\t\t\t\ttap(x => this.sizeInfo = x),\n\t\t\t\ttap(() => this._update$.next(this._context)),\n\t\t\t)\n\t\t\t.subscribe();\n\n\t\tthis.cssClass$$ = this.viewport.sizeType$\n\t\t\t.pipe(\n\t\t\t\tstartWith<ViewportSizeTypeInfo | undefined>(undefined),\n\t\t\t\tfilter(() => !!(this._thenViewRef || this._elseViewRef)),\n\t\t\t\tpairwise(),\n\t\t\t\ttap(([prev, curr]) => {\n\t\t\t\t\tconst el: Element = this._thenViewRef\n\t\t\t\t\t\t? this._thenViewRef.rootNodes[0]\n\t\t\t\t\t\t: this._elseViewRef?.rootNodes[0];\n\n\t\t\t\t\tif (!el.classList) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tif (prev) {\n\t\t\t\t\t\tthis.renderer.removeClass(el, `ssv-vp-size--${prev.name}`);\n\t\t\t\t\t}\n\t\t\t\t\tthis.renderer.addClass(el, `ssv-vp-size--${curr?.name}`);\n\t\t\t\t}),\n\t\t\t)\n\t\t\t.subscribe();\n\t}\n\n\tngOnDestroy(): void {\n\t\tthis.cssClass$$.unsubscribe();\n\t\tthis.sizeType$$.unsubscribe();\n\t\tthis._update$.complete();\n\t}\n\n\t@Input() set ssvViewportMatcher(value: string | string[] | ViewportSizeMatcherExpression) {\n\t\tif (isViewportSizeMatcherExpression(value)) {\n\t\t\tthis._context.expression = value;\n\t\t} else if (isViewportSizeMatcherTupleExpression(value)) {\n\t\t\tconst [op, size] = value;\n\t\t\tthis._context.expression = {\n\t\t\t\toperation: op,\n\t\t\t\tsize\n\t\t\t};\n\t\t} else {\n\t\t\tthis._context.sizeType = value;\n\t\t}\n\n\t\tif (this.sizeInfo) {\n\t\t\tthis._update$.next(this._context);\n\t\t}\n\t}\n\n\t@Input() set ssvViewportMatcherExclude(value: string | string[]) {\n\t\tthis._context.sizeTypeExclude = value;\n\n\t\tif (this.sizeInfo) {\n\t\t\tthis._update$.next(this._context);\n\t\t}\n\t}\n\n\t@Input() set ssvViewportMatcherElse(templateRef: TemplateRef<SsvViewportMatcherContext> | null) {\n\t\tthis._elseTemplateRef = templateRef;\n\t\tthis._elseViewRef = null; // clear previous view if any.\n\t\tif (this.sizeInfo) {\n\t\t\tthis._update$.next(this._context);\n\t\t}\n\t}\n\n\tprivate _updateView(sizeInfo: ViewportSizeTypeInfo) {\n\t\tif (isViewportConditionMatch(sizeInfo, this._context, this.viewport.sizeTypeMap)) {\n\t\t\tif (!this._thenViewRef) {\n\t\t\t\tthis._viewContainer.clear();\n\t\t\t\tthis._elseViewRef = null;\n\n\t\t\t\tif (this._thenTemplateRef) {\n\t\t\t\t\tthis._thenViewRef = this._viewContainer.createEmbeddedView(\n\t\t\t\t\t\tthis._thenTemplateRef,\n\t\t\t\t\t\tthis._context,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tif (!this._elseViewRef) {\n\t\t\t\tthis._viewContainer.clear();\n\t\t\t\tthis._thenViewRef = null;\n\n\t\t\t\tif (this._elseTemplateRef) {\n\t\t\t\t\tthis._elseViewRef = this._viewContainer.createEmbeddedView(\n\t\t\t\t\t\tthis._elseTemplateRef,\n\t\t\t\t\t\tthis._context,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n}\n","import { NgModule, ModuleWithProviders, InjectionToken, Optional } from \"@angular/core\";\n\nimport { SsvViewportMatcherDirective } from \"./viewport/index\";\nimport { UxOptions, UX_DEFAULT_CONFIG, UX_CONFIG } from \"./config\";\nimport { WINDOW } from \"./platform/window\";\nimport { PartialDeep } from \"./internal/internal.model\";\nimport { ViewportDataPipe } from \"./viewport/viewport-data/viewport-data.pipe\";\n\n/** @internal */\nexport const MODULE_CONFIG_DATA = new InjectionToken<UxOptions>(\"@ssv/ngx.ux/configData\");\n\nconst components = [\n\tSsvViewportMatcherDirective,\n\tViewportDataPipe,\n];\n\n// todo: create module for Viewport\n@NgModule({\n\tdeclarations: [components],\n\tproviders: [\n\t\t{ provide: UX_CONFIG, useFactory: _moduleConfigFactory, deps: [[MODULE_CONFIG_DATA, new Optional()]] },\n\t\t{ provide: WINDOW, useFactory: _window },\n\t],\n\texports: [...components],\n})\nexport class SsvUxModule {\n\n\tstatic forRoot(config?: PartialDeep<UxOptions> | (() => PartialDeep<UxOptions>)): ModuleWithProviders<SsvUxModule> {\n\t\treturn {\n\t\t\tngModule: SsvUxModule,\n\t\t\tproviders: [\n\t\t\t\t{ provide: MODULE_CONFIG_DATA, useValue: config },\n\t\t\t],\n\t\t};\n\t}\n\n}\n\n/** @internal */\nexport function _moduleConfigFactory(config: UxOptions | (() => UxOptions)): UxOptions {\n\tif(!config) {\n\t\treturn UX_DEFAULT_CONFIG;\n\t}\n\tconst uxOptions = typeof config === \"function\" ? config() : config;\n\tconst viewport = {\n\t\t...UX_DEFAULT_CONFIG.viewport,\n\t\t...uxOptions.viewport\n\t}; // breakpoints shouldn't be merged\n\n\treturn { viewport };\n}\n\n/** @internal */\nexport function _window(): unknown {\n\tif (typeof window !== \"undefined\") {\n\t\treturn window;\n\t}\n\treturn {};\n}\n","export const VERSION = \"1.3.0\";\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n\nexport {WINDOW as ɵb,WindowRef as ɵc} from './platform/window';\nexport {UX_VIEWPORT_DEFAULT_CONFIG as ɵa} from './viewport/viewport.const';"],"names":["matchStrategyHandlerMap"],"mappings":";;;;;IAOY,yBAeX;AAfD,WAAY,yBAAyB;;IAEpC,2EAAK,CAAA;;IAGL,+EAAO,CAAA;;IAGP,6EAAM,CAAA;;IAGN,uGAAmB,CAAA;;IAGnB,qGAAkB,CAAA;CAClB,EAfW,yBAAyB,KAAzB,yBAAyB,QAepC;;;;;;;;;;;AAsBD,SAAgB,iBAAiB,CAChC,UAAiC,EACjC,QAA8B,EAC9B,QAAmC,EACnC,SAAiC,EACjC,WAA6C;IAE7C,MAAM,OAAO,GAAG,uBAAuB,CAAC,QAAQ,CAAC,CAAC;IAClD,IAAI,CAAC,OAAO,EAAE;QACb,MAAM,KAAK,CAAC,yEAAyE,QAAQ,GAAG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AAG,MAAM,CAAC;IACnE,MAAM,QAAQ,mCACV,iBAAiB,CAAC,QAAQ,GAC1B,SAAS,CAAC,QAAQ,CACrB,CAAC;IAEF,OAAO,EAAE,QAAQ,EAAE,CAAC;CACpB;;AAGD,SAAgB,OAAO;IACtB,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QAClC,OAAO,MAAM,CAAC;KACd;IACD,OAAO,EAAE,CAAC;CACV;;MC1DY,OAAO,GAAG,OAAO;;ACA9B;;GAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ssv-ngx.ux.js","sources":["ng://@ssv/ngx.ux/viewport/viewport-data/viewport-data-matcher.ts","ng://@ssv/ngx.ux/viewport/viewport.const.ts","ng://@ssv/ngx.ux/config.ts","ng://@ssv/ngx.ux/platform/window.ts","ng://@ssv/ngx.ux/viewport/viewport.model.ts","ng://@ssv/ngx.ux/viewport/viewport-server-size.service.ts","ng://@ssv/ngx.ux/viewport/viewport.util.ts","ng://@ssv/ngx.ux/viewport/viewport.service.ts","ng://@ssv/ngx.ux/viewport/viewport-data/viewport-data.utils.ts","ng://@ssv/ngx.ux/viewport/viewport-data/viewport-data.service.ts","ng://@ssv/ngx.ux/viewport/viewport-data/viewport-data.pipe.ts","ng://@ssv/ngx.ux/viewport/viewport-matcher-var.directive.ts","ng://@ssv/ngx.ux/viewport/viewport-matcher.directive.ts","ng://@ssv/ngx.ux/module.ts","ng://@ssv/ngx.ux/version.ts","ng://@ssv/ngx.ux/ssv-ngx.ux.ts"],"sourcesContent":["import { Dictionary } from \"../../internal/internal.model\";\nimport { ViewportSizeTypeInfo } from \"../viewport.model\";\n\nexport type ViewportDataConfig<TValue = unknown, TData = Dictionary<TValue>> = TData & {\n\tdefault?: TValue\n};\n\nexport enum ViewportDataMatchStrategy {\n\t/** Indicates that size should match exact or default. */\n\texact,\n\n\t/** Indicates that size matches when exact match, first match smaller (down) or default. */\n\tsmaller,\n\n\t/** Indicates that size matches when exact match, first match larger (up) or default. */\n\tlarger,\n\n\t/** Indicates that size matches when exact match, or it tries both smaller/larger (smaller is preferred) until match or default. */\n\tclosestSmallerFirst,\n\n\t/** Indicates that size matches when exact match, or it tries both larger/smaller (larger is preferred) until match or default. */\n\tclosestLargerFirst,\n}\nexport type ViewportDataMatchStrategyLiteral = keyof typeof ViewportDataMatchStrategy;\n\nexport interface ViewportDataMatcher<T = unknown> {\n\t(\n\t\tdataConfig: ViewportDataConfig<T>,\n\t\tcurrentSizeType: ViewportSizeTypeInfo,\n\t\tsizeTypes: ViewportSizeTypeInfo[],\n\t\tsizeTypeMap: Dictionary<ViewportSizeTypeInfo>,\n\t): T | undefined;\n}\n\n/**\n * Utility function to match data based on strategy and size.\n *\n * @param dataConfig Data config to generate rules based on.\n * @param sizeType Size type to get data for.\n * @param strategy Strategy to use when building rules.\n * @param sizeTypes Available size types ordered by index type. (Can be obtained from `ViewportService`)\n * @param sizeTypeMap Available size type map. (Can be obtained from `ViewportService`)\n * @returns Returns the matched data value.\n */\nexport function matchViewportData<T>(\n\tdataConfig: ViewportDataConfig<T>,\n\tsizeType: ViewportSizeTypeInfo,\n\tstrategy: ViewportDataMatchStrategy,\n\tsizeTypes: ViewportSizeTypeInfo[],\n\tsizeTypeMap: Dictionary<ViewportSizeTypeInfo>,\n): T | undefined {\n\tconst matchFn = matchStrategyHandlerMap[strategy];\n\tif (!matchFn) {\n\t\tthrow Error(`matchViewportData: Viewport Data strategy not implemented. Strategy: '${strategy}'`);\n\t}\n\tconst data = matchFn(dataConfig, sizeType, sizeTypes, sizeTypeMap) as T;\n\tif (data !== undefined) {\n\t\treturn data;\n\t}\n\treturn dataConfig.default;\n}\n\n\nconst matchStrategyHandlerMap: Dictionary<ViewportDataMatcher> = {\n\t[ViewportDataMatchStrategy.exact]: matchWithExact,\n\t[ViewportDataMatchStrategy.larger]: matchWithLargerMatch,\n\t[ViewportDataMatchStrategy.smaller]: matchWithSmallerMatch,\n\t[ViewportDataMatchStrategy.closestSmallerFirst]: matchWithClosestSmallerFirstMatch,\n\t[ViewportDataMatchStrategy.closestLargerFirst]: matchWithClosestLargerFirstMatch,\n};\n\nfunction matchWithExact<T>(\n\tdataConfig: ViewportDataConfig<T>,\n\tcurrentSizeType: ViewportSizeTypeInfo,\n): T | undefined {\n\treturn dataConfig[currentSizeType.name];\n}\n\nfunction matchWithLargerMatch<T>(\n\tdataConfig: ViewportDataConfig<T>,\n\tcurrentSizeType: ViewportSizeTypeInfo,\n\tsizeTypes: ViewportSizeTypeInfo[],\n): T | undefined {\n\tlet data = dataConfig[currentSizeType.name];\n\tif (data !== undefined) {\n\t\treturn data;\n\t}\n\n\tconst largestTypeIdx = sizeTypes[sizeTypes.length - 1].type;\n\tif (currentSizeType.type >= largestTypeIdx) {\n\t\treturn undefined;\n\t}\n\n\tfor (let index = currentSizeType.type; index < sizeTypes.length; index++) {\n\t\tconst sizeType = sizeTypes[index];\n\t\tdata = dataConfig[sizeType.name];\n\t\tif (data !== undefined) {\n\t\t\treturn data;\n\t\t}\n\t}\n\n\treturn undefined;\n}\n\nfunction matchWithSmallerMatch<T>(\n\tdataConfig: ViewportDataConfig<T>,\n\tcurrentSizeType: ViewportSizeTypeInfo,\n\tsizeTypes: ViewportSizeTypeInfo[],\n): T | undefined {\n\tlet data = dataConfig[currentSizeType.name];\n\tif (data !== undefined) {\n\t\treturn data;\n\t}\n\n\tif (currentSizeType.type <= 0) {\n\t\treturn undefined;\n\t}\n\n\t// eslint-disable-next-line for-direction\n\tfor (let index = currentSizeType.type; index < sizeTypes.length; index--) {\n\t\tconst sizeType = sizeTypes[index];\n\t\tdata = dataConfig[sizeType.name];\n\t\tif (data !== undefined) {\n\t\t\treturn data;\n\t\t}\n\t}\n\n\treturn undefined;\n}\n\nfunction matchWithClosestSmallerFirstMatch<T>(\n\tdataConfig: ViewportDataConfig<T>,\n\tcurrentSizeType: ViewportSizeTypeInfo,\n\tsizeTypes: ViewportSizeTypeInfo[],\n): T | undefined {\n\treturn closestMatch(dataConfig, currentSizeType, sizeTypes, true);\n}\n\nfunction matchWithClosestLargerFirstMatch<T>(\n\tdataConfig: ViewportDataConfig<T>,\n\tcurrentSizeType: ViewportSizeTypeInfo,\n\tsizeTypes: ViewportSizeTypeInfo[],\n): T | undefined {\n\treturn closestMatch(dataConfig, currentSizeType, sizeTypes, false);\n}\n\nfunction closestMatch<T>(\n\tdataConfig: ViewportDataConfig<T>,\n\tcurrentSizeType: ViewportSizeTypeInfo,\n\tsizeTypes: ViewportSizeTypeInfo[],\n\tisSmallerFirst: boolean\n): T | undefined {\n\tlet data = dataConfig[currentSizeType.name];\n\tif (data !== undefined) {\n\t\treturn data;\n\t}\n\n\tlet downIndex = currentSizeType.type;\n\tlet upIndex = currentSizeType.type;\n\n\t// eslint-disable-next-line @typescript-eslint/prefer-for-of\n\tfor (let index = 0; index < sizeTypes.length; index++) {\n\t\tfor (const idx of isSmallerFirst ? [--downIndex, ++upIndex] : [++upIndex, --downIndex]) {\n\t\t\tconst sizeType = sizeTypes[idx];\n\t\t\tif (sizeType) {\n\t\t\t\tdata = dataConfig[sizeType.name];\n\t\t\t\tif (data !== undefined) {\n\t\t\t\t\treturn data;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn undefined;\n}\n","import { Dictionary } from \"../internal/internal.model\";\nimport { ViewportDataMatchStrategy } from \"./viewport-data/viewport-data-matcher\";\nimport { UxViewportOptions } from \"./viewport.model\";\n\n/** Default viewport breakpoints. */\nexport const UX_VIEWPORT_DEFAULT_BREAKPOINTS: Dictionary<number> = {\n\txsmall: 450,\n\tsmall: 767,\n\tmedium: 992,\n\tlarge: 1200,\n\txlarge: 1500,\n\txxlarge: 1920,\n\txxlarge1: 2100,\n};\n\nexport const UX_VIEWPORT_DEFAULT_CONFIG: UxViewportOptions = {\n\tresizePollingSpeed: 33,\n\tbreakpoints: UX_VIEWPORT_DEFAULT_BREAKPOINTS,\n\tdefaultDataMatchStrategy: ViewportDataMatchStrategy.smaller,\n};\n","import { InjectionToken } from \"@angular/core\";\nimport { UX_VIEWPORT_DEFAULT_CONFIG } from \"./viewport/viewport.const\";\nimport { UxViewportOptions } from \"./viewport/viewport.model\";\n\nexport interface UxOptions {\n\tviewport: UxViewportOptions;\n}\n\nexport const UX_DEFAULT_CONFIG: UxOptions = {\n\tviewport: UX_VIEWPORT_DEFAULT_CONFIG,\n};\n\nexport const UX_CONFIG = new InjectionToken<UxOptions>(\"@ssv/ngx.ux-config\");\n","import { InjectionToken, Injectable, Inject } from \"@angular/core\";\n\nexport const WINDOW = new InjectionToken<Window>(\"Window\");\n\n@Injectable({\n\tprovidedIn: \"root\",\n})\nexport class WindowRef {\n\n\tconstructor(\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\n\t\t@Inject(WINDOW) private window: any\n\t) {\n\t}\n\n\t/** Window underlying native object. */\n\tget native(): Window {\n\t\treturn this.window as Window;\n\t}\n\n\t/** Determines whether native element is supported or not. Generally `false` when executing in SSR. */\n\tget hasNative(): boolean {\n\t\treturn !!this.native.window;\n\t}\n\n}\n","import { Dictionary } from \"../internal/internal.model\";\nimport { ViewportDataMatchStrategy } from \"./viewport-data\";\n\n/**\n * The indices of each breakpoint provided based on the `UX_VIEWPORT_DEFAULT_BREAKPOINTS`.\n * @see UX_VIEWPORT_DEFAULT_BREAKPOINTS\n */\nexport enum ViewportSizeType {\n\txsmall = 0,\n\tsmall = 1,\n\tmedium = 2,\n\tlarge = 3,\n\txlarge = 4,\n\txxlarge = 5,\n\txxlarge1 = 6,\n}\n\nexport enum ComparisonOperation {\n\tequals = \"=\",\n\tnotEquals = \"<>\",\n\tlessThan = \"<\",\n\tlessOrEqualThan = \"<=\",\n\tgreaterThan = \">\",\n\tgreaterOrEqualThan = \">=\",\n}\n\nexport enum DeviceType {\n\tdesktop = \"desktop\",\n\tmobile = \"mobile\",\n\ttablet = \"tablet\"\n}\n\nexport interface UxViewportOptions {\n\t/** Polling speed on resizing (in milliseconds). e.g. the higher the number the longer it takes to recalculate. */\n\tresizePollingSpeed: number;\n\n\t/** Breakpoints to use. Key needs to match the size type and the value the width threshold.\n\t * e.g. given width '1000' and `medium` is set to '992' => `large`.\n\t */\n\tbreakpoints: Dictionary<number>;\n\n\t/** Default data match strategy to use. */\n\tdefaultDataMatchStrategy: ViewportDataMatchStrategy;\n}\n\nexport interface ViewportSize {\n\twidth: number;\n\theight: number;\n}\n\nexport interface ViewportSizeTypeInfo {\n\ttype: number;\n\tname: string;\n\twidthThreshold: number;\n}\n\nexport interface ViewportMatchConditions {\n\tsizeType?: string | string[] | null;\n\tsizeTypeExclude?: string | string[] | null;\n\texpression?: ViewportSizeMatcherExpression;\n}\n\nexport interface ViewportSizeMatcherExpression {\n\tsize: string;\n\toperation: ComparisonOperation;\n}\n","import { Injectable, Inject, InjectionToken, Optional } from \"@angular/core\";\n\nimport { Dictionary } from \"../internal/internal.model\";\nimport { DeviceType, ViewportSize } from \"./viewport.model\";\nimport { UxOptions } from \"../config\";\n\n// todo: make this configurable\n/** Viewport size for SSR. */\nconst viewportSizeSSR: Dictionary<ViewportSize> = {\n\t[DeviceType.desktop]: {\n\t\twidth: 1366,\n\t\theight: 768,\n\t},\n\t[DeviceType.tablet]: {\n\t\twidth: 768,\n\t\theight: 1024,\n\t},\n\t[DeviceType.mobile]: {\n\t\twidth: 414,\n\t\theight: 736,\n\t},\n};\n\nexport const UX_VIEWPORT_SSR_DEVICE = new InjectionToken<UxOptions>(\"@ssv/ngx.ux-config/viewport/ssr-device\");\n\n@Injectable({\n\tprovidedIn: \"root\",\n})\nexport class ViewportServerSizeService {\n\n\tconstructor(\n\t\t@Optional() @Inject(UX_VIEWPORT_SSR_DEVICE) private deviceType: DeviceType,\n\t) {\n\t}\n\n\tget(): ViewportSize {\n\t\treturn viewportSizeSSR[this.deviceType] || viewportSizeSSR[DeviceType.desktop];\n\t}\n\n}\n","import { Dictionary } from \"../internal/internal.model\";\nimport {\n\tComparisonOperation,\n\tViewportSizeMatcherExpression,\n\tViewportSizeTypeInfo,\n\tViewportMatchConditions\n} from \"./viewport.model\";\n\nexport function isViewportSizeMatcherExpression(value: unknown): value is ViewportSizeMatcherExpression {\n\tif (typeof value !== \"object\" || !value) {\n\t\treturn false;\n\t}\n\tconst args: Partial<ViewportSizeMatcherExpression> = value;\n\tif (args.size && args.operation) {\n\t\treturn true;\n\t}\n\treturn false;\n}\n\nexport function isViewportSizeMatcherTupleExpression(arg: unknown): arg is [ComparisonOperation, string] {\n\tif (!arg) {\n\t\treturn false;\n\t}\n\tif (Array.isArray(arg)) {\n\t\tif (arg.length === 2) {\n\t\t\tconst [op] = arg;\n\t\t\treturn operations.includes(op);\n\t\t}\n\t}\n\treturn false;\n}\n\n\nconst operations = Object.values(ComparisonOperation);\n\nexport const COMPARISON_OPERATION_FUNC_MAPPING: Dictionary<(a: number, b: number) => boolean> = {\n\t[ComparisonOperation.equals]: (a: number, b: number) => a === b,\n\t[ComparisonOperation.notEquals]: (a: number, b: number) => a !== b,\n\t[ComparisonOperation.lessThan]: (a: number, b: number) => a < b,\n\t[ComparisonOperation.lessOrEqualThan]: (a: number, b: number) => a <= b,\n\t[ComparisonOperation.greaterThan]: (a: number, b: number) => a > b,\n\t[ComparisonOperation.greaterOrEqualThan]: (a: number, b: number) => a >= b,\n};\n\nexport function isViewportConditionMatch(\n\tevaluateSize: ViewportSizeTypeInfo,\n\tconditions: ViewportMatchConditions,\n\tviewportSizeTypeInfoRefs: Dictionary<ViewportSizeTypeInfo>\n): boolean {\n\tconst isExcluded = match(conditions.sizeTypeExclude, evaluateSize.name, false);\n\tlet isIncluded;\n\tlet isExpressionTruthy;\n\n\tif (!isExcluded && conditions.expression) {\n\t\tconst ref = viewportSizeTypeInfoRefs[conditions.expression.size];\n\t\tif(!ref) {\n\t\t\tthrow new Error(`Viewport size type is invalid. Size type: '${conditions.expression.size}'`);\n\t\t}\n\t\tconst expMatcher = COMPARISON_OPERATION_FUNC_MAPPING[conditions.expression.operation];\n\n\t\tisExpressionTruthy = expMatcher(evaluateSize.type, ref.type);\n\t} else {\n\t\tisIncluded = match(conditions.sizeType, evaluateSize.name, true);\n\t}\n\n\tconst shouldRender = (isExpressionTruthy || isIncluded) && !isExcluded;\n\t// console.warn(\">>> shouldRender\", { evaluateSize, conditions, shouldRender });\n\treturn !!shouldRender;\n}\n\nfunction match(value: string | string[] | null | undefined, targetValue: string, defaultValue: boolean) {\n\tif (!value) {\n\t\treturn defaultValue;\n\t}\n\n\treturn Array.isArray(value)\n\t\t? value.includes(targetValue)\n\t\t: value === targetValue;\n}\n\nexport function getSizeTypeInfo(width: number, sizeTypes: ViewportSizeTypeInfo[]): ViewportSizeTypeInfo {\n\tconst lastEntryIndex = sizeTypes.length - 1;\n\n\tfor (let idx = 0; idx < lastEntryIndex; idx++) {\n\t\tconst viewportSizeTypeInfo = sizeTypes[idx];\n\n\t\tif (width <= viewportSizeTypeInfo.widthThreshold) {\n\t\t\treturn viewportSizeTypeInfo;\n\t\t}\n\t}\n\n\treturn sizeTypes[lastEntryIndex];\n}\n\n/**\n * Converts the breakpoints into a 2 dimensional array containing the name and width, and sorted from\n * smallest to largest.\n * @param breakpoints the breakpoints obtained from the config\n * @internal\n */\nfunction getSortedBreakpoints(breakpoints: Dictionary<number>): [string, number][] {\n\treturn Object.entries(breakpoints)\n\t\t.sort(([, widthA], [, widthB]) => widthA - widthB);\n}\n\n/**\n * A util function which generates the ViewportSizeTypeInfo.type for each breakpoint.\n * @param breakpoints the custom breakpoints\n */\nexport function generateViewportSizeType<T extends Record<string, number>>(breakpoints: T): T & Record<number, string> {\n\treturn Object.freeze(\n\t\tgetSortedBreakpoints(breakpoints).reduce<Record<number | string, string | number>>(\n\t\t\t(dictionary, [name], index) => {\n\t\t\t\tdictionary[name] = index;\n\t\t\t\tdictionary[index] = name;\n\t\t\t\treturn dictionary;\n\t\t\t}, {}\n\t\t)\n\t) as T & Record<number, string>;\n}\n\n/**\n * Pre-processes the given breakpoints into an ordered list from smallest to largest while generating\n * all the necessary information on the viewport.\n * @param breakpoints the breakpoints obtained from the config\n * @internal\n */\nexport function generateViewportSizeTypeInfoList(breakpoints: Dictionary<number>): ViewportSizeTypeInfo[] {\n\treturn getSortedBreakpoints(breakpoints)\n\t\t.map(([name, width], index) =>\n\t\t\t(Object.freeze({\n\t\t\t\tname,\n\t\t\t\ttype: index,\n\t\t\t\twidthThreshold: width\n\t\t\t}))\n\t\t);\n}\n\n/**\n * Converts the breakpoint list into a dictionary while using the name as key.\n * @param breakpointList the list of breakpoints\n * @internal\n */\nexport function generateViewportSizeTypeInfoRefs(breakpointList: ViewportSizeTypeInfo[]): Dictionary<ViewportSizeTypeInfo> {\n\treturn Object.freeze(\n\t\tbreakpointList.reduce<Dictionary<ViewportSizeTypeInfo>>((dictionary, breakpoint) => {\n\t\t\tdictionary[breakpoint.name] = breakpoint;\n\t\t\tdictionary[breakpoint.type] = breakpoint;\n\t\t\treturn dictionary;\n\t\t}, {})\n\t);\n}\n","import { Injectable, Inject } from \"@angular/core\";\nimport { Observable, fromEvent, of } from \"rxjs\";\nimport {\n\tmap,\n\ttap,\n\tdistinctUntilChanged,\n\tstartWith,\n\tshare,\n\tshareReplay,\n\tauditTime,\n} from \"rxjs/operators\";\n\nimport { UxOptions, UX_CONFIG } from \"../config\";\nimport { ViewportSizeTypeInfo, ViewportSize } from \"./viewport.model\";\nimport { WindowRef } from \"../platform/window\";\nimport { ViewportServerSizeService } from \"./viewport-server-size.service\";\nimport { generateViewportSizeTypeInfoList, generateViewportSizeTypeInfoRefs, getSizeTypeInfo } from \"./viewport.util\";\nimport { Dictionary } from \"../internal/internal.model\";\n\n@Injectable({\n\tprovidedIn: \"root\",\n})\nexport class ViewportService {\n\n\t/** Window resize observable. */\n\treadonly resizeSnap$: Observable<ViewportSize>;\n\n\t/** Window resize observable (which is also throttled). */\n\treadonly resize$: Observable<ViewportSize>;\n\n\t/** Viewport size type observable (which is also throttled). */\n\treadonly sizeType$: Observable<ViewportSizeTypeInfo>;\n\n\t/** Viewport size type observable. */\n\treadonly sizeTypeSnap$: Observable<ViewportSizeTypeInfo>;\n\n\t/** Viewport size type snapshot of the last value. (Prefer use `sizeType$` observable when possible.) */\n\tget sizeTypeSnapshot(): ViewportSizeTypeInfo { return this._sizeTypeSnapshot; }\n\n\t/** Viewport size observable (which is also throttled). */\n\treadonly size$: Observable<ViewportSize>;\n\n\t/** Viewport size observable. */\n\treadonly sizeSnap$: Observable<ViewportSize>;\n\n\t/** Size types refs of the generated viewport size type info. */\n\tget sizeTypeMap(): Dictionary<ViewportSizeTypeInfo> { return this._sizeTypeMap; }\n\n\t/** Viewport size types list ordered by type, smallest to largest. */\n\tget sizeTypes(): ViewportSizeTypeInfo[] { return this._sizeTypes; }\n\n\tprivate _sizeTypeMap: Dictionary<ViewportSizeTypeInfo>;\n\tprivate _sizeTypes: ViewportSizeTypeInfo[];\n\tprivate _sizeTypeSnapshot: ViewportSizeTypeInfo;\n\n\tconstructor(\n\t\tprivate windowRef: WindowRef,\n\t\tprivate viewportServerSize: ViewportServerSizeService,\n\t\t@Inject(UX_CONFIG) config: UxOptions,\n\t) {\n\t\tthis._sizeTypes = generateViewportSizeTypeInfoList(config.viewport.breakpoints);\n\t\tthis._sizeTypeMap = generateViewportSizeTypeInfoRefs(this._sizeTypes);\n\n\t\tif (windowRef.hasNative) {\n\t\t\tthis.resizeSnap$ = fromEvent<Event>(window, \"resize\").pipe(\n\t\t\t\tmap(() => this.getViewportSize()),\n\t\t\t\tshare()\n\t\t\t);\n\n\t\t\tthis.resize$ = this.resizeSnap$.pipe(\n\t\t\t\tauditTime(config.viewport.resizePollingSpeed),\n\t\t\t\tshare(),\n\t\t\t);\n\t\t} else {\n\t\t\tthis.resizeSnap$ = this.resize$ = of(viewportServerSize.get());\n\t\t}\n\t\tconst size = this.getViewportSize();\n\t\tthis._sizeTypeSnapshot = getSizeTypeInfo(size.width, this.sizeTypes);\n\n\t\tconst sizeFn = (obs$: Observable<ViewportSize>) => obs$.pipe(\n\t\t\tstartWith(size),\n\t\t\tdistinctUntilChanged((a, b) => a.width === b.width && a.height === b.height),\n\t\t\tshareReplay(1),\n\t\t);\n\n\t\tthis.sizeSnap$ = sizeFn(this.resizeSnap$);\n\t\tthis.size$ = sizeFn(this.resize$);\n\n\t\tconst sizeTypeFn = (obs$: Observable<ViewportSize>) => obs$.pipe(\n\t\t\tdistinctUntilChanged((a, b) => a.width === b.width),\n\t\t\tmap(x => getSizeTypeInfo(x.width, this.sizeTypes)),\n\t\t\tdistinctUntilChanged(),\n\t\t\ttap(x => this._sizeTypeSnapshot = x),\n\t\t\tshareReplay(1),\n\t\t);\n\n\t\tthis.sizeType$ = sizeTypeFn(this.size$);\n\t\tthis.sizeTypeSnap$ = sizeTypeFn(this.sizeSnap$);\n\t}\n\n\t/**\n\t * Calculates amount of items that fits into container's width.\n\t * @param containerWidth\n\t * @param itemWidth\n\t * @returns\n\t */\n\tcalculateItemsPerRow(containerWidth: number, itemWidth: number): number {\n\t\tif (containerWidth === 0) {\n\t\t\treturn 0;\n\t\t}\n\t\tif (!containerWidth && !this.windowRef.hasNative) {\n\t\t\t// todo: find a way to get container width for ssr\n\t\t\tcontainerWidth = this.viewportServerSize.get().width;\n\t\t}\n\n\t\treturn containerWidth / itemWidth;\n\t}\n\n\t/** Returns the current viewport size */\n\tprivate getViewportSize(): ViewportSize {\n\t\tif (!this.windowRef.hasNative) {\n\t\t\treturn this.viewportServerSize.get();\n\t\t}\n\n\t\tconst ua = navigator.userAgent.toLowerCase();\n\t\tif (ua.indexOf(\"safari\") !== -1 && ua.indexOf(\"chrome\") === -1) { // safari subtracts the scrollbar width\n\t\t\treturn {\n\t\t\t\twidth: this.windowRef.native.document.documentElement.clientWidth,\n\t\t\t\theight: this.windowRef.native.document.documentElement.clientHeight,\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\twidth: this.windowRef.native.innerWidth,\n\t\t\theight: this.windowRef.native.innerHeight,\n\t\t};\n\t}\n\n}\n","import { Dictionary } from \"../../internal/internal.model\";\nimport { ViewportSizeTypeInfo } from \"../viewport.model\";\nimport { ViewportDataConfig, ViewportDataMatchStrategy } from \"./viewport-data-matcher\";\n\nexport interface ViewportDataRule<T> {\n\tmin?: number;\n\tmax?: number;\n\tvalue: T;\n}\n\n/**\n * Utility function to generate rules based on strategies.\n *\n * @param dataConfig Data config to generate rules based on.\n * @param strategy Strategy to use when building rules.\n * @param sizeTypes Available size types ordered by index type. (Can be obtained from `ViewportService`)\n * @param sizeTypeMap Available size type map. (Can be obtained from `ViewportService`)\n * @returns Returns a collection of rules (ordered).\n */\nexport function generateViewportRulesRangeFromDataMatcher<T>(\n\tdataConfig: ViewportDataConfig<T>,\n\tstrategy: ViewportDataMatchStrategy,\n\tsizeTypes: ViewportSizeTypeInfo[],\n\tsizeTypeMap: Dictionary<ViewportSizeTypeInfo>,\n): ViewportDataRule<T>[] {\n\tconst ruleBuilderFn = matchStrategyHandlerMap[strategy];\n\tif (!ruleBuilderFn) {\n\t\tthrow Error(`generateViewportRulesRangeFromDataMatcher: Viewport Data strategy not implemented. Strategy: '${strategy}'`);\n\t}\n\n\tlet dataSizes: ViewportSizeTypeInfo[] = [];\n\tfor (const key in dataConfig) {\n\t\tif (Object.prototype.hasOwnProperty.call(dataConfig, key)) {\n\t\t\tconst data = dataConfig[key];\n\t\t\tif (data === undefined) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst size = sizeTypeMap[key];\n\t\t\tif (size) {\n\t\t\t\tdataSizes.push(size);\n\t\t\t}\n\t\t}\n\t}\n\tdataSizes = dataSizes.sort(({ type: typeA }, { type: typeB }) => typeA - typeB);\n\n\tconst rules: ViewportDataRule<T>[] = [];\n\tif (dataConfig.default) {\n\t\trules.push({ value: dataConfig.default, min: undefined, max: undefined });\n\t}\n\n\tlet prevRule: ViewportDataRule<T> | undefined;\n\tfor (let index = 0; index < dataSizes.length; index++) {\n\t\tconst prevDataSize = dataSizes[index - 1];\n\t\tconst nextDataSize = dataSizes[index + 1];\n\t\tconst dataSize = dataSizes[index];\n\t\tconst prevSize = sizeTypes[dataSize.type - 1];\n\t\t// const nextSize = sizeTypes[dataSize.type + 1];\n\t\tconst data = dataConfig[dataSize.name];\n\t\tconst rule: ViewportDataRule<T> = {\n\t\t\tvalue: data,\n\t\t\tmin: undefined,\n\t\t\tmax: undefined,\n\t\t};\n\n\t\truleBuilderFn(rule, dataSize, nextDataSize, prevDataSize, prevSize, prevRule, sizeTypes);\n\n\t\tprevRule = rule;\n\t\trules.push(rule);\n\t}\n\treturn rules;\n}\n\nexport interface ViewportRuleRangeBuilder<T = unknown> {\n\t(\n\t\trule: ViewportDataRule<T>,\n\t\tdataSize: ViewportSizeTypeInfo,\n\t\tnextDataSize: ViewportSizeTypeInfo | undefined,\n\t\tprevDataSize: ViewportSizeTypeInfo | undefined,\n\t\tprevSize: ViewportSizeTypeInfo | undefined,\n\t\tprevRule: ViewportDataRule<T> | undefined,\n\t\tsizeTypes: ViewportSizeTypeInfo[],\n\t): void;\n}\n\nconst matchStrategyHandlerMap: Dictionary<ViewportRuleRangeBuilder> = {\n\t[ViewportDataMatchStrategy.exact]: (rule, dataSize, _nextDataSize, _prevDataSize, prevSize) => {\n\t\trule.max = dataSize.widthThreshold;\n\t\tif (prevSize) {\n\t\t\trule.min = prevSize.widthThreshold + 1;\n\t\t}\n\t},\n\t[ViewportDataMatchStrategy.smaller]: (rule, dataSize, nextDataSize, _prevDataSize, prevSize) => {\n\t\tif (nextDataSize) {\n\t\t\trule.max = dataSize.widthThreshold;\n\t\t}\n\t\tif (prevSize) {\n\t\t\trule.min = prevSize.widthThreshold + 1;\n\t\t}\n\t},\n\t[ViewportDataMatchStrategy.larger]: (rule, dataSize, _nextDataSize, prevDataSize) => {\n\t\tif (dataSize) {\n\t\t\trule.max = dataSize.widthThreshold;\n\t\t}\n\t\tif (prevDataSize) {\n\t\t\trule.min = prevDataSize.widthThreshold + 1;\n\t\t}\n\t},\n\t[ViewportDataMatchStrategy.closestSmallerFirst]: (rule, dataSize, nextDataSize, _prevDataSize, _prevSize, prevRule, sizeTypes) => {\n\t\tif (nextDataSize) {\n\t\t\trule.max = calculateClosestWidthThreshold(nextDataSize, dataSize, sizeTypes, true);\n\t\t}\n\t\tif (prevRule?.max) {\n\t\t\trule.min = prevRule.max + 1;\n\t\t}\n\t},\n\t[ViewportDataMatchStrategy.closestLargerFirst]: (rule, dataSize, nextDataSize, _prevDataSize, _prevSize, prevRule, sizeTypes) => {\n\t\tif (nextDataSize) {\n\t\t\trule.max = calculateClosestWidthThreshold(nextDataSize, dataSize, sizeTypes, false);\n\t\t}\n\t\tif (prevRule?.max) {\n\t\t\trule.min = prevRule.max + 1;\n\t\t}\n\t},\n};\n\nfunction calculateClosestWidthThreshold(\n\tnextDataSize: ViewportSizeTypeInfo,\n\tdataSize: ViewportSizeTypeInfo,\n\tsizeTypes: ViewportSizeTypeInfo[],\n\tisSmallerPreferred: boolean,\n) {\n\tconst fn = isSmallerPreferred ? Math.ceil : Math.floor;\n\t// get closest between curr and next\n\tconst diffIndex = fn((nextDataSize.type - dataSize.type - 1) / 2);\n\tconst diffNextSize = sizeTypes[dataSize.type + diffIndex];\n\treturn (diffNextSize || dataSize).widthThreshold;\n}\n","import { Inject, Injectable } from \"@angular/core\";\nimport { Observable } from \"rxjs\";\nimport { distinctUntilChanged, map } from \"rxjs/operators\";\nimport { UX_CONFIG, UxOptions } from \"../../config\";\n\nimport { ViewportSizeTypeInfo } from \"../viewport.model\";\nimport { ViewportService } from \"../viewport.service\";\nimport { matchViewportData, ViewportDataConfig, ViewportDataMatchStrategy } from \"./viewport-data-matcher\";\nimport { generateViewportRulesRangeFromDataMatcher, ViewportDataRule } from \"./viewport-data.utils\";\n\n@Injectable({\n\tprovidedIn: \"root\",\n})\nexport class ViewportDataService {\n\n\tconstructor(\n\t\tprivate viewport: ViewportService,\n\t\t@Inject(UX_CONFIG) private config: UxOptions,\n\t) {\n\t}\n\n\t/** Get data for match. */\n\tget<T>(\n\t\tdataConfig: ViewportDataConfig<T>,\n\t\tstrategy: ViewportDataMatchStrategy = this.config.viewport.defaultDataMatchStrategy,\n\t\tsizeType: ViewportSizeTypeInfo = this.viewport.sizeTypeSnapshot\n\t): T | undefined {\n\t\treturn matchViewportData(dataConfig, sizeType, strategy, this.viewport.sizeTypes, this.viewport.sizeTypeMap);\n\t}\n\n\t/** Get data for match as observable. */\n\tget$<T>(dataConfig: ViewportDataConfig<T>, strategy?: ViewportDataMatchStrategy, throttle = true): Observable<T | undefined> {\n\t\treturn (throttle ? this.viewport.sizeType$ : this.viewport.sizeTypeSnap$).pipe(\n\t\t\tmap(sizeType => this.get<T>(dataConfig, strategy, sizeType)),\n\t\t\tdistinctUntilChanged(),\n\t\t);\n\t}\n\n\t/** Generate rules based on strategies for data. */\n\tgenerateRules<T>(\n\t\tdataConfig: ViewportDataConfig<T>,\n\t\tstrategy: ViewportDataMatchStrategy = this.config.viewport.defaultDataMatchStrategy,\n\t): ViewportDataRule<T>[] {\n\t\treturn generateViewportRulesRangeFromDataMatcher(\n\t\t\tdataConfig,\n\t\t\tstrategy,\n\t\t\tthis.viewport.sizeTypes,\n\t\t\tthis.viewport.sizeTypeMap\n\t\t);\n\t}\n\n}\n","import { Subscription } from \"rxjs\";\nimport { tap } from \"rxjs/operators\";\nimport { Pipe, PipeTransform, OnDestroy, ChangeDetectorRef } from \"@angular/core\";\n\nimport { ViewportDataConfig, ViewportDataMatchStrategy, ViewportDataMatchStrategyLiteral } from \"./viewport-data-matcher\";\nimport { ViewportDataService } from \"./viewport-data.service\";\n\n/* eslint-disable @angular-eslint/no-pipe-impure */\n@Pipe({\n\tname: \"ssvViewportData\",\n\tpure: false\n})\nexport class ViewportDataPipe implements PipeTransform, OnDestroy {\n\n\tprivate markForTransform = true;\n\tprivate value: unknown;\n\tprivate data: ViewportDataConfig | undefined;\n\tprivate strategy: ViewportDataMatchStrategyLiteral | undefined;\n\tprivate data$$ = Subscription.EMPTY;\n\n\tconstructor(\n\t\tprivate viewportData: ViewportDataService,\n\t\tprivate cdr: ChangeDetectorRef\n\t) {\n\t}\n\n\ttransform(data: ViewportDataConfig, strategy: ViewportDataMatchStrategyLiteral): unknown {\n\t\tif (!this.markForTransform && data === this.data && strategy === this.strategy) {\n\t\t\treturn this.value;\n\t\t}\n\t\tthis.data = data;\n\t\tthis.strategy = strategy;\n\n\t\tthis.data$$.unsubscribe();\n\t\tthis.data$$ = this.viewportData.get$(data, ViewportDataMatchStrategy[strategy]).pipe(\n\t\t\ttap(value => {\n\t\t\t\tthis.markForTransform = true;\n\t\t\t\tthis.value = value;\n\t\t\t\tthis.cdr.markForCheck();\n\t\t\t}),\n\t\t).subscribe();\n\n\t\tthis.markForTransform = false;\n\t\treturn this.value;\n\t}\n\n\tngOnDestroy(): void {\n\t\tthis.data$$.unsubscribe();\n\t}\n\n}\n","import {\n\tOnInit,\n\tOnDestroy,\n\tDirective,\n\tInput,\n\tTemplateRef,\n\tViewContainerRef,\n\tEmbeddedViewRef,\n} from \"@angular/core\";\nimport { combineLatest, ReplaySubject, Subject } from \"rxjs\";\nimport { tap, map, takeUntil } from \"rxjs/operators\";\n\nimport { ViewportService } from \"./viewport.service\";\nimport {\n\tisViewportSizeMatcherExpression,\n\tisViewportSizeMatcherTupleExpression,\n\tisViewportConditionMatch\n} from \"./viewport.util\";\nimport { ViewportMatchConditions, ViewportSizeMatcherExpression } from \"./viewport.model\";\n\nconst NAME_CAMEL = \"ssvViewportMatcherVar\";\n\nexport class SsvViewportMatcherVarContext {\n\n\tconstructor(\n\t\tpublic $implicit = false,\n\t) { }\n\n}\n\n@Directive({\n\tselector: `[${NAME_CAMEL}]`,\n})\nexport class SsvViewportMatcherVarDirective implements OnInit, OnDestroy {\n\n\tprivate _matchConditions: ViewportMatchConditions = {};\n\tprivate _context = new SsvViewportMatcherVarContext();\n\tprivate readonly _destroy$ = new Subject<void>();\n\tprivate readonly _update$ = new ReplaySubject<void>(1);\n\tprivate _viewRef!: EmbeddedViewRef<SsvViewportMatcherVarContext>;\n\n\t@Input(`${NAME_CAMEL}When`) set condition(value: string | string[] | ViewportSizeMatcherExpression) {\n\t\tif (isViewportSizeMatcherExpression(value)) {\n\t\t\tthis._matchConditions.expression = value;\n\t\t} else if (isViewportSizeMatcherTupleExpression(value)) {\n\t\t\tconst [op, size] = value;\n\t\t\tthis._matchConditions.expression = {\n\t\t\t\toperation: op,\n\t\t\t\tsize\n\t\t\t};\n\t\t} else {\n\t\t\tthis._matchConditions.sizeType = value;\n\t\t}\n\n\t\tthis._update$.next();\n\t}\n\n\tconstructor(\n\t\tprivate viewport: ViewportService,\n\t\tprivate viewContainer: ViewContainerRef,\n\t\tprivate templateRef: TemplateRef<SsvViewportMatcherVarContext>,\n\t) {\n\t}\n\n\tngOnInit(): void {\n\t\tthis.updateView();\n\t\tcombineLatest([this.viewport.sizeType$, this._update$]).pipe(\n\t\t\tmap(([sizeType]) => isViewportConditionMatch(sizeType, this._matchConditions, this.viewport.sizeTypeMap)),\n\t\t\ttap(x => this._context.$implicit = x),\n\t\t\ttap(() => this._viewRef.markForCheck()),\n\t\t\ttakeUntil(this._destroy$),\n\t\t).subscribe();\n\t}\n\n\tngOnDestroy(): void {\n\t\tthis._destroy$.next();\n\t\tthis._destroy$.complete();\n\t}\n\n\tprivate updateView(): void {\n\t\tthis.viewContainer.clear();\n\t\tthis._viewRef = this.viewContainer.createEmbeddedView(this.templateRef, this._context);\n\t}\n\n}\n","import {\n\tOnInit,\n\tOnDestroy,\n\tDirective,\n\tRenderer2,\n\tViewContainerRef,\n\tInput,\n\tEmbeddedViewRef,\n\tTemplateRef,\n\tChangeDetectorRef,\n} from \"@angular/core\";\nimport { Subscription, Subject } from \"rxjs\";\nimport { tap, filter, pairwise, startWith } from \"rxjs/operators\";\n\nimport { ViewportService } from \"./viewport.service\";\nimport {\n\tisViewportSizeMatcherExpression,\n\tisViewportSizeMatcherTupleExpression,\n\tisViewportConditionMatch\n} from \"./viewport.util\";\nimport { ViewportSizeTypeInfo, ViewportMatchConditions, ViewportSizeMatcherExpression } from \"./viewport.model\";\n\nexport class SsvViewportMatcherContext implements ViewportMatchConditions {\n\n\tsizeType: string | string[] | null = null;\n\tsizeTypeExclude: string | string[] | null = null;\n\texpression?: ViewportSizeMatcherExpression;\n\n}\n\n@Directive({\n\tselector: \"[ssvViewportMatcher]\",\n\texportAs: \"ssvViewportMatcher\",\n})\nexport class SsvViewportMatcherDirective implements OnInit, OnDestroy {\n\n\tsizeInfo: ViewportSizeTypeInfo | undefined;\n\n\tprivate _context: SsvViewportMatcherContext = new SsvViewportMatcherContext();\n\tprivate _thenTemplateRef: TemplateRef<SsvViewportMatcherContext> | null = null;\n\tprivate _elseTemplateRef: TemplateRef<SsvViewportMatcherContext> | null = null;\n\tprivate _thenViewRef: EmbeddedViewRef<SsvViewportMatcherContext> | null = null;\n\tprivate _elseViewRef: EmbeddedViewRef<SsvViewportMatcherContext> | null = null;\n\tprivate sizeType$$ = Subscription.EMPTY;\n\tprivate cssClass$$ = Subscription.EMPTY;\n\tprivate readonly _update$ = new Subject<SsvViewportMatcherContext>();\n\n\t@Input() set ssvViewportMatcher(value: string | string[] | ViewportSizeMatcherExpression) {\n\t\tif (isViewportSizeMatcherExpression(value)) {\n\t\t\tthis._context.expression = value;\n\t\t} else if (isViewportSizeMatcherTupleExpression(value)) {\n\t\t\tconst [op, size] = value;\n\t\t\tthis._context.expression = {\n\t\t\t\toperation: op,\n\t\t\t\tsize\n\t\t\t};\n\t\t} else {\n\t\t\tthis._context.sizeType = value;\n\t\t}\n\n\t\tif (this.sizeInfo) {\n\t\t\tthis._update$.next(this._context);\n\t\t}\n\t}\n\n\t@Input() set ssvViewportMatcherExclude(value: string | string[]) {\n\t\tthis._context.sizeTypeExclude = value;\n\n\t\tif (this.sizeInfo) {\n\t\t\tthis._update$.next(this._context);\n\t\t}\n\t}\n\n\t@Input() set ssvViewportMatcherElse(templateRef: TemplateRef<SsvViewportMatcherContext> | null) {\n\t\tthis._elseTemplateRef = templateRef;\n\t\tthis._elseViewRef = null; // clear previous view if any.\n\t\tif (this.sizeInfo) {\n\t\t\tthis._update$.next(this._context);\n\t\t}\n\t}\n\n\tconstructor(\n\t\tprivate viewport: ViewportService,\n\t\tprivate renderer: Renderer2,\n\t\tprivate viewContainer: ViewContainerRef,\n\t\tprivate cdr: ChangeDetectorRef,\n\t\ttemplateRef: TemplateRef<SsvViewportMatcherContext>,\n\t) {\n\t\tthis._thenTemplateRef = templateRef;\n\t}\n\n\tngOnInit(): void {\n\t\t// console.log(\"ssvViewportMatcher init\");\n\n\t\tthis._update$\n\t\t\t.pipe(\n\t\t\t\t// tap(x => console.log(\">>> ssvViewportMatcher - update triggered\", x)),\n\t\t\t\tfilter(() => !!this.sizeInfo),\n\t\t\t\t// tap(x => console.log(\">>> ssvViewportMatcher - updating...\", x)),\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\ttap(() => this._updateView(this.sizeInfo!)),\n\t\t\t\ttap(() => this.cdr.markForCheck())\n\t\t\t)\n\t\t\t.subscribe();\n\n\t\tthis.sizeType$$ = this.viewport.sizeType$\n\t\t\t.pipe(\n\t\t\t\t// tap(x => console.log(\"ssvViewportMatcher - sizeType changed\", x)),\n\t\t\t\ttap(x => this.sizeInfo = x),\n\t\t\t\ttap(() => this._update$.next(this._context)),\n\t\t\t)\n\t\t\t.subscribe();\n\n\t\tthis.cssClass$$ = this.viewport.sizeType$\n\t\t\t.pipe(\n\t\t\t\tstartWith<ViewportSizeTypeInfo | undefined>(undefined),\n\t\t\t\tfilter(() => !!(this._thenViewRef || this._elseViewRef)),\n\t\t\t\tpairwise(),\n\t\t\t\ttap(([prev, curr]) => {\n\t\t\t\t\tconst el: Element = this._thenViewRef\n\t\t\t\t\t\t? this._thenViewRef.rootNodes[0]\n\t\t\t\t\t\t: this._elseViewRef?.rootNodes[0];\n\n\t\t\t\t\tif (!el.classList) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tif (prev) {\n\t\t\t\t\t\tthis.renderer.removeClass(el, `ssv-vp-size--${prev.name}`);\n\t\t\t\t\t}\n\t\t\t\t\tthis.renderer.addClass(el, `ssv-vp-size--${curr?.name}`);\n\t\t\t\t}),\n\t\t\t)\n\t\t\t.subscribe();\n\t}\n\n\tngOnDestroy(): void {\n\t\tthis.cssClass$$.unsubscribe();\n\t\tthis.sizeType$$.unsubscribe();\n\t\tthis._update$.complete();\n\t}\n\n\tprivate _updateView(sizeInfo: ViewportSizeTypeInfo) {\n\t\tif (isViewportConditionMatch(sizeInfo, this._context, this.viewport.sizeTypeMap)) {\n\t\t\tif (!this._thenViewRef) {\n\t\t\t\tthis.viewContainer.clear();\n\t\t\t\tthis._elseViewRef = null;\n\n\t\t\t\tif (this._thenTemplateRef) {\n\t\t\t\t\tthis._thenViewRef = this.viewContainer.createEmbeddedView(\n\t\t\t\t\t\tthis._thenTemplateRef,\n\t\t\t\t\t\tthis._context,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tif (!this._elseViewRef) {\n\t\t\t\tthis.viewContainer.clear();\n\t\t\t\tthis._thenViewRef = null;\n\n\t\t\t\tif (this._elseTemplateRef) {\n\t\t\t\t\tthis._elseViewRef = this.viewContainer.createEmbeddedView(\n\t\t\t\t\t\tthis._elseTemplateRef,\n\t\t\t\t\t\tthis._context,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n}\n","import { NgModule, ModuleWithProviders, InjectionToken, Optional } from \"@angular/core\";\n\nimport { SsvViewportMatcherDirective, SsvViewportMatcherVarDirective } from \"./viewport/index\";\nimport { UxOptions, UX_DEFAULT_CONFIG, UX_CONFIG } from \"./config\";\nimport { WINDOW } from \"./platform/window\";\nimport { PartialDeep } from \"./internal/internal.model\";\nimport { ViewportDataPipe } from \"./viewport/viewport-data/viewport-data.pipe\";\n\n/** @internal */\nexport const MODULE_CONFIG_DATA = new InjectionToken<UxOptions>(\"@ssv/ngx.ux/configData\");\n\nconst components = [\n\tSsvViewportMatcherDirective,\n\tSsvViewportMatcherVarDirective,\n\tViewportDataPipe,\n];\n\n// todo: create module for Viewport\n@NgModule({\n\tdeclarations: [components],\n\tproviders: [\n\t\t{ provide: UX_CONFIG, useFactory: _moduleConfigFactory, deps: [[MODULE_CONFIG_DATA, new Optional()]] },\n\t\t{ provide: WINDOW, useFactory: _window },\n\t],\n\texports: [...components],\n})\nexport class SsvUxModule {\n\n\tstatic forRoot(config?: PartialDeep<UxOptions> | (() => PartialDeep<UxOptions>)): ModuleWithProviders<SsvUxModule> {\n\t\treturn {\n\t\t\tngModule: SsvUxModule,\n\t\t\tproviders: [\n\t\t\t\t{ provide: MODULE_CONFIG_DATA, useValue: config },\n\t\t\t],\n\t\t};\n\t}\n\n}\n\n/** @internal */\nexport function _moduleConfigFactory(config: UxOptions | (() => UxOptions)): UxOptions {\n\tif(!config) {\n\t\treturn UX_DEFAULT_CONFIG;\n\t}\n\tconst uxOptions = typeof config === \"function\" ? config() : config;\n\tconst viewport = {\n\t\t...UX_DEFAULT_CONFIG.viewport,\n\t\t...uxOptions.viewport\n\t}; // breakpoints shouldn't be merged\n\n\treturn { viewport };\n}\n\n/** @internal */\nexport function _window(): unknown {\n\tif (typeof window !== \"undefined\") {\n\t\treturn window;\n\t}\n\treturn {};\n}\n","export const VERSION = \"1.4.1\";\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n\nexport {WINDOW as ɵb,WindowRef as ɵc} from './platform/window';\nexport {UX_VIEWPORT_DEFAULT_CONFIG as ɵa} from './viewport/viewport.const';"],"names":["matchStrategyHandlerMap"],"mappings":";;;;;IAOY,yBAeX;AAfD,WAAY,yBAAyB;;IAEpC,2EAAK,CAAA;;IAGL,+EAAO,CAAA;;IAGP,6EAAM,CAAA;;IAGN,uGAAmB,CAAA;;IAGnB,qGAAkB,CAAA;CAClB,EAfW,yBAAyB,KAAzB,yBAAyB,QAepC;;;;;;;;;;;AAsBD,SAAgB,iBAAiB,CAChC,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,UAAU,EAAE,OAAO,EAAE;SACxC;QACD,OAAO,EAAE,CAAC,GAAG,UAAU,CAAC;KACxB,CAAC;GACW,WAAW,CAWvB;AAED;AACA,SAAgB,oBAAoB,CAAC,MAAqC;IACzE,IAAG,CAAC,MAAM,EAAE;QACX,OAAO,iBAAiB,CAAC;KACzB;IACD,MAAM,SAAS,GAAG,OAAO,MAAM,KAAK,UAAU,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC;IACnE,MAAM,QAAQ,mCACV,iBAAiB,CAAC,QAAQ,GAC1B,SAAS,CAAC,QAAQ,CACrB,CAAC;IAEF,OAAO,EAAE,QAAQ,EAAE,CAAC;CACpB;;AAGD,SAAgB,OAAO;IACtB,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QAClC,OAAO,MAAM,CAAC;KACd;IACD,OAAO,EAAE,CAAC;CACV;;MC3DY,OAAO,GAAG,OAAO;;ACA9B;;GAEG;;;;"}
|
package/fesm5/ssv-ngx.ux.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __values, __decorate, __param, __read, __spread, __assign } from 'tslib';
|
|
2
|
-
import { InjectionToken, Inject, ɵɵdefineInjectable, ɵɵinject, Injectable, Optional, ChangeDetectorRef, Pipe,
|
|
3
|
-
import { map,
|
|
4
|
-
import { fromEvent, of, Subscription, Subject } from 'rxjs';
|
|
2
|
+
import { InjectionToken, Inject, ɵɵdefineInjectable, ɵɵinject, Injectable, Optional, ChangeDetectorRef, Pipe, ViewContainerRef, TemplateRef, Input, Directive, Renderer2, NgModule } from '@angular/core';
|
|
3
|
+
import { map, share, auditTime, startWith, distinctUntilChanged, shareReplay, tap, takeUntil, filter, pairwise } from 'rxjs/operators';
|
|
4
|
+
import { fromEvent, of, Subscription, Subject, ReplaySubject, combineLatest } from 'rxjs';
|
|
5
5
|
|
|
6
6
|
var _a;
|
|
7
7
|
var ViewportDataMatchStrategy;
|
|
@@ -381,15 +381,20 @@ var ViewportService = /** @class */ (function () {
|
|
|
381
381
|
this._sizeTypes = generateViewportSizeTypeInfoList(config.viewport.breakpoints);
|
|
382
382
|
this._sizeTypeMap = generateViewportSizeTypeInfoRefs(this._sizeTypes);
|
|
383
383
|
if (windowRef.hasNative) {
|
|
384
|
-
this.
|
|
384
|
+
this.resizeSnap$ = fromEvent(window, "resize").pipe(map(function () { return _this.getViewportSize(); }), share());
|
|
385
|
+
this.resize$ = this.resizeSnap$.pipe(auditTime(config.viewport.resizePollingSpeed), share());
|
|
385
386
|
}
|
|
386
387
|
else {
|
|
387
|
-
this.resize$ = of(viewportServerSize.get());
|
|
388
|
+
this.resizeSnap$ = this.resize$ = of(viewportServerSize.get());
|
|
388
389
|
}
|
|
389
390
|
var size = this.getViewportSize();
|
|
390
391
|
this._sizeTypeSnapshot = getSizeTypeInfo(size.width, this.sizeTypes);
|
|
391
|
-
|
|
392
|
-
this.
|
|
392
|
+
var sizeFn = function (obs$) { return obs$.pipe(startWith(size), distinctUntilChanged(function (a, b) { return a.width === b.width && a.height === b.height; }), shareReplay(1)); };
|
|
393
|
+
this.sizeSnap$ = sizeFn(this.resizeSnap$);
|
|
394
|
+
this.size$ = sizeFn(this.resize$);
|
|
395
|
+
var sizeTypeFn = function (obs$) { return obs$.pipe(distinctUntilChanged(function (a, b) { return a.width === b.width; }), map(function (x) { return getSizeTypeInfo(x.width, _this.sizeTypes); }), distinctUntilChanged(), tap(function (x) { return _this._sizeTypeSnapshot = x; }), shareReplay(1)); };
|
|
396
|
+
this.sizeType$ = sizeTypeFn(this.size$);
|
|
397
|
+
this.sizeTypeSnap$ = sizeTypeFn(this.sizeSnap$);
|
|
393
398
|
}
|
|
394
399
|
Object.defineProperty(ViewportService.prototype, "sizeTypeSnapshot", {
|
|
395
400
|
/** Viewport size type snapshot of the last value. (Prefer use `sizeType$` observable when possible.) */
|
|
@@ -573,9 +578,10 @@ var ViewportDataService = /** @class */ (function () {
|
|
|
573
578
|
return matchViewportData(dataConfig, sizeType, strategy, this.viewport.sizeTypes, this.viewport.sizeTypeMap);
|
|
574
579
|
};
|
|
575
580
|
/** Get data for match as observable. */
|
|
576
|
-
ViewportDataService.prototype.get$ = function (dataConfig, strategy) {
|
|
581
|
+
ViewportDataService.prototype.get$ = function (dataConfig, strategy, throttle) {
|
|
577
582
|
var _this = this;
|
|
578
|
-
|
|
583
|
+
if (throttle === void 0) { throttle = true; }
|
|
584
|
+
return (throttle ? this.viewport.sizeType$ : this.viewport.sizeTypeSnap$).pipe(map(function (sizeType) { return _this.get(dataConfig, strategy, sizeType); }), distinctUntilChanged());
|
|
579
585
|
};
|
|
580
586
|
/** Generate rules based on strategies for data. */
|
|
581
587
|
ViewportDataService.prototype.generateRules = function (dataConfig, strategy) {
|
|
@@ -636,6 +642,76 @@ var ViewportDataPipe = /** @class */ (function () {
|
|
|
636
642
|
return ViewportDataPipe;
|
|
637
643
|
}());
|
|
638
644
|
|
|
645
|
+
var NAME_CAMEL = "ssvViewportMatcherVar";
|
|
646
|
+
var SsvViewportMatcherVarContext = /** @class */ (function () {
|
|
647
|
+
function SsvViewportMatcherVarContext($implicit) {
|
|
648
|
+
if ($implicit === void 0) { $implicit = false; }
|
|
649
|
+
this.$implicit = $implicit;
|
|
650
|
+
}
|
|
651
|
+
return SsvViewportMatcherVarContext;
|
|
652
|
+
}());
|
|
653
|
+
var SsvViewportMatcherVarDirective = /** @class */ (function () {
|
|
654
|
+
function SsvViewportMatcherVarDirective(viewport, viewContainer, templateRef) {
|
|
655
|
+
this.viewport = viewport;
|
|
656
|
+
this.viewContainer = viewContainer;
|
|
657
|
+
this.templateRef = templateRef;
|
|
658
|
+
this._matchConditions = {};
|
|
659
|
+
this._context = new SsvViewportMatcherVarContext();
|
|
660
|
+
this._destroy$ = new Subject();
|
|
661
|
+
this._update$ = new ReplaySubject(1);
|
|
662
|
+
}
|
|
663
|
+
Object.defineProperty(SsvViewportMatcherVarDirective.prototype, "condition", {
|
|
664
|
+
set: function (value) {
|
|
665
|
+
if (isViewportSizeMatcherExpression(value)) {
|
|
666
|
+
this._matchConditions.expression = value;
|
|
667
|
+
}
|
|
668
|
+
else if (isViewportSizeMatcherTupleExpression(value)) {
|
|
669
|
+
var _a = __read(value, 2), op = _a[0], size = _a[1];
|
|
670
|
+
this._matchConditions.expression = {
|
|
671
|
+
operation: op,
|
|
672
|
+
size: size
|
|
673
|
+
};
|
|
674
|
+
}
|
|
675
|
+
else {
|
|
676
|
+
this._matchConditions.sizeType = value;
|
|
677
|
+
}
|
|
678
|
+
this._update$.next();
|
|
679
|
+
},
|
|
680
|
+
enumerable: true,
|
|
681
|
+
configurable: true
|
|
682
|
+
});
|
|
683
|
+
SsvViewportMatcherVarDirective.prototype.ngOnInit = function () {
|
|
684
|
+
var _this = this;
|
|
685
|
+
this.updateView();
|
|
686
|
+
combineLatest([this.viewport.sizeType$, this._update$]).pipe(map(function (_a) {
|
|
687
|
+
var _b = __read(_a, 1), sizeType = _b[0];
|
|
688
|
+
return isViewportConditionMatch(sizeType, _this._matchConditions, _this.viewport.sizeTypeMap);
|
|
689
|
+
}), tap(function (x) { return _this._context.$implicit = x; }), tap(function () { return _this._viewRef.markForCheck(); }), takeUntil(this._destroy$)).subscribe();
|
|
690
|
+
};
|
|
691
|
+
SsvViewportMatcherVarDirective.prototype.ngOnDestroy = function () {
|
|
692
|
+
this._destroy$.next();
|
|
693
|
+
this._destroy$.complete();
|
|
694
|
+
};
|
|
695
|
+
SsvViewportMatcherVarDirective.prototype.updateView = function () {
|
|
696
|
+
this.viewContainer.clear();
|
|
697
|
+
this._viewRef = this.viewContainer.createEmbeddedView(this.templateRef, this._context);
|
|
698
|
+
};
|
|
699
|
+
SsvViewportMatcherVarDirective.ctorParameters = function () { return [
|
|
700
|
+
{ type: ViewportService },
|
|
701
|
+
{ type: ViewContainerRef },
|
|
702
|
+
{ type: TemplateRef }
|
|
703
|
+
]; };
|
|
704
|
+
__decorate([
|
|
705
|
+
Input(NAME_CAMEL + "When")
|
|
706
|
+
], SsvViewportMatcherVarDirective.prototype, "condition", null);
|
|
707
|
+
SsvViewportMatcherVarDirective = __decorate([
|
|
708
|
+
Directive({
|
|
709
|
+
selector: "[" + NAME_CAMEL + "]",
|
|
710
|
+
})
|
|
711
|
+
], SsvViewportMatcherVarDirective);
|
|
712
|
+
return SsvViewportMatcherVarDirective;
|
|
713
|
+
}());
|
|
714
|
+
|
|
639
715
|
var SsvViewportMatcherContext = /** @class */ (function () {
|
|
640
716
|
function SsvViewportMatcherContext() {
|
|
641
717
|
this.sizeType = null;
|
|
@@ -644,10 +720,10 @@ var SsvViewportMatcherContext = /** @class */ (function () {
|
|
|
644
720
|
return SsvViewportMatcherContext;
|
|
645
721
|
}());
|
|
646
722
|
var SsvViewportMatcherDirective = /** @class */ (function () {
|
|
647
|
-
function SsvViewportMatcherDirective(viewport, renderer,
|
|
723
|
+
function SsvViewportMatcherDirective(viewport, renderer, viewContainer, cdr, templateRef) {
|
|
648
724
|
this.viewport = viewport;
|
|
649
725
|
this.renderer = renderer;
|
|
650
|
-
this.
|
|
726
|
+
this.viewContainer = viewContainer;
|
|
651
727
|
this.cdr = cdr;
|
|
652
728
|
this._context = new SsvViewportMatcherContext();
|
|
653
729
|
this._thenTemplateRef = null;
|
|
@@ -659,44 +735,6 @@ var SsvViewportMatcherDirective = /** @class */ (function () {
|
|
|
659
735
|
this._update$ = new Subject();
|
|
660
736
|
this._thenTemplateRef = templateRef;
|
|
661
737
|
}
|
|
662
|
-
SsvViewportMatcherDirective.prototype.ngOnInit = function () {
|
|
663
|
-
// console.log("ssvViewportMatcher init");
|
|
664
|
-
var _this = this;
|
|
665
|
-
this._update$
|
|
666
|
-
.pipe(
|
|
667
|
-
// tap(x => console.log(">>> ssvViewportMatcher - update triggered", x)),
|
|
668
|
-
filter(function () { return !!_this.sizeInfo; }),
|
|
669
|
-
// tap(x => console.log(">>> ssvViewportMatcher - updating...", x)),
|
|
670
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
671
|
-
tap(function () { return _this._updateView(_this.sizeInfo); }), tap(function () { return _this.cdr.markForCheck(); }))
|
|
672
|
-
.subscribe();
|
|
673
|
-
this.sizeType$$ = this.viewport.sizeType$
|
|
674
|
-
.pipe(
|
|
675
|
-
// tap(x => console.log("ssvViewportMatcher - sizeType changed", x)),
|
|
676
|
-
tap(function (x) { return _this.sizeInfo = x; }), tap(function () { return _this._update$.next(_this._context); }))
|
|
677
|
-
.subscribe();
|
|
678
|
-
this.cssClass$$ = this.viewport.sizeType$
|
|
679
|
-
.pipe(startWith(undefined), filter(function () { return !!(_this._thenViewRef || _this._elseViewRef); }), pairwise(), tap(function (_a) {
|
|
680
|
-
var _b = __read(_a, 2), prev = _b[0], curr = _b[1];
|
|
681
|
-
var _c;
|
|
682
|
-
var el = _this._thenViewRef
|
|
683
|
-
? _this._thenViewRef.rootNodes[0]
|
|
684
|
-
: (_c = _this._elseViewRef) === null || _c === void 0 ? void 0 : _c.rootNodes[0];
|
|
685
|
-
if (!el.classList) {
|
|
686
|
-
return;
|
|
687
|
-
}
|
|
688
|
-
if (prev) {
|
|
689
|
-
_this.renderer.removeClass(el, "ssv-vp-size--" + prev.name);
|
|
690
|
-
}
|
|
691
|
-
_this.renderer.addClass(el, "ssv-vp-size--" + (curr === null || curr === void 0 ? void 0 : curr.name));
|
|
692
|
-
}))
|
|
693
|
-
.subscribe();
|
|
694
|
-
};
|
|
695
|
-
SsvViewportMatcherDirective.prototype.ngOnDestroy = function () {
|
|
696
|
-
this.cssClass$$.unsubscribe();
|
|
697
|
-
this.sizeType$$.unsubscribe();
|
|
698
|
-
this._update$.complete();
|
|
699
|
-
};
|
|
700
738
|
Object.defineProperty(SsvViewportMatcherDirective.prototype, "ssvViewportMatcher", {
|
|
701
739
|
set: function (value) {
|
|
702
740
|
if (isViewportSizeMatcherExpression(value)) {
|
|
@@ -740,22 +778,60 @@ var SsvViewportMatcherDirective = /** @class */ (function () {
|
|
|
740
778
|
enumerable: true,
|
|
741
779
|
configurable: true
|
|
742
780
|
});
|
|
781
|
+
SsvViewportMatcherDirective.prototype.ngOnInit = function () {
|
|
782
|
+
// console.log("ssvViewportMatcher init");
|
|
783
|
+
var _this = this;
|
|
784
|
+
this._update$
|
|
785
|
+
.pipe(
|
|
786
|
+
// tap(x => console.log(">>> ssvViewportMatcher - update triggered", x)),
|
|
787
|
+
filter(function () { return !!_this.sizeInfo; }),
|
|
788
|
+
// tap(x => console.log(">>> ssvViewportMatcher - updating...", x)),
|
|
789
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
790
|
+
tap(function () { return _this._updateView(_this.sizeInfo); }), tap(function () { return _this.cdr.markForCheck(); }))
|
|
791
|
+
.subscribe();
|
|
792
|
+
this.sizeType$$ = this.viewport.sizeType$
|
|
793
|
+
.pipe(
|
|
794
|
+
// tap(x => console.log("ssvViewportMatcher - sizeType changed", x)),
|
|
795
|
+
tap(function (x) { return _this.sizeInfo = x; }), tap(function () { return _this._update$.next(_this._context); }))
|
|
796
|
+
.subscribe();
|
|
797
|
+
this.cssClass$$ = this.viewport.sizeType$
|
|
798
|
+
.pipe(startWith(undefined), filter(function () { return !!(_this._thenViewRef || _this._elseViewRef); }), pairwise(), tap(function (_a) {
|
|
799
|
+
var _b = __read(_a, 2), prev = _b[0], curr = _b[1];
|
|
800
|
+
var _c;
|
|
801
|
+
var el = _this._thenViewRef
|
|
802
|
+
? _this._thenViewRef.rootNodes[0]
|
|
803
|
+
: (_c = _this._elseViewRef) === null || _c === void 0 ? void 0 : _c.rootNodes[0];
|
|
804
|
+
if (!el.classList) {
|
|
805
|
+
return;
|
|
806
|
+
}
|
|
807
|
+
if (prev) {
|
|
808
|
+
_this.renderer.removeClass(el, "ssv-vp-size--" + prev.name);
|
|
809
|
+
}
|
|
810
|
+
_this.renderer.addClass(el, "ssv-vp-size--" + (curr === null || curr === void 0 ? void 0 : curr.name));
|
|
811
|
+
}))
|
|
812
|
+
.subscribe();
|
|
813
|
+
};
|
|
814
|
+
SsvViewportMatcherDirective.prototype.ngOnDestroy = function () {
|
|
815
|
+
this.cssClass$$.unsubscribe();
|
|
816
|
+
this.sizeType$$.unsubscribe();
|
|
817
|
+
this._update$.complete();
|
|
818
|
+
};
|
|
743
819
|
SsvViewportMatcherDirective.prototype._updateView = function (sizeInfo) {
|
|
744
820
|
if (isViewportConditionMatch(sizeInfo, this._context, this.viewport.sizeTypeMap)) {
|
|
745
821
|
if (!this._thenViewRef) {
|
|
746
|
-
this.
|
|
822
|
+
this.viewContainer.clear();
|
|
747
823
|
this._elseViewRef = null;
|
|
748
824
|
if (this._thenTemplateRef) {
|
|
749
|
-
this._thenViewRef = this.
|
|
825
|
+
this._thenViewRef = this.viewContainer.createEmbeddedView(this._thenTemplateRef, this._context);
|
|
750
826
|
}
|
|
751
827
|
}
|
|
752
828
|
}
|
|
753
829
|
else {
|
|
754
830
|
if (!this._elseViewRef) {
|
|
755
|
-
this.
|
|
831
|
+
this.viewContainer.clear();
|
|
756
832
|
this._thenViewRef = null;
|
|
757
833
|
if (this._elseTemplateRef) {
|
|
758
|
-
this._elseViewRef = this.
|
|
834
|
+
this._elseViewRef = this.viewContainer.createEmbeddedView(this._elseTemplateRef, this._context);
|
|
759
835
|
}
|
|
760
836
|
}
|
|
761
837
|
}
|
|
@@ -789,6 +865,7 @@ var SsvViewportMatcherDirective = /** @class */ (function () {
|
|
|
789
865
|
var MODULE_CONFIG_DATA = new InjectionToken("@ssv/ngx.ux/configData");
|
|
790
866
|
var components = [
|
|
791
867
|
SsvViewportMatcherDirective,
|
|
868
|
+
SsvViewportMatcherVarDirective,
|
|
792
869
|
ViewportDataPipe,
|
|
793
870
|
];
|
|
794
871
|
// todo: create module for Viewport
|
|
@@ -834,11 +911,11 @@ function _window() {
|
|
|
834
911
|
return {};
|
|
835
912
|
}
|
|
836
913
|
|
|
837
|
-
var VERSION = "1.
|
|
914
|
+
var VERSION = "1.4.1";
|
|
838
915
|
|
|
839
916
|
/**
|
|
840
917
|
* Generated bundle index. Do not edit.
|
|
841
918
|
*/
|
|
842
919
|
|
|
843
|
-
export { COMPARISON_OPERATION_FUNC_MAPPING, ComparisonOperation, DeviceType, MODULE_CONFIG_DATA, SsvUxModule, SsvViewportMatcherContext, SsvViewportMatcherDirective, UX_CONFIG, UX_DEFAULT_CONFIG, UX_VIEWPORT_DEFAULT_BREAKPOINTS, UX_VIEWPORT_SSR_DEVICE, VERSION, ViewportDataMatchStrategy, ViewportDataPipe, ViewportDataService, ViewportServerSizeService, ViewportService, ViewportSizeType, _moduleConfigFactory, _window, generateViewportSizeType, isViewportSizeMatcherExpression, isViewportSizeMatcherTupleExpression, UX_VIEWPORT_DEFAULT_CONFIG as ɵa, WINDOW as ɵb, WindowRef as ɵc };
|
|
920
|
+
export { COMPARISON_OPERATION_FUNC_MAPPING, ComparisonOperation, DeviceType, MODULE_CONFIG_DATA, SsvUxModule, SsvViewportMatcherContext, SsvViewportMatcherDirective, SsvViewportMatcherVarContext, SsvViewportMatcherVarDirective, UX_CONFIG, UX_DEFAULT_CONFIG, UX_VIEWPORT_DEFAULT_BREAKPOINTS, UX_VIEWPORT_SSR_DEVICE, VERSION, ViewportDataMatchStrategy, ViewportDataPipe, ViewportDataService, ViewportServerSizeService, ViewportService, ViewportSizeType, _moduleConfigFactory, _window, generateViewportSizeType, isViewportSizeMatcherExpression, isViewportSizeMatcherTupleExpression, UX_VIEWPORT_DEFAULT_CONFIG as ɵa, WINDOW as ɵb, WindowRef as ɵc };
|
|
844
921
|
//# sourceMappingURL=ssv-ngx.ux.js.map
|