@designbasekorea/ui-wc 0.5.3 → 0.5.6

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 (156) hide show
  1. package/dist/chunks/lottie-e273b936.js +17032 -0
  2. package/dist/esm/components/animation-background/canvas-controller.js +121 -1
  3. package/dist/esm/components/animation-background/controls.js +180 -1
  4. package/dist/esm/components/animation-background/graphite-controller.js +196 -1
  5. package/dist/esm/components/animation-background/graphite-presets.js +42 -1
  6. package/dist/esm/components/animation-background/graphite-shader.js +111 -1
  7. package/dist/esm/components/animation-background/layers.js +369 -1
  8. package/dist/esm/components/animation-background/lumina-presets.js +53 -1
  9. package/dist/esm/components/animation-background/lumina-shaders.js +181 -1
  10. package/dist/esm/components/animation-background/lumina-utils.js +60 -1
  11. package/dist/esm/components/animation-background/particle-defaults.js +36 -1
  12. package/dist/esm/components/animation-background/renderers.js +167 -1
  13. package/dist/esm/components/animation-background/shader-controller.js +154 -1
  14. package/dist/esm/components/color-picker-utils.js +134 -1
  15. package/dist/esm/components/date-picker-utils.js +140 -1
  16. package/dist/esm/components/db-accordion.js +304 -1
  17. package/dist/esm/components/db-ad-banner.js +455 -1
  18. package/dist/esm/components/db-alert.js +149 -1
  19. package/dist/esm/components/db-animation-background.js +486 -1
  20. package/dist/esm/components/db-animation-text.js +601 -1
  21. package/dist/esm/components/db-app-badge.js +88 -1
  22. package/dist/esm/components/db-audio-player.js +752 -1
  23. package/dist/esm/components/db-avatar.js +188 -1
  24. package/dist/esm/components/db-backdrop.js +139 -1
  25. package/dist/esm/components/db-badge.js +91 -1
  26. package/dist/esm/components/db-banner.js +188 -1
  27. package/dist/esm/components/db-bottom-navigation.js +146 -1
  28. package/dist/esm/components/db-bottom-sheet.js +481 -1
  29. package/dist/esm/components/db-breadcrumbs.js +329 -1
  30. package/dist/esm/components/db-button.js +316 -1
  31. package/dist/esm/components/db-calendar.js +675 -1
  32. package/dist/esm/components/db-card.js +265 -1
  33. package/dist/esm/components/db-carousel.js +264 -1
  34. package/dist/esm/components/db-checkbox.js +202 -1
  35. package/dist/esm/components/db-chip.js +104 -1
  36. package/dist/esm/components/db-code-block.js +304 -1
  37. package/dist/esm/components/db-color-picker.js +746 -1
  38. package/dist/esm/components/db-confirm.js +191 -1
  39. package/dist/esm/components/db-container.js +39 -1
  40. package/dist/esm/components/db-context-menu.js +265 -1
  41. package/dist/esm/components/db-countdown.js +146 -1
  42. package/dist/esm/components/db-cursor-follower.js +173 -1
  43. package/dist/esm/components/db-date-picker.js +837 -1
  44. package/dist/esm/components/db-divider.js +66 -1
  45. package/dist/esm/components/db-drawer.js +245 -1
  46. package/dist/esm/components/db-dropdown.js +493 -1
  47. package/dist/esm/components/db-dropzone.js +266 -1
  48. package/dist/esm/components/db-empty-state.js +97 -1
  49. package/dist/esm/components/db-file-uploader.js +256 -1
  50. package/dist/esm/components/db-floating-action-button.js +139 -1
  51. package/dist/esm/components/db-footer.js +385 -1
  52. package/dist/esm/components/db-form.js +566 -1
  53. package/dist/esm/components/db-gantt.js +882 -1
  54. package/dist/esm/components/db-gradient.js +133 -1
  55. package/dist/esm/components/db-grid-background.js +909 -1
  56. package/dist/esm/components/db-grid.js +73 -1
  57. package/dist/esm/components/db-icons.js +82 -1
  58. package/dist/esm/components/db-image-list.js +214 -1
  59. package/dist/esm/components/db-image-placeholder.js +96 -1
  60. package/dist/esm/components/db-image.js +289 -1
  61. package/dist/esm/components/db-indicator.js +517 -1
  62. package/dist/esm/components/db-input.js +420 -1
  63. package/dist/esm/components/db-kanban.js +538 -1
  64. package/dist/esm/components/db-label.js +66 -1
  65. package/dist/esm/components/db-lightbox.js +372 -1
  66. package/dist/esm/components/db-list.js +340 -1
  67. package/dist/esm/components/db-logo-svg.js +72 -1
  68. package/dist/esm/components/db-logo.js +106 -1
  69. package/dist/esm/components/db-lottie.js +109 -1
  70. package/dist/esm/components/db-markdown-editor.js +458 -1
  71. package/dist/esm/components/db-marquee.js +402 -1
  72. package/dist/esm/components/db-masonry.js +94 -1
  73. package/dist/esm/components/db-menu-item.js +211 -1
  74. package/dist/esm/components/db-modal.js +522 -1
  75. package/dist/esm/components/db-navbar.js +680 -1
  76. package/dist/esm/components/db-onboarding-modal.js +322 -1
  77. package/dist/esm/components/db-page-header.js +312 -1
  78. package/dist/esm/components/db-pagination.js +271 -1
  79. package/dist/esm/components/db-popover.js +580 -1
  80. package/dist/esm/components/db-progress-step.js +166 -1
  81. package/dist/esm/components/db-progress.js +171 -1
  82. package/dist/esm/components/db-progressbar.js +72 -1
  83. package/dist/esm/components/db-radio.js +172 -1
  84. package/dist/esm/components/db-random-gradient.js +121 -1
  85. package/dist/esm/components/db-range-slider.js +811 -1
  86. package/dist/esm/components/db-rating.js +325 -1
  87. package/dist/esm/components/db-reorder.js +286 -1
  88. package/dist/esm/components/db-resizable-panels.js +282 -1
  89. package/dist/esm/components/db-scroll-area.js +126 -1
  90. package/dist/esm/components/db-search-bar.js +668 -1
  91. package/dist/esm/components/db-section-app-download.js +101 -1
  92. package/dist/esm/components/db-section-contact.js +102 -1
  93. package/dist/esm/components/db-section-cta.js +150 -1
  94. package/dist/esm/components/db-section-faq.js +120 -1
  95. package/dist/esm/components/db-section-feature-grid.js +137 -1
  96. package/dist/esm/components/db-section-feature.js +179 -1
  97. package/dist/esm/components/db-section-hero.js +243 -1
  98. package/dist/esm/components/db-section-logo-cloud.js +138 -1
  99. package/dist/esm/components/db-section-pricing.js +166 -1
  100. package/dist/esm/components/db-section-stats.js +129 -1
  101. package/dist/esm/components/db-section-testimonials.js +252 -1
  102. package/dist/esm/components/db-section.js +385 -1
  103. package/dist/esm/components/db-segment-control.js +231 -1
  104. package/dist/esm/components/db-select.js +571 -1
  105. package/dist/esm/components/db-share-icons.js +40 -1
  106. package/dist/esm/components/db-share.js +489 -1
  107. package/dist/esm/components/db-sidebar.js +1068 -1
  108. package/dist/esm/components/db-skeleton.js +94 -1
  109. package/dist/esm/components/db-spinner.js +102 -1
  110. package/dist/esm/components/db-split-view.js +297 -1
  111. package/dist/esm/components/db-stack.js +46 -1
  112. package/dist/esm/components/db-stat.js +218 -1
  113. package/dist/esm/components/db-stepper.js +398 -1
  114. package/dist/esm/components/db-table.js +412 -1
  115. package/dist/esm/components/db-tabs.js +335 -1
  116. package/dist/esm/components/db-testimonial.js +162 -1
  117. package/dist/esm/components/db-textarea.js +233 -1
  118. package/dist/esm/components/db-time-picker.js +523 -1
  119. package/dist/esm/components/db-timeline.js +174 -1
  120. package/dist/esm/components/db-toast.js +158 -1
  121. package/dist/esm/components/db-toggle.js +162 -1
  122. package/dist/esm/components/db-toolbar.js +94 -1
  123. package/dist/esm/components/db-tooltip.js +440 -1
  124. package/dist/esm/components/db-top-banner.js +121 -1
  125. package/dist/esm/components/db-tutorial.js +324 -1
  126. package/dist/esm/components/db-video-player.js +503 -1
  127. package/dist/esm/components/db-youtube-player.js +194 -1
  128. package/dist/esm/components/highlight-code.js +65 -1
  129. package/dist/esm/components/input-validation.js +50 -1
  130. package/dist/esm/components/marketing-block-host-utils.js +9 -1
  131. package/dist/esm/components/number-scrub.js +117 -1
  132. package/dist/esm/components/random-gradient-palettes.js +67 -1
  133. package/dist/esm/components/section-block-header-utils.js +48 -1
  134. package/dist/esm/helpers/confirm.js +52 -1
  135. package/dist/esm/helpers/toast.js +73 -1
  136. package/dist/esm/index.js +111 -1
  137. package/dist/esm/node_modules/prismjs/components/prism-bash.js +235 -1
  138. package/dist/esm/node_modules/prismjs/components/prism-clike.js +31 -1
  139. package/dist/esm/node_modules/prismjs/components/prism-css.js +64 -1
  140. package/dist/esm/node_modules/prismjs/components/prism-javascript.js +172 -1
  141. package/dist/esm/node_modules/prismjs/components/prism-json.js +27 -1
  142. package/dist/esm/node_modules/prismjs/components/prism-jsx.js +143 -1
  143. package/dist/esm/node_modules/prismjs/components/prism-markup.js +186 -1
  144. package/dist/esm/node_modules/prismjs/components/prism-scss.js +81 -1
  145. package/dist/esm/node_modules/prismjs/components/prism-tsx.js +15 -1
  146. package/dist/esm/node_modules/prismjs/components/prism-typescript.js +60 -1
  147. package/dist/index.cjs +55414 -1
  148. package/dist/index.css +1 -1
  149. package/dist/index.esm.js +38284 -1
  150. package/dist/react/chunks/lottie-72a4c6d4.js +17032 -0
  151. package/dist/react/index.cjs +56503 -1
  152. package/dist/react/index.d.ts +1 -1
  153. package/dist/react/index.esm.js +39373 -1
  154. package/package.json +1 -1
  155. package/dist/chunks/lottie-2d1f6278.js +0 -1
  156. package/dist/react/chunks/lottie-14e7addb.js +0 -1
@@ -1 +1,282 @@
1
- const e=["both","horizontal","vertical"],t=["bottom-right","bottom-left","top-right","top-left","right","bottom"];class DbResizablePanels extends HTMLElement{constructor(){super(...arguments),this.isResizing=!1,this.startSize={width:0,height:0},this.startPos={x:0,y:0},this.currentSize={width:0,height:0},this.onMouseDown=e=>{e.preventDefault(),this.startResize(e.clientX,e.clientY),document.addEventListener("mousemove",this.onMouseMove),document.addEventListener("mouseup",this.onMouseUp)},this.onTouchStart=e=>{e.preventDefault();const t=e.touches[0];this.startResize(t.clientX,t.clientY),document.addEventListener("touchmove",this.onTouchMove,{passive:!1}),document.addEventListener("touchend",this.onTouchEnd)},this.onMouseMove=e=>{this.applyResize(e.clientX,e.clientY)},this.onTouchMove=e=>{e.preventDefault();const t=e.touches[0];this.applyResize(t.clientX,t.clientY)},this.onMouseUp=()=>{this.endResize(),document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("mouseup",this.onMouseUp)},this.onTouchEnd=()=>{this.endResize(),document.removeEventListener("touchmove",this.onTouchMove),document.removeEventListener("touchend",this.onTouchEnd)}}static get observedAttributes(){return["initial-width","initial-height","min-width","min-height","max-width","max-height","direction","handle-position","handle-size","handle-color","handle-hover-color","snap-to-grid","show-guides","show-size-indicator","show-constraints","show-border","shadow","background-color","border-radius"]}connectedCallback(){this.ensureStructure(),this.initializeSize(),this.render()}attributeChangedCallback(){this.render()}getBool(e,t=!1){if(!this.hasAttribute(e))return t;const i=this.getAttribute(e);return""===i||"true"===i}getNumber(e,t){const i=Number(this.getAttribute(e)??t);return Number.isFinite(i)?i:t}getDirection(){const t=this.getAttribute("direction");return t&&e.includes(t)?t:"both"}getHandlePosition(){const e=this.getAttribute("handle-position");return e&&t.includes(e)?e:"bottom-right"}initializeSize(){const e=this.parentElement?.getBoundingClientRect();if(!e)return;const t=this.getAttribute("initial-width")||"100%",i=this.getAttribute("initial-height")||"100%";this.currentSize={width:"string"==typeof t&&t.endsWith("%")?e.width*Number(t.replace("%",""))/100:Number(t)||e.width,height:"string"==typeof i&&i.endsWith("%")?e.height*Number(i.replace("%",""))/100:Number(i)||e.height}}getMinSize(){return{width:this.getNumber("min-width",200),height:this.getNumber("min-height",150)}}getMaxSize(){const e=this.parentElement?.getBoundingClientRect();if(!e)return{width:Number.POSITIVE_INFINITY,height:Number.POSITIVE_INFINITY};const t=this.getAttribute("max-width")||"100vw",i=this.getAttribute("max-height")||"100vh",toSize=(e,t,i)=>{if("100vw"===e||"100vh"===e)return t;if("100%"===e)return i;const s=Number(e);return Number.isFinite(s)?s:Number.POSITIVE_INFINITY};return{width:toSize(t,window.innerWidth,e.width),height:toSize(i,window.innerHeight,e.height)}}ensureStructure(){if(this.container)return;this.container=document.createElement("div"),this.container.className="designbase-wc-resizable-panels",this.guidesEl=document.createElement("div"),this.guidesEl.className="designbase-wc-resizable-panels__guides";const e=document.createElement("div");e.className="designbase-wc-resizable-panels__guide designbase-wc-resizable-panels__guide--horizontal";const t=document.createElement("div");t.className="designbase-wc-resizable-panels__guide designbase-wc-resizable-panels__guide--vertical",this.guidesEl.append(e,t),this.sizeIndicatorEl=document.createElement("div"),this.sizeIndicatorEl.className="designbase-wc-resizable-panels__size-indicator",this.constraintsEl=document.createElement("div"),this.constraintsEl.className="designbase-wc-resizable-panels__constraints",this.contentEl=document.createElement("div"),this.contentEl.className="designbase-wc-resizable-panels__content",this.handleEl=document.createElement("div"),this.handleEl.className="designbase-wc-resizable-panels__handle",this.handleEl.addEventListener("mousedown",this.onMouseDown),this.handleEl.addEventListener("touchstart",this.onTouchStart,{passive:!1}),this.container.append(this.guidesEl,this.sizeIndicatorEl,this.constraintsEl,this.contentEl,this.handleEl),this.replaceChildren(this.container)}startResize(e,t){this.isResizing=!0,this.startSize={...this.currentSize},this.startPos={x:e,y:t},this.dispatchEvent(new CustomEvent("db-resize-start",{detail:this.currentSize,bubbles:!0,composed:!0})),this.render()}applyResize(e,t){if(!this.isResizing)return;const i=e-this.startPos.x,s=t-this.startPos.y,n=this.getDirection();let h=this.startSize.width,r=this.startSize.height;"both"!==n&&"horizontal"!==n||(h+=i),"both"!==n&&"vertical"!==n||(r+=s);const o=this.getNumber("snap-to-grid",0);o>0&&(h=Math.round(h/o)*o,r=Math.round(r/o)*o);const a=this.getMinSize(),l=this.getMaxSize();h=Math.max(a.width,Math.min(l.width,h)),r=Math.max(a.height,Math.min(l.height,r)),this.currentSize={width:h,height:r},this.dispatchEvent(new CustomEvent("db-resize",{detail:this.currentSize,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("db-size-change",{detail:this.currentSize,bubbles:!0,composed:!0})),this.render()}endResize(){this.isResizing&&(this.isResizing=!1,this.dispatchEvent(new CustomEvent("db-resize-end",{detail:this.currentSize,bubbles:!0,composed:!0})),this.render())}renderHandleStyle(){if(!this.handleEl)return;const e=this.getDirection(),t=this.getHandlePosition(),i=this.getAttribute("handle-color"),s=this.getAttribute("handle-hover-color");i?this.handleEl.style.setProperty("--db-resize-handle-color",i):this.handleEl.style.removeProperty("--db-resize-handle-color"),s?this.handleEl.style.setProperty("--db-resize-handle-hover-color",s):this.handleEl.style.removeProperty("--db-resize-handle-hover-color"),this.handleEl.style.top="",this.handleEl.style.right="",this.handleEl.style.bottom="",this.handleEl.style.left="",this.handleEl.style.transform="",this.handleEl.style.width="",this.handleEl.style.height="",this.handleEl.style.backgroundColor="",this.handleEl.onmouseenter=null,this.handleEl.onmouseleave=null;let n=`corner-${t}`;"vertical"===e?n="edge-bottom":"horizontal"===e&&(n="edge-right"),this.handleEl.className=`designbase-wc-resizable-panels__handle designbase-wc-resizable-panels__handle--${n}`,this.handleEl.setAttribute("role","separator"),this.handleEl.setAttribute("aria-label","크기 조절"),this.handleEl.replaceChildren()}render(){if(this.ensureStructure(),!(this.container&&this.contentEl&&this.guidesEl&&this.sizeIndicatorEl&&this.constraintsEl))return;const e=["designbase-wc-resizable-panels",this.isResizing&&"designbase-wc-resizable-panels--resizing",this.getBool("show-border",!0)&&"designbase-wc-resizable-panels--border",this.getBool("shadow",!0)&&"designbase-wc-resizable-panels--shadow"].filter(Boolean).join(" ");this.container.className=e,this.container.style.width=`${this.currentSize.width}px`,this.container.style.height=`${this.currentSize.height}px`;const t=this.getAttribute("background-color");this.container.style.backgroundColor=t||"";const i=this.getAttribute("border-radius")||"8px";if(this.container.style.borderRadius=/^\d+$/.test(i)?`${i}px`:i,0===this.contentEl.children.length){const e=Array.from(this.childNodes).filter(e=>e!==this.container);this.contentEl.append(...e)}if(this.guidesEl.style.display=this.getBool("show-guides",!0)&&this.isResizing?"":"none",this.sizeIndicatorEl.style.display=this.getBool("show-size-indicator",!0)&&this.isResizing?"":"none",this.sizeIndicatorEl.textContent=`${Math.round(this.currentSize.width)} × ${Math.round(this.currentSize.height)}`,this.constraintsEl.style.display=this.getBool("show-constraints",!0)&&this.isResizing?"":"none",this.constraintsEl.replaceChildren(),"none"!==this.constraintsEl.style.display){const e=this.getMinSize(),t=this.getMaxSize();this.currentSize.width<=e.width&&this.constraintsEl.append(this.makeConstraint("최소 너비 도달","min")),this.currentSize.height<=e.height&&this.constraintsEl.append(this.makeConstraint("최소 높이 도달","min")),this.currentSize.width>=t.width&&this.constraintsEl.append(this.makeConstraint("최대 너비 도달","max")),this.currentSize.height>=t.height&&this.constraintsEl.append(this.makeConstraint("최대 높이 도달","max"))}this.renderHandleStyle()}makeConstraint(e,t){const i=document.createElement("div");return i.className=`designbase-wc-resizable-panels__constraint designbase-wc-resizable-panels__constraint--${t}`,i.textContent=e,i}}customElements.get("db-resizable-panels")||customElements.define("db-resizable-panels",DbResizablePanels);export{DbResizablePanels};
1
+ const DIRECTIONS = ['both', 'horizontal', 'vertical'];
2
+ const HANDLE_POSITIONS = ['bottom-right', 'bottom-left', 'top-right', 'top-left', 'right', 'bottom'];
3
+ class DbResizablePanels extends HTMLElement {
4
+ constructor() {
5
+ super(...arguments);
6
+ this.isResizing = false;
7
+ this.startSize = { width: 0, height: 0 };
8
+ this.startPos = { x: 0, y: 0 };
9
+ this.currentSize = { width: 0, height: 0 };
10
+ this.onMouseDown = (event) => {
11
+ event.preventDefault();
12
+ this.startResize(event.clientX, event.clientY);
13
+ document.addEventListener('mousemove', this.onMouseMove);
14
+ document.addEventListener('mouseup', this.onMouseUp);
15
+ };
16
+ this.onTouchStart = (event) => {
17
+ event.preventDefault();
18
+ const touch = event.touches[0];
19
+ this.startResize(touch.clientX, touch.clientY);
20
+ document.addEventListener('touchmove', this.onTouchMove, { passive: false });
21
+ document.addEventListener('touchend', this.onTouchEnd);
22
+ };
23
+ this.onMouseMove = (event) => {
24
+ this.applyResize(event.clientX, event.clientY);
25
+ };
26
+ this.onTouchMove = (event) => {
27
+ event.preventDefault();
28
+ const touch = event.touches[0];
29
+ this.applyResize(touch.clientX, touch.clientY);
30
+ };
31
+ this.onMouseUp = () => {
32
+ this.endResize();
33
+ document.removeEventListener('mousemove', this.onMouseMove);
34
+ document.removeEventListener('mouseup', this.onMouseUp);
35
+ };
36
+ this.onTouchEnd = () => {
37
+ this.endResize();
38
+ document.removeEventListener('touchmove', this.onTouchMove);
39
+ document.removeEventListener('touchend', this.onTouchEnd);
40
+ };
41
+ }
42
+ static get observedAttributes() {
43
+ return [
44
+ 'initial-width',
45
+ 'initial-height',
46
+ 'min-width',
47
+ 'min-height',
48
+ 'max-width',
49
+ 'max-height',
50
+ 'direction',
51
+ 'handle-position',
52
+ 'handle-size',
53
+ 'handle-color',
54
+ 'handle-hover-color',
55
+ 'snap-to-grid',
56
+ 'show-guides',
57
+ 'show-size-indicator',
58
+ 'show-constraints',
59
+ 'show-border',
60
+ 'shadow',
61
+ 'background-color',
62
+ 'border-radius',
63
+ ];
64
+ }
65
+ connectedCallback() {
66
+ this.ensureStructure();
67
+ this.initializeSize();
68
+ this.render();
69
+ }
70
+ attributeChangedCallback() {
71
+ this.render();
72
+ }
73
+ getBool(name, fallback = false) {
74
+ if (!this.hasAttribute(name))
75
+ return fallback;
76
+ const value = this.getAttribute(name);
77
+ return value === '' || value === 'true';
78
+ }
79
+ getNumber(name, fallback) {
80
+ const value = Number(this.getAttribute(name) ?? fallback);
81
+ return Number.isFinite(value) ? value : fallback;
82
+ }
83
+ getDirection() {
84
+ const value = this.getAttribute('direction');
85
+ return value && DIRECTIONS.includes(value) ? value : 'both';
86
+ }
87
+ getHandlePosition() {
88
+ const value = this.getAttribute('handle-position');
89
+ return value && HANDLE_POSITIONS.includes(value) ? value : 'bottom-right';
90
+ }
91
+ initializeSize() {
92
+ const parentRect = this.parentElement?.getBoundingClientRect();
93
+ if (!parentRect)
94
+ return;
95
+ const initialWidth = this.getAttribute('initial-width') || '100%';
96
+ const initialHeight = this.getAttribute('initial-height') || '100%';
97
+ this.currentSize = {
98
+ width: typeof initialWidth === 'string' && initialWidth.endsWith('%')
99
+ ? (parentRect.width * Number(initialWidth.replace('%', ''))) / 100
100
+ : Number(initialWidth) || parentRect.width,
101
+ height: typeof initialHeight === 'string' && initialHeight.endsWith('%')
102
+ ? (parentRect.height * Number(initialHeight.replace('%', ''))) / 100
103
+ : Number(initialHeight) || parentRect.height,
104
+ };
105
+ }
106
+ getMinSize() {
107
+ return { width: this.getNumber('min-width', 200), height: this.getNumber('min-height', 150) };
108
+ }
109
+ getMaxSize() {
110
+ const parentRect = this.parentElement?.getBoundingClientRect();
111
+ if (!parentRect)
112
+ return { width: Number.POSITIVE_INFINITY, height: Number.POSITIVE_INFINITY };
113
+ const maxWidth = this.getAttribute('max-width') || '100vw';
114
+ const maxHeight = this.getAttribute('max-height') || '100vh';
115
+ const toSize = (value, viewport, parent) => {
116
+ if (value === '100vw' || value === '100vh')
117
+ return viewport;
118
+ if (value === '100%')
119
+ return parent;
120
+ const num = Number(value);
121
+ return Number.isFinite(num) ? num : Number.POSITIVE_INFINITY;
122
+ };
123
+ return {
124
+ width: toSize(maxWidth, window.innerWidth, parentRect.width),
125
+ height: toSize(maxHeight, window.innerHeight, parentRect.height),
126
+ };
127
+ }
128
+ ensureStructure() {
129
+ if (this.container)
130
+ return;
131
+ this.container = document.createElement('div');
132
+ this.container.className = 'designbase-wc-resizable-panels';
133
+ this.guidesEl = document.createElement('div');
134
+ this.guidesEl.className = 'designbase-wc-resizable-panels__guides';
135
+ const hGuide = document.createElement('div');
136
+ hGuide.className = 'designbase-wc-resizable-panels__guide designbase-wc-resizable-panels__guide--horizontal';
137
+ const vGuide = document.createElement('div');
138
+ vGuide.className = 'designbase-wc-resizable-panels__guide designbase-wc-resizable-panels__guide--vertical';
139
+ this.guidesEl.append(hGuide, vGuide);
140
+ this.sizeIndicatorEl = document.createElement('div');
141
+ this.sizeIndicatorEl.className = 'designbase-wc-resizable-panels__size-indicator';
142
+ this.constraintsEl = document.createElement('div');
143
+ this.constraintsEl.className = 'designbase-wc-resizable-panels__constraints';
144
+ this.contentEl = document.createElement('div');
145
+ this.contentEl.className = 'designbase-wc-resizable-panels__content';
146
+ this.handleEl = document.createElement('div');
147
+ this.handleEl.className = 'designbase-wc-resizable-panels__handle';
148
+ this.handleEl.addEventListener('mousedown', this.onMouseDown);
149
+ this.handleEl.addEventListener('touchstart', this.onTouchStart, { passive: false });
150
+ this.container.append(this.guidesEl, this.sizeIndicatorEl, this.constraintsEl, this.contentEl, this.handleEl);
151
+ this.replaceChildren(this.container);
152
+ }
153
+ startResize(x, y) {
154
+ this.isResizing = true;
155
+ this.startSize = { ...this.currentSize };
156
+ this.startPos = { x, y };
157
+ this.dispatchEvent(new CustomEvent('db-resize-start', { detail: this.currentSize, bubbles: true, composed: true }));
158
+ this.render();
159
+ }
160
+ applyResize(clientX, clientY) {
161
+ if (!this.isResizing)
162
+ return;
163
+ const deltaX = clientX - this.startPos.x;
164
+ const deltaY = clientY - this.startPos.y;
165
+ const direction = this.getDirection();
166
+ let width = this.startSize.width;
167
+ let height = this.startSize.height;
168
+ if (direction === 'both' || direction === 'horizontal')
169
+ width += deltaX;
170
+ if (direction === 'both' || direction === 'vertical')
171
+ height += deltaY;
172
+ const snap = this.getNumber('snap-to-grid', 0);
173
+ if (snap > 0) {
174
+ width = Math.round(width / snap) * snap;
175
+ height = Math.round(height / snap) * snap;
176
+ }
177
+ const min = this.getMinSize();
178
+ const max = this.getMaxSize();
179
+ width = Math.max(min.width, Math.min(max.width, width));
180
+ height = Math.max(min.height, Math.min(max.height, height));
181
+ this.currentSize = { width, height };
182
+ this.dispatchEvent(new CustomEvent('db-resize', { detail: this.currentSize, bubbles: true, composed: true }));
183
+ this.dispatchEvent(new CustomEvent('db-size-change', { detail: this.currentSize, bubbles: true, composed: true }));
184
+ this.render();
185
+ }
186
+ endResize() {
187
+ if (!this.isResizing)
188
+ return;
189
+ this.isResizing = false;
190
+ this.dispatchEvent(new CustomEvent('db-resize-end', { detail: this.currentSize, bubbles: true, composed: true }));
191
+ this.render();
192
+ }
193
+ renderHandleStyle() {
194
+ if (!this.handleEl)
195
+ return;
196
+ const direction = this.getDirection();
197
+ const position = this.getHandlePosition();
198
+ const color = this.getAttribute('handle-color');
199
+ const hoverColor = this.getAttribute('handle-hover-color');
200
+ if (color)
201
+ this.handleEl.style.setProperty('--db-resize-handle-color', color);
202
+ else
203
+ this.handleEl.style.removeProperty('--db-resize-handle-color');
204
+ if (hoverColor)
205
+ this.handleEl.style.setProperty('--db-resize-handle-hover-color', hoverColor);
206
+ else
207
+ this.handleEl.style.removeProperty('--db-resize-handle-hover-color');
208
+ this.handleEl.style.top = '';
209
+ this.handleEl.style.right = '';
210
+ this.handleEl.style.bottom = '';
211
+ this.handleEl.style.left = '';
212
+ this.handleEl.style.transform = '';
213
+ this.handleEl.style.width = '';
214
+ this.handleEl.style.height = '';
215
+ this.handleEl.style.backgroundColor = '';
216
+ this.handleEl.onmouseenter = null;
217
+ this.handleEl.onmouseleave = null;
218
+ let variant = `corner-${position}`;
219
+ if (direction === 'vertical') {
220
+ variant = 'edge-bottom';
221
+ }
222
+ else if (direction === 'horizontal') {
223
+ variant = 'edge-right';
224
+ }
225
+ this.handleEl.className = `designbase-wc-resizable-panels__handle designbase-wc-resizable-panels__handle--${variant}`;
226
+ this.handleEl.setAttribute('role', 'separator');
227
+ this.handleEl.setAttribute('aria-label', '크기 조절');
228
+ this.handleEl.replaceChildren();
229
+ }
230
+ render() {
231
+ this.ensureStructure();
232
+ if (!this.container || !this.contentEl || !this.guidesEl || !this.sizeIndicatorEl || !this.constraintsEl)
233
+ return;
234
+ const classes = [
235
+ 'designbase-wc-resizable-panels',
236
+ this.isResizing && 'designbase-wc-resizable-panels--resizing',
237
+ this.getBool('show-border', true) && 'designbase-wc-resizable-panels--border',
238
+ this.getBool('shadow', true) && 'designbase-wc-resizable-panels--shadow',
239
+ ]
240
+ .filter(Boolean)
241
+ .join(' ');
242
+ this.container.className = classes;
243
+ this.container.style.width = `${this.currentSize.width}px`;
244
+ this.container.style.height = `${this.currentSize.height}px`;
245
+ const bg = this.getAttribute('background-color');
246
+ this.container.style.backgroundColor = bg || '';
247
+ const radius = this.getAttribute('border-radius') || '8px';
248
+ this.container.style.borderRadius = /^\d+$/.test(radius) ? `${radius}px` : radius;
249
+ if (this.contentEl.children.length === 0) {
250
+ const childNodes = Array.from(this.childNodes).filter((node) => node !== this.container);
251
+ this.contentEl.append(...childNodes);
252
+ }
253
+ this.guidesEl.style.display = this.getBool('show-guides', true) && this.isResizing ? '' : 'none';
254
+ this.sizeIndicatorEl.style.display = this.getBool('show-size-indicator', true) && this.isResizing ? '' : 'none';
255
+ this.sizeIndicatorEl.textContent = `${Math.round(this.currentSize.width)} × ${Math.round(this.currentSize.height)}`;
256
+ this.constraintsEl.style.display = this.getBool('show-constraints', true) && this.isResizing ? '' : 'none';
257
+ this.constraintsEl.replaceChildren();
258
+ if (this.constraintsEl.style.display !== 'none') {
259
+ const min = this.getMinSize();
260
+ const max = this.getMaxSize();
261
+ if (this.currentSize.width <= min.width)
262
+ this.constraintsEl.append(this.makeConstraint('최소 너비 도달', 'min'));
263
+ if (this.currentSize.height <= min.height)
264
+ this.constraintsEl.append(this.makeConstraint('최소 높이 도달', 'min'));
265
+ if (this.currentSize.width >= max.width)
266
+ this.constraintsEl.append(this.makeConstraint('최대 너비 도달', 'max'));
267
+ if (this.currentSize.height >= max.height)
268
+ this.constraintsEl.append(this.makeConstraint('최대 높이 도달', 'max'));
269
+ }
270
+ this.renderHandleStyle();
271
+ }
272
+ makeConstraint(text, kind) {
273
+ const el = document.createElement('div');
274
+ el.className = `designbase-wc-resizable-panels__constraint designbase-wc-resizable-panels__constraint--${kind}`;
275
+ el.textContent = text;
276
+ return el;
277
+ }
278
+ }
279
+ if (!customElements.get('db-resizable-panels'))
280
+ customElements.define('db-resizable-panels', DbResizablePanels);
281
+
282
+ export { DbResizablePanels };
@@ -1 +1,126 @@
1
- const t=["vertical","horizontal","both"],e=["auto","thin","none"];class DbScrollArea extends HTMLElement{static get observedAttributes(){return["direction","scrollbar-style","max-height","max-width","min-height","min-width","full-width","full-height","always-show-scrollbar","scrollbar-color","scrollbar-track-color"]}connectedCallback(){this.ensureStructure(),this.sync(),this.resizeObserver=new ResizeObserver(()=>{this.syncViewportSize(),this.syncScrollState()}),this.resizeObserver.observe(this),this.contentEl&&this.resizeObserver.observe(this.contentEl),this.observer=new MutationObserver(()=>this.syncChildren()),this.observer.observe(this,{childList:!0,subtree:!0})}disconnectedCallback(){this.resizeObserver?.disconnect(),this.observer?.disconnect()}attributeChangedCallback(){this.isConnected&&this.sync()}ensureStructure(){this.contentEl||(this.contentEl=document.createElement("div"),this.contentEl.className="designbase-wc-scroll-area__content",this.contentEl.setAttribute("data-wc-internal","")),this.contentEl.isConnected||this.append(this.contentEl)}collectContentNodes(){return Array.from(this.children).filter(t=>t!==this.contentEl&&!t.hasAttribute("data-wc-internal"))}syncChildren(){const t=this.collectContentNodes();t.length&&this.contentEl?.append(...t),this.syncScrollState()}toCssSize(t){if(!t)return;if(t.includes("px")||t.includes("%")||t.includes("vh")||t.includes("rem"))return t;const e=Number(t);return Number.isFinite(e)?`${e}px`:t}syncScrollState(){const t=this.contentEl;if(!t)return;const e=t.scrollHeight>t.clientHeight,s=t.scrollWidth>t.clientWidth;this.classList.toggle("designbase-wc-scroll-area--has-vertical",e),this.classList.toggle("designbase-wc-scroll-area--has-horizontal",s)}syncViewportSize(){if(!this.contentEl)return;const t=this.toCssSize(this.getAttribute("max-height"))||this.style.maxHeight||void 0,e=this.toCssSize(this.getAttribute("max-width"))||this.style.maxWidth||void 0,s=this.toCssSize(this.getAttribute("min-height"))||this.style.minHeight||void 0,i=this.toCssSize(this.getAttribute("min-width"))||this.style.minWidth||void 0;this.contentEl.style.maxHeight=t||"",this.contentEl.style.maxWidth=e||"",this.contentEl.style.minHeight=s||"",this.contentEl.style.minWidth=i||""}sync(){this.ensureStructure();const s=this.getAttribute("direction")||"vertical",i=this.getAttribute("scrollbar-style")||"auto",r=t.includes(s)?s:"vertical",l=e.includes(i)?i:"auto";this.className=["designbase-wc-scroll-area",`designbase-wc-scroll-area--direction-${r}`,`designbase-wc-scroll-area--scrollbar-${l}`,this.hasAttribute("full-width")&&"designbase-wc-scroll-area--full-width",this.hasAttribute("full-height")&&"designbase-wc-scroll-area--full-height",this.hasAttribute("always-show-scrollbar")&&"designbase-wc-scroll-area--always-show"].filter(Boolean).join(" ");const c=this.getAttribute("scrollbar-color"),n=this.getAttribute("scrollbar-track-color");c?this.style.setProperty("--scrollbar-color",c):this.style.removeProperty("--scrollbar-color"),n?this.style.setProperty("--scrollbar-track-color",n):this.style.removeProperty("--scrollbar-track-color"),this.syncViewportSize(),this.syncChildren()}}customElements.get("db-scroll-area")||customElements.define("db-scroll-area",DbScrollArea);export{DbScrollArea};
1
+ const DIRECTIONS = ['vertical', 'horizontal', 'both'];
2
+ const SCROLLBAR_STYLES = ['auto', 'thin', 'none'];
3
+ class DbScrollArea extends HTMLElement {
4
+ static get observedAttributes() {
5
+ return [
6
+ 'direction',
7
+ 'scrollbar-style',
8
+ 'max-height',
9
+ 'max-width',
10
+ 'min-height',
11
+ 'min-width',
12
+ 'full-width',
13
+ 'full-height',
14
+ 'always-show-scrollbar',
15
+ 'scrollbar-color',
16
+ 'scrollbar-track-color',
17
+ ];
18
+ }
19
+ connectedCallback() {
20
+ this.ensureStructure();
21
+ this.sync();
22
+ this.resizeObserver = new ResizeObserver(() => {
23
+ this.syncViewportSize();
24
+ this.syncScrollState();
25
+ });
26
+ this.resizeObserver.observe(this);
27
+ if (this.contentEl)
28
+ this.resizeObserver.observe(this.contentEl);
29
+ this.observer = new MutationObserver(() => this.syncChildren());
30
+ this.observer.observe(this, { childList: true, subtree: true });
31
+ }
32
+ disconnectedCallback() {
33
+ this.resizeObserver?.disconnect();
34
+ this.observer?.disconnect();
35
+ }
36
+ attributeChangedCallback() {
37
+ if (this.isConnected)
38
+ this.sync();
39
+ }
40
+ ensureStructure() {
41
+ if (!this.contentEl) {
42
+ this.contentEl = document.createElement('div');
43
+ this.contentEl.className = 'designbase-wc-scroll-area__content';
44
+ this.contentEl.setAttribute('data-wc-internal', '');
45
+ }
46
+ if (!this.contentEl.isConnected) {
47
+ this.append(this.contentEl);
48
+ }
49
+ }
50
+ collectContentNodes() {
51
+ return Array.from(this.children).filter((child) => child !== this.contentEl && !child.hasAttribute('data-wc-internal'));
52
+ }
53
+ syncChildren() {
54
+ const nodes = this.collectContentNodes();
55
+ if (nodes.length) {
56
+ this.contentEl?.append(...nodes);
57
+ }
58
+ this.syncScrollState();
59
+ }
60
+ toCssSize(value) {
61
+ if (!value)
62
+ return undefined;
63
+ if (value.includes('px') || value.includes('%') || value.includes('vh') || value.includes('rem')) {
64
+ return value;
65
+ }
66
+ const numeric = Number(value);
67
+ return Number.isFinite(numeric) ? `${numeric}px` : value;
68
+ }
69
+ syncScrollState() {
70
+ const viewport = this.contentEl;
71
+ if (!viewport)
72
+ return;
73
+ const hasVertical = viewport.scrollHeight > viewport.clientHeight;
74
+ const hasHorizontal = viewport.scrollWidth > viewport.clientWidth;
75
+ this.classList.toggle('designbase-wc-scroll-area--has-vertical', hasVertical);
76
+ this.classList.toggle('designbase-wc-scroll-area--has-horizontal', hasHorizontal);
77
+ }
78
+ syncViewportSize() {
79
+ if (!this.contentEl)
80
+ return;
81
+ const maxHeight = this.toCssSize(this.getAttribute('max-height')) || this.style.maxHeight || undefined;
82
+ const maxWidth = this.toCssSize(this.getAttribute('max-width')) || this.style.maxWidth || undefined;
83
+ const minHeight = this.toCssSize(this.getAttribute('min-height')) || this.style.minHeight || undefined;
84
+ const minWidth = this.toCssSize(this.getAttribute('min-width')) || this.style.minWidth || undefined;
85
+ this.contentEl.style.maxHeight = maxHeight || '';
86
+ this.contentEl.style.maxWidth = maxWidth || '';
87
+ this.contentEl.style.minHeight = minHeight || '';
88
+ this.contentEl.style.minWidth = minWidth || '';
89
+ }
90
+ sync() {
91
+ this.ensureStructure();
92
+ const direction = this.getAttribute('direction') || 'vertical';
93
+ const scrollbarStyle = this.getAttribute('scrollbar-style') || 'auto';
94
+ const safeDirection = DIRECTIONS.includes(direction) ? direction : 'vertical';
95
+ const safeScrollbar = SCROLLBAR_STYLES.includes(scrollbarStyle)
96
+ ? scrollbarStyle
97
+ : 'auto';
98
+ this.className = [
99
+ 'designbase-wc-scroll-area',
100
+ `designbase-wc-scroll-area--direction-${safeDirection}`,
101
+ `designbase-wc-scroll-area--scrollbar-${safeScrollbar}`,
102
+ this.hasAttribute('full-width') && 'designbase-wc-scroll-area--full-width',
103
+ this.hasAttribute('full-height') && 'designbase-wc-scroll-area--full-height',
104
+ this.hasAttribute('always-show-scrollbar') && 'designbase-wc-scroll-area--always-show',
105
+ ]
106
+ .filter(Boolean)
107
+ .join(' ');
108
+ const scrollbarColor = this.getAttribute('scrollbar-color');
109
+ const scrollbarTrackColor = this.getAttribute('scrollbar-track-color');
110
+ if (scrollbarColor)
111
+ this.style.setProperty('--scrollbar-color', scrollbarColor);
112
+ else
113
+ this.style.removeProperty('--scrollbar-color');
114
+ if (scrollbarTrackColor)
115
+ this.style.setProperty('--scrollbar-track-color', scrollbarTrackColor);
116
+ else
117
+ this.style.removeProperty('--scrollbar-track-color');
118
+ this.syncViewportSize();
119
+ this.syncChildren();
120
+ }
121
+ }
122
+ if (!customElements.get('db-scroll-area')) {
123
+ customElements.define('db-scroll-area', DbScrollArea);
124
+ }
125
+
126
+ export { DbScrollArea };