@lynx-json/jsua-lynx v0.5.1
jsua-lynx (PRELIMINARY DOCUMENTATION)
Extensions to the jsua
package for the Lynx JSON media type.
building.build
accepts content
and then:
- parses
content.blob
as Lynx JSON and assigns it to thecontent.document
property - passes the
content
object tobuilding.documentViewBuilder
builders.nodeViewBuilder
accepts result
and then:
- finds (see
building.register
) the builder that matches the most specific hint - passes the
result
object to the builder
building.register
registers a view builder (for a Lynx JSON node) function that accepts the following params:
hint
- the hint to build views forbuilder
- the builder function with signature f(node) -> view || Promisecondition
- a function that accepts a Lynx node param and returnstrue
if the builder will build a view for the node orfalse
if the builder will not
building.registrations
returns the registrations added via building.register
building.setNodeViewBuilder
sets the default nodeViewBuilder, accepting a function with signature f(node) -> view || Promise
View Attributes
A view representing a Lynx JSON document may have the following attributes:
data-content-url
- the document's URLdata-content-type
- the document's content type (application/lynx+json
)data-lynx-realm
- the document's realm URIdata-lynx-context
- the document's context URIdata-lynx-focus
- the document's focus namedata-transfer-started-at
- the start date/time of the transfer that the view represents (see ECMASCript Date.prototype.valueOf()).
A view representing a node of a Lynx JSON document may have the following attributes:
data-lynx-visibility
- the node'svisibility
data-lynx-hints
- the node'shints
data-lynx-name
- the node'sname
data-lynx-labeled-by
- the node'slabeledBy
property valuedata-lynx-scope
- the node'sscope
(container
nodes)href
- the node'shref
property value (link
nodes)type
- the node'stype
property value (link
nodes)data-lynx-input
- the node's input name for form data submissiondata-lynx-submitter
- the node'ssubmitter
property value (form
and input nodes)formaction
- the node'saction
property value (submit
nodes)data-lynx-submit-method
- the node'smethod
property value (submit
nodes)data-lynx-submit-enctype
- the node'senctype
property value (submit
nodes)data-lynx-send
- the node'ssend
property value (submit
nodes)data-lynx-embedded-view
- the view for the node'ssrc
ordata
property value (content
nodes)alt
- the node'salt
property value (content
nodes)title
- the node'salt
property value (image
nodes)data-lynx-height
- the node'sheight
property value (image
nodes)data-lynx-width
- the node'swidth
property value (image
nodes)data-lynx-container-input-add
- the control used to add a new value to acontainer
input nodedata-lynx-container-input-value
- the view for the value of an item in thecontainer
input nodedata-lynx-container-input-remove
- the control used to remove a value from acontainer
input nodedata-lynx-container-input-item
- contains thedata-lynx-container-input-value
view and its associateddata-lynx-container-input-remove
controldata-lynx-validation-state
- the current validation state of the viewdata-lynx-visibility-conceal
- the control used to toggle a view'sdata-lynx-visibility
betweenrevealed
andconcealed
data-lynx-options-name
- the node'soptions
property value (input nodes)data-lynx-options-connected
- the input view is connected to its source of options (input nodes)data-lynx-options-role=options
- the view is a source of options for an input viewdata-lynx-option-selected
- the current option selected state of the viewdata-lynx-var-*
- lynx data (unspecified) properties are added with this namespace
View Functions
A view representing a node of a Lynx JSON document may have the following methods/functions:
lynxGetVisibility
- gets the visibility of a viewlynxSetVisibility
- sets the visibility of a viewlynxGetValue
- gets the value of a view (text, content, text input, content input, container input, option, and option value views)lynxSetValue
- sets the value of an input viewlynxHasValue
- tests an input view's value and returns a Promise for a booleanlynxClearValue
- clears an input view's valuelynxAddValue
- adds a value to a container input viewlynxRemoveValue
- removes a value from a container input viewlynxValidateValue
- if the view can be validated, performs the validationlynxGetValidationState
- if the view can be validated, gets the validation state of the viewlynxGetValidationConstraintSetObject
- gets the normalized validation constraint set of a viewlynxGetConcealView
- gets the view that represents the conceal action of a viewlynxSetConcealView
- sets the view that represents the conceal action of a viewlynxGetRevealView
- gets the view that represents the reveal action of a viewlynxSetRevealView
- sets the view that represents the reveal action of a viewlynxConnectOptions
- connects an input view that has options with its source of options (if found)lynxDisconnectOptions
- disconnects an input view from its source of options (if connected)lynxGetInputView
- gets the input view for an options viewlynxGetOptionsView
- gets the options view for an input viewlynxSetEmbeddedView
- sets both the view and the value (Blob) for a content viewlynxGetFocusableView
- optional function to get the element from a view that is an appropriate focus target (i.e., an input control)
View Events
A view representing a node of a Lynx JSON document may emit the following events:
change
- emitted when an input view's value changeslynx-visibility-change
- emitted when the view'sdata-lynx-visibility
value changeslynx-validation-state-change
- emitted when the view'sdata-lynx-validation-state
value changes. The event object will have avalidation
property whose value is an object (conforming to Lynx JSON's "Validation Constraint Set Object" interface) with the following additional properties:state
- the overall validation state for the view after considering the state of all constraintspriorState
- the overall validation state for the view prior to the changeconstraints
- an array of the validation constraints (conforming Lynx JSON's "Validation Constraint Object" interface) for the view also with their ownstate
andpriorState
propertieschanges
- an array of references to the validation constraints that have changed state
lynx-options-connected
- emitted when a view that provides options to an input view is connected to the input viewlynx-options-disconnected
- emitted when a view that provides options to an input view is disconnected from the input viewlynx-option-attached
- emitted when an option view has been added to an options viewlynx-option-selected
- emitted when a view that provides a value to an input view is selectedlynx-option-deselected
- emitted when a view that provides a value to an input view is deselectedlynx-marker-here
- emitted when a marker view determines the current view contains the content it markslynx-marker-there
- emitted when a marker view determines the current view does not contain the content it marks
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago