@sellmate/design-system-react 0.0.10 → 0.0.11

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,2 @@
1
+ export declare function renderStencilToString(html: string): Promise<string>;
2
+ export declare function registerStencilForNextjs(): void;
@@ -0,0 +1,44 @@
1
+ import { hydrateDocument, } from '@sellmate/design-system/hydrate';
2
+ // -------------------------------
3
+ // SSR용 서버사이드 렌더링 함수
4
+ // -------------------------------
5
+ export async function renderStencilToString(html) {
6
+ try {
7
+ const results = await hydrateDocument(html, {
8
+ staticComponents: [
9
+ 'sd-button',
10
+ 'sd-input',
11
+ 'sd-select',
12
+ 'sd-table',
13
+ 'sd-icon',
14
+ 'sd-checkbox',
15
+ 'sd-tag',
16
+ 'sd-pagination',
17
+ 'sd-tooltip',
18
+ 'sd-popover',
19
+ 'sd-guide',
20
+ 'sd-date-picker',
21
+ 'sd-date-range-picker',
22
+ 'sd-date-box',
23
+ 'sd-portal',
24
+ 'sd-tooltip-portal',
25
+ ],
26
+ });
27
+ return results.html;
28
+ }
29
+ catch (error) {
30
+ console.warn('Stencil SSR failed, falling back to client-side rendering:', error);
31
+ return html;
32
+ }
33
+ }
34
+ // ----------------------------------------------
35
+ // 클라이언트 사이드 등록 함수
36
+ // ----------------------------------------------
37
+ export function registerStencilForNextjs() {
38
+ if (typeof window === 'undefined')
39
+ return;
40
+ // router 변경 시에도 재등록
41
+ import('@sellmate/design-system/loader').then(({ defineCustomElements }) => {
42
+ defineCustomElements(window);
43
+ });
44
+ }
package/dist/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from './components/components';
2
+ export { registerStencil } from './registerStencil';
2
3
  export type { SdTableSortDir, SdTableColumn, Row as SdTableRow, } from '@sellmate/design-system';
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  'use strict';
2
2
  export * from './components/components';
3
- import { registerStencil } from './registerStencil';
4
- registerStencil();
3
+ // Optional manual registration (not automatically called)
4
+ export { registerStencil } from './registerStencil';
package/lib/hydrate.ts ADDED
@@ -0,0 +1,52 @@
1
+ import {
2
+ renderToString,
3
+ hydrateDocument,
4
+ } from '@sellmate/design-system/hydrate';
5
+
6
+ // -------------------------------
7
+ // SSR용 서버사이드 렌더링 함수
8
+ // -------------------------------
9
+ export async function renderStencilToString(html: string) {
10
+ try {
11
+ const results = await hydrateDocument(html, {
12
+ staticComponents: [
13
+ 'sd-button',
14
+ 'sd-input',
15
+ 'sd-select',
16
+ 'sd-table',
17
+ 'sd-icon',
18
+ 'sd-checkbox',
19
+ 'sd-tag',
20
+ 'sd-pagination',
21
+ 'sd-tooltip',
22
+ 'sd-popover',
23
+ 'sd-guide',
24
+ 'sd-date-picker',
25
+ 'sd-date-range-picker',
26
+ 'sd-date-box',
27
+ 'sd-portal',
28
+ 'sd-tooltip-portal',
29
+ ],
30
+ });
31
+
32
+ return results.html;
33
+ } catch (error) {
34
+ console.warn(
35
+ 'Stencil SSR failed, falling back to client-side rendering:',
36
+ error
37
+ );
38
+ return html;
39
+ }
40
+ }
41
+
42
+ // ----------------------------------------------
43
+ // 클라이언트 사이드 등록 함수
44
+ // ----------------------------------------------
45
+ export function registerStencilForNextjs() {
46
+ if (typeof window === 'undefined') return;
47
+
48
+ // router 변경 시에도 재등록
49
+ import('@sellmate/design-system/loader').then(({ defineCustomElements }) => {
50
+ defineCustomElements(window);
51
+ });
52
+ }
package/lib/index.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
3
  export * from './components/components';
4
- import { registerStencil } from './registerStencil';
5
4
 
6
- registerStencil();
5
+ // Optional manual registration (not automatically called)
6
+ export { registerStencil } from './registerStencil';
7
7
 
8
8
  // Export sd-table types for React usage
9
9
  export type {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sellmate/design-system-react",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "description": "Design System - React Component Wrappers",
5
5
  "keywords": [
6
6
  "react",
@@ -24,6 +24,18 @@
24
24
  "main": "dist/index.js",
25
25
  "module": "dist/index.js",
26
26
  "types": "dist/index.d.ts",
27
+ "exports": {
28
+ ".": {
29
+ "types": "./dist/index.d.ts",
30
+ "import": "./dist/index.js",
31
+ "require": "./dist/index.js"
32
+ },
33
+ "./hydrate": {
34
+ "types": "./dist/hydrate.d.ts",
35
+ "import": "./dist/hydrate.js",
36
+ "require": "./dist/hydrate.js"
37
+ }
38
+ },
27
39
  "directories": {
28
40
  "lib": "lib",
29
41
  "test": "__tests__"
@@ -56,5 +68,5 @@
56
68
  "rimraf": "^6.0.1",
57
69
  "typescript": "^5.9.3"
58
70
  },
59
- "gitHead": "b0ff5a50812d0d336ed4ec7d44ad000c78cab377"
71
+ "gitHead": "8406a77cacf86efd489f6b4a42e362176fe81d7b"
60
72
  }