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.
- package/README.md +60 -0
- package/antd/CopyButton/CopyButton.d.ts +7 -0
- package/antd/CopyButton/CopyButton.js +29 -0
- package/antd/CopyButton/index.d.ts +1 -0
- package/antd/CopyButton/index.js +2 -0
- package/antd/FloatLabel/FloatLabel.css +18 -0
- package/antd/FloatLabel/FloatLabel.d.ts +8 -0
- package/antd/FloatLabel/FloatLabel.js +50 -0
- package/antd/FloatLabel/index.d.ts +1 -0
- package/antd/FloatLabel/index.js +2 -0
- package/antd/FuzzyAutoComplete/FuzzyAutoComplete.d.ts +17 -0
- package/antd/FuzzyAutoComplete/FuzzyAutoComplete.js +73 -0
- package/antd/FuzzyAutoComplete/index.d.ts +1 -0
- package/antd/FuzzyAutoComplete/index.js +2 -0
- package/antd/FuzzyPathSelect/FuzzyPathSelect.d.ts +8 -0
- package/antd/FuzzyPathSelect/FuzzyPathSelect.js +48 -0
- package/antd/FuzzyPathSelect/defaultIgnoreNames.d.ts +1 -0
- package/antd/FuzzyPathSelect/defaultIgnoreNames.js +28 -0
- package/antd/FuzzyPathSelect/index.d.ts +1 -0
- package/antd/FuzzyPathSelect/index.js +2 -0
- package/antd/FuzzyStringSelect/FuzzyStringSelect.d.ts +6 -0
- package/antd/FuzzyStringSelect/FuzzyStringSelect.js +12 -0
- package/antd/FuzzyStringSelect/index.d.ts +1 -0
- package/antd/FuzzyStringSelect/index.js +2 -0
- package/antd/HoverSwap/HoverSwap.css +3 -0
- package/antd/HoverSwap/HoverSwap.d.ts +8 -0
- package/antd/HoverSwap/HoverSwap.js +18 -0
- package/antd/HoverSwap/index.d.ts +1 -0
- package/antd/HoverSwap/index.js +2 -0
- package/antd/InputLabel/InputLabel.css +10 -0
- package/antd/InputLabel/InputLabel.d.ts +4 -0
- package/antd/InputLabel/InputLabel.js +11 -0
- package/antd/InputLabel/index.d.ts +1 -0
- package/antd/InputLabel/index.js +2 -0
- package/antd/JsonPreviewer/JsonPreviewer.css +74 -0
- package/antd/JsonPreviewer/JsonPreviewer.d.ts +11 -0
- package/antd/JsonPreviewer/JsonPreviewer.js +69 -0
- package/antd/JsonPreviewer/index.d.ts +1 -0
- package/antd/JsonPreviewer/index.js +2 -0
- package/antd/_internal/HighlightParts.d.ts +6 -0
- package/antd/_internal/HighlightParts.js +12 -0
- package/antd/index.d.ts +8 -0
- package/antd/index.js +17 -0
- package/common/SimpleType.d.ts +2 -0
- package/common/SimpleType.js +0 -0
- package/common/_internal/createObjectReferenceTracker.d.ts +5 -0
- package/common/_internal/createObjectReferenceTracker.js +11 -0
- package/common/anyToString/anyToString.d.ts +27 -0
- package/common/anyToString/anyToString.js +23 -0
- package/common/anyToString/createCircularStackTracker.d.ts +5 -0
- package/common/anyToString/createCircularStackTracker.js +14 -0
- package/common/anyToString/formatters/formatArray.d.ts +2 -0
- package/common/anyToString/formatters/formatArray.js +11 -0
- package/common/anyToString/formatters/formatArrayBufferView.d.ts +2 -0
- package/common/anyToString/formatters/formatArrayBufferView.js +14 -0
- package/common/anyToString/formatters/formatDocumentObject.d.ts +1 -0
- package/common/anyToString/formatters/formatDocumentObject.js +7 -0
- package/common/anyToString/formatters/formatElementObject.d.ts +1 -0
- package/common/anyToString/formatters/formatElementObject.js +15 -0
- package/common/anyToString/formatters/formatError.d.ts +1 -0
- package/common/anyToString/formatters/formatError.js +7 -0
- package/common/anyToString/formatters/formatFunction.d.ts +1 -0
- package/common/anyToString/formatters/formatFunction.js +6 -0
- package/common/anyToString/formatters/formatMap.d.ts +2 -0
- package/common/anyToString/formatters/formatMap.js +17 -0
- package/common/anyToString/formatters/formatObject.d.ts +2 -0
- package/common/anyToString/formatters/formatObject.js +44 -0
- package/common/anyToString/formatters/formatObjectKey.d.ts +1 -0
- package/common/anyToString/formatters/formatObjectKey.js +8 -0
- package/common/anyToString/formatters/formatRecordLike.d.ts +2 -0
- package/common/anyToString/formatters/formatRecordLike.js +39 -0
- package/common/anyToString/formatters/formatSet.d.ts +2 -0
- package/common/anyToString/formatters/formatSet.js +17 -0
- package/common/anyToString/formatters/formatString.d.ts +1 -0
- package/common/anyToString/formatters/formatString.js +8 -0
- package/common/anyToString/formatters/formatValue.d.ts +11 -0
- package/common/anyToString/formatters/formatValue.js +20 -0
- package/common/anyToString/formatters/formatWindowObject.d.ts +1 -0
- package/common/anyToString/formatters/formatWindowObject.js +6 -0
- package/common/anyToString/formatters/getConstructorName.d.ts +1 -0
- package/common/anyToString/formatters/getConstructorName.js +7 -0
- package/common/anyToString/formatters/joinBlock.d.ts +1 -0
- package/common/anyToString/formatters/joinBlock.js +9 -0
- package/common/anyToString/formatters/withCircularGuard.d.ts +2 -0
- package/common/anyToString/formatters/withCircularGuard.js +11 -0
- package/common/anyToString/index.d.ts +1 -0
- package/common/anyToString/index.js +2 -0
- package/common/assertsType.d.ts +12 -0
- package/common/assertsType.js +4 -0
- package/common/buildSequence.d.ts +6 -0
- package/common/buildSequence.js +8 -0
- package/common/deepClone.d.ts +12 -0
- package/common/deepClone.js +55 -0
- package/common/deepEqual.d.ts +12 -0
- package/common/deepEqual.js +46 -0
- package/common/deepParseJsonStrings.d.ts +1 -0
- package/common/deepParseJsonStrings.js +22 -0
- package/common/dependsOn.d.ts +12 -0
- package/common/dependsOn.js +4 -0
- package/common/doExpr.d.ts +14 -0
- package/common/doExpr.js +6 -0
- package/common/flatChildren.d.ts +1 -0
- package/common/flatChildren.js +14 -0
- package/common/formatDecimal.d.ts +12 -0
- package/common/formatDecimal.js +11 -0
- package/common/formatFriendlyTime.d.ts +1 -0
- package/common/formatFriendlyTime.js +10 -0
- package/common/formatSize.d.ts +13 -0
- package/common/formatSize.js +19 -0
- package/common/fuzzy/fuzzyMatch.d.ts +25 -0
- package/common/fuzzy/fuzzyMatch.js +19 -0
- package/common/fuzzy/fuzzyMatchPath.d.ts +23 -0
- package/common/fuzzy/fuzzyMatchPath.js +102 -0
- package/common/fuzzy/types.d.ts +10 -0
- package/common/fuzzy/types.js +0 -0
- package/common/fuzzy/utils/buildHighlightParts.d.ts +4 -0
- package/common/fuzzy/utils/buildHighlightParts.js +21 -0
- package/common/fuzzy/utils/buildHighlightRanges.d.ts +1 -0
- package/common/fuzzy/utils/buildHighlightRanges.js +20 -0
- package/common/fuzzy/utils/index.d.ts +5 -0
- package/common/fuzzy/utils/index.js +6 -0
- package/common/fuzzy/utils/normalizePathSeparators.d.ts +1 -0
- package/common/fuzzy/utils/normalizePathSeparators.js +7 -0
- package/common/fuzzy/utils/rankFuzzyCandidates.d.ts +2 -0
- package/common/fuzzy/utils/rankFuzzyCandidates.js +26 -0
- package/common/fuzzy/utils/scoreLooseFuzzyMatch.d.ts +2 -0
- package/common/fuzzy/utils/scoreLooseFuzzyMatch.js +126 -0
- package/common/getEnumerableOwnDescriptors.d.ts +1 -0
- package/common/getEnumerableOwnDescriptors.js +11 -0
- package/common/index.d.ts +49 -0
- package/common/index.js +48 -0
- package/common/isEmptyRecord.d.ts +10 -0
- package/common/isEmptyRecord.js +7 -0
- package/common/isNil.d.ts +13 -0
- package/common/isNil.js +6 -0
- package/common/isNonNil.d.ts +11 -0
- package/common/isNonNil.js +6 -0
- package/common/isRecord.d.ts +12 -0
- package/common/isRecord.js +8 -0
- package/common/jsonRecord/filterJsonRecord.d.ts +16 -0
- package/common/jsonRecord/filterJsonRecord.js +19 -0
- package/common/jsonRecord/isJsonRecord.d.ts +16 -0
- package/common/jsonRecord/isJsonRecord.js +16 -0
- package/common/jsonRecord/jsonRecordDiff.d.ts +13 -0
- package/common/jsonRecord/jsonRecordDiff.js +26 -0
- package/common/jsonRecord/mapJsonRecord.d.ts +13 -0
- package/common/jsonRecord/mapJsonRecord.js +14 -0
- package/common/jsonRecord/modifyJsonRecord.d.ts +14 -0
- package/common/jsonRecord/modifyJsonRecord.js +24 -0
- package/common/jsonRecord/walkJsonRecord.d.ts +15 -0
- package/common/jsonRecord/walkJsonRecord.js +16 -0
- package/common/onlyUnique.d.ts +10 -0
- package/common/onlyUnique.js +6 -0
- package/common/pipe.d.ts +9 -0
- package/common/pipe.js +6 -0
- package/common/pipeNonNil.d.ts +16 -0
- package/common/pipeNonNil.js +7 -0
- package/common/safeJsonStringify.d.ts +28 -0
- package/common/safeJsonStringify.js +105 -0
- package/common/simpleInt/isSimpleInt.d.ts +6 -0
- package/common/simpleInt/isSimpleInt.js +6 -0
- package/common/simpleInt/isSimpleIntInputing.d.ts +6 -0
- package/common/simpleInt/isSimpleIntInputing.js +7 -0
- package/common/simpleInt/isSimpleNumber.d.ts +10 -0
- package/common/simpleInt/isSimpleNumber.js +6 -0
- package/common/simpleInt/isSimpleNumberInputing.d.ts +6 -0
- package/common/simpleInt/isSimpleNumberInputing.js +7 -0
- package/common/simpleInt/parseSimpleInt.d.ts +6 -0
- package/common/simpleInt/parseSimpleInt.js +11 -0
- package/common/simpleInt/parseSimpleIntOrNil.d.ts +6 -0
- package/common/simpleInt/parseSimpleIntOrNil.js +9 -0
- package/common/simpleInt/parseSimpleNumber.d.ts +6 -0
- package/common/simpleInt/parseSimpleNumber.js +11 -0
- package/common/simpleInt/parseSimpleNumberOrNil.d.ts +4 -0
- package/common/simpleInt/parseSimpleNumberOrNil.js +7 -0
- package/common/tap.d.ts +9 -0
- package/common/tap.js +6 -0
- package/common/tree/buildTree.d.ts +6 -0
- package/common/tree/buildTree.js +13 -0
- package/common/tree/flatTree.d.ts +2 -0
- package/common/tree/flatTree.js +7 -0
- package/common/tree/mapTree.d.ts +2 -0
- package/common/tree/mapTree.js +11 -0
- package/common/tree/pruneTree.d.ts +2 -0
- package/common/tree/pruneTree.js +15 -0
- package/common/tree/sortTree.d.ts +2 -0
- package/common/tree/sortTree.js +11 -0
- package/common/tree/treeToArray.d.ts +2 -0
- package/common/tree/treeToArray.js +12 -0
- package/common/tree/treeToRows.d.ts +5 -0
- package/common/tree/treeToRows.js +19 -0
- package/common/tree/treeTypes.d.ts +7 -0
- package/common/tree/treeTypes.js +0 -0
- package/common/tree/walkTree.d.ts +2 -0
- package/common/tree/walkTree.js +13 -0
- package/common/truncateJsonStrings.d.ts +14 -0
- package/common/truncateJsonStrings.js +7 -0
- package/common/truncateString.d.ts +13 -0
- package/common/truncateString.js +7 -0
- package/common/tryParsePartialJson.d.ts +11 -0
- package/common/tryParsePartialJson.js +156 -0
- package/eslint-config/eslintPreset.d.ts +2 -0
- package/eslint-config/eslintPreset.js +36 -0
- package/eslint-config/index.d.ts +14 -0
- package/eslint-config/index.js +20 -0
- package/eslint-config/layers/configLayer.d.ts +2 -0
- package/eslint-config/layers/configLayer.js +16 -0
- package/eslint-config/layers/jsLayer.d.ts +2 -0
- package/eslint-config/layers/jsLayer.js +20 -0
- package/eslint-config/layers/prettierLayer.d.ts +5 -0
- package/eslint-config/layers/prettierLayer.js +5 -0
- package/eslint-config/layers/reactHookLayer.d.ts +2 -0
- package/eslint-config/layers/reactHookLayer.js +16 -0
- package/eslint-config/layers/testLayer.d.ts +2 -0
- package/eslint-config/layers/testLayer.js +46 -0
- package/eslint-config/layers/tsLayer.d.ts +2 -0
- package/eslint-config/layers/tsLayer.js +70 -0
- package/eslint-config/plugins/freewindSingleExportPlugin.d.ts +2 -0
- package/eslint-config/plugins/freewindSingleExportPlugin.js +47 -0
- package/eslint-config/utils/withRuleOverrides.d.ts +2 -0
- package/eslint-config/utils/withRuleOverrides.js +9 -0
- package/index.d.ts +1 -0
- package/index.js +49 -0
- package/node/index.d.ts +2 -0
- package/node/index.js +3 -0
- package/node/md5.d.ts +11 -0
- package/node/md5.js +7 -0
- package/node/uuid.d.ts +11 -0
- package/node/uuid.js +7 -0
- package/package.json +115 -0
- package/prettier-config/freewindPrettierPreset.d.ts +2 -0
- package/prettier-config/freewindPrettierPreset.js +4 -0
- package/prettier-config/index.d.ts +1 -0
- package/prettier-config/index.js +2 -0
- package/react/hooks/useCopyToClipboard.d.ts +10 -0
- package/react/hooks/useCopyToClipboard.js +28 -0
- package/react/hooks/useDeepCompareSelector.d.ts +23 -0
- package/react/hooks/useDeepCompareSelector.js +14 -0
- package/react/hooks/useInputEvent/_internal/ink-input/index.d.ts +2 -0
- package/react/hooks/useInputEvent/_internal/ink-input/index.js +3 -0
- package/react/hooks/useInputEvent/_internal/ink-input/input-parser.d.ts +6 -0
- package/react/hooks/useInputEvent/_internal/ink-input/input-parser.js +98 -0
- package/react/hooks/useInputEvent/_internal/ink-input/kitty-keyboard.d.ts +19 -0
- package/react/hooks/useInputEvent/_internal/ink-input/kitty-keyboard.js +13 -0
- package/react/hooks/useInputEvent/_internal/ink-input/parse-keypress.d.ts +33 -0
- package/react/hooks/useInputEvent/_internal/ink-input/parse-keypress.js +319 -0
- package/react/hooks/useInputEvent/formatInputEvent.d.ts +2 -0
- package/react/hooks/useInputEvent/formatInputEvent.js +25 -0
- package/react/hooks/useInputEvent/index.d.ts +4 -0
- package/react/hooks/useInputEvent/index.js +4 -0
- package/react/hooks/useInputEvent/inputEventTypes.d.ts +51 -0
- package/react/hooks/useInputEvent/inputEventTypes.js +0 -0
- package/react/hooks/useInputEvent/parseInputEvent.d.ts +4 -0
- package/react/hooks/useInputEvent/parseInputEvent.js +100 -0
- package/react/hooks/useInputEvent/useInputEvent.d.ts +7 -0
- package/react/hooks/useInputEvent/useInputEvent.js +57 -0
- package/react/hooks/useOverlayStack/_internal/overlayStackId.d.ts +2 -0
- package/react/hooks/useOverlayStack/_internal/overlayStackId.js +6 -0
- package/react/hooks/useOverlayStack/createOverlayStackItem.d.ts +2 -0
- package/react/hooks/useOverlayStack/createOverlayStackItem.js +10 -0
- package/react/hooks/useOverlayStack/index.d.ts +3 -0
- package/react/hooks/useOverlayStack/index.js +3 -0
- package/react/hooks/useOverlayStack/overlayStackTypes.d.ts +13 -0
- package/react/hooks/useOverlayStack/overlayStackTypes.js +0 -0
- package/react/hooks/useOverlayStack/useOverlayStack.d.ts +2 -0
- package/react/hooks/useOverlayStack/useOverlayStack.js +24 -0
- package/react/index.d.ts +4 -0
- package/react/index.js +10 -0
- package/react/ink-components/InkModal/InkModal.d.ts +3 -0
- package/react/ink-components/InkModal/InkModal.js +101 -0
- package/react/ink-components/InkModal/index.d.ts +4 -0
- package/react/ink-components/InkModal/index.js +4 -0
- package/react/ink-components/InkModal/types.d.ts +24 -0
- package/react/ink-components/InkModal/types.js +0 -0
- package/react/ink-components/InkModal/utils/computeInkModalBodyMaxHeight.d.ts +1 -0
- package/react/ink-components/InkModal/utils/computeInkModalBodyMaxHeight.js +4 -0
- package/react/ink-components/InkModal/utils/resolveInkModalSize.d.ts +6 -0
- package/react/ink-components/InkModal/utils/resolveInkModalSize.js +7 -0
- package/react/ink-components/InkMultiSelect/InkMultiSelect.d.ts +22 -0
- package/react/ink-components/InkMultiSelect/InkMultiSelect.js +94 -0
- package/react/ink-components/InkMultiSelect/InkMultiSelectRow.d.ts +10 -0
- package/react/ink-components/InkMultiSelect/InkMultiSelectRow.js +35 -0
- package/react/ink-components/InkMultiSelect/index.d.ts +8 -0
- package/react/ink-components/InkMultiSelect/index.js +9 -0
- package/react/ink-components/InkMultiSelect/inkMultiSelectKeyboard.d.ts +17 -0
- package/react/ink-components/InkMultiSelect/inkMultiSelectKeyboard.js +19 -0
- package/react/ink-components/InkMultiSelect/types.d.ts +20 -0
- package/react/ink-components/InkMultiSelect/types.js +18 -0
- package/react/ink-components/InkMultiSelect/useInkMultiSelectNavigation.d.ts +10 -0
- package/react/ink-components/InkMultiSelect/useInkMultiSelectNavigation.js +40 -0
- package/react/ink-components/InkMultiSelect/utils/clampListScrollOffset.d.ts +1 -0
- package/react/ink-components/InkMultiSelect/utils/clampListScrollOffset.js +6 -0
- package/react/ink-components/InkMultiSelect/utils/formatMoreLabel.d.ts +1 -0
- package/react/ink-components/InkMultiSelect/utils/formatMoreLabel.js +6 -0
- package/react/ink-components/InkMultiSelect/utils/inkMultiSelectVisibleCount.d.ts +2 -0
- package/react/ink-components/InkMultiSelect/utils/inkMultiSelectVisibleCount.js +7 -0
- package/react/ink-components/InkScrollView/InkScrollView.d.ts +19 -0
- package/react/ink-components/InkScrollView/InkScrollView.js +103 -0
- package/react/ink-components/InkScrollView/Scrollbar.d.ts +7 -0
- package/react/ink-components/InkScrollView/Scrollbar.js +16 -0
- package/react/ink-components/InkScrollView/index.d.ts +9 -0
- package/react/ink-components/InkScrollView/index.js +18 -0
- package/react/ink-components/InkScrollView/utils/applyInkScrollInput.d.ts +10 -0
- package/react/ink-components/InkScrollView/utils/applyInkScrollInput.js +57 -0
- package/react/ink-components/InkScrollView/utils/bounds/getAbsoluteBounds.d.ts +7 -0
- package/react/ink-components/InkScrollView/utils/bounds/getAbsoluteBounds.js +19 -0
- package/react/ink-components/InkScrollView/utils/bounds/index.d.ts +3 -0
- package/react/ink-components/InkScrollView/utils/bounds/index.js +4 -0
- package/react/ink-components/InkScrollView/utils/bounds/isInside.d.ts +2 -0
- package/react/ink-components/InkScrollView/utils/bounds/isInside.js +7 -0
- package/react/ink-components/InkScrollView/utils/bounds/rowInViewport.d.ts +2 -0
- package/react/ink-components/InkScrollView/utils/bounds/rowInViewport.js +4 -0
- package/react/ink-components/InkScrollView/utils/inkScrollInputTarget.d.ts +11 -0
- package/react/ink-components/InkScrollView/utils/inkScrollInputTarget.js +0 -0
- package/react/ink-components/InkScrollView/utils/scrollMath/allocateHeights.d.ts +6 -0
- package/react/ink-components/InkScrollView/utils/scrollMath/allocateHeights.js +29 -0
- package/react/ink-components/InkScrollView/utils/scrollMath/clampOffset.d.ts +1 -0
- package/react/ink-components/InkScrollView/utils/scrollMath/clampOffset.js +7 -0
- package/react/ink-components/InkScrollView/utils/scrollMath/computeScrollbarThumb.d.ts +5 -0
- package/react/ink-components/InkScrollView/utils/scrollMath/computeScrollbarThumb.js +14 -0
- package/react/ink-components/InkScrollView/utils/scrollMath/index.d.ts +10 -0
- package/react/ink-components/InkScrollView/utils/scrollMath/index.js +11 -0
- package/react/ink-components/InkScrollView/utils/scrollMath/offsetFromScrollbarClick.d.ts +1 -0
- package/react/ink-components/InkScrollView/utils/scrollMath/offsetFromScrollbarClick.js +12 -0
- package/react/ink-components/InkScrollView/utils/scrollMath/offsetFromScrollbarDrag.d.ts +1 -0
- package/react/ink-components/InkScrollView/utils/scrollMath/offsetFromScrollbarDrag.js +8 -0
- package/react/ink-components/InkScrollView/utils/scrollMath/resolveNextStickToBottomOffset.d.ts +8 -0
- package/react/ink-components/InkScrollView/utils/scrollMath/resolveNextStickToBottomOffset.js +10 -0
- package/react/ink-components/InkScrollView/utils/scrollMath/scrollByInputEventKey.d.ts +1 -0
- package/react/ink-components/InkScrollView/utils/scrollMath/scrollByInputEventKey.js +15 -0
- package/react/ink-components/InkScrollView/utils/scrollMath/scrollByKey.d.ts +9 -0
- package/react/ink-components/InkScrollView/utils/scrollMath/scrollByKey.js +7 -0
- package/react/ink-components/InkScrollView/utils/scrollMath/scrollByWheel.d.ts +2 -0
- package/react/ink-components/InkScrollView/utils/scrollMath/scrollByWheel.js +8 -0
- package/react/ink-components/InkScrollView/utils/scrollMath/stickToBottomOffset.d.ts +1 -0
- package/react/ink-components/InkScrollView/utils/scrollMath/stickToBottomOffset.js +4 -0
- package/react/ink-components/InkScrollView/utils/useInkScrollInput.d.ts +10 -0
- package/react/ink-components/InkScrollView/utils/useInkScrollInput.js +17 -0
- package/react/ink-components/InkTimer/InkTimer.d.ts +9 -0
- package/react/ink-components/InkTimer/InkTimer.js +26 -0
- package/react/ink-components/InkTimer/index.d.ts +1 -0
- package/react/ink-components/InkTimer/index.js +2 -0
- package/react/ink-components/index.d.ts +4 -0
- package/react/ink-components/index.js +34 -0
- package/vite-plugins/fileLinePlaceholderPlugin.d.ts +26 -0
- package/vite-plugins/fileLinePlaceholderPlugin.js +57 -0
- package/vite-plugins/index.d.ts +1 -0
- package/vite-plugins/index.js +2 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Typography as e } from "antd";
|
|
2
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
3
|
+
//#region src/antd/_internal/HighlightParts.tsx
|
|
4
|
+
var n = ({ parts: e }) => /* @__PURE__ */ t("span", { children: e.map((e, t) => r(e, t)) });
|
|
5
|
+
function r(n, r) {
|
|
6
|
+
return n.matched ? /* @__PURE__ */ t(e.Text, {
|
|
7
|
+
mark: !0,
|
|
8
|
+
children: n.text
|
|
9
|
+
}, r) : /* @__PURE__ */ t("span", { children: n.text }, r);
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { n as HighlightParts };
|
package/antd/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './CopyButton/index.js';
|
|
2
|
+
export * from './FloatLabel/index.js';
|
|
3
|
+
export * from './FuzzyAutoComplete/index.js';
|
|
4
|
+
export * from './FuzzyPathSelect/index.js';
|
|
5
|
+
export * from './FuzzyStringSelect/index.js';
|
|
6
|
+
export * from './HoverSwap/index.js';
|
|
7
|
+
export * from './InputLabel/index.js';
|
|
8
|
+
export * from './JsonPreviewer/index.js';
|
package/antd/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CopyButton as e } from "./CopyButton/CopyButton.js";
|
|
2
|
+
import "./CopyButton/index.js";
|
|
3
|
+
import { FloatLabel as t } from "./FloatLabel/FloatLabel.js";
|
|
4
|
+
import "./FloatLabel/index.js";
|
|
5
|
+
import { FuzzyAutoComplete as n } from "./FuzzyAutoComplete/FuzzyAutoComplete.js";
|
|
6
|
+
import "./FuzzyAutoComplete/index.js";
|
|
7
|
+
import { FuzzyPathSelect as r } from "./FuzzyPathSelect/FuzzyPathSelect.js";
|
|
8
|
+
import "./FuzzyPathSelect/index.js";
|
|
9
|
+
import { FuzzyStringSelect as i } from "./FuzzyStringSelect/FuzzyStringSelect.js";
|
|
10
|
+
import "./FuzzyStringSelect/index.js";
|
|
11
|
+
import { HoverSwap as a } from "./HoverSwap/HoverSwap.js";
|
|
12
|
+
import "./HoverSwap/index.js";
|
|
13
|
+
import { InputLabel as o } from "./InputLabel/InputLabel.js";
|
|
14
|
+
import "./InputLabel/index.js";
|
|
15
|
+
import { JsonPreviewer as s } from "./JsonPreviewer/JsonPreviewer.js";
|
|
16
|
+
import "./JsonPreviewer/index.js";
|
|
17
|
+
export { e as CopyButton, t as FloatLabel, n as FuzzyAutoComplete, r as FuzzyPathSelect, i as FuzzyStringSelect, a as HoverSwap, o as InputLabel, s as JsonPreviewer };
|
|
File without changes
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/common/_internal/createObjectReferenceTracker.ts
|
|
2
|
+
function e() {
|
|
3
|
+
let e = /* @__PURE__ */ new Map();
|
|
4
|
+
return { remember(t, n) {
|
|
5
|
+
let r = e.get(t);
|
|
6
|
+
if (r) return r;
|
|
7
|
+
e.set(t, n);
|
|
8
|
+
} };
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { e as createObjectReferenceTracker };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
type AnyToStringOptions = {
|
|
2
|
+
maxDepth?: number;
|
|
3
|
+
maxEntries?: number;
|
|
4
|
+
maxStringLength?: number;
|
|
5
|
+
spaces?: number;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Converts any value into a readable string and safely handles special objects such as
|
|
9
|
+
* `Error`, `Date`, `Map`, `Set`, DOM nodes, `window`, and circular references.
|
|
10
|
+
*
|
|
11
|
+
* It avoids invoking enumerable getters, keeps custom instance names visible, and can
|
|
12
|
+
* shorten deep or wide structures to keep logs readable.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* anyToString({
|
|
17
|
+
* user: 'alice',
|
|
18
|
+
* error: new Error('request failed'),
|
|
19
|
+
* })
|
|
20
|
+
* // {
|
|
21
|
+
* // user: "alice",
|
|
22
|
+
* // error: Error: request failed
|
|
23
|
+
* // }
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function anyToString(value: unknown, options?: AnyToStringOptions): string;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createCircularStackTracker as e } from "./createCircularStackTracker.js";
|
|
2
|
+
import { formatValue as t } from "./formatters/formatValue.js";
|
|
3
|
+
//#region src/common/anyToString/anyToString.ts
|
|
4
|
+
var n = 4, r = 20, i = 2;
|
|
5
|
+
function a(n, r = {}) {
|
|
6
|
+
return t(n, {
|
|
7
|
+
options: o(r),
|
|
8
|
+
circularTracker: e()
|
|
9
|
+
}, 0, !1);
|
|
10
|
+
}
|
|
11
|
+
function o(e) {
|
|
12
|
+
return {
|
|
13
|
+
maxDepth: s(e.maxDepth, n),
|
|
14
|
+
maxEntries: s(e.maxEntries, r),
|
|
15
|
+
maxStringLength: e.maxStringLength === void 0 ? void 0 : s(e.maxStringLength, 0),
|
|
16
|
+
spaces: s(e.spaces, i)
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function s(e, t) {
|
|
20
|
+
return typeof e != "number" || !Number.isFinite(e) ? t : Math.max(0, Math.floor(e));
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { a as anyToString };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/common/anyToString/createCircularStackTracker.ts
|
|
2
|
+
function e() {
|
|
3
|
+
let e = /* @__PURE__ */ new WeakSet();
|
|
4
|
+
return {
|
|
5
|
+
enter(t) {
|
|
6
|
+
return e.has(t) ? !0 : (e.add(t), !1);
|
|
7
|
+
},
|
|
8
|
+
leave(t) {
|
|
9
|
+
e.delete(t);
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { e as createCircularStackTracker };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { joinBlock as e } from "./joinBlock.js";
|
|
2
|
+
import { formatValue as t } from "./formatValue.js";
|
|
3
|
+
//#region src/common/anyToString/formatters/formatArray.ts
|
|
4
|
+
function n(n, r, i) {
|
|
5
|
+
if (i >= r.options.maxDepth) return `[Array(${n.length})]`;
|
|
6
|
+
let a = [], o = Math.min(n.length, r.options.maxEntries);
|
|
7
|
+
for (let e = 0; e < o; e += 1) a.push(e in n ? t(n[e], r, i + 1, !0) : "<empty>");
|
|
8
|
+
return n.length > o && a.push(`...(${n.length - o} more)`), e("[", "]", a, r.options.spaces, i);
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { n as formatArray };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { joinBlock as e } from "./joinBlock.js";
|
|
2
|
+
import { getConstructorName as t } from "./getConstructorName.js";
|
|
3
|
+
import { formatValue as n } from "./formatValue.js";
|
|
4
|
+
//#region src/common/anyToString/formatters/formatArrayBufferView.ts
|
|
5
|
+
function r(r, i, a) {
|
|
6
|
+
let o = t(r) || "ArrayBufferView";
|
|
7
|
+
if (r instanceof DataView) return `${o}(${r.byteLength})`;
|
|
8
|
+
let s = Array.from(r);
|
|
9
|
+
if (a >= i.options.maxDepth) return `${o}(${s.length})`;
|
|
10
|
+
let c = Math.min(s.length, i.options.maxEntries), l = s.slice(0, c).map((e) => n(e, i, a + 1, !0));
|
|
11
|
+
return s.length > c && l.push(`...(${s.length - c} more)`), e(`${o}(${s.length}) [`, "]", l, i.options.spaces, a);
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { r as formatArrayBufferView };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function formatDocumentObject(value: object): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function formatElementObject(value: object): string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/common/anyToString/formatters/formatElementObject.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
let n = "tagName" in e && typeof e.tagName == "string" ? e.tagName.toLowerCase() : "element", r = "id" in e && typeof e.id == "string" && e.id ? `#${e.id}` : "", i = t(e);
|
|
4
|
+
return `${n}${r}${i ? "." + i.trim().split(/\s+/).filter(Boolean).join(".") : ""}`;
|
|
5
|
+
}
|
|
6
|
+
function t(e) {
|
|
7
|
+
if ("className" in e && typeof e.className == "string") return e.className;
|
|
8
|
+
if ("getAttribute" in e && typeof e.getAttribute == "function") {
|
|
9
|
+
let t = e.getAttribute("class");
|
|
10
|
+
return typeof t == "string" ? t : "";
|
|
11
|
+
}
|
|
12
|
+
return "";
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { e as formatElementObject };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function formatError(value: Error): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function formatFunction(value: Function): string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { joinBlock as e } from "./joinBlock.js";
|
|
2
|
+
import { formatValue as t } from "./formatValue.js";
|
|
3
|
+
//#region src/common/anyToString/formatters/formatMap.ts
|
|
4
|
+
function n(n, r, i) {
|
|
5
|
+
if (i >= r.options.maxDepth) return `Map(${n.size})`;
|
|
6
|
+
let a = [], o = 0;
|
|
7
|
+
for (let [e, s] of n) {
|
|
8
|
+
if (o >= r.options.maxEntries) {
|
|
9
|
+
a.push(`...(${n.size - o} more)`);
|
|
10
|
+
break;
|
|
11
|
+
}
|
|
12
|
+
a.push(`${t(e, r, i + 1, !0)} => ${t(s, r, i + 1, !0)}`), o += 1;
|
|
13
|
+
}
|
|
14
|
+
return e("Map(" + String(n.size) + ") {", "}", a, r.options.spaces, i);
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { n as formatMap };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { formatArray as e } from "./formatArray.js";
|
|
2
|
+
import { formatArrayBufferView as t } from "./formatArrayBufferView.js";
|
|
3
|
+
import { formatDocumentObject as n } from "./formatDocumentObject.js";
|
|
4
|
+
import { formatElementObject as r } from "./formatElementObject.js";
|
|
5
|
+
import { formatError as i } from "./formatError.js";
|
|
6
|
+
import { formatMap as a } from "./formatMap.js";
|
|
7
|
+
import { formatRecordLike as o } from "./formatRecordLike.js";
|
|
8
|
+
import { formatSet as s } from "./formatSet.js";
|
|
9
|
+
import { formatWindowObject as c } from "./formatWindowObject.js";
|
|
10
|
+
import { withCircularGuard as l } from "./withCircularGuard.js";
|
|
11
|
+
import { formatValue as u } from "./formatValue.js";
|
|
12
|
+
//#region src/common/anyToString/formatters/formatObject.ts
|
|
13
|
+
function d(d, _, v) {
|
|
14
|
+
let y = f(d);
|
|
15
|
+
return y !== void 0 && y !== d ? u(y, _, v, !1) : d instanceof Date ? Number.isNaN(d.getTime()) ? "Invalid Date" : d.toISOString() : d instanceof Error ? i(d) : d instanceof RegExp ? String(d) : typeof URL < "u" && d instanceof URL ? `URL(${d.href})` : p(d) ? "Promise" : m(d) ? c(d) : h(d) ? n(d) : g(d) ? r(d) : Array.isArray(d) ? l(d, _, () => e(d, _, v)) : d instanceof Map ? l(d, _, () => a(d, _, v)) : d instanceof Set ? l(d, _, () => s(d, _, v)) : ArrayBuffer.isView(d) ? t(d, _, v) : d instanceof ArrayBuffer ? `ArrayBuffer(${d.byteLength})` : l(d, _, () => o(d, _, v));
|
|
16
|
+
}
|
|
17
|
+
function f(e) {
|
|
18
|
+
if (!("toQuickValue" in e)) return;
|
|
19
|
+
let t = e.toQuickValue;
|
|
20
|
+
if (typeof t == "function") try {
|
|
21
|
+
return t.call(e);
|
|
22
|
+
} catch {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function p(e) {
|
|
27
|
+
return _(e) === "[object Promise]" || "then" in e && typeof e.then == "function";
|
|
28
|
+
}
|
|
29
|
+
function m(e) {
|
|
30
|
+
let t = _(e);
|
|
31
|
+
return t === "[object Window]" || t === "[object global]" && "window" in e && e.window === e && "document" in e;
|
|
32
|
+
}
|
|
33
|
+
function h(e) {
|
|
34
|
+
let t = _(e);
|
|
35
|
+
return t === "[object Document]" || t === "[object HTMLDocument]" || "nodeType" in e && e.nodeType === 9 && "title" in e;
|
|
36
|
+
}
|
|
37
|
+
function g(e) {
|
|
38
|
+
return "nodeType" in e && e.nodeType === 1 && "tagName" in e;
|
|
39
|
+
}
|
|
40
|
+
function _(e) {
|
|
41
|
+
return Object.prototype.toString.call(e);
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
export { d as formatObject };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function formatObjectKey(key: PropertyKey): string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/common/anyToString/formatters/formatObjectKey.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
if (typeof e == "symbol") return `[${String(e)}]`;
|
|
4
|
+
let t = String(e);
|
|
5
|
+
return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(t) ? t : JSON.stringify(t);
|
|
6
|
+
}
|
|
7
|
+
//#endregion
|
|
8
|
+
export { e as formatObjectKey };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { joinBlock as e } from "./joinBlock.js";
|
|
2
|
+
import { getConstructorName as t } from "./getConstructorName.js";
|
|
3
|
+
import { getEnumerableOwnDescriptors as n } from "../../getEnumerableOwnDescriptors.js";
|
|
4
|
+
import { formatObjectKey as r } from "./formatObjectKey.js";
|
|
5
|
+
import { formatValue as i } from "./formatValue.js";
|
|
6
|
+
//#region src/common/anyToString/formatters/formatRecordLike.ts
|
|
7
|
+
function a(n, i, a) {
|
|
8
|
+
let l = t(n);
|
|
9
|
+
if (a >= i.options.maxDepth) return l ? `${l} { ... }` : "{ ... }";
|
|
10
|
+
let u = s(n).map(([e, t]) => `${r(e)}: ${c(t, i, a + 1)}`);
|
|
11
|
+
return (l ? `${l} ` : "") + e("{", "}", o(u, i.options.maxEntries), i.options.spaces, a);
|
|
12
|
+
}
|
|
13
|
+
function o(e, t) {
|
|
14
|
+
return e.length <= t ? e : [...e.slice(0, t), `...(${e.length - t} more)`];
|
|
15
|
+
}
|
|
16
|
+
function s(e) {
|
|
17
|
+
let t = [];
|
|
18
|
+
for (let [r, i] of n(e)) {
|
|
19
|
+
if ("value" in i) {
|
|
20
|
+
t.push([r, i.value]);
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
if (i.get && i.set) {
|
|
24
|
+
t.push([r, "[Getter/Setter]"]);
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
if (i.get) {
|
|
28
|
+
t.push([r, "[Getter]"]);
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
t.push([r, "[Setter]"]);
|
|
32
|
+
}
|
|
33
|
+
return t;
|
|
34
|
+
}
|
|
35
|
+
function c(e, t, n) {
|
|
36
|
+
return e === "[Getter]" || e === "[Getter/Setter]" || e === "[Setter]" ? e : i(e, t, n, !0);
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { a as formatRecordLike };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { joinBlock as e } from "./joinBlock.js";
|
|
2
|
+
import { formatValue as t } from "./formatValue.js";
|
|
3
|
+
//#region src/common/anyToString/formatters/formatSet.ts
|
|
4
|
+
function n(n, r, i) {
|
|
5
|
+
if (i >= r.options.maxDepth) return `Set(${n.size})`;
|
|
6
|
+
let a = [], o = 0;
|
|
7
|
+
for (let e of n) {
|
|
8
|
+
if (o >= r.options.maxEntries) {
|
|
9
|
+
a.push(`...(${n.size - o} more)`);
|
|
10
|
+
break;
|
|
11
|
+
}
|
|
12
|
+
a.push(t(e, r, i + 1, !0)), o += 1;
|
|
13
|
+
}
|
|
14
|
+
return e("Set(" + String(n.size) + ") {", "}", a, r.options.spaces, i);
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { n as formatSet };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function formatString(value: string, maxStringLength: number | undefined, nested: boolean): string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { truncateString as e } from "../../truncateString.js";
|
|
2
|
+
//#region src/common/anyToString/formatters/formatString.ts
|
|
3
|
+
function t(t, n, r) {
|
|
4
|
+
let i = n === void 0 ? t : e(t, n);
|
|
5
|
+
return r ? JSON.stringify(i) : i;
|
|
6
|
+
}
|
|
7
|
+
//#endregion
|
|
8
|
+
export { t as formatString };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CircularStackTracker } from '../createCircularStackTracker.js';
|
|
2
|
+
export type FormatContext = {
|
|
3
|
+
options: {
|
|
4
|
+
maxDepth: number;
|
|
5
|
+
maxEntries: number;
|
|
6
|
+
maxStringLength: number | undefined;
|
|
7
|
+
spaces: number;
|
|
8
|
+
};
|
|
9
|
+
circularTracker: CircularStackTracker;
|
|
10
|
+
};
|
|
11
|
+
export declare function formatValue(value: unknown, context: FormatContext, depth: number, nested: boolean): string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { formatFunction as e } from "./formatFunction.js";
|
|
2
|
+
import { formatObject as t } from "./formatObject.js";
|
|
3
|
+
import { formatString as n } from "./formatString.js";
|
|
4
|
+
//#region src/common/anyToString/formatters/formatValue.ts
|
|
5
|
+
function r(r, i, a, o) {
|
|
6
|
+
if (r === null) return "null";
|
|
7
|
+
if (r === void 0) return "undefined";
|
|
8
|
+
switch (typeof r) {
|
|
9
|
+
case "string": return n(r, i.options.maxStringLength, o);
|
|
10
|
+
case "number": return Number.isNaN(r) ? "NaN" : String(r);
|
|
11
|
+
case "boolean": return String(r);
|
|
12
|
+
case "bigint": return `${r}n`;
|
|
13
|
+
case "symbol": return String(r);
|
|
14
|
+
case "function": return e(r);
|
|
15
|
+
case "object": return t(r, i, a);
|
|
16
|
+
default: return String(r);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { r as formatValue };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function formatWindowObject(value: object): string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
//#region src/common/anyToString/formatters/formatWindowObject.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
return `Window(${"location" in e && e.location && typeof e.location == "object" && "href" in e.location && typeof e.location.href == "string" ? e.location.href : ""})`;
|
|
4
|
+
}
|
|
5
|
+
//#endregion
|
|
6
|
+
export { e as formatWindowObject };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getConstructorName(value: object): string | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function joinBlock(open: string, close: string, items: string[], spaces: number, depth: number): string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/common/anyToString/formatters/joinBlock.ts
|
|
2
|
+
function e(e, t, n, r, i) {
|
|
3
|
+
if (n.length === 0) return `${e}${t}`;
|
|
4
|
+
if (r === 0) return `${e}${n.join(", ")}${t}`;
|
|
5
|
+
let a = " ".repeat(i * r), o = " ".repeat((i + 1) * r);
|
|
6
|
+
return `${e}\n${n.map((e) => `${o}${e}`).join(",\n")}\n${a}${t}`;
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { e as joinBlock };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/common/anyToString/formatters/withCircularGuard.ts
|
|
2
|
+
function e(e, t, n) {
|
|
3
|
+
if (t.circularTracker.enter(e)) return "[Circular]";
|
|
4
|
+
try {
|
|
5
|
+
return n();
|
|
6
|
+
} finally {
|
|
7
|
+
t.circularTracker.leave(e);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { e as withCircularGuard };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './anyToString.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provides a compile-time assertion hook for narrowing a value to a target type.
|
|
3
|
+
*
|
|
4
|
+
* This function does nothing at runtime.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* const value: unknown = 'hello'
|
|
9
|
+
* assertsType<string>(value)
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export declare function assertsType<T>(value: unknown): asserts value is T;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deeply clones arrays, objects, maps, sets, dates, regexes, array buffers,
|
|
3
|
+
* and typed arrays.
|
|
4
|
+
*
|
|
5
|
+
* Circular references are supported. `null` prototypes are preserved.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* const copy = deepClone({ a: [1, 2] })
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export declare function deepClone<T>(value: T): T;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { getEnumerableOwnDescriptors as e } from "./getEnumerableOwnDescriptors.js";
|
|
2
|
+
//#region src/common/deepClone.ts
|
|
3
|
+
function t(e, t) {
|
|
4
|
+
if (e instanceof DataView) {
|
|
5
|
+
let r = n(e.buffer.slice(e.byteOffset, e.byteOffset + e.byteLength), t);
|
|
6
|
+
return new DataView(r, 0, e.byteLength);
|
|
7
|
+
}
|
|
8
|
+
let r = e.constructor;
|
|
9
|
+
return new r(e);
|
|
10
|
+
}
|
|
11
|
+
function n(r, i) {
|
|
12
|
+
if (typeof r != "object" || !r) return r;
|
|
13
|
+
let a = i.get(r);
|
|
14
|
+
if (a !== void 0) return a;
|
|
15
|
+
if (r instanceof Date) return new Date(r.getTime());
|
|
16
|
+
if (r instanceof RegExp) {
|
|
17
|
+
let e = new RegExp(r.source, r.flags);
|
|
18
|
+
return e.lastIndex = r.lastIndex, e;
|
|
19
|
+
}
|
|
20
|
+
if (r instanceof Map) {
|
|
21
|
+
let e = /* @__PURE__ */ new Map();
|
|
22
|
+
return i.set(r, e), r.forEach((t, r) => {
|
|
23
|
+
e.set(n(r, i), n(t, i));
|
|
24
|
+
}), e;
|
|
25
|
+
}
|
|
26
|
+
if (r instanceof Set) {
|
|
27
|
+
let e = /* @__PURE__ */ new Set();
|
|
28
|
+
return i.set(r, e), r.forEach((t) => {
|
|
29
|
+
e.add(n(t, i));
|
|
30
|
+
}), e;
|
|
31
|
+
}
|
|
32
|
+
if (r instanceof ArrayBuffer) return r.slice(0);
|
|
33
|
+
if (ArrayBuffer.isView(r)) return t(r, i);
|
|
34
|
+
if (Array.isArray(r)) {
|
|
35
|
+
let e = [];
|
|
36
|
+
return i.set(r, e), r.forEach((t, r) => {
|
|
37
|
+
e[r] = n(t, i);
|
|
38
|
+
}), e;
|
|
39
|
+
}
|
|
40
|
+
let o = Object.create(Object.getPrototypeOf(r));
|
|
41
|
+
i.set(r, o);
|
|
42
|
+
for (let [t, a] of e(r)) {
|
|
43
|
+
if ("value" in a) {
|
|
44
|
+
o[t] = n(a.value, i);
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
Object.defineProperty(o, t, a);
|
|
48
|
+
}
|
|
49
|
+
return o;
|
|
50
|
+
}
|
|
51
|
+
function r(e) {
|
|
52
|
+
return n(e, /* @__PURE__ */ new Map());
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
export { r as deepClone };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compares two values deeply, including arrays, objects, maps, sets, dates,
|
|
3
|
+
* regexes, array buffers, and typed arrays.
|
|
4
|
+
*
|
|
5
|
+
* Circular references are supported.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* deepEqual({ a: [1, 2] }, { a: [1, 2] }) // true
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export declare function deepEqual(left: unknown, right: unknown): boolean;
|