@ddict/popup
Advanced tools
Comparing version 0.3.19 to 1.0.0
1006
dist/popup.es.js
@@ -1,3 +0,8 @@ | ||
import { resolveComponent, openBlock, createElementBlock, createElementVNode, withDirectives, Fragment, renderList, toDisplayString, vModelSelect, createBlock, createCommentVNode, createVNode, normalizeStyle, vModelText, vModelCheckbox, createTextVNode, Transition, withCtx } from "vue"; | ||
var style = ""; | ||
import { openBlock, createElementBlock, Fragment, withDirectives, createElementVNode, renderList, toDisplayString, vModelSelect, createCommentVNode, normalizeStyle, vModelText, vModelCheckbox, createVNode } from "vue"; | ||
var helper = { | ||
isRTL | ||
}; | ||
function isRTL(locale) { | ||
return ["ar", "fa", "iw", "yi", "ur", "pa"].indexOf(locale) > -1; | ||
} | ||
var _export_sfc = (sfc, props) => { | ||
@@ -17,2 +22,3 @@ const target = sfc.__vccOpts || sfc; | ||
}, | ||
emits: ["select"], | ||
data() { | ||
@@ -22,22 +28,31 @@ return { | ||
target: "", | ||
warning: false | ||
recents: { | ||
src: [], | ||
target: [] | ||
} | ||
}; | ||
}, | ||
watch: { | ||
select() { | ||
this.src = this.select.src; | ||
this.target = this.select.target; | ||
select(val) { | ||
if (!val) | ||
return; | ||
this.src = val.src; | ||
this.target = val.target; | ||
this.loadRecents(); | ||
} | ||
}, | ||
methods: { | ||
warn() { | ||
this.warning = true; | ||
setTimeout(() => { | ||
this.warning = false; | ||
}, 2e3); | ||
onRecentSrc(src) { | ||
this.src = src; | ||
this.onSelect(); | ||
}, | ||
onRecentTarget(target) { | ||
this.target = target; | ||
this.onSelect(); | ||
}, | ||
swap() { | ||
if (!this.select.srcs.hasOwnProperty(this.target) || !this.select.targets.hasOwnProperty(this.src)) { | ||
this.warn(); | ||
if (this.src === "auto") | ||
return; | ||
if (!this.select.srcs[this.target] || !this.select.targets[this.src]) { | ||
return; | ||
} | ||
@@ -47,9 +62,28 @@ const tmp = this.target; | ||
this.src = tmp; | ||
this.srctarget(); | ||
this.onSelect(); | ||
}, | ||
srctarget() { | ||
onSelect() { | ||
const select = JSON.parse(JSON.stringify(this.select)); | ||
select.src = this.src; | ||
select.target = this.target; | ||
this.$emit("srctarget", select); | ||
this.$emit("select", select); | ||
this.saveRecents(this.src, this.target); | ||
}, | ||
loadRecents() { | ||
const recents = JSON.parse(localStorage.getItem("recents")); | ||
if (!recents) | ||
return; | ||
this.recents = recents; | ||
}, | ||
saveRecents(src, target) { | ||
if (!this.recents.src.includes(src)) { | ||
this.recents.src.push(src); | ||
} | ||
if (!this.recents.target.includes(target)) | ||
this.recents.target.push(target); | ||
if (this.recents.src.length > 3) | ||
this.recents.src.shift(); | ||
if (this.recents.target.length > 3) | ||
this.recents.target.shift(); | ||
localStorage.setItem("recents", JSON.stringify(this.recents)); | ||
} | ||
@@ -60,21 +94,50 @@ } | ||
key: 0, | ||
class: "row justify-content-center mb-2" | ||
class: "flex flex-row" | ||
}; | ||
const _hoisted_2$7 = { class: "col-5" }; | ||
const _hoisted_3$7 = ["value"]; | ||
const _hoisted_4$7 = { class: "col-auto text-center" }; | ||
const _hoisted_5$7 = { | ||
id: "swap", | ||
class: "form-control bg-light pointer" | ||
const _hoisted_2$8 = ["value"]; | ||
const _hoisted_3$8 = { | ||
key: 0, | ||
xmlns: "http://www.w3.org/2000/svg", | ||
class: "h-6 w-6", | ||
fill: "none", | ||
viewBox: "0 0 24 24", | ||
stroke: "currentColor" | ||
}; | ||
const _hoisted_6$6 = { class: "col-5" }; | ||
const _hoisted_7$1 = ["value"]; | ||
function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) { | ||
const _component_b_icon = resolveComponent("b-icon"); | ||
return $props.select ? (openBlock(), createElementBlock("div", _hoisted_1$8, [ | ||
createElementVNode("div", _hoisted_2$7, [ | ||
const _hoisted_4$8 = /* @__PURE__ */ createElementVNode("path", { | ||
"stroke-linecap": "round", | ||
"stroke-linejoin": "round", | ||
"stroke-width": "2", | ||
d: "M8 7h12m0 0l-4-4m4 4l-4 4m0 6H4m0 0l4 4m-4-4l4-4" | ||
}, null, -1); | ||
const _hoisted_5$7 = [ | ||
_hoisted_4$8 | ||
]; | ||
const _hoisted_6$6 = { | ||
key: 1, | ||
xmlns: "http://www.w3.org/2000/svg", | ||
class: "h-6 w-6", | ||
fill: "none", | ||
viewBox: "0 0 24 24", | ||
stroke: "currentColor" | ||
}; | ||
const _hoisted_7$5 = /* @__PURE__ */ createElementVNode("path", { | ||
"stroke-linecap": "round", | ||
"stroke-linejoin": "round", | ||
"stroke-width": "2", | ||
d: "M13 7l5 5m0 0l-5 5m5-5H6" | ||
}, null, -1); | ||
const _hoisted_8$2 = [ | ||
_hoisted_7$5 | ||
]; | ||
const _hoisted_9$2 = ["value"]; | ||
const _hoisted_10$2 = { key: 1 }; | ||
const _hoisted_11$2 = ["onClick"]; | ||
const _hoisted_12$2 = ["onClick"]; | ||
function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) { | ||
return openBlock(), createElementBlock(Fragment, null, [ | ||
$props.select ? (openBlock(), createElementBlock("div", _hoisted_1$8, [ | ||
withDirectives(createElementVNode("select", { | ||
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $data.src = $event), | ||
class: "form-select", | ||
onChange: _cache[1] || (_cache[1] = (...args) => $options.srctarget && $options.srctarget(...args)) | ||
class: "select select-bordered grow", | ||
onChange: _cache[1] || (_cache[1] = (...args) => $options.onSelect && $options.onSelect(...args)) | ||
}, [ | ||
@@ -85,26 +148,18 @@ (openBlock(true), createElementBlock(Fragment, null, renderList($props.select.srcs, (value, key) => { | ||
key | ||
}, toDisplayString(value), 9, _hoisted_3$7); | ||
}, toDisplayString(value), 9, _hoisted_2$8); | ||
}), 128)) | ||
], 544), [ | ||
[vModelSelect, $data.src] | ||
]) | ||
]), | ||
createElementVNode("div", _hoisted_4$7, [ | ||
createElementVNode("span", _hoisted_5$7, [ | ||
$data.src != "auto" ? (openBlock(), createBlock(_component_b_icon, { | ||
key: 0, | ||
icon: "arrow-left-right", | ||
onClick: $options.swap | ||
}, null, 8, ["onClick"])) : createCommentVNode("", true), | ||
$data.src == "auto" ? (openBlock(), createBlock(_component_b_icon, { | ||
key: 1, | ||
icon: "arrow-right" | ||
})) : createCommentVNode("", true) | ||
]) | ||
]), | ||
createElementVNode("div", _hoisted_6$6, [ | ||
]), | ||
createElementVNode("button", { | ||
class: "grow-0 ml-2 mr-2", | ||
onClick: _cache[2] || (_cache[2] = (...args) => $options.swap && $options.swap(...args)) | ||
}, [ | ||
$data.src != "auto" ? (openBlock(), createElementBlock("svg", _hoisted_3$8, _hoisted_5$7)) : createCommentVNode("", true), | ||
$data.src == "auto" ? (openBlock(), createElementBlock("svg", _hoisted_6$6, _hoisted_8$2)) : createCommentVNode("", true) | ||
]), | ||
withDirectives(createElementVNode("select", { | ||
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => $data.target = $event), | ||
class: "form-select", | ||
onChange: _cache[3] || (_cache[3] = (...args) => $options.srctarget && $options.srctarget(...args)) | ||
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => $data.target = $event), | ||
class: "select select-bordered grow", | ||
onChange: _cache[4] || (_cache[4] = (...args) => $options.onSelect && $options.onSelect(...args)) | ||
}, [ | ||
@@ -115,3 +170,3 @@ (openBlock(true), createElementBlock(Fragment, null, renderList($props.select.targets, (value, key) => { | ||
key | ||
}, toDisplayString(value), 9, _hoisted_7$1); | ||
}, toDisplayString(value), 9, _hoisted_9$2); | ||
}), 128)) | ||
@@ -121,6 +176,22 @@ ], 544), [ | ||
]) | ||
]) | ||
])) : createCommentVNode("", true); | ||
])) : createCommentVNode("", true), | ||
$props.select && $data.src && $data.target && $data.recents ? (openBlock(), createElementBlock("p", _hoisted_10$2, [ | ||
(openBlock(true), createElementBlock(Fragment, null, renderList($data.recents.src, (src) => { | ||
return openBlock(), createElementBlock("span", { | ||
key: src, | ||
onClick: ($event) => $options.onRecentSrc(src), | ||
class: "badge badge-sm ml-1 badge-outline" | ||
}, toDisplayString($props.select.srcs[src]), 9, _hoisted_11$2); | ||
}), 128)), | ||
(openBlock(true), createElementBlock(Fragment, null, renderList($data.recents.target, (target) => { | ||
return openBlock(), createElementBlock("span", { | ||
key: target, | ||
onClick: ($event) => $options.onRecentTarget(target), | ||
class: "badge badge-sm ml-1 float-right mt-1" | ||
}, toDisplayString($props.select.targets[target]), 9, _hoisted_12$2); | ||
}), 128)) | ||
])) : createCommentVNode("", true) | ||
], 64); | ||
} | ||
var selects = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$8]]); | ||
var Selects = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$7]]); | ||
var config = { | ||
@@ -166,8 +237,2 @@ INPUT_MAX_LENGTH: 5e3, | ||
} | ||
var helper = { | ||
isRTL | ||
}; | ||
function isRTL(locale) { | ||
return ["ar", "fa", "iw", "yi", "ur", "pa"].indexOf(locale) > -1; | ||
} | ||
const LABEL_AUTO_TRANSLATE = "auto_translate"; | ||
@@ -287,87 +352,137 @@ const _sfc_main$7 = { | ||
}; | ||
const _hoisted_1$7 = { class: "col-sm-6 section position-relative" }; | ||
const _hoisted_2$6 = { | ||
const _hoisted_1$7 = { class: "relative indicator w-full" }; | ||
const _hoisted_2$7 = { | ||
key: 0, | ||
class: "textarea-src-target-header text-truncate position-absolute top-0 start-20 truncate" | ||
class: "absolute top-0 left-0 w-4/5 ml-2 text-sm truncate" | ||
}; | ||
const _hoisted_3$6 = { | ||
const _hoisted_3$7 = /* @__PURE__ */ createElementVNode("svg", { | ||
xmlns: "http://www.w3.org/2000/svg", | ||
class: "h-4 w-4 inline", | ||
fill: "none", | ||
viewBox: "0 0 24 24", | ||
stroke: "currentColor" | ||
}, [ | ||
/* @__PURE__ */ createElementVNode("path", { | ||
"stroke-linecap": "round", | ||
"stroke-linejoin": "round", | ||
"stroke-width": "2", | ||
d: "M15.536 8.464a5 5 0 010 7.072m2.828-9.9a9 9 0 010 12.728M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z" | ||
}) | ||
], -1); | ||
const _hoisted_4$7 = [ | ||
_hoisted_3$7 | ||
]; | ||
const _hoisted_5$6 = /* @__PURE__ */ createElementVNode("svg", { | ||
xmlns: "http://www.w3.org/2000/svg", | ||
class: "h-4 w-4 inline", | ||
fill: "none", | ||
viewBox: "0 0 24 24", | ||
stroke: "currentColor" | ||
}, [ | ||
/* @__PURE__ */ createElementVNode("path", { | ||
"stroke-linecap": "round", | ||
"stroke-linejoin": "round", | ||
"stroke-width": "2", | ||
d: "M21 12a9 9 0 11-18 0 9 9 0 0118 0z" | ||
}), | ||
/* @__PURE__ */ createElementVNode("path", { | ||
"stroke-linecap": "round", | ||
"stroke-linejoin": "round", | ||
"stroke-width": "2", | ||
d: "M9 10a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1h-4a1 1 0 01-1-1v-4z" | ||
}) | ||
], -1); | ||
const _hoisted_6$5 = [ | ||
_hoisted_5$6 | ||
]; | ||
const _hoisted_7$4 = { | ||
key: 2, | ||
class: "text-muted small" | ||
class: "ml-1" | ||
}; | ||
const _hoisted_4$6 = { key: 0 }; | ||
const _hoisted_5$6 = { class: "small form-check form-switch text-muted textarea-footer" }; | ||
const _hoisted_6$5 = /* @__PURE__ */ createElementVNode("label", { | ||
const _hoisted_8$1 = { key: 0 }; | ||
const _hoisted_9$1 = /* @__PURE__ */ createElementVNode("svg", { | ||
xmlns: "http://www.w3.org/2000/svg", | ||
class: "h-5 w-5", | ||
fill: "none", | ||
viewBox: "0 0 24 24", | ||
stroke: "currentColor" | ||
}, [ | ||
/* @__PURE__ */ createElementVNode("path", { | ||
"stroke-linecap": "round", | ||
"stroke-linejoin": "round", | ||
"stroke-width": "2", | ||
d: "M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z" | ||
}) | ||
], -1); | ||
const _hoisted_10$1 = [ | ||
_hoisted_9$1 | ||
]; | ||
const _hoisted_11$1 = /* @__PURE__ */ createElementVNode("label", { | ||
for: "auto_translate", | ||
class: "form-check-label small" | ||
}, "Auto translate", -1); | ||
const _hoisted_7 = { | ||
class: "text-xs ml-1" | ||
}, " Auto translate ", -1); | ||
const _hoisted_12$1 = { | ||
key: 0, | ||
class: "float-end" | ||
class: "float-right text-xs" | ||
}; | ||
function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) { | ||
const _component_b_icon = resolveComponent("b-icon"); | ||
return openBlock(), createElementBlock("div", _hoisted_1$7, [ | ||
$props.data ? (openBlock(), createElementBlock("small", _hoisted_2$6, [ | ||
!$data.playing ? (openBlock(), createElementBlock("span", { | ||
key: 0, | ||
class: "pointer", | ||
onClick: _cache[0] || (_cache[0] = (...args) => $options.play && $options.play(...args)) | ||
}, [ | ||
createVNode(_component_b_icon, { icon: "volume-up" }) | ||
function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) { | ||
return openBlock(), createElementBlock("div", null, [ | ||
createElementVNode("div", _hoisted_1$7, [ | ||
$props.data ? (openBlock(), createElementBlock("div", _hoisted_2$7, [ | ||
!$data.playing ? (openBlock(), createElementBlock("span", { | ||
key: 0, | ||
class: "pointer", | ||
onClick: _cache[0] || (_cache[0] = (...args) => $options.play && $options.play(...args)) | ||
}, _hoisted_4$7)) : createCommentVNode("", true), | ||
$data.playing ? (openBlock(), createElementBlock("span", { | ||
key: 1, | ||
class: "pointer", | ||
onClick: _cache[1] || (_cache[1] = (...args) => $options.stop && $options.stop(...args)) | ||
}, _hoisted_6$5)) : createCommentVNode("", true), | ||
$props.data.ddictSrc ? (openBlock(), createElementBlock("span", _hoisted_7$4, toDisplayString($props.data.ddictSrc), 1)) : createCommentVNode("", true), | ||
(openBlock(true), createElementBlock(Fragment, null, renderList($props.data.sentences, (sentence, index) => { | ||
return openBlock(), createElementBlock("span", { | ||
key: `${sentence.src_translit}-${index}`, | ||
class: "text-muted small" | ||
}, [ | ||
sentence.src_translit ? (openBlock(), createElementBlock("span", _hoisted_8$1, " \u2015 " + toDisplayString(sentence.src_translit), 1)) : createCommentVNode("", true) | ||
]); | ||
}), 128)) | ||
])) : createCommentVNode("", true), | ||
$data.playing ? (openBlock(), createElementBlock("span", { | ||
$data.input != "" ? (openBlock(), createElementBlock("div", { | ||
key: 1, | ||
class: "pointer", | ||
onClick: _cache[1] || (_cache[1] = (...args) => $options.stop && $options.stop(...args)) | ||
}, [ | ||
createVNode(_component_b_icon, { icon: "volume-off" }) | ||
])) : createCommentVNode("", true), | ||
$props.data.ddictSrc ? (openBlock(), createElementBlock("span", _hoisted_3$6, toDisplayString($props.data.ddictSrc), 1)) : createCommentVNode("", true), | ||
(openBlock(true), createElementBlock(Fragment, null, renderList($props.data.sentences, (sentence, index) => { | ||
return openBlock(), createElementBlock("span", { | ||
key: `${sentence.src_translit}-${index}`, | ||
class: "text-muted small" | ||
}, [ | ||
sentence.src_translit ? (openBlock(), createElementBlock("span", _hoisted_4$6, " \u2015 " + toDisplayString(sentence.src_translit), 1)) : createCommentVNode("", true) | ||
]); | ||
}), 128)) | ||
])) : createCommentVNode("", true), | ||
$data.input != "" ? (openBlock(), createElementBlock("span", { | ||
key: 1, | ||
id: "clear", | ||
class: "small pointer position-absolute top-0 end-0", | ||
onClick: _cache[2] || (_cache[2] = (...args) => $options.clear && $options.clear(...args)) | ||
}, [ | ||
createVNode(_component_b_icon, { icon: "x-circle" }) | ||
])) : createCommentVNode("", true), | ||
withDirectives(createElementVNode("textarea", { | ||
id: "input", | ||
ref: "input", | ||
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => $data.input = $event), | ||
class: "form-control textarea-src-target", | ||
style: normalizeStyle({ "text-align": $options.rtl ? "right" : "left" }), | ||
autofocus: "" | ||
}, "\n ", 4), [ | ||
[ | ||
vModelText, | ||
$data.input, | ||
void 0, | ||
{ trim: true } | ||
] | ||
onClick: _cache[2] || (_cache[2] = (...args) => $options.clear && $options.clear(...args)), | ||
class: "indicator-item m-3" | ||
}, _hoisted_10$1)) : createCommentVNode("", true), | ||
withDirectives(createElementVNode("textarea", { | ||
id: "input", | ||
ref: "input", | ||
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => $data.input = $event), | ||
class: "text-lg textarea textarea-bordered w-full pt-5", | ||
style: normalizeStyle({ "text-align": $options.rtl ? "right" : "left" }), | ||
autofocus: "" | ||
}, null, 4), [ | ||
[ | ||
vModelText, | ||
$data.input, | ||
void 0, | ||
{ trim: true } | ||
] | ||
]) | ||
]), | ||
createElementVNode("p", _hoisted_5$6, [ | ||
createElementVNode("p", null, [ | ||
withDirectives(createElementVNode("input", { | ||
"onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => $data.auto_translate = $event), | ||
id: "auto_translate", | ||
class: "form-check-input", | ||
"onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => $data.auto_translate = $event), | ||
type: "checkbox" | ||
type: "checkbox", | ||
class: "toggle toggle-xs" | ||
}, null, 512), [ | ||
[vModelCheckbox, $data.auto_translate] | ||
]), | ||
_hoisted_6$5, | ||
$data.input != "" ? (openBlock(), createElementBlock("small", _hoisted_7, toDisplayString($data.input.length) + " / " + toDisplayString($data.INPUT_MAX_LENGTH), 1)) : createCommentVNode("", true) | ||
_hoisted_11$1, | ||
$data.input != "" ? (openBlock(), createElementBlock("span", _hoisted_12$1, toDisplayString($data.input.length) + " / " + toDisplayString($data.INPUT_MAX_LENGTH), 1)) : createCommentVNode("", true) | ||
]) | ||
]); | ||
} | ||
var input = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$7]]); | ||
var Input = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$6]]); | ||
const _sfc_main$6 = { | ||
@@ -388,2 +503,3 @@ props: { | ||
playing: false, | ||
copied: false, | ||
ttsIndex: 0 | ||
@@ -440,53 +556,135 @@ }; | ||
this.player.pause(); | ||
}, | ||
copy() { | ||
const val = this.$refs.input.value; | ||
if (!val) | ||
return; | ||
navigator.clipboard.writeText(val); | ||
this.copied = true; | ||
setTimeout(() => { | ||
this.copied = false; | ||
}, 500); | ||
} | ||
} | ||
}; | ||
const _hoisted_1$6 = { class: "col-sm-6 section position-relative" }; | ||
const _hoisted_2$5 = { | ||
const _hoisted_1$6 = { class: "relative indicator w-full" }; | ||
const _hoisted_2$6 = { | ||
key: 0, | ||
class: "textarea-src-target-header text-truncate position-absolute top-0 start-20 truncate" | ||
class: "absolute top-0 left-0 w-2/3 ml-2 text-sm truncate" | ||
}; | ||
const _hoisted_3$5 = { | ||
const _hoisted_3$6 = /* @__PURE__ */ createElementVNode("svg", { | ||
xmlns: "http://www.w3.org/2000/svg", | ||
class: "h-4 w-4 inline", | ||
fill: "none", | ||
viewBox: "0 0 24 24", | ||
stroke: "currentColor" | ||
}, [ | ||
/* @__PURE__ */ createElementVNode("path", { | ||
"stroke-linecap": "round", | ||
"stroke-linejoin": "round", | ||
"stroke-width": "2", | ||
d: "M15.536 8.464a5 5 0 010 7.072m2.828-9.9a9 9 0 010 12.728M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z" | ||
}) | ||
], -1); | ||
const _hoisted_4$6 = [ | ||
_hoisted_3$6 | ||
]; | ||
const _hoisted_5$5 = /* @__PURE__ */ createElementVNode("svg", { | ||
xmlns: "http://www.w3.org/2000/svg", | ||
class: "h-4 w-4 inline", | ||
fill: "none", | ||
viewBox: "0 0 24 24", | ||
stroke: "currentColor" | ||
}, [ | ||
/* @__PURE__ */ createElementVNode("path", { | ||
"stroke-linecap": "round", | ||
"stroke-linejoin": "round", | ||
"stroke-width": "2", | ||
d: "M21 12a9 9 0 11-18 0 9 9 0 0118 0z" | ||
}), | ||
/* @__PURE__ */ createElementVNode("path", { | ||
"stroke-linecap": "round", | ||
"stroke-linejoin": "round", | ||
"stroke-width": "2", | ||
d: "M9 10a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1h-4a1 1 0 01-1-1v-4z" | ||
}) | ||
], -1); | ||
const _hoisted_6$4 = [ | ||
_hoisted_5$5 | ||
]; | ||
const _hoisted_7$3 = { | ||
key: 2, | ||
class: "text-muted small" | ||
class: "ml-1" | ||
}; | ||
const _hoisted_4$5 = { | ||
const _hoisted_8 = { | ||
key: 0, | ||
xmlns: "http://www.w3.org/2000/svg", | ||
class: "h-5 w-5", | ||
fill: "none", | ||
viewBox: "0 0 24 24", | ||
stroke: "currentColor" | ||
}; | ||
const _hoisted_9 = /* @__PURE__ */ createElementVNode("path", { | ||
"stroke-linecap": "round", | ||
"stroke-linejoin": "round", | ||
"stroke-width": "2", | ||
d: "M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3m2 4H10m0 0l3-3m-3 3l3 3" | ||
}, null, -1); | ||
const _hoisted_10 = [ | ||
_hoisted_9 | ||
]; | ||
const _hoisted_11 = { | ||
key: 1, | ||
class: "small text-end text-muted textarea-footer" | ||
xmlns: "http://www.w3.org/2000/svg", | ||
class: "h-5 w-5", | ||
viewBox: "0 0 20 20", | ||
fill: "currentColor" | ||
}; | ||
const _hoisted_5$5 = /* @__PURE__ */ createElementVNode("small", null, "Powered by Google Translate", -1); | ||
const _hoisted_6$4 = [ | ||
_hoisted_5$5 | ||
const _hoisted_12 = /* @__PURE__ */ createElementVNode("path", { d: "M8 2a1 1 0 000 2h2a1 1 0 100-2H8z" }, null, -1); | ||
const _hoisted_13 = /* @__PURE__ */ createElementVNode("path", { d: "M3 5a2 2 0 012-2 3 3 0 003 3h2a3 3 0 003-3 2 2 0 012 2v6h-4.586l1.293-1.293a1 1 0 00-1.414-1.414l-3 3a1 1 0 000 1.414l3 3a1 1 0 001.414-1.414L10.414 13H15v3a2 2 0 01-2 2H5a2 2 0 01-2-2V5zM15 11h2a1 1 0 110 2h-2v-2z" }, null, -1); | ||
const _hoisted_14 = [ | ||
_hoisted_12, | ||
_hoisted_13 | ||
]; | ||
function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) { | ||
const _component_b_icon = resolveComponent("b-icon"); | ||
return openBlock(), createElementBlock("div", _hoisted_1$6, [ | ||
$props.data ? (openBlock(), createElementBlock("small", _hoisted_2$5, [ | ||
!$data.playing ? (openBlock(), createElementBlock("span", { | ||
key: 0, | ||
class: "pointer", | ||
onClick: _cache[0] || (_cache[0] = (...args) => $options.play && $options.play(...args)) | ||
}, [ | ||
createVNode(_component_b_icon, { icon: "volume-up" }) | ||
const _hoisted_15 = { key: 0 }; | ||
const _hoisted_16 = /* @__PURE__ */ createElementVNode("span", { class: "float-right text-xs" }, "Powered by Google Translate", -1); | ||
const _hoisted_17 = [ | ||
_hoisted_16 | ||
]; | ||
function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) { | ||
return openBlock(), createElementBlock("div", null, [ | ||
createElementVNode("div", _hoisted_1$6, [ | ||
$props.data ? (openBlock(), createElementBlock("div", _hoisted_2$6, [ | ||
!$data.playing ? (openBlock(), createElementBlock("span", { | ||
key: 0, | ||
class: "pointer", | ||
onClick: _cache[0] || (_cache[0] = (...args) => $options.play && $options.play(...args)) | ||
}, _hoisted_4$6)) : createCommentVNode("", true), | ||
$data.playing ? (openBlock(), createElementBlock("span", { | ||
key: 1, | ||
class: "pointer", | ||
onClick: _cache[1] || (_cache[1] = (...args) => $options.stop && $options.stop(...args)) | ||
}, _hoisted_6$4)) : createCommentVNode("", true), | ||
$props.data.ddictTarget ? (openBlock(), createElementBlock("span", _hoisted_7$3, toDisplayString($props.data.ddictTarget), 1)) : createCommentVNode("", true) | ||
])) : createCommentVNode("", true), | ||
$data.playing ? (openBlock(), createElementBlock("span", { | ||
$props.data != "" ? (openBlock(), createElementBlock("div", { | ||
key: 1, | ||
class: "pointer", | ||
onClick: _cache[1] || (_cache[1] = (...args) => $options.stop && $options.stop(...args)) | ||
onClick: _cache[2] || (_cache[2] = (...args) => $options.copy && $options.copy(...args)), | ||
class: "indicator-item m-3" | ||
}, [ | ||
createVNode(_component_b_icon, { icon: "volume-off" }) | ||
!$data.copied ? (openBlock(), createElementBlock("svg", _hoisted_8, _hoisted_10)) : createCommentVNode("", true), | ||
$data.copied ? (openBlock(), createElementBlock("svg", _hoisted_11, _hoisted_14)) : createCommentVNode("", true) | ||
])) : createCommentVNode("", true), | ||
$props.data.ddictTarget ? (openBlock(), createElementBlock("span", _hoisted_3$5, toDisplayString($props.data.ddictTarget), 1)) : createCommentVNode("", true) | ||
])) : createCommentVNode("", true), | ||
createElementVNode("textarea", { | ||
ref: "input", | ||
class: "form-control textarea-src-target", | ||
style: normalizeStyle({ "text-align": $options.rtl ? "right" : "left" }), | ||
readonly: "", | ||
spellcheck: "false" | ||
}, null, 4), | ||
$props.data ? (openBlock(), createElementBlock("p", _hoisted_4$5, _hoisted_6$4)) : createCommentVNode("", true) | ||
createElementVNode("textarea", { | ||
ref: "input", | ||
class: "text-lg textarea textarea-bordered w-full pt-5", | ||
style: normalizeStyle({ "text-align": $options.rtl ? "right" : "left" }), | ||
readonly: "", | ||
spellcheck: "false" | ||
}, null, 4) | ||
]), | ||
$props.data ? (openBlock(), createElementBlock("p", _hoisted_15, _hoisted_17)) : createCommentVNode("", true) | ||
]); | ||
} | ||
var result = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$6]]); | ||
var Result = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$5]]); | ||
const _sfc_main$5 = { | ||
@@ -505,36 +703,36 @@ props: { | ||
}; | ||
const _hoisted_1$5 = { | ||
key: 0, | ||
class: "card border-success text-success section" | ||
}; | ||
const _hoisted_2$4 = { class: "card-header" }; | ||
const _hoisted_3$4 = { class: "list-group list-group-flush" }; | ||
const _hoisted_4$4 = { class: "card-title text-muted title" }; | ||
const _hoisted_5$4 = /* @__PURE__ */ createElementVNode("br", null, null, -1); | ||
const _hoisted_6$3 = { class: "text-muted" }; | ||
function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) { | ||
return $props.data && $props.data.definitions ? (openBlock(), createElementBlock("div", _hoisted_1$5, [ | ||
createElementVNode("div", _hoisted_2$4, toDisplayString($data.name), 1), | ||
createElementVNode("ul", _hoisted_3$4, [ | ||
(openBlock(true), createElementBlock(Fragment, null, renderList($props.data.definitions, (dict, index) => { | ||
return openBlock(), createElementBlock("li", { | ||
key: `${dict.pos}-${index}`, | ||
class: "list-group-item" | ||
}, [ | ||
createElementVNode("h5", _hoisted_4$4, toDisplayString(dict.pos), 1), | ||
(openBlock(true), createElementBlock(Fragment, null, renderList(dict.entry, (entry, index2) => { | ||
return openBlock(), createElementBlock("div", { | ||
key: `${entry.definition_id}-${index2}` | ||
}, [ | ||
createElementVNode("span", null, toDisplayString(entry.gloss), 1), | ||
_hoisted_5$4, | ||
createElementVNode("small", _hoisted_6$3, toDisplayString(entry.example), 1) | ||
]); | ||
}), 128)) | ||
]); | ||
}), 128)) | ||
const _hoisted_1$5 = { key: 0 }; | ||
const _hoisted_2$5 = { class: "card-body" }; | ||
const _hoisted_3$5 = { class: "card-title font-bold" }; | ||
const _hoisted_4$5 = { class: "list-group list-group-flush" }; | ||
const _hoisted_5$4 = { class: "capitalize font-bold" }; | ||
const _hoisted_6$3 = /* @__PURE__ */ createElementVNode("br", null, null, -1); | ||
const _hoisted_7$2 = { class: "italic" }; | ||
function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) { | ||
return $props.data.definitions ? (openBlock(), createElementBlock("div", _hoisted_1$5, [ | ||
createElementVNode("div", _hoisted_2$5, [ | ||
createElementVNode("h2", _hoisted_3$5, toDisplayString($data.name), 1), | ||
createElementVNode("ul", _hoisted_4$5, [ | ||
(openBlock(true), createElementBlock(Fragment, null, renderList($props.data.definitions, (dict, index) => { | ||
return openBlock(), createElementBlock("li", { | ||
key: `${dict.pos}-${index}`, | ||
class: "list-group-item mb-2" | ||
}, [ | ||
createElementVNode("h5", _hoisted_5$4, toDisplayString(dict.pos), 1), | ||
(openBlock(true), createElementBlock(Fragment, null, renderList(dict.entry, (entry, index2) => { | ||
return openBlock(), createElementBlock("div", { | ||
key: `${entry.definition_id}-${index2}` | ||
}, [ | ||
createElementVNode("span", null, toDisplayString(entry.gloss), 1), | ||
_hoisted_6$3, | ||
createElementVNode("small", _hoisted_7$2, toDisplayString(entry.example), 1) | ||
]); | ||
}), 128)) | ||
]); | ||
}), 128)) | ||
]) | ||
]) | ||
])) : createCommentVNode("", true); | ||
} | ||
var dictSrc = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$5]]); | ||
var DictSrc = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$4]]); | ||
const _sfc_main$4 = { | ||
@@ -558,38 +756,38 @@ props: { | ||
}; | ||
const _hoisted_1$4 = { | ||
key: 0, | ||
class: "card border-primary text-primary section" | ||
}; | ||
const _hoisted_2$3 = { class: "card-header" }; | ||
const _hoisted_3$3 = { class: "list-group list-group-flush" }; | ||
const _hoisted_4$3 = { class: "card-title text-muted title" }; | ||
const _hoisted_5$3 = ["onClick"]; | ||
const _hoisted_6$2 = { class: "text-muted" }; | ||
function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) { | ||
return $props.data && $props.data.dict ? (openBlock(), createElementBlock("div", _hoisted_1$4, [ | ||
createElementVNode("div", _hoisted_2$3, toDisplayString($data.name), 1), | ||
createElementVNode("ul", _hoisted_3$3, [ | ||
(openBlock(true), createElementBlock(Fragment, null, renderList($props.data.dict, (dict, index) => { | ||
return openBlock(), createElementBlock("li", { | ||
key: `${dict.pos}-${index}`, | ||
class: "list-group-item" | ||
}, [ | ||
createElementVNode("h5", _hoisted_4$3, toDisplayString(dict.pos), 1), | ||
(openBlock(true), createElementBlock(Fragment, null, renderList(dict.entry, (entry, index2) => { | ||
return openBlock(), createElementBlock("div", { | ||
key: `${entry.word}-${index2}` | ||
}, [ | ||
createElementVNode("span", { | ||
class: "badge bg-primary", | ||
onClick: ($event) => $options.translate(entry.word) | ||
}, toDisplayString(entry.word), 9, _hoisted_5$3), | ||
createElementVNode("small", _hoisted_6$2, " \u2015 " + toDisplayString(entry.reverse_translation.join(", ")), 1) | ||
]); | ||
}), 128)) | ||
]); | ||
}), 128)) | ||
const _hoisted_1$4 = { key: 0 }; | ||
const _hoisted_2$4 = { class: "card-body" }; | ||
const _hoisted_3$4 = { class: "card-title" }; | ||
const _hoisted_4$4 = { class: "list-group list-group-flush" }; | ||
const _hoisted_5$3 = { class: "capitalize font-bold" }; | ||
const _hoisted_6$2 = ["onClick"]; | ||
const _hoisted_7$1 = { class: "italic" }; | ||
function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) { | ||
return $props.data.dict ? (openBlock(), createElementBlock("div", _hoisted_1$4, [ | ||
createElementVNode("div", _hoisted_2$4, [ | ||
createElementVNode("h2", _hoisted_3$4, toDisplayString($data.name), 1), | ||
createElementVNode("ul", _hoisted_4$4, [ | ||
(openBlock(true), createElementBlock(Fragment, null, renderList($props.data.dict, (dict, index) => { | ||
return openBlock(), createElementBlock("li", { | ||
key: `${dict.pos}-${index}`, | ||
class: "list-group-item" | ||
}, [ | ||
createElementVNode("h5", _hoisted_5$3, toDisplayString(dict.pos), 1), | ||
(openBlock(true), createElementBlock(Fragment, null, renderList(dict.entry, (entry, index2) => { | ||
return openBlock(), createElementBlock("div", { | ||
key: `${entry.word}-${index2}` | ||
}, [ | ||
createElementVNode("span", { | ||
class: "badge bg-neutral", | ||
onClick: ($event) => $options.translate(entry.word) | ||
}, toDisplayString(entry.word), 9, _hoisted_6$2), | ||
createElementVNode("small", _hoisted_7$1, " \u2015 " + toDisplayString(entry.reverse_translation.join(", ")), 1) | ||
]); | ||
}), 128)) | ||
]); | ||
}), 128)) | ||
]) | ||
]) | ||
])) : createCommentVNode("", true); | ||
} | ||
var dictTarget = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$4]]); | ||
var DictTarget = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$3]]); | ||
const _sfc_main$3 = { | ||
@@ -604,62 +802,28 @@ props: { | ||
return { | ||
name: "Examples", | ||
more: false | ||
name: "Examples" | ||
}; | ||
} | ||
}; | ||
const _hoisted_1$3 = { | ||
key: 0, | ||
class: "card border-dark text-dark section" | ||
}; | ||
const _hoisted_2$2 = { class: "card-header" }; | ||
const _hoisted_3$2 = { class: "list-group list-group-flush" }; | ||
const _hoisted_4$2 = ["innerHTML"]; | ||
const _hoisted_5$2 = { | ||
key: 0, | ||
class: "list-group list-group-flush" | ||
}; | ||
const _hoisted_6$1 = ["innerHTML"]; | ||
function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) { | ||
const _component_b_icon = resolveComponent("b-icon"); | ||
return $props.data && $props.data.examples ? (openBlock(), createElementBlock("div", _hoisted_1$3, [ | ||
createElementVNode("div", _hoisted_2$2, [ | ||
createTextVNode(toDisplayString($data.name) + " ", 1), | ||
$props.data.examples.example.length > 1 && !$data.more ? (openBlock(), createElementBlock("span", { | ||
key: 0, | ||
style: { "float": "right" }, | ||
onClick: _cache[0] || (_cache[0] = ($event) => $data.more = true) | ||
}, [ | ||
createVNode(_component_b_icon, { icon: "arrows-expand" }) | ||
])) : createCommentVNode("", true), | ||
$props.data.examples.example.length > 1 && $data.more ? (openBlock(), createElementBlock("span", { | ||
key: 1, | ||
style: { "float": "right" }, | ||
onClick: _cache[1] || (_cache[1] = ($event) => $data.more = false) | ||
}, [ | ||
createVNode(_component_b_icon, { icon: "arrows-collapse" }) | ||
])) : createCommentVNode("", true) | ||
]), | ||
createElementVNode("ul", _hoisted_3$2, [ | ||
createElementVNode("li", { | ||
class: "list-group-item", | ||
innerHTML: $props.data.examples.example[0].text | ||
}, null, 8, _hoisted_4$2) | ||
]), | ||
createVNode(Transition, { name: "fade" }, { | ||
default: withCtx(() => [ | ||
$data.more ? (openBlock(), createElementBlock("ul", _hoisted_5$2, [ | ||
(openBlock(true), createElementBlock(Fragment, null, renderList($props.data.examples.example.slice(1), (example2, index) => { | ||
return openBlock(), createElementBlock("li", { | ||
key: `${example2.definition_id}-${index}`, | ||
class: "list-group-item", | ||
innerHTML: example2.text | ||
}, null, 8, _hoisted_6$1); | ||
}), 128)) | ||
])) : createCommentVNode("", true) | ||
]), | ||
_: 1 | ||
}) | ||
const _hoisted_1$3 = { key: 0 }; | ||
const _hoisted_2$3 = { class: "card-body" }; | ||
const _hoisted_3$3 = { class: "card-title font-bold" }; | ||
const _hoisted_4$3 = { class: "list-disc" }; | ||
const _hoisted_5$2 = ["innerHTML"]; | ||
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) { | ||
return $props.data.examples ? (openBlock(), createElementBlock("div", _hoisted_1$3, [ | ||
createElementVNode("div", _hoisted_2$3, [ | ||
createElementVNode("h2", _hoisted_3$3, toDisplayString($data.name), 1), | ||
createElementVNode("ul", _hoisted_4$3, [ | ||
(openBlock(true), createElementBlock(Fragment, null, renderList($props.data.examples.example.slice(1), (example, index) => { | ||
return openBlock(), createElementBlock("li", { | ||
key: `${example.definition_id}-${index}`, | ||
class: "mt-2 ml-2", | ||
innerHTML: example.text | ||
}, null, 8, _hoisted_5$2); | ||
}), 128)) | ||
]) | ||
]) | ||
])) : createCommentVNode("", true); | ||
} | ||
var example = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$3]]); | ||
var Example = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$2]]); | ||
const _sfc_main$2 = { | ||
@@ -678,44 +842,44 @@ props: { | ||
}; | ||
const _hoisted_1$2 = { | ||
key: 0, | ||
class: "card border-info text-info section" | ||
}; | ||
const _hoisted_2$1 = { class: "card-header" }; | ||
const _hoisted_3$1 = { class: "list-group list-group-flush" }; | ||
const _hoisted_4$1 = { class: "card-title text-muted title" }; | ||
const _hoisted_5$1 = ["onClick"]; | ||
const _hoisted_6 = /* @__PURE__ */ createElementVNode("span", null, null, -1); | ||
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) { | ||
return $props.data && $props.data.synsets ? (openBlock(), createElementBlock("div", _hoisted_1$2, [ | ||
createElementVNode("div", _hoisted_2$1, toDisplayString($data.name), 1), | ||
createElementVNode("ul", _hoisted_3$1, [ | ||
(openBlock(true), createElementBlock(Fragment, null, renderList($props.data.synsets, (dict, index) => { | ||
return openBlock(), createElementBlock("li", { | ||
key: `${dict.pos}-${index}`, | ||
class: "list-group-item" | ||
}, [ | ||
createElementVNode("h5", _hoisted_4$1, toDisplayString(dict.pos), 1), | ||
(openBlock(true), createElementBlock(Fragment, null, renderList(dict.entry, (entry, index2) => { | ||
return openBlock(), createElementBlock("div", { | ||
key: `${entry.definition_id}-${index2}` | ||
}, [ | ||
(openBlock(true), createElementBlock(Fragment, null, renderList(entry.synonym, (synonym, index3) => { | ||
return openBlock(), createElementBlock("span", { | ||
key: `${synonym}-${index3}` | ||
}, [ | ||
createElementVNode("span", { | ||
class: "badge bg-info clickable-badge", | ||
onClick: ($event) => _ctx.$emit("translate", synonym) | ||
}, toDisplayString(synonym), 9, _hoisted_5$1), | ||
_hoisted_6 | ||
]); | ||
}), 128)) | ||
]); | ||
}), 128)) | ||
]); | ||
}), 128)) | ||
const _hoisted_1$2 = { key: 0 }; | ||
const _hoisted_2$2 = { class: "card-body" }; | ||
const _hoisted_3$2 = { class: "card-title font-bold" }; | ||
const _hoisted_4$2 = { class: "list-group list-group-flush" }; | ||
const _hoisted_5$1 = { class: "capitalize font-bold" }; | ||
const _hoisted_6$1 = ["onClick"]; | ||
const _hoisted_7 = /* @__PURE__ */ createElementVNode("span", null, null, -1); | ||
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) { | ||
return $props.data.synsets ? (openBlock(), createElementBlock("div", _hoisted_1$2, [ | ||
createElementVNode("div", _hoisted_2$2, [ | ||
createElementVNode("h2", _hoisted_3$2, toDisplayString($data.name), 1), | ||
createElementVNode("ul", _hoisted_4$2, [ | ||
(openBlock(true), createElementBlock(Fragment, null, renderList($props.data.synsets, (dict, index) => { | ||
return openBlock(), createElementBlock("li", { | ||
key: `${dict.pos}-${index}`, | ||
class: "list-group-item" | ||
}, [ | ||
createElementVNode("h5", _hoisted_5$1, toDisplayString(dict.pos), 1), | ||
(openBlock(true), createElementBlock(Fragment, null, renderList(dict.entry, (entry, index2) => { | ||
return openBlock(), createElementBlock("div", { | ||
key: `${entry.definition_id}-${index2}` | ||
}, [ | ||
(openBlock(true), createElementBlock(Fragment, null, renderList(entry.synonym, (synonym, index3) => { | ||
return openBlock(), createElementBlock("span", { | ||
key: `${synonym}-${index3}` | ||
}, [ | ||
createElementVNode("span", { | ||
class: "badge bg-neutral ml-1", | ||
onClick: ($event) => _ctx.$emit("translate", synonym) | ||
}, toDisplayString(synonym), 9, _hoisted_6$1), | ||
_hoisted_7 | ||
]); | ||
}), 128)) | ||
]); | ||
}), 128)) | ||
]); | ||
}), 128)) | ||
]) | ||
]) | ||
])) : createCommentVNode("", true); | ||
} | ||
var syno = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2]]); | ||
var Syno = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$1]]); | ||
const _sfc_main$1 = { | ||
@@ -734,41 +898,35 @@ props: { | ||
}; | ||
const _hoisted_1$1 = { | ||
key: 0, | ||
class: "card border-secondary text-secondary section" | ||
}; | ||
const _hoisted_2 = { class: "card-header" }; | ||
const _hoisted_3 = { class: "card-body" }; | ||
const _hoisted_4 = ["onClick"]; | ||
const _hoisted_5 = /* @__PURE__ */ createElementVNode("span", null, null, -1); | ||
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) { | ||
return $props.data && $props.data.related_words && $props.data.related_words.word ? (openBlock(), createElementBlock("div", _hoisted_1$1, [ | ||
createElementVNode("div", _hoisted_2, toDisplayString($data.name), 1), | ||
createElementVNode("div", _hoisted_3, [ | ||
(openBlock(true), createElementBlock(Fragment, null, renderList($props.data.related_words.word, (word, index) => { | ||
return openBlock(), createElementBlock("span", { | ||
key: `${word}-${index}` | ||
}, [ | ||
createElementVNode("span", { | ||
class: "badge bg-secondary clickable-badge", | ||
onClick: ($event) => _ctx.$emit("translate", word) | ||
}, toDisplayString(word), 9, _hoisted_4), | ||
_hoisted_5 | ||
]); | ||
}), 128)) | ||
const _hoisted_1$1 = { key: 0 }; | ||
const _hoisted_2$1 = { class: "card-body" }; | ||
const _hoisted_3$1 = { class: "card-title font-bold" }; | ||
const _hoisted_4$1 = { class: "card-body" }; | ||
const _hoisted_5 = ["onClick"]; | ||
const _hoisted_6 = /* @__PURE__ */ createElementVNode("span", null, null, -1); | ||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { | ||
return $props.data.related_words && $props.data.related_words.word ? (openBlock(), createElementBlock("div", _hoisted_1$1, [ | ||
createElementVNode("div", _hoisted_2$1, [ | ||
createElementVNode("h2", _hoisted_3$1, toDisplayString($data.name), 1), | ||
createElementVNode("div", _hoisted_4$1, [ | ||
(openBlock(true), createElementBlock(Fragment, null, renderList($props.data.related_words.word, (word, index) => { | ||
return openBlock(), createElementBlock("span", { | ||
key: `${word}-${index}` | ||
}, [ | ||
createElementVNode("span", { | ||
class: "badge bg-neutral", | ||
onClick: ($event) => _ctx.$emit("translate", word) | ||
}, toDisplayString(word), 9, _hoisted_5), | ||
_hoisted_6 | ||
]); | ||
}), 128)) | ||
]) | ||
]) | ||
])) : createCommentVNode("", true); | ||
} | ||
var more = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1]]); | ||
const _sfc_main = { | ||
var More = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render]]); | ||
const _hoisted_1 = { class: "p-1" }; | ||
const _hoisted_2 = { class: "mt-3 grid grid-cols-1 md:grid-cols-2" }; | ||
const _hoisted_3 = { class: "w-full pr-1" }; | ||
const _hoisted_4 = { class: "w-full pl-1" }; | ||
const __default__ = { | ||
name: "Popup", | ||
components: { | ||
appSelects: selects, | ||
appInput: input, | ||
appResult: result, | ||
appDictSrc: dictSrc, | ||
appDictTarget: dictTarget, | ||
appExample: example, | ||
appSyno: syno, | ||
appMore: more | ||
}, | ||
props: { | ||
@@ -821,9 +979,9 @@ export_data: { | ||
}, | ||
translateReplace(input2) { | ||
return this.translate(input2, true); | ||
translateReplace(input) { | ||
return this.translate(input, true); | ||
}, | ||
translateSwap(input2) { | ||
return this.translate(input2, true, true); | ||
translateSwap(input) { | ||
return this.translate(input, true, true); | ||
}, | ||
translate(input2, is_replace, is_swap) { | ||
translate(input, is_replace, is_swap) { | ||
if (is_swap) { | ||
@@ -841,11 +999,11 @@ if (!this.data.src || this.data.src === "auto" || !this.data.target) { | ||
if (is_replace) { | ||
this.replace = input2; | ||
this.replace = input; | ||
} | ||
this.$emit("translate", input2); | ||
this.$emit("translate", input); | ||
}, | ||
srctarget(select) { | ||
onSelect(select) { | ||
this.$emit("srctarget", select); | ||
if (this.data) { | ||
const input2 = this.data.sentences.map((sentence) => sentence.orig).join(""); | ||
this.$emit("translate", input2); | ||
const input = this.data.sentences.map((sentence) => sentence.orig).join(""); | ||
this.$emit("translate", input); | ||
} | ||
@@ -855,52 +1013,66 @@ } | ||
}; | ||
const _hoisted_1 = { class: "row section" }; | ||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { | ||
const _component_app_selects = resolveComponent("app-selects"); | ||
const _component_app_input = resolveComponent("app-input"); | ||
const _component_app_result = resolveComponent("app-result"); | ||
const _component_app_dict_target = resolveComponent("app-dict-target"); | ||
const _component_app_dict_src = resolveComponent("app-dict-src"); | ||
const _component_app_syno = resolveComponent("app-syno"); | ||
const _component_app_more = resolveComponent("app-more"); | ||
const _component_app_example = resolveComponent("app-example"); | ||
return openBlock(), createElementBlock("div", null, [ | ||
createVNode(_component_app_selects, { | ||
select: $data.select, | ||
onSrctarget: $options.srctarget | ||
}, null, 8, ["select", "onSrctarget"]), | ||
createElementVNode("div", _hoisted_1, [ | ||
createVNode(_component_app_input, { | ||
data: $data.data, | ||
tts: $data.tts, | ||
replace: $data.replace, | ||
onTranslate: $options.translate, | ||
onClear: $options.clear | ||
}, null, 8, ["data", "tts", "replace", "onTranslate", "onClear"]), | ||
createVNode(_component_app_result, { | ||
data: $data.data, | ||
tts: $data.tts | ||
}, null, 8, ["data", "tts"]) | ||
]), | ||
createElementVNode("div", { | ||
class: "card-columns", | ||
style: normalizeStyle({ "text-align": $options.rtl ? "right" : "left" }) | ||
}, [ | ||
createVNode(_component_app_dict_target, { | ||
data: $data.data, | ||
onTranslate: $options.translateSwap | ||
}, null, 8, ["data", "onTranslate"]), | ||
createVNode(_component_app_dict_src, { data: $data.data }, null, 8, ["data"]), | ||
createVNode(_component_app_syno, { | ||
data: $data.data, | ||
onTranslate: $options.translateReplace | ||
}, null, 8, ["data", "onTranslate"]), | ||
createVNode(_component_app_more, { | ||
data: $data.data, | ||
onTranslate: $options.translateReplace | ||
}, null, 8, ["data", "onTranslate"]), | ||
createVNode(_component_app_example, { data: $data.data }, null, 8, ["data"]) | ||
], 4) | ||
]); | ||
} | ||
var Popup = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]); | ||
export { Popup as default }; | ||
const _sfc_main = /* @__PURE__ */ Object.assign(__default__, { | ||
setup(__props) { | ||
return (_ctx, _cache) => { | ||
return openBlock(), createElementBlock("div", _hoisted_1, [ | ||
createVNode(Selects, { | ||
select: _ctx.select, | ||
onSelect: _ctx.onSelect | ||
}, null, 8, ["select", "onSelect"]), | ||
createElementVNode("div", _hoisted_2, [ | ||
createElementVNode("div", _hoisted_3, [ | ||
createVNode(Input, { | ||
data: _ctx.data, | ||
tts: _ctx.tts, | ||
replace: _ctx.replace, | ||
onTranslate: _ctx.translate, | ||
onClear: _ctx.clear | ||
}, null, 8, ["data", "tts", "replace", "onTranslate", "onClear"]) | ||
]), | ||
createElementVNode("div", _hoisted_4, [ | ||
createVNode(Result, { | ||
data: _ctx.data, | ||
tts: _ctx.tts | ||
}, null, 8, ["data", "tts"]) | ||
]) | ||
]), | ||
_ctx.data ? (openBlock(), createElementBlock("div", { | ||
key: 0, | ||
class: "mt-3 grid grid-cols-1 md:grid-cols-3 gap-3", | ||
style: normalizeStyle({ "text-align": _ctx.rtl ? "right" : "left" }) | ||
}, [ | ||
createVNode(DictSrc, { | ||
class: "card border", | ||
data: _ctx.data | ||
}, null, 8, ["data"]), | ||
createVNode(DictTarget, { | ||
class: "card border", | ||
data: _ctx.data, | ||
onTranslate: _ctx.translateSwap | ||
}, null, 8, ["data", "onTranslate"]), | ||
createVNode(Syno, { | ||
class: "card border", | ||
data: _ctx.data, | ||
onTranslate: _ctx.translateReplace | ||
}, null, 8, ["data", "onTranslate"]), | ||
createVNode(More, { | ||
class: "card border", | ||
data: _ctx.data, | ||
onTranslate: _ctx.translateReplace | ||
}, null, 8, ["data", "onTranslate"]) | ||
], 4)) : createCommentVNode("", true), | ||
_ctx.data ? (openBlock(), createElementBlock("div", { | ||
key: 1, | ||
class: "mt-5 grid grid-cols-1 gap-6", | ||
style: normalizeStyle({ "text-align": _ctx.rtl ? "right" : "left" }) | ||
}, [ | ||
createVNode(Example, { | ||
class: "card border", | ||
data: _ctx.data | ||
}, null, 8, ["data"]) | ||
], 4)) : createCommentVNode("", true) | ||
]); | ||
}; | ||
} | ||
}); | ||
export { _sfc_main as default }; |
@@ -1,2 +0,1 @@ | ||
(function(p,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(p=typeof globalThis!="undefined"?globalThis:p||self,t(p.Popup={},p.Vue))})(this,function(p,t){"use strict";var Qt="",d=(e,s)=>{const a=e.__vccOpts||e;for(const[i,n]of s)a[i]=n;return a};const x={props:{select:{type:Object,default:null}},data(){return{src:"",target:"",warning:!1}},watch:{select(){this.src=this.select.src,this.target=this.select.target}},methods:{warn(){this.warning=!0,setTimeout(()=>{this.warning=!1},2e3)},swap(){if(!this.select.srcs.hasOwnProperty(this.target)||!this.select.targets.hasOwnProperty(this.src)){this.warn();return}const e=this.target;this.target=this.src,this.src=e,this.srctarget()},srctarget(){const e=JSON.parse(JSON.stringify(this.select));e.src=this.src,e.target=this.target,this.$emit("srctarget",e)}}},V={key:0,class:"row justify-content-center mb-2"},C={class:"col-5"},T=["value"],$={class:"col-auto text-center"},b={id:"swap",class:"form-control bg-light pointer"},S={class:"col-5"},w=["value"];function L(e,s,a,i,n,l){const o=t.resolveComponent("b-icon");return a.select?(t.openBlock(),t.createElementBlock("div",V,[t.createElementVNode("div",C,[t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":s[0]||(s[0]=r=>n.src=r),class:"form-select",onChange:s[1]||(s[1]=(...r)=>l.srctarget&&l.srctarget(...r))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.select.srcs,(r,c)=>(t.openBlock(),t.createElementBlock("option",{value:c,key:c},t.toDisplayString(r),9,T))),128))],544),[[t.vModelSelect,n.src]])]),t.createElementVNode("div",$,[t.createElementVNode("span",b,[n.src!="auto"?(t.openBlock(),t.createBlock(o,{key:0,icon:"arrow-left-right",onClick:l.swap},null,8,["onClick"])):t.createCommentVNode("",!0),n.src=="auto"?(t.openBlock(),t.createBlock(o,{key:1,icon:"arrow-right"})):t.createCommentVNode("",!0)])]),t.createElementVNode("div",S,[t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":s[2]||(s[2]=r=>n.target=r),class:"form-select",onChange:s[3]||(s[3]=(...r)=>l.srctarget&&l.srctarget(...r))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.select.targets,(r,c)=>(t.openBlock(),t.createElementBlock("option",{value:c,key:c},t.toDisplayString(r),9,w))),128))],544),[[t.vModelSelect,n.target]])])])):t.createCommentVNode("",!0)}var D=d(x,[["render",L]]),k={INPUT_MAX_LENGTH:5e3,INPUT_DELAY:1e3},m={init:O,autoResize:j};const g=100,E=600,I=10;function O(e,s){s&&(e.maxlength=s),e.spellcheck=!1,f(e,g)}function j(e){if(e.value==""){f(e,g);return}if(e.scrollHeight<g){f(e,g);return}if(e.scrollHeight>E){f(e,E);return}e.style.height.replace("px","")>e.scrollHeight||f(e,e.scrollHeight+I)}function f(e,s){e.style.height=`${s}px`}var y={isRTL:H};function H(e){return["ar","fa","iw","yi","ur","pa"].indexOf(e)>-1}const B="auto_translate",M={props:{data:{type:Object,default:null},tts:{type:Object,default:null},replace:{type:String,default:""}},data(){return{input:"",INPUT_MAX_LENGTH:k.INPUT_MAX_LENGTH,input_timeout:null,player:new Audio,playing:!1,ttsIndex:0,auto_translate:!0,firstTime:!0}},computed:{rtl(){return this.data?y.isRTL(this.data.src):!1}},watch:{replace(e){this.input=e,(this.firstTime||!this.auto_translate)&&setTimeout(()=>{this.$refs.input.select()},100),this.firstTime=!1},tts(){this.ttsIndex=0},auto_translate(e){e&&this.translate(),localStorage.setItem(B,e)}},mounted(){m.init(this.$refs.input,k.INPUT_MAX_LENGTH),this.player.addEventListener("ended",()=>{if(this.ttsIndex++,this.ttsIndex>=this.tts.src.length){this.stop();return}this.play()}),this.$refs.input.addEventListener("input",()=>{m.autoResize(this.$refs.input),!!this.auto_translate&&(clearTimeout(this.input_timeout),this.input_timeout=setTimeout(this.translate,k.INPUT_DELAY))}),this.$refs.input.addEventListener("keyup",e=>{this.auto_translate||e&&e.keyCode===13&&this.translate()})},created(){localStorage.getItem(B)==="false"&&(this.auto_translate=!1)},methods:{play(){!this.tts.src||(this.player.src=this.tts.src[this.ttsIndex],this.playing=!0,this.player.play().catch(()=>{this.playing=!1}))},stop(){this.playing=!1,this.ttsIndex=0,this.player.pause()},clear(){this.$emit("clear"),this.input="",m.init(this.$refs.input,k.INPUT_MAX_LENGTH),this.$refs.input.focus()},translate(){if(!this.input){this.clear();return}this.$emit("translate",this.input)}}},A={class:"col-sm-6 section position-relative"},P={key:0,class:"textarea-src-target-header text-truncate position-absolute top-0 start-20 truncate"},R={key:2,class:"text-muted small"},U={key:0},F={class:"small form-check form-switch text-muted textarea-footer"},G=t.createElementVNode("label",{for:"auto_translate",class:"form-check-label small"},"Auto translate",-1),z={key:0,class:"float-end"};function X(e,s,a,i,n,l){const o=t.resolveComponent("b-icon");return t.openBlock(),t.createElementBlock("div",A,[a.data?(t.openBlock(),t.createElementBlock("small",P,[n.playing?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("span",{key:0,class:"pointer",onClick:s[0]||(s[0]=(...r)=>l.play&&l.play(...r))},[t.createVNode(o,{icon:"volume-up"})])),n.playing?(t.openBlock(),t.createElementBlock("span",{key:1,class:"pointer",onClick:s[1]||(s[1]=(...r)=>l.stop&&l.stop(...r))},[t.createVNode(o,{icon:"volume-off"})])):t.createCommentVNode("",!0),a.data.ddictSrc?(t.openBlock(),t.createElementBlock("span",R,t.toDisplayString(a.data.ddictSrc),1)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.data.sentences,(r,c)=>(t.openBlock(),t.createElementBlock("span",{key:`${r.src_translit}-${c}`,class:"text-muted small"},[r.src_translit?(t.openBlock(),t.createElementBlock("span",U," \u2015 "+t.toDisplayString(r.src_translit),1)):t.createCommentVNode("",!0)]))),128))])):t.createCommentVNode("",!0),n.input!=""?(t.openBlock(),t.createElementBlock("span",{key:1,id:"clear",class:"small pointer position-absolute top-0 end-0",onClick:s[2]||(s[2]=(...r)=>l.clear&&l.clear(...r))},[t.createVNode(o,{icon:"x-circle"})])):t.createCommentVNode("",!0),t.withDirectives(t.createElementVNode("textarea",{id:"input",ref:"input","onUpdate:modelValue":s[3]||(s[3]=r=>n.input=r),class:"form-control textarea-src-target",style:t.normalizeStyle({"text-align":l.rtl?"right":"left"}),autofocus:""},` | ||
`,4),[[t.vModelText,n.input,void 0,{trim:!0}]]),t.createElementVNode("p",F,[t.withDirectives(t.createElementVNode("input",{id:"auto_translate",class:"form-check-input","onUpdate:modelValue":s[4]||(s[4]=r=>n.auto_translate=r),type:"checkbox"},null,512),[[t.vModelCheckbox,n.auto_translate]]),G,n.input!=""?(t.openBlock(),t.createElementBlock("small",z,t.toDisplayString(n.input.length)+" / "+t.toDisplayString(n.INPUT_MAX_LENGTH),1)):t.createCommentVNode("",!0)])])}var J=d(M,[["render",X]]);const Y={props:{data:{type:Object,default:null},tts:{type:Object,default:null}},data(){return{player:new Audio,playing:!1,ttsIndex:0}},computed:{rtl(){return this.data?y.isRTL(this.data.target):!1}},watch:{data(e){if(!e){this.$refs.input.value="",m.init(this.$refs.input);return}this.$refs.input.value=e.sentences.map(s=>s.trans).join(""),m.autoResize(this.$refs.input)},tts(){this.ttsIndex=0}},mounted(){m.init(this.$refs.input),m.autoResize(this.$refs.input),this.player.addEventListener("ended",()=>{if(this.ttsIndex++,this.ttsIndex>=this.tts.target.length){this.stop();return}this.play()})},methods:{play(){!this.tts.target||(this.player.src=this.tts.target[this.ttsIndex],this.playing=!0,this.player.play().catch(()=>{this.playing=!1}))},stop(){this.playing=!1,this.ttsIndex=0,this.player.pause()}}},q={class:"col-sm-6 section position-relative"},K={key:0,class:"textarea-src-target-header text-truncate position-absolute top-0 start-20 truncate"},Q={key:2,class:"text-muted small"},W={key:1,class:"small text-end text-muted textarea-footer"},Z=[t.createElementVNode("small",null,"Powered by Google Translate",-1)];function v(e,s,a,i,n,l){const o=t.resolveComponent("b-icon");return t.openBlock(),t.createElementBlock("div",q,[a.data?(t.openBlock(),t.createElementBlock("small",K,[n.playing?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("span",{key:0,class:"pointer",onClick:s[0]||(s[0]=(...r)=>l.play&&l.play(...r))},[t.createVNode(o,{icon:"volume-up"})])),n.playing?(t.openBlock(),t.createElementBlock("span",{key:1,class:"pointer",onClick:s[1]||(s[1]=(...r)=>l.stop&&l.stop(...r))},[t.createVNode(o,{icon:"volume-off"})])):t.createCommentVNode("",!0),a.data.ddictTarget?(t.openBlock(),t.createElementBlock("span",Q,t.toDisplayString(a.data.ddictTarget),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),t.createElementVNode("textarea",{ref:"input",class:"form-control textarea-src-target",style:t.normalizeStyle({"text-align":l.rtl?"right":"left"}),readonly:"",spellcheck:"false"},null,4),a.data?(t.openBlock(),t.createElementBlock("p",W,Z)):t.createCommentVNode("",!0)])}var tt=d(Y,[["render",v]]);const et={props:{data:{type:Object,default:null}},data(){return{name:"Definitions"}}},nt={key:0,class:"card border-success text-success section"},st={class:"card-header"},at={class:"list-group list-group-flush"},rt={class:"card-title text-muted title"},lt=t.createElementVNode("br",null,null,-1),ot={class:"text-muted"};function ct(e,s,a,i,n,l){return a.data&&a.data.definitions?(t.openBlock(),t.createElementBlock("div",nt,[t.createElementVNode("div",st,t.toDisplayString(n.name),1),t.createElementVNode("ul",at,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.data.definitions,(o,r)=>(t.openBlock(),t.createElementBlock("li",{key:`${o.pos}-${r}`,class:"list-group-item"},[t.createElementVNode("h5",rt,t.toDisplayString(o.pos),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.entry,(c,_)=>(t.openBlock(),t.createElementBlock("div",{key:`${c.definition_id}-${_}`},[t.createElementVNode("span",null,t.toDisplayString(c.gloss),1),lt,t.createElementVNode("small",ot,t.toDisplayString(c.example),1)]))),128))]))),128))])])):t.createCommentVNode("",!0)}var it=d(et,[["render",ct]]);const dt={props:{data:{type:Object,default:null}},data(){return{name:"Translations"}},methods:{translate(e){this.$emit("translate",e)}}},pt={key:0,class:"card border-primary text-primary section"},mt={class:"card-header"},_t={class:"list-group list-group-flush"},ht={class:"card-title text-muted title"},ft=["onClick"],kt={class:"text-muted"};function gt(e,s,a,i,n,l){return a.data&&a.data.dict?(t.openBlock(),t.createElementBlock("div",pt,[t.createElementVNode("div",mt,t.toDisplayString(n.name),1),t.createElementVNode("ul",_t,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.data.dict,(o,r)=>(t.openBlock(),t.createElementBlock("li",{key:`${o.pos}-${r}`,class:"list-group-item"},[t.createElementVNode("h5",ht,t.toDisplayString(o.pos),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.entry,(c,_)=>(t.openBlock(),t.createElementBlock("div",{key:`${c.word}-${_}`},[t.createElementVNode("span",{class:"badge bg-primary",onClick:h=>l.translate(c.word)},t.toDisplayString(c.word),9,ft),t.createElementVNode("small",kt," \u2015 "+t.toDisplayString(c.reverse_translation.join(", ")),1)]))),128))]))),128))])])):t.createCommentVNode("",!0)}var yt=d(dt,[["render",gt]]);const ut={props:{data:{type:Object,default:null}},data(){return{name:"Examples",more:!1}}},Et={key:0,class:"card border-dark text-dark section"},Bt={class:"card-header"},Nt={class:"list-group list-group-flush"},xt=["innerHTML"],Vt={key:0,class:"list-group list-group-flush"},Ct=["innerHTML"];function Tt(e,s,a,i,n,l){const o=t.resolveComponent("b-icon");return a.data&&a.data.examples?(t.openBlock(),t.createElementBlock("div",Et,[t.createElementVNode("div",Bt,[t.createTextVNode(t.toDisplayString(n.name)+" ",1),a.data.examples.example.length>1&&!n.more?(t.openBlock(),t.createElementBlock("span",{key:0,style:{float:"right"},onClick:s[0]||(s[0]=r=>n.more=!0)},[t.createVNode(o,{icon:"arrows-expand"})])):t.createCommentVNode("",!0),a.data.examples.example.length>1&&n.more?(t.openBlock(),t.createElementBlock("span",{key:1,style:{float:"right"},onClick:s[1]||(s[1]=r=>n.more=!1)},[t.createVNode(o,{icon:"arrows-collapse"})])):t.createCommentVNode("",!0)]),t.createElementVNode("ul",Nt,[t.createElementVNode("li",{class:"list-group-item",innerHTML:a.data.examples.example[0].text},null,8,xt)]),t.createVNode(t.Transition,{name:"fade"},{default:t.withCtx(()=>[n.more?(t.openBlock(),t.createElementBlock("ul",Vt,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.data.examples.example.slice(1),(r,c)=>(t.openBlock(),t.createElementBlock("li",{key:`${r.definition_id}-${c}`,class:"list-group-item",innerHTML:r.text},null,8,Ct))),128))])):t.createCommentVNode("",!0)]),_:1})])):t.createCommentVNode("",!0)}var $t=d(ut,[["render",Tt]]);const bt={props:{data:{type:Object,default:null}},data(){return{name:"Synonyms"}}},St={key:0,class:"card border-info text-info section"},wt={class:"card-header"},Lt={class:"list-group list-group-flush"},Dt={class:"card-title text-muted title"},It=["onClick"],Ot=t.createElementVNode("span",null,null,-1);function jt(e,s,a,i,n,l){return a.data&&a.data.synsets?(t.openBlock(),t.createElementBlock("div",St,[t.createElementVNode("div",wt,t.toDisplayString(n.name),1),t.createElementVNode("ul",Lt,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.data.synsets,(o,r)=>(t.openBlock(),t.createElementBlock("li",{key:`${o.pos}-${r}`,class:"list-group-item"},[t.createElementVNode("h5",Dt,t.toDisplayString(o.pos),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.entry,(c,_)=>(t.openBlock(),t.createElementBlock("div",{key:`${c.definition_id}-${_}`},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(c.synonym,(h,u)=>(t.openBlock(),t.createElementBlock("span",{key:`${h}-${u}`},[t.createElementVNode("span",{class:"badge bg-info clickable-badge",onClick:N=>e.$emit("translate",h)},t.toDisplayString(h),9,It),Ot]))),128))]))),128))]))),128))])])):t.createCommentVNode("",!0)}var Ht=d(bt,[["render",jt]]);const Mt={props:{data:{type:Object,default:null}},data(){return{name:"See also"}}},At={key:0,class:"card border-secondary text-secondary section"},Pt={class:"card-header"},Rt={class:"card-body"},Ut=["onClick"],Ft=t.createElementVNode("span",null,null,-1);function Gt(e,s,a,i,n,l){return a.data&&a.data.related_words&&a.data.related_words.word?(t.openBlock(),t.createElementBlock("div",At,[t.createElementVNode("div",Pt,t.toDisplayString(n.name),1),t.createElementVNode("div",Rt,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.data.related_words.word,(o,r)=>(t.openBlock(),t.createElementBlock("span",{key:`${o}-${r}`},[t.createElementVNode("span",{class:"badge bg-secondary clickable-badge",onClick:c=>e.$emit("translate",o)},t.toDisplayString(o),9,Ut),Ft]))),128))])])):t.createCommentVNode("",!0)}var zt=d(Mt,[["render",Gt]]);const Xt={name:"Popup",components:{appSelects:D,appInput:J,appResult:tt,appDictSrc:it,appDictTarget:yt,appExample:$t,appSyno:Ht,appMore:zt},props:{export_data:{type:Object,default:null},export_select:{type:Object,default:null},export_tts:{type:Object,default:null}},data(){return{data:null,select:null,tts:null,replace:""}},computed:{rtl(){return this.data?y.isRTL(this.data.target):!1}},watch:{export_data(e){this.data=e,e.text&&this.replace!=e.text&&(this.replace=e.text)},export_select(e){this.select=e},export_tts(e){this.tts=e}},methods:{clear(){this.data=null,this.$emit("clear")},translateReplace(e){return this.translate(e,!0)},translateSwap(e){return this.translate(e,!0,!0)},translate(e,s,a){if(a){if(!this.data.src||this.data.src==="auto"||!this.data.target)return;const i=JSON.parse(JSON.stringify(this.select));i.src=this.data.target,i.target=this.data.src,this.$emit("srctarget",i)}window.scrollTo(0,0),this.clear(),s&&(this.replace=e),this.$emit("translate",e)},srctarget(e){if(this.$emit("srctarget",e),this.data){const s=this.data.sentences.map(a=>a.orig).join("");this.$emit("translate",s)}}}},Jt={class:"row section"};function Yt(e,s,a,i,n,l){const o=t.resolveComponent("app-selects"),r=t.resolveComponent("app-input"),c=t.resolveComponent("app-result"),_=t.resolveComponent("app-dict-target"),h=t.resolveComponent("app-dict-src"),u=t.resolveComponent("app-syno"),N=t.resolveComponent("app-more"),Kt=t.resolveComponent("app-example");return t.openBlock(),t.createElementBlock("div",null,[t.createVNode(o,{select:n.select,onSrctarget:l.srctarget},null,8,["select","onSrctarget"]),t.createElementVNode("div",Jt,[t.createVNode(r,{data:n.data,tts:n.tts,replace:n.replace,onTranslate:l.translate,onClear:l.clear},null,8,["data","tts","replace","onTranslate","onClear"]),t.createVNode(c,{data:n.data,tts:n.tts},null,8,["data","tts"])]),t.createElementVNode("div",{class:"card-columns",style:t.normalizeStyle({"text-align":l.rtl?"right":"left"})},[t.createVNode(_,{data:n.data,onTranslate:l.translateSwap},null,8,["data","onTranslate"]),t.createVNode(h,{data:n.data},null,8,["data"]),t.createVNode(u,{data:n.data,onTranslate:l.translateReplace},null,8,["data","onTranslate"]),t.createVNode(N,{data:n.data,onTranslate:l.translateReplace},null,8,["data","onTranslate"]),t.createVNode(Kt,{data:n.data},null,8,["data"])],4)])}var qt=d(Xt,[["render",Yt]]);p.default=qt,Object.defineProperty(p,"__esModule",{value:!0}),p[Symbol.toStringTag]="Module"}); | ||
(function(d,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(d=typeof globalThis!="undefined"?globalThis:d||self,t(d.Popup={},d.Vue))})(this,function(d,t){"use strict";var y={isRTL:N};function N(e){return["ar","fa","iw","yi","ur","pa"].indexOf(e)>-1}var h=(e,s)=>{const l=e.__vccOpts||e;for(const[i,r]of s)l[i]=r;return l};const u={props:{select:{type:Object,default:null}},emits:["select"],data(){return{src:"",target:"",recents:{src:[],target:[]}}},watch:{select(e){!e||(this.src=e.src,this.target=e.target,this.loadRecents())}},methods:{onRecentSrc(e){this.src=e,this.onSelect()},onRecentTarget(e){this.target=e,this.onSelect()},swap(){if(this.src==="auto"||!this.select.srcs[this.target]||!this.select.targets[this.src])return;const e=this.target;this.target=this.src,this.src=e,this.onSelect()},onSelect(){const e=JSON.parse(JSON.stringify(this.select));e.src=this.src,e.target=this.target,this.$emit("select",e),this.saveRecents(this.src,this.target)},loadRecents(){const e=JSON.parse(localStorage.getItem("recents"));!e||(this.recents=e)},saveRecents(e,s){this.recents.src.includes(e)||this.recents.src.push(e),this.recents.target.includes(s)||this.recents.target.push(s),this.recents.src.length>3&&this.recents.src.shift(),this.recents.target.length>3&&this.recents.target.shift(),localStorage.setItem("recents",JSON.stringify(this.recents))}}},w={key:0,class:"flex flex-row"},V=["value"],$={key:0,xmlns:"http://www.w3.org/2000/svg",class:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},S=[t.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 7h12m0 0l-4-4m4 4l-4 4m0 6H4m0 0l4 4m-4-4l4-4"},null,-1)],x={key:1,xmlns:"http://www.w3.org/2000/svg",class:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},C=[t.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 7l5 5m0 0l-5 5m5-5H6"},null,-1)],b=["value"],T={key:1},L=["onClick"],D=["onClick"];function M(e,s,l,i,r,o){return t.openBlock(),t.createElementBlock(t.Fragment,null,[l.select?(t.openBlock(),t.createElementBlock("div",w,[t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":s[0]||(s[0]=n=>r.src=n),class:"select select-bordered grow",onChange:s[1]||(s[1]=(...n)=>o.onSelect&&o.onSelect(...n))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.select.srcs,(n,a)=>(t.openBlock(),t.createElementBlock("option",{value:a,key:a},t.toDisplayString(n),9,V))),128))],544),[[t.vModelSelect,r.src]]),t.createElementVNode("button",{class:"grow-0 ml-2 mr-2",onClick:s[2]||(s[2]=(...n)=>o.swap&&o.swap(...n))},[r.src!="auto"?(t.openBlock(),t.createElementBlock("svg",$,S)):t.createCommentVNode("",!0),r.src=="auto"?(t.openBlock(),t.createElementBlock("svg",x,C)):t.createCommentVNode("",!0)]),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":s[3]||(s[3]=n=>r.target=n),class:"select select-bordered grow",onChange:s[4]||(s[4]=(...n)=>o.onSelect&&o.onSelect(...n))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.select.targets,(n,a)=>(t.openBlock(),t.createElementBlock("option",{value:a,key:a},t.toDisplayString(n),9,b))),128))],544),[[t.vModelSelect,r.target]])])):t.createCommentVNode("",!0),l.select&&r.src&&r.target&&r.recents?(t.openBlock(),t.createElementBlock("p",T,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.recents.src,n=>(t.openBlock(),t.createElementBlock("span",{key:n,onClick:a=>o.onRecentSrc(n),class:"badge badge-sm ml-1 badge-outline"},t.toDisplayString(l.select.srcs[n]),9,L))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.recents.target,n=>(t.openBlock(),t.createElementBlock("span",{key:n,onClick:a=>o.onRecentTarget(n),class:"badge badge-sm ml-1 float-right mt-1"},t.toDisplayString(l.select.targets[n]),9,D))),128))])):t.createCommentVNode("",!0)],64)}var j=h(u,[["render",M]]),k={INPUT_MAX_LENGTH:5e3,INPUT_DELAY:1e3},m={init:H,autoResize:O};const g=100,E=600,I=10;function H(e,s){s&&(e.maxlength=s),e.spellcheck=!1,p(e,g)}function O(e){if(e.value==""){p(e,g);return}if(e.scrollHeight<g){p(e,g);return}if(e.scrollHeight>E){p(e,E);return}e.style.height.replace("px","")>e.scrollHeight||p(e,e.scrollHeight+I)}function p(e,s){e.style.height=`${s}px`}const B="auto_translate",z={props:{data:{type:Object,default:null},tts:{type:Object,default:null},replace:{type:String,default:""}},data(){return{input:"",INPUT_MAX_LENGTH:k.INPUT_MAX_LENGTH,input_timeout:null,player:new Audio,playing:!1,ttsIndex:0,auto_translate:!0,firstTime:!0}},computed:{rtl(){return this.data?y.isRTL(this.data.src):!1}},watch:{replace(e){this.input=e,(this.firstTime||!this.auto_translate)&&setTimeout(()=>{this.$refs.input.select()},100),this.firstTime=!1},tts(){this.ttsIndex=0},auto_translate(e){e&&this.translate(),localStorage.setItem(B,e)}},mounted(){m.init(this.$refs.input,k.INPUT_MAX_LENGTH),this.player.addEventListener("ended",()=>{if(this.ttsIndex++,this.ttsIndex>=this.tts.src.length){this.stop();return}this.play()}),this.$refs.input.addEventListener("input",()=>{m.autoResize(this.$refs.input),!!this.auto_translate&&(clearTimeout(this.input_timeout),this.input_timeout=setTimeout(this.translate,k.INPUT_DELAY))}),this.$refs.input.addEventListener("keyup",e=>{this.auto_translate||e&&e.keyCode===13&&this.translate()})},created(){localStorage.getItem(B)==="false"&&(this.auto_translate=!1)},methods:{play(){!this.tts.src||(this.player.src=this.tts.src[this.ttsIndex],this.playing=!0,this.player.play().catch(()=>{this.playing=!1}))},stop(){this.playing=!1,this.ttsIndex=0,this.player.pause()},clear(){this.$emit("clear"),this.input="",m.init(this.$refs.input,k.INPUT_MAX_LENGTH),this.$refs.input.focus()},translate(){if(!this.input){this.clear();return}this.$emit("translate",this.input)}}},R={class:"relative indicator w-full"},A={key:0,class:"absolute top-0 left-0 w-4/5 ml-2 text-sm truncate"},F=[t.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-4 w-4 inline",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[t.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15.536 8.464a5 5 0 010 7.072m2.828-9.9a9 9 0 010 12.728M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z"})],-1)],P=[t.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-4 w-4 inline",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[t.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}),t.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 10a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1h-4a1 1 0 01-1-1v-4z"})],-1)],U={key:2,class:"ml-1"},G={key:0},X=[t.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[t.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"})],-1)],J=t.createElementVNode("label",{for:"auto_translate",class:"text-xs ml-1"}," Auto translate ",-1),Y={key:0,class:"float-right text-xs"};function q(e,s,l,i,r,o){return t.openBlock(),t.createElementBlock("div",null,[t.createElementVNode("div",R,[l.data?(t.openBlock(),t.createElementBlock("div",A,[r.playing?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("span",{key:0,class:"pointer",onClick:s[0]||(s[0]=(...n)=>o.play&&o.play(...n))},F)),r.playing?(t.openBlock(),t.createElementBlock("span",{key:1,class:"pointer",onClick:s[1]||(s[1]=(...n)=>o.stop&&o.stop(...n))},P)):t.createCommentVNode("",!0),l.data.ddictSrc?(t.openBlock(),t.createElementBlock("span",U,t.toDisplayString(l.data.ddictSrc),1)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.data.sentences,(n,a)=>(t.openBlock(),t.createElementBlock("span",{key:`${n.src_translit}-${a}`,class:"text-muted small"},[n.src_translit?(t.openBlock(),t.createElementBlock("span",G," \u2015 "+t.toDisplayString(n.src_translit),1)):t.createCommentVNode("",!0)]))),128))])):t.createCommentVNode("",!0),r.input!=""?(t.openBlock(),t.createElementBlock("div",{key:1,onClick:s[2]||(s[2]=(...n)=>o.clear&&o.clear(...n)),class:"indicator-item m-3"},X)):t.createCommentVNode("",!0),t.withDirectives(t.createElementVNode("textarea",{id:"input",ref:"input","onUpdate:modelValue":s[3]||(s[3]=n=>r.input=n),class:"text-lg textarea textarea-bordered w-full pt-5",style:t.normalizeStyle({"text-align":o.rtl?"right":"left"}),autofocus:""},null,4),[[t.vModelText,r.input,void 0,{trim:!0}]])]),t.createElementVNode("p",null,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":s[4]||(s[4]=n=>r.auto_translate=n),id:"auto_translate",type:"checkbox",class:"toggle toggle-xs"},null,512),[[t.vModelCheckbox,r.auto_translate]]),J,r.input!=""?(t.openBlock(),t.createElementBlock("span",Y,t.toDisplayString(r.input.length)+" / "+t.toDisplayString(r.INPUT_MAX_LENGTH),1)):t.createCommentVNode("",!0)])])}var K=h(z,[["render",q]]);const Q={props:{data:{type:Object,default:null},tts:{type:Object,default:null}},data(){return{player:new Audio,playing:!1,copied:!1,ttsIndex:0}},computed:{rtl(){return this.data?y.isRTL(this.data.target):!1}},watch:{data(e){if(!e){this.$refs.input.value="",m.init(this.$refs.input);return}this.$refs.input.value=e.sentences.map(s=>s.trans).join(""),m.autoResize(this.$refs.input)},tts(){this.ttsIndex=0}},mounted(){m.init(this.$refs.input),m.autoResize(this.$refs.input),this.player.addEventListener("ended",()=>{if(this.ttsIndex++,this.ttsIndex>=this.tts.target.length){this.stop();return}this.play()})},methods:{play(){!this.tts.target||(this.player.src=this.tts.target[this.ttsIndex],this.playing=!0,this.player.play().catch(()=>{this.playing=!1}))},stop(){this.playing=!1,this.ttsIndex=0,this.player.pause()},copy(){const e=this.$refs.input.value;!e||(navigator.clipboard.writeText(e),this.copied=!0,setTimeout(()=>{this.copied=!1},500))}}},W={class:"relative indicator w-full"},Z={key:0,class:"absolute top-0 left-0 w-2/3 ml-2 text-sm truncate"},v=[t.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-4 w-4 inline",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[t.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15.536 8.464a5 5 0 010 7.072m2.828-9.9a9 9 0 010 12.728M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z"})],-1)],tt=[t.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-4 w-4 inline",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[t.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}),t.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 10a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1h-4a1 1 0 01-1-1v-4z"})],-1)],et={key:2,class:"ml-1"},st={key:0,xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},nt=[t.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3m2 4H10m0 0l3-3m-3 3l3 3"},null,-1)],lt={key:1,xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor"},rt=[t.createElementVNode("path",{d:"M8 2a1 1 0 000 2h2a1 1 0 100-2H8z"},null,-1),t.createElementVNode("path",{d:"M3 5a2 2 0 012-2 3 3 0 003 3h2a3 3 0 003-3 2 2 0 012 2v6h-4.586l1.293-1.293a1 1 0 00-1.414-1.414l-3 3a1 1 0 000 1.414l3 3a1 1 0 001.414-1.414L10.414 13H15v3a2 2 0 01-2 2H5a2 2 0 01-2-2V5zM15 11h2a1 1 0 110 2h-2v-2z"},null,-1)],ot={key:0},at=[t.createElementVNode("span",{class:"float-right text-xs"},"Powered by Google Translate",-1)];function it(e,s,l,i,r,o){return t.openBlock(),t.createElementBlock("div",null,[t.createElementVNode("div",W,[l.data?(t.openBlock(),t.createElementBlock("div",Z,[r.playing?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("span",{key:0,class:"pointer",onClick:s[0]||(s[0]=(...n)=>o.play&&o.play(...n))},v)),r.playing?(t.openBlock(),t.createElementBlock("span",{key:1,class:"pointer",onClick:s[1]||(s[1]=(...n)=>o.stop&&o.stop(...n))},tt)):t.createCommentVNode("",!0),l.data.ddictTarget?(t.openBlock(),t.createElementBlock("span",et,t.toDisplayString(l.data.ddictTarget),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),l.data!=""?(t.openBlock(),t.createElementBlock("div",{key:1,onClick:s[2]||(s[2]=(...n)=>o.copy&&o.copy(...n)),class:"indicator-item m-3"},[r.copied?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("svg",st,nt)),r.copied?(t.openBlock(),t.createElementBlock("svg",lt,rt)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),t.createElementVNode("textarea",{ref:"input",class:"text-lg textarea textarea-bordered w-full pt-5",style:t.normalizeStyle({"text-align":o.rtl?"right":"left"}),readonly:"",spellcheck:"false"},null,4)]),l.data?(t.openBlock(),t.createElementBlock("p",ot,at)):t.createCommentVNode("",!0)])}var ct=h(Q,[["render",it]]);const dt={props:{data:{type:Object,default:null}},data(){return{name:"Definitions"}}},ht={key:0},mt={class:"card-body"},pt={class:"card-title font-bold"},_t={class:"list-group list-group-flush"},kt={class:"capitalize font-bold"},gt=t.createElementVNode("br",null,null,-1),ft={class:"italic"};function yt(e,s,l,i,r,o){return l.data.definitions?(t.openBlock(),t.createElementBlock("div",ht,[t.createElementVNode("div",mt,[t.createElementVNode("h2",pt,t.toDisplayString(r.name),1),t.createElementVNode("ul",_t,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.data.definitions,(n,a)=>(t.openBlock(),t.createElementBlock("li",{key:`${n.pos}-${a}`,class:"list-group-item mb-2"},[t.createElementVNode("h5",kt,t.toDisplayString(n.pos),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.entry,(c,_)=>(t.openBlock(),t.createElementBlock("div",{key:`${c.definition_id}-${_}`},[t.createElementVNode("span",null,t.toDisplayString(c.gloss),1),gt,t.createElementVNode("small",ft,t.toDisplayString(c.example),1)]))),128))]))),128))])])])):t.createCommentVNode("",!0)}var Et=h(dt,[["render",yt]]);const Bt={props:{data:{type:Object,default:null}},data(){return{name:"Translations"}},methods:{translate(e){this.$emit("translate",e)}}},Nt={key:0},ut={class:"card-body"},wt={class:"card-title"},Vt={class:"list-group list-group-flush"},$t={class:"capitalize font-bold"},St=["onClick"],xt={class:"italic"};function Ct(e,s,l,i,r,o){return l.data.dict?(t.openBlock(),t.createElementBlock("div",Nt,[t.createElementVNode("div",ut,[t.createElementVNode("h2",wt,t.toDisplayString(r.name),1),t.createElementVNode("ul",Vt,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.data.dict,(n,a)=>(t.openBlock(),t.createElementBlock("li",{key:`${n.pos}-${a}`,class:"list-group-item"},[t.createElementVNode("h5",$t,t.toDisplayString(n.pos),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.entry,(c,_)=>(t.openBlock(),t.createElementBlock("div",{key:`${c.word}-${_}`},[t.createElementVNode("span",{class:"badge bg-neutral",onClick:f=>o.translate(c.word)},t.toDisplayString(c.word),9,St),t.createElementVNode("small",xt," \u2015 "+t.toDisplayString(c.reverse_translation.join(", ")),1)]))),128))]))),128))])])])):t.createCommentVNode("",!0)}var bt=h(Bt,[["render",Ct]]);const Tt={props:{data:{type:Object,default:null}},data(){return{name:"Examples"}}},Lt={key:0},Dt={class:"card-body"},Mt={class:"card-title font-bold"},jt={class:"list-disc"},It=["innerHTML"];function Ht(e,s,l,i,r,o){return l.data.examples?(t.openBlock(),t.createElementBlock("div",Lt,[t.createElementVNode("div",Dt,[t.createElementVNode("h2",Mt,t.toDisplayString(r.name),1),t.createElementVNode("ul",jt,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.data.examples.example.slice(1),(n,a)=>(t.openBlock(),t.createElementBlock("li",{key:`${n.definition_id}-${a}`,class:"mt-2 ml-2",innerHTML:n.text},null,8,It))),128))])])])):t.createCommentVNode("",!0)}var Ot=h(Tt,[["render",Ht]]);const zt={props:{data:{type:Object,default:null}},data(){return{name:"Synonyms"}}},Rt={key:0},At={class:"card-body"},Ft={class:"card-title font-bold"},Pt={class:"list-group list-group-flush"},Ut={class:"capitalize font-bold"},Gt=["onClick"],Xt=t.createElementVNode("span",null,null,-1);function Jt(e,s,l,i,r,o){return l.data.synsets?(t.openBlock(),t.createElementBlock("div",Rt,[t.createElementVNode("div",At,[t.createElementVNode("h2",Ft,t.toDisplayString(r.name),1),t.createElementVNode("ul",Pt,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.data.synsets,(n,a)=>(t.openBlock(),t.createElementBlock("li",{key:`${n.pos}-${a}`,class:"list-group-item"},[t.createElementVNode("h5",Ut,t.toDisplayString(n.pos),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.entry,(c,_)=>(t.openBlock(),t.createElementBlock("div",{key:`${c.definition_id}-${_}`},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(c.synonym,(f,ie)=>(t.openBlock(),t.createElementBlock("span",{key:`${f}-${ie}`},[t.createElementVNode("span",{class:"badge bg-neutral ml-1",onClick:Ne=>e.$emit("translate",f)},t.toDisplayString(f),9,Gt),Xt]))),128))]))),128))]))),128))])])])):t.createCommentVNode("",!0)}var Yt=h(zt,[["render",Jt]]);const qt={props:{data:{type:Object,default:null}},data(){return{name:"See also"}}},Kt={key:0},Qt={class:"card-body"},Wt={class:"card-title font-bold"},Zt={class:"card-body"},vt=["onClick"],te=t.createElementVNode("span",null,null,-1);function ee(e,s,l,i,r,o){return l.data.related_words&&l.data.related_words.word?(t.openBlock(),t.createElementBlock("div",Kt,[t.createElementVNode("div",Qt,[t.createElementVNode("h2",Wt,t.toDisplayString(r.name),1),t.createElementVNode("div",Zt,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.data.related_words.word,(n,a)=>(t.openBlock(),t.createElementBlock("span",{key:`${n}-${a}`},[t.createElementVNode("span",{class:"badge bg-neutral",onClick:c=>e.$emit("translate",n)},t.toDisplayString(n),9,vt),te]))),128))])])])):t.createCommentVNode("",!0)}var se=h(qt,[["render",ee]]);const ne={class:"p-1"},le={class:"mt-3 grid grid-cols-1 md:grid-cols-2"},re={class:"w-full pr-1"},oe={class:"w-full pl-1"},ae=Object.assign({name:"Popup",props:{export_data:{type:Object,default:null},export_select:{type:Object,default:null},export_tts:{type:Object,default:null}},data(){return{data:null,select:null,tts:null,replace:""}},computed:{rtl(){return this.data?y.isRTL(this.data.target):!1}},watch:{export_data(e){this.data=e,e.text&&this.replace!=e.text&&(this.replace=e.text)},export_select(e){this.select=e},export_tts(e){this.tts=e}},methods:{clear(){this.data=null,this.$emit("clear")},translateReplace(e){return this.translate(e,!0)},translateSwap(e){return this.translate(e,!0,!0)},translate(e,s,l){if(l){if(!this.data.src||this.data.src==="auto"||!this.data.target)return;const i=JSON.parse(JSON.stringify(this.select));i.src=this.data.target,i.target=this.data.src,this.$emit("srctarget",i)}window.scrollTo(0,0),this.clear(),s&&(this.replace=e),this.$emit("translate",e)},onSelect(e){if(this.$emit("srctarget",e),this.data){const s=this.data.sentences.map(l=>l.orig).join("");this.$emit("translate",s)}}}},{setup(e){return(s,l)=>(t.openBlock(),t.createElementBlock("div",ne,[t.createVNode(j,{select:s.select,onSelect:s.onSelect},null,8,["select","onSelect"]),t.createElementVNode("div",le,[t.createElementVNode("div",re,[t.createVNode(K,{data:s.data,tts:s.tts,replace:s.replace,onTranslate:s.translate,onClear:s.clear},null,8,["data","tts","replace","onTranslate","onClear"])]),t.createElementVNode("div",oe,[t.createVNode(ct,{data:s.data,tts:s.tts},null,8,["data","tts"])])]),s.data?(t.openBlock(),t.createElementBlock("div",{key:0,class:"mt-3 grid grid-cols-1 md:grid-cols-3 gap-3",style:t.normalizeStyle({"text-align":s.rtl?"right":"left"})},[t.createVNode(Et,{class:"card border",data:s.data},null,8,["data"]),t.createVNode(bt,{class:"card border",data:s.data,onTranslate:s.translateSwap},null,8,["data","onTranslate"]),t.createVNode(Yt,{class:"card border",data:s.data,onTranslate:s.translateReplace},null,8,["data","onTranslate"]),t.createVNode(se,{class:"card border",data:s.data,onTranslate:s.translateReplace},null,8,["data","onTranslate"])],4)):t.createCommentVNode("",!0),s.data?(t.openBlock(),t.createElementBlock("div",{key:1,class:"mt-5 grid grid-cols-1 gap-6",style:t.normalizeStyle({"text-align":s.rtl?"right":"left"})},[t.createVNode(Ot,{class:"card border",data:s.data},null,8,["data"])],4)):t.createCommentVNode("",!0)]))}});d.default=ae,Object.defineProperty(d,"__esModule",{value:!0}),d[Symbol.toStringTag]="Module"}); |
{ | ||
"name": "@ddict/popup", | ||
"version": "0.3.19", | ||
"files": ["dist"], | ||
"version": "1.0.0", | ||
"files": [ | ||
"dist" | ||
], | ||
"main": "./dist/popup.umd.js", | ||
@@ -15,2 +17,3 @@ "module": "./dist/popup.es.js", | ||
"dependencies": { | ||
"daisyui": "^1.25.4", | ||
"vue": "^3.2.25" | ||
@@ -20,8 +23,9 @@ }, | ||
"@vitejs/plugin-vue": "^2.0.0", | ||
"bootstrap": "^5.1.3", | ||
"bootstrap-vue-3": "^0.1.0", | ||
"autoprefixer": "^10.4.2", | ||
"eslint": "^8.6.0", | ||
"eslint-plugin-vue": "^8.2.0", | ||
"postcss": "^8.4.6", | ||
"tailwindcss": "^3.0.19", | ||
"vite": "^2.7.2" | ||
} | ||
} |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
56194
1141
2
2
7
4
+ Addeddaisyui@^1.25.4
+ Addeddaisyui@1.25.4(transitive)