@taiga-ui/cdk 2.50.1 → 2.50.2
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-utils-dom.umd.js +0 -46
- package/bundles/taiga-ui-cdk-utils-dom.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-utils-dom.umd.min.js +1 -1
- package/bundles/taiga-ui-cdk-utils-dom.umd.min.js.map +1 -1
- package/esm2015/utils/dom/index.js +1 -3
- package/esm5/utils/dom/index.js +1 -3
- package/fesm2015/taiga-ui-cdk-utils-dom.js +1 -43
- package/fesm2015/taiga-ui-cdk-utils-dom.js.map +1 -1
- package/fesm5/taiga-ui-cdk-utils-dom.js +1 -45
- package/fesm5/taiga-ui-cdk-utils-dom.js.map +1 -1
- package/package.json +1 -1
- package/schematics/ng-update/constants/consts.js +10 -0
- package/schematics/ng-update/steps/migrate-sliders/index.js +2 -0
- package/schematics/ng-update/steps/migrate-sliders/migrate-input-range.d.ts +2 -0
- package/schematics/ng-update/steps/migrate-sliders/migrate-input-range.js +80 -0
- package/schematics/ng-update/steps/migrate-templates.js +29 -9
- package/utils/dom/index.d.ts +0 -2
- package/utils/dom/taiga-ui-cdk-utils-dom.metadata.json +1 -1
- package/esm2015/utils/dom/get-viewport-height.js +0 -21
- package/esm2015/utils/dom/get-viewport-width.js +0 -21
- package/esm5/utils/dom/get-viewport-height.js +0 -22
- package/esm5/utils/dom/get-viewport-width.js +0 -22
- package/utils/dom/get-viewport-height.d.ts +0 -18
- package/utils/dom/get-viewport-width.d.ts +0 -18
|
@@ -181,50 +181,6 @@
|
|
|
181
181
|
return getScrollParent(element.parentElement, vertical);
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
/**
|
|
185
|
-
* @description:
|
|
186
|
-
* Cross-browser @media (height)
|
|
187
|
-
*
|
|
188
|
-
* 1. window.innerWidth
|
|
189
|
-
* 1.1. gets CSS viewport @media (height) which include scrollbars
|
|
190
|
-
* 1.2. initial-scale and zoom variations may cause mobile values to
|
|
191
|
-
* wrongly scale down to what PPK calls the visual
|
|
192
|
-
* viewport and be smaller than the @media values
|
|
193
|
-
* 1.3. zoom may cause values to be 1px off due to native rounding
|
|
194
|
-
*
|
|
195
|
-
* 2. document.documentElement.clientHeight
|
|
196
|
-
* 2.1. equals CSS viewport width minus scrollbar width
|
|
197
|
-
* 2.2. matches @media (height) when there is no scrollbar
|
|
198
|
-
* 2.3. available cross-browser
|
|
199
|
-
* 2.4. inaccurate if doctype is missing
|
|
200
|
-
*/
|
|
201
|
-
function tuiGetViewportHeight(_a) {
|
|
202
|
-
var document = _a.document, innerHeight = _a.innerHeight;
|
|
203
|
-
return Math.max(document.documentElement.clientHeight || 0, innerHeight || 0);
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* @description:
|
|
208
|
-
* Cross-browser @media (width)
|
|
209
|
-
*
|
|
210
|
-
* 1. window.innerWidth
|
|
211
|
-
* 1.1. gets CSS viewport @media (width) which include scrollbars
|
|
212
|
-
* 1.2. initial-scale and zoom variations may cause mobile values to
|
|
213
|
-
* wrongly scale down to what PPK calls the visual
|
|
214
|
-
* viewport and be smaller than the @media values
|
|
215
|
-
* 1.3. zoom may cause values to be 1px off due to native rounding
|
|
216
|
-
*
|
|
217
|
-
* 2. document.documentElement.clientWidth
|
|
218
|
-
* 2.1. equals CSS viewport width minus scrollbar width
|
|
219
|
-
* 2.2. matches @media (width) when there is no scrollbar
|
|
220
|
-
* 2.3. available cross-browser
|
|
221
|
-
* 2.4. inaccurate if doctype is missing
|
|
222
|
-
*/
|
|
223
|
-
function tuiGetViewportWidth(_a) {
|
|
224
|
-
var document = _a.document, innerWidth = _a.innerWidth;
|
|
225
|
-
return Math.max(document.documentElement.clientWidth || 0, innerWidth || 0);
|
|
226
|
-
}
|
|
227
|
-
|
|
228
184
|
function isCurrentTarget(_a) {
|
|
229
185
|
var target = _a.target, currentTarget = _a.currentTarget;
|
|
230
186
|
return target === currentTarget;
|
|
@@ -264,8 +220,6 @@
|
|
|
264
220
|
exports.isInsideIframe = isInsideIframe;
|
|
265
221
|
exports.isNodeIn = isNodeIn;
|
|
266
222
|
exports.tuiCustomEvent = tuiCustomEvent;
|
|
267
|
-
exports.tuiGetViewportHeight = tuiGetViewportHeight;
|
|
268
|
-
exports.tuiGetViewportWidth = tuiGetViewportWidth;
|
|
269
223
|
|
|
270
224
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
271
225
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-cdk-utils-dom.umd.js","sources":["ng://@taiga-ui/cdk/utils/dom/can-scroll.ts","ng://@taiga-ui/cdk/utils/dom/contains-or-after.ts","ng://@taiga-ui/cdk/utils/dom/custom-event.ts","ng://@taiga-ui/cdk/utils/dom/get-actual-target.ts","ng://@taiga-ui/cdk/utils/dom/get-clipboard-data-text.ts","ng://@taiga-ui/cdk/utils/dom/get-closest-element.ts","ng://@taiga-ui/cdk/utils/dom/get-document-or-shadow-root.ts","ng://@taiga-ui/cdk/utils/dom/get-element-obscurers.ts","ng://@taiga-ui/cdk/utils/dom/get-element-offset.ts","ng://@taiga-ui/cdk/utils/dom/get-scroll-parent.ts","ng://@taiga-ui/cdk/utils/dom/get-viewport-height.ts","ng://@taiga-ui/cdk/utils/dom/get-viewport-width.ts","ng://@taiga-ui/cdk/utils/dom/is-current-target.ts","ng://@taiga-ui/cdk/utils/dom/is-inside-iframe.ts","ng://@taiga-ui/cdk/utils/dom/is-node-in.ts"],"sourcesContent":["export function canScroll(\n element: Element,\n rootElement: Element,\n vertical: boolean,\n scrollEnd: boolean,\n): boolean {\n return vertical\n ? canScrollVertical(element, rootElement, scrollEnd)\n : canScrollHorizontal(element, rootElement, scrollEnd);\n}\n\nfunction canScrollVertical(\n element: Element,\n rootElement: Element,\n scrollEnd: boolean,\n): boolean {\n let currentElement = element;\n\n while (currentElement !== rootElement.parentElement) {\n if (\n (Math.floor(currentElement.scrollTop) > 0 && !scrollEnd) ||\n (Math.ceil(currentElement.scrollTop + currentElement.clientHeight) <\n currentElement.scrollHeight &&\n scrollEnd)\n ) {\n return true;\n }\n\n if (currentElement.parentElement) {\n currentElement = currentElement.parentElement;\n } else {\n return false;\n }\n }\n\n return false;\n}\n\nfunction canScrollHorizontal(\n element: Element,\n rootElement: Element,\n scrollEnd: boolean,\n): boolean {\n let currentElement = element;\n\n while (currentElement !== rootElement.parentElement) {\n if (\n (Math.floor(currentElement.scrollLeft) > 0 && !scrollEnd) ||\n (Math.ceil(currentElement.scrollLeft + currentElement.clientWidth) <\n currentElement.scrollWidth &&\n scrollEnd)\n ) {\n return true;\n }\n\n if (currentElement.parentElement) {\n currentElement = currentElement.parentElement;\n } else {\n return false;\n }\n }\n\n return false;\n}\n","export function containsOrAfter(current: Node, node: Node): boolean {\n return (\n current.contains(node) ||\n !!(node.compareDocumentPosition(current) & Node.DOCUMENT_POSITION_PRECEDING)\n );\n}\n","/** @deprecated only needed for IE, remove in 3.0 */\nexport function tuiCustomEvent<T = null>(\n name: string,\n {bubbles = false, cancelable = false, detail = null}: CustomEventInit<T | null> = {},\n documentRef: Document,\n): CustomEvent {\n if (typeof CustomEvent === 'function') {\n return new CustomEvent(name, {bubbles, cancelable, detail});\n }\n\n const customEvent = documentRef.createEvent('CustomEvent');\n\n customEvent.initCustomEvent(name, bubbles, cancelable, detail);\n\n return customEvent;\n}\n","/**\n * Gets actual target from open Shadow DOM if event happened within it\n */\nexport function getActualTarget(event: Event): Node {\n if ('composedPath' in event) {\n return (event as any).composedPath()[0];\n }\n\n return (event as any).target;\n}\n","const DEFAULT_FORMAT = 'text/plain';\n\n/**\n * Gets text from data of clipboardEvent, it also works in IE and Edge browsers\n */\nexport function getClipboardDataText(\n event: ClipboardEvent,\n format: string = DEFAULT_FORMAT,\n): string {\n return 'clipboardData' in event && event.clipboardData !== null\n ? event.clipboardData.getData(format) ||\n event.clipboardData.getData(DEFAULT_FORMAT)\n : (event as any).target.ownerDocument.defaultView.clipboardData.getData('text');\n}\n","/**\n * Gets closest element by selector i.e. {@link Element.closest}\n * @deprecated only needed for IE, remove in 3.0\n */\nexport function getClosestElement(element: Element, selector: string): Element | null {\n const closest = Element.prototype.closest;\n\n if (closest) {\n return closest.call(element, selector);\n }\n\n const matchesSelector =\n Element.prototype.matches || (Element.prototype as any).msMatchesSelector;\n\n do {\n if (matchesSelector.call(element, selector)) {\n return element;\n }\n\n (element as Element | null) = element.parentElement;\n } while (element !== null);\n\n return null;\n}\n","export function getDocumentOrShadowRoot(node: Node): DocumentOrShadowRoot {\n return 'getRootNode' in node && node.isConnected\n ? (node.getRootNode() as Document)\n : node.ownerDocument!;\n}\n","import {clamp} from '@taiga-ui/cdk/utils/math';\nimport {isPresent} from '@taiga-ui/cdk/utils/miscellaneous';\n\nimport {getDocumentOrShadowRoot} from './get-document-or-shadow-root';\n\n/**\n * Returns array of Elements covering edges of given element or null if at least one edge middle point is visible\n *\n * CAUTION: Empty array means element if offscreen i.e. covered by no elements, rather than not covered\n */\nexport function getElementObscurers(element: Element): readonly Element[] | null {\n const {ownerDocument} = element;\n\n if (!ownerDocument || !ownerDocument.defaultView) {\n return null;\n }\n\n const {innerWidth, innerHeight} = ownerDocument.defaultView;\n const documentRef = getDocumentOrShadowRoot(element);\n const rect = element.getBoundingClientRect();\n const left = clamp(Math.round(rect.left) + 2, 0, innerWidth);\n const top = clamp(Math.round(rect.top) + 2, 0, innerHeight);\n const right = clamp(Math.round(rect.right) - 2, 0, innerWidth);\n const bottom = clamp(Math.round(rect.bottom) - 2, 0, innerHeight);\n const horizontalMiddle = clamp(Math.round(rect.left + rect.width / 2), 0, innerWidth);\n const verticalMiddle = clamp(Math.round(rect.top + rect.height / 2), 0, innerHeight);\n const elements = [\n documentRef.elementFromPoint(horizontalMiddle, top),\n documentRef.elementFromPoint(horizontalMiddle, bottom),\n documentRef.elementFromPoint(left, verticalMiddle),\n documentRef.elementFromPoint(right, verticalMiddle),\n ];\n const nonNull = elements.filter(isPresent);\n\n if (!nonNull.length) {\n return nonNull;\n }\n\n const filtered = nonNull.filter(el => !element.contains(el));\n\n return filtered.length === 4 ? filtered : null;\n}\n","import {tuiAssert} from '@taiga-ui/cdk/classes';\n\n/**\n * Calculates offset for an element relative to it's parent several levels above\n *\n * @param host parent element\n * @param element\n * @return object with offsetTop and offsetLeft number properties\n */\nexport function getElementOffset(\n host: Element,\n element: HTMLElement,\n): {offsetTop: number; offsetLeft: number} {\n tuiAssert.assert(host.contains(element), 'Host must contain element');\n\n let {offsetTop, offsetLeft, offsetParent} = element;\n\n // TODO: iframe warning\n while (offsetParent && offsetParent instanceof HTMLElement && offsetParent !== host) {\n offsetTop += offsetParent.offsetTop;\n offsetLeft += offsetParent.offsetLeft;\n offsetParent = offsetParent.offsetParent;\n }\n\n return {offsetTop, offsetLeft};\n}\n","/**\n * Finds nearest parent with scroll in it\n *\n * @param element initial element\n * @param vertical flag for orientation of scroll\n */\nexport function getScrollParent(\n element: Element | null,\n vertical: boolean = true,\n): Element | null {\n if (element === null) {\n return null;\n }\n\n if (vertical && element.scrollHeight > element.clientHeight) {\n return element;\n }\n\n if (!vertical && element.scrollWidth > element.clientWidth) {\n return element;\n }\n\n return getScrollParent(element.parentElement, vertical);\n}\n","/**\n * @description:\n * Cross-browser @media (height)\n *\n * 1. window.innerWidth\n * 1.1. gets CSS viewport @media (height) which include scrollbars\n * 1.2. initial-scale and zoom variations may cause mobile values to\n * wrongly scale down to what PPK calls the visual\n * viewport and be smaller than the @media values\n * 1.3. zoom may cause values to be 1px off due to native rounding\n *\n * 2. document.documentElement.clientHeight\n * 2.1. equals CSS viewport width minus scrollbar width\n * 2.2. matches @media (height) when there is no scrollbar\n * 2.3. available cross-browser\n * 2.4. inaccurate if doctype is missing\n */\nexport function tuiGetViewportHeight({document, innerHeight}: Window): number {\n return Math.max(document.documentElement.clientHeight || 0, innerHeight || 0);\n}\n","/**\n * @description:\n * Cross-browser @media (width)\n *\n * 1. window.innerWidth\n * 1.1. gets CSS viewport @media (width) which include scrollbars\n * 1.2. initial-scale and zoom variations may cause mobile values to\n * wrongly scale down to what PPK calls the visual\n * viewport and be smaller than the @media values\n * 1.3. zoom may cause values to be 1px off due to native rounding\n *\n * 2. document.documentElement.clientWidth\n * 2.1. equals CSS viewport width minus scrollbar width\n * 2.2. matches @media (width) when there is no scrollbar\n * 2.3. available cross-browser\n * 2.4. inaccurate if doctype is missing\n */\nexport function tuiGetViewportWidth({document, innerWidth}: Window): number {\n return Math.max(document.documentElement.clientWidth || 0, innerWidth || 0);\n}\n","export function isCurrentTarget({target, currentTarget}: Event): boolean {\n return target === currentTarget;\n}\n","/**\n * Checks if an app is running inside <iframe /> tag\n */\nexport function isInsideIframe(windowRef: Window): boolean {\n return windowRef.parent !== windowRef;\n}\n","import {getClosestElement} from './get-closest-element';\n\n/**\n * Checks if node is inside a specific selector\n *\n * @param node\n * @param selector\n * @return true if node is inside a particular selector\n */\nexport function isNodeIn(node: Node, selector: string): boolean {\n return node.nodeType === Node.TEXT_NODE\n ? !!node.parentElement && !!getClosestElement(node.parentElement, selector)\n : node.nodeType === Node.ELEMENT_NODE &&\n !!getClosestElement(node as Element, selector);\n}\n"],"names":["clamp","isPresent","tuiAssert"],"mappings":";;;;;;aAAgB,SAAS,CACrB,OAAgB,EAChB,WAAoB,EACpB,QAAiB,EACjB,SAAkB;QAElB,OAAO,QAAQ;cACT,iBAAiB,CAAC,OAAO,EAAE,WAAW,EAAE,SAAS,CAAC;cAClD,mBAAmB,CAAC,OAAO,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;IAC/D,CAAC;IAED,SAAS,iBAAiB,CACtB,OAAgB,EAChB,WAAoB,EACpB,SAAkB;QAElB,IAAI,cAAc,GAAG,OAAO,CAAC;QAE7B,OAAO,cAAc,KAAK,WAAW,CAAC,aAAa,EAAE;YACjD,IACI,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,C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AS,CAAC;IAC1C;;ICHA;;;;;;;aAOgB,QAAQ,CAAC,IAAU,EAAE,QAAgB;QACjD,OAAO,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,SAAS;cACjC,CAAC,CAAC,IAAI,CAAC,aAAa,IAAI,CAAC,CAAC,iBAAiB,CAAC,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC;cACzE,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,YAAY;gBAC/B,CAAC,CAAC,iBAAiB,CAAC,IAAe,EAAE,QAAQ,CAAC,CAAC;IAC7D;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"taiga-ui-cdk-utils-dom.umd.js","sources":["ng://@taiga-ui/cdk/utils/dom/can-scroll.ts","ng://@taiga-ui/cdk/utils/dom/contains-or-after.ts","ng://@taiga-ui/cdk/utils/dom/custom-event.ts","ng://@taiga-ui/cdk/utils/dom/get-actual-target.ts","ng://@taiga-ui/cdk/utils/dom/get-clipboard-data-text.ts","ng://@taiga-ui/cdk/utils/dom/get-closest-element.ts","ng://@taiga-ui/cdk/utils/dom/get-document-or-shadow-root.ts","ng://@taiga-ui/cdk/utils/dom/get-element-obscurers.ts","ng://@taiga-ui/cdk/utils/dom/get-element-offset.ts","ng://@taiga-ui/cdk/utils/dom/get-scroll-parent.ts","ng://@taiga-ui/cdk/utils/dom/is-current-target.ts","ng://@taiga-ui/cdk/utils/dom/is-inside-iframe.ts","ng://@taiga-ui/cdk/utils/dom/is-node-in.ts"],"sourcesContent":["export function canScroll(\n element: Element,\n rootElement: Element,\n vertical: boolean,\n scrollEnd: boolean,\n): boolean {\n return vertical\n ? canScrollVertical(element, rootElement, scrollEnd)\n : canScrollHorizontal(element, rootElement, scrollEnd);\n}\n\nfunction canScrollVertical(\n element: Element,\n rootElement: Element,\n scrollEnd: boolean,\n): boolean {\n let currentElement = element;\n\n while (currentElement !== rootElement.parentElement) {\n if (\n (Math.floor(currentElement.scrollTop) > 0 && !scrollEnd) ||\n (Math.ceil(currentElement.scrollTop + currentElement.clientHeight) <\n currentElement.scrollHeight &&\n scrollEnd)\n ) {\n return true;\n }\n\n if (currentElement.parentElement) {\n currentElement = currentElement.parentElement;\n } else {\n return false;\n }\n }\n\n return false;\n}\n\nfunction canScrollHorizontal(\n element: Element,\n rootElement: Element,\n scrollEnd: boolean,\n): boolean {\n let currentElement = element;\n\n while (currentElement !== rootElement.parentElement) {\n if (\n (Math.floor(currentElement.scrollLeft) > 0 && !scrollEnd) ||\n (Math.ceil(currentElement.scrollLeft + currentElement.clientWidth) <\n currentElement.scrollWidth &&\n scrollEnd)\n ) {\n return true;\n }\n\n if (currentElement.parentElement) {\n currentElement = currentElement.parentElement;\n } else {\n return false;\n }\n }\n\n return false;\n}\n","export function containsOrAfter(current: Node, node: Node): boolean {\n return (\n current.contains(node) ||\n !!(node.compareDocumentPosition(current) & Node.DOCUMENT_POSITION_PRECEDING)\n );\n}\n","/** @deprecated only needed for IE, remove in 3.0 */\nexport function tuiCustomEvent<T = null>(\n name: string,\n {bubbles = false, cancelable = false, detail = null}: CustomEventInit<T | null> = {},\n documentRef: Document,\n): CustomEvent {\n if (typeof CustomEvent === 'function') {\n return new CustomEvent(name, {bubbles, cancelable, detail});\n }\n\n const customEvent = documentRef.createEvent('CustomEvent');\n\n customEvent.initCustomEvent(name, bubbles, cancelable, detail);\n\n return customEvent;\n}\n","/**\n * Gets actual target from open Shadow DOM if event happened within it\n */\nexport function getActualTarget(event: Event): Node {\n if ('composedPath' in event) {\n return (event as any).composedPath()[0];\n }\n\n return (event as any).target;\n}\n","const DEFAULT_FORMAT = 'text/plain';\n\n/**\n * Gets text from data of clipboardEvent, it also works in IE and Edge browsers\n */\nexport function getClipboardDataText(\n event: ClipboardEvent,\n format: string = DEFAULT_FORMAT,\n): string {\n return 'clipboardData' in event && event.clipboardData !== null\n ? event.clipboardData.getData(format) ||\n event.clipboardData.getData(DEFAULT_FORMAT)\n : (event as any).target.ownerDocument.defaultView.clipboardData.getData('text');\n}\n","/**\n * Gets closest element by selector i.e. {@link Element.closest}\n * @deprecated only needed for IE, remove in 3.0\n */\nexport function getClosestElement(element: Element, selector: string): Element | null {\n const closest = Element.prototype.closest;\n\n if (closest) {\n return closest.call(element, selector);\n }\n\n const matchesSelector =\n Element.prototype.matches || (Element.prototype as any).msMatchesSelector;\n\n do {\n if (matchesSelector.call(element, selector)) {\n return element;\n }\n\n (element as Element | null) = element.parentElement;\n } while (element !== null);\n\n return null;\n}\n","export function getDocumentOrShadowRoot(node: Node): DocumentOrShadowRoot {\n return 'getRootNode' in node && node.isConnected\n ? (node.getRootNode() as Document)\n : node.ownerDocument!;\n}\n","import {clamp} from '@taiga-ui/cdk/utils/math';\nimport {isPresent} from '@taiga-ui/cdk/utils/miscellaneous';\n\nimport {getDocumentOrShadowRoot} from './get-document-or-shadow-root';\n\n/**\n * Returns array of Elements covering edges of given element or null if at least one edge middle point is visible\n *\n * CAUTION: Empty array means element if offscreen i.e. covered by no elements, rather than not covered\n */\nexport function getElementObscurers(element: Element): readonly Element[] | null {\n const {ownerDocument} = element;\n\n if (!ownerDocument || !ownerDocument.defaultView) {\n return null;\n }\n\n const {innerWidth, innerHeight} = ownerDocument.defaultView;\n const documentRef = getDocumentOrShadowRoot(element);\n const rect = element.getBoundingClientRect();\n const left = clamp(Math.round(rect.left) + 2, 0, innerWidth);\n const top = clamp(Math.round(rect.top) + 2, 0, innerHeight);\n const right = clamp(Math.round(rect.right) - 2, 0, innerWidth);\n const bottom = clamp(Math.round(rect.bottom) - 2, 0, innerHeight);\n const horizontalMiddle = clamp(Math.round(rect.left + rect.width / 2), 0, innerWidth);\n const verticalMiddle = clamp(Math.round(rect.top + rect.height / 2), 0, innerHeight);\n const elements = [\n documentRef.elementFromPoint(horizontalMiddle, top),\n documentRef.elementFromPoint(horizontalMiddle, bottom),\n documentRef.elementFromPoint(left, verticalMiddle),\n documentRef.elementFromPoint(right, verticalMiddle),\n ];\n const nonNull = elements.filter(isPresent);\n\n if (!nonNull.length) {\n return nonNull;\n }\n\n const filtered = nonNull.filter(el => !element.contains(el));\n\n return filtered.length === 4 ? filtered : null;\n}\n","import {tuiAssert} from '@taiga-ui/cdk/classes';\n\n/**\n * Calculates offset for an element relative to it's parent several levels above\n *\n * @param host parent element\n * @param element\n * @return object with offsetTop and offsetLeft number properties\n */\nexport function getElementOffset(\n host: Element,\n element: HTMLElement,\n): {offsetTop: number; offsetLeft: number} {\n tuiAssert.assert(host.contains(element), 'Host must contain element');\n\n let {offsetTop, offsetLeft, offsetParent} = element;\n\n // TODO: iframe warning\n while (offsetParent && offsetParent instanceof HTMLElement && offsetParent !== host) {\n offsetTop += offsetParent.offsetTop;\n offsetLeft += offsetParent.offsetLeft;\n offsetParent = offsetParent.offsetParent;\n }\n\n return {offsetTop, offsetLeft};\n}\n","/**\n * Finds nearest parent with scroll in it\n *\n * @param element initial element\n * @param vertical flag for orientation of scroll\n */\nexport function getScrollParent(\n element: Element | null,\n vertical: boolean = true,\n): Element | null {\n if (element === null) {\n return null;\n }\n\n if (vertical && element.scrollHeight > element.clientHeight) {\n return element;\n }\n\n if (!vertical && element.scrollWidth > element.clientWidth) {\n return element;\n }\n\n return getScrollParent(element.parentElement, vertical);\n}\n","export function isCurrentTarget({target, currentTarget}: Event): boolean {\n return target === currentTarget;\n}\n","/**\n * Checks if an app is running inside <iframe /> tag\n */\nexport function isInsideIframe(windowRef: Window): boolean {\n return windowRef.parent !== windowRef;\n}\n","import {getClosestElement} from './get-closest-element';\n\n/**\n * Checks if node is inside a specific selector\n *\n * @param node\n * @param selector\n * @return true if node is inside a particular selector\n */\nexport function isNodeIn(node: Node, selector: string): boolean {\n return node.nodeType === Node.TEXT_NODE\n ? !!node.parentElement && !!getClosestElement(node.parentElement, selector)\n : node.nodeType === Node.ELEMENT_NODE &&\n !!getClosestElement(node as Element, selector);\n}\n"],"names":["clamp","isPresent","tuiAssert"],"mappings":";;;;;;aAAgB,SAAS,CACrB,OAAgB,EAChB,WA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AC;IAC1C;;ICHA;;;;;;;aAOgB,QAAQ,CAAC,IAAU,EAAE,QAAgB;QACjD,OAAO,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,SAAS;cACjC,CAAC,CAAC,IAAI,CAAC,aAAa,IAAI,CAAC,CAAC,iBAAiB,CAAC,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC;cACzE,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,YAAY;gBAC/B,CAAC,CAAC,iBAAiB,CAAC,IAAe,EAAE,QAAQ,CAAC,CAAC;IAC7D;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@taiga-ui/cdk/utils/math"),require("@taiga-ui/cdk/utils/miscellaneous"),require("@taiga-ui/cdk/classes")):"function"==typeof define&&define.amd?define("@taiga-ui/cdk/utils/dom",["exports","@taiga-ui/cdk/utils/math","@taiga-ui/cdk/utils/miscellaneous","@taiga-ui/cdk/classes"],e):e(((t=t||self)["taiga-ui"]=t["taiga-ui"]||{},t["taiga-ui"].cdk=t["taiga-ui"].cdk||{},t["taiga-ui"].cdk.utils=t["taiga-ui"].cdk.utils||{},t["taiga-ui"].cdk.utils.dom={}),t["taiga-ui"].cdk.utils.math,t["taiga-ui"].cdk.utils.miscellaneous,t["taiga-ui"].cdk.classes)}(this,(function(t,e,n,i){"use strict";function
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@taiga-ui/cdk/utils/math"),require("@taiga-ui/cdk/utils/miscellaneous"),require("@taiga-ui/cdk/classes")):"function"==typeof define&&define.amd?define("@taiga-ui/cdk/utils/dom",["exports","@taiga-ui/cdk/utils/math","@taiga-ui/cdk/utils/miscellaneous","@taiga-ui/cdk/classes"],e):e(((t=t||self)["taiga-ui"]=t["taiga-ui"]||{},t["taiga-ui"].cdk=t["taiga-ui"].cdk||{},t["taiga-ui"].cdk.utils=t["taiga-ui"].cdk.utils||{},t["taiga-ui"].cdk.utils.dom={}),t["taiga-ui"].cdk.utils.math,t["taiga-ui"].cdk.utils.miscellaneous,t["taiga-ui"].cdk.classes)}(this,(function(t,e,n,i){"use strict";function o(t,e){var n=Element.prototype.closest;if(n)return n.call(t,e);var i=Element.prototype.matches||Element.prototype.msMatchesSelector;do{if(i.call(t,e))return t;t=t.parentElement}while(null!==t);return null}function r(t){return"getRootNode"in t&&t.isConnected?t.getRootNode():t.ownerDocument}t.canScroll=function(t,e,n,i){return n?function(t,e,n){var i=t;for(;i!==e.parentElement;){if(Math.floor(i.scrollTop)>0&&!n||Math.ceil(i.scrollTop+i.clientHeight)<i.scrollHeight&&n)return!0;if(!i.parentElement)return!1;i=i.parentElement}return!1}(t,e,i):function(t,e,n){var i=t;for(;i!==e.parentElement;){if(Math.floor(i.scrollLeft)>0&&!n||Math.ceil(i.scrollLeft+i.clientWidth)<i.scrollWidth&&n)return!0;if(!i.parentElement)return!1;i=i.parentElement}return!1}(t,e,i)},t.containsOrAfter=function(t,e){return t.contains(e)||!!(e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_PRECEDING)},t.getActualTarget=function(t){return"composedPath"in t?t.composedPath()[0]:t.target},t.getClipboardDataText=function(t,e){return void 0===e&&(e="text/plain"),"clipboardData"in t&&null!==t.clipboardData?t.clipboardData.getData(e)||t.clipboardData.getData("text/plain"):t.target.ownerDocument.defaultView.clipboardData.getData("text")},t.getClosestElement=o,t.getDocumentOrShadowRoot=r,t.getElementObscurers=function(t){var i=t.ownerDocument;if(!i||!i.defaultView)return null;var o=i.defaultView,a=o.innerWidth,l=o.innerHeight,u=r(t),c=t.getBoundingClientRect(),s=e.clamp(Math.round(c.left)+2,0,a),f=e.clamp(Math.round(c.top)+2,0,l),d=e.clamp(Math.round(c.right)-2,0,a),m=e.clamp(Math.round(c.bottom)-2,0,l),p=e.clamp(Math.round(c.left+c.width/2),0,a),g=e.clamp(Math.round(c.top+c.height/2),0,l),h=[u.elementFromPoint(p,f),u.elementFromPoint(p,m),u.elementFromPoint(s,g),u.elementFromPoint(d,g)].filter(n.isPresent);if(!h.length)return h;var E=h.filter((function(e){return!t.contains(e)}));return 4===E.length?E:null},t.getElementOffset=function(t,e){i.tuiAssert.assert(t.contains(e),"Host must contain element");for(var n=e.offsetTop,o=e.offsetLeft,r=e.offsetParent;r&&r instanceof HTMLElement&&r!==t;)n+=r.offsetTop,o+=r.offsetLeft,r=r.offsetParent;return{offsetTop:n,offsetLeft:o}},t.getScrollParent=function t(e,n){return void 0===n&&(n=!0),null===e?null:n&&e.scrollHeight>e.clientHeight||!n&&e.scrollWidth>e.clientWidth?e:t(e.parentElement,n)},t.isCurrentTarget=function(t){return t.target===t.currentTarget},t.isInsideIframe=function(t){return t.parent!==t},t.isNodeIn=function(t,e){return t.nodeType===Node.TEXT_NODE?!!t.parentElement&&!!o(t.parentElement,e):t.nodeType===Node.ELEMENT_NODE&&!!o(t,e)},t.tuiCustomEvent=function(t,e,n){var i=void 0===e?{}:e,o=i.bubbles,r=void 0!==o&&o,a=i.cancelable,l=void 0!==a&&a,u=i.detail,c=void 0===u?null:u;if("function"==typeof CustomEvent)return new CustomEvent(t,{bubbles:r,cancelable:l,detail:c});var s=n.createEvent("CustomEvent");return s.initCustomEvent(t,r,l,c),s},Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
2
2
|
//# sourceMappingURL=taiga-ui-cdk-utils-dom.umd.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ng://@taiga-ui/cdk/utils/dom/get-closest-element.ts","ng://@taiga-ui/cdk/utils/dom/get-document-or-shadow-root.ts","ng://@taiga-ui/cdk/utils/dom/can-scroll.ts","ng://@taiga-ui/cdk/utils/dom/contains-or-after.ts","ng://@taiga-ui/cdk/utils/dom/get-actual-target.ts","ng://@taiga-ui/cdk/utils/dom/get-clipboard-data-text.ts","ng://@taiga-ui/cdk/utils/dom/get-element-obscurers.ts","ng://@taiga-ui/cdk/utils/dom/get-element-offset.ts","ng://@taiga-ui/cdk/utils/dom/get-scroll-parent.ts","ng://@taiga-ui/cdk/utils/dom/is-current-target.ts","ng://@taiga-ui/cdk/utils/dom/is-inside-iframe.ts","ng://@taiga-ui/cdk/utils/dom/is-node-in.ts","ng://@taiga-ui/cdk/utils/dom/custom-event.ts","ng://@taiga-ui/cdk/utils/dom/get-viewport-height.ts","ng://@taiga-ui/cdk/utils/dom/get-viewport-width.ts"],"names":["getClosestElement","element","selector","closest","Element","prototype","call","matchesSelector","matches","msMatchesSelector","parentElement","getDocumentOrShadowRoot","node","isConnected","getRootNode","ownerDocument","rootElement","vertical","scrollEnd","currentElement","Math","floor","scrollTop","ceil","clientHeight","scrollHeight","canScrollVertical","scrollLeft","clientWidth","scrollWidth","canScrollHorizontal","current","contains","compareDocumentPosition","Node","DOCUMENT_POSITION_PRECEDING","event","composedPath","target","format","clipboardData","getData","defaultView","_a","innerWidth","innerHeight","documentRef","rect","getBoundingClientRect","left","clamp","round","top","right","bottom","horizontalMiddle","width","verticalMiddle","height","nonNull","elementFromPoint","filter","isPresent","length","filtered","el","host","tuiAssert","assert","offsetTop","offsetLeft","offsetParent","HTMLElement","getScrollParent","currentTarget","windowRef","parent","nodeType","TEXT_NODE","ELEMENT_NODE","name","_b","_c","bubbles","_d","cancelable","_e","detail","CustomEvent","customEvent","createEvent","initCustomEvent","document","max","documentElement"],"mappings":"oqBAIgBA,EAAkBC,EAAkBC,GAChD,IAAMC,EAAUC,QAAQC,UAAUF,QAElC,GAAIA,EACA,OAAOA,EAAQG,KAAKL,EAASC,GAGjC,IAAMK,EACFH,QAAQC,UAAUG,SAAYJ,QAAQC,UAAkBI,kBAE5D,EAAG,CACC,GAAIF,EAAgBD,KAAKL,EAASC,GAC9B,OAAOD,EAGVA,EAA6BA,EAAQS,oBACrB,OAAZT,GAET,OAAO,cCtBKU,EAAwBC,GACpC,MAAO,gBAAiBA,GAAQA,EAAKC,YAC9BD,EAAKE,cACNF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4B,YAAc5B,EAAQ2B,YAHpC3B,EAOJwE,EAAgBxE,EAAQS,cAAeO,+BCtBlB0B,GAC5B,OAD6BA,EAAAL,SAAQK,EAAA+B,yCCGVC,GAC3B,OAAOA,EAAUC,SAAWD,uBCKP/D,EAAYV,GACjC,OAAOU,EAAKiE,WAAa3C,KAAK4C,YACtBlE,EAAKF,iBAAmBV,EAAkBY,EAAKF,cAAeR,GAChEU,EAAKiE,WAAa3C,KAAK6C,gBACjB/E,EAAkBY,EAAiBV,8BCX/C8E,EACArC,EACAG,OADAmC,OAAA,IAAAtC,EAAA,GAAAA,EAACuC,EAAAD,EAAAE,QAAAA,OAAA,IAAAD,GAAAA,EAAiBE,EAAAH,EAAAI,WAAAA,OAAA,IAAAD,GAAAA,EAAoBE,EAAAL,EAAAM,OAAAA,OAAA,IAAAD,EAAA,KAAAA,EAGtC,GAA2B,mBAAhBE,YACP,OAAO,IAAIA,YAAYR,EAAM,CAACG,QAAOA,EAAEE,WAAUA,EAAEE,OAAMA,IAG7D,IAAME,EAAc3C,EAAY4C,YAAY,eAI5C,OAFAD,EAAYE,gBAAgBX,EAAMG,EAASE,EAAYE,GAEhDE,mCCG0B9C,OAACiD,EAAAjD,EAAAiD,SAAU/C,EAAAF,EAAAE,YAC5C,OAAOzB,KAAKyE,IAAID,EAASE,gBAAgBtE,cAAgB,EAAGqB,GAAe,mCCD3CF,OAACiD,EAAAjD,EAAAiD,SAAUhD,EAAAD,EAAAC,WAC3C,OAAOxB,KAAKyE,IAAID,EAASE,gBAAgBlE,aAAe,EAAGgB,GAAc","sourcesContent":["/**\n * Gets closest element by selector i.e. {@link Element.closest}\n * @deprecated only needed for IE, remove in 3.0\n */\nexport function getClosestElement(element: Element, selector: string): Element | null {\n const closest = Element.prototype.closest;\n\n if (closest) {\n return closest.call(element, selector);\n }\n\n const matchesSelector =\n Element.prototype.matches || (Element.prototype as any).msMatchesSelector;\n\n do {\n if (matchesSelector.call(element, selector)) {\n return element;\n }\n\n (element as Element | null) = element.parentElement;\n } while (element !== null);\n\n return null;\n}\n","export function getDocumentOrShadowRoot(node: Node): DocumentOrShadowRoot {\n return 'getRootNode' in node && node.isConnected\n ? (node.getRootNode() as Document)\n : node.ownerDocument!;\n}\n","export function canScroll(\n element: Element,\n rootElement: Element,\n vertical: boolean,\n scrollEnd: boolean,\n): boolean {\n return vertical\n ? canScrollVertical(element, rootElement, scrollEnd)\n : canScrollHorizontal(element, rootElement, scrollEnd);\n}\n\nfunction canScrollVertical(\n element: Element,\n rootElement: Element,\n scrollEnd: boolean,\n): boolean {\n let currentElement = element;\n\n while (currentElement !== rootElement.parentElement) {\n if (\n (Math.floor(currentElement.scrollTop) > 0 && !scrollEnd) ||\n (Math.ceil(currentElement.scrollTop + currentElement.clientHeight) <\n currentElement.scrollHeight &&\n scrollEnd)\n ) {\n return true;\n }\n\n if (currentElement.parentElement) {\n currentElement = currentElement.parentElement;\n } else {\n return false;\n }\n }\n\n return false;\n}\n\nfunction canScrollHorizontal(\n element: Element,\n rootElement: Element,\n scrollEnd: boolean,\n): boolean {\n let currentElement = element;\n\n while (currentElement !== rootElement.parentElement) {\n if (\n (Math.floor(currentElement.scrollLeft) > 0 && !scrollEnd) ||\n (Math.ceil(currentElement.scrollLeft + currentElement.clientWidth) <\n currentElement.scrollWidth &&\n scrollEnd)\n ) {\n return true;\n }\n\n if (currentElement.parentElement) {\n currentElement = currentElement.parentElement;\n } else {\n return false;\n }\n }\n\n return false;\n}\n","export function containsOrAfter(current: Node, node: Node): boolean {\n return (\n current.contains(node) ||\n !!(node.compareDocumentPosition(current) & Node.DOCUMENT_POSITION_PRECEDING)\n );\n}\n","/**\n * Gets actual target from open Shadow DOM if event happened within it\n */\nexport function getActualTarget(event: Event): Node {\n if ('composedPath' in event) {\n return (event as any).composedPath()[0];\n }\n\n return (event as any).target;\n}\n","const DEFAULT_FORMAT = 'text/plain';\n\n/**\n * Gets text from data of clipboardEvent, it also works in IE and Edge browsers\n */\nexport function getClipboardDataText(\n event: ClipboardEvent,\n format: string = DEFAULT_FORMAT,\n): string {\n return 'clipboardData' in event && event.clipboardData !== null\n ? event.clipboardData.getData(format) ||\n event.clipboardData.getData(DEFAULT_FORMAT)\n : (event as any).target.ownerDocument.defaultView.clipboardData.getData('text');\n}\n","import {clamp} from '@taiga-ui/cdk/utils/math';\nimport {isPresent} from '@taiga-ui/cdk/utils/miscellaneous';\n\nimport {getDocumentOrShadowRoot} from './get-document-or-shadow-root';\n\n/**\n * Returns array of Elements covering edges of given element or null if at least one edge middle point is visible\n *\n * CAUTION: Empty array means element if offscreen i.e. covered by no elements, rather than not covered\n */\nexport function getElementObscurers(element: Element): readonly Element[] | null {\n const {ownerDocument} = element;\n\n if (!ownerDocument || !ownerDocument.defaultView) {\n return null;\n }\n\n const {innerWidth, innerHeight} = ownerDocument.defaultView;\n const documentRef = getDocumentOrShadowRoot(element);\n const rect = element.getBoundingClientRect();\n const left = clamp(Math.round(rect.left) + 2, 0, innerWidth);\n const top = clamp(Math.round(rect.top) + 2, 0, innerHeight);\n const right = clamp(Math.round(rect.right) - 2, 0, innerWidth);\n const bottom = clamp(Math.round(rect.bottom) - 2, 0, innerHeight);\n const horizontalMiddle = clamp(Math.round(rect.left + rect.width / 2), 0, innerWidth);\n const verticalMiddle = clamp(Math.round(rect.top + rect.height / 2), 0, innerHeight);\n const elements = [\n documentRef.elementFromPoint(horizontalMiddle, top),\n documentRef.elementFromPoint(horizontalMiddle, bottom),\n documentRef.elementFromPoint(left, verticalMiddle),\n documentRef.elementFromPoint(right, verticalMiddle),\n ];\n const nonNull = elements.filter(isPresent);\n\n if (!nonNull.length) {\n return nonNull;\n }\n\n const filtered = nonNull.filter(el => !element.contains(el));\n\n return filtered.length === 4 ? filtered : null;\n}\n","import {tuiAssert} from '@taiga-ui/cdk/classes';\n\n/**\n * Calculates offset for an element relative to it's parent several levels above\n *\n * @param host parent element\n * @param element\n * @return object with offsetTop and offsetLeft number properties\n */\nexport function getElementOffset(\n host: Element,\n element: HTMLElement,\n): {offsetTop: number; offsetLeft: number} {\n tuiAssert.assert(host.contains(element), 'Host must contain element');\n\n let {offsetTop, offsetLeft, offsetParent} = element;\n\n // TODO: iframe warning\n while (offsetParent && offsetParent instanceof HTMLElement && offsetParent !== host) {\n offsetTop += offsetParent.offsetTop;\n offsetLeft += offsetParent.offsetLeft;\n offsetParent = offsetParent.offsetParent;\n }\n\n return {offsetTop, offsetLeft};\n}\n","/**\n * Finds nearest parent with scroll in it\n *\n * @param element initial element\n * @param vertical flag for orientation of scroll\n */\nexport function getScrollParent(\n element: Element | null,\n vertical: boolean = true,\n): Element | null {\n if (element === null) {\n return null;\n }\n\n if (vertical && element.scrollHeight > element.clientHeight) {\n return element;\n }\n\n if (!vertical && element.scrollWidth > element.clientWidth) {\n return element;\n }\n\n return getScrollParent(element.parentElement, vertical);\n}\n","export function isCurrentTarget({target, currentTarget}: Event): boolean {\n return target === currentTarget;\n}\n","/**\n * Checks if an app is running inside <iframe /> tag\n */\nexport function isInsideIframe(windowRef: Window): boolean {\n return windowRef.parent !== windowRef;\n}\n","import {getClosestElement} from './get-closest-element';\n\n/**\n * Checks if node is inside a specific selector\n *\n * @param node\n * @param selector\n * @return true if node is inside a particular selector\n */\nexport function isNodeIn(node: Node, selector: string): boolean {\n return node.nodeType === Node.TEXT_NODE\n ? !!node.parentElement && !!getClosestElement(node.parentElement, selector)\n : node.nodeType === Node.ELEMENT_NODE &&\n !!getClosestElement(node as Element, selector);\n}\n","/** @deprecated only needed for IE, remove in 3.0 */\nexport function tuiCustomEvent<T = null>(\n name: string,\n {bubbles = false, cancelable = false, detail = null}: CustomEventInit<T | null> = {},\n documentRef: Document,\n): CustomEvent {\n if (typeof CustomEvent === 'function') {\n return new CustomEvent(name, {bubbles, cancelable, detail});\n }\n\n const customEvent = documentRef.createEvent('CustomEvent');\n\n customEvent.initCustomEvent(name, bubbles, cancelable, detail);\n\n return customEvent;\n}\n","/**\n * @description:\n * Cross-browser @media (height)\n *\n * 1. window.innerWidth\n * 1.1. gets CSS viewport @media (height) which include scrollbars\n * 1.2. initial-scale and zoom variations may cause mobile values to\n * wrongly scale down to what PPK calls the visual\n * viewport and be smaller than the @media values\n * 1.3. zoom may cause values to be 1px off due to native rounding\n *\n * 2. document.documentElement.clientHeight\n * 2.1. equals CSS viewport width minus scrollbar width\n * 2.2. matches @media (height) when there is no scrollbar\n * 2.3. available cross-browser\n * 2.4. inaccurate if doctype is missing\n */\nexport function tuiGetViewportHeight({document, innerHeight}: Window): number {\n return Math.max(document.documentElement.clientHeight || 0, innerHeight || 0);\n}\n","/**\n * @description:\n * Cross-browser @media (width)\n *\n * 1. window.innerWidth\n * 1.1. gets CSS viewport @media (width) which include scrollbars\n * 1.2. initial-scale and zoom variations may cause mobile values to\n * wrongly scale down to what PPK calls the visual\n * viewport and be smaller than the @media values\n * 1.3. zoom may cause values to be 1px off due to native rounding\n *\n * 2. document.documentElement.clientWidth\n * 2.1. equals CSS viewport width minus scrollbar width\n * 2.2. matches @media (width) when there is no scrollbar\n * 2.3. available cross-browser\n * 2.4. inaccurate if doctype is missing\n */\nexport function tuiGetViewportWidth({document, innerWidth}: Window): number {\n return Math.max(document.documentElement.clientWidth || 0, innerWidth || 0);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["ng://@taiga-ui/cdk/utils/dom/get-closest-element.ts","ng://@taiga-ui/cdk/utils/dom/get-document-or-shadow-root.ts","ng://@taiga-ui/cdk/utils/dom/can-scroll.ts","ng://@taiga-ui/cdk/utils/dom/contains-or-after.ts","ng://@taiga-ui/cdk/utils/dom/get-actual-target.ts","ng://@taiga-ui/cdk/utils/dom/get-clipboard-data-text.ts","ng://@taiga-ui/cdk/utils/dom/get-element-obscurers.ts","ng://@taiga-ui/cdk/utils/dom/get-element-offset.ts","ng://@taiga-ui/cdk/utils/dom/get-scroll-parent.ts","ng://@taiga-ui/cdk/utils/dom/is-current-target.ts","ng://@taiga-ui/cdk/utils/dom/is-inside-iframe.ts","ng://@taiga-ui/cdk/utils/dom/is-node-in.ts","ng://@taiga-ui/cdk/utils/dom/custom-event.ts"],"names":["getClosestElement","element","selector","closest","Element","prototype","call","matchesSelector","matches","msMatchesSelector","parentElement","getDocumentOrShadowRoot","node","isConnected","getRootNode","ownerDocument","rootElement","vertical","scrollEnd","currentElement","Math","floor","scrollTop","ceil","clientHeight","scrollHeight","canScrollVertical","scrollLeft","clientWidth","scrollWidth","canScrollHorizontal","current","contains","compareDocumentPosition","Node","DOCUMENT_POSITION_PRECEDING","event","composedPath","target","format","clipboardData","getData","defaultView","_a","innerWidth","innerHeight","documentRef","rect","getBoundingClientRect","left","clamp","round","top","right","bottom","horizontalMiddle","width","verticalMiddle","height","nonNull","elementFromPoint","filter","isPresent","length","filtered","el","host","tuiAssert","assert","offsetTop","offsetLeft","offsetParent","HTMLElement","getScrollParent","currentTarget","windowRef","parent","nodeType","TEXT_NODE","ELEMENT_NODE","name","_b","_c","bubbles","_d","cancelable","_e","detail","CustomEvent","customEvent","createEvent","initCustomEvent"],"mappings":"oqBAIgBA,EAAkBC,EAAkBC,GAChD,IAAMC,EAAUC,QAAQC,UAAUF,QAElC,GAAIA,EACA,OAAOA,EAAQG,KAAKL,EAASC,GAGjC,IAAMK,EACFH,QAAQC,UAAUG,SAAYJ,QAAQC,UAAkBI,kBAE5D,EAAG,CACC,GAAIF,EAAgBD,KAAKL,EAASC,GAC9B,OAAOD,EAGVA,EAA6BA,EAAQS,oBACrB,OAAZT,GAET,OAAO,cCtBKU,EAAwBC,GACpC,MAAO,gBAAiBA,GAAQA,EAAKC,YAC9BD,EAAKE,cACNF,EAAKG,mCCFXd,EACAe,EACAC,EACAC,GAEA,OAAOD,EAKX,SACIhB,EACAe,EACAE,GAEA,IAAIC,EAAiBlB,EAErB,KAAOkB,IAAmBH,EAAYN,eAAe,CACjD,GACKU,KAAKC,MAAMF,EAAeG,WAAa,IAAMJ,GAC7CE,KAAKG,KAAKJ,EAAeG,UAAYH,EAAeK,cACjDL,EAAeM,cACfP,EAEJ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eR,GAChEU,EAAKiE,WAAa3C,KAAK6C,gBACjB/E,EAAkBY,EAAiBV,8BCX/C8E,EACArC,EACAG,OADAmC,OAAA,IAAAtC,EAAA,GAAAA,EAACuC,EAAAD,EAAAE,QAAAA,OAAA,IAAAD,GAAAA,EAAiBE,EAAAH,EAAAI,WAAAA,OAAA,IAAAD,GAAAA,EAAoBE,EAAAL,EAAAM,OAAAA,OAAA,IAAAD,EAAA,KAAAA,EAGtC,GAA2B,mBAAhBE,YACP,OAAO,IAAIA,YAAYR,EAAM,CAACG,QAAOA,EAAEE,WAAUA,EAAEE,OAAMA,IAG7D,IAAME,EAAc3C,EAAY4C,YAAY,eAI5C,OAFAD,EAAYE,gBAAgBX,EAAMG,EAASE,EAAYE,GAEhDE","sourcesContent":["/**\n * Gets closest element by selector i.e. {@link Element.closest}\n * @deprecated only needed for IE, remove in 3.0\n */\nexport function getClosestElement(element: Element, selector: string): Element | null {\n const closest = Element.prototype.closest;\n\n if (closest) {\n return closest.call(element, selector);\n }\n\n const matchesSelector =\n Element.prototype.matches || (Element.prototype as any).msMatchesSelector;\n\n do {\n if (matchesSelector.call(element, selector)) {\n return element;\n }\n\n (element as Element | null) = element.parentElement;\n } while (element !== null);\n\n return null;\n}\n","export function getDocumentOrShadowRoot(node: Node): DocumentOrShadowRoot {\n return 'getRootNode' in node && node.isConnected\n ? (node.getRootNode() as Document)\n : node.ownerDocument!;\n}\n","export function canScroll(\n element: Element,\n rootElement: Element,\n vertical: boolean,\n scrollEnd: boolean,\n): boolean {\n return vertical\n ? canScrollVertical(element, rootElement, scrollEnd)\n : canScrollHorizontal(element, rootElement, scrollEnd);\n}\n\nfunction canScrollVertical(\n element: Element,\n rootElement: Element,\n scrollEnd: boolean,\n): boolean {\n let currentElement = element;\n\n while (currentElement !== rootElement.parentElement) {\n if (\n (Math.floor(currentElement.scrollTop) > 0 && !scrollEnd) ||\n (Math.ceil(currentElement.scrollTop + currentElement.clientHeight) <\n currentElement.scrollHeight &&\n scrollEnd)\n ) {\n return true;\n }\n\n if (currentElement.parentElement) {\n currentElement = currentElement.parentElement;\n } else {\n return false;\n }\n }\n\n return false;\n}\n\nfunction canScrollHorizontal(\n element: Element,\n rootElement: Element,\n scrollEnd: boolean,\n): boolean {\n let currentElement = element;\n\n while (currentElement !== rootElement.parentElement) {\n if (\n (Math.floor(currentElement.scrollLeft) > 0 && !scrollEnd) ||\n (Math.ceil(currentElement.scrollLeft + currentElement.clientWidth) <\n currentElement.scrollWidth &&\n scrollEnd)\n ) {\n return true;\n }\n\n if (currentElement.parentElement) {\n currentElement = currentElement.parentElement;\n } else {\n return false;\n }\n }\n\n return false;\n}\n","export function containsOrAfter(current: Node, node: Node): boolean {\n return (\n current.contains(node) ||\n !!(node.compareDocumentPosition(current) & Node.DOCUMENT_POSITION_PRECEDING)\n );\n}\n","/**\n * Gets actual target from open Shadow DOM if event happened within it\n */\nexport function getActualTarget(event: Event): Node {\n if ('composedPath' in event) {\n return (event as any).composedPath()[0];\n }\n\n return (event as any).target;\n}\n","const DEFAULT_FORMAT = 'text/plain';\n\n/**\n * Gets text from data of clipboardEvent, it also works in IE and Edge browsers\n */\nexport function getClipboardDataText(\n event: ClipboardEvent,\n format: string = DEFAULT_FORMAT,\n): string {\n return 'clipboardData' in event && event.clipboardData !== null\n ? event.clipboardData.getData(format) ||\n event.clipboardData.getData(DEFAULT_FORMAT)\n : (event as any).target.ownerDocument.defaultView.clipboardData.getData('text');\n}\n","import {clamp} from '@taiga-ui/cdk/utils/math';\nimport {isPresent} from '@taiga-ui/cdk/utils/miscellaneous';\n\nimport {getDocumentOrShadowRoot} from './get-document-or-shadow-root';\n\n/**\n * Returns array of Elements covering edges of given element or null if at least one edge middle point is visible\n *\n * CAUTION: Empty array means element if offscreen i.e. covered by no elements, rather than not covered\n */\nexport function getElementObscurers(element: Element): readonly Element[] | null {\n const {ownerDocument} = element;\n\n if (!ownerDocument || !ownerDocument.defaultView) {\n return null;\n }\n\n const {innerWidth, innerHeight} = ownerDocument.defaultView;\n const documentRef = getDocumentOrShadowRoot(element);\n const rect = element.getBoundingClientRect();\n const left = clamp(Math.round(rect.left) + 2, 0, innerWidth);\n const top = clamp(Math.round(rect.top) + 2, 0, innerHeight);\n const right = clamp(Math.round(rect.right) - 2, 0, innerWidth);\n const bottom = clamp(Math.round(rect.bottom) - 2, 0, innerHeight);\n const horizontalMiddle = clamp(Math.round(rect.left + rect.width / 2), 0, innerWidth);\n const verticalMiddle = clamp(Math.round(rect.top + rect.height / 2), 0, innerHeight);\n const elements = [\n documentRef.elementFromPoint(horizontalMiddle, top),\n documentRef.elementFromPoint(horizontalMiddle, bottom),\n documentRef.elementFromPoint(left, verticalMiddle),\n documentRef.elementFromPoint(right, verticalMiddle),\n ];\n const nonNull = elements.filter(isPresent);\n\n if (!nonNull.length) {\n return nonNull;\n }\n\n const filtered = nonNull.filter(el => !element.contains(el));\n\n return filtered.length === 4 ? filtered : null;\n}\n","import {tuiAssert} from '@taiga-ui/cdk/classes';\n\n/**\n * Calculates offset for an element relative to it's parent several levels above\n *\n * @param host parent element\n * @param element\n * @return object with offsetTop and offsetLeft number properties\n */\nexport function getElementOffset(\n host: Element,\n element: HTMLElement,\n): {offsetTop: number; offsetLeft: number} {\n tuiAssert.assert(host.contains(element), 'Host must contain element');\n\n let {offsetTop, offsetLeft, offsetParent} = element;\n\n // TODO: iframe warning\n while (offsetParent && offsetParent instanceof HTMLElement && offsetParent !== host) {\n offsetTop += offsetParent.offsetTop;\n offsetLeft += offsetParent.offsetLeft;\n offsetParent = offsetParent.offsetParent;\n }\n\n return {offsetTop, offsetLeft};\n}\n","/**\n * Finds nearest parent with scroll in it\n *\n * @param element initial element\n * @param vertical flag for orientation of scroll\n */\nexport function getScrollParent(\n element: Element | null,\n vertical: boolean = true,\n): Element | null {\n if (element === null) {\n return null;\n }\n\n if (vertical && element.scrollHeight > element.clientHeight) {\n return element;\n }\n\n if (!vertical && element.scrollWidth > element.clientWidth) {\n return element;\n }\n\n return getScrollParent(element.parentElement, vertical);\n}\n","export function isCurrentTarget({target, currentTarget}: Event): boolean {\n return target === currentTarget;\n}\n","/**\n * Checks if an app is running inside <iframe /> tag\n */\nexport function isInsideIframe(windowRef: Window): boolean {\n return windowRef.parent !== windowRef;\n}\n","import {getClosestElement} from './get-closest-element';\n\n/**\n * Checks if node is inside a specific selector\n *\n * @param node\n * @param selector\n * @return true if node is inside a particular selector\n */\nexport function isNodeIn(node: Node, selector: string): boolean {\n return node.nodeType === Node.TEXT_NODE\n ? !!node.parentElement && !!getClosestElement(node.parentElement, selector)\n : node.nodeType === Node.ELEMENT_NODE &&\n !!getClosestElement(node as Element, selector);\n}\n","/** @deprecated only needed for IE, remove in 3.0 */\nexport function tuiCustomEvent<T = null>(\n name: string,\n {bubbles = false, cancelable = false, detail = null}: CustomEventInit<T | null> = {},\n documentRef: Document,\n): CustomEvent {\n if (typeof CustomEvent === 'function') {\n return new CustomEvent(name, {bubbles, cancelable, detail});\n }\n\n const customEvent = documentRef.createEvent('CustomEvent');\n\n customEvent.initCustomEvent(name, bubbles, cancelable, detail);\n\n return customEvent;\n}\n"]}
|
|
@@ -8,9 +8,7 @@ export * from './get-document-or-shadow-root';
|
|
|
8
8
|
export * from './get-element-obscurers';
|
|
9
9
|
export * from './get-element-offset';
|
|
10
10
|
export * from './get-scroll-parent';
|
|
11
|
-
export * from './get-viewport-height';
|
|
12
|
-
export * from './get-viewport-width';
|
|
13
11
|
export * from './is-current-target';
|
|
14
12
|
export * from './is-inside-iframe';
|
|
15
13
|
export * from './is-node-in';
|
|
16
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
14
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290Ijoibmc6Ly9AdGFpZ2EtdWkvY2RrL3V0aWxzL2RvbS8iLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQW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GUtaW4nO1xuIl19
|
package/esm5/utils/dom/index.js
CHANGED
|
@@ -8,9 +8,7 @@ export * from './get-document-or-shadow-root';
|
|
|
8
8
|
export * from './get-element-obscurers';
|
|
9
9
|
export * from './get-element-offset';
|
|
10
10
|
export * from './get-scroll-parent';
|
|
11
|
-
export * from './get-viewport-height';
|
|
12
|
-
export * from './get-viewport-width';
|
|
13
11
|
export * from './is-current-target';
|
|
14
12
|
export * from './is-inside-iframe';
|
|
15
13
|
export * from './is-node-in';
|
|
16
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
14
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290Ijoibmc6Ly9AdGFpZ2EtdWkvY2RrL3V0aWxzL2RvbS8iLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsY0FBYyxDQUFDO0FBQzdCLGNBQWMscUJBQXFCLENBQUM7QUFDcEMsY0FBYyxnQkFBZ0IsQ0FBQztBQUMvQixjQUFjLHFCQUFxQixDQUFDO0FBQ3BDLGNBQWMsMkJBQTJCLENBQUM7QUFDMUMsY0FBYyx1QkFBdUIsQ0FBQztBQUN0QyxjQUFjLCtCQUErQixDQUFDO0FBQzlDLGNBQWMseUJBQXlCLENBQUM7QUFDeEMsY0FBYyxzQkFBc0IsQ0FBQztBQUNyQyxjQUFjLHFCQUFxQixDQUFDO0FBQ3BDLGNBQWMscUJBQXFCLENBQUM7QUFDcEMsY0FBYyxvQkFBb0IsQ0FBQztBQUNuQyxjQUFjLGNBQWMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCAqIGZyb20gJy4vY2FuLXNjcm9sbCc7XG5leHBvcnQgKiBmcm9tICcuL2NvbnRhaW5zLW9yLWFmdGVyJztcbmV4cG9ydCAqIGZyb20gJy4vY3VzdG9tLWV2ZW50JztcbmV4cG9ydCAqIGZyb20gJy4vZ2V0LWFjdHVhbC10YXJnZXQnO1xuZXhwb3J0ICogZnJvbSAnLi9nZXQtY2xpcGJvYXJkLWRhdGEtdGV4dCc7XG5leHBvcnQgKiBmcm9tICcuL2dldC1jbG9zZXN0LWVsZW1lbnQnO1xuZXhwb3J0ICogZnJvbSAnLi9nZXQtZG9jdW1lbnQtb3Itc2hhZG93LXJvb3QnO1xuZXhwb3J0ICogZnJvbSAnLi9nZXQtZWxlbWVudC1vYnNjdXJlcnMnO1xuZXhwb3J0ICogZnJvbSAnLi9nZXQtZWxlbWVudC1vZmZzZXQnO1xuZXhwb3J0ICogZnJvbSAnLi9nZXQtc2Nyb2xsLXBhcmVudCc7XG5leHBvcnQgKiBmcm9tICcuL2lzLWN1cnJlbnQtdGFyZ2V0JztcbmV4cG9ydCAqIGZyb20gJy4vaXMtaW5zaWRlLWlmcmFtZSc7XG5leHBvcnQgKiBmcm9tICcuL2lzLW5vZGUtaW4nO1xuIl19
|
|
@@ -176,48 +176,6 @@ function getScrollParent(element, vertical = true) {
|
|
|
176
176
|
return getScrollParent(element.parentElement, vertical);
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
-
/**
|
|
180
|
-
* @description:
|
|
181
|
-
* Cross-browser @media (height)
|
|
182
|
-
*
|
|
183
|
-
* 1. window.innerWidth
|
|
184
|
-
* 1.1. gets CSS viewport @media (height) which include scrollbars
|
|
185
|
-
* 1.2. initial-scale and zoom variations may cause mobile values to
|
|
186
|
-
* wrongly scale down to what PPK calls the visual
|
|
187
|
-
* viewport and be smaller than the @media values
|
|
188
|
-
* 1.3. zoom may cause values to be 1px off due to native rounding
|
|
189
|
-
*
|
|
190
|
-
* 2. document.documentElement.clientHeight
|
|
191
|
-
* 2.1. equals CSS viewport width minus scrollbar width
|
|
192
|
-
* 2.2. matches @media (height) when there is no scrollbar
|
|
193
|
-
* 2.3. available cross-browser
|
|
194
|
-
* 2.4. inaccurate if doctype is missing
|
|
195
|
-
*/
|
|
196
|
-
function tuiGetViewportHeight({ document, innerHeight }) {
|
|
197
|
-
return Math.max(document.documentElement.clientHeight || 0, innerHeight || 0);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* @description:
|
|
202
|
-
* Cross-browser @media (width)
|
|
203
|
-
*
|
|
204
|
-
* 1. window.innerWidth
|
|
205
|
-
* 1.1. gets CSS viewport @media (width) which include scrollbars
|
|
206
|
-
* 1.2. initial-scale and zoom variations may cause mobile values to
|
|
207
|
-
* wrongly scale down to what PPK calls the visual
|
|
208
|
-
* viewport and be smaller than the @media values
|
|
209
|
-
* 1.3. zoom may cause values to be 1px off due to native rounding
|
|
210
|
-
*
|
|
211
|
-
* 2. document.documentElement.clientWidth
|
|
212
|
-
* 2.1. equals CSS viewport width minus scrollbar width
|
|
213
|
-
* 2.2. matches @media (width) when there is no scrollbar
|
|
214
|
-
* 2.3. available cross-browser
|
|
215
|
-
* 2.4. inaccurate if doctype is missing
|
|
216
|
-
*/
|
|
217
|
-
function tuiGetViewportWidth({ document, innerWidth }) {
|
|
218
|
-
return Math.max(document.documentElement.clientWidth || 0, innerWidth || 0);
|
|
219
|
-
}
|
|
220
|
-
|
|
221
179
|
function isCurrentTarget({ target, currentTarget }) {
|
|
222
180
|
return target === currentTarget;
|
|
223
181
|
}
|
|
@@ -247,5 +205,5 @@ function isNodeIn(node, selector) {
|
|
|
247
205
|
* Generated bundle index. Do not edit.
|
|
248
206
|
*/
|
|
249
207
|
|
|
250
|
-
export { canScroll, containsOrAfter, getActualTarget, getClipboardDataText, getClosestElement, getDocumentOrShadowRoot, getElementObscurers, getElementOffset, getScrollParent, isCurrentTarget, isInsideIframe, isNodeIn, tuiCustomEvent
|
|
208
|
+
export { canScroll, containsOrAfter, getActualTarget, getClipboardDataText, getClosestElement, getDocumentOrShadowRoot, getElementObscurers, getElementOffset, getScrollParent, isCurrentTarget, isInsideIframe, isNodeIn, tuiCustomEvent };
|
|
251
209
|
//# sourceMappingURL=taiga-ui-cdk-utils-dom.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-cdk-utils-dom.js","sources":["ng://@taiga-ui/cdk/utils/dom/can-scroll.ts","ng://@taiga-ui/cdk/utils/dom/contains-or-after.ts","ng://@taiga-ui/cdk/utils/dom/custom-event.ts","ng://@taiga-ui/cdk/utils/dom/get-actual-target.ts","ng://@taiga-ui/cdk/utils/dom/get-clipboard-data-text.ts","ng://@taiga-ui/cdk/utils/dom/get-closest-element.ts","ng://@taiga-ui/cdk/utils/dom/get-document-or-shadow-root.ts","ng://@taiga-ui/cdk/utils/dom/get-element-obscurers.ts","ng://@taiga-ui/cdk/utils/dom/get-element-offset.ts","ng://@taiga-ui/cdk/utils/dom/get-scroll-parent.ts","ng://@taiga-ui/cdk/utils/dom/get-viewport-height.ts","ng://@taiga-ui/cdk/utils/dom/get-viewport-width.ts","ng://@taiga-ui/cdk/utils/dom/is-current-target.ts","ng://@taiga-ui/cdk/utils/dom/is-inside-iframe.ts","ng://@taiga-ui/cdk/utils/dom/is-node-in.ts","ng://@taiga-ui/cdk/utils/dom/taiga-ui-cdk-utils-dom.ts"],"sourcesContent":["export function canScroll(\n element: Element,\n rootElement: Element,\n vertical: boolean,\n scrollEnd: boolean,\n): boolean {\n return vertical\n ? canScrollVertical(element, rootElement, scrollEnd)\n : canScrollHorizontal(element, rootElement, scrollEnd);\n}\n\nfunction canScrollVertical(\n element: Element,\n rootElement: Element,\n scrollEnd: boolean,\n): boolean {\n let currentElement = element;\n\n while (currentElement !== rootElement.parentElement) {\n if (\n (Math.floor(currentElement.scrollTop) > 0 && !scrollEnd) ||\n (Math.ceil(currentElement.scrollTop + currentElement.clientHeight) <\n currentElement.scrollHeight &&\n scrollEnd)\n ) {\n return true;\n }\n\n if (currentElement.parentElement) {\n currentElement = currentElement.parentElement;\n } else {\n return false;\n }\n }\n\n return false;\n}\n\nfunction canScrollHorizontal(\n element: Element,\n rootElement: Element,\n scrollEnd: boolean,\n): boolean {\n let currentElement = element;\n\n while (currentElement !== rootElement.parentElement) {\n if (\n (Math.floor(currentElement.scrollLeft) > 0 && !scrollEnd) ||\n (Math.ceil(currentElement.scrollLeft + currentElement.clientWidth) <\n currentElement.scrollWidth &&\n scrollEnd)\n ) {\n return true;\n }\n\n if (currentElement.parentElement) {\n currentElement = currentElement.parentElement;\n } else {\n return false;\n }\n }\n\n return false;\n}\n","export function containsOrAfter(current: Node, node: Node): boolean {\n return (\n current.contains(node) ||\n !!(node.compareDocumentPosition(current) & Node.DOCUMENT_POSITION_PRECEDING)\n );\n}\n","/** @deprecated only needed for IE, remove in 3.0 */\nexport function tuiCustomEvent<T = null>(\n name: string,\n {bubbles = false, cancelable = false, detail = null}: CustomEventInit<T | null> = {},\n documentRef: Document,\n): CustomEvent {\n if (typeof CustomEvent === 'function') {\n return new CustomEvent(name, {bubbles, cancelable, detail});\n }\n\n const customEvent = documentRef.createEvent('CustomEvent');\n\n customEvent.initCustomEvent(name, bubbles, cancelable, detail);\n\n return customEvent;\n}\n","/**\n * Gets actual target from open Shadow DOM if event happened within it\n */\nexport function getActualTarget(event: Event): Node {\n if ('composedPath' in event) {\n return (event as any).composedPath()[0];\n }\n\n return (event as any).target;\n}\n","const DEFAULT_FORMAT = 'text/plain';\n\n/**\n * Gets text from data of clipboardEvent, it also works in IE and Edge browsers\n */\nexport function getClipboardDataText(\n event: ClipboardEvent,\n format: string = DEFAULT_FORMAT,\n): string {\n return 'clipboardData' in event && event.clipboardData !== null\n ? event.clipboardData.getData(format) ||\n event.clipboardData.getData(DEFAULT_FORMAT)\n : (event as any).target.ownerDocument.defaultView.clipboardData.getData('text');\n}\n","/**\n * Gets closest element by selector i.e. {@link Element.closest}\n * @deprecated only needed for IE, remove in 3.0\n */\nexport function getClosestElement(element: Element, selector: string): Element | null {\n const closest = Element.prototype.closest;\n\n if (closest) {\n return closest.call(element, selector);\n }\n\n const matchesSelector =\n Element.prototype.matches || (Element.prototype as any).msMatchesSelector;\n\n do {\n if (matchesSelector.call(element, selector)) {\n return element;\n }\n\n (element as Element | null) = element.parentElement;\n } while (element !== null);\n\n return null;\n}\n","export function getDocumentOrShadowRoot(node: Node): DocumentOrShadowRoot {\n return 'getRootNode' in node && node.isConnected\n ? (node.getRootNode() as Document)\n : node.ownerDocument!;\n}\n","import {clamp} from '@taiga-ui/cdk/utils/math';\nimport {isPresent} from '@taiga-ui/cdk/utils/miscellaneous';\n\nimport {getDocumentOrShadowRoot} from './get-document-or-shadow-root';\n\n/**\n * Returns array of Elements covering edges of given element or null if at least one edge middle point is visible\n *\n * CAUTION: Empty array means element if offscreen i.e. covered by no elements, rather than not covered\n */\nexport function getElementObscurers(element: Element): readonly Element[] | null {\n const {ownerDocument} = element;\n\n if (!ownerDocument || !ownerDocument.defaultView) {\n return null;\n }\n\n const {innerWidth, innerHeight} = ownerDocument.defaultView;\n const documentRef = getDocumentOrShadowRoot(element);\n const rect = element.getBoundingClientRect();\n const left = clamp(Math.round(rect.left) + 2, 0, innerWidth);\n const top = clamp(Math.round(rect.top) + 2, 0, innerHeight);\n const right = clamp(Math.round(rect.right) - 2, 0, innerWidth);\n const bottom = clamp(Math.round(rect.bottom) - 2, 0, innerHeight);\n const horizontalMiddle = clamp(Math.round(rect.left + rect.width / 2), 0, innerWidth);\n const verticalMiddle = clamp(Math.round(rect.top + rect.height / 2), 0, innerHeight);\n const elements = [\n documentRef.elementFromPoint(horizontalMiddle, top),\n documentRef.elementFromPoint(horizontalMiddle, bottom),\n documentRef.elementFromPoint(left, verticalMiddle),\n documentRef.elementFromPoint(right, verticalMiddle),\n ];\n const nonNull = elements.filter(isPresent);\n\n if (!nonNull.length) {\n return nonNull;\n }\n\n const filtered = nonNull.filter(el => !element.contains(el));\n\n return filtered.length === 4 ? filtered : null;\n}\n","import {tuiAssert} from '@taiga-ui/cdk/classes';\n\n/**\n * Calculates offset for an element relative to it's parent several levels above\n *\n * @param host parent element\n * @param element\n * @return object with offsetTop and offsetLeft number properties\n */\nexport function getElementOffset(\n host: Element,\n element: HTMLElement,\n): {offsetTop: number; offsetLeft: number} {\n tuiAssert.assert(host.contains(element), 'Host must contain element');\n\n let {offsetTop, offsetLeft, offsetParent} = element;\n\n // TODO: iframe warning\n while (offsetParent && offsetParent instanceof HTMLElement && offsetParent !== host) {\n offsetTop += offsetParent.offsetTop;\n offsetLeft += offsetParent.offsetLeft;\n offsetParent = offsetParent.offsetParent;\n }\n\n return {offsetTop, offsetLeft};\n}\n","/**\n * Finds nearest parent with scroll in it\n *\n * @param element initial element\n * @param vertical flag for orientation of scroll\n */\nexport function getScrollParent(\n element: Element | null,\n vertical: boolean = true,\n): Element | null {\n if (element === null) {\n return null;\n }\n\n if (vertical && element.scrollHeight > element.clientHeight) {\n return element;\n }\n\n if (!vertical && element.scrollWidth > element.clientWidth) {\n return element;\n }\n\n return getScrollParent(element.parentElement, vertical);\n}\n","/**\n * @description:\n * Cross-browser @media (height)\n *\n * 1. window.innerWidth\n * 1.1. gets CSS viewport @media (height) which include scrollbars\n * 1.2. initial-scale and zoom variations may cause mobile values to\n * wrongly scale down to what PPK calls the visual\n * viewport and be smaller than the @media values\n * 1.3. zoom may cause values to be 1px off due to native rounding\n *\n * 2. document.documentElement.clientHeight\n * 2.1. equals CSS viewport width minus scrollbar width\n * 2.2. matches @media (height) when there is no scrollbar\n * 2.3. available cross-browser\n * 2.4. inaccurate if doctype is missing\n */\nexport function tuiGetViewportHeight({document, innerHeight}: Window): number {\n return Math.max(document.documentElement.clientHeight || 0, innerHeight || 0);\n}\n","/**\n * @description:\n * Cross-browser @media (width)\n *\n * 1. window.innerWidth\n * 1.1. gets CSS viewport @media (width) which include scrollbars\n * 1.2. initial-scale and zoom variations may cause mobile values to\n * wrongly scale down to what PPK calls the visual\n * viewport and be smaller than the @media values\n * 1.3. zoom may cause values to be 1px off due to native rounding\n *\n * 2. document.documentElement.clientWidth\n * 2.1. equals CSS viewport width minus scrollbar width\n * 2.2. matches @media (width) when there is no scrollbar\n * 2.3. available cross-browser\n * 2.4. inaccurate if doctype is missing\n */\nexport function tuiGetViewportWidth({document, innerWidth}: Window): number {\n return Math.max(document.documentElement.clientWidth || 0, innerWidth || 0);\n}\n","export function isCurrentTarget({target, currentTarget}: Event): boolean {\n return target === currentTarget;\n}\n","/**\n * Checks if an app is running inside <iframe /> tag\n */\nexport function isInsideIframe(windowRef: Window): boolean {\n return windowRef.parent !== windowRef;\n}\n","import {getClosestElement} from './get-closest-element';\n\n/**\n * Checks if node is inside a specific selector\n *\n * @param node\n * @param selector\n * @return true if node is inside a particular selector\n */\nexport function isNodeIn(node: Node, selector: string): boolean {\n return node.nodeType === Node.TEXT_NODE\n ? !!node.parentElement && !!getClosestElement(node.parentElement, selector)\n : node.nodeType === Node.ELEMENT_NODE &&\n !!getClosestElement(node as Element, selector);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;SAAgB,SAAS,CACrB,OAAgB,EAChB,WAAoB,EACpB,QAAiB,EACjB,SAAkB;IAElB,OAAO,QAAQ;UACT,iBAAiB,CAAC,OAAO,EAAE,WAAW,EAAE,SAAS,CAAC;UAClD,mBAAmB,CAAC,OAAO,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;AAC/D,CAAC;AAED,SAAS,iBAAiB,CACtB,OAAgB,EAChB,WAAoB,EACpB,SAAkB;IAElB,IAAI,cAAc,GAAG,OAAO,CAAC;IAE7B,OAAO,cAAc,KAAK,WAAW,CAAC,aAAa,EAAE;QACjD,IACI,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS;aACtD,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,SAAS,GAAG,cAAc,CAAC,YAAY,CAAC;gBAC9D,cAAc,CAAC,YAAY;gBAC3B,SAAS,CAAC,EAChB;YACE,OAAO,IAAI,CAAC;SACf;QAED,IAAI,cAAc,CAAC,aAAa,EAAE;YAC9B,cAAc,GAAG,cAA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IAAe,EAAE,QAAQ,CAAC,CAAC;AAC7D;;ACdA;;;;;;"}
|
|
1
|
+
{"version":3,"file":"taiga-ui-cdk-utils-dom.js","sources":["ng://@taiga-ui/cdk/utils/dom/can-scroll.ts","ng://@taiga-ui/cdk/utils/dom/contains-or-after.ts","ng://@taiga-ui/cdk/utils/dom/custom-event.ts","ng://@taiga-ui/cdk/utils/dom/get-actual-target.ts","ng://@taiga-ui/cdk/utils/dom/get-clipboard-data-text.ts","ng://@taiga-ui/cdk/utils/dom/get-closest-element.ts","ng://@taiga-ui/cdk/utils/dom/get-document-or-shadow-root.ts","ng://@taiga-ui/cdk/utils/dom/get-element-obscurers.ts","ng://@taiga-ui/cdk/utils/dom/get-element-offset.ts","ng://@taiga-ui/cdk/utils/dom/get-scroll-parent.ts","ng://@taiga-ui/cdk/utils/dom/is-current-target.ts","ng://@taiga-ui/cdk/utils/dom/is-inside-iframe.ts","ng://@taiga-ui/cdk/utils/dom/is-node-in.ts","ng://@taiga-ui/cdk/utils/dom/taiga-ui-cdk-utils-dom.ts"],"sourcesContent":["export function canScroll(\n element: Element,\n rootElement: Element,\n vertical: boolean,\n scrollEnd: boolean,\n): boolean {\n return vertical\n ? canScrollVertical(element, rootElement, scrollEnd)\n : canScrollHorizontal(element, rootElement, scrollEnd);\n}\n\nfunction canScrollVertical(\n element: Element,\n rootElement: Element,\n scrollEnd: boolean,\n): boolean {\n let currentElement = element;\n\n while (currentElement !== rootElement.parentElement) {\n if (\n (Math.floor(currentElement.scrollTop) > 0 && !scrollEnd) ||\n (Math.ceil(currentElement.scrollTop + currentElement.clientHeight) <\n currentElement.scrollHeight &&\n scrollEnd)\n ) {\n return true;\n }\n\n if (currentElement.parentElement) {\n currentElement = currentElement.parentElement;\n } else {\n return false;\n }\n }\n\n return false;\n}\n\nfunction canScrollHorizontal(\n element: Element,\n rootElement: Element,\n scrollEnd: boolean,\n): boolean {\n let currentElement = element;\n\n while (currentElement !== rootElement.parentElement) {\n if (\n (Math.floor(currentElement.scrollLeft) > 0 && !scrollEnd) ||\n (Math.ceil(currentElement.scrollLeft + currentElement.clientWidth) <\n currentElement.scrollWidth &&\n scrollEnd)\n ) {\n return true;\n }\n\n if (currentElement.parentElement) {\n currentElement = currentElement.parentElement;\n } else {\n return false;\n }\n }\n\n return false;\n}\n","export function containsOrAfter(current: Node, node: Node): boolean {\n return (\n current.contains(node) ||\n !!(node.compareDocumentPosition(current) & Node.DOCUMENT_POSITION_PRECEDING)\n );\n}\n","/** @deprecated only needed for IE, remove in 3.0 */\nexport function tuiCustomEvent<T = null>(\n name: string,\n {bubbles = false, cancelable = false, detail = null}: CustomEventInit<T | null> = {},\n documentRef: Document,\n): CustomEvent {\n if (typeof CustomEvent === 'function') {\n return new CustomEvent(name, {bubbles, cancelable, detail});\n }\n\n const customEvent = documentRef.createEvent('CustomEvent');\n\n customEvent.initCustomEvent(name, bubbles, cancelable, detail);\n\n return customEvent;\n}\n","/**\n * Gets actual target from open Shadow DOM if event happened within it\n */\nexport function getActualTarget(event: Event): Node {\n if ('composedPath' in event) {\n return (event as any).composedPath()[0];\n }\n\n return (event as any).target;\n}\n","const DEFAULT_FORMAT = 'text/plain';\n\n/**\n * Gets text from data of clipboardEvent, it also works in IE and Edge browsers\n */\nexport function getClipboardDataText(\n event: ClipboardEvent,\n format: string = DEFAULT_FORMAT,\n): string {\n return 'clipboardData' in event && event.clipboardData !== null\n ? event.clipboardData.getData(format) ||\n event.clipboardData.getData(DEFAULT_FORMAT)\n : (event as any).target.ownerDocument.defaultView.clipboardData.getData('text');\n}\n","/**\n * Gets closest element by selector i.e. {@link Element.closest}\n * @deprecated only needed for IE, remove in 3.0\n */\nexport function getClosestElement(element: Element, selector: string): Element | null {\n const closest = Element.prototype.closest;\n\n if (closest) {\n return closest.call(element, selector);\n }\n\n const matchesSelector =\n Element.prototype.matches || (Element.prototype as any).msMatchesSelector;\n\n do {\n if (matchesSelector.call(element, selector)) {\n return element;\n }\n\n (element as Element | null) = element.parentElement;\n } while (element !== null);\n\n return null;\n}\n","export function getDocumentOrShadowRoot(node: Node): DocumentOrShadowRoot {\n return 'getRootNode' in node && node.isConnected\n ? (node.getRootNode() as Document)\n : node.ownerDocument!;\n}\n","import {clamp} from '@taiga-ui/cdk/utils/math';\nimport {isPresent} from '@taiga-ui/cdk/utils/miscellaneous';\n\nimport {getDocumentOrShadowRoot} from './get-document-or-shadow-root';\n\n/**\n * Returns array of Elements covering edges of given element or null if at least one edge middle point is visible\n *\n * CAUTION: Empty array means element if offscreen i.e. covered by no elements, rather than not covered\n */\nexport function getElementObscurers(element: Element): readonly Element[] | null {\n const {ownerDocument} = element;\n\n if (!ownerDocument || !ownerDocument.defaultView) {\n return null;\n }\n\n const {innerWidth, innerHeight} = ownerDocument.defaultView;\n const documentRef = getDocumentOrShadowRoot(element);\n const rect = element.getBoundingClientRect();\n const left = clamp(Math.round(rect.left) + 2, 0, innerWidth);\n const top = clamp(Math.round(rect.top) + 2, 0, innerHeight);\n const right = clamp(Math.round(rect.right) - 2, 0, innerWidth);\n const bottom = clamp(Math.round(rect.bottom) - 2, 0, innerHeight);\n const horizontalMiddle = clamp(Math.round(rect.left + rect.width / 2), 0, innerWidth);\n const verticalMiddle = clamp(Math.round(rect.top + rect.height / 2), 0, innerHeight);\n const elements = [\n documentRef.elementFromPoint(horizontalMiddle, top),\n documentRef.elementFromPoint(horizontalMiddle, bottom),\n documentRef.elementFromPoint(left, verticalMiddle),\n documentRef.elementFromPoint(right, verticalMiddle),\n ];\n const nonNull = elements.filter(isPresent);\n\n if (!nonNull.length) {\n return nonNull;\n }\n\n const filtered = nonNull.filter(el => !element.contains(el));\n\n return filtered.length === 4 ? filtered : null;\n}\n","import {tuiAssert} from '@taiga-ui/cdk/classes';\n\n/**\n * Calculates offset for an element relative to it's parent several levels above\n *\n * @param host parent element\n * @param element\n * @return object with offsetTop and offsetLeft number properties\n */\nexport function getElementOffset(\n host: Element,\n element: HTMLElement,\n): {offsetTop: number; offsetLeft: number} {\n tuiAssert.assert(host.contains(element), 'Host must contain element');\n\n let {offsetTop, offsetLeft, offsetParent} = element;\n\n // TODO: iframe warning\n while (offsetParent && offsetParent instanceof HTMLElement && offsetParent !== host) {\n offsetTop += offsetParent.offsetTop;\n offsetLeft += offsetParent.offsetLeft;\n offsetParent = offsetParent.offsetParent;\n }\n\n return {offsetTop, offsetLeft};\n}\n","/**\n * Finds nearest parent with scroll in it\n *\n * @param element initial element\n * @param vertical flag for orientation of scroll\n */\nexport function getScrollParent(\n element: Element | null,\n vertical: boolean = true,\n): Element | null {\n if (element === null) {\n return null;\n }\n\n if (vertical && element.scrollHeight > element.clientHeight) {\n return element;\n }\n\n if (!vertical && element.scrollWidth > element.clientWidth) {\n return element;\n }\n\n return getScrollParent(element.parentElement, vertical);\n}\n","export function isCurrentTarget({target, currentTarget}: Event): boolean {\n return target === currentTarget;\n}\n","/**\n * Checks if an app is running inside <iframe /> tag\n */\nexport function isInsideIframe(windowRef: Window): boolean {\n return windowRef.parent !== windowRef;\n}\n","import {getClosestElement} from './get-closest-element';\n\n/**\n * Checks if node is inside a specific selector\n *\n * @param node\n * @param selector\n * @return true if node is inside a particular selector\n */\nexport function isNodeIn(node: Node, selector: string): boolean {\n return node.nodeType === Node.TEXT_NODE\n ? !!node.parentElement && !!getClosestElement(node.parentElement, selector)\n : node.nodeType === Node.ELEMENT_NODE &&\n !!getClosestElement(node as Element, selector);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;SAAgB,SAAS,CACrB,OAAgB,EAChB,WAAoB,EACpB,QAAiB,EACjB,SAAkB;IAElB,OAAO,QAAQ;UACT,iBAAiB,CAAC,OAAO,EAAE,WAAW,EAAE,SAAS,CAAC;UAClD,mBAAmB,CAAC,OAAO,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;AAC/D,CAAC;AAED,SAAS,iBAAiB,CACtB,OAAgB,EAChB,WAAoB,EACpB,SAAkB;IAElB,IAAI,cAAc,GAAG,O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D;;ACdA;;;;;;"}
|
|
@@ -179,50 +179,6 @@ function getScrollParent(element, vertical) {
|
|
|
179
179
|
return getScrollParent(element.parentElement, vertical);
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
-
/**
|
|
183
|
-
* @description:
|
|
184
|
-
* Cross-browser @media (height)
|
|
185
|
-
*
|
|
186
|
-
* 1. window.innerWidth
|
|
187
|
-
* 1.1. gets CSS viewport @media (height) which include scrollbars
|
|
188
|
-
* 1.2. initial-scale and zoom variations may cause mobile values to
|
|
189
|
-
* wrongly scale down to what PPK calls the visual
|
|
190
|
-
* viewport and be smaller than the @media values
|
|
191
|
-
* 1.3. zoom may cause values to be 1px off due to native rounding
|
|
192
|
-
*
|
|
193
|
-
* 2. document.documentElement.clientHeight
|
|
194
|
-
* 2.1. equals CSS viewport width minus scrollbar width
|
|
195
|
-
* 2.2. matches @media (height) when there is no scrollbar
|
|
196
|
-
* 2.3. available cross-browser
|
|
197
|
-
* 2.4. inaccurate if doctype is missing
|
|
198
|
-
*/
|
|
199
|
-
function tuiGetViewportHeight(_a) {
|
|
200
|
-
var document = _a.document, innerHeight = _a.innerHeight;
|
|
201
|
-
return Math.max(document.documentElement.clientHeight || 0, innerHeight || 0);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
* @description:
|
|
206
|
-
* Cross-browser @media (width)
|
|
207
|
-
*
|
|
208
|
-
* 1. window.innerWidth
|
|
209
|
-
* 1.1. gets CSS viewport @media (width) which include scrollbars
|
|
210
|
-
* 1.2. initial-scale and zoom variations may cause mobile values to
|
|
211
|
-
* wrongly scale down to what PPK calls the visual
|
|
212
|
-
* viewport and be smaller than the @media values
|
|
213
|
-
* 1.3. zoom may cause values to be 1px off due to native rounding
|
|
214
|
-
*
|
|
215
|
-
* 2. document.documentElement.clientWidth
|
|
216
|
-
* 2.1. equals CSS viewport width minus scrollbar width
|
|
217
|
-
* 2.2. matches @media (width) when there is no scrollbar
|
|
218
|
-
* 2.3. available cross-browser
|
|
219
|
-
* 2.4. inaccurate if doctype is missing
|
|
220
|
-
*/
|
|
221
|
-
function tuiGetViewportWidth(_a) {
|
|
222
|
-
var document = _a.document, innerWidth = _a.innerWidth;
|
|
223
|
-
return Math.max(document.documentElement.clientWidth || 0, innerWidth || 0);
|
|
224
|
-
}
|
|
225
|
-
|
|
226
182
|
function isCurrentTarget(_a) {
|
|
227
183
|
var target = _a.target, currentTarget = _a.currentTarget;
|
|
228
184
|
return target === currentTarget;
|
|
@@ -253,5 +209,5 @@ function isNodeIn(node, selector) {
|
|
|
253
209
|
* Generated bundle index. Do not edit.
|
|
254
210
|
*/
|
|
255
211
|
|
|
256
|
-
export { canScroll, containsOrAfter, getActualTarget, getClipboardDataText, getClosestElement, getDocumentOrShadowRoot, getElementObscurers, getElementOffset, getScrollParent, isCurrentTarget, isInsideIframe, isNodeIn, tuiCustomEvent
|
|
212
|
+
export { canScroll, containsOrAfter, getActualTarget, getClipboardDataText, getClosestElement, getDocumentOrShadowRoot, getElementObscurers, getElementOffset, getScrollParent, isCurrentTarget, isInsideIframe, isNodeIn, tuiCustomEvent };
|
|
257
213
|
//# sourceMappingURL=taiga-ui-cdk-utils-dom.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-cdk-utils-dom.js","sources":["ng://@taiga-ui/cdk/utils/dom/can-scroll.ts","ng://@taiga-ui/cdk/utils/dom/contains-or-after.ts","ng://@taiga-ui/cdk/utils/dom/custom-event.ts","ng://@taiga-ui/cdk/utils/dom/get-actual-target.ts","ng://@taiga-ui/cdk/utils/dom/get-clipboard-data-text.ts","ng://@taiga-ui/cdk/utils/dom/get-closest-element.ts","ng://@taiga-ui/cdk/utils/dom/get-document-or-shadow-root.ts","ng://@taiga-ui/cdk/utils/dom/get-element-obscurers.ts","ng://@taiga-ui/cdk/utils/dom/get-element-offset.ts","ng://@taiga-ui/cdk/utils/dom/get-scroll-parent.ts","ng://@taiga-ui/cdk/utils/dom/get-viewport-height.ts","ng://@taiga-ui/cdk/utils/dom/get-viewport-width.ts","ng://@taiga-ui/cdk/utils/dom/is-current-target.ts","ng://@taiga-ui/cdk/utils/dom/is-inside-iframe.ts","ng://@taiga-ui/cdk/utils/dom/is-node-in.ts","ng://@taiga-ui/cdk/utils/dom/taiga-ui-cdk-utils-dom.ts"],"sourcesContent":["export function canScroll(\n element: Element,\n rootElement: Element,\n vertical: boolean,\n scrollEnd: boolean,\n): boolean {\n return vertical\n ? canScrollVertical(element, rootElement, scrollEnd)\n : canScrollHorizontal(element, rootElement, scrollEnd);\n}\n\nfunction canScrollVertical(\n element: Element,\n rootElement: Element,\n scrollEnd: boolean,\n): boolean {\n let currentElement = element;\n\n while (currentElement !== rootElement.parentElement) {\n if (\n (Math.floor(currentElement.scrollTop) > 0 && !scrollEnd) ||\n (Math.ceil(currentElement.scrollTop + currentElement.clientHeight) <\n currentElement.scrollHeight &&\n scrollEnd)\n ) {\n return true;\n }\n\n if (currentElement.parentElement) {\n currentElement = currentElement.parentElement;\n } else {\n return false;\n }\n }\n\n return false;\n}\n\nfunction canScrollHorizontal(\n element: Element,\n rootElement: Element,\n scrollEnd: boolean,\n): boolean {\n let currentElement = element;\n\n while (currentElement !== rootElement.parentElement) {\n if (\n (Math.floor(currentElement.scrollLeft) > 0 && !scrollEnd) ||\n (Math.ceil(currentElement.scrollLeft + currentElement.clientWidth) <\n currentElement.scrollWidth &&\n scrollEnd)\n ) {\n return true;\n }\n\n if (currentElement.parentElement) {\n currentElement = currentElement.parentElement;\n } else {\n return false;\n }\n }\n\n return false;\n}\n","export function containsOrAfter(current: Node, node: Node): boolean {\n return (\n current.contains(node) ||\n !!(node.compareDocumentPosition(current) & Node.DOCUMENT_POSITION_PRECEDING)\n );\n}\n","/** @deprecated only needed for IE, remove in 3.0 */\nexport function tuiCustomEvent<T = null>(\n name: string,\n {bubbles = false, cancelable = false, detail = null}: CustomEventInit<T | null> = {},\n documentRef: Document,\n): CustomEvent {\n if (typeof CustomEvent === 'function') {\n return new CustomEvent(name, {bubbles, cancelable, detail});\n }\n\n const customEvent = documentRef.createEvent('CustomEvent');\n\n customEvent.initCustomEvent(name, bubbles, cancelable, detail);\n\n return customEvent;\n}\n","/**\n * Gets actual target from open Shadow DOM if event happened within it\n */\nexport function getActualTarget(event: Event): Node {\n if ('composedPath' in event) {\n return (event as any).composedPath()[0];\n }\n\n return (event as any).target;\n}\n","const DEFAULT_FORMAT = 'text/plain';\n\n/**\n * Gets text from data of clipboardEvent, it also works in IE and Edge browsers\n */\nexport function getClipboardDataText(\n event: ClipboardEvent,\n format: string = DEFAULT_FORMAT,\n): string {\n return 'clipboardData' in event && event.clipboardData !== null\n ? event.clipboardData.getData(format) ||\n event.clipboardData.getData(DEFAULT_FORMAT)\n : (event as any).target.ownerDocument.defaultView.clipboardData.getData('text');\n}\n","/**\n * Gets closest element by selector i.e. {@link Element.closest}\n * @deprecated only needed for IE, remove in 3.0\n */\nexport function getClosestElement(element: Element, selector: string): Element | null {\n const closest = Element.prototype.closest;\n\n if (closest) {\n return closest.call(element, selector);\n }\n\n const matchesSelector =\n Element.prototype.matches || (Element.prototype as any).msMatchesSelector;\n\n do {\n if (matchesSelector.call(element, selector)) {\n return element;\n }\n\n (element as Element | null) = element.parentElement;\n } while (element !== null);\n\n return null;\n}\n","export function getDocumentOrShadowRoot(node: Node): DocumentOrShadowRoot {\n return 'getRootNode' in node && node.isConnected\n ? (node.getRootNode() as Document)\n : node.ownerDocument!;\n}\n","import {clamp} from '@taiga-ui/cdk/utils/math';\nimport {isPresent} from '@taiga-ui/cdk/utils/miscellaneous';\n\nimport {getDocumentOrShadowRoot} from './get-document-or-shadow-root';\n\n/**\n * Returns array of Elements covering edges of given element or null if at least one edge middle point is visible\n *\n * CAUTION: Empty array means element if offscreen i.e. covered by no elements, rather than not covered\n */\nexport function getElementObscurers(element: Element): readonly Element[] | null {\n const {ownerDocument} = element;\n\n if (!ownerDocument || !ownerDocument.defaultView) {\n return null;\n }\n\n const {innerWidth, innerHeight} = ownerDocument.defaultView;\n const documentRef = getDocumentOrShadowRoot(element);\n const rect = element.getBoundingClientRect();\n const left = clamp(Math.round(rect.left) + 2, 0, innerWidth);\n const top = clamp(Math.round(rect.top) + 2, 0, innerHeight);\n const right = clamp(Math.round(rect.right) - 2, 0, innerWidth);\n const bottom = clamp(Math.round(rect.bottom) - 2, 0, innerHeight);\n const horizontalMiddle = clamp(Math.round(rect.left + rect.width / 2), 0, innerWidth);\n const verticalMiddle = clamp(Math.round(rect.top + rect.height / 2), 0, innerHeight);\n const elements = [\n documentRef.elementFromPoint(horizontalMiddle, top),\n documentRef.elementFromPoint(horizontalMiddle, bottom),\n documentRef.elementFromPoint(left, verticalMiddle),\n documentRef.elementFromPoint(right, verticalMiddle),\n ];\n const nonNull = elements.filter(isPresent);\n\n if (!nonNull.length) {\n return nonNull;\n }\n\n const filtered = nonNull.filter(el => !element.contains(el));\n\n return filtered.length === 4 ? filtered : null;\n}\n","import {tuiAssert} from '@taiga-ui/cdk/classes';\n\n/**\n * Calculates offset for an element relative to it's parent several levels above\n *\n * @param host parent element\n * @param element\n * @return object with offsetTop and offsetLeft number properties\n */\nexport function getElementOffset(\n host: Element,\n element: HTMLElement,\n): {offsetTop: number; offsetLeft: number} {\n tuiAssert.assert(host.contains(element), 'Host must contain element');\n\n let {offsetTop, offsetLeft, offsetParent} = element;\n\n // TODO: iframe warning\n while (offsetParent && offsetParent instanceof HTMLElement && offsetParent !== host) {\n offsetTop += offsetParent.offsetTop;\n offsetLeft += offsetParent.offsetLeft;\n offsetParent = offsetParent.offsetParent;\n }\n\n return {offsetTop, offsetLeft};\n}\n","/**\n * Finds nearest parent with scroll in it\n *\n * @param element initial element\n * @param vertical flag for orientation of scroll\n */\nexport function getScrollParent(\n element: Element | null,\n vertical: boolean = true,\n): Element | null {\n if (element === null) {\n return null;\n }\n\n if (vertical && element.scrollHeight > element.clientHeight) {\n return element;\n }\n\n if (!vertical && element.scrollWidth > element.clientWidth) {\n return element;\n }\n\n return getScrollParent(element.parentElement, vertical);\n}\n","/**\n * @description:\n * Cross-browser @media (height)\n *\n * 1. window.innerWidth\n * 1.1. gets CSS viewport @media (height) which include scrollbars\n * 1.2. initial-scale and zoom variations may cause mobile values to\n * wrongly scale down to what PPK calls the visual\n * viewport and be smaller than the @media values\n * 1.3. zoom may cause values to be 1px off due to native rounding\n *\n * 2. document.documentElement.clientHeight\n * 2.1. equals CSS viewport width minus scrollbar width\n * 2.2. matches @media (height) when there is no scrollbar\n * 2.3. available cross-browser\n * 2.4. inaccurate if doctype is missing\n */\nexport function tuiGetViewportHeight({document, innerHeight}: Window): number {\n return Math.max(document.documentElement.clientHeight || 0, innerHeight || 0);\n}\n","/**\n * @description:\n * Cross-browser @media (width)\n *\n * 1. window.innerWidth\n * 1.1. gets CSS viewport @media (width) which include scrollbars\n * 1.2. initial-scale and zoom variations may cause mobile values to\n * wrongly scale down to what PPK calls the visual\n * viewport and be smaller than the @media values\n * 1.3. zoom may cause values to be 1px off due to native rounding\n *\n * 2. document.documentElement.clientWidth\n * 2.1. equals CSS viewport width minus scrollbar width\n * 2.2. matches @media (width) when there is no scrollbar\n * 2.3. available cross-browser\n * 2.4. inaccurate if doctype is missing\n */\nexport function tuiGetViewportWidth({document, innerWidth}: Window): number {\n return Math.max(document.documentElement.clientWidth || 0, innerWidth || 0);\n}\n","export function isCurrentTarget({target, currentTarget}: Event): boolean {\n return target === currentTarget;\n}\n","/**\n * Checks if an app is running inside <iframe /> tag\n */\nexport function isInsideIframe(windowRef: Window): boolean {\n return windowRef.parent !== windowRef;\n}\n","import {getClosestElement} from './get-closest-element';\n\n/**\n * Checks if node is inside a specific selector\n *\n * @param node\n * @param selector\n * @return true if node is inside a particular selector\n */\nexport function isNodeIn(node: Node, selector: string): boolean {\n return node.nodeType === Node.TEXT_NODE\n ? !!node.parentElement && !!getClosestElement(node.parentElement, selector)\n : node.nodeType === Node.ELEMENT_NODE &&\n !!getClosestElement(node as Element, selector);\n}\n","/**\n * Gener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AAC,QAAQ,CAAC,eAAe,CAAC,YAAY,IAAI,CAAC,EAAE,WAAW,IAAI,CAAC,CAAC,CAAC;AAClF;;ACnBA;;;;;;;;;;;;;;;;;SAiBgB,mBAAmB,CAAC,EAA8B;QAA7B,sBAAQ,EAAE,0BAAU;IACrD,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,eAAe,CAAC,WAAW,IAAI,CAAC,EAAE,UAAU,IAAI,CAAC,CAAC,CAAC;AAChF;;SCnBgB,eAAe,CAAC,EAA8B;QAA7B,kBAAM,EAAE,gCAAa;IAClD,OAAO,MAAM,KAAK,aAAa,CAAC;AACpC;;ACFA;;;SAGgB,cAAc,CAAC,SAAiB;IAC5C,OAAO,SAAS,CAAC,MAAM,KAAK,SAAS,CAAC;AAC1C;;ACHA;;;;;;;SAOgB,QAAQ,CAAC,IAAU,EAAE,QAAgB;IACjD,OAAO,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,SAAS;UACjC,CAAC,CAAC,IAAI,CAAC,aAAa,IAAI,CAAC,CAAC,iBAAiB,CAAC,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC;UACzE,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,YAAY;YAC/B,CAAC,CAAC,iBAAiB,CAAC,IAAe,EAAE,QAAQ,CAAC,CAAC;AAC7D;;ACdA;;;;;;"}
|
|
1
|
+
{"version":3,"file":"taiga-ui-cdk-utils-dom.js","sources":["ng://@taiga-ui/cdk/utils/dom/can-scroll.ts","ng://@taiga-ui/cdk/utils/dom/contains-or-after.ts","ng://@taiga-ui/cdk/utils/dom/custom-event.ts","ng://@taiga-ui/cdk/utils/dom/get-actual-target.ts","ng://@taiga-ui/cdk/utils/dom/get-clipboard-data-text.ts","ng://@taiga-ui/cdk/utils/dom/get-closest-element.ts","ng://@taiga-ui/cdk/utils/dom/get-document-or-shadow-root.ts","ng://@taiga-ui/cdk/utils/dom/get-element-obscurers.ts","ng://@taiga-ui/cdk/utils/dom/get-element-offset.ts","ng://@taiga-ui/cdk/utils/dom/get-scroll-parent.ts","ng://@taiga-ui/cdk/utils/dom/is-current-target.ts","ng://@taiga-ui/cdk/utils/dom/is-inside-iframe.ts","ng://@taiga-ui/cdk/utils/dom/is-node-in.ts","ng://@taiga-ui/cdk/utils/dom/taiga-ui-cdk-utils-dom.ts"],"sourcesContent":["export function canScroll(\n element: Element,\n rootElement: Element,\n vertical: boolean,\n scrollEnd: boolean,\n): boolean {\n return vertical\n ? canScrollVertical(element, rootElement, scrollEnd)\n : canScrollHorizontal(element, rootElement, scrollEnd);\n}\n\nfunction canScrollVertical(\n element: Element,\n rootElement: Element,\n scrollEnd: boolean,\n): boolean {\n let currentElement = element;\n\n while (currentElement !== rootElement.parentElement) {\n if (\n (Math.floor(currentElement.scrollTop) > 0 && !scrollEnd) ||\n (Math.ceil(currentElement.scrollTop + currentElement.clientHeight) <\n currentElement.scrollHeight &&\n scrollEnd)\n ) {\n return true;\n }\n\n if (currentElement.parentElement) {\n currentElement = currentElement.parentElement;\n } else {\n return false;\n }\n }\n\n return false;\n}\n\nfunction canScrollHorizontal(\n element: Element,\n rootElement: Element,\n scrollEnd: boolean,\n): boolean {\n let currentElement = element;\n\n while (currentElement !== rootElement.parentElement) {\n if (\n (Math.floor(currentElement.scrollLeft) > 0 && !scrollEnd) ||\n (Math.ceil(currentElement.scrollLeft + currentElement.clientWidth) <\n currentElement.scrollWidth &&\n scrollEnd)\n ) {\n return true;\n }\n\n if (currentElement.parentElement) {\n currentElement = currentElement.parentElement;\n } else {\n return false;\n }\n }\n\n return false;\n}\n","export function containsOrAfter(current: Node, node: Node): boolean {\n return (\n current.contains(node) ||\n !!(node.compareDocumentPosition(current) & Node.DOCUMENT_POSITION_PRECEDING)\n );\n}\n","/** @deprecated only needed for IE, remove in 3.0 */\nexport function tuiCustomEvent<T = null>(\n name: string,\n {bubbles = false, cancelable = false, detail = null}: CustomEventInit<T | null> = {},\n documentRef: Document,\n): CustomEvent {\n if (typeof CustomEvent === 'function') {\n return new CustomEvent(name, {bubbles, cancelable, detail});\n }\n\n const customEvent = documentRef.createEvent('CustomEvent');\n\n customEvent.initCustomEvent(name, bubbles, cancelable, detail);\n\n return customEvent;\n}\n","/**\n * Gets actual target from open Shadow DOM if event happened within it\n */\nexport function getActualTarget(event: Event): Node {\n if ('composedPath' in event) {\n return (event as any).composedPath()[0];\n }\n\n return (event as any).target;\n}\n","const DEFAULT_FORMAT = 'text/plain';\n\n/**\n * Gets text from data of clipboardEvent, it also works in IE and Edge browsers\n */\nexport function getClipboardDataText(\n event: ClipboardEvent,\n format: string = DEFAULT_FORMAT,\n): string {\n return 'clipboardData' in event && event.clipboardData !== null\n ? event.clipboardData.getData(format) ||\n event.clipboardData.getData(DEFAULT_FORMAT)\n : (event as any).target.ownerDocument.defaultView.clipboardData.getData('text');\n}\n","/**\n * Gets closest element by selector i.e. {@link Element.closest}\n * @deprecated only needed for IE, remove in 3.0\n */\nexport function getClosestElement(element: Element, selector: string): Element | null {\n const closest = Element.prototype.closest;\n\n if (closest) {\n return closest.call(element, selector);\n }\n\n const matchesSelector =\n Element.prototype.matches || (Element.prototype as any).msMatchesSelector;\n\n do {\n if (matchesSelector.call(element, selector)) {\n return element;\n }\n\n (element as Element | null) = element.parentElement;\n } while (element !== null);\n\n return null;\n}\n","export function getDocumentOrShadowRoot(node: Node): DocumentOrShadowRoot {\n return 'getRootNode' in node && node.isConnected\n ? (node.getRootNode() as Document)\n : node.ownerDocument!;\n}\n","import {clamp} from '@taiga-ui/cdk/utils/math';\nimport {isPresent} from '@taiga-ui/cdk/utils/miscellaneous';\n\nimport {getDocumentOrShadowRoot} from './get-document-or-shadow-root';\n\n/**\n * Returns array of Elements covering edges of given element or null if at least one edge middle point is visible\n *\n * CAUTION: Empty array means element if offscreen i.e. covered by no elements, rather than not covered\n */\nexport function getElementObscurers(element: Element): readonly Element[] | null {\n const {ownerDocument} = element;\n\n if (!ownerDocument || !ownerDocument.defaultView) {\n return null;\n }\n\n const {innerWidth, innerHeight} = ownerDocument.defaultView;\n const documentRef = getDocumentOrShadowRoot(element);\n const rect = element.getBoundingClientRect();\n const left = clamp(Math.round(rect.left) + 2, 0, innerWidth);\n const top = clamp(Math.round(rect.top) + 2, 0, innerHeight);\n const right = clamp(Math.round(rect.right) - 2, 0, innerWidth);\n const bottom = clamp(Math.round(rect.bottom) - 2, 0, innerHeight);\n const horizontalMiddle = clamp(Math.round(rect.left + rect.width / 2), 0, innerWidth);\n const verticalMiddle = clamp(Math.round(rect.top + rect.height / 2), 0, innerHeight);\n const elements = [\n documentRef.elementFromPoint(horizontalMiddle, top),\n documentRef.elementFromPoint(horizontalMiddle, bottom),\n documentRef.elementFromPoint(left, verticalMiddle),\n documentRef.elementFromPoint(right, verticalMiddle),\n ];\n const nonNull = elements.filter(isPresent);\n\n if (!nonNull.length) {\n return nonNull;\n }\n\n const filtered = nonNull.filter(el => !element.contains(el));\n\n return filtered.length === 4 ? filtered : null;\n}\n","import {tuiAssert} from '@taiga-ui/cdk/classes';\n\n/**\n * Calculates offset for an element relative to it's parent several levels above\n *\n * @param host parent element\n * @param element\n * @return object with offsetTop and offsetLeft number properties\n */\nexport function getElementOffset(\n host: Element,\n element: HTMLElement,\n): {offsetTop: number; offsetLeft: number} {\n tuiAssert.assert(host.contains(element), 'Host must contain element');\n\n let {offsetTop, offsetLeft, offsetParent} = element;\n\n // TODO: iframe warning\n while (offsetParent && offsetParent instanceof HTMLElement && offsetParent !== host) {\n offsetTop += offsetParent.offsetTop;\n offsetLeft += offsetParent.offsetLeft;\n offsetParent = offsetParent.offsetParent;\n }\n\n return {offsetTop, offsetLeft};\n}\n","/**\n * Finds nearest parent with scroll in it\n *\n * @param element initial element\n * @param vertical flag for orientation of scroll\n */\nexport function getScrollParent(\n element: Element | null,\n vertical: boolean = true,\n): Element | null {\n if (element === null) {\n return null;\n }\n\n if (vertical && element.scrollHeight > element.clientHeight) {\n return element;\n }\n\n if (!vertical && element.scrollWidth > element.clientWidth) {\n return element;\n }\n\n return getScrollParent(element.parentElement, vertical);\n}\n","export function isCurrentTarget({target, currentTarget}: Event): boolean {\n return target === currentTarget;\n}\n","/**\n * Checks if an app is running inside <iframe /> tag\n */\nexport function isInsideIframe(windowRef: Window): boolean {\n return windowRef.parent !== windowRef;\n}\n","import {getClosestElement} from './get-closest-element';\n\n/**\n * Checks if node is inside a specific selector\n *\n * @param node\n * @param selector\n * @return true if node is inside a particular selector\n */\nexport function isNodeIn(node: Node, selector: string): boolean {\n return node.nodeType === Node.TEXT_NODE\n ? !!node.parentElement && !!getClosestElement(node.parentElement, selector)\n : node.nodeType === Node.ELEMENT_NODE &&\n !!getClosestElement(node as Element, selector);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;SAAgB,SAAS,CACrB,OAAgB,EAChB,WAAoB,EACpB,QAAiB,EACjB,SAAkB;IAElB,OAAO,QAAQ;UACT,iBAAiB,CAAC,OAAO,EAAE,WAAW,EAAE,SAAS,CAAC;UAClD,mBAAmB,CAAC,OAAO,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;AAC/D,CAAC;AAED,SAAS,iBAAiB,CACtB,OAAgB,EAChB,WAAoB,EACpB,SAAkB;IAElB,IAAI,cAAc,GAAG,OAAO,CAAC;IAE7B,OAAO,cAAc,KAAK,WAAW,CAAC,aAAa,EAAE;QACjD,IACI,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS;aACtD,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,SAAS,GAAG,cAAc,CAAC,YAAY,CAAC;gBAC9D,cAAc,CAAC,YAAY;gBAC3B,SAAS,CAAC,EAChB;YACE,OAAO,IAAI,CAAC;SACf;QAED,IAAI,cAAc,CAAC,aAAa,EAAE;YAC9B,cAAc,GAAG,cAAc,CAAC,aAAa,CAAC;SACjD;aAAM;YACH,OAAO,KAAK,CAAC;SAChB;KACJ;IAED,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AE;QAClB,OAAO,IAAI,CAAC;KACf;IAED,IAAI,QAAQ,IAAI,OAAO,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,EAAE;QACzD,OAAO,OAAO,CAAC;KAClB;IAED,IAAI,CAAC,QAAQ,IAAI,OAAO,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,EAAE;QACxD,OAAO,OAAO,CAAC;KAClB;IAED,OAAO,eAAe,CAAC,OAAO,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;AAC5D;;SCvBgB,eAAe,CAAC,EAA8B;QAA7B,kBAAM,EAAE,gCAAa;IAClD,OAAO,MAAM,KAAK,aAAa,CAAC;AACpC;;ACFA;;;SAGgB,cAAc,CAAC,SAAiB;IAC5C,OAAO,SAAS,CAAC,MAAM,KAAK,SAAS,CAAC;AAC1C;;ACHA;;;;;;;SAOgB,QAAQ,CAAC,IAAU,EAAE,QAAgB;IACjD,OAAO,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,SAAS;UACjC,CAAC,CAAC,IAAI,CAAC,aAAa,IAAI,CAAC,CAAC,iBAAiB,CAAC,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC;UACzE,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,YAAY;YAC/B,CAAC,CAAC,iBAAiB,CAAC,IAAe,EAAE,QAAQ,CAAC,CAAC;AAC7D;;ACdA;;;;;;"}
|
package/package.json
CHANGED
|
@@ -102,4 +102,14 @@ exports.CONSTS_TO_REPLACE = [
|
|
|
102
102
|
namedImport: 'AbstractTuiFilterByInput',
|
|
103
103
|
},
|
|
104
104
|
},
|
|
105
|
+
{
|
|
106
|
+
from: {
|
|
107
|
+
name: 'TuiFieldErrorModule',
|
|
108
|
+
moduleSpecifier: '@taiga-ui/kit',
|
|
109
|
+
},
|
|
110
|
+
to: {
|
|
111
|
+
name: 'TuiFieldErrorPipeModule',
|
|
112
|
+
moduleSpecifier: '@taiga-ui/kit',
|
|
113
|
+
},
|
|
114
|
+
},
|
|
105
115
|
];
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const migrate_input_slider_1 = require("./migrate-input-slider");
|
|
4
|
+
const migrate_input_range_1 = require("./migrate-input-range");
|
|
4
5
|
function migrateSliders(tree) {
|
|
5
6
|
migrate_input_slider_1.migrateInputSlider(tree);
|
|
7
|
+
migrate_input_range_1.migrateInputRange(tree);
|
|
6
8
|
}
|
|
7
9
|
exports.migrateSliders = migrateSliders;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const devkit_file_system_1 = require("ng-morph/project/classes/devkit-file-system");
|
|
4
|
+
const get_component_templates_1 = require("../../../utils/templates/get-component-templates");
|
|
5
|
+
const ng_component_input_manipulations_1 = require("../../../utils/templates/ng-component-input-manipulations");
|
|
6
|
+
const ng_morph_1 = require("ng-morph");
|
|
7
|
+
const ng_component_1 = require("../../../utils/angular/ng-component");
|
|
8
|
+
const add_unique_import_1 = require("../../../utils/add-unique-import");
|
|
9
|
+
function migrateInputRange(tree) {
|
|
10
|
+
const fileSystem = new devkit_file_system_1.DevkitFileSystem(tree);
|
|
11
|
+
const templateResources = get_component_templates_1.getComponentTemplates('**/**');
|
|
12
|
+
for (const templateResource of templateResources) {
|
|
13
|
+
replaceMinLabel(templateResource, fileSystem);
|
|
14
|
+
replaceMaxLabel(templateResource, fileSystem);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.migrateInputRange = migrateInputRange;
|
|
18
|
+
function replaceMinLabel(templateResource, fileSystem) {
|
|
19
|
+
const MIGRATION_VARIABLE_NAME = 'tuiMigrationInputRangeMinLabel';
|
|
20
|
+
const wasModified = ng_component_input_manipulations_1.replaceInputProperty({
|
|
21
|
+
templateResource,
|
|
22
|
+
fileSystem,
|
|
23
|
+
componentSelector: 'tui-input-range',
|
|
24
|
+
from: 'minLabel',
|
|
25
|
+
to: '[leftValueContent]',
|
|
26
|
+
newValue: MIGRATION_VARIABLE_NAME,
|
|
27
|
+
});
|
|
28
|
+
save(fileSystem);
|
|
29
|
+
if (wasModified) {
|
|
30
|
+
addMinMaxLabelMethod(templateResource.componentPath, MIGRATION_VARIABLE_NAME, [
|
|
31
|
+
'const currentValue = context.$implicit;',
|
|
32
|
+
'const minValue = 0; // TODO replace with the MIN value of the input-range',
|
|
33
|
+
'const minLabelText = "Min"; // TODO replace with the required label',
|
|
34
|
+
'if (currentValue === minValue) return minLabelText;',
|
|
35
|
+
'return String(currentValue);',
|
|
36
|
+
]);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function replaceMaxLabel(templateResource, fileSystem) {
|
|
40
|
+
const MIGRATION_VARIABLE_NAME = 'tuiMigrationInputRangeMaxLabel';
|
|
41
|
+
const wasModified = ng_component_input_manipulations_1.replaceInputProperty({
|
|
42
|
+
templateResource,
|
|
43
|
+
fileSystem,
|
|
44
|
+
componentSelector: 'tui-input-range',
|
|
45
|
+
from: 'maxLabel',
|
|
46
|
+
to: '[rightValueContent]',
|
|
47
|
+
newValue: MIGRATION_VARIABLE_NAME,
|
|
48
|
+
});
|
|
49
|
+
save(fileSystem);
|
|
50
|
+
if (wasModified) {
|
|
51
|
+
addMinMaxLabelMethod(templateResource.componentPath, MIGRATION_VARIABLE_NAME, [
|
|
52
|
+
'const currentValue = context.$implicit;',
|
|
53
|
+
'const maxValue = 100; // TODO replace with the MAX value of the input',
|
|
54
|
+
'const maxLabelText = "Max"; // TODO replace with the required label',
|
|
55
|
+
'if (currentValue === maxValue) return maxLabelText;',
|
|
56
|
+
'return String(currentValue);',
|
|
57
|
+
]);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function addMinMaxLabelMethod(componentPath, methodName, methodCode) {
|
|
61
|
+
const [ngComponent] = ng_component_1.getNgComponents(componentPath);
|
|
62
|
+
if (ngComponent) {
|
|
63
|
+
add_unique_import_1.addUniqueImport(ngComponent.getSourceFile().getFilePath(), 'TuiContextWithImplicit', '@taiga-ui/cdk');
|
|
64
|
+
ng_morph_1.addMethods(ngComponent, {
|
|
65
|
+
name: methodName,
|
|
66
|
+
returnType: 'string',
|
|
67
|
+
parameters: [{ name: 'context', type: 'TuiContextWithImplicit<number>' }],
|
|
68
|
+
statements: methodCode,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* We should update virtual file tree after template manipulations
|
|
74
|
+
* otherwise all following ng-morph commands will overwrite all previous template manipulations
|
|
75
|
+
* */
|
|
76
|
+
function save(fileSystem) {
|
|
77
|
+
fileSystem.commitEdits();
|
|
78
|
+
ng_morph_1.saveActiveProject();
|
|
79
|
+
ng_morph_1.setActiveProject(ng_morph_1.createProject(fileSystem.tree, '/', '**/**'));
|
|
80
|
+
}
|
|
@@ -17,6 +17,7 @@ function migrateTemplates(tree) {
|
|
|
17
17
|
replaceAttrs,
|
|
18
18
|
replaceAttrsByDirective,
|
|
19
19
|
replaceBreadcrumbs,
|
|
20
|
+
replaceFieldError,
|
|
20
21
|
];
|
|
21
22
|
actions.forEach(action => {
|
|
22
23
|
componentWithTemplatesPaths.forEach(componentPath => {
|
|
@@ -71,16 +72,8 @@ function replaceTags({ resource, recorder, fileSystem, }) {
|
|
|
71
72
|
templates_1.TAGS_TO_REPLACE.forEach(({ from, to, addAttributes }) => {
|
|
72
73
|
const elements = elements_1.findElementsByTagName(template, from);
|
|
73
74
|
elements.forEach(({ sourceCodeLocation }) => {
|
|
74
|
-
var _a;
|
|
75
75
|
if (sourceCodeLocation) {
|
|
76
|
-
|
|
77
|
-
const endTagOffset = (_a = sourceCodeLocation.endTag) === null || _a === void 0 ? void 0 : _a.startOffset;
|
|
78
|
-
if (endTagOffset) {
|
|
79
|
-
recorder.remove(endTagOffset + templateOffset + END_TAG_OFFSET, from.length);
|
|
80
|
-
recorder.insertRight(endTagOffset + templateOffset + END_TAG_OFFSET, to);
|
|
81
|
-
}
|
|
82
|
-
recorder.remove(startTagOffset + templateOffset + START_TAG_OFFSET, from.length);
|
|
83
|
-
recorder.insertRight(startTagOffset + templateOffset + START_TAG_OFFSET, `${to} ${addAttributes.join(' ')}`);
|
|
76
|
+
replaceTag(recorder, sourceCodeLocation, from, to, templateOffset, addAttributes);
|
|
84
77
|
}
|
|
85
78
|
});
|
|
86
79
|
});
|
|
@@ -111,3 +104,30 @@ function replaceBreadcrumbs({ resource, recorder, fileSystem, }) {
|
|
|
111
104
|
recorder.remove(templateOffset + startOffset - 1, endOffset - startOffset + 1);
|
|
112
105
|
});
|
|
113
106
|
}
|
|
107
|
+
function replaceFieldError({ resource, recorder, fileSystem, }) {
|
|
108
|
+
const template = template_resource_1.getTemplateFromTemplateResource(resource, fileSystem);
|
|
109
|
+
const templateOffset = template_resource_1.getTemplateOffset(resource);
|
|
110
|
+
const elements = elements_1.findElementsByTagName(template, 'tui-field-error');
|
|
111
|
+
elements.forEach(element => {
|
|
112
|
+
var _a, _b;
|
|
113
|
+
const orderAttr = element.attrs.find(attr => attr.name === '[order]');
|
|
114
|
+
const orderVal = orderAttr === null || orderAttr === void 0 ? void 0 : orderAttr.value;
|
|
115
|
+
if (orderAttr) {
|
|
116
|
+
const { startOffset = 0, endOffset = 0 } = ((_b = (_a = element.sourceCodeLocation) === null || _a === void 0 ? void 0 : _a.attrs) === null || _b === void 0 ? void 0 : _b['[order]']) || {};
|
|
117
|
+
recorder.remove(templateOffset + startOffset - 1, endOffset - startOffset + 1);
|
|
118
|
+
}
|
|
119
|
+
const input = `[error]="${orderVal !== null && orderVal !== void 0 ? orderVal : '[]'} | tuiFieldError | async"`;
|
|
120
|
+
replaceTag(recorder, element.sourceCodeLocation, 'tui-field-error', 'tui-error', templateOffset, [input]);
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
function replaceTag(recorder, sourceCodeLocation, from, to, templateOffset = 0, addAttributes = []) {
|
|
124
|
+
var _a;
|
|
125
|
+
const startTagOffset = sourceCodeLocation.startTag.startOffset;
|
|
126
|
+
const endTagOffset = (_a = sourceCodeLocation.endTag) === null || _a === void 0 ? void 0 : _a.startOffset;
|
|
127
|
+
if (endTagOffset) {
|
|
128
|
+
recorder.remove(endTagOffset + templateOffset + END_TAG_OFFSET, from.length);
|
|
129
|
+
recorder.insertRight(endTagOffset + templateOffset + END_TAG_OFFSET, to);
|
|
130
|
+
}
|
|
131
|
+
recorder.remove(startTagOffset + templateOffset + START_TAG_OFFSET, from.length);
|
|
132
|
+
recorder.insertRight(startTagOffset + templateOffset + START_TAG_OFFSET, `${to} ${addAttributes.join(' ')}`);
|
|
133
|
+
}
|
package/utils/dom/index.d.ts
CHANGED
|
@@ -8,8 +8,6 @@ export * from './get-document-or-shadow-root';
|
|
|
8
8
|
export * from './get-element-obscurers';
|
|
9
9
|
export * from './get-element-offset';
|
|
10
10
|
export * from './get-scroll-parent';
|
|
11
|
-
export * from './get-viewport-height';
|
|
12
|
-
export * from './get-viewport-width';
|
|
13
11
|
export * from './is-current-target';
|
|
14
12
|
export * from './is-inside-iframe';
|
|
15
13
|
export * from './is-node-in';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"__symbolic":"module","version":4,"metadata":{"canScroll":{"__symbolic":"function","parameters":["element","rootElement","vertical","scrollEnd"],"value":{"__symbolic":"if","condition":{"__symbolic":"reference","name":"vertical"},"thenExpression":{"__symbolic":"error","message":"Reference to a non-exported function","line":11,"character":9,"context":{"name":"canScrollVertical"},"module":"./can-scroll"},"elseExpression":{"__symbolic":"error","message":"Reference to a non-exported function","line":38,"character":9,"context":{"name":"canScrollHorizontal"},"module":"./can-scroll"}}},"containsOrAfter":{"__symbolic":"function","parameters":["current","node"],"value":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"current"},"member":"contains"},"arguments":[{"__symbolic":"reference","name":"node"}]},"right":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"binop","operator":"&","left":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"node"},"member":"compareDocumentPosition"},"arguments":[{"__symbolic":"reference","name":"current"}]},"right":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"Node"},"member":"DOCUMENT_POSITION_PRECEDING"}}}}}},"tuiCustomEvent":{"__symbolic":"function"},"getActualTarget":{"__symbolic":"function"},"getClipboardDataText":{"__symbolic":"function","parameters":["event","format"],"defaults":[null,"text/plain"],"value":{"__symbolic":"if","condition":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"in","left":"clipboardData","right":{"__symbolic":"reference","name":"event"}},"right":{"__symbolic":"binop","operator":"!==","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"event"},"member":"clipboardData"},"right":null}},"thenExpression":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"event"},"member":"clipboardData"},"member":"getData"},"arguments":[{"__symbolic":"reference","name":"format"}]},"right":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"event"},"member":"clipboardData"},"member":"getData"},"arguments":["text/plain"]}},"elseExpression":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"select","expression":{"__symbolic":"select","expression":{"__symbolic":"select","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"event"},"member":"target"},"member":"ownerDocument"},"member":"defaultView"},"member":"clipboardData"},"member":"getData"},"arguments":["text"]}}},"getClosestElement":{"__symbolic":"function"},"getDocumentOrShadowRoot":{"__symbolic":"function","parameters":["node"],"value":{"__symbolic":"if","condition":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"in","left":"getRootNode","right":{"__symbolic":"reference","name":"node"}},"right":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"node"},"member":"isConnected"}},"thenExpression":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"node"},"member":"getRootNode"}},"elseExpression":{"__symbolic":"error","message":"Expression form not supported","line":3,"character":10,"module":"./get-document-or-shadow-root"}}},"getElementObscurers":{"__symbolic":"function"},"getElementOffset":{"__symbolic":"function"},"getScrollParent":{"__symbolic":"function"},"
|
|
1
|
+
{"__symbolic":"module","version":4,"metadata":{"canScroll":{"__symbolic":"function","parameters":["element","rootElement","vertical","scrollEnd"],"value":{"__symbolic":"if","condition":{"__symbolic":"reference","name":"vertical"},"thenExpression":{"__symbolic":"error","message":"Reference to a non-exported function","line":11,"character":9,"context":{"name":"canScrollVertical"},"module":"./can-scroll"},"elseExpression":{"__symbolic":"error","message":"Reference to a non-exported function","line":38,"character":9,"context":{"name":"canScrollHorizontal"},"module":"./can-scroll"}}},"containsOrAfter":{"__symbolic":"function","parameters":["current","node"],"value":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"current"},"member":"contains"},"arguments":[{"__symbolic":"reference","name":"node"}]},"right":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"binop","operator":"&","left":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"node"},"member":"compareDocumentPosition"},"arguments":[{"__symbolic":"reference","name":"current"}]},"right":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"Node"},"member":"DOCUMENT_POSITION_PRECEDING"}}}}}},"tuiCustomEvent":{"__symbolic":"function"},"getActualTarget":{"__symbolic":"function"},"getClipboardDataText":{"__symbolic":"function","parameters":["event","format"],"defaults":[null,"text/plain"],"value":{"__symbolic":"if","condition":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"in","left":"clipboardData","right":{"__symbolic":"reference","name":"event"}},"right":{"__symbolic":"binop","operator":"!==","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"event"},"member":"clipboardData"},"right":null}},"thenExpression":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"event"},"member":"clipboardData"},"member":"getData"},"arguments":[{"__symbolic":"reference","name":"format"}]},"right":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"event"},"member":"clipboardData"},"member":"getData"},"arguments":["text/plain"]}},"elseExpression":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"select","expression":{"__symbolic":"select","expression":{"__symbolic":"select","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"event"},"member":"target"},"member":"ownerDocument"},"member":"defaultView"},"member":"clipboardData"},"member":"getData"},"arguments":["text"]}}},"getClosestElement":{"__symbolic":"function"},"getDocumentOrShadowRoot":{"__symbolic":"function","parameters":["node"],"value":{"__symbolic":"if","condition":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"in","left":"getRootNode","right":{"__symbolic":"reference","name":"node"}},"right":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"node"},"member":"isConnected"}},"thenExpression":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"node"},"member":"getRootNode"}},"elseExpression":{"__symbolic":"error","message":"Expression form not supported","line":3,"character":10,"module":"./get-document-or-shadow-root"}}},"getElementObscurers":{"__symbolic":"function"},"getElementOffset":{"__symbolic":"function"},"getScrollParent":{"__symbolic":"function"},"isCurrentTarget":{"__symbolic":"function","parameters":["target","currentTarget"],"value":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"reference","name":"target"},"right":{"__symbolic":"reference","name":"currentTarget"}}},"isInsideIframe":{"__symbolic":"function","parameters":["windowRef"],"value":{"__symbolic":"binop","operator":"!==","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"windowRef"},"member":"parent"},"right":{"__symbolic":"reference","name":"windowRef"}}},"isNodeIn":{"__symbolic":"function","parameters":["node","selector"],"value":{"__symbolic":"if","condition":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"node"},"member":"nodeType"},"right":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"Node"},"member":"TEXT_NODE"}},"thenExpression":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"node"},"member":"parentElement"}}},"right":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"getClosestElement"},"arguments":[{"__symbolic":"select","expression":{"__symbolic":"reference","name":"node"},"member":"parentElement"},{"__symbolic":"reference","name":"selector"}]}}}},"elseExpression":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"node"},"member":"nodeType"},"right":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"Node"},"member":"ELEMENT_NODE"}},"right":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"getClosestElement"},"arguments":[{"__symbolic":"reference","name":"node"},{"__symbolic":"reference","name":"selector"}]}}}}}}},"origins":{"canScroll":"./can-scroll","containsOrAfter":"./contains-or-after","tuiCustomEvent":"./custom-event","getActualTarget":"./get-actual-target","getClipboardDataText":"./get-clipboard-data-text","getClosestElement":"./get-closest-element","getDocumentOrShadowRoot":"./get-document-or-shadow-root","getElementObscurers":"./get-element-obscurers","getElementOffset":"./get-element-offset","getScrollParent":"./get-scroll-parent","isCurrentTarget":"./is-current-target","isInsideIframe":"./is-inside-iframe","isNodeIn":"./is-node-in"},"importAs":"@taiga-ui/cdk/utils/dom"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description:
|
|
3
|
-
* Cross-browser @media (height)
|
|
4
|
-
*
|
|
5
|
-
* 1. window.innerWidth
|
|
6
|
-
* 1.1. gets CSS viewport @media (height) which include scrollbars
|
|
7
|
-
* 1.2. initial-scale and zoom variations may cause mobile values to
|
|
8
|
-
* wrongly scale down to what PPK calls the visual
|
|
9
|
-
* viewport and be smaller than the @media values
|
|
10
|
-
* 1.3. zoom may cause values to be 1px off due to native rounding
|
|
11
|
-
*
|
|
12
|
-
* 2. document.documentElement.clientHeight
|
|
13
|
-
* 2.1. equals CSS viewport width minus scrollbar width
|
|
14
|
-
* 2.2. matches @media (height) when there is no scrollbar
|
|
15
|
-
* 2.3. available cross-browser
|
|
16
|
-
* 2.4. inaccurate if doctype is missing
|
|
17
|
-
*/
|
|
18
|
-
export function tuiGetViewportHeight({ document, innerHeight }) {
|
|
19
|
-
return Math.max(document.documentElement.clientHeight || 0, innerHeight || 0);
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0LXZpZXdwb3J0LWhlaWdodC5qcyIsInNvdXJjZVJvb3QiOiJuZzovL0B0YWlnYS11aS9jZGsvdXRpbHMvZG9tLyIsInNvdXJjZXMiOlsiZ2V0LXZpZXdwb3J0LWhlaWdodC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7Ozs7Ozs7Ozs7OztHQWdCRztBQUNILE1BQU0sVUFBVSxvQkFBb0IsQ0FBQyxFQUFDLFFBQVEsRUFBRSxXQUFXLEVBQVM7SUFDaEUsT0FBTyxJQUFJLENBQUMsR0FBRyxDQUFDLFFBQVEsQ0FBQyxlQUFlLENBQUMsWUFBWSxJQUFJLENBQUMsRUFBRSxXQUFXLElBQUksQ0FBQyxDQUFDLENBQUM7QUFDbEYsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogQGRlc2NyaXB0aW9uOlxuICogQ3Jvc3MtYnJvd3NlciBAbWVkaWEgKGhlaWdodClc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
|
|
2
|
-
* @description:
|
|
3
|
-
* Cross-browser @media (width)
|
|
4
|
-
*
|
|
5
|
-
* 1. window.innerWidth
|
|
6
|
-
* 1.1. gets CSS viewport @media (width) which include scrollbars
|
|
7
|
-
* 1.2. initial-scale and zoom variations may cause mobile values to
|
|
8
|
-
* wrongly scale down to what PPK calls the visual
|
|
9
|
-
* viewport and be smaller than the @media values
|
|
10
|
-
* 1.3. zoom may cause values to be 1px off due to native rounding
|
|
11
|
-
*
|
|
12
|
-
* 2. document.documentElement.clientWidth
|
|
13
|
-
* 2.1. equals CSS viewport width minus scrollbar width
|
|
14
|
-
* 2.2. matches @media (width) when there is no scrollbar
|
|
15
|
-
* 2.3. available cross-browser
|
|
16
|
-
* 2.4. inaccurate if doctype is missing
|
|
17
|
-
*/
|
|
18
|
-
export function tuiGetViewportWidth({ document, innerWidth }) {
|
|
19
|
-
return Math.max(document.documentElement.clientWidth || 0, innerWidth || 0);
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0LXZpZXdwb3J0LXdpZHRoLmpzIiwic291cmNlUm9vdCI6Im5nOi8vQHRhaWdhLXVpL2Nkay91dGlscy9kb20vIiwic291cmNlcyI6WyJnZXQtdmlld3BvcnQtd2lkdGgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7Ozs7Ozs7Ozs7Ozs7R0FnQkc7QUFDSCxNQUFNLFVBQVUsbUJBQW1CLENBQUMsRUFBQyxRQUFRLEVBQUUsVUFBVSxFQUFTO0lBQzlELE9BQU8sSUFBSSxDQUFDLEdBQUcsQ0FBQyxRQUFRLENBQUMsZUFBZSxDQUFDLFdBQVcsSUFBSSxDQUFDLEVBQUUsVUFBVSxJQUFJLENBQUMsQ0FBQyxDQUFDO0FBQ2hGLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEBkZXNjcmlwdGlvbjpcbiAqIENyb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,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description:
|
|
3
|
-
* Cross-browser @media (height)
|
|
4
|
-
*
|
|
5
|
-
* 1. window.innerWidth
|
|
6
|
-
* 1.1. gets CSS viewport @media (height) which include scrollbars
|
|
7
|
-
* 1.2. initial-scale and zoom variations may cause mobile values to
|
|
8
|
-
* wrongly scale down to what PPK calls the visual
|
|
9
|
-
* viewport and be smaller than the @media values
|
|
10
|
-
* 1.3. zoom may cause values to be 1px off due to native rounding
|
|
11
|
-
*
|
|
12
|
-
* 2. document.documentElement.clientHeight
|
|
13
|
-
* 2.1. equals CSS viewport width minus scrollbar width
|
|
14
|
-
* 2.2. matches @media (height) when there is no scrollbar
|
|
15
|
-
* 2.3. available cross-browser
|
|
16
|
-
* 2.4. inaccurate if doctype is missing
|
|
17
|
-
*/
|
|
18
|
-
export function tuiGetViewportHeight(_a) {
|
|
19
|
-
var document = _a.document, innerHeight = _a.innerHeight;
|
|
20
|
-
return Math.max(document.documentElement.clientHeight || 0, innerHeight || 0);
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0LXZpZXdwb3J0LWhlaWdodC5qcyIsInNvdXJjZVJvb3QiOiJuZzovL0B0YWlnYS11aS9jZGsvdXRpbHMvZG9tLyIsInNvdXJjZXMiOlsiZ2V0LXZpZXdwb3J0LWhlaWdodC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7Ozs7Ozs7Ozs7OztHQWdCRztBQUNILE1BQU0sVUFBVSxvQkFBb0IsQ0FBQyxFQUErQjtRQUE5QixzQkFBUSxFQUFFLDRCQUFXO0lBQ3ZELE9BQU8sSUFBSSxDQUFDLEdBQUcsQ0FBQyxRQUFRLENBQUMsZUFBZSxDQUFDLFlBQVksSUFBSSxDQUFDLEVBQUUsV0FBVyxJQUFJLENBQUMsQ0FBQyxDQUFDO0FBQ2xGLENBQU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5jbGllbnRIZWlnaHQgfHwgMCwgaW5uZXJIZWlnaHQgfHwgMCk7XG59XG4iXX0=
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description:
|
|
3
|
-
* Cross-browser @media (width)
|
|
4
|
-
*
|
|
5
|
-
* 1. window.innerWidth
|
|
6
|
-
* 1.1. gets CSS viewport @media (width) which include scrollbars
|
|
7
|
-
* 1.2. initial-scale and zoom variations may cause mobile values to
|
|
8
|
-
* wrongly scale down to what PPK calls the visual
|
|
9
|
-
* viewport and be smaller than the @media values
|
|
10
|
-
* 1.3. zoom may cause values to be 1px off due to native rounding
|
|
11
|
-
*
|
|
12
|
-
* 2. document.documentElement.clientWidth
|
|
13
|
-
* 2.1. equals CSS viewport width minus scrollbar width
|
|
14
|
-
* 2.2. matches @media (width) when there is no scrollbar
|
|
15
|
-
* 2.3. available cross-browser
|
|
16
|
-
* 2.4. inaccurate if doctype is missing
|
|
17
|
-
*/
|
|
18
|
-
export function tuiGetViewportWidth(_a) {
|
|
19
|
-
var document = _a.document, innerWidth = _a.innerWidth;
|
|
20
|
-
return Math.max(document.documentElement.clientWidth || 0, innerWidth || 0);
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0LXZpZXdwb3J0LXdpZHRoLmpzIiwic291cmNlUm9vdCI6Im5nOi8vQHRhaWdhLXVpL2Nkay91dGlscy9kb20vIiwic291cmNlcyI6WyJnZXQtdmlld3BvcnQtd2lkdGgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7Ozs7Ozs7Ozs7Ozs7R0FnQkc7QUFDSCxNQUFNLFVBQVUsbUJBQW1CLENBQUMsRUFBOEI7UUFBN0Isc0JBQVEsRUFBRSwwQkFBVTtJQUNyRCxPQUFPLElBQUksQ0FBQyxHQUFHLENBQUMsUUFBUSxDQUFDLGVBQWUsQ0FBQyxXQUFXLElB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ldHVybiBNYXRoLm1heChkb2N1bWVudC5kb2N1bWVudEVsZW1lbnQuY2xpZW50V2lkdGggfHwgMCwgaW5uZXJXaWR0aCB8fCAwKTtcbn1cbiJdfQ==
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description:
|
|
3
|
-
* Cross-browser @media (height)
|
|
4
|
-
*
|
|
5
|
-
* 1. window.innerWidth
|
|
6
|
-
* 1.1. gets CSS viewport @media (height) which include scrollbars
|
|
7
|
-
* 1.2. initial-scale and zoom variations may cause mobile values to
|
|
8
|
-
* wrongly scale down to what PPK calls the visual
|
|
9
|
-
* viewport and be smaller than the @media values
|
|
10
|
-
* 1.3. zoom may cause values to be 1px off due to native rounding
|
|
11
|
-
*
|
|
12
|
-
* 2. document.documentElement.clientHeight
|
|
13
|
-
* 2.1. equals CSS viewport width minus scrollbar width
|
|
14
|
-
* 2.2. matches @media (height) when there is no scrollbar
|
|
15
|
-
* 2.3. available cross-browser
|
|
16
|
-
* 2.4. inaccurate if doctype is missing
|
|
17
|
-
*/
|
|
18
|
-
export declare function tuiGetViewportHeight({ document, innerHeight }: Window): number;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description:
|
|
3
|
-
* Cross-browser @media (width)
|
|
4
|
-
*
|
|
5
|
-
* 1. window.innerWidth
|
|
6
|
-
* 1.1. gets CSS viewport @media (width) which include scrollbars
|
|
7
|
-
* 1.2. initial-scale and zoom variations may cause mobile values to
|
|
8
|
-
* wrongly scale down to what PPK calls the visual
|
|
9
|
-
* viewport and be smaller than the @media values
|
|
10
|
-
* 1.3. zoom may cause values to be 1px off due to native rounding
|
|
11
|
-
*
|
|
12
|
-
* 2. document.documentElement.clientWidth
|
|
13
|
-
* 2.1. equals CSS viewport width minus scrollbar width
|
|
14
|
-
* 2.2. matches @media (width) when there is no scrollbar
|
|
15
|
-
* 2.3. available cross-browser
|
|
16
|
-
* 2.4. inaccurate if doctype is missing
|
|
17
|
-
*/
|
|
18
|
-
export declare function tuiGetViewportWidth({ document, innerWidth }: Window): number;
|