Skip to content

pantoken / renderers/web-components/src / RegisterContext

介面: RegisterContext

Alpha(內測)

register() 呼叫建立並傳遞到每個 ElementDefinition 的共用狀態。 它攜帶支援前綴感知的註冊器適配器、用於巢狀標記的 tag() 幫助函式、CSS 類 前綴 I、Invoker Commands 的支援旗標與路由器、wrapper/variantClass/iconSvg 工廠,以及語系資料(strings, locale, dir, firstDay)。

屬性

registry

registry: ElementRegistry

Alpha(內測)

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


tag

tag: (base) => string

Alpha(內測)

將基底名稱對映到作用中前綴的標籤(用於巢狀標記,querySelector, tagName)。

參數

base

string

回傳

string


I

I: object

Alpha(內測)

內嵌元件樣式表的 CSS 類前綴 — 永遠為 instui,與標籤前綴分離。

prefix

readonly prefix: "instui"


invokerSupported

invokerSupported: boolean

Alpha(內測)

瀏覽器是否支援 Invoker Commands API(command/commandfor)。


onCommand

onCommand: OnCommand

Alpha(內測)

將目標的 command 事件(或點擊備援)路由到處理器。


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).

參數

tag

string

css

string

render

(host) => string

options?
display?

string

invoker?

boolean

回傳

void


variantClass

variantClass: (name, host) => string

Alpha(內測)

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

參數

name

string

host

HTMLElement

回傳

string


iconSvg

iconSvg: (name) => string

Alpha(內測)

將圖示名稱解析為內嵌 SVG(未知時回傳空字串)。

參數

name

string

回傳

string


locale

locale: string

Alpha(內測)

用於 toLocaleDateStringIntl 格式化的 BCP47 語系標籤。


dir

dir: "ltr" | "rtl"

Alpha(內測)

從作用中語系包導出的文字方向。


firstDay

firstDay: number

Alpha(內測)

以 JS Date.getDay() 索引表示的一週第一天(0=星期日 … 6=星期六)。


strings

strings: WebComponentStrings

Alpha(內測)

所有互動元件的已翻譯 UI 字串。