iwsdk-ui-panel

작성자: facebook

IWSDK UI 패널을 효율적으로 개발하고 반복 개선합니다. PanelUI 구성 요소 작업, UI 레이아웃 디버깅, 또는 IWSDK 애플리케이션의 UI 디자인 개선 시 사용하세요.

npx skills add https://github.com/facebook/immersive-web-sdk --skill iwsdk-ui-panel

IWSDK UIKitML Asset Workflow

Treat UIKitML as a first-class renderable asset. Use the managed editor's isolated renderer for layout, the scene editor for placement, and the application runtime for behavior. Do not change the scene, camera, or component model merely to inspect a panel.

1. Find the three stable identities

Every scene-authored panel has three different identities:

  1. the manifest asset ID, which names the reusable UIKitML definition;
  2. the scene node ID, which names one placed instance;
  3. element id attributes, which name fields and controls inside the document.

Find or add the manifest entry in src/assets.ts and keep the source under public/ui/:

import { AssetType, type AssetManifest } from '@iwsdk/core';

const assets = {
  'welcome-panel': {
    name: 'Welcome panel',
    type: AssetType.UIKitML,
    url: '/ui/welcome.uikitml',
  },
} satisfies AssetManifest;

export default assets;

A file under public/ui/ is not placeable until it is registered. The .uikitml file is the runtime source of truth; never generate an intermediate JSON file.

2. Reuse the managed editor

Run commands from the application directory. Reuse a command-ready session instead of starting a second server or browser:

npx iwsdk dev status
npx iwsdk dev up --timeout 60000
npx iwsdk ui assets --raw

dev up owns the managed headed browser. Do not launch a second Playwright browser, enable Vite's independent opener, or implement a custom UIKit renderer.

3. Render the panel in isolation

Use the editor-backed isolated renderer before debugging scene placement:

npx iwsdk ui render-preview \
  --input-json '{"assetId":"welcome-panel","width":800,"height":600}' \
  --output-file artifacts/welcome-panel.png

This renders the real manifest entry through the real UIKitML parser, fonts, layout, and WebGL path on a neutral background. It waits for UIKit render and resource signals; do not add fixed frame delays. Re-run the command after every layout change. Same-URL sources are reloaded without restarting the server.

4. Place and inspect it in the scene editor

For a human-authored placement, open the scene and add the UIKitML asset from the asset drawer. For file authoring, use the same asset-only node contract:

{
  "id": "welcome-panel-instance",
  "name": "Welcome panel",
  "content": { "type": "asset", "asset": "welcome-panel" },
  "transform": {
    "position": [0, 1.4, -1.5],
    "rotationDeg": [0, 180, 0],
    "scale": 0.5
  }
}
npx iwsdk scene render-file \
  --input-json '{"path":"public/scenes/main.iwsdk.scene.json","view":"quarter"}' \
  --output-file artifacts/main-editor.png
npx iwsdk scene open \
  --input-json '{"path":"public/scenes/main.iwsdk.scene.json"}' --raw

UIKitML surfaces are single-sided. If the isolated preview works but the placed panel is invisible, inspect its rotation first. Size a world-space panel with its ordinary entity transform scale. There is no maxWidth/maxHeight fitting layer and no editor-visible PanelUI component to configure.

Use scene screenshot for editor/scene evidence. browser screenshot is intentionally runtime-only and switches the managed workspace to runtime before capturing.

5. Edit UIKitML

UIKitML is HTML/CSS-shaped, but it is not a browser engine. Confirm supported elements and properties from the installed IWSDK reference before assuming browser behavior.

Key rules:

  • numeric UIKit sizes are centimeters (100 = 100 cm = 1 m);
  • use stable id attributes for elements application code must manipulate;
  • prefer explicit supported declarations over CSS shorthand;
  • parser errors include source locations;
  • relative and remote font URLs are supported, but font completion can change layout;
  • the managed preview settles from UIKit render/font/texture signals, so inspect logs instead of compensating with arbitrary waits.

After each edit:

  1. rerender with ui render-preview and inspect the image;
  2. rerender the scene when placement or scale matters;
  3. inspect browser logs for parser, font, texture, or runtime failures.

6. Connect runtime behavior

For a code-owned instance, keep the UIKitMLAsset returned by the asset manager:

import { UIKit, UIKitMLAsset } from '@iwsdk/core';

const panel = await world.assets.instantiate<UIKitMLAsset>('welcome-panel');
const entity = world.createTransformEntity(panel);
const button = panel.requireElementById<UIKit.Text>('xr-button');
button.addEventListener('click', () => world.launchXR());

For a scene-authored instance, resolve it by stable scene node ID after the level has loaded:

const panel = world.requireSceneObject<UIKitMLAsset>('welcome-panel-instance');
const button = panel.requireElementById<UIKit.Text>('xr-button');
button.setProperties({ text: 'Enter XR' });

Do not locate a panel by transient ECS index, manifest URL, or a scan for an internal PanelDocument. Use the scene node ID and element IDs.

ScreenSpace is product behavior

Add ScreenSpace only when the experience genuinely needs a browser-camera HUD:

entity.addComponent(ScreenSpace, {
  width: '420px',
  height: '240px',
  top: '20px',
  right: '20px',
  zOffset: 0.2,
});

Position and size values are CSS strings. In immersive mode the document returns to its authored world transform. Do not add ScreenSpace, a backdrop, or a temporary camera pose merely to make a panel easier to inspect—the editor already provides the correct isolated and in-scene render paths.

Completion checklist

  • Manifest ID resolves and ui assets lists it.
  • Isolated preview is nonblank, correctly laid out, and uses the intended fonts.
  • Scene preview has correct facing, transform scale, and lighting-independent color.
  • Runtime behavior resolves the placed node and required element IDs.
  • Browser logs contain no UIKitML parser, resource, or font errors.
  • No generated UI JSON, temporary ScreenSpace component, backdrop, or camera hack remains.

facebook의 다른 스킬

binary-size-analysis
facebook
git 커밋 범위에 걸쳐 hermesvm 공유 라이브러리의 커밋별 바이너리 크기 변화를 분석합니다. 커밋별 크기와 주요 증가 및 감소 요약 테이블이 포함된 마크다운 보고서를 생성합니다.
official
modify-jsi-features
facebook
JavaScript Interface (JSI) 레이어에 새로운 JSI 기능을 추가하기 위한 가이드입니다. 사용자가 새로운 메서드나 기능을 추가, 생성 또는 구현하도록 요청할 때 사용하세요.
official
non-interactive-git-rebase
facebook
최상위 커밋이 아닌 git 커밋을 재정렬, 분할, 삭제 또는 수정해야 하며 대화형 편집기 접근이 불가능할 때 사용합니다. 프로그래밍 방식의 리베이스를 다룹니다…
official
click-target
facebook
XR에서 대상 객체를 찾아 클릭합니다. UI 상호작용 테스트, 버튼 클릭, 또는 상호작용 가능한 요소가 올바르게 작동하는지 확인할 때 사용하세요.
official
iwsdk-planner
facebook
IWSDK 프로젝트 계획 및 모범 사례 가이드. 새로운 IWSDK 기능을 계획하거나, 시스템/컴포넌트를 설계하거나, IWSDK 코드 아키텍처를 검토할 때, 또는...
official
test-all
facebook
병렬 테스트 오케스트레이터. Task 하위 에이전트와 iwsdk CLI를 통해 9개의 모든 테스트 스위트를 동시에 실행합니다. 빌드, 예제 설정, 개발 서버, 에이전트 실행 등을 처리합니다.
official
test-audio
facebook
iwsdk CLI를 사용하여 오디오 예제에 대해 오디오 시스템(AudioSource 로딩, 재생 상태, 정지, 공간 오디오)을 테스트합니다.
official
test-ecs-core
facebook
ECS 핵심 기능(시스템 등록, 컴포넌트, Transform 동기화, 일시정지/단계/재개, 시스템 전환, 엔티티 발견, 스냅샷)을 poke…에 대해 테스트합니다.
official