@design-edito/tools 0.3.9 → 0.3.11
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 +2 -2
- package/agnostic/arrays/index.js +2 -2
- 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 +54 -1
- package/agnostic/css/clss/index.js +3 -3
- package/agnostic/css/generate-nice-color/index.js +1 -0
- package/agnostic/css/index.d.ts +1 -1
- package/agnostic/css/index.js +1 -1
- package/agnostic/css/styles-set/index.d.ts +4 -4
- package/agnostic/css/styles-set/index.js +1 -1
- package/agnostic/errors/index.d.ts +1 -1
- package/agnostic/errors/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 +14 -14
- package/agnostic/html/hyper-json/smart-tags/coalesced/index.js +14 -14
- 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 +3 -3
- package/agnostic/html/hyper-json/smart-tags/isolated/index.js +3 -3
- 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 +5 -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/index.d.ts +1 -1
- package/agnostic/misc/crossenv/index.js +1 -1
- 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 +6 -6
- package/agnostic/misc/index.js +6 -6
- package/agnostic/misc/is-constructor-function/index.d.ts +1 -1
- package/agnostic/misc/logs/logger/index.d.ts +11 -1
- package/agnostic/misc/logs/logger/index.js +40 -10
- package/agnostic/misc/logs/styles/index.d.ts +1 -0
- package/agnostic/misc/logs/styles/index.js +27 -9
- 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 +5 -4
- package/agnostic/objects/index.js +5 -4
- 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 +1 -1
- package/agnostic/sanitization/index.js +1 -1
- 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 +3 -3
- package/agnostic/strings/index.js +3 -3
- 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/transitions/index.d.ts +3 -3
- package/agnostic/time/transitions/index.js +4 -4
- package/agnostic/time/wait/index.d.ts +2 -2
- package/agnostic/time/wait/index.js +1 -1
- package/components/Disclaimer/index.d.ts +45 -0
- package/components/Disclaimer/index.js +70 -0
- package/components/Drawer/index.d.ts +45 -0
- package/components/Drawer/index.js +82 -0
- package/components/Drawer/styles.module.css +0 -0
- package/components/EventListener/index.d.ts +20 -3
- package/components/EventListener/index.js +15 -22
- package/components/Gallery/index.d.ts +67 -0
- package/components/Gallery/index.js +173 -0
- package/components/Gallery/styles.module.css +33 -0
- package/components/Gallery/utils.d.ts +1 -0
- package/components/Image/index.d.ts +60 -0
- package/components/Image/index.js +99 -0
- package/components/Image/styles.module.css +0 -0
- package/components/IntersectionObserver/index.d.ts +48 -11
- package/components/IntersectionObserver/index.js +13 -22
- package/components/Paginator/index.d.ts +72 -0
- package/components/Paginator/index.js +116 -0
- package/components/Paginator/styles.module.css +9 -0
- package/components/ResizeObserver/index.d.ts +27 -0
- package/components/ResizeObserver/index.js +81 -0
- package/components/Scrllgngn/index.d.ts +123 -0
- package/components/Scrllgngn/index.js +175 -0
- package/components/Scrllgngn/styles.module.css +74 -0
- package/components/Sequencer/index.controlled.d.ts +78 -0
- package/components/Sequencer/index.d.ts +85 -0
- package/components/Sequencer/index.js +109 -0
- package/components/Sequencer/styles.module.css +0 -0
- package/components/ShadowRoot/index.d.ts +35 -0
- package/components/ShadowRoot/index.js +56 -0
- package/components/ShadowRoot/styles.module.css +0 -0
- package/components/Subtitles/index.d.ts +58 -0
- package/components/Subtitles/index.js +111 -0
- package/components/Subtitles/styles.module.css +0 -0
- package/components/Subtitles/types.d.ts +10 -0
- package/components/Subtitles/types.js +0 -0
- package/components/Subtitles/utils.d.ts +28 -0
- package/components/Theatre/index.d.ts +64 -0
- package/components/Theatre/index.js +97 -0
- package/components/Theatre/styles.module.css +0 -0
- package/components/Video/index.d.ts +119 -0
- package/components/Video/index.js +358 -0
- package/components/Video/styles.module.css +0 -0
- package/components/Video/utils.d.ts +10 -0
- package/components/_WIP_AudioQuote/index.d.ts +1 -0
- package/components/_WIP_AudioQuote/index.js +0 -0
- package/components/_WIP_Icon/index.d.ts +1 -0
- package/components/_WIP_Icon/index.js +0 -0
- package/components/index.d.ts +15 -1
- package/components/index.js +15 -1
- package/components/public-classnames.d.ts +14 -3
- package/components/utils/index.d.ts +1 -0
- package/components/utils/index.js +12 -0
- package/components/utils/types.d.ts +3 -0
- package/components/utils/types.js +0 -0
- package/node/@aws-s3/index.test.d.ts +1 -0
- 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/index.d.ts +1 -1
- package/node/@aws-s3/storage/directory/index.js +1 -1
- 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 +2 -2
- package/node/@aws-s3/storage/file/index.js +2 -2
- 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 +6 -6
- package/node/@google-cloud/storage/file/index.js +6 -6
- 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 +1 -1
- package/node/cloud-storage/operations/index.js +1 -1
- 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/encryption/index.d.ts +1 -1
- package/node/encryption/index.js +1 -1
- 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/index.d.ts +2 -2
- package/node/ftps/directory/index.js +2 -2
- 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 +1 -1
- package/node/ftps/file/index.js +1 -1
- 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 +1 -1
- package/node/images/index.js +1 -1
- 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 +2 -2
- package/node/index.js +2 -2
- package/node/process/prompt-continue/index.js +1 -1
- package/node/process/spawner/index.d.ts +61 -10
- package/node/process/spawner/index.js +15 -13
- 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 +2 -2
- package/node/sftp/file/index.js +2 -2
- 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 +2265 -14
- package/components/Input/index.d.ts +0 -7
- package/components/Input/index.js +0 -29
- /package/components/{Input → Disclaimer}/styles.module.css +0 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
position: relative;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
/* MAIN LAYOUTS (back / front blocks, scrolling content) */
|
|
6
|
+
|
|
7
|
+
.back-blocks {
|
|
8
|
+
z-index: 1;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.scrolling-content {
|
|
12
|
+
z-index: 2;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.front-blocks {
|
|
16
|
+
z-index: 3;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/* Scrllgngn entering the viewport, blocks not fixed yet */
|
|
20
|
+
.back-blocks,
|
|
21
|
+
.front-blocks,
|
|
22
|
+
.root.root--top-visible.root--content-visible .back-blocks,
|
|
23
|
+
.root.root--top-visible.root--content-visible .front-blocks {
|
|
24
|
+
position: absolute;
|
|
25
|
+
top: 0;
|
|
26
|
+
left: 0;
|
|
27
|
+
right: 0;
|
|
28
|
+
height: 100vh;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/*
|
|
32
|
+
Scrllgngn well in the viewport, fixed blocks
|
|
33
|
+
OR
|
|
34
|
+
Force stick blocks option
|
|
35
|
+
*/
|
|
36
|
+
.root.root--content-visible .back-blocks,
|
|
37
|
+
.root.root--content-visible .front-blocks,
|
|
38
|
+
|
|
39
|
+
.root.root--top-visible.root--content-visible.root--force-stick-blocks-before .back-blocks,
|
|
40
|
+
.root.root--top-visible.root--content-visible.root--force-stick-blocks-before .front-blocks,
|
|
41
|
+
.root.root--top-visible.root--content-visible.root--force-stick-blocks-both .back-blocks,
|
|
42
|
+
.root.root--top-visible.root--content-visible.root--force-stick-blocks-both .front-blocks,
|
|
43
|
+
|
|
44
|
+
.root.root--bottom-visible.root--content-visible.root--force-stick-blocks-after .back-blocks,
|
|
45
|
+
.root.root--bottom-visible.root--content-visible.root--force-stick-blocks-after .front-blocks,
|
|
46
|
+
.root.root--bottom-visible.root--content-visible.root--force-stick-blocks-both .back-blocks,
|
|
47
|
+
.root.root--bottom-visible.root--content-visible.root--force-stick-blocks-both .front-blocks {
|
|
48
|
+
position: fixed;
|
|
49
|
+
top: 0;
|
|
50
|
+
left: var(--PRIVATE-left);
|
|
51
|
+
width: var(--PRIVATE-width);
|
|
52
|
+
height: 100vh;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* Scrllgngn leaving the viewport, blocks not fixed but have offset */
|
|
56
|
+
.root.root--bottom-visible.root--content-visible .back-blocks,
|
|
57
|
+
.root.root--bottom-visible.root--content-visible .front-blocks {
|
|
58
|
+
position: absolute;
|
|
59
|
+
top: calc(var(--PRIVATE-height) - 100vh);
|
|
60
|
+
left: 0;
|
|
61
|
+
right: 0;
|
|
62
|
+
height: 100vh;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* INDIVIDUAL FIXED BLOCKS */
|
|
66
|
+
|
|
67
|
+
.back-block,
|
|
68
|
+
.front-block {
|
|
69
|
+
position: absolute;
|
|
70
|
+
top: 0;
|
|
71
|
+
bottom: 0;
|
|
72
|
+
left: 0;
|
|
73
|
+
right: 0;
|
|
74
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { type FunctionComponent, type PropsWithChildren } from 'react';
|
|
2
|
+
import type { WithClassName } from '../utils/types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Props for the {@link SequencerControlled} component.
|
|
5
|
+
*
|
|
6
|
+
* This is the low-level controlled interface. All state is driven externally —
|
|
7
|
+
* the component holds no internal state of its own. For the uncontrolled
|
|
8
|
+
* version that reacts to external events and derives these props automatically,
|
|
9
|
+
* see the default export of the parent module.
|
|
10
|
+
*
|
|
11
|
+
* @property step - Zero-based index of the currently active step. Determines
|
|
12
|
+
* which child is marked active, which are previous, and which are next.
|
|
13
|
+
* Defaults to `0`.
|
|
14
|
+
* @property activateOnStep - Optional 2D array that overrides the default
|
|
15
|
+
* one-child-per-step activation logic. Each entry at index `i` is the list of
|
|
16
|
+
* child indices that should be active when `step === i`, allowing multiple
|
|
17
|
+
* children to be simultaneously active on a given step. When omitted, exactly
|
|
18
|
+
* one child is active at a time (the child at index `step`).
|
|
19
|
+
* @property _modifiers - Internal modifier flags forwarded directly to the
|
|
20
|
+
* BEM class builder on the root element. Intended to be injected by the
|
|
21
|
+
* uncontrolled wrapper; avoid setting manually in consumer code.
|
|
22
|
+
* - `playing` — sequence is currently progressing.
|
|
23
|
+
* - `at-start` — current step is the first step.
|
|
24
|
+
* - `at-end` — current step is the last step.
|
|
25
|
+
* @property _dataAttributes - Internal data attribute values forwarded to the
|
|
26
|
+
* root element as `data-<key>`. Intended to be injected by the uncontrolled
|
|
27
|
+
* wrapper; avoid setting manually in consumer code.
|
|
28
|
+
* - `tempo` — exposed as `data-tempo`, reflects the current playback tempo.
|
|
29
|
+
* @property className - Optional additional class name(s) applied to the root element.
|
|
30
|
+
* @property children - The items to sequence. Each child is wrapped in a
|
|
31
|
+
* classifier `<div>` and receives one of the `--active`, `--previous`, or
|
|
32
|
+
* `--next` modifiers depending on its position relative to the current `step`.
|
|
33
|
+
*/
|
|
34
|
+
export type ControlledProps = PropsWithChildren<WithClassName<{
|
|
35
|
+
step?: number;
|
|
36
|
+
activateOnStep?: number[][];
|
|
37
|
+
_modifiers?: {
|
|
38
|
+
playing?: boolean;
|
|
39
|
+
'at-start'?: boolean;
|
|
40
|
+
'at-end'?: boolean;
|
|
41
|
+
};
|
|
42
|
+
_dataAttributes?: {
|
|
43
|
+
tempo?: number;
|
|
44
|
+
};
|
|
45
|
+
}>>;
|
|
46
|
+
/**
|
|
47
|
+
* Controlled sequencer component. Renders each child inside a classifier
|
|
48
|
+
* wrapper and assigns step-relative modifiers based on `step` and the optional
|
|
49
|
+
* `activateOnStep` override map.
|
|
50
|
+
*
|
|
51
|
+
* This component is purely presentational and holds no internal state.
|
|
52
|
+
* It is designed to be driven by the uncontrolled wrapper, which handles
|
|
53
|
+
* timing, playback events, and derives the props passed here.
|
|
54
|
+
*
|
|
55
|
+
* ### Root element modifiers
|
|
56
|
+
* The root `<div>` receives the public class name defined by `sequencer` and
|
|
57
|
+
* the following BEM-style modifier classes, sourced from `_modifiers`:
|
|
58
|
+
* - `--playing` — when the sequence is actively progressing.
|
|
59
|
+
* - `--at-start` — when the current step is the first step.
|
|
60
|
+
* - `--at-end` — when the current step is the last step.
|
|
61
|
+
*
|
|
62
|
+
* ### Data attributes on the root element
|
|
63
|
+
* Derived from `_dataAttributes`, each key is prefixed with `data-`:
|
|
64
|
+
* - `data-tempo` — current playback tempo, when provided.
|
|
65
|
+
*
|
|
66
|
+
* ### Child wrapper elements
|
|
67
|
+
* Each child is wrapped in a `<div>` with the `__child` element class and
|
|
68
|
+
* exactly one of the following mutually exclusive modifiers:
|
|
69
|
+
* - `--active` — this child corresponds to the current step (or is included
|
|
70
|
+
* in `activateOnStep[step]`).
|
|
71
|
+
* - `--previous` — this child was active in a prior step.
|
|
72
|
+
* - `--next` — this child has not yet been reached.
|
|
73
|
+
*
|
|
74
|
+
* @param props - Component properties.
|
|
75
|
+
* @see {@link ControlledProps}
|
|
76
|
+
* @returns A root `<div>` containing one classifier wrapper per child.
|
|
77
|
+
*/
|
|
78
|
+
export declare const SequencerControlled: FunctionComponent<ControlledProps>;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { type FunctionComponent } from 'react';
|
|
2
|
+
import { type Props as IOCompProps } from '../IntersectionObserver/index.js';
|
|
3
|
+
import { type ControlledProps } from './index.controlled.js';
|
|
4
|
+
/**
|
|
5
|
+
* Props for the {@link Sequencer} component.
|
|
6
|
+
*
|
|
7
|
+
* Extends {@link ControlledProps} (minus `_modifiers`, which are derived
|
|
8
|
+
* internally) with uncontrolled playback and viewport-driven behaviour.
|
|
9
|
+
*
|
|
10
|
+
* @property defaultStep - Initial step index when running in uncontrolled mode.
|
|
11
|
+
* Ignored if `step` is provided. Defaults to `0`.
|
|
12
|
+
* @property tempo - Playback speed in beats per minute. The interval between
|
|
13
|
+
* steps is derived as `1000 / (tempo / 60)` ms. Clamped to a minimum of `1`.
|
|
14
|
+
* Defaults to `60`.
|
|
15
|
+
* @property play - Controlled play state. When provided, overrides the internal
|
|
16
|
+
* play state. The auto-advance interval only runs when this is `true`.
|
|
17
|
+
* @property loop - When `true`, the step wraps around using absolute modulo so
|
|
18
|
+
* it never exceeds the number of steps.
|
|
19
|
+
* @property clampFirst - When `true` (and `loop` is `false`), clamps the step
|
|
20
|
+
* to `0` at the lower bound, preventing negative step values.
|
|
21
|
+
* @property clampLast - When `true` (and `loop` is `false`), clamps the step
|
|
22
|
+
* to `stepsCount - 1` at the upper bound, preventing overflow.
|
|
23
|
+
* @property resetOnVisible - When `true`, resets the internal step to `0` each
|
|
24
|
+
* time the component enters the viewport. No-op when `step` or `play` is controlled.
|
|
25
|
+
* @property resetOnHidden - When `true`, resets the internal step to `0` each
|
|
26
|
+
* time the component leaves the viewport. No-op when `step` or `play` is controlled.
|
|
27
|
+
* @property playOnVisible - When `true`, starts internal playback when the
|
|
28
|
+
* component enters the viewport. No-op when `play` is controlled.
|
|
29
|
+
* @property pauseOnHidden - When `true`, pauses internal playback when the
|
|
30
|
+
* component leaves the viewport. No-op when `play` is controlled.
|
|
31
|
+
* @property actionHandlers - Optional handlers for imperative actions triggered
|
|
32
|
+
* by external events:
|
|
33
|
+
* - `intersected` — forwarded verbatim to the internal
|
|
34
|
+
* {@link IntersectionObserverComponent}'s `onIntersected`, called on every
|
|
35
|
+
* intersection change regardless of controlled state.
|
|
36
|
+
* @property stateHandlers - Optional callbacks invoked when derived state changes:
|
|
37
|
+
* - `isPlaying` — called with the new play state whenever it changes.
|
|
38
|
+
* - `stepChanged` — called with the new forwarded step index whenever it changes.
|
|
39
|
+
*/
|
|
40
|
+
export type Props = Omit<ControlledProps, '_modifiers'> & {
|
|
41
|
+
defaultStep?: number;
|
|
42
|
+
tempo?: number;
|
|
43
|
+
play?: boolean;
|
|
44
|
+
loop?: boolean;
|
|
45
|
+
clampFirst?: boolean;
|
|
46
|
+
clampLast?: boolean;
|
|
47
|
+
resetOnVisible?: boolean;
|
|
48
|
+
resetOnHidden?: boolean;
|
|
49
|
+
playOnVisible?: boolean;
|
|
50
|
+
pauseOnHidden?: boolean;
|
|
51
|
+
actionHandlers?: {
|
|
52
|
+
intersected?: IOCompProps['onIntersected'];
|
|
53
|
+
};
|
|
54
|
+
stateHandlers?: {
|
|
55
|
+
isPlaying?: (isPlaying: boolean) => void;
|
|
56
|
+
stepChanged?: (step: number) => void;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Uncontrolled, self-advancing sequencer component. Drives a
|
|
61
|
+
* {@link SequencerControlled} instance with an internal tempo-based interval,
|
|
62
|
+
* optional loop/clamp boundary behaviour, and viewport-driven play/reset triggers
|
|
63
|
+
* via an {@link IntersectionObserverComponent}.
|
|
64
|
+
*
|
|
65
|
+
* Supports mixed controlled/uncontrolled usage: passing `step` disables the
|
|
66
|
+
* internal interval while still applying loop/clamp arithmetic before forwarding
|
|
67
|
+
* to the controlled layer. Passing `play` disables internal play state management
|
|
68
|
+
* while still allowing viewport handlers to fire `actionHandlers.intersected`.
|
|
69
|
+
*
|
|
70
|
+
* ### Forwarded modifiers to {@link SequencerControlled}
|
|
71
|
+
* The following `_modifiers` are computed and injected automatically:
|
|
72
|
+
* - `playing` — `true` when the effective play state is active.
|
|
73
|
+
* - `at-start` — `true` when the forwarded step is `0`.
|
|
74
|
+
* - `at-end` — `true` when the forwarded step equals `stepsCount - 1`.
|
|
75
|
+
*
|
|
76
|
+
* ### Forwarded data attributes to {@link SequencerControlled}
|
|
77
|
+
* - `data-tempo` — the current `tempo` value.
|
|
78
|
+
*
|
|
79
|
+
* @param props - Component properties.
|
|
80
|
+
* @see {@link Props}
|
|
81
|
+
* @see {@link SequencerControlled}
|
|
82
|
+
* @returns An {@link IntersectionObserverComponent} wrapping a
|
|
83
|
+
* {@link SequencerControlled} with the computed step and modifiers applied.
|
|
84
|
+
*/
|
|
85
|
+
export declare const Sequencer: FunctionComponent<Props>;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
// src/components/Sequencer/index.tsx
|
|
2
|
+
import {
|
|
3
|
+
useState,
|
|
4
|
+
useEffect,
|
|
5
|
+
useCallback,
|
|
6
|
+
Children,
|
|
7
|
+
useRef
|
|
8
|
+
} from "react";
|
|
9
|
+
import { absoluteModulo } from "../../agnostic/numbers/absolute-modulo/index.js";
|
|
10
|
+
import { clamp } from "../../agnostic/numbers/clamp/index.js";
|
|
11
|
+
import {
|
|
12
|
+
IntersectionObserverComponent
|
|
13
|
+
} from "../IntersectionObserver/index.js";
|
|
14
|
+
import {
|
|
15
|
+
SequencerControlled
|
|
16
|
+
} from "./index.controlled.js";
|
|
17
|
+
import { jsx } from "react/jsx-runtime";
|
|
18
|
+
var Sequencer = ({
|
|
19
|
+
defaultStep,
|
|
20
|
+
tempo = 60,
|
|
21
|
+
play,
|
|
22
|
+
loop,
|
|
23
|
+
clampFirst,
|
|
24
|
+
clampLast,
|
|
25
|
+
resetOnVisible,
|
|
26
|
+
resetOnHidden,
|
|
27
|
+
playOnVisible,
|
|
28
|
+
pauseOnHidden,
|
|
29
|
+
actionHandlers,
|
|
30
|
+
stateHandlers,
|
|
31
|
+
...controlledProps
|
|
32
|
+
}) => {
|
|
33
|
+
const { step, activateOnStep, children } = controlledProps;
|
|
34
|
+
const [internalPlay, setInternalPlay] = useState(play ?? false);
|
|
35
|
+
const [internalStep, setInternalStep] = useState(step ?? defaultStep ?? 0);
|
|
36
|
+
const actualPlay = play ?? internalPlay;
|
|
37
|
+
const actualStep = step ?? internalStep;
|
|
38
|
+
const actualPlayRef = useRef(actualPlay);
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
const clampedTempo = Math.max(tempo, 1);
|
|
41
|
+
if (!actualPlay || step !== void 0) return;
|
|
42
|
+
const interval = window.setInterval(() => {
|
|
43
|
+
setInternalStep((s) => s + 1);
|
|
44
|
+
}, 1e3 / (clampedTempo / 60));
|
|
45
|
+
return () => window.clearInterval(interval);
|
|
46
|
+
}, [actualPlay, tempo, step]);
|
|
47
|
+
const stepsCount = activateOnStep !== void 0 ? activateOnStep.length : Children.toArray(children).length;
|
|
48
|
+
let forwardedStep;
|
|
49
|
+
if (loop === true) {
|
|
50
|
+
forwardedStep = absoluteModulo(actualStep, stepsCount);
|
|
51
|
+
} else {
|
|
52
|
+
const leftClamp = clampFirst === true ? 0 : -Infinity;
|
|
53
|
+
const rightClamp = clampLast === true ? stepsCount - 1 : Infinity;
|
|
54
|
+
forwardedStep = clamp(actualStep, leftClamp, rightClamp);
|
|
55
|
+
}
|
|
56
|
+
const forwardedStepRef = useRef(forwardedStep);
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
if (actualPlay !== actualPlayRef.current) {
|
|
59
|
+
actualPlayRef.current = actualPlay;
|
|
60
|
+
stateHandlers?.isPlaying?.(actualPlay);
|
|
61
|
+
}
|
|
62
|
+
if (forwardedStep !== forwardedStepRef.current) {
|
|
63
|
+
forwardedStepRef.current = forwardedStep;
|
|
64
|
+
stateHandlers?.stepChanged?.(forwardedStep);
|
|
65
|
+
}
|
|
66
|
+
}, [actualPlay, forwardedStep]);
|
|
67
|
+
const handleIntersection = useCallback(({ ioEntry, observer }) => {
|
|
68
|
+
if (play === true || step !== void 0) return;
|
|
69
|
+
const { isIntersecting } = ioEntry ?? {};
|
|
70
|
+
actionHandlers?.intersected?.({ ioEntry, observer });
|
|
71
|
+
if (isIntersecting === true) {
|
|
72
|
+
if (resetOnVisible === true) setInternalStep(0);
|
|
73
|
+
if (playOnVisible === true) setInternalPlay(true);
|
|
74
|
+
} else {
|
|
75
|
+
if (resetOnHidden === true) setInternalStep(0);
|
|
76
|
+
if (pauseOnHidden === true) setInternalPlay(false);
|
|
77
|
+
}
|
|
78
|
+
}, [
|
|
79
|
+
resetOnVisible,
|
|
80
|
+
playOnVisible,
|
|
81
|
+
resetOnHidden,
|
|
82
|
+
pauseOnHidden,
|
|
83
|
+
play,
|
|
84
|
+
step,
|
|
85
|
+
actionHandlers
|
|
86
|
+
]);
|
|
87
|
+
return /* @__PURE__ */ jsx(
|
|
88
|
+
IntersectionObserverComponent,
|
|
89
|
+
{
|
|
90
|
+
onIntersected: handleIntersection,
|
|
91
|
+
children: /* @__PURE__ */ jsx(
|
|
92
|
+
SequencerControlled,
|
|
93
|
+
{
|
|
94
|
+
...controlledProps,
|
|
95
|
+
step: forwardedStep,
|
|
96
|
+
_modifiers: {
|
|
97
|
+
playing: actualPlay,
|
|
98
|
+
"at-start": forwardedStep === 0,
|
|
99
|
+
"at-end": forwardedStep === stepsCount - 1
|
|
100
|
+
},
|
|
101
|
+
_dataAttributes: { tempo }
|
|
102
|
+
}
|
|
103
|
+
)
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
};
|
|
107
|
+
export {
|
|
108
|
+
Sequencer
|
|
109
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type PropsWithChildren, type FunctionComponent } from 'react';
|
|
2
|
+
import type { WithClassName } from '../utils/types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Props for the ShadowRootComponent.
|
|
5
|
+
*
|
|
6
|
+
* @property className - Optional additional class name(s) applied to the host element
|
|
7
|
+
* that owns the Shadow Root.
|
|
8
|
+
* @property mode - Shadow DOM mode. `"open"` exposes the shadowRoot via `element.shadowRoot`,
|
|
9
|
+
* `"closed"` keeps it inaccessible from the outside. Defaults to `"open"`.
|
|
10
|
+
* @property delegatesFocus - When true, enables focus delegation from the host
|
|
11
|
+
* to the first focusable element inside the Shadow Root.
|
|
12
|
+
* @property slotAssignment - Slot assignment mode. `"named"` uses standard named slot behavior,
|
|
13
|
+
* `"manual"` requires manual slot assignment via `HTMLSlotElement.assign()`.
|
|
14
|
+
* @property adoptedStyleSheets - Array of constructable `CSSStyleSheet` instances
|
|
15
|
+
* assigned to `shadowRoot.adoptedStyleSheets` (if supported by the browser).
|
|
16
|
+
* @property injectedStyles - Raw CSS string injected into the Shadow Root inside a `<style>` element.
|
|
17
|
+
* Useful as a fallback when constructable stylesheets are not used.
|
|
18
|
+
* @property children - React children rendered inside the Shadow Root via a React portal.
|
|
19
|
+
*/
|
|
20
|
+
export type Props = PropsWithChildren<WithClassName<{
|
|
21
|
+
mode?: 'open' | 'closed';
|
|
22
|
+
delegatesFocus?: boolean;
|
|
23
|
+
slotAssignment?: 'named' | 'manual';
|
|
24
|
+
adoptedStyleSheets?: CSSStyleSheet[];
|
|
25
|
+
injectedStyles?: string;
|
|
26
|
+
}>>;
|
|
27
|
+
/**
|
|
28
|
+
* Component that creates a Shadow Root on its host element and renders
|
|
29
|
+
* its children inside that Shadow Root using a React portal.
|
|
30
|
+
*
|
|
31
|
+
* @param props - Component properties
|
|
32
|
+
* @see {@link Props}
|
|
33
|
+
* @returns A host `div` element that owns the created Shadow Root.
|
|
34
|
+
*/
|
|
35
|
+
export declare const ShadowRootComponent: FunctionComponent<Props>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// src/components/ShadowRoot/index.tsx
|
|
2
|
+
import {
|
|
3
|
+
useRef,
|
|
4
|
+
useEffect,
|
|
5
|
+
useState
|
|
6
|
+
} from "react";
|
|
7
|
+
import { createPortal } from "react-dom";
|
|
8
|
+
import { clss } from "../../agnostic/css/clss/index.js";
|
|
9
|
+
import { shadowRoot as publicClassName } from "../public-classnames.js";
|
|
10
|
+
import { mergeClassNames } from "../utils/index.js";
|
|
11
|
+
import cssModule from "./styles.module.css";
|
|
12
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
+
var ShadowRootComponent = ({
|
|
14
|
+
mode = "open",
|
|
15
|
+
delegatesFocus,
|
|
16
|
+
slotAssignment,
|
|
17
|
+
adoptedStyleSheets,
|
|
18
|
+
injectedStyles,
|
|
19
|
+
className,
|
|
20
|
+
children
|
|
21
|
+
}) => {
|
|
22
|
+
const hostRef = useRef(null);
|
|
23
|
+
const [shadowRoot, setShadowRoot] = useState(null);
|
|
24
|
+
const [styles, setStyles] = useState(injectedStyles);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (hostRef.current === null || shadowRoot !== null) return;
|
|
27
|
+
const root = hostRef.current.attachShadow({ mode, delegatesFocus, slotAssignment });
|
|
28
|
+
if (adoptedStyleSheets !== void 0 && "adoptedStyleSheets" in root) {
|
|
29
|
+
root.adoptedStyleSheets = adoptedStyleSheets;
|
|
30
|
+
}
|
|
31
|
+
if (injectedStyles !== void 0) setStyles(injectedStyles);
|
|
32
|
+
setShadowRoot(root);
|
|
33
|
+
}, [
|
|
34
|
+
mode,
|
|
35
|
+
delegatesFocus,
|
|
36
|
+
slotAssignment,
|
|
37
|
+
adoptedStyleSheets,
|
|
38
|
+
injectedStyles
|
|
39
|
+
]);
|
|
40
|
+
const c = clss(publicClassName, { cssModule });
|
|
41
|
+
const rootClss = mergeClassNames(c(), className);
|
|
42
|
+
return /* @__PURE__ */ jsx(
|
|
43
|
+
"div",
|
|
44
|
+
{
|
|
45
|
+
ref: hostRef,
|
|
46
|
+
className: rootClss,
|
|
47
|
+
children: shadowRoot !== null && createPortal(/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
48
|
+
styles !== void 0 && /* @__PURE__ */ jsx("style", { children: styles }),
|
|
49
|
+
children
|
|
50
|
+
] }), shadowRoot)
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
export {
|
|
55
|
+
ShadowRootComponent
|
|
56
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { type FunctionComponent, type PropsWithChildren } from 'react';
|
|
2
|
+
import type { WithClassName } from '../utils/types.js';
|
|
3
|
+
import type { ParsedSub } from './types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Props for the {@link Subtitles} component.
|
|
6
|
+
*
|
|
7
|
+
* @property src - URL of an SRT file to fetch. Ignored if `srtFileContent` is provided.
|
|
8
|
+
* If both are undefined, no subtitles are loaded.
|
|
9
|
+
* @property srtFileContent - Raw SRT string used directly, bypassing any network fetch.
|
|
10
|
+
* Takes precedence over `src`.
|
|
11
|
+
* @property subsGroups - Optional array of subtitle IDs that act as group boundaries,
|
|
12
|
+
* splitting the full subtitle list into named sections. If omitted, all subtitles
|
|
13
|
+
* belong to a single group.
|
|
14
|
+
* @property timecodeMs - Current media position in milliseconds. Drives which subtitles
|
|
15
|
+
* receive the `--prev` and `--curr` modifiers. When `undefined`, nothing is rendered.
|
|
16
|
+
* @property isEnded - When `true`, forces the last group to be treated as current,
|
|
17
|
+
* regardless of `timecodeMs`. Useful to keep the final subtitle group visible after
|
|
18
|
+
* media playback finishes.
|
|
19
|
+
* @property onLoaded - Callback invoked with the raw SRT string after a successful
|
|
20
|
+
* fetch and parse. Not called when `srtFileContent` is used directly.
|
|
21
|
+
* @property onParsed - Callback invoked with the raw SRT string has been parsed.
|
|
22
|
+
* @property onLoadFailed - Callback invoked with an `Error` if the fetch or parse step fails.
|
|
23
|
+
* @property className - Optional additional class name(s) applied to the root element.
|
|
24
|
+
* @property children - React children rendered inside the root element, after the subtitle groups.
|
|
25
|
+
*/
|
|
26
|
+
export type Props = PropsWithChildren<WithClassName<{
|
|
27
|
+
src?: string;
|
|
28
|
+
srtFileContent?: string;
|
|
29
|
+
subsGroups?: number[];
|
|
30
|
+
timecodeMs?: number;
|
|
31
|
+
isEnded?: boolean;
|
|
32
|
+
onLoaded?: (subs: string) => void;
|
|
33
|
+
onParsed?: (subs: ParsedSub[]) => void;
|
|
34
|
+
onLoadFailed?: (error: Error) => void;
|
|
35
|
+
}>>;
|
|
36
|
+
/**
|
|
37
|
+
* Subtitle synchronization component. Fetches or receives an SRT source, parses it,
|
|
38
|
+
* and renders subtitle groups whose individual spans are styled according to the
|
|
39
|
+
* current media timecode.
|
|
40
|
+
*
|
|
41
|
+
* ### Group elements
|
|
42
|
+
* Each subtitle group is a `<div>` with the following:
|
|
43
|
+
* - `--curr` modifier when the group contains the subtitle at the current timecode.
|
|
44
|
+
* - `data-start-sub-pos` — ID of the first subtitle in the group.
|
|
45
|
+
* - `data-end-sub-pos` — ID of the last subtitle in the group.
|
|
46
|
+
*
|
|
47
|
+
* ### Subtitle span elements
|
|
48
|
+
* Each individual subtitle is a `<span>` with the following:
|
|
49
|
+
* - `--prev` modifier when the subtitle's start time is at or before the last elapsed subtitle.
|
|
50
|
+
* - `--curr` modifier when `timecodeMs` falls within the subtitle's `[start, end]` interval.
|
|
51
|
+
* - `data-sub-pos` — the subtitle's numeric ID from the SRT source.
|
|
52
|
+
*
|
|
53
|
+
* @param props - Component properties.
|
|
54
|
+
* @see {@link Props}
|
|
55
|
+
* @returns A root `<div>` containing the rendered subtitle groups, or an empty `<div>`
|
|
56
|
+
* when `timecodeMs` is undefined or no subtitles have been parsed yet.
|
|
57
|
+
*/
|
|
58
|
+
export declare const Subtitles: FunctionComponent<Props>;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
// src/components/Subtitles/index.tsx
|
|
2
|
+
import {
|
|
3
|
+
useCallback,
|
|
4
|
+
useEffect,
|
|
5
|
+
useRef,
|
|
6
|
+
useState
|
|
7
|
+
} from "react";
|
|
8
|
+
import { clss } from "../../agnostic/css/clss/index.js";
|
|
9
|
+
import { toError } from "../../agnostic/misc/cast/index.js";
|
|
10
|
+
import { unknownToString } from "../../agnostic/errors/unknown-to-string/index.js";
|
|
11
|
+
import { mergeClassNames } from "../utils/index.js";
|
|
12
|
+
import { subtitles as publicClassName } from "../public-classnames.js";
|
|
13
|
+
import {
|
|
14
|
+
computeSubGroupsWithBoundaries,
|
|
15
|
+
getCurrentGroup,
|
|
16
|
+
parseSubs
|
|
17
|
+
} from "./utils.js";
|
|
18
|
+
import cssModule from "./styles.module.css";
|
|
19
|
+
import { jsx } from "react/jsx-runtime";
|
|
20
|
+
var Subtitles = ({
|
|
21
|
+
src,
|
|
22
|
+
srtFileContent,
|
|
23
|
+
subsGroups,
|
|
24
|
+
timecodeMs,
|
|
25
|
+
isEnded,
|
|
26
|
+
className,
|
|
27
|
+
onLoaded,
|
|
28
|
+
onParsed,
|
|
29
|
+
onLoadFailed
|
|
30
|
+
}) => {
|
|
31
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
32
|
+
const [loadError, setLoadError] = useState(null);
|
|
33
|
+
const [parsedSubs, setParsedSubs] = useState([]);
|
|
34
|
+
const pParsedSubs = useRef(parsedSubs);
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
if (pParsedSubs.current === parsedSubs) return;
|
|
37
|
+
onParsed?.(parsedSubs);
|
|
38
|
+
}, [parsedSubs]);
|
|
39
|
+
const fetchAndParseSubs = useCallback(async (src2, srtFileContent2) => {
|
|
40
|
+
if (src2 === void 0) return;
|
|
41
|
+
if (srtFileContent2 !== void 0) return setParsedSubs(parseSubs(srtFileContent2));
|
|
42
|
+
setIsLoading(true);
|
|
43
|
+
setLoadError(null);
|
|
44
|
+
try {
|
|
45
|
+
const response = await fetch(src2);
|
|
46
|
+
const srtContent = await response.text();
|
|
47
|
+
onLoaded?.(srtContent);
|
|
48
|
+
const parsedSubs2 = parseSubs(srtContent);
|
|
49
|
+
setParsedSubs(parsedSubs2);
|
|
50
|
+
} catch (error) {
|
|
51
|
+
setLoadError(error instanceof Error ? error : new Error(unknownToString(error)));
|
|
52
|
+
console.error(error);
|
|
53
|
+
onLoadFailed?.(toError(error));
|
|
54
|
+
} finally {
|
|
55
|
+
setIsLoading(false);
|
|
56
|
+
}
|
|
57
|
+
}, [onLoadFailed, onLoaded]);
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
fetchAndParseSubs(src, srtFileContent).catch((error) => {
|
|
60
|
+
console.error(error);
|
|
61
|
+
});
|
|
62
|
+
}, [fetchAndParseSubs, src, srtFileContent]);
|
|
63
|
+
const c = clss(publicClassName, { cssModule });
|
|
64
|
+
const rootClss = mergeClassNames(
|
|
65
|
+
c(null, {
|
|
66
|
+
loading: isLoading,
|
|
67
|
+
error: loadError !== null
|
|
68
|
+
}),
|
|
69
|
+
className
|
|
70
|
+
);
|
|
71
|
+
const prevSubs = parsedSubs.filter(({ start }) => start != null && start < (timecodeMs ?? 0));
|
|
72
|
+
const lastPrevSub = prevSubs[prevSubs.length - 1];
|
|
73
|
+
const highestSubId = Math.max(...parsedSubs.map((sub) => sub.id));
|
|
74
|
+
const subsGroupsWithBoundaries = computeSubGroupsWithBoundaries(subsGroups, highestSubId);
|
|
75
|
+
const currentGroup = getCurrentGroup(subsGroupsWithBoundaries, lastPrevSub?.id, isEnded);
|
|
76
|
+
return /* @__PURE__ */ jsx("div", { className: rootClss, children: timecodeMs !== void 0 && parsedSubs.length > 0 && subsGroupsWithBoundaries.map((group) => {
|
|
77
|
+
const groupSubs = parsedSubs.filter((sub) => sub.id >= group.startId && sub.id <= group.endId);
|
|
78
|
+
const totalSubs = groupSubs.length;
|
|
79
|
+
const groupClass = c("group", { curr: currentGroup?.startId === group.startId });
|
|
80
|
+
const subsNodes = groupSubs.map((sub, subIndex) => {
|
|
81
|
+
let subText = sub.content?.trim() ?? "";
|
|
82
|
+
if (subIndex !== totalSubs - 1) subText += " ";
|
|
83
|
+
const subClass = c("sub", {
|
|
84
|
+
prev: sub.start !== void 0 && lastPrevSub?.start !== void 0 && sub.start <= lastPrevSub.start,
|
|
85
|
+
curr: sub.start !== void 0 && timecodeMs >= sub.start && sub.end !== void 0 && timecodeMs <= sub.end
|
|
86
|
+
});
|
|
87
|
+
return /* @__PURE__ */ jsx(
|
|
88
|
+
"span",
|
|
89
|
+
{
|
|
90
|
+
className: subClass,
|
|
91
|
+
"data-sub-pos": sub.id,
|
|
92
|
+
children: subText
|
|
93
|
+
},
|
|
94
|
+
sub.id
|
|
95
|
+
);
|
|
96
|
+
});
|
|
97
|
+
return /* @__PURE__ */ jsx(
|
|
98
|
+
"div",
|
|
99
|
+
{
|
|
100
|
+
className: groupClass,
|
|
101
|
+
"data-start-sub-pos": group.startId,
|
|
102
|
+
"data-end-sub-pos": group.endId,
|
|
103
|
+
children: subsNodes
|
|
104
|
+
},
|
|
105
|
+
group.startId
|
|
106
|
+
);
|
|
107
|
+
}) });
|
|
108
|
+
};
|
|
109
|
+
export {
|
|
110
|
+
Subtitles
|
|
111
|
+
};
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ParsedSub, SubGroupBoundaries } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Convertit un timecode au format SRT (hh:mm:ss,ms) en millisecondes.
|
|
4
|
+
* @param timecode - Timecode sous forme de chaîne (ex: '00:01:23,456')
|
|
5
|
+
* @returns Le temps en millisecondes
|
|
6
|
+
*/
|
|
7
|
+
export declare const getTimecodeToMs: (timecode: string) => number;
|
|
8
|
+
/**
|
|
9
|
+
* Parse un texte brut de sous-titres SRT en une liste d'objets ParsedSub.
|
|
10
|
+
* @param rawSubs - Sous-titres bruts au format SRT
|
|
11
|
+
* @returns Tableau d'objets ParsedSub
|
|
12
|
+
*/
|
|
13
|
+
export declare const parseSubs: (rawSubs: string) => ParsedSub[];
|
|
14
|
+
/**
|
|
15
|
+
* Calcule les groupes de sous-titres avec leurs bornes (startId, endId).
|
|
16
|
+
* @param subsGroups - Tableau d'IDs de fin de groupe
|
|
17
|
+
* @param highestSubId - ID le plus élevé des sous-titres
|
|
18
|
+
* @returns Tableau de SubGroupBoundaries
|
|
19
|
+
*/
|
|
20
|
+
export declare const computeSubGroupsWithBoundaries: (subsGroups: number[] | undefined, highestSubId: number) => SubGroupBoundaries[];
|
|
21
|
+
/**
|
|
22
|
+
* Retourne le groupe de sous-titres courant selon l'ID du dernier sous-titre précédent et l'état.
|
|
23
|
+
* @param subsGroupsWithBoundaries - Tableau des groupes avec bornes
|
|
24
|
+
* @param lastPrevSubId - ID du dernier sous-titre précédent
|
|
25
|
+
* @param isEnded - Indique si la lecture est terminée
|
|
26
|
+
* @returns Le groupe courant ou undefined
|
|
27
|
+
*/
|
|
28
|
+
export declare const getCurrentGroup: (subsGroupsWithBoundaries: SubGroupBoundaries[], lastPrevSubId: number | undefined, isEnded: boolean | undefined) => SubGroupBoundaries | undefined;
|