@taiga-ui/cdk 3.25.0 → 3.26.0
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/bundles/taiga-ui-cdk-constants.umd.js +1 -1
- package/bundles/taiga-ui-cdk-constants.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-services.umd.js +28 -28
- package/bundles/taiga-ui-cdk-services.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-tokens.umd.js +5 -0
- package/bundles/taiga-ui-cdk-tokens.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-utils-miscellaneous.umd.js +12 -0
- package/bundles/taiga-ui-cdk-utils-miscellaneous.umd.js.map +1 -1
- package/constants/version.d.ts +1 -1
- package/constants/version.js +1 -1
- package/esm2015/constants/version.js +2 -2
- package/esm2015/interfaces/month-like.js +1 -1
- package/esm2015/services/static-request.service.js +27 -28
- package/esm2015/tokens/index.js +2 -1
- package/esm2015/tokens/is-stackblitz.js +6 -0
- package/esm2015/utils/miscellaneous/index.js +2 -1
- package/esm2015/utils/miscellaneous/is-valid-url.js +11 -0
- package/fesm2015/taiga-ui-cdk-constants.js +1 -1
- package/fesm2015/taiga-ui-cdk-constants.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-services.js +24 -27
- package/fesm2015/taiga-ui-cdk-services.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-tokens.js +5 -1
- package/fesm2015/taiga-ui-cdk-tokens.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-utils-miscellaneous.js +12 -1
- package/fesm2015/taiga-ui-cdk-utils-miscellaneous.js.map +1 -1
- package/interfaces/month-like.d.ts +1 -1
- package/package.json +4 -3
- package/schematics/constants/file-globs.js +1 -0
- package/schematics/ng-add/constants/modules.d.ts +5 -1
- package/schematics/ng-add/constants/modules.js +9 -11
- package/schematics/ng-add/schema.json +4 -0
- package/schematics/ng-add/steps/add-taiga-modules.js +85 -15
- package/schematics/ng-add/steps/wrap-with-tui-root.js +21 -8
- package/schematics/ng-update/steps/replace-const.d.ts +1 -1
- package/schematics/ng-update/steps/replace-const.js +2 -2
- package/schematics/ng-update/v3/constants/{consts.d.ts → constants.d.ts} +1 -1
- package/schematics/ng-update/v3/constants/{consts.js → constants.js} +2 -2
- package/schematics/ng-update/v3/constants/enums.js +4 -0
- package/schematics/ng-update/v3/index.js +2 -2
- package/schematics/ng-update/v3/steps/migrate-polymorpheus.d.ts +1 -1
- package/schematics/ng-update/v3/steps/migrate-textfield-controller.d.ts +1 -1
- package/schematics/ng-update/v3/steps/miscellaneous.js +4 -0
- package/schematics/utils/add-import-to-component.d.ts +4 -0
- package/schematics/utils/add-import-to-component.js +12 -0
- package/schematics/utils/get-component-from-identifier.d.ts +2 -0
- package/schematics/utils/get-component-from-identifier.js +16 -0
- package/schematics/utils/get-named-import-references.d.ts +1 -1
- package/schematics/utils/get-named-import-references.js +2 -2
- package/schematics/utils/get-standalone-bootstrap-function.d.ts +2 -0
- package/schematics/utils/get-standalone-bootstrap-function.js +13 -0
- package/schematics/utils/push-to-array-property.d.ts +5 -0
- package/schematics/utils/push-to-array-property.js +26 -0
- package/schematics/utils/templates/get-component-templates.d.ts +1 -1
- package/schematics/utils/templates/ng-component-input-manipulations.d.ts +1 -1
- package/schematics/utils/templates/template-resource.d.ts +1 -1
- package/services/static-request.service.d.ts +3 -0
- package/tokens/index.d.ts +1 -0
- package/tokens/is-stackblitz.d.ts +2 -0
- package/utils/miscellaneous/index.d.ts +1 -0
- package/utils/miscellaneous/is-valid-url.d.ts +1 -0
- /package/schematics/ng-update/interfaces/{template-resourse.d.ts → template-resource.d.ts} +0 -0
- /package/schematics/ng-update/interfaces/{template-resourse.js → template-resource.js} +0 -0
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"taiga-ui-cdk-tokens.js","sources":["../../../projects/cdk/tokens/removed-element.ts","../../../projects/cdk/tokens/active-element.ts","../../../projects/cdk/tokens/alerts.ts","../../../projects/cdk/tokens/default-renderer.ts","../../../projects/cdk/tokens/dialogs.ts","../../../projects/cdk/tokens/ensure-base-href.ts","../../../projects/cdk/tokens/focusable-item-accessor.ts","../../../projects/cdk/tokens/is-ios.ts","../../../projects/cdk/tokens/is-mobile.ts","../../../projects/cdk/tokens/is-android.ts","../../../projects/cdk/tokens/is-apple.ts","../../../projects/cdk/tokens/is-chromium.ts","../../../projects/cdk/tokens/is-cypress.ts","../../../projects/cdk/tokens/is-firefox.ts","../../../projects/cdk/tokens/is-webkit.ts","../../../projects/cdk/tokens/range.ts","../../../projects/cdk/tokens/swipe-options.ts","../../../projects/cdk/tokens/take-only-trusted-events.ts","../../../projects/cdk/tokens/touch-supported.ts","../../../projects/cdk/tokens/window-height.ts","../../../projects/cdk/tokens/zoom-options.ts","../../../projects/cdk/tokens/taiga-ui-cdk-tokens.ts"],"sourcesContent":["import {ɵAnimationEngine as AnimationEngine} from '@angular/animations/browser';\nimport {inject, InjectFlags, InjectionToken} from '@angular/core';\nimport {BehaviorSubject, Observable, timer} from 'rxjs';\nimport {map, share, startWith, switchMap} from 'rxjs/operators';\n\n/**\n * Element currently being removed by AnimationEngine\n */\nexport const TUI_REMOVED_ELEMENT = new InjectionToken<Observable<Element | null>>(\n `[TUI_REMOVED_ELEMENT]`,\n {\n factory: () => {\n const stub = {onRemovalComplete: () => {}};\n const element$ = new BehaviorSubject<Element | null>(null);\n const engine = inject(AnimationEngine, InjectFlags.Optional) || stub;\n const {onRemovalComplete = stub.onRemovalComplete} = engine;\n\n engine.onRemovalComplete = (element, context) => {\n element$.next(element);\n onRemovalComplete(element, context);\n };\n\n return element$.pipe(\n switchMap(element =>\n timer(0).pipe(\n map(() => null),\n startWith(element),\n ),\n ),\n share(),\n );\n },\n },\n);\n","import {DOCUMENT} from '@angular/common';\nimport {inject, InjectionToken} from '@angular/core';\nimport {WINDOW} from '@ng-web-apis/common';\nimport {tuiTypedFromEvent} from '@taiga-ui/cdk/observables';\nimport {tuiGetActualTarget, tuiGetDocumentOrShadowRoot} from '@taiga-ui/cdk/utils';\nimport {merge, Observable, of, timer} from 'rxjs';\nimport {\n distinctUntilChanged,\n filter,\n map,\n repeatWhen,\n share,\n startWith,\n switchMap,\n take,\n takeUntil,\n withLatestFrom,\n} from 'rxjs/operators';\n\nimport {TUI_REMOVED_ELEMENT} from './removed-element';\n\n/**\n * Active element on the document for ActiveZone\n */\nexport const TUI_ACTIVE_ELEMENT = new InjectionToken<Observable<EventTarget | null>>(\n `[TUI_ACTIVE_ELEMENT]`,\n {\n factory: () => {\n const removedElement$ = inject(TUI_REMOVED_ELEMENT);\n const win = inject(WINDOW);\n const doc = inject(DOCUMENT);\n const focusout$ = tuiTypedFromEvent(win, `focusout`);\n const focusin$ = tuiTypedFromEvent(win, `focusin`);\n const blur$ = tuiTypedFromEvent(win, `blur`);\n const mousedown$ = tuiTypedFromEvent(win, `mousedown`);\n const mouseup$ = tuiTypedFromEvent(win, `mouseup`);\n\n return merge(\n focusout$.pipe(\n // eslint-disable-next-line rxjs/no-unsafe-takeuntil\n takeUntil(mousedown$),\n /**\n * TODO: replace to\n * repeat({delay: () => mouseup$})\n * in RxJS 7\n */\n // eslint-disable-next-line rxjs/no-ignored-notifier\n repeatWhen(() => mouseup$),\n withLatestFrom(removedElement$),\n filter(([event, removedElement]) =>\n isValidFocusout(tuiGetActualTarget(event), removedElement),\n ),\n map(([{relatedTarget}]) => relatedTarget),\n ),\n blur$.pipe(\n map(() => doc.activeElement),\n filter(element => !!element?.matches(`iframe`)),\n ),\n focusin$.pipe(\n switchMap(event => {\n const target = tuiGetActualTarget(event);\n const root = tuiGetDocumentOrShadowRoot(target) as Document;\n\n return root === doc\n ? of(target)\n : shadowRootActiveElement(root).pipe(startWith(target));\n }),\n ),\n mousedown$.pipe(\n switchMap(event => {\n const actualTargetInCurrentTime = tuiGetActualTarget(event);\n\n return !doc.activeElement || doc.activeElement === doc.body\n ? of(actualTargetInCurrentTime)\n : focusout$.pipe(\n take(1),\n map(\n /**\n * Do not use `map(() => tuiGetActualTarget(event))`\n * because we have different result in runtime\n */\n () => actualTargetInCurrentTime,\n ),\n takeUntil(timer(0)),\n );\n }),\n ),\n ).pipe(distinctUntilChanged(), share());\n },\n },\n);\n\n// Checks if focusout event should be considered leaving active zone\nfunction isValidFocusout(target: any, removedElement: Element | null = null): boolean {\n return (\n // Not due to switching tabs/going to DevTools\n tuiGetDocumentOrShadowRoot(target).activeElement !== target &&\n // Not due to button/input becoming disabled\n !target.disabled &&\n // Not due to element being removed from DOM\n !removedElement?.contains(target)\n );\n}\n\nfunction shadowRootActiveElement(root: Document): Observable<EventTarget | null> {\n return merge(\n tuiTypedFromEvent(root, `focusin`).pipe(map(({target}) => target)),\n tuiTypedFromEvent(root, `focusout`).pipe(\n filter(\n ({target, relatedTarget}) => !!relatedTarget && isValidFocusout(target),\n ),\n map(({relatedTarget}) => relatedTarget),\n ),\n );\n}\n","import {InjectionToken, Provider, Type} from '@angular/core';\nimport {TuiAriaDialogContext} from '@taiga-ui/cdk/interfaces';\nimport {Observable} from 'rxjs';\n\n/**\n * A stream of alerts\n */\nexport const TUI_ALERTS = new InjectionToken<\n ReadonlyArray<Observable<readonly TuiAriaDialogContext[]>>\n>(`[TUI_ALERTS]`, {\n factory: () => [],\n});\n\nexport function tuiAsAlerts(\n useExisting: Type<Observable<readonly TuiAriaDialogContext[]>>,\n): Provider {\n return {\n provide: TUI_ALERTS,\n multi: true,\n useExisting,\n };\n}\n","import {inject, InjectionToken, Renderer2, RendererFactory2} from '@angular/core';\n\n/**\n * A Renderer2 for global services\n * https://github.com/angular/angular/issues/17824#issuecomment-353239017\n * @deprecated unnecessary\n * TODO: remove in 4.0\n */\nexport const TUI_DEFAULT_RENDERER = new InjectionToken<Renderer2>(\n `[TUI_DEFAULT_RENDERER]`,\n {\n // @ts-ignore\n factory: () => inject(RendererFactory2).createRenderer(null, null),\n },\n);\n","import {InjectionToken, Provider, Type} from '@angular/core';\nimport {TuiAriaDialogContext} from '@taiga-ui/cdk/interfaces';\nimport {Observable} from 'rxjs';\n\n/**\n * A stream of dialogs\n */\nexport const TUI_DIALOGS = new InjectionToken<\n ReadonlyArray<Observable<readonly TuiAriaDialogContext[]>>\n>(`[TUI_DIALOGS]`, {\n factory: () => [],\n});\n\nexport function tuiAsDialog(\n useExisting: Type<Observable<readonly TuiAriaDialogContext[]>>,\n): Provider {\n return {\n provide: TUI_DIALOGS,\n multi: true,\n useExisting,\n };\n}\n","import {DOCUMENT} from '@angular/common';\nimport {inject, InjectionToken} from '@angular/core';\n\nexport const TUI_ENSURE_BASE_HREF: InjectionToken<string> = new InjectionToken<string>(\n `[TUI_ENSURE_BASE_HREF]`,\n {\n factory: () => {\n const link = inject(DOCUMENT).createElement(`a`);\n\n link.href = ``;\n\n return link.pathname;\n },\n },\n);\n","import {InjectionToken, Provider, Type} from '@angular/core';\nimport {TuiFocusableElementAccessor} from '@taiga-ui/cdk/interfaces';\n\n/**\n * A component that can be focused\n */\nexport const TUI_FOCUSABLE_ITEM_ACCESSOR =\n new InjectionToken<TuiFocusableElementAccessor>(`[TUI_FOCUSABLE_ITEM_ACCESSOR]`);\n\nexport function tuiAsFocusableItemAccessor(\n useExisting: Type<TuiFocusableElementAccessor>,\n): Provider {\n return {\n provide: TUI_FOCUSABLE_ITEM_ACCESSOR,\n useExisting,\n };\n}\n","import {inject, InjectionToken} from '@angular/core';\nimport {NAVIGATOR} from '@ng-web-apis/common';\nimport {tuiIsIos} from '@taiga-ui/cdk/utils';\n\n/**\n * iOS browser detection\n */\nexport const TUI_IS_IOS = new InjectionToken<boolean>(`[TUI_IS_IOS]`, {\n factory: () => tuiIsIos(inject(NAVIGATOR)),\n});\n","import {inject, InjectionToken} from '@angular/core';\nimport {USER_AGENT} from '@ng-web-apis/common';\n\n// https://stackoverflow.com/a/11381730/2706426 http://detectmobilebrowsers.com/\nconst firstRegex =\n /(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows ce|xda|xiino/;\nconst secondRegex =\n /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/;\n\n/**\n * Mobile browser detection\n */\nexport const TUI_IS_MOBILE = new InjectionToken<boolean>(`[TUI_IS_MOBILE]`, {\n factory: () =>\n firstRegex.test(inject(USER_AGENT).toLowerCase()) ||\n secondRegex.test(inject(USER_AGENT).slice(0, 4).toLowerCase()),\n});\n","import {inject, InjectionToken} from '@angular/core';\n\nimport {TUI_IS_IOS} from './is-ios';\nimport {TUI_IS_MOBILE} from './is-mobile';\n\n/**\n * Mobile browser that is not iOS (technically includes Windows Phone, Blackberry etc.)\n */\nexport const TUI_IS_ANDROID = new InjectionToken<boolean>(`[TUI_IS_ANDROID]`, {\n factory: () => inject(TUI_IS_MOBILE) && !inject(TUI_IS_IOS),\n});\n","import {inject, InjectionToken} from '@angular/core';\nimport {NAVIGATOR} from '@ng-web-apis/common';\nimport {tuiIsApple} from '@taiga-ui/cdk/utils';\n\n/**\n * Apple(safari/webkit) detection\n */\nexport const TUI_IS_APPLE = new InjectionToken<boolean>(`[TUI_IS_APPLE]`, {\n factory: () => tuiIsApple(inject(NAVIGATOR)),\n});\n","import {inject, InjectionToken} from '@angular/core';\nimport {WINDOW} from '@ng-web-apis/common';\n\n/**\n * Chromium browser engine detection\n */\nexport const TUI_IS_CHROMIUM = new InjectionToken<boolean>(`[TUI_IS_CHROMIUM]`, {\n factory: () => !!(inject(WINDOW) as Window & {chrome: unknown}).chrome,\n});\n","import {inject, InjectionToken} from '@angular/core';\nimport {WINDOW} from '@ng-web-apis/common';\n\ninterface WindowWithCypress extends Window {\n Cypress?: unknown;\n}\n\n/**\n * Detect if app is running under Cypress\n * {@link https://docs.cypress.io/faq/questions/using-cypress-faq#Is-there-any-way-to-detect-if-my-app-is-running-under-Cypress Cypress docs}\n */\nexport const TUI_IS_CYPRESS = new InjectionToken<boolean>(`[TUI_IS_CYPRESS]`, {\n factory: () => !!inject<WindowWithCypress>(WINDOW).Cypress,\n});\n","import {inject, InjectionToken} from '@angular/core';\nimport {WINDOW} from '@ng-web-apis/common';\n\n/**\n * Firefox browser engine detection\n */\nexport const TUI_IS_FIREFOX = new InjectionToken<boolean>(`[TUI_IS_FIREFOX]`, {\n factory: () =>\n typeof (inject(WINDOW) as Window & {mozCancelFullScreen: unknown})\n ?.mozCancelFullScreen !== `undefined`,\n});\n","import {inject, InjectionToken} from '@angular/core';\nimport {WINDOW} from '@ng-web-apis/common';\n\n/**\n * Webkit browser engine detection\n */\nexport const TUI_IS_WEBKIT = new InjectionToken<boolean>(`[TUI_IS_WEBKIT]`, {\n factory: () =>\n !!(inject(WINDOW) as unknown as {webkitConvertPointFromNodeToPage?: unknown})\n ?.webkitConvertPointFromNodeToPage,\n});\n","import {isPlatformBrowser} from '@angular/common';\nimport {inject, InjectionToken, PLATFORM_ID} from '@angular/core';\n\n/**\n * SSR safe default empty Range\n */\nexport const TUI_RANGE = new InjectionToken<Range>(`[TUI_RANGE]`, {\n factory: () =>\n isPlatformBrowser(inject(PLATFORM_ID)) ? new Range() : ({} as unknown as Range),\n});\n","import {InjectionToken} from '@angular/core';\nimport {TuiSwipeOptions} from '@taiga-ui/cdk/interfaces';\n\n/**\n * Swipe options\n */\nexport const TUI_SWIPE_OPTIONS = new InjectionToken<TuiSwipeOptions>(\n `[TUI_SWIPE_OPTIONS]`,\n {\n factory: () => ({timeout: 500, threshold: 30}),\n },\n);\n","import {InjectionToken} from '@angular/core';\nimport {ALWAYS_TRUE_HANDLER} from '@taiga-ui/cdk/constants';\n\n/**\n * @description:\n * The isTrusted read-only property of the Event interface is a boolean value that is true\n * when the event was generated by a user action, and false when the event was created or\n * modified by a script or dispatched via EventTarget.dispatchEvent().\n */\nexport const TUI_TAKE_ONLY_TRUSTED_EVENTS: InjectionToken<boolean> =\n new InjectionToken<boolean>(`[TUI_TAKE_ONLY_TRUSTED_EVENTS]`, {\n factory: ALWAYS_TRUE_HANDLER,\n });\n","import {inject, InjectionToken} from '@angular/core';\nimport {WINDOW} from '@ng-web-apis/common';\n\nexport const TUI_TOUCH_SUPPORTED = new InjectionToken(`[TUI_TOUCH_SUPPORTED]`, {\n factory: () => inject(WINDOW).matchMedia(`(any-pointer: coarse)`).matches,\n});\n","import {inject, InjectionToken} from '@angular/core';\nimport {WINDOW} from '@ng-web-apis/common';\nimport {tuiTypedFromEvent} from '@taiga-ui/cdk/observables';\nimport {Observable} from 'rxjs';\nimport {map, shareReplay, startWith} from 'rxjs/operators';\n\n/**\n * Window height accounting for disappearing address bar\n */\nexport const TUI_WINDOW_HEIGHT = new InjectionToken<Observable<number>>(\n `[TUI_WINDOW_HEIGHT]`,\n {\n factory: () => {\n const win = inject(WINDOW);\n\n return tuiTypedFromEvent(win, `resize`).pipe(\n startWith(null),\n map(() => win.innerHeight),\n shareReplay({bufferSize: 1, refCount: true}),\n );\n },\n },\n);\n","import {InjectionToken} from '@angular/core';\nimport {TuiZoomOptions} from '@taiga-ui/cdk/interfaces';\n\n/**\n * Zoom options\n */\nexport const TUI_ZOOM_OPTIONS = new InjectionToken<TuiZoomOptions>(`[TUI_ZOOM_OPTIONS]`, {\n factory: () => ({\n wheelSensitivity: 0.01,\n }),\n});\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["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qBAAqB,EACrB;IACI,OAAO,EAAE,MAAK;AACV,QAAA,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;AAE3B,QAAA,OAAO,iBAAiB,CAAC,GAAG,EAAE,CAAA,MAAA,CAAQ,CAAC,CAAC,IAAI,CACxC,SAAS,CAAC,IAAI,CAAC,EACf,GAAG,CAAC,MAAM,GAAG,CAAC,WAAW,CAAC,EAC1B,WAAW,CAAC,EAAC,UAAU,EAAE,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAC,CAAC,CAC/C,CAAC;KACL;AACJ,CAAA;;AClBL;;AAEG;MACU,gBAAgB,GAAG,IAAI,cAAc,CAAiB,oBAAoB,EAAE;AACrF,IAAA,OAAO,EAAE,OAAO;AACZ,QAAA,gBAAgB,EAAE,IAAI;KACzB,CAAC;AACL,CAAA;;ACVD;;AAEG;;;;"}
|
1
|
+
{"version":3,"file":"taiga-ui-cdk-tokens.js","sources":["../../../projects/cdk/tokens/removed-element.ts","../../../projects/cdk/tokens/active-element.ts","../../../projects/cdk/tokens/alerts.ts","../../../projects/cdk/tokens/default-renderer.ts","../../../projects/cdk/tokens/dialogs.ts","../../../projects/cdk/tokens/ensure-base-href.ts","../../../projects/cdk/tokens/focusable-item-accessor.ts","../../../projects/cdk/tokens/is-ios.ts","../../../projects/cdk/tokens/is-mobile.ts","../../../projects/cdk/tokens/is-android.ts","../../../projects/cdk/tokens/is-apple.ts","../../../projects/cdk/tokens/is-chromium.ts","../../../projects/cdk/tokens/is-cypress.ts","../../../projects/cdk/tokens/is-firefox.ts","../../../projects/cdk/tokens/is-stackblitz.ts","../../../projects/cdk/tokens/is-webkit.ts","../../../projects/cdk/tokens/range.ts","../../../projects/cdk/tokens/swipe-options.ts","../../../projects/cdk/tokens/take-only-trusted-events.ts","../../../projects/cdk/tokens/touch-supported.ts","../../../projects/cdk/tokens/window-height.ts","../../../projects/cdk/tokens/zoom-options.ts","../../../projects/cdk/tokens/taiga-ui-cdk-tokens.ts"],"sourcesContent":["import {ɵAnimationEngine as AnimationEngine} from '@angular/animations/browser';\nimport {inject, InjectFlags, InjectionToken} from '@angular/core';\nimport {BehaviorSubject, Observable, timer} from 'rxjs';\nimport {map, share, startWith, switchMap} from 'rxjs/operators';\n\n/**\n * Element currently being removed by AnimationEngine\n */\nexport const TUI_REMOVED_ELEMENT = new InjectionToken<Observable<Element | null>>(\n `[TUI_REMOVED_ELEMENT]`,\n {\n factory: () => {\n const stub = {onRemovalComplete: () => {}};\n const element$ = new BehaviorSubject<Element | null>(null);\n const engine = inject(AnimationEngine, InjectFlags.Optional) || stub;\n const {onRemovalComplete = stub.onRemovalComplete} = engine;\n\n engine.onRemovalComplete = (element, context) => {\n element$.next(element);\n onRemovalComplete(element, context);\n };\n\n return element$.pipe(\n switchMap(element =>\n timer(0).pipe(\n map(() => null),\n startWith(element),\n ),\n ),\n share(),\n );\n },\n },\n);\n","import {DOCUMENT} from '@angular/common';\nimport {inject, InjectionToken} from '@angular/core';\nimport {WINDOW} from '@ng-web-apis/common';\nimport {tuiTypedFromEvent} from '@taiga-ui/cdk/observables';\nimport {tuiGetActualTarget, tuiGetDocumentOrShadowRoot} from '@taiga-ui/cdk/utils';\nimport {merge, Observable, of, timer} from 'rxjs';\nimport {\n distinctUntilChanged,\n filter,\n map,\n repeatWhen,\n share,\n startWith,\n switchMap,\n take,\n takeUntil,\n withLatestFrom,\n} from 'rxjs/operators';\n\nimport {TUI_REMOVED_ELEMENT} from './removed-element';\n\n/**\n * Active element on the document for ActiveZone\n */\nexport const TUI_ACTIVE_ELEMENT = new InjectionToken<Observable<EventTarget | null>>(\n `[TUI_ACTIVE_ELEMENT]`,\n {\n factory: () => {\n const removedElement$ = inject(TUI_REMOVED_ELEMENT);\n const win = inject(WINDOW);\n const doc = inject(DOCUMENT);\n const focusout$ = tuiTypedFromEvent(win, `focusout`);\n const focusin$ = tuiTypedFromEvent(win, `focusin`);\n const blur$ = tuiTypedFromEvent(win, `blur`);\n const mousedown$ = tuiTypedFromEvent(win, `mousedown`);\n const mouseup$ = tuiTypedFromEvent(win, `mouseup`);\n\n return merge(\n focusout$.pipe(\n // eslint-disable-next-line rxjs/no-unsafe-takeuntil\n takeUntil(mousedown$),\n /**\n * TODO: replace to\n * repeat({delay: () => mouseup$})\n * in RxJS 7\n */\n // eslint-disable-next-line rxjs/no-ignored-notifier\n repeatWhen(() => mouseup$),\n withLatestFrom(removedElement$),\n filter(([event, removedElement]) =>\n isValidFocusout(tuiGetActualTarget(event), removedElement),\n ),\n map(([{relatedTarget}]) => relatedTarget),\n ),\n blur$.pipe(\n map(() => doc.activeElement),\n filter(element => !!element?.matches(`iframe`)),\n ),\n focusin$.pipe(\n switchMap(event => {\n const target = tuiGetActualTarget(event);\n const root = tuiGetDocumentOrShadowRoot(target) as Document;\n\n return root === doc\n ? of(target)\n : shadowRootActiveElement(root).pipe(startWith(target));\n }),\n ),\n mousedown$.pipe(\n switchMap(event => {\n const actualTargetInCurrentTime = tuiGetActualTarget(event);\n\n return !doc.activeElement || doc.activeElement === doc.body\n ? of(actualTargetInCurrentTime)\n : focusout$.pipe(\n take(1),\n map(\n /**\n * Do not use `map(() => tuiGetActualTarget(event))`\n * because we have different result in runtime\n */\n () => actualTargetInCurrentTime,\n ),\n takeUntil(timer(0)),\n );\n }),\n ),\n ).pipe(distinctUntilChanged(), share());\n },\n },\n);\n\n// Checks if focusout event should be considered leaving active zone\nfunction isValidFocusout(target: any, removedElement: Element | null = null): boolean {\n return (\n // Not due to switching tabs/going to DevTools\n tuiGetDocumentOrShadowRoot(target).activeElement !== target &&\n // Not due to button/input becoming disabled\n !target.disabled &&\n // Not due to element being removed from DOM\n !removedElement?.contains(target)\n );\n}\n\nfunction shadowRootActiveElement(root: Document): Observable<EventTarget | null> {\n return merge(\n tuiTypedFromEvent(root, `focusin`).pipe(map(({target}) => target)),\n tuiTypedFromEvent(root, `focusout`).pipe(\n filter(\n ({target, relatedTarget}) => !!relatedTarget && isValidFocusout(target),\n ),\n map(({relatedTarget}) => relatedTarget),\n ),\n );\n}\n","import {InjectionToken, Provider, Type} from '@angular/core';\nimport {TuiAriaDialogContext} from '@taiga-ui/cdk/interfaces';\nimport {Observable} from 'rxjs';\n\n/**\n * A stream of alerts\n */\nexport const TUI_ALERTS = new InjectionToken<\n ReadonlyArray<Observable<readonly TuiAriaDialogContext[]>>\n>(`[TUI_ALERTS]`, {\n factory: () => [],\n});\n\nexport function tuiAsAlerts(\n useExisting: Type<Observable<readonly TuiAriaDialogContext[]>>,\n): Provider {\n return {\n provide: TUI_ALERTS,\n multi: true,\n useExisting,\n };\n}\n","import {inject, InjectionToken, Renderer2, RendererFactory2} from '@angular/core';\n\n/**\n * A Renderer2 for global services\n * https://github.com/angular/angular/issues/17824#issuecomment-353239017\n * @deprecated unnecessary\n * TODO: remove in 4.0\n */\nexport const TUI_DEFAULT_RENDERER = new InjectionToken<Renderer2>(\n `[TUI_DEFAULT_RENDERER]`,\n {\n // @ts-ignore\n factory: () => inject(RendererFactory2).createRenderer(null, null),\n },\n);\n","import {InjectionToken, Provider, Type} from '@angular/core';\nimport {TuiAriaDialogContext} from '@taiga-ui/cdk/interfaces';\nimport {Observable} from 'rxjs';\n\n/**\n * A stream of dialogs\n */\nexport const TUI_DIALOGS = new InjectionToken<\n ReadonlyArray<Observable<readonly TuiAriaDialogContext[]>>\n>(`[TUI_DIALOGS]`, {\n factory: () => [],\n});\n\nexport function tuiAsDialog(\n useExisting: Type<Observable<readonly TuiAriaDialogContext[]>>,\n): Provider {\n return {\n provide: TUI_DIALOGS,\n multi: true,\n useExisting,\n };\n}\n","import {DOCUMENT} from '@angular/common';\nimport {inject, InjectionToken} from '@angular/core';\n\nexport const TUI_ENSURE_BASE_HREF: InjectionToken<string> = new InjectionToken<string>(\n `[TUI_ENSURE_BASE_HREF]`,\n {\n factory: () => {\n const link = inject(DOCUMENT).createElement(`a`);\n\n link.href = ``;\n\n return link.pathname;\n },\n },\n);\n","import {InjectionToken, Provider, Type} from '@angular/core';\nimport {TuiFocusableElementAccessor} from '@taiga-ui/cdk/interfaces';\n\n/**\n * A component that can be focused\n */\nexport const TUI_FOCUSABLE_ITEM_ACCESSOR =\n new InjectionToken<TuiFocusableElementAccessor>(`[TUI_FOCUSABLE_ITEM_ACCESSOR]`);\n\nexport function tuiAsFocusableItemAccessor(\n useExisting: Type<TuiFocusableElementAccessor>,\n): Provider {\n return {\n provide: TUI_FOCUSABLE_ITEM_ACCESSOR,\n useExisting,\n };\n}\n","import {inject, InjectionToken} from '@angular/core';\nimport {NAVIGATOR} from '@ng-web-apis/common';\nimport {tuiIsIos} from '@taiga-ui/cdk/utils';\n\n/**\n * iOS browser detection\n */\nexport const TUI_IS_IOS = new InjectionToken<boolean>(`[TUI_IS_IOS]`, {\n factory: () => tuiIsIos(inject(NAVIGATOR)),\n});\n","import {inject, InjectionToken} from '@angular/core';\nimport {USER_AGENT} from '@ng-web-apis/common';\n\n// https://stackoverflow.com/a/11381730/2706426 http://detectmobilebrowsers.com/\nconst firstRegex =\n /(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows ce|xda|xiino/;\nconst secondRegex =\n /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/;\n\n/**\n * Mobile browser detection\n */\nexport const TUI_IS_MOBILE = new InjectionToken<boolean>(`[TUI_IS_MOBILE]`, {\n factory: () =>\n firstRegex.test(inject(USER_AGENT).toLowerCase()) ||\n secondRegex.test(inject(USER_AGENT).slice(0, 4).toLowerCase()),\n});\n","import {inject, InjectionToken} from '@angular/core';\n\nimport {TUI_IS_IOS} from './is-ios';\nimport {TUI_IS_MOBILE} from './is-mobile';\n\n/**\n * Mobile browser that is not iOS (technically includes Windows Phone, Blackberry etc.)\n */\nexport const TUI_IS_ANDROID = new InjectionToken<boolean>(`[TUI_IS_ANDROID]`, {\n factory: () => inject(TUI_IS_MOBILE) && !inject(TUI_IS_IOS),\n});\n","import {inject, InjectionToken} from '@angular/core';\nimport {NAVIGATOR} from '@ng-web-apis/common';\nimport {tuiIsApple} from '@taiga-ui/cdk/utils';\n\n/**\n * Apple(safari/webkit) detection\n */\nexport const TUI_IS_APPLE = new InjectionToken<boolean>(`[TUI_IS_APPLE]`, {\n factory: () => tuiIsApple(inject(NAVIGATOR)),\n});\n","import {inject, InjectionToken} from '@angular/core';\nimport {WINDOW} from '@ng-web-apis/common';\n\n/**\n * Chromium browser engine detection\n */\nexport const TUI_IS_CHROMIUM = new InjectionToken<boolean>(`[TUI_IS_CHROMIUM]`, {\n factory: () => !!(inject(WINDOW) as Window & {chrome: unknown}).chrome,\n});\n","import {inject, InjectionToken} from '@angular/core';\nimport {WINDOW} from '@ng-web-apis/common';\n\ninterface WindowWithCypress extends Window {\n Cypress?: unknown;\n}\n\n/**\n * Detect if app is running under Cypress\n * {@link https://docs.cypress.io/faq/questions/using-cypress-faq#Is-there-any-way-to-detect-if-my-app-is-running-under-Cypress Cypress docs}\n */\nexport const TUI_IS_CYPRESS = new InjectionToken<boolean>(`[TUI_IS_CYPRESS]`, {\n factory: () => !!inject<WindowWithCypress>(WINDOW).Cypress,\n});\n","import {inject, InjectionToken} from '@angular/core';\nimport {WINDOW} from '@ng-web-apis/common';\n\n/**\n * Firefox browser engine detection\n */\nexport const TUI_IS_FIREFOX = new InjectionToken<boolean>(`[TUI_IS_FIREFOX]`, {\n factory: () =>\n typeof (inject(WINDOW) as Window & {mozCancelFullScreen: unknown})\n ?.mozCancelFullScreen !== `undefined`,\n});\n","import {inject, InjectionToken} from '@angular/core';\nimport {WINDOW} from '@ng-web-apis/common';\n\nexport const TUI_IS_STACKBLITZ = new InjectionToken<boolean>(`[TUI_IS_STACKBLITZ]`, {\n factory: () => inject(WINDOW).location.host.endsWith(`stackblitz.io`),\n});\n","import {inject, InjectionToken} from '@angular/core';\nimport {WINDOW} from '@ng-web-apis/common';\n\n/**\n * Webkit browser engine detection\n */\nexport const TUI_IS_WEBKIT = new InjectionToken<boolean>(`[TUI_IS_WEBKIT]`, {\n factory: () =>\n !!(inject(WINDOW) as unknown as {webkitConvertPointFromNodeToPage?: unknown})\n ?.webkitConvertPointFromNodeToPage,\n});\n","import {isPlatformBrowser} from '@angular/common';\nimport {inject, InjectionToken, PLATFORM_ID} from '@angular/core';\n\n/**\n * SSR safe default empty Range\n */\nexport const TUI_RANGE = new InjectionToken<Range>(`[TUI_RANGE]`, {\n factory: () =>\n isPlatformBrowser(inject(PLATFORM_ID)) ? new Range() : ({} as unknown as Range),\n});\n","import {InjectionToken} from '@angular/core';\nimport {TuiSwipeOptions} from '@taiga-ui/cdk/interfaces';\n\n/**\n * Swipe options\n */\nexport const TUI_SWIPE_OPTIONS = new InjectionToken<TuiSwipeOptions>(\n `[TUI_SWIPE_OPTIONS]`,\n {\n factory: () => ({timeout: 500, threshold: 30}),\n },\n);\n","import {InjectionToken} from '@angular/core';\nimport {ALWAYS_TRUE_HANDLER} from '@taiga-ui/cdk/constants';\n\n/**\n * @description:\n * The isTrusted read-only property of the Event interface is a boolean value that is true\n * when the event was generated by a user action, and false when the event was created or\n * modified by a script or dispatched via EventTarget.dispatchEvent().\n */\nexport const TUI_TAKE_ONLY_TRUSTED_EVENTS: InjectionToken<boolean> =\n new InjectionToken<boolean>(`[TUI_TAKE_ONLY_TRUSTED_EVENTS]`, {\n factory: ALWAYS_TRUE_HANDLER,\n });\n","import {inject, InjectionToken} from '@angular/core';\nimport {WINDOW} from '@ng-web-apis/common';\n\nexport const TUI_TOUCH_SUPPORTED = new InjectionToken(`[TUI_TOUCH_SUPPORTED]`, {\n factory: () => inject(WINDOW).matchMedia(`(any-pointer: coarse)`).matches,\n});\n","import {inject, InjectionToken} from '@angular/core';\nimport {WINDOW} from '@ng-web-apis/common';\nimport {tuiTypedFromEvent} from '@taiga-ui/cdk/observables';\nimport {Observable} from 'rxjs';\nimport {map, shareReplay, startWith} from 'rxjs/operators';\n\n/**\n * Window height accounting for disappearing address bar\n */\nexport const TUI_WINDOW_HEIGHT = new InjectionToken<Observable<number>>(\n `[TUI_WINDOW_HEIGHT]`,\n {\n factory: () => {\n const win = inject(WINDOW);\n\n return tuiTypedFromEvent(win, `resize`).pipe(\n startWith(null),\n map(() => win.innerHeight),\n shareReplay({bufferSize: 1, refCount: true}),\n );\n },\n },\n);\n","import {InjectionToken} from '@angular/core';\nimport {TuiZoomOptions} from '@taiga-ui/cdk/interfaces';\n\n/**\n * Zoom options\n */\nexport const TUI_ZOOM_OPTIONS = new InjectionToken<TuiZoomOptions>(`[TUI_ZOOM_OPTIONS]`, {\n factory: () => ({\n wheelSensitivity: 0.01,\n }),\n});\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["AnimationEngine"],"mappings":";;;;;;;;;;AAKA;;AAEG;MACU,mBAAmB,GAAG,IAAI,cAAc,CACjD,uBAAuB,EACvB;IACI,OAAO,EAAE,MAAK;QACV,MAAM,IAAI,GAAG,EAAC,iBAAiB,EAAE,MAAK,GAAG,EAAC,CAAC;AAC3C,QAAA,MAAM,QAAQ,GAAG,IAAI,eAAe,CAAiB,IAAI,CAAC,CAAC;AAC3D,QAAA,MAAM,MAAM,GAAG,MAAM,CAACA,gBAAe,EAAE,WAAW,CAAC,QAAQ,CAA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AQ,CAAC,CAAC,IAAI,CACxC,SAAS,CAAC,IAAI,CAAC,EACf,GAAG,CAAC,MAAM,GAAG,CAAC,WAAW,CAAC,EAC1B,WAAW,CAAC,EAAC,UAAU,EAAE,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAC,CAAC,CAC/C,CAAC;KACL;AACJ,CAAA;;AClBL;;AAEG;MACU,gBAAgB,GAAG,IAAI,cAAc,CAAiB,oBAAoB,EAAE;AACrF,IAAA,OAAO,EAAE,OAAO;AACZ,QAAA,gBAAgB,EAAE,IAAI;KACzB,CAAC;AACL,CAAA;;ACVD;;AAEG;;;;"}
|
@@ -99,6 +99,17 @@ function tuiIsPresent(value) {
|
|
99
99
|
return value !== null && value !== undefined;
|
100
100
|
}
|
101
101
|
|
102
|
+
function tuiIsValidUrl(url) {
|
103
|
+
const pattern = new RegExp(`^([a-zA-Z]+:\\/\\/)?` + // protocol
|
104
|
+
`((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|localhost|` + // domain name
|
105
|
+
`((\\d{1,3}\\.){3}\\d{1,3}))` + // OR IP (v4) address
|
106
|
+
`(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*` + // port and path
|
107
|
+
`(\\?[;&a-z\\d%_.~+=-]*)?` + // query string
|
108
|
+
`(\\#[-a-z\\d_]*)?$`, // fragment locator
|
109
|
+
`i`);
|
110
|
+
return pattern.test(url);
|
111
|
+
}
|
112
|
+
|
102
113
|
function tuiMarkControlAsTouchedAndValidate(control) {
|
103
114
|
if (control instanceof FormArray) {
|
104
115
|
control.controls.forEach(nestedControl => {
|
@@ -154,5 +165,5 @@ function tuiUniqBy(array, key) {
|
|
154
165
|
* Generated bundle index. Do not edit.
|
155
166
|
*/
|
156
167
|
|
157
|
-
export { tuiArrayRemove, tuiArrayShallowEquals, tuiArrayToggle, tuiCleanObject, tuiDefaultSort, tuiDistanceBetweenTouches, tuiEaseInOutQuad, tuiFlatLength, tuiGetOriginalArrayFromQueryList, tuiGetSwipeDirection, tuiIsFalsy, tuiIsNumber, tuiIsObject, tuiIsPresent, tuiIsString, tuiMarkControlAsTouchedAndValidate, tuiNullableSame, tuiObjectFromEntries, tuiUniqBy };
|
168
|
+
export { tuiArrayRemove, tuiArrayShallowEquals, tuiArrayToggle, tuiCleanObject, tuiDefaultSort, tuiDistanceBetweenTouches, tuiEaseInOutQuad, tuiFlatLength, tuiGetOriginalArrayFromQueryList, tuiGetSwipeDirection, tuiIsFalsy, tuiIsNumber, tuiIsObject, tuiIsPresent, tuiIsString, tuiIsValidUrl, tuiMarkControlAsTouchedAndValidate, tuiNullableSame, tuiObjectFromEntries, tuiUniqBy };
|
158
169
|
//# sourceMappingURL=taiga-ui-cdk-utils-miscellaneous.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"taiga-ui-cdk-utils-miscellaneous.js","sources":["../../../projects/cdk/utils/miscellaneous/array-remove.ts","../../../projects/cdk/utils/miscellaneous/array-shallow-equals.ts","../../../projects/cdk/utils/miscellaneous/array-toggle.ts","../../../projects/cdk/utils/miscellaneous/is-string.ts","../../../projects/cdk/utils/miscellaneous/clean-object.ts","../../../projects/cdk/utils/miscellaneous/default-sort.ts","../../../projects/cdk/utils/miscellaneous/distance-between-touches.ts","../../../projects/cdk/utils/miscellaneous/ease-in-out-quad.ts","../../../projects/cdk/utils/miscellaneous/flat-length.ts","../../../projects/cdk/utils/miscellaneous/get-original-array-from-query-list.ts","../../../projects/cdk/utils/miscellaneous/get-swipe-direction.ts","../../../projects/cdk/utils/miscellaneous/is-falsy.ts","../../../projects/cdk/utils/miscellaneous/is-number.ts","../../../projects/cdk/utils/miscellaneous/is-object.ts","../../../projects/cdk/utils/miscellaneous/is-present.ts","../../../projects/cdk/utils/miscellaneous/mark-control-as-touched-and-validate.ts","../../../projects/cdk/utils/miscellaneous/nullable-same.ts","../../../projects/cdk/utils/miscellaneous/object-from-entries.ts","../../../projects/cdk/utils/miscellaneous/uniq-by.ts","../../../projects/cdk/utils/miscellaneous/taiga-ui-cdk-utils-miscellaneous.ts"],"sourcesContent":["export function tuiArrayRemove<T>(array: readonly T[], index: number): T[] {\n return array.slice(0, Math.max(index, 0)).concat(array.slice(Math.max(index + 1, 0)));\n}\n","export function tuiArrayShallowEquals<T>(a: readonly T[], b: readonly T[]): boolean {\n return a.length === b.length && a.every((item, index) => item === b[index]);\n}\n","import {tuiArrayRemove} from './array-remove';\n\nexport function tuiArrayToggle<T>(array: readonly T[], item: T): T[] {\n const index = array.indexOf(item);\n\n return index === -1 ? [...array, item] : tuiArrayRemove(array, index);\n}\n","export function tuiIsString(value: unknown): value is string {\n // eslint-disable-next-line @taiga-ui/no-typeof\n return typeof value === `string`;\n}\n","import {TuiDeepPartial} from '@taiga-ui/cdk/types';\n\nimport {tuiIsString} from './is-string';\n\nexport function tuiCleanObject<T>(object: T): TuiDeepPartial<T> {\n return JSON.parse(\n JSON.stringify(object, (_key: string, value: unknown) =>\n checkValueIsEmpty(value) ? undefined : value,\n ),\n );\n}\n\ntype EmptyValue = '' | null | undefined;\n\nfunction checkValueIsEmpty<T>(value: EmptyValue | T): value is EmptyValue {\n const nextValue: any = tuiIsString(value) ? value.trim() : value;\n\n return [undefined, null, NaN, ``].includes(nextValue);\n}\n","import {TuiDay} from '@taiga-ui/cdk/date-time';\n\nimport {tuiIsString} from './is-string';\n\nexport function tuiDefaultSort<T>(x: T, y: T): number {\n const a = x instanceof TuiDay ? Number(x.toUtcNativeDate()) : x;\n const b = y instanceof TuiDay ? Number(y.toUtcNativeDate()) : y;\n\n if (a === b) {\n return 0;\n }\n\n if (tuiIsString(a) && tuiIsString(b)) {\n return a.localeCompare(b);\n }\n\n return a > b ? 1 : -1;\n}\n","export function tuiDistanceBetweenTouches({touches}: TouchEvent): number {\n return Math.hypot(\n touches[0].clientX - touches[1].clientX,\n touches[0].clientY - touches[1].clientY,\n );\n}\n","import {tuiAssert} from '@taiga-ui/cdk/classes';\n\nexport function tuiEaseInOutQuad(t: number): number {\n ngDevMode &&\n tuiAssert.assert(\n t >= 0 && t <= 1,\n `Input must be between 0 and 1 inclusive but received `,\n t,\n );\n\n return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;\n}\n","/**\n * Flattens two-dimensional array and calculates resulting length\n *\n * @param array twi dimensional array\n */\nexport function tuiFlatLength(array: ReadonlyArray<readonly unknown[]>): number {\n return array.reduce((count, section) => count + section.length, 0);\n}\n","import {QueryList} from '@angular/core';\n\n/**\n * Extracts original array from {@link QueryList} rather than\n * creating a copy like {@link QueryList.toArray} does.\n * @param queryList\n * @returns original array from {@link QueryList}.\n */\nexport function tuiGetOriginalArrayFromQueryList<T>(\n queryList: QueryList<T>,\n): readonly T[] {\n let array: readonly T[] = [];\n\n queryList.find((_item, _index, originalArray) => {\n array = originalArray;\n\n return true;\n });\n\n return array;\n}\n","import {TuiSwipeDirection} from '@taiga-ui/cdk/interfaces';\n\nexport function tuiGetSwipeDirection(deltaX: number, deltaY: number): TuiSwipeDirection {\n if (Math.abs(deltaY) > Math.abs(deltaX)) {\n return deltaY > 0 ? `top` : `bottom`;\n }\n\n return deltaX > 0 ? `left` : `right`;\n}\n","export function tuiIsFalsy(value: unknown): boolean {\n return !value;\n}\n","export function tuiIsNumber(value: unknown): value is number {\n // eslint-disable-next-line @taiga-ui/no-typeof\n return typeof value === `number`;\n}\n","export function tuiIsObject<T extends Record<string, any>>(\n value: unknown,\n): value is NonNullable<T> {\n // eslint-disable-next-line @taiga-ui/no-typeof\n return typeof value === `object` && !!value;\n}\n","export function tuiIsPresent<T>(value?: T | null): value is T {\n return value !== null && value !== undefined;\n}\n","import {AbstractControl, FormArray, FormGroup} from '@angular/forms';\n\nexport function tuiMarkControlAsTouchedAndValidate(control: AbstractControl): void {\n if (control instanceof FormArray) {\n control.controls.forEach(nestedControl => {\n tuiMarkControlAsTouchedAndValidate(nestedControl);\n });\n }\n\n if (control instanceof FormGroup) {\n Object.values(control.controls).forEach(nestedControl => {\n tuiMarkControlAsTouchedAndValidate(nestedControl);\n });\n }\n\n control.markAsTouched();\n control.updateValueAndValidity();\n}\n","import {TuiIdentityMatcher} from '@taiga-ui/cdk/types';\n\n/**\n * Checks identity for nullable elements.\n *\n * @param a element a\n * @param b element b\n * @param handler called if both elements are not null\n * @return true if either both are null or they pass identity handler\n */\nexport function tuiNullableSame<T>(\n a: T | null,\n b: T | null,\n handler: TuiIdentityMatcher<T>,\n): boolean {\n if (a === null) {\n return b === null;\n }\n\n if (b === null) {\n return false;\n }\n\n return handler(a, b);\n}\n","/**\n * @deprecated use `Object.fromEntries` instead\n * (check browser support first https://caniuse.com/mdn-javascript_builtins_object_fromentries)\n * ___\n * TODO: after we bump Firefox to 63+ replace this function with `Object.fromEntries`.\n * TODO: Add `es2019.object` to `tsconfig.json` => `compilerOptions.lib`.\n *\n */\nexport function tuiObjectFromEntries<K extends number | string, V>(\n keyValuePairs: Array<[K, V]>,\n): Record<K, V> {\n return keyValuePairs.reduce(\n (obj, [key, val]) => ({...obj, [key]: val}),\n {} as Record<K, V>,\n );\n}\n","export function tuiUniqBy<T extends Record<string, any>>(\n array: readonly T[],\n key: keyof T,\n): readonly T[] {\n return Array.from(\n array\n .reduce(\n (map, item) => (map.has(item[key]) ? map : map.set(item[key], item)),\n new Map<T[keyof T], T>(),\n )\n .values(),\n );\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAAgB,SAAA,cAAc,CAAI,KAAmB,EAAE,KAAa,EAAA;AAChE,IAAA,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1F;;ACFgB,SAAA,qBAAqB,CAAI,CAAe,EAAE,CAAe,EAAA;IACrE,OAAO,CAAC,C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"file":"taiga-ui-cdk-utils-miscellaneous.js","sources":["../../../projects/cdk/utils/miscellaneous/array-remove.ts","../../../projects/cdk/utils/miscellaneous/array-shallow-equals.ts","../../../projects/cdk/utils/miscellaneous/array-toggle.ts","../../../projects/cdk/utils/miscellaneous/is-string.ts","../../../projects/cdk/utils/miscellaneous/clean-object.ts","../../../projects/cdk/utils/miscellaneous/default-sort.ts","../../../projects/cdk/utils/miscellaneous/distance-between-touches.ts","../../../projects/cdk/utils/miscellaneous/ease-in-out-quad.ts","../../../projects/cdk/utils/miscellaneous/flat-length.ts","../../../projects/cdk/utils/miscellaneous/get-original-array-from-query-list.ts","../../../projects/cdk/utils/miscellaneous/get-swipe-direction.ts","../../../projects/cdk/utils/miscellaneous/is-falsy.ts","../../../projects/cdk/utils/miscellaneous/is-number.ts","../../../projects/cdk/utils/miscellaneous/is-object.ts","../../../projects/cdk/utils/miscellaneous/is-present.ts","../../../projects/cdk/utils/miscellaneous/is-valid-url.ts","../../../projects/cdk/utils/miscellaneous/mark-control-as-touched-and-validate.ts","../../../projects/cdk/utils/miscellaneous/nullable-same.ts","../../../projects/cdk/utils/miscellaneous/object-from-entries.ts","../../../projects/cdk/utils/miscellaneous/uniq-by.ts","../../../projects/cdk/utils/miscellaneous/taiga-ui-cdk-utils-miscellaneous.ts"],"sourcesContent":["export function tuiArrayRemove<T>(array: readonly T[], index: number): T[] {\n return array.slice(0, Math.max(index, 0)).concat(array.slice(Math.max(index + 1, 0)));\n}\n","export function tuiArrayShallowEquals<T>(a: readonly T[], b: readonly T[]): boolean {\n return a.length === b.length && a.every((item, index) => item === b[index]);\n}\n","import {tuiArrayRemove} from './array-remove';\n\nexport function tuiArrayToggle<T>(array: readonly T[], item: T): T[] {\n const index = array.indexOf(item);\n\n return index === -1 ? [...array, item] : tuiArrayRemove(array, index);\n}\n","export function tuiIsString(value: unknown): value is string {\n // eslint-disable-next-line @taiga-ui/no-typeof\n return typeof value === `string`;\n}\n","import {TuiDeepPartial} from '@taiga-ui/cdk/types';\n\nimport {tuiIsString} from './is-string';\n\nexport function tuiCleanObject<T>(object: T): TuiDeepPartial<T> {\n return JSON.parse(\n JSON.stringify(object, (_key: string, value: unknown) =>\n checkValueIsEmpty(value) ? undefined : value,\n ),\n );\n}\n\ntype EmptyValue = '' | null | undefined;\n\nfunction checkValueIsEmpty<T>(value: EmptyValue | T): value is EmptyValue {\n const nextValue: any = tuiIsString(value) ? value.trim() : value;\n\n return [undefined, null, NaN, ``].includes(nextValue);\n}\n","import {TuiDay} from '@taiga-ui/cdk/date-time';\n\nimport {tuiIsString} from './is-string';\n\nexport function tuiDefaultSort<T>(x: T, y: T): number {\n const a = x instanceof TuiDay ? Number(x.toUtcNativeDate()) : x;\n const b = y instanceof TuiDay ? Number(y.toUtcNativeDate()) : y;\n\n if (a === b) {\n return 0;\n }\n\n if (tuiIsString(a) && tuiIsString(b)) {\n return a.localeCompare(b);\n }\n\n return a > b ? 1 : -1;\n}\n","export function tuiDistanceBetweenTouches({touches}: TouchEvent): number {\n return Math.hypot(\n touches[0].clientX - touches[1].clientX,\n touches[0].clientY - touches[1].clientY,\n );\n}\n","import {tuiAssert} from '@taiga-ui/cdk/classes';\n\nexport function tuiEaseInOutQuad(t: number): number {\n ngDevMode &&\n tuiAssert.assert(\n t >= 0 && t <= 1,\n `Input must be between 0 and 1 inclusive but received `,\n t,\n );\n\n return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;\n}\n","/**\n * Flattens two-dimensional array and calculates resulting length\n *\n * @param array twi dimensional array\n */\nexport function tuiFlatLength(array: ReadonlyArray<readonly unknown[]>): number {\n return array.reduce((count, section) => count + section.length, 0);\n}\n","import {QueryList} from '@angular/core';\n\n/**\n * Extracts original array from {@link QueryList} rather than\n * creating a copy like {@link QueryList.toArray} does.\n * @param queryList\n * @returns original array from {@link QueryList}.\n */\nexport function tuiGetOriginalArrayFromQueryList<T>(\n queryList: QueryList<T>,\n): readonly T[] {\n let array: readonly T[] = [];\n\n queryList.find((_item, _index, originalArray) => {\n array = originalArray;\n\n return true;\n });\n\n return array;\n}\n","import {TuiSwipeDirection} from '@taiga-ui/cdk/interfaces';\n\nexport function tuiGetSwipeDirection(deltaX: number, deltaY: number): TuiSwipeDirection {\n if (Math.abs(deltaY) > Math.abs(deltaX)) {\n return deltaY > 0 ? `top` : `bottom`;\n }\n\n return deltaX > 0 ? `left` : `right`;\n}\n","export function tuiIsFalsy(value: unknown): boolean {\n return !value;\n}\n","export function tuiIsNumber(value: unknown): value is number {\n // eslint-disable-next-line @taiga-ui/no-typeof\n return typeof value === `number`;\n}\n","export function tuiIsObject<T extends Record<string, any>>(\n value: unknown,\n): value is NonNullable<T> {\n // eslint-disable-next-line @taiga-ui/no-typeof\n return typeof value === `object` && !!value;\n}\n","export function tuiIsPresent<T>(value?: T | null): value is T {\n return value !== null && value !== undefined;\n}\n","export function tuiIsValidUrl(url: string): boolean {\n const pattern = new RegExp(\n `^([a-zA-Z]+:\\\\/\\\\/)?` + // protocol\n `((([a-z\\\\d]([a-z\\\\d-]*[a-z\\\\d])*)\\\\.)+[a-z]{2,}|localhost|` + // domain name\n `((\\\\d{1,3}\\\\.){3}\\\\d{1,3}))` + // OR IP (v4) address\n `(\\\\:\\\\d+)?(\\\\/[-a-z\\\\d%_.~+]*)*` + // port and path\n `(\\\\?[;&a-z\\\\d%_.~+=-]*)?` + // query string\n `(\\\\#[-a-z\\\\d_]*)?$`, // fragment locator\n `i`,\n );\n\n return pattern.test(url);\n}\n","import {AbstractControl, FormArray, FormGroup} from '@angular/forms';\n\nexport function tuiMarkControlAsTouchedAndValidate(control: AbstractControl): void {\n if (control instanceof FormArray) {\n control.controls.forEach(nestedControl => {\n tuiMarkControlAsTouchedAndValidate(nestedControl);\n });\n }\n\n if (control instanceof FormGroup) {\n Object.values(control.controls).forEach(nestedControl => {\n tuiMarkControlAsTouchedAndValidate(nestedControl);\n });\n }\n\n control.markAsTouched();\n control.updateValueAndValidity();\n}\n","import {TuiIdentityMatcher} from '@taiga-ui/cdk/types';\n\n/**\n * Checks identity for nullable elements.\n *\n * @param a element a\n * @param b element b\n * @param handler called if both elements are not null\n * @return true if either both are null or they pass identity handler\n */\nexport function tuiNullableSame<T>(\n a: T | null,\n b: T | null,\n handler: TuiIdentityMatcher<T>,\n): boolean {\n if (a === null) {\n return b === null;\n }\n\n if (b === null) {\n return false;\n }\n\n return handler(a, b);\n}\n","/**\n * @deprecated use `Object.fromEntries` instead\n * (check browser support first https://caniuse.com/mdn-javascript_builtins_object_fromentries)\n * ___\n * TODO: after we bump Firefox to 63+ replace this function with `Object.fromEntries`.\n * TODO: Add `es2019.object` to `tsconfig.json` => `compilerOptions.lib`.\n *\n */\nexport function tuiObjectFromEntries<K extends number | string, V>(\n keyValuePairs: Array<[K, V]>,\n): Record<K, V> {\n return keyValuePairs.reduce(\n (obj, [key, val]) => ({...obj, [key]: val}),\n {} as Record<K, V>,\n );\n}\n","export function tuiUniqBy<T extends Record<string, any>>(\n array: readonly T[],\n key: keyof T,\n): readonly T[] {\n return Array.from(\n array\n .reduce(\n (map, item) => (map.has(item[key]) ? map : map.set(item[key], item)),\n new Map<T[keyof T], T>(),\n )\n .values(),\n );\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAAgB,SAAA,cAAc,CAAI,KAAmB,EAAE,KAAa,EAAA;AAChE,IAAA,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1F;;ACFgB,SAAA,qBAAqB,CAAI,CAAe,EAAE,CAAe,EAAA;IACrE,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,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K;AACA,SAAA,MAAM,CACH,CAAC,GAAG,EAAE,IAAI,MAAM,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC,EACpE,IAAI,GAAG,EAAiB,CAC3B;SACA,MAAM,EAAE,CAChB,CAAC;AACN;;ACZA;;AAEG;;;;"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@taiga-ui/cdk",
|
3
|
-
"version": "3.
|
3
|
+
"version": "3.26.0",
|
4
4
|
"description": "Base library for creating Angular components and applications using Taiga UI principles regarding of actual visual appearance",
|
5
5
|
"keywords": [
|
6
6
|
"angular",
|
@@ -30,7 +30,7 @@
|
|
30
30
|
"rxjs": ">=6.0.0"
|
31
31
|
},
|
32
32
|
"optionalDependencies": {
|
33
|
-
"ng-morph": "2.
|
33
|
+
"ng-morph": "2.2.0",
|
34
34
|
"parse5": "6.0.1"
|
35
35
|
},
|
36
36
|
"ng-update": {
|
@@ -54,7 +54,8 @@
|
|
54
54
|
"@taiga-ui/proprietary-banking",
|
55
55
|
"@taiga-ui/proprietary-core",
|
56
56
|
"@taiga-ui/proprietary-icons",
|
57
|
-
"@taiga-ui/proprietary-navigation"
|
57
|
+
"@taiga-ui/proprietary-navigation",
|
58
|
+
"@taiga-ui/layout"
|
58
59
|
]
|
59
60
|
},
|
60
61
|
"schematics": "./schematics/collection.json",
|
@@ -2,7 +2,11 @@ export interface ImportingModule {
|
|
2
2
|
name: string;
|
3
3
|
packageName: string;
|
4
4
|
}
|
5
|
-
export declare const
|
5
|
+
export declare const MAIN_MODULE: ImportingModule;
|
6
|
+
export declare const BROWSER_ANIMATION_MODULE: {
|
7
|
+
name: string;
|
8
|
+
packageName: string;
|
9
|
+
};
|
6
10
|
export declare const DIALOG_MODULES: readonly ImportingModule[];
|
7
11
|
export declare const ALERT_MODULES: readonly ImportingModule[];
|
8
12
|
export declare const SANITIZER_MODULES: readonly ImportingModule[];
|
@@ -1,16 +1,14 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.SANITIZER_MODULES = exports.ALERT_MODULES = exports.DIALOG_MODULES = exports.
|
4
|
-
exports.
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
},
|
13
|
-
];
|
3
|
+
exports.SANITIZER_MODULES = exports.ALERT_MODULES = exports.DIALOG_MODULES = exports.BROWSER_ANIMATION_MODULE = exports.MAIN_MODULE = void 0;
|
4
|
+
exports.MAIN_MODULE = {
|
5
|
+
name: `TuiRootModule`,
|
6
|
+
packageName: `@taiga-ui/core`,
|
7
|
+
};
|
8
|
+
exports.BROWSER_ANIMATION_MODULE = {
|
9
|
+
name: `BrowserAnimationsModule`,
|
10
|
+
packageName: `@angular/platform-browser/animations`,
|
11
|
+
};
|
14
12
|
exports.DIALOG_MODULES = [
|
15
13
|
{
|
16
14
|
name: `TuiDialogModule`,
|
@@ -4,9 +4,14 @@ exports.addTaigaModules = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
5
5
|
const workspace_1 = require("@schematics/angular/utility/workspace");
|
6
6
|
const ng_morph_1 = require("ng-morph");
|
7
|
+
const constants_1 = require("../../constants");
|
8
|
+
const add_import_to_component_1 = require("../../utils/add-import-to-component");
|
7
9
|
const add_unique_import_1 = require("../../utils/add-unique-import");
|
10
|
+
const get_component_from_identifier_1 = require("../../utils/get-component-from-identifier");
|
8
11
|
const get_project_target_options_1 = require("../../utils/get-project-target-options");
|
9
12
|
const get_projects_1 = require("../../utils/get-projects");
|
13
|
+
const get_standalone_bootstrap_function_1 = require("../../utils/get-standalone-bootstrap-function");
|
14
|
+
const push_to_array_property_1 = require("../../utils/push-to-array-property");
|
10
15
|
const modules_1 = require("../constants/modules");
|
11
16
|
function addTaigaModules(options) {
|
12
17
|
return (tree, context) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
@@ -17,33 +22,98 @@ function addTaigaModules(options) {
|
|
17
22
|
return;
|
18
23
|
}
|
19
24
|
const buildOptions = get_project_target_options_1.getProjectTargetOptions(project, `build`);
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
25
|
+
const mainFilePath = buildOptions.main;
|
26
|
+
if (!mainFilePath) {
|
27
|
+
context.logger.error(`[ERROR]: Could not find the project main file`);
|
28
|
+
return;
|
29
|
+
}
|
30
|
+
ng_morph_1.setActiveProject(ng_morph_1.createProject(tree, `/`, constants_1.ALL_FILES));
|
31
|
+
const bootstrapFunction = get_standalone_bootstrap_function_1.getStandaloneBootstrapFunction(mainFilePath);
|
32
|
+
if (bootstrapFunction) {
|
33
|
+
addTuiEntitiesToStandalone({
|
34
|
+
bootstrapFunction,
|
35
|
+
options,
|
36
|
+
context,
|
37
|
+
});
|
38
|
+
}
|
39
|
+
else {
|
40
|
+
const mainClass = ng_morph_1.getMainModule(mainFilePath);
|
41
|
+
addTuiModules({ mainClass, options, context });
|
42
|
+
addExtraTuiProvidersToRootComponent({ mainClass, options });
|
43
|
+
}
|
24
44
|
ng_morph_1.saveActiveProject();
|
25
45
|
});
|
26
46
|
}
|
27
47
|
exports.addTaigaModules = addTaigaModules;
|
28
|
-
function addTuiModules(
|
29
|
-
const modules = [
|
30
|
-
|
31
|
-
...(options.addDialogsModule ? modules_1.DIALOG_MODULES : []),
|
32
|
-
...(options.addAlertModule ? modules_1.ALERT_MODULES : []),
|
33
|
-
];
|
34
|
-
const mainModulePath = mainModule.getSourceFile().getFilePath();
|
48
|
+
function addTuiModules({ mainClass, options, context, }) {
|
49
|
+
const modules = getModules(options, [modules_1.BROWSER_ANIMATION_MODULE]);
|
50
|
+
const mainModulePath = mainClass.getSourceFile().getFilePath();
|
35
51
|
modules.forEach(module => {
|
36
|
-
ng_morph_1.addImportToNgModule(
|
52
|
+
ng_morph_1.addImportToNgModule(mainClass, module.name, { unique: true });
|
37
53
|
add_unique_import_1.addUniqueImport(mainModulePath, module.name, module.packageName);
|
38
54
|
});
|
39
55
|
context.logger.info(`${modules.map(module => module.name)} was added to ${mainModulePath}`);
|
40
56
|
}
|
41
|
-
function
|
57
|
+
function addExtraTuiProvidersToRootComponent({ mainClass, options, standalone = false, }) {
|
42
58
|
if (!options.addSanitizer) {
|
43
59
|
return;
|
44
60
|
}
|
45
|
-
|
61
|
+
const provider = `{provide: TUI_SANITIZER, useClass: NgDompurifySanitizer}`;
|
62
|
+
if (standalone) {
|
63
|
+
ng_morph_1.addProviderToComponent(mainClass, provider, { unique: true });
|
64
|
+
}
|
65
|
+
else {
|
66
|
+
ng_morph_1.addProviderToNgModule(mainClass, provider, { unique: true });
|
67
|
+
}
|
46
68
|
modules_1.SANITIZER_MODULES.forEach(module => {
|
47
|
-
add_unique_import_1.addUniqueImport(
|
69
|
+
add_unique_import_1.addUniqueImport(mainClass.getSourceFile().getFilePath(), module.name, module.packageName);
|
48
70
|
});
|
49
71
|
}
|
72
|
+
function addTuiEntitiesToStandalone({ bootstrapFunction, options, context, }) {
|
73
|
+
const [rootComponentIdentifier, bootstrapOptions = bootstrapFunction.addArgument(`{providers}: []`),] = bootstrapFunction.getArguments();
|
74
|
+
const mainClass = get_component_from_identifier_1.getComponentFromIdentifier(rootComponentIdentifier);
|
75
|
+
if (mainClass) {
|
76
|
+
addMainModuleToRootComponent({ mainClass, options, context });
|
77
|
+
addRootTuiProvidersToBootstrapFn(bootstrapOptions);
|
78
|
+
addExtraTuiProvidersToRootComponent({ mainClass, options, standalone: true });
|
79
|
+
}
|
80
|
+
}
|
81
|
+
function addRootTuiProvidersToBootstrapFn(bootstrapOptions) {
|
82
|
+
const property = bootstrapOptions.getProperty(`providers`);
|
83
|
+
const initializer = property.getInitializer();
|
84
|
+
const providerFrom = initializer
|
85
|
+
.getElements()
|
86
|
+
.find(el => ng_morph_1.Node.isCallExpression(el) &&
|
87
|
+
el.getExpression().getText() === `importProvidersFrom`);
|
88
|
+
const modules = [modules_1.MAIN_MODULE, modules_1.BROWSER_ANIMATION_MODULE];
|
89
|
+
if (ng_morph_1.Node.isCallExpression(providerFrom)) {
|
90
|
+
const existing = providerFrom.getArguments();
|
91
|
+
const moduleNames = modules
|
92
|
+
.map(({ name }) => name)
|
93
|
+
.filter(module => !existing.some(existingModule => existingModule.getText() === module));
|
94
|
+
providerFrom.addArguments(moduleNames);
|
95
|
+
}
|
96
|
+
else {
|
97
|
+
push_to_array_property_1.pushToObjectArrayProperty(bootstrapOptions, `providers`, `importProvidersFrom(TuiRootModule, BrowserAnimationsModule)`);
|
98
|
+
}
|
99
|
+
[...modules, { name: `importProvidersFrom`, packageName: `@angular/core` }].forEach(({ name, packageName }) => {
|
100
|
+
add_unique_import_1.addUniqueImport(bootstrapOptions.getSourceFile().getFilePath(), name, packageName);
|
101
|
+
});
|
102
|
+
}
|
103
|
+
function addMainModuleToRootComponent({ mainClass, options, context, }) {
|
104
|
+
const rootComponentPath = mainClass.getSourceFile().getFilePath();
|
105
|
+
const modules = getModules(options);
|
106
|
+
modules.forEach(({ name, packageName }) => {
|
107
|
+
add_import_to_component_1.addImportToComponent(mainClass, name);
|
108
|
+
add_unique_import_1.addUniqueImport(rootComponentPath, name, packageName);
|
109
|
+
});
|
110
|
+
context.logger.info(`${modules.map(({ name }) => name)} was added to ${rootComponentPath}`);
|
111
|
+
}
|
112
|
+
function getModules(options, extraModules) {
|
113
|
+
return [
|
114
|
+
...(extraModules || []),
|
115
|
+
modules_1.MAIN_MODULE,
|
116
|
+
...(options.addDialogsModule ? modules_1.DIALOG_MODULES : []),
|
117
|
+
...(options.addAlertModule ? modules_1.ALERT_MODULES : []),
|
118
|
+
];
|
119
|
+
}
|
@@ -4,8 +4,11 @@ exports.wrapWithTuiRootComponent = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
5
5
|
const workspace_1 = require("@schematics/angular/utility/workspace");
|
6
6
|
const ng_morph_1 = require("ng-morph");
|
7
|
+
const constants_1 = require("../../constants");
|
8
|
+
const get_component_from_identifier_1 = require("../../utils/get-component-from-identifier");
|
7
9
|
const get_project_target_options_1 = require("../../utils/get-project-target-options");
|
8
10
|
const get_projects_1 = require("../../utils/get-projects");
|
11
|
+
const get_standalone_bootstrap_function_1 = require("../../utils/get-standalone-bootstrap-function");
|
9
12
|
function wrapWithTuiRootComponent(options) {
|
10
13
|
return (tree, context) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
11
14
|
const workspace = yield workspace_1.getWorkspace(tree);
|
@@ -14,7 +17,9 @@ function wrapWithTuiRootComponent(options) {
|
|
14
17
|
return;
|
15
18
|
}
|
16
19
|
const buildOptions = get_project_target_options_1.getProjectTargetOptions(project, `build`);
|
17
|
-
|
20
|
+
ng_morph_1.setActiveProject(ng_morph_1.createProject(tree, `/`, constants_1.ALL_FILES));
|
21
|
+
const appTemplatePath = getAppTemplatePath(buildOptions.main);
|
22
|
+
ng_morph_1.saveActiveProject();
|
18
23
|
if (!appTemplatePath) {
|
19
24
|
context.logger.error(`Could not find the default main template file for this project.`);
|
20
25
|
context.logger.info(`Consider manually wrapping content of your app with tui-root`);
|
@@ -44,24 +49,32 @@ function addTuiRootComponent(filePath, context, tree) {
|
|
44
49
|
tree.commitUpdate(recorder);
|
45
50
|
context.logger.info(`Content of the app was wrapped with tui-root component in ${filePath}`);
|
46
51
|
}
|
47
|
-
function getAppTemplatePath(
|
48
|
-
|
52
|
+
function getAppTemplatePath(mainPath) {
|
53
|
+
const standaloneBootstrapFunction = get_standalone_bootstrap_function_1.getStandaloneBootstrapFunction(mainPath);
|
54
|
+
if (standaloneBootstrapFunction) {
|
55
|
+
const [componentIdentifier] = standaloneBootstrapFunction.getArguments();
|
56
|
+
const component = get_component_from_identifier_1.getComponentFromIdentifier(componentIdentifier);
|
57
|
+
return component && getTemplatePathFromComponent(component);
|
58
|
+
}
|
49
59
|
const mainModule = ng_morph_1.getMainModule(mainPath);
|
50
|
-
const mainInitializer =
|
60
|
+
const mainInitializer = getTemplateInitializer(mainModule, `NgModule`, `declarations`);
|
51
61
|
if (!ng_morph_1.Node.isArrayLiteralExpression(mainInitializer)) {
|
52
62
|
return;
|
53
63
|
}
|
54
64
|
const appIdentifier = mainInitializer.getElements()[0];
|
55
65
|
const appComponent = appIdentifier.getDefinitionNodes()[0];
|
56
|
-
const
|
57
|
-
|
66
|
+
const templateUrlPath = getTemplatePathFromComponent(appComponent);
|
67
|
+
return templateUrlPath;
|
68
|
+
}
|
69
|
+
function getTemplatePathFromComponent(component) {
|
70
|
+
const templateInitializer = getTemplateInitializer(component, `Component`, `templateUrl`);
|
71
|
+
const appComponentPath = component.getSourceFile().getFilePath().split(`/`);
|
58
72
|
const templateUrlPath = `${appComponentPath
|
59
73
|
.splice(0, appComponentPath.length - 1)
|
60
74
|
.join(`/`)}/${templateInitializer === null || templateInitializer === void 0 ? void 0 : templateInitializer.getText().replace(/['"]/g, ``)}`;
|
61
|
-
ng_morph_1.saveActiveProject();
|
62
75
|
return templateUrlPath;
|
63
76
|
}
|
64
|
-
function
|
77
|
+
function getTemplateInitializer(classDeclaration, decoratorName, propertyName) {
|
65
78
|
const decorator = classDeclaration.getDecorator(decoratorName);
|
66
79
|
if (!decorator) {
|
67
80
|
return;
|
@@ -1,4 +1,4 @@
|
|
1
1
|
import { TuiSchema } from '../../ng-add/schema';
|
2
2
|
import { ReplacementConst } from '../interfaces/replacement-const';
|
3
|
-
export declare function replaceConstants(options: TuiSchema,
|
3
|
+
export declare function replaceConstants(options: TuiSchema, constants: readonly ReplacementConst[]): void;
|
4
4
|
export declare function replaceConst({ from, to }: ReplacementConst): void;
|
@@ -6,10 +6,10 @@ const add_unique_import_1 = require("../../utils/add-unique-import");
|
|
6
6
|
const colored_log_1 = require("../../utils/colored-log");
|
7
7
|
const get_named_import_references_1 = require("../../utils/get-named-import-references");
|
8
8
|
const import_manipulations_1 = require("../../utils/import-manipulations");
|
9
|
-
function replaceConstants(options,
|
9
|
+
function replaceConstants(options, constants) {
|
10
10
|
!options[`skip-logs`] &&
|
11
11
|
colored_log_1.infoLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} replacing constants...`);
|
12
|
-
|
12
|
+
constants.forEach(constToReplace => replaceConst(constToReplace));
|
13
13
|
!options[`skip-logs`] &&
|
14
14
|
colored_log_1.successLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SUCCESS_SYMBOL} constants replaced \n`);
|
15
15
|
}
|
@@ -1,2 +1,2 @@
|
|
1
1
|
import { ReplacementConst } from '../../interfaces/replacement-const';
|
2
|
-
export declare const
|
2
|
+
export declare const CONSTANTS_TO_REPLACE: ReplacementConst[];
|
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
4
|
-
exports.
|
3
|
+
exports.CONSTANTS_TO_REPLACE = void 0;
|
4
|
+
exports.CONSTANTS_TO_REPLACE = [
|
5
5
|
{
|
6
6
|
from: {
|
7
7
|
name: `EMPTY_VALIDATOR`,
|
@@ -182,18 +182,22 @@ exports.ENUMS_TO_REPLACE = [
|
|
182
182
|
Bittersweet: `support-06`,
|
183
183
|
Pinkie: `support-07`,
|
184
184
|
Charm: `support-08`,
|
185
|
+
// cspell:disable-next-line
|
185
186
|
Amethist: `support-09`,
|
186
187
|
Helio: `support-10`,
|
187
188
|
Lilac: `support-11`,
|
188
189
|
Malibu: `support-12`,
|
189
190
|
Havelock: `support-13`,
|
191
|
+
// cspell:disable-next-line
|
190
192
|
Picton: `support-14`,
|
191
193
|
Mint: `support-15`,
|
192
194
|
Fountain: `support-16`,
|
195
|
+
// cspell:disable-next-line
|
193
196
|
Puertorico: `support-17`,
|
194
197
|
Bay: `support-18`,
|
195
198
|
Forest: `support-19`,
|
196
199
|
York: `support-20`,
|
200
|
+
// cspell:disable-next-line
|
197
201
|
Feijoa: `support-21`,
|
198
202
|
},
|
199
203
|
keepAsType: false,
|
@@ -19,7 +19,7 @@ const replace_services_1 = require("../steps/replace-services");
|
|
19
19
|
const show_warnings_1 = require("../steps/show-warnings");
|
20
20
|
const get_file_system_1 = require("../utils/get-file-system");
|
21
21
|
const migrate_expand_templates_1 = require("../v3-5/steps/migrate-expand-templates");
|
22
|
-
const
|
22
|
+
const constants_1 = require("./constants/constants");
|
23
23
|
const enums_1 = require("./constants/enums");
|
24
24
|
const modules_1 = require("./constants/modules");
|
25
25
|
const services_1 = require("./constants/services");
|
@@ -68,7 +68,7 @@ function main(options) {
|
|
68
68
|
replace_deep_import_1.replaceDeepImports(options);
|
69
69
|
replace_enums_1.replaceEnums(options, enums_1.ENUMS_TO_REPLACE);
|
70
70
|
rename_types_1.renameTypes(options, types_1.TYPES_TO_RENAME);
|
71
|
-
replace_const_1.replaceConstants(options,
|
71
|
+
replace_const_1.replaceConstants(options, constants_1.CONSTANTS_TO_REPLACE);
|
72
72
|
replace_services_1.replaceServices(options, services_1.SERVICES_TO_REPLACE);
|
73
73
|
replace_styles_1.replaceStyles();
|
74
74
|
show_warnings_1.showWarnings(context, warnings_1.MIGRATION_WARNINGS);
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { UpdateRecorder } from '@angular-devkit/schematics';
|
2
2
|
import { DevkitFileSystem } from 'ng-morph/project/classes/devkit-file-system';
|
3
|
-
import { TemplateResource } from '../../interfaces/template-
|
3
|
+
import { TemplateResource } from '../../interfaces/template-resource';
|
4
4
|
export declare function migratePolymorpheus({ resource, fileSystem, recorder, }: {
|
5
5
|
resource: TemplateResource;
|
6
6
|
recorder: UpdateRecorder;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { UpdateRecorder } from '@angular-devkit/schematics';
|
2
2
|
import { DevkitFileSystem } from 'ng-morph/project/classes/devkit-file-system';
|
3
|
-
import { TemplateResource } from '../../interfaces/template-
|
3
|
+
import { TemplateResource } from '../../interfaces/template-resource';
|
4
4
|
export declare function migrateTextfieldController({ resource, fileSystem, recorder, }: {
|
5
5
|
resource: TemplateResource;
|
6
6
|
recorder: UpdateRecorder;
|