@design-edito/tools 0.3.9 → 0.3.10
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/agnostic/arrays/index.d.ts +1 -1
- package/agnostic/arrays/index.js +1 -1
- package/agnostic/arrays/is-array-of/index.d.ts +1 -1
- package/agnostic/arrays/is-array-of/index.js +2 -2
- package/agnostic/booleans/is-falsy/index.d.ts +1 -1
- package/agnostic/colors/channels/index.d.ts +1 -1
- package/agnostic/colors/contrast/index.d.ts +1 -1
- package/agnostic/colors/convert/index.d.ts +1 -1
- package/agnostic/colors/convert/index.js +14 -17
- package/agnostic/colors/cssColorsMap.d.ts +9 -0
- package/agnostic/colors/distance/index.d.ts +1 -1
- package/agnostic/colors/index.d.ts +3 -3
- package/agnostic/colors/index.js +3 -3
- package/agnostic/colors/invert/index.d.ts +1 -1
- package/agnostic/colors/luminance/index.d.ts +1 -1
- package/agnostic/colors/palette/index.js +2 -0
- package/agnostic/colors/tidy/index.js +2 -1
- package/agnostic/colors/typechecks/index.d.ts +1 -1
- package/agnostic/colors/typechecks/index.js +1 -3
- package/agnostic/colors/types.d.ts +0 -7
- package/agnostic/colors/types.js +0 -154
- package/agnostic/css/bem/index.d.ts +3 -3
- package/agnostic/css/bem/index.js +6 -5
- package/agnostic/css/clss/index.d.ts +2 -1
- package/agnostic/css/clss/index.js +2 -2
- package/agnostic/css/generate-nice-color/index.js +1 -0
- package/agnostic/css/index.d.ts +2 -2
- package/agnostic/css/index.js +2 -2
- package/agnostic/css/styles-set/index.d.ts +4 -4
- package/agnostic/css/styles-set/index.js +1 -1
- package/agnostic/errors/register/index.js +4 -2
- package/agnostic/html/get-node-ancestors/index.js +1 -1
- package/agnostic/html/get-position-inside-parent/index.js +1 -1
- package/agnostic/html/hyper-json/cast/index.d.ts +1 -1
- package/agnostic/html/hyper-json/method/index.d.ts +2 -2
- package/agnostic/html/hyper-json/serialize/index.d.ts +1 -1
- package/agnostic/html/hyper-json/serialize/index.js +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/and/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/append/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/at/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/call/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/call/index.js +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/clone/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/deleteproperties/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/deleteproperties/index.js +5 -2
- package/agnostic/html/hyper-json/smart-tags/coalesced/equals/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/getproperties/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/getproperty/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/getproperty/index.js +5 -2
- package/agnostic/html/hyper-json/smart-tags/coalesced/hjparse/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/hjstringify/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/if/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/index.d.ts +16 -16
- package/agnostic/html/hyper-json/smart-tags/coalesced/index.js +16 -16
- package/agnostic/html/hyper-json/smart-tags/coalesced/initialize/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/join/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/length/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/map/index.d.ts +2 -2
- package/agnostic/html/hyper-json/smart-tags/coalesced/map/index.js +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/or/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/pickrandom/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/populate/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/print/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/push/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/pusheach/index.d.ts +2 -2
- package/agnostic/html/hyper-json/smart-tags/coalesced/recordtoarray/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/removeattribute/index.d.ts +2 -2
- package/agnostic/html/hyper-json/smart-tags/coalesced/removeattribute/index.js +7 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/renameproperty/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/replace/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/set/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/setattribute/index.d.ts +2 -2
- package/agnostic/html/hyper-json/smart-tags/coalesced/setattribute/index.js +7 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/setproperty/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/setproperty/index.js +9 -9
- package/agnostic/html/hyper-json/smart-tags/coalesced/sorton/index.d.ts +2 -2
- package/agnostic/html/hyper-json/smart-tags/coalesced/spread/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/toarray/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/toboolean/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/toelement/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/tonodelist/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/tonull/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/tonumber/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/torecord/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/toref/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/tostring/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/totext/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/transformselected/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/transformselected/index.js +0 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/trim/index.js +1 -1
- package/agnostic/html/hyper-json/smart-tags/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/isolated/any/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/isolated/array/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/isolated/get/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/isolated/global/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/isolated/guess/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/isolated/guess/index.js +1 -1
- package/agnostic/html/hyper-json/smart-tags/isolated/index.d.ts +4 -4
- package/agnostic/html/hyper-json/smart-tags/isolated/index.js +4 -4
- package/agnostic/html/hyper-json/smart-tags/isolated/nodelist/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/isolated/null/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/isolated/record/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/isolated/ref/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/isolated/text/index.js +3 -1
- package/agnostic/html/hyper-json/transformer/index.d.ts +2 -2
- package/agnostic/html/hyper-json/transformer/index.js +6 -9
- package/agnostic/html/hyper-json/tree/index.d.ts +1 -1
- package/agnostic/html/hyper-json/tree/index.js +14 -10
- package/agnostic/html/hyper-json/types/index.d.ts +9 -13
- package/agnostic/html/hyper-json/utils/index.d.ts +7 -7
- package/agnostic/html/hyper-json/utils/index.js +1 -1
- package/agnostic/html/index.d.ts +1 -1
- package/agnostic/html/index.js +1 -1
- package/agnostic/html/placeholders/index.d.ts +1 -1
- package/agnostic/html/selector-to-element/index.js +1 -1
- package/agnostic/index.d.ts +6 -6
- package/agnostic/index.js +6 -6
- package/agnostic/misc/assert/index.d.ts +2 -2
- package/agnostic/misc/assert/index.js +4 -4
- package/agnostic/misc/cast/index.d.ts +1 -1
- package/agnostic/misc/connection/index.js +0 -1
- package/agnostic/misc/crawler/index.d.ts +2 -2
- package/agnostic/misc/crossenv/detect-runtime/index.js +4 -4
- package/agnostic/misc/crossenv/window/index.d.ts +1 -1
- package/agnostic/misc/crossenv/window/index.js +2 -2
- package/agnostic/misc/data-size/index.js +2 -2
- package/agnostic/misc/index.d.ts +5 -5
- package/agnostic/misc/index.js +5 -5
- package/agnostic/misc/is-constructor-function/index.d.ts +1 -1
- package/agnostic/misc/logs/index.d.ts +1 -1
- package/agnostic/misc/logs/index.js +1 -1
- package/agnostic/misc/logs/logger/index.d.ts +1 -1
- package/agnostic/misc/outcome/index.d.ts +7 -7
- package/agnostic/numbers/approximate-rational/index.js +4 -2
- package/agnostic/numbers/index.d.ts +3 -3
- package/agnostic/numbers/index.js +3 -3
- package/agnostic/objects/deep-get-property/index.js +2 -2
- package/agnostic/objects/flatten-getters/index.js +2 -1
- package/agnostic/objects/index.d.ts +4 -3
- package/agnostic/objects/index.js +4 -3
- package/agnostic/objects/record-format/index.js +1 -0
- package/agnostic/objects/sort-keys/index.d.ts +11 -0
- package/agnostic/objects/sort-keys/index.js +12 -0
- package/agnostic/objects/sort-keys/index.test.d.ts +1 -0
- package/agnostic/optim/memoize/index.js +1 -1
- package/agnostic/optim/throttle-debounce/index.d.ts +12 -10
- package/agnostic/optim/throttle-debounce/index.js +2 -2
- package/agnostic/optim/throttle-debounce/types.d.ts +1 -1
- package/agnostic/random/index.d.ts +1 -1
- package/agnostic/random/index.js +1 -1
- package/agnostic/random/random/index.js +1 -1
- package/agnostic/sanitization/html/index.js +7 -7
- package/agnostic/sanitization/index.d.ts +2 -2
- package/agnostic/sanitization/index.js +2 -2
- package/agnostic/sanitization/types.d.ts +2 -6
- package/agnostic/strings/char-codes/index.d.ts +5 -5
- package/agnostic/strings/char-codes/index.js +2 -2
- package/agnostic/strings/index.d.ts +2 -2
- package/agnostic/strings/index.js +2 -2
- package/agnostic/strings/matches/index.d.ts +2 -2
- package/agnostic/time/dates/format-date/index.js +23 -9
- package/agnostic/time/duration/index.d.ts +23 -2
- package/agnostic/time/duration/index.js +36 -4
- package/agnostic/time/index.d.ts +2 -2
- package/agnostic/time/index.js +2 -2
- package/agnostic/time/timeout/index.js +2 -2
- package/agnostic/time/wait/index.d.ts +2 -2
- package/agnostic/time/wait/index.js +1 -1
- package/components/EventListener/index.d.ts +2 -2
- package/components/EventListener/index.js +8 -8
- package/components/Input/index.d.ts +2 -2
- package/components/IntersectionObserver/index.d.ts +2 -2
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/node/@aws-s3/storage/directory/copy-dir/index.d.ts +2 -2
- package/node/@aws-s3/storage/directory/copy-dir/index.js +3 -3
- package/node/@aws-s3/storage/directory/list/index.d.ts +2 -2
- package/node/@aws-s3/storage/directory/list/index.js +1 -1
- package/node/@aws-s3/storage/directory/move-dir/index.d.ts +3 -3
- package/node/@aws-s3/storage/directory/move-dir/index.js +3 -3
- package/node/@aws-s3/storage/directory/remove-dir/index.d.ts +2 -2
- package/node/@aws-s3/storage/directory/remove-dir/index.js +4 -4
- package/node/@aws-s3/storage/file/copy/index.d.ts +1 -1
- package/node/@aws-s3/storage/file/download/index.d.ts +3 -3
- package/node/@aws-s3/storage/file/exists/index.d.ts +2 -2
- package/node/@aws-s3/storage/file/exists/index.js +1 -2
- package/node/@aws-s3/storage/file/index.d.ts +3 -3
- package/node/@aws-s3/storage/file/index.js +3 -3
- package/node/@aws-s3/storage/file/move/index.d.ts +2 -2
- package/node/@aws-s3/storage/file/remove/index.d.ts +1 -1
- package/node/@aws-s3/storage/file/stat/index.d.ts +1 -1
- package/node/@aws-s3/storage/file/upload/index.d.ts +2 -2
- package/node/@aws-s3/storage/index.d.ts +1 -1
- package/node/@aws-s3/storage/index.js +1 -1
- package/node/@express/@multer/index.d.ts +1 -1
- package/node/@google-cloud/storage/bucket/get-metadata/index.d.ts +1 -1
- package/node/@google-cloud/storage/directory/copy-dir/index.d.ts +1 -1
- package/node/@google-cloud/storage/directory/index.d.ts +1 -1
- package/node/@google-cloud/storage/directory/index.js +1 -1
- package/node/@google-cloud/storage/directory/list/index.d.ts +1 -1
- package/node/@google-cloud/storage/directory/move-dir/index.d.ts +1 -1
- package/node/@google-cloud/storage/directory/remove-dir/index.d.ts +1 -1
- package/node/@google-cloud/storage/file/copy/index.d.ts +2 -2
- package/node/@google-cloud/storage/file/download/index.d.ts +2 -2
- package/node/@google-cloud/storage/file/exists/index.d.ts +1 -1
- package/node/@google-cloud/storage/file/generate-signed-url/index.d.ts +1 -1
- package/node/@google-cloud/storage/file/get-metadata/index.d.ts +1 -1
- package/node/@google-cloud/storage/file/get-permissions/index.d.ts +1 -1
- package/node/@google-cloud/storage/file/index.d.ts +4 -4
- package/node/@google-cloud/storage/file/index.js +4 -4
- package/node/@google-cloud/storage/file/move/index.d.ts +1 -1
- package/node/@google-cloud/storage/file/remove/index.d.ts +1 -1
- package/node/@google-cloud/storage/file/revoke-signed-urls/index.d.ts +4 -4
- package/node/@google-cloud/storage/file/stat/index.d.ts +1 -1
- package/node/@google-cloud/storage/file/stat/index.js +2 -2
- package/node/@google-cloud/storage/file/update-metadata/index.d.ts +1 -1
- package/node/@google-cloud/storage/file/upload/index.d.ts +2 -2
- package/node/@google-cloud/storage/index.d.ts +1 -1
- package/node/@google-cloud/storage/index.js +1 -1
- package/node/cloud-storage/operations/copy-dir/index.d.ts +8 -8
- package/node/cloud-storage/operations/copy-dir/index.js +4 -4
- package/node/cloud-storage/operations/copy-file/index.d.ts +8 -8
- package/node/cloud-storage/operations/copy-file/index.js +4 -4
- package/node/cloud-storage/operations/download-file/index.d.ts +9 -9
- package/node/cloud-storage/operations/download-file/index.js +4 -4
- package/node/cloud-storage/operations/exists-file/index.d.ts +6 -6
- package/node/cloud-storage/operations/exists-file/index.js +4 -4
- package/node/cloud-storage/operations/index.d.ts +2 -2
- package/node/cloud-storage/operations/index.js +2 -2
- package/node/cloud-storage/operations/list-dir/index.d.ts +6 -6
- package/node/cloud-storage/operations/list-dir/index.js +4 -4
- package/node/cloud-storage/operations/move-dir/index.d.ts +8 -8
- package/node/cloud-storage/operations/move-dir/index.js +4 -4
- package/node/cloud-storage/operations/move-file/index.d.ts +8 -8
- package/node/cloud-storage/operations/move-file/index.js +4 -4
- package/node/cloud-storage/operations/remove-dir/index.d.ts +8 -8
- package/node/cloud-storage/operations/remove-dir/index.js +4 -4
- package/node/cloud-storage/operations/remove-file/index.d.ts +8 -8
- package/node/cloud-storage/operations/remove-file/index.js +4 -4
- package/node/cloud-storage/operations/stat-file/index.d.ts +8 -8
- package/node/cloud-storage/operations/stat-file/index.js +4 -4
- package/node/cloud-storage/operations/upload-file/index.d.ts +9 -9
- package/node/cloud-storage/operations/upload-file/index.js +4 -4
- package/node/files/index.d.ts +1 -1
- package/node/files/index.js +1 -1
- package/node/files/read-write/index.js +1 -1
- package/node/files/subpaths/index.d.ts +3 -3
- package/node/files/subpaths/index.js +6 -6
- package/node/ftps/directory/copy-dir/index.d.ts +1 -1
- package/node/ftps/directory/copy-dir/index.js +1 -1
- package/node/ftps/directory/list/index.d.ts +1 -1
- package/node/ftps/directory/move-dir/index.d.ts +1 -1
- package/node/ftps/directory/move-dir/index.js +1 -3
- package/node/ftps/directory/remove-dir/index.d.ts +2 -2
- package/node/ftps/file/copy/index.d.ts +1 -1
- package/node/ftps/file/copy/index.js +1 -1
- package/node/ftps/file/download/index.d.ts +2 -2
- package/node/ftps/file/exists/index.d.ts +2 -2
- package/node/ftps/file/exists/index.js +1 -1
- package/node/ftps/file/index.d.ts +2 -2
- package/node/ftps/file/index.js +2 -2
- package/node/ftps/file/move/index.d.ts +3 -3
- package/node/ftps/file/move/index.js +1 -1
- package/node/ftps/file/remove/index.d.ts +1 -1
- package/node/ftps/file/stat/index.d.ts +1 -1
- package/node/ftps/file/stat/index.js +2 -2
- package/node/ftps/file/upload/index.d.ts +2 -2
- package/node/images/format/index.d.ts +1 -1
- package/node/images/format/index.js +9 -9
- package/node/images/index.d.ts +2 -2
- package/node/images/index.js +2 -2
- package/node/images/metadata/index.d.ts +1 -1
- package/node/images/metadata/index.js +1 -1
- package/node/images/transform/index.d.ts +2 -2
- package/node/images/transform/index.js +26 -21
- package/node/images/transform/operations/blur/index.d.ts +1 -1
- package/node/images/transform/operations/brighten/index.d.ts +1 -1
- package/node/images/transform/operations/extend/index.d.ts +1 -1
- package/node/images/transform/operations/extract/index.d.ts +1 -1
- package/node/images/transform/operations/flatten/index.d.ts +1 -1
- package/node/images/transform/operations/flatten/index.js +1 -1
- package/node/images/transform/operations/flip/index.d.ts +1 -1
- package/node/images/transform/operations/flop/index.d.ts +1 -1
- package/node/images/transform/operations/hue/index.d.ts +1 -1
- package/node/images/transform/operations/index.d.ts +5 -5
- package/node/images/transform/operations/index.js +5 -5
- package/node/images/transform/operations/level/index.d.ts +1 -1
- package/node/images/transform/operations/lighten/index.d.ts +1 -1
- package/node/images/transform/operations/normalize/index.d.ts +1 -1
- package/node/images/transform/operations/overlay/index.js +1 -1
- package/node/images/transform/operations/resize/index.d.ts +1 -1
- package/node/images/transform/operations/rotate/index.d.ts +1 -1
- package/node/images/transform/operations/saturate/index.d.ts +1 -1
- package/node/index.d.ts +3 -3
- package/node/index.js +3 -3
- package/node/process/prompt-continue/index.js +1 -1
- package/node/process/spawner/index.d.ts +1 -9
- package/node/process/spawner/index.js +10 -8
- package/node/sftp/directory/copy-dir/index.d.ts +2 -1
- package/node/sftp/directory/copy-dir/index.js +2 -2
- package/node/sftp/directory/index.d.ts +1 -1
- package/node/sftp/directory/index.js +1 -1
- package/node/sftp/directory/list/index.d.ts +1 -1
- package/node/sftp/directory/move-dir/index.d.ts +1 -1
- package/node/sftp/directory/move-dir/index.js +2 -4
- package/node/sftp/directory/remove-dir/index.d.ts +2 -2
- package/node/sftp/file/copy/index.d.ts +2 -1
- package/node/sftp/file/copy/index.js +2 -2
- package/node/sftp/file/download/index.d.ts +3 -3
- package/node/sftp/file/exists/index.d.ts +1 -1
- package/node/sftp/file/index.d.ts +3 -3
- package/node/sftp/file/index.js +3 -3
- package/node/sftp/file/move/index.d.ts +3 -3
- package/node/sftp/file/move/index.js +3 -5
- package/node/sftp/file/remove/index.d.ts +1 -1
- package/node/sftp/file/remove/index.js +1 -1
- package/node/sftp/file/stat/index.d.ts +1 -1
- package/node/sftp/file/stat/index.js +1 -1
- package/node/sftp/file/upload/index.d.ts +3 -2
- package/node/sftp/file/upload/index.js +1 -1
- package/package.json +1244 -10
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * as dedupe from './dedupe/index.js'
|
|
2
2
|
export * as findDuplicates from './find-duplicates/index.js'
|
|
3
3
|
export * as isArrayOf from './is-array-of/index.js'
|
|
4
|
+
export * as make from './make/index.js'
|
|
4
5
|
export * as randomPick from './random-pick/index.js'
|
|
5
6
|
export * as shuffle from './shuffle/index.js'
|
|
6
|
-
export * as make from './make/index.js'
|
package/agnostic/arrays/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * as dedupe from './dedupe/index.js'
|
|
2
2
|
export * as findDuplicates from './find-duplicates/index.js'
|
|
3
3
|
export * as isArrayOf from './is-array-of/index.js'
|
|
4
|
+
export * as make from './make/index.js'
|
|
4
5
|
export * as randomPick from './random-pick/index.js'
|
|
5
6
|
export * as shuffle from './shuffle/index.js'
|
|
6
|
-
export * as make from './make/index.js'
|
|
@@ -12,5 +12,5 @@ type TypeOfChecker<C> = C extends ConstructorFunction<infer U> ? U : C extends T
|
|
|
12
12
|
* Supports constructor functions (e.g., `Number`, `String`, `Boolean`, custom classes)
|
|
13
13
|
* and custom type guard functions.
|
|
14
14
|
*/
|
|
15
|
-
export declare function isArrayOf<C extends TypeChecker<any> | TypeChecker<any
|
|
15
|
+
export declare function isArrayOf<C extends TypeChecker<any> | Array<TypeChecker<any>>>(input: unknown, _types?: C): input is Array<TypeOfChecker<C extends any[] ? C[number] : C>>;
|
|
16
16
|
export {};
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "../../misc/is-constructor-function/index.js";
|
|
5
5
|
function isArrayOf(input, _types) {
|
|
6
6
|
if (!Array.isArray(input)) return false;
|
|
7
|
-
if (
|
|
7
|
+
if (_types === void 0) return true;
|
|
8
8
|
const types = Array.isArray(_types) ? _types : [_types];
|
|
9
9
|
const primitiveTypeMap = /* @__PURE__ */ new Map([
|
|
10
10
|
[Number, "number"],
|
|
@@ -15,7 +15,7 @@ function isArrayOf(input, _types) {
|
|
|
15
15
|
(entry) => types.some((typeChecker) => {
|
|
16
16
|
if (!isConstructorFunction(typeChecker)) return typeChecker(entry);
|
|
17
17
|
const primitiveType = primitiveTypeMap.get(typeChecker);
|
|
18
|
-
if (primitiveType) return typeof entry === primitiveType;
|
|
18
|
+
if (primitiveType !== void 0) return typeof entry === primitiveType;
|
|
19
19
|
return entry instanceof typeChecker;
|
|
20
20
|
})
|
|
21
21
|
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Nullish } from '../../misc/is-nullish/index.js';
|
|
1
|
+
import { type Nullish } from '../../misc/is-nullish/index.js';
|
|
2
2
|
/** Union type representing all falsy values in JavaScript. */
|
|
3
3
|
export type Falsy = Nullish | false | '' | 0 | -0 | typeof NaN | 0n;
|
|
4
4
|
/** Type that excludes falsy values from T (except numbers, which may be 0). */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Color, Hex, Rgba, Hsla, Hsba, Laba, Lcha, Cmyka, Xyza, CssColor, TransformedColor, Srgba } from '../types.js';
|
|
1
|
+
import type { Color, Hex, Rgba, Hsla, Hsba, Laba, Lcha, Cmyka, Xyza, CssColor, TransformedColor, Srgba } from '../types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Converts any supported color format to RGBA.
|
|
4
4
|
*
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
// src/agnostic/colors/convert/index.ts
|
|
2
2
|
import { absoluteModulo } from "../../numbers/absolute-modulo/index.js";
|
|
3
3
|
import { tidy } from "../tidy/index.js";
|
|
4
|
-
import {
|
|
5
|
-
cssColors
|
|
6
|
-
} from "../types.js";
|
|
4
|
+
import { cssColors } from "../cssColorsMap.js";
|
|
7
5
|
import {
|
|
8
6
|
isHex,
|
|
9
7
|
isRgb,
|
|
@@ -15,8 +13,9 @@ import {
|
|
|
15
13
|
isLab,
|
|
16
14
|
isLch
|
|
17
15
|
} from "../typechecks/index.js";
|
|
16
|
+
import { unknownToString } from "../../errors/unknown-to-string/index.js";
|
|
18
17
|
function _hex2rgb(hex) {
|
|
19
|
-
if (!isHex(hex)) throw new Error(`invalid hex color ${hex}`);
|
|
18
|
+
if (!isHex(hex)) throw new Error(`invalid hex color ${unknownToString(hex)}`);
|
|
20
19
|
let hexString = hex;
|
|
21
20
|
const inputHex = hexString;
|
|
22
21
|
const startsWithHash = hexString.startsWith("#");
|
|
@@ -28,9 +27,7 @@ function _hex2rgb(hex) {
|
|
|
28
27
|
hexString = hexString.split("").map((c) => c + c).join("");
|
|
29
28
|
} else if (hexString.length === 6) {
|
|
30
29
|
hexString = hexString + "ff";
|
|
31
|
-
} else if (hexString.length
|
|
32
|
-
hexString = hexString;
|
|
33
|
-
} else throw new Error(`invalid hex color ${inputHex}`);
|
|
30
|
+
} else if (hexString.length !== 8) throw new Error(`invalid hex color ${inputHex}`);
|
|
34
31
|
const r = parseInt(hexString.slice(0, 2), 16);
|
|
35
32
|
const g = parseInt(hexString.slice(2, 4), 16);
|
|
36
33
|
const b = parseInt(hexString.slice(4, 6), 16);
|
|
@@ -45,7 +42,7 @@ function _rgb2hex(rgb) {
|
|
|
45
42
|
const aHex = Math.round(a * 255).toString(16).padStart(2, "0");
|
|
46
43
|
const returned = `#${rHex}${gHex}${bHex}${aHex}`;
|
|
47
44
|
if (!isHex(returned)) {
|
|
48
|
-
throw new Error(`invalid hex color output ${returned}`);
|
|
45
|
+
throw new Error(`invalid hex color output ${unknownToString(returned)}`);
|
|
49
46
|
}
|
|
50
47
|
return returned;
|
|
51
48
|
}
|
|
@@ -364,7 +361,7 @@ function toRgb(color) {
|
|
|
364
361
|
if (isXyz(color)) return _xyz2rgb(color);
|
|
365
362
|
if (isLab(color)) return _xyz2rgb(_lab2xyz(color));
|
|
366
363
|
if (isLch(color)) return _xyz2rgb(_lab2xyz(_lch2lab(color)));
|
|
367
|
-
throw new Error(`Invalid color input: ${color}`);
|
|
364
|
+
throw new Error(`Invalid color input: ${unknownToString(color)}`);
|
|
368
365
|
}
|
|
369
366
|
function toXyz(color) {
|
|
370
367
|
if (isXyz(color)) return color;
|
|
@@ -376,7 +373,7 @@ function toXyz(color) {
|
|
|
376
373
|
if (isCmyk(color)) return _rgb2xyz(_cmyk2rgb(color));
|
|
377
374
|
if (isCssColor(color)) return _rgb2xyz(_css2rgb(color));
|
|
378
375
|
if (isHex(color)) return _rgb2xyz(_hex2rgb(color));
|
|
379
|
-
throw new Error(`Invalid color input: ${color}`);
|
|
376
|
+
throw new Error(`Invalid color input: ${unknownToString(color)}`);
|
|
380
377
|
}
|
|
381
378
|
function toLab(color) {
|
|
382
379
|
if (isLab(color)) return color;
|
|
@@ -428,7 +425,7 @@ function viaRgb(color, transformer) {
|
|
|
428
425
|
if (isHex(_color)) return toRgb(transformedRgb);
|
|
429
426
|
if (isCssColor(_color)) return transformedRgb;
|
|
430
427
|
const _typecheck = true;
|
|
431
|
-
throw new Error(`Invalid color input: ${_color}`);
|
|
428
|
+
throw new Error(`Invalid color input: ${unknownToString(_color)}`);
|
|
432
429
|
}
|
|
433
430
|
function viaHsl(color, transformer) {
|
|
434
431
|
const _color = color;
|
|
@@ -444,7 +441,7 @@ function viaHsl(color, transformer) {
|
|
|
444
441
|
if (isHex(_color)) return toHex(transformedHsl);
|
|
445
442
|
if (isCssColor(_color)) return transformedHsl;
|
|
446
443
|
const _typecheck = true;
|
|
447
|
-
throw new Error(`Invalid color input: ${_color}`);
|
|
444
|
+
throw new Error(`Invalid color input: ${unknownToString(_color)}`);
|
|
448
445
|
}
|
|
449
446
|
function viaHsb(color, transformer) {
|
|
450
447
|
const _color = color;
|
|
@@ -460,7 +457,7 @@ function viaHsb(color, transformer) {
|
|
|
460
457
|
if (isHex(_color)) return toHex(transformedHsb);
|
|
461
458
|
if (isCssColor(_color)) return transformedHsb;
|
|
462
459
|
const _typecheck = true;
|
|
463
|
-
throw new Error(`Invalid color input: ${_color}`);
|
|
460
|
+
throw new Error(`Invalid color input: ${unknownToString(_color)}`);
|
|
464
461
|
}
|
|
465
462
|
function viaCmyk(color, transformer) {
|
|
466
463
|
const _color = color;
|
|
@@ -476,7 +473,7 @@ function viaCmyk(color, transformer) {
|
|
|
476
473
|
if (isHex(_color)) return toHex(transformedCmyk);
|
|
477
474
|
if (isCssColor(_color)) return transformedCmyk;
|
|
478
475
|
const _typecheck = true;
|
|
479
|
-
throw new Error(`Invalid color input: ${_color}`);
|
|
476
|
+
throw new Error(`Invalid color input: ${unknownToString(_color)}`);
|
|
480
477
|
}
|
|
481
478
|
function viaXyz(color, transformer) {
|
|
482
479
|
const _color = color;
|
|
@@ -492,7 +489,7 @@ function viaXyz(color, transformer) {
|
|
|
492
489
|
if (isHex(_color)) return toHex(transformedXyz);
|
|
493
490
|
if (isCssColor(_color)) return transformedXyz;
|
|
494
491
|
const _typecheck = true;
|
|
495
|
-
throw new Error(`Invalid color input: ${_color}`);
|
|
492
|
+
throw new Error(`Invalid color input: ${unknownToString(_color)}`);
|
|
496
493
|
}
|
|
497
494
|
function viaLab(color, transformer) {
|
|
498
495
|
const _color = color;
|
|
@@ -508,7 +505,7 @@ function viaLab(color, transformer) {
|
|
|
508
505
|
if (isHex(_color)) return toHex(transformedLab);
|
|
509
506
|
if (isCssColor(_color)) return transformedLab;
|
|
510
507
|
const _typecheck = true;
|
|
511
|
-
throw new Error(`Invalid color input: ${_color}`);
|
|
508
|
+
throw new Error(`Invalid color input: ${unknownToString(_color)}`);
|
|
512
509
|
}
|
|
513
510
|
function viaLch(color, transformer) {
|
|
514
511
|
const _color = color;
|
|
@@ -524,7 +521,7 @@ function viaLch(color, transformer) {
|
|
|
524
521
|
if (isHex(_color)) return toHex(transformedLch);
|
|
525
522
|
if (isCssColor(_color)) return transformedLch;
|
|
526
523
|
const _typecheck = true;
|
|
527
|
-
throw new Error(`Invalid color input: ${_color}`);
|
|
524
|
+
throw new Error(`Invalid color input: ${unknownToString(_color)}`);
|
|
528
525
|
}
|
|
529
526
|
function linearizeToSRgb(rgb) {
|
|
530
527
|
const cleanRgb = tidy(rgb);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export * as channels from './channels/index.js'
|
|
2
1
|
export * as contrast from './contrast/index.js'
|
|
2
|
+
export * as channels from './channels/index.js'
|
|
3
3
|
export * as convert from './convert/index.js'
|
|
4
|
+
export * as grayscale from './grayscale/index.js'
|
|
4
5
|
export * as distance from './distance/index.js'
|
|
5
6
|
export * as invert from './invert/index.js'
|
|
6
|
-
export * as grayscale from './grayscale/index.js'
|
|
7
7
|
export * as lerp from './lerp/index.js'
|
|
8
8
|
export * as luminance from './luminance/index.js'
|
|
9
9
|
export * as palette from './palette/index.js'
|
|
10
|
+
export * as rotate from './rotate/index.js'
|
|
10
11
|
export * as tidy from './tidy/index.js'
|
|
11
12
|
export * as typechecks from './typechecks/index.js'
|
|
12
|
-
export * as rotate from './rotate/index.js'
|
package/agnostic/colors/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export * as channels from './channels/index.js'
|
|
2
1
|
export * as contrast from './contrast/index.js'
|
|
2
|
+
export * as channels from './channels/index.js'
|
|
3
3
|
export * as convert from './convert/index.js'
|
|
4
|
+
export * as grayscale from './grayscale/index.js'
|
|
4
5
|
export * as distance from './distance/index.js'
|
|
5
6
|
export * as invert from './invert/index.js'
|
|
6
|
-
export * as grayscale from './grayscale/index.js'
|
|
7
7
|
export * as lerp from './lerp/index.js'
|
|
8
8
|
export * as luminance from './luminance/index.js'
|
|
9
9
|
export * as palette from './palette/index.js'
|
|
10
|
+
export * as rotate from './rotate/index.js'
|
|
10
11
|
export * as tidy from './tidy/index.js'
|
|
11
12
|
export * as typechecks from './typechecks/index.js'
|
|
12
|
-
export * as rotate from './rotate/index.js'
|
|
@@ -3,6 +3,7 @@ import { isRgb, isHsl, isHsb, isCmyk, isXyz, isLab, isLch, isCssColor, isHex } f
|
|
|
3
3
|
import { clamp } from "../../numbers/clamp/index.js";
|
|
4
4
|
import { absoluteModulo } from "../../numbers/absolute-modulo/index.js";
|
|
5
5
|
import { toRgb, toHex } from "../convert/index.js";
|
|
6
|
+
import { unknownToString } from "../../errors/unknown-to-string/index.js";
|
|
6
7
|
function tidy(color) {
|
|
7
8
|
const _color = color;
|
|
8
9
|
if (isRgb(_color)) return {
|
|
@@ -51,7 +52,7 @@ function tidy(color) {
|
|
|
51
52
|
if (isCssColor(_color)) return tidy(toRgb(_color));
|
|
52
53
|
if (isHex(_color)) return toHex(tidy(toRgb(_color)));
|
|
53
54
|
const _typecheck = true;
|
|
54
|
-
throw new Error(`Invalid color input: ${_color}`);
|
|
55
|
+
throw new Error(`Invalid color input: ${unknownToString(_color)}`);
|
|
55
56
|
}
|
|
56
57
|
export {
|
|
57
58
|
tidy
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Hex, Rgba, Hsla, Hsba, Laba, Lcha, Cmyka, Xyza, CssColor, Color } from '../types.js';
|
|
1
|
+
import { type Hex, type Rgba, type Hsla, type Hsba, type Laba, type Lcha, type Cmyka, type Xyza, type CssColor, type Color } from '../types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Type guard to check if a value is a valid hexadecimal color string.
|
|
4
4
|
*
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
// src/agnostic/colors/typechecks/index.ts
|
|
2
2
|
import { isNonNullObject } from "../../objects/is-object/index.js";
|
|
3
|
-
import {
|
|
4
|
-
cssColors
|
|
5
|
-
} from "../types.js";
|
|
3
|
+
import { cssColors } from "../cssColorsMap.js";
|
|
6
4
|
var isHex = (color) => {
|
|
7
5
|
if (typeof color !== "string") return false;
|
|
8
6
|
if (!color.startsWith("#")) return false;
|
|
@@ -99,13 +99,6 @@ export type Xyza = {
|
|
|
99
99
|
* Union type of all valid CSS named colors.
|
|
100
100
|
*/
|
|
101
101
|
export type CssColor = 'aliceblue' | 'antiquewhite' | 'aqua' | 'aquamarine' | 'azure' | 'beige' | 'bisque' | 'black' | 'blanchedalmond' | 'blue' | 'blueviolet' | 'brown' | 'burlywood' | 'cadetblue' | 'chartreuse' | 'chocolate' | 'coral' | 'cornflowerblue' | 'cornsilk' | 'crimson' | 'cyan' | 'darkblue' | 'darkcyan' | 'darkgoldenrod' | 'darkgray' | 'darkgreen' | 'darkgrey' | 'darkkhaki' | 'darkmagenta' | 'darkolivegreen' | 'darkorange' | 'darkorchid' | 'darkred' | 'darksalmon' | 'darkseagreen' | 'darkslateblue' | 'darkslategray' | 'darkslategrey' | 'darkturquoise' | 'darkviolet' | 'deeppink' | 'deepskyblue' | 'dimgray' | 'dimgrey' | 'dodgerblue' | 'firebrick' | 'floralwhite' | 'forestgreen' | 'fuchsia' | 'gainsboro' | 'ghostwhite' | 'gold' | 'goldenrod' | 'gray' | 'green' | 'greenyellow' | 'grey' | 'honeydew' | 'hotpink' | 'indianred' | 'indigo' | 'ivory' | 'khaki' | 'lavender' | 'lavenderblush' | 'lawngreen' | 'lemonchiffon' | 'lightblue' | 'lightcoral' | 'lightcyan' | 'lightgoldenrodyellow' | 'lightgray' | 'lightgreen' | 'lightgrey' | 'lightpink' | 'lightsalmon' | 'lightseagreen' | 'lightskyblue' | 'lightslategray' | 'lightslategrey' | 'lightsteelblue' | 'lightyellow' | 'lime' | 'limegreen' | 'linen' | 'magenta' | 'maroon' | 'mediumaquamarine' | 'mediumblue' | 'mediumorchid' | 'mediumpurple' | 'mediumseagreen' | 'mediumslateblue' | 'mediumspringgreen' | 'mediumturquoise' | 'mediumvioletred' | 'midnightblue' | 'mintcream' | 'mistyrose' | 'moccasin' | 'navajowhite' | 'navy' | 'oldlace' | 'olive' | 'olivedrab' | 'orange' | 'orangered' | 'orchid' | 'palegoldenrod' | 'palegreen' | 'paleturquoise' | 'palevioletred' | 'papayawhip' | 'peachpuff' | 'peru' | 'pink' | 'plum' | 'powderblue' | 'purple' | 'rebeccapurple' | 'red' | 'rosybrown' | 'royalblue' | 'saddlebrown' | 'salmon' | 'sandybrown' | 'seagreen' | 'seashell' | 'sienna' | 'silver' | 'skyblue' | 'slateblue' | 'slategray' | 'slategrey' | 'snow' | 'springgreen' | 'steelblue' | 'tan' | 'teal' | 'thistle' | 'tomato' | 'turquoise' | 'violet' | 'wheat' | 'white' | 'whitesmoke' | 'yellow' | 'yellowgreen';
|
|
102
|
-
type CssColorMap = {
|
|
103
|
-
[K in CssColor]: Rgba;
|
|
104
|
-
};
|
|
105
|
-
/**
|
|
106
|
-
* Map of CSS named colors to their corresponding RGBA values.
|
|
107
|
-
*/
|
|
108
|
-
export declare const cssColors: CssColorMap;
|
|
109
102
|
/**
|
|
110
103
|
* Union type representing any supported color format.
|
|
111
104
|
*/
|
package/agnostic/colors/types.js
CHANGED
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
// src/agnostic/colors/types.ts
|
|
2
|
-
var cssColors = {
|
|
3
|
-
aliceblue: { r: 240, g: 248, b: 255 },
|
|
4
|
-
antiquewhite: { r: 250, g: 235, b: 215 },
|
|
5
|
-
aqua: { r: 0, g: 255, b: 255 },
|
|
6
|
-
aquamarine: { r: 127, g: 255, b: 212 },
|
|
7
|
-
azure: { r: 240, g: 255, b: 255 },
|
|
8
|
-
beige: { r: 245, g: 245, b: 220 },
|
|
9
|
-
bisque: { r: 255, g: 228, b: 196 },
|
|
10
|
-
black: { r: 0, g: 0, b: 0 },
|
|
11
|
-
blanchedalmond: { r: 255, g: 235, b: 205 },
|
|
12
|
-
blue: { r: 0, g: 0, b: 255 },
|
|
13
|
-
blueviolet: { r: 138, g: 43, b: 226 },
|
|
14
|
-
brown: { r: 165, g: 42, b: 42 },
|
|
15
|
-
burlywood: { r: 222, g: 184, b: 135 },
|
|
16
|
-
cadetblue: { r: 95, g: 158, b: 160 },
|
|
17
|
-
chartreuse: { r: 127, g: 255, b: 0 },
|
|
18
|
-
chocolate: { r: 210, g: 105, b: 30 },
|
|
19
|
-
coral: { r: 255, g: 127, b: 80 },
|
|
20
|
-
cornflowerblue: { r: 100, g: 149, b: 237 },
|
|
21
|
-
cornsilk: { r: 255, g: 248, b: 220 },
|
|
22
|
-
crimson: { r: 220, g: 20, b: 60 },
|
|
23
|
-
cyan: { r: 0, g: 255, b: 255 },
|
|
24
|
-
darkblue: { r: 0, g: 0, b: 139 },
|
|
25
|
-
darkcyan: { r: 0, g: 139, b: 139 },
|
|
26
|
-
darkgoldenrod: { r: 184, g: 134, b: 11 },
|
|
27
|
-
darkgray: { r: 169, g: 169, b: 169 },
|
|
28
|
-
darkgreen: { r: 0, g: 100, b: 0 },
|
|
29
|
-
darkgrey: { r: 169, g: 169, b: 169 },
|
|
30
|
-
darkkhaki: { r: 189, g: 183, b: 107 },
|
|
31
|
-
darkmagenta: { r: 139, g: 0, b: 139 },
|
|
32
|
-
darkolivegreen: { r: 85, g: 107, b: 47 },
|
|
33
|
-
darkorange: { r: 255, g: 140, b: 0 },
|
|
34
|
-
darkorchid: { r: 153, g: 50, b: 204 },
|
|
35
|
-
darkred: { r: 139, g: 0, b: 0 },
|
|
36
|
-
darksalmon: { r: 233, g: 150, b: 122 },
|
|
37
|
-
darkseagreen: { r: 143, g: 188, b: 143 },
|
|
38
|
-
darkslateblue: { r: 72, g: 61, b: 139 },
|
|
39
|
-
darkslategray: { r: 47, g: 79, b: 79 },
|
|
40
|
-
darkslategrey: { r: 47, g: 79, b: 79 },
|
|
41
|
-
darkturquoise: { r: 0, g: 206, b: 209 },
|
|
42
|
-
darkviolet: { r: 148, g: 0, b: 211 },
|
|
43
|
-
deeppink: { r: 255, g: 20, b: 147 },
|
|
44
|
-
deepskyblue: { r: 0, g: 191, b: 255 },
|
|
45
|
-
dimgray: { r: 105, g: 105, b: 105 },
|
|
46
|
-
dimgrey: { r: 105, g: 105, b: 105 },
|
|
47
|
-
dodgerblue: { r: 30, g: 144, b: 255 },
|
|
48
|
-
firebrick: { r: 178, g: 34, b: 34 },
|
|
49
|
-
floralwhite: { r: 255, g: 250, b: 240 },
|
|
50
|
-
forestgreen: { r: 34, g: 139, b: 34 },
|
|
51
|
-
fuchsia: { r: 255, g: 0, b: 255 },
|
|
52
|
-
gainsboro: { r: 220, g: 220, b: 220 },
|
|
53
|
-
ghostwhite: { r: 248, g: 248, b: 255 },
|
|
54
|
-
gold: { r: 255, g: 215, b: 0 },
|
|
55
|
-
goldenrod: { r: 218, g: 165, b: 32 },
|
|
56
|
-
gray: { r: 128, g: 128, b: 128 },
|
|
57
|
-
green: { r: 0, g: 128, b: 0 },
|
|
58
|
-
greenyellow: { r: 173, g: 255, b: 47 },
|
|
59
|
-
grey: { r: 128, g: 128, b: 128 },
|
|
60
|
-
honeydew: { r: 240, g: 255, b: 240 },
|
|
61
|
-
hotpink: { r: 255, g: 105, b: 180 },
|
|
62
|
-
indianred: { r: 205, g: 92, b: 92 },
|
|
63
|
-
indigo: { r: 75, g: 0, b: 130 },
|
|
64
|
-
ivory: { r: 255, g: 255, b: 240 },
|
|
65
|
-
khaki: { r: 240, g: 230, b: 140 },
|
|
66
|
-
lavender: { r: 230, g: 230, b: 250 },
|
|
67
|
-
lavenderblush: { r: 255, g: 240, b: 245 },
|
|
68
|
-
lawngreen: { r: 124, g: 252, b: 0 },
|
|
69
|
-
lemonchiffon: { r: 255, g: 250, b: 205 },
|
|
70
|
-
lightblue: { r: 173, g: 216, b: 230 },
|
|
71
|
-
lightcoral: { r: 240, g: 128, b: 128 },
|
|
72
|
-
lightcyan: { r: 224, g: 255, b: 255 },
|
|
73
|
-
lightgoldenrodyellow: { r: 250, g: 250, b: 210 },
|
|
74
|
-
lightgray: { r: 211, g: 211, b: 211 },
|
|
75
|
-
lightgreen: { r: 144, g: 238, b: 144 },
|
|
76
|
-
lightgrey: { r: 211, g: 211, b: 211 },
|
|
77
|
-
lightpink: { r: 255, g: 182, b: 193 },
|
|
78
|
-
lightsalmon: { r: 255, g: 160, b: 122 },
|
|
79
|
-
lightseagreen: { r: 32, g: 178, b: 170 },
|
|
80
|
-
lightskyblue: { r: 135, g: 206, b: 250 },
|
|
81
|
-
lightslategray: { r: 119, g: 136, b: 153 },
|
|
82
|
-
lightslategrey: { r: 119, g: 136, b: 153 },
|
|
83
|
-
lightsteelblue: { r: 176, g: 196, b: 222 },
|
|
84
|
-
lightyellow: { r: 255, g: 255, b: 224 },
|
|
85
|
-
lime: { r: 0, g: 255, b: 0 },
|
|
86
|
-
limegreen: { r: 50, g: 205, b: 50 },
|
|
87
|
-
linen: { r: 250, g: 240, b: 230 },
|
|
88
|
-
magenta: { r: 255, g: 0, b: 255 },
|
|
89
|
-
maroon: { r: 128, g: 0, b: 0 },
|
|
90
|
-
mediumaquamarine: { r: 102, g: 205, b: 170 },
|
|
91
|
-
mediumblue: { r: 0, g: 0, b: 205 },
|
|
92
|
-
mediumorchid: { r: 186, g: 85, b: 211 },
|
|
93
|
-
mediumpurple: { r: 147, g: 112, b: 219 },
|
|
94
|
-
mediumseagreen: { r: 60, g: 179, b: 113 },
|
|
95
|
-
mediumslateblue: { r: 123, g: 104, b: 238 },
|
|
96
|
-
mediumspringgreen: { r: 0, g: 250, b: 154 },
|
|
97
|
-
mediumturquoise: { r: 72, g: 209, b: 204 },
|
|
98
|
-
mediumvioletred: { r: 199, g: 21, b: 133 },
|
|
99
|
-
midnightblue: { r: 25, g: 25, b: 112 },
|
|
100
|
-
mintcream: { r: 245, g: 255, b: 250 },
|
|
101
|
-
mistyrose: { r: 255, g: 228, b: 225 },
|
|
102
|
-
moccasin: { r: 255, g: 228, b: 181 },
|
|
103
|
-
navajowhite: { r: 255, g: 222, b: 173 },
|
|
104
|
-
navy: { r: 0, g: 0, b: 128 },
|
|
105
|
-
oldlace: { r: 253, g: 245, b: 230 },
|
|
106
|
-
olive: { r: 128, g: 128, b: 0 },
|
|
107
|
-
olivedrab: { r: 107, g: 142, b: 35 },
|
|
108
|
-
orange: { r: 255, g: 165, b: 0 },
|
|
109
|
-
orangered: { r: 255, g: 69, b: 0 },
|
|
110
|
-
orchid: { r: 218, g: 112, b: 214 },
|
|
111
|
-
palegoldenrod: { r: 238, g: 232, b: 170 },
|
|
112
|
-
palegreen: { r: 152, g: 251, b: 152 },
|
|
113
|
-
paleturquoise: { r: 175, g: 238, b: 238 },
|
|
114
|
-
palevioletred: { r: 219, g: 112, b: 147 },
|
|
115
|
-
papayawhip: { r: 255, g: 239, b: 213 },
|
|
116
|
-
peachpuff: { r: 255, g: 218, b: 185 },
|
|
117
|
-
peru: { r: 205, g: 133, b: 63 },
|
|
118
|
-
pink: { r: 255, g: 192, b: 203 },
|
|
119
|
-
plum: { r: 221, g: 160, b: 221 },
|
|
120
|
-
powderblue: { r: 176, g: 224, b: 230 },
|
|
121
|
-
purple: { r: 128, g: 0, b: 128 },
|
|
122
|
-
rebeccapurple: { r: 102, g: 51, b: 153 },
|
|
123
|
-
red: { r: 255, g: 0, b: 0 },
|
|
124
|
-
rosybrown: { r: 188, g: 143, b: 143 },
|
|
125
|
-
royalblue: { r: 65, g: 105, b: 225 },
|
|
126
|
-
saddlebrown: { r: 139, g: 69, b: 19 },
|
|
127
|
-
salmon: { r: 250, g: 128, b: 114 },
|
|
128
|
-
sandybrown: { r: 244, g: 164, b: 96 },
|
|
129
|
-
seagreen: { r: 46, g: 139, b: 87 },
|
|
130
|
-
seashell: { r: 255, g: 245, b: 238 },
|
|
131
|
-
sienna: { r: 160, g: 82, b: 45 },
|
|
132
|
-
silver: { r: 192, g: 192, b: 192 },
|
|
133
|
-
skyblue: { r: 135, g: 206, b: 235 },
|
|
134
|
-
slateblue: { r: 106, g: 90, b: 205 },
|
|
135
|
-
slategray: { r: 112, g: 128, b: 144 },
|
|
136
|
-
slategrey: { r: 112, g: 128, b: 144 },
|
|
137
|
-
snow: { r: 255, g: 250, b: 250 },
|
|
138
|
-
springgreen: { r: 0, g: 255, b: 127 },
|
|
139
|
-
steelblue: { r: 70, g: 130, b: 180 },
|
|
140
|
-
tan: { r: 210, g: 180, b: 140 },
|
|
141
|
-
teal: { r: 0, g: 128, b: 128 },
|
|
142
|
-
thistle: { r: 216, g: 191, b: 216 },
|
|
143
|
-
tomato: { r: 255, g: 99, b: 71 },
|
|
144
|
-
turquoise: { r: 64, g: 224, b: 208 },
|
|
145
|
-
violet: { r: 238, g: 130, b: 238 },
|
|
146
|
-
wheat: { r: 245, g: 222, b: 179 },
|
|
147
|
-
white: { r: 255, g: 255, b: 255 },
|
|
148
|
-
whitesmoke: { r: 245, g: 245, b: 245 },
|
|
149
|
-
yellow: { r: 255, g: 255, b: 0 },
|
|
150
|
-
yellowgreen: { r: 154, g: 205, b: 50 }
|
|
151
|
-
};
|
|
152
|
-
export {
|
|
153
|
-
cssColors
|
|
154
|
-
};
|
|
@@ -5,9 +5,9 @@ export interface Block {
|
|
|
5
5
|
}
|
|
6
6
|
export declare class BEM {
|
|
7
7
|
constructor();
|
|
8
|
-
addBlock(blockNameArg: any):
|
|
9
|
-
addElement(elementNameArg: any):
|
|
10
|
-
addModifier(modifierNameArg: any):
|
|
8
|
+
addBlock(blockNameArg: any): this;
|
|
9
|
+
addElement(elementNameArg: any): this;
|
|
10
|
+
addModifier(modifierNameArg: any): this;
|
|
11
11
|
copy(): BEM;
|
|
12
12
|
block(blockNameArg: any): BEM;
|
|
13
13
|
element(elementNameArg: any): BEM;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// src/agnostic/css/bem/index.ts
|
|
2
|
+
import { isNonNullObject } from "agnostic/objects/is-object/index.js";
|
|
2
3
|
import { isFalsy } from "../../booleans/is-falsy/index.js";
|
|
3
4
|
import { isValidClassName } from "../is-valid-css-class-name/index.js";
|
|
4
5
|
function getNamesArr(arg) {
|
|
@@ -9,7 +10,7 @@ function getNamesArr(arg) {
|
|
|
9
10
|
});
|
|
10
11
|
} else if (Array.isArray(arg)) {
|
|
11
12
|
arg.forEach((elt) => returned.push(...getNamesArr(elt)));
|
|
12
|
-
} else if (
|
|
13
|
+
} else if (isNonNullObject(arg)) {
|
|
13
14
|
Object.entries(arg).forEach(([key, val]) => {
|
|
14
15
|
if (!isFalsy(val)) returned.push(...getNamesArr(key));
|
|
15
16
|
});
|
|
@@ -39,26 +40,26 @@ var BEM = class _BEM {
|
|
|
39
40
|
}
|
|
40
41
|
addBlock(blockNameArg) {
|
|
41
42
|
const blocksNames = getNamesArr(blockNameArg);
|
|
42
|
-
blocksNames.forEach(this.addSingleBlock);
|
|
43
|
+
blocksNames.forEach(this.addSingleBlock.bind(this));
|
|
43
44
|
return this;
|
|
44
45
|
}
|
|
45
46
|
addElement(elementNameArg) {
|
|
46
47
|
const elementsNames = getNamesArr(elementNameArg);
|
|
47
|
-
elementsNames.forEach(this.addSingleElement);
|
|
48
|
+
elementsNames.forEach(this.addSingleElement.bind(this));
|
|
48
49
|
return this;
|
|
49
50
|
}
|
|
50
51
|
addModifier(modifierNameArg) {
|
|
51
52
|
const currentBlock = this.getCurrentBlock();
|
|
52
53
|
if (currentBlock === void 0) return this;
|
|
53
54
|
const modifiersNames = getNamesArr(modifierNameArg);
|
|
54
|
-
modifiersNames.forEach(this.addSingleModifier);
|
|
55
|
+
modifiersNames.forEach(this.addSingleModifier.bind(this));
|
|
55
56
|
return this;
|
|
56
57
|
}
|
|
57
58
|
copy() {
|
|
58
59
|
const copy = new _BEM();
|
|
59
60
|
this.blocks.forEach((block) => {
|
|
60
61
|
copy.addBlock(block.name);
|
|
61
|
-
block.modifiers.forEach(copy.addModifier);
|
|
62
|
+
block.modifiers.forEach(copy.addModifier.bind(copy));
|
|
62
63
|
});
|
|
63
64
|
return copy;
|
|
64
65
|
}
|
|
@@ -5,4 +5,5 @@ export type Options = {
|
|
|
5
5
|
cssModule: CssModuleObj;
|
|
6
6
|
cssModuleRoot?: string;
|
|
7
7
|
};
|
|
8
|
-
export
|
|
8
|
+
export type ClssMaker = (eltNames: EltNamesDescriptor, modNames?: ModsDescriptor) => string;
|
|
9
|
+
export declare function clss(blockNames: string | string[], options?: Options): ClssMaker;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/agnostic/css/clss/index.ts
|
|
2
2
|
function clss(blockNames, options) {
|
|
3
|
-
|
|
3
|
+
const blockNamesArr = Array.isArray(blockNames) ? blockNames : [blockNames];
|
|
4
4
|
return (eltNames, modNames = []) => {
|
|
5
5
|
const eltNamesArr = Array.isArray(eltNames) ? eltNames : [eltNames];
|
|
6
6
|
const modNamesArr = (Array.isArray(modNames) ? modNames : [modNames]).map((modName) => {
|
|
@@ -9,7 +9,7 @@ function clss(blockNames, options) {
|
|
|
9
9
|
return trueModNames;
|
|
10
10
|
}).flat();
|
|
11
11
|
const outputClassesArr = [];
|
|
12
|
-
|
|
12
|
+
blockNamesArr.forEach((compName) => {
|
|
13
13
|
eltNamesArr.forEach((eltName) => {
|
|
14
14
|
const targetPublicClss = eltName === null ? compName : `${compName}__${eltName}`;
|
|
15
15
|
const targetPrivateClss = eltName === null ? options?.cssModule[options.cssModuleRoot ?? "root"] : options?.cssModule[eltName];
|
|
@@ -64,6 +64,7 @@ var niceColors = [
|
|
|
64
64
|
var generateNiceColor = () => {
|
|
65
65
|
const pos = Math.floor(Math.random() * niceColors.length);
|
|
66
66
|
const found = niceColors[pos];
|
|
67
|
+
if (found === void 0) throw new Error("Could not generate color (should never happen)");
|
|
67
68
|
return found;
|
|
68
69
|
};
|
|
69
70
|
export {
|
package/agnostic/css/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
export * as bem from './bem/index.js'
|
|
1
2
|
export * as clss from './clss/index.js'
|
|
2
3
|
export * as generateNiceColor from './generate-nice-color/index.js'
|
|
3
|
-
export * as isValidCssClassName from './is-valid-css-class-name/index.js'
|
|
4
4
|
export * as scale from './scale/index.js'
|
|
5
|
-
export * as
|
|
5
|
+
export * as isValidCssClassName from './is-valid-css-class-name/index.js'
|
|
6
6
|
export * as stylesSet from './styles-set/index.js'
|
package/agnostic/css/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
export * as bem from './bem/index.js'
|
|
1
2
|
export * as clss from './clss/index.js'
|
|
2
3
|
export * as generateNiceColor from './generate-nice-color/index.js'
|
|
3
|
-
export * as isValidCssClassName from './is-valid-css-class-name/index.js'
|
|
4
4
|
export * as scale from './scale/index.js'
|
|
5
|
-
export * as
|
|
5
|
+
export * as isValidCssClassName from './is-valid-css-class-name/index.js'
|
|
6
6
|
export * as stylesSet from './styles-set/index.js'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component } from 'react';
|
|
1
|
+
import { Component, type JSX } from 'react';
|
|
2
2
|
export type StylesSetItem = {
|
|
3
3
|
type: 'string' | 'url';
|
|
4
4
|
content: string;
|
|
@@ -11,14 +11,14 @@ export declare class StylesSet {
|
|
|
11
11
|
static defaultPublicIDAttribute: string;
|
|
12
12
|
tagsPrivateIDAttribute: string;
|
|
13
13
|
tagsPublicIDAttribute: string;
|
|
14
|
-
private _items;
|
|
14
|
+
private readonly _items;
|
|
15
15
|
get items(): Map<string, StylesSetItem>;
|
|
16
16
|
private getTargetPosition;
|
|
17
17
|
setTagsPrivateIDAttribute(str: string): this;
|
|
18
18
|
setTagsPublicIDAttribute(str: string): this;
|
|
19
19
|
getById(id: string): StylesSetItem | undefined;
|
|
20
20
|
generateUniquePrivateId(): string;
|
|
21
|
-
private _rendered;
|
|
21
|
+
private readonly _rendered;
|
|
22
22
|
render(element: Element): this;
|
|
23
23
|
unmount(element: Element): this;
|
|
24
24
|
updateRendered(): this;
|
|
@@ -35,5 +35,5 @@ export type StylesSetCompProps = {
|
|
|
35
35
|
export declare class StylesSetComp extends Component<StylesSetCompProps> {
|
|
36
36
|
componentDidMount(): void;
|
|
37
37
|
componentDidUpdate(): void;
|
|
38
|
-
render():
|
|
38
|
+
render(): JSX.Element;
|
|
39
39
|
}
|
|
@@ -110,7 +110,7 @@ var StylesSet = class _StylesSet {
|
|
|
110
110
|
async getDomString(documentObj) {
|
|
111
111
|
const actualDocumentObj = documentObj ?? window.document;
|
|
112
112
|
if (actualDocumentObj === null) throw new Error("Window.document is not available");
|
|
113
|
-
return new Promise((resolve) => {
|
|
113
|
+
return await new Promise((resolve) => {
|
|
114
114
|
const tempElt = actualDocumentObj.createElement("div");
|
|
115
115
|
const tempRoot = reactCreateRoot(tempElt);
|
|
116
116
|
const { items } = this;
|
|
@@ -4,11 +4,13 @@ function makeSource(s) {
|
|
|
4
4
|
}
|
|
5
5
|
function from(source) {
|
|
6
6
|
function getMessage(code) {
|
|
7
|
-
const message = source[code]
|
|
7
|
+
const message = source[code]?.message;
|
|
8
|
+
if (message === void 0) throw new Error("Unknown code");
|
|
8
9
|
return message;
|
|
9
10
|
}
|
|
10
11
|
function getDetailsMaker(code) {
|
|
11
|
-
const maker = source[code]
|
|
12
|
+
const maker = source[code]?.detailsMaker;
|
|
13
|
+
if (maker === void 0) throw new Error("Unknown code");
|
|
12
14
|
return maker;
|
|
13
15
|
}
|
|
14
16
|
function getDetails(code, ...params) {
|