@yashau/thaana 2026.1023.0 → 2026.1023.2

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/README.md CHANGED
@@ -64,6 +64,6 @@ Or with no build step at all:
64
64
  import '@yashau/thaana/thaana.css';
65
65
  ```
66
66
 
67
- Applies to `:lang(dv)`: RTL, line height that doesn't clip fili, no synthetic italics/bold, `unicode-bidi: plaintext` for user content, LTR for code/URLs/emails.
67
+ Applies to `:lang(dv)`: RTL, line height that doesn't clip fili, no synthetic italics/bold, `unicode-bidi: plaintext` for displayed paragraphs (not inputs, whose caret stays on the right), LTR for code/URLs/emails.
68
68
 
69
69
  Guide: https://dvfonts.yashau.com/docs · Agent guide: https://dvfonts.yashau.com/llms.txt
@@ -4,4 +4,4 @@ const e=Object.freeze({q:`ް`,w:`އ`,e:`ެ`,r:`ރ`,t:`ތ`,y:`ޔ`,u:`ު`,i:`ި`,o
4
4
  `).map(e=>{if(!a(e))return e;let t=e.replace(/([/:])\s+(?=\d)/gu,`$1`);t=t.replace(/\d+(?:[/:]\d+)+/gu,e=>{let t=new Set(e.match(/[/:]/gu));if(t.size!==1)return e;let[n]=t;return e.split(n).toReversed().join(n)}),t=C(t,{arabicPunctuation:!1}),t=t.replace(/^(\s*)\.(\d)(\d)(\s+)/u,(e,t,n,r,i)=>`${t}${r}-${n}${i}`);let n=/^(\s*)(\d+)(\s+)([\s\S]*?)(\s*)\.$/u.exec(t);if(n&&a(n[4])){let[,e,r,i,a,o]=n;t=`${e}.${r}${i}${a}${o}`}return t}).join(`
5
5
  `)}const T=[`Noto Sans Thaana`,`MV Boli`];function E(e,{latin:t=`system-ui`}={}){return[e,t,...T,`sans-serif`].map(D).join(`, `)}function D(e){return/^[a-z-]+$/.test(e)?e:`'${e}'`}function O(t){if(t.inputType!==`insertText`||t.isComposing)return null;let n=t.data&&t.data.length===1?t.data:void 0;return n?e[n]??null:null}function k(e,t={}){let{enabled:n=()=>!0,setAttributes:r=!0,autoDirection:i=!0}=t;if(r)for(let[t,n]of[[`dir`,`rtl`],[`lang`,`dv`],[`autocomplete`,`off`],[`autocorrect`,`off`],[`autocapitalize`,`none`],[`spellcheck`,`false`]])e.hasAttribute(t)||e.setAttribute(t,n);let a=!1,o=t=>{let r=t;if(a||!n())return;let i=O(r);if(i){r.preventDefault(),a=!0;try{if(typeof document.execCommand==`function`&&document.execCommand(`insertText`,!1,i))return;if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement){let t=e.selectionStart??e.value.length;e.setRangeText(i,t,e.selectionEnd??t,`end`),e.dispatchEvent(new Event(`input`,{bubbles:!0}))}}finally{a=!1}}},s=()=>e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement?e.value:e.textContent??``,c=()=>{e.dir=l(s(),null,`rtl`)};return e.addEventListener(`beforeinput`,o),i&&(e.addEventListener(`input`,c),c()),()=>{e.removeEventListener(`beforeinput`,o),e.removeEventListener(`input`,c)}}const A=/* @__PURE__ */ new WeakMap;function j(e=document){let t=()=>{for(let t of e.querySelectorAll(`[data-thaana]`))A.has(t)||t.dataset.thaana===`off`||A.set(t,k(t))};t();let n=new MutationObserver(t);return n.observe(e instanceof Document?e.documentElement:e,{childList:!0,subtree:!0}),()=>n.disconnect()}let M=!1;function N(){M||typeof document>`u`||(M=!0,document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,()=>j(),{once:!0}):j())}N();const P={typewriter:{a:`އ`,b:`ބ`,c:`ް`,d:`ދ`,e:`ެ`,f:`ފ`,g:`ގ`,h:`ހ`,i:`ި`,j:`ޖ`,k:`ކ`,l:`ލ`,m:`މ`,n:`ނ`,o:`ޮ`,p:`ޕ`,q:`ޤ`,r:`ރ`,s:`ސ`,t:`ތ`,u:`ު`,v:`ވ`,w:`ަ`,x:`ޝ`,y:`ޔ`,z:`ޒ`,A:`ޢ`,B:`ޞ`,C:`ޗ`,D:`ޑ`,E:`ޭ`,F:`ޟ`,G:`ޣ`,H:`ޙ`,I:`ީ`,J:`ޛ`,K:`ޚ`,L:`ޅ`,N:`ޏ`,O:`ޯ`,R:`ޜ`,S:`ށ`,T:`ޓ`,U:`ޫ`,V:`ޥ`,W:`ާ`,X:`ޘ`,Y:`ޠ`,Z:`ޡ`,Q:`ﷲ`,",":`،`,";":`؛`,"?":`؟`},phonetic:{q:`ް`,w:`އ`,e:`ެ`,r:`ރ`,t:`ތ`,y:`ޔ`,u:`ު`,i:`ި`,o:`ޮ`,p:`ޕ`,a:`ަ`,s:`ސ`,d:`ދ`,f:`ފ`,g:`ގ`,h:`ހ`,j:`ޖ`,k:`ކ`,l:`ލ`,z:`ޒ`,c:`ޗ`,v:`ވ`,b:`ބ`,n:`ނ`,m:`މ`,Q:`ޤ`,W:`ޢ`,E:`ޭ`,R:`ޜ`,T:`ޓ`,Y:`ޠ`,U:`ޫ`,I:`ީ`,O:`ޯ`,A:`ާ`,S:`ށ`,D:`ޑ`,F:`ﷲ`,G:`ޣ`,H:`ޙ`,J:`ޛ`,K:`ޚ`,L:`ޅ`,Z:`ޡ`,X:`ޘ`,C:`ޝ`,V:`ޥ`,B:`ޞ`,N:`ޏ`,M:`ޟ`,",":`،`,";":`؛`,"?":`؟`}};function F(e,t={}){let{layout:n=`typewriter`,reverse:r=!0}=t,i=P[n];return e.split(/(\r?\n)/).map(e=>{if(e===`
6
6
  `||e===`\r
7
- `)return e;let t=(r?[...e].toReversed():[...e]).map(e=>i[e]??e).join(``);return r&&(t=t.replace(/\d[\d.,:/-]*\d|\d/g,e=>[...e].toReversed().join(``))),t}).join(``)}const I=`https://dvfonts.yashau.com`;function L(e,{display:t=`swap`,origin:n=I}={}){return`${n}/css2?${(Array.isArray(e)?e:[e]).map(({family:e,weights:t})=>`family=${encodeURIComponent(e).replace(/%20/g,`+`)}${t?.length?`:wght@${t.toSorted((e,t)=>e-t).join(`;`)}`:``}`).join(`&`)}&display=${t}`}function R(e,t){let n=L(e,t),r=document.querySelector(`link[data-dvfonts][href="${CSS.escape(n)}"]`);r||(r=document.createElement(`link`),r.rel=`stylesheet`,r.href=n,r.dataset.dvfonts=``,document.head.append(r));let i=Array.isArray(e)?e:[e];return new Promise((e,t)=>{if(r.sheet)return e();r.addEventListener(`load`,()=>e(),{once:!0}),r.addEventListener(`error`,()=>t(/* @__PURE__ */ Error(`Could not load ${n}`)),{once:!0})}).then(()=>Promise.all(i.flatMap(({family:e,weights:t=[400]})=>t.map(t=>document.fonts.load(`${t} 16px "${e}"`,`ދ`)))).then(()=>void 0))}const z=[`ޗާލު ޒުވާން ކުއްޖާ، ފޮށިން ޕެކެޓެއް ކަނޑައި، ޏަމްޏަމް ގަހުގައި އިން ބުޅަލަށް މަސްދީ، ރީތި ލަވައެއް ކިޔައިދިނެވެ.`,`ކުޑަ ޗުއްޓީއެއްގައި ޏ. އަތޮޅަށް ފުރަން ޓިކެޓާއި ބޮޑު ފޮށި ހިފައިގެން، ޒުވާން ޕައިލެޓް މަޖާ ލަވައެއް ސަކަރާތާއެކު ކިޔަމުން ދިޔައެވެ.`,`ޕާކުގައި ހުރި މޭޒުމަތީގައި، ކުޑަ ކުއްޖާ ފޮނި ޏަމްޏަމް މޭވާއާއި ޗޮކްލެޓް ބަހައްޓައި، ޅަ އެކުވެރިޔާއަށް ތަށިން ސައި ދިނެވެ.`,`ސުކޫލު ކުލާހުގައި ހުރި ބޯޑުގައި، މޮޅު ކުއްޖާ ތާނަ އަކުރު 'ޏަވިޔަނި' ވަރަށް ޗާލުކޮށް ޕެންސިލުން ފޮތުގައި ލިޔެ، ޒުވާން ޓީޗަރަށް ދެއްކިއެވެ.`,`ބާޒާރުން ތާޒާ ޏަމްޏަމް މޭވާއާއި، ޗީޒް، ޓޮމާޓޯ އަދި ފޮނި ޖޭމު ޑަބިޔަލެއް ގަނެގެން، ކުއްޖާ ޕްލާސްޓިކް ކޮތަޅަށް އަޅައިގެން އަވަހަށް ހިނގައިގަތެވެ.`,`ރީތި ޗާލު ހަނދުވަރުގައި، ޏ. އަތޮޅުގެ ގޮނޑުދޮށުގައި ޒުވާނުން ބޮޑުބެރު ޖަހައި، ޕާޓީއެއް ހަދައި، ފާނޫޒު ދިއްލައިގެން މަޖާ ލަވަތައް ކިޔައި ސަކަރާތްޖެހިއެވެ.`,`ޗަސްބިމުގައި ހުރި ޏަމްޏަމް ގަހުގެ ގޮފިތަކަށް ޖެހި، ޅަ ލޯބި ދޫނި، ކުޑަ ޕިކަޕެއްގައި އައި ޒުވާނުން ޖެހި ޓެންޓު މަތިން އުދުހިގެން ދިޔައެވެ.`,`މީރު ޗޮކްލެޓާއި، ބަޓަރު، ފުށް، ޗީޒް އަދި ޏަމްޏަމް އެއްކޮށް، ބޮޑު ތައްޓަކަށް ސަމުސަލުން ހަކުރު އަޅައިގެން، ޒުވާން ކުއްޖާ ޕޭސްޓްރީ ތައްޔާރުކުރިއެވެ.`],B=`ރަމަޟާން މަހުގެ ޚާއްޞަ ޘަޤާފަތާއި ޝަރީޢަތުގެ ޙަޤީޤަތް ޙިފްޡުކޮށް ޛިކުރުކުރުމަކީ ބަޣާވާތެއް ނޫނެވެ.`,V=(e,t)=>Array.from({length:t-e},(t,n)=>String.fromCodePoint(e+n)),H=V(1920,1944),U=V(1944,1958),W=V(1958,1969);N();export{U as ARABIC_LETTERS,B as ARABIC_LETTERS_SAMPLE,I as DVFONTS_ORIGIN,W as FILI,f as FSI,e as KEYMAP,P as LEGACY_LAYOUTS,H as LETTERS,u as LRI,z as PANGRAMS,p as PDI,d as RLI,T as SYSTEM_THAANA_FONTS,k as attachKeyboard,j as autoAttach,F as convertLegacy,c as detectDirection,L as fontCssUrl,E as fontStack,o as hasRtl,a as hasThaana,s as isMixedScript,m as isolate,g as isolateNumbers,R as loadFonts,C as normalizePunctuation,w as repairPdfText,l as resolveDirection,v as stripBidiControls,O as thaanaForInputEvent,t as transliterate};
7
+ `||a(e))return e;let t=(r?[...e].toReversed():[...e]).map(e=>i[e]??e).join(``);return r&&(t=t.replace(/\d[\d.,:/-]*\d|\d/g,e=>[...e].toReversed().join(``))),t}).join(``)}const I=`https://dvfonts.yashau.com`;function L(e,{display:t=`swap`,origin:n=I}={}){return`${n}/css2?${(Array.isArray(e)?e:[e]).map(({family:e,weights:t})=>`family=${encodeURIComponent(e).replace(/%20/g,`+`)}${t?.length?`:wght@${t.toSorted((e,t)=>e-t).join(`;`)}`:``}`).join(`&`)}&display=${t}`}function R(e,t){let n=L(e,t),r=document.querySelector(`link[data-dvfonts][href="${CSS.escape(n)}"]`);r||(r=document.createElement(`link`),r.rel=`stylesheet`,r.href=n,r.dataset.dvfonts=``,document.head.append(r));let i=Array.isArray(e)?e:[e];return new Promise((e,t)=>{if(r.sheet)return e();r.addEventListener(`load`,()=>e(),{once:!0}),r.addEventListener(`error`,()=>t(/* @__PURE__ */ Error(`Could not load ${n}`)),{once:!0})}).then(()=>Promise.all(i.flatMap(({family:e,weights:t=[400]})=>t.map(t=>document.fonts.load(`${t} 16px "${e}"`,`ދ`)))).then(()=>void 0))}const z=[`ޗާލު ޒުވާން ކުއްޖާ، ފޮށިން ޕެކެޓެއް ކަނޑައި، ޏަމްޏަމް ގަހުގައި އިން ބުޅަލަށް މަސްދީ، ރީތި ލަވައެއް ކިޔައިދިނެވެ.`,`ކުޑަ ޗުއްޓީއެއްގައި ޏ. އަތޮޅަށް ފުރަން ޓިކެޓާއި ބޮޑު ފޮށި ހިފައިގެން، ޒުވާން ޕައިލެޓް މަޖާ ލަވައެއް ސަކަރާތާއެކު ކިޔަމުން ދިޔައެވެ.`,`ޕާކުގައި ހުރި މޭޒުމަތީގައި، ކުޑަ ކުއްޖާ ފޮނި ޏަމްޏަމް މޭވާއާއި ޗޮކްލެޓް ބަހައްޓައި، ޅަ އެކުވެރިޔާއަށް ތަށިން ސައި ދިނެވެ.`,`ސުކޫލު ކުލާހުގައި ހުރި ބޯޑުގައި، މޮޅު ކުއްޖާ ތާނަ އަކުރު 'ޏަވިޔަނި' ވަރަށް ޗާލުކޮށް ޕެންސިލުން ފޮތުގައި ލިޔެ، ޒުވާން ޓީޗަރަށް ދެއްކިއެވެ.`,`ބާޒާރުން ތާޒާ ޏަމްޏަމް މޭވާއާއި، ޗީޒް، ޓޮމާޓޯ އަދި ފޮނި ޖޭމު ޑަބިޔަލެއް ގަނެގެން، ކުއްޖާ ޕްލާސްޓިކް ކޮތަޅަށް އަޅައިގެން އަވަހަށް ހިނގައިގަތެވެ.`,`ރީތި ޗާލު ހަނދުވަރުގައި، ޏ. އަތޮޅުގެ ގޮނޑުދޮށުގައި ޒުވާނުން ބޮޑުބެރު ޖަހައި، ޕާޓީއެއް ހަދައި، ފާނޫޒު ދިއްލައިގެން މަޖާ ލަވަތައް ކިޔައި ސަކަރާތްޖެހިއެވެ.`,`ޗަސްބިމުގައި ހުރި ޏަމްޏަމް ގަހުގެ ގޮފިތަކަށް ޖެހި، ޅަ ލޯބި ދޫނި، ކުޑަ ޕިކަޕެއްގައި އައި ޒުވާނުން ޖެހި ޓެންޓު މަތިން އުދުހިގެން ދިޔައެވެ.`,`މީރު ޗޮކްލެޓާއި، ބަޓަރު، ފުށް، ޗީޒް އަދި ޏަމްޏަމް އެއްކޮށް، ބޮޑު ތައްޓަކަށް ސަމުސަލުން ހަކުރު އަޅައިގެން، ޒުވާން ކުއްޖާ ޕޭސްޓްރީ ތައްޔާރުކުރިއެވެ.`],B=`ރަމަޟާން މަހުގެ ޚާއްޞަ ޘަޤާފަތާއި ޝަރީޢަތުގެ ޙަޤީޤަތް ޙިފްޡުކޮށް ޛިކުރުކުރުމަކީ ބަޣާވާތެއް ނޫނެވެ.`,V=(e,t)=>Array.from({length:t-e},(t,n)=>String.fromCodePoint(e+n)),H=V(1920,1944),U=V(1944,1958),W=V(1958,1969);N();export{U as ARABIC_LETTERS,B as ARABIC_LETTERS_SAMPLE,I as DVFONTS_ORIGIN,W as FILI,f as FSI,e as KEYMAP,P as LEGACY_LAYOUTS,H as LETTERS,u as LRI,z as PANGRAMS,p as PDI,d as RLI,T as SYSTEM_THAANA_FONTS,k as attachKeyboard,j as autoAttach,F as convertLegacy,c as detectDirection,L as fontCssUrl,E as fontStack,o as hasRtl,a as hasThaana,s as isMixedScript,m as isolate,g as isolateNumbers,R as loadFonts,C as normalizePunctuation,w as repairPdfText,l as resolveDirection,v as stripBidiControls,O as thaanaForInputEvent,t as transliterate};
package/dist/index.d.ts CHANGED
@@ -67,7 +67,8 @@ interface ConvertLegacyOptions {
67
67
  * Convert text typed in a pre-Unicode Thaana font (it looks like Latin
68
68
  * gibberish such as "ihevid" once the font is gone) into Unicode Thaana.
69
69
  * Each line is reversed into logical order, characters are mapped, and digit
70
- * groups are put back in reading order.
70
+ * groups are put back in reading order. Lines that already contain Unicode
71
+ * Thaana are not legacy text and are returned unchanged.
71
72
  */
72
73
  export declare function convertLegacy(text: string, options?: ConvertLegacyOptions): string;
73
74
  /** True if the string contains any Thaana. */
package/dist/index.js CHANGED
@@ -119,13 +119,14 @@ const LEGACY_LAYOUTS = {
119
119
  * Convert text typed in a pre-Unicode Thaana font (it looks like Latin
120
120
  * gibberish such as "ihevid" once the font is gone) into Unicode Thaana.
121
121
  * Each line is reversed into logical order, characters are mapped, and digit
122
- * groups are put back in reading order.
122
+ * groups are put back in reading order. Lines that already contain Unicode
123
+ * Thaana are not legacy text and are returned unchanged.
123
124
  */
124
125
  function convertLegacy(text, options = {}) {
125
126
  const { layout = "typewriter", reverse = true } = options;
126
127
  const map = LEGACY_LAYOUTS[layout];
127
128
  return text.split(/(\r?\n)/).map((line) => {
128
- if (line === "\n" || line === "\r\n") return line;
129
+ if (line === "\n" || line === "\r\n" || hasThaana(line)) return line;
129
130
  let out = (reverse ? [...line].toReversed() : [...line]).map((c) => map[c] ?? c).join("");
130
131
  if (reverse) out = out.replace(/\d[\d.,:/-]*\d|\d/g, (m) => [...m].toReversed().join(""));
131
132
  return out;
@@ -4,4 +4,4 @@ var Thaana=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Modul
4
4
  `).map(e=>{if(!o(e))return e;let t=e.replace(/([/:])\s+(?=\d)/gu,`$1`);t=t.replace(/\d+(?:[/:]\d+)+/gu,e=>{let t=new Set(e.match(/[/:]/gu));if(t.size!==1)return e;let[n]=t;return e.split(n).toReversed().join(n)}),t=b(t,{arabicPunctuation:!1}),t=t.replace(/^(\s*)\.(\d)(\d)(\s+)/u,(e,t,n,r,i)=>`${t}${r}-${n}${i}`);let n=/^(\s*)(\d+)(\s+)([\s\S]*?)(\s*)\.$/u.exec(t);if(n&&o(n[4])){let[,e,r,i,a,o]=n;t=`${e}.${r}${i}${a}${o}`}return t}).join(`
5
5
  `)}let S=[`Noto Sans Thaana`,`MV Boli`];function C(e,{latin:t=`system-ui`}={}){return[e,t,...S,`sans-serif`].map(w).join(`, `)}function w(e){return/^[a-z-]+$/.test(e)?e:`'${e}'`}function T(e){if(e.inputType!==`insertText`||e.isComposing)return null;let n=e.data&&e.data.length===1?e.data:void 0;return n?t[n]??null:null}function E(e,t={}){let{enabled:n=()=>!0,setAttributes:r=!0,autoDirection:i=!0}=t;if(r)for(let[t,n]of[[`dir`,`rtl`],[`lang`,`dv`],[`autocomplete`,`off`],[`autocorrect`,`off`],[`autocapitalize`,`none`],[`spellcheck`,`false`]])e.hasAttribute(t)||e.setAttribute(t,n);let a=!1,o=t=>{let r=t;if(a||!n())return;let i=T(r);if(i){r.preventDefault(),a=!0;try{if(typeof document.execCommand==`function`&&document.execCommand(`insertText`,!1,i))return;if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement){let t=e.selectionStart??e.value.length;e.setRangeText(i,t,e.selectionEnd??t,`end`),e.dispatchEvent(new Event(`input`,{bubbles:!0}))}}finally{a=!1}}},s=()=>e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement?e.value:e.textContent??``,c=()=>{e.dir=u(s(),null,`rtl`)};return e.addEventListener(`beforeinput`,o),i&&(e.addEventListener(`input`,c),c()),()=>{e.removeEventListener(`beforeinput`,o),e.removeEventListener(`input`,c)}}let D=/* @__PURE__ */ new WeakMap;function O(e=document){let t=()=>{for(let t of e.querySelectorAll(`[data-thaana]`))D.has(t)||t.dataset.thaana===`off`||D.set(t,E(t))};t();let n=new MutationObserver(t);return n.observe(e instanceof Document?e.documentElement:e,{childList:!0,subtree:!0}),()=>n.disconnect()}let k=!1;function A(){k||typeof document>`u`||(k=!0,document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,()=>O(),{once:!0}):O())}A();let j={typewriter:{a:`އ`,b:`ބ`,c:`ް`,d:`ދ`,e:`ެ`,f:`ފ`,g:`ގ`,h:`ހ`,i:`ި`,j:`ޖ`,k:`ކ`,l:`ލ`,m:`މ`,n:`ނ`,o:`ޮ`,p:`ޕ`,q:`ޤ`,r:`ރ`,s:`ސ`,t:`ތ`,u:`ު`,v:`ވ`,w:`ަ`,x:`ޝ`,y:`ޔ`,z:`ޒ`,A:`ޢ`,B:`ޞ`,C:`ޗ`,D:`ޑ`,E:`ޭ`,F:`ޟ`,G:`ޣ`,H:`ޙ`,I:`ީ`,J:`ޛ`,K:`ޚ`,L:`ޅ`,N:`ޏ`,O:`ޯ`,R:`ޜ`,S:`ށ`,T:`ޓ`,U:`ޫ`,V:`ޥ`,W:`ާ`,X:`ޘ`,Y:`ޠ`,Z:`ޡ`,Q:`ﷲ`,",":`،`,";":`؛`,"?":`؟`},phonetic:{q:`ް`,w:`އ`,e:`ެ`,r:`ރ`,t:`ތ`,y:`ޔ`,u:`ު`,i:`ި`,o:`ޮ`,p:`ޕ`,a:`ަ`,s:`ސ`,d:`ދ`,f:`ފ`,g:`ގ`,h:`ހ`,j:`ޖ`,k:`ކ`,l:`ލ`,z:`ޒ`,c:`ޗ`,v:`ވ`,b:`ބ`,n:`ނ`,m:`މ`,Q:`ޤ`,W:`ޢ`,E:`ޭ`,R:`ޜ`,T:`ޓ`,Y:`ޠ`,U:`ޫ`,I:`ީ`,O:`ޯ`,A:`ާ`,S:`ށ`,D:`ޑ`,F:`ﷲ`,G:`ޣ`,H:`ޙ`,J:`ޛ`,K:`ޚ`,L:`ޅ`,Z:`ޡ`,X:`ޘ`,C:`ޝ`,V:`ޥ`,B:`ޞ`,N:`ޏ`,M:`ޟ`,",":`،`,";":`؛`,"?":`؟`}};function M(e,t={}){let{layout:n=`typewriter`,reverse:r=!0}=t,i=j[n];return e.split(/(\r?\n)/).map(e=>{if(e===`
6
6
  `||e===`\r
7
- `)return e;let t=(r?[...e].toReversed():[...e]).map(e=>i[e]??e).join(``);return r&&(t=t.replace(/\d[\d.,:/-]*\d|\d/g,e=>[...e].toReversed().join(``))),t}).join(``)}let N=`https://dvfonts.yashau.com`;function P(e,{display:t=`swap`,origin:n=N}={}){return`${n}/css2?${(Array.isArray(e)?e:[e]).map(({family:e,weights:t})=>`family=${encodeURIComponent(e).replace(/%20/g,`+`)}${t?.length?`:wght@${t.toSorted((e,t)=>e-t).join(`;`)}`:``}`).join(`&`)}&display=${t}`}function F(e,t){let n=P(e,t),r=document.querySelector(`link[data-dvfonts][href="${CSS.escape(n)}"]`);r||(r=document.createElement(`link`),r.rel=`stylesheet`,r.href=n,r.dataset.dvfonts=``,document.head.append(r));let i=Array.isArray(e)?e:[e];return new Promise((e,t)=>{if(r.sheet)return e();r.addEventListener(`load`,()=>e(),{once:!0}),r.addEventListener(`error`,()=>t(/* @__PURE__ */ Error(`Could not load ${n}`)),{once:!0})}).then(()=>Promise.all(i.flatMap(({family:e,weights:t=[400]})=>t.map(t=>document.fonts.load(`${t} 16px "${e}"`,`ދ`)))).then(()=>void 0))}let I=[`ޗާލު ޒުވާން ކުއްޖާ، ފޮށިން ޕެކެޓެއް ކަނޑައި، ޏަމްޏަމް ގަހުގައި އިން ބުޅަލަށް މަސްދީ، ރީތި ލަވައެއް ކިޔައިދިނެވެ.`,`ކުޑަ ޗުއްޓީއެއްގައި ޏ. އަތޮޅަށް ފުރަން ޓިކެޓާއި ބޮޑު ފޮށި ހިފައިގެން، ޒުވާން ޕައިލެޓް މަޖާ ލަވައެއް ސަކަރާތާއެކު ކިޔަމުން ދިޔައެވެ.`,`ޕާކުގައި ހުރި މޭޒުމަތީގައި، ކުޑަ ކުއްޖާ ފޮނި ޏަމްޏަމް މޭވާއާއި ޗޮކްލެޓް ބަހައްޓައި، ޅަ އެކުވެރިޔާއަށް ތަށިން ސައި ދިނެވެ.`,`ސުކޫލު ކުލާހުގައި ހުރި ބޯޑުގައި، މޮޅު ކުއްޖާ ތާނަ އަކުރު 'ޏަވިޔަނި' ވަރަށް ޗާލުކޮށް ޕެންސިލުން ފޮތުގައި ލިޔެ، ޒުވާން ޓީޗަރަށް ދެއްކިއެވެ.`,`ބާޒާރުން ތާޒާ ޏަމްޏަމް މޭވާއާއި، ޗީޒް، ޓޮމާޓޯ އަދި ފޮނި ޖޭމު ޑަބިޔަލެއް ގަނެގެން، ކުއްޖާ ޕްލާސްޓިކް ކޮތަޅަށް އަޅައިގެން އަވަހަށް ހިނގައިގަތެވެ.`,`ރީތި ޗާލު ހަނދުވަރުގައި، ޏ. އަތޮޅުގެ ގޮނޑުދޮށުގައި ޒުވާނުން ބޮޑުބެރު ޖަހައި، ޕާޓީއެއް ހަދައި، ފާނޫޒު ދިއްލައިގެން މަޖާ ލަވަތައް ކިޔައި ސަކަރާތްޖެހިއެވެ.`,`ޗަސްބިމުގައި ހުރި ޏަމްޏަމް ގަހުގެ ގޮފިތަކަށް ޖެހި، ޅަ ލޯބި ދޫނި، ކުޑަ ޕިކަޕެއްގައި އައި ޒުވާނުން ޖެހި ޓެންޓު މަތިން އުދުހިގެން ދިޔައެވެ.`,`މީރު ޗޮކްލެޓާއި، ބަޓަރު، ފުށް، ޗީޒް އަދި ޏަމްޏަމް އެއްކޮށް، ބޮޑު ތައްޓަކަށް ސަމުސަލުން ހަކުރު އަޅައިގެން، ޒުވާން ކުއްޖާ ޕޭސްޓްރީ ތައްޔާރުކުރިއެވެ.`],L=(e,t)=>Array.from({length:t-e},(t,n)=>String.fromCodePoint(e+n)),R=L(1920,1944),z=L(1944,1958),B=L(1958,1969);return A(),e.ARABIC_LETTERS=z,e.ARABIC_LETTERS_SAMPLE=`ރަމަޟާން މަހުގެ ޚާއްޞަ ޘަޤާފަތާއި ޝަރީޢަތުގެ ޙަޤީޤަތް ޙިފްޡުކޮށް ޛިކުރުކުރުމަކީ ބަޣާވާތެއް ނޫނެވެ.`,e.DVFONTS_ORIGIN=N,e.FILI=B,e.FSI=`⁨`,e.KEYMAP=t,e.LEGACY_LAYOUTS=j,e.LETTERS=R,e.LRI=`⁦`,e.PANGRAMS=I,e.PDI=`⁩`,e.RLI=`⁧`,e.SYSTEM_THAANA_FONTS=S,e.attachKeyboard=E,e.autoAttach=O,e.convertLegacy=M,e.detectDirection=l,e.fontCssUrl=P,e.fontStack=C,e.hasRtl=s,e.hasThaana=o,e.isMixedScript=c,e.isolate=d,e.isolateNumbers=p,e.loadFonts=F,e.normalizePunctuation=b,e.repairPdfText=x,e.resolveDirection=u,e.stripBidiControls=h,e.thaanaForInputEvent=T,e.transliterate=n,e})({});
7
+ `||o(e))return e;let t=(r?[...e].toReversed():[...e]).map(e=>i[e]??e).join(``);return r&&(t=t.replace(/\d[\d.,:/-]*\d|\d/g,e=>[...e].toReversed().join(``))),t}).join(``)}let N=`https://dvfonts.yashau.com`;function P(e,{display:t=`swap`,origin:n=N}={}){return`${n}/css2?${(Array.isArray(e)?e:[e]).map(({family:e,weights:t})=>`family=${encodeURIComponent(e).replace(/%20/g,`+`)}${t?.length?`:wght@${t.toSorted((e,t)=>e-t).join(`;`)}`:``}`).join(`&`)}&display=${t}`}function F(e,t){let n=P(e,t),r=document.querySelector(`link[data-dvfonts][href="${CSS.escape(n)}"]`);r||(r=document.createElement(`link`),r.rel=`stylesheet`,r.href=n,r.dataset.dvfonts=``,document.head.append(r));let i=Array.isArray(e)?e:[e];return new Promise((e,t)=>{if(r.sheet)return e();r.addEventListener(`load`,()=>e(),{once:!0}),r.addEventListener(`error`,()=>t(/* @__PURE__ */ Error(`Could not load ${n}`)),{once:!0})}).then(()=>Promise.all(i.flatMap(({family:e,weights:t=[400]})=>t.map(t=>document.fonts.load(`${t} 16px "${e}"`,`ދ`)))).then(()=>void 0))}let I=[`ޗާލު ޒުވާން ކުއްޖާ، ފޮށިން ޕެކެޓެއް ކަނޑައި، ޏަމްޏަމް ގަހުގައި އިން ބުޅަލަށް މަސްދީ، ރީތި ލަވައެއް ކިޔައިދިނެވެ.`,`ކުޑަ ޗުއްޓީއެއްގައި ޏ. އަތޮޅަށް ފުރަން ޓިކެޓާއި ބޮޑު ފޮށި ހިފައިގެން، ޒުވާން ޕައިލެޓް މަޖާ ލަވައެއް ސަކަރާތާއެކު ކިޔަމުން ދިޔައެވެ.`,`ޕާކުގައި ހުރި މޭޒުމަތީގައި، ކުޑަ ކުއްޖާ ފޮނި ޏަމްޏަމް މޭވާއާއި ޗޮކްލެޓް ބަހައްޓައި، ޅަ އެކުވެރިޔާއަށް ތަށިން ސައި ދިނެވެ.`,`ސުކޫލު ކުލާހުގައި ހުރި ބޯޑުގައި، މޮޅު ކުއްޖާ ތާނަ އަކުރު 'ޏަވިޔަނި' ވަރަށް ޗާލުކޮށް ޕެންސިލުން ފޮތުގައި ލިޔެ، ޒުވާން ޓީޗަރަށް ދެއްކިއެވެ.`,`ބާޒާރުން ތާޒާ ޏަމްޏަމް މޭވާއާއި، ޗީޒް، ޓޮމާޓޯ އަދި ފޮނި ޖޭމު ޑަބިޔަލެއް ގަނެގެން، ކުއްޖާ ޕްލާސްޓިކް ކޮތަޅަށް އަޅައިގެން އަވަހަށް ހިނގައިގަތެވެ.`,`ރީތި ޗާލު ހަނދުވަރުގައި، ޏ. އަތޮޅުގެ ގޮނޑުދޮށުގައި ޒުވާނުން ބޮޑުބެރު ޖަހައި، ޕާޓީއެއް ހަދައި، ފާނޫޒު ދިއްލައިގެން މަޖާ ލަވަތައް ކިޔައި ސަކަރާތްޖެހިއެވެ.`,`ޗަސްބިމުގައި ހުރި ޏަމްޏަމް ގަހުގެ ގޮފިތަކަށް ޖެހި، ޅަ ލޯބި ދޫނި، ކުޑަ ޕިކަޕެއްގައި އައި ޒުވާނުން ޖެހި ޓެންޓު މަތިން އުދުހިގެން ދިޔައެވެ.`,`މީރު ޗޮކްލެޓާއި، ބަޓަރު، ފުށް، ޗީޒް އަދި ޏަމްޏަމް އެއްކޮށް، ބޮޑު ތައްޓަކަށް ސަމުސަލުން ހަކުރު އަޅައިގެން، ޒުވާން ކުއްޖާ ޕޭސްޓްރީ ތައްޔާރުކުރިއެވެ.`],L=(e,t)=>Array.from({length:t-e},(t,n)=>String.fromCodePoint(e+n)),R=L(1920,1944),z=L(1944,1958),B=L(1958,1969);return A(),e.ARABIC_LETTERS=z,e.ARABIC_LETTERS_SAMPLE=`ރަމަޟާން މަހުގެ ޚާއްޞަ ޘަޤާފަތާއި ޝަރީޢަތުގެ ޙަޤީޤަތް ޙިފްޡުކޮށް ޛިކުރުކުރުމަކީ ބަޣާވާތެއް ނޫނެވެ.`,e.DVFONTS_ORIGIN=N,e.FILI=B,e.FSI=`⁨`,e.KEYMAP=t,e.LEGACY_LAYOUTS=j,e.LETTERS=R,e.LRI=`⁦`,e.PANGRAMS=I,e.PDI=`⁩`,e.RLI=`⁧`,e.SYSTEM_THAANA_FONTS=S,e.attachKeyboard=E,e.autoAttach=O,e.convertLegacy=M,e.detectDirection=l,e.fontCssUrl=P,e.fontStack=C,e.hasRtl=s,e.hasThaana=o,e.isMixedScript=c,e.isolate=d,e.isolateNumbers=p,e.loadFonts=F,e.normalizePunctuation=b,e.repairPdfText=x,e.resolveDirection=u,e.stripBidiControls=h,e.thaanaForInputEvent=T,e.transliterate=n,e})({});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yashau/thaana",
3
- "version": "2026.1023.0",
3
+ "version": "2026.1023.2",
4
4
  "description": "Everything to make Thaana (Dhivehi) work on the web: phonetic keyboard for any input, legacy A_-font text converter, bidi helpers, font loading and sane CSS defaults.",
5
5
  "keywords": [
6
6
  "bidi",
package/thaana.css CHANGED
@@ -19,18 +19,18 @@
19
19
  text-align: start;
20
20
  }
21
21
 
22
- /* User-generated content: each paragraph takes its direction from its first
22
+ /* Displayed user content: each paragraph takes its direction from its first
23
23
  letter, so a Latin-first line is LTR and a Thaana-first line is RTL. */
24
- :where(:lang(dv))
25
- :where(p, li, td, th, dd, blockquote, figcaption, h1, h2, h3, h4, h5, h6, input, textarea, [contenteditable]) {
24
+ :where(:lang(dv)) :where(p, li, td, th, dd, blockquote, figcaption, h1, h2, h3, h4, h5, h6) {
26
25
  unicode-bidi: plaintext;
27
26
  }
28
27
 
29
- /* Inputs: keep the caret and placeholder on the right for Thaana. */
30
- :where(input, textarea):where(:lang(dv), [data-thaana]) {
28
+ /* Inputs: keep the caret and placeholder on the right for Thaana. Not
29
+ unicode-bidi: plaintext, which makes an empty field left-to-right (the caret
30
+ starts on the left); attachKeyboard keeps dir in step with the text instead. */
31
+ :where(input, textarea, [contenteditable]):where(:lang(dv), [data-thaana]) {
31
32
  direction: rtl;
32
33
  text-align: start;
33
- unicode-bidi: plaintext;
34
34
  }
35
35
 
36
36
  /* Things that are always left-to-right inside Thaana text. */