UI na-emepụta ihe site na Lyra Gen

Azịza ndị modeli na-apụta dị ka njikwa Lyra n'ezie, ndị e nyochara.

Lyra Gen na-atụgharị azịza modeli a haziri ahazi ka ọ bụrụ akụrụngwa Lyra ndị mmadụ niile nwere ike iji site na katalọgụ e nyochara. Ọdịnaya e mepụtara nwere ike ịkpọ naanị ọrụ dị na katalọgụ, ọ bụghị tag, skrịpụtụ ma ọ bụ omume ọ bụla; arịrịọ modeli, data, omume na nchekwa na-anọgide n'ngwa gị.

Ihe atụ

Họrọ akụkụ nke katalọgụ e nyochara, wee gbaa ọkwa nlele e mepụtara tupu e gosipụta ya.

import '@aceshooting/lyra-ui/theme.css';
import { initialCatalog, subsetCatalog } from '@aceshooting/lyra-gen/catalog.js';
import { validateView } from '@aceshooting/lyra-gen/runtime.js';
import { LyraGenViewElement } from '@aceshooting/lyra-gen/gen-view.js';

const selected = subsetCatalog(initialCatalog, ['stack', 'heading', 'text']);
if (!selected.ok) throw new Error('The requested catalog is unavailable.');
const catalog = selected.value;
const result = validateView({
  version: '1', catalog: { id: catalog.id, version: catalog.version },
  surfaceId: 'answer-1', revision: 0,
  root: { id: 'summary', type: 'stack', children: [
    { id: 'title', type: 'heading', text: 'Quarterly summary' },
    { id: 'detail', type: 'text', text: 'Revenue increased this quarter.' },
  ] },
}, catalog);
if (!result.ok) throw new Error('The generated view was rejected.');

const view = new LyraGenViewElement();
view.catalog = catalog;
view.document = result.value;
document.body.append(view);

Chọgharịa ngwa UI · Gụọ ntuziaka (n’asụsụ Bekee)