@wipco/sdui 0.12.1 → 0.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1551,6 +1551,18 @@ interface SduiRendererProps {
1551
1551
  registry?: SduiRegistry;
1552
1552
  /** 내비게이션·API·실시간 연결점 — 생략 시 브라우저 기본 구현 */
1553
1553
  adapter?: SduiAdapter;
1554
+ /**
1555
+ * 마운트 시 한 번 심는 초기 상태 — **경로 파라미터가 들어오는 자리**다.
1556
+ *
1557
+ * 동적 상세 라우트(`asset/asset/:id`)를 열 때 호스트 라우터가
1558
+ * `{ 'route.id': '<실제 id>' }` 를 심으면, 스펙은 `page.data` 의 endpoint 에서
1559
+ * `{"$state":"route.id"}` 로 그 값을 읽어 **그 행의** 데이터를 조회한다.
1560
+ * 이 자리가 없던 동안 목록의 행 클릭이 전부 고정 샘플 상세로 갔다(실사용 지적).
1561
+ *
1562
+ * 마운트 시 1회다 — 라우트가 바뀌면 호스트가 `key` 로 렌더러를 갈아 끼워야 한다
1563
+ * (같은 인스턴스를 재사용하면 이전 화면의 상태가 새 화면으로 샌다).
1564
+ */
1565
+ initialState?: Record<string, SduiPropValue>;
1554
1566
  /**
1555
1567
  * page.urlState ↔ URL 쿼리 동기화 여부 (기본 true).
1556
1568
  * 편집기 미리보기처럼 실제 페이지 라우트가 아닌 곳에 마운트할 때 false로 끈다 —
@@ -1577,7 +1589,7 @@ interface SduiRendererProps {
1577
1589
  * 서버(JSON 스펙) 주도 페이지 렌더러.
1578
1590
  * 스펙은 직렬화 가능한 데이터만 담고, 상태·이벤트·폼·내비게이션은 여기서 해석한다.
1579
1591
  */
1580
- declare function SduiRenderer({ page, registry, adapter, syncUrlState, can, onCustomAction, customValidators, }: SduiRendererProps): React__default.JSX.Element;
1592
+ declare function SduiRenderer({ page, registry, adapter, syncUrlState, initialState, can, onCustomAction, customValidators, }: SduiRendererProps): React__default.JSX.Element;
1581
1593
 
1582
1594
  /**
1583
1595
  * 스펙 구조 검증기 — 서버(또는 편집기)가 만든 스펙의 형태 오류를 렌더 전에 찾아낸다.
package/dist/index.js CHANGED
@@ -2247,6 +2247,7 @@ function SduiRenderer({
2247
2247
  registry = defaultRegistry,
2248
2248
  adapter,
2249
2249
  syncUrlState = true,
2250
+ initialState,
2250
2251
  can,
2251
2252
  onCustomAction,
2252
2253
  customValidators
@@ -2254,7 +2255,7 @@ function SduiRenderer({
2254
2255
  const host = useMemo(() => resolveAdapter(adapter), [adapter]);
2255
2256
  const hostRef = useRef(host);
2256
2257
  hostRef.current = host;
2257
- const [state, setState] = useState({});
2258
+ const [state, setState] = useState(() => ({ ...initialState ?? {} }));
2258
2259
  const urlSeeded = useRef(false);
2259
2260
  const [toasts, setToasts] = useState([]);
2260
2261
  const toastSeq = useRef(0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wipco/sdui",
3
- "version": "0.12.1",
3
+ "version": "0.13.1",
4
4
  "description": "WIPCO 서버 주도 UI(SDUI) 렌더러 — JSON 페이지 스펙을 React 컴포넌트로 렌더링",
5
5
  "keywords": [
6
6
  "sdui",