Appn

A web component library focuses on building a common Webapp navigation standard on the Web.

API

一个用于放置在 appn-page[slot=footer] 的元素。 提供了安全区域的渲染限制 提供了与滚动监听相关的一些能力

Properties

NameAttributeDescriptionTypeDefault
translucenttranslucentAutoBoolean'auto'

Events

NameDescriptionType
stuckbottom当元素的粘性滚动生效时触发Event

Slots

NameDescription
(default)渲染在底部的内容,通常用来放置 appn-bottom-bar 等工具栏、导航栏等组件

<appn-header>

一个用于放置在 appn-page[slot=header] 的元素。 提供了安全区域的渲染限制 提供了与滚动监听相关的一些能力

Properties

NameAttributeDescriptionTypeDefault
translucenttranslucentAutoBoolean'auto'

Events

NameDescriptionType
stucktop当元素的粘性滚动生效时触发Event

Slots

NameDescription
(default)渲染在头部的内容,通常用来放置 appn-top-bar 等工具栏、导航栏等组件

<appn-icon>

Static Properties

NameDescriptionTypeDefault
defineappnIconDefine
getappnIconGet
whenDefineappnIconWhenDefine
safeGetappnIconSafeGet

Attributes

NameDescriptionTypeDefault
nameThe name of the icon to display.string | nullnull
widgetThe widget of the icon to display.AppnIconWidget

Properties

NameAttributeDescriptionTypeDefault
namenamestring | nullnull
widgetwidgetAppnIconWidget'normal'

Attributes

NameDescriptionTypeDefault
toThe URL to navigate to.string | nullnull
stateThe state object to pass to the navigation.object | nullnull
typeThe type of link. Defaults to 'a'.AppnLinkType
modeThe mode of navigation. Defaults to 'push'.AppLinkMode
actionTypeThe event-name of action to take when clicked. Defaults to 'click'.AppnLinkActionType
to-keystring | nullnull

Properties

NameAttributeDescriptionTypeDefault
typetypeAppnLinkType'button'
totostring | nullnull
toKeyto-keystring | nullnull
statestateobject | nullnull
modemodeAppnLinkMode'auto'
actionTypeactiontypeAppnLinkActionType'click'

Events

NameDescriptionType
navigate AppnNavigateEvent

<appn-nav-back-text>

Attributes

NameDescriptionTypeDefault
sharedNamestring | null | undefined

Properties

NameAttributeDescriptionTypeDefault
sharedNamesharedNamestring | null | undefined
sharedControllersharedcontrollerFixedSharedControllernew FixedSharedController(this)

<appn-nav-text>

Attributes

NameDescriptionTypeDefault
sharedNamestring | null | undefined

Properties

NameAttributeDescriptionTypeDefault
sharedNamesharedNamestring | null | undefined
sharedControllersharedcontrollerFixedSharedControllernew FixedSharedController(this)

<appn-navigation-provider>

Static Properties

NameDescriptionTypeDefault
navNavigationBasenavApi

Attributes

NameDescriptionTypeDefault
stackenable stack view modebooleanfalse
stack-directionThe direction of the navigation stack.AppnNavigationStackDirection
base-uristring

Properties

NameAttributeDescriptionTypeDefault
baseURIbase-uristring
currentEntrycurrententryNavigationHistoryEntry | null
transitiontransitionRepresents the currently ongoing navigation or null if none.NavigationTransition | null
canGoBackcangobackIndicates if it's possible to navigate backwards.boolean
canGoForwardcangoforwardIndicates if it's possible to navigate forwards.boolean
stackstackbooleanfalse
stackDirectionstackdirectionAppnNavigationStackDirectionnull
routersElementsrouterselementsHTMLTemplateElement[]

Methods

NameParametersDescriptionReturn
entriesReturns a snapshot of the joint session history entries.NavigationHistoryEntry[]
findFirstEntry
NameDescriptionType
patternPattern.Pattern<NavigationHistoryEntry>
fromEntryNavigationHistoryEntry | null
findLastEntry
NameDescriptionType
patternPattern.Pattern<NavigationHistoryEntry>
fromEntryNavigationHistoryEntry | null
updateCurrentEntry
NameDescriptionType
optionsNavigationUpdateCurrentEntryOptions
Updates the state object of the current NavigationHistoryEntry.void
navigate
NameDescriptionType
urlstring
optionsNavigationNavigateOptions
Navigates to the specified URL.NavigationResult
reload
NameDescriptionType
optionsNavigationReloadOptions
Reloads the current entry.NavigationResult
traverseTo
NameDescriptionType
keystring
optionsNavigationOptions
Navigates to a specific history entry identified by its key.NavigationResult
back
NameDescriptionType
optionsNavigationOptions
Navigates back one entry in the joint session history.NavigationResult
forward
NameDescriptionType
optionsNavigationOptions
Navigates forward one entry in the joint session history.NavigationResult
setCamera
NameDescriptionType
xnumber
ynumber
znumber

Events

NameDescriptionType
navigate NavigateEvent
navigatesuccessEvent
navigateerror ErrorEvent
currententrychange NavigationCurrentEntryChangeEvent

<appn-navigation-history-entry>

Attributes

NameDescriptionTypeDefault
pathnamestring
searchstring
hashstring
templateEleHTMLTemplateElement | undefinedundefined
presentEntryIndexnumber-1
sharedNamestring | undefined | null

Properties

NameAttributeDescriptionTypeDefault
pathnamepathnamestring
searchsearchstring
hashhashstring
templateEletemplateEleHTMLTemplateElement | undefinedundefined
navigationTypenavigationtypeNavigationTypeString | nullnull
presentEntryIndexpresentEntryIndexnumber-1
navigationEntrynavigationentryNavigationHistoryEntry | nullnull
sharedNamesharedNamestring | undefined | null
sharedControllersharedcontrollerStaticSharedControllernew StaticSharedController(this)
sharedIndexsharedindex

<appn-page>

Attributes

NameDescriptionTypeDefault
openThe name to say "Hello" to.booleantrue
mode'screen' | 'dialog' | 'tooltip' | 'bottomsheet' | 'topsheet' | 'leftslide' | 'rightslide''screen'
pathnamestring'*'
searchstring'*'
hashstring'*'
swapbackbooleantrue

Properties

NameAttributeDescriptionTypeDefault
openopenThe name to say "Hello" to.booleantrue
modemode'screen' | 'dialog' | 'tooltip' | 'bottomsheet' | 'topsheet' | 'leftslide' | 'rightslide''screen'
themethemeAppnTheme
pathnamepathnamestring'*'
searchsearchstring'*'
hashhashstring'*'
swapbackswapbackbooleantrue
navigationEntrynavigationentryNavigationHistoryEntry | nullnull

Events

NameDescriptionType
activated AppnPageActivatedEvent
swapback AppnNavigateEvent
navigationEntryAppnPageActivatedEvent

<appn-scroll-view>

A scroll-view element of the style 'overflow: overlay'. lightweight components that maximize the use of native capabilities. Core features: - Mobile: Zero-overhead native scrolling - Desktop: Native scrollbars (limited styling) - CSS Scrollbars specification compliant

Attributes

NameDescriptionTypeDefault
scrollbar-size'auto' | 'thin' | 'none''auto'
scrollbarColorstring''

Properties

NameAttributeDescriptionTypeDefault
scrollbarSizescrollbar-size'auto' | 'thin' | 'none''auto'
scrollbarColorscrollbarColorstring''
canOverlayScrollbarcanoverlayscrollbarboolean

Events

NameDescriptionType
scrollendEvent
scrollEvent
scrollend为不支持原生scrollend事件的浏览器提供垫片Event

Slots

NameDescription
(default)Scrollable content container
(default)滚动内容容器

CSS Shadow Parts

NameDescription
scrollbarScrollbar track
axis-yVertical scrollbar track
axis-xHorizontal scrollbar track
contentContent container <i18n lang="zh-cn"> 一个样式为 `overflow: overlay` 的滚动元素 非常轻量的组件,最大化地使用了原生的能力. 核心特性: - 移动端:无额外开销的原生滚动 - 桌面端:原生滚动条(样式定制受限) - 符合 CSS 滚动条标准规范
scrollbar滚动条轨道
axis-y垂直滚动条轨道
axis-x水平滚动条轨道
content内容容器 </i18n>

<appn-shared-contents>

Attributes

NameDescriptionTypeDefault
sharedNamestring
sharedOldStylestring
sharedNewStylestring

Properties

NameAttributeDescriptionTypeDefault
sharedNamesharedNamestring
sharedOldStylesharedOldStylestring
sharedNewStylesharedNewStylestring
sharedControllersharedcontrollerFixedSharedControllernew FixedSharedController(this)

<appn-theme-provider>

一个用于提供主题的插槽 开发者通过可以在此基础上进行一些定制

Static Properties

NameDescriptionTypeDefault
registerThemeregisterAppnTheme
findThemefindAppnTheme
allThemes

Attributes

NameDescriptionTypeDefault
theme在通过 registerTheme 接口注册theme后,可以使用 theme 属性来查询对应的 theme 可以同时书写多项:theme="ios dark"Appn.MaybeThemeClass'unstyled'
color-scheme颜色偏好 会在查询 theme 的时候,自动添加 dark/light 查询条件'dark' | 'light' | 'auto''auto'
accessible是否启用视觉可访问性的增强,会在查询theme的时候,自动添加 accessible 查询条件booleanfalse

Properties

NameAttributeDescriptionTypeDefault
themetheme在通过 registerTheme 接口注册theme后,可以使用 theme 属性来查询对应的 theme 可以同时书写多项:theme="ios dark"Appn.MaybeThemeClass'unstyled'
colorSchemecolor-scheme颜色偏好 会在查询 theme 的时候,自动添加 dark/light 查询条件'dark' | 'light' | 'auto''auto'
isDarkisdarkboolean
accessibleaccessible是否启用视觉可访问性的增强,会在查询theme的时候,自动添加 accessible 查询条件booleanfalse
themeContextthemecontext

<appn-top-bar>

顶部工具栏组件,参考了 material3-top-app-bar 的标准。

Events

NameDescriptionType
count-changedIndicates when the count changesEvent

Slots

NameDescription
(default)This element has a slot

CSS Shadow Parts

NameDescription
buttonThe button

<appn-nav-title>

Attributes

NameDescriptionTypeDefault
linesThe number of times the button has been clicked.number1
pageTitleThe name to say "Hello" to.string''
sharedNamestring | null | undefined

Properties

NameAttributeDescriptionTypeDefault
lineslinesThe number of times the button has been clicked.number1
pageTitlepageTitleThe name to say "Hello" to.string''
sharedNamesharedNamestring | null | undefined
sharedControllersharedcontrollerFixedSharedControllernew FixedSharedController(this)

<appn-view>

一个用于放置在 appn-page[slot=<default>] 的元素。 提供了安全区域的渲染限制

Events

NameDescriptionType
stuckbottom当元素的粘性滚动生效时触发Event

Slots

NameDescription
(default)渲染在底部的内容,通常用来放置 appn-bottom-bar 等工具栏、导航栏等组件

<css-color-mix>

Static Properties

NameDescriptionTypeDefault
shadowRootOptionsobject{ ...LitElement.shadowRootOptions, mode: 'closed' as const, }
calcColorMixcalc_color_mix
calcColorMixNativecalc_color_mix_native
loadCalcColorMixShimloadCalcColorMixShim

Attributes

NameDescriptionTypeDefault
varColorSpace'--color-mix'
instring'srgb'
c1Property.Color'#000'
c2Property.Color'#000'

Properties

NameAttributeDescriptionTypeDefault
varvarColorSpace'--color-mix'
ininstring'srgb'
c1c1Property.Color'#000'
p1p1number | nullnull
c2c2Property.Color'#000'
p2p2number | nullnull

<css-starting-style>

Static Properties

NameDescriptionTypeDefault
isSupports
shadowRootOptionsobject{ ...LitElement.shadowRootOptions, mode: 'closed' as const, }

Attributes

NameDescriptionTypeDefault
selectorstring''
slottedstring | nullnull
hostbooleanfalse
layerstring''
cssTextstring''

Properties

NameAttributeDescriptionTypeDefault
modemodeCssStartingStyleMode'auto'
selectorselectorstring''
slottedslottedstring | nullnull
hosthostbooleanfalse
layerlayerstring''
cssTextcssTextstring''

<my-element>

An example element.

Attributes

NameDescriptionTypeDefault
nameThe name to say "Hello" to.string'World'
countThe number of times the button has been clicked.number0

Properties

NameAttributeDescriptionTypeDefault
namenameThe name to say "Hello" to.string'World'
countcountThe number of times the button has been clicked.number0

Methods

NameParametersDescriptionReturn
sayHello
NameDescriptionType
nameThe name to say "Hello" tostring
Formats a greetingstring

Events

NameDescriptionType
count-changedIndicates when the count changesCustomEvent

Slots

NameDescription
(default)This element has a slot

CSS Shadow Parts

NameDescription
buttonThe button