vue-instantsearch 4.13.8 → 4.15.0

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.
Files changed (102) hide show
  1. package/package.json +8 -6
  2. package/src/__tests__/common-widgets.test.js +16 -0
  3. package/src/components/Highlight.vue +1 -2
  4. package/src/components/Highlighter.js +69 -0
  5. package/src/components/Hits.js +113 -0
  6. package/src/components/RefinementList.vue +3 -2
  7. package/src/components/SearchInput.vue +0 -1
  8. package/src/components/Snippet.vue +1 -2
  9. package/src/components/__tests__/Hits.js +1 -1
  10. package/src/components/__tests__/NumericMenu.js +0 -51
  11. package/src/util/pragma.js +22 -0
  12. package/src/{components/Highlighter.vue → util/vue-compat/Highlighter/Highlighter-vue2.vue} +6 -9
  13. package/src/util/vue-compat/Highlighter/index-vue2.js +1 -0
  14. package/src/util/vue-compat/Highlighter/index-vue3.js +1 -0
  15. package/src/util/vue-compat/Highlighter/index.js +1 -0
  16. package/src/util/vue-compat/index-vue2.js +26 -1
  17. package/src/util/vue-compat/index-vue3.js +7 -0
  18. package/src/widgets.js +1 -1
  19. package/vue2/cjs/index.js +1 -1
  20. package/vue2/cjs/index.js.map +1 -1
  21. package/vue2/es/package.json.js +1 -1
  22. package/vue2/es/src/components/Highlight.vue_rollup-plugin-vue=script.js +1 -1
  23. package/vue2/es/src/components/Hits.js +2 -0
  24. package/vue2/es/src/components/Hits.js.map +1 -0
  25. package/vue2/es/src/components/RefinementList.vue.js +1 -1
  26. package/vue2/es/src/components/RefinementList.vue_rollup-plugin-vue=script.js.map +1 -1
  27. package/vue2/es/src/components/Snippet.vue_rollup-plugin-vue=script.js +1 -1
  28. package/vue2/es/src/instantsearch.js +1 -1
  29. package/vue2/es/src/util/vue-compat/Highlighter/Highlighter-vue2.vue.js +2 -0
  30. package/vue2/es/src/util/vue-compat/Highlighter/Highlighter-vue2.vue.js.map +1 -0
  31. package/vue2/es/src/util/vue-compat/Highlighter/Highlighter-vue2.vue_rollup-plugin-vue=script.js +2 -0
  32. package/vue2/es/src/util/vue-compat/Highlighter/Highlighter-vue2.vue_rollup-plugin-vue=script.js.map +1 -0
  33. package/vue2/es/src/util/vue-compat/index-vue2.js +1 -1
  34. package/vue2/es/src/util/vue-compat/index-vue2.js.map +1 -1
  35. package/vue2/es/src/widgets.js +1 -1
  36. package/vue2/umd/index.js +1 -1
  37. package/vue2/umd/index.js.map +1 -1
  38. package/vue3/cjs/index.js +1 -1
  39. package/vue3/cjs/index.js.map +1 -1
  40. package/vue3/es/package.json.js +1 -1
  41. package/vue3/es/src/components/Highlight.vue.js +1 -1
  42. package/vue3/es/src/components/Highlight.vue_vue&type=script&lang.js +1 -1
  43. package/vue3/es/src/components/Highlight.vue_vue&type=script&lang.js.map +1 -1
  44. package/vue3/es/src/components/{Highlight.vue_vue&type=template&id=1d5c1fda&lang.js → Highlight.vue_vue&type=template&id=214ecb36&lang.js} +1 -1
  45. package/vue3/es/src/components/Highlight.vue_vue&type=template&id=214ecb36&lang.js.map +1 -0
  46. package/vue3/es/src/components/Highlighter.js +2 -0
  47. package/vue3/es/src/components/Highlighter.js.map +1 -0
  48. package/vue3/es/src/components/Hits.js +2 -0
  49. package/vue3/es/src/components/Hits.js.map +1 -0
  50. package/vue3/es/src/components/RefinementList.vue.js +1 -1
  51. package/vue3/es/src/components/RefinementList.vue_vue&type=script&lang.js.map +1 -1
  52. package/vue3/es/src/components/RefinementList.vue_vue&type=template&id=e39e9d16&lang.js +2 -0
  53. package/vue3/es/src/components/RefinementList.vue_vue&type=template&id=e39e9d16&lang.js.map +1 -0
  54. package/vue3/es/src/components/SearchInput.vue.js +1 -1
  55. package/vue3/es/src/components/SearchInput.vue_vue&type=script&lang.js.map +1 -1
  56. package/vue3/es/src/components/{SearchInput.vue_vue&type=template&id=02fb82e2&lang.js → SearchInput.vue_vue&type=template&id=79e30e4e&lang.js} +1 -1
  57. package/vue3/es/src/components/SearchInput.vue_vue&type=template&id=79e30e4e&lang.js.map +1 -0
  58. package/vue3/es/src/components/Snippet.vue.js +1 -1
  59. package/vue3/es/src/components/Snippet.vue_vue&type=script&lang.js +1 -1
  60. package/vue3/es/src/components/Snippet.vue_vue&type=script&lang.js.map +1 -1
  61. package/vue3/es/src/components/{Snippet.vue_vue&type=template&id=1e214b4c&lang.js → Snippet.vue_vue&type=template&id=edc35952&lang.js} +1 -1
  62. package/vue3/es/src/components/Snippet.vue_vue&type=template&id=edc35952&lang.js.map +1 -0
  63. package/vue3/es/src/instantsearch.js +1 -1
  64. package/vue3/es/src/util/pragma.js +2 -0
  65. package/vue3/es/src/util/pragma.js.map +1 -0
  66. package/vue3/es/src/util/vue-compat/index-vue3.js +1 -1
  67. package/vue3/es/src/util/vue-compat/index-vue3.js.map +1 -1
  68. package/vue3/es/src/widgets.js +1 -1
  69. package/vue3/umd/index.js +1 -1
  70. package/vue3/umd/index.js.map +1 -1
  71. package/src/components/Hits.vue +0 -72
  72. package/src/components/__tests__/RefinementList.js +0 -199
  73. package/src/components/__tests__/__snapshots__/RefinementList.js.snap +0 -405
  74. package/vue2/es/src/components/Highlighter.vue.js +0 -2
  75. package/vue2/es/src/components/Highlighter.vue.js.map +0 -1
  76. package/vue2/es/src/components/Highlighter.vue_rollup-plugin-vue=script.js +0 -2
  77. package/vue2/es/src/components/Highlighter.vue_rollup-plugin-vue=script.js.map +0 -1
  78. package/vue2/es/src/components/Hits.vue.js +0 -2
  79. package/vue2/es/src/components/Hits.vue.js.map +0 -1
  80. package/vue2/es/src/components/Hits.vue_rollup-plugin-vue=script.js +0 -2
  81. package/vue2/es/src/components/Hits.vue_rollup-plugin-vue=script.js.map +0 -1
  82. package/vue3/es/src/components/Highlight.vue_vue&type=template&id=1d5c1fda&lang.js.map +0 -1
  83. package/vue3/es/src/components/Highlighter.vue.js +0 -2
  84. package/vue3/es/src/components/Highlighter.vue.js.map +0 -1
  85. package/vue3/es/src/components/Highlighter.vue_vue&type=script&lang.js +0 -2
  86. package/vue3/es/src/components/Highlighter.vue_vue&type=script&lang.js.map +0 -1
  87. package/vue3/es/src/components/Highlighter.vue_vue&type=template&id=f822f802&lang.js +0 -2
  88. package/vue3/es/src/components/Highlighter.vue_vue&type=template&id=f822f802&lang.js.map +0 -1
  89. package/vue3/es/src/components/Hits.vue.js +0 -2
  90. package/vue3/es/src/components/Hits.vue.js.map +0 -1
  91. package/vue3/es/src/components/Hits.vue_vue&type=script&lang.js +0 -2
  92. package/vue3/es/src/components/Hits.vue_vue&type=script&lang.js.map +0 -1
  93. package/vue3/es/src/components/Hits.vue_vue&type=template&id=026646d2&lang.js +0 -2
  94. package/vue3/es/src/components/Hits.vue_vue&type=template&id=026646d2&lang.js.map +0 -1
  95. package/vue3/es/src/components/RefinementList.vue_vue&type=template&id=80c1baee&lang.js +0 -2
  96. package/vue3/es/src/components/RefinementList.vue_vue&type=template&id=80c1baee&lang.js.map +0 -1
  97. package/vue3/es/src/components/SearchInput.vue_vue&type=template&id=02fb82e2&lang.js.map +0 -1
  98. package/vue3/es/src/components/Snippet.vue_vue&type=template&id=1e214b4c&lang.js.map +0 -1
  99. package/vue3/es/src/util/parseAlgoliaHit.js +0 -2
  100. package/vue3/es/src/util/parseAlgoliaHit.js.map +0 -1
  101. package/vue3/es/src/util/unescape.js +0 -2
  102. package/vue3/es/src/util/unescape.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"Hits.vue.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- import{createSuitMixin as t}from"../mixins/suit.js";import{createWidgetMixin as s}from"../mixins/widget.js";import{connectHitsWithInsights as e}from"instantsearch.js/es/connectors/index.js";export default{name:"AisHits",mixins:[s({connector:e},{$$widgetType:"ais.hits"}),t({name:"Hits"})],props:{escapeHTML:{type:Boolean,default:!0},transformItems:{type:Function,default:void 0}},computed:{items:function(){return this.state.hits},widgetParams:function(){return{escapeHTML:this.escapeHTML,transformItems:this.transformItems}}}};
2
- //# sourceMappingURL=Hits.vue_rollup-plugin-vue=script.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Hits.vue_rollup-plugin-vue=script.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Highlight.vue_vue&type=template&id=1d5c1fda&lang.js","sources":["../../../../src/components/Highlight.vue?vue&type=template&id=1d5c1fda&lang.js"],"sourcesContent":["<template>\n <ais-highlighter\n :hit=\"hit\"\n :attribute=\"attribute\"\n :highlighted-tag-name=\"highlightedTagName\"\n :suit=\"suit\"\n highlight-property=\"_highlightResult\"\n pre-tag=\"<mark>\"\n post-tag=\"</mark>\"\n />\n</template>\n\n<script>\nimport { createSuitMixin } from '../mixins/suit';\n\nimport AisHighlighter from './Highlighter.vue';\n\nexport default {\n name: 'AisHighlight',\n mixins: [createSuitMixin({ name: 'Highlight' })],\n components: { AisHighlighter },\n props: {\n hit: {\n type: Object,\n required: true,\n },\n attribute: {\n type: String,\n required: true,\n },\n highlightedTagName: {\n type: String,\n default: 'mark',\n },\n },\n};\n</script>\n"],"names":["_createBlock","hit","$props","attribute","highlighted-tag-name","suit","_ctx","highlight-property","pre-tag","post-tag"],"mappings":"qIACEA,KACGC,IAAKC,MACLC,UAAWD,YACXE,uBAAsBF,qBACtBG,KAAMC,OACPC,qBAAmB,mBACnBC,UAAQ,SACRC,WAAS"}
@@ -1,2 +0,0 @@
1
- import e from"./Highlighter.vue_vue&type=script&lang.js";import{render as t}from"./Highlighter.vue_vue&type=template&id=f822f802&lang.js";e.render=t;export default e;
2
- //# sourceMappingURL=Highlighter.vue.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Highlighter.vue.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- import"../util/vue-compat/index-vue3.js";import{parseAlgoliaHit as t}from"../util/parseAlgoliaHit.js";var e=function(t,e){return e.slots.default()};export default{name:"AisHighlighter",props:{hit:{type:Object,required:!0},attribute:{type:String,required:!0},highlightedTagName:{type:String,default:"mark"},suit:{type:Function,required:!0},highlightProperty:{type:String,required:!0},preTag:{type:String,required:!0},postTag:{type:String,required:!0}},data:function(){return{TextNode:e}},computed:{parsedHighlights:function(){return t({attribute:this.attribute,hit:this.hit,highlightProperty:this.highlightProperty,preTag:this.preTag,postTag:this.postTag})}}};
2
- //# sourceMappingURL=Highlighter.vue_vue&type=script&lang.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Highlighter.vue_vue&type=script&lang.js","sources":["../../../../src/components/Highlighter.vue"],"sourcesContent":["<template>\n <span :class=\"suit()\">\n <component\n v-for=\"({ value, isHighlighted }, index) in parsedHighlights\"\n :class=\"[isHighlighted && suit('highlighted')]\"\n :key=\"index\"\n :is=\"isHighlighted ? highlightedTagName : TextNode\"\n >{{ value }}</component\n >\n </span>\n</template>\n\n<script>\nimport { parseAlgoliaHit } from '../util/parseAlgoliaHit';\nimport { getDefaultSlot, renderCompat, isVue3 } from '../util/vue-compat';\n\nconst TextNode = isVue3\n ? (props, context) => context.slots.default()\n : {\n render: renderCompat(function () {\n return getDefaultSlot(this);\n }),\n };\n\nexport default {\n name: 'AisHighlighter',\n props: {\n hit: {\n type: Object,\n required: true,\n },\n attribute: {\n type: String,\n required: true,\n },\n highlightedTagName: {\n type: String,\n default: 'mark',\n },\n suit: {\n type: Function,\n required: true,\n },\n highlightProperty: {\n type: String,\n required: true,\n },\n preTag: {\n type: String,\n required: true,\n },\n postTag: {\n type: String,\n required: true,\n },\n },\n data() {\n return { TextNode };\n },\n computed: {\n parsedHighlights() {\n return parseAlgoliaHit({\n attribute: this.attribute,\n hit: this.hit,\n highlightProperty: this.highlightProperty,\n preTag: this.preTag,\n postTag: this.postTag,\n });\n },\n },\n};\n</script>\n"],"names":["const","TextNode","props","context","slots","default","name","hit","type","Object","required","attribute","String","highlightedTagName","suit","Function","highlightProperty","preTag","postTag","data","computed","parsedHighlights","parseAlgoliaHit","this"],"mappings":"sGAgBAA,IAAMC,WACDC,EAAOC,UAAYA,EAAQC,MAAMC,yBAOvB,CACbC,KAAM,iBACNJ,MAAO,CACLK,IAAK,CACHC,KAAMC,OACNC,UAAU,GAEZC,UAAW,CACTH,KAAMI,OACNF,UAAU,GAEZG,mBAAoB,CAClBL,KAAMI,OACNP,QAAS,QAEXS,KAAM,CACJN,KAAMO,SACNL,UAAU,GAEZM,kBAAmB,CACjBR,KAAMI,OACNF,UAAU,GAEZO,OAAQ,CACNT,KAAMI,OACNF,UAAU,GAEZQ,QAAS,CACPV,KAAMI,OACNF,UAAU,IAGdS,gBACE,MAAO,UAAElB,IAEXmB,SAAU,CACRC,4BACE,OAAOC,EAAgB,CACrBX,UAAWY,KAAKZ,UAChBJ,IAAKgB,KAAKhB,IACVS,kBAAmBO,KAAKP,kBACxBC,OAAQM,KAAKN,OACbC,QAASK,KAAKL"}
@@ -1,2 +0,0 @@
1
- import{openBlock as t,createElementBlock as e,normalizeClass as i,Fragment as s,renderList as u,createBlock as l,resolveDynamicComponent as n,withCtx as r,createTextVNode as a,toDisplayString as h}from"vue";function g(g,o,c,d,f,p){return t(),e("span",{class:i(c.suit())},[(t(!0),e(s,null,u(p.parsedHighlights,function(e,s){var u=e.value,g=e.isHighlighted;return t(),l(n(g?c.highlightedTagName:f.TextNode),{class:i([g&&c.suit("highlighted")]),key:s},{default:r(function(){return[a(h(u),1)]}),_:2},1032,["class"])}),128))],2)}export{g as render};
2
- //# sourceMappingURL=Highlighter.vue_vue&type=template&id=f822f802&lang.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Highlighter.vue_vue&type=template&id=f822f802&lang.js","sources":["../../../../src/components/Highlighter.vue?vue&type=template&id=f822f802&lang.js"],"sourcesContent":["<template>\n <span :class=\"suit()\">\n <component\n v-for=\"({ value, isHighlighted }, index) in parsedHighlights\"\n :class=\"[isHighlighted && suit('highlighted')]\"\n :key=\"index\"\n :is=\"isHighlighted ? highlightedTagName : TextNode\"\n >{{ value }}</component\n >\n </span>\n</template>\n\n<script>\nimport { parseAlgoliaHit } from '../util/parseAlgoliaHit';\nimport { getDefaultSlot, renderCompat, isVue3 } from '../util/vue-compat';\n\nconst TextNode = isVue3\n ? (props, context) => context.slots.default()\n : {\n render: renderCompat(function () {\n return getDefaultSlot(this);\n }),\n };\n\nexport default {\n name: 'AisHighlighter',\n props: {\n hit: {\n type: Object,\n required: true,\n },\n attribute: {\n type: String,\n required: true,\n },\n highlightedTagName: {\n type: String,\n default: 'mark',\n },\n suit: {\n type: Function,\n required: true,\n },\n highlightProperty: {\n type: String,\n required: true,\n },\n preTag: {\n type: String,\n required: true,\n },\n postTag: {\n type: String,\n required: true,\n },\n },\n data() {\n return { TextNode };\n },\n computed: {\n parsedHighlights() {\n return parseAlgoliaHit({\n attribute: this.attribute,\n hit: this.hit,\n highlightProperty: this.highlightProperty,\n preTag: this.preTag,\n postTag: this.postTag,\n });\n },\n },\n};\n</script>\n"],"names":["_createElementBlock","class","$props","$options","index","_createBlock","isHighlighted","$data","key","value"],"mappings":"kPACEA,UAAOC,QAAOC,mBACZF,WAC8CG,8BAAVC,8CADpCC,IAIOC,EAAgBJ,qBAAqBK,aAFzCN,SAAQK,GAAiBJ,wBACzBM,IAAKJ,oCAEFK"}
@@ -1,2 +0,0 @@
1
- import e from"./Hits.vue_vue&type=script&lang.js";import{render as t}from"./Hits.vue_vue&type=template&id=026646d2&lang.js";e.render=t;export default e;
2
- //# sourceMappingURL=Hits.vue.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Hits.vue.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- import{createSuitMixin as t}from"../mixins/suit.js";import{createWidgetMixin as s}from"../mixins/widget.js";import{connectHitsWithInsights as e}from"instantsearch.js/es/connectors/index.js";export default{name:"AisHits",mixins:[s({connector:e},{$$widgetType:"ais.hits"}),t({name:"Hits"})],props:{escapeHTML:{type:Boolean,default:!0},transformItems:{type:Function,default:void 0}},computed:{items:function(){return this.state.hits},widgetParams:function(){return{escapeHTML:this.escapeHTML,transformItems:this.transformItems}}}};
2
- //# sourceMappingURL=Hits.vue_vue&type=script&lang.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Hits.vue_vue&type=script&lang.js","sources":["../../../../src/components/Hits.vue"],"sourcesContent":["<template>\n <div v-if=\"state\" :class=\"suit()\">\n <slot\n :items=\"items\"\n :insights=\"state.insights\"\n :send-event=\"state.sendEvent\"\n >\n <ol :class=\"suit('list')\">\n <li\n v-for=\"(item, itemIndex) in items\"\n :key=\"item.objectID\"\n :class=\"suit('item')\"\n @click=\"state.sendEvent('click:internal', item, 'Hit Clicked')\"\n @auxclick=\"state.sendEvent('click:internal', item, 'Hit Clicked')\"\n >\n <slot\n name=\"item\"\n :item=\"item\"\n :index=\"itemIndex\"\n :insights=\"state.insights\"\n :send-event=\"state.sendEvent\"\n >\n objectID: {{ item.objectID }}, index: {{ itemIndex }}\n </slot>\n </li>\n </ol>\n </slot>\n </div>\n</template>\n\n<script>\nimport { connectHitsWithInsights } from 'instantsearch.js/es/connectors';\n\nimport { createSuitMixin } from '../mixins/suit';\nimport { createWidgetMixin } from '../mixins/widget';\n\nexport default {\n name: 'AisHits',\n mixins: [\n createWidgetMixin(\n {\n connector: connectHitsWithInsights,\n },\n {\n $$widgetType: 'ais.hits',\n }\n ),\n createSuitMixin({ name: 'Hits' }),\n ],\n props: {\n escapeHTML: {\n type: Boolean,\n default: true,\n },\n transformItems: {\n type: Function,\n default: undefined,\n },\n },\n computed: {\n items() {\n return this.state.hits;\n },\n widgetParams() {\n return {\n escapeHTML: this.escapeHTML,\n transformItems: this.transformItems,\n };\n },\n },\n};\n</script>\n"],"names":["name","mixins","createWidgetMixin","connector","connectHitsWithInsights","$$widgetType","createSuitMixin","props","escapeHTML","type","Boolean","default","transformItems","Function","undefined","computed","items","this","state","hits","widgetParams"],"mappings":"4MAoCe,CACbA,KAAM,UACNC,OAAQ,CACNC,EACE,CACEC,UAAWC,GAEb,CACEC,aAAc,aAGlBC,EAAgB,CAAEN,KAAM,UAE1BO,MAAO,CACLC,WAAY,CACVC,KAAMC,QACNC,SAAS,GAEXC,eAAgB,CACdH,KAAMI,SACNF,aAASG,IAGbC,SAAU,CACRC,iBACE,OAAOC,KAAKC,MAAMC,MAEpBC,wBACE,MAAO,CACLZ,WAAYS,KAAKT,WACjBI,eAAgBK,KAAKL"}
@@ -1,2 +0,0 @@
1
- import{openBlock as t,createElementBlock as e,normalizeClass as n,renderSlot as i,createElementVNode as s,Fragment as c,renderList as l,createTextVNode as u,toDisplayString as o,createCommentVNode as r}from"vue";var a=["onClick","onAuxclick"];function d(d,k,v,f,m,E){return d.state?(t(),e("div",{key:0,class:n(d.suit())},[i(d.$slots,"default",{items:E.items,insights:d.state.insights,sendEvent:d.state.sendEvent},function(){return[s("ol",{class:n(d.suit("list"))},[(t(!0),e(c,null,l(E.items,function(s,c){return t(),e("li",{key:s.objectID,class:n(d.suit("item")),onClick:function(t){return d.state.sendEvent("click:internal",s,"Hit Clicked")},onAuxclick:function(t){return d.state.sendEvent("click:internal",s,"Hit Clicked")}},[i(d.$slots,"item",{item:s,index:c,insights:d.state.insights,sendEvent:d.state.sendEvent},function(){return[u(" objectID: "+o(s.objectID)+", index: "+o(c),1)]})],42,a)}),128))],2)]})],2)):r("",!0)}export{d as render};
2
- //# sourceMappingURL=Hits.vue_vue&type=template&id=026646d2&lang.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Hits.vue_vue&type=template&id=026646d2&lang.js","sources":["../../../../src/components/Hits.vue?vue&type=template&id=026646d2&lang.js"],"sourcesContent":["<template>\n <div v-if=\"state\" :class=\"suit()\">\n <slot\n :items=\"items\"\n :insights=\"state.insights\"\n :send-event=\"state.sendEvent\"\n >\n <ol :class=\"suit('list')\">\n <li\n v-for=\"(item, itemIndex) in items\"\n :key=\"item.objectID\"\n :class=\"suit('item')\"\n @click=\"state.sendEvent('click:internal', item, 'Hit Clicked')\"\n @auxclick=\"state.sendEvent('click:internal', item, 'Hit Clicked')\"\n >\n <slot\n name=\"item\"\n :item=\"item\"\n :index=\"itemIndex\"\n :insights=\"state.insights\"\n :send-event=\"state.sendEvent\"\n >\n objectID: {{ item.objectID }}, index: {{ itemIndex }}\n </slot>\n </li>\n </ol>\n </slot>\n </div>\n</template>\n\n<script>\nimport { connectHitsWithInsights } from 'instantsearch.js/es/connectors';\n\nimport { createSuitMixin } from '../mixins/suit';\nimport { createWidgetMixin } from '../mixins/widget';\n\nexport default {\n name: 'AisHits',\n mixins: [\n createWidgetMixin(\n {\n connector: connectHitsWithInsights,\n },\n {\n $$widgetType: 'ais.hits',\n }\n ),\n createSuitMixin({ name: 'Hits' }),\n ],\n props: {\n escapeHTML: {\n type: Boolean,\n default: true,\n },\n transformItems: {\n type: Function,\n default: undefined,\n },\n },\n computed: {\n items() {\n return this.state.hits;\n },\n widgetParams() {\n return {\n escapeHTML: this.escapeHTML,\n transformItems: this.transformItems,\n };\n },\n },\n};\n</script>\n"],"names":["_ctx","_createElementBlock","class","_renderSlot","items","$options","insights","sendEvent","_createElementVNode","item","itemIndex","key","objectID","onClick","onAuxclick","index"],"mappings":"kRACaA,aAAXC,eAAmBC,QAAOF,YACxBG,sBACGC,MAAOC,QACPC,SAAUN,QAAMM,SAChBC,UAAYP,QAAMO,6BAEnBC,QAAKN,QAAOF,yBACVC,WAC8BI,iBAApBI,EAAMC,cADhBT,QAEGU,IAAKF,EAAKG,SACVV,QAAOF,gBACPa,2BAAOb,QAAMO,2BAA4BE,kBACzCK,8BAAUd,QAAMO,2BAA4BE,oBAE7CN,mBAEGM,KAAMA,EACNM,MAAOL,EACPJ,SAAUN,QAAMM,SAChBC,UAAYP,QAAMO,+CAENE,EAAKG,UAAW,cAAYF"}
@@ -1,2 +0,0 @@
1
- import{resolveComponent as e,openBlock as s,createElementBlock as t,normalizeClass as a,renderSlot as o,createVNode as l,createCommentVNode as r,createElementVNode as n,Fragment as i,renderList as c,toDisplayString as u,createTextVNode as h}from"vue";var g=["value","checked","onChange"],m=["disabled"];function d(d,f,w,M,S,b){var v=e("search-input"),F=e("ais-highlight");return d.state?(s(),t("div",{key:0,class:a([d.suit(),!d.state.canRefine&&d.suit("","noRefinement")])},[o(d.$slots,"default",{items:b.items,refine:b.refine,searchForItems:d.state.searchForItems,searchForItemsQuery:S.searchForFacetValuesQuery,toggleShowMore:b.toggleShowMore,canToggleShowMore:d.state.canToggleShowMore,isShowingMore:d.state.isShowingMore,createURL:d.state.createURL,isFromSearch:d.state.isFromSearch,canRefine:d.state.canRefine,sendEvent:d.state.sendEvent},function(){var e;return[w.searchable?(s(),t("div",{key:0,class:a(d.suit("searchBox"))},[l(v,{modelValue:b.searchForFacetValues,"onUpdate:modelValue":f[0]||(f[0]=function(e){return b.searchForFacetValues=e}),placeholder:w.searchablePlaceholder,"class-names":d.classNames},null,8,["modelValue","placeholder","class-names"])],2)):r("",!0),d.state.isFromSearch&&0===b.items.length?o(d.$slots,"noResults",{key:1,query:b.searchForFacetValues},function(){return[n("div",{class:a(d.suit("noResults"))},"No results.",2)]}):r("",!0),n("ul",{class:a(d.suit("list"))},[(s(!0),t(i,null,c(b.items,function(e){return s(),t("li",{class:a([d.suit("item"),e.isRefined&&d.suit("item","selected")]),key:e.value},[o(d.$slots,"item",{item:e,refine:b.refine,createURL:d.state.createURL},function(){return[n("label",{class:a(d.suit("label"))},[n("input",{class:a(d.suit("checkbox")),type:"checkbox",value:e.value,checked:e.isRefined,onChange:function(s){return b.refine(e.value)}},null,42,g),w.searchable?(s(),t("span",{key:0,class:a(d.suit("labelText"))},[l(F,{attribute:"item",hit:e},null,8,["hit"])],2)):(s(),t("span",{key:1,class:a(d.suit("labelText"))},u(e.label),3)),n("span",{class:a(d.suit("count"))},u(e.count),3)],2)]})],2)}),128))],2),w.showMore?(s(),t("button",{key:2,class:a([d.suit("showMore"),(e={},e[d.suit("showMore","disabled")]=!d.state.canToggleShowMore,e)]),onClick:f[1]||(f[1]=function(){for(var e=[],s=arguments.length;s--;)e[s]=arguments[s];return b.toggleShowMore&&b.toggleShowMore.apply(b,e)}),disabled:!d.state.canToggleShowMore},[o(d.$slots,"showMoreLabel",{isShowingMore:d.state.isShowingMore},function(){return[h(" Show "+u(d.state.isShowingMore?"less":"more"),1)]})],10,m)):r("",!0)]})],2)):r("",!0)}export{d as render};
2
- //# sourceMappingURL=RefinementList.vue_vue&type=template&id=80c1baee&lang.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RefinementList.vue_vue&type=template&id=80c1baee&lang.js","sources":["../../../../src/components/RefinementList.vue?vue&type=template&id=80c1baee&lang.js"],"sourcesContent":["<template>\n <div\n :class=\"[suit(), !state.canRefine && suit('', 'noRefinement')]\"\n v-if=\"state\"\n >\n <slot\n :items=\"items\"\n :refine=\"refine\"\n :search-for-items=\"state.searchForItems\"\n :search-for-items-query=\"searchForFacetValuesQuery\"\n :toggle-show-more=\"toggleShowMore\"\n :can-toggle-show-more=\"state.canToggleShowMore\"\n :is-showing-more=\"state.isShowingMore\"\n :createURL=\"state.createURL\"\n :is-from-search=\"state.isFromSearch\"\n :can-refine=\"state.canRefine\"\n :send-event=\"state.sendEvent\"\n >\n <div :class=\"suit('searchBox')\" v-if=\"searchable\">\n <search-input\n v-model=\"searchForFacetValues\"\n :placeholder=\"searchablePlaceholder\"\n :class-names=\"classNames\"\n />\n </div>\n <slot\n name=\"noResults\"\n :query=\"searchForFacetValues\"\n v-if=\"state.isFromSearch && items.length === 0\"\n >\n <div :class=\"suit('noResults')\">No results.</div>\n </slot>\n <ul :class=\"suit('list')\">\n <li\n :class=\"[suit('item'), item.isRefined && suit('item', 'selected')]\"\n v-for=\"item in items\"\n :key=\"item.value\"\n >\n <slot\n name=\"item\"\n :item=\"item\"\n :refine=\"refine\"\n :createURL=\"state.createURL\"\n >\n <label :class=\"suit('label')\">\n <input\n :class=\"suit('checkbox')\"\n type=\"checkbox\"\n :value=\"item.value\"\n :checked=\"item.isRefined\"\n @change=\"refine(item.value)\"\n />\n <span v-if=\"searchable\" :class=\"suit('labelText')\">\n <ais-highlight attribute=\"item\" :hit=\"item\" />\n </span>\n <span v-else :class=\"suit('labelText')\">{{ item.label }}</span>\n <span :class=\"suit('count')\">{{ item.count }}</span>\n </label>\n </slot>\n </li>\n </ul>\n <button\n :class=\"[\n suit('showMore'),\n {\n [suit('showMore', 'disabled')]: !state.canToggleShowMore,\n },\n ]\"\n @click=\"toggleShowMore\"\n v-if=\"showMore\"\n :disabled=\"!state.canToggleShowMore\"\n >\n <slot name=\"showMoreLabel\" :is-showing-more=\"state.isShowingMore\">\n Show {{ state.isShowingMore ? 'less' : 'more' }}\n </slot>\n </button>\n </slot>\n </div>\n</template>\n\n<script>\nimport { connectRefinementList } from 'instantsearch.js/es/connectors';\n\nimport { createPanelConsumerMixin } from '../mixins/panel';\nimport { createSuitMixin } from '../mixins/suit';\nimport { createWidgetMixin } from '../mixins/widget';\n\nimport AisHighlight from './Highlight.vue';\nimport SearchInput from './SearchInput.vue';\n\nconst noop = () => {};\n\nexport default {\n name: 'AisRefinementList',\n components: { SearchInput, AisHighlight },\n mixins: [\n createSuitMixin({ name: 'RefinementList' }),\n createWidgetMixin(\n {\n connector: connectRefinementList,\n },\n {\n $$widgetType: 'ais.refinementList',\n }\n ),\n createPanelConsumerMixin(),\n ],\n props: {\n attribute: {\n type: String,\n required: true,\n },\n searchable: {\n type: Boolean,\n default: undefined,\n },\n searchablePlaceholder: {\n type: String,\n required: false,\n default: 'Search here…',\n },\n operator: {\n default: 'or',\n validator(value) {\n return value === 'and' || value === 'or';\n },\n required: false,\n },\n limit: {\n type: Number,\n required: false,\n default: undefined,\n },\n showMoreLimit: {\n type: Number,\n required: false,\n default: undefined,\n },\n showMore: {\n type: Boolean,\n required: false,\n default: false,\n },\n sortBy: {\n type: [Array, Function],\n required: false,\n default: undefined,\n },\n transformItems: {\n type: Function,\n required: false,\n default: undefined,\n },\n },\n data() {\n return {\n searchForFacetValuesQuery: '',\n };\n },\n computed: {\n searchForFacetValues: {\n get() {\n return this.searchForFacetValuesQuery;\n },\n set(value) {\n this.state.searchForItems(value);\n this.searchForFacetValuesQuery = value;\n },\n },\n toggleShowMore() {\n return this.state.toggleShowMore || noop;\n },\n items() {\n return this.state.items.map((item) =>\n Object.assign({}, item, {\n _highlightResult: {\n item: {\n value: item.highlighted,\n },\n },\n })\n );\n },\n widgetParams() {\n return {\n attribute: this.attribute,\n operator: this.operator,\n limit: this.limit,\n showMore: this.showMore,\n showMoreLimit: this.showMoreLimit,\n sortBy: this.sortBy,\n escapeFacetValues: true,\n transformItems: this.transformItems,\n };\n },\n },\n methods: {\n refine(value) {\n this.state.refine(value);\n this.searchForFacetValuesQuery = '';\n },\n },\n};\n</script>\n"],"names":["_ctx","_createElementBlock","class","canRefine","_renderSlot","items","$options","refine","searchForItems","searchForItemsQuery","$data","toggleShowMore","canToggleShowMore","isShowingMore","createURL","isFromSearch","sendEvent","$props","_createVNode","placeholder","class-names","length","query","_createElementVNode","item","isRefined","key","value","type","checked","onChange","attribute","hit","label","count","onClick","disabled"],"mappings":"2XAGUA,aAFRC,eACGC,SAAQF,UAASA,QAAMG,WAAaH,8BAGrCI,sBACGC,MAAOC,QACPC,OAAQD,SACRE,eAAkBR,QAAMQ,eACxBC,oBAAwBC,4BACxBC,eAAkBL,iBAClBM,kBAAsBZ,QAAMY,kBAC5BC,cAAiBb,QAAMa,cACvBC,UAAWd,QAAMc,UACjBC,aAAgBf,QAAMe,aACtBZ,UAAYH,QAAMG,UAClBa,UAAYhB,QAAMgB,mCAEmBC,kBAAtChB,eAAMC,QAAOF,uBACXkB,gBACWZ,4EAAAA,2BACRa,YAAaF,wBACbG,cAAapB,+EAMVA,QAAMe,kBAAgBT,QAAMe,OAHpCjB,8BAEGkB,MAAOhB,0CAGRiB,SAAMrB,QAAOF,sBAAmB,6BAElCuB,QAAKrB,QAAOF,yBACVC,WAEiBK,iBAARkB,cAFTvB,QACGC,SAAQF,eAAcwB,EAAKC,WAAazB,4BAExC0B,IAAKF,EAAKG,QAEXvB,mBAEGoB,KAAMA,EACNjB,OAAQD,SACRQ,UAAWd,QAAMc,6BAElBS,WAAQrB,QAAOF,mBACbuB,WACGrB,QAAOF,oBACR4B,KAAK,WACJD,MAAOH,EAAKG,MACZE,QAASL,EAAKC,UACdK,4BAAQxB,SAAOkB,EAAKG,oBAEXV,kBAAZhB,gBAAyBC,QAAOF,uBAC9BkB,KAAea,UAAU,OAAQC,IAAKR,6BAExCvB,gBAAcC,QAAOF,wBAAsBwB,EAAKS,WAChDV,UAAOrB,QAAOF,oBAAkBwB,EAAKU,iCAarCjB,gBARRhB,kBACGC,mGAMAiC,6FAAO7B,gDAEP8B,UAAWpC,QAAMY,oBAElBR,4BAA4BS,cAAiBb,QAAMa,8CACzCb,QAAMa"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"SearchInput.vue_vue&type=template&id=02fb82e2&lang.js","sources":["../../../../src/components/SearchInput.vue?vue&type=template&id=02fb82e2&lang.js"],"sourcesContent":["<template>\n <form\n action=\"\"\n role=\"search\"\n novalidate\n :class=\"suit('form')\"\n @submit.prevent=\"onFormSubmit\"\n @reset.prevent=\"onFormReset\"\n >\n <!-- :value/@input allows us to pass v-model to the component in v2 -->\n <!-- :modelValue/@update:modelValue allows us to pass v-model to the component in v3 -->\n <input\n type=\"search\"\n autocorrect=\"off\"\n autocapitalize=\"off\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n maxlength=\"512\"\n aria-label=\"Search\"\n :placeholder=\"placeholder\"\n :autofocus=\"autofocus\"\n :class=\"suit('input')\"\n :value=\"value || modelValue\"\n @focus=\"$emit('focus', $event)\"\n @blur=\"$emit('blur', $event)\"\n @input=\"onInput($event)\"\n @compositionend=\"onInput($event)\"\n ref=\"input\"\n />\n <button\n type=\"submit\"\n :title=\"submitTitle\"\n :class=\"suit('submit')\"\n :hidden=\"showLoadingIndicator && shouldShowLoadingIndicator\"\n >\n <slot name=\"submit-icon\">\n <svg\n aria-hidden=\"true\"\n width=\"10\"\n height=\"10\"\n viewBox=\"0 0 40 40\"\n :class=\"suit('submitIcon')\"\n >\n <path\n d=\"M26.804 29.01c-2.832 2.34-6.465 3.746-10.426 3.746C7.333 32.756 0 25.424 0 16.378 0 7.333 7.333 0 16.378 0c9.046 0 16.378 7.333 16.378 16.378 0 3.96-1.406 7.594-3.746 10.426l10.534 10.534c.607.607.61 1.59-.004 2.202-.61.61-1.597.61-2.202.004L26.804 29.01zm-10.426.627c7.323 0 13.26-5.936 13.26-13.26 0-7.32-5.937-13.257-13.26-13.257C9.056 3.12 3.12 9.056 3.12 16.378c0 7.323 5.936 13.26 13.258 13.26z\"\n />\n </svg>\n </slot>\n </button>\n\n <button\n type=\"reset\"\n :title=\"resetTitle\"\n :class=\"suit('reset')\"\n :hidden=\"\n (!value && !modelValue) ||\n (showLoadingIndicator && shouldShowLoadingIndicator)\n \"\n >\n <slot name=\"reset-icon\">\n <svg\n aria-hidden=\"true\"\n height=\"10\"\n viewBox=\"0 0 20 20\"\n :class=\"suit('resetIcon')\"\n width=\"10\"\n >\n <path\n d=\"M8.114 10L.944 2.83 0 1.885 1.886 0l.943.943L10 8.113l7.17-7.17.944-.943L20 1.886l-.943.943-7.17 7.17 7.17 7.17.943.944L18.114 20l-.943-.943-7.17-7.17-7.17 7.17-.944.943L0 18.114l.943-.943L8.113 10z\"\n />\n </svg>\n </slot>\n </button>\n\n <span\n v-if=\"showLoadingIndicator\"\n :hidden=\"!shouldShowLoadingIndicator\"\n :class=\"suit('loadingIndicator')\"\n >\n <slot name=\"loading-indicator\">\n <svg\n :aria-hidden=\"!shouldShowLoadingIndicator\"\n aria-label=\"Results are loading\"\n width=\"16\"\n height=\"16\"\n stroke=\"#444\"\n viewBox=\"0 0 38 38\"\n :class=\"suit('loadingIcon')\"\n >\n <g fill=\"none\" fill-rule=\"evenodd\">\n <g transform=\"translate(1 1)\" stroke-width=\"2\">\n <circle stroke-opacity=\".5\" cx=\"18\" cy=\"18\" r=\"18\" />\n <path d=\"M36 18c0-9.94-8.06-18-18-18\">\n <animateTransform\n attributeName=\"transform\"\n type=\"rotate\"\n from=\"0 18 18\"\n to=\"360 18 18\"\n dur=\"1s\"\n repeatCount=\"indefinite\"\n />\n </path>\n </g>\n </g>\n </svg>\n </slot>\n </span>\n </form>\n</template>\n\n<script>\nimport { createSuitMixin } from '../mixins/suit';\n\nexport default {\n name: 'SearchInput',\n mixins: [createSuitMixin({ name: 'SearchBox' })],\n props: {\n placeholder: {\n type: String,\n default: 'Search here…',\n },\n autofocus: {\n type: Boolean,\n default: false,\n },\n showLoadingIndicator: {\n type: Boolean,\n default: false,\n },\n shouldShowLoadingIndicator: {\n type: Boolean,\n default: false,\n },\n ignoreCompositionEvents: {\n type: Boolean,\n default: false,\n },\n submitTitle: {\n type: String,\n default: 'Search',\n },\n resetTitle: {\n type: String,\n default: 'Clear',\n },\n value: {\n type: String,\n required: false,\n default: undefined,\n },\n modelValue: {\n type: String,\n required: false,\n default: undefined,\n },\n },\n emits: ['input', 'update:modelValue', 'blur', 'focus', 'reset'],\n data() {\n return {\n query: '',\n };\n },\n methods: {\n isFocused() {\n return document.activeElement === this.$refs.input;\n },\n onInput(event) {\n if (!(this.ignoreCompositionEvents && event.isComposing)) {\n this.$emit('input', event.target.value);\n this.$emit('update:modelValue', event.target.value);\n }\n },\n onFormSubmit() {\n const input = this.$refs.input;\n input.blur();\n },\n onFormReset() {\n this.$emit('input', '');\n this.$emit('update:modelValue', '');\n this.$emit('reset');\n },\n },\n};\n</script>\n"],"names":["_createElementVNode","d","_createElementBlock","action","role","novalidate","class","_ctx","onSubmit","$options","onReset","type","autocorrect","autocapitalize","autocomplete","spellcheck","maxlength","aria-label","placeholder","$props","autofocus","value","onFocus","$event","onBlur","onInput","onCompositionend","ref","title","hidden","_renderSlot","aria-hidden","width","height","viewBox","stroke"],"mappings":"wPA2CUA,UACEC,EAAE,sbAuBJD,UACEC,EAAE,knBAnEZC,UACEC,OAAO,GACPC,KAAK,SACLC,WAAA,GACCC,QAAOC,gBACPC,gGAAgBC,yDAChBC,+FAAeD,yDAIhBT,WACEW,KAAK,SACLC,YAAY,MACZC,eAAe,MACfC,aAAa,MACbC,WAAW,QACXC,UAAU,MACVC,aAAW,SACVC,YAAaC,cACbC,UAAWD,YACXb,QAAOC,iBACPc,MAAOF,SAASA,aAChBG,uCAAOf,gBAAegB,KACtBC,sCAAMjB,eAAcgB,KACpBE,uCAAOhB,UAAQc,KACfG,gDAAgBjB,UAAQc,KACzBI,IAAI,oBAEN3B,YACEW,KAAK,SACJiB,MAAOT,cACPb,QAAOC,kBACPsB,OAAQV,wBAAwBA,+BAEjCW,mDACE5B,SACE6B,cAAY,OACZC,MAAM,KACNC,OAAO,KACPC,QAAQ,YACP5B,QAAOC,uCASdP,YACEW,KAAK,QACJiB,MAAOT,aACPb,QAAOC,iBACPsB,uFAKDC,kDACE5B,SACE6B,cAAY,OACZE,OAAO,KACPC,QAAQ,YACP5B,QAAOC,qBACRyB,MAAM,sBAUJb,4BADRjB,gBAEG2B,QAASV,6BACTb,QAAOC,8BAERuB,yDACE5B,SACG6B,eAAcZ,6BACfF,aAAW,sBACXe,MAAM,KACNC,OAAO,KACPE,OAAO,OACPD,QAAQ,YACP5B,QAAOC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Snippet.vue_vue&type=template&id=1e214b4c&lang.js","sources":["../../../../src/components/Snippet.vue?vue&type=template&id=1e214b4c&lang.js"],"sourcesContent":["<template>\n <ais-highlighter\n :hit=\"hit\"\n :attribute=\"attribute\"\n :highlighted-tag-name=\"highlightedTagName\"\n :suit=\"suit\"\n highlight-property=\"_snippetResult\"\n pre-tag=\"<mark>\"\n post-tag=\"</mark>\"\n />\n</template>\n\n<script>\nimport { createSuitMixin } from '../mixins/suit';\n\nimport AisHighlighter from './Highlighter.vue';\n\nexport default {\n name: 'AisSnippet',\n mixins: [createSuitMixin({ name: 'Snippet' })],\n components: { AisHighlighter },\n props: {\n hit: {\n type: Object,\n required: true,\n },\n attribute: {\n type: String,\n required: true,\n },\n highlightedTagName: {\n type: String,\n default: 'mark',\n },\n },\n};\n</script>\n"],"names":["_createBlock","hit","$props","attribute","highlighted-tag-name","suit","_ctx","highlight-property","pre-tag","post-tag"],"mappings":"qIACEA,KACGC,IAAKC,MACLC,UAAWD,YACXE,uBAAsBF,qBACtBG,KAAMC,OACPC,qBAAmB,iBACnBC,UAAQ,SACRC,WAAS"}
@@ -1,2 +0,0 @@
1
- import{getPropertyByPath as i}from"instantsearch.js/es/lib/utils/index.js";import{unescape as h}from"./unescape.js";var t={highlightPreTag:"__ais-highlight__",highlightPostTag:"__/ais-highlight__"};function r(i){var h=i.preTag,t=i.postTag,r=i.highlightedValue;void 0===r&&(r="");var a=r.split(h),g=a.shift(),e=""===g?[]:[{value:g,isHighlighted:!1}];if(t===h){var s=!0;a.forEach(function(i){e.push({value:i,isHighlighted:s}),s=!s})}else a.forEach(function(i){var h=i.split(t);e.push({value:h[0],isHighlighted:!0}),""!==h[1]&&e.push({value:" "===h[1]?" ":h[1],isHighlighted:!1})});return e}function a(a){var g=a.preTag;void 0===g&&(g=t.highlightPreTag);var e=a.postTag;void 0===e&&(e=t.highlightPostTag);var s=a.highlightProperty,l=a.attribute,o=a.hit;if(!o)throw new Error("`hit`, the matching record, must be provided");var u=i(o[s],l)||{};return Array.isArray(u)?u.map(function(i){return r({preTag:g,postTag:e,highlightedValue:h(i.value)})}):r({preTag:g,postTag:e,highlightedValue:h(u.value)})}export{a as parseAlgoliaHit};
2
- //# sourceMappingURL=parseAlgoliaHit.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parseAlgoliaHit.js","sources":["../../../../src/util/parseAlgoliaHit.js"],"sourcesContent":["// copied from React InstantSearch\nimport { getPropertyByPath } from 'instantsearch.js/es/lib/utils';\n\nimport { unescape } from '../util/unescape';\n\nconst TAG_PLACEHOLDER = {\n highlightPreTag: '__ais-highlight__',\n highlightPostTag: '__/ais-highlight__',\n};\n\n/**\n * Parses an highlighted attribute into an array of objects with the string value, and\n * a boolean that indicated if this part is highlighted.\n *\n * @param {string} preTag - string used to identify the start of an highlighted value\n * @param {string} postTag - string used to identify the end of an highlighted value\n * @param {string} highlightedValue - highlighted attribute as returned by Algolia highlight feature\n * @return {object[]} - An array of {value: string, isHighlighted: boolean}.\n */\nfunction parseHighlightedAttribute({ preTag, postTag, highlightedValue = '' }) {\n const splitByPreTag = highlightedValue.split(preTag);\n const firstValue = splitByPreTag.shift();\n const elements =\n firstValue === '' ? [] : [{ value: firstValue, isHighlighted: false }];\n\n if (postTag === preTag) {\n let isHighlighted = true;\n splitByPreTag.forEach((split) => {\n elements.push({ value: split, isHighlighted });\n isHighlighted = !isHighlighted;\n });\n } else {\n splitByPreTag.forEach((split) => {\n const splitByPostTag = split.split(postTag);\n\n elements.push({\n value: splitByPostTag[0],\n isHighlighted: true,\n });\n\n if (splitByPostTag[1] !== '') {\n elements.push({\n // Vue removes nodes which are just a single space (vuejs/vue#9208),\n // we replace this by two spaces, which does not have an impact,\n // unless someone would have `white-space: pre` on the highlights\n value: splitByPostTag[1] === ' ' ? ' ' : splitByPostTag[1],\n isHighlighted: false,\n });\n }\n });\n }\n\n return elements;\n}\n\n/**\n * Find an highlighted attribute given an `attribute` and an `highlightProperty`, parses it,\n * and provided an array of objects with the string value and a boolean if this\n * value is highlighted.\n *\n * In order to use this feature, highlight must be activated in the configuration of\n * the index. The `preTag` and `postTag` attributes are respectively highlightPreTag and\n * highlightPostTag in Algolia configuration.\n *\n * @param {string} preTag - string used to identify the start of an highlighted value\n * @param {string} postTag - string used to identify the end of an highlighted value\n * @param {string} highlightProperty - the property that contains the highlight structure in the results\n * @param {string} attribute - the highlighted attribute to look for\n * @param {object} hit - the actual hit returned by Algolia.\n * @return {object[]} - An array of {value: string, isHighlighted: boolean}.\n */\nexport function parseAlgoliaHit({\n preTag = TAG_PLACEHOLDER.highlightPreTag,\n postTag = TAG_PLACEHOLDER.highlightPostTag,\n highlightProperty,\n attribute,\n hit,\n}) {\n if (!hit) throw new Error('`hit`, the matching record, must be provided');\n\n const highlightObject =\n getPropertyByPath(hit[highlightProperty], attribute) || {};\n\n if (Array.isArray(highlightObject)) {\n return highlightObject.map((item) =>\n parseHighlightedAttribute({\n preTag,\n postTag,\n highlightedValue: unescape(item.value),\n })\n );\n }\n\n return parseHighlightedAttribute({\n preTag,\n postTag,\n highlightedValue: unescape(highlightObject.value),\n });\n}\n"],"names":["const","TAG_PLACEHOLDER","highlightPreTag","highlightPostTag","parseHighlightedAttribute","splitByPreTag","highlightedValue","split","preTag","firstValue","shift","elements","value","isHighlighted","postTag","let","forEach","push","splitByPostTag","parseAlgoliaHit","hit","Error","highlightObject","getPropertyByPath","highlightProperty","attribute","Array","isArray","map","item","unescape"],"mappings":"oHAKAA,IAAMC,EAAkB,CACtBC,gBAAiB,oBACjBC,iBAAkB,sBAYpB,SAASC,oEAAgE,IACvEJ,IAAMK,EAAgBC,EAAiBC,MAAMC,GACvCC,EAAaJ,EAAcK,QAC3BC,EACW,KAAfF,EAAoB,GAAK,CAAC,CAAEG,MAAOH,EAAYI,eAAe,IAEhE,GAAIC,IAAYN,EAAQ,CACtBO,IAAIF,GAAgB,EACpBR,EAAcW,iBAAST,GACrBI,EAASM,KAAK,CAAEL,MAAOL,gBAAOM,IAC9BA,GAAiBA,SAGnBR,EAAcW,iBAAST,GACrBP,IAAMkB,EAAiBX,EAAMA,MAAMO,GAEnCH,EAASM,KAAK,CACZL,MAAOM,EAAe,GACtBL,eAAe,IAGS,KAAtBK,EAAe,IACjBP,EAASM,KAAK,CAIZL,MAA6B,MAAtBM,EAAe,GAAa,KAAOA,EAAe,GACzDL,eAAe,MAMvB,OAAOF,EAmBF,SAASQ,mCACLlB,EAAgBC,gDACfD,EAAgBE,kEAK1B,IAAKiB,EAAK,MAAM,IAAIC,MAAM,gDAE1BrB,IAAMsB,EACJC,EAAkBH,EAAII,GAAoBC,IAAc,GAE1D,OAAIC,MAAMC,QAAQL,GACTA,EAAgBM,aAAKC,UAC1BzB,EAA0B,QACxBI,UACAM,EACAR,iBAAkBwB,EAASD,EAAKjB,WAK/BR,EAA0B,QAC/BI,UACAM,EACAR,iBAAkBwB,EAASR,EAAgBV"}
@@ -1,2 +0,0 @@
1
- var t={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},e=/&(?:amp|lt|gt|quot|#39);/g,r=RegExp(e.source);function u(u){return u&&r.test(u)?u.replace(e,function(e){return t[e]}):u}export{u as unescape};
2
- //# sourceMappingURL=unescape.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"unescape.js","sources":["../../../../src/util/unescape.js"],"sourcesContent":["/**\n * This implementation is taken from Lodash implementation.\n * See: https://github.com/lodash/lodash/blob/4.17.11-npm/unescape.js\n */\n\n/** Used to map HTML entities to characters. */\nconst htmlUnescapes = {\n '&amp;': '&',\n '&lt;': '<',\n '&gt;': '>',\n '&quot;': '\"',\n '&#39;': \"'\",\n};\n\n/** Used to match HTML entities and HTML characters. */\nconst reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g;\nconst reHasEscapedHtml = RegExp(reEscapedHtml.source);\n\n/**\n * The inverse of `_.escape`; this method converts the HTML entities\n * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to\n * their corresponding characters.\n *\n * **Note:** No other HTML entities are unescaped. To unescape additional\n * HTML entities use a third-party library like [_he_](https://mths.be/he).\n *\n * @static\n * @memberOf _\n * @since 0.6.0\n * @category String\n * @param {string} [string=''] The string to unescape.\n * @returns {string} Returns the unescaped string.\n * @example\n *\n * _.unescape('fred, barney, &amp; pebbles');\n * // => 'fred, barney, & pebbles'\n */\nexport function unescape(string) {\n return string && reHasEscapedHtml.test(string)\n ? string.replace(reEscapedHtml, (character) => htmlUnescapes[character])\n : string;\n}\n"],"names":["const","htmlUnescapes","&amp;","&lt;","&gt;","&quot;","&#39;","reEscapedHtml","reHasEscapedHtml","RegExp","source","unescape","string","test","replace","character"],"mappings":"AAMAA,IAAMC,EAAgB,CACpBC,QAAS,IACTC,OAAQ,IACRC,OAAQ,IACRC,SAAU,IACVC,QAAS,KAILC,EAAgB,4BAChBC,EAAmBC,OAAOF,EAAcG,QAqBvC,SAASC,EAASC,GACvB,OAAOA,GAAUJ,EAAiBK,KAAKD,GACnCA,EAAOE,QAAQP,WAAgBQ,UAAcd,EAAcc,KAC3DH"}