Comparing version 2.1.0 to 2.2.0
@@ -26,2 +26,6 @@ # Change Log | ||
## [2.2.0] - 2017-07-13 | ||
### Added | ||
- Options object setting `IMEMode` can now accept `'toHiragana'` or `'toKatakana'` to enforce specific conversion on input | ||
## [2.1.0] - 2017-07-09 | ||
@@ -81,2 +85,3 @@ ### Added | ||
[2.2.0]: https://github.com/WaniKani/WanaKana/compare/2.1.0...2.2.0 | ||
[2.1.0]: https://github.com/WaniKani/WanaKana/compare/2.0.4...2.1.0 | ||
@@ -83,0 +88,0 @@ [2.0.4]: https://github.com/WaniKani/WanaKana/compare/2.0.3...2.0.4 |
@@ -65,3 +65,3 @@ 'use strict'; | ||
* @param {Object} event DOM event to listen to | ||
* @param {defaultOptions} [options] user config overrides, {IMEMode: true} cannot be changed | ||
* @param {defaultOptions} [options] user config overrides, default conversion is toKana() | ||
* @return {Function} event handler with bound options | ||
@@ -71,3 +71,4 @@ * @ignore | ||
function onInput(options) { | ||
var config = Object.assign({}, _constants.DEFAULT_OPTIONS, options, { IMEMode: true }); | ||
var config = Object.assign({}, _constants.DEFAULT_OPTIONS, options); | ||
return function listener(event) { | ||
@@ -77,4 +78,7 @@ var input = event.target; | ||
// const startingLength = input.value.length; | ||
var normalizedInputString = (0, _convertFullwidthCharsToASCII2.default)(input.value); | ||
var newText = (0, _toKana2.default)(normalizedInputString, config); | ||
var hiraOrKataString = setKanaType(normalizedInputString, config.IMEMode); | ||
var ensureIMEModeConfig = Object.assign({}, config, { IMEMode: true }); | ||
var newText = (0, _toKana2.default)(hiraOrKataString, ensureIMEModeConfig); | ||
@@ -98,2 +102,14 @@ if (normalizedInputString !== newText) { | ||
}; | ||
} | ||
// easy way to still use `toKana` to handle IME input - but with forced conversion type | ||
function setKanaType(input, flag) { | ||
switch (true) { | ||
case flag === 'toHiragana': | ||
return input.toLowerCase(); | ||
case flag === 'toKatakana': | ||
return input.toUpperCase(); | ||
default: | ||
return input; | ||
} | ||
} |
@@ -1117,3 +1117,3 @@ /** | ||
* @param {Object} event DOM event to listen to | ||
* @param {defaultOptions} [options] user config overrides, {IMEMode: true} cannot be changed | ||
* @param {defaultOptions} [options] user config overrides, default conversion is toKana() | ||
* @return {Function} event handler with bound options | ||
@@ -1123,3 +1123,4 @@ * @ignore | ||
function onInput(options) { | ||
var config = Object.assign({}, DEFAULT_OPTIONS, options, { IMEMode: true }); | ||
var config = Object.assign({}, DEFAULT_OPTIONS, options); | ||
return function listener(event) { | ||
@@ -1129,4 +1130,7 @@ var input = event.target; | ||
// const startingLength = input.value.length; | ||
var normalizedInputString = convertFullwidthCharsToASCII(input.value); | ||
var newText = toKana(normalizedInputString, config); | ||
var hiraOrKataString = setKanaType(normalizedInputString, config.IMEMode); | ||
var ensureIMEModeConfig = Object.assign({}, config, { IMEMode: true }); | ||
var newText = toKana(hiraOrKataString, ensureIMEModeConfig); | ||
@@ -1152,2 +1156,14 @@ if (normalizedInputString !== newText) { | ||
// easy way to still use `toKana` to handle IME input - but with forced conversion type | ||
function setKanaType(input, flag) { | ||
switch (true) { | ||
case flag === 'toHiragana': | ||
return input.toLowerCase(); | ||
case flag === 'toKatakana': | ||
return input.toUpperCase(); | ||
default: | ||
return input; | ||
} | ||
} | ||
/** | ||
@@ -1154,0 +1170,0 @@ * Tests a character. Returns true if the character is [Romaji](https://en.wikipedia.org/wiki/Romaji) |
@@ -1123,3 +1123,3 @@ (function (global, factory) { | ||
* @param {Object} event DOM event to listen to | ||
* @param {defaultOptions} [options] user config overrides, {IMEMode: true} cannot be changed | ||
* @param {defaultOptions} [options] user config overrides, default conversion is toKana() | ||
* @return {Function} event handler with bound options | ||
@@ -1129,3 +1129,4 @@ * @ignore | ||
function onInput(options) { | ||
var config = Object.assign({}, DEFAULT_OPTIONS, options, { IMEMode: true }); | ||
var config = Object.assign({}, DEFAULT_OPTIONS, options); | ||
return function listener(event) { | ||
@@ -1135,4 +1136,7 @@ var input = event.target; | ||
// const startingLength = input.value.length; | ||
var normalizedInputString = convertFullwidthCharsToASCII(input.value); | ||
var newText = toKana(normalizedInputString, config); | ||
var hiraOrKataString = setKanaType(normalizedInputString, config.IMEMode); | ||
var ensureIMEModeConfig = Object.assign({}, config, { IMEMode: true }); | ||
var newText = toKana(hiraOrKataString, ensureIMEModeConfig); | ||
@@ -1158,2 +1162,14 @@ if (normalizedInputString !== newText) { | ||
// easy way to still use `toKana` to handle IME input - but with forced conversion type | ||
function setKanaType(input, flag) { | ||
switch (true) { | ||
case flag === 'toHiragana': | ||
return input.toLowerCase(); | ||
case flag === 'toKatakana': | ||
return input.toUpperCase(); | ||
default: | ||
return input; | ||
} | ||
} | ||
/** | ||
@@ -1160,0 +1176,0 @@ * Tests a character. Returns true if the character is [Romaji](https://en.wikipedia.org/wiki/Romaji) |
@@ -1,1 +0,1 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(e.wanakana=e.wanakana||{})}(this,function(e){"use strict";function n(e){return"string"!=typeof e||!e.length}function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments[1],a=arguments[2];if(n(e))return!1;var r=e.charCodeAt(0);return r>=t&&a>=r}function a(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return[].concat(ce(e)).map(function(e,n){var a=e.charCodeAt(0),r=t(e,$,ee),o=t(e,ne,te);return r?String.fromCharCode(a-$+X):o?String.fromCharCode(a-ne+B):e}).join("")}function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!n(e)&&t(e,B,F)}function o(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return Math.min(e,n)}function i(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t=arguments[2];return e.slice(n,t)}function u(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=1>=arguments.length||void 0===arguments[1]||arguments[1];if(n(e))return!1;var a=t?/[bcdfghjklmnpqrstvwxyz]/:/[bcdfghjklmnpqrstvwxz]/;return-1!==e.toLowerCase().charAt(0).search(a)}function y(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=1>=arguments.length||void 0===arguments[1]||arguments[1];if(n(e))return!1;var a=t?/[aeiouy]/:/[aeiou]/;return-1!==e.toLowerCase().charAt(0).search(a)}function h(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!n(e)&&e.charCodeAt(0)===ae}function c(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!n(e)&&e.charCodeAt(0)===re}function s(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!n(e)&&(!!h(e)||t(e,G,Q))}function f(){var e=[];return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split("").forEach(function(n){if(h(n)||c(n))e.push(n);else if(s(n)){var t=n.charCodeAt(0)+(V-G),a=String.fromCharCode(t);e.push(a)}else e.push(n)}),e.join("")}function l(){return t(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",V,W)}function d(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!n(e)&&(s(e)||l(e))}function v(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!n(e)&&[].concat(ce(e)).every(d)}function g(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],h=Object.assign({},N,n),c=[],s=0,l=e.length,d=3,g="",w="";l>s;){var p=null;for(d=o(3,l-s);d>0;){if(g=i(e,s,s+d),w=g.toLowerCase(),ie.includes(w)&&l-s>=4)w=(g=i(e,s,s+(d+=1))).toLowerCase();else{if("n"===w.charAt(0)){if(2===d){if(!h.IMEMode&&" "===w.charAt(1)){p="ん ";break}if(h.IMEMode&&"n'"===w){p="ん";break}}u(w.charAt(1),!1)&&y(w.charAt(2))&&(w=(g=i(e,s,s+(d=1))).toLowerCase())}"n"!==w.charAt(0)&&u(w.charAt(0))&&g.charAt(0)===g.charAt(1)&&(d=1,t(g.charAt(0),B,F)?(w="ッ",g="ッ"):(w="っ",g="っ"))}if(null!=(p=ue[w]))break;d-=4===d?2:1}null==p&&(p=g),h.useObsoleteKana&&("wi"===w&&(p="ゐ"),"we"===w&&(p="ゑ")),h.IMEMode&&"n"===w.charAt(0)&&("y"===e.charAt(s+1).toLowerCase()&&!1===y(e.charAt(s+2))||s===l-1||v(e.charAt(s+1)))&&(p=g.charAt(0)),a||r(g.charAt(0))&&(p=f(p)),c.push(p),s+=d||1}return c.join("")}function w(e){var n=m(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{});e instanceof Element&&se.includes(e.nodeName)?(e.autocapitalize="none",e.addEventListener("input",n),fe=fe.concat({id:e.getAttribute("id"),handler:n})):console.warn("Input provided to wanakana.bind was not a valid input field.")}function p(e){var n=fe.find(function(n){return n.id===e.id});null!=n?(e.removeEventListener("input",n.handler),fe=fe.filter(function(e){return e.handler!==n.handler})):console.warn("Input had no listener registered.")}function m(e){var n=Object.assign({},N,e,{IMEMode:!0});return function(e){var t=e.target,r=a(t.value),o=g(r,n);if(r!==o){if(t.value=o,null!=t.setSelectionRange&&"number"==typeof t.selectionStart)return void t.setSelectionRange(t.value.length,t.value.length);if(null!=t.createTextRange){t.focus();var i=t.createTextRange();i.collapse(!1),i.select()}}}}function b(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!n(e)&&_.test(e)}function k(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!n(e)&&[].concat(ce(e)).every(function(e){return b(e)})}function j(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!n(e)&&[].concat(ce(e)).every(function(e){return U.test(e)})}function A(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!n(e)&&[].concat(ce(e)).every(s)}function x(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!n(e)&&[].concat(ce(e)).every(l)}function q(){return t(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",Y,Z)}function C(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!n(e)&&[].concat(ce(e)).every(q)}function z(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{passKanji:!0},t=[].concat(ce(e)),a=!1;return n.passKanji||(a=t.some(C)),(t.some(A)||t.some(x))&&t.some(k)&&!a}function M(){for(var e=[],n="",t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split(""),a=0;t.length>a;a+=1){var r=t[a],o=[c(r),h(r)],i=o[0],u=o[1];if(i||u&&1>a)e.push(r);else if(u&&a>0){var y=ye[n].slice(-1);e.push(oe[y])}else if(l(r)){var s=r.charCodeAt(0)+(G-V),f=String.fromCharCode(s);e.push(f),n=f}else e.push(r),n=""}return e.join("")}function E(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=Object.assign({},N,n),a=e.length,r=[],u=0,y=2,h="",c="",s=void 0;a>u;){y=o(2,a-u);for(var f=!1;y>0;){if(h=i(e,u,u+y),x(h)&&(f=t.upcaseKatakana,h=M(h)),"っ"===h.charAt(0)&&1===y&&a-1>u){s=!0,c="";break}if(null!=(c=ye[h])&&s&&(c=c.charAt(0).concat(c),s=!1),null!=c)break;y-=1}null==c&&(c=h),f&&(c=c.toUpperCase()),r.push(c),u+=y||1}return r.join("")}function K(){return g(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},!0)}function O(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=Object.assign({},N,n);return t.passRomaji?M(e):k(e)?K(e,t):z(e,{passKanji:!0})?K(M(e),t):M(e)}function R(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=Object.assign({},N,n);return f(t.passRomaji?e:k(e)||z(e)?K(e,t):e)}function I(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!n(e)&&D.some(function(n){var a=he(n,2);return t(e,a[0],a[1])})}function S(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return J.some(function(n){var a=he(n,2);return t(e,a[0],a[1])})}function L(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!n(e)&&(I(e)||S(e))}function T(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{all:!1};if(n(e)||!j(e)||v(e))return e;var a=[].concat(ce(e));if(t.all)return a.filter(function(e){return!d(e)}).join("");for(var r=a.reverse(),o=0,i=r.length;i>o;o+=1){var u=r[o];if(!L(u)){if(C(u))break;r[o]=""}}return r.reverse().join("")}function P(e){switch(!0){case S(e):return"japanesePunctuation";case q(e):return"kanji";case s(e):return"hiragana";case l(e):return"katakana";default:return"romaji"}}function H(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";if(n(e))return[""];var t=[].concat(ce(e)),a=t.shift(),r=P(a);return t.reduce(function(e,n){var t=P(n)===r;if(r=P(n),t){var a=e.pop();return e.concat(a.concat(n))}return e.concat(n)},[a])}var N={useObsoleteKana:!1,passRomaji:!1,upcaseKatakana:!1,IMEMode:!1},U=/[\u3000-\u303f\u3040-\u309f\u30a0-\u30ff\uff01-\uff0f\u4e00-\u9faf\u3400-\u4dbf]/,_=/[\u0000-\u007f\u0100-\u0101\u0112-\u0113\u012a-\u012b\u014c-\u014d\u016a-\u016b\u2018-\u2019\u201C-\u201D]/,D=[[33,47],[58,63],[91,96],[123,126],[8216,8217],[8220,8221]],J=[[12289,12350],[12539,12540],[65281,65295],[65306,65311],[65339,65343],[65371,65376]],X=97,B=65,F=90,G=12353,Q=12438,V=12449,W=12540,Y=19968,Z=40879,$=65345,ee=65370,ne=65313,te=65338,ae=12540,re=12539,oe={a:"あ",i:"い",u:"う",e:"え",o:"う"},ie=["lts","chy","shy"],ue={".":"。",",":"、",":":":","/":"・","!":"!","?":"?","~":"〜","-":"ー","‘":"「","’":"」","“":"『","”":"』","[":"[","]":"]","(":"(",")":")","{":"{","}":"}",a:"あ",i:"い",u:"う",e:"え",o:"お",yi:"い",wu:"う",whu:"う",xa:"ぁ",xi:"ぃ",xu:"ぅ",xe:"ぇ",xo:"ぉ",xyi:"ぃ",xye:"ぇ",ye:"いぇ",wha:"うぁ",whi:"うぃ",whe:"うぇ",who:"うぉ",wi:"うぃ",we:"うぇ",va:"ゔぁ",vi:"ゔぃ",vu:"ゔ",ve:"ゔぇ",vo:"ゔぉ",vya:"ゔゃ",vyi:"ゔぃ",vyu:"ゔゅ",vye:"ゔぇ",vyo:"ゔょ",ka:"か",ki:"き",ku:"く",ke:"け",ko:"こ",lka:"ヵ",lke:"ヶ",xka:"ヵ",xke:"ヶ",kya:"きゃ",kyi:"きぃ",kyu:"きゅ",kye:"きぇ",kyo:"きょ",ca:"か",ci:"き",cu:"く",ce:"け",co:"こ",lca:"ヵ",lce:"ヶ",xca:"ヵ",xce:"ヶ",qya:"くゃ",qyu:"くゅ",qyo:"くょ",qwa:"くぁ",qwi:"くぃ",qwu:"くぅ",qwe:"くぇ",qwo:"くぉ",qa:"くぁ",qi:"くぃ",qe:"くぇ",qo:"くぉ",kwa:"くぁ",qyi:"くぃ",qye:"くぇ",ga:"が",gi:"ぎ",gu:"ぐ",ge:"げ",go:"ご",gya:"ぎゃ",gyi:"ぎぃ",gyu:"ぎゅ",gye:"ぎぇ",gyo:"ぎょ",gwa:"ぐぁ",gwi:"ぐぃ",gwu:"ぐぅ",gwe:"ぐぇ",gwo:"ぐぉ",sa:"さ",si:"し",shi:"し",su:"す",se:"せ",so:"そ",za:"ざ",zi:"じ",zu:"ず",ze:"ぜ",zo:"ぞ",ji:"じ",sya:"しゃ",syi:"しぃ",syu:"しゅ",sye:"しぇ",syo:"しょ",sha:"しゃ",shu:"しゅ",she:"しぇ",sho:"しょ",shya:"しゃ",shyu:"しゅ",shye:"しぇ",shyo:"しょ",swa:"すぁ",swi:"すぃ",swu:"すぅ",swe:"すぇ",swo:"すぉ",zya:"じゃ",zyi:"じぃ",zyu:"じゅ",zye:"じぇ",zyo:"じょ",ja:"じゃ",ju:"じゅ",je:"じぇ",jo:"じょ",jya:"じゃ",jyi:"じぃ",jyu:"じゅ",jye:"じぇ",jyo:"じょ",ta:"た",ti:"ち",tu:"つ",te:"て",to:"と",chi:"ち",tsu:"つ",ltu:"っ",xtu:"っ",tya:"ちゃ",tyi:"ちぃ",tyu:"ちゅ",tye:"ちぇ",tyo:"ちょ",cha:"ちゃ",chu:"ちゅ",che:"ちぇ",cho:"ちょ",cya:"ちゃ",cyi:"ちぃ",cyu:"ちゅ",cye:"ちぇ",cyo:"ちょ",chya:"ちゃ",chyu:"ちゅ",chye:"ちぇ",chyo:"ちょ",tsa:"つぁ",tsi:"つぃ",tse:"つぇ",tso:"つぉ",tha:"てゃ",thi:"てぃ",thu:"てゅ",the:"てぇ",tho:"てょ",twa:"とぁ",twi:"とぃ",twu:"とぅ",twe:"とぇ",two:"とぉ",da:"だ",di:"ぢ",du:"づ",de:"で",do:"ど",dya:"ぢゃ",dyi:"ぢぃ",dyu:"ぢゅ",dye:"ぢぇ",dyo:"ぢょ",dha:"でゃ",dhi:"でぃ",dhu:"でゅ",dhe:"でぇ",dho:"でょ",dwa:"どぁ",dwi:"どぃ",dwu:"どぅ",dwe:"どぇ",dwo:"どぉ",na:"な",ni:"に",nu:"ぬ",ne:"ね",no:"の",nya:"にゃ",nyi:"にぃ",nyu:"にゅ",nye:"にぇ",nyo:"にょ",ha:"は",hi:"ひ",hu:"ふ",he:"へ",ho:"ほ",fu:"ふ",hya:"ひゃ",hyi:"ひぃ",hyu:"ひゅ",hye:"ひぇ",hyo:"ひょ",fya:"ふゃ",fyu:"ふゅ",fyo:"ふょ",fwa:"ふぁ",fwi:"ふぃ",fwu:"ふぅ",fwe:"ふぇ",fwo:"ふぉ",fa:"ふぁ",fi:"ふぃ",fe:"ふぇ",fo:"ふぉ",fyi:"ふぃ",fye:"ふぇ",ba:"ば",bi:"び",bu:"ぶ",be:"べ",bo:"ぼ",bya:"びゃ",byi:"びぃ",byu:"びゅ",bye:"びぇ",byo:"びょ",pa:"ぱ",pi:"ぴ",pu:"ぷ",pe:"ぺ",po:"ぽ",pya:"ぴゃ",pyi:"ぴぃ",pyu:"ぴゅ",pye:"ぴぇ",pyo:"ぴょ",ma:"ま",mi:"み",mu:"む",me:"め",mo:"も",mya:"みゃ",myi:"みぃ",myu:"みゅ",mye:"みぇ",myo:"みょ",ya:"や",yu:"ゆ",yo:"よ",xya:"ゃ",xyu:"ゅ",xyo:"ょ",ra:"ら",ri:"り",ru:"る",re:"れ",ro:"ろ",rya:"りゃ",ryi:"りぃ",ryu:"りゅ",rye:"りぇ",ryo:"りょ",la:"ら",li:"り",lu:"る",le:"れ",lo:"ろ",lya:"りゃ",lyi:"りぃ",lyu:"りゅ",lye:"りぇ",lyo:"りょ",wa:"わ",wo:"を",lwe:"ゎ",xwa:"ゎ",n:"ん",nn:"ん","n'":"ん","n ":"ん",xn:"ん",ltsu:"っ"},ye={" ":" ","!":"!","?":"?","。":".",":":":","・":"/","、":",","〜":"~","ー":"-","「":"‘","」":"’","『":"“","』":"”","[":"[","]":"]","(":"(",")":")","{":"{","}":"}","あ":"a","い":"i","う":"u","え":"e","お":"o","ゔぁ":"va","ゔぃ":"vi","ゔ":"vu","ゔぇ":"ve","ゔぉ":"vo","か":"ka","き":"ki","きゃ":"kya","きぃ":"kyi","きゅ":"kyu","く":"ku","け":"ke","こ":"ko","が":"ga","ぎ":"gi","ぐ":"gu","げ":"ge","ご":"go","ぎゃ":"gya","ぎぃ":"gyi","ぎゅ":"gyu","ぎぇ":"gye","ぎょ":"gyo","さ":"sa","す":"su","せ":"se","そ":"so","ざ":"za","ず":"zu","ぜ":"ze","ぞ":"zo","し":"shi","しゃ":"sha","しゅ":"shu","しょ":"sho","じ":"ji","じゃ":"ja","じゅ":"ju","じょ":"jo","た":"ta","ち":"chi","ちゃ":"cha","ちゅ":"chu","ちょ":"cho","つ":"tsu","て":"te","と":"to","だ":"da","ぢ":"di","づ":"du","で":"de","ど":"do","な":"na","に":"ni","にゃ":"nya","にゅ":"nyu","にょ":"nyo","ぬ":"nu","ね":"ne","の":"no","は":"ha","ひ":"hi","ふ":"fu","へ":"he","ほ":"ho","ひゃ":"hya","ひゅ":"hyu","ひょ":"hyo","ふぁ":"fa","ふぃ":"fi","ふぇ":"fe","ふぉ":"fo","ば":"ba","び":"bi","ぶ":"bu","べ":"be","ぼ":"bo","びゃ":"bya","びゅ":"byu","びょ":"byo","ぱ":"pa","ぴ":"pi","ぷ":"pu","ぺ":"pe","ぽ":"po","ぴゃ":"pya","ぴゅ":"pyu","ぴょ":"pyo","ま":"ma","み":"mi","む":"mu","め":"me","も":"mo","みゃ":"mya","みゅ":"myu","みょ":"myo","や":"ya","ゆ":"yu","よ":"yo","ら":"ra","り":"ri","る":"ru","れ":"re","ろ":"ro","りゃ":"rya","りゅ":"ryu","りょ":"ryo","わ":"wa","を":"wo","ん":"n","ゐ":"wi","ゑ":"we","きぇ":"kye","きょ":"kyo","じぃ":"jyi","じぇ":"jye","ちぃ":"cyi","ちぇ":"che","ひぃ":"hyi","ひぇ":"hye","びぃ":"byi","びぇ":"bye","ぴぃ":"pyi","ぴぇ":"pye","みぇ":"mye","みぃ":"myi","りぃ":"ryi","りぇ":"rye","にぃ":"nyi","にぇ":"nye","しぃ":"syi","しぇ":"she","いぇ":"ye","うぁ":"wha","うぉ":"who","うぃ":"wi","うぇ":"we","ゔゃ":"vya","ゔゅ":"vyu","ゔょ":"vyo","すぁ":"swa","すぃ":"swi","すぅ":"swu","すぇ":"swe","すぉ":"swo","くゃ":"qya","くゅ":"qyu","くょ":"qyo","くぁ":"qwa","くぃ":"qwi","くぅ":"qwu","くぇ":"qwe","くぉ":"qwo","ぐぁ":"gwa","ぐぃ":"gwi","ぐぅ":"gwu","ぐぇ":"gwe","ぐぉ":"gwo","つぁ":"tsa","つぃ":"tsi","つぇ":"tse","つぉ":"tso","てゃ":"tha","てぃ":"thi","てゅ":"thu","てぇ":"the","てょ":"tho","とぁ":"twa","とぃ":"twi","とぅ":"twu","とぇ":"twe","とぉ":"two","ぢゃ":"dya","ぢぃ":"dyi","ぢゅ":"dyu","ぢぇ":"dye","ぢょ":"dyo","でゃ":"dha","でぃ":"dhi","でゅ":"dhu","でぇ":"dhe","でょ":"dho","どぁ":"dwa","どぃ":"dwi","どぅ":"dwu","どぇ":"dwe","どぉ":"dwo","ふぅ":"fwu","ふゃ":"fya","ふゅ":"fyu","ふょ":"fyo","ぁ":"a","ぃ":"i","ぇ":"e","ぅ":"u","ぉ":"o","ゃ":"ya","ゅ":"yu","ょ":"yo","っ":"","ゕ":"ka","ゖ":"ka","ゎ":"wa","んあ":"n'a","んい":"n'i","んう":"n'u","んえ":"n'e","んお":"n'o","んや":"n'ya","んゆ":"n'yu","んよ":"n'yo"},he=function(){function e(e,n){var t=[],a=!0,r=!1,o=void 0;try{for(var i,u=e[Symbol.iterator]();!(a=(i=u.next()).done)&&(t.push(i.value),!n||t.length!==n);a=!0);}catch(e){r=!0,o=e}finally{try{!a&&u.return&&u.return()}finally{if(r)throw o}}return t}return function(n,t){if(Array.isArray(n))return n;if(Symbol.iterator in Object(n))return e(n,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),ce=function(e){if(Array.isArray(e)){for(var n=0,t=Array(e.length);e.length>n;n++)t[n]=e[n];return t}return Array.from(e)},se=["TEXTAREA","INPUT"],fe=[];e.bind=w,e.unbind=p,e.isRomaji=k,e.isJapanese=j,e.isKana=v,e.isHiragana=A,e.isKatakana=x,e.isMixed=z,e.isKanji=C,e.toRomaji=E,e.toKana=g,e.toHiragana=O,e.toKatakana=R,e.stripOkurigana=T,e.tokenize=H,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(e.wanakana=e.wanakana||{})}(this,function(e){"use strict";function n(e){return"string"!=typeof e||!e.length}function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments[1],a=arguments[2];if(n(e))return!1;var r=e.charCodeAt(0);return r>=t&&a>=r}function a(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return[].concat(se(e)).map(function(e,n){var a=e.charCodeAt(0),r=t(e,ee,ne),o=t(e,te,ae);return r?String.fromCharCode(a-ee+B):o?String.fromCharCode(a-te+F):e}).join("")}function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!n(e)&&t(e,F,G)}function o(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return Math.min(e,n)}function i(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t=arguments[2];return e.slice(n,t)}function u(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=1>=arguments.length||void 0===arguments[1]||arguments[1];if(n(e))return!1;var a=t?/[bcdfghjklmnpqrstvwxyz]/:/[bcdfghjklmnpqrstvwxz]/;return-1!==e.toLowerCase().charAt(0).search(a)}function y(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=1>=arguments.length||void 0===arguments[1]||arguments[1];if(n(e))return!1;var a=t?/[aeiouy]/:/[aeiou]/;return-1!==e.toLowerCase().charAt(0).search(a)}function c(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!n(e)&&e.charCodeAt(0)===re}function h(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!n(e)&&e.charCodeAt(0)===oe}function s(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!n(e)&&(!!c(e)||t(e,Q,V))}function f(){var e=[];return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split("").forEach(function(n){if(c(n)||h(n))e.push(n);else if(s(n)){var t=n.charCodeAt(0)+(W-Q),a=String.fromCharCode(t);e.push(a)}else e.push(n)}),e.join("")}function l(){return t(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",W,Y)}function d(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!n(e)&&(s(e)||l(e))}function v(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!n(e)&&[].concat(se(e)).every(d)}function g(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],c=Object.assign({},N,n),h=[],s=0,l=e.length,d=3,g="",w="";l>s;){var p=null;for(d=o(3,l-s);d>0;){if(g=i(e,s,s+d),w=g.toLowerCase(),ue.includes(w)&&l-s>=4)w=(g=i(e,s,s+(d+=1))).toLowerCase();else{if("n"===w.charAt(0)){if(2===d){if(!c.IMEMode&&" "===w.charAt(1)){p="ん ";break}if(c.IMEMode&&"n'"===w){p="ん";break}}u(w.charAt(1),!1)&&y(w.charAt(2))&&(w=(g=i(e,s,s+(d=1))).toLowerCase())}"n"!==w.charAt(0)&&u(w.charAt(0))&&g.charAt(0)===g.charAt(1)&&(d=1,t(g.charAt(0),F,G)?(w="ッ",g="ッ"):(w="っ",g="っ"))}if(null!=(p=ye[w]))break;d-=4===d?2:1}null==p&&(p=g),c.useObsoleteKana&&("wi"===w&&(p="ゐ"),"we"===w&&(p="ゑ")),c.IMEMode&&"n"===w.charAt(0)&&("y"===e.charAt(s+1).toLowerCase()&&!1===y(e.charAt(s+2))||s===l-1||v(e.charAt(s+1)))&&(p=g.charAt(0)),a||r(g.charAt(0))&&(p=f(p)),h.push(p),s+=d||1}return h.join("")}function w(e){var n=b(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{});e instanceof Element&&fe.includes(e.nodeName)?(e.autocapitalize="none",e.addEventListener("input",n),le=le.concat({id:e.getAttribute("id"),handler:n})):console.warn("Input provided to wanakana.bind was not a valid input field.")}function p(e){var n=le.find(function(n){return n.id===e.id});null!=n?(e.removeEventListener("input",n.handler),le=le.filter(function(e){return e.handler!==n.handler})):console.warn("Input had no listener registered.")}function b(e){var n=Object.assign({},N,e);return function(e){var t=e.target,r=a(t.value),o=g(m(r,n.IMEMode),Object.assign({},n,{IMEMode:!0}));if(r!==o){if(t.value=o,null!=t.setSelectionRange&&"number"==typeof t.selectionStart)return void t.setSelectionRange(t.value.length,t.value.length);if(null!=t.createTextRange){t.focus();var i=t.createTextRange();i.collapse(!1),i.select()}}}}function m(e,n){switch(!0){case"toHiragana"===n:return e.toLowerCase();case"toKatakana"===n:return e.toUpperCase();default:return e}}function k(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!n(e)&&D.test(e)}function j(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!n(e)&&[].concat(se(e)).every(function(e){return k(e)})}function A(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!n(e)&&[].concat(se(e)).every(function(e){return _.test(e)})}function x(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!n(e)&&[].concat(se(e)).every(s)}function q(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!n(e)&&[].concat(se(e)).every(l)}function C(){return t(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",Z,$)}function z(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!n(e)&&[].concat(se(e)).every(C)}function M(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{passKanji:!0},t=[].concat(se(e)),a=!1;return n.passKanji||(a=t.some(z)),(t.some(x)||t.some(q))&&t.some(j)&&!a}function E(){for(var e=[],n="",t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split(""),a=0;t.length>a;a+=1){var r=t[a],o=[h(r),c(r)],i=o[0],u=o[1];if(i||u&&1>a)e.push(r);else if(u&&a>0){var y=ce[n].slice(-1);e.push(ie[y])}else if(l(r)){var s=r.charCodeAt(0)+(Q-W),f=String.fromCharCode(s);e.push(f),n=f}else e.push(r),n=""}return e.join("")}function K(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=Object.assign({},N,n),a=e.length,r=[],u=0,y=2,c="",h="",s=void 0;a>u;){y=o(2,a-u);for(var f=!1;y>0;){if(c=i(e,u,u+y),q(c)&&(f=t.upcaseKatakana,c=E(c)),"っ"===c.charAt(0)&&1===y&&a-1>u){s=!0,h="";break}if(null!=(h=ce[c])&&s&&(h=h.charAt(0).concat(h),s=!1),null!=h)break;y-=1}null==h&&(h=c),f&&(h=h.toUpperCase()),r.push(h),u+=y||1}return r.join("")}function O(){return g(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},!0)}function I(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=Object.assign({},N,n);return t.passRomaji?E(e):j(e)?O(e,t):M(e,{passKanji:!0})?O(E(e),t):E(e)}function R(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=Object.assign({},N,n);return f(t.passRomaji?e:j(e)||M(e)?O(e,t):e)}function L(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!n(e)&&J.some(function(n){var a=he(n,2);return t(e,a[0],a[1])})}function S(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return X.some(function(n){var a=he(n,2);return t(e,a[0],a[1])})}function T(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!n(e)&&(L(e)||S(e))}function H(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{all:!1};if(n(e)||!A(e)||v(e))return e;var a=[].concat(se(e));if(t.all)return a.filter(function(e){return!d(e)}).join("");for(var r=a.reverse(),o=0,i=r.length;i>o;o+=1){var u=r[o];if(!T(u)){if(z(u))break;r[o]=""}}return r.reverse().join("")}function P(e){switch(!0){case S(e):return"japanesePunctuation";case C(e):return"kanji";case s(e):return"hiragana";case l(e):return"katakana";default:return"romaji"}}function U(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";if(n(e))return[""];var t=[].concat(se(e)),a=t.shift(),r=P(a);return t.reduce(function(e,n){var t=P(n)===r;if(r=P(n),t){var a=e.pop();return e.concat(a.concat(n))}return e.concat(n)},[a])}var N={useObsoleteKana:!1,passRomaji:!1,upcaseKatakana:!1,IMEMode:!1},_=/[\u3000-\u303f\u3040-\u309f\u30a0-\u30ff\uff01-\uff0f\u4e00-\u9faf\u3400-\u4dbf]/,D=/[\u0000-\u007f\u0100-\u0101\u0112-\u0113\u012a-\u012b\u014c-\u014d\u016a-\u016b\u2018-\u2019\u201C-\u201D]/,J=[[33,47],[58,63],[91,96],[123,126],[8216,8217],[8220,8221]],X=[[12289,12350],[12539,12540],[65281,65295],[65306,65311],[65339,65343],[65371,65376]],B=97,F=65,G=90,Q=12353,V=12438,W=12449,Y=12540,Z=19968,$=40879,ee=65345,ne=65370,te=65313,ae=65338,re=12540,oe=12539,ie={a:"あ",i:"い",u:"う",e:"え",o:"う"},ue=["lts","chy","shy"],ye={".":"。",",":"、",":":":","/":"・","!":"!","?":"?","~":"〜","-":"ー","‘":"「","’":"」","“":"『","”":"』","[":"[","]":"]","(":"(",")":")","{":"{","}":"}",a:"あ",i:"い",u:"う",e:"え",o:"お",yi:"い",wu:"う",whu:"う",xa:"ぁ",xi:"ぃ",xu:"ぅ",xe:"ぇ",xo:"ぉ",xyi:"ぃ",xye:"ぇ",ye:"いぇ",wha:"うぁ",whi:"うぃ",whe:"うぇ",who:"うぉ",wi:"うぃ",we:"うぇ",va:"ゔぁ",vi:"ゔぃ",vu:"ゔ",ve:"ゔぇ",vo:"ゔぉ",vya:"ゔゃ",vyi:"ゔぃ",vyu:"ゔゅ",vye:"ゔぇ",vyo:"ゔょ",ka:"か",ki:"き",ku:"く",ke:"け",ko:"こ",lka:"ヵ",lke:"ヶ",xka:"ヵ",xke:"ヶ",kya:"きゃ",kyi:"きぃ",kyu:"きゅ",kye:"きぇ",kyo:"きょ",ca:"か",ci:"き",cu:"く",ce:"け",co:"こ",lca:"ヵ",lce:"ヶ",xca:"ヵ",xce:"ヶ",qya:"くゃ",qyu:"くゅ",qyo:"くょ",qwa:"くぁ",qwi:"くぃ",qwu:"くぅ",qwe:"くぇ",qwo:"くぉ",qa:"くぁ",qi:"くぃ",qe:"くぇ",qo:"くぉ",kwa:"くぁ",qyi:"くぃ",qye:"くぇ",ga:"が",gi:"ぎ",gu:"ぐ",ge:"げ",go:"ご",gya:"ぎゃ",gyi:"ぎぃ",gyu:"ぎゅ",gye:"ぎぇ",gyo:"ぎょ",gwa:"ぐぁ",gwi:"ぐぃ",gwu:"ぐぅ",gwe:"ぐぇ",gwo:"ぐぉ",sa:"さ",si:"し",shi:"し",su:"す",se:"せ",so:"そ",za:"ざ",zi:"じ",zu:"ず",ze:"ぜ",zo:"ぞ",ji:"じ",sya:"しゃ",syi:"しぃ",syu:"しゅ",sye:"しぇ",syo:"しょ",sha:"しゃ",shu:"しゅ",she:"しぇ",sho:"しょ",shya:"しゃ",shyu:"しゅ",shye:"しぇ",shyo:"しょ",swa:"すぁ",swi:"すぃ",swu:"すぅ",swe:"すぇ",swo:"すぉ",zya:"じゃ",zyi:"じぃ",zyu:"じゅ",zye:"じぇ",zyo:"じょ",ja:"じゃ",ju:"じゅ",je:"じぇ",jo:"じょ",jya:"じゃ",jyi:"じぃ",jyu:"じゅ",jye:"じぇ",jyo:"じょ",ta:"た",ti:"ち",tu:"つ",te:"て",to:"と",chi:"ち",tsu:"つ",ltu:"っ",xtu:"っ",tya:"ちゃ",tyi:"ちぃ",tyu:"ちゅ",tye:"ちぇ",tyo:"ちょ",cha:"ちゃ",chu:"ちゅ",che:"ちぇ",cho:"ちょ",cya:"ちゃ",cyi:"ちぃ",cyu:"ちゅ",cye:"ちぇ",cyo:"ちょ",chya:"ちゃ",chyu:"ちゅ",chye:"ちぇ",chyo:"ちょ",tsa:"つぁ",tsi:"つぃ",tse:"つぇ",tso:"つぉ",tha:"てゃ",thi:"てぃ",thu:"てゅ",the:"てぇ",tho:"てょ",twa:"とぁ",twi:"とぃ",twu:"とぅ",twe:"とぇ",two:"とぉ",da:"だ",di:"ぢ",du:"づ",de:"で",do:"ど",dya:"ぢゃ",dyi:"ぢぃ",dyu:"ぢゅ",dye:"ぢぇ",dyo:"ぢょ",dha:"でゃ",dhi:"でぃ",dhu:"でゅ",dhe:"でぇ",dho:"でょ",dwa:"どぁ",dwi:"どぃ",dwu:"どぅ",dwe:"どぇ",dwo:"どぉ",na:"な",ni:"に",nu:"ぬ",ne:"ね",no:"の",nya:"にゃ",nyi:"にぃ",nyu:"にゅ",nye:"にぇ",nyo:"にょ",ha:"は",hi:"ひ",hu:"ふ",he:"へ",ho:"ほ",fu:"ふ",hya:"ひゃ",hyi:"ひぃ",hyu:"ひゅ",hye:"ひぇ",hyo:"ひょ",fya:"ふゃ",fyu:"ふゅ",fyo:"ふょ",fwa:"ふぁ",fwi:"ふぃ",fwu:"ふぅ",fwe:"ふぇ",fwo:"ふぉ",fa:"ふぁ",fi:"ふぃ",fe:"ふぇ",fo:"ふぉ",fyi:"ふぃ",fye:"ふぇ",ba:"ば",bi:"び",bu:"ぶ",be:"べ",bo:"ぼ",bya:"びゃ",byi:"びぃ",byu:"びゅ",bye:"びぇ",byo:"びょ",pa:"ぱ",pi:"ぴ",pu:"ぷ",pe:"ぺ",po:"ぽ",pya:"ぴゃ",pyi:"ぴぃ",pyu:"ぴゅ",pye:"ぴぇ",pyo:"ぴょ",ma:"ま",mi:"み",mu:"む",me:"め",mo:"も",mya:"みゃ",myi:"みぃ",myu:"みゅ",mye:"みぇ",myo:"みょ",ya:"や",yu:"ゆ",yo:"よ",xya:"ゃ",xyu:"ゅ",xyo:"ょ",ra:"ら",ri:"り",ru:"る",re:"れ",ro:"ろ",rya:"りゃ",ryi:"りぃ",ryu:"りゅ",rye:"りぇ",ryo:"りょ",la:"ら",li:"り",lu:"る",le:"れ",lo:"ろ",lya:"りゃ",lyi:"りぃ",lyu:"りゅ",lye:"りぇ",lyo:"りょ",wa:"わ",wo:"を",lwe:"ゎ",xwa:"ゎ",n:"ん",nn:"ん","n'":"ん","n ":"ん",xn:"ん",ltsu:"っ"},ce={" ":" ","!":"!","?":"?","。":".",":":":","・":"/","、":",","〜":"~","ー":"-","「":"‘","」":"’","『":"“","』":"”","[":"[","]":"]","(":"(",")":")","{":"{","}":"}","あ":"a","い":"i","う":"u","え":"e","お":"o","ゔぁ":"va","ゔぃ":"vi","ゔ":"vu","ゔぇ":"ve","ゔぉ":"vo","か":"ka","き":"ki","きゃ":"kya","きぃ":"kyi","きゅ":"kyu","く":"ku","け":"ke","こ":"ko","が":"ga","ぎ":"gi","ぐ":"gu","げ":"ge","ご":"go","ぎゃ":"gya","ぎぃ":"gyi","ぎゅ":"gyu","ぎぇ":"gye","ぎょ":"gyo","さ":"sa","す":"su","せ":"se","そ":"so","ざ":"za","ず":"zu","ぜ":"ze","ぞ":"zo","し":"shi","しゃ":"sha","しゅ":"shu","しょ":"sho","じ":"ji","じゃ":"ja","じゅ":"ju","じょ":"jo","た":"ta","ち":"chi","ちゃ":"cha","ちゅ":"chu","ちょ":"cho","つ":"tsu","て":"te","と":"to","だ":"da","ぢ":"di","づ":"du","で":"de","ど":"do","な":"na","に":"ni","にゃ":"nya","にゅ":"nyu","にょ":"nyo","ぬ":"nu","ね":"ne","の":"no","は":"ha","ひ":"hi","ふ":"fu","へ":"he","ほ":"ho","ひゃ":"hya","ひゅ":"hyu","ひょ":"hyo","ふぁ":"fa","ふぃ":"fi","ふぇ":"fe","ふぉ":"fo","ば":"ba","び":"bi","ぶ":"bu","べ":"be","ぼ":"bo","びゃ":"bya","びゅ":"byu","びょ":"byo","ぱ":"pa","ぴ":"pi","ぷ":"pu","ぺ":"pe","ぽ":"po","ぴゃ":"pya","ぴゅ":"pyu","ぴょ":"pyo","ま":"ma","み":"mi","む":"mu","め":"me","も":"mo","みゃ":"mya","みゅ":"myu","みょ":"myo","や":"ya","ゆ":"yu","よ":"yo","ら":"ra","り":"ri","る":"ru","れ":"re","ろ":"ro","りゃ":"rya","りゅ":"ryu","りょ":"ryo","わ":"wa","を":"wo","ん":"n","ゐ":"wi","ゑ":"we","きぇ":"kye","きょ":"kyo","じぃ":"jyi","じぇ":"jye","ちぃ":"cyi","ちぇ":"che","ひぃ":"hyi","ひぇ":"hye","びぃ":"byi","びぇ":"bye","ぴぃ":"pyi","ぴぇ":"pye","みぇ":"mye","みぃ":"myi","りぃ":"ryi","りぇ":"rye","にぃ":"nyi","にぇ":"nye","しぃ":"syi","しぇ":"she","いぇ":"ye","うぁ":"wha","うぉ":"who","うぃ":"wi","うぇ":"we","ゔゃ":"vya","ゔゅ":"vyu","ゔょ":"vyo","すぁ":"swa","すぃ":"swi","すぅ":"swu","すぇ":"swe","すぉ":"swo","くゃ":"qya","くゅ":"qyu","くょ":"qyo","くぁ":"qwa","くぃ":"qwi","くぅ":"qwu","くぇ":"qwe","くぉ":"qwo","ぐぁ":"gwa","ぐぃ":"gwi","ぐぅ":"gwu","ぐぇ":"gwe","ぐぉ":"gwo","つぁ":"tsa","つぃ":"tsi","つぇ":"tse","つぉ":"tso","てゃ":"tha","てぃ":"thi","てゅ":"thu","てぇ":"the","てょ":"tho","とぁ":"twa","とぃ":"twi","とぅ":"twu","とぇ":"twe","とぉ":"two","ぢゃ":"dya","ぢぃ":"dyi","ぢゅ":"dyu","ぢぇ":"dye","ぢょ":"dyo","でゃ":"dha","でぃ":"dhi","でゅ":"dhu","でぇ":"dhe","でょ":"dho","どぁ":"dwa","どぃ":"dwi","どぅ":"dwu","どぇ":"dwe","どぉ":"dwo","ふぅ":"fwu","ふゃ":"fya","ふゅ":"fyu","ふょ":"fyo","ぁ":"a","ぃ":"i","ぇ":"e","ぅ":"u","ぉ":"o","ゃ":"ya","ゅ":"yu","ょ":"yo","っ":"","ゕ":"ka","ゖ":"ka","ゎ":"wa","んあ":"n'a","んい":"n'i","んう":"n'u","んえ":"n'e","んお":"n'o","んや":"n'ya","んゆ":"n'yu","んよ":"n'yo"},he=function(){function e(e,n){var t=[],a=!0,r=!1,o=void 0;try{for(var i,u=e[Symbol.iterator]();!(a=(i=u.next()).done)&&(t.push(i.value),!n||t.length!==n);a=!0);}catch(e){r=!0,o=e}finally{try{!a&&u.return&&u.return()}finally{if(r)throw o}}return t}return function(n,t){if(Array.isArray(n))return n;if(Symbol.iterator in Object(n))return e(n,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),se=function(e){if(Array.isArray(e)){for(var n=0,t=Array(e.length);e.length>n;n++)t[n]=e[n];return t}return Array.from(e)},fe=["TEXTAREA","INPUT"],le=[];e.bind=w,e.unbind=p,e.isRomaji=j,e.isJapanese=A,e.isKana=v,e.isHiragana=x,e.isKatakana=q,e.isMixed=M,e.isKanji=z,e.toRomaji=K,e.toKana=g,e.toHiragana=I,e.toKatakana=R,e.stripOkurigana=H,e.tokenize=U,Object.defineProperty(e,"__esModule",{value:!0})}); |
{ | ||
"name": "wanakana", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"license": "MIT", | ||
@@ -12,2 +12,3 @@ "homepage": "http://www.wanakana.com", | ||
"keywords": [ | ||
"english", | ||
"japanese", | ||
@@ -14,0 +15,0 @@ "hiragana", |
@@ -42,3 +42,3 @@ <div align="center"> | ||
const textInput = document.querySelector('#wanakana-input'); | ||
wanakana.bind(textInput); // IME Mode | ||
wanakana.bind(textInput); // uses IMEMode toKana() as default | ||
</script> | ||
@@ -68,8 +68,9 @@ ``` | ||
// Convert characters from a text input while being typed. | ||
IMEMode: false, | ||
IMEMode: false, // alternatives are: true, 'toHiragana', or 'toKatakana' | ||
} | ||
/*** DOM HELPERS ***/ | ||
// Automatically converts to kana using an eventListener on input | ||
// Uses { IMEMode:true } by default (first example on the demo page) | ||
// Automatically converts text using an eventListener on input | ||
// bind() uses option: { IMEMode: true } with `toKana()` by default | ||
// Alternatives are: 'toHiragana' or 'toKatakana' to enforce kana type | ||
wanakana.bind(domElement [, options]); | ||
@@ -82,3 +83,3 @@ | ||
/*** TEXT CHECKING UTILITIES ***/ | ||
wanakana.isJapanese('泣き虫。!〜') // Full-width/zenkaku punctuation allowed | ||
wanakana.isJapanese('泣き虫。!〜') // Full-width/Zenkaku punctuation allowed | ||
// => true | ||
@@ -85,0 +86,0 @@ |
188161
5115
168