@elliemae/ds-hooks-fontsize-detector 3.22.0-next.25 → 3.22.0-next.27
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/dist/cjs/DSHooksFontsizeDetector.js.map +1 -1
- package/dist/cjs/constants/index.js.map +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/react-desc-prop-types.js.map +1 -1
- package/dist/esm/DSHooksFontsizeDetector.js.map +1 -1
- package/dist/esm/constants/index.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/react-desc-prop-types.js.map +1 -1
- package/package.json +9 -9
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/DSHooksFontsizeDetector.tsx", "
|
|
3
|
+
"sources": ["../../src/DSHooksFontsizeDetector.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["import React, { useState, useEffect, useMemo, useCallback } from 'react';\nimport { appendComponentIfNotExist, debounce } from '@elliemae/ds-utilities';\nimport { FONT_DETECTOR_UID, BREAKPOINTS } from './constants/index.js';\nimport { type DSHooksFontsizeDetectorT } from './react-desc-prop-types.js';\n\ntype ResizeObserverConstructorEntries = Parameters<ConstructorParameters<typeof ResizeObserver>[0]>[0];\n\nconst FontDetectorElement = React.memo(() => (\n <p\n aria-hidden=\"true\"\n id={FONT_DETECTOR_UID}\n data-testid={FONT_DETECTOR_UID}\n style={{\n margin: 0,\n color: 'transparent',\n position: 'absolute',\n }}\n >\n \n </p>\n));\n\nconst useResizeObserver = (ref: HTMLElement | null): number => {\n const [dimensions, setDimensions] = React.useState<number>(0);\n\n useEffect(() => {\n const resizeObserver = new ResizeObserver((entries: ResizeObserverConstructorEntries) => {\n entries.forEach((entry) => {\n setDimensions(Math.ceil(entry.contentRect.height));\n });\n });\n if (ref) {\n resizeObserver.observe(ref);\n }\n\n return () => {\n if (ref) {\n resizeObserver.unobserve(ref);\n }\n };\n }, [ref]);\n return dimensions;\n};\n\nconst useFontSizeDetector = (): DSHooksFontsizeDetectorT.UseFontSizeDetectorT => {\n const [ref, setRef] = useState<HTMLElement | null>(null);\n const [parentWidth, setParentWidth] = useState<number>(document.documentElement.clientWidth);\n const fontHeight = useResizeObserver(ref);\n\n useEffect(() => {\n const retrieveElement = async () => {\n const elementAppended = await appendComponentIfNotExist({\n Component: FontDetectorElement,\n uidSelector: FONT_DETECTOR_UID,\n tagName: 'font-size',\n });\n setRef(elementAppended);\n };\n retrieveElement().catch(() => {});\n }, []);\n\n const ratio = useMemo(() => Math.floor(parentWidth / (fontHeight || 1)), [fontHeight, parentWidth]);\n\n const viewPortChange = useCallback(\n debounce(() => {\n setParentWidth(document.documentElement.clientWidth);\n }, 200),\n [],\n );\n\n useEffect(() => {\n window.addEventListener('resize', viewPortChange);\n return () => {\n window.removeEventListener('resize', viewPortChange);\n };\n }, [viewPortChange]);\n return {\n ratio,\n fontHeight,\n documentWidthRatio: parentWidth,\n isLarge: ratio <= BREAKPOINTS.large,\n isMedium: ratio > BREAKPOINTS.large && ratio <= BREAKPOINTS.medimum,\n isSmall: ratio > BREAKPOINTS.small,\n };\n};\n\nexport { useFontSizeDetector };\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADQrB;AARF,mBAAiE;AACjE,0BAAoD;AACpD,uBAA+C;AAK/C,MAAM,sBAAsB,aAAAA,QAAM,KAAK,MACrC;AAAA,EAAC;AAAA;AAAA,IACC,eAAY;AAAA,IACZ,IAAI;AAAA,IACJ,eAAa;AAAA,IACb,OAAO;AAAA,MACL,QAAQ;AAAA,MACR,OAAO;AAAA,MACP,UAAU;AAAA,IACZ;AAAA,IACD;AAAA;AAED,CACD;AAED,MAAM,oBAAoB,CAAC,QAAoC;AAC7D,QAAM,CAAC,YAAY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,IACL;AAAA,IACA;AAAA,IACA,oBAAoB;AAAA,IACpB,SAAS,SAAS,6BAAY;AAAA,IAC9B,UAAU,QAAQ,6BAAY,SAAS,SAAS,6BAAY;AAAA,IAC5D,SAAS,QAAQ,6BAAY;AAAA,EAC/B;AACF;",
|
|
6
6
|
"names": ["React"]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../src/constants/index.ts", "
|
|
3
|
+
"sources": ["../../../src/constants/index.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["export const FONT_DETECTOR_UID = 'DS_FONT_DETECTOR';\n\nexport const BREAKPOINTS = {\n large: 30,\n medimum: 40,\n small: 60,\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,oBAAoB;AAE1B,MAAM,cAAc;AAAA,EACzB,OAAO;AAAA,EACP,SAAS;AAAA,EACT,OAAO;AACT;",
|
|
6
6
|
"names": []
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/index.ts", "
|
|
3
|
+
"sources": ["../../src/index.ts", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["// this is a workaround to typescript error TS2742\n// https://github.com/microsoft/TypeScript/issues/47663\nimport type {} from '@xstyled/system';\nexport { useFontSizeDetector } from './DSHooksFontsizeDetector.js';\nexport { FONT_DETECTOR_UID } from './constants/index.js';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGvB,qCAAoC;AACpC,uBAAkC;",
|
|
6
6
|
"names": []
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/react-desc-prop-types.ts", "
|
|
3
|
+
"sources": ["../../src/react-desc-prop-types.ts", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-empty-interface */\n\nexport declare namespace DSHooksFontsizeDetectorT {\n export interface UseFontSizeDetectorT {\n ratio: number;\n fontHeight: number;\n documentWidthRatio: number;\n isSmall: boolean;\n isMedium: boolean;\n isLarge: boolean;\n }\n}\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;ACAA,YAAuB;",
|
|
6
6
|
"names": []
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/DSHooksFontsizeDetector.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useState, useEffect, useMemo, useCallback } from 'react';\nimport { appendComponentIfNotExist, debounce } from '@elliemae/ds-utilities';\nimport { FONT_DETECTOR_UID, BREAKPOINTS } from './constants/index.js';\nimport { type DSHooksFontsizeDetectorT } from './react-desc-prop-types.js';\n\ntype ResizeObserverConstructorEntries = Parameters<ConstructorParameters<typeof ResizeObserver>[0]>[0];\n\nconst FontDetectorElement = React.memo(() => (\n <p\n aria-hidden=\"true\"\n id={FONT_DETECTOR_UID}\n data-testid={FONT_DETECTOR_UID}\n style={{\n margin: 0,\n color: 'transparent',\n position: 'absolute',\n }}\n >\n \n </p>\n));\n\nconst useResizeObserver = (ref: HTMLElement | null): number => {\n const [dimensions, setDimensions] = React.useState<number>(0);\n\n useEffect(() => {\n const resizeObserver = new ResizeObserver((entries: ResizeObserverConstructorEntries) => {\n entries.forEach((entry) => {\n setDimensions(Math.ceil(entry.contentRect.height));\n });\n });\n if (ref) {\n resizeObserver.observe(ref);\n }\n\n return () => {\n if (ref) {\n resizeObserver.unobserve(ref);\n }\n };\n }, [ref]);\n return dimensions;\n};\n\nconst useFontSizeDetector = (): DSHooksFontsizeDetectorT.UseFontSizeDetectorT => {\n const [ref, setRef] = useState<HTMLElement | null>(null);\n const [parentWidth, setParentWidth] = useState<number>(document.documentElement.clientWidth);\n const fontHeight = useResizeObserver(ref);\n\n useEffect(() => {\n const retrieveElement = async () => {\n const elementAppended = await appendComponentIfNotExist({\n Component: FontDetectorElement,\n uidSelector: FONT_DETECTOR_UID,\n tagName: 'font-size',\n });\n setRef(elementAppended);\n };\n retrieveElement().catch(() => {});\n }, []);\n\n const ratio = useMemo(() => Math.floor(parentWidth / (fontHeight || 1)), [fontHeight, parentWidth]);\n\n const viewPortChange = useCallback(\n debounce(() => {\n setParentWidth(document.documentElement.clientWidth);\n }, 200),\n [],\n );\n\n useEffect(() => {\n window.addEventListener('resize', viewPortChange);\n return () => {\n window.removeEventListener('resize', viewPortChange);\n };\n }, [viewPortChange]);\n return {\n ratio,\n fontHeight,\n documentWidthRatio: parentWidth,\n isLarge: ratio <= BREAKPOINTS.large,\n isMedium: ratio > BREAKPOINTS.large && ratio <= BREAKPOINTS.medimum,\n isSmall: ratio > BREAKPOINTS.small,\n };\n};\n\nexport { useFontSizeDetector };\n"],
|
|
5
5
|
"mappings": "AAAA,YAAY,WAAW;ACQrB;AARF,OAAOA,UAAS,UAAU,WAAW,SAAS,mBAAmB;AACjE,SAAS,2BAA2B,gBAAgB;AACpD,SAAS,mBAAmB,mBAAmB;AAK/C,MAAM,sBAAsBA,OAAM,KAAK,MACrC;AAAA,EAAC;AAAA;AAAA,IACC,eAAY;AAAA,IACZ,IAAI;AAAA,IACJ,eAAa;AAAA,IACb,OAAO;AAAA,MACL,QAAQ;AAAA,MACR,OAAO;AAAA,MACP,UAAU;AAAA,IACZ;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AAc;AAAA,IACrD;AAAA,EACF,GAAG,CAAC,cAAc,CAAC;AACnB,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,oBAAoB;AAAA,IACpB,SAAS,SAAS,YAAY;AAAA,IAC9B,UAAU,QAAQ,YAAY,SAAS,SAAS,YAAY;AAAA,IAC5D,SAAS,QAAQ,YAAY;AAAA,EAC/B;AACF;",
|
|
6
6
|
"names": ["React"]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/constants/index.ts"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const FONT_DETECTOR_UID = 'DS_FONT_DETECTOR';\n\nexport const BREAKPOINTS = {\n large: 30,\n medimum: 40,\n small: 60,\n};\n"],
|
|
5
5
|
"mappings": "AAAA,YAAY,WAAW;ACAhB,MAAM,oBAAoB;AAE1B,MAAM,cAAc;AAAA,EACzB,OAAO;AAAA,EACP,SAAS;AAAA,EACT,OAAO;AACT;",
|
|
6
6
|
"names": []
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/index.ts"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "// this is a workaround to typescript error TS2742\n// https://github.com/microsoft/TypeScript/issues/47663\nimport type {} from '@xstyled/system';\nexport { useFontSizeDetector } from './DSHooksFontsizeDetector.js';\nexport { FONT_DETECTOR_UID } from './constants/index.js';\n"],
|
|
5
5
|
"mappings": "AAAA,YAAY,WAAW;ACGvB,SAAS,2BAA2B;AACpC,SAAS,yBAAyB;",
|
|
6
6
|
"names": []
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n"],
|
|
5
5
|
"mappings": "AAAA,YAAY,WAAW;",
|
|
6
6
|
"names": []
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-hooks-fontsize-detector",
|
|
3
|
-
"version": "3.22.0-next.
|
|
3
|
+
"version": "3.22.0-next.27",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Hooks Fontsize Detector",
|
|
6
6
|
"files": [
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@xstyled/system": "3.7.0",
|
|
39
|
-
"@elliemae/ds-utilities": "3.22.0-next.
|
|
39
|
+
"@elliemae/ds-utilities": "3.22.0-next.27"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@elliemae/pui-cli": "~9.0.0-next.22",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@testing-library/user-event": "~13.5.0",
|
|
45
45
|
"styled-components": "~5.3.9",
|
|
46
46
|
"styled-system": "~5.1.5",
|
|
47
|
-
"@elliemae/ds-monorepo-devops": "3.22.0-next.
|
|
47
|
+
"@elliemae/ds-monorepo-devops": "3.22.0-next.27"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"lodash": "^4.17.21",
|
|
@@ -58,15 +58,15 @@
|
|
|
58
58
|
"typeSafety": false
|
|
59
59
|
},
|
|
60
60
|
"scripts": {
|
|
61
|
-
"dev": "cross-env NODE_ENV=development node
|
|
61
|
+
"dev": "cross-env NODE_ENV=development node ../../../scripts/build/build.mjs --watch",
|
|
62
62
|
"test": "pui-cli test --passWithNoTests",
|
|
63
|
-
"lint": "node
|
|
64
|
-
"eslint:fix": "eslint --ext='.js,.jsx,.test.js,.ts,.tsx' --fix --config='
|
|
65
|
-
"dts": "node
|
|
63
|
+
"lint": "node ../../../scripts/lint.mjs --fix",
|
|
64
|
+
"eslint:fix": "eslint --ext='.js,.jsx,.test.js,.ts,.tsx' --fix --config='../../../.eslintrc.js' src/",
|
|
65
|
+
"dts": "node ../../../scripts/dts.mjs",
|
|
66
66
|
"dts:withdeps": "pnpm --filter {.}... dts",
|
|
67
|
-
"build": "cross-env NODE_ENV=production node
|
|
67
|
+
"build": "cross-env NODE_ENV=production node ../../../scripts/build/build.mjs",
|
|
68
68
|
"dev:build": "pnpm --filter {.}... build",
|
|
69
69
|
"dev:install": "pnpm --filter {.}... i --no-lockfile && pnpm run dev:build",
|
|
70
|
-
"checkDeps": "npx -yes
|
|
70
|
+
"checkDeps": "npx -yes ../../util/ds-codemods check-missing-packages --projectFolderPath=\"./\" --ignorePackagesGlobPattern=\"\" --ignoreFilesGlobPattern=\"**/test-ables/*,**/tests/*\""
|
|
71
71
|
}
|
|
72
72
|
}
|