@aceshooting/lyra-ui 30.4.0 → 30.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +92 -0
- package/README.md +2 -3
- package/dist/components/agent-tools/artifact-panel/artifact-panel.class.d.ts +7 -4
- package/dist/components/agent-tools/artifact-panel/artifact-panel.class.js +5 -5
- package/dist/components/conversation/code-block/onig.provenance.json +1 -1
- package/dist/components/conversation/markdown/markdown-base.class.d.ts +1 -1
- package/dist/components/conversation/markdown/markdown-base.class.js +1 -1
- package/dist/components/conversation/markdown/markdown-core.class.d.ts +11 -1
- package/dist/components/conversation/markdown/markdown-core.class.js +1 -1
- package/dist/components/conversation/markdown/markdown-progressive.js +2 -2
- package/dist/components/conversation/markdown/markdown-shared.d.ts +7 -2
- package/dist/components/conversation/markdown/markdown-shared.js +3 -3
- package/dist/components/conversation/markdown/markdown.class.d.ts +11 -1
- package/dist/components/conversation/markdown/markdown.class.js +1 -1
- package/dist/components/conversation/message-parts/message-parts.class.d.ts +1 -1
- package/dist/components/conversation/message-parts/message-parts.class.js +1 -1
- package/dist/components/conversation/message-parts/message-parts.d.ts +1 -1
- package/dist/components/conversation/model-select/model-select.class.d.ts +8 -1
- package/dist/components/conversation/model-select/model-select.class.js +2 -2
- package/dist/components/conversation/streaming-text/streaming-text-base.class.d.ts +5 -0
- package/dist/components/conversation/streaming-text/streaming-text-base.class.js +2 -2
- package/dist/components/conversation/streaming-text/streaming-text-core.class.d.ts +1 -1
- package/dist/components/conversation/streaming-text/streaming-text-core.class.js +1 -0
- package/dist/components/conversation/streaming-text/streaming-text.class.d.ts +1 -1
- package/dist/components/conversation/streaming-text/streaming-text.class.js +1 -0
- package/dist/components/conversation/suggestion-chips/suggestion-chips.class.d.ts +6 -0
- package/dist/components/conversation/suggestion-chips/suggestion-chips.styles.js +1 -1
- package/dist/components/conversation/voice-picker/voice-picker.class.d.ts +9 -2
- package/dist/components/conversation/voice-picker/voice-picker.class.js +2 -2
- package/dist/components/conversation/widget-renderer/default-registry.js +1 -1
- package/dist/components/conversation/widget-renderer/registry.d.ts +1 -27
- package/dist/components/conversation/widget-renderer/registry.js +1 -1
- package/dist/components/conversation/widget-renderer/resolve.d.ts +1 -29
- package/dist/components/conversation/widget-renderer/resolve.js +1 -1
- package/dist/components/conversation/widget-renderer/widget-renderer.class.d.ts +1 -1
- package/dist/components/conversation/widget-renderer/widget-renderer.class.js +1 -1
- package/dist/components/forms/catalog-picker-base.d.ts +3 -1
- package/dist/components/forms/catalog-picker-base.js +3 -3
- package/dist/components/forms/combobox/combobox.class.d.ts +9 -2
- package/dist/components/forms/combobox/combobox.class.js +2 -2
- package/dist/components/forms/date-picker/date-input.class.d.ts +9 -2
- package/dist/components/forms/date-picker/date-input.class.js +2 -2
- package/dist/components/forms/input/input-shared.d.ts +9 -2
- package/dist/components/forms/input/input-shared.js +2 -2
- package/dist/components/forms/input/time-input.class.d.ts +9 -2
- package/dist/components/forms/input/time-input.class.js +2 -2
- package/dist/components/forms/input/time-input.styles.js +1 -1
- package/dist/components/forms/locale-picker/locale-picker.class.d.ts +18 -3
- package/dist/components/forms/locale-picker/locale-picker.class.js +2 -2
- package/dist/components/forms/phone-input/phone-input.class.d.ts +9 -2
- package/dist/components/forms/phone-input/phone-input.class.js +2 -2
- package/dist/components/forms/phone-input/phone-input.styles.js +1 -1
- package/dist/components/forms/select/select.class.d.ts +9 -2
- package/dist/components/forms/select/select.class.js +2 -2
- package/dist/components/forms/textarea/textarea.class.d.ts +9 -2
- package/dist/components/forms/textarea/textarea.class.js +2 -2
- package/dist/components/forms/token-input/token-input.class.d.ts +9 -2
- package/dist/components/forms/token-input/token-input.class.js +2 -2
- package/dist/components/forms/token-input/token-input.styles.js +1 -1
- package/dist/components/layout/dock-panel/dock-panel.class.d.ts +5 -2
- package/dist/components/layout/dock-panel/dock-panel.styles.js +1 -1
- package/dist/components/layout/menu/menu-item.class.d.ts +7 -4
- package/dist/components/layout/menu/menu-item.class.js +3 -2
- package/dist/components/layout/multi-split/multi-split.class.d.ts +73 -6
- package/dist/components/layout/multi-split/multi-split.class.js +4 -4
- package/dist/components/layout/multi-split/multi-split.styles.js +1 -1
- package/dist/components/layout/page/page.class.d.ts +7 -0
- package/dist/components/layout/page/page.styles.js +1 -1
- package/dist/components/media/flag/language-map.js +1 -1
- package/dist/components/media/image-viewer/image-viewer-panorama.d.ts +1 -5
- package/dist/components/media/image-viewer/image-viewer-panorama.js +1 -8
- package/dist/components/media/image-viewer/image-viewer.class.d.ts +1 -1
- package/dist/components/media/image-viewer/image-viewer.class.js +1 -1
- package/dist/components/media/map/map-control-options.d.ts +19 -5
- package/dist/components/media/map/map-control-options.js +1 -1
- package/dist/components/media/map/map-controls-lifecycle.js +1 -1
- package/dist/components/media/map/map-feature-loader.js +1 -1
- package/dist/components/media/map/map-loader.d.ts +10 -4
- package/dist/components/media/map/map-loader.js +1 -1
- package/dist/components/media/map/map-scene-admission.js +1 -0
- package/dist/components/media/map/map-scene-completion-adapter.js +1 -0
- package/dist/components/media/map/map-scene-completion-camera.js +1 -0
- package/dist/components/media/map/map-scene-configuration-controller.js +1 -0
- package/dist/components/media/map/map-scene-configuration.d.ts +15 -0
- package/dist/components/media/map/map-scene-configuration.js +1 -0
- package/dist/components/media/map/map-scene-controls.js +1 -0
- package/dist/components/media/map/map-scene-errors.js +1 -0
- package/dist/components/media/map/map-scene-line-layer.js +1 -0
- package/dist/components/media/map/map-scene-lines.js +1 -0
- package/dist/components/media/map/map-scene-owner.js +1 -0
- package/dist/components/media/map/map-scene-position-registry.js +1 -0
- package/dist/components/media/map/map-scene-render-controller.js +1 -0
- package/dist/components/media/map/map-scene-render-input.js +1 -0
- package/dist/components/media/map/map-scene-source-snapshot.js +1 -0
- package/dist/components/media/map/map-scene-status.js +1 -0
- package/dist/components/media/map/map-scene-types.d.ts +55 -0
- package/dist/components/media/map/map.class.d.ts +105 -18
- package/dist/components/media/map/map.class.js +32 -15
- package/dist/components/media/map/map.styles.js +1 -1
- package/dist/components/media/sequence-playback/sequence-playback.class.d.ts +1 -1
- package/dist/components/media/sequence-playback/sequence-playback.class.js +1 -1
- package/dist/components/media/video/video.class.d.ts +1 -1
- package/dist/components/media/video/video.class.js +1 -1
- package/dist/components/retrieval/graph/graph-builtin-3d-engine.js +1 -1
- package/dist/components/retrieval/graph/graph-curvature.js +1 -0
- package/dist/components/retrieval/graph/graph-engine-columns.js +1 -1
- package/dist/components/retrieval/graph/graph-model.d.ts +4 -0
- package/dist/components/retrieval/graph/graph-node-renderer.d.ts +13 -0
- package/dist/components/retrieval/graph/graph-node-renderer.js +1 -0
- package/dist/components/retrieval/graph/graph-source-controller.js +1 -1
- package/dist/components/retrieval/graph/graph-spatial-controller.js +3 -1
- package/dist/components/retrieval/graph/graph-spatial.js +1 -1
- package/dist/components/retrieval/graph/graph-webgl-engine.js +1 -1
- package/dist/components/retrieval/graph/graph.class.d.ts +11 -3
- package/dist/components/retrieval/graph/graph.class.js +4 -4
- package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.class.d.ts +8 -2
- package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.class.js +4 -2
- package/dist/events.d.ts +41 -1
- package/dist/framework-types.d.ts +1 -1
- package/dist/internal/collection-policy.js +1 -0
- package/dist/internal/collection-snapshot.js +1 -1
- package/dist/internal/default-strings/media.generated.js +1 -1
- package/dist/internal/default-strings/retrieval.generated.js +1 -1
- package/dist/internal/engine-3d-loader.d.ts +8 -2
- package/dist/internal/engine-3d-loader.js +1 -1
- package/dist/internal/form-control.styles.js +1 -1
- package/dist/internal/locale-loaders.generated.js +1 -1
- package/dist/internal/localization-runtime.js +1 -1
- package/dist/internal/localization-types.d.ts +1 -1
- package/dist/internal/localization.js +1 -1
- package/dist/internal/map-camera-follow-controller.d.ts +9 -0
- package/dist/internal/map-camera-follow-controller.js +1 -0
- package/dist/internal/map-camera-follow-data.js +1 -0
- package/dist/internal/map-camera-follow-scene.js +1 -0
- package/dist/internal/map-camera-session-controller.d.ts +59 -0
- package/dist/internal/map-camera-session-controller.js +1 -0
- package/dist/internal/map-camera-session-data.d.ts +16 -0
- package/dist/internal/map-camera-session-data.js +1 -0
- package/dist/internal/map-camera-session.js +1 -0
- package/dist/internal/map-scene-session.js +1 -0
- package/dist/internal/media-panorama.d.ts +5 -0
- package/dist/internal/media-panorama.js +8 -0
- package/dist/internal/package-metadata.js +1 -1
- package/dist/internal/sequence-playback-binding.js +1 -0
- package/dist/internal/typed-columns.d.ts +3 -1
- package/dist/internal/typed-columns.js +1 -1
- package/dist/internal/variants.d.ts +7 -0
- package/dist/internal/widget-default-registry.js +1 -0
- package/dist/internal/widget-document.d.ts +29 -0
- package/dist/internal/widget-document.js +1 -0
- package/dist/internal/widget-type-registry.d.ts +27 -0
- package/dist/internal/widget-type-registry.js +1 -0
- package/dist/lyra.d.ts +1 -1
- package/dist/lyra.js +1 -1
- package/dist/map-camera-session.d.ts +10 -0
- package/dist/map-camera-session.js +1 -0
- package/dist/sequence-time-binding.d.ts +3 -0
- package/dist/sequence-time-binding.js +1 -0
- package/dist/simulation-clock.d.ts +3 -0
- package/dist/simulation-clock.js +1 -0
- package/dist/time-index.d.ts +3 -0
- package/dist/time-index.js +1 -0
- package/llms/components/lr-artifact-panel.md +8 -3
- package/llms/components/lr-combobox.md +2 -0
- package/llms/components/lr-country-picker.md +2 -0
- package/llms/components/lr-currency-picker.md +2 -0
- package/llms/components/lr-date-picker.md +2 -0
- package/llms/components/lr-dock-panel.md +5 -2
- package/llms/components/lr-graph.md +121 -3
- package/llms/components/lr-input.md +2 -0
- package/llms/components/lr-knowledge-graph-explorer.md +6 -1
- package/llms/components/lr-locale-picker.md +8 -1
- package/llms/components/lr-map.md +365 -13
- package/llms/components/lr-markdown-core.md +2 -1
- package/llms/components/lr-markdown.md +12 -1
- package/llms/components/lr-menu.md +5 -2
- package/llms/components/lr-model-select.md +2 -0
- package/llms/components/lr-multi-split.md +53 -4
- package/llms/components/lr-native-time-input.md +2 -0
- package/llms/components/lr-number-input.md +2 -0
- package/llms/components/lr-page.md +9 -1
- package/llms/components/lr-phone-input.md +2 -0
- package/llms/components/lr-select.md +2 -0
- package/llms/components/lr-sequence-playback.md +44 -0
- package/llms/components/lr-streaming-text-core.md +3 -2
- package/llms/components/lr-streaming-text.md +4 -1
- package/llms/components/lr-suggestion-chips.md +6 -2
- package/llms/components/lr-textarea.md +2 -0
- package/llms/components/lr-time-input.md +2 -0
- package/llms/components/lr-time-zone-picker.md +2 -0
- package/llms/components/lr-token-input.md +2 -0
- package/llms/components/lr-unit-picker.md +2 -0
- package/llms/components/lr-voice-picker.md +2 -0
- package/llms/peers.md +7 -7
- package/llms/shared/imports-and-registration.md +1 -1
- package/llms/shared/localization-and-rtl.md +15 -1
- package/llms/shared/testing-and-utilities.md +184 -0
- package/llms/shared.md +200 -2
- package/locales.json +1 -1
- package/package.json +39 -23
- package/registrations.json +1 -1
- package/skills/lyra-ui/lyra-gen.md +18 -0
- /package/dist/{components/media/image-viewer/image-viewer-panorama.styles.js → internal/media-panorama.styles.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{DEFAULT_WIDGET_TYPE_REGISTRY as SHARED_DEFAULT_WIDGET_TYPE_REGISTRY}from"../../../internal/widget-default-registry.js";const DEFAULT_WIDGET_TYPE_REGISTRY=SHARED_DEFAULT_WIDGET_TYPE_REGISTRY;export{DEFAULT_WIDGET_TYPE_REGISTRY};
|
|
@@ -1,27 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export type LyraWidgetPropType='string'|'number'|'boolean';
|
|
3
|
-
/** Semantic interaction classification, independent of event and binding plumbing.*/
|
|
4
|
-
export type LyraWidgetInteraction='none'|'control';
|
|
5
|
-
/** One allowlisted mapped widget type. Structural `text`/`row`/`col` nodes are not registered.*/
|
|
6
|
-
export interface LyraWidgetTypeDefinition{
|
|
7
|
-
/** Required custom-element render target.*/
|
|
8
|
-
readonly tag:string;
|
|
9
|
-
/** Prop allowlist: name -> required primitive type.*/
|
|
10
|
-
readonly props?:Readonly<Record<string,LyraWidgetPropType>>;
|
|
11
|
-
/** Always applied after the authored allowlist and never overridable by document input.*/
|
|
12
|
-
readonly forcedProps?:Readonly<Record<string,unknown>>;
|
|
13
|
-
/** Allowlisted child slot names.*/
|
|
14
|
-
readonly slots?:readonly string[];
|
|
15
|
-
/** Whether this element is semantically a control for nested-control content-model checks.*/
|
|
16
|
-
readonly interaction:LyraWidgetInteraction;
|
|
17
|
-
/** Event that emits `lr-widget-action` when a node also supplies `actionId`.*/
|
|
18
|
-
readonly action?:Readonly<{event:string;}>;
|
|
19
|
-
/** Controlled-state event mappings for allowlisted props.*/
|
|
20
|
-
readonly bindings?:Readonly<Record<string,Readonly<{event:string;}>>>;}declare const WIDGET_TYPE_REGISTRY_BRAND:unique symbol;
|
|
21
|
-
/** Immutable type-keyed registry snapshot accepted by each `<lr-widget-renderer>` instance.*/
|
|
22
|
-
export interface LyraWidgetTypeRegistry extends ReadonlyMap<string,Readonly<LyraWidgetTypeDefinition>>{readonly[WIDGET_TYPE_REGISTRY_BRAND]:true;}
|
|
23
|
-
/** Runtime guard for callers crossing an untyped boundary. Mutable structural `Map` values are
|
|
24
|
-
* rejected rather than retained by a renderer and allowed to leak mutations between instances. */
|
|
25
|
-
export declare function isWidgetTypeRegistry(value:unknown):value is LyraWidgetTypeRegistry;
|
|
26
|
-
/** Creates an immutable, validated registry snapshot owned by the assigning renderer/consumer.*/
|
|
27
|
-
export declare function createWidgetTypeRegistry(entries?:Iterable<readonly[string,LyraWidgetTypeDefinition]>):LyraWidgetTypeRegistry;export{};
|
|
1
|
+
export*from'../../../internal/widget-type-registry.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export*from"../../../internal/widget-type-registry.js";
|
|
@@ -1,29 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/** Version-two document. Controlled binding state is supplied separately through `bindingState`.*/
|
|
3
|
-
export interface LyraWidgetDocument{readonly version:'2';readonly root:LyraWidgetNode;}
|
|
4
|
-
/**
|
|
5
|
-
* Creates an immediate, bounded, frozen version-two document snapshot. Widget-owned structure and
|
|
6
|
-
* prop records are copied; opaque prop values and action payloads intentionally retain identity.
|
|
7
|
-
* String children and string prop values are truncated to `WIDGET_MAX_STRING_LENGTH`, the same
|
|
8
|
-
* silent admission ceiling the depth/node/prop budgets apply here.
|
|
9
|
-
* Malformed, cyclic, duplicate-id, or hostile input throws `TypeError` before a document escapes.
|
|
10
|
-
*/
|
|
11
|
-
export declare function createWidgetDocument(root:LyraWidgetNode):LyraWidgetDocument;export interface ResolvedText{
|
|
12
|
-
/** Collision-free deterministic reconciliation key.*/
|
|
13
|
-
nodeKey:string;nodePath:string;kind:'text';text:string;slot?:string;}export interface ResolvedElement{
|
|
14
|
-
/** Explicit public identity, when authored. Stateful/actionable mapped nodes always have one.*/
|
|
15
|
-
nodeId?:string;
|
|
16
|
-
/** Collision-free deterministic key: authored id when present, otherwise structural path.*/
|
|
17
|
-
nodeKey:string;
|
|
18
|
-
/** Deterministic occurrence path within this document.*/
|
|
19
|
-
nodePath:string;kind:'builtin-row'|'builtin-col'|'builtin-text'|'mapped';tag?:string;
|
|
20
|
-
/** Semantic control classification, independent of actions and bindings.*/
|
|
21
|
-
interactive:boolean;props:Record<string,unknown>;actionEvent?:string;actionId?:string;payload?:unknown;bindings:Array<{prop:string;path:string;event?:string;}>;children:ResolvedNode[];slot?:string;}export type ResolvedNode=ResolvedText|ResolvedElement;export interface ResolveContext{registry:LyraWidgetTypeRegistry;bindingState:unknown;
|
|
22
|
-
/** Warning keys retained for one renderer document/registry generation.*/
|
|
23
|
-
warned:Set<string>;
|
|
24
|
-
/** Explicit diagnostic callback, active in every runtime. Without one, authoring warnings
|
|
25
|
-
* are emitted only in development; keys and caps belong to this context generation. */
|
|
26
|
-
warn?:(message:string)=>void;}
|
|
27
|
-
/** Resolves one bounded immutable snapshot through `ctx.registry`. Structural invalidity returns
|
|
28
|
-
* `null`; throwing getters/registry access propagate so the renderer can emit one normalized error. */
|
|
29
|
-
export declare function resolveTree(root:LyraWidgetNode|null|undefined,ctx:ResolveContext):ResolvedNode|null;
|
|
1
|
+
export*from'../../../internal/widget-document.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{devWarn}from"../../../internal/dev-mode-attribute-warning.js";import{isWidgetTypeRegistry}from"./registry.js";import{readWidgetPointer,WIDGET_MAX_DEPTH,WIDGET_MAX_NODES,WIDGET_MAX_PROPS_PER_NODE,WIDGET_MAX_WARNINGS}from"../../../internal/widget-resolver.js";const WIDGET_MAX_STRING_LENGTH=16384;function truncateWidgetString(value){if(value.length<=WIDGET_MAX_STRING_LENGTH)return value;const capped=value.slice(0,WIDGET_MAX_STRING_LENGTH),last=capped.charCodeAt(capped.length-1);return last>=55296&&last<=56319?capped.slice(0,-1):capped}const DOCUMENT_INVALID=Symbol("invalid-widget-document"),DOCUMENT_MISSING=Symbol("missing-widget-document-field");function readDocumentField(input,key){try{return Object.hasOwn(input,key)?Reflect.get(input,key):DOCUMENT_MISSING}catch{return DOCUMENT_INVALID}}function snapshotDocumentProps(input){const output={};let admitted=0;try{for(const key in input){if(!Object.hasOwn(input,key))continue;if(admitted>=WIDGET_MAX_PROPS_PER_NODE)break;const value=Reflect.get(input,key);admitted+=1,output[key]=typeof value=="string"?truncateWidgetString(value):value}}catch{return DOCUMENT_INVALID}return Object.freeze(output)}function snapshotDocumentNode(input,depth,context){if(depth>WIDGET_MAX_DEPTH||context.remaining<=0)return null;if(context.remaining-=1,input===null||typeof input!="object"||Array.isArray(input)||context.ancestors.has(input))return DOCUMENT_INVALID;const type=readDocumentField(input,"type");if(typeof type!="string")return DOCUMENT_INVALID;const id=readDocumentField(input,"id"),slot=readDocumentField(input,"slot"),actionId=readDocumentField(input,"actionId"),propsInput=readDocumentField(input,"props"),childrenInput=readDocumentField(input,"children");if([id,slot,actionId,propsInput,childrenInput].includes(DOCUMENT_INVALID)||id!==DOCUMENT_MISSING&&(typeof id!="string"||id.length===0||id!==id.trim()))return DOCUMENT_INVALID;if(typeof id=="string"){if(context.ids.has(id))return DOCUMENT_INVALID;context.ids.add(id)}if(slot!==DOCUMENT_MISSING&&(typeof slot!="string"||slot.length===0||slot!==slot.trim())||actionId!==DOCUMENT_MISSING&&(typeof actionId!="string"||actionId.length===0||actionId!==actionId.trim())||propsInput!==DOCUMENT_MISSING&&(propsInput===null||typeof propsInput!="object"||Array.isArray(propsInput))||childrenInput!==DOCUMENT_MISSING&&!Array.isArray(childrenInput))return DOCUMENT_INVALID;const props=propsInput===DOCUMENT_MISSING?void 0:snapshotDocumentProps(propsInput);if(props===DOCUMENT_INVALID)return DOCUMENT_INVALID;let payload=DOCUMENT_MISSING;if(actionId!==DOCUMENT_MISSING&&(payload=readDocumentField(input,"payload"),payload===DOCUMENT_INVALID))return DOCUMENT_INVALID;const children=[];if(childrenInput!==DOCUMENT_MISSING&&depth<WIDGET_MAX_DEPTH){const length=readDocumentField(childrenInput,"length");if(typeof length!="number"||!Number.isSafeInteger(length)||length<0)return DOCUMENT_INVALID;context.ancestors.add(input);try{for(let index=0;index<length&&context.remaining>0;index++){const child=readDocumentField(childrenInput,index);if(child===DOCUMENT_INVALID||child===DOCUMENT_MISSING)return DOCUMENT_INVALID;if(typeof child=="string"){context.remaining-=1,children.push(truncateWidgetString(child));continue}const snapshot=snapshotDocumentNode(child,depth+1,context);if(snapshot===DOCUMENT_INVALID)return DOCUMENT_INVALID;snapshot&&children.push(snapshot)}}finally{context.ancestors.delete(input)}}return Object.freeze({type,...typeof id=="string"?{id}:{},...typeof slot=="string"?{slot}:{},...typeof actionId=="string"?{actionId,payload:payload===DOCUMENT_MISSING?void 0:payload}:{},...props===void 0?{}:{props},...children.length===0?{}:{children:Object.freeze(children)}})}function createWidgetDocument(root){const snapshot=snapshotDocumentNode(root,0,{ancestors:new Set,ids:new Set,remaining:WIDGET_MAX_NODES});if(snapshot===DOCUMENT_INVALID||snapshot===null)throw new TypeError("A widget document root must be a valid bounded widget node.");return Object.freeze({version:"2",root:snapshot})}const WARNING_SUPPRESSION_KEY="__warning-cap__",INVALID=Symbol("invalid-widget-input"),ROW_COL_PROP_ENUMS={gap:["s","m","l"],align:["start","center","end","stretch"],justify:["start","center","end","between"]};function warnOnce(ctx,key,message){if(!ctx.warned.has(key)){if(ctx.warned.size>=WIDGET_MAX_WARNINGS){if(ctx.warned.has(WARNING_SUPPRESSION_KEY))return;ctx.warned.add(WARNING_SUPPRESSION_KEY),(ctx.warn??devWarn)(`[lr-widget-renderer] suppressed further diagnostics after ${WIDGET_MAX_WARNINGS} unique warnings`);return}ctx.warned.add(key),(ctx.warn??devWarn)(`[lr-widget-renderer] ${message}`)}}function capResolvedString(value,ctx,key,subject){const capped=truncateWidgetString(value);return capped.length!==value.length&&warnOnce(ctx,`__string-cap__:${key}`,`truncated ${subject} after the ${WIDGET_MAX_STRING_LENGTH}-character string cap was reached`),capped}function isBinding(value){return!!(value&&typeof value=="object"&&!Array.isArray(value)&&typeof value.$bind=="string")}function resolveValue(value,ctx){if(!isBinding(value))return{value};const resolved=readWidgetPointer(ctx.bindingState,value.$bind);return{value:resolved===void 0?value.fallback:resolved,path:value.$bind}}function consumeNodeBudget(snapshot){return snapshot.remaining<=0?(warnOnce(snapshot.resolve,"__node-cap__",`stopped resolving after the ${WIDGET_MAX_NODES}-node cap was reached`),!1):(snapshot.remaining--,!0)}function snapshotProps(input,type,ctx){const out={};let visited=0;for(const key in input){if(visited>=WIDGET_MAX_PROPS_PER_NODE){warnOnce(ctx,`__prop-cap__:${type}`,`stopped reading props on type "${type}" after the ${WIDGET_MAX_PROPS_PER_NODE}-prop cap was reached`);break}visited++,Object.hasOwn(input,key)&&(out[key]=input[key])}return out}function definitionFor(type,registry){return registry.get(type)}function snapshotNode(input,depth,snapshot){if(!consumeNodeBudget(snapshot))return null;if(input===null||typeof input!="object"||Array.isArray(input)||snapshot.ancestors.has(input))return INVALID;const candidate=input,type=candidate.type;if(typeof type!="string")return INVALID;if(!(type==="row"||type==="col"||type==="text")&&!definitionFor(type,snapshot.resolve.registry))return{type};const id=candidate.id;if(id!==void 0&&(typeof id!="string"||id.length===0||id!==id.trim()))return INVALID;const slot=candidate.slot;if(slot!==void 0&&(typeof slot!="string"||slot.length===0||slot!==slot.trim()))return INVALID;const actionId=candidate.actionId;if(actionId!==void 0&&(typeof actionId!="string"||actionId.length===0||actionId!==actionId.trim()))return INVALID;const propsInput=candidate.props;if(propsInput!==void 0&&(propsInput===null||typeof propsInput!="object"||Array.isArray(propsInput)))return INVALID;const childrenInput=candidate.children;if(childrenInput!==void 0&&!Array.isArray(childrenInput))return INVALID;const node={type,...id!==void 0?{id}:{},...slot!==void 0?{slot}:{},...actionId!==void 0?{actionId,payload:candidate.payload}:{},...propsInput!==void 0?{props:snapshotProps(propsInput,type,snapshot.resolve)}:{}};if(childrenInput===void 0||depth===WIDGET_MAX_DEPTH)return childrenInput&&childrenInput.length>0&&warnOnce(snapshot.resolve,"__depth-cap__",`stopped resolving after the ${WIDGET_MAX_DEPTH}-level depth cap was reached`),node;const children=[];snapshot.ancestors.add(input);try{const childCount=childrenInput.length;for(let index=0;index<childCount;index++){if(snapshot.remaining<=0){consumeNodeBudget(snapshot);break}const child=childrenInput[index];if(typeof child=="string"){if(!consumeNodeBudget(snapshot))break;children.push(child);continue}const accepted=snapshotNode(child,depth+1,snapshot);if(accepted===INVALID)return INVALID;accepted&&children.push(accepted)}}finally{snapshot.ancestors.delete(input)}return children.length>0?{...node,children}:node}function filterRowColProps(props){const out={};if(!props)return out;for(const[key,allowed]of Object.entries(ROW_COL_PROP_ENUMS)){const value=props[key];typeof value=="string"&&allowed.includes(value)&&(out[key]=value)}return out}function filterMappedProps(props,def,ctx,type){const out={},bindings=[],allowlist=def.props??{};if(props)for(const[key,rawValue]of Object.entries(props)){const expectedType=allowlist[key],{value,path}=resolveValue(rawValue,ctx);if(expectedType===void 0||typeof value!==expectedType){warnOnce(ctx,`${type}:${key}`,`skipped disallowed or mistyped prop "${key}" on type "${type}"`);continue}out[key]=typeof value=="string"?capResolvedString(value,ctx,`${type}:${key}`,`string prop "${key}" on type "${type}"`):value,path&&bindings.push({prop:key,path,event:def.bindings?.[key]?.event})}return{props:{...out,...def.forcedProps??{}},bindings}}function containsInteractive(node){return node.kind==="text"?!1:node.interactive||node.children.some(containsInteractive)}function resolveChild(value,ctx,path){return typeof value=="string"?{nodeKey:`path:${path}`,nodePath:path,kind:"text",text:capResolvedString(value,ctx,"__text__","a text child")}:resolveNode(value,ctx,path)}function resolveNode(node,ctx,path){const authoredId=node.id,nodeKey=authoredId?`id:${authoredId}`:`path:${path}`;let kind,tag,interactive=!1,props,actionEvent,bindings=[],slots=[];if(node.type==="row"||node.type==="col")kind=node.type==="row"?"builtin-row":"builtin-col",props=filterRowColProps(node.props);else if(node.type==="text"){kind="builtin-text";const resolved=resolveValue(node.props?.value,ctx);if(props=typeof resolved.value=="string"||typeof resolved.value=="number"?{value:capResolvedString(String(resolved.value),ctx,"__text-value__",'the "value" of a built-in text node')}:{},resolved.path){if(!authoredId)throw warnOnce(ctx,`__required-id__:${path}`,"rejected bound text without a stable id"),new TypeError("A bound widget node requires a stable id.");bindings=[{prop:"value",path:resolved.path}]}}else{const def=definitionFor(node.type,ctx.registry);if(!def)return warnOnce(ctx,node.type,`skipped unknown widget type "${node.type}" (and its subtree)`),null;kind="mapped",tag=def.tag,interactive=def.interaction==="control";const filtered=filterMappedProps(node.props,def,ctx,node.type);if(props=filtered.props,bindings=filtered.bindings,slots=def.slots??[],node.actionId!==void 0&&def.action&&(actionEvent=def.action.event),(actionEvent||bindings.length>0)&&!authoredId)throw warnOnce(ctx,`__required-id__:${path}`,`rejected stateful or actionable type "${node.type}" without a stable id`),new TypeError("A stateful or actionable widget node requires a stable id.")}const children=[];for(let index=0;index<(node.children?.length??0);index++){const resolvedChild=resolveChild(node.children[index],ctx,`${path}.${index}`);if(resolvedChild){if(interactive&&containsInteractive(resolvedChild)){warnOnce(ctx,`__nested-interactive__:${node.type}`,`skipped a control descendant inside control type "${node.type}"`);continue}resolvedChild.slot!==void 0&&!slots.includes(resolvedChild.slot)&&(resolvedChild.slot=void 0),children.push(resolvedChild)}}return{nodeId:authoredId,nodeKey,nodePath:path,kind,tag,interactive,props,actionEvent,actionId:actionEvent?node.actionId:void 0,payload:actionEvent?node.payload:void 0,bindings,children,slot:node.slot}}function hasDuplicateAuthoredIds(root,ctx){const counts=new Map,pending=[root];for(;pending.length>0;){const node=pending.pop();node.id&&counts.set(node.id,(counts.get(node.id)??0)+1);for(const child of node.children??[])typeof child!="string"&&pending.push(child)}let duplicate=!1;for(const[id,count]of counts)count<2||(duplicate=!0,warnOnce(ctx,`__duplicate-id__:${id}`,`rejected duplicate widget id "${id}"`));return duplicate}function resolveTree(root,ctx){if(root==null)return null;if(!isWidgetTypeRegistry(ctx.registry))throw new TypeError("A widget renderer registry must be created with createWidgetTypeRegistry().");const snapshot=snapshotNode(root,0,{resolve:ctx,ancestors:new Set,remaining:WIDGET_MAX_NODES});return snapshot===INVALID||snapshot===null||hasDuplicateAuthoredIds(snapshot,ctx)?null:resolveNode(snapshot,ctx,"0")}export{WIDGET_MAX_STRING_LENGTH,createWidgetDocument,resolveTree};
|
|
1
|
+
export*from"../../../internal/widget-document.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{type TemplateResult,type PropertyValues}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import{type LyraWidgetDocument}from'
|
|
1
|
+
import{type TemplateResult,type PropertyValues}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import{type LyraWidgetDocument}from'../../../internal/widget-document.js';import type{LyraWidgetTypeRegistry}from'../../../internal/widget-type-registry.js';export interface LyraWidgetRendererEventMap{'lr-widget-action':CustomEvent<{actionId:string;payload:unknown;nodeId:string;nodeKey:string;nodePath:string;}>;'lr-render-error':CustomEvent<{error:Error;}>;'lr-widget-state-change':CustomEvent<{path:string;value:unknown;nodeId:string;nodeKey:string;nodePath:string;prop:string;}>;}
|
|
2
2
|
/**
|
|
3
3
|
* `<lr-widget-renderer>` — renders an agent-streamed declarative JSON widget tree through an
|
|
4
4
|
* allowlisted `type -> lyra tag` registry (see `registry.ts`/`resolve.ts` for the allowlist
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{ref}from"lit/directives/ref.js";import{property,state}from"lit/decorators.js";import{repeat}from"lit/directives/repeat.js";import{styleMap}from"lit/directives/style-map.js";import{html as staticHtml,unsafeStatic}from"lit/static-html.js";import{LyraElement}from"../../../internal/lyra-element.js";import{styles}from"./widget-renderer.styles.js";import{resolveTree}from"
|
|
1
|
+
import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{ref}from"lit/directives/ref.js";import{property,state}from"lit/decorators.js";import{repeat}from"lit/directives/repeat.js";import{styleMap}from"lit/directives/style-map.js";import{html as staticHtml,unsafeStatic}from"lit/static-html.js";import{LyraElement}from"../../../internal/lyra-element.js";import{styles}from"./widget-renderer.styles.js";import{resolveTree}from"../../../internal/widget-document.js";import{DEFAULT_WIDGET_TYPE_REGISTRY}from"../../../internal/widget-default-registry.js";const mappedTagCache=new Map;function cachedMappedTag(tag){let value=mappedTagCache.get(tag);return value||(value=unsafeStatic(tag),mappedTagCache.set(tag,value)),value}const GAP_TOKEN={s:"var(--lr-space-s)",m:"var(--lr-space-m)",l:"var(--lr-space-l)"},JUSTIFY_VALUE={start:"flex-start",center:"center",end:"flex-end",between:"space-between"},ALIGN_VALUE={start:"flex-start","flex-start":"flex-start",center:"center",end:"flex-end","flex-end":"flex-end",stretch:"stretch",baseline:"baseline","self-start":"self-start","self-end":"self-end","first baseline":"first baseline","last baseline":"last baseline",normal:"normal"};function sanitizeAlignValue(value){return ALIGN_VALUE[value.trim().toLowerCase()]}const DOCUMENT_RESOLUTION_FAILED_MESSAGE="lr-widget-renderer: document resolution failed";function normalizedRenderError(error){return error instanceof Error?error:new Error(DOCUMENT_RESOLUTION_FAILED_MESSAGE)}const DOCUMENT_FIELD_UNREADABLE=Symbol("lr-widget-renderer:document-field-unreadable");function readDocumentField(document,key){try{return Object.hasOwn(document,key)?Reflect.get(document,key):DOCUMENT_FIELD_UNREADABLE}catch{return DOCUMENT_FIELD_UNREADABLE}}class LyraWidgetRenderer extends LyraElement{constructor(){super(...arguments),this.document=null,this.registry=DEFAULT_WIDGET_TYPE_REGISTRY,this.resolved=null,this.warned=new Set,this.actionHandlers=new WeakMap,this.bindingHandlers=new WeakMap,this.assignedProps=new WeakMap,this.initialProps=new WeakMap,this.mappedElementRefs=new WeakMap}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["document"])}static{this.styles=[LyraElement.styles,styles]}willUpdate(changed){if(super.willUpdate(changed),!this.hasUpdated||changed.has("document")||changed.has("bindingState")||changed.has("registry"))try{const registry=this.registry,widgetDocument=this.document;let root=null;if(widgetDocument!==null){const version=readDocumentField(widgetDocument,"version"),rootField=readDocumentField(widgetDocument,"root");if(version===DOCUMENT_FIELD_UNREADABLE||rootField===DOCUMENT_FIELD_UNREADABLE)throw new Error(DOCUMENT_RESOLUTION_FAILED_MESSAGE);if(version!=="2")throw new Error("lr-widget-renderer: unsupported document version");root=rootField}(this.warningScope?.root!==root||this.warningScope.registry!==registry)&&(this.warned.clear(),this.warningScope={root,registry});const next=resolveTree(root,{registry,warned:this.warned,bindingState:this.bindingState});if(widgetDocument!==null&&next===null)throw new Error("lr-widget-renderer: document resolved to nothing renderable");this.resolved=next}catch(error){this.resolved=null,this.emit("lr-render-error",{error:normalizedRenderError(error)})}}builtinStyle(node){const gap=typeof node.props.gap=="string"?GAP_TOKEN[node.props.gap]:void 0,align=typeof node.props.align=="string"?sanitizeAlignValue(node.props.align):void 0,justifyRaw=typeof node.props.justify=="string"?node.props.justify:void 0,justify=justifyRaw?JUSTIFY_VALUE[justifyRaw]:void 0;return{display:"flex","flex-direction":node.kind==="builtin-row"?"row":"column","flex-wrap":node.kind==="builtin-row"?"wrap":"nowrap",...gap?{gap}:{},...align?{"align-items":align}:{},...justify?{"justify-content":justify}:{}}}syncActionHandler(el,node){const existing=this.actionHandlers.get(el);if(existing&&(el.removeEventListener(existing.event,existing.handler),this.actionHandlers.delete(el)),node.actionEvent){const handler=e=>{e.stopPropagation(),node.actionId!==void 0&&this.emit("lr-widget-action",{actionId:node.actionId,payload:node.payload,nodeId:node.nodeId,nodeKey:node.nodeKey,nodePath:node.nodePath})};el.addEventListener(node.actionEvent,handler),this.actionHandlers.set(el,{event:node.actionEvent,handler})}}syncBindingHandlers(el,node){for(const existing of this.bindingHandlers.get(el)??[])el.removeEventListener(existing.event,existing.handler);const states=[];for(const binding of node.bindings){if(!binding.event)continue;const handler=event=>{event.stopPropagation();const detail=event.detail,value=detail!==null&&typeof detail=="object"&&Object.hasOwn(detail,"value")?detail.value:el[binding.prop];this.emit("lr-widget-state-change",{path:binding.path,value,nodeId:node.nodeId,nodeKey:node.nodeKey,nodePath:node.nodePath,prop:binding.prop})};el.addEventListener(binding.event,handler),states.push({event:binding.event,handler})}this.bindingHandlers.set(el,states)}syncMappedElement(el,node){const previousKeys=this.assignedProps.get(el)??new Set,initialValues=this.initialProps.get(el)??new Map,nextKeys=new Set(Object.keys(node.props));for(const key of previousKeys)nextKeys.has(key)||(el[key]=initialValues.get(key));for(const[k,v]of Object.entries(node.props))initialValues.has(k)||initialValues.set(k,el[k]),el[k]=v;this.assignedProps.set(el,nextKeys),this.initialProps.set(el,initialValues),this.syncActionHandler(el,node),this.syncBindingHandlers(el,node)}cleanupMappedElement(el){const action=this.actionHandlers.get(el);action&&el.removeEventListener(action.event,action.handler),this.actionHandlers.delete(el);for(const binding of this.bindingHandlers.get(el)??[])el.removeEventListener(binding.event,binding.handler);this.bindingHandlers.delete(el)}mappedElementRef(node){let attached;return element=>{if(!element){attached&&this.cleanupMappedElement(attached),attached=void 0;return}attached=element,this.syncMappedElement(attached,node)}}renderMapped(node){let onRef=this.mappedElementRefs.get(node);onRef||(onRef=this.mappedElementRef(node),this.mappedElementRefs.set(node,onRef));const mappedTag=cachedMappedTag(node.tag);return staticHtml`<${mappedTag}
|
|
2
2
|
data-widget-node-key=${node.nodeKey}
|
|
3
3
|
data-widget-node-path=${node.nodePath}
|
|
4
4
|
slot=${node.slot??nothing}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import{nothing,type PropertyValues,type TemplateResult}from'lit';import{LyraElement}from'../../internal/lyra-element.js';import{type FormSubmissionValue}from'../../internal/form-associated.js';import{type SelectionCatalogEntry,type SelectionCatalogRow}from'../../internal/selection-catalog.js';import type{PlaceStrategy}from'../../internal/positioner.js';import type{LyraSize}from'../../internal/variants.js';import type{LyraSelect}from'./select/select.class.js';import type{LyraCombobox}from'./combobox/combobox.class.js';export interface LyraCatalogPickerChangeDetail{readonly value:string;readonly previousValue:string;}export interface LyraCatalogPickerEventMap{'lr-input':CustomEvent<LyraCatalogPickerChangeDetail>;'lr-change':CustomEvent<LyraCatalogPickerChangeDetail>;'lr-invalid':CustomEvent<null>;input:Event;change:Event;focus:FocusEvent;blur:FocusEvent;}type PickerControl=LyraSelect<false> |LyraCombobox<false>;declare class CatalogPickerElement extends LyraElement<LyraCatalogPickerEventMap>{}declare const LyraCatalogPickerBase_base:typeof CatalogPickerElement&(new(...args:any[])=>import("../../lyra.js").FormAssociatedInterface<string> &import("../../internal/form-associated.js").FormAssociatedSubclassInterface<string>);
|
|
1
|
+
import{nothing,type PropertyValues,type TemplateResult}from'lit';import{LyraElement}from'../../internal/lyra-element.js';import{type FormSubmissionValue}from'../../internal/form-associated.js';import{type SelectionCatalogEntry,type SelectionCatalogRow}from'../../internal/selection-catalog.js';import type{PlaceStrategy}from'../../internal/positioner.js';import type{LyraLabelDisplay,LyraSize}from'../../internal/variants.js';import type{LyraSelect}from'./select/select.class.js';import type{LyraCombobox}from'./combobox/combobox.class.js';export interface LyraCatalogPickerChangeDetail{readonly value:string;readonly previousValue:string;}export interface LyraCatalogPickerEventMap{'lr-input':CustomEvent<LyraCatalogPickerChangeDetail>;'lr-change':CustomEvent<LyraCatalogPickerChangeDetail>;'lr-invalid':CustomEvent<null>;input:Event;change:Event;focus:FocusEvent;blur:FocusEvent;}type PickerControl=LyraSelect<false> |LyraCombobox<false>;declare class CatalogPickerElement extends LyraElement<LyraCatalogPickerEventMap>{}declare const LyraCatalogPickerBase_base:typeof CatalogPickerElement&(new(...args:any[])=>import("../../lyra.js").FormAssociatedInterface<string> &import("../../internal/form-associated.js").FormAssociatedSubclassInterface<string>);
|
|
2
2
|
/** Shared implementation for catalog selectors; not a registered custom element.*/
|
|
3
3
|
export declare abstract class LyraCatalogPickerBase extends LyraCatalogPickerBase_base{static styles:import("lit").CSSResultGroup[];protected static collectionSupport:import("../../internal/lyra-element.js").LyraCollectionSupport;protected static readonly immutableEventDetails:readonly string[];
|
|
4
4
|
/** Visible field label; the label slot takes precedence.*/
|
|
5
5
|
label:string;
|
|
6
|
+
/** Whether the `label` renders on screen; `hidden` keeps it as the accessible name.*/
|
|
7
|
+
labelDisplay:LyraLabelDisplay;
|
|
6
8
|
/** Field guidance; the hint slot takes precedence.*/
|
|
7
9
|
hint:string;
|
|
8
10
|
/** Validation guidance; the error slot takes precedence.*/
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import{__decorate}from"tslib";import{MAX_RENDERED_OPTION_ROWS}from"../../internal/option-selection.js";import{guard}from"lit/directives/guard.js";import{noChange,nothing}from"lit";import{html,unsafeStatic}from"lit/static-html.js";import{property}from"lit/decorators.js";import{LyraElement}from"../../internal/lyra-element.js";import{FormAssociated,isBarredFromValidation}from"../../internal/form-associated.js";import{resolveValidityAnchor,SET_ANCHORED_VALIDITY,VALIDITY_ANCHOR}from"../../internal/anchored-validity.js";import{acquireResolvedAriaRelationship}from"../../internal/aria-controls.js";import{AnnouncementSinkController}from"../../internal/announcer.js";import{collectionSupport}from"../../internal/collection-snapshot.js";import{autocorrectConverter,spellcheckConverter}from"../../internal/converters.js";import{dispatchNativeEvent,relayNativeEvent}from"../../internal/native-event-relay.js";import{deepActiveElementIn,shadowFocusTarget}from"../../internal/active-element.js";import{submitOnEnter}from"../../internal/submit-on-enter.js";import{SlotPresenceController}from"../../internal/slot-presence-controller.js";import{tag}from"../../internal/prefix.js";import{resolveEffectivePositioningStrategy}from"../../internal/positioning-strategy.js";import{hasCustomState}from"../../internal/custom-states.js";import{normalizeSelectionValue,selectionCatalogTruncation}from"../../internal/selection-catalog.js";import{styles}from"./catalog-picker-base.styles.js";class CatalogPickerElement extends LyraElement{}const pickerSpellcheckConverter={...spellcheckConverter,fromAttribute:value=>value===null?!1:spellcheckConverter.fromAttribute(value,Boolean)};class LyraCatalogPickerBase extends FormAssociated(CatalogPickerElement){static{this.styles=[LyraElement.styles,styles]}static{this.collectionSupport=collectionSupport}static{this.immutableEventDetails=Object.freeze(["lr-input","lr-change"])}get autocorrect(){return this.autocorrectValue}set autocorrect(next){this.autocorrectValue=!!next,this.requestUpdate()}normalizeValue(value){return normalizeSelectionValue(value)}renderAdornment(_row){return nothing}optionDisplay(row){return{label:row.label,sub:[row.code,row.symbol].filter(text=>!!text&&text!==row.label).join(" · ")}}renderStart(row){const content=this.renderAdornment(row);return content===nothing?nothing:html`<span slot="start">${content}</span>`}get value(){return super.value}set value(next){super.value=this.normalizeValue(next)}get defaultValue(){return super.defaultValue}set defaultValue(next){super.defaultValue=next===null?null:this.normalizeValue(next)}get input(){return this.searchable?this.combobox?.input??null:null}get inputLimitMessage(){return selectionCatalogTruncation(this.entries)?this.localize("catalogPickerInputLimit"):""}requestUpdate(...args){const name=args[0];name===void 0&&this.hasUpdated&&this.resolvedRows.delete(this.entries),(name===void 0||!["value","defaultValue","label","hint","errorText","placeholder","accessibleLabel","required","disabled","size","clearable","topLayer","name"].includes(String(name)))&&(this.rowPresentationEpoch=(this.rowPresentationEpoch??0)+1),super.requestUpdate(...args)}get control(){return this.renderRoot?.querySelector(`${tag("select")},${tag("combobox")}`)??void 0}get combobox(){return this.renderRoot?.querySelector(tag("combobox"))??void 0}get liveDisabled(){return this.effectiveDisabled||this.matches(":disabled")}get rows(){const entries=this.entries,locale=this.effectiveLocale;let byLocale=this.resolvedRows.get(entries);byLocale||this.resolvedRows.set(entries,byLocale=new Map);let rows=byLocale.get(locale);return rows||byLocale.set(locale,rows=this.resolveRows()),rows}constructor(){super(),this.label="",this.hint="",this.errorText="",this.accessibleLabel=null,this.size="m",this.clearable=!1,this.searchable=!1,this.topLayer=!1,this.autocomplete="off",this.inputMode="",this.enterKeyHint="",this.spellcheck=!1,this.autocapitalize="",this.autocorrectValue=!0,this.resolvedRows=new WeakMap,this.optionsMounted=!1,this.inputLimitAnnouncements=new AnnouncementSinkController(this),this.rowPresentationEpoch=0,this.mountOptions=()=>{this.optionsMounted||(this.optionsMounted=!0,this.requestUpdate("optionsMounted",!1))},this.onControlShow=event=>{event.target===this.control&&this.mountOptions()},this.slots=new SlotPresenceController(this),this.projectionToken=0,this.restoreFocus=!1,this.validationController={hostUpdated:()=>this.projectValidation()},this.onControlEvent=event=>{const child=this.control;if(!child||event.target!==child||(event.stopPropagation(),event.type!=="lr-change"))return;const raw=event.detail.value,next=raw===null?"":raw;if(this.liveDisabled||typeof next!="string"||next&&!this.entries.some(row=>row.code===next&&!row.disabled)){this.syncChildValue(child);return}if(next===this.value)return;const previousValue=this.value;this.value=next;const detail={value:this.value,previousValue};dispatchNativeEvent(this,"input"),this.emit("lr-input",detail),dispatchNativeEvent(this,"change"),this.emit("lr-change",detail)},this.onControlFocus=event=>{event.target===this.control&&(event.type==="focus"&&this.mountOptions(),event.stopPropagation(),this.replacingControl||relayNativeEvent(this,event))},this.onControlFocusOut=event=>{event.target===this.replacingControl&&event.stopPropagation()},this.onControlKeyDown=event=>{!this.liveDisabled&&this.searchable&&event.target===this.control&&event.composedPath()[0]===this.input&&submitOnEnter(this,event)},this.usingCombobox=!1,this.addEventListener("invalid",()=>this.projectValidation())}updateValidity(){this.internals&&(isBarredFromValidation(this,this.internals)?this[SET_ANCHORED_VALIDITY]({}):this.value&&!this.entries.some(row=>row.code===this.value&&!row.disabled)?this[SET_ANCHORED_VALIDITY]({customError:!0},this.localize("notInCatalog")):this.required&&!this.value?this[SET_ANCHORED_VALIDITY]({valueMissing:!0},this.localize("fieldRequired")):this[SET_ANCHORED_VALIDITY]({}))}[VALIDITY_ANCHOR](){return resolveValidityAnchor(this.control)??null}focus(options){this.liveDisabled||this.control?.focus(options)}blur(){this.control?.blur()}click(){this.liveDisabled||this.control?.click()}syncChildValue(child){child.value="inputValue"in child?this.value||null:this.value}clearTransientState(){const child=this.control;child&&(child.open=!1,child.formResetCallback(),this.syncChildValue(child))}projectValidation(){const child=this.validationChild;!child||!this.isConnected||child!==this.control||this.validationDocument!==this.ownerDocument||resolveValidityAnchor(child)?.setAttribute("aria-invalid",hasCustomState(this.internals,"user-invalid")?"true":"false")}syncRelationships(){const anchor=this[VALIDITY_ANCHOR]();this.descriptionLease?this.descriptionLease.update(anchor):this.descriptionLease=acquireResolvedAriaRelationship(this,anchor,"aria-describedby"),this.accessibleLabel!==null?(this.labelLease?.release(),this.labelLease=void 0):this.labelLease?this.labelLease.update(anchor):this.labelLease=acquireResolvedAriaRelationship(this,anchor,"aria-labelledby"),anchor&&this.projectedAnchor!==anchor&&(this.projectedAnchor=anchor,this.requestUpdate())}get comboboxDefined(){return globalThis.customElements?.get(tag("combobox"))!==void 0}async getUpdateComplete(){const done=await super.getUpdateComplete(),load=this.comboboxLoad;return load?(await load,this.getUpdateComplete()):done}willUpdate(changed){if(super.willUpdate(changed),this.searchable&&!this.comboboxDefined&&!this.comboboxLoad){const load=import("./combobox/combobox-catalog.js").then(()=>this.requestUpdate(),()=>{});this.comboboxLoad=load,load.then(()=>{this.comboboxLoad===load&&(this.comboboxLoad=void 0)})}const child=this.control,combobox=this.searchable&&this.comboboxDefined;combobox!==this.usingCombobox&&child&&(this.replacingControl=child,this.restoreFocus=shadowFocusTarget(this)===child||this.focusReplacement===child,this.focusReplacement=void 0,this.clearTransientState()),this.usingCombobox=combobox}updated(changed){super.updated(changed);const loss=selectionCatalogTruncation(this.entries);this.inputLimitAnnouncements.transition("input-limit",loss?`${loss.source}:${loss.retained}:${loss.omitted}`:"",this.inputLimitMessage,"polite");const child=this.control;this.restoreFocus&&(this.focusReplacement=child),this.restoreFocus=!1,this.replacingControl=void 0,(this.validationChild!==child||this.validationDocument!==this.ownerDocument)&&(this.validationChild?.removeController(this.validationController),this.validationChild=child,this.validationDocument=this.ownerDocument,child?.addController(this.validationController)),this.projectValidation();const token=++this.projectionToken,document=this.ownerDocument;child&&child.updateComplete.then(()=>{if(!(token!==this.projectionToken||!this.isConnected||this.ownerDocument!==document||child!==this.control)&&(this.syncRelationships(),this.focusReplacement===child)){this.focusReplacement=void 0;const active=deepActiveElementIn(document);!this.liveDisabled&&(!active||active===document.body||active===this||active===child)&&(child.focus({preventScroll:!0}),child.hide())}})}connectedCallback(){super.connectedCallback(),this.requestUpdate()}adoptedCallback(){super.adoptedCallback(),this.inputLimitAnnouncements.adopted(),this.requestUpdate()}formResetCallback(){super.formResetCallback(),this.clearTransientState(),this.projectValidation()}formStateRestoreCallback(state,reason){super.formStateRestoreCallback(state,reason),this.clearTransientState(),this.projectValidation()}disconnectedCallback(){++this.projectionToken,this.clearTransientState(),this.restoreFocus=!1,this.focusReplacement=void 0,this.replacingControl=void 0,this.validationChild?.removeController(this.validationController),this.validationChild=void 0,this.validationDocument=void 0,this.projectedAnchor=void 0,this.labelLease?.release(),this.labelLease=void 0,this.descriptionLease?.release(),this.descriptionLease=void 0,super.disconnectedCallback()}render(){const controlTag=unsafeStatic(tag(this.usingCombobox?"combobox":"select")),optionTag=unsafeStatic(tag("option")),hasLabel=!!this.label||this.slots.has("label"),current=this.rows.find(row=>row.code===this.value),optionRows=this.optionsMounted?this.rows:current?[current]:[],exportParts=["form-control,form-control-label",this.usingCombobox?"combobox:select-trigger,combobox-input:select-display-input":"trigger:select-trigger,display-input:select-display-input","listbox:select-listbox,option:select-option,option-overflow:select-option-overflow,option-sub:select-option-sub,group-label:select-group-label,clear-button:select-clear-button,flag,hint,error"].join(",");return html`<${controlTag}
|
|
1
|
+
import{__decorate}from"tslib";import{MAX_RENDERED_OPTION_ROWS}from"../../internal/option-selection.js";import{guard}from"lit/directives/guard.js";import{noChange,nothing}from"lit";import{html,unsafeStatic}from"lit/static-html.js";import{property}from"lit/decorators.js";import{LyraElement}from"../../internal/lyra-element.js";import{FormAssociated,isBarredFromValidation}from"../../internal/form-associated.js";import{resolveValidityAnchor,SET_ANCHORED_VALIDITY,VALIDITY_ANCHOR}from"../../internal/anchored-validity.js";import{acquireResolvedAriaRelationship}from"../../internal/aria-controls.js";import{AnnouncementSinkController}from"../../internal/announcer.js";import{collectionSupport}from"../../internal/collection-snapshot.js";import{autocorrectConverter,spellcheckConverter}from"../../internal/converters.js";import{dispatchNativeEvent,relayNativeEvent}from"../../internal/native-event-relay.js";import{deepActiveElementIn,shadowFocusTarget}from"../../internal/active-element.js";import{submitOnEnter}from"../../internal/submit-on-enter.js";import{SlotPresenceController}from"../../internal/slot-presence-controller.js";import{tag}from"../../internal/prefix.js";import{resolveEffectivePositioningStrategy}from"../../internal/positioning-strategy.js";import{hasCustomState}from"../../internal/custom-states.js";import{normalizeSelectionValue,selectionCatalogTruncation}from"../../internal/selection-catalog.js";import{styles}from"./catalog-picker-base.styles.js";class CatalogPickerElement extends LyraElement{}const pickerSpellcheckConverter={...spellcheckConverter,fromAttribute:value=>value===null?!1:spellcheckConverter.fromAttribute(value,Boolean)};class LyraCatalogPickerBase extends FormAssociated(CatalogPickerElement){static{this.styles=[LyraElement.styles,styles]}static{this.collectionSupport=collectionSupport}static{this.immutableEventDetails=Object.freeze(["lr-input","lr-change"])}get autocorrect(){return this.autocorrectValue}set autocorrect(next){this.autocorrectValue=!!next,this.requestUpdate()}normalizeValue(value){return normalizeSelectionValue(value)}renderAdornment(_row){return nothing}optionDisplay(row){return{label:row.label,sub:[row.code,row.symbol].filter(text=>!!text&&text!==row.label).join(" · ")}}renderStart(row){const content=this.renderAdornment(row);return content===nothing?nothing:html`<span slot="start">${content}</span>`}get value(){return super.value}set value(next){super.value=this.normalizeValue(next)}get defaultValue(){return super.defaultValue}set defaultValue(next){super.defaultValue=next===null?null:this.normalizeValue(next)}get input(){return this.searchable?this.combobox?.input??null:null}get inputLimitMessage(){return selectionCatalogTruncation(this.entries)?this.localize("catalogPickerInputLimit"):""}requestUpdate(...args){const name=args[0];name===void 0&&this.hasUpdated&&this.resolvedRows.delete(this.entries),(name===void 0||!["value","defaultValue","label","hint","errorText","placeholder","accessibleLabel","required","disabled","size","clearable","topLayer","name"].includes(String(name)))&&(this.rowPresentationEpoch=(this.rowPresentationEpoch??0)+1),super.requestUpdate(...args)}get control(){return this.renderRoot?.querySelector(`${tag("select")},${tag("combobox")}`)??void 0}get combobox(){return this.renderRoot?.querySelector(tag("combobox"))??void 0}get liveDisabled(){return this.effectiveDisabled||this.matches(":disabled")}get rows(){const entries=this.entries,locale=this.effectiveLocale;let byLocale=this.resolvedRows.get(entries);byLocale||this.resolvedRows.set(entries,byLocale=new Map);let rows=byLocale.get(locale);return rows||byLocale.set(locale,rows=this.resolveRows()),rows}constructor(){super(),this.label="",this.labelDisplay="visible",this.hint="",this.errorText="",this.accessibleLabel=null,this.size="m",this.clearable=!1,this.searchable=!1,this.topLayer=!1,this.autocomplete="off",this.inputMode="",this.enterKeyHint="",this.spellcheck=!1,this.autocapitalize="",this.autocorrectValue=!0,this.resolvedRows=new WeakMap,this.optionsMounted=!1,this.inputLimitAnnouncements=new AnnouncementSinkController(this),this.rowPresentationEpoch=0,this.mountOptions=()=>{this.optionsMounted||(this.optionsMounted=!0,this.requestUpdate("optionsMounted",!1))},this.onControlShow=event=>{event.target===this.control&&this.mountOptions()},this.slots=new SlotPresenceController(this),this.projectionToken=0,this.restoreFocus=!1,this.validationController={hostUpdated:()=>this.projectValidation()},this.onControlEvent=event=>{const child=this.control;if(!child||event.target!==child||(event.stopPropagation(),event.type!=="lr-change"))return;const raw=event.detail.value,next=raw===null?"":raw;if(this.liveDisabled||typeof next!="string"||next&&!this.entries.some(row=>row.code===next&&!row.disabled)){this.syncChildValue(child);return}if(next===this.value)return;const previousValue=this.value;this.value=next;const detail={value:this.value,previousValue};dispatchNativeEvent(this,"input"),this.emit("lr-input",detail),dispatchNativeEvent(this,"change"),this.emit("lr-change",detail)},this.onControlFocus=event=>{event.target===this.control&&(event.type==="focus"&&this.mountOptions(),event.stopPropagation(),this.replacingControl||relayNativeEvent(this,event))},this.onControlFocusOut=event=>{event.target===this.replacingControl&&event.stopPropagation()},this.onControlKeyDown=event=>{!this.liveDisabled&&this.searchable&&event.target===this.control&&event.composedPath()[0]===this.input&&submitOnEnter(this,event)},this.usingCombobox=!1,this.addEventListener("invalid",()=>this.projectValidation())}updateValidity(){this.internals&&(isBarredFromValidation(this,this.internals)?this[SET_ANCHORED_VALIDITY]({}):this.value&&!this.entries.some(row=>row.code===this.value&&!row.disabled)?this[SET_ANCHORED_VALIDITY]({customError:!0},this.localize("notInCatalog")):this.required&&!this.value?this[SET_ANCHORED_VALIDITY]({valueMissing:!0},this.localize("fieldRequired")):this[SET_ANCHORED_VALIDITY]({}))}[VALIDITY_ANCHOR](){return resolveValidityAnchor(this.control)??null}focus(options){this.liveDisabled||this.control?.focus(options)}blur(){this.control?.blur()}click(){this.liveDisabled||this.control?.click()}syncChildValue(child){child.value="inputValue"in child?this.value||null:this.value}clearTransientState(){const child=this.control;child&&(child.open=!1,child.formResetCallback(),this.syncChildValue(child))}projectValidation(){const child=this.validationChild;!child||!this.isConnected||child!==this.control||this.validationDocument!==this.ownerDocument||resolveValidityAnchor(child)?.setAttribute("aria-invalid",hasCustomState(this.internals,"user-invalid")?"true":"false")}syncRelationships(){const anchor=this[VALIDITY_ANCHOR]();this.descriptionLease?this.descriptionLease.update(anchor):this.descriptionLease=acquireResolvedAriaRelationship(this,anchor,"aria-describedby"),this.accessibleLabel!==null?(this.labelLease?.release(),this.labelLease=void 0):this.labelLease?this.labelLease.update(anchor):this.labelLease=acquireResolvedAriaRelationship(this,anchor,"aria-labelledby"),anchor&&this.projectedAnchor!==anchor&&(this.projectedAnchor=anchor,this.requestUpdate())}get comboboxDefined(){return globalThis.customElements?.get(tag("combobox"))!==void 0}async getUpdateComplete(){const done=await super.getUpdateComplete(),load=this.comboboxLoad;return load?(await load,this.getUpdateComplete()):done}willUpdate(changed){if(super.willUpdate(changed),this.searchable&&!this.comboboxDefined&&!this.comboboxLoad){const load=import("./combobox/combobox-catalog.js").then(()=>this.requestUpdate(),()=>{});this.comboboxLoad=load,load.then(()=>{this.comboboxLoad===load&&(this.comboboxLoad=void 0)})}const child=this.control,combobox=this.searchable&&this.comboboxDefined;combobox!==this.usingCombobox&&child&&(this.replacingControl=child,this.restoreFocus=shadowFocusTarget(this)===child||this.focusReplacement===child,this.focusReplacement=void 0,this.clearTransientState()),this.usingCombobox=combobox}updated(changed){super.updated(changed);const loss=selectionCatalogTruncation(this.entries);this.inputLimitAnnouncements.transition("input-limit",loss?`${loss.source}:${loss.retained}:${loss.omitted}`:"",this.inputLimitMessage,"polite");const child=this.control;this.restoreFocus&&(this.focusReplacement=child),this.restoreFocus=!1,this.replacingControl=void 0,(this.validationChild!==child||this.validationDocument!==this.ownerDocument)&&(this.validationChild?.removeController(this.validationController),this.validationChild=child,this.validationDocument=this.ownerDocument,child?.addController(this.validationController)),this.projectValidation();const token=++this.projectionToken,document=this.ownerDocument;child&&child.updateComplete.then(()=>{if(!(token!==this.projectionToken||!this.isConnected||this.ownerDocument!==document||child!==this.control)&&(this.syncRelationships(),this.focusReplacement===child)){this.focusReplacement=void 0;const active=deepActiveElementIn(document);!this.liveDisabled&&(!active||active===document.body||active===this||active===child)&&(child.focus({preventScroll:!0}),child.hide())}})}connectedCallback(){super.connectedCallback(),this.requestUpdate()}adoptedCallback(){super.adoptedCallback(),this.inputLimitAnnouncements.adopted(),this.requestUpdate()}formResetCallback(){super.formResetCallback(),this.clearTransientState(),this.projectValidation()}formStateRestoreCallback(state,reason){super.formStateRestoreCallback(state,reason),this.clearTransientState(),this.projectValidation()}disconnectedCallback(){++this.projectionToken,this.clearTransientState(),this.restoreFocus=!1,this.focusReplacement=void 0,this.replacingControl=void 0,this.validationChild?.removeController(this.validationController),this.validationChild=void 0,this.validationDocument=void 0,this.projectedAnchor=void 0,this.labelLease?.release(),this.labelLease=void 0,this.descriptionLease?.release(),this.descriptionLease=void 0,super.disconnectedCallback()}render(){const controlTag=unsafeStatic(tag(this.usingCombobox?"combobox":"select")),optionTag=unsafeStatic(tag("option")),hasLabel=!!this.label||this.slots.has("label"),current=this.rows.find(row=>row.code===this.value),optionRows=this.optionsMounted?this.rows:current?[current]:[],exportParts=["form-control,form-control-label",this.usingCombobox?"combobox:select-trigger,combobox-input:select-display-input":"trigger:select-trigger,display-input:select-display-input","listbox:select-listbox,option:select-option,option-overflow:select-option-overflow,option-sub:select-option-sub,group-label:select-group-label,clear-button:select-clear-button,flag,hint,error"].join(",");return html`<${controlTag}
|
|
2
2
|
exportparts=${exportParts}
|
|
3
3
|
.positioningStrategy=${this.ownerDocument?resolveEffectivePositioningStrategy(this,this.positioningStrategy,"absolute"):this.positioningStrategy}
|
|
4
4
|
.strings=${this.strings} .customError=${this.validity.valid?null:this.validationMessage}
|
|
5
5
|
.value=${this.usingCombobox?this.value||null:this.value}
|
|
6
|
-
.label=${this.label} .hint=${this.hint} .errorText=${this.errorText}
|
|
6
|
+
.label=${this.label} .labelDisplay=${this.labelDisplay} .hint=${this.hint} .errorText=${this.errorText}
|
|
7
7
|
.placeholder=${this.placeholder??this.localize("select")}
|
|
8
8
|
aria-label=${this.accessibleLabel??(hasLabel?nothing:this.pickerLabel)}
|
|
9
9
|
.required=${this.required} .disabled=${this.effectiveDisabled} .size=${this.size}
|
|
@@ -26,4 +26,4 @@ import{__decorate}from"tslib";import{MAX_RENDERED_OPTION_ROWS}from"../../interna
|
|
|
26
26
|
${this.slots.has("label")?html`<slot name="label" slot="label"></slot>`:nothing}
|
|
27
27
|
${this.slots.has("hint")?html`<slot name="hint" slot="hint"></slot>`:nothing}
|
|
28
28
|
${this.slots.has("error")?html`<slot name="error" slot="error"></slot>`:nothing}
|
|
29
|
-
</${controlTag}>${this.inputLimitMessage?html`<p part="limit">${this.inputLimitMessage}</p>`:nothing}`}}__decorate([property()],LyraCatalogPickerBase.prototype,"label",void 0),__decorate([property()],LyraCatalogPickerBase.prototype,"hint",void 0),__decorate([property({attribute:"error-text"})],LyraCatalogPickerBase.prototype,"errorText",void 0),__decorate([property()],LyraCatalogPickerBase.prototype,"placeholder",void 0),__decorate([property({attribute:"aria-label"})],LyraCatalogPickerBase.prototype,"accessibleLabel",void 0),__decorate([property({reflect:!0})],LyraCatalogPickerBase.prototype,"size",void 0),__decorate([property({type:Boolean})],LyraCatalogPickerBase.prototype,"clearable",void 0),__decorate([property({type:Boolean})],LyraCatalogPickerBase.prototype,"searchable",void 0),__decorate([property({type:Boolean,attribute:"top-layer"})],LyraCatalogPickerBase.prototype,"topLayer",void 0),__decorate([property({attribute:"positioning-strategy"})],LyraCatalogPickerBase.prototype,"positioningStrategy",void 0),__decorate([property()],LyraCatalogPickerBase.prototype,"autocomplete",void 0),__decorate([property({attribute:"inputmode"})],LyraCatalogPickerBase.prototype,"inputMode",void 0),__decorate([property({attribute:"enterkeyhint"})],LyraCatalogPickerBase.prototype,"enterKeyHint",void 0),__decorate([property({converter:pickerSpellcheckConverter,useDefault:!0})],LyraCatalogPickerBase.prototype,"spellcheck",void 0),__decorate([property()],LyraCatalogPickerBase.prototype,"autocapitalize",void 0),__decorate([property({converter:autocorrectConverter})],LyraCatalogPickerBase.prototype,"autocorrect",null);export{LyraCatalogPickerBase};
|
|
29
|
+
</${controlTag}>${this.inputLimitMessage?html`<p part="limit">${this.inputLimitMessage}</p>`:nothing}`}}__decorate([property()],LyraCatalogPickerBase.prototype,"label",void 0),__decorate([property({attribute:"label-display",reflect:!0})],LyraCatalogPickerBase.prototype,"labelDisplay",void 0),__decorate([property()],LyraCatalogPickerBase.prototype,"hint",void 0),__decorate([property({attribute:"error-text"})],LyraCatalogPickerBase.prototype,"errorText",void 0),__decorate([property()],LyraCatalogPickerBase.prototype,"placeholder",void 0),__decorate([property({attribute:"aria-label"})],LyraCatalogPickerBase.prototype,"accessibleLabel",void 0),__decorate([property({reflect:!0})],LyraCatalogPickerBase.prototype,"size",void 0),__decorate([property({type:Boolean})],LyraCatalogPickerBase.prototype,"clearable",void 0),__decorate([property({type:Boolean})],LyraCatalogPickerBase.prototype,"searchable",void 0),__decorate([property({type:Boolean,attribute:"top-layer"})],LyraCatalogPickerBase.prototype,"topLayer",void 0),__decorate([property({attribute:"positioning-strategy"})],LyraCatalogPickerBase.prototype,"positioningStrategy",void 0),__decorate([property()],LyraCatalogPickerBase.prototype,"autocomplete",void 0),__decorate([property({attribute:"inputmode"})],LyraCatalogPickerBase.prototype,"inputMode",void 0),__decorate([property({attribute:"enterkeyhint"})],LyraCatalogPickerBase.prototype,"enterKeyHint",void 0),__decorate([property({converter:pickerSpellcheckConverter,useDefault:!0})],LyraCatalogPickerBase.prototype,"spellcheck",void 0),__decorate([property()],LyraCatalogPickerBase.prototype,"autocapitalize",void 0),__decorate([property({converter:autocorrectConverter})],LyraCatalogPickerBase.prototype,"autocorrect",null);export{LyraCatalogPickerBase};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{type TemplateResult,type PropertyValues}from'lit';import{LyraElement,type LyraEventDetailSnapshot}from'../../../internal/lyra-element.js';import{LyraFormControlElement}from'../../../internal/form-control-element.js';import type{LyraAppearance,LyraSize}from'../../../internal/variants.js';import type{LyraSelectionDirection}from'../../../internal/shared-unions.js';import type{LyraOption}from'./option.class.js';import type{PlaceStrategy,PlaceSync}from'../../../internal/positioner.js';import{type FormOwnerValue}from'../../../internal/form-associated.js';import type{LyraPickerDetailValue,LyraPickerValue}from'../../../internal/picker-value.js';export type OptionFilter=(option:LyraOption,query:string)=>boolean;export type LyraComboboxPlacement='top'|'bottom';export type LyraComboboxTagRenderer=(option:LyraOption,index:number)=>unknown;
|
|
1
|
+
import{type TemplateResult,type PropertyValues}from'lit';import{LyraElement,type LyraEventDetailSnapshot}from'../../../internal/lyra-element.js';import{LyraFormControlElement}from'../../../internal/form-control-element.js';import type{LyraAppearance,LyraSize,LyraLabelDisplay}from'../../../internal/variants.js';import type{LyraSelectionDirection}from'../../../internal/shared-unions.js';import type{LyraOption}from'./option.class.js';import type{PlaceStrategy,PlaceSync}from'../../../internal/positioner.js';import{type FormOwnerValue}from'../../../internal/form-associated.js';import type{LyraPickerDetailValue,LyraPickerValue}from'../../../internal/picker-value.js';export type OptionFilter=(option:LyraOption,query:string)=>boolean;export type LyraComboboxPlacement='top'|'bottom';export type LyraComboboxTagRenderer=(option:LyraOption,index:number)=>unknown;
|
|
2
2
|
/** What a `validators` entry may return: nothing/`true` passes, a string is the message, `false` is
|
|
3
3
|
* a generic failure, and an object of {@linkcode ValidityStateFlags} names the flags to raise. */
|
|
4
4
|
export type LyraComboboxValidatorResult=void|boolean|string|ValidityStateFlags;
|
|
@@ -328,7 +328,14 @@ export declare class LyraCombobox<Multiple extends boolean=boolean>extends LyraF
|
|
|
328
328
|
/** `data` carries opaque per-row caller payload -- preserve each item's identity through the
|
|
329
329
|
* frozen event envelope instead of recursively cloning unknown data, the same policy
|
|
330
330
|
* `<lr-prompt-queue>`'s `lr-queue-change` detail uses for its own `items`. */
|
|
331
|
-
protected static readonly identityEventDetailCollectionItems:Readonly<{'lr-input':readonly string[];'lr-change':readonly string[];}>;static formAssociated:boolean;static styles:import("lit").CSSResultGroup[];static properties:{customError:{attribute:string;reflect:boolean;noAccessor:boolean;};multiple:{type:BooleanConstructor;reflect:boolean;noAccessor:boolean;};disabled:{type:BooleanConstructor;reflect:boolean;noAccessor:boolean;};required:{type:BooleanConstructor;reflect:boolean;noAccessor:boolean;};readonly:{type:BooleanConstructor;reflect:boolean;noAccessor:boolean;};value:{noAccessor:boolean;};name:{reflect:boolean;noAccessor:boolean;converter:import("lit").ComplexAttributeConverter<string,unknown>;};maxOptionsVisible:{type:NumberConstructor;attribute:string;noAccessor:boolean;};maxRender:{type:NumberConstructor;attribute:string;noAccessor:boolean;};sourceDelay:{type:NumberConstructor;attribute:string;noAccessor:boolean;};};placeholder:string;label:string;
|
|
331
|
+
protected static readonly identityEventDetailCollectionItems:Readonly<{'lr-input':readonly string[];'lr-change':readonly string[];}>;static formAssociated:boolean;static styles:import("lit").CSSResultGroup[];static properties:{customError:{attribute:string;reflect:boolean;noAccessor:boolean;};multiple:{type:BooleanConstructor;reflect:boolean;noAccessor:boolean;};disabled:{type:BooleanConstructor;reflect:boolean;noAccessor:boolean;};required:{type:BooleanConstructor;reflect:boolean;noAccessor:boolean;};readonly:{type:BooleanConstructor;reflect:boolean;noAccessor:boolean;};value:{noAccessor:boolean;};name:{reflect:boolean;noAccessor:boolean;converter:import("lit").ComplexAttributeConverter<string,unknown>;};maxOptionsVisible:{type:NumberConstructor;attribute:string;noAccessor:boolean;};maxRender:{type:NumberConstructor;attribute:string;noAccessor:boolean;};sourceDelay:{type:NumberConstructor;attribute:string;noAccessor:boolean;};};placeholder:string;label:string;
|
|
332
|
+
/**
|
|
333
|
+
* Whether the `label` renders on screen. `hidden` keeps the label as the accessible name but
|
|
334
|
+
* removes it visually (compact toolbars, table cells); hint, error and required semantics are
|
|
335
|
+
* unaffected. Reflected so styles and `[label-display]` selectors match.
|
|
336
|
+
* @attr label-display
|
|
337
|
+
*/
|
|
338
|
+
labelDisplay:LyraLabelDisplay;hint:string;errorText:string;
|
|
332
339
|
/** Whether the listbox is open. Disabled or readonly controls reject direct reopen attempts,
|
|
333
340
|
* including a synchronous fieldset cascade. */
|
|
334
341
|
get open():boolean;set open(next:boolean);
|