{"_id":"@annoyingmouse/wc-trim-middle","_rev":"3-aab022f9ba54ad4edd6cbac823036719","name":"@annoyingmouse/wc-trim-middle","dist-tags":{"latest":"1.4.0"},"versions":{"1.0.1":{"name":"@annoyingmouse/wc-trim-middle","version":"1.0.1","keywords":["progress","web-component"],"author":{"name":"Dominic Myers"},"license":"MIT","_id":"@annoyingmouse/wc-trim-middle@1.0.1","maintainers":[{"name":"annoyingmouse","email":"annoyingmouse@gmail.com"}],"homepage":"https://github.com/annoyingmouse/wc-trim-middle#readme","bugs":{"url":"https://github.com/annoyingmouse/wc-trim-middle/issues"},"dist":{"shasum":"8b477e15e019fa4e53d2ff6d55e7443c4c5bd8e5","tarball":"https://registry.npmjs.org/@annoyingmouse/wc-trim-middle/-/wc-trim-middle-1.0.1.tgz","fileCount":8,"integrity":"sha512-uXS8pjT9d/LFs9kHareK9KFMrX7Qp1K3FHo+xzcrGJodcG9hQWmd/Hs9YCxWvPcLODnMtdHEQlN79veCifPbug==","signatures":[{"sig":"MEYCIQCXca/X1/uNMZky9iplW4HW02bGbTvTHnSAe/j8YhhriAIhALeQSSKUmgUWtEFTegmypllof6+kKeTgmZAn+BZ+0jX1","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":19723},"main":"wc-trim-middle.js","gitHead":"769ca5dfa73809772c8e8d0a1365157243a6a8fe","scripts":{"test":"echo \"No test specified\"","build":"rollup -c"},"_npmUser":{"name":"annoyingmouse","email":"annoyingmouse@gmail.com"},"prettier":{"semi":false,"singleQuote":true},"repository":{"url":"git+https://github.com/annoyingmouse/wc-trim-middle.git","type":"git"},"_npmVersion":"10.9.0","description":"This web component was inspired by Chris Heilmann and does not trim strings that don’t fit the space at the end, but in the middle of the string","directories":{},"_nodeVersion":"22.12.0","dependencies":{"np":"^10.1.0"},"_hasShrinkwrap":false,"devDependencies":{"rollup":"^2.36.2","rollup-plugin-terser":"^7.0.2"},"_npmOperationalInternal":{"tmp":"tmp/wc-trim-middle_1.0.1_1737197726471_0.9585293454706938","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@annoyingmouse/wc-trim-middle","version":"1.0.2","keywords":["truncate","web-component"],"author":{"name":"Dominic Myers"},"license":"MIT","_id":"@annoyingmouse/wc-trim-middle@1.0.2","maintainers":[{"name":"annoyingmouse","email":"annoyingmouse@gmail.com"}],"homepage":"https://github.com/annoyingmouse/wc-trim-middle#readme","bugs":{"url":"https://github.com/annoyingmouse/wc-trim-middle/issues"},"dist":{"shasum":"3ae3f984194a375dc978a52a4418ba26d6fbb487","tarball":"https://registry.npmjs.org/@annoyingmouse/wc-trim-middle/-/wc-trim-middle-1.0.2.tgz","fileCount":8,"integrity":"sha512-QsS95jJNzXzAjSJfLas1JX14ATuU2JHJyjLxqPRtaQ1mcCug62sw1spCE42VuypCakSUGKb1iFyabKGDGYoqzQ==","signatures":[{"sig":"MEYCIQC6paebqqPmsyH+XJB+41TRl8dT/tuB6w/xjegQcpX5ugIhAOvUiNRtUwVYLaRak16RMULAqe0duIFEoOhqsKTC1oeT","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":19723},"main":"wc-trim-middle.js","gitHead":"0ced680a96ce40ec4e3b1fd1c5c7f2ab4dab2ffc","scripts":{"test":"echo \"No test specified\"","build":"rollup -c"},"_npmUser":{"name":"annoyingmouse","email":"annoyingmouse@gmail.com"},"prettier":{"semi":false,"singleQuote":true},"repository":{"url":"git+https://github.com/annoyingmouse/wc-trim-middle.git","type":"git"},"_npmVersion":"10.9.0","description":"This web component was inspired by Chris Heilmann and does not trim strings that don’t fit the space at the end, but in the middle of the string","directories":{},"_nodeVersion":"22.12.0","dependencies":{"np":"^10.1.0"},"_hasShrinkwrap":false,"devDependencies":{"rollup":"^2.36.2","rollup-plugin-terser":"^7.0.2"},"_npmOperationalInternal":{"tmp":"tmp/wc-trim-middle_1.0.2_1737198334410_0.4560826849119768","host":"s3://npm-registry-packages-npm-production"}},"1.4.0":{"name":"@annoyingmouse/wc-trim-middle","version":"1.4.0","description":"This web component was inspired by Chris Heilmann and does not trim strings that don’t fit the space at the end, but in the middle of the string","main":"wc-trim-middle.js","type":"module","scripts":{"format":"biome format --write .","lint":"biome lint .","build":"rollup -c","release":"node scripts/release.cjs && git push && git push --tags && npm publish --access public","release:patch":"npm version patch && npm run release","release:minor":"npm version minor && npm run release","release:major":"npm version major && npm run release"},"repository":{"type":"git","url":"git+https://github.com/annoyingmouse/wc-trim-middle.git"},"keywords":["web-component","custom-element","truncate","text-truncation","middle-truncation","accessibility","a11y"],"author":{"name":"Dominic Myers"},"license":"MIT","bugs":{"url":"https://github.com/annoyingmouse/wc-trim-middle/issues"},"homepage":"https://github.com/annoyingmouse/wc-trim-middle#readme","prettier":{"singleQuote":true,"semi":false},"devDependencies":{"@biomejs/biome":"^2.4.9","@rollup/plugin-terser":"^1.0.0","rollup":"^4.0.0"},"gitHead":"b607062aedab6cbb9c148abf9d2e251fe3c2b8bd","_id":"@annoyingmouse/wc-trim-middle@1.4.0","_nodeVersion":"22.12.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-zjSa4TEcOcETkCXB8G5emJW9bKbcPjlcUMKNMXBTOrEQ7G83UnXFiSMUtZgV/N5D+RaA0HNXBx+gfZFgT1++wQ==","shasum":"e3ba90966e9beb7d316e6eff3d9ca80de3d16795","tarball":"https://registry.npmjs.org/@annoyingmouse/wc-trim-middle/-/wc-trim-middle-1.4.0.tgz","fileCount":9,"unpackedSize":24758,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDlTBpM6f0gNKJyf/M9zsUSOnIsK7bFZ99i+Fu1BM2VsAIhAPGk6E6o2A87ykcriKqQmlWOrpnoAZyv9u9hnZGgt+wb"}]},"_npmUser":{"name":"annoyingmouse","email":"annoyingmouse@gmail.com"},"directories":{},"maintainers":[{"name":"annoyingmouse","email":"annoyingmouse@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/wc-trim-middle_1.4.0_1777270440578_0.7227999179628535"},"_hasShrinkwrap":false}},"time":{"created":"2025-01-18T10:55:26.371Z","modified":"2026-04-27T06:14:00.908Z","1.0.1":"2025-01-18T10:55:26.666Z","1.0.2":"2025-01-18T11:05:34.604Z","1.4.0":"2026-04-27T06:14:00.806Z"},"bugs":{"url":"https://github.com/annoyingmouse/wc-trim-middle/issues"},"author":{"name":"Dominic Myers"},"license":"MIT","homepage":"https://github.com/annoyingmouse/wc-trim-middle#readme","keywords":["web-component","custom-element","truncate","text-truncation","middle-truncation","accessibility","a11y"],"repository":{"type":"git","url":"git+https://github.com/annoyingmouse/wc-trim-middle.git"},"description":"This web component was inspired by Chris Heilmann and does not trim strings that don’t fit the space at the end, but in the middle of the string","maintainers":[{"name":"annoyingmouse","email":"annoyingmouse@gmail.com"}],"readme":"# <wc-trim-middle/>\r\n\r\nShamelessly stolen from Christian Heilmann this takes his function and embeds it into a Web Component without a shadowDOM, according to Mr Heilmann:</p>\r\n\r\n<blockquote>\r\nOne of the cool features of MacOS’ Finder app is that it does not trim file names that don’t fit the space at the end, but in the middle of the file name. This does make a lot more sense, as it also shows what format the file is.\r\n</blockquote>\r\n\r\nThe original text is retained in the `title` and `aria-label` attributes of the element, but only if the string has been trimmed. Screen readers will therefore announce the full untruncated text.\r\n\r\n## Browser support\r\n\r\nThis component uses the [customized built-in elements](https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry/define#customized_built-in_element) API (`is=\"wc-trim-middle\"`), which is **not supported in Safari or any iOS browser**. The component detects this automatically and loads the `@ungap/custom-elements` polyfill from unpkg on demand — no extra steps required.\r\n\r\n## Usage\r\n\r\n```html\r\n<span is=\"wc-trim-middle\">This is a long string that will be trimmed</span>\r\n<script type=\"module\" src=\"wc-trim-middle.js\"></script>\r\n```\r\n\r\n## Configuration\r\n\r\n* Adding a `width` attribute allow you to define the amount of letters you want to show - it defaults to 16.\r\n* Adding a `replacement` attribute allows you to change what the character in between the parts should be - it defaults to `…`.\r\n\r\n## License\r\n\r\nMIT","readmeFilename":"README.md"}