@designbasekorea/ui-wc 0.8.12 → 0.9.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.
- package/CHANGELOG.md +56 -0
- package/LICENSE-PAYMENT-LOGOS.md +437 -0
- package/README.md +61 -23
- package/dist/esm/components/db-achievement-list.d.ts +31 -0
- package/dist/esm/components/db-achievement-list.js +1 -0
- package/dist/esm/components/db-achievement-modal.d.ts +38 -0
- package/dist/esm/components/db-achievement-modal.js +1 -0
- package/dist/esm/components/db-ai-chain-of-thought.d.ts +14 -0
- package/dist/esm/components/db-ai-chain-of-thought.js +1 -0
- package/dist/esm/components/db-ai-chat.js +1 -1
- package/dist/esm/components/db-ai-checkpoint.d.ts +14 -0
- package/dist/esm/components/db-ai-checkpoint.js +1 -0
- package/dist/esm/components/db-ai-confirmation.d.ts +14 -0
- package/dist/esm/components/db-ai-confirmation.js +1 -0
- package/dist/esm/components/db-ai-context.d.ts +15 -0
- package/dist/esm/components/db-ai-context.js +1 -0
- package/dist/esm/components/db-ai-conversation.d.ts +21 -0
- package/dist/esm/components/db-ai-conversation.js +1 -0
- package/dist/esm/components/db-ai-execution-quote.d.ts +41 -0
- package/dist/esm/components/db-ai-execution-quote.js +1 -0
- package/dist/esm/components/db-ai-file-tree.d.ts +14 -0
- package/dist/esm/components/db-ai-file-tree.js +1 -0
- package/dist/esm/components/db-ai-glow.d.ts +1 -1
- package/dist/esm/components/db-ai-inline-citation.d.ts +16 -0
- package/dist/esm/components/db-ai-inline-citation.js +1 -0
- package/dist/esm/components/db-ai-message.d.ts +19 -0
- package/dist/esm/components/db-ai-message.js +1 -0
- package/dist/esm/components/db-ai-model-select.d.ts +36 -0
- package/dist/esm/components/db-ai-model-select.js +1 -0
- package/dist/esm/components/db-ai-plan.d.ts +14 -0
- package/dist/esm/components/db-ai-plan.js +1 -0
- package/dist/esm/components/db-ai-queue.d.ts +14 -0
- package/dist/esm/components/db-ai-queue.js +1 -0
- package/dist/esm/components/db-ai-reasoning.d.ts +14 -0
- package/dist/esm/components/db-ai-reasoning.js +1 -0
- package/dist/esm/components/db-ai-sources.d.ts +14 -0
- package/dist/esm/components/db-ai-sources.js +1 -0
- package/dist/esm/components/db-ai-stack-trace.d.ts +14 -0
- package/dist/esm/components/db-ai-stack-trace.js +1 -0
- package/dist/esm/components/db-ai-subagent.d.ts +14 -0
- package/dist/esm/components/db-ai-subagent.js +1 -0
- package/dist/esm/components/db-ai-task-status.d.ts +26 -0
- package/dist/esm/components/db-ai-task-status.js +1 -0
- package/dist/esm/components/db-ai-task.d.ts +14 -0
- package/dist/esm/components/db-ai-task.js +1 -0
- package/dist/esm/components/db-ai-terminal.d.ts +14 -0
- package/dist/esm/components/db-ai-terminal.js +1 -0
- package/dist/esm/components/db-ai-test-results.d.ts +14 -0
- package/dist/esm/components/db-ai-test-results.js +1 -0
- package/dist/esm/components/db-ai-tool.d.ts +14 -0
- package/dist/esm/components/db-ai-tool.js +1 -0
- package/dist/esm/components/db-attachment-list.d.ts +38 -0
- package/dist/esm/components/db-attachment-list.js +1 -0
- package/dist/esm/components/db-bento-card.d.ts +55 -0
- package/dist/esm/components/db-bento-card.js +1 -0
- package/dist/esm/components/db-bento-grid.d.ts +25 -0
- package/dist/esm/components/db-bento-grid.js +1 -0
- package/dist/esm/components/db-boarding-pass-stack.d.ts +49 -0
- package/dist/esm/components/db-boarding-pass-stack.js +1 -0
- package/dist/esm/components/db-boarding-pass.d.ts +32 -0
- package/dist/esm/components/db-boarding-pass.js +1 -0
- package/dist/esm/components/db-border-beam.d.ts +52 -0
- package/dist/esm/components/db-border-beam.js +1 -0
- package/dist/esm/components/db-button.d.ts +1 -1
- package/dist/esm/components/db-button.js +1 -1
- package/dist/esm/components/db-chat-composer.d.ts +2 -0
- package/dist/esm/components/db-chat-composer.js +1 -1
- package/dist/esm/components/db-chat-message.d.ts +1 -1
- package/dist/esm/components/db-chat-orb.d.ts +1 -1
- package/dist/esm/components/db-chat-widget.d.ts +1 -1
- package/dist/esm/components/db-color-picker.d.ts +1 -0
- package/dist/esm/components/db-color-picker.js +1 -1
- package/dist/esm/components/db-confetti.d.ts +90 -0
- package/dist/esm/components/db-confetti.js +1 -0
- package/dist/esm/components/db-context-bar.d.ts +13 -0
- package/dist/esm/components/db-context-bar.js +1 -0
- package/dist/esm/components/db-credit-balance.d.ts +17 -0
- package/dist/esm/components/db-credit-balance.js +1 -0
- package/dist/esm/components/db-credit-card.d.ts +51 -0
- package/dist/esm/components/db-credit-card.js +1 -0
- package/dist/esm/components/db-credit-dropdown.d.ts +31 -0
- package/dist/esm/components/db-credit-dropdown.js +1 -0
- package/dist/esm/components/db-credit-history.d.ts +31 -0
- package/dist/esm/components/db-credit-history.js +1 -0
- package/dist/esm/components/db-credit-recharge-modal.d.ts +35 -0
- package/dist/esm/components/db-credit-recharge-modal.js +1 -0
- package/dist/esm/components/db-credit-recharge.d.ts +39 -0
- package/dist/esm/components/db-credit-recharge.js +1 -0
- package/dist/esm/components/db-design-canvas.d.ts +137 -0
- package/dist/esm/components/db-design-canvas.js +1 -0
- package/dist/esm/components/db-design-toolbar.d.ts +60 -0
- package/dist/esm/components/db-design-toolbar.js +1 -0
- package/dist/esm/components/db-device-mockup.d.ts +100 -0
- package/dist/esm/components/db-device-mockup.js +1 -0
- package/dist/esm/components/db-download-progress.d.ts +1 -1
- package/dist/esm/components/db-drawer.js +1 -1
- package/dist/esm/components/db-dropdown.d.ts +2 -0
- package/dist/esm/components/db-dropdown.js +1 -1
- package/dist/esm/components/db-email-verify.d.ts +1 -1
- package/dist/esm/components/db-file-uploader.d.ts +10 -0
- package/dist/esm/components/db-filter-bar.d.ts +34 -0
- package/dist/esm/components/db-filter-bar.js +1 -0
- package/dist/esm/components/db-flight-status.d.ts +33 -0
- package/dist/esm/components/db-flight-status.js +1 -0
- package/dist/esm/components/db-floating-action-button.d.ts +24 -14
- package/dist/esm/components/db-floating-action-button.js +1 -1
- package/dist/esm/components/db-footer.d.ts +3 -0
- package/dist/esm/components/db-footer.js +1 -1
- package/dist/esm/components/db-form.js +1 -1
- package/dist/esm/components/db-glyph-matrix.d.ts +58 -0
- package/dist/esm/components/db-glyph-matrix.js +1 -0
- package/dist/esm/components/db-icons.d.ts +1 -1
- package/dist/esm/components/db-icons.js +1 -1
- package/dist/esm/components/db-menu-item.d.ts +2 -0
- package/dist/esm/components/db-menu-item.js +1 -1
- package/dist/esm/components/db-modal.d.ts +1 -1
- package/dist/esm/components/db-modal.js +1 -1
- package/dist/esm/components/db-navbar.d.ts +3 -1
- package/dist/esm/components/db-navbar.js +1 -1
- package/dist/esm/components/db-navigation-rail.d.ts +1 -1
- package/dist/esm/components/db-node.d.ts +83 -0
- package/dist/esm/components/db-node.js +1 -0
- package/dist/esm/components/db-notification-dropdown.d.ts +30 -0
- package/dist/esm/components/db-notification-dropdown.js +1 -0
- package/dist/esm/components/db-notification-inbox.d.ts +25 -0
- package/dist/esm/components/db-notification-inbox.js +1 -0
- package/dist/esm/components/db-otp-input.d.ts +1 -1
- package/dist/esm/components/db-phone-verify.d.ts +1 -1
- package/dist/esm/components/db-plan-overview.d.ts +26 -0
- package/dist/esm/components/db-plan-overview.js +1 -0
- package/dist/esm/components/db-popover.js +1 -1
- package/dist/esm/components/db-progressive-blur.d.ts +35 -0
- package/dist/esm/components/db-progressive-blur.js +1 -0
- package/dist/esm/components/db-receipt.d.ts +37 -0
- package/dist/esm/components/db-receipt.js +1 -0
- package/dist/esm/components/db-search-bar.js +1 -1
- package/dist/esm/components/db-segment-control.js +1 -1
- package/dist/esm/components/db-select.js +1 -1
- package/dist/esm/components/db-sidebar.d.ts +14 -1
- package/dist/esm/components/db-sidebar.js +1 -1
- package/dist/esm/components/db-split-view.d.ts +2 -0
- package/dist/esm/components/db-split-view.js +1 -1
- package/dist/esm/components/db-textarea.js +1 -1
- package/dist/esm/components/db-ticket.d.ts +18 -0
- package/dist/esm/components/db-ticket.js +1 -0
- package/dist/esm/components/db-time-picker.d.ts +1 -1
- package/dist/esm/components/db-tool-button.d.ts +57 -0
- package/dist/esm/components/db-tool-button.js +1 -0
- package/dist/esm/components/db-tweet-card.d.ts +101 -0
- package/dist/esm/components/db-tweet-card.js +1 -0
- package/dist/esm/components/db-two-factor.d.ts +1 -1
- package/dist/esm/components/db-voice-control.d.ts +25 -0
- package/dist/esm/components/db-voice-control.js +1 -0
- package/dist/esm/components/db-workspace-invite-modal.d.ts +51 -0
- package/dist/esm/components/db-workspace-invite-modal.js +1 -0
- package/dist/esm/components/db-workspace-members.d.ts +36 -0
- package/dist/esm/components/db-workspace-members.js +1 -0
- package/dist/esm/components/device-mockup-style.js +1 -0
- package/dist/esm/components/flight-route.js +1 -0
- package/dist/esm/components/node-style.js +1 -0
- package/dist/esm/components/paper-card.d.ts +26 -0
- package/dist/esm/components/paper-card.js +1 -0
- package/dist/esm/components/random-gradient-palettes.d.ts +4 -0
- package/dist/esm/core/ai-element.d.ts +47 -0
- package/dist/esm/core/ai-element.js +1 -0
- package/dist/esm/core/credit-ui.js +1 -0
- package/dist/esm/core/i18n.d.ts +153 -0
- package/dist/esm/core/i18n.js +1 -1
- package/dist/esm/core/notification-ui.d.ts +17 -0
- package/dist/esm/core/notification-ui.js +1 -0
- package/dist/esm/helpers/payment-brands.d.ts +56 -0
- package/dist/esm/helpers/payment-brands.js +1 -0
- package/dist/esm/helpers/toast.d.ts +2 -3
- package/dist/esm/index.d.ts +62 -2
- package/dist/esm/index.js +1 -1
- package/dist/esm/node_modules/@designbasekorea/ui-contracts/dist/components.js +1 -1
- package/dist/esm/ui-contracts/dist/components.d.d.ts +76 -0
- package/dist/esm/ui-contracts/dist/primitives.d.d.ts +21 -0
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +2149 -23
- package/dist/index.esm.js +1 -1
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.d.ts +786 -6727
- package/dist/react/index.esm.js +1 -1
- package/package.json +13 -7
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { DbElement } from '../core/base-element.js';
|
|
2
|
+
|
|
3
|
+
declare const STATUSES: readonly ["scheduled", "boarding", "in-flight", "landed", "delayed", "cancelled"];
|
|
4
|
+
type DbFlightStatusValue = typeof STATUSES[number];
|
|
5
|
+
/** Display data supplied by the application; does not fetch or simulate live flights. */
|
|
6
|
+
declare class DbFlightStatus extends DbElement {
|
|
7
|
+
static get observedAttributes(): string[];
|
|
8
|
+
private view;
|
|
9
|
+
private displayedProgress;
|
|
10
|
+
private animation;
|
|
11
|
+
private resizeObserver;
|
|
12
|
+
private motion;
|
|
13
|
+
private redraw;
|
|
14
|
+
private get targetProgress();
|
|
15
|
+
private stopAnimation;
|
|
16
|
+
private onMotionChange;
|
|
17
|
+
disconnectedCallback(): void;
|
|
18
|
+
get progress(): number;
|
|
19
|
+
set progress(value: number);
|
|
20
|
+
get status(): DbFlightStatusValue;
|
|
21
|
+
set status(value: DbFlightStatusValue);
|
|
22
|
+
connectedCallback(): void;
|
|
23
|
+
attributeChangedCallback(): void;
|
|
24
|
+
private render;
|
|
25
|
+
}
|
|
26
|
+
declare global {
|
|
27
|
+
interface HTMLElementTagNameMap {
|
|
28
|
+
'db-flight-status': DbFlightStatus;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { DbFlightStatus };
|
|
33
|
+
export type { DbFlightStatusValue };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{DbElement as t}from"../core/base-element.js";import{createDbIcon as e}from"./db-icons.js";import{paperNode as s}from"./paper-card.js";import{flightRoutePosition as i}from"./flight-route.js";const r=["scheduled","boarding","in-flight","landed","delayed","cancelled"],a={scheduled:"출발 예정",boarding:"탑승 중","in-flight":"운항 중",landed:"도착",delayed:"지연",cancelled:"취소"};class DbFlightStatus extends t{constructor(){super(...arguments),this.view=s("section","db-flight-status__view"),this.displayedProgress=null,this.animation=0,this.resizeObserver=null,this.motion=null,this.redraw=null,this.onMotionChange=()=>{this.motion?.matches&&(this.stopAnimation(),this.displayedProgress=this.targetProgress,this.redraw?.())}}static get observedAttributes(){return["airline","service-number","origin","origin-name","destination","destination-name","departure-time","arrival-time","terminal","gate","status","detail","progress","label"]}get targetProgress(){return"landed"===this.status?100:"scheduled"===this.status||"cancelled"===this.status?0:this.progress}stopAnimation(){this.animation&&cancelAnimationFrame(this.animation),this.animation=0}disconnectedCallback(){this.stopAnimation(),this.resizeObserver?.disconnect(),this.motion?.removeEventListener("change",this.onMotionChange),this.redraw=null,super.disconnectedCallback()}get progress(){const t=Number(this.getAttribute("progress")||0);return Number.isFinite(t)?Math.min(100,Math.max(0,t)):0}set progress(t){this.setAttribute("progress",String(t))}get status(){return r.find(t=>t===this.getAttribute("status"))||"scheduled"}set status(t){this.setAttribute("status",t)}connectedCallback(){this.classList.add("db-flight-status"),this.upgradeProperties(["progress","status"]),this.view.parentNode||this.prepend(this.view),this.motion=window.matchMedia?.("(prefers-reduced-motion: reduce)")||null,this.motion?.addEventListener("change",this.onMotionChange),this.render()}attributeChangedCallback(){this.isConnected&&this.render()}render(){const attr=t=>this.getAttribute(t)||"";this.dataset.status=this.status,this.view.setAttribute("aria-label",attr("label")||`${attr("origin")}에서 ${attr("destination")} 운항 현황`);const t=s("header","db-flight-status__header");t.append(s("strong","",attr("airline")||attr("service-number")||"운항 현황"),s("span","db-flight-status__status",attr("detail")||a[this.status]));const r=s("div","db-flight-status__route"),endpoint=t=>{const e=s("div","db-flight-status__endpoint");return e.append(s("strong","",attr(t)||"—")),attr(`${t}-name`)&&e.append(s("span","",attr(`${t}-name`))),e},n=s("div","db-flight-status__track"),o=this.targetProgress;this.stopAnimation(),this.resizeObserver?.disconnect(),n.setAttribute("role","progressbar"),n.setAttribute("aria-label","여정 진행률"),n.setAttribute("aria-valuemin","0"),n.setAttribute("aria-valuemax","100"),n.setAttribute("aria-valuenow",String(o)),n.setAttribute("aria-valuetext",`${a[this.status]} · ${o}%`);const d="http://www.w3.org/2000/svg",l=document.createElementNS(d,"svg");l.setAttribute("viewBox","0 0 240 64"),l.setAttribute("preserveAspectRatio","none"),l.setAttribute("aria-hidden","true");for(const t of["db-flight-status__path","db-flight-status__travelled"]){const e=document.createElementNS(d,"path");e.setAttribute("d","M12 46 Q120 -8 228 46"),e.setAttribute("pathLength","100"),e.setAttribute("class",t),t.endsWith("travelled")&&(e.style.strokeDasharray=`${o} 100`),l.append(e)}const h=s("span","db-flight-status__plane");h.setAttribute("aria-hidden","true"),h.append(e("plane",20)),n.append(l,h),r.append(endpoint("origin"),n,endpoint("destination"));const u=s("div","db-flight-status__footer");u.append(s("span","",[attr("service-number"),attr("departure-time")&&`출발 ${attr("departure-time")}`].filter(Boolean).join(" · ")),s("span","",[attr("arrival-time")&&`도착 ${attr("arrival-time")}`,attr("terminal")&&`터미널 ${attr("terminal")}`,attr("gate")&&`게이트 ${attr("gate")}`].filter(Boolean).join(" · "))),this.view.replaceChildren(t,r,u);const c=l.querySelector(".db-flight-status__travelled");let g=n.clientWidth||240,p=n.clientHeight||58;this.redraw=()=>{const t=this.displayedProgress??o,e=i(t,g,p);h.style.left=`${e.x}px`,h.style.top=`${e.y}px`,h.style.transform=`translate(-50%, -50%) rotate(${e.angle}deg)`,c.style.strokeDasharray=`${t} 100`},"undefined"!=typeof ResizeObserver&&(this.resizeObserver=new ResizeObserver(()=>{g=n.clientWidth||240,p=n.clientHeight||58,this.redraw?.()}),this.resizeObserver.observe(n));const m=this.displayedProgress;if(null===m||m===o||this.motion?.matches)return this.displayedProgress=o,void this.redraw();this.redraw();let b=null;const animate=t=>{b??(b=t);const e=Math.min(1,(t-b)/1e3);this.displayedProgress=m+(o-m)*(1-Math.pow(1-e,3)),this.redraw?.(),this.animation=e<1?requestAnimationFrame(animate):0};this.animation=requestAnimationFrame(animate)}}customElements.get("db-flight-status")||customElements.define("db-flight-status",DbFlightStatus);export{DbFlightStatus};
|
|
@@ -1,20 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { DbButton } from './db-button.js';
|
|
2
|
+
|
|
3
|
+
/** Floating placement and collapsing label, with the canonical Button behavior and visuals. */
|
|
4
|
+
declare class DbFloatingActionButton extends DbButton {
|
|
5
|
+
private scrollRoot;
|
|
6
|
+
private lastScroll;
|
|
7
|
+
private mappedIcon?;
|
|
8
|
+
private scrollCollapsed;
|
|
9
|
+
private labelObserver?;
|
|
3
10
|
static get observedAttributes(): string[];
|
|
4
|
-
get
|
|
5
|
-
set
|
|
6
|
-
get
|
|
7
|
-
set
|
|
8
|
-
get
|
|
9
|
-
set
|
|
10
|
-
get
|
|
11
|
-
set
|
|
11
|
+
get label(): string;
|
|
12
|
+
set label(value: string);
|
|
13
|
+
get collapsed(): boolean;
|
|
14
|
+
set collapsed(value: boolean);
|
|
15
|
+
get collapseOnScroll(): boolean;
|
|
16
|
+
set collapseOnScroll(value: boolean);
|
|
17
|
+
get collapseThreshold(): number;
|
|
18
|
+
set collapseThreshold(value: number);
|
|
12
19
|
connectedCallback(): void;
|
|
13
20
|
disconnectedCallback(): void;
|
|
14
|
-
attributeChangedCallback(): void;
|
|
15
|
-
private
|
|
16
|
-
private
|
|
17
|
-
private
|
|
21
|
+
attributeChangedCallback(name?: string): void;
|
|
22
|
+
private syncFab;
|
|
23
|
+
private measureLabel;
|
|
24
|
+
private unbindScroll;
|
|
25
|
+
private bindScroll;
|
|
26
|
+
private scrollPosition;
|
|
27
|
+
private onScroll;
|
|
18
28
|
}
|
|
19
29
|
declare global {
|
|
20
30
|
interface HTMLElementTagNameMap {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{DbButton as t}from"./db-button.js";class DbFloatingActionButton extends t{constructor(){super(...arguments),this.scrollRoot=null,this.lastScroll=0,this.scrollCollapsed=!1,this.measureLabel=()=>{const t=this.querySelector(".designbase-wc-fab__label-text");this.style.setProperty("--db-fab-label-width",`${t?.scrollWidth||0}px`)},this.onScroll=()=>{const t=this.scrollPosition(),e=t-this.lastScroll;if(t<=this.collapseThreshold)this.scrollCollapsed=!1;else if(e>4)this.scrollCollapsed=!0;else{if(!(e<-4))return;this.scrollCollapsed=!1}this.lastScroll=t,this.classList.toggle("designbase-wc-fab--collapsed",this.collapsed||this.scrollCollapsed)}}static get observedAttributes(){return[...super.observedAttributes,"icon","label","collapsed","collapse-on-scroll","scroll-target","collapse-threshold"]}get label(){return this.getAttribute("label")||""}set label(t){this.setAttribute("label",t)}get collapsed(){return this.hasAttribute("collapsed")}set collapsed(t){this.toggleAttribute("collapsed",t)}get collapseOnScroll(){return this.hasAttribute("collapse-on-scroll")}set collapseOnScroll(t){this.toggleAttribute("collapse-on-scroll",t)}get collapseThreshold(){const t=Number(this.getAttribute("collapse-threshold")??24);return Number.isFinite(t)?Math.max(0,t):24}set collapseThreshold(t){this.setAttribute("collapse-threshold",String(t))}connectedCallback(){this.hasAttribute("radius")||(this.radius="pill"),this.syncFab(),super.connectedCallback(),this.labelObserver=new ResizeObserver(this.measureLabel);const t=this.querySelector(".designbase-wc-fab__label-text");t&&this.labelObserver.observe(t),this.bindScroll()}disconnectedCallback(){super.disconnectedCallback(),this.unbindScroll(),this.labelObserver?.disconnect(),this.labelObserver=void 0}attributeChangedCallback(t){super.attributeChangedCallback(),this.syncFab(),this.isConnected&&["collapse-on-scroll","scroll-target","collapse-threshold"].includes(t||"")&&this.bindScroll()}syncFab(){this.classList.add("designbase-wc-fab");const t=this.getAttribute("icon");if(t)this.mappedIcon=t,this.getAttribute("start-icon")!==t&&this.setAttribute("start-icon",t);else if(this.mappedIcon){const t=this.mappedIcon;this.mappedIcon=void 0,this.getAttribute("start-icon")===t&&this.removeAttribute("start-icon")}let e=this.querySelector(":scope > .designbase-wc-fab__label");if(!e){e=document.createElement("span"),e.className="designbase-wc-fab__label",e.setAttribute("aria-hidden","true");const t=document.createElement("span");t.className="designbase-wc-fab__label-text",e.append(t),this.append(e)}const l=e.firstElementChild;l.textContent!==this.label&&(l.textContent=this.label),!this.label||this.hasAttribute("aria-label")&&this.getAttribute("data-fab-auto-label")!==this.getAttribute("aria-label")||(this.setAttribute("aria-label",this.label),this.setAttribute("data-fab-auto-label",this.label)),this.hasAttribute("aria-label")||(this.setAttribute("aria-label","Floating action button"),this.setAttribute("data-fab-auto-label","Floating action button")),this.classList.toggle("designbase-wc-fab--extended",Boolean(this.label)),this.classList.toggle("designbase-wc-fab--collapsed",this.collapsed||this.scrollCollapsed),this.measureLabel()}unbindScroll(){this.scrollRoot?.removeEventListener("scroll",this.onScroll),this.scrollRoot=null}bindScroll(){if(this.unbindScroll(),this.scrollCollapsed=!1,this.collapseOnScroll){let t=null;const e=this.getAttribute("scroll-target");if(e)try{t=document.querySelector(e)}catch{}else for(let e=this.parentElement;e;e=e.parentElement)if(/(auto|scroll)/.test(getComputedStyle(e).overflowY)){t=e;break}this.scrollRoot=t||window,this.lastScroll=this.scrollPosition(),this.scrollCollapsed=this.lastScroll>this.collapseThreshold,this.scrollRoot.addEventListener("scroll",this.onScroll,{passive:!0})}this.syncFab()}scrollPosition(){return Math.max(0,this.scrollRoot instanceof HTMLElement?this.scrollRoot.scrollTop:window.scrollY)}}customElements.get("db-floating-action-button")||customElements.define("db-floating-action-button",DbFloatingActionButton);export{DbFloatingActionButton};
|
|
@@ -35,6 +35,9 @@ interface DbFooterFamilySite {
|
|
|
35
35
|
href: string;
|
|
36
36
|
}
|
|
37
37
|
declare class DbFooter extends HTMLElement {
|
|
38
|
+
/** Light-DOM slots retain framework state and listeners across attribute updates. */
|
|
39
|
+
private brandContent;
|
|
40
|
+
private bottomContent;
|
|
38
41
|
static get observedAttributes(): string[];
|
|
39
42
|
connectedCallback(): void;
|
|
40
43
|
attributeChangedCallback(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createShareIcon as e}from"./db-share-icons.js";import{sanitizeHref as t}from"../core/safe-url.js";import{FOOTER_SIZES as
|
|
1
|
+
import{createShareIcon as e}from"./db-share-icons.js";import{sanitizeHref as t}from"../core/safe-url.js";import{FOOTER_SIZES as n,FOOTER_VARIANTS as s}from"../node_modules/@designbasekorea/ui-contracts/dist/components.js";const a={youtube:"youtube",instagram:"instagram",x:"x",linkedin:"linkedin",facebook:"facebook",email:"mail"};function parseJson(e,t){if(!e)return t;try{return JSON.parse(e)??t}catch{return t}}class DbFooter extends HTMLElement{constructor(){super(...arguments),this.brandContent=null,this.bottomContent=null}static get observedAttributes(){return["columns","legal-links","social-links","company-info","family-sites","tagline","copyright","logo-type","variant","size","full-width","show-logo","show-social","family-site-label"]}connectedCallback(){this.render()}attributeChangedCallback(){this.isConnected&&this.render()}get columns(){return parseJson(this.getAttribute("columns"),[])}set columns(e){this.setAttribute("columns","string"==typeof e?e:JSON.stringify(e))}get legalLinks(){return parseJson(this.getAttribute("legal-links"),[])}set legalLinks(e){this.setAttribute("legal-links","string"==typeof e?e:JSON.stringify(e))}get socialLinks(){return parseJson(this.getAttribute("social-links"),[])}set socialLinks(e){this.setAttribute("social-links","string"==typeof e?e:JSON.stringify(e))}get companyInfo(){return parseJson(this.getAttribute("company-info"),{})}set companyInfo(e){this.setAttribute("company-info","string"==typeof e?e:JSON.stringify(e))}get familySites(){return parseJson(this.getAttribute("family-sites"),[])}set familySites(e){this.setAttribute("family-sites","string"==typeof e?e:JSON.stringify(e))}syncHostClasses(){const e=this.getAttribute("size")||"m",t=this.getAttribute("variant")||"default",a=n.includes(e)?e:"m",o=s.includes(t)?t:"default",i=[...this.classList].filter(e=>!e.startsWith("designbase-wc-footer"));this.className=[...i,"designbase-wc-footer",`designbase-wc-footer--${a}`,`designbase-wc-footer--${o}`,this.hasAttribute("full-width")&&"designbase-wc-footer--full-width"].filter(Boolean).join(" ")}dispatchLinkClick(e,t){this.dispatchEvent(new CustomEvent("db-link-click",{bubbles:!0,composed:!0,detail:{link:e,source:t}}))}createLink(e,n,s){const a=document.createElement("a");return a.href=t(e.href,"#"),a.className=[n,e.emphasize&&`${n}--emphasize`].filter(Boolean).join(" "),a.textContent=e.label,e.external&&(a.target="_blank",a.rel="noopener noreferrer"),a.addEventListener("click",t=>{t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||0!==t.button||(t.preventDefault(),this.dispatchLinkClick(e,s))}),a}createSocialLink(n,s){const o=document.createElement("a");o.href=t(n.href,"#"),o.className="designbase-wc-footer__social-link",o.target="_blank",o.rel="noopener noreferrer",o.setAttribute("aria-label",n.label||n.platform);const i=a[n.platform]||"share-alt";return o.append(e(i,s)),o.addEventListener("click",e=>{e.preventDefault(),this.dispatchEvent(new CustomEvent("db-social-click",{bubbles:!0,composed:!0,detail:{link:n}}))}),o}createCompanyInfoRows(e){const t=[],n=[];e.companyName&&n.push(e.companyName),e.representative&&n.push(`대표: ${e.representative}`),e.businessNumber&&n.push(`사업자등록번호: ${e.businessNumber}`),n.length&&t.push(n.join(" | "));const s=[];e.address&&s.push(e.address),e.phone&&s.push(`대표전화: ${e.phone}`),e.customerCenter&&s.push(`고객센터: ${e.customerCenter}`),s.length&&t.push(s.join(" | "));const a=[];return e.email&&a.push(`이메일: ${e.email}`),e.mailOrderNumber&&a.push(`통신판매업신고: ${e.mailOrderNumber}`),e.hostingProvider&&a.push(`호스팅: ${e.hostingProvider}`),a.length&&t.push(a.join(" | ")),t}showLogo(){return!this.hasAttribute("show-logo")||"false"!==this.getAttribute("show-logo")}createLogo(){const e=document.createElement("div");e.className="designbase-wc-footer__logo";const t=document.createElement("db-logo");return t.setAttribute("type",this.getAttribute("logo-type")||"designbase"),t.setAttribute("size","s"),t.setAttribute("clickable",""),t.addEventListener("db-click",()=>{this.dispatchEvent(new CustomEvent("db-logo-click",{bubbles:!0,composed:!0}))}),e.append(t),e}renderBrand(e,t={}){const{showTagline:n=!0}=t,s=document.createElement("div");if(s.className="designbase-wc-footer__brand",this.brandContent)return s.append(this.brandContent),s;this.showLogo()&&s.append(this.createLogo());const a=this.getAttribute("tagline");if(n&&a){const e=document.createElement("p");e.className="designbase-wc-footer__tagline",e.textContent=a,s.append(e)}const o=this.socialLinks;if(o.length&&(!this.hasAttribute("show-social")||"false"!==this.getAttribute("show-social"))){const t=document.createElement("div");t.className="designbase-wc-footer__social",o.forEach(n=>t.append(this.createSocialLink(n,e))),s.append(t)}return s}renderColumns(e){if(!e.length)return null;const t=document.createElement("div");return t.className="designbase-wc-footer__columns",t.style.setProperty("--db-footer-columns",String(Math.min(e.length,4))),e.forEach(e=>{const n=document.createElement("div");n.className="designbase-wc-footer__column";const s=document.createElement("h3");s.className="designbase-wc-footer__column-title",s.textContent=e.title,n.append(s);const a=document.createElement("ul");a.className="designbase-wc-footer__column-list",e.items.forEach(e=>{const t=document.createElement("li");t.append(this.createLink(e,"designbase-wc-footer__column-link","column")),a.append(t)}),n.append(a),t.append(n)}),t}createLegalNav(e){const t=document.createElement("nav");t.className="designbase-wc-footer__legal-nav",t.setAttribute("aria-label","법적 고지");const n=document.createElement("ul");return n.className="designbase-wc-footer__legal-list",e.forEach((t,s)=>{const a=document.createElement("li");if(a.append(this.createLink(t,"designbase-wc-footer__legal-link","legal")),n.append(a),s<e.length-1){const e=document.createElement("span");e.className="designbase-wc-footer__legal-divider",e.setAttribute("aria-hidden","true"),e.textContent="|",a.append(e)}}),t.append(n),t}renderLegalBar(e,t){if(!e.length&&!t.length)return null;const n=document.createElement("div");if(n.className="designbase-wc-footer__legal-bar",e.length&&n.append(this.createLegalNav(e)),t.length){const e=document.createElement("div");e.className="designbase-wc-footer__family-site";const s=document.createElement("select");s.className="designbase-wc-footer__family-select",s.setAttribute("aria-label",this.getAttribute("family-site-label")||"패밀리 사이트");const a=document.createElement("option");a.value="",a.textContent=this.getAttribute("family-site-label")||"패밀리 사이트",a.disabled=!0,a.selected=!0,s.append(a),t.forEach(e=>{const t=document.createElement("option");t.value=e.href,t.textContent=e.label,t.dataset.id=e.id,s.append(t)}),s.addEventListener("change",()=>{const e=t.find(e=>e.href===s.value);e&&(s.selectedIndex=0,this.dispatchEvent(new CustomEvent("db-family-site-change",{bubbles:!0,composed:!0,detail:{site:e}})))}),e.append(s),n.append(e)}return n}renderCompanyInfo(e){const t=this.createCompanyInfoRows(e);if(!t.length)return null;const n=document.createElement("div");return n.className="designbase-wc-footer__company",t.forEach(e=>{const t=document.createElement("p");t.className="designbase-wc-footer__company-line",t.textContent=e,n.append(t)}),n}createCopyright(e){const t=document.createElement("div");t.className="designbase-wc-footer__bottom";const n=document.createElement("p");return n.className="designbase-wc-footer__copyright",n.textContent=e,t.append(n),this.bottomContent&&t.append(this.bottomContent),t}renderMinimal(e,t,n){const s=document.createElement("div");s.className="designbase-wc-footer__minimal-bar";const a=document.createElement("div");if(a.className="designbase-wc-footer__minimal-start",this.brandContent?a.append(this.brandContent):this.showLogo()&&a.append(this.createLogo()),s.append(a),t.length){const e=document.createElement("div");e.className="designbase-wc-footer__minimal-legal",e.append(this.createLegalNav(t)),s.append(e)}e.append(s),e.append(this.createCopyright(n))}render(){this.syncHostClasses(),this.setAttribute("role","contentinfo");const e=this.getAttribute("variant")||"default",t=this.getAttribute("size")||"m",n="s"===t?18:"l"===t?22:20,s="default"===e?this.columns:[],a=this.legalLinks,o=this.companyInfo,i=this.familySites,r=this.getAttribute("copyright")||`© ${(new Date).getFullYear()} Designbase. All rights reserved.`;this.brandContent=this.querySelector('[slot="brand"]'),this.bottomContent=this.querySelector('[slot="bottom"]'),this.brandContent?.remove(),this.bottomContent?.remove(),this.replaceChildren();const l=document.createElement("div");if(l.className=["designbase-wc-footer__container",this.hasAttribute("full-width")&&"designbase-wc-footer__container--full-width"].filter(Boolean).join(" "),"minimal"===e)return this.renderMinimal(l,a,r),void this.append(l);const c=document.createElement("div");c.className="designbase-wc-footer__top",c.append(this.renderBrand(n,{showTagline:"compact"!==e}));const d=this.renderColumns(s);d&&c.append(d),l.append(c);const m=this.renderLegalBar(a,i);m&&l.append(m);const u=this.renderCompanyInfo(o);u&&l.append(u),l.append(this.createCopyright(r)),this.append(l)}}customElements.get("db-footer")||customElements.define("db-footer",DbFooter);export{DbFooter};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./db-input.js";import"./db-textarea.js";import"./db-select.js";import"./db-checkbox.js";import"./db-radio.js";import"./db-button.js";const e="designbase-wc-form";class DbForm extends HTMLElement{constructor(){super(...arguments),this.built=!1,this.formEl=null,this.headerEl=null,this.fieldsEl=null,this.actionsEl=null,this.submitBtn=null,this.resetBtn=null,this.values={},this.errors={},this.touched={},this.initialValues={},this.fieldWrappers=new Map,this.boundSubmit=e=>this.handleSubmit(e),this.boundReset=e=>this.handleReset(e)}static get observedAttributes(){return["fields","columns","size","variant","title","description","submit-text","reset-text","show-reset","submit-loading","submit-disabled","initial-values"]}connectedCallback(){this.built||(this.buildShell(),this.built=!0),this.bootstrapValues(),this.syncAll()}attributeChangedCallback(e){this.built&&("initial-values"===e&&this.bootstrapValues(),"fields"===e&&this.bootstrapValues(),this.syncAll())}get fields(){return this.parseFields(this.getAttribute("fields"))}set fields(e){this.setAttribute("fields","string"==typeof e?e:JSON.stringify(e))}parseFields(e){if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}parseInitialValues(){const e=this.getAttribute("initial-values");if(!e)return{};try{const t=JSON.parse(e);return t&&"object"==typeof t?t:{}}catch{return{}}}bootstrapValues(){this.initialValues=this.parseInitialValues();const e={...this.initialValues};this.fields.forEach(t=>{void 0===e[t.name]&&(void 0===t.value?void 0===t.defaultValue?"checkbox"===t.type&&t.checkboxGroup?e[t.name]=[]:"checkbox"!==t.type?e[t.name]="":e[t.name]=!1:e[t.name]=t.defaultValue:e[t.name]=t.value)}),this.values=e}buildShell(){this.formEl=document.createElement("form"),this.formEl.className=`${e}__native`,this.formEl.noValidate=!0,this.formEl.addEventListener("submit",this.boundSubmit),this.headerEl=document.createElement("div"),this.headerEl.className=`${e}__header`,this.fieldsEl=document.createElement("div"),this.fieldsEl.className=`${e}__fields`,this.actionsEl=document.createElement("div"),this.actionsEl.className=`${e}__actions`,this.submitBtn=document.createElement("db-button"),this.submitBtn.setAttribute("type","submit"),this.submitBtn.setAttribute("variant","primary"),this.resetBtn=document.createElement("db-button"),this.resetBtn.setAttribute("type","button"),this.resetBtn.setAttribute("variant","secondary"),this.resetBtn.addEventListener("click",this.boundReset),this.actionsEl.append(this.submitBtn,this.resetBtn),this.formEl.append(this.fieldsEl,this.actionsEl),this.append(this.headerEl,this.formEl)}syncAll(){this.syncClasses(),this.syncHeader(),this.renderFields(),this.syncActions()}syncClasses(){const t=this.getAttribute("columns")||"1",i=this.getAttribute("size")||"m",s=this.getAttribute("variant")||"default";this.className=[e,`${e}--columns-${t}`,`${e}--${i}`,`${e}--${s}`,this.hasAttribute("submit-loading")&&`${e}--loading`].filter(Boolean).join(" ")}syncHeader(){if(!this.headerEl)return;const t=this.getAttribute("title")||"",i=this.getAttribute("description")||"";if(this.headerEl.innerHTML="",t||i){if(this.headerEl.hidden=!1,t){const i=document.createElement("h3");i.className=`${e}__title`,i.textContent=t,this.headerEl.appendChild(i)}if(i){const t=document.createElement("p");t.className=`${e}__description`,t.textContent=i,this.headerEl.appendChild(t)}}else this.headerEl.hidden=!0}syncActions(){const e=this.getAttribute("submit-text")||"제출",t=this.getAttribute("reset-text")||"리셋",i=this.hasAttribute("show-reset");this.submitBtn&&(this.submitBtn.textContent=e,this.hasAttribute("submit-loading")?this.submitBtn.setAttribute("loading",""):this.submitBtn.removeAttribute("loading"),this.hasAttribute("submit-disabled")?this.submitBtn.setAttribute("disabled",""):this.submitBtn.removeAttribute("disabled")),this.resetBtn&&(this.resetBtn.textContent=t,this.resetBtn.hidden=!i)}renderFields(){if(!this.fieldsEl)return;const t=this.getAttribute("size")||"m";this.fieldsEl.innerHTML="",this.fieldWrappers.clear(),this.fields.forEach(i=>{const s=document.createElement("div");if(s.className=`${e}__field-wrapper ${e}__field-wrapper--${i.type||"text"}`,s.dataset.field=i.name,i.label&&("checkbox"!==i.type||i.checkboxGroup)){const t=document.createElement("label");if(t.className=`${e}__label`,t.htmlFor=`db-form-${i.name}`,t.textContent=i.label,i.required||i.validation?.required){const i=document.createElement("span");i.className=`${e}__required`,i.textContent="*",i.setAttribute("aria-hidden","true"),t.appendChild(i)}s.appendChild(t)}s.appendChild(this.createFieldControl(i,t)),this.fieldsEl.appendChild(s),this.fieldWrappers.set(i.name,s),this.refreshFieldState(i.name)})}refreshFieldState(t){const i=this.fields.find(e=>e.name===t),s=this.fieldWrappers.get(t);if(!i||!s)return;const r=Boolean(this.touched[t]&&this.errors[t]);s.classList.toggle(`${e}__field-wrapper--error`,r),s.querySelector(`.${e}__error`)?.remove(),s.querySelector(`.${e}__help`)?.remove();const a=s.querySelector(`.${e}__field, db-input, db-textarea, db-select, db-checkbox`);if(a&&(r?(a.setAttribute("error",""),a.setAttribute("error-message",this.errors[t])):(a.removeAttribute("error"),a.removeAttribute("error-message"))),r){const i=document.createElement("div");return i.className=`${e}__error`,i.textContent=this.errors[t],void s.appendChild(i)}if(i.helpText){const t=document.createElement("div");t.className=`${e}__help`,t.textContent=i.helpText,s.appendChild(t)}}refreshAllFieldStates(){this.fields.forEach(e=>this.refreshFieldState(e.name))}createFieldControl(t,i){const s=t.type||"text",r=this.values[t.name],a=Boolean(this.touched[t.name]&&this.errors[t.name]),n=a?this.errors[t.name]:"";if("textarea"===s){const s=document.createElement("db-textarea");return s.className=`${e}__field`,s.setAttribute("name",t.name),s.id=`db-form-${t.name}`,s.setAttribute("size",i),s.setAttribute("full-width",""),t.placeholder&&s.setAttribute("placeholder",t.placeholder),void 0!==r&&s.setAttribute("value",String(r)),t.disabled&&s.setAttribute("disabled",""),t.readOnly&&s.setAttribute("readonly",""),t.required&&s.setAttribute("required",""),t.maxLength&&s.setAttribute("max-length",String(t.maxLength)),a&&(s.setAttribute("error",""),s.setAttribute("error-message",n)),s.addEventListener("db-change",e=>{const i=e.detail;this.handleFieldChange(t,i.value)}),s.addEventListener("db-input",e=>{const i=e.detail;this.handleFieldChange(t,i.value,!1)}),s}if("select"===s){const s=document.createElement("db-select");return s.className=`${e}__field`,s.setAttribute("name",t.name),s.id=`db-form-${t.name}`,s.setAttribute("size",i),s.setAttribute("full-width",""),t.placeholder&&s.setAttribute("placeholder",t.placeholder),t.options&&s.setAttribute("options",JSON.stringify(t.options)),t.multiple&&s.setAttribute("multiple",""),t.disabled&&s.setAttribute("disabled",""),t.readOnly&&s.setAttribute("readonly",""),t.required&&s.setAttribute("required",""),void 0!==r&&s.setAttribute("value",Array.isArray(r)?JSON.stringify(r):String(r)),a&&(s.setAttribute("error",""),s.setAttribute("error-message",n)),s.addEventListener("db-change",e=>{const i=e.detail;this.handleFieldChange(t,i.value)}),s}if("radio"===s&&t.radioGroup){const s=document.createElement("div");return s.className=`${e}__radio-group`,s.setAttribute("role","radiogroup"),(t.options||[]).forEach(e=>{const a=document.createElement("db-radio");a.setAttribute("name",t.name),a.setAttribute("value",e.value),a.setAttribute("size",i),r===e.value&&a.setAttribute("checked",""),(t.disabled||e.disabled)&&a.setAttribute("disabled",""),a.textContent=e.label,a.addEventListener("db-change",i=>{i.detail.checked&&this.handleFieldChange(t,e.value)}),s.appendChild(a)}),s}if("checkbox"===s&&t.checkboxGroup){const s=document.createElement("div");s.className=`${e}__checkbox-group`;const a=Array.isArray(r)?r:[];return(t.options||[]).forEach(e=>{const r=document.createElement("db-checkbox");r.setAttribute("name",t.name),r.setAttribute("value",e.value),r.setAttribute("size",i),a.includes(e.value)&&r.setAttribute("checked",""),(t.disabled||e.disabled)&&r.setAttribute("disabled",""),r.textContent=e.label,r.addEventListener("db-change",i=>{const s=i.detail,r=Array.isArray(this.values[t.name])?[...this.values[t.name]]:[],a=s.checked?[...new Set([...r,e.value])]:r.filter(t=>t!==e.value);this.handleFieldChange(t,a)}),s.appendChild(r)}),s}if("checkbox"===s){const s=document.createElement("db-checkbox");return s.className=`${e}__field`,s.setAttribute("name",t.name),s.id=`db-form-${t.name}`,s.setAttribute("size",i),r&&s.setAttribute("checked",""),t.disabled&&s.setAttribute("disabled",""),t.readOnly&&s.setAttribute("readonly",""),t.required&&s.setAttribute("required",""),s.textContent=t.label||"",s.addEventListener("db-change",e=>{const i=e.detail;this.handleFieldChange(t,i.checked)}),s}const l=document.createElement("db-input");return l.className=`${e}__field`,l.setAttribute("name",t.name),l.id=`db-form-${t.name}`,l.setAttribute("type",s),l.setAttribute("size",i),l.setAttribute("full-width",""),t.placeholder&&l.setAttribute("placeholder",t.placeholder),void 0!==r&&!1!==r&&l.setAttribute("value",String(r)),t.disabled&&l.setAttribute("disabled",""),t.readOnly&&l.setAttribute("readonly",""),t.required&&l.setAttribute("required",""),void 0!==t.min&&l.setAttribute("min",String(t.min)),void 0!==t.max&&l.setAttribute("max",String(t.max)),void 0!==t.minLength&&l.setAttribute("minlength",String(t.minLength)),void 0!==t.maxLength&&l.setAttribute("maxlength",String(t.maxLength)),t.pattern&&l.setAttribute("pattern",t.pattern),a&&(l.setAttribute("error",""),l.setAttribute("error-message",n)),l.addEventListener("db-change",e=>{const i=e.detail;this.handleFieldChange(t,i.value)}),l.addEventListener("db-input",e=>{const i=e.detail;this.handleFieldChange(t,i.value,!1)}),l}handleFieldChange(e,t,i=!0){this.values[e.name]=t,i&&(this.touched[e.name]=!0);const s=this.validateField(e,t);this.errors[e.name]=s||"",this.refreshFieldState(e.name),this.dispatchEvent(new CustomEvent("db-change",{bubbles:!0,composed:!0,detail:{values:{...this.values}}}))}validateField(e,t){const i=e.validation||{};if((i.required??e.required)&&(null==t||""===t||!1===t||Array.isArray(t)&&0===t.length))return e.errorMessage||`${e.label||e.name}은(는) 필수입니다.`;if(void 0!==i.min&&Number(t)<i.min)return e.errorMessage||`최소값은 ${i.min}입니다.`;if(void 0!==i.max&&Number(t)>i.max)return e.errorMessage||`최대값은 ${i.max}입니다.`;if(void 0!==i.minLength&&String(t).length<i.minLength)return e.errorMessage||`최소 ${i.minLength}자 이상 입력해주세요.`;if(void 0!==i.maxLength&&String(t).length>i.maxLength)return e.errorMessage||`최대 ${i.maxLength}자까지 입력 가능합니다.`;const s=i.pattern||e.pattern;if(s&&String(t))try{if(!new RegExp(s).test(String(t)))return e.errorMessage||"올바른 형식으로 입력해주세요."}catch{}}validateForm(){let e=!0;return this.fields.forEach(t=>{const i=this.validateField(t,this.values[t.name]);i?(this.errors[t.name]=i,e=!1):this.errors[t.name]=""}),e}handleSubmit(e){e.preventDefault(),this.fields.forEach(e=>{this.touched[e.name]=!0}),this.validateForm()?this.dispatchEvent(new CustomEvent("db-submit",{bubbles:!0,composed:!0,detail:{values:{...this.values}}})):this.refreshAllFieldStates()}handleReset(e){e.preventDefault(),this.values={...this.initialValues},this.bootstrapValues(),this.errors={},this.touched={},this.renderFields(),this.dispatchEvent(new CustomEvent("db-reset",{bubbles:!0,composed:!0,detail:{values:{...this.values}}})),this.dispatchEvent(new CustomEvent("db-change",{bubbles:!0,composed:!0,detail:{values:{...this.values}}}))}}customElements.get("db-form")||customElements.define("db-form",DbForm);export{DbForm};
|
|
1
|
+
import"./db-input.js";import"./db-textarea.js";import"./db-select.js";import"./db-checkbox.js";import"./db-radio.js";import"./db-button.js";const e="designbase-wc-form";class DbForm extends HTMLElement{constructor(){super(...arguments),this.built=!1,this.formEl=null,this.headerEl=null,this.fieldsEl=null,this.actionsEl=null,this.submitBtn=null,this.resetBtn=null,this.values={},this.errors={},this.touched={},this.initialValues={},this.fieldWrappers=new Map,this.boundSubmit=e=>this.handleSubmit(e),this.boundReset=e=>this.handleReset(e)}static get observedAttributes(){return["fields","columns","size","variant","title","description","submit-text","reset-text","show-reset","submit-loading","submit-disabled","initial-values"]}connectedCallback(){this.built||(this.buildShell(),this.built=!0),this.bootstrapValues(),this.syncAll()}attributeChangedCallback(e){this.built&&("initial-values"===e&&this.bootstrapValues(),"fields"===e&&this.bootstrapValues(),this.syncAll())}get fields(){return this.parseFields(this.getAttribute("fields"))}set fields(e){this.setAttribute("fields","string"==typeof e?e:JSON.stringify(e))}parseFields(e){if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}parseInitialValues(){const e=this.getAttribute("initial-values");if(!e)return{};try{const t=JSON.parse(e);return t&&"object"==typeof t?t:{}}catch{return{}}}bootstrapValues(){this.initialValues=this.parseInitialValues();const e={...this.initialValues};this.fields.forEach(t=>{void 0===e[t.name]&&(void 0===t.value?void 0===t.defaultValue?"checkbox"===t.type&&t.checkboxGroup?e[t.name]=[]:"checkbox"!==t.type?e[t.name]="":e[t.name]=!1:e[t.name]=t.defaultValue:e[t.name]=t.value)}),this.values=e}buildShell(){this.formEl=document.createElement("form"),this.formEl.className=`${e}__native`,this.formEl.noValidate=!0,this.formEl.addEventListener("submit",this.boundSubmit),this.headerEl=document.createElement("div"),this.headerEl.className=`${e}__header`,this.fieldsEl=document.createElement("div"),this.fieldsEl.className=`${e}__fields`,this.actionsEl=document.createElement("div"),this.actionsEl.className=`${e}__actions`,this.submitBtn=document.createElement("db-button"),this.submitBtn.setAttribute("type","submit"),this.submitBtn.setAttribute("variant","primary"),this.resetBtn=document.createElement("db-button"),this.resetBtn.setAttribute("type","button"),this.resetBtn.setAttribute("variant","secondary"),this.resetBtn.addEventListener("click",this.boundReset),this.actionsEl.append(this.submitBtn,this.resetBtn),this.formEl.append(this.fieldsEl,this.actionsEl),this.append(this.headerEl,this.formEl)}syncAll(){this.syncClasses(),this.syncHeader(),this.renderFields(),this.syncActions()}syncClasses(){const t=this.getAttribute("columns")||"1",i=this.getAttribute("size")||"m",s=this.getAttribute("variant")||"default";this.className=[e,`${e}--columns-${t}`,`${e}--${i}`,`${e}--${s}`,this.hasAttribute("submit-loading")&&`${e}--loading`].filter(Boolean).join(" ")}syncHeader(){if(!this.headerEl)return;const t=this.getAttribute("title")||"",i=this.getAttribute("description")||"";if(this.headerEl.innerHTML="",t||i){if(this.headerEl.hidden=!1,t){const i=document.createElement("h3");i.className=`${e}__title`,i.textContent=t,this.headerEl.appendChild(i)}if(i){const t=document.createElement("p");t.className=`${e}__description`,t.textContent=i,this.headerEl.appendChild(t)}}else this.headerEl.hidden=!0}syncActions(){const e=this.getAttribute("submit-text")||"제출",t=this.getAttribute("reset-text")||"리셋",i=this.hasAttribute("show-reset");this.submitBtn&&(this.submitBtn.textContent=e,this.hasAttribute("submit-loading")?this.submitBtn.setAttribute("loading",""):this.submitBtn.removeAttribute("loading"),this.hasAttribute("submit-disabled")?this.submitBtn.setAttribute("disabled",""):this.submitBtn.removeAttribute("disabled")),this.resetBtn&&(this.resetBtn.textContent=t,this.resetBtn.hidden=!i)}renderFields(){if(!this.fieldsEl)return;const t=this.getAttribute("size")||"m";this.fieldsEl.innerHTML="",this.fieldWrappers.clear(),this.fields.forEach(i=>{const s=document.createElement("div");if(s.className=`${e}__field-wrapper ${e}__field-wrapper--${i.type||"text"}`,s.dataset.field=i.name,i.label&&("checkbox"!==i.type||i.checkboxGroup)){const t=document.createElement("label");if(t.className=`${e}__label`,t.htmlFor=`db-form-${i.name}`,t.textContent=i.label,i.required||i.validation?.required){const i=document.createElement("span");i.className=`${e}__required`,i.textContent="*",i.setAttribute("aria-hidden","true"),t.appendChild(i)}s.appendChild(t)}s.appendChild(this.createFieldControl(i,t)),this.fieldsEl.appendChild(s),this.fieldWrappers.set(i.name,s),this.refreshFieldState(i.name)})}refreshFieldState(t){const i=this.fields.find(e=>e.name===t),s=this.fieldWrappers.get(t);if(!i||!s)return;const r=Boolean(this.touched[t]&&this.errors[t]);s.classList.toggle(`${e}__field-wrapper--error`,r),s.querySelector(`.${e}__error`)?.remove(),s.querySelector(`.${e}__help`)?.remove();const a=s.querySelector(`.${e}__field, db-input, db-textarea, db-select, db-checkbox`);a&&(r?(a.setAttribute("error",""),a.setAttribute("error-message",this.errors[t])):(a.removeAttribute("error"),a.removeAttribute("error-message")));const n=a&&["DB-INPUT","DB-TEXTAREA","DB-SELECT"].includes(a.tagName);if(!r||!n){if(r){const i=document.createElement("div");return i.className=`${e}__error`,i.textContent=this.errors[t],void s.appendChild(i)}if(i.helpText){const t=document.createElement("div");t.className=`${e}__help`,t.textContent=i.helpText,s.appendChild(t)}}}refreshAllFieldStates(){this.fields.forEach(e=>this.refreshFieldState(e.name))}createFieldControl(t,i){const s=t.type||"text",r=this.values[t.name],a=Boolean(this.touched[t.name]&&this.errors[t.name]),n=a?this.errors[t.name]:"";if("textarea"===s){const s=document.createElement("db-textarea");return s.className=`${e}__field`,s.setAttribute("name",t.name),s.id=`db-form-${t.name}`,s.setAttribute("size",i),s.setAttribute("full-width",""),t.placeholder&&s.setAttribute("placeholder",t.placeholder),void 0!==r&&s.setAttribute("value",String(r)),t.disabled&&s.setAttribute("disabled",""),t.readOnly&&s.setAttribute("readonly",""),t.required&&s.setAttribute("required",""),t.maxLength&&s.setAttribute("max-length",String(t.maxLength)),a&&(s.setAttribute("error",""),s.setAttribute("error-message",n)),s.addEventListener("db-change",e=>{const i=e.detail;this.handleFieldChange(t,i.value)}),s.addEventListener("db-input",e=>{const i=e.detail;this.handleFieldChange(t,i.value,!1)}),s}if("select"===s){const s=document.createElement("db-select");return s.className=`${e}__field`,s.setAttribute("name",t.name),s.id=`db-form-${t.name}`,s.setAttribute("size",i),s.setAttribute("full-width",""),t.placeholder&&s.setAttribute("placeholder",t.placeholder),t.options&&s.setAttribute("options",JSON.stringify(t.options)),t.multiple&&s.setAttribute("multiple",""),t.disabled&&s.setAttribute("disabled",""),t.readOnly&&s.setAttribute("readonly",""),t.required&&s.setAttribute("required",""),void 0!==r&&s.setAttribute("value",Array.isArray(r)?JSON.stringify(r):String(r)),a&&(s.setAttribute("error",""),s.setAttribute("error-message",n)),s.addEventListener("db-change",e=>{const i=e.detail;this.handleFieldChange(t,i.value)}),s}if("radio"===s&&t.radioGroup){const s=document.createElement("div");return s.className=`${e}__radio-group`,s.setAttribute("role","radiogroup"),(t.options||[]).forEach(e=>{const a=document.createElement("db-radio");a.setAttribute("name",t.name),a.setAttribute("value",e.value),a.setAttribute("size",i),r===e.value&&a.setAttribute("checked",""),(t.disabled||e.disabled)&&a.setAttribute("disabled",""),a.textContent=e.label,a.addEventListener("db-change",i=>{i.detail.checked&&this.handleFieldChange(t,e.value)}),s.appendChild(a)}),s}if("checkbox"===s&&t.checkboxGroup){const s=document.createElement("div");s.className=`${e}__checkbox-group`;const a=Array.isArray(r)?r:[];return(t.options||[]).forEach(e=>{const r=document.createElement("db-checkbox");r.setAttribute("name",t.name),r.setAttribute("value",e.value),r.setAttribute("size",i),a.includes(e.value)&&r.setAttribute("checked",""),(t.disabled||e.disabled)&&r.setAttribute("disabled",""),r.textContent=e.label,r.addEventListener("db-change",i=>{const s=i.detail,r=Array.isArray(this.values[t.name])?[...this.values[t.name]]:[],a=s.checked?[...new Set([...r,e.value])]:r.filter(t=>t!==e.value);this.handleFieldChange(t,a)}),s.appendChild(r)}),s}if("checkbox"===s){const s=document.createElement("db-checkbox");return s.className=`${e}__field`,s.setAttribute("name",t.name),s.id=`db-form-${t.name}`,s.setAttribute("size",i),r&&s.setAttribute("checked",""),t.disabled&&s.setAttribute("disabled",""),t.readOnly&&s.setAttribute("readonly",""),t.required&&s.setAttribute("required",""),s.textContent=t.label||"",s.addEventListener("db-change",e=>{const i=e.detail;this.handleFieldChange(t,i.checked)}),s}const l=document.createElement("db-input");return l.className=`${e}__field`,l.setAttribute("name",t.name),l.id=`db-form-${t.name}`,l.setAttribute("type",s),l.setAttribute("size",i),l.setAttribute("full-width",""),t.placeholder&&l.setAttribute("placeholder",t.placeholder),void 0!==r&&!1!==r&&l.setAttribute("value",String(r)),t.disabled&&l.setAttribute("disabled",""),t.readOnly&&l.setAttribute("readonly",""),t.required&&l.setAttribute("required",""),void 0!==t.min&&l.setAttribute("min",String(t.min)),void 0!==t.max&&l.setAttribute("max",String(t.max)),void 0!==t.minLength&&l.setAttribute("minlength",String(t.minLength)),void 0!==t.maxLength&&l.setAttribute("maxlength",String(t.maxLength)),t.pattern&&l.setAttribute("pattern",t.pattern),a&&(l.setAttribute("error",""),l.setAttribute("error-message",n)),l.addEventListener("db-change",e=>{const i=e.detail;this.handleFieldChange(t,i.value)}),l.addEventListener("db-input",e=>{const i=e.detail;this.handleFieldChange(t,i.value,!1)}),l}handleFieldChange(e,t,i=!0){this.values[e.name]=t,i&&(this.touched[e.name]=!0);const s=this.validateField(e,t);this.errors[e.name]=s||"",this.refreshFieldState(e.name),this.dispatchEvent(new CustomEvent("db-change",{bubbles:!0,composed:!0,detail:{values:{...this.values}}}))}validateField(e,t){const i=e.validation||{};if((i.required??e.required)&&(null==t||""===t||!1===t||Array.isArray(t)&&0===t.length))return e.errorMessage||`${e.label||e.name}은(는) 필수입니다.`;if(void 0!==i.min&&Number(t)<i.min)return e.errorMessage||`최소값은 ${i.min}입니다.`;if(void 0!==i.max&&Number(t)>i.max)return e.errorMessage||`최대값은 ${i.max}입니다.`;if(void 0!==i.minLength&&String(t).length<i.minLength)return e.errorMessage||`최소 ${i.minLength}자 이상 입력해주세요.`;if(void 0!==i.maxLength&&String(t).length>i.maxLength)return e.errorMessage||`최대 ${i.maxLength}자까지 입력 가능합니다.`;const s=i.pattern||e.pattern;if(s&&String(t))try{if(!new RegExp(s).test(String(t)))return e.errorMessage||"올바른 형식으로 입력해주세요."}catch{}}validateForm(){let e=!0;return this.fields.forEach(t=>{const i=this.validateField(t,this.values[t.name]);i?(this.errors[t.name]=i,e=!1):this.errors[t.name]=""}),e}handleSubmit(e){e.preventDefault(),this.fields.forEach(e=>{this.touched[e.name]=!0}),this.validateForm()?this.dispatchEvent(new CustomEvent("db-submit",{bubbles:!0,composed:!0,detail:{values:{...this.values}}})):this.refreshAllFieldStates()}handleReset(e){e.preventDefault(),this.values={...this.initialValues},this.bootstrapValues(),this.errors={},this.touched={},this.renderFields(),this.dispatchEvent(new CustomEvent("db-reset",{bubbles:!0,composed:!0,detail:{values:{...this.values}}})),this.dispatchEvent(new CustomEvent("db-change",{bubbles:!0,composed:!0,detail:{values:{...this.values}}}))}}customElements.get("db-form")||customElements.define("db-form",DbForm);export{DbForm};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { GlyphMatrixPreset, GlyphMatrixSize } from '../ui-contracts/dist/components.d.js';
|
|
2
|
+
|
|
3
|
+
declare class DbGlyphMatrix extends HTMLElement {
|
|
4
|
+
static get observedAttributes(): string[];
|
|
5
|
+
private built;
|
|
6
|
+
private canvas?;
|
|
7
|
+
private ctx?;
|
|
8
|
+
private ro?;
|
|
9
|
+
private rafId;
|
|
10
|
+
private lastTick;
|
|
11
|
+
private stopped;
|
|
12
|
+
private cols;
|
|
13
|
+
private rows;
|
|
14
|
+
private cells;
|
|
15
|
+
private alphas;
|
|
16
|
+
private rgba;
|
|
17
|
+
private mouseX;
|
|
18
|
+
private mouseY;
|
|
19
|
+
private mouseHandler;
|
|
20
|
+
private mouseLeaveHandler;
|
|
21
|
+
get preset(): GlyphMatrixPreset;
|
|
22
|
+
set preset(value: GlyphMatrixPreset);
|
|
23
|
+
get size(): GlyphMatrixSize;
|
|
24
|
+
set size(value: GlyphMatrixSize);
|
|
25
|
+
get glyphs(): string;
|
|
26
|
+
set glyphs(value: string);
|
|
27
|
+
get cellSize(): number;
|
|
28
|
+
set cellSize(value: number);
|
|
29
|
+
get mutationRate(): number;
|
|
30
|
+
set mutationRate(value: number);
|
|
31
|
+
get interval(): number;
|
|
32
|
+
set interval(value: number);
|
|
33
|
+
get fadeBottom(): number;
|
|
34
|
+
set fadeBottom(value: number);
|
|
35
|
+
get color(): string;
|
|
36
|
+
set color(value: string);
|
|
37
|
+
get interactive(): boolean;
|
|
38
|
+
set interactive(value: boolean);
|
|
39
|
+
connectedCallback(): void;
|
|
40
|
+
disconnectedCallback(): void;
|
|
41
|
+
attributeChangedCallback(name: string, _oldVal: string | null, _newVal: string | null): void;
|
|
42
|
+
private attachMouseEvents;
|
|
43
|
+
private detachMouseEvents;
|
|
44
|
+
private build;
|
|
45
|
+
private syncColor;
|
|
46
|
+
private sync;
|
|
47
|
+
private resize;
|
|
48
|
+
private draw;
|
|
49
|
+
private tick;
|
|
50
|
+
private start;
|
|
51
|
+
}
|
|
52
|
+
declare global {
|
|
53
|
+
interface HTMLElementTagNameMap {
|
|
54
|
+
'db-glyph-matrix': DbGlyphMatrix;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export { DbGlyphMatrix };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{coerceToContract as t}from"../node_modules/@designbasekorea/ui-contracts/dist/primitives.js";import{GLYPH_MATRIX_PRESETS as e,GLYPH_MATRIX_SIZES as s}from"../node_modules/@designbasekorea/ui-contracts/dist/components.js";const i="designbase-wc-glyph-matrix",a={code:"01·•+*/\\<>=-_",matrix:"ヲアウエオカキケコサシスセソタツテナニヌネハヒホマミムメモヤユラリワ9876543210",binary:"01",dots:"·•:;*+~",alphanumeric:"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"},r={s:10,m:14,l:18};class DbGlyphMatrix extends HTMLElement{constructor(){super(...arguments),this.built=!1,this.rafId=null,this.lastTick=0,this.stopped=!1,this.cols=0,this.rows=0,this.cells=[],this.alphas=[],this.rgba={r:107,g:114,b:128,a:1},this.mouseX=-9999,this.mouseY=-9999,this.mouseHandler=t=>{const e=this.getBoundingClientRect();this.mouseX=t.clientX-e.left,this.mouseY=t.clientY-e.top},this.mouseLeaveHandler=()=>{this.mouseX=-9999,this.mouseY=-9999},this.tick=t=>{if(!this.stopped){if(t-this.lastTick>=this.interval){this.lastTick=t;const e=this.cols*this.rows,s=Math.max(1,Math.floor(e*this.mutationRate)),i=this.glyphs,a=i.length;for(let t=0;t<s;t++){const t=Math.floor(Math.random()*e);this.cells[t]=i[Math.floor(Math.random()*a)]||"0",this.alphas[t]=.05+.45*Math.random()}this.draw()}this.rafId=requestAnimationFrame(this.tick)}}}static get observedAttributes(){return["glyphs","preset","size","cell-size","mutation-rate","interval","fade-bottom","color","interactive"]}get preset(){return t(this.getAttribute("preset"),e,"code")}set preset(t){this.setAttribute("preset",t)}get size(){return t(this.getAttribute("size"),s,"m")}set size(t){this.setAttribute("size",t)}get glyphs(){const t=this.getAttribute("glyphs");return t||(a[this.preset]||a.code)}set glyphs(t){this.setAttribute("glyphs",t)}get cellSize(){const t=this.getAttribute("cell-size");if(t){const e=parseFloat(t);if(Number.isFinite(e)&&e>4)return e}return r[this.size]||14}set cellSize(t){this.setAttribute("cell-size",String(t))}get mutationRate(){const t=parseFloat(this.getAttribute("mutation-rate")||"0.04");return Number.isFinite(t)&&t>=0?t:.04}set mutationRate(t){this.setAttribute("mutation-rate",String(t))}get interval(){const t=parseFloat(this.getAttribute("interval")||"90");return Number.isFinite(t)&&t>10?t:90}set interval(t){this.setAttribute("interval",String(t))}get fadeBottom(){const t=parseFloat(this.getAttribute("fade-bottom")||"0.6");return Number.isFinite(t)?t:.6}set fadeBottom(t){this.setAttribute("fade-bottom",String(t))}get color(){return this.getAttribute("color")||"#6B7280"}set color(t){this.setAttribute("color",t)}get interactive(){return this.hasAttribute("interactive")}set interactive(t){t?this.setAttribute("interactive",""):this.removeAttribute("interactive")}connectedCallback(){this.setAttribute("aria-hidden","true"),this.built||(this.build(),this.built=!0),this.syncColor(),this.sync(),this.interactive&&this.attachMouseEvents(),this.start()}disconnectedCallback(){this.stopped=!0,null!==this.rafId&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.ro&&(this.ro.disconnect(),this.ro=void 0),this.detachMouseEvents()}attributeChangedCallback(t,e,s){this.built&&("color"===t?this.syncColor():"interactive"===t&&(this.interactive?this.attachMouseEvents():this.detachMouseEvents()),this.sync())}attachMouseEvents(){this.addEventListener("mousemove",this.mouseHandler,{passive:!0}),this.addEventListener("mouseleave",this.mouseLeaveHandler,{passive:!0});const t=this.parentElement;t&&(t.addEventListener("mousemove",this.mouseHandler,{passive:!0}),t.addEventListener("mouseleave",this.mouseLeaveHandler,{passive:!0}))}detachMouseEvents(){this.removeEventListener("mousemove",this.mouseHandler),this.removeEventListener("mouseleave",this.mouseLeaveHandler);const t=this.parentElement;t&&(t.removeEventListener("mousemove",this.mouseHandler),t.removeEventListener("mouseleave",this.mouseLeaveHandler))}build(){this.classList.add(i);const t=document.createElement("canvas");t.className=`${i}__canvas`,t.setAttribute("aria-hidden","true"),this.canvas=t,this.ctx=t.getContext("2d"),this.replaceChildren(t),"undefined"!=typeof ResizeObserver&&(this.ro=new ResizeObserver(()=>{this.resize(),this.draw()}),this.ro.observe(this))}syncColor(){const t=document.createElement("canvas");t.width=1,t.height=1;const e=t.getContext("2d");if(!e)return;e.fillStyle="#6B7280",e.fillStyle=this.color,e.fillRect(0,0,1,1);const[s,i,a,r]=e.getImageData(0,0,1,1).data;this.rgba={r:s,g:i,b:a,a:r/255}}sync(){e.forEach(t=>this.classList.remove(`${i}--${t}`)),s.forEach(t=>this.classList.remove(`${i}--${t}`)),this.classList.add(`${i}--${this.preset}`),this.classList.add(`${i}--${this.size}`),this.resize(),this.draw()}resize(){if(!this.canvas||!this.ctx)return;const t=window.devicePixelRatio||1;let e=this.clientWidth,s=this.clientHeight;if(0===e||0===s){const t=this.parentElement;t&&(e=t.clientWidth,s=t.clientHeight)}0===e&&(e=300),0===s&&(s=300),this.canvas.width=e*t,this.canvas.height=s*t,this.canvas.style.width=`${e}px`,this.canvas.style.height=`${s}px`,this.ctx.setTransform(t,0,0,t,0,0);const i=this.cellSize;this.cols=Math.ceil(e/i),this.rows=Math.ceil(s/i);const a=this.cols*this.rows,r=this.glyphs,h=r.length;this.cells=new Array(a),this.alphas=new Array(a);for(let t=0;t<a;t++)this.cells[t]=r[Math.floor(Math.random()*h)]||"0",this.alphas[t]=.05+.35*Math.random()}draw(){if(!this.ctx||!this.canvas)return;const t=this.ctx,e=this.clientWidth||this.canvas.width/(window.devicePixelRatio||1),s=this.clientHeight||this.canvas.height/(window.devicePixelRatio||1);t.clearRect(0,0,e,s);const i=this.cellSize;t.font=i-2+"px ui-monospace, SFMono-Regular, Menlo, monospace",t.textBaseline="top";const{r:a,g:r,b:h,a:o}=this.rgba,n=this.fadeBottom,l=this.rows,c=this.cols,d=this.interactive&&this.mouseX>=0&&this.mouseY>=0;for(let e=0;e<l;e++){const s=n>0?Math.max(0,1-e/l*n):1,u=e*i;for(let n=0;n<c;n++){const l=e*c+n,m=n*i;let v=this.alphas[l]*s*o;if(d){const t=m-this.mouseX,e=u-this.mouseY,s=t*t+e*e;if(s<6400){const t=Math.max(0,1-Math.sqrt(s)/80);v=Math.min(1,v+.6*t)}}t.fillStyle=`rgba(${a}, ${r}, ${h}, ${v})`,t.fillText(this.cells[l]||"",m,u)}}}start(){this.stopped=!1,this.lastTick=0,window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches?this.draw():(null!==this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=requestAnimationFrame(this.tick))}}customElements.get("db-glyph-matrix")||customElements.define("db-glyph-matrix",DbGlyphMatrix);export{DbGlyphMatrix};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
type DbIconName = 'arrow-bar-left' | 'arrow-bar-right' | 'award' | 'apple' | 'play-store' | 'arrow-right' | 'star' | 'star-filled' | 'star-half' | 'trending-up' | 'cart' | 'bell-active' | 'caret-down-filled' | 'caret-updown-filled' | 'chevron-down' | 'chevron-up' | 'chevron-left' | 'chevron-right' | 'calendar' | 'camera' | 'clock' | 'bulb' | 'circle-checked' | 'cloud-close' | 'close' | 'done' | 'documentation' | 'doughnut-chart' | 'download' | 'error-filled' | 'edit' | 'eyedropper' | 'file-new' | 'home-outline' | 'home-filled' | 'folder' | 'more-horizontal' | 'folder-open' | 'gallery' | 'globe' | 'hide' | 'info-filled' | 'lock' | 'mail' | 'menu' | 'microphone' | 'minus' | 'moon' | 'more-vertical' | 'paperclip' | 'pause' | 'play' | 'plus' | 'copy' | 'code' | 'write' | 'upload' | 'video' | 'volume-up' | 'mute-filled' | 'package' | 'delivery-filled' | 'repeat' | 'settings' | 'refresh' | 'expand' | 'shrink' | 'grip-vertical' | 'grip-horizontal' | 'search' | 'send' | 'share-alt' | 'show' | 'sparkle' | 'stop' | 'sun' | 'thumb-down' | 'thumb-up' | 'trash' | 'user' | 'warning-filled';
|
|
1
|
+
type DbIconName = 'shape-line' | 'shape-triangle' | 'shape-ellipse' | 'shape-rectangle' | 'filp-vertical' | 'filp-horizontal' | 'filter' | 'sort-descending' | 'navigation' | 'move' | 'arrow-back-up' | 'zoom-in' | 'zoom-out' | 'layer' | 'unlock' | 'layout-align-left' | 'layout-align-center' | 'layout-align-right' | 'layout-align-top' | 'layout-align-middle' | 'layout-align-bottom' | 'text' | 'shapes' | 'text-align-left' | 'text-align-center' | 'text-align-right' | 'desktop' | 'tablet' | 'mobile' | 'plane' | 'arrow-bar-left' | 'arrow-bar-right' | 'award' | 'apple' | 'play-store' | 'arrow-right' | 'star' | 'star-filled' | 'star-half' | 'trending-up' | 'cart' | 'credit-card' | 'bell-active' | 'caret-down-filled' | 'caret-updown-filled' | 'chevron-down' | 'chevron-up' | 'chevron-left' | 'chevron-right' | 'calendar' | 'camera' | 'clock' | 'bulb' | 'circle-checked' | 'cloud-close' | 'close' | 'done' | 'documentation' | 'doughnut-chart' | 'download' | 'error-filled' | 'edit' | 'eyedropper' | 'file-new' | 'home-outline' | 'home-filled' | 'folder' | 'more-horizontal' | 'folder-open' | 'gallery' | 'globe' | 'hide' | 'info-filled' | 'lock' | 'mail' | 'menu' | 'microphone' | 'minus' | 'moon' | 'more-vertical' | 'paperclip' | 'pause' | 'play-outline' | 'play' | 'plus' | 'copy' | 'code' | 'write' | 'upload' | 'video' | 'volume-up' | 'mute-filled' | 'package' | 'delivery-filled' | 'repeat' | 'settings' | 'refresh' | 'expand' | 'shrink' | 'grip-vertical' | 'grip-horizontal' | 'search' | 'send' | 'share-alt' | 'show' | 'sparkle' | 'stop' | 'sun' | 'thumb-down' | 'thumb-up' | 'trash' | 'twitter' | 'x-logo' | 'heart' | 'heart-filled' | 'verified-badge' | 'comment' | 'user' | 'warning-filled';
|
|
2
2
|
|
|
3
3
|
export type { DbIconName };
|