@designbasekorea/wordpress-ui 0.1.3 → 0.1.4

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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  이 문서는 `@designbasekorea/wordpress-ui`를 WordPress 플러그인과 테마의 관리자 화면에 적용하는 표준 가이드입니다.
4
4
 
5
- 이 가이드의 기준 배포 버전은 `0.1.2`입니다. 플러그인 또는 테마의 lockfile과
5
+ 이 가이드의 기준 배포 버전은 `0.1.4`입니다. 플러그인 또는 테마의 lockfile과
6
6
  vendor 산출물도 같은 버전으로 맞추고, 버전을 올릴 때마다 아래 검증 명령을 다시
7
7
  실행합니다.
8
8
 
@@ -62,7 +62,7 @@ WordPress plugin/theme
62
62
  ### 2.1 Node 프로젝트에 설치
63
63
 
64
64
  ```bash
65
- npm install @designbasekorea/wordpress-ui@0.1.2
65
+ npm install @designbasekorea/wordpress-ui@0.1.4
66
66
  ```
67
67
 
68
68
  WordPress 서버가 npm을 실행하는 것이 아닙니다. 라이브러리를 설치한 뒤 플러그인 또는 테마 빌드 과정에서 배포에 필요한 파일을 포함해야 합니다.
@@ -143,7 +143,7 @@ require_once __DIR__ . '/vendor/wordpress-ui/wordpress-ui.php';
143
143
 
144
144
  final class MyPlugin_Admin_Assets
145
145
  {
146
- private const UI_VERSION = '0.1.2';
146
+ private const UI_VERSION = '0.1.4';
147
147
 
148
148
  public static function init(): void
149
149
  {
@@ -266,52 +266,80 @@ WordPress 플러그인과 테마의 기본 선택지는 vanilla/PHP입니다. Re
266
266
 
267
267
  ### 4.1 페이지 기본 구조
268
268
 
269
+ PHP 템플릿은 `.designbase-wp-admin` root와 `db-page-header`만 선언하고, 화면별
270
+ AssetsManager가 `wordpress-ui` runtime과 shell adapter를 enqueue하는 방식을 권장합니다.
271
+ adapter는 `ui-wc`의 실제 `db-sidebar`를 생성하고, 설정의 `title`을 사이드바 상단
272
+ 플러그인명으로 표시합니다. `db-page-header`를 제외한 root children은 자동으로
273
+ `<db-container size="full" padding="l" full-width>` 안에 배치됩니다.
274
+
275
+ `sections`/`items`는 PHP에서 `wp_json_encode()`로 전달하고, 링크·권한·활성 상태는
276
+ 소비 플러그인이나 테마가 관리합니다. adapter를 사용하지 않는 수동 구성에서는 아래처럼
277
+ `db-sidebar`와 `db-container`를 직접 선언할 수 있습니다.
278
+
269
279
  ```php
280
+ <?php
281
+ $sidebar_items = [
282
+ [
283
+ 'id' => 'dashboard',
284
+ 'label' => __('대시보드', 'myplugin'),
285
+ 'href' => admin_url('admin.php?page=myplugin'),
286
+ 'icon' => 'doughnut-chart',
287
+ 'active' => (($_GET['page'] ?? '') === 'myplugin'),
288
+ ],
289
+ [
290
+ 'id' => 'settings',
291
+ 'label' => __('설정', 'myplugin'),
292
+ 'href' => admin_url('admin.php?page=myplugin-settings'),
293
+ 'icon' => 'settings',
294
+ 'active' => (($_GET['page'] ?? '') === 'myplugin-settings'),
295
+ ],
296
+ ];
297
+ ?>
270
298
  <div class="wrap designbase-wp-admin myplugin-admin">
271
- <div class="dbwp-admin-shell dbwp-admin-shell--has-sidebar">
272
- <aside class="dbwp-admin-shell__sidebar" aria-label="My Plugin 메뉴">
273
- <div class="dbwp-admin-sidebar">
274
- <div class="dbwp-admin-sidebar__title">My Plugin</div>
275
- <nav class="dbwp-admin-sidebar__nav">
276
- <a class="dbwp-admin-sidebar__link is-active"
277
- href="<?php echo esc_url(admin_url('admin.php?page=myplugin')); ?>"
278
- aria-current="page">
279
- <i class="dbwp-admin-icon icon-dashboard" aria-hidden="true"></i>
280
- <span class="dbwp-admin-sidebar__label">대시보드</span>
281
- </a>
282
- <a class="dbwp-admin-sidebar__link"
283
- href="<?php echo esc_url(admin_url('admin.php?page=myplugin-settings')); ?>">
284
- <i class="dbwp-admin-icon icon-settings" aria-hidden="true"></i>
285
- <span class="dbwp-admin-sidebar__label">설정</span>
286
- </a>
287
- </nav>
299
+ <div class="designbase-wp-admin__shell designbase-wp-admin__shell--has-sidebar">
300
+ <aside class="designbase-wp-admin__shell-sidebar" aria-label="<?php esc_attr_e('My Plugin 메뉴', 'myplugin'); ?>">
301
+ <div class="designbase-wp-admin__shell-brand">
302
+ <db-logo type="custom" text="My Plugin" size="s"></db-logo>
288
303
  </div>
304
+ <db-sidebar
305
+ size="m"
306
+ show-logo="false"
307
+ collapsible="false"
308
+ full-height
309
+ sections='<?php echo esc_attr(wp_json_encode([[
310
+ 'id' => 'main',
311
+ 'title' => 'My Plugin',
312
+ 'items' => $sidebar_items,
313
+ ]])); ?>'>
314
+ </db-sidebar>
289
315
  </aside>
290
316
 
291
- <main class="dbwp-admin-shell__main" id="main-content">
292
- <header class="dbwp-admin-page-header">
293
- <div class="dbwp-admin-page-header__heading">
294
- <i class="dbwp-admin-icon icon-dashboard" aria-hidden="true"></i>
295
- <div>
296
- <h1 class="dbwp-admin-page-header__title">대시보드</h1>
297
- <p class="dbwp-admin-page-header__description">플러그인 상태와 최근 작업을 확인합니다.</p>
298
- </div>
299
- </div>
300
- <div class="dbwp-admin-page-header__actions">
317
+ <main class="designbase-wp-admin__shell-main" id="main-content">
318
+ <db-page-header
319
+ title="<?php esc_attr_e('대시보드', 'myplugin'); ?>"
320
+ description="<?php esc_attr_e('플러그인 상태와 최근 작업을 확인합니다.', 'myplugin'); ?>"
321
+ variant="minimal"
322
+ align="left">
323
+ <div slot="actions">
301
324
  <a class="button button-secondary" href="<?php echo esc_url(admin_url('admin.php?page=myplugin-settings')); ?>">
302
- 설정
325
+ <?php esc_html_e('설정', 'myplugin'); ?>
303
326
  </a>
304
327
  </div>
305
- </header>
328
+ </db-page-header>
306
329
 
307
- <div class="dbwp-admin-page-content">
308
- <!-- tabs, filter, section, table 등을 배치한다. -->
309
- </div>
330
+ <db-container size="full" padding="l" full-width>
331
+ <!-- db-tabs, db-section, db-table 등을 배치한다. -->
332
+ </db-container>
310
333
  </main>
311
334
  </div>
312
335
  </div>
313
336
  ```
314
337
 
338
+ 기존 화면을 일괄 재작성하기 어려운 경우에는 동일한 `.designbase-wp-admin` root와
339
+ `db-page-header`를 유지하고, 소비 플러그인의 작은 vanilla adapter에서 root children을
340
+ `designbase-wp-admin__shell`로 감싼 뒤 `db-sidebar`를 생성해도 됩니다. 이 adapter는
341
+ 패키지의 Web Component runtime을 대체하지 않으며, 화면별 메뉴 설정만 담당합니다.
342
+
315
343
  컴포넌트 스타일을 사용하는 자체 markup은 `.designbase-wp-admin` 내부에 둡니다. 단순한 링크와 form submit은 WordPress의 native `<a>`와 `<button>`을 우선 사용하고, 복합 동작이 필요한 경우에만 Web Component를 사용합니다.
316
344
 
317
345
  ### 4.2 ui-wc 기본 컴포넌트 사용
@@ -411,7 +439,7 @@ select?.addEventListener('db-change', (event) => {
411
439
  React는 선택 사항입니다. Gutenberg나 기존 React 앱과 연결해야 하는 화면에서만 사용하고, 일반적인 PHP admin page에는 vanilla entry를 권장합니다.
412
440
 
413
441
  ```bash
414
- npm install @designbasekorea/wordpress-ui@0.1.2 react react-dom
442
+ npm install @designbasekorea/wordpress-ui@0.1.4 react react-dom
415
443
  ```
416
444
 
417
445
  ```tsx
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@designbasekorea/wordpress-ui",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "WordPress 관리자용 Designbase UI primitives와 plugin shell patterns",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",