@sellmate/design-system-vue 1.0.46 → 1.0.47

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.
@@ -1,5 +1,6 @@
1
1
  import { type StencilVueComponent } from '@stencil/vue-output-target/runtime';
2
2
  import type { JSX } from '@sellmate/design-system';
3
+ export declare const SdActionModal: StencilVueComponent<JSX.SdActionModal>;
3
4
  export declare const SdBadge: StencilVueComponent<JSX.SdBadge>;
4
5
  export declare const SdBarcodeInput: StencilVueComponent<JSX.SdBarcodeInput, JSX.SdBarcodeInput["value"]>;
5
6
  export declare const SdButton: StencilVueComponent<JSX.SdButton>;
@@ -2,6 +2,15 @@
2
2
  /* tslint:disable */
3
3
  /* auto-generated vue proxies */
4
4
  import { defineContainer } from '@stencil/vue-output-target/runtime';
5
+ export const SdActionModal = /*@__PURE__*/ defineContainer('sd-action-modal', undefined, [
6
+ 'title',
7
+ 'buttonLabel',
8
+ 'sdClose',
9
+ 'sdOk'
10
+ ], [
11
+ 'sdClose',
12
+ 'sdOk'
13
+ ]);
5
14
  export const SdBadge = /*@__PURE__*/ defineContainer('sd-badge', undefined, [
6
15
  'color',
7
16
  'label'
@@ -103,9 +112,11 @@ export const SdConfirmModal = /*@__PURE__*/ defineContainer('sd-confirm-modal',
103
112
  'slotLabel',
104
113
  'tagContents',
105
114
  'sdClose',
115
+ 'sdCancel',
106
116
  'sdOk'
107
117
  ], [
108
118
  'sdClose',
119
+ 'sdCancel',
109
120
  'sdOk'
110
121
  ]);
111
122
  export const SdDateBox = /*@__PURE__*/ defineContainer('sd-date-box', undefined, [
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import '@sellmate/design-system/styles.css';
2
2
  export * from './components';
3
3
  export * from './plugin';
4
+ export { sdModal, SdModalVuePlugin } from './sdModal';
4
5
  export { default as SdTable } from './SdTable';
5
6
  export type { SdTableSortDir, SdTableColumn, Row as SdTableRow, SelectOption, SelectOptionGroup, SelectEvents, SelectMultipleEvents, SelectStyleProps, RadioValue, RadioOption, ButtonVariant, ButtonSize, ButtonV2Name, DropdownButtonItem, DropdownButtonName, DropdownButtonSize, DropdownButtonValue, Rule, ValidatableField, SdTooltipProps, TagName, ToastType, CheckedType, Type as DateBoxType, TabOption, } from '@sellmate/design-system';
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import '@sellmate/design-system/styles.css';
2
2
  export * from './components';
3
3
  export * from './plugin';
4
+ export { sdModal, SdModalVuePlugin } from './sdModal';
4
5
  export { default as SdTable } from './SdTable';
@@ -0,0 +1,42 @@
1
+ import { type App, type Component } from 'vue';
2
+ import { type ConfirmModalOptions, type ModalDialogChain, type SdModalCreateOption as CoreSdModalCreateOption, type SdModalGlobalOptions } from '@sellmate/design-system/utils';
3
+ /**
4
+ * Vue 플러그인. `app.use(SdModalVuePlugin)` 로 설치하면
5
+ * 이후 `sdModal.create({ component: MyModal, componentProps: { ... } })` 호출 시
6
+ * 해당 앱의 컨텍스트(플러그인, provide/inject, compilerOptions 등)를
7
+ * 그대로 상속받습니다.
8
+ */
9
+ export declare const SdModalVuePlugin: {
10
+ install(app: App): void;
11
+ };
12
+ /**
13
+ * `sdModal.create` 에 넘기는 입력.
14
+ *
15
+ * - `component` 에 HTMLElement 를 넘기면 core `sdModal.create` 로 바로 위임합니다.
16
+ * 이 경우 `componentProps` 는 무시됩니다.
17
+ * - `component` 에 Vue 컴포넌트를 넘기면 `componentProps` 로 props 를 지정해
18
+ * 메인 앱 컨텍스트 안에서 렌더한 뒤 core 로 위임합니다.
19
+ * - `persist` 는 core 옵션을 그대로 전달합니다.
20
+ */
21
+ export interface SdModalCreateOption extends Omit<CoreSdModalCreateOption, 'component'> {
22
+ component: HTMLElement | Component;
23
+ componentProps?: Record<string, unknown>;
24
+ }
25
+ /**
26
+ * Vue-aware `sdModal`.
27
+ *
28
+ * - `sdModal.confirm(options)` — core 와 동일
29
+ * - `sdModal.create({ component, componentProps?, persist? })` —
30
+ * `component` 가 HTMLElement 면 core 로 위임, Vue 컴포넌트면 메인 앱
31
+ * 컨텍스트 안에서 렌더한 뒤 위임합니다. 모달이 닫히면 자동으로 언마운트됩니다.
32
+ *
33
+ * 내부 구현 노트: 새 `createApp` 을 만들지 않고 `createVNode` + `render` +
34
+ * `vnode.appContext` 로 메인 앱의 렌더러만 빌려쓰므로 플러그인/provide/
35
+ * `compilerOptions.isCustomElement` 가 전부 자동 상속됩니다.
36
+ */
37
+ export declare const sdModal: {
38
+ confirm(options: ConfirmModalOptions): ModalDialogChain;
39
+ configure(options: SdModalGlobalOptions): void;
40
+ create(input: SdModalCreateOption): ModalDialogChain;
41
+ };
42
+ export default sdModal;
@@ -0,0 +1,68 @@
1
+ import { createVNode, render, } from 'vue';
2
+ import { sdModal as coreSdModal, } from '@sellmate/design-system/utils';
3
+ /**
4
+ * Vue 플러그인. `app.use(SdModalVuePlugin)` 로 설치하면
5
+ * 이후 `sdModal.create({ component: MyModal, componentProps: { ... } })` 호출 시
6
+ * 해당 앱의 컨텍스트(플러그인, provide/inject, compilerOptions 등)를
7
+ * 그대로 상속받습니다.
8
+ */
9
+ export const SdModalVuePlugin = {
10
+ install(app) {
11
+ capturedContext = app._context;
12
+ },
13
+ };
14
+ let capturedContext = null;
15
+ function isHTMLElement(value) {
16
+ return typeof HTMLElement !== 'undefined' && value instanceof HTMLElement;
17
+ }
18
+ function mountVueComponent(component, componentProps) {
19
+ if (!capturedContext) {
20
+ throw new Error('[sdModal] SdModalVuePlugin 이 설치되지 않았습니다. `app.use(SdModalVuePlugin)` 을 먼저 호출하세요.');
21
+ }
22
+ const host = document.createElement('div');
23
+ const vnode = createVNode(component, componentProps);
24
+ // 메인 앱의 컨텍스트(플러그인, isCustomElement, provide/inject 등) 상속
25
+ vnode.appContext = capturedContext;
26
+ render(vnode, host);
27
+ const el = host.firstElementChild;
28
+ if (!el) {
29
+ render(null, host);
30
+ throw new Error('[sdModal] 전달한 Vue 컴포넌트의 template 최상위는 단일 요소여야 합니다.');
31
+ }
32
+ return { el, host };
33
+ }
34
+ /**
35
+ * Vue-aware `sdModal`.
36
+ *
37
+ * - `sdModal.confirm(options)` — core 와 동일
38
+ * - `sdModal.create({ component, componentProps?, persist? })` —
39
+ * `component` 가 HTMLElement 면 core 로 위임, Vue 컴포넌트면 메인 앱
40
+ * 컨텍스트 안에서 렌더한 뒤 위임합니다. 모달이 닫히면 자동으로 언마운트됩니다.
41
+ *
42
+ * 내부 구현 노트: 새 `createApp` 을 만들지 않고 `createVNode` + `render` +
43
+ * `vnode.appContext` 로 메인 앱의 렌더러만 빌려쓰므로 플러그인/provide/
44
+ * `compilerOptions.isCustomElement` 가 전부 자동 상속됩니다.
45
+ */
46
+ export const sdModal = {
47
+ confirm(options) {
48
+ return coreSdModal.confirm(options);
49
+ },
50
+ configure(options) {
51
+ coreSdModal.configure(options);
52
+ },
53
+ create(input) {
54
+ const { component, componentProps = {}, persist } = input;
55
+ // HTMLElement 오버로드: core 로 바로 위임
56
+ if (isHTMLElement(component)) {
57
+ return coreSdModal.create({ component, persist });
58
+ }
59
+ // Vue 컴포넌트 오버로드
60
+ const { el, host } = mountVueComponent(component, componentProps);
61
+ const chain = coreSdModal.create({ component: el, persist });
62
+ chain.onDismissed(() => {
63
+ render(null, host);
64
+ });
65
+ return chain;
66
+ },
67
+ };
68
+ export default sdModal;
package/lib/components.ts CHANGED
@@ -8,6 +8,17 @@ import type { JSX } from '@sellmate/design-system';
8
8
 
9
9
 
10
10
 
11
+ export const SdActionModal: StencilVueComponent<JSX.SdActionModal> = /*@__PURE__*/ defineContainer<JSX.SdActionModal>('sd-action-modal', undefined, [
12
+ 'title',
13
+ 'buttonLabel',
14
+ 'sdClose',
15
+ 'sdOk'
16
+ ], [
17
+ 'sdClose',
18
+ 'sdOk'
19
+ ]);
20
+
21
+
11
22
  export const SdBadge: StencilVueComponent<JSX.SdBadge> = /*@__PURE__*/ defineContainer<JSX.SdBadge>('sd-badge', undefined, [
12
23
  'color',
13
24
  'label'
@@ -125,9 +136,11 @@ export const SdConfirmModal: StencilVueComponent<JSX.SdConfirmModal> = /*@__PURE
125
136
  'slotLabel',
126
137
  'tagContents',
127
138
  'sdClose',
139
+ 'sdCancel',
128
140
  'sdOk'
129
141
  ], [
130
142
  'sdClose',
143
+ 'sdCancel',
131
144
  'sdOk'
132
145
  ]);
133
146
 
package/lib/index.ts CHANGED
@@ -2,6 +2,7 @@ import '@sellmate/design-system/styles.css';
2
2
 
3
3
  export * from './components';
4
4
  export * from './plugin';
5
+ export { sdModal, SdModalVuePlugin } from './sdModal';
5
6
  export { default as SdTable } from './SdTable';
6
7
 
7
8
  // Export commonly used types for Vue usage
package/lib/sdModal.ts ADDED
@@ -0,0 +1,116 @@
1
+ import {
2
+ createVNode,
3
+ render,
4
+ type App,
5
+ type AppContext,
6
+ type Component,
7
+ } from 'vue';
8
+ import {
9
+ sdModal as coreSdModal,
10
+ type ConfirmModalOptions,
11
+ type ModalDialogChain,
12
+ type SdModalCreateOption as CoreSdModalCreateOption,
13
+ type SdModalGlobalOptions,
14
+ } from '@sellmate/design-system/utils';
15
+
16
+ /**
17
+ * Vue 플러그인. `app.use(SdModalVuePlugin)` 로 설치하면
18
+ * 이후 `sdModal.create({ component: MyModal, componentProps: { ... } })` 호출 시
19
+ * 해당 앱의 컨텍스트(플러그인, provide/inject, compilerOptions 등)를
20
+ * 그대로 상속받습니다.
21
+ */
22
+ export const SdModalVuePlugin = {
23
+ install(app: App) {
24
+ capturedContext = app._context;
25
+ },
26
+ };
27
+
28
+ let capturedContext: AppContext | null = null;
29
+
30
+ /**
31
+ * `sdModal.create` 에 넘기는 입력.
32
+ *
33
+ * - `component` 에 HTMLElement 를 넘기면 core `sdModal.create` 로 바로 위임합니다.
34
+ * 이 경우 `componentProps` 는 무시됩니다.
35
+ * - `component` 에 Vue 컴포넌트를 넘기면 `componentProps` 로 props 를 지정해
36
+ * 메인 앱 컨텍스트 안에서 렌더한 뒤 core 로 위임합니다.
37
+ * - `persist` 는 core 옵션을 그대로 전달합니다.
38
+ */
39
+ export interface SdModalCreateOption
40
+ extends Omit<CoreSdModalCreateOption, 'component'> {
41
+ component: HTMLElement | Component;
42
+ componentProps?: Record<string, unknown>;
43
+ }
44
+
45
+ function isHTMLElement(value: unknown): value is HTMLElement {
46
+ return typeof HTMLElement !== 'undefined' && value instanceof HTMLElement;
47
+ }
48
+
49
+ function mountVueComponent(
50
+ component: Component,
51
+ componentProps: Record<string, unknown>,
52
+ ): { el: HTMLElement; host: HTMLElement } {
53
+ if (!capturedContext) {
54
+ throw new Error(
55
+ '[sdModal] SdModalVuePlugin 이 설치되지 않았습니다. `app.use(SdModalVuePlugin)` 을 먼저 호출하세요.',
56
+ );
57
+ }
58
+
59
+ const host = document.createElement('div');
60
+ const vnode = createVNode(component, componentProps);
61
+ // 메인 앱의 컨텍스트(플러그인, isCustomElement, provide/inject 등) 상속
62
+ vnode.appContext = capturedContext;
63
+ render(vnode, host);
64
+
65
+ const el = host.firstElementChild as HTMLElement | null;
66
+ if (!el) {
67
+ render(null, host);
68
+ throw new Error(
69
+ '[sdModal] 전달한 Vue 컴포넌트의 template 최상위는 단일 요소여야 합니다.',
70
+ );
71
+ }
72
+
73
+ return { el, host };
74
+ }
75
+
76
+ /**
77
+ * Vue-aware `sdModal`.
78
+ *
79
+ * - `sdModal.confirm(options)` — core 와 동일
80
+ * - `sdModal.create({ component, componentProps?, persist? })` —
81
+ * `component` 가 HTMLElement 면 core 로 위임, Vue 컴포넌트면 메인 앱
82
+ * 컨텍스트 안에서 렌더한 뒤 위임합니다. 모달이 닫히면 자동으로 언마운트됩니다.
83
+ *
84
+ * 내부 구현 노트: 새 `createApp` 을 만들지 않고 `createVNode` + `render` +
85
+ * `vnode.appContext` 로 메인 앱의 렌더러만 빌려쓰므로 플러그인/provide/
86
+ * `compilerOptions.isCustomElement` 가 전부 자동 상속됩니다.
87
+ */
88
+ export const sdModal = {
89
+ confirm(options: ConfirmModalOptions): ModalDialogChain {
90
+ return coreSdModal.confirm(options);
91
+ },
92
+
93
+ configure(options: SdModalGlobalOptions): void {
94
+ coreSdModal.configure(options);
95
+ },
96
+
97
+ create(input: SdModalCreateOption): ModalDialogChain {
98
+ const { component, componentProps = {}, persist } = input;
99
+
100
+ // HTMLElement 오버로드: core 로 바로 위임
101
+ if (isHTMLElement(component)) {
102
+ return coreSdModal.create({ component, persist });
103
+ }
104
+
105
+ // Vue 컴포넌트 오버로드
106
+ const { el, host } = mountVueComponent(component, componentProps);
107
+ const chain = coreSdModal.create({ component: el, persist });
108
+ chain.onDismissed(() => {
109
+ render(null, host);
110
+ });
111
+
112
+ return chain;
113
+ },
114
+ };
115
+
116
+ export default sdModal;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sellmate/design-system-vue",
3
- "version": "1.0.46",
3
+ "version": "1.0.47",
4
4
  "description": "Design System - Vue Component Wrappers",
5
5
  "keywords": [
6
6
  "vue",
@@ -45,7 +45,7 @@
45
45
  "vue": "^3.4.38"
46
46
  },
47
47
  "dependencies": {
48
- "@sellmate/design-system": "^1.0.46",
48
+ "@sellmate/design-system": "^1.0.47",
49
49
  "@stencil/vue-output-target": "^0.11.8"
50
50
  },
51
51
  "peerDependencies": {