vue-keyword-highlight
Advanced tools
Comparing version 0.1.0-beta.9 to 0.1.0-beta.10
import { PluginObject } from 'vue'; | ||
import "./lib/composition-api"; | ||
import component from "./vue-keyword-highlight.vue"; | ||
@@ -4,0 +3,0 @@ declare type InstallableComponent = typeof component & PluginObject<any>; |
@@ -11,3 +11,3 @@ interface IKeywords { | ||
export declare function keywordFilter<T, K extends keyof T>(arr: T[], key: T[K] extends string ? K : never, keywords: Partial<IKeywords>, options: Partial<IOptions>): T[]; | ||
export declare function tokenizeSeparators(str: string, separators: string[]): RegExpMatchArray | string[]; | ||
export declare function tokenizeSeparators(str: string, separators: string[]): string[]; | ||
export {}; |
@@ -1147,4 +1147,6 @@ /****************************************************************************** | ||
function tokenizeSeparators(str, separators) { | ||
var _a; | ||
const reg = new RegExp('([\\wㄱ-ㅎㅏ-ㅣ가-힣]+(?:[^' + separators.join('') + '])?)', 'g'); | ||
return str.match(reg) ?? []; | ||
return (_a = str.match(reg)) !== null && _a !== void 0 ? _a : []; | ||
} | ||
@@ -1457,2 +1459,3 @@ | ||
installable.install = Vue => { | ||
Vue.use(Plugin); | ||
Vue.component('VueKeywordHighlight', installable); | ||
@@ -1459,0 +1462,0 @@ Vue.prototype.$vueKeywordHighlight = useKeywordHighlight; |
@@ -1,1 +0,1 @@ | ||
var VueKeywordHighlight=function(){"use strict";function t(t,n){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var r,o,i=[],u=!0,a=!1;try{for(n=n.call(t);!(u=(r=n.next()).done)&&(i.push(r.value),!e||i.length!==e);u=!0);}catch(t){a=!0,o=t}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}(t,n)||function(t,n){if(!t)return;if("string"==typeof t)return e(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e(t,n)}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function e(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var n,r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},r(t,e)};function o(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}var i=[],u=function(){function t(t){this.active=!0,this.effects=[],this.cleanups=[],this.vm=t}return t.prototype.run=function(t){if(this.active)try{return this.on(),t()}finally{this.off()}},t.prototype.on=function(){this.active&&(i.push(this),n=this)},t.prototype.off=function(){this.active&&(i.pop(),n=i[i.length-1])},t.prototype.stop=function(){this.active&&(this.vm.$destroy(),this.effects.forEach((function(t){return t.stop()})),this.cleanups.forEach((function(t){return t()})),this.active=!1)},t}();function a(){var t,e;return(null===(t=n)||void 0===t?void 0:t.vm)||(null===(e=y())||void 0===e?void 0:e.proxy)}!function(t){function e(e){void 0===e&&(e=!1);var r,o=void 0;return function(t){var e=d;d=!1;try{t()}finally{d=e}}((function(){o=A(h())})),r=t.call(this,o)||this,e||function(t,e){var r;if((e=e||n)&&e.active)return void e.effects.push(t);var o=null===(r=y())||void 0===r?void 0:r.proxy;o&&o.$on("hook:destroyed",(function(){return t.stop()}))}(r),r}(function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)})(e,t)}(u);var c=void 0;try{var f=require("vue");f&&p(f)?c=f:f&&"default"in f&&p(f.default)&&(c=f.default)}catch(t){}var s=null,l=null,d=!0,v="__composition_api_installed__";function p(t){return t&&R(t)&&"Vue"===t.name}function h(){return s}function _(t){if(d){var e=l;null==e||e.scope.off(),null==(l=t)||l.scope.on()}}function y(){return l}var g=new WeakMap;function b(t){if(g.has(t))return g.get(t);var e={proxy:t,update:t.$forceUpdate,type:t.$options,uid:t._uid,emit:t.$emit.bind(t),parent:null,root:null};!function(t){if(!t.scope){var e=new u(t.proxy);t.scope=e,t.proxy.$on("hook:destroyed",(function(){return e.stop()}))}t.scope}(e);return["data","props","attrs","refs","vnode","slots"].forEach((function(n){O(e,n,{get:function(){return t["$".concat(n)]}})})),O(e,"isMounted",{get:function(){return t._isMounted}}),O(e,"isUnmounted",{get:function(){return t._isDestroyed}}),O(e,"isDeactivated",{get:function(){return t._inactive}}),O(e,"emitted",{get:function(){return t._events}}),g.set(t,e),t.$parent&&(e.parent=b(t.$parent)),t.$root&&(e.root=b(t.$root)),e}function m(t){return"function"==typeof t&&/native code/.test(t.toString())}var w="undefined"!=typeof Symbol&&m(Symbol)&&"undefined"!=typeof Reflect&&m(Reflect.ownKeys),$=function(t){return t};function O(t,e,n){var r=n.get,o=n.set;Object.defineProperty(t,e,{enumerable:!0,configurable:!0,get:r||$,set:o||$})}function j(t,e,n,r){Object.defineProperty(t,e,{value:n,enumerable:!!r,writable:!0,configurable:!0})}function S(t,e){return Object.hasOwnProperty.call(t,e)}function x(t){return Array.isArray(t)}var E;function k(t){return null!==t&&"object"==typeof t}function C(t){return"[object Object]"===function(t){return Object.prototype.toString.call(t)}(t)}function R(t){return"function"==typeof t}function A(t,e){void 0===e&&(e={});var n=t.config.silent;t.config.silent=!0;var r=new t(e);return t.config.silent=n,r}function M(t,e){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];if(t.$scopedSlots[e])return t.$scopedSlots[e].apply(t,n)}}var T="composition-api.refKey",F=new WeakMap,B=new WeakMap;function U(t,e,n){var r=h().util;r.warn;var o=r.defineReactive,i=t.__ob__;function u(){i&&k(n)&&!S(n,"__ob__")&&q(n)}if(x(t)){if(function(t){var e=parseFloat(String(t));return e>=0&&Math.floor(e)===e&&isFinite(t)&&e<=4294967295}(e))return t.length=Math.max(t.length,e),t.splice(e,1,n),u(),n;if("length"===e&&n!==t.length)return t.length=n,null==i||i.dep.notify(),n}return e in t&&!(e in Object.prototype)?(t[e]=n,u(),n):t._isVue||i&&i.vmCount?n:i?(o(i.value,e,n),I(t,e,n),u(),i.dep.notify(),n):(t[e]=n,n)}var V=function(t){O(this,"value",{get:t.get,set:t.set})};function H(t,e,n){void 0===e&&(e=!1),void 0===n&&(n=!1);var r=new V(t);n&&(r.effect=!0);var o=Object.seal(r);return e&&B.set(o,!0),o}function K(t){var e;if(P(t))return t;var n=X(((e={})[T]=t,e));return H({get:function(){return n[T]},set:function(t){return n[T]=t}})}function P(t){return t instanceof V}function N(t,e){e in t||U(t,e,void 0);var n=t[e];return P(n)?n:H({get:function(){return t[e]},set:function(n){return t[e]=n}})}function W(t){var e;return Boolean(t&&S(t,"__ob__")&&"object"==typeof t.__ob__&&(null===(e=t.__ob__)||void 0===e?void 0:e.__v_skip))}function z(t){var e;return Boolean(t&&S(t,"__ob__")&&"object"==typeof t.__ob__&&!(null===(e=t.__ob__)||void 0===e?void 0:e.__v_skip))}function D(t){if(!(!C(t)||W(t)||x(t)||P(t)||(e=t,n=h(),n&&e instanceof n)||F.has(t))){var e,n;F.set(t,!0);for(var r=Object.keys(t),o=0;o<r.length;o++)I(t,r[o])}}function I(t,e,n){if("__ob__"!==e&&!W(t[e])){var r,o,i=Object.getOwnPropertyDescriptor(t,e);if(i){if(!1===i.configurable)return;r=i.get,o=i.set,r&&!o||2!==arguments.length||(n=t[e])}D(n),O(t,e,{get:function(){var o=r?r.call(t):n;return e!==T&&P(o)?o.value:o},set:function(i){r&&!o||(e!==T&&P(n)&&!P(i)?n.value=i:o?(o.call(t,i),n=i):n=i,D(i))}})}}function L(t){var e,n=s||c;n.observable?e=n.observable(t):e=A(n,{data:{$$state:t}})._data.$$state;return S(e,"__ob__")||q(e),e}function q(t,e){var n,r;if(void 0===e&&(e=new Set),!e.has(t)&&!S(t,"__ob__")&&Object.isExtensible(t)){j(t,"__ob__",function(t){void 0===t&&(t={});return{value:t,dep:{notify:$,depend:$,addSub:$,removeSub:$}}}(t)),e.add(t);try{for(var i=o(Object.keys(t)),u=i.next();!u.done;u=i.next()){var a=t[u.value];(C(a)||x(a))&&!W(a)&&Object.isExtensible(a)&&q(a,e)}}catch(t){n={error:t}}finally{try{u&&!u.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}}}function X(t){if(!k(t))return t;if(!C(t)&&!x(t)||W(t)||!Object.isExtensible(t))return t;var e=L(t);return D(e),e}function J(t){var e,n,r,o,i=a();if(R(t)?e=t:(e=t.get,n=t.set),i&&!i.$isServer){var u,c=function(){if(!E){var t=A(h(),{computed:{value:function(){return 0}}}),e=t._computedWatchers.value.constructor,n=t._data.__ob__.dep.constructor;E={Watcher:e,Dep:n},t.$destroy()}return E}(),f=c.Watcher,s=c.Dep;o=function(){return u||(u=new f(i,e,$,{lazy:!0})),u.dirty&&u.evaluate(),s.target&&u.depend(),u.value},r=function(t){n&&n(t)}}else{var l=A(h(),{computed:{$$state:{get:e,set:n}}});i&&i.$on("hook:destroyed",(function(){return l.$destroy()})),o=function(){return l.$$state},r=function(t){l.$$state=t}}return H({get:o,set:r},!n,!0)}var G={set:function(t,e,n){(t.__composition_api_state__=t.__composition_api_state__||{})[e]=n},get:function(t,e){return(t.__composition_api_state__||{})[e]}};function Q(t){var e=G.get(t,"rawBindings")||{};if(e&&Object.keys(e).length){for(var n=t.$refs,r=G.get(t,"refs")||[],o=0;o<r.length;o++){var i=e[c=r[o]];!n[c]&&i&&P(i)&&(i.value=null)}var u=Object.keys(n),a=[];for(o=0;o<u.length;o++){var c;i=e[c=u[o]];n[c]&&i&&P(i)&&(i.value=n[c],a.push(c))}G.set(t,"refs",a)}}function Y(t){for(var e=[t._vnode];e.length;){var n=e.pop();if(n&&(n.context&&Q(n.context),n.children))for(var r=0;r<n.children.length;++r)e.push(n.children[r])}}function Z(t,e){var n,r;if(t){var i=G.get(t,"attrBindings");if(i||e){if(!i){var u=X({});i={ctx:e,data:u},G.set(t,"attrBindings",i),O(e,"attrs",{get:function(){return null==i?void 0:i.data},set:function(){}})}var a=t.$attrs,c=function(e){S(i.data,e)||O(i.data,e,{get:function(){return t.$attrs[e]}})};try{for(var f=o(Object.keys(a)),s=f.next();!s.done;s=f.next()){c(s.value)}}catch(t){n={error:t}}finally{try{s&&!s.done&&(r=f.return)&&r.call(f)}finally{if(n)throw n.error}}}}}function tt(t,e){var n=t.$options._parentVnode;if(n){for(var r=G.get(t,"slots")||[],o=function(t,e){var n;if(t){if(t._normalized)return t._normalized;for(var r in n={},t)t[r]&&"$"!==r[0]&&(n[r]=!0)}else n={};for(var r in e)r in n||(n[r]=!0);return n}(n.data.scopedSlots,t.$slots),i=0;i<r.length;i++){o[a=r[i]]||delete e[a]}var u=Object.keys(o);for(i=0;i<u.length;i++){var a;e[a=u[i]]||(e[a]=M(t,a))}G.set(t,"slots",u)}}function et(t,e,n){var r=y();_(t);try{return e(t)}catch(t){if(!n)throw t;n(t)}finally{_(r)}}function nt(t){function e(t,n){if(void 0===n&&(n=new Set),!n.has(t)&&C(t)&&!P(t)&&!z(t)&&!W(t)){var r=h().util.defineReactive;Object.keys(t).forEach((function(o){var i=t[o];r(t,o,i),i&&(n.add(i),e(i,n))}))}}function n(t,e){return void 0===e&&(e=new Map),e.has(t)?e.get(t):(e.set(t,!1),x(t)&&z(t)?(e.set(t,!0),!0):!(!C(t)||W(t)||P(t))&&Object.keys(t).some((function(r){return n(t[r],e)})))}t.mixin({beforeCreate:function(){var t=this,r=t.$options,o=r.setup,i=r.render;i&&(r.render=function(){for(var e=this,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return et(b(t),(function(){return i.apply(e,n)}))});if(!o)return;if(!R(o))return;var u=r.data;r.data=function(){return function(t,r){void 0===r&&(r={});var o,i=t.$options.setup,u=function(t){var e={slots:{}},n=["emit"];return["root","parent","refs","listeners","isServer","ssrContext"].forEach((function(n){var r="$".concat(n);O(e,n,{get:function(){return t[r]},set:function(){}})})),Z(t,e),n.forEach((function(n){var r="$".concat(n);O(e,n,{get:function(){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t[r].apply(t,e)}}})})),e}(t),a=b(t);if(a.setupContext=u,j(r,"__ob__",function(){return L({}).__ob__}()),tt(t,u.slots),et(a,(function(){o=i(r,u)})),!o)return;if(R(o)){var c=o;return void(t.$options.render=function(){return tt(t,u.slots),et(a,(function(){return c()}))})}if(k(o)){z(o)&&(o=function(t){if(!C(t))return t;var e={};for(var n in t)e[n]=N(t,n);return e}(o)),G.set(t,"rawBindings",o);var f=o;Object.keys(f).forEach((function(r){var o=f[r];if(!P(o))if(z(o))x(o)&&(o=K(o));else if(R(o)){var i=o;o=o.bind(t),Object.keys(i).forEach((function(t){o[t]=i[t]}))}else k(o)?n(o)&&e(o):o=K(o);!function(t,e,n){var r=t.$options.props;e in t||r&&S(r,e)||(P(n)?O(t,e,{get:function(){return n.value},set:function(t){n.value=t}}):O(t,e,{get:function(){return z(n)&&n.__ob__.dep.depend(),n},set:function(t){n=t}}))}(t,r,o)}))}}(t,t.$props),R(u)?u.call(t,t):u||{}}},mounted:function(){Y(this)},beforeUpdate:function(){Z(this)},updated:function(){Y(this)}})}function rt(t,e){if(!t)return e;if(!e)return t;for(var n,r,o,i=w?Reflect.ownKeys(t):Object.keys(t),u=0;u<i.length;u++)"__ob__"!==(n=i[u])&&(r=e[n],o=t[n],S(e,n)?r!==o&&C(r)&&!P(r)&&C(o)&&!P(o)&&rt(o,r):e[n]=o);return e}function ot(t){(function(t){return s&&S(t,v)})(t)||(t.config.optionMergeStrategies.setup=function(t,e){return function(n,r){return rt(R(t)?t(n,r)||{}:void 0,R(e)?e(n,r)||{}:void 0)}},function(t){s=t,Object.defineProperty(t,v,{configurable:!0,writable:!0,value:!0})}(t),nt(t))}var it={install:function(t){return ot(t)}};"undefined"!=typeof window&&window.Vue&&window.Vue.use(it);var ut=X({search:"",separators:[" ",","],highlightField:null,options:{color:"pink"}});function at(){return{setSearch:function(t){ut.search=t},setHighlightField:function(t){ut.highlightField=t},getOptions:function(){return ut.options},getSearchKeywords:function(){return(t=ut.search,e=ut.separators,r=new RegExp("([\\wㄱ-ㅎㅏ-ㅣ가-힣]+(?:[^"+e.join("")+"])?)","g"),null!==(n=t.match(r))&&void 0!==n?n:[]).filter(ct).sort(ft);var t,e,n,r},getHighlightField:function(){return ut.highlightField}}}function ct(t,e,n){return n.indexOf(t)===e}function ft(t,e){return e.length-t.length}var st={name:"vue-keyword-highlight",props:{text:{type:String,default:"",required:!0},field:{type:String}},setup:function(e){var n=at(),r=n.getSearchKeywords,o=n.getOptions,i=n.getHighlightField,u=J((function(){return r()})),a=J((function(){return o()})),c=J((function(){var t=i();return["string"==typeof t,t]}));return{output:J((function(){var n=e.text;return c.value[0]&&e.field!==c.value[1]?n:u.value.reduce((function(e,r){for(var o,i,u,c,f=n.indexOf(r);-1!==f;){for(var s=0;s<r.length;s++)e[f+s]=(o=r[s],i=void 0,u=void 0,c=void 0,(c=document.createElement("b")).setAttribute("style",(i={highlightColor:a.value.color},u=i.highlightColor,Object.entries({background:u}).map((function(e){var n=t(e,2),r=n[0],o=n[1];return"".concat(r,":").concat(o)})).join(";"))),c.innerText=o,c.outerHTML);f=n.indexOf(r,f+1)}return e}),Array.from(n)).join("")})),options:a}}};function lt(t,e,n,r,o,i,u,a,c,f){"boolean"!=typeof u&&(c=a,a=u,u=!1);const s="function"==typeof n?n.options:n;let l;if(t&&t.render&&(s.render=t.render,s.staticRenderFns=t.staticRenderFns,s._compiled=!0,o&&(s.functional=!0)),r&&(s._scopeId=r),i?(l=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),e&&e.call(this,c(t)),t&&t._registeredComponents&&t._registeredComponents.add(i)},s._ssrRegister=l):e&&(l=u?function(t){e.call(this,f(t,this.$root.$options.shadowRoot))}:function(t){e.call(this,a(t))}),l)if(s.functional){const t=s.render;s.render=function(e,n){return l.call(n),t(e,n)}}else{const t=s.beforeCreate;s.beforeCreate=t?[].concat(t,l):[l]}return n}const dt="undefined"!=typeof navigator&&/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());function vt(t){return(t,e)=>function(t,e){const n=dt?e.media||"default":t,r=ht[n]||(ht[n]={ids:new Set,styles:[]});if(!r.ids.has(t)){r.ids.add(t);let n=e.source;if(e.map&&(n+="\n/*# sourceURL="+e.map.sources[0]+" */",n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(e.map))))+" */"),r.element||(r.element=document.createElement("style"),r.element.type="text/css",e.media&&r.element.setAttribute("media",e.media),void 0===pt&&(pt=document.head||document.getElementsByTagName("head")[0]),pt.appendChild(r.element)),"styleSheet"in r.element)r.styles.push(n),r.element.styleSheet.cssText=r.styles.filter(Boolean).join("\n");else{const t=r.ids.size-1,e=document.createTextNode(n),o=r.element.childNodes;o[t]&&r.element.removeChild(o[t]),o.length?r.element.insertBefore(e,o[t]):r.element.appendChild(e)}}}(t,e)}let pt;const ht={};var _t=lt({render:function(){var t=this,e=t.$createElement;return(t._self._c||e)("span",{domProps:{innerHTML:t._s(t.output)}})},staticRenderFns:[]},(function(t){t&&t("data-v-7979f15c_0",{source:"[data-v-7979f15c] b{font-weight:400}",map:void 0,media:void 0})}),st,"data-v-7979f15c",false,undefined,!1,vt,void 0,void 0),yt=function(){var t=_t;return t.install=function(e){e.component("VueKeywordHighlight",t),e.prototype.$vueKeywordHighlight=at},t}(),gt=Object.freeze({__proto__:null,default:yt});return Object.entries(gt).forEach((function(e){var n=t(e,2),r=n[0],o=n[1];"default"!==r&&(yt[r]=o)})),yt}(); | ||
var VueKeywordHighlight=function(){"use strict";function t(t,n){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var r,o,i=[],u=!0,a=!1;try{for(n=n.call(t);!(u=(r=n.next()).done)&&(i.push(r.value),!e||i.length!==e);u=!0);}catch(t){a=!0,o=t}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}(t,n)||function(t,n){if(!t)return;if("string"==typeof t)return e(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e(t,n)}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function e(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var n,r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},r(t,e)};function o(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}var i=[],u=function(){function t(t){this.active=!0,this.effects=[],this.cleanups=[],this.vm=t}return t.prototype.run=function(t){if(this.active)try{return this.on(),t()}finally{this.off()}},t.prototype.on=function(){this.active&&(i.push(this),n=this)},t.prototype.off=function(){this.active&&(i.pop(),n=i[i.length-1])},t.prototype.stop=function(){this.active&&(this.vm.$destroy(),this.effects.forEach((function(t){return t.stop()})),this.cleanups.forEach((function(t){return t()})),this.active=!1)},t}();function a(){var t,e;return(null===(t=n)||void 0===t?void 0:t.vm)||(null===(e=y())||void 0===e?void 0:e.proxy)}!function(t){function e(e){void 0===e&&(e=!1);var r,o=void 0;return function(t){var e=d;d=!1;try{t()}finally{d=e}}((function(){o=A(h())})),r=t.call(this,o)||this,e||function(t,e){var r;if((e=e||n)&&e.active)return void e.effects.push(t);var o=null===(r=y())||void 0===r?void 0:r.proxy;o&&o.$on("hook:destroyed",(function(){return t.stop()}))}(r),r}(function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)})(e,t)}(u);var c=void 0;try{var f=require("vue");f&&p(f)?c=f:f&&"default"in f&&p(f.default)&&(c=f.default)}catch(t){}var s=null,l=null,d=!0,v="__composition_api_installed__";function p(t){return t&&R(t)&&"Vue"===t.name}function h(){return s}function _(t){if(d){var e=l;null==e||e.scope.off(),null==(l=t)||l.scope.on()}}function y(){return l}var g=new WeakMap;function b(t){if(g.has(t))return g.get(t);var e={proxy:t,update:t.$forceUpdate,type:t.$options,uid:t._uid,emit:t.$emit.bind(t),parent:null,root:null};!function(t){if(!t.scope){var e=new u(t.proxy);t.scope=e,t.proxy.$on("hook:destroyed",(function(){return e.stop()}))}t.scope}(e);return["data","props","attrs","refs","vnode","slots"].forEach((function(n){O(e,n,{get:function(){return t["$".concat(n)]}})})),O(e,"isMounted",{get:function(){return t._isMounted}}),O(e,"isUnmounted",{get:function(){return t._isDestroyed}}),O(e,"isDeactivated",{get:function(){return t._inactive}}),O(e,"emitted",{get:function(){return t._events}}),g.set(t,e),t.$parent&&(e.parent=b(t.$parent)),t.$root&&(e.root=b(t.$root)),e}function m(t){return"function"==typeof t&&/native code/.test(t.toString())}var w="undefined"!=typeof Symbol&&m(Symbol)&&"undefined"!=typeof Reflect&&m(Reflect.ownKeys),$=function(t){return t};function O(t,e,n){var r=n.get,o=n.set;Object.defineProperty(t,e,{enumerable:!0,configurable:!0,get:r||$,set:o||$})}function j(t,e,n,r){Object.defineProperty(t,e,{value:n,enumerable:!!r,writable:!0,configurable:!0})}function S(t,e){return Object.hasOwnProperty.call(t,e)}function x(t){return Array.isArray(t)}var E;function k(t){return null!==t&&"object"==typeof t}function C(t){return"[object Object]"===function(t){return Object.prototype.toString.call(t)}(t)}function R(t){return"function"==typeof t}function A(t,e){void 0===e&&(e={});var n=t.config.silent;t.config.silent=!0;var r=new t(e);return t.config.silent=n,r}function M(t,e){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];if(t.$scopedSlots[e])return t.$scopedSlots[e].apply(t,n)}}var T="composition-api.refKey",F=new WeakMap,B=new WeakMap;function U(t,e,n){var r=h().util;r.warn;var o=r.defineReactive,i=t.__ob__;function u(){i&&k(n)&&!S(n,"__ob__")&&q(n)}if(x(t)){if(function(t){var e=parseFloat(String(t));return e>=0&&Math.floor(e)===e&&isFinite(t)&&e<=4294967295}(e))return t.length=Math.max(t.length,e),t.splice(e,1,n),u(),n;if("length"===e&&n!==t.length)return t.length=n,null==i||i.dep.notify(),n}return e in t&&!(e in Object.prototype)?(t[e]=n,u(),n):t._isVue||i&&i.vmCount?n:i?(o(i.value,e,n),I(t,e,n),u(),i.dep.notify(),n):(t[e]=n,n)}var V=function(t){O(this,"value",{get:t.get,set:t.set})};function H(t,e,n){void 0===e&&(e=!1),void 0===n&&(n=!1);var r=new V(t);n&&(r.effect=!0);var o=Object.seal(r);return e&&B.set(o,!0),o}function K(t){var e;if(P(t))return t;var n=X(((e={})[T]=t,e));return H({get:function(){return n[T]},set:function(t){return n[T]=t}})}function P(t){return t instanceof V}function N(t,e){e in t||U(t,e,void 0);var n=t[e];return P(n)?n:H({get:function(){return t[e]},set:function(n){return t[e]=n}})}function W(t){var e;return Boolean(t&&S(t,"__ob__")&&"object"==typeof t.__ob__&&(null===(e=t.__ob__)||void 0===e?void 0:e.__v_skip))}function z(t){var e;return Boolean(t&&S(t,"__ob__")&&"object"==typeof t.__ob__&&!(null===(e=t.__ob__)||void 0===e?void 0:e.__v_skip))}function D(t){if(!(!C(t)||W(t)||x(t)||P(t)||(e=t,n=h(),n&&e instanceof n)||F.has(t))){var e,n;F.set(t,!0);for(var r=Object.keys(t),o=0;o<r.length;o++)I(t,r[o])}}function I(t,e,n){if("__ob__"!==e&&!W(t[e])){var r,o,i=Object.getOwnPropertyDescriptor(t,e);if(i){if(!1===i.configurable)return;r=i.get,o=i.set,r&&!o||2!==arguments.length||(n=t[e])}D(n),O(t,e,{get:function(){var o=r?r.call(t):n;return e!==T&&P(o)?o.value:o},set:function(i){r&&!o||(e!==T&&P(n)&&!P(i)?n.value=i:o?(o.call(t,i),n=i):n=i,D(i))}})}}function L(t){var e,n=s||c;n.observable?e=n.observable(t):e=A(n,{data:{$$state:t}})._data.$$state;return S(e,"__ob__")||q(e),e}function q(t,e){var n,r;if(void 0===e&&(e=new Set),!e.has(t)&&!S(t,"__ob__")&&Object.isExtensible(t)){j(t,"__ob__",function(t){void 0===t&&(t={});return{value:t,dep:{notify:$,depend:$,addSub:$,removeSub:$}}}(t)),e.add(t);try{for(var i=o(Object.keys(t)),u=i.next();!u.done;u=i.next()){var a=t[u.value];(C(a)||x(a))&&!W(a)&&Object.isExtensible(a)&&q(a,e)}}catch(t){n={error:t}}finally{try{u&&!u.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}}}function X(t){if(!k(t))return t;if(!C(t)&&!x(t)||W(t)||!Object.isExtensible(t))return t;var e=L(t);return D(e),e}function J(t){var e,n,r,o,i=a();if(R(t)?e=t:(e=t.get,n=t.set),i&&!i.$isServer){var u,c=function(){if(!E){var t=A(h(),{computed:{value:function(){return 0}}}),e=t._computedWatchers.value.constructor,n=t._data.__ob__.dep.constructor;E={Watcher:e,Dep:n},t.$destroy()}return E}(),f=c.Watcher,s=c.Dep;o=function(){return u||(u=new f(i,e,$,{lazy:!0})),u.dirty&&u.evaluate(),s.target&&u.depend(),u.value},r=function(t){n&&n(t)}}else{var l=A(h(),{computed:{$$state:{get:e,set:n}}});i&&i.$on("hook:destroyed",(function(){return l.$destroy()})),o=function(){return l.$$state},r=function(t){l.$$state=t}}return H({get:o,set:r},!n,!0)}var G={set:function(t,e,n){(t.__composition_api_state__=t.__composition_api_state__||{})[e]=n},get:function(t,e){return(t.__composition_api_state__||{})[e]}};function Q(t){var e=G.get(t,"rawBindings")||{};if(e&&Object.keys(e).length){for(var n=t.$refs,r=G.get(t,"refs")||[],o=0;o<r.length;o++){var i=e[c=r[o]];!n[c]&&i&&P(i)&&(i.value=null)}var u=Object.keys(n),a=[];for(o=0;o<u.length;o++){var c;i=e[c=u[o]];n[c]&&i&&P(i)&&(i.value=n[c],a.push(c))}G.set(t,"refs",a)}}function Y(t){for(var e=[t._vnode];e.length;){var n=e.pop();if(n&&(n.context&&Q(n.context),n.children))for(var r=0;r<n.children.length;++r)e.push(n.children[r])}}function Z(t,e){var n,r;if(t){var i=G.get(t,"attrBindings");if(i||e){if(!i){var u=X({});i={ctx:e,data:u},G.set(t,"attrBindings",i),O(e,"attrs",{get:function(){return null==i?void 0:i.data},set:function(){}})}var a=t.$attrs,c=function(e){S(i.data,e)||O(i.data,e,{get:function(){return t.$attrs[e]}})};try{for(var f=o(Object.keys(a)),s=f.next();!s.done;s=f.next()){c(s.value)}}catch(t){n={error:t}}finally{try{s&&!s.done&&(r=f.return)&&r.call(f)}finally{if(n)throw n.error}}}}}function tt(t,e){var n=t.$options._parentVnode;if(n){for(var r=G.get(t,"slots")||[],o=function(t,e){var n;if(t){if(t._normalized)return t._normalized;for(var r in n={},t)t[r]&&"$"!==r[0]&&(n[r]=!0)}else n={};for(var r in e)r in n||(n[r]=!0);return n}(n.data.scopedSlots,t.$slots),i=0;i<r.length;i++){o[a=r[i]]||delete e[a]}var u=Object.keys(o);for(i=0;i<u.length;i++){var a;e[a=u[i]]||(e[a]=M(t,a))}G.set(t,"slots",u)}}function et(t,e,n){var r=y();_(t);try{return e(t)}catch(t){if(!n)throw t;n(t)}finally{_(r)}}function nt(t){function e(t,n){if(void 0===n&&(n=new Set),!n.has(t)&&C(t)&&!P(t)&&!z(t)&&!W(t)){var r=h().util.defineReactive;Object.keys(t).forEach((function(o){var i=t[o];r(t,o,i),i&&(n.add(i),e(i,n))}))}}function n(t,e){return void 0===e&&(e=new Map),e.has(t)?e.get(t):(e.set(t,!1),x(t)&&z(t)?(e.set(t,!0),!0):!(!C(t)||W(t)||P(t))&&Object.keys(t).some((function(r){return n(t[r],e)})))}t.mixin({beforeCreate:function(){var t=this,r=t.$options,o=r.setup,i=r.render;i&&(r.render=function(){for(var e=this,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return et(b(t),(function(){return i.apply(e,n)}))});if(!o)return;if(!R(o))return;var u=r.data;r.data=function(){return function(t,r){void 0===r&&(r={});var o,i=t.$options.setup,u=function(t){var e={slots:{}},n=["emit"];return["root","parent","refs","listeners","isServer","ssrContext"].forEach((function(n){var r="$".concat(n);O(e,n,{get:function(){return t[r]},set:function(){}})})),Z(t,e),n.forEach((function(n){var r="$".concat(n);O(e,n,{get:function(){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t[r].apply(t,e)}}})})),e}(t),a=b(t);if(a.setupContext=u,j(r,"__ob__",function(){return L({}).__ob__}()),tt(t,u.slots),et(a,(function(){o=i(r,u)})),!o)return;if(R(o)){var c=o;return void(t.$options.render=function(){return tt(t,u.slots),et(a,(function(){return c()}))})}if(k(o)){z(o)&&(o=function(t){if(!C(t))return t;var e={};for(var n in t)e[n]=N(t,n);return e}(o)),G.set(t,"rawBindings",o);var f=o;Object.keys(f).forEach((function(r){var o=f[r];if(!P(o))if(z(o))x(o)&&(o=K(o));else if(R(o)){var i=o;o=o.bind(t),Object.keys(i).forEach((function(t){o[t]=i[t]}))}else k(o)?n(o)&&e(o):o=K(o);!function(t,e,n){var r=t.$options.props;e in t||r&&S(r,e)||(P(n)?O(t,e,{get:function(){return n.value},set:function(t){n.value=t}}):O(t,e,{get:function(){return z(n)&&n.__ob__.dep.depend(),n},set:function(t){n=t}}))}(t,r,o)}))}}(t,t.$props),R(u)?u.call(t,t):u||{}}},mounted:function(){Y(this)},beforeUpdate:function(){Z(this)},updated:function(){Y(this)}})}function rt(t,e){if(!t)return e;if(!e)return t;for(var n,r,o,i=w?Reflect.ownKeys(t):Object.keys(t),u=0;u<i.length;u++)"__ob__"!==(n=i[u])&&(r=e[n],o=t[n],S(e,n)?r!==o&&C(r)&&!P(r)&&C(o)&&!P(o)&&rt(o,r):e[n]=o);return e}function ot(t){(function(t){return s&&S(t,v)})(t)||(t.config.optionMergeStrategies.setup=function(t,e){return function(n,r){return rt(R(t)?t(n,r)||{}:void 0,R(e)?e(n,r)||{}:void 0)}},function(t){s=t,Object.defineProperty(t,v,{configurable:!0,writable:!0,value:!0})}(t),nt(t))}var it={install:function(t){return ot(t)}};"undefined"!=typeof window&&window.Vue&&window.Vue.use(it);var ut=X({search:"",separators:[" ",","],highlightField:null,options:{color:"pink"}});function at(){return{setSearch:function(t){ut.search=t},setHighlightField:function(t){ut.highlightField=t},getOptions:function(){return ut.options},getSearchKeywords:function(){return(t=ut.search,e=ut.separators,r=new RegExp("([\\wㄱ-ㅎㅏ-ㅣ가-힣]+(?:[^"+e.join("")+"])?)","g"),null!==(n=t.match(r))&&void 0!==n?n:[]).filter(ct).sort(ft);var t,e,n,r},getHighlightField:function(){return ut.highlightField}}}function ct(t,e,n){return n.indexOf(t)===e}function ft(t,e){return e.length-t.length}var st={name:"vue-keyword-highlight",props:{text:{type:String,default:"",required:!0},field:{type:String}},setup:function(e){var n=at(),r=n.getSearchKeywords,o=n.getOptions,i=n.getHighlightField,u=J((function(){return r()})),a=J((function(){return o()})),c=J((function(){var t=i();return["string"==typeof t,t]}));return{output:J((function(){var n=e.text;return c.value[0]&&e.field!==c.value[1]?n:u.value.reduce((function(e,r){for(var o,i,u,c,f=n.indexOf(r);-1!==f;){for(var s=0;s<r.length;s++)e[f+s]=(o=r[s],i=void 0,u=void 0,c=void 0,(c=document.createElement("b")).setAttribute("style",(i={highlightColor:a.value.color},u=i.highlightColor,Object.entries({background:u}).map((function(e){var n=t(e,2),r=n[0],o=n[1];return"".concat(r,":").concat(o)})).join(";"))),c.innerText=o,c.outerHTML);f=n.indexOf(r,f+1)}return e}),Array.from(n)).join("")})),options:a}}};function lt(t,e,n,r,o,i,u,a,c,f){"boolean"!=typeof u&&(c=a,a=u,u=!1);const s="function"==typeof n?n.options:n;let l;if(t&&t.render&&(s.render=t.render,s.staticRenderFns=t.staticRenderFns,s._compiled=!0,o&&(s.functional=!0)),r&&(s._scopeId=r),i?(l=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),e&&e.call(this,c(t)),t&&t._registeredComponents&&t._registeredComponents.add(i)},s._ssrRegister=l):e&&(l=u?function(t){e.call(this,f(t,this.$root.$options.shadowRoot))}:function(t){e.call(this,a(t))}),l)if(s.functional){const t=s.render;s.render=function(e,n){return l.call(n),t(e,n)}}else{const t=s.beforeCreate;s.beforeCreate=t?[].concat(t,l):[l]}return n}const dt="undefined"!=typeof navigator&&/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());function vt(t){return(t,e)=>function(t,e){const n=dt?e.media||"default":t,r=ht[n]||(ht[n]={ids:new Set,styles:[]});if(!r.ids.has(t)){r.ids.add(t);let n=e.source;if(e.map&&(n+="\n/*# sourceURL="+e.map.sources[0]+" */",n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(e.map))))+" */"),r.element||(r.element=document.createElement("style"),r.element.type="text/css",e.media&&r.element.setAttribute("media",e.media),void 0===pt&&(pt=document.head||document.getElementsByTagName("head")[0]),pt.appendChild(r.element)),"styleSheet"in r.element)r.styles.push(n),r.element.styleSheet.cssText=r.styles.filter(Boolean).join("\n");else{const t=r.ids.size-1,e=document.createTextNode(n),o=r.element.childNodes;o[t]&&r.element.removeChild(o[t]),o.length?r.element.insertBefore(e,o[t]):r.element.appendChild(e)}}}(t,e)}let pt;const ht={};var _t=lt({render:function(){var t=this,e=t.$createElement;return(t._self._c||e)("span",{domProps:{innerHTML:t._s(t.output)}})},staticRenderFns:[]},(function(t){t&&t("data-v-7979f15c_0",{source:"[data-v-7979f15c] b{font-weight:400}",map:void 0,media:void 0})}),st,"data-v-7979f15c",false,undefined,!1,vt,void 0,void 0),yt=function(){var t=_t;return t.install=function(e){e.use(it),e.component("VueKeywordHighlight",t),e.prototype.$vueKeywordHighlight=at},t}(),gt=Object.freeze({__proto__:null,default:yt});return Object.entries(gt).forEach((function(e){var n=t(e,2),r=n[0],o=n[1];"default"!==r&&(yt[r]=o)})),yt}(); |
@@ -1496,2 +1496,3 @@ 'use strict';function _slicedToArray(arr, i) { | ||
installable.install = function (Vue) { | ||
Vue.use(Plugin); | ||
Vue.component('VueKeywordHighlight', installable); | ||
@@ -1498,0 +1499,0 @@ Vue.prototype.$vueKeywordHighlight = useKeywordHighlight; |
{ | ||
"name": "vue-keyword-highlight", | ||
"version": "0.1.0-beta.9", | ||
"version": "0.1.0-beta.10", | ||
"description": "vue component, each keyword highlight in text", | ||
@@ -57,3 +57,4 @@ "author": { | ||
"peerDependencies": { | ||
"vue": "^2.6.14" | ||
"vue": "^2.6.14", | ||
"@vue/composition-api": "^1.6.1" | ||
}, | ||
@@ -60,0 +61,0 @@ "engines": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
115583
2939
2