@designbasekorea/ui-wc 0.5.5 → 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.
- package/dist/chunks/lottie-e273b936.js +17032 -0
- package/dist/esm/components/animation-background/canvas-controller.js +121 -1
- package/dist/esm/components/animation-background/controls.js +180 -1
- package/dist/esm/components/animation-background/graphite-controller.js +196 -1
- package/dist/esm/components/animation-background/graphite-presets.js +42 -1
- package/dist/esm/components/animation-background/graphite-shader.js +111 -1
- package/dist/esm/components/animation-background/layers.js +369 -1
- package/dist/esm/components/animation-background/lumina-presets.js +53 -1
- package/dist/esm/components/animation-background/lumina-shaders.js +181 -1
- package/dist/esm/components/animation-background/lumina-utils.js +60 -1
- package/dist/esm/components/animation-background/particle-defaults.js +36 -1
- package/dist/esm/components/animation-background/renderers.js +167 -1
- package/dist/esm/components/animation-background/shader-controller.js +154 -1
- package/dist/esm/components/color-picker-utils.js +134 -1
- package/dist/esm/components/date-picker-utils.js +140 -1
- package/dist/esm/components/db-accordion.js +304 -1
- package/dist/esm/components/db-ad-banner.js +455 -1
- package/dist/esm/components/db-alert.js +149 -1
- package/dist/esm/components/db-animation-background.js +486 -1
- package/dist/esm/components/db-animation-text.js +601 -1
- package/dist/esm/components/db-app-badge.js +88 -1
- package/dist/esm/components/db-audio-player.js +752 -1
- package/dist/esm/components/db-avatar.js +188 -1
- package/dist/esm/components/db-backdrop.js +139 -1
- package/dist/esm/components/db-badge.js +91 -1
- package/dist/esm/components/db-banner.js +188 -1
- package/dist/esm/components/db-bottom-navigation.js +146 -1
- package/dist/esm/components/db-bottom-sheet.js +481 -1
- package/dist/esm/components/db-breadcrumbs.js +329 -1
- package/dist/esm/components/db-button.js +316 -1
- package/dist/esm/components/db-calendar.js +675 -1
- package/dist/esm/components/db-card.js +265 -1
- package/dist/esm/components/db-carousel.js +264 -1
- package/dist/esm/components/db-checkbox.js +202 -1
- package/dist/esm/components/db-chip.js +104 -1
- package/dist/esm/components/db-code-block.js +304 -1
- package/dist/esm/components/db-color-picker.js +746 -1
- package/dist/esm/components/db-confirm.js +191 -1
- package/dist/esm/components/db-container.js +39 -1
- package/dist/esm/components/db-context-menu.js +265 -1
- package/dist/esm/components/db-countdown.js +146 -1
- package/dist/esm/components/db-cursor-follower.js +173 -1
- package/dist/esm/components/db-date-picker.js +837 -1
- package/dist/esm/components/db-divider.js +66 -1
- package/dist/esm/components/db-drawer.js +245 -1
- package/dist/esm/components/db-dropdown.js +493 -1
- package/dist/esm/components/db-dropzone.js +266 -1
- package/dist/esm/components/db-empty-state.js +97 -1
- package/dist/esm/components/db-file-uploader.js +256 -1
- package/dist/esm/components/db-floating-action-button.js +139 -1
- package/dist/esm/components/db-footer.js +385 -1
- package/dist/esm/components/db-form.js +566 -1
- package/dist/esm/components/db-gantt.js +882 -1
- package/dist/esm/components/db-gradient.js +133 -1
- package/dist/esm/components/db-grid-background.js +909 -1
- package/dist/esm/components/db-grid.js +73 -1
- package/dist/esm/components/db-icons.js +82 -1
- package/dist/esm/components/db-image-list.js +214 -1
- package/dist/esm/components/db-image-placeholder.js +96 -1
- package/dist/esm/components/db-image.js +289 -1
- package/dist/esm/components/db-indicator.js +517 -1
- package/dist/esm/components/db-input.js +420 -1
- package/dist/esm/components/db-kanban.js +538 -1
- package/dist/esm/components/db-label.js +66 -1
- package/dist/esm/components/db-lightbox.js +372 -1
- package/dist/esm/components/db-list.js +340 -1
- package/dist/esm/components/db-logo-svg.js +72 -1
- package/dist/esm/components/db-logo.js +106 -1
- package/dist/esm/components/db-lottie.js +109 -1
- package/dist/esm/components/db-markdown-editor.js +458 -1
- package/dist/esm/components/db-marquee.js +402 -1
- package/dist/esm/components/db-masonry.js +94 -1
- package/dist/esm/components/db-menu-item.js +211 -1
- package/dist/esm/components/db-modal.js +522 -1
- package/dist/esm/components/db-navbar.js +680 -1
- package/dist/esm/components/db-onboarding-modal.js +322 -1
- package/dist/esm/components/db-page-header.js +312 -1
- package/dist/esm/components/db-pagination.js +271 -1
- package/dist/esm/components/db-popover.js +580 -1
- package/dist/esm/components/db-progress-step.js +166 -1
- package/dist/esm/components/db-progress.js +171 -1
- package/dist/esm/components/db-progressbar.js +72 -1
- package/dist/esm/components/db-radio.js +172 -1
- package/dist/esm/components/db-random-gradient.js +121 -1
- package/dist/esm/components/db-range-slider.js +811 -1
- package/dist/esm/components/db-rating.js +325 -1
- package/dist/esm/components/db-reorder.js +286 -1
- package/dist/esm/components/db-resizable-panels.js +282 -1
- package/dist/esm/components/db-scroll-area.js +126 -1
- package/dist/esm/components/db-search-bar.js +668 -1
- package/dist/esm/components/db-section-app-download.js +101 -1
- package/dist/esm/components/db-section-contact.js +102 -1
- package/dist/esm/components/db-section-cta.js +150 -1
- package/dist/esm/components/db-section-faq.js +120 -1
- package/dist/esm/components/db-section-feature-grid.js +137 -1
- package/dist/esm/components/db-section-feature.js +179 -1
- package/dist/esm/components/db-section-hero.js +243 -1
- package/dist/esm/components/db-section-logo-cloud.js +138 -1
- package/dist/esm/components/db-section-pricing.js +166 -1
- package/dist/esm/components/db-section-stats.js +129 -1
- package/dist/esm/components/db-section-testimonials.js +252 -1
- package/dist/esm/components/db-section.js +385 -1
- package/dist/esm/components/db-segment-control.js +231 -1
- package/dist/esm/components/db-select.js +571 -1
- package/dist/esm/components/db-share-icons.js +40 -1
- package/dist/esm/components/db-share.js +489 -1
- package/dist/esm/components/db-sidebar.js +1068 -1
- package/dist/esm/components/db-skeleton.js +94 -1
- package/dist/esm/components/db-spinner.js +102 -1
- package/dist/esm/components/db-split-view.js +297 -1
- package/dist/esm/components/db-stack.js +46 -1
- package/dist/esm/components/db-stat.js +218 -1
- package/dist/esm/components/db-stepper.js +398 -1
- package/dist/esm/components/db-table.js +412 -1
- package/dist/esm/components/db-tabs.js +335 -1
- package/dist/esm/components/db-testimonial.js +162 -1
- package/dist/esm/components/db-textarea.js +233 -1
- package/dist/esm/components/db-time-picker.js +523 -1
- package/dist/esm/components/db-timeline.js +174 -1
- package/dist/esm/components/db-toast.js +158 -1
- package/dist/esm/components/db-toggle.js +162 -1
- package/dist/esm/components/db-toolbar.js +94 -1
- package/dist/esm/components/db-tooltip.js +440 -1
- package/dist/esm/components/db-top-banner.js +121 -1
- package/dist/esm/components/db-tutorial.js +324 -1
- package/dist/esm/components/db-video-player.js +503 -1
- package/dist/esm/components/db-youtube-player.js +194 -1
- package/dist/esm/components/highlight-code.js +65 -1
- package/dist/esm/components/input-validation.js +50 -1
- package/dist/esm/components/marketing-block-host-utils.js +9 -1
- package/dist/esm/components/number-scrub.js +117 -1
- package/dist/esm/components/random-gradient-palettes.js +67 -1
- package/dist/esm/components/section-block-header-utils.js +48 -1
- package/dist/esm/helpers/confirm.js +52 -1
- package/dist/esm/helpers/toast.js +73 -1
- package/dist/esm/index.js +111 -1
- package/dist/esm/node_modules/prismjs/components/prism-bash.js +235 -1
- package/dist/esm/node_modules/prismjs/components/prism-clike.js +31 -1
- package/dist/esm/node_modules/prismjs/components/prism-css.js +64 -1
- package/dist/esm/node_modules/prismjs/components/prism-javascript.js +172 -1
- package/dist/esm/node_modules/prismjs/components/prism-json.js +27 -1
- package/dist/esm/node_modules/prismjs/components/prism-jsx.js +143 -1
- package/dist/esm/node_modules/prismjs/components/prism-markup.js +186 -1
- package/dist/esm/node_modules/prismjs/components/prism-scss.js +81 -1
- package/dist/esm/node_modules/prismjs/components/prism-tsx.js +15 -1
- package/dist/esm/node_modules/prismjs/components/prism-typescript.js +60 -1
- package/dist/index.cjs +55414 -1
- package/dist/index.css +1 -1
- package/dist/index.esm.js +38284 -1
- package/dist/react/chunks/lottie-72a4c6d4.js +17032 -0
- package/dist/react/index.cjs +56503 -1
- package/dist/react/index.esm.js +39373 -1
- package/package.json +1 -1
- package/dist/chunks/lottie-2637aa0f.js +0 -1
- package/dist/react/chunks/lottie-14e7addb.js +0 -1
|
@@ -1 +1,173 @@
|
|
|
1
|
-
import{createDbIcon
|
|
1
|
+
import { createDbIcon } from './db-icons.js';
|
|
2
|
+
|
|
3
|
+
const CLASS = 'designbase-wc-cursor-follower';
|
|
4
|
+
const HIDE_CLASS = 'designbase-wc-cursor-follower--hide-native';
|
|
5
|
+
const DESKTOP_MEDIA = '(pointer: fine) and (hover: hover) and (min-width: 769px)';
|
|
6
|
+
const DEFAULT_SELECTOR = 'a[href], button:not(:disabled), [role="button"]:not([aria-disabled="true"]), [data-cursor], [data-cursor-label], input[type="submit"], input[type="button"]';
|
|
7
|
+
function getLabelFromElement(el, defaultLabel) {
|
|
8
|
+
return (el.getAttribute('data-cursor-label') ||
|
|
9
|
+
el.getAttribute('data-cursor') ||
|
|
10
|
+
el.getAttribute('aria-label') ||
|
|
11
|
+
defaultLabel);
|
|
12
|
+
}
|
|
13
|
+
function parseOffset(raw) {
|
|
14
|
+
if (!raw)
|
|
15
|
+
return { x: 18, y: 18 };
|
|
16
|
+
try {
|
|
17
|
+
const parsed = JSON.parse(raw);
|
|
18
|
+
return {
|
|
19
|
+
x: Number(parsed.x ?? 18),
|
|
20
|
+
y: Number(parsed.y ?? 18),
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
const [x, y] = raw.split(',').map((v) => Number(v.trim()));
|
|
25
|
+
return {
|
|
26
|
+
x: Number.isFinite(x) ? x : 18,
|
|
27
|
+
y: Number.isFinite(y) ? y : 18,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
class DbCursorFollower extends HTMLElement {
|
|
32
|
+
constructor() {
|
|
33
|
+
super(...arguments);
|
|
34
|
+
this.target = { x: -9999, y: -9999 };
|
|
35
|
+
this.current = { x: -9999, y: -9999 };
|
|
36
|
+
this.raf = 0;
|
|
37
|
+
this.enabled = false;
|
|
38
|
+
this.isScoped = false;
|
|
39
|
+
}
|
|
40
|
+
static get observedAttributes() {
|
|
41
|
+
return [
|
|
42
|
+
'default-label',
|
|
43
|
+
'selector',
|
|
44
|
+
'smoothness',
|
|
45
|
+
'offset',
|
|
46
|
+
'hide-native-cursor',
|
|
47
|
+
'show-icon',
|
|
48
|
+
];
|
|
49
|
+
}
|
|
50
|
+
connectedCallback() {
|
|
51
|
+
this.style.display = 'contents';
|
|
52
|
+
this.setupDesktopGate();
|
|
53
|
+
}
|
|
54
|
+
disconnectedCallback() {
|
|
55
|
+
this.teardown();
|
|
56
|
+
}
|
|
57
|
+
attributeChangedCallback() {
|
|
58
|
+
if (this.isConnected && this.enabled)
|
|
59
|
+
this.mountLayer();
|
|
60
|
+
}
|
|
61
|
+
setupDesktopGate() {
|
|
62
|
+
if (typeof window === 'undefined')
|
|
63
|
+
return;
|
|
64
|
+
this.desktopMq = window.matchMedia(DESKTOP_MEDIA);
|
|
65
|
+
this.onDesktopChange = () => {
|
|
66
|
+
const next = this.desktopMq?.matches ?? false;
|
|
67
|
+
if (next === this.enabled)
|
|
68
|
+
return;
|
|
69
|
+
this.enabled = next;
|
|
70
|
+
if (next) {
|
|
71
|
+
this.mountLayer();
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
this.teardownLayer();
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
this.onDesktopChange();
|
|
78
|
+
this.desktopMq.addEventListener('change', this.onDesktopChange);
|
|
79
|
+
}
|
|
80
|
+
updateScope() {
|
|
81
|
+
// 이 커스텀 엘리먼트는 Shadow DOM을 쓰지 않으므로, light DOM 자식이
|
|
82
|
+
// 있으면 엘리먼트 자신(this)이 곧 스코프가 된다. 자식이 없으면 전역 모드.
|
|
83
|
+
this.isScoped = this.childElementCount > 0 || !!this.textContent?.trim();
|
|
84
|
+
}
|
|
85
|
+
isInScope(el) {
|
|
86
|
+
if (!el)
|
|
87
|
+
return false;
|
|
88
|
+
if (!this.isScoped)
|
|
89
|
+
return true;
|
|
90
|
+
return this.contains(el);
|
|
91
|
+
}
|
|
92
|
+
mountLayer() {
|
|
93
|
+
this.teardownLayer();
|
|
94
|
+
this.updateScope();
|
|
95
|
+
const defaultLabel = this.getAttribute('default-label') || 'See the project';
|
|
96
|
+
const selector = this.getAttribute('selector') || DEFAULT_SELECTOR;
|
|
97
|
+
const smoothness = Math.min(1, Math.max(0.05, Number(this.getAttribute('smoothness') || 0.14)));
|
|
98
|
+
const offset = parseOffset(this.getAttribute('offset'));
|
|
99
|
+
const hideNativeCursor = this.hasAttribute('hide-native-cursor') && this.getAttribute('hide-native-cursor') !== 'false';
|
|
100
|
+
const showIcon = !this.hasAttribute('show-icon') || this.getAttribute('show-icon') !== 'false';
|
|
101
|
+
if (hideNativeCursor) {
|
|
102
|
+
document.documentElement.classList.add(HIDE_CLASS);
|
|
103
|
+
}
|
|
104
|
+
this.portalRoot = document.createElement('div');
|
|
105
|
+
this.portalRoot.className = CLASS;
|
|
106
|
+
this.portalRoot.setAttribute('aria-hidden', 'true');
|
|
107
|
+
this.pillEl = document.createElement('div');
|
|
108
|
+
this.pillEl.className = `${CLASS}__pill`;
|
|
109
|
+
this.labelEl = document.createElement('span');
|
|
110
|
+
this.labelEl.textContent = defaultLabel;
|
|
111
|
+
this.pillEl.appendChild(this.labelEl);
|
|
112
|
+
if (showIcon) {
|
|
113
|
+
this.iconEl = document.createElement('span');
|
|
114
|
+
this.iconEl.className = `${CLASS}__icon`;
|
|
115
|
+
this.iconEl.appendChild(createDbIcon('arrow-right', 14));
|
|
116
|
+
this.pillEl.appendChild(this.iconEl);
|
|
117
|
+
}
|
|
118
|
+
this.portalRoot.appendChild(this.pillEl);
|
|
119
|
+
document.body.appendChild(this.portalRoot);
|
|
120
|
+
this.onMouseMove = (event) => {
|
|
121
|
+
this.target = {
|
|
122
|
+
x: event.clientX + offset.x,
|
|
123
|
+
y: event.clientY + offset.y,
|
|
124
|
+
};
|
|
125
|
+
const hit = document.elementFromPoint(event.clientX, event.clientY);
|
|
126
|
+
const interactive = hit?.closest(selector) ?? null;
|
|
127
|
+
if (this.isInScope(interactive) && interactive) {
|
|
128
|
+
if (this.labelEl)
|
|
129
|
+
this.labelEl.textContent = getLabelFromElement(interactive, defaultLabel);
|
|
130
|
+
this.pillEl?.classList.add(`${CLASS}__pill--visible`);
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
this.pillEl?.classList.remove(`${CLASS}__pill--visible`);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
window.addEventListener('mousemove', this.onMouseMove, { passive: true });
|
|
137
|
+
const tick = () => {
|
|
138
|
+
this.current.x += (this.target.x - this.current.x) * smoothness;
|
|
139
|
+
this.current.y += (this.target.y - this.current.y) * smoothness;
|
|
140
|
+
if (this.portalRoot) {
|
|
141
|
+
this.portalRoot.style.transform = `translate3d(${this.current.x}px, ${this.current.y}px, 0)`;
|
|
142
|
+
}
|
|
143
|
+
this.raf = requestAnimationFrame(tick);
|
|
144
|
+
};
|
|
145
|
+
this.raf = requestAnimationFrame(tick);
|
|
146
|
+
}
|
|
147
|
+
teardownLayer() {
|
|
148
|
+
cancelAnimationFrame(this.raf);
|
|
149
|
+
if (this.onMouseMove) {
|
|
150
|
+
window.removeEventListener('mousemove', this.onMouseMove);
|
|
151
|
+
this.onMouseMove = undefined;
|
|
152
|
+
}
|
|
153
|
+
document.documentElement.classList.remove(HIDE_CLASS);
|
|
154
|
+
this.portalRoot?.remove();
|
|
155
|
+
this.portalRoot = undefined;
|
|
156
|
+
this.pillEl = undefined;
|
|
157
|
+
this.labelEl = undefined;
|
|
158
|
+
this.iconEl = undefined;
|
|
159
|
+
}
|
|
160
|
+
teardown() {
|
|
161
|
+
this.teardownLayer();
|
|
162
|
+
if (this.desktopMq && this.onDesktopChange) {
|
|
163
|
+
this.desktopMq.removeEventListener('change', this.onDesktopChange);
|
|
164
|
+
}
|
|
165
|
+
this.isScoped = false;
|
|
166
|
+
this.enabled = false;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
if (!customElements.get('db-cursor-follower')) {
|
|
170
|
+
customElements.define('db-cursor-follower', DbCursorFollower);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export { DbCursorFollower };
|