hisonvue 1.0.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 (155) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +248 -0
  3. package/dist/HAccordion-CPtgQUK0.js +1 -0
  4. package/dist/HAccordion-ll-4cIAw.mjs +262 -0
  5. package/dist/HBaggie-D6omQoFh.js +1 -0
  6. package/dist/HBaggie-D_7mEiuV.mjs +283 -0
  7. package/dist/HBanner-DmcMOFqS.mjs +420 -0
  8. package/dist/HBanner-Io4SdGGs.js +1 -0
  9. package/dist/HButton-DAVuDmOQ.js +1 -0
  10. package/dist/HButton-DAriO81x.mjs +256 -0
  11. package/dist/HCalendar-DKwGatUk.js +2 -0
  12. package/dist/HCalendar-w18iIB90.mjs +3387 -0
  13. package/dist/HCaption-6CbSqRA7.js +1 -0
  14. package/dist/HCaption-DwsXHDNK.mjs +275 -0
  15. package/dist/HChart-C86JXUyW.js +1 -0
  16. package/dist/HChart-CcArHFr0.mjs +179 -0
  17. package/dist/HDrawer-DG1O42iF.mjs +439 -0
  18. package/dist/HDrawer-U5VC_okK.js +1 -0
  19. package/dist/HDropdown-Bs7AfefJ.mjs +393 -0
  20. package/dist/HDropdown-D4RAGmjE.js +1 -0
  21. package/dist/HFileset-BGuP9O4l.mjs +578 -0
  22. package/dist/HFileset-CuPR6Hwf.js +2 -0
  23. package/dist/HGap-BPAdnOQz.js +1 -0
  24. package/dist/HGap-DzGrfWVt.mjs +233 -0
  25. package/dist/HGrid-BiIhVCv_.mjs +345 -0
  26. package/dist/HGrid-C3EV_pgM.js +1 -0
  27. package/dist/HImagebox-D_DKeCrO.mjs +654 -0
  28. package/dist/HImagebox-t_UdFjQO.js +2 -0
  29. package/dist/HInput-BEyJqYkD.mjs +1103 -0
  30. package/dist/HInput-DMGLY473.js +1 -0
  31. package/dist/HInputGroup-D37WTYoI.mjs +281 -0
  32. package/dist/HInputGroup-Dcfr23sZ.js +1 -0
  33. package/dist/HLabel-B2FOqSiS.mjs +369 -0
  34. package/dist/HLabel-Dm48mSwn.js +1 -0
  35. package/dist/HLayout-BbCEm_aO.mjs +196 -0
  36. package/dist/HLayout-C1e4BZ_K.js +1 -0
  37. package/dist/HList-CAeYb-hz.mjs +419 -0
  38. package/dist/HList-eNXmMf27.js +1 -0
  39. package/dist/HModal-BDBEEpKm.mjs +778 -0
  40. package/dist/HModal-GODLq3wH.js +1 -0
  41. package/dist/HNote-CWnUjt3_.mjs +934 -0
  42. package/dist/HNote-D_Xwu9oL.js +1 -0
  43. package/dist/HPagination-Db_L9wv-.js +1 -0
  44. package/dist/HPagination-e5e2a5GS.mjs +496 -0
  45. package/dist/HParagraph-BRuSeOMU.js +1 -0
  46. package/dist/HParagraph-DYuB-qjY.mjs +463 -0
  47. package/dist/HPopup-Brp1FVpm.mjs +431 -0
  48. package/dist/HPopup-ChkoI3xm.js +1 -0
  49. package/dist/HSpinner-DDtU9PL_.js +1 -0
  50. package/dist/HSpinner-DOq2k5kT.mjs +281 -0
  51. package/dist/HTable-DGFnzD4u.js +1 -0
  52. package/dist/HTable-GCDP5O_J.mjs +620 -0
  53. package/dist/_plugin-vue_export-helper-BHFhmbuH.js +1 -0
  54. package/dist/_plugin-vue_export-helper-CHgC5LLL.mjs +9 -0
  55. package/dist/ar.es-CKau4tBl.js +5 -0
  56. package/dist/ar.es-XxSuE68c.mjs +57 -0
  57. package/dist/bg.es-BJ7fu6yy.mjs +57 -0
  58. package/dist/bg.es-Melqx1M5.js +5 -0
  59. package/dist/bn.es-CYlBkxc5.mjs +57 -0
  60. package/dist/bn.es-ClbAZ4WP.js +5 -0
  61. package/dist/bs.es-KjOcbE96.js +5 -0
  62. package/dist/bs.es-yMnaKmdi.mjs +57 -0
  63. package/dist/ca.es-BaGTENcW.js +5 -0
  64. package/dist/ca.es-DIhlxmQc.mjs +67 -0
  65. package/dist/cs.es-BN8oxRXQ.mjs +57 -0
  66. package/dist/cs.es-ChOlHqBr.js +5 -0
  67. package/dist/da.es-DJB5lAli.mjs +57 -0
  68. package/dist/da.es-DOFXbf8-.js +5 -0
  69. package/dist/de.es-DwE82Kaw.js +5 -0
  70. package/dist/de.es-glb8GeJh.mjs +57 -0
  71. package/dist/drag-and-drop.es-4ttM1tRs.js +5 -0
  72. package/dist/drag-and-drop.es-Ckzp6XEn.mjs +183 -0
  73. package/dist/el.es-CNrCgzYI.js +5 -0
  74. package/dist/el.es-_bBZf22h.mjs +76 -0
  75. package/dist/en.es-CV9nmQGr.mjs +57 -0
  76. package/dist/en.es-CgL601qd.js +5 -0
  77. package/dist/es.es-CZjcWK54.mjs +57 -0
  78. package/dist/es.es-IdFGKY7Q.js +5 -0
  79. package/dist/et.es-BygWmV3P.js +5 -0
  80. package/dist/et.es-CjvQAzNF.mjs +57 -0
  81. package/dist/fa.es-DW_0SmsT.js +5 -0
  82. package/dist/fa.es-DykeFwDA.mjs +57 -0
  83. package/dist/fi.es-Bl7Pp7AO.mjs +57 -0
  84. package/dist/fi.es-pgfJlZ8i.js +5 -0
  85. package/dist/fr.es-CNKVhFfO.mjs +57 -0
  86. package/dist/fr.es-OENguFuM.js +5 -0
  87. package/dist/he.es-bixEnAeH.js +5 -0
  88. package/dist/he.es-nF4GFhjH.mjs +57 -0
  89. package/dist/hisonvue.cjs.js +1 -0
  90. package/dist/hisonvue.css +1 -0
  91. package/dist/hisonvue.d.ts +19934 -0
  92. package/dist/hisonvue.es.js +114 -0
  93. package/dist/hr.es-CkRAP94O.js +5 -0
  94. package/dist/hr.es-QFfz660j.mjs +57 -0
  95. package/dist/hu.es-Ck2rE01V.mjs +57 -0
  96. package/dist/hu.es-DG6HeiQJ.js +5 -0
  97. package/dist/id.es-D4tPi6wP.js +5 -0
  98. package/dist/id.es-Je7FEUJ5.mjs +57 -0
  99. package/dist/index-BmKMHsSZ.js +153 -0
  100. package/dist/index-DUh7pai4.mjs +19976 -0
  101. package/dist/is.es-CDFqLYCV.js +5 -0
  102. package/dist/is.es-bzprHvXI.mjs +57 -0
  103. package/dist/it.es-BHgrw_C6.js +5 -0
  104. package/dist/it.es-CJtfqmNS.mjs +57 -0
  105. package/dist/ja.es-BaiGjqZ6.mjs +57 -0
  106. package/dist/ja.es-D-lxWwyb.js +5 -0
  107. package/dist/ka.es-CnnB6q4A.js +5 -0
  108. package/dist/ka.es-x9QJo_dl.mjs +57 -0
  109. package/dist/ko.es-6c447eTS.mjs +57 -0
  110. package/dist/ko.es-b18aaB3V.js +5 -0
  111. package/dist/lt.es-2twYdvmJ.mjs +57 -0
  112. package/dist/lt.es-BY9UQ6wZ.js +5 -0
  113. package/dist/mn.es-BLQRG1uu.mjs +57 -0
  114. package/dist/mn.es-YFS7gSdf.js +5 -0
  115. package/dist/nl.es-BEx-4hnj.js +5 -0
  116. package/dist/nl.es-bB1qWR_S.mjs +57 -0
  117. package/dist/no.es-BQnRWlWR.js +5 -0
  118. package/dist/no.es-CWDVXpTf.mjs +57 -0
  119. package/dist/pl.es-CKCsZ_02.js +5 -0
  120. package/dist/pl.es-Dzct23w9.mjs +57 -0
  121. package/dist/pt-br.es-BeBuiitI.mjs +57 -0
  122. package/dist/pt-br.es-oH7qh6Fd.js +5 -0
  123. package/dist/pt-pt.es-BeBuiitI.mjs +57 -0
  124. package/dist/pt-pt.es-DLk5I0ej.js +5 -0
  125. package/dist/ro.es-DfMVJ30M.mjs +57 -0
  126. package/dist/ro.es-DgTen1Dh.js +5 -0
  127. package/dist/ru.es-Bv9UvrBe.mjs +67 -0
  128. package/dist/ru.es-jGIQfREl.js +5 -0
  129. package/dist/scrollManager-BGnq4wyt.mjs +14 -0
  130. package/dist/scrollManager-CEEWQwoK.js +1 -0
  131. package/dist/setButtonCssEvent-B9WTs2X7.js +1 -0
  132. package/dist/setButtonCssEvent-dBs1GcAh.mjs +70 -0
  133. package/dist/sk.es-CUOTpLuL.mjs +57 -0
  134. package/dist/sk.es-D2bhVb26.js +5 -0
  135. package/dist/sl.es-DeIGgZbR.mjs +57 -0
  136. package/dist/sl.es-TV8Uraa1.js +5 -0
  137. package/dist/sq.es-CQJJrZHv.mjs +67 -0
  138. package/dist/sq.es-Cc65zxbr.js +5 -0
  139. package/dist/sr.es-CKS0AkiW.mjs +57 -0
  140. package/dist/sr.es-D5VNA_GW.js +5 -0
  141. package/dist/sv.es-ChHQRrAe.mjs +57 -0
  142. package/dist/sv.es-dBeK_DZs.js +5 -0
  143. package/dist/tr.es-B3v90gVv.mjs +57 -0
  144. package/dist/tr.es-BUz4S13G.js +5 -0
  145. package/dist/uk.es-B8uaeLcK.js +5 -0
  146. package/dist/uk.es-CiR4NnbN.mjs +67 -0
  147. package/dist/vi.es-2OFMtbQI.js +5 -0
  148. package/dist/vi.es-DFDi5l7p.mjs +67 -0
  149. package/dist/zh-cn.es-9cbEAuAi.mjs +67 -0
  150. package/dist/zh-cn.es-fDHCbCIg.js +5 -0
  151. package/dist/zh-hk.es-COzeh5F8.js +5 -0
  152. package/dist/zh-hk.es-z0tio4jE.mjs +67 -0
  153. package/nuxt/module.mjs +39 -0
  154. package/nuxt/plugin.mjs +21 -0
  155. package/package.json +53 -0
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),a=require("./index-BmKMHsSZ.js"),se=require("./_plugin-vue_export-helper-BHFhmbuH.js"),re={id:{type:String,required:!1},class:{type:[String,Array,Object],required:!1},style:{type:[String,Object,Array],required:!1},visible:{type:Boolean,default:!0},title:{type:String,required:!1},text:{type:String,required:!1},fontBold:{type:Boolean,default:!1},fontItalic:{type:Boolean,default:!1},fontThruline:{type:Boolean,default:!1},fontUnderline:{type:Boolean,default:!1},textAlign:{type:String,default:null,validator:n=>n==null||a.TEXT_ALIGN_VALUES.includes(n)},verticalAlign:{type:String,default:a.VerticalAlign.top,validator:n=>a.VERTICAL_ALIGN_VALUES.includes(n)},border:{type:Boolean,default:!1},backgroundType:{type:String,default:a.BackgroundType.empty,validator:n=>a.BACKGROUND_TYPE_VALUES.includes(n)},whiteSpace:{type:String,default:null,validator:n=>n==null||a.WHITE_SPACE_VALUES.includes(n)},copyEnabled:{type:Boolean,default:!1},showCopyButton:{type:Boolean,default:!1},copyButtonText:{type:String,default:"copy"}},ie=t.defineComponent({name:"HParagraph",props:re,inheritAttrs:!1,emits:["mounted","responsive-change","copy-click","copied","copy-error"],setup(n,{emit:l}){const E=t.ref(null),d=t.ref(null),i=n.id?n.id:a.getUUID(),N=t.computed(()=>`hison_paragraph_copy_button_${i}`),f=`hparagraph:${i}`,u=a.useDevice(),I=t.useSlots(),v=t.ref(n.visible),y=t.ref(n.title||""),p=t.ref(n.text||""),h=t.ref(n.fontBold),g=t.ref(n.fontItalic),C=t.ref(n.fontThruline),m=t.ref(n.fontUnderline),b=t.ref(n.textAlign??a.TextAlign.left),w=t.ref(n.verticalAlign),T=t.ref(n.border),B=t.ref(n.backgroundType),S=t.ref(n.whiteSpace),s=t.ref(n.copyEnabled),k=t.ref(n.showCopyButton),A=t.ref(n.copyButtonText),L=t.computed(()=>I.default?I.default():[]),P=t.computed(()=>L.value.length>0&&L.value.every(e=>e.type===t.Text)),U=t.computed(()=>!!I.default&&!P.value),F=t.computed(()=>!!I.default&&L.value.length>0);t.onMounted(()=>{if(P.value){const e=L.value.map(o=>String(o.children??"")).join("");p.value=e}});const K=t.computed(()=>v.value?"":"hison-display-none"),q=t.computed(()=>T.value?"hison-border":""),z=t.computed(()=>{switch(B.value){case a.BackgroundType.empty:return"hison-bg-empty";case a.BackgroundType.transparent:return"hison-bg-transparent";default:return"hison-bg-filled"}}),M=t.computed(()=>h.value?"hison-font-bold":""),G=t.computed(()=>g.value?"hison-font-italic":""),O=t.computed(()=>C.value?"hison-font-thruline":""),j=t.computed(()=>m.value?"hison-font-underline":""),W=t.computed(()=>s.value?"":"hison-no-select"),V=t.ref([]),R=()=>{V.value=a.extractResponsiveClasses(a.toClassString(n.class)||"",u.value),a.addComponentNameToClass(V.value,"size",a.hisonCloser.componentStyle.size),a.addComponentNameToClass(V.value,"color","primary")},X=t.computed(()=>{const e=[];return e.push(...a.extractPrefixedClasses(a.toClassString(n.class)||"","color")),e}),Y=t.computed(()=>S.value??"pre-wrap"),J=t.computed(()=>{switch(Y.value){case"normal":return"hison-ws-normal";case"pre":return"hison-ws-pre";case"pre-wrap":return"hison-ws-pre-wrap";case"pre-line":return"hison-ws-pre-line";case"break-spaces":return"hison-ws-break-spaces";default:return""}}),Q=t.computed(()=>{switch(b.value){case"center":return"hison-ta-center";case"right":return"hison-ta-right";default:return"hison-ta-left"}}),Z=t.computed(()=>{switch(w.value){case"middle":return"hison-valign-middle";case"bottom":return"hison-valign-bottom";default:return""}}),_=()=>{const e=E.value;return e?e.innerText??"":""},x=async()=>{if(!s.value)return!1;const e=_();try{if(navigator.clipboard&&typeof navigator.clipboard.writeText=="function")return await navigator.clipboard.writeText(e),!0}catch{}try{const o=document.createRange(),c=E.value;if(!c)throw new Error("no element");o.selectNodeContents(c);const r=window.getSelection();r==null||r.removeAllRanges(),r==null||r.addRange(o);const le=document.execCommand("copy");return r==null||r.removeAllRanges(),le}catch{return!1}},$=async(e,o)=>{l("copy-click",{src:e,event:o,api:d.value});try{const c=await x();l("copied",c,d.value)}catch(c){l("copy-error",c,d.value)}},ee=async e=>{await $("button",e)},te=async e=>{const o=/Mac|iPod|iPhone|iPad/.test(navigator.platform),c=(o?e.metaKey:e.ctrlKey)&&(e.key==="c"||e.key==="C"),r=(o?e.metaKey:e.ctrlKey)&&(e.key==="x"||e.key==="X");if(!s.value&&(c||r)){e.preventDefault(),e.stopPropagation();return}s.value&&c&&(e.preventDefault(),e.stopPropagation(),await $("keyboard",e))},ne=async e=>{if(!s.value){e.preventDefault();return}e.preventDefault(),await $("native",e)},oe=e=>{s.value||e.preventDefault()},ae=e=>{s.value||e.preventDefault()},D=()=>{a.hisonCloser.component.paragraphList[i]&&a.hisonCloser.component.paragraphList[i].isHisonvueComponent&&console.warn(`[Hisonvue] The paragraph ID is at risk of being duplicated. ${i}`),a.registerReloadable(f,()=>{H(),t.nextTick(D)}),R(),d.value={isHisonvueComponent:!0,getId:()=>i,getType:()=>"paragraph",isVisible:()=>v.value,setVisible:e=>{v.value=e},getTitle:()=>y.value,setTitle:e=>{y.value=e||""},getText:()=>U.value?"":p.value,setText:e=>{U.value||(p.value=e??"")},getTextAlign:()=>b.value,setTextAlign:e=>{(e==="left"||e==="center"||e==="right")&&(b.value=e)},getVerticalAlign:()=>w.value,setVerticalAlign:e=>{w.value=e},isFontBold:()=>h.value,setFontBold:e=>{h.value=e},isFontItalic:()=>g.value,setFontItalic:e=>{g.value=e},isFontThruline:()=>C.value,setFontThruline:e=>{C.value=e},isFontUnderline:()=>m.value,setFontUnderline:e=>{m.value=e},isBorder:()=>T.value,setBorder:e=>{T.value=e},getBackgroundType:()=>B.value,setBackgroundType:e=>{B.value=e},getWhiteSpace:()=>S.value,setWhiteSpace:e=>{S.value=e},getCopyButtonText:()=>A.value,setCopyButtonText:e=>{A.value=e},isCopyEnabled:()=>s.value,setCopyEnabled:e=>{s.value=e},isShowCopyButton:()=>k.value,setShowCopyButton:e=>{k.value=e},copy:async()=>await x(),reload:()=>a.reloadHisonComponent(f)},a.hisonCloser.component.paragraphList[i]=d.value,l("mounted",d.value)},H=()=>{a.unregisterReloadable(f),delete a.hisonCloser.component.paragraphList[i]};return t.onMounted(D),t.onBeforeUnmount(H),t.watch(u,e=>{R(),l("responsive-change",e)}),t.watch(()=>n.visible,e=>{const o=!!e;o!==v.value&&(v.value=o)}),t.watch(()=>n.title,e=>{const o=e??"";o!==y.value&&(y.value=o)}),t.watch(()=>n.text,e=>{const o=e??"";!U.value&&o!==p.value&&(p.value=o)}),t.watch(()=>n.fontBold,e=>{const o=!!e;o!==h.value&&(h.value=o)}),t.watch(()=>n.fontItalic,e=>{const o=!!e;o!==g.value&&(g.value=o)}),t.watch(()=>n.fontThruline,e=>{const o=!!e;o!==C.value&&(C.value=o)}),t.watch(()=>n.fontUnderline,e=>{const o=!!e;o!==m.value&&(m.value=o)}),t.watch(()=>n.textAlign,e=>{e&&e!==b.value&&(e==="left"||e==="center"||e==="right")&&(b.value=e)}),t.watch(()=>n.verticalAlign,e=>{e&&e!==w.value&&(e==="top"||e==="middle"||e==="bottom")&&(w.value=e)}),t.watch(()=>n.whiteSpace,e=>{const o=e??null;o!==S.value&&(S.value=o)}),t.watch(()=>n.border,e=>{const o=!!e;o!==T.value&&(T.value=o)}),t.watch(()=>n.backgroundType,e=>{e&&e!==B.value&&(B.value=e)}),t.watch(()=>n.copyEnabled,e=>{const o=!!e;o!==s.value&&(s.value=o)}),t.watch(()=>n.showCopyButton,e=>{const o=!!e;o!==k.value&&(k.value=o)}),t.watch(()=>n.copyButtonText,e=>{const o=e??"copy";o!==A.value&&(A.value=o)}),t.watch(()=>n.class,()=>{R()}),{paraRef:E,paragraphMethods:t.computed(()=>t.unref(d)),props:n,id:i,copyButtonId:N,title:y,visibleClass:K,borderClass:q,backgroundTypeClass:z,fontBoldClass:M,fontItalicClass:G,fontThrulineClass:O,fontUnderlineClass:j,responsiveClassList:V,buttonClassList:X,internalText:p,copyButtonText:A,copyEnabled:s,showCopyButton:k,hasElementSlot:U,hasAnySlot:F,whiteSpaceClass:J,textAlignClass:Q,verticalAlignClass:Z,copyGuardClass:W,onKeydown:te,onCopyEvent:ne,onCutEvent:oe,onSelectStart:ae,onCopyButtonClick:ee}}}),ue={key:0,class:"hison-paragraph-copybtn"},ce=["title"];function de(n,l,E,d,i,N){const f=t.resolveComponent("HButton");return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["hison-wrapper","hison-paragraph-wrapper",...n.responsiveClassList,n.visibleClass])},[n.copyEnabled&&n.showCopyButton?(t.openBlock(),t.createElementBlock("div",ue,[t.renderSlot(n.$slots,"copy-button",{onClick:n.onCopyButtonClick,text:n.copyButtonText},()=>[t.createVNode(f,{id:n.copyButtonId,class:t.normalizeClass([...n.buttonClassList,"hison-size-s"]),border:!0,text:n.copyButtonText,"background-type":"transparent",onClick:n.onCopyButtonClick,title:"Copy content"},t.createSlots({default:t.withCtx(()=>[n.$slots["copy-label"]?t.renderSlot(n.$slots,"copy-label",{key:0}):t.createCommentVNode("",!0)]),_:2},[n.$slots["copy-icon"]?{name:"icon",fn:t.withCtx(()=>[t.renderSlot(n.$slots,"copy-icon")]),key:"0"}:void 0]),1032,["id","class","text","onClick"])])])):t.createCommentVNode("",!0),t.createElementVNode("p",{ref:"paraRef",class:t.normalizeClass(["hison-paragraph",[n.borderClass,n.backgroundTypeClass,n.fontBoldClass,n.fontItalicClass,n.fontThrulineClass,n.fontUnderlineClass,n.whiteSpaceClass,n.textAlignClass,n.verticalAlignClass,n.copyGuardClass]]),style:t.normalizeStyle(n.props.style),title:n.title||void 0,tabindex:"0",onKeydown:l[0]||(l[0]=(...u)=>n.onKeydown&&n.onKeydown(...u)),onCopy:l[1]||(l[1]=(...u)=>n.onCopyEvent&&n.onCopyEvent(...u)),onCut:l[2]||(l[2]=(...u)=>n.onCutEvent&&n.onCutEvent(...u)),onSelectstart:l[3]||(l[3]=(...u)=>n.onSelectStart&&n.onSelectStart(...u))},[n.hasElementSlot?t.renderSlot(n.$slots,"default",{key:0}):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(n.internalText),1)],64))],46,ce)],2)}const pe=se._export_sfc(ie,[["render",de]]);exports.default=pe;
@@ -0,0 +1,463 @@
1
+ import { defineComponent as Ce, ref as o, computed as a, useSlots as be, Text as me, onMounted as O, onBeforeUnmount as Te, watch as l, unref as Be, nextTick as we, resolveComponent as Se, createElementBlock as x, openBlock as F, normalizeClass as H, createCommentVNode as W, createElementVNode as ke, renderSlot as D, createVNode as Ae, createSlots as Ee, withCtx as X, normalizeStyle as Ie, Fragment as Le, createTextVNode as Ue, toDisplayString as Ve } from "vue";
2
+ import { a0 as Re, B as $e, f as K, a1 as De, a2 as Pe, T as Ne, g as xe, u as Fe, w as He, j as Ke, t as Y, e as qe, b as J, h as I, r as ze, c as Ge, d as Me } from "./index-DUh7pai4.mjs";
3
+ import { _ as je } from "./_plugin-vue_export-helper-CHgC5LLL.mjs";
4
+ const Oe = {
5
+ /**
6
+ * Unique identifier for the paragraph.
7
+ * - Access methods via `hison.component.getParagraph(id)`
8
+ * - Duplicate `id` will throw at mount time
9
+ */
10
+ id: { type: String, required: !1 },
11
+ /**
12
+ * Custom class applied to the wrapper/paragraph (string / array / object supported).
13
+ * - Works with responsive classes like `hison-col-*`, `hison-size-*`, `hison-color-*`, etc.
14
+ */
15
+ class: {
16
+ type: [String, Array, Object],
17
+ required: !1
18
+ },
19
+ /**
20
+ * Inline style for the content element (string, object, or an array of objects).
21
+ */
22
+ style: {
23
+ type: [String, Object, Array],
24
+ required: !1
25
+ },
26
+ /**
27
+ * Controls visibility of the paragraph.
28
+ * - Boolean only. Use `:visible="false"` (with a colon).
29
+ */
30
+ visible: { type: Boolean, default: !0 },
31
+ /**
32
+ * Tooltip text shown on hover (maps to the `title` attribute).
33
+ */
34
+ title: { type: String, required: !1 },
35
+ /**
36
+ * Text content (used when there is NO element slot).
37
+ * - Rendered as plain text (no HTML injection)
38
+ * - Newlines/whitespace are preserved according to `whiteSpace` (default: `'pre-wrap'`)
39
+ */
40
+ text: { type: String, required: !1 },
41
+ /**
42
+ * Bold font style toggle.
43
+ * - Adds `hison-font-bold` when enabled
44
+ */
45
+ fontBold: { type: Boolean, default: !1 },
46
+ /**
47
+ * Italic font style toggle.
48
+ * - Adds `hison-font-italic` when enabled
49
+ */
50
+ fontItalic: { type: Boolean, default: !1 },
51
+ /**
52
+ * Strikethrough font style toggle.
53
+ * - Adds `hison-font-thruline` when enabled
54
+ */
55
+ fontThruline: { type: Boolean, default: !1 },
56
+ /**
57
+ * Underline font style toggle.
58
+ * - Adds `hison-font-underline` when enabled
59
+ */
60
+ fontUnderline: { type: Boolean, default: !1 },
61
+ /**
62
+ * Horizontal text alignment.
63
+ * - 'left' | 'center' | 'right'
64
+ * - Accepts enum `TextAlign` or its literal strings
65
+ */
66
+ textAlign: {
67
+ type: String,
68
+ default: null,
69
+ validator: (t) => t == null || Ne.includes(t)
70
+ },
71
+ /**
72
+ * Vertical alignment (effective when the paragraph has vertical space).
73
+ * - 'top' | 'middle' | 'bottom'
74
+ * - Implemented by flex utility classes internally
75
+ */
76
+ verticalAlign: {
77
+ type: String,
78
+ default: Pe.top,
79
+ validator: (t) => De.includes(t)
80
+ },
81
+ /**
82
+ * Whether to show border (rendered as subtle box-shadow).
83
+ * - Default: false (no border)
84
+ */
85
+ border: { type: Boolean, default: !1 },
86
+ /**
87
+ * Background type for the paragraph.
88
+ * - 'filled' | 'empty' | 'transparent'
89
+ * - Default: 'empty'
90
+ */
91
+ backgroundType: {
92
+ type: String,
93
+ default: K.empty,
94
+ validator: (t) => $e.includes(t)
95
+ },
96
+ /**
97
+ * Whitespace rendering policy.
98
+ * - 'normal' | 'pre' | 'pre-wrap' | 'pre-line' | 'break-spaces' | null
99
+ * - When null, the component defaults to `'pre-wrap'`
100
+ */
101
+ whiteSpace: {
102
+ type: String,
103
+ default: null,
104
+ validator: (t) => t == null || Re.includes(t)
105
+ },
106
+ /**
107
+ * Enables content copy.
108
+ * - When true: Ctrl/Cmd+C works on focus; `copy()` API is available
109
+ */
110
+ copyEnabled: { type: Boolean, default: !1 },
111
+ /**
112
+ * Shows the copy button on the top-right corner.
113
+ * - Only visible when `copyEnabled` is true
114
+ */
115
+ showCopyButton: { type: Boolean, default: !1 },
116
+ /**
117
+ * Copy button label (also used for accessibility).
118
+ */
119
+ copyButtonText: { type: String, default: "copy" }
120
+ }, We = Ce({
121
+ name: "HParagraph",
122
+ props: Oe,
123
+ inheritAttrs: !1,
124
+ emits: [
125
+ "mounted",
126
+ "responsive-change",
127
+ "copy-click",
128
+ "copied",
129
+ "copy-error"
130
+ ],
131
+ setup(t, { emit: s }) {
132
+ const L = o(null), v = o(null), u = t.id ? t.id : xe(), q = a(() => `hison_paragraph_copy_button_${u}`), f = `hparagraph:${u}`, c = Fe(), U = be(), y = o(t.visible), g = o(t.title || ""), p = o(t.text || ""), h = o(t.fontBold), C = o(t.fontItalic), b = o(t.fontThruline), m = o(t.fontUnderline), T = o(t.textAlign ?? He.left), B = o(t.verticalAlign), w = o(t.border), S = o(t.backgroundType), k = o(t.whiteSpace), i = o(t.copyEnabled), A = o(t.showCopyButton), E = o(t.copyButtonText), V = a(() => U.default ? U.default() : []), z = a(
133
+ () => V.value.length > 0 && V.value.every((e) => e.type === me)
134
+ ), R = a(() => !!U.default && !z.value), Q = a(() => !!U.default && V.value.length > 0);
135
+ O(() => {
136
+ if (z.value) {
137
+ const e = V.value.map((n) => String(n.children ?? "")).join("");
138
+ p.value = e;
139
+ }
140
+ });
141
+ const Z = a(() => y.value ? "" : "hison-display-none"), _ = a(() => w.value ? "hison-border" : ""), ee = a(() => {
142
+ switch (S.value) {
143
+ case K.empty:
144
+ return "hison-bg-empty";
145
+ case K.transparent:
146
+ return "hison-bg-transparent";
147
+ default:
148
+ return "hison-bg-filled";
149
+ }
150
+ }), te = a(() => h.value ? "hison-font-bold" : ""), ne = a(() => C.value ? "hison-font-italic" : ""), ae = a(() => b.value ? "hison-font-thruline" : ""), oe = a(() => m.value ? "hison-font-underline" : ""), le = a(() => i.value ? "" : "hison-no-select"), $ = o([]), P = () => {
151
+ $.value = qe(Y(t.class) || "", c.value), J($.value, "size", I.componentStyle.size), J($.value, "color", "primary");
152
+ }, se = a(() => {
153
+ const e = [];
154
+ return e.push(...Ke(Y(t.class) || "", "color")), e;
155
+ }), ie = a(() => k.value ?? "pre-wrap"), re = a(() => {
156
+ switch (ie.value) {
157
+ case "normal":
158
+ return "hison-ws-normal";
159
+ case "pre":
160
+ return "hison-ws-pre";
161
+ case "pre-wrap":
162
+ return "hison-ws-pre-wrap";
163
+ case "pre-line":
164
+ return "hison-ws-pre-line";
165
+ case "break-spaces":
166
+ return "hison-ws-break-spaces";
167
+ default:
168
+ return "";
169
+ }
170
+ }), ue = a(() => {
171
+ switch (T.value) {
172
+ case "center":
173
+ return "hison-ta-center";
174
+ case "right":
175
+ return "hison-ta-right";
176
+ default:
177
+ return "hison-ta-left";
178
+ }
179
+ }), ce = a(() => {
180
+ switch (B.value) {
181
+ case "middle":
182
+ return "hison-valign-middle";
183
+ case "bottom":
184
+ return "hison-valign-bottom";
185
+ default:
186
+ return "";
187
+ }
188
+ }), de = () => {
189
+ const e = L.value;
190
+ return e ? e.innerText ?? "" : "";
191
+ }, G = async () => {
192
+ if (!i.value) return !1;
193
+ const e = de();
194
+ try {
195
+ if (navigator.clipboard && typeof navigator.clipboard.writeText == "function")
196
+ return await navigator.clipboard.writeText(e), !0;
197
+ } catch {
198
+ }
199
+ try {
200
+ const n = document.createRange(), d = L.value;
201
+ if (!d) throw new Error("no element");
202
+ n.selectNodeContents(d);
203
+ const r = window.getSelection();
204
+ r == null || r.removeAllRanges(), r == null || r.addRange(n);
205
+ const he = document.execCommand("copy");
206
+ return r == null || r.removeAllRanges(), he;
207
+ } catch {
208
+ return !1;
209
+ }
210
+ }, N = async (e, n) => {
211
+ s("copy-click", { src: e, event: n, api: v.value });
212
+ try {
213
+ const d = await G();
214
+ s("copied", d, v.value);
215
+ } catch (d) {
216
+ s("copy-error", d, v.value);
217
+ }
218
+ }, ve = async (e) => {
219
+ await N("button", e);
220
+ }, pe = async (e) => {
221
+ const n = /Mac|iPod|iPhone|iPad/.test(navigator.platform), d = (n ? e.metaKey : e.ctrlKey) && (e.key === "c" || e.key === "C"), r = (n ? e.metaKey : e.ctrlKey) && (e.key === "x" || e.key === "X");
222
+ if (!i.value && (d || r)) {
223
+ e.preventDefault(), e.stopPropagation();
224
+ return;
225
+ }
226
+ i.value && d && (e.preventDefault(), e.stopPropagation(), await N("keyboard", e));
227
+ }, fe = async (e) => {
228
+ if (!i.value) {
229
+ e.preventDefault();
230
+ return;
231
+ }
232
+ e.preventDefault(), await N("native", e);
233
+ }, ye = (e) => {
234
+ i.value || e.preventDefault();
235
+ }, ge = (e) => {
236
+ i.value || e.preventDefault();
237
+ }, M = () => {
238
+ I.component.paragraphList[u] && I.component.paragraphList[u].isHisonvueComponent && console.warn(`[Hisonvue] The paragraph ID is at risk of being duplicated. ${u}`), ze(f, () => {
239
+ j(), we(M);
240
+ }), P(), v.value = {
241
+ isHisonvueComponent: !0,
242
+ getId: () => u,
243
+ getType: () => "paragraph",
244
+ isVisible: () => y.value,
245
+ setVisible: (e) => {
246
+ y.value = e;
247
+ },
248
+ getTitle: () => g.value,
249
+ setTitle: (e) => {
250
+ g.value = e || "";
251
+ },
252
+ getText: () => R.value ? "" : p.value,
253
+ setText: (e) => {
254
+ R.value || (p.value = e ?? "");
255
+ },
256
+ getTextAlign: () => T.value,
257
+ setTextAlign: (e) => {
258
+ (e === "left" || e === "center" || e === "right") && (T.value = e);
259
+ },
260
+ getVerticalAlign: () => B.value,
261
+ setVerticalAlign: (e) => {
262
+ B.value = e;
263
+ },
264
+ isFontBold: () => h.value,
265
+ setFontBold: (e) => {
266
+ h.value = e;
267
+ },
268
+ isFontItalic: () => C.value,
269
+ setFontItalic: (e) => {
270
+ C.value = e;
271
+ },
272
+ isFontThruline: () => b.value,
273
+ setFontThruline: (e) => {
274
+ b.value = e;
275
+ },
276
+ isFontUnderline: () => m.value,
277
+ setFontUnderline: (e) => {
278
+ m.value = e;
279
+ },
280
+ isBorder: () => w.value,
281
+ setBorder: (e) => {
282
+ w.value = e;
283
+ },
284
+ getBackgroundType: () => S.value,
285
+ setBackgroundType: (e) => {
286
+ S.value = e;
287
+ },
288
+ getWhiteSpace: () => k.value,
289
+ setWhiteSpace: (e) => {
290
+ k.value = e;
291
+ },
292
+ getCopyButtonText: () => E.value,
293
+ setCopyButtonText: (e) => {
294
+ E.value = e;
295
+ },
296
+ isCopyEnabled: () => i.value,
297
+ setCopyEnabled: (e) => {
298
+ i.value = e;
299
+ },
300
+ isShowCopyButton: () => A.value,
301
+ setShowCopyButton: (e) => {
302
+ A.value = e;
303
+ },
304
+ copy: async () => await G(),
305
+ reload: () => Ge(f)
306
+ }, I.component.paragraphList[u] = v.value, s("mounted", v.value);
307
+ }, j = () => {
308
+ Me(f), delete I.component.paragraphList[u];
309
+ };
310
+ return O(M), Te(j), l(c, (e) => {
311
+ P(), s("responsive-change", e);
312
+ }), l(() => t.visible, (e) => {
313
+ const n = !!e;
314
+ n !== y.value && (y.value = n);
315
+ }), l(() => t.title, (e) => {
316
+ const n = e ?? "";
317
+ n !== g.value && (g.value = n);
318
+ }), l(() => t.text, (e) => {
319
+ const n = e ?? "";
320
+ !R.value && n !== p.value && (p.value = n);
321
+ }), l(() => t.fontBold, (e) => {
322
+ const n = !!e;
323
+ n !== h.value && (h.value = n);
324
+ }), l(() => t.fontItalic, (e) => {
325
+ const n = !!e;
326
+ n !== C.value && (C.value = n);
327
+ }), l(() => t.fontThruline, (e) => {
328
+ const n = !!e;
329
+ n !== b.value && (b.value = n);
330
+ }), l(() => t.fontUnderline, (e) => {
331
+ const n = !!e;
332
+ n !== m.value && (m.value = n);
333
+ }), l(() => t.textAlign, (e) => {
334
+ e && e !== T.value && (e === "left" || e === "center" || e === "right") && (T.value = e);
335
+ }), l(() => t.verticalAlign, (e) => {
336
+ e && e !== B.value && (e === "top" || e === "middle" || e === "bottom") && (B.value = e);
337
+ }), l(() => t.whiteSpace, (e) => {
338
+ const n = e ?? null;
339
+ n !== k.value && (k.value = n);
340
+ }), l(() => t.border, (e) => {
341
+ const n = !!e;
342
+ n !== w.value && (w.value = n);
343
+ }), l(() => t.backgroundType, (e) => {
344
+ e && e !== S.value && (S.value = e);
345
+ }), l(() => t.copyEnabled, (e) => {
346
+ const n = !!e;
347
+ n !== i.value && (i.value = n);
348
+ }), l(() => t.showCopyButton, (e) => {
349
+ const n = !!e;
350
+ n !== A.value && (A.value = n);
351
+ }), l(() => t.copyButtonText, (e) => {
352
+ const n = e ?? "copy";
353
+ n !== E.value && (E.value = n);
354
+ }), l(() => t.class, () => {
355
+ P();
356
+ }), {
357
+ paraRef: L,
358
+ paragraphMethods: a(() => Be(v)),
359
+ props: t,
360
+ id: u,
361
+ copyButtonId: q,
362
+ title: g,
363
+ visibleClass: Z,
364
+ borderClass: _,
365
+ backgroundTypeClass: ee,
366
+ fontBoldClass: te,
367
+ fontItalicClass: ne,
368
+ fontThrulineClass: ae,
369
+ fontUnderlineClass: oe,
370
+ responsiveClassList: $,
371
+ buttonClassList: se,
372
+ internalText: p,
373
+ copyButtonText: E,
374
+ copyEnabled: i,
375
+ showCopyButton: A,
376
+ hasElementSlot: R,
377
+ hasAnySlot: Q,
378
+ whiteSpaceClass: re,
379
+ textAlignClass: ue,
380
+ verticalAlignClass: ce,
381
+ copyGuardClass: le,
382
+ onKeydown: pe,
383
+ onCopyEvent: fe,
384
+ onCutEvent: ye,
385
+ onSelectStart: ge,
386
+ onCopyButtonClick: ve
387
+ };
388
+ }
389
+ }), Xe = {
390
+ key: 0,
391
+ class: "hison-paragraph-copybtn"
392
+ }, Ye = ["title"];
393
+ function Je(t, s, L, v, u, q) {
394
+ const f = Se("HButton");
395
+ return F(), x("div", {
396
+ class: H([
397
+ "hison-wrapper",
398
+ "hison-paragraph-wrapper",
399
+ ...t.responsiveClassList,
400
+ t.visibleClass
401
+ ])
402
+ }, [
403
+ t.copyEnabled && t.showCopyButton ? (F(), x("div", Xe, [
404
+ D(t.$slots, "copy-button", {
405
+ onClick: t.onCopyButtonClick,
406
+ text: t.copyButtonText
407
+ }, () => [
408
+ Ae(f, {
409
+ id: t.copyButtonId,
410
+ class: H([...t.buttonClassList, "hison-size-s"]),
411
+ border: !0,
412
+ text: t.copyButtonText,
413
+ "background-type": "transparent",
414
+ onClick: t.onCopyButtonClick,
415
+ title: "Copy content"
416
+ }, Ee({
417
+ default: X(() => [
418
+ t.$slots["copy-label"] ? D(t.$slots, "copy-label", { key: 0 }) : W("", !0)
419
+ ]),
420
+ _: 2
421
+ }, [
422
+ t.$slots["copy-icon"] ? {
423
+ name: "icon",
424
+ fn: X(() => [
425
+ D(t.$slots, "copy-icon")
426
+ ]),
427
+ key: "0"
428
+ } : void 0
429
+ ]), 1032, ["id", "class", "text", "onClick"])
430
+ ])
431
+ ])) : W("", !0),
432
+ ke("p", {
433
+ ref: "paraRef",
434
+ class: H(["hison-paragraph", [
435
+ t.borderClass,
436
+ t.backgroundTypeClass,
437
+ t.fontBoldClass,
438
+ t.fontItalicClass,
439
+ t.fontThrulineClass,
440
+ t.fontUnderlineClass,
441
+ t.whiteSpaceClass,
442
+ t.textAlignClass,
443
+ t.verticalAlignClass,
444
+ t.copyGuardClass
445
+ ]]),
446
+ style: Ie(t.props.style),
447
+ title: t.title || void 0,
448
+ tabindex: "0",
449
+ onKeydown: s[0] || (s[0] = (...c) => t.onKeydown && t.onKeydown(...c)),
450
+ onCopy: s[1] || (s[1] = (...c) => t.onCopyEvent && t.onCopyEvent(...c)),
451
+ onCut: s[2] || (s[2] = (...c) => t.onCutEvent && t.onCutEvent(...c)),
452
+ onSelectstart: s[3] || (s[3] = (...c) => t.onSelectStart && t.onSelectStart(...c))
453
+ }, [
454
+ t.hasElementSlot ? D(t.$slots, "default", { key: 0 }) : (F(), x(Le, { key: 1 }, [
455
+ Ue(Ve(t.internalText), 1)
456
+ ], 64))
457
+ ], 46, Ye)
458
+ ], 2);
459
+ }
460
+ const et = /* @__PURE__ */ je(We, [["render", Je]]);
461
+ export {
462
+ et as default
463
+ };