- Docs
- Changelog
Changelog
Every @samline/string release, newest first, with breaking changes, behavior changes and upgrade steps called out explicitly.
All notable changes to this package. Format: Keep a Changelog; versions follow semver.
[2.0.1] - 2026-11-17
Fixed
data-string-copyandcopy()fall back to copying a hidden selection when the Clipboard API is missing (plain HTTP, restrictive iframes) or refuses, and give focus back to the button.errornow means that no copy succeeded.
[2.0.0] - 2026-11-15
Changed
- Breaking: the browser bundle defines
window.Stringsinstead ofwindow.SamlineString, so the global carries the package’s own name like every other @samline package (window.Stringis JavaScript’s built-in constructor). In pages that load the CDN script, replaceSamlineStringwithStrings, for exampleStrings.auto()andStrings.controller. ESM and CommonJS imports are unchanged.
[1.5.0] - 2026-11-15
Added
count/autoCountanddata-string-count: characters (graphemes) or words in a field, the remaining count frommaxlengthormax, a{count}/{max}/{remaining}template,ok/near/overstates and astring:countevent.fit/autoFitanddata-string-fit: text cut in the middle (or at the end or start) to fit its box, fitted again on resize and when fonts load, with the full text intitle.copy/autoCopyanddata-string-copy: copy a field’s or element’s text to the clipboard, optionally converted withdata-string-copy-as, withcopied/errorstates and astring:copyevent.hashColor(text)anddata-string-color(coloroption): a stable--string-colorper name for avatar backgrounds, dark enough for white text at 4.5:1 by default.- The browser bundle starts every behavior;
SamlineString.auto()takes per-behavior options undersearch,count,fitandcopy.
[1.4.0] - 2026-11-15
Added
graphemes(text): user-perceived characters withIntl.Segmenter(code points as the fallback).wordCountandreadingTime, with locale-aware word boundaries.pluralize(count, forms, { locale, ordinal })withIntl.PluralRules, a formatted#count and an explicitzeroform.template(text, values, { missing })with nested paths and{{ }}for literal braces.escapeHtml,unescapeHtmlandstripTags.closestpartialoption (on by default): compares the input with the start of each word of longer candidates, sohorchattafindsHorchata de arroz.
Fixed
truncateandinitialscount graphemes instead of code points, so emoji sequences (👨👩👧, flags) and letters with combining accents are never split.words(and every case function) andtitleCasekeep combining accents inside their word: decomposedéno longer splitsélaninto two words.
[1.3.0] - 2026-11-15
Added
uniqueSlug(text, taken, options): the first free slug (hola-3), with the number kept insidemaxLength;takenis a list, aSetor a function.convert(text, 'slug', { taken })uses it.- Transliteration presets
CYRILLIC,GREEKandGERMAN(plusCHAR_MAPS), and acharMapoption forslugify,removeAccentsandconvert. slugifypreserveoption to keep characters such as.or_, and replacement pairs with regular expressions.data-string-taken,data-string-transliterateanddata-string-preserveattributes. A slug field moves to a free slug on blur, not while the user types.
[1.2.0] - 2026-11-15
Added
- Search and comparison:
fold(case, accents, full-width),contains(every query word, accent-insensitive),highlight(matching pieces of the original text, without HTML),compareNatural(numeric, locale-aware, accent-insensitive sorting),distance,similarityandclosestfor typo suggestions. search(target, options)andautoSearch(options)in@samline/string/vanilla:data-string-search="#q"filters a list as the user types, wraps matches in<mark>, shows adata-string-search-emptymessage, reportsdata-string-search-stateand astring:searchevent, and restores the markup ondestroy().- The browser bundle also starts
[data-string-search]lists;SamlineString.auto({ search })takes search-only options.
[1.1.0] - 2026-11-15
Added
- HTML layer in
@samline/string/vanilla:string(target, options)andautoString(options)convert any element withdata-string="<conversion>"and restore the original markup ondestroy(). Inputs and textareas convert while the user types (keeping a just-typed separator and the caret, skipping IME composition) and finalize on blur. data-string-source: a field or preview follows another one. A slug field follows the title until the user edits it and follows again when emptied; sources chain. State indata-string-state(ready,following,edited) and a bubblingstring:changeevent.- Every option as a
data-string-*attribute, the locale taken from the closestlang,titleon truncated text and an accessible label on initials. - The browser bundle converts
[data-string]on load and for elements added later;data-manualon the script tag waits forSamlineString.auto(). convert(text, to, options),CONVERSIONSandisConversionto run any conversion by name.pathCase(hello/world) andtrainCase(Content-Type).truncatepositionoption:'middle'keeps both ends of file names and IDs,'start'keeps the ending.
Changed
- The package moved from the
samline/utilsmonorepo to its own repository, samline/string. Homepage, repository and documentation links point to the package’s own site.
[1.0.0] - 2026-11-13
Added
- First release: case conversion (camel, Pascal, kebab, snake, dot, constant, title and sentence case, capitalize and uncapitalize),
slugifywith replacements,maxLengthand a typing-friendlytrim: false,removeAccentswith transliteration,truncate,initialsand the sharedwordssplitter. ESM, CommonJS and a browser global (window.SamlineString).