@vmscloud/moz-ui-components-core 0.1.59 → 0.1.61

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.
@@ -0,0 +1,20 @@
1
+ import { MozSpec } from '../../runtime/types';
2
+ import { NotificationCardProps, NotificationCardEmits, NotificationCardApi } from './notification-card.core';
3
+ import { NotificationItemProps, NotificationItemEmits } from './notification-item.core';
4
+
5
+ export { createNotificationCard, NOTIFICATION_TONES, NOTIFICATION_POSITIONS, } from './notification-card.core';
6
+ export type { NotificationCardProps, NotificationCardEmits, NotificationCardApi, NotificationTone, NotificationPosition, } from './notification-card.core';
7
+ export { createNotificationItem } from './notification-item.core';
8
+ export type { NotificationItemProps, NotificationItemEmits } from './notification-item.core';
9
+ export { useNotification } from './useNotification';
10
+ export type { NotificationOptions, NotificationHandle, NotificationMountOptions, NotificationInstance, } from './useNotification';
11
+ /**
12
+ * NotificationCard — 떠 있는 알림 카드 (ITSM-2026-003295). 명령형(`useNotification`)이 기본이고,
13
+ * 소비 앱이 스택을 직접 쥐면 `<NotificationCard inline>` 으로 자기 컨테이너에 그린다.
14
+ * 스타일: notification.css.
15
+ */
16
+ export declare const NOTIFICATION_CARD_SPEC: MozSpec<NotificationCardProps, NotificationCardEmits, NotificationCardApi>;
17
+ /**
18
+ * NotificationItem — 알림 목록의 한 행. 목록·헤더·빈 상태(`EmptyState composed`)는 소비 앱이 조립한다.
19
+ */
20
+ export declare const NOTIFICATION_ITEM_SPEC: MozSpec<NotificationItemProps, NotificationItemEmits, void>;
@@ -0,0 +1,80 @@
1
+ /**
2
+ * NotificationCard 코어 — 다른 사람이 일으킨 사건을 알리는 떠 있는 카드 (ITSM-2026-003295).
3
+ *
4
+ * Toast 는 "내가 한 동작의 결과" 를 한 줄로 잠깐 보여주는 알약이다. 티켓 전이·멘션처럼 **누가·무엇을·
5
+ * 언제** 했는지와 바로가기가 필요한 알림은 이 카드로 그린다. 디자인은 mozart-cloud APS 의
6
+ * `Notification.vue`(우측 하단 카드, 유형별 좌측 바, 호버 시 타이머 정지)를 참고했고 코드는 새로 썼다.
7
+ *
8
+ * 구조: `<div class="moz-notification-card" data-tone>` 안에
9
+ * - `.moz-notification-card-icon` — `avatar` slot, 없으면 tone 상태 아이콘(Callout 20px 세트 재사용)
10
+ * - `.moz-notification-card-main` — `.moz-notification-card-content`(제목·본문·시각)와 `actions` slot.
11
+ * `onSelect` 가 있으면 content 가 `role="button"`·`tabindex="0"` 이 되어 클릭·Enter·Space 로 선택된다.
12
+ * 액션은 content 밖에 둔다 — 버튼 안에 버튼을 넣지 않기 위해서다.
13
+ * - 닫기 버튼(`dismissible`) — 접근 이름은 `closeLabel` 또는 로케일 `Notification.close`.
14
+ *
15
+ * 수명주기는 Toast 와 같다: 마운트 → 표시, `duration` 이 지나면 숨김 → `exitDuration` 뒤 `onDismiss`.
16
+ * `duration: 0` 이면 닫을 때까지 남는다. 선택하면 `onSelect` 후 (dismissible 이면) 닫힌다.
17
+ *
18
+ * 텔레포트: 기본은 위치별 전용 스택 컨테이너(`.moz-notification-stack`)로 보낸다. Toast 의
19
+ * `.toast--top/bottom` 과는 섞지 않는다 — 섞으면 Toast `queue` 가 알림 수를 세고 두 종류가 한 열에
20
+ * 엇갈린다. `inline` 이면 소비자가 둔 자리에 그리고 컨테이너를 만들지 않는다.
21
+ *
22
+ * 스택은 ESC 계층(DismissStack)에 등록하지 않는다. 알림은 포커스를 가져가지 않는 라이브 영역이고,
23
+ * ESC 로 알림이 닫히면 열린 Popup·Popover 의 ESC 를 가로챈다.
24
+ */
25
+ export declare const NOTIFICATION_TONES: readonly ["info", "success", "warning", "danger", "neutral"];
26
+ export type NotificationTone = (typeof NOTIFICATION_TONES)[number];
27
+ export declare const NOTIFICATION_POSITIONS: readonly ["top", "top-right", "top-left", "bottom", "bottom-right", "bottom-left"];
28
+ export type NotificationPosition = (typeof NOTIFICATION_POSITIONS)[number];
29
+ export interface NotificationCardProps {
30
+ /** 색·아이콘 의미. 어휘 밖·미지정은 `info`. `danger` 만 `role="alert"` 로 즉시 낭독된다 */
31
+ tone?: NotificationTone;
32
+ /** 제목 텍스트. 요소가 필요하면 `heading` slot(그쪽이 이긴다) */
33
+ title?: string;
34
+ /** 본문 텍스트. 요소가 필요하면 `description` slot(그쪽이 이긴다) */
35
+ body?: string;
36
+ /** 표시용 시각 문자열. 포맷(상대 시간 등)은 소비자가 정한다 */
37
+ time?: string;
38
+ /** 기계 판독용 시각(ISO 8601) — `<time datetime>` 에 실린다 */
39
+ datetime?: string;
40
+ /** 닫기 버튼을 붙인다. false 면 버튼이 없고 선택해도 닫히지 않는다. 기본 true */
41
+ dismissible?: boolean;
42
+ /** 닫기 버튼의 접근 이름. 없거나 빈 문자열이면 로케일 `Notification.close` */
43
+ closeLabel?: string;
44
+ /** 자동으로 닫히기까지(ms). 0 이면 닫을 때까지 남는다. 기본 5000 */
45
+ duration?: number;
46
+ /** 마우스가 올라가 있거나 포커스가 카드 안에 있는 동안 타이머를 멈춘다. 기본 true */
47
+ pauseOnHover?: boolean;
48
+ /** 숨김 뒤 `onDismiss` 까지의 대기(ms). 기본 150 */
49
+ exitDuration?: number;
50
+ /** 스택 위치. 기본 `bottom-right`. `inline` 이면 쓰지 않는다 */
51
+ position?: NotificationPosition;
52
+ /**
53
+ * 제자리 렌더. 스택 컨테이너로 텔레포트하지 않고 소비자가 둔 자리에 그린다 — 소비 앱이 자기
54
+ * store·컨테이너로 스택을 쥐는 경우다. 기본 false.
55
+ */
56
+ inline?: boolean;
57
+ /** 카드 본체 선택(클릭·Enter·Space). 주면 본체가 키보드로 도달 가능해진다 */
58
+ onSelect?: () => void;
59
+ /** 닫힘이 끝난 뒤(숨김 + `exitDuration`) 한 번 호출된다 */
60
+ onDismiss?: () => void;
61
+ class?: unknown;
62
+ style?: unknown;
63
+ [attr: string]: unknown;
64
+ }
65
+ export interface NotificationCardEmits {
66
+ }
67
+ export interface NotificationCardApi {
68
+ /** 지금 닫는다(숨김 → `exitDuration` 뒤 `onDismiss`). 이미 닫히는 중이면 무시한다 */
69
+ dismiss(): void;
70
+ /** 닫히는 중이거나 이미 닫혔는가 — 타이머로 닫히는 카드도 포함한다 */
71
+ isClosing(): boolean;
72
+ }
73
+ export declare function pickNotificationTone(raw: unknown): NotificationTone;
74
+ export declare function pickNotificationPosition(raw: unknown): NotificationPosition;
75
+ /**
76
+ * 위치별 스택 컨테이너 — 없으면 body 에 만든다. Toast 의 `setupContainer` 와 같은 방식이고
77
+ * 클래스만 다르다. 하단 위치는 `column-reverse` 라 나중에 붙은 카드가 모서리에 가장 가깝다.
78
+ */
79
+ export declare function ensureNotificationStack(position: NotificationPosition): HTMLElement;
80
+ export declare const createNotificationCard: import('../..').CoreFactory<NotificationCardProps, NotificationCardEmits, NotificationCardApi>;
@@ -0,0 +1,33 @@
1
+ /**
2
+ * NotificationItem 코어 — 알림 목록(벨 패널 등)의 한 행 (ITSM-2026-003295).
3
+ *
4
+ * 디자인은 APS `NotificationPanel.vue` 의 항목(제목 + 안 읽음 점, 본문, 시각)을 참고했다.
5
+ * 목록 컨테이너·헤더·읽음 처리·빈 상태는 소비 앱 몫이다 — 빈 상태는 `EmptyState`(`composed`)를 쓴다.
6
+ *
7
+ * 구조: `onSelect` 가 있으면 루트가 `<button type="button">`(키보드는 네이티브 버튼이 담당), 없으면
8
+ * `<div>`. 안에 `.moz-notification-item-header`(제목 + 안 읽음 점 + `meta` slot), 본문, `<time>`.
9
+ * 안 읽음은 `data-unread` 와 점으로 보이고, 점 옆 숨김 텍스트(로케일 `Notification.unread`)로 읽힌다.
10
+ *
11
+ * `meta` slot 은 제목 줄 오른쪽 보조 정보(작성자 아바타·티켓 번호 등)다. 버튼 루트 안에 그려지므로
12
+ * 대화형 요소를 넣지 않는다.
13
+ */
14
+ export interface NotificationItemProps {
15
+ /** 제목 텍스트. 요소가 필요하면 `heading` slot(그쪽이 이긴다) */
16
+ title?: string;
17
+ /** 본문 텍스트. 요소가 필요하면 `description` slot(그쪽이 이긴다) */
18
+ body?: string;
19
+ /** 표시용 시각 문자열. 포맷은 소비자가 정한다 */
20
+ time?: string;
21
+ /** 기계 판독용 시각(ISO 8601) — `<time datetime>` 에 실린다 */
22
+ datetime?: string;
23
+ /** 안 읽은 항목 — 점과 `data-unread` 를 단다 */
24
+ unread?: boolean;
25
+ /** 행 선택(클릭·Enter·Space). 주면 루트가 버튼이 된다 */
26
+ onSelect?: () => void;
27
+ class?: unknown;
28
+ style?: unknown;
29
+ [attr: string]: unknown;
30
+ }
31
+ export interface NotificationItemEmits {
32
+ }
33
+ export declare const createNotificationItem: import('../..').CoreFactory<NotificationItemProps, NotificationItemEmits, void>;
@@ -0,0 +1,44 @@
1
+ import { CoreFactoryOpts } from '../../runtime/types';
2
+ import { NotificationCardProps } from './notification-card.core';
3
+
4
+ /**
5
+ * useNotification — 알림 카드 명령형 API (ITSM-2026-003295, 프레임워크 무관).
6
+ *
7
+ * `useToast` 와 같은 방식으로 `display:contents` 앵커를 body 에 붙이고 카드 코어를 마운트한다(코어가
8
+ * 위치별 스택 컨테이너로 텔레포트). 다른 점은 세 가지다.
9
+ * - `open` 이 `{ id, close }` 핸들을 돌려주고 `close(id)`·`closeAll()` 로 닫을 수 있다.
10
+ * - 같은 위치에 열린 카드가 `max` 개면 가장 오래된 카드부터 닫는다.
11
+ * - 같은 `id` 의 카드가 열려 있으면 새로 열지 않고 그 핸들을 돌려준다(같은 사건의 중복 수신 방지).
12
+ *
13
+ * 열린 카드 목록은 모듈에 하나다 — 여러 곳에서 `useNotification()` 을 불러도 같은 스택을 본다.
14
+ * 그래서 `closeAll()` 은 이 API 로 연 카드 전부를 닫는다.
15
+ */
16
+ /** `inline` 을 뺀 카드 prop. `Omit` 은 인덱스 시그니처가 있는 타입에서 알려진 키를 잃어 `Pick` 으로 고른다. */
17
+ type CardOptionKeys = 'tone' | 'title' | 'body' | 'time' | 'datetime' | 'dismissible' | 'closeLabel' | 'duration' | 'pauseOnHover' | 'exitDuration' | 'position' | 'onSelect' | 'onDismiss' | 'class' | 'style';
18
+ export interface NotificationOptions extends Pick<NotificationCardProps, CardOptionKeys> {
19
+ /** 그 밖의 속성(`data-*`·`aria-*` 등)은 카드 루트로 그대로 넘어간다 */
20
+ [attr: string]: unknown;
21
+ /** 카드 식별자. 같은 id 가 열려 있으면 새로 열지 않는다. 없으면 자동 생성 */
22
+ id?: string;
23
+ /** 같은 위치에 동시에 보일 최대 개수. 넘으면 가장 오래된 카드부터 닫는다. 기본 3 */
24
+ max?: number;
25
+ }
26
+ export interface NotificationHandle {
27
+ id: string;
28
+ /** 이 카드를 닫는다 */
29
+ close(): void;
30
+ }
31
+ /**
32
+ * 어댑터용 마운트 옵션 — React 훅처럼 slot 콘텐츠(아바타·액션 등)와 로케일을 넘길 때 쓴다.
33
+ * `onRemoved` 는 카드가 DOM 에서 빠진 뒤 호출된다(어댑터의 slot root 정리용).
34
+ */
35
+ export interface NotificationMountOptions extends Pick<CoreFactoryOpts, 'slots' | 'locale'> {
36
+ onRemoved?: () => void;
37
+ }
38
+ export declare const useNotification: (globalOptions?: NotificationOptions) => {
39
+ open: (options?: NotificationOptions, mount?: NotificationMountOptions) => NotificationHandle;
40
+ close: (id: string) => void;
41
+ closeAll: () => void;
42
+ };
43
+ export type NotificationInstance = ReturnType<typeof useNotification>;
44
+ export {};