@ryuzaki13/react-foundation-lib 0.1.1
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/LICENSE +21 -0
- package/README.md +654 -0
- package/dist/array/array.d.ts +30 -0
- package/dist/array/array.d.ts.map +1 -0
- package/dist/array/index.d.ts +3 -0
- package/dist/array/index.d.ts.map +1 -0
- package/dist/array/index.js +2 -0
- package/dist/array/reorder.d.ts +10 -0
- package/dist/array/reorder.d.ts.map +1 -0
- package/dist/auth/getClientFingerprint.d.ts +2 -0
- package/dist/auth/getClientFingerprint.d.ts.map +1 -0
- package/dist/binary/binaryToBlob.d.ts +13 -0
- package/dist/binary/binaryToBlob.d.ts.map +1 -0
- package/dist/binary/index.d.ts +3 -0
- package/dist/binary/index.d.ts.map +1 -0
- package/dist/binary/index.js +126 -0
- package/dist/binary/index.js.map +1 -0
- package/dist/binary/useBinaryFile.d.ts +8 -0
- package/dist/binary/useBinaryFile.d.ts.map +1 -0
- package/dist/bounded-copy-stack/boundedCopyStack.d.ts +26 -0
- package/dist/bounded-copy-stack/boundedCopyStack.d.ts.map +1 -0
- package/dist/bounded-copy-stack/index.d.ts +2 -0
- package/dist/bounded-copy-stack/index.d.ts.map +1 -0
- package/dist/bounded-copy-stack/index.js +26 -0
- package/dist/bounded-copy-stack/index.js.map +1 -0
- package/dist/chunks/array-BBSjoTRy.js +146 -0
- package/dist/chunks/array-BBSjoTRy.js.map +1 -0
- package/dist/chunks/dateUtils-D9dpdTl7.js +760 -0
- package/dist/chunks/dateUtils-D9dpdTl7.js.map +1 -0
- package/dist/chunks/formatters-CQppb89D.js +1234 -0
- package/dist/chunks/formatters-CQppb89D.js.map +1 -0
- package/dist/chunks/formulas-BxcH5Zjt.js +279 -0
- package/dist/chunks/formulas-BxcH5Zjt.js.map +1 -0
- package/dist/chunks/isRecord-DXDTW-jA.js +18 -0
- package/dist/chunks/isRecord-DXDTW-jA.js.map +1 -0
- package/dist/chunks/odata-service-BAYf08WI.js +1223 -0
- package/dist/chunks/odata-service-BAYf08WI.js.map +1 -0
- package/dist/chunks/string-comparison-BKT7PXmq.js +20 -0
- package/dist/chunks/string-comparison-BKT7PXmq.js.map +1 -0
- package/dist/chunks/validate-BChpTW6y.js +468 -0
- package/dist/chunks/validate-BChpTW6y.js.map +1 -0
- package/dist/context-menu/anchor.d.ts +19 -0
- package/dist/context-menu/anchor.d.ts.map +1 -0
- package/dist/context-menu/index.d.ts +4 -0
- package/dist/context-menu/index.d.ts.map +1 -0
- package/dist/context-menu/index.js +57 -0
- package/dist/context-menu/index.js.map +1 -0
- package/dist/context-menu/state.d.ts +6 -0
- package/dist/context-menu/state.d.ts.map +1 -0
- package/dist/context-menu/types.d.ts +25 -0
- package/dist/context-menu/types.d.ts.map +1 -0
- package/dist/copy/index.d.ts +5 -0
- package/dist/copy/index.d.ts.map +1 -0
- package/dist/copy/index.js +56 -0
- package/dist/copy/index.js.map +1 -0
- package/dist/copy/useCopyElementText.d.ts +6 -0
- package/dist/copy/useCopyElementText.d.ts.map +1 -0
- package/dist/copy/useCopyFeedback.d.ts +11 -0
- package/dist/copy/useCopyFeedback.d.ts.map +1 -0
- package/dist/copy/useCopyText.d.ts +4 -0
- package/dist/copy/useCopyText.d.ts.map +1 -0
- package/dist/copy/useElementText.d.ts +5 -0
- package/dist/copy/useElementText.d.ts.map +1 -0
- package/dist/crypto/hashString.d.ts +5 -0
- package/dist/crypto/hashString.d.ts.map +1 -0
- package/dist/crypto/index.d.ts +3 -0
- package/dist/crypto/index.d.ts.map +1 -0
- package/dist/crypto/index.js +62 -0
- package/dist/crypto/index.js.map +1 -0
- package/dist/crypto/uuid.d.ts +5 -0
- package/dist/crypto/uuid.d.ts.map +1 -0
- package/dist/currency/currency.d.ts +8 -0
- package/dist/currency/currency.d.ts.map +1 -0
- package/dist/currency/index.d.ts +2 -0
- package/dist/currency/index.d.ts.map +1 -0
- package/dist/currency/index.js +16 -0
- package/dist/currency/index.js.map +1 -0
- package/dist/date-segments/index.d.ts +3 -0
- package/dist/date-segments/index.d.ts.map +1 -0
- package/dist/date-segments/index.js +160 -0
- package/dist/date-segments/index.js.map +1 -0
- package/dist/date-segments/mask.d.ts +54 -0
- package/dist/date-segments/mask.d.ts.map +1 -0
- package/dist/dom/downloadFile.d.ts +4 -0
- package/dist/dom/downloadFile.d.ts.map +1 -0
- package/dist/dom/getOrCreatePortalRoot.d.ts +2 -0
- package/dist/dom/getOrCreatePortalRoot.d.ts.map +1 -0
- package/dist/dom/index.d.ts +10 -0
- package/dist/dom/index.d.ts.map +1 -0
- package/dist/dom/index.js +159 -0
- package/dist/dom/index.js.map +1 -0
- package/dist/dom/useClickOutside.d.ts +3 -0
- package/dist/dom/useClickOutside.d.ts.map +1 -0
- package/dist/dom/useElementHeightObserver.d.ts +3 -0
- package/dist/dom/useElementHeightObserver.d.ts.map +1 -0
- package/dist/dom/useEscapeDismiss.d.ts +14 -0
- package/dist/dom/useEscapeDismiss.d.ts.map +1 -0
- package/dist/dom/useFocusTrap.d.ts +5 -0
- package/dist/dom/useFocusTrap.d.ts.map +1 -0
- package/dist/dom/useIntersectionObserver.d.ts +4 -0
- package/dist/dom/useIntersectionObserver.d.ts.map +1 -0
- package/dist/dom/useIsTouchDevice.d.ts +2 -0
- package/dist/dom/useIsTouchDevice.d.ts.map +1 -0
- package/dist/dom/useOverlayFocus.d.ts +14 -0
- package/dist/dom/useOverlayFocus.d.ts.map +1 -0
- package/dist/error/index.d.ts +2 -0
- package/dist/error/index.d.ts.map +1 -0
- package/dist/error/index.js +20 -0
- package/dist/error/index.js.map +1 -0
- package/dist/error/missingContextError.d.ts +14 -0
- package/dist/error/missingContextError.d.ts.map +1 -0
- package/dist/error-report/breadcrumbs.d.ts +11 -0
- package/dist/error-report/breadcrumbs.d.ts.map +1 -0
- package/dist/error-report/capture.d.ts +6 -0
- package/dist/error-report/capture.d.ts.map +1 -0
- package/dist/error-report/diagnostics.d.ts +29 -0
- package/dist/error-report/diagnostics.d.ts.map +1 -0
- package/dist/error-report/drafts.d.ts +25 -0
- package/dist/error-report/drafts.d.ts.map +1 -0
- package/dist/error-report/environment.d.ts +19 -0
- package/dist/error-report/environment.d.ts.map +1 -0
- package/dist/error-report/errorInfo.d.ts +7 -0
- package/dist/error-report/errorInfo.d.ts.map +1 -0
- package/dist/error-report/index.d.ts +11 -0
- package/dist/error-report/index.d.ts.map +1 -0
- package/dist/error-report/index.js +464 -0
- package/dist/error-report/index.js.map +1 -0
- package/dist/error-report/runtime.d.ts +26 -0
- package/dist/error-report/runtime.d.ts.map +1 -0
- package/dist/error-report/safeValue.d.ts +14 -0
- package/dist/error-report/safeValue.d.ts.map +1 -0
- package/dist/error-report/transport.d.ts +32 -0
- package/dist/error-report/transport.d.ts.map +1 -0
- package/dist/error-report/types.d.ts +123 -0
- package/dist/error-report/types.d.ts.map +1 -0
- package/dist/excel/excel.d.ts +52 -0
- package/dist/excel/excel.d.ts.map +1 -0
- package/dist/excel/index.d.ts +3 -0
- package/dist/excel/index.d.ts.map +1 -0
- package/dist/excel/index.js +139 -0
- package/dist/excel/index.js.map +1 -0
- package/dist/excel/tableExport.d.ts +26 -0
- package/dist/excel/tableExport.d.ts.map +1 -0
- package/dist/file/contentDisposition.d.ts +11 -0
- package/dist/file/contentDisposition.d.ts.map +1 -0
- package/dist/file/image/index.d.ts +3 -0
- package/dist/file/image/index.d.ts.map +1 -0
- package/dist/file/image/readImageFile.d.ts +8 -0
- package/dist/file/image/readImageFile.d.ts.map +1 -0
- package/dist/file/image/types.d.ts +30 -0
- package/dist/file/image/types.d.ts.map +1 -0
- package/dist/file/index.d.ts +5 -0
- package/dist/file/index.d.ts.map +1 -0
- package/dist/file/index.js +211 -0
- package/dist/file/index.js.map +1 -0
- package/dist/file/mimeType.d.ts +2 -0
- package/dist/file/mimeType.d.ts.map +1 -0
- package/dist/file/read-file/assert.d.ts +4 -0
- package/dist/file/read-file/assert.d.ts.map +1 -0
- package/dist/file/read-file/index.d.ts +4 -0
- package/dist/file/read-file/index.d.ts.map +1 -0
- package/dist/file/read-file/readFile.d.ts +14 -0
- package/dist/file/read-file/readFile.d.ts.map +1 -0
- package/dist/file/read-file/types.d.ts +43 -0
- package/dist/file/read-file/types.d.ts.map +1 -0
- package/dist/form/formErrors.d.ts +2 -0
- package/dist/form/formErrors.d.ts.map +1 -0
- package/dist/form/index.d.ts +2 -0
- package/dist/form/index.d.ts.map +1 -0
- package/dist/form/index.js +19 -0
- package/dist/form/index.js.map +1 -0
- package/dist/formatters/boolean/index.d.ts +3 -0
- package/dist/formatters/boolean/index.d.ts.map +1 -0
- package/dist/formatters/boolean/parseAbapBoolean.d.ts +3 -0
- package/dist/formatters/boolean/parseAbapBoolean.d.ts.map +1 -0
- package/dist/formatters/boolean/toAbapBoolean.d.ts +3 -0
- package/dist/formatters/boolean/toAbapBoolean.d.ts.map +1 -0
- package/dist/formatters/date/calendarDate.d.ts +48 -0
- package/dist/formatters/date/calendarDate.d.ts.map +1 -0
- package/dist/formatters/date/calendarPeriod.d.ts +33 -0
- package/dist/formatters/date/calendarPeriod.d.ts.map +1 -0
- package/dist/formatters/date/dateRange.d.ts +25 -0
- package/dist/formatters/date/dateRange.d.ts.map +1 -0
- package/dist/formatters/date/educationDate.d.ts +79 -0
- package/dist/formatters/date/educationDate.d.ts.map +1 -0
- package/dist/formatters/date/formatDate.d.ts +98 -0
- package/dist/formatters/date/formatDate.d.ts.map +1 -0
- package/dist/formatters/date/index.d.ts +14 -0
- package/dist/formatters/date/index.d.ts.map +1 -0
- package/dist/formatters/date/parseDate.d.ts +44 -0
- package/dist/formatters/date/parseDate.d.ts.map +1 -0
- package/dist/formatters/date/pattern.d.ts +38 -0
- package/dist/formatters/date/pattern.d.ts.map +1 -0
- package/dist/formatters/date/presets.d.ts +108 -0
- package/dist/formatters/date/presets.d.ts.map +1 -0
- package/dist/formatters/date/relativeRanges.d.ts +35 -0
- package/dist/formatters/date/relativeRanges.d.ts.map +1 -0
- package/dist/formatters/date/types.d.ts +70 -0
- package/dist/formatters/date/types.d.ts.map +1 -0
- package/dist/formatters/formatName.d.ts +13 -0
- package/dist/formatters/formatName.d.ts.map +1 -0
- package/dist/formatters/formatPhone.d.ts +3 -0
- package/dist/formatters/formatPhone.d.ts.map +1 -0
- package/dist/formatters/formatTagAsHashtag.d.ts +6 -0
- package/dist/formatters/formatTagAsHashtag.d.ts.map +1 -0
- package/dist/formatters/index.d.ts +11 -0
- package/dist/formatters/index.d.ts.map +1 -0
- package/dist/formatters/index.js +6 -0
- package/dist/formatters/normalizeLeadingZeros.d.ts +27 -0
- package/dist/formatters/normalizeLeadingZeros.d.ts.map +1 -0
- package/dist/formatters/number/compact.d.ts +10 -0
- package/dist/formatters/number/compact.d.ts.map +1 -0
- package/dist/formatters/number/formatCompactNumber.d.ts +49 -0
- package/dist/formatters/number/formatCompactNumber.d.ts.map +1 -0
- package/dist/formatters/number/formatNumber.d.ts +93 -0
- package/dist/formatters/number/formatNumber.d.ts.map +1 -0
- package/dist/formatters/number/index.d.ts +6 -0
- package/dist/formatters/number/index.d.ts.map +1 -0
- package/dist/formatters/number/isZeroValue.d.ts +5 -0
- package/dist/formatters/number/isZeroValue.d.ts.map +1 -0
- package/dist/formatters/number/parseNumber.d.ts +12 -0
- package/dist/formatters/number/parseNumber.d.ts.map +1 -0
- package/dist/formatters/number/presets.d.ts +24 -0
- package/dist/formatters/number/presets.d.ts.map +1 -0
- package/dist/formatters/number/types.d.ts +46 -0
- package/dist/formatters/number/types.d.ts.map +1 -0
- package/dist/formatters/pipeline/clone.d.ts +15 -0
- package/dist/formatters/pipeline/clone.d.ts.map +1 -0
- package/dist/formatters/pipeline/definitions.d.ts +14 -0
- package/dist/formatters/pipeline/definitions.d.ts.map +1 -0
- package/dist/formatters/pipeline/dependencies.d.ts +38 -0
- package/dist/formatters/pipeline/dependencies.d.ts.map +1 -0
- package/dist/formatters/pipeline/execute.d.ts +21 -0
- package/dist/formatters/pipeline/execute.d.ts.map +1 -0
- package/dist/formatters/pipeline/index.d.ts +10 -0
- package/dist/formatters/pipeline/index.d.ts.map +1 -0
- package/dist/formatters/pipeline/normalize.d.ts +3 -0
- package/dist/formatters/pipeline/normalize.d.ts.map +1 -0
- package/dist/formatters/pipeline/registry.d.ts +11 -0
- package/dist/formatters/pipeline/registry.d.ts.map +1 -0
- package/dist/formatters/pipeline/rekey.d.ts +11 -0
- package/dist/formatters/pipeline/rekey.d.ts.map +1 -0
- package/dist/formatters/pipeline/runtime.d.ts +17 -0
- package/dist/formatters/pipeline/runtime.d.ts.map +1 -0
- package/dist/formatters/pipeline/types.d.ts +379 -0
- package/dist/formatters/pipeline/types.d.ts.map +1 -0
- package/dist/formatters/pipeline/validate.d.ts +29 -0
- package/dist/formatters/pipeline/validate.d.ts.map +1 -0
- package/dist/formatters/rowBased/context.d.ts +9 -0
- package/dist/formatters/rowBased/context.d.ts.map +1 -0
- package/dist/formatters/rowBased/definitions/index.d.ts +6 -0
- package/dist/formatters/rowBased/definitions/index.d.ts.map +1 -0
- package/dist/formatters/rowBased/index.d.ts +4 -0
- package/dist/formatters/rowBased/index.d.ts.map +1 -0
- package/dist/formatters/rowBased/registry.d.ts +19 -0
- package/dist/formatters/rowBased/registry.d.ts.map +1 -0
- package/dist/formatters/rowBased/types.d.ts +29 -0
- package/dist/formatters/rowBased/types.d.ts.map +1 -0
- package/dist/formatters/strings/index.d.ts +6 -0
- package/dist/formatters/strings/index.d.ts.map +1 -0
- package/dist/formatters/strings/normalizeText.d.ts +11 -0
- package/dist/formatters/strings/normalizeText.d.ts.map +1 -0
- package/dist/formatters/strings/startsWithIgnoringZeros.d.ts +2 -0
- package/dist/formatters/strings/startsWithIgnoringZeros.d.ts.map +1 -0
- package/dist/formatters/strings/stripInnerSpaces.d.ts +6 -0
- package/dist/formatters/strings/stripInnerSpaces.d.ts.map +1 -0
- package/dist/formatters/strings/stripLeadingZeros.d.ts +10 -0
- package/dist/formatters/strings/stripLeadingZeros.d.ts.map +1 -0
- package/dist/formatters/strings/truncateText.d.ts +2 -0
- package/dist/formatters/strings/truncateText.d.ts.map +1 -0
- package/dist/formatters/valueState/fixedValueStateResolver.d.ts +41 -0
- package/dist/formatters/valueState/fixedValueStateResolver.d.ts.map +1 -0
- package/dist/formatters/valueState/index.d.ts +7 -0
- package/dist/formatters/valueState/index.d.ts.map +1 -0
- package/dist/formatters/valueState/presentation.d.ts +4 -0
- package/dist/formatters/valueState/presentation.d.ts.map +1 -0
- package/dist/formatters/valueState/resolveValueStateClassName.d.ts +3 -0
- package/dist/formatters/valueState/resolveValueStateClassName.d.ts.map +1 -0
- package/dist/formatters/valueState/thresholdValueStateResolver.d.ts +40 -0
- package/dist/formatters/valueState/thresholdValueStateResolver.d.ts.map +1 -0
- package/dist/formatters/valueState/types.d.ts +35 -0
- package/dist/formatters/valueState/types.d.ts.map +1 -0
- package/dist/formatters/valueState/valueStateRegistry.d.ts +45 -0
- package/dist/formatters/valueState/valueStateRegistry.d.ts.map +1 -0
- package/dist/formulas/definitions/base.d.ts +7 -0
- package/dist/formulas/definitions/base.d.ts.map +1 -0
- package/dist/formulas/definitions/index.d.ts +3 -0
- package/dist/formulas/definitions/index.d.ts.map +1 -0
- package/dist/formulas/definitions/sales.d.ts +7 -0
- package/dist/formulas/definitions/sales.d.ts.map +1 -0
- package/dist/formulas/execute.d.ts +36 -0
- package/dist/formulas/execute.d.ts.map +1 -0
- package/dist/formulas/index.d.ts +5 -0
- package/dist/formulas/index.d.ts.map +1 -0
- package/dist/formulas/index.js +2 -0
- package/dist/formulas/perf.runtime.d.ts +48 -0
- package/dist/formulas/perf.runtime.d.ts.map +1 -0
- package/dist/formulas/registry.d.ts +10 -0
- package/dist/formulas/registry.d.ts.map +1 -0
- package/dist/formulas/types.d.ts +16 -0
- package/dist/formulas/types.d.ts.map +1 -0
- package/dist/formulas/validate.d.ts +22 -0
- package/dist/formulas/validate.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +11 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +291 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/types.d.ts +4 -0
- package/dist/hooks/types.d.ts.map +1 -0
- package/dist/hooks/useBlockBrowserZoom.d.ts +7 -0
- package/dist/hooks/useBlockBrowserZoom.d.ts.map +1 -0
- package/dist/hooks/useDebounce.d.ts +2 -0
- package/dist/hooks/useDebounce.d.ts.map +1 -0
- package/dist/hooks/useDebounceCallback.d.ts +22 -0
- package/dist/hooks/useDebounceCallback.d.ts.map +1 -0
- package/dist/hooks/useDndSortableSensors.d.ts +13 -0
- package/dist/hooks/useDndSortableSensors.d.ts.map +1 -0
- package/dist/hooks/useFloatingListbox.d.ts +61 -0
- package/dist/hooks/useFloatingListbox.d.ts.map +1 -0
- package/dist/hooks/useLazyComponent.d.ts +28 -0
- package/dist/hooks/useLazyComponent.d.ts.map +1 -0
- package/dist/hooks/useReferenceTrace.d.ts +2 -0
- package/dist/hooks/useReferenceTrace.d.ts.map +1 -0
- package/dist/hooks/useSearchLink.d.ts +5 -0
- package/dist/hooks/useSearchLink.d.ts.map +1 -0
- package/dist/hooks/useSearchParams.d.ts +8 -0
- package/dist/hooks/useSearchParams.d.ts.map +1 -0
- package/dist/hooks/useThrottledCallback.d.ts +43 -0
- package/dist/hooks/useThrottledCallback.d.ts.map +1 -0
- package/dist/http/httpHeaders.d.ts +3 -0
- package/dist/http/httpHeaders.d.ts.map +1 -0
- package/dist/http/index.d.ts +3 -0
- package/dist/http/index.d.ts.map +1 -0
- package/dist/http/index.js +18 -0
- package/dist/http/index.js.map +1 -0
- package/dist/http/textResponse.d.ts +7 -0
- package/dist/http/textResponse.d.ts.map +1 -0
- package/dist/media/breakpoints.d.ts +9 -0
- package/dist/media/breakpoints.d.ts.map +1 -0
- package/dist/media/getCurrentFontSize.d.ts +4 -0
- package/dist/media/getCurrentFontSize.d.ts.map +1 -0
- package/dist/media/index.d.ts +7 -0
- package/dist/media/index.d.ts.map +1 -0
- package/dist/media/index.js +147 -0
- package/dist/media/index.js.map +1 -0
- package/dist/media/pxToEm.d.ts +2 -0
- package/dist/media/pxToEm.d.ts.map +1 -0
- package/dist/media/responsive.d.ts +29 -0
- package/dist/media/responsive.d.ts.map +1 -0
- package/dist/media/useMatchMedia.d.ts +15 -0
- package/dist/media/useMatchMedia.d.ts.map +1 -0
- package/dist/media/useMediaQuery.d.ts +10 -0
- package/dist/media/useMediaQuery.d.ts.map +1 -0
- package/dist/notifications/index.d.ts +4 -0
- package/dist/notifications/index.d.ts.map +1 -0
- package/dist/notifications/index.js +124 -0
- package/dist/notifications/index.js.map +1 -0
- package/dist/notifications/notify.d.ts +32 -0
- package/dist/notifications/notify.d.ts.map +1 -0
- package/dist/notifications/store.d.ts +31 -0
- package/dist/notifications/store.d.ts.map +1 -0
- package/dist/notifications/types.d.ts +19 -0
- package/dist/notifications/types.d.ts.map +1 -0
- package/dist/number-scale/index.d.ts +3 -0
- package/dist/number-scale/index.d.ts.map +1 -0
- package/dist/number-scale/index.js +99 -0
- package/dist/number-scale/index.js.map +1 -0
- package/dist/number-scale/numberScale.d.ts +52 -0
- package/dist/number-scale/numberScale.d.ts.map +1 -0
- package/dist/number-scale/types.d.ts +44 -0
- package/dist/number-scale/types.d.ts.map +1 -0
- package/dist/odata/buildSeparatedArrays.d.ts +10 -0
- package/dist/odata/buildSeparatedArrays.d.ts.map +1 -0
- package/dist/odata/dateUtils.d.ts +14 -0
- package/dist/odata/dateUtils.d.ts.map +1 -0
- package/dist/odata/findCollectionPairs.d.ts +11 -0
- package/dist/odata/findCollectionPairs.d.ts.map +1 -0
- package/dist/odata/index.d.ts +6 -0
- package/dist/odata/index.d.ts.map +1 -0
- package/dist/odata/index.js +102 -0
- package/dist/odata/index.js.map +1 -0
- package/dist/odata/store.d.ts +42 -0
- package/dist/odata/store.d.ts.map +1 -0
- package/dist/odata/types.d.ts +12 -0
- package/dist/odata/types.d.ts.map +1 -0
- package/dist/odata-service/baseTypes.d.ts +6 -0
- package/dist/odata-service/baseTypes.d.ts.map +1 -0
- package/dist/odata-service/builder.d.ts +33 -0
- package/dist/odata-service/builder.d.ts.map +1 -0
- package/dist/odata-service/columns.d.ts +10 -0
- package/dist/odata-service/columns.d.ts.map +1 -0
- package/dist/odata-service/filterDefinitions.d.ts +113 -0
- package/dist/odata-service/filterDefinitions.d.ts.map +1 -0
- package/dist/odata-service/filters.d.ts +75 -0
- package/dist/odata-service/filters.d.ts.map +1 -0
- package/dist/odata-service/formatters.d.ts +33 -0
- package/dist/odata-service/formatters.d.ts.map +1 -0
- package/dist/odata-service/index.d.ts +16 -0
- package/dist/odata-service/index.d.ts.map +1 -0
- package/dist/odata-service/index.js +2 -0
- package/dist/odata-service/parser.d.ts +14 -0
- package/dist/odata-service/parser.d.ts.map +1 -0
- package/dist/odata-service/schema.d.ts +8 -0
- package/dist/odata-service/schema.d.ts.map +1 -0
- package/dist/odata-service/sorts.d.ts +26 -0
- package/dist/odata-service/sorts.d.ts.map +1 -0
- package/dist/odata-service/sqlFilters.d.ts +32 -0
- package/dist/odata-service/sqlFilters.d.ts.map +1 -0
- package/dist/odata-service/types.d.ts +166 -0
- package/dist/odata-service/types.d.ts.map +1 -0
- package/dist/odata-service/typesValidation.d.ts +6 -0
- package/dist/odata-service/typesValidation.d.ts.map +1 -0
- package/dist/odata-service/unwrapODataQueryResult.d.ts +22 -0
- package/dist/odata-service/unwrapODataQueryResult.d.ts.map +1 -0
- package/dist/odata-service/utils.d.ts +5 -0
- package/dist/odata-service/utils.d.ts.map +1 -0
- package/dist/odata-service/wrapParams.d.ts +7 -0
- package/dist/odata-service/wrapParams.d.ts.map +1 -0
- package/dist/presets/index.d.ts +2 -0
- package/dist/presets/index.d.ts.map +1 -0
- package/dist/presets/index.js +23 -0
- package/dist/presets/index.js.map +1 -0
- package/dist/presets/presets.d.ts +20 -0
- package/dist/presets/presets.d.ts.map +1 -0
- package/dist/pwa/index.d.ts +3 -0
- package/dist/pwa/index.d.ts.map +1 -0
- package/dist/pwa/index.js +206 -0
- package/dist/pwa/index.js.map +1 -0
- package/dist/pwa/serviceWorker.d.ts +31 -0
- package/dist/pwa/serviceWorker.d.ts.map +1 -0
- package/dist/pwa/swCachePolicy.d.ts +24 -0
- package/dist/pwa/swCachePolicy.d.ts.map +1 -0
- package/dist/pwa/useServiceWorkerUpdate.d.ts +6 -0
- package/dist/pwa/useServiceWorkerUpdate.d.ts.map +1 -0
- package/dist/query-client/broadcast.d.ts +23 -0
- package/dist/query-client/broadcast.d.ts.map +1 -0
- package/dist/query-client/index.d.ts +5 -0
- package/dist/query-client/index.d.ts.map +1 -0
- package/dist/query-client/index.js +204 -0
- package/dist/query-client/index.js.map +1 -0
- package/dist/query-client/persistence.d.ts +33 -0
- package/dist/query-client/persistence.d.ts.map +1 -0
- package/dist/query-client/queryClient.d.ts +127 -0
- package/dist/query-client/queryClient.d.ts.map +1 -0
- package/dist/query-client/queryPersistenceAdapter.d.ts +7 -0
- package/dist/query-client/queryPersistenceAdapter.d.ts.map +1 -0
- package/dist/range-output/index.d.ts +2 -0
- package/dist/range-output/index.d.ts.map +1 -0
- package/dist/range-output/index.js +22 -0
- package/dist/range-output/index.js.map +1 -0
- package/dist/range-output/rangeOutput.d.ts +15 -0
- package/dist/range-output/rangeOutput.d.ts.map +1 -0
- package/dist/seo/index.d.ts +3 -0
- package/dist/seo/index.d.ts.map +1 -0
- package/dist/seo/index.js +125 -0
- package/dist/seo/index.js.map +1 -0
- package/dist/seo/seo.d.ts +16 -0
- package/dist/seo/seo.d.ts.map +1 -0
- package/dist/seo/types.d.ts +28 -0
- package/dist/seo/types.d.ts.map +1 -0
- package/dist/session-storage/index.d.ts +2 -0
- package/dist/session-storage/index.d.ts.map +1 -0
- package/dist/session-storage/index.js +17 -0
- package/dist/session-storage/index.js.map +1 -0
- package/dist/session-storage/sessionId.d.ts +8 -0
- package/dist/session-storage/sessionId.d.ts.map +1 -0
- package/dist/string-comparison/compareStrings.d.ts +9 -0
- package/dist/string-comparison/compareStrings.d.ts.map +1 -0
- package/dist/string-comparison/index.d.ts +2 -0
- package/dist/string-comparison/index.d.ts.map +1 -0
- package/dist/string-comparison/index.js +2 -0
- package/dist/table/columnLayout.d.ts +23 -0
- package/dist/table/columnLayout.d.ts.map +1 -0
- package/dist/table/columnOrder.d.ts +21 -0
- package/dist/table/columnOrder.d.ts.map +1 -0
- package/dist/table/columnSizing.d.ts +7 -0
- package/dist/table/columnSizing.d.ts.map +1 -0
- package/dist/table/index.d.ts +9 -0
- package/dist/table/index.d.ts.map +1 -0
- package/dist/table/index.js +229 -0
- package/dist/table/index.js.map +1 -0
- package/dist/table/odataAdapter.d.ts +63 -0
- package/dist/table/odataAdapter.d.ts.map +1 -0
- package/dist/table/selection.d.ts +16 -0
- package/dist/table/selection.d.ts.map +1 -0
- package/dist/table/types.d.ts +60 -0
- package/dist/table/types.d.ts.map +1 -0
- package/dist/table/useTableRowSelection.d.ts +19 -0
- package/dist/table/useTableRowSelection.d.ts.map +1 -0
- package/dist/table/utils.d.ts +20 -0
- package/dist/table/utils.d.ts.map +1 -0
- package/dist/three-scene/index.d.ts +3 -0
- package/dist/three-scene/index.d.ts.map +1 -0
- package/dist/three-scene/index.js +84 -0
- package/dist/three-scene/index.js.map +1 -0
- package/dist/three-scene/threeSceneAvailability.d.ts +15 -0
- package/dist/three-scene/threeSceneAvailability.d.ts.map +1 -0
- package/dist/three-scene/useThreeSceneAvailability.d.ts +8 -0
- package/dist/three-scene/useThreeSceneAvailability.d.ts.map +1 -0
- package/dist/tree-table/buildTreeTableRows.d.ts +9 -0
- package/dist/tree-table/buildTreeTableRows.d.ts.map +1 -0
- package/dist/tree-table/index.d.ts +4 -0
- package/dist/tree-table/index.d.ts.map +1 -0
- package/dist/tree-table/index.js +126 -0
- package/dist/tree-table/index.js.map +1 -0
- package/dist/tree-table/transposeFlatRowsToTreeTableRows.d.ts +11 -0
- package/dist/tree-table/transposeFlatRowsToTreeTableRows.d.ts.map +1 -0
- package/dist/tree-table/types.d.ts +87 -0
- package/dist/tree-table/types.d.ts.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +8 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/types.d.ts +12 -0
- package/dist/types/types.d.ts.map +1 -0
- package/dist/utils/childrenCount.d.ts +3 -0
- package/dist/utils/childrenCount.d.ts.map +1 -0
- package/dist/utils/cn.d.ts +6 -0
- package/dist/utils/cn.d.ts.map +1 -0
- package/dist/utils/createLazyComponent.d.ts +22 -0
- package/dist/utils/createLazyComponent.d.ts.map +1 -0
- package/dist/utils/deepCloneWithoutFunctions.d.ts +20 -0
- package/dist/utils/deepCloneWithoutFunctions.d.ts.map +1 -0
- package/dist/utils/deepCopyWithoutFunctions.d.ts +10 -0
- package/dist/utils/deepCopyWithoutFunctions.d.ts.map +1 -0
- package/dist/utils/index.d.ts +17 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +209 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/keyboard.d.ts +36 -0
- package/dist/utils/keyboard.d.ts.map +1 -0
- package/dist/utils/logger.d.ts +2 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/selectNavigation.d.ts +8 -0
- package/dist/utils/selectNavigation.d.ts.map +1 -0
- package/dist/utils/stableStringify.d.ts +8 -0
- package/dist/utils/stableStringify.d.ts.map +1 -0
- package/dist/utils/toBase64.d.ts +3 -0
- package/dist/utils/toBase64.d.ts.map +1 -0
- package/dist/utils/treeNode.d.ts +9 -0
- package/dist/utils/treeNode.d.ts.map +1 -0
- package/dist/validators/index.d.ts +7 -0
- package/dist/validators/index.d.ts.map +1 -0
- package/dist/validators/index.js +54 -0
- package/dist/validators/index.js.map +1 -0
- package/dist/validators/isDomReference.d.ts +3 -0
- package/dist/validators/isDomReference.d.ts.map +1 -0
- package/dist/validators/isImageExtension.d.ts +3 -0
- package/dist/validators/isImageExtension.d.ts.map +1 -0
- package/dist/validators/isRecord.d.ts +5 -0
- package/dist/validators/isRecord.d.ts.map +1 -0
- package/dist/validators/isSafe.d.ts +2 -0
- package/dist/validators/isSafe.d.ts.map +1 -0
- package/dist/validators/positiveInteger.d.ts +2 -0
- package/dist/validators/positiveInteger.d.ts.map +1 -0
- package/dist/validators/validateUrl.d.ts +10 -0
- package/dist/validators/validateUrl.d.ts.map +1 -0
- package/dist/virtualizer/index.d.ts +2 -0
- package/dist/virtualizer/index.d.ts.map +1 -0
- package/dist/virtualizer/index.js +19 -0
- package/dist/virtualizer/index.js.map +1 -0
- package/dist/virtualizer/useFetchNextPageEffect.d.ts +8 -0
- package/dist/virtualizer/useFetchNextPageEffect.d.ts.map +1 -0
- package/dist/xml/index.d.ts +2 -0
- package/dist/xml/index.d.ts.map +1 -0
- package/dist/xml/index.js +17 -0
- package/dist/xml/index.js.map +1 -0
- package/dist/xml/xml.d.ts +5 -0
- package/dist/xml/xml.d.ts.map +1 -0
- package/package.json +428 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//#region src/http/httpHeaders.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
let t = new Headers(e);
|
|
4
|
+
return t.set("Cache-Control", "no-store, no-cache, must-revalidate, proxy-revalidate"), t.set("Pragma", "no-cache"), t.set("Expires", "0"), t;
|
|
5
|
+
}
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/http/textResponse.ts
|
|
8
|
+
function t({ status: t, text: n, headers: r }) {
|
|
9
|
+
let i = e(r);
|
|
10
|
+
return i.set("Content-Type", "text/plain; charset=UTF-8"), new Response(n, {
|
|
11
|
+
status: t,
|
|
12
|
+
headers: i
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { e as createNoStoreHeaders, t as createTextHttpResponse };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/http/httpHeaders.ts","../../src/http/textResponse.ts"],"sourcesContent":["export type NoStoreHeadersInit = HeadersInit | undefined;\n\nexport function createNoStoreHeaders(init?: NoStoreHeadersInit): Headers {\n\tconst headers = new Headers(init);\n\n\theaders.set(\"Cache-Control\", \"no-store, no-cache, must-revalidate, proxy-revalidate\");\n\theaders.set(\"Pragma\", \"no-cache\");\n\theaders.set(\"Expires\", \"0\");\n\n\treturn headers;\n}\n","import { createNoStoreHeaders } from \"./httpHeaders\";\n\nexport type TextHttpResponseOptions = {\n\treadonly status: number;\n\treadonly text: string;\n\treadonly headers?: HeadersInit;\n};\n\nexport function createTextHttpResponse({ status, text, headers }: TextHttpResponseOptions): Response {\n\tconst responseHeaders = createNoStoreHeaders(headers);\n\tresponseHeaders.set(\"Content-Type\", \"text/plain; charset=UTF-8\");\n\n\treturn new Response(text, {\n\t\tstatus,\n\t\theaders: responseHeaders\n\t});\n}\n"],"mappings":";AAEA,SAAgB,EAAqB,GAAoC;CACxE,IAAM,IAAU,IAAI,QAAQ,CAAI;CAMhC,OAJA,EAAQ,IAAI,iBAAiB,uDAAuD,GACpF,EAAQ,IAAI,UAAU,UAAU,GAChC,EAAQ,IAAI,WAAW,GAAG,GAEnB;AACR;;;ACFA,SAAgB,EAAuB,EAAE,WAAQ,SAAM,cAA8C;CACpG,IAAM,IAAkB,EAAqB,CAAO;CAGpD,OAFA,EAAgB,IAAI,gBAAgB,2BAA2B,GAExD,IAAI,SAAS,GAAM;EACzB;EACA,SAAS;CACV,CAAC;AACF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type TextHttpResponseOptions = {
|
|
2
|
+
readonly status: number;
|
|
3
|
+
readonly text: string;
|
|
4
|
+
readonly headers?: HeadersInit;
|
|
5
|
+
};
|
|
6
|
+
export declare function createTextHttpResponse({ status, text, headers }: TextHttpResponseOptions): Response;
|
|
7
|
+
//# sourceMappingURL=textResponse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textResponse.d.ts","sourceRoot":"","sources":["../../src/http/textResponse.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,uBAAuB,GAAG;IACrC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,CAAC,EAAE,WAAW,CAAC;CAC/B,CAAC;AAEF,wBAAgB,sBAAsB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,uBAAuB,GAAG,QAAQ,CAQnG"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const BREAKPOINTS_EM: {
|
|
2
|
+
readonly mobileMax: number;
|
|
3
|
+
readonly tabletMin: number;
|
|
4
|
+
readonly tabletMax: number;
|
|
5
|
+
readonly laptopMin: number;
|
|
6
|
+
};
|
|
7
|
+
export type Breakpoint = "mobile" | "tablet" | "laptop";
|
|
8
|
+
export type MediaMatches = Record<Breakpoint, boolean>;
|
|
9
|
+
//# sourceMappingURL=breakpoints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"breakpoints.d.ts","sourceRoot":"","sources":["../../src/media/breakpoints.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc;;;;;CAKjB,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;AACxD,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getCurrentFontSize.d.ts","sourceRoot":"","sources":["../../src/media/getCurrentFontSize.ts"],"names":[],"mappings":"AAGA,wBAAgB,kBAAkB,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,IAAI,GAAG,MAAM,CAcvE;AAED,wBAAgB,oBAAoB,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,IAAI,GAAG,MAAM,CAezE;AAED,wBAAgB,gBAAgB,WAM/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/media/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { useCallback as e, useSyncExternalStore as t } from "react";
|
|
2
|
+
//#region src/media/breakpoints.ts
|
|
3
|
+
var n = {
|
|
4
|
+
mobileMax: 767.98 / 16,
|
|
5
|
+
tabletMin: 768 / 16,
|
|
6
|
+
tabletMax: 1151.98 / 16,
|
|
7
|
+
laptopMin: 1152 / 16
|
|
8
|
+
}, r = 16, i = 1.2;
|
|
9
|
+
function a(e) {
|
|
10
|
+
if (typeof window > "u" || typeof document > "u") return r;
|
|
11
|
+
let t = e ?? document.documentElement, n = window.getComputedStyle(t).fontSize, i = Number.parseFloat(n);
|
|
12
|
+
return !Number.isFinite(i) || i <= 0 ? r : i;
|
|
13
|
+
}
|
|
14
|
+
function o(e) {
|
|
15
|
+
if (typeof window > "u" || typeof document > "u") return i;
|
|
16
|
+
let t = e ?? document.documentElement, n = window.getComputedStyle(t).lineHeight, a = Number.parseFloat(n);
|
|
17
|
+
return !Number.isFinite(a) || a <= 0 ? i : a / r;
|
|
18
|
+
}
|
|
19
|
+
function s() {
|
|
20
|
+
return a() + o() * 10;
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/media/pxToEm.ts
|
|
24
|
+
function c(e, t) {
|
|
25
|
+
return (e / (t ?? a())).toString();
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/media/responsive.ts
|
|
29
|
+
function l(e) {
|
|
30
|
+
return typeof e != "object" || !e ? !1 : "mobile" in e || "tablet" in e || "laptop" in e || "desktop" in e;
|
|
31
|
+
}
|
|
32
|
+
function u(e, t) {
|
|
33
|
+
if (e !== void 0) return l(e) ? t === "mobile" ? e.mobile ?? e.tablet ?? e.laptop : t === "tablet" ? e.tablet ?? e.mobile ?? e.laptop : e.laptop ?? e.tablet ?? e.mobile : e;
|
|
34
|
+
}
|
|
35
|
+
function d(e, t, n) {
|
|
36
|
+
let r = { ...e };
|
|
37
|
+
for (let e of n) r[e] = u(r[e], t);
|
|
38
|
+
return r;
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/media/useMediaQuery.ts
|
|
42
|
+
var f = () => {};
|
|
43
|
+
function p(e, t) {
|
|
44
|
+
return typeof window > "u" || typeof window.matchMedia != "function" ? t : window.matchMedia(e).matches;
|
|
45
|
+
}
|
|
46
|
+
function m(e, t) {
|
|
47
|
+
if (typeof window > "u" || typeof window.matchMedia != "function") return f;
|
|
48
|
+
let n = window.matchMedia(e);
|
|
49
|
+
return typeof n.addEventListener == "function" ? (n.addEventListener("change", t), () => n.removeEventListener("change", t)) : (n.addListener(t), () => n.removeListener(t));
|
|
50
|
+
}
|
|
51
|
+
function h(n, { ssrFallback: r = !1 } = {}) {
|
|
52
|
+
return t(e((e) => m(n, e), [n]), e(() => p(n, r), [n, r]), e(() => r, [r]));
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/media/useMatchMedia.ts
|
|
56
|
+
function g(e, t) {
|
|
57
|
+
return "addEventListener" in e ? (e.addEventListener("change", t), () => e.removeEventListener("change", t)) : (e.addListener(t), () => e.removeListener(t));
|
|
58
|
+
}
|
|
59
|
+
function _(e) {
|
|
60
|
+
let t = (t) => t * e, r = t(n.mobileMax), i = t(n.tabletMin), a = t(n.tabletMax), o = t(n.laptopMin);
|
|
61
|
+
return {
|
|
62
|
+
mobile: `(width <= ${r}px)`,
|
|
63
|
+
tablet: `(width >= ${i}px) and (width <= ${a}px)`,
|
|
64
|
+
laptop: `(width >= ${o}px)`
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
var v = {
|
|
68
|
+
matches: {
|
|
69
|
+
mobile: !1,
|
|
70
|
+
tablet: !1,
|
|
71
|
+
laptop: !1
|
|
72
|
+
},
|
|
73
|
+
activeBreakpoint: "laptop"
|
|
74
|
+
}, y = .25, b = 80, x = v, S = null, C = [], w = 0, T = !1, E = null, D = null, O = null, k = null, A = /* @__PURE__ */ new Set();
|
|
75
|
+
function j(e) {
|
|
76
|
+
return e.mobile ? "mobile" : e.tablet ? "tablet" : "laptop";
|
|
77
|
+
}
|
|
78
|
+
function M(e, t) {
|
|
79
|
+
return e.mobile === t.mobile && e.tablet === t.tablet && e.laptop === t.laptop;
|
|
80
|
+
}
|
|
81
|
+
function N(e) {
|
|
82
|
+
M(x.matches, e) || (x = {
|
|
83
|
+
matches: e,
|
|
84
|
+
activeBreakpoint: j(e)
|
|
85
|
+
}, A.forEach((e) => e()));
|
|
86
|
+
}
|
|
87
|
+
function P() {
|
|
88
|
+
S && N({
|
|
89
|
+
mobile: S.mobile.matches,
|
|
90
|
+
tablet: S.tablet.matches,
|
|
91
|
+
laptop: S.laptop.matches
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
function F() {
|
|
95
|
+
C.forEach((e) => e()), C = [];
|
|
96
|
+
}
|
|
97
|
+
function I(e = !1) {
|
|
98
|
+
if (typeof window > "u" || typeof document > "u") return;
|
|
99
|
+
let t = a();
|
|
100
|
+
if (!e && S && Math.abs(t - w) < y) return;
|
|
101
|
+
w = t, F();
|
|
102
|
+
let n = _(t);
|
|
103
|
+
S = {
|
|
104
|
+
mobile: window.matchMedia(n.mobile),
|
|
105
|
+
tablet: window.matchMedia(n.tablet),
|
|
106
|
+
laptop: window.matchMedia(n.laptop)
|
|
107
|
+
}, C = Object.keys(S).map((e) => g(S[e], P)), P();
|
|
108
|
+
}
|
|
109
|
+
function L() {
|
|
110
|
+
k && clearTimeout(k), k = setTimeout(() => {
|
|
111
|
+
k = null, I();
|
|
112
|
+
}, b);
|
|
113
|
+
}
|
|
114
|
+
function R() {
|
|
115
|
+
typeof window > "u" || typeof document > "u" || (E = new MutationObserver(L), E.observe(document.documentElement, {
|
|
116
|
+
attributes: !0,
|
|
117
|
+
attributeFilter: [
|
|
118
|
+
"style",
|
|
119
|
+
"class",
|
|
120
|
+
"data-font-size"
|
|
121
|
+
]
|
|
122
|
+
}), !(typeof ResizeObserver > "u") && (O = document.createElement("div"), O.style.position = "absolute", O.style.visibility = "hidden", O.style.pointerEvents = "none", O.style.width = "1em", O.style.height = "1px", O.style.overflow = "hidden", O.setAttribute("aria-hidden", "true"), (document.body ?? document.documentElement).appendChild(O), D = new ResizeObserver(L), D.observe(O)));
|
|
123
|
+
}
|
|
124
|
+
function z() {
|
|
125
|
+
F(), S = null, k &&= (clearTimeout(k), null), E &&= (E.disconnect(), null), D &&= (D.disconnect(), null), O?.parentNode && O.parentNode.removeChild(O), O = null, T = !1;
|
|
126
|
+
}
|
|
127
|
+
function B() {
|
|
128
|
+
T || typeof window > "u" || typeof document > "u" || (T = !0, I(!0), R());
|
|
129
|
+
}
|
|
130
|
+
function V(e) {
|
|
131
|
+
return typeof window > "u" || typeof document > "u" ? () => {} : (A.add(e), B(), () => {
|
|
132
|
+
A.delete(e), A.size === 0 && z();
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
function H() {
|
|
136
|
+
return x;
|
|
137
|
+
}
|
|
138
|
+
function U() {
|
|
139
|
+
return v;
|
|
140
|
+
}
|
|
141
|
+
function W() {
|
|
142
|
+
return t(V, H, U);
|
|
143
|
+
}
|
|
144
|
+
//#endregion
|
|
145
|
+
export { n as BREAKPOINTS_EM, s as getControlHeight, a as getCurrentFontSize, o as getCurrentLineHeight, l as isResponsiveMap, c as pxToEm, d as resolveProps, u as resolveResponsiveValue, W as useMatchMedia, h as useMediaQuery };
|
|
146
|
+
|
|
147
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/media/breakpoints.ts","../../src/media/getCurrentFontSize.ts","../../src/media/pxToEm.ts","../../src/media/responsive.ts","../../src/media/useMediaQuery.ts","../../src/media/useMatchMedia.ts"],"sourcesContent":["export const BREAKPOINTS_EM = {\n\tmobileMax: 767.98 / 16,\n\ttabletMin: 768 / 16,\n\ttabletMax: 1151.98 / 16,\n\tlaptopMin: 1152 / 16\n} as const;\n\nexport type Breakpoint = \"mobile\" | \"tablet\" | \"laptop\";\nexport type MediaMatches = Record<Breakpoint, boolean>;\n","const DEFAULT_FONT_SIZE = 16;\nconst DEFAULT_LINE_HEIGHT = 1.2;\n\nexport function getCurrentFontSize(element?: HTMLElement | null): number {\n\tif (typeof window === \"undefined\" || typeof document === \"undefined\") {\n\t\treturn DEFAULT_FONT_SIZE;\n\t}\n\n\tconst target = element ?? document.documentElement;\n\tconst rootFontSize = window.getComputedStyle(target).fontSize;\n\tconst fontSize = Number.parseFloat(rootFontSize);\n\n\tif (!Number.isFinite(fontSize) || fontSize <= 0) {\n\t\treturn DEFAULT_FONT_SIZE;\n\t}\n\n\treturn fontSize;\n}\n\nexport function getCurrentLineHeight(element?: HTMLElement | null): number {\n\tif (typeof window === \"undefined\" || typeof document === \"undefined\") {\n\t\treturn DEFAULT_LINE_HEIGHT;\n\t}\n\n\tconst target = element ?? document.documentElement;\n\tconst computedStyles = window.getComputedStyle(target);\n\tconst rootLineHeight = computedStyles.lineHeight;\n\tconst lineHeight = Number.parseFloat(rootLineHeight);\n\n\tif (!Number.isFinite(lineHeight) || lineHeight <= 0) {\n\t\treturn DEFAULT_LINE_HEIGHT;\n\t}\n\n\treturn lineHeight / DEFAULT_FONT_SIZE;\n}\n\nexport function getControlHeight() {\n\tconst fontSize = getCurrentFontSize();\n\tconst lineHeight = getCurrentLineHeight();\n\n\t// Правильно расчета --control-height\n\treturn fontSize + lineHeight * 10;\n}\n","import { getCurrentFontSize } from \"./getCurrentFontSize\";\n\nexport function pxToEm(px: number, baseEm?: number): string {\n\tconst emSize = baseEm ?? getCurrentFontSize(); // динамическая привязка\n\treturn (px / emSize).toString();\n}\n","import { Breakpoint } from \"./breakpoints\";\n\nexport type ResponsiveMap<T> = {\n\tmobile?: T;\n\ttablet?: T;\n\tlaptop?: T;\n};\nexport type ResponsiveValue<T> = T | ResponsiveMap<T>;\nexport type UnwrapResponsive<T> = T extends ResponsiveValue<infer U> ? U : T;\n\nexport function isResponsiveMap<T>(v: ResponsiveValue<T>): v is ResponsiveMap<T> {\n\tif (typeof v !== \"object\" || v === null) return false;\n\n\t// ключевой момент: отличаем “responsive-map” от произвольного объекта T\n\treturn \"mobile\" in v || \"tablet\" in v || \"laptop\" in v || \"desktop\" in v;\n}\n\n/**\n * Превращает объект пропсов, где некоторые поля ResponsiveValue<...>,\n * в объект, где эти поля уже \"плоские\" (U).\n */\nexport type ResolvedProps<T extends object> = {\n\t[K in keyof T]: UnwrapResponsive<T[K]>;\n};\n\n/**\n * Резолвит responsive значение под текущий брейкпоинт.\n * Приоритеты:\n * - exact match (mobile/tablet/laptop)\n * - fallback на \"первое определённое\" в предсказуемом порядке\n */\nexport function resolveResponsiveValue<T>(value: ResponsiveValue<T> | undefined, bp: Breakpoint): T | undefined {\n\tif (value === undefined) return undefined;\n\tif (!isResponsiveMap(value)) {\n\t\t// здесь value точно T (в т.ч. может быть объектом — и это ок)\n\t\treturn value;\n\t}\n\n\tif (bp === \"mobile\") return value.mobile ?? value.tablet ?? value.laptop;\n\tif (bp === \"tablet\") return value.tablet ?? value.mobile ?? value.laptop;\n\n\treturn value.laptop ?? value.tablet ?? value.mobile;\n}\n\n/**\n * Типобезопасно резолвит все поля объекта по списку ключей, которые responsive.\n * (TS-магия: на выходе будет ResolvedProps<T>.)\n */\nexport function resolveProps<T extends object>(props: T, bp: Breakpoint, responsiveKeys: readonly (keyof T)[]): ResolvedProps<T> {\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tconst out: any = { ...props };\n\n\tfor (const key of responsiveKeys) {\n\t\tout[key] = resolveResponsiveValue(out[key], bp);\n\t}\n\n\treturn out as ResolvedProps<T>;\n}\n","import { useCallback, useSyncExternalStore } from \"react\";\n\ntype UseMediaQueryOptions = {\n\treadonly ssrFallback?: boolean;\n};\n\nconst noop = () => {};\n\nfunction readMediaQuery(query: string, fallback: boolean): boolean {\n\tif (typeof window === \"undefined\" || typeof window.matchMedia !== \"function\") return fallback;\n\n\treturn window.matchMedia(query).matches;\n}\n\nfunction subscribeMediaQuery(query: string, listener: () => void): () => void {\n\tif (typeof window === \"undefined\" || typeof window.matchMedia !== \"function\") return noop;\n\n\tconst mql = window.matchMedia(query);\n\n\tif (typeof mql.addEventListener === \"function\") {\n\t\tmql.addEventListener(\"change\", listener);\n\t\treturn () => mql.removeEventListener(\"change\", listener);\n\t}\n\n\tmql.addListener(listener);\n\treturn () => mql.removeListener(listener);\n}\n\n/**\n * SSR-безопасная подписка на произвольный media query.\n * Используется для клиентских предпочтений, где значение должно совпадать с SSR fallback на гидрации.\n */\nexport function useMediaQuery(query: string, { ssrFallback = false }: UseMediaQueryOptions = {}) {\n\tconst subscribe = useCallback((listener: () => void) => subscribeMediaQuery(query, listener), [query]);\n\tconst getSnapshot = useCallback(() => readMediaQuery(query, ssrFallback), [query, ssrFallback]);\n\tconst getServerSnapshot = useCallback(() => ssrFallback, [ssrFallback]);\n\n\treturn useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n}\n","import { useSyncExternalStore } from \"react\";\n\nimport { BREAKPOINTS_EM, type Breakpoint, type MediaMatches } from \"./breakpoints\";\nimport { getCurrentFontSize } from \"./getCurrentFontSize\";\n\n/**\n * Публичный снимок состояния, который возвращает хук/store.\n * Содержит сырые совпадения media query и вычисленный активный брейкпоинт.\n */\ntype MatchMediaSnapshot = {\n\tmatches: MediaMatches;\n\tactiveBreakpoint: Breakpoint;\n};\n\nfunction subscribeMql(mql: MediaQueryList, cb: () => void) {\n\tif (\"addEventListener\" in mql) {\n\t\tmql.addEventListener(\"change\", cb);\n\t\treturn () => mql.removeEventListener(\"change\", cb);\n\t}\n\t// Safari legacy\n\t// @ts-expect-error legacy api\n\tmql.addListener(cb);\n\t// @ts-expect-error legacy api\n\treturn () => mql.removeListener(cb);\n}\n\nfunction buildQueriesPx(emSize: number) {\n\tconst toPx = (em: number) => em * emSize;\n\n\tconst mobileMax = toPx(BREAKPOINTS_EM.mobileMax);\n\tconst tabletMin = toPx(BREAKPOINTS_EM.tabletMin);\n\tconst tabletMax = toPx(BREAKPOINTS_EM.tabletMax);\n\tconst laptopMin = toPx(BREAKPOINTS_EM.laptopMin);\n\n\treturn {\n\t\tmobile: `(width <= ${mobileMax}px)`,\n\t\ttablet: `(width >= ${tabletMin}px) and (width <= ${tabletMax}px)`,\n\t\tlaptop: `(width >= ${laptopMin}px)`\n\t} satisfies Record<Breakpoint, string>;\n}\n\nconst DEFAULT_MATCHES: MediaMatches = {\n\tmobile: false,\n\ttablet: false,\n\tlaptop: false\n};\n\nconst DEFAULT_SNAPSHOT: MatchMediaSnapshot = {\n\tmatches: DEFAULT_MATCHES,\n\tactiveBreakpoint: \"laptop\"\n};\n\n/**\n * Игнорируем микроколебания `em`, чтобы не перестраивать media query без необходимости.\n */\nconst EM_CHANGE_THRESHOLD = 0.25;\n/**\n * Склеиваем частые события observer-ов в одно перестроение.\n */\nconst EM_REBUILD_DEBOUNCE_MS = 80;\n\nlet snapshot: MatchMediaSnapshot = DEFAULT_SNAPSHOT;\nlet currentMql: Record<Breakpoint, MediaQueryList> | null = null;\nlet mqlUnsubs: Array<() => void> = [];\nlet emSizeRef = 0;\nlet initialized = false;\nlet mutationObserver: MutationObserver | null = null;\nlet resizeObserver: ResizeObserver | null = null;\nlet emProbeElement: HTMLDivElement | null = null;\nlet rebuildTimer: ReturnType<typeof setTimeout> | null = null;\n\nconst listeners = new Set<() => void>();\n\n/**\n * Выбирает один активный брейкпоинт по приоритету: mobile -> tablet -> laptop.\n */\nfunction getActiveBreakpoint(matches: MediaMatches): Breakpoint {\n\tif (matches.mobile) return \"mobile\";\n\tif (matches.tablet) return \"tablet\";\n\treturn \"laptop\";\n}\n\n/**\n * Поверхностное сравнение media-состояния, чтобы пропускать пустые уведомления.\n */\nfunction matchesEqual(a: MediaMatches, b: MediaMatches) {\n\treturn a.mobile === b.mobile && a.tablet === b.tablet && a.laptop === b.laptop;\n}\n\n/**\n * Обновляет глобальный snapshot и уведомляет подписчиков только при реальных изменениях.\n */\nfunction emitIfChanged(nextMatches: MediaMatches) {\n\tif (matchesEqual(snapshot.matches, nextMatches)) return;\n\tsnapshot = {\n\t\tmatches: nextMatches,\n\t\tactiveBreakpoint: getActiveBreakpoint(nextMatches)\n\t};\n\tlisteners.forEach((listener) => listener());\n}\n\n/**\n * Читает текущие значения `MediaQueryList` и публикует новый snapshot.\n */\nfunction recomputeFromMql() {\n\tif (!currentMql) return;\n\n\temitIfChanged({\n\t\tmobile: currentMql.mobile.matches,\n\t\ttablet: currentMql.tablet.matches,\n\t\tlaptop: currentMql.laptop.matches\n\t});\n}\n\n/**\n * Снимает активные mql-подписки перед перестроением/очисткой.\n */\nfunction clearMqlSubscriptions() {\n\tmqlUnsubs.forEach((unsubscribe) => unsubscribe());\n\tmqlUnsubs = [];\n}\n\n/**\n * Перестраивает media query, когда корневой `em` изменился достаточно сильно (или принудительно).\n * Это дорогой путь, поэтому он специально ограничен проверками.\n */\nfunction rebuildIfEmChanged(force = false) {\n\tif (typeof window === \"undefined\" || typeof document === \"undefined\") return;\n\n\tconst em = getCurrentFontSize();\n\tif (!force && currentMql && Math.abs(em - emSizeRef) < EM_CHANGE_THRESHOLD) return;\n\n\temSizeRef = em;\n\tclearMqlSubscriptions();\n\n\tconst queries = buildQueriesPx(em);\n\tcurrentMql = {\n\t\tmobile: window.matchMedia(queries.mobile),\n\t\ttablet: window.matchMedia(queries.tablet),\n\t\tlaptop: window.matchMedia(queries.laptop)\n\t};\n\n\tmqlUnsubs = (Object.keys(currentMql) as Breakpoint[]).map((key) => subscribeMql(currentMql![key], recomputeFromMql));\n\trecomputeFromMql();\n}\n\n/**\n * Дебаунс-обертка для перестроения query по событиям observer-ов.\n */\nfunction scheduleRebuild() {\n\tif (rebuildTimer) clearTimeout(rebuildTimer);\n\trebuildTimer = setTimeout(() => {\n\t\trebuildTimer = null;\n\t\trebuildIfEmChanged();\n\t}, EM_REBUILD_DEBOUNCE_MS);\n}\n\n/**\n * Наблюдает за изменением style/class у root и размером probe-элемента `1em`.\n * Это позволяет ловить изменения font-size/zoom без слушателя window resize.\n */\nfunction setupEmObservers() {\n\tif (typeof window === \"undefined\" || typeof document === \"undefined\") return;\n\n\tmutationObserver = new MutationObserver(scheduleRebuild);\n\tmutationObserver.observe(document.documentElement, {\n\t\tattributes: true,\n\t\tattributeFilter: [\"style\", \"class\", \"data-font-size\"]\n\t});\n\n\tif (typeof ResizeObserver === \"undefined\") return;\n\n\temProbeElement = document.createElement(\"div\");\n\temProbeElement.style.position = \"absolute\";\n\temProbeElement.style.visibility = \"hidden\";\n\temProbeElement.style.pointerEvents = \"none\";\n\temProbeElement.style.width = \"1em\";\n\temProbeElement.style.height = \"1px\";\n\temProbeElement.style.overflow = \"hidden\";\n\temProbeElement.setAttribute(\"aria-hidden\", \"true\");\n\n\t(document.body ?? document.documentElement).appendChild(emProbeElement);\n\n\tresizeObserver = new ResizeObserver(scheduleRebuild);\n\tresizeObserver.observe(emProbeElement);\n}\n\n/**\n * Полностью освобождает глобальные ресурсы, когда не осталось подписчиков.\n */\nfunction cleanupStore() {\n\tclearMqlSubscriptions();\n\tcurrentMql = null;\n\n\tif (rebuildTimer) {\n\t\tclearTimeout(rebuildTimer);\n\t\trebuildTimer = null;\n\t}\n\n\tif (mutationObserver) {\n\t\tmutationObserver.disconnect();\n\t\tmutationObserver = null;\n\t}\n\n\tif (resizeObserver) {\n\t\tresizeObserver.disconnect();\n\t\tresizeObserver = null;\n\t}\n\n\tif (emProbeElement?.parentNode) {\n\t\temProbeElement.parentNode.removeChild(emProbeElement);\n\t}\n\temProbeElement = null;\n\n\tinitialized = false;\n}\n\n/**\n * Лениво инициализирует singleton-store при первом подписчике.\n */\nfunction initializeStore() {\n\tif (initialized) return;\n\tif (typeof window === \"undefined\" || typeof document === \"undefined\") return;\n\n\tinitialized = true;\n\trebuildIfEmChanged(true);\n\tsetupEmObservers();\n}\n\n/**\n * API подписки для `useSyncExternalStore`.\n * Держит ровно один глобальный набор observer-ов и mql на всё приложение.\n */\nfunction subscribeStore(listener: () => void) {\n\tif (typeof window === \"undefined\" || typeof document === \"undefined\") {\n\t\treturn () => {};\n\t}\n\n\tlisteners.add(listener);\n\tinitializeStore();\n\n\treturn () => {\n\t\tlisteners.delete(listener);\n\t\tif (listeners.size === 0) {\n\t\t\tcleanupStore();\n\t\t}\n\t};\n}\n\n/**\n * Getter клиентского snapshot для `useSyncExternalStore`.\n */\nfunction getSnapshot() {\n\treturn snapshot;\n}\n\n/**\n * SSR-безопасный getter snapshot.\n */\nfunction getServerSnapshot() {\n\treturn DEFAULT_SNAPSHOT;\n}\n\n/**\n * Общий хук брейкпоинтов, работающий через singleton external store.\n */\nexport function useMatchMedia() {\n\treturn useSyncExternalStore(subscribeStore, getSnapshot, getServerSnapshot);\n}\n"],"mappings":";;AAAA,IAAa,IAAiB;CAC7B,WAAW,SAAS;CACpB,WAAW,MAAM;CACjB,WAAW,UAAU;CACrB,WAAW,OAAO;AACnB,GCLM,IAAoB,IACpB,IAAsB;AAE5B,SAAgB,EAAmB,GAAsC;CACxE,IAAI,OAAO,SAAW,OAAe,OAAO,WAAa,KACxD,OAAO;CAGR,IAAM,IAAS,KAAW,SAAS,iBAC7B,IAAe,OAAO,iBAAiB,CAAM,CAAC,CAAC,UAC/C,IAAW,OAAO,WAAW,CAAY;CAM/C,OAJI,CAAC,OAAO,SAAS,CAAQ,KAAK,KAAY,IACtC,IAGD;AACR;AAEA,SAAgB,EAAqB,GAAsC;CAC1E,IAAI,OAAO,SAAW,OAAe,OAAO,WAAa,KACxD,OAAO;CAGR,IAAM,IA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
|
|
|
1
|
+
import { Breakpoint } from "./breakpoints";
|
|
2
|
+
export type ResponsiveMap<T> = {
|
|
3
|
+
mobile?: T;
|
|
4
|
+
tablet?: T;
|
|
5
|
+
laptop?: T;
|
|
6
|
+
};
|
|
7
|
+
export type ResponsiveValue<T> = T | ResponsiveMap<T>;
|
|
8
|
+
export type UnwrapResponsive<T> = T extends ResponsiveValue<infer U> ? U : T;
|
|
9
|
+
export declare function isResponsiveMap<T>(v: ResponsiveValue<T>): v is ResponsiveMap<T>;
|
|
10
|
+
/**
|
|
11
|
+
* Превращает объект пропсов, где некоторые поля ResponsiveValue<...>,
|
|
12
|
+
* в объект, где эти поля уже "плоские" (U).
|
|
13
|
+
*/
|
|
14
|
+
export type ResolvedProps<T extends object> = {
|
|
15
|
+
[K in keyof T]: UnwrapResponsive<T[K]>;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Резолвит responsive значение под текущий брейкпоинт.
|
|
19
|
+
* Приоритеты:
|
|
20
|
+
* - exact match (mobile/tablet/laptop)
|
|
21
|
+
* - fallback на "первое определённое" в предсказуемом порядке
|
|
22
|
+
*/
|
|
23
|
+
export declare function resolveResponsiveValue<T>(value: ResponsiveValue<T> | undefined, bp: Breakpoint): T | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Типобезопасно резолвит все поля объекта по списку ключей, которые responsive.
|
|
26
|
+
* (TS-магия: на выходе будет ResolvedProps<T>.)
|
|
27
|
+
*/
|
|
28
|
+
export declare function resolveProps<T extends object>(props: T, bp: Breakpoint, responsiveKeys: readonly (keyof T)[]): ResolvedProps<T>;
|
|
29
|
+
//# sourceMappingURL=responsive.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"responsive.d.ts","sourceRoot":"","sources":["../../src/media/responsive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI;IAC9B,MAAM,CAAC,EAAE,CAAC,CAAC;IACX,MAAM,CAAC,EAAE,CAAC,CAAC;IACX,MAAM,CAAC,EAAE,CAAC,CAAC;CACX,CAAC;AACF,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;AACtD,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,CAAC,SAAS,eAAe,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAE7E,wBAAgB,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC,CAK/E;AAED;;;GAGG;AACH,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,MAAM,IAAI;KAC5C,CAAC,IAAI,MAAM,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CACtC,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,SAAS,EAAE,EAAE,EAAE,UAAU,GAAG,CAAC,GAAG,SAAS,CAW9G;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,cAAc,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,aAAa,CAAC,CAAC,CAAC,CAS/H"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type Breakpoint, type MediaMatches } from "./breakpoints";
|
|
2
|
+
/**
|
|
3
|
+
* Публичный снимок состояния, который возвращает хук/store.
|
|
4
|
+
* Содержит сырые совпадения media query и вычисленный активный брейкпоинт.
|
|
5
|
+
*/
|
|
6
|
+
type MatchMediaSnapshot = {
|
|
7
|
+
matches: MediaMatches;
|
|
8
|
+
activeBreakpoint: Breakpoint;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Общий хук брейкпоинтов, работающий через singleton external store.
|
|
12
|
+
*/
|
|
13
|
+
export declare function useMatchMedia(): MatchMediaSnapshot;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=useMatchMedia.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMatchMedia.d.ts","sourceRoot":"","sources":["../../src/media/useMatchMedia.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,KAAK,UAAU,EAAE,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAGnF;;;GAGG;AACH,KAAK,kBAAkB,GAAG;IACzB,OAAO,EAAE,YAAY,CAAC;IACtB,gBAAgB,EAAE,UAAU,CAAC;CAC7B,CAAC;AA2PF;;GAEG;AACH,wBAAgB,aAAa,uBAE5B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type UseMediaQueryOptions = {
|
|
2
|
+
readonly ssrFallback?: boolean;
|
|
3
|
+
};
|
|
4
|
+
/**
|
|
5
|
+
* SSR-безопасная подписка на произвольный media query.
|
|
6
|
+
* Используется для клиентских предпочтений, где значение должно совпадать с SSR fallback на гидрации.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useMediaQuery(query: string, { ssrFallback }?: UseMediaQueryOptions): boolean;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=useMediaQuery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMediaQuery.d.ts","sourceRoot":"","sources":["../../src/media/useMediaQuery.ts"],"names":[],"mappings":"AAEA,KAAK,oBAAoB,GAAG;IAC3B,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;CAC/B,CAAC;AAwBF;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,WAAmB,EAAE,GAAE,oBAAyB,WAM9F"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/notifications/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACrD,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { createStore as e } from "zustand";
|
|
2
|
+
//#region src/notifications/notify.ts
|
|
3
|
+
var t = null, n = (e) => (t = e, () => {
|
|
4
|
+
t === e && (t = null);
|
|
5
|
+
}), r = () => {
|
|
6
|
+
if (!t) throw Error("Notifications store is not bound. Wrap app with NotificationsProvider.");
|
|
7
|
+
return t;
|
|
8
|
+
}, i = Object.freeze({
|
|
9
|
+
push: (e) => r().getState().actions.push(e),
|
|
10
|
+
upsert: (e) => r().getState().actions.upsert(e),
|
|
11
|
+
update: (e, t) => r().getState().actions.update(e, t),
|
|
12
|
+
dismiss: (e) => r().getState().actions.dismiss(e),
|
|
13
|
+
clear: () => r().getState().actions.clear(),
|
|
14
|
+
success: (e, t) => r().getState().actions.push({
|
|
15
|
+
type: "success",
|
|
16
|
+
message: e,
|
|
17
|
+
...t
|
|
18
|
+
}),
|
|
19
|
+
info: (e, t) => r().getState().actions.push({
|
|
20
|
+
type: "info",
|
|
21
|
+
message: e,
|
|
22
|
+
...t
|
|
23
|
+
}),
|
|
24
|
+
warning: (e, t) => r().getState().actions.push({
|
|
25
|
+
type: "warning",
|
|
26
|
+
message: e,
|
|
27
|
+
...t
|
|
28
|
+
}),
|
|
29
|
+
error: (e, t) => r().getState().actions.push({
|
|
30
|
+
type: "error",
|
|
31
|
+
message: e,
|
|
32
|
+
...t
|
|
33
|
+
}),
|
|
34
|
+
progress: (e, t) => {
|
|
35
|
+
let n = r(), a = t?.id;
|
|
36
|
+
a && n.getState().actions.upsert({
|
|
37
|
+
id: a,
|
|
38
|
+
type: "info",
|
|
39
|
+
title: t?.title,
|
|
40
|
+
message: e,
|
|
41
|
+
dismissible: !1
|
|
42
|
+
});
|
|
43
|
+
let o = a ?? n.getState().actions.push({
|
|
44
|
+
type: "info",
|
|
45
|
+
title: t?.title,
|
|
46
|
+
message: e,
|
|
47
|
+
dismissible: !1
|
|
48
|
+
});
|
|
49
|
+
return {
|
|
50
|
+
id: o,
|
|
51
|
+
update: (e) => i.update(o, { message: e }),
|
|
52
|
+
success: (e, t = 2500) => i.update(o, {
|
|
53
|
+
type: "success",
|
|
54
|
+
message: e,
|
|
55
|
+
dismissible: !0,
|
|
56
|
+
ttlMs: t
|
|
57
|
+
}),
|
|
58
|
+
error: (e, t = 5e3) => i.update(o, {
|
|
59
|
+
type: "error",
|
|
60
|
+
message: e,
|
|
61
|
+
dismissible: !0,
|
|
62
|
+
ttlMs: t
|
|
63
|
+
}),
|
|
64
|
+
dismiss: () => i.dismiss(o)
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
}), a = () => `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 9)}`, o = 6, s = () => {
|
|
68
|
+
let t = /* @__PURE__ */ new Map(), n = (e) => {
|
|
69
|
+
let n = t.get(e);
|
|
70
|
+
n && (window.clearTimeout(n), t.delete(e));
|
|
71
|
+
}, r = (e, r, i = 1e4) => {
|
|
72
|
+
if (n(r), i <= 0) return;
|
|
73
|
+
let a = window.setTimeout(() => {
|
|
74
|
+
e.getState().actions.dismiss(r);
|
|
75
|
+
}, i);
|
|
76
|
+
t.set(r, a);
|
|
77
|
+
}, i = e()((e, s) => ({
|
|
78
|
+
items: [],
|
|
79
|
+
actions: {
|
|
80
|
+
push: (t) => {
|
|
81
|
+
let n = t.id ?? a(), s = Date.now(), c = {
|
|
82
|
+
id: n,
|
|
83
|
+
type: t.type,
|
|
84
|
+
title: t.title,
|
|
85
|
+
message: t.message,
|
|
86
|
+
createdAt: s,
|
|
87
|
+
ttlMs: t.ttlMs,
|
|
88
|
+
dismissible: t.dismissible ?? !0,
|
|
89
|
+
actions: t.actions
|
|
90
|
+
};
|
|
91
|
+
return e((e) => ({ items: [c, ...e.items.filter((e) => e.id !== n)].slice(0, o) })), r(i, n, c.ttlMs), n;
|
|
92
|
+
},
|
|
93
|
+
update: (t, n) => {
|
|
94
|
+
let { items: a } = s(), o = a.findIndex((e) => e.id === t);
|
|
95
|
+
if (o === -1) return !1;
|
|
96
|
+
let c = a[o], l = {
|
|
97
|
+
...c,
|
|
98
|
+
...n,
|
|
99
|
+
id: c.id,
|
|
100
|
+
createdAt: c.createdAt
|
|
101
|
+
};
|
|
102
|
+
return e((e) => ({ items: e.items.map((e) => e.id === t ? l : e) })), "ttlMs" in n && r(i, t, l.ttlMs), !0;
|
|
103
|
+
},
|
|
104
|
+
upsert: (e) => s().actions.update(e.id, {
|
|
105
|
+
type: e.type,
|
|
106
|
+
title: e.title,
|
|
107
|
+
message: e.message,
|
|
108
|
+
ttlMs: e.ttlMs,
|
|
109
|
+
dismissible: e.dismissible
|
|
110
|
+
}) ? e.id : s().actions.push(e),
|
|
111
|
+
dismiss: (t) => {
|
|
112
|
+
n(t), e((e) => ({ items: e.items.filter((e) => e.id !== t) }));
|
|
113
|
+
},
|
|
114
|
+
clear: () => {
|
|
115
|
+
t.forEach((e) => window.clearTimeout(e)), t.clear(), e({ items: [] });
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}));
|
|
119
|
+
return i;
|
|
120
|
+
};
|
|
121
|
+
//#endregion
|
|
122
|
+
export { n as bindNotifications, s as createNotificationsStore, i as notify };
|
|
123
|
+
|
|
124
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/notifications/notify.ts","../../src/notifications/store.ts"],"sourcesContent":["import type { NotificationPushInput, NotificationsStoreApi, NotificationUpdatePatch } from \"./store\";\nimport type { NotificationId } from \"./types\";\n\nlet boundStore: NotificationsStoreApi | null = null;\n\nexport const bindNotifications = (store: NotificationsStoreApi) => {\n\tboundStore = store;\n\n\treturn () => {\n\t\tif (boundStore === store) {\n\t\t\tboundStore = null;\n\t\t}\n\t};\n};\n\nconst requireStore = (): NotificationsStoreApi => {\n\tif (!boundStore) throw new Error(\"Notifications store is not bound. Wrap app with NotificationsProvider.\");\n\treturn boundStore;\n};\n\nexport const notify = Object.freeze({\n\tpush: (input: NotificationPushInput) => requireStore().getState().actions.push(input),\n\tupsert: (input: NotificationPushInput & { id: NotificationId }) => requireStore().getState().actions.upsert(input),\n\tupdate: (id: NotificationId, patch: NotificationUpdatePatch) => requireStore().getState().actions.update(id, patch),\n\n\tdismiss: (id: NotificationId) => requireStore().getState().actions.dismiss(id),\n\tclear: () => requireStore().getState().actions.clear(),\n\n\tsuccess: (message: string, opts?: Omit<NotificationPushInput, \"type\" | \"message\">) =>\n\t\trequireStore()\n\t\t\t.getState()\n\t\t\t.actions.push({ type: \"success\", message, ...opts }),\n\tinfo: (message: string, opts?: Omit<NotificationPushInput, \"type\" | \"message\">) =>\n\t\trequireStore()\n\t\t\t.getState()\n\t\t\t.actions.push({ type: \"info\", message, ...opts }),\n\twarning: (message: string, opts?: Omit<NotificationPushInput, \"type\" | \"message\">) =>\n\t\trequireStore()\n\t\t\t.getState()\n\t\t\t.actions.push({ type: \"warning\", message, ...opts }),\n\terror: (message: string, opts?: Omit<NotificationPushInput, \"type\" | \"message\">) =>\n\t\trequireStore()\n\t\t\t.getState()\n\t\t\t.actions.push({ type: \"error\", message, ...opts }),\n\n\t/**\n\t * Удобный паттерн \"долгой операции\":\n\t * const op = notify.progress(\"Сохраняю...\");\n\t * ... op.success(\"Готово\") или op.error(\"Ошибка\")\n\t */\n\tprogress: (message: string, opts?: { id?: NotificationId; title?: string }) => {\n\t\tconst store = requireStore();\n\t\tconst id = opts?.id;\n\n\t\tif (id) {\n\t\t\tstore.getState().actions.upsert({\n\t\t\t\tid,\n\t\t\t\ttype: \"info\",\n\t\t\t\ttitle: opts?.title,\n\t\t\t\tmessage,\n\t\t\t\tdismissible: false\n\t\t\t});\n\t\t}\n\n\t\tconst notificationId =\n\t\t\tid ??\n\t\t\tstore.getState().actions.push({\n\t\t\t\ttype: \"info\",\n\t\t\t\ttitle: opts?.title,\n\t\t\t\tmessage,\n\t\t\t\tdismissible: false\n\t\t\t});\n\n\t\treturn {\n\t\t\tid: notificationId,\n\t\t\tupdate: (nextMessage: string) => notify.update(notificationId, { message: nextMessage }),\n\t\t\tsuccess: (nextMessage: string, ttlMs = 2500) =>\n\t\t\t\tnotify.update(notificationId, { type: \"success\", message: nextMessage, dismissible: true, ttlMs }),\n\t\t\terror: (nextMessage: string, ttlMs = 5000) =>\n\t\t\t\tnotify.update(notificationId, { type: \"error\", message: nextMessage, dismissible: true, ttlMs }),\n\t\t\tdismiss: () => notify.dismiss(notificationId)\n\t\t};\n\t}\n});\n","import { createStore, StoreApi } from \"zustand\";\n\nimport { Notification, NotificationAction, NotificationId, NotificationType } from \"./types\";\n\nexport type NotificationPushInput = {\n\tid?: NotificationId;\n\ttype: NotificationType;\n\ttitle?: string;\n\tmessage: string;\n\tttlMs?: number;\n\tdismissible?: boolean;\n\tactions?: NotificationAction[];\n};\n\nexport type NotificationUpdatePatch = Partial<Omit<Notification, \"id\" | \"createdAt\">> & {\n\t// ttlMs можно менять; createdAt — нет\n};\n\ntype NotificationsState = {\n\titems: Notification[];\n};\n\ntype NotificationsActions = {\n\tpush: (input: NotificationPushInput) => NotificationId;\n\tupdate: (id: NotificationId, patch: NotificationUpdatePatch) => boolean;\n\tupsert: (input: NotificationPushInput & { id: NotificationId }) => NotificationId;\n\tdismiss: (id: NotificationId) => void;\n\tclear: () => void;\n};\n\nexport type NotificationsStore = NotificationsState & {\n\tactions: NotificationsActions;\n};\n\nconst genId = (): NotificationId => `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 9)}`;\n\nconst MAX_ITEMS = 6;\n\nexport const createNotificationsStore = () => {\n\tconst timers = new Map<NotificationId, number>();\n\n\tconst clearTimer = (id: NotificationId) => {\n\t\tconst t = timers.get(id);\n\t\tif (t) {\n\t\t\twindow.clearTimeout(t);\n\t\t\ttimers.delete(id);\n\t\t}\n\t};\n\n\tconst armTimer = (store: StoreApi<NotificationsStore>, id: NotificationId, ttlMs: number = 10_000) => {\n\t\tclearTimer(id);\n\t\tif (ttlMs <= 0) return;\n\n\t\tconst t = window.setTimeout(() => {\n\t\t\tstore.getState().actions.dismiss(id);\n\t\t}, ttlMs);\n\n\t\ttimers.set(id, t);\n\t};\n\n\tconst store = createStore<NotificationsStore>()((set, get) => ({\n\t\titems: [],\n\n\t\tactions: {\n\t\t\tpush: (input) => {\n\t\t\t\tconst id = input.id ?? genId();\n\t\t\t\tconst now = Date.now();\n\n\t\t\t\tconst notif: Notification = {\n\t\t\t\t\tid,\n\t\t\t\t\ttype: input.type,\n\t\t\t\t\ttitle: input.title,\n\t\t\t\t\tmessage: input.message,\n\t\t\t\t\tcreatedAt: now,\n\t\t\t\t\tttlMs: input.ttlMs,\n\t\t\t\t\tdismissible: input.dismissible ?? true,\n\t\t\t\t\tactions: input.actions\n\t\t\t\t};\n\n\t\t\t\tset((s) => ({\n\t\t\t\t\titems: [notif, ...s.items.filter((n) => n.id !== id)].slice(0, MAX_ITEMS)\n\t\t\t\t}));\n\n\t\t\t\tarmTimer(store, id, notif.ttlMs);\n\t\t\t\treturn id;\n\t\t\t},\n\n\t\t\tupdate: (id, patch) => {\n\t\t\t\tconst { items } = get();\n\t\t\t\tconst idx = items.findIndex((n) => n.id === id);\n\t\t\t\tif (idx === -1) return false;\n\n\t\t\t\tconst prev = items[idx];\n\t\t\t\tconst next: Notification = {\n\t\t\t\t\t...prev,\n\t\t\t\t\t...patch,\n\t\t\t\t\tid: prev.id,\n\t\t\t\t\tcreatedAt: prev.createdAt\n\t\t\t\t};\n\n\t\t\t\tset((s) => ({\n\t\t\t\t\titems: s.items.map((n) => (n.id === id ? next : n))\n\t\t\t\t}));\n\n\t\t\t\t// если ttlMs изменили — пере-армим таймер\n\t\t\t\tif (\"ttlMs\" in patch) {\n\t\t\t\t\tarmTimer(store, id, next.ttlMs);\n\t\t\t\t}\n\n\t\t\t\treturn true;\n\t\t\t},\n\n\t\t\tupsert: (input) => {\n\t\t\t\tconst ok = get().actions.update(input.id, {\n\t\t\t\t\ttype: input.type,\n\t\t\t\t\ttitle: input.title,\n\t\t\t\t\tmessage: input.message,\n\t\t\t\t\tttlMs: input.ttlMs,\n\t\t\t\t\tdismissible: input.dismissible\n\t\t\t\t});\n\n\t\t\t\tif (ok) return input.id;\n\t\t\t\treturn get().actions.push(input);\n\t\t\t},\n\n\t\t\tdismiss: (id) => {\n\t\t\t\tclearTimer(id);\n\t\t\t\tset((s) => ({ items: s.items.filter((n) => n.id !== id) }));\n\t\t\t},\n\n\t\t\tclear: () => {\n\t\t\t\ttimers.forEach((t) => window.clearTimeout(t));\n\t\t\t\ttimers.clear();\n\t\t\t\tset({ items: [] });\n\t\t\t}\n\t\t}\n\t}));\n\n\treturn store;\n};\n\nexport type NotificationsStoreApi = StoreApi<NotificationsStore>;\n"],"mappings":";;AAGA,IAAI,IAA2C,MAElC,KAAqB,OACjC,IAAa,SAEA;CACZ,AAAI,MAAe,MAClB,IAAa;AAEf,IAGK,UAA4C;CACjD,IAAI,CAAC,GAAY,MAAU,MAAM,wEAAwE;CACzG,OAAO;AACR,GAEa,IAAS,OAAO,OAAO;CACnC,OAAO,MAAiC,EAAa,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ,KAAK,CAAK;CACpF,SAAS,MAA0D,EAAa,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ,OAAO,CAAK;CACjH,SAAS,GAAoB,MAAmC,EAAa,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ,OAAO,GAAI,CAAK;CAElH,UAAU,MAAuB,EAAa,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ,QAAQ,CAAE;CAC7E,aAAa,EAAa,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ,MAAM;CAErD,UAAU,GAAiB,MAC1B,EAAa,CA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EAAS,GAAO,GAAI,EAAK,KAAK,GAGxB;GACR;GAEA,SAAS,MACG,EAAI,CAAC,CAAC,QAAQ,OAAO,EAAM,IAAI;IACzC,MAAM,EAAM;IACZ,OAAO,EAAM;IACb,SAAS,EAAM;IACf,OAAO,EAAM;IACb,aAAa,EAAM;GACpB,CAEI,IAAW,EAAM,KACd,EAAI,CAAC,CAAC,QAAQ,KAAK,CAAK;GAGhC,UAAU,MAAO;IAEhB,AADA,EAAW,CAAE,GACb,GAAK,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,MAAM,EAAE,OAAO,CAAE,EAAE,EAAE;GAC3D;GAEA,aAAa;IAGZ,AAFA,EAAO,SAAS,MAAM,OAAO,aAAa,CAAC,CAAC,GAC5C,EAAO,MAAM,GACb,EAAI,EAAE,OAAO,CAAC,EAAE,CAAC;GAClB;EACD;CACD,EAAE;CAEF,OAAO;AACR"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { NotificationPushInput, NotificationsStoreApi, NotificationUpdatePatch } from "./store";
|
|
2
|
+
import type { NotificationId } from "./types";
|
|
3
|
+
export declare const bindNotifications: (store: NotificationsStoreApi) => () => void;
|
|
4
|
+
export declare const notify: Readonly<{
|
|
5
|
+
push: (input: NotificationPushInput) => string;
|
|
6
|
+
upsert: (input: NotificationPushInput & {
|
|
7
|
+
id: NotificationId;
|
|
8
|
+
}) => string;
|
|
9
|
+
update: (id: NotificationId, patch: NotificationUpdatePatch) => boolean;
|
|
10
|
+
dismiss: (id: NotificationId) => void;
|
|
11
|
+
clear: () => void;
|
|
12
|
+
success: (message: string, opts?: Omit<NotificationPushInput, "type" | "message">) => string;
|
|
13
|
+
info: (message: string, opts?: Omit<NotificationPushInput, "type" | "message">) => string;
|
|
14
|
+
warning: (message: string, opts?: Omit<NotificationPushInput, "type" | "message">) => string;
|
|
15
|
+
error: (message: string, opts?: Omit<NotificationPushInput, "type" | "message">) => string;
|
|
16
|
+
/**
|
|
17
|
+
* Удобный паттерн "долгой операции":
|
|
18
|
+
* const op = notify.progress("Сохраняю...");
|
|
19
|
+
* ... op.success("Готово") или op.error("Ошибка")
|
|
20
|
+
*/
|
|
21
|
+
progress: (message: string, opts?: {
|
|
22
|
+
id?: NotificationId;
|
|
23
|
+
title?: string;
|
|
24
|
+
}) => {
|
|
25
|
+
id: string;
|
|
26
|
+
update: (nextMessage: string) => boolean;
|
|
27
|
+
success: (nextMessage: string, ttlMs?: number) => boolean;
|
|
28
|
+
error: (nextMessage: string, ttlMs?: number) => boolean;
|
|
29
|
+
dismiss: () => void;
|
|
30
|
+
};
|
|
31
|
+
}>;
|
|
32
|
+
//# sourceMappingURL=notify.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notify.d.ts","sourceRoot":"","sources":["../../src/notifications/notify.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AACrG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAI9C,eAAO,MAAM,iBAAiB,GAAI,OAAO,qBAAqB,eAQ7D,CAAC;AAOF,eAAO,MAAM,MAAM;kBACJ,qBAAqB;oBACnB,qBAAqB,GAAG;QAAE,EAAE,EAAE,cAAc,CAAA;KAAE;iBACjD,cAAc,SAAS,uBAAuB;kBAE7C,cAAc;;uBAGT,MAAM,SAAS,IAAI,CAAC,qBAAqB,EAAE,MAAM,GAAG,SAAS,CAAC;oBAIjE,MAAM,SAAS,IAAI,CAAC,qBAAqB,EAAE,MAAM,GAAG,SAAS,CAAC;uBAI3D,MAAM,SAAS,IAAI,CAAC,qBAAqB,EAAE,MAAM,GAAG,SAAS,CAAC;qBAIhE,MAAM,SAAS,IAAI,CAAC,qBAAqB,EAAE,MAAM,GAAG,SAAS,CAAC;IAK/E;;;;OAIG;wBACiB,MAAM,SAAS;QAAE,EAAE,CAAC,EAAE,cAAc,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;;8BAyBlD,MAAM;+BACL,MAAM;6BAER,MAAM;;;EAK5B,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { StoreApi } from "zustand";
|
|
2
|
+
import { Notification, NotificationAction, NotificationId, NotificationType } from "./types";
|
|
3
|
+
export type NotificationPushInput = {
|
|
4
|
+
id?: NotificationId;
|
|
5
|
+
type: NotificationType;
|
|
6
|
+
title?: string;
|
|
7
|
+
message: string;
|
|
8
|
+
ttlMs?: number;
|
|
9
|
+
dismissible?: boolean;
|
|
10
|
+
actions?: NotificationAction[];
|
|
11
|
+
};
|
|
12
|
+
export type NotificationUpdatePatch = Partial<Omit<Notification, "id" | "createdAt">> & {};
|
|
13
|
+
type NotificationsState = {
|
|
14
|
+
items: Notification[];
|
|
15
|
+
};
|
|
16
|
+
type NotificationsActions = {
|
|
17
|
+
push: (input: NotificationPushInput) => NotificationId;
|
|
18
|
+
update: (id: NotificationId, patch: NotificationUpdatePatch) => boolean;
|
|
19
|
+
upsert: (input: NotificationPushInput & {
|
|
20
|
+
id: NotificationId;
|
|
21
|
+
}) => NotificationId;
|
|
22
|
+
dismiss: (id: NotificationId) => void;
|
|
23
|
+
clear: () => void;
|
|
24
|
+
};
|
|
25
|
+
export type NotificationsStore = NotificationsState & {
|
|
26
|
+
actions: NotificationsActions;
|
|
27
|
+
};
|
|
28
|
+
export declare const createNotificationsStore: () => StoreApi<NotificationsStore>;
|
|
29
|
+
export type NotificationsStoreApi = StoreApi<NotificationsStore>;
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/notifications/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEhD,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE7F,MAAM,MAAM,qBAAqB,GAAG;IACnC,EAAE,CAAC,EAAE,cAAc,CAAC;IACpB,IAAI,EAAE,gBAAgB,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,kBAAkB,EAAE,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,GAAG,WAAW,CAAC,CAAC,GAAG,EAEvF,CAAC;AAEF,KAAK,kBAAkB,GAAG;IACzB,KAAK,EAAE,YAAY,EAAE,CAAC;CACtB,CAAC;AAEF,KAAK,oBAAoB,GAAG;IAC3B,IAAI,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,cAAc,CAAC;IACvD,MAAM,EAAE,CAAC,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,uBAAuB,KAAK,OAAO,CAAC;IACxE,MAAM,EAAE,CAAC,KAAK,EAAE,qBAAqB,GAAG;QAAE,EAAE,EAAE,cAAc,CAAA;KAAE,KAAK,cAAc,CAAC;IAClF,OAAO,EAAE,CAAC,EAAE,EAAE,cAAc,KAAK,IAAI,CAAC;IACtC,KAAK,EAAE,MAAM,IAAI,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,kBAAkB,GAAG;IACrD,OAAO,EAAE,oBAAoB,CAAC;CAC9B,CAAC;AAMF,eAAO,MAAM,wBAAwB,oCAqGpC,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,QAAQ,CAAC,kBAAkB,CAAC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type NotificationType = "error" | "warning" | "info" | "success";
|
|
2
|
+
export type NotificationTone = "neutral" | NotificationType;
|
|
3
|
+
export type NotificationId = string;
|
|
4
|
+
export type NotificationAction = {
|
|
5
|
+
label: string;
|
|
6
|
+
onClick: () => void | Promise<void>;
|
|
7
|
+
tone?: NotificationTone;
|
|
8
|
+
};
|
|
9
|
+
export type Notification = {
|
|
10
|
+
id: NotificationId;
|
|
11
|
+
type: NotificationType;
|
|
12
|
+
title?: string;
|
|
13
|
+
message: string;
|
|
14
|
+
createdAt: number;
|
|
15
|
+
ttlMs?: number;
|
|
16
|
+
dismissible?: boolean;
|
|
17
|
+
actions?: NotificationAction[];
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/notifications/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAAC;AAExE,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,gBAAgB,CAAC;AAE5D,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC;AAEpC,MAAM,MAAM,kBAAkB,GAAG;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,IAAI,CAAC,EAAE,gBAAgB,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IAC1B,EAAE,EAAE,cAAc,CAAC;IACnB,IAAI,EAAE,gBAAgB,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,kBAAkB,EAAE,CAAC;CAC/B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/number-scale/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC"}
|