freewind-ts-utils 0.18.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.
Files changed (348) hide show
  1. package/README.md +60 -0
  2. package/antd/CopyButton/CopyButton.d.ts +7 -0
  3. package/antd/CopyButton/CopyButton.js +29 -0
  4. package/antd/CopyButton/index.d.ts +1 -0
  5. package/antd/CopyButton/index.js +2 -0
  6. package/antd/FloatLabel/FloatLabel.css +18 -0
  7. package/antd/FloatLabel/FloatLabel.d.ts +8 -0
  8. package/antd/FloatLabel/FloatLabel.js +50 -0
  9. package/antd/FloatLabel/index.d.ts +1 -0
  10. package/antd/FloatLabel/index.js +2 -0
  11. package/antd/FuzzyAutoComplete/FuzzyAutoComplete.d.ts +17 -0
  12. package/antd/FuzzyAutoComplete/FuzzyAutoComplete.js +73 -0
  13. package/antd/FuzzyAutoComplete/index.d.ts +1 -0
  14. package/antd/FuzzyAutoComplete/index.js +2 -0
  15. package/antd/FuzzyPathSelect/FuzzyPathSelect.d.ts +8 -0
  16. package/antd/FuzzyPathSelect/FuzzyPathSelect.js +48 -0
  17. package/antd/FuzzyPathSelect/defaultIgnoreNames.d.ts +1 -0
  18. package/antd/FuzzyPathSelect/defaultIgnoreNames.js +28 -0
  19. package/antd/FuzzyPathSelect/index.d.ts +1 -0
  20. package/antd/FuzzyPathSelect/index.js +2 -0
  21. package/antd/FuzzyStringSelect/FuzzyStringSelect.d.ts +6 -0
  22. package/antd/FuzzyStringSelect/FuzzyStringSelect.js +12 -0
  23. package/antd/FuzzyStringSelect/index.d.ts +1 -0
  24. package/antd/FuzzyStringSelect/index.js +2 -0
  25. package/antd/HoverSwap/HoverSwap.css +3 -0
  26. package/antd/HoverSwap/HoverSwap.d.ts +8 -0
  27. package/antd/HoverSwap/HoverSwap.js +18 -0
  28. package/antd/HoverSwap/index.d.ts +1 -0
  29. package/antd/HoverSwap/index.js +2 -0
  30. package/antd/InputLabel/InputLabel.css +10 -0
  31. package/antd/InputLabel/InputLabel.d.ts +4 -0
  32. package/antd/InputLabel/InputLabel.js +11 -0
  33. package/antd/InputLabel/index.d.ts +1 -0
  34. package/antd/InputLabel/index.js +2 -0
  35. package/antd/JsonPreviewer/JsonPreviewer.css +74 -0
  36. package/antd/JsonPreviewer/JsonPreviewer.d.ts +11 -0
  37. package/antd/JsonPreviewer/JsonPreviewer.js +69 -0
  38. package/antd/JsonPreviewer/index.d.ts +1 -0
  39. package/antd/JsonPreviewer/index.js +2 -0
  40. package/antd/_internal/HighlightParts.d.ts +6 -0
  41. package/antd/_internal/HighlightParts.js +12 -0
  42. package/antd/index.d.ts +8 -0
  43. package/antd/index.js +17 -0
  44. package/common/SimpleType.d.ts +2 -0
  45. package/common/SimpleType.js +0 -0
  46. package/common/_internal/createObjectReferenceTracker.d.ts +5 -0
  47. package/common/_internal/createObjectReferenceTracker.js +11 -0
  48. package/common/anyToString/anyToString.d.ts +27 -0
  49. package/common/anyToString/anyToString.js +23 -0
  50. package/common/anyToString/createCircularStackTracker.d.ts +5 -0
  51. package/common/anyToString/createCircularStackTracker.js +14 -0
  52. package/common/anyToString/formatters/formatArray.d.ts +2 -0
  53. package/common/anyToString/formatters/formatArray.js +11 -0
  54. package/common/anyToString/formatters/formatArrayBufferView.d.ts +2 -0
  55. package/common/anyToString/formatters/formatArrayBufferView.js +14 -0
  56. package/common/anyToString/formatters/formatDocumentObject.d.ts +1 -0
  57. package/common/anyToString/formatters/formatDocumentObject.js +7 -0
  58. package/common/anyToString/formatters/formatElementObject.d.ts +1 -0
  59. package/common/anyToString/formatters/formatElementObject.js +15 -0
  60. package/common/anyToString/formatters/formatError.d.ts +1 -0
  61. package/common/anyToString/formatters/formatError.js +7 -0
  62. package/common/anyToString/formatters/formatFunction.d.ts +1 -0
  63. package/common/anyToString/formatters/formatFunction.js +6 -0
  64. package/common/anyToString/formatters/formatMap.d.ts +2 -0
  65. package/common/anyToString/formatters/formatMap.js +17 -0
  66. package/common/anyToString/formatters/formatObject.d.ts +2 -0
  67. package/common/anyToString/formatters/formatObject.js +44 -0
  68. package/common/anyToString/formatters/formatObjectKey.d.ts +1 -0
  69. package/common/anyToString/formatters/formatObjectKey.js +8 -0
  70. package/common/anyToString/formatters/formatRecordLike.d.ts +2 -0
  71. package/common/anyToString/formatters/formatRecordLike.js +39 -0
  72. package/common/anyToString/formatters/formatSet.d.ts +2 -0
  73. package/common/anyToString/formatters/formatSet.js +17 -0
  74. package/common/anyToString/formatters/formatString.d.ts +1 -0
  75. package/common/anyToString/formatters/formatString.js +8 -0
  76. package/common/anyToString/formatters/formatValue.d.ts +11 -0
  77. package/common/anyToString/formatters/formatValue.js +20 -0
  78. package/common/anyToString/formatters/formatWindowObject.d.ts +1 -0
  79. package/common/anyToString/formatters/formatWindowObject.js +6 -0
  80. package/common/anyToString/formatters/getConstructorName.d.ts +1 -0
  81. package/common/anyToString/formatters/getConstructorName.js +7 -0
  82. package/common/anyToString/formatters/joinBlock.d.ts +1 -0
  83. package/common/anyToString/formatters/joinBlock.js +9 -0
  84. package/common/anyToString/formatters/withCircularGuard.d.ts +2 -0
  85. package/common/anyToString/formatters/withCircularGuard.js +11 -0
  86. package/common/anyToString/index.d.ts +1 -0
  87. package/common/anyToString/index.js +2 -0
  88. package/common/assertsType.d.ts +12 -0
  89. package/common/assertsType.js +4 -0
  90. package/common/buildSequence.d.ts +6 -0
  91. package/common/buildSequence.js +8 -0
  92. package/common/deepClone.d.ts +12 -0
  93. package/common/deepClone.js +55 -0
  94. package/common/deepEqual.d.ts +12 -0
  95. package/common/deepEqual.js +46 -0
  96. package/common/deepParseJsonStrings.d.ts +1 -0
  97. package/common/deepParseJsonStrings.js +22 -0
  98. package/common/dependsOn.d.ts +12 -0
  99. package/common/dependsOn.js +4 -0
  100. package/common/doExpr.d.ts +14 -0
  101. package/common/doExpr.js +6 -0
  102. package/common/flatChildren.d.ts +1 -0
  103. package/common/flatChildren.js +14 -0
  104. package/common/formatDecimal.d.ts +12 -0
  105. package/common/formatDecimal.js +11 -0
  106. package/common/formatFriendlyTime.d.ts +1 -0
  107. package/common/formatFriendlyTime.js +10 -0
  108. package/common/formatSize.d.ts +13 -0
  109. package/common/formatSize.js +19 -0
  110. package/common/fuzzy/fuzzyMatch.d.ts +25 -0
  111. package/common/fuzzy/fuzzyMatch.js +19 -0
  112. package/common/fuzzy/fuzzyMatchPath.d.ts +23 -0
  113. package/common/fuzzy/fuzzyMatchPath.js +102 -0
  114. package/common/fuzzy/types.d.ts +10 -0
  115. package/common/fuzzy/types.js +0 -0
  116. package/common/fuzzy/utils/buildHighlightParts.d.ts +4 -0
  117. package/common/fuzzy/utils/buildHighlightParts.js +21 -0
  118. package/common/fuzzy/utils/buildHighlightRanges.d.ts +1 -0
  119. package/common/fuzzy/utils/buildHighlightRanges.js +20 -0
  120. package/common/fuzzy/utils/index.d.ts +5 -0
  121. package/common/fuzzy/utils/index.js +6 -0
  122. package/common/fuzzy/utils/normalizePathSeparators.d.ts +1 -0
  123. package/common/fuzzy/utils/normalizePathSeparators.js +7 -0
  124. package/common/fuzzy/utils/rankFuzzyCandidates.d.ts +2 -0
  125. package/common/fuzzy/utils/rankFuzzyCandidates.js +26 -0
  126. package/common/fuzzy/utils/scoreLooseFuzzyMatch.d.ts +2 -0
  127. package/common/fuzzy/utils/scoreLooseFuzzyMatch.js +126 -0
  128. package/common/getEnumerableOwnDescriptors.d.ts +1 -0
  129. package/common/getEnumerableOwnDescriptors.js +11 -0
  130. package/common/index.d.ts +49 -0
  131. package/common/index.js +48 -0
  132. package/common/isEmptyRecord.d.ts +10 -0
  133. package/common/isEmptyRecord.js +7 -0
  134. package/common/isNil.d.ts +13 -0
  135. package/common/isNil.js +6 -0
  136. package/common/isNonNil.d.ts +11 -0
  137. package/common/isNonNil.js +6 -0
  138. package/common/isRecord.d.ts +12 -0
  139. package/common/isRecord.js +8 -0
  140. package/common/jsonRecord/filterJsonRecord.d.ts +16 -0
  141. package/common/jsonRecord/filterJsonRecord.js +19 -0
  142. package/common/jsonRecord/isJsonRecord.d.ts +16 -0
  143. package/common/jsonRecord/isJsonRecord.js +16 -0
  144. package/common/jsonRecord/jsonRecordDiff.d.ts +13 -0
  145. package/common/jsonRecord/jsonRecordDiff.js +26 -0
  146. package/common/jsonRecord/mapJsonRecord.d.ts +13 -0
  147. package/common/jsonRecord/mapJsonRecord.js +14 -0
  148. package/common/jsonRecord/modifyJsonRecord.d.ts +14 -0
  149. package/common/jsonRecord/modifyJsonRecord.js +24 -0
  150. package/common/jsonRecord/walkJsonRecord.d.ts +15 -0
  151. package/common/jsonRecord/walkJsonRecord.js +16 -0
  152. package/common/onlyUnique.d.ts +10 -0
  153. package/common/onlyUnique.js +6 -0
  154. package/common/pipe.d.ts +9 -0
  155. package/common/pipe.js +6 -0
  156. package/common/pipeNonNil.d.ts +16 -0
  157. package/common/pipeNonNil.js +7 -0
  158. package/common/safeJsonStringify.d.ts +28 -0
  159. package/common/safeJsonStringify.js +105 -0
  160. package/common/simpleInt/isSimpleInt.d.ts +6 -0
  161. package/common/simpleInt/isSimpleInt.js +6 -0
  162. package/common/simpleInt/isSimpleIntInputing.d.ts +6 -0
  163. package/common/simpleInt/isSimpleIntInputing.js +7 -0
  164. package/common/simpleInt/isSimpleNumber.d.ts +10 -0
  165. package/common/simpleInt/isSimpleNumber.js +6 -0
  166. package/common/simpleInt/isSimpleNumberInputing.d.ts +6 -0
  167. package/common/simpleInt/isSimpleNumberInputing.js +7 -0
  168. package/common/simpleInt/parseSimpleInt.d.ts +6 -0
  169. package/common/simpleInt/parseSimpleInt.js +11 -0
  170. package/common/simpleInt/parseSimpleIntOrNil.d.ts +6 -0
  171. package/common/simpleInt/parseSimpleIntOrNil.js +9 -0
  172. package/common/simpleInt/parseSimpleNumber.d.ts +6 -0
  173. package/common/simpleInt/parseSimpleNumber.js +11 -0
  174. package/common/simpleInt/parseSimpleNumberOrNil.d.ts +4 -0
  175. package/common/simpleInt/parseSimpleNumberOrNil.js +7 -0
  176. package/common/tap.d.ts +9 -0
  177. package/common/tap.js +6 -0
  178. package/common/tree/buildTree.d.ts +6 -0
  179. package/common/tree/buildTree.js +13 -0
  180. package/common/tree/flatTree.d.ts +2 -0
  181. package/common/tree/flatTree.js +7 -0
  182. package/common/tree/mapTree.d.ts +2 -0
  183. package/common/tree/mapTree.js +11 -0
  184. package/common/tree/pruneTree.d.ts +2 -0
  185. package/common/tree/pruneTree.js +15 -0
  186. package/common/tree/sortTree.d.ts +2 -0
  187. package/common/tree/sortTree.js +11 -0
  188. package/common/tree/treeToArray.d.ts +2 -0
  189. package/common/tree/treeToArray.js +12 -0
  190. package/common/tree/treeToRows.d.ts +5 -0
  191. package/common/tree/treeToRows.js +19 -0
  192. package/common/tree/treeTypes.d.ts +7 -0
  193. package/common/tree/treeTypes.js +0 -0
  194. package/common/tree/walkTree.d.ts +2 -0
  195. package/common/tree/walkTree.js +13 -0
  196. package/common/truncateJsonStrings.d.ts +14 -0
  197. package/common/truncateJsonStrings.js +7 -0
  198. package/common/truncateString.d.ts +13 -0
  199. package/common/truncateString.js +7 -0
  200. package/common/tryParsePartialJson.d.ts +11 -0
  201. package/common/tryParsePartialJson.js +156 -0
  202. package/eslint-config/eslintPreset.d.ts +2 -0
  203. package/eslint-config/eslintPreset.js +36 -0
  204. package/eslint-config/index.d.ts +14 -0
  205. package/eslint-config/index.js +20 -0
  206. package/eslint-config/layers/configLayer.d.ts +2 -0
  207. package/eslint-config/layers/configLayer.js +16 -0
  208. package/eslint-config/layers/jsLayer.d.ts +2 -0
  209. package/eslint-config/layers/jsLayer.js +20 -0
  210. package/eslint-config/layers/prettierLayer.d.ts +5 -0
  211. package/eslint-config/layers/prettierLayer.js +5 -0
  212. package/eslint-config/layers/reactHookLayer.d.ts +2 -0
  213. package/eslint-config/layers/reactHookLayer.js +16 -0
  214. package/eslint-config/layers/testLayer.d.ts +2 -0
  215. package/eslint-config/layers/testLayer.js +46 -0
  216. package/eslint-config/layers/tsLayer.d.ts +2 -0
  217. package/eslint-config/layers/tsLayer.js +70 -0
  218. package/eslint-config/plugins/freewindSingleExportPlugin.d.ts +2 -0
  219. package/eslint-config/plugins/freewindSingleExportPlugin.js +47 -0
  220. package/eslint-config/utils/withRuleOverrides.d.ts +2 -0
  221. package/eslint-config/utils/withRuleOverrides.js +9 -0
  222. package/index.d.ts +1 -0
  223. package/index.js +49 -0
  224. package/node/index.d.ts +2 -0
  225. package/node/index.js +3 -0
  226. package/node/md5.d.ts +11 -0
  227. package/node/md5.js +7 -0
  228. package/node/uuid.d.ts +11 -0
  229. package/node/uuid.js +7 -0
  230. package/package.json +115 -0
  231. package/prettier-config/freewindPrettierPreset.d.ts +2 -0
  232. package/prettier-config/freewindPrettierPreset.js +4 -0
  233. package/prettier-config/index.d.ts +1 -0
  234. package/prettier-config/index.js +2 -0
  235. package/react/hooks/useCopyToClipboard.d.ts +10 -0
  236. package/react/hooks/useCopyToClipboard.js +28 -0
  237. package/react/hooks/useDeepCompareSelector.d.ts +23 -0
  238. package/react/hooks/useDeepCompareSelector.js +14 -0
  239. package/react/hooks/useInputEvent/_internal/ink-input/index.d.ts +2 -0
  240. package/react/hooks/useInputEvent/_internal/ink-input/index.js +3 -0
  241. package/react/hooks/useInputEvent/_internal/ink-input/input-parser.d.ts +6 -0
  242. package/react/hooks/useInputEvent/_internal/ink-input/input-parser.js +98 -0
  243. package/react/hooks/useInputEvent/_internal/ink-input/kitty-keyboard.d.ts +19 -0
  244. package/react/hooks/useInputEvent/_internal/ink-input/kitty-keyboard.js +13 -0
  245. package/react/hooks/useInputEvent/_internal/ink-input/parse-keypress.d.ts +33 -0
  246. package/react/hooks/useInputEvent/_internal/ink-input/parse-keypress.js +319 -0
  247. package/react/hooks/useInputEvent/formatInputEvent.d.ts +2 -0
  248. package/react/hooks/useInputEvent/formatInputEvent.js +25 -0
  249. package/react/hooks/useInputEvent/index.d.ts +4 -0
  250. package/react/hooks/useInputEvent/index.js +4 -0
  251. package/react/hooks/useInputEvent/inputEventTypes.d.ts +51 -0
  252. package/react/hooks/useInputEvent/inputEventTypes.js +0 -0
  253. package/react/hooks/useInputEvent/parseInputEvent.d.ts +4 -0
  254. package/react/hooks/useInputEvent/parseInputEvent.js +100 -0
  255. package/react/hooks/useInputEvent/useInputEvent.d.ts +7 -0
  256. package/react/hooks/useInputEvent/useInputEvent.js +57 -0
  257. package/react/hooks/useOverlayStack/_internal/overlayStackId.d.ts +2 -0
  258. package/react/hooks/useOverlayStack/_internal/overlayStackId.js +6 -0
  259. package/react/hooks/useOverlayStack/createOverlayStackItem.d.ts +2 -0
  260. package/react/hooks/useOverlayStack/createOverlayStackItem.js +10 -0
  261. package/react/hooks/useOverlayStack/index.d.ts +3 -0
  262. package/react/hooks/useOverlayStack/index.js +3 -0
  263. package/react/hooks/useOverlayStack/overlayStackTypes.d.ts +13 -0
  264. package/react/hooks/useOverlayStack/overlayStackTypes.js +0 -0
  265. package/react/hooks/useOverlayStack/useOverlayStack.d.ts +2 -0
  266. package/react/hooks/useOverlayStack/useOverlayStack.js +24 -0
  267. package/react/index.d.ts +4 -0
  268. package/react/index.js +10 -0
  269. package/react/ink-components/InkModal/InkModal.d.ts +3 -0
  270. package/react/ink-components/InkModal/InkModal.js +101 -0
  271. package/react/ink-components/InkModal/index.d.ts +4 -0
  272. package/react/ink-components/InkModal/index.js +4 -0
  273. package/react/ink-components/InkModal/types.d.ts +24 -0
  274. package/react/ink-components/InkModal/types.js +0 -0
  275. package/react/ink-components/InkModal/utils/computeInkModalBodyMaxHeight.d.ts +1 -0
  276. package/react/ink-components/InkModal/utils/computeInkModalBodyMaxHeight.js +4 -0
  277. package/react/ink-components/InkModal/utils/resolveInkModalSize.d.ts +6 -0
  278. package/react/ink-components/InkModal/utils/resolveInkModalSize.js +7 -0
  279. package/react/ink-components/InkMultiSelect/InkMultiSelect.d.ts +22 -0
  280. package/react/ink-components/InkMultiSelect/InkMultiSelect.js +94 -0
  281. package/react/ink-components/InkMultiSelect/InkMultiSelectRow.d.ts +10 -0
  282. package/react/ink-components/InkMultiSelect/InkMultiSelectRow.js +35 -0
  283. package/react/ink-components/InkMultiSelect/index.d.ts +8 -0
  284. package/react/ink-components/InkMultiSelect/index.js +9 -0
  285. package/react/ink-components/InkMultiSelect/inkMultiSelectKeyboard.d.ts +17 -0
  286. package/react/ink-components/InkMultiSelect/inkMultiSelectKeyboard.js +19 -0
  287. package/react/ink-components/InkMultiSelect/types.d.ts +20 -0
  288. package/react/ink-components/InkMultiSelect/types.js +18 -0
  289. package/react/ink-components/InkMultiSelect/useInkMultiSelectNavigation.d.ts +10 -0
  290. package/react/ink-components/InkMultiSelect/useInkMultiSelectNavigation.js +40 -0
  291. package/react/ink-components/InkMultiSelect/utils/clampListScrollOffset.d.ts +1 -0
  292. package/react/ink-components/InkMultiSelect/utils/clampListScrollOffset.js +6 -0
  293. package/react/ink-components/InkMultiSelect/utils/formatMoreLabel.d.ts +1 -0
  294. package/react/ink-components/InkMultiSelect/utils/formatMoreLabel.js +6 -0
  295. package/react/ink-components/InkMultiSelect/utils/inkMultiSelectVisibleCount.d.ts +2 -0
  296. package/react/ink-components/InkMultiSelect/utils/inkMultiSelectVisibleCount.js +7 -0
  297. package/react/ink-components/InkScrollView/InkScrollView.d.ts +19 -0
  298. package/react/ink-components/InkScrollView/InkScrollView.js +103 -0
  299. package/react/ink-components/InkScrollView/Scrollbar.d.ts +7 -0
  300. package/react/ink-components/InkScrollView/Scrollbar.js +16 -0
  301. package/react/ink-components/InkScrollView/index.d.ts +9 -0
  302. package/react/ink-components/InkScrollView/index.js +18 -0
  303. package/react/ink-components/InkScrollView/utils/applyInkScrollInput.d.ts +10 -0
  304. package/react/ink-components/InkScrollView/utils/applyInkScrollInput.js +57 -0
  305. package/react/ink-components/InkScrollView/utils/bounds/getAbsoluteBounds.d.ts +7 -0
  306. package/react/ink-components/InkScrollView/utils/bounds/getAbsoluteBounds.js +19 -0
  307. package/react/ink-components/InkScrollView/utils/bounds/index.d.ts +3 -0
  308. package/react/ink-components/InkScrollView/utils/bounds/index.js +4 -0
  309. package/react/ink-components/InkScrollView/utils/bounds/isInside.d.ts +2 -0
  310. package/react/ink-components/InkScrollView/utils/bounds/isInside.js +7 -0
  311. package/react/ink-components/InkScrollView/utils/bounds/rowInViewport.d.ts +2 -0
  312. package/react/ink-components/InkScrollView/utils/bounds/rowInViewport.js +4 -0
  313. package/react/ink-components/InkScrollView/utils/inkScrollInputTarget.d.ts +11 -0
  314. package/react/ink-components/InkScrollView/utils/inkScrollInputTarget.js +0 -0
  315. package/react/ink-components/InkScrollView/utils/scrollMath/allocateHeights.d.ts +6 -0
  316. package/react/ink-components/InkScrollView/utils/scrollMath/allocateHeights.js +29 -0
  317. package/react/ink-components/InkScrollView/utils/scrollMath/clampOffset.d.ts +1 -0
  318. package/react/ink-components/InkScrollView/utils/scrollMath/clampOffset.js +7 -0
  319. package/react/ink-components/InkScrollView/utils/scrollMath/computeScrollbarThumb.d.ts +5 -0
  320. package/react/ink-components/InkScrollView/utils/scrollMath/computeScrollbarThumb.js +14 -0
  321. package/react/ink-components/InkScrollView/utils/scrollMath/index.d.ts +10 -0
  322. package/react/ink-components/InkScrollView/utils/scrollMath/index.js +11 -0
  323. package/react/ink-components/InkScrollView/utils/scrollMath/offsetFromScrollbarClick.d.ts +1 -0
  324. package/react/ink-components/InkScrollView/utils/scrollMath/offsetFromScrollbarClick.js +12 -0
  325. package/react/ink-components/InkScrollView/utils/scrollMath/offsetFromScrollbarDrag.d.ts +1 -0
  326. package/react/ink-components/InkScrollView/utils/scrollMath/offsetFromScrollbarDrag.js +8 -0
  327. package/react/ink-components/InkScrollView/utils/scrollMath/resolveNextStickToBottomOffset.d.ts +8 -0
  328. package/react/ink-components/InkScrollView/utils/scrollMath/resolveNextStickToBottomOffset.js +10 -0
  329. package/react/ink-components/InkScrollView/utils/scrollMath/scrollByInputEventKey.d.ts +1 -0
  330. package/react/ink-components/InkScrollView/utils/scrollMath/scrollByInputEventKey.js +15 -0
  331. package/react/ink-components/InkScrollView/utils/scrollMath/scrollByKey.d.ts +9 -0
  332. package/react/ink-components/InkScrollView/utils/scrollMath/scrollByKey.js +7 -0
  333. package/react/ink-components/InkScrollView/utils/scrollMath/scrollByWheel.d.ts +2 -0
  334. package/react/ink-components/InkScrollView/utils/scrollMath/scrollByWheel.js +8 -0
  335. package/react/ink-components/InkScrollView/utils/scrollMath/stickToBottomOffset.d.ts +1 -0
  336. package/react/ink-components/InkScrollView/utils/scrollMath/stickToBottomOffset.js +4 -0
  337. package/react/ink-components/InkScrollView/utils/useInkScrollInput.d.ts +10 -0
  338. package/react/ink-components/InkScrollView/utils/useInkScrollInput.js +17 -0
  339. package/react/ink-components/InkTimer/InkTimer.d.ts +9 -0
  340. package/react/ink-components/InkTimer/InkTimer.js +26 -0
  341. package/react/ink-components/InkTimer/index.d.ts +1 -0
  342. package/react/ink-components/InkTimer/index.js +2 -0
  343. package/react/ink-components/index.d.ts +4 -0
  344. package/react/ink-components/index.js +34 -0
  345. package/vite-plugins/fileLinePlaceholderPlugin.d.ts +26 -0
  346. package/vite-plugins/fileLinePlaceholderPlugin.js +57 -0
  347. package/vite-plugins/index.d.ts +1 -0
  348. package/vite-plugins/index.js +2 -0
package/README.md ADDED
@@ -0,0 +1,60 @@
1
+ # freewind-ts-utils
2
+
3
+ 本人常用的 TypeScript util 仓库。
4
+
5
+ 符号索引 → [AGENTS.md](./AGENTS.md)
6
+
7
+ ## 安装
8
+
9
+ ```bash
10
+ pnpm add freewind-ts-utils
11
+ ```
12
+
13
+ 从 npmjs 安装。
14
+
15
+ ## 开发
16
+
17
+ ```bash
18
+ pnpm check # typecheck + lint
19
+ pnpm build # 本地看 dist
20
+ pnpm test
21
+ pnpm dev # antd demo
22
+ pnpm demo:ink
23
+ pnpm release patch # bump version + build + check + commit
24
+ pnpm release:npm patch # release + dist/package.json + npm publish
25
+ ```
26
+
27
+ 日常 commit 不提交 `dist`;只有 `pnpm release` / `pnpm release:npm` 走发版。
28
+
29
+ 发 npm:
30
+
31
+ ```bash
32
+ pnpm release:npm auto
33
+ pnpm release:npm patch --tag next
34
+ pnpm release:npm patch --otp 123456
35
+ ```
36
+
37
+ `release:npm` 会先跑 `pnpm release`,再生成 `dist/package.json` 并执行 `pnpm publish dist`。
38
+ 这里的 `--tag next` 是 npm dist-tag,不是 Git tag。
39
+ 若当前 `HEAD` 已是 `release v*` commit 且其后无新 commit,`pnpm release:npm auto` 会直接发布当前版本,不再 bump。
40
+
41
+ ## 导入
42
+
43
+ ```ts
44
+ import { anyToString, formatSize } from "freewind-ts-utils";
45
+ import { md5 } from "freewind-ts-utils/node";
46
+ import { useCopyToClipboard, useDeepCompareSelector } from "freewind-ts-utils/react";
47
+ import { CopyButton } from "freewind-ts-utils/antd";
48
+ ```
49
+
50
+ `useMemoizedFn`、`useRequest` 等通用 React hooks 用 [ahooks](https://ahooks.js.org/):
51
+
52
+ ```ts
53
+ import { useMemoizedFn, useRequest } from "ahooks";
54
+ ```
55
+
56
+ 单项:`freewind-ts-utils/react/useCopyToClipboard`、`freewind-ts-utils/react/useDeepCompareSelector` 等,见 `package.json` `exports`。
57
+
58
+ ## 新增
59
+
60
+ 放哪、怎么导出 → [AGENTS.md](./AGENTS.md)
@@ -0,0 +1,7 @@
1
+ import { FC, ReactNode } from 'react';
2
+ export type CopyButtonProps = {
3
+ children?: ReactNode;
4
+ copiedDuration?: number;
5
+ text: string;
6
+ };
7
+ export declare const CopyButton: FC<CopyButtonProps>;
@@ -0,0 +1,29 @@
1
+ import { Button as e, Flex as t, Typography as n } from "antd";
2
+ import { useState as r } from "react";
3
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
4
+ //#region src/antd/CopyButton/CopyButton.tsx
5
+ var o = ({ children: o = "Copy", copiedDuration: s = 1500, text: c }) => {
6
+ let [l, u] = r(!1), d = async () => {
7
+ await navigator.clipboard.writeText(c), u(!0), window.setTimeout(() => {
8
+ u(!1);
9
+ }, s);
10
+ };
11
+ return /* @__PURE__ */ a(t, {
12
+ align: "center",
13
+ gap: 6,
14
+ children: [/* @__PURE__ */ i(e, {
15
+ onClick: () => {
16
+ d();
17
+ },
18
+ size: "small",
19
+ type: "text",
20
+ children: o
21
+ }), l ? /* @__PURE__ */ i(n.Text, {
22
+ type: "success",
23
+ style: { lineHeight: 1 },
24
+ children: "✓"
25
+ }) : null]
26
+ });
27
+ };
28
+ //#endregion
29
+ export { o as CopyButton };
@@ -0,0 +1 @@
1
+ export * from './CopyButton.js';
@@ -0,0 +1,2 @@
1
+ import { CopyButton as e } from "./CopyButton.js";
2
+ export { e as CopyButton };
@@ -0,0 +1,18 @@
1
+ .float-label {
2
+ display: block;
3
+ position: relative;
4
+ }
5
+
6
+ .float-label__overlay {
7
+ position: absolute;
8
+ transform: translateY(-50%);
9
+ max-width: 90%;
10
+ }
11
+
12
+ .float-label__text {
13
+ display: inline-block;
14
+ white-space: nowrap;
15
+ overflow: hidden;
16
+ text-overflow: ellipsis;
17
+ max-width: 100%;
18
+ }
@@ -0,0 +1,8 @@
1
+ import { ComponentPropsWithoutRef, FC, PropsWithChildren, ReactNode } from 'react';
2
+ export type FloatLabelSize = "small" | "middle" | "large";
3
+ export type FloatLabelProps = PropsWithChildren<{
4
+ label: ReactNode;
5
+ offsetY?: number;
6
+ size?: FloatLabelSize;
7
+ }> & Omit<ComponentPropsWithoutRef<"div">, "children">;
8
+ export declare const FloatLabel: FC<FloatLabelProps>;
@@ -0,0 +1,50 @@
1
+ import { theme as e } from "antd";
2
+ import { isValidElement as t } from "react";
3
+ import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
4
+ import "./FloatLabel.css";
5
+ //#region src/antd/FloatLabel/FloatLabel.tsx
6
+ var a = ({ children: a, className: o, label: s, offsetY: c = 0, size: l, style: u, ...d }) => {
7
+ let { token: f } = e.useToken(), p = t(a) ? a.props : void 0, m = l ?? p?.size ?? "middle", h = {
8
+ small: {
9
+ fontSize: f.fontSizeSM,
10
+ paddingX: f.controlPaddingHorizontalSM
11
+ },
12
+ middle: {
13
+ fontSize: f.fontSize,
14
+ paddingX: f.controlPaddingHorizontal
15
+ },
16
+ large: {
17
+ fontSize: f.fontSizeLG,
18
+ paddingX: f.controlPaddingHorizontal
19
+ }
20
+ }[m], g = Math.max(h.fontSize - 2, f.fontSizeSM), _ = Math.ceil(Math.ceil(g) / 2), v = {
21
+ backgroundColor: f.colorBgContainer,
22
+ color: f.colorText,
23
+ fontSize: g,
24
+ lineHeight: 1,
25
+ paddingInline: f.paddingXXS
26
+ }, y = {
27
+ left: Math.max(h.paddingX - f.paddingXXS, 0),
28
+ top: _ + c,
29
+ zIndex: 3
30
+ };
31
+ return s ? /* @__PURE__ */ i("div", {
32
+ ...d,
33
+ className: o ? `float-label ${o}` : "float-label",
34
+ style: {
35
+ paddingTop: _,
36
+ ...u
37
+ },
38
+ children: [/* @__PURE__ */ r("div", {
39
+ className: "float-label__overlay",
40
+ style: y,
41
+ children: /* @__PURE__ */ r("span", {
42
+ className: "float-label__text",
43
+ style: v,
44
+ children: s
45
+ })
46
+ }), a]
47
+ }) : /* @__PURE__ */ r(n, { children: a });
48
+ };
49
+ //#endregion
50
+ export { a as FloatLabel };
@@ -0,0 +1 @@
1
+ export * from './FloatLabel.js';
@@ -0,0 +1,2 @@
1
+ import { FloatLabel as e } from "./FloatLabel.js";
2
+ export { e as FloatLabel };
@@ -0,0 +1,17 @@
1
+ import { SelectProps } from 'antd';
2
+ import { FC, ReactNode } from 'react';
3
+ import { FuzzyMatchHit } from '../../common/fuzzy/fuzzyMatch.js';
4
+ type FuzzySelectValue = string | string[];
5
+ export type FuzzyAutoCompleteProps = Omit<SelectProps, "defaultValue" | "filterOption" | "mode" | "onChange" | "options" | "optionLabelProp" | "showSearch" | "value"> & {
6
+ items: string[];
7
+ value?: FuzzySelectValue;
8
+ defaultValue?: FuzzySelectValue;
9
+ onChange?: (value: FuzzySelectValue) => void;
10
+ multiple?: boolean;
11
+ maxResults?: number;
12
+ emptyQueryResults?: number;
13
+ match: (query: string, candidates: string[]) => FuzzyMatchHit[];
14
+ renderOptionSuffix?: (item: string) => ReactNode;
15
+ };
16
+ export declare const FuzzyAutoComplete: FC<FuzzyAutoCompleteProps>;
17
+ export {};
@@ -0,0 +1,73 @@
1
+ import { HighlightParts as e } from "../_internal/HighlightParts.js";
2
+ import { Empty as t, Select as n } from "antd";
3
+ import { useDeferredValue as r, useMemo as i, useState as a } from "react";
4
+ import { jsx as o, jsxs as s } from "react/jsx-runtime";
5
+ //#region src/antd/FuzzyAutoComplete/FuzzyAutoComplete.tsx
6
+ var c = ({ items: c, value: l, defaultValue: u, onChange: d, multiple: f = !1, maxResults: p = 200, emptyQueryResults: m = 100, match: h, renderOptionSuffix: g, notFoundContent: _, onSearch: v, ...y }) => {
7
+ let [b, x] = a(u ?? l ?? (f ? [] : "")), [S, C] = a(""), w = l ?? b, T = r(S), E = i(() => new Set(Array.isArray(w) ? w : w ? [w] : []), [w]), D = i(() => {
8
+ let t = T.trim();
9
+ return (t ? h(t, c).slice(0, p) : c.slice(0, m).map((e) => ({
10
+ value: e,
11
+ score: 0,
12
+ ranges: [],
13
+ parts: [{
14
+ text: e,
15
+ matched: !1
16
+ }]
17
+ }))).map((t) => ({
18
+ label: /* @__PURE__ */ s("div", {
19
+ style: {
20
+ display: "flex",
21
+ alignItems: "center",
22
+ gap: 8,
23
+ minWidth: 0
24
+ },
25
+ children: [/* @__PURE__ */ o("div", {
26
+ style: {
27
+ flex: 1,
28
+ minWidth: 0,
29
+ overflow: "hidden",
30
+ textOverflow: "ellipsis"
31
+ },
32
+ children: E.has(t.value) ? t.value : /* @__PURE__ */ o(e, { parts: t.parts })
33
+ }), g ? /* @__PURE__ */ o("div", {
34
+ style: { flex: "none" },
35
+ children: g(t.value)
36
+ }) : null]
37
+ }),
38
+ plainLabel: t.value,
39
+ value: t.value
40
+ }));
41
+ }, [
42
+ T,
43
+ m,
44
+ c,
45
+ h,
46
+ p,
47
+ g,
48
+ E
49
+ ]), O = (e) => {
50
+ l === void 0 && x(e), f || C(""), d?.(e);
51
+ }, k = (e) => {
52
+ C(e), v?.(e);
53
+ };
54
+ return /* @__PURE__ */ o(n, {
55
+ ...y,
56
+ autoClearSearchValue: !f,
57
+ filterOption: !1,
58
+ notFoundContent: _ ?? /* @__PURE__ */ o(t, {
59
+ image: t.PRESENTED_IMAGE_SIMPLE,
60
+ description: "No matches"
61
+ }),
62
+ onChange: O,
63
+ onSearch: k,
64
+ optionLabelProp: "plainLabel",
65
+ options: D,
66
+ searchValue: S,
67
+ showSearch: !0,
68
+ value: w,
69
+ ...f ? { mode: "multiple" } : {}
70
+ });
71
+ };
72
+ //#endregion
73
+ export { c as FuzzyAutoComplete };
@@ -0,0 +1 @@
1
+ export * from './FuzzyAutoComplete.js';
@@ -0,0 +1,2 @@
1
+ import { FuzzyAutoComplete as e } from "./FuzzyAutoComplete.js";
2
+ export { e as FuzzyAutoComplete };
@@ -0,0 +1,8 @@
1
+ import { FC } from 'react';
2
+ import { FuzzyAutoCompleteProps } from '../FuzzyAutoComplete/index.js';
3
+ export type FuzzyPathSelectProps = Omit<FuzzyAutoCompleteProps, "items" | "match"> & {
4
+ paths: string[];
5
+ ignoreNames?: string[];
6
+ useDefaultIgnore?: boolean;
7
+ };
8
+ export declare const FuzzyPathSelect: FC<FuzzyPathSelectProps>;
@@ -0,0 +1,48 @@
1
+ import { FuzzyAutoComplete as e } from "../FuzzyAutoComplete/FuzzyAutoComplete.js";
2
+ import "../FuzzyAutoComplete/index.js";
3
+ import { fuzzyMatchPath as t } from "../../common/fuzzy/fuzzyMatchPath.js";
4
+ import { DEFAULT_FUZZY_PATH_IGNORE_NAMES as n } from "./defaultIgnoreNames.js";
5
+ import { useMemo as r } from "react";
6
+ import { jsx as i } from "react/jsx-runtime";
7
+ //#region src/antd/FuzzyPathSelect/FuzzyPathSelect.tsx
8
+ var a = ({ paths: a, ignoreNames: s, useDefaultIgnore: l = !0, popupMatchSelectWidth: u = !1, ...d }) => {
9
+ let f = r(() => {
10
+ let e = /* @__PURE__ */ new Set(), t = /* @__PURE__ */ new Set(), r = [];
11
+ for (let i of l ? n : []) c(i, e, t, r);
12
+ for (let n of s ?? []) c(n, e, t, r);
13
+ return a.filter((n) => !o(n, e, t, r));
14
+ }, [
15
+ s,
16
+ a,
17
+ l
18
+ ]);
19
+ return /* @__PURE__ */ i(e, {
20
+ ...d,
21
+ items: f,
22
+ match: (e, n) => t(e, n, !0),
23
+ popupMatchSelectWidth: u
24
+ });
25
+ };
26
+ function o(e, t, n, r) {
27
+ let i = s(e);
28
+ if (n.has(i)) return !0;
29
+ for (let e of i.split("/")) if (e && t.has(e) || e && r.some((t) => e.endsWith(t))) return !0;
30
+ return !1;
31
+ }
32
+ function s(e) {
33
+ return e.replaceAll("\\", "/");
34
+ }
35
+ function c(e, t, n, r) {
36
+ let i = s(e);
37
+ if (i.startsWith("*.")) {
38
+ r.push(i.slice(1));
39
+ return;
40
+ }
41
+ if (i.includes("/")) {
42
+ n.add(i);
43
+ return;
44
+ }
45
+ t.add(i);
46
+ }
47
+ //#endregion
48
+ export { a as FuzzyPathSelect };
@@ -0,0 +1 @@
1
+ export declare const DEFAULT_FUZZY_PATH_IGNORE_NAMES: readonly ["*.log", ".cache", ".DS_Store", ".git", ".idea", ".next", ".nuxt", ".svn", ".turbo", ".vscode", "bin", "build", "coverage", "dist", "logs", "node_modules", "out", "package-lockon", "pnpm-lock.yaml", "temp", "tmp", "Thumbs.db", "yarn.lock"];
@@ -0,0 +1,28 @@
1
+ //#region src/antd/FuzzyPathSelect/defaultIgnoreNames.ts
2
+ var e = [
3
+ "*.log",
4
+ ".cache",
5
+ ".DS_Store",
6
+ ".git",
7
+ ".idea",
8
+ ".next",
9
+ ".nuxt",
10
+ ".svn",
11
+ ".turbo",
12
+ ".vscode",
13
+ "bin",
14
+ "build",
15
+ "coverage",
16
+ "dist",
17
+ "logs",
18
+ "node_modules",
19
+ "out",
20
+ "package-lockon",
21
+ "pnpm-lock.yaml",
22
+ "temp",
23
+ "tmp",
24
+ "Thumbs.db",
25
+ "yarn.lock"
26
+ ];
27
+ //#endregion
28
+ export { e as DEFAULT_FUZZY_PATH_IGNORE_NAMES };
@@ -0,0 +1 @@
1
+ export * from './FuzzyPathSelect.js';
@@ -0,0 +1,2 @@
1
+ import { FuzzyPathSelect as e } from "./FuzzyPathSelect.js";
2
+ export { e as FuzzyPathSelect };
@@ -0,0 +1,6 @@
1
+ import { FC } from 'react';
2
+ import { FuzzyAutoCompleteProps } from '../FuzzyAutoComplete/index.js';
3
+ export type FuzzyStringSelectProps = Omit<FuzzyAutoCompleteProps, "items" | "match"> & {
4
+ items: string[];
5
+ };
6
+ export declare const FuzzyStringSelect: FC<FuzzyStringSelectProps>;
@@ -0,0 +1,12 @@
1
+ import { FuzzyAutoComplete as e } from "../FuzzyAutoComplete/FuzzyAutoComplete.js";
2
+ import "../FuzzyAutoComplete/index.js";
3
+ import { fuzzyMatch as t } from "../../common/fuzzy/fuzzyMatch.js";
4
+ import { jsx as n } from "react/jsx-runtime";
5
+ //#region src/antd/FuzzyStringSelect/FuzzyStringSelect.tsx
6
+ var r = ({ items: r, ...i }) => /* @__PURE__ */ n(e, {
7
+ ...i,
8
+ items: r,
9
+ match: (e, n) => t(e, n, !0)
10
+ });
11
+ //#endregion
12
+ export { r as FuzzyStringSelect };
@@ -0,0 +1 @@
1
+ export * from './FuzzyStringSelect.js';
@@ -0,0 +1,2 @@
1
+ import { FuzzyStringSelect as e } from "./FuzzyStringSelect.js";
2
+ export { e as FuzzyStringSelect };
@@ -0,0 +1,3 @@
1
+ .hover-swap {
2
+ display: inline-block;
3
+ }
@@ -0,0 +1,8 @@
1
+ import { CSSProperties, FC, ReactNode } from 'react';
2
+ export type HoverSwapProps = {
3
+ normal: ReactNode;
4
+ hover: ReactNode;
5
+ className?: string;
6
+ style?: CSSProperties;
7
+ };
8
+ export declare const HoverSwap: FC<HoverSwapProps>;
@@ -0,0 +1,18 @@
1
+ import { useState as e } from "react";
2
+ import { jsx as t } from "react/jsx-runtime";
3
+ import "./HoverSwap.css";
4
+ //#region src/antd/HoverSwap/HoverSwap.tsx
5
+ var n = ({ normal: n, hover: r, className: i, style: a }) => {
6
+ let [o, s] = e(!1);
7
+ return /* @__PURE__ */ t("span", {
8
+ className: i ? `hover-swap ${i}` : "hover-swap",
9
+ onBlur: () => s(!1),
10
+ onFocus: () => s(!0),
11
+ onMouseEnter: () => s(!0),
12
+ onMouseLeave: () => s(!1),
13
+ style: a,
14
+ children: o ? r : n
15
+ });
16
+ };
17
+ //#endregion
18
+ export { n as HoverSwap };
@@ -0,0 +1 @@
1
+ export * from './HoverSwap.js';
@@ -0,0 +1,2 @@
1
+ import { HoverSwap as e } from "./HoverSwap.js";
2
+ export { e as HoverSwap };
@@ -0,0 +1,10 @@
1
+ .input-label {
2
+ width: auto;
3
+ }
4
+
5
+ .input-label input {
6
+ width: 0 !important;
7
+ border-left: 0 !important;
8
+ padding-left: 0 !important;
9
+ padding-right: 0 !important;
10
+ }
@@ -0,0 +1,4 @@
1
+ import { FC, PropsWithChildren } from 'react';
2
+ import { InputProps } from 'antd';
3
+ export type InputLabelProps = PropsWithChildren<Omit<InputProps, "addonBefore">>;
4
+ export declare const InputLabel: FC<InputLabelProps>;
@@ -0,0 +1,11 @@
1
+ import { Input as e } from "antd";
2
+ import { jsx as t } from "react/jsx-runtime";
3
+ import "./InputLabel.css";
4
+ //#region src/antd/InputLabel/InputLabel.tsx
5
+ var n = ({ children: n, className: r, ...i }) => /* @__PURE__ */ t(e, {
6
+ ...i,
7
+ addonBefore: n,
8
+ className: r ? `input-label ${r}` : "input-label"
9
+ });
10
+ //#endregion
11
+ export { n as InputLabel };
@@ -0,0 +1 @@
1
+ export * from './InputLabel.js';
@@ -0,0 +1,2 @@
1
+ import { InputLabel as e } from "./InputLabel.js";
2
+ export { e as InputLabel };
@@ -0,0 +1,74 @@
1
+ .json-previewer {
2
+ color: var(--json-previewer-color-text, #262626);
3
+ line-height: 1.45;
4
+ white-space: pre-wrap;
5
+ word-break: break-word;
6
+ }
7
+
8
+ .json-previewer__child {
9
+ margin: 0;
10
+ padding: 0 0 0 14px;
11
+ }
12
+
13
+ .json-previewer__row {
14
+ margin: 0;
15
+ padding: 0;
16
+ }
17
+
18
+ .json-previewer__label {
19
+ color: var(--json-previewer-color-label, #1677ff);
20
+ font-weight: 400;
21
+ margin-right: 5px;
22
+ }
23
+
24
+ .json-previewer__clickable-label {
25
+ cursor: pointer;
26
+ }
27
+
28
+ .json-previewer__null,
29
+ .json-previewer__undefined {
30
+ color: var(--json-previewer-color-muted, #8c8c8c);
31
+ }
32
+
33
+ .json-previewer__number {
34
+ color: var(--json-previewer-color-number, #d46b08);
35
+ }
36
+
37
+ .json-previewer__string {
38
+ color: var(--json-previewer-color-string, #389e0d);
39
+ }
40
+
41
+ .json-previewer__boolean {
42
+ color: var(--json-previewer-color-boolean, #722ed1);
43
+ }
44
+
45
+ .json-previewer__other,
46
+ .json-previewer__punctuation {
47
+ color: var(--json-previewer-color-other, #595959);
48
+ }
49
+
50
+ .json-previewer__collapse,
51
+ .json-previewer__expand {
52
+ color: var(--json-previewer-color-muted, #8c8c8c);
53
+ cursor: pointer;
54
+ font-size: 12px;
55
+ margin-right: 4px;
56
+ user-select: none;
57
+ }
58
+
59
+ .json-previewer__expand::after {
60
+ content: "\25B8";
61
+ }
62
+
63
+ .json-previewer__collapse::after {
64
+ content: "\25BE";
65
+ }
66
+
67
+ .json-previewer__collapsed {
68
+ color: var(--json-previewer-color-muted, #8c8c8c);
69
+ margin-right: 5px;
70
+ }
71
+
72
+ .json-previewer__collapsed::after {
73
+ content: "...";
74
+ }
@@ -0,0 +1,11 @@
1
+ import { ComponentProps, CSSProperties, FC } from 'react';
2
+ import { JsonView } from 'react-json-view-lite';
3
+ export type JsonPreviewerProps = {
4
+ className?: string;
5
+ maxHeight?: number;
6
+ parseStringAsJson?: boolean;
7
+ shouldExpandNode?: ComponentProps<typeof JsonView>["shouldExpandNode"];
8
+ style?: CSSProperties;
9
+ value: unknown;
10
+ };
11
+ export declare const JsonPreviewer: FC<JsonPreviewerProps>;
@@ -0,0 +1,69 @@
1
+ import { Typography as e, theme as t } from "antd";
2
+ import { jsx as n } from "react/jsx-runtime";
3
+ import { JsonView as r } from "react-json-view-lite";
4
+ import "./JsonPreviewer.css";
5
+ //#region src/antd/JsonPreviewer/JsonPreviewer.tsx
6
+ var i = {
7
+ basicChildStyle: "json-previewer__row",
8
+ booleanValue: "json-previewer__boolean",
9
+ childFieldsContainer: "json-previewer__child",
10
+ clickableLabel: "json-previewer__clickable-label",
11
+ collapsedContent: "json-previewer__collapsed",
12
+ collapseIcon: "json-previewer__collapse",
13
+ container: "json-previewer",
14
+ expandIcon: "json-previewer__expand",
15
+ label: "json-previewer__label",
16
+ nullValue: "json-previewer__null",
17
+ numberValue: "json-previewer__number",
18
+ otherValue: "json-previewer__other",
19
+ punctuation: "json-previewer__punctuation",
20
+ stringValue: "json-previewer__string",
21
+ undefinedValue: "json-previewer__undefined"
22
+ }, a = () => !0;
23
+ function o(e) {
24
+ try {
25
+ return JSON.parse(e);
26
+ } catch {
27
+ return null;
28
+ }
29
+ }
30
+ function s(e) {
31
+ return e !== null && (Array.isArray(e) || typeof e == "object");
32
+ }
33
+ var c = ({ className: c, maxHeight: l = 200, parseStringAsJson: u = !0, shouldExpandNode: d = a, style: f, value: p }) => {
34
+ let { token: m } = t.useToken(), h = (u && typeof p == "string" ? o(p) : null) ?? p;
35
+ return s(h) ? /* @__PURE__ */ n("div", {
36
+ className: c,
37
+ style: {
38
+ fontFamily: m.fontFamilyCode,
39
+ fontSize: m.fontSizeSM,
40
+ lineHeight: 1.45,
41
+ maxHeight: l,
42
+ overflow: "auto",
43
+ overflowWrap: "anywhere",
44
+ ...f
45
+ },
46
+ children: /* @__PURE__ */ n(r, {
47
+ data: h,
48
+ shouldExpandNode: d,
49
+ style: i
50
+ })
51
+ }) : /* @__PURE__ */ n(e.Text, {
52
+ code: !0,
53
+ style: {
54
+ display: "block",
55
+ fontFamily: m.fontFamilyCode,
56
+ fontSize: m.fontSizeSM,
57
+ lineHeight: 1.35,
58
+ maxHeight: l,
59
+ overflow: "auto",
60
+ whiteSpace: "pre-wrap",
61
+ wordBreak: "break-word",
62
+ ...f
63
+ },
64
+ ...c ? { className: c } : {},
65
+ children: String(p || " ")
66
+ });
67
+ };
68
+ //#endregion
69
+ export { c as JsonPreviewer };
@@ -0,0 +1 @@
1
+ export * from './JsonPreviewer.js';
@@ -0,0 +1,2 @@
1
+ import { JsonPreviewer as e } from "./JsonPreviewer.js";
2
+ export { e as JsonPreviewer };