Skip to content

pantoken / renderers/web-components/src / RegisterContext

Giao diện: RegisterContext

Alpha

Trạng thái chung mà một cuộc gọi register() khởi tạo một lần và truyền tới mọi ElementDefinition. Nó mang bộ điều hợp đăng ký nhận biết tiền tố, trợ giúp tag() cho đánh dấu lồng nhau, tiền tố lớp CSS I, cờ hỗ trợ + bộ định tuyến Invoker Commands, các nhà máy wrapper/variantClass/iconSvg, và dữ liệu vùng ( strings, locale, dir, firstDay).

Thuộc tính

registry

registry: ElementRegistry

Alpha

The scoped registry: rewrites instui-<base> → the active-prefix tag on get/define.


tag

tag: (base) => string

Alpha

Ánh xạ tên cơ sở sang thẻ tiền tố-đang-được-sử-dụng (cho đánh dấu lồng nhau, querySelector, tagName).

Tham số

base

string

Trả về

string


I

I: object

Alpha

Tiền tố lớp CSS cho các stylesheet thành phần được nhúng — luôn là instui, tách biệt khỏi tiền tố thẻ.

prefix

readonly prefix: "instui"


invokerSupported

invokerSupported: boolean

Alpha

Trình duyệt có hỗ trợ Invoker Commands API hay không (command/commandfor).


onCommand

onCommand: OnCommand

Alpha

Định tuyến các sự kiện command của một mục tiêu (hoặc dùng dự phòng click) tới một bộ xử lý.


wrapper

wrapper: (tag, css, render, options?) => void

Alpha

Define a shadow-DOM element: <style>:host{display}css</style> + markup from render(host). invoker: true forwards the host's popovertarget/command to the inner <button> (IDL).

Tham số

tag

string

css

string

render

(host) => string

options?
display?

string

invoker?

boolean

Trả về

void


variantClass

variantClass: (name, host) => string

Alpha

Build a .instui-<name> class with an optional -color-<variant> modifier from variant.

Tham số

name

string

host

HTMLElement

Trả về

string


iconSvg

iconSvg: (name) => string

Alpha

Giải quyết tên biểu tượng thành SVG nhúng (chuỗi rỗng nếu không biết).

Tham số

name

string

Trả về

string


locale

locale: string

Alpha

Thẻ vùng BCP47 dùng cho định dạng toLocaleDateStringIntl.


dir

dir: "ltr" | "rtl"

Alpha

Hướng văn bản suy ra từ gói ngôn ngữ đang hoạt động.


firstDay

firstDay: number

Alpha

Ngày đầu tuần dưới dạng chỉ số JS Date.getDay() (0=Chủ nhật … 6=Thứ bảy).


strings

strings: WebComponentStrings

Alpha

Các chuỗi giao diện đã được dịch cho tất cả các phần tử hành vi.