@designbasekorea/ui-wc 0.5.6 → 0.6.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 (202) hide show
  1. package/dist/chunks/lottie-0e23d630.js +1 -0
  2. package/dist/esm/components/animation-background/canvas-controller.js +1 -121
  3. package/dist/esm/components/animation-background/controls.js +1 -180
  4. package/dist/esm/components/animation-background/graphite-controller.js +1 -196
  5. package/dist/esm/components/animation-background/graphite-presets.js +1 -42
  6. package/dist/esm/components/animation-background/graphite-shader.js +1 -111
  7. package/dist/esm/components/animation-background/layers.js +1 -369
  8. package/dist/esm/components/animation-background/lumina-presets.js +1 -53
  9. package/dist/esm/components/animation-background/lumina-shaders.js +1 -181
  10. package/dist/esm/components/animation-background/lumina-utils.js +1 -60
  11. package/dist/esm/components/animation-background/particle-defaults.js +1 -36
  12. package/dist/esm/components/animation-background/renderers.js +1 -167
  13. package/dist/esm/components/animation-background/shader-controller.js +1 -154
  14. package/dist/esm/components/color-picker-utils.js +1 -134
  15. package/dist/esm/components/date-picker-utils.js +1 -140
  16. package/dist/esm/components/db-accordion.js +1 -304
  17. package/dist/esm/components/db-ad-banner.js +1 -455
  18. package/dist/esm/components/db-ai-chat-list.d.ts +43 -0
  19. package/dist/esm/components/db-ai-chat-list.js +1 -0
  20. package/dist/esm/components/db-ai-chat.d.ts +159 -0
  21. package/dist/esm/components/db-ai-chat.js +1 -0
  22. package/dist/esm/components/db-alert.js +1 -149
  23. package/dist/esm/components/db-animation-background.js +1 -486
  24. package/dist/esm/components/db-animation-text.js +1 -601
  25. package/dist/esm/components/db-app-badge.js +1 -88
  26. package/dist/esm/components/db-audio-player.js +1 -752
  27. package/dist/esm/components/db-avatar.js +1 -188
  28. package/dist/esm/components/db-backdrop.js +1 -139
  29. package/dist/esm/components/db-badge.js +1 -91
  30. package/dist/esm/components/db-banner.js +1 -188
  31. package/dist/esm/components/db-bottom-navigation.js +1 -146
  32. package/dist/esm/components/db-bottom-sheet.js +1 -481
  33. package/dist/esm/components/db-breadcrumbs.js +1 -329
  34. package/dist/esm/components/db-button.js +1 -316
  35. package/dist/esm/components/db-calendar.js +1 -675
  36. package/dist/esm/components/db-card.js +1 -265
  37. package/dist/esm/components/db-carousel.js +1 -264
  38. package/dist/esm/components/db-chat-composer.d.ts +134 -0
  39. package/dist/esm/components/db-chat-composer.js +1 -0
  40. package/dist/esm/components/db-chat-list.d.ts +47 -0
  41. package/dist/esm/components/db-chat-list.js +1 -0
  42. package/dist/esm/components/db-chat-message.d.ts +39 -0
  43. package/dist/esm/components/db-chat-message.js +1 -0
  44. package/dist/esm/components/db-chat-orb.d.ts +99 -0
  45. package/dist/esm/components/db-chat-orb.js +1 -0
  46. package/dist/esm/components/db-chat-room.d.ts +71 -0
  47. package/dist/esm/components/db-chat-room.js +1 -0
  48. package/dist/esm/components/db-chat-suggestions.d.ts +44 -0
  49. package/dist/esm/components/db-chat-suggestions.js +1 -0
  50. package/dist/esm/components/db-chat-typing.d.ts +22 -0
  51. package/dist/esm/components/db-chat-typing.js +1 -0
  52. package/dist/esm/components/db-chat-welcome.d.ts +32 -0
  53. package/dist/esm/components/db-chat-welcome.js +1 -0
  54. package/dist/esm/components/db-chat-widget.d.ts +146 -0
  55. package/dist/esm/components/db-chat-widget.js +1 -0
  56. package/dist/esm/components/db-checkbox.js +1 -202
  57. package/dist/esm/components/db-chip.js +1 -104
  58. package/dist/esm/components/db-code-block.js +1 -304
  59. package/dist/esm/components/db-color-picker.js +1 -746
  60. package/dist/esm/components/db-confirm.js +1 -191
  61. package/dist/esm/components/db-container.js +1 -39
  62. package/dist/esm/components/db-context-menu.js +1 -265
  63. package/dist/esm/components/db-countdown.js +1 -146
  64. package/dist/esm/components/db-cursor-follower.js +1 -173
  65. package/dist/esm/components/db-date-picker.js +1 -837
  66. package/dist/esm/components/db-divider.js +1 -66
  67. package/dist/esm/components/db-download-progress.d.ts +89 -0
  68. package/dist/esm/components/db-download-progress.js +1 -0
  69. package/dist/esm/components/db-drawer.js +1 -245
  70. package/dist/esm/components/db-dropdown.js +1 -493
  71. package/dist/esm/components/db-dropzone.js +1 -266
  72. package/dist/esm/components/db-email-verify.d.ts +62 -0
  73. package/dist/esm/components/db-email-verify.js +1 -0
  74. package/dist/esm/components/db-empty-state.js +1 -97
  75. package/dist/esm/components/db-file-uploader.js +1 -256
  76. package/dist/esm/components/db-floating-action-button.js +1 -139
  77. package/dist/esm/components/db-footer.js +1 -385
  78. package/dist/esm/components/db-form.js +1 -566
  79. package/dist/esm/components/db-gantt.js +1 -882
  80. package/dist/esm/components/db-gradient.js +1 -133
  81. package/dist/esm/components/db-grid-background.js +1 -909
  82. package/dist/esm/components/db-grid.js +1 -73
  83. package/dist/esm/components/db-icons.d.ts +3 -0
  84. package/dist/esm/components/db-icons.js +1 -82
  85. package/dist/esm/components/db-image-list.js +1 -214
  86. package/dist/esm/components/db-image-placeholder.js +1 -96
  87. package/dist/esm/components/db-image.js +1 -289
  88. package/dist/esm/components/db-indicator.js +1 -517
  89. package/dist/esm/components/db-input.js +1 -420
  90. package/dist/esm/components/db-kanban.js +1 -538
  91. package/dist/esm/components/db-label.js +1 -66
  92. package/dist/esm/components/db-lightbox.js +1 -372
  93. package/dist/esm/components/db-list.js +1 -340
  94. package/dist/esm/components/db-logo-svg.js +1 -72
  95. package/dist/esm/components/db-logo.js +1 -106
  96. package/dist/esm/components/db-lottie.js +1 -109
  97. package/dist/esm/components/db-markdown-editor.js +1 -458
  98. package/dist/esm/components/db-marquee.js +1 -402
  99. package/dist/esm/components/db-masonry.js +1 -94
  100. package/dist/esm/components/db-menu-item.js +1 -211
  101. package/dist/esm/components/db-modal.js +1 -522
  102. package/dist/esm/components/db-navbar.js +1 -680
  103. package/dist/esm/components/db-onboarding-modal.js +1 -322
  104. package/dist/esm/components/db-otp-input.d.ts +53 -0
  105. package/dist/esm/components/db-otp-input.js +1 -0
  106. package/dist/esm/components/db-page-header.js +1 -312
  107. package/dist/esm/components/db-pagination.js +1 -271
  108. package/dist/esm/components/db-phone-verify.d.ts +61 -0
  109. package/dist/esm/components/db-phone-verify.js +1 -0
  110. package/dist/esm/components/db-popover.js +1 -580
  111. package/dist/esm/components/db-progress-step.js +1 -166
  112. package/dist/esm/components/db-progress.js +1 -171
  113. package/dist/esm/components/db-progressbar.js +1 -72
  114. package/dist/esm/components/db-radio.js +1 -172
  115. package/dist/esm/components/db-random-gradient.js +1 -121
  116. package/dist/esm/components/db-range-slider.js +1 -811
  117. package/dist/esm/components/db-rating.js +1 -325
  118. package/dist/esm/components/db-reorder.js +1 -286
  119. package/dist/esm/components/db-resizable-panels.js +1 -282
  120. package/dist/esm/components/db-scroll-area.js +1 -126
  121. package/dist/esm/components/db-search-bar.js +1 -668
  122. package/dist/esm/components/db-section-app-download.js +1 -101
  123. package/dist/esm/components/db-section-contact.js +1 -102
  124. package/dist/esm/components/db-section-cta.js +1 -150
  125. package/dist/esm/components/db-section-faq.js +1 -120
  126. package/dist/esm/components/db-section-feature-grid.js +1 -137
  127. package/dist/esm/components/db-section-feature.js +1 -179
  128. package/dist/esm/components/db-section-hero.js +1 -243
  129. package/dist/esm/components/db-section-logo-cloud.js +1 -138
  130. package/dist/esm/components/db-section-pricing.js +1 -166
  131. package/dist/esm/components/db-section-stats.js +1 -129
  132. package/dist/esm/components/db-section-testimonials.js +1 -252
  133. package/dist/esm/components/db-section.js +1 -385
  134. package/dist/esm/components/db-segment-control.js +1 -231
  135. package/dist/esm/components/db-select.js +1 -571
  136. package/dist/esm/components/db-share-icons.js +1 -40
  137. package/dist/esm/components/db-share.js +1 -489
  138. package/dist/esm/components/db-sidebar.js +1 -1068
  139. package/dist/esm/components/db-skeleton.js +1 -94
  140. package/dist/esm/components/db-spinner.js +1 -102
  141. package/dist/esm/components/db-split-view.js +1 -297
  142. package/dist/esm/components/db-stack.js +1 -46
  143. package/dist/esm/components/db-stat.js +1 -218
  144. package/dist/esm/components/db-stepper.js +1 -398
  145. package/dist/esm/components/db-table.js +1 -412
  146. package/dist/esm/components/db-tabs.js +1 -335
  147. package/dist/esm/components/db-testimonial.d.ts +2 -0
  148. package/dist/esm/components/db-testimonial.js +1 -162
  149. package/dist/esm/components/db-textarea.js +1 -233
  150. package/dist/esm/components/db-time-picker.js +1 -523
  151. package/dist/esm/components/db-timeline.js +1 -174
  152. package/dist/esm/components/db-toast.js +1 -158
  153. package/dist/esm/components/db-toggle.js +1 -162
  154. package/dist/esm/components/db-toolbar.js +1 -94
  155. package/dist/esm/components/db-tooltip.js +1 -440
  156. package/dist/esm/components/db-top-banner.js +1 -121
  157. package/dist/esm/components/db-tutorial.js +1 -324
  158. package/dist/esm/components/db-two-factor.d.ts +60 -0
  159. package/dist/esm/components/db-two-factor.js +1 -0
  160. package/dist/esm/components/db-video-player.js +1 -503
  161. package/dist/esm/components/db-youtube-player.js +1 -194
  162. package/dist/esm/components/highlight-code.js +1 -65
  163. package/dist/esm/components/input-validation.js +1 -50
  164. package/dist/esm/components/marketing-block-host-utils.js +1 -9
  165. package/dist/esm/components/number-scrub.js +1 -117
  166. package/dist/esm/components/random-gradient-palettes.js +1 -67
  167. package/dist/esm/components/section-block-header-utils.js +1 -48
  168. package/dist/esm/helpers/confirm.js +1 -52
  169. package/dist/esm/helpers/toast.js +1 -73
  170. package/dist/esm/index.d.ts +16 -0
  171. package/dist/esm/index.js +1 -111
  172. package/dist/esm/node_modules/.pnpm/prismjs@1.30.0/node_modules/prismjs/components/prism-bash.js +1 -0
  173. package/dist/esm/node_modules/.pnpm/prismjs@1.30.0/node_modules/prismjs/components/prism-clike.js +1 -0
  174. package/dist/esm/node_modules/.pnpm/prismjs@1.30.0/node_modules/prismjs/components/prism-css.js +1 -0
  175. package/dist/esm/node_modules/.pnpm/prismjs@1.30.0/node_modules/prismjs/components/prism-javascript.js +1 -0
  176. package/dist/esm/node_modules/.pnpm/prismjs@1.30.0/node_modules/prismjs/components/prism-json.js +1 -0
  177. package/dist/esm/node_modules/.pnpm/prismjs@1.30.0/node_modules/prismjs/components/prism-jsx.js +1 -0
  178. package/dist/esm/node_modules/.pnpm/prismjs@1.30.0/node_modules/prismjs/components/prism-markup.js +1 -0
  179. package/dist/esm/node_modules/.pnpm/prismjs@1.30.0/node_modules/prismjs/components/prism-scss.js +1 -0
  180. package/dist/esm/node_modules/.pnpm/prismjs@1.30.0/node_modules/prismjs/components/prism-tsx.js +1 -0
  181. package/dist/esm/node_modules/.pnpm/prismjs@1.30.0/node_modules/prismjs/components/prism-typescript.js +1 -0
  182. package/dist/index.cjs +1 -55414
  183. package/dist/index.css +1 -1
  184. package/dist/index.d.ts +1091 -2
  185. package/dist/index.esm.js +1 -38284
  186. package/dist/react/chunks/lottie-14e7addb.js +1 -0
  187. package/dist/react/index.cjs +1 -56503
  188. package/dist/react/index.d.ts +1620 -54
  189. package/dist/react/index.esm.js +1 -39373
  190. package/package.json +1 -1
  191. package/dist/chunks/lottie-e273b936.js +0 -17032
  192. package/dist/esm/node_modules/prismjs/components/prism-bash.js +0 -235
  193. package/dist/esm/node_modules/prismjs/components/prism-clike.js +0 -31
  194. package/dist/esm/node_modules/prismjs/components/prism-css.js +0 -64
  195. package/dist/esm/node_modules/prismjs/components/prism-javascript.js +0 -172
  196. package/dist/esm/node_modules/prismjs/components/prism-json.js +0 -27
  197. package/dist/esm/node_modules/prismjs/components/prism-jsx.js +0 -143
  198. package/dist/esm/node_modules/prismjs/components/prism-markup.js +0 -186
  199. package/dist/esm/node_modules/prismjs/components/prism-scss.js +0 -81
  200. package/dist/esm/node_modules/prismjs/components/prism-tsx.js +0 -15
  201. package/dist/esm/node_modules/prismjs/components/prism-typescript.js +0 -60
  202. package/dist/react/chunks/lottie-72a4c6d4.js +0 -17032
@@ -1,282 +1 @@
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
+ 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,126 +1 @@
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 };
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};