@sectile/core 0.14.8 → 0.16.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.
Files changed (74) hide show
  1. package/README.md +9 -15
  2. package/dist/adapter-runtime.d.ts +8 -4
  3. package/dist/adapter-runtime.js +1 -1
  4. package/dist/adapter-runtime.js.map +1 -1
  5. package/dist/color-picker.d.ts +8 -2
  6. package/dist/color-picker.js +1 -1
  7. package/dist/color-picker.js.map +1 -1
  8. package/dist/error-code.d.ts +1 -1
  9. package/dist/interaction.d.ts +1 -1
  10. package/dist/interaction.js +1 -1
  11. package/dist/interaction.js.map +1 -1
  12. package/dist/internal/composites/combobox.d.ts +2 -0
  13. package/dist/internal/composites/combobox.js +1 -1
  14. package/dist/internal/composites/combobox.js.map +1 -1
  15. package/dist/internal/composites/listbox.d.ts +2 -0
  16. package/dist/internal/composites/listbox.js +1 -1
  17. package/dist/internal/composites/listbox.js.map +1 -1
  18. package/dist/internal/composites/menu.d.ts +1 -1
  19. package/dist/internal/composites/menu.js +1 -1
  20. package/dist/internal/composites/menu.js.map +1 -1
  21. package/dist/internal/composites/tree-select.d.ts +104 -0
  22. package/dist/internal/composites/tree-select.js +2 -0
  23. package/dist/internal/composites/tree-select.js.map +1 -0
  24. package/dist/internal/composites/tree-selection.d.ts +40 -0
  25. package/dist/internal/composites/tree-selection.js +2 -0
  26. package/dist/internal/composites/tree-selection.js.map +1 -0
  27. package/dist/internal/composites/tree-view.d.ts +22 -1
  28. package/dist/internal/composites/tree-view.js +1 -1
  29. package/dist/internal/composites/tree-view.js.map +1 -1
  30. package/dist/internal/editing/text.d.ts +16 -0
  31. package/dist/internal/editing/text.js +1 -1
  32. package/dist/internal/editing/text.js.map +1 -1
  33. package/dist/internal/state/selection.d.ts +2 -0
  34. package/dist/internal/state/selection.js +1 -1
  35. package/dist/internal/state/selection.js.map +1 -1
  36. package/dist/layer-stack.d.ts +50 -0
  37. package/dist/layer-stack.js +1 -1
  38. package/dist/layer-stack.js.map +1 -1
  39. package/dist/multi-thumb-slider.d.ts +8 -0
  40. package/dist/multi-thumb-slider.js +1 -1
  41. package/dist/multi-thumb-slider.js.map +1 -1
  42. package/dist/number-field.d.ts +6 -0
  43. package/dist/number-field.js +1 -1
  44. package/dist/number-field.js.map +1 -1
  45. package/dist/quantity-field.d.ts +2 -0
  46. package/dist/quantity-field.js +1 -1
  47. package/dist/quantity-field.js.map +1 -1
  48. package/dist/reorder.d.ts +37 -6
  49. package/dist/reorder.js +1 -1
  50. package/dist/reorder.js.map +1 -1
  51. package/dist/structures/geometry.d.ts +3 -1
  52. package/dist/structures/geometry.js +1 -1
  53. package/dist/structures/geometry.js.map +1 -1
  54. package/dist/structures/json.d.ts +71 -0
  55. package/dist/structures/json.js +2 -0
  56. package/dist/structures/json.js.map +1 -0
  57. package/dist/structures/metric-index.js +1 -1
  58. package/dist/structures/metric-index.js.map +1 -1
  59. package/dist/text.d.ts +1 -1
  60. package/dist/text.js +1 -1
  61. package/dist/text.js.map +1 -1
  62. package/dist/toast.d.ts +8 -0
  63. package/dist/toast.js +1 -1
  64. package/dist/toast.js.map +1 -1
  65. package/dist/transfer.d.ts +74 -0
  66. package/dist/transfer.js +2 -0
  67. package/dist/transfer.js.map +1 -0
  68. package/dist/tree-select.d.ts +3 -0
  69. package/dist/tree-select.js +2 -0
  70. package/dist/tree-select.js.map +1 -0
  71. package/dist/tree-view.d.ts +2 -1
  72. package/dist/tree-view.js +1 -1
  73. package/dist/tree-view.js.map +1 -1
  74. package/package.json +18 -2
package/README.md CHANGED
@@ -1,20 +1,14 @@
1
1
  # @sectile/core
2
2
 
3
- Pure, renderer-neutral interaction semantics with explicit laws, failures, and resource bounds.
3
+ Renderer-neutral structures and deterministic interaction state transitions.
4
4
 
5
- ## Scope
5
+ ```sh
6
+ pnpm add @sectile/core
7
+ ```
6
8
 
7
- - Ordered structures: sequence, range, grid, and tree
8
- - Reusable state: cursor, selection, expansion, revision, interaction gates, and finite collection windows
9
- - Coordination primitives for generation-bound async work, nested layer stacks, and identity-based reordering
10
- - Bounded geometry algebra, anchored placement calculations, and a generic metric index
11
- - Composite behavior for selection, navigation, disclosure, editing, forms, and overlays
12
- - UTF-16-safe text editing, exact decimal expressions, and dimension-checked units
9
+ Import runtime operations from focused entries such as `@sectile/core/sequence`
10
+ and `@sectile/core/checkbox`. Core owns no rendering or host resources.
13
11
 
14
- ## Contract
15
-
16
- Core modules contain no DOM, terminal, rendering, or styling behavior. Constructors validate their inputs and return typed `Result` values. Accepted transitions are deterministic and failure-atomic; policies make eligibility, boundaries, and ownership explicit.
17
-
18
- Runtime APIs are exposed through focused package subpaths. The package root contains shared types and has no interaction authority.
19
-
20
- Core geometry is value-level infrastructure. `@sectile/virtual` owns collection extents, viewport queries, dynamic measurement state, layout strategies, and virtual repair. DOM and other host adapters obtain actual platform measurements and pass that evidence across the boundary; Core never reads host elements.
12
+ `@sectile/core/json` snapshots plain JSON data under explicit byte, value, depth
13
+ and string limits. `tryMeasureJSON` performs the same validation and accounting
14
+ without copying a data tree.
@@ -1,6 +1,6 @@
1
1
  import type { Result, SectileError, StableID } from './shared.js';
2
2
  import type { CoreErrorCode } from './error-code.js';
3
- import { type InteractionStateInput } from './interaction.js';
3
+ import { type InteractionStateInput, type InteractionState, type InteractionIntent } from './interaction.js';
4
4
  import { type EventReducer, type RevisionResult, type RevisionSnapshot } from './revision.js';
5
5
  export declare function synchronizeControllerState<State, Code extends string>(current: RevisionSnapshot<State>, state: Result<State, Code>): Result<RevisionSnapshot<State>, CoreErrorCode | Code>;
6
6
  export type ControlledFieldCodeName = 'edit-mode' | 'expanded-value' | 'expanded-values' | 'highlighted-value' | 'input-state' | 'open' | 'value';
@@ -8,6 +8,7 @@ type ControlledFieldErrorCode = `controlled-${ControlledFieldCodeName}-required`
8
8
  export declare function controlledFieldError(controlled: boolean, provided: boolean, codeName: ControlledFieldCodeName, label: string): SectileError<ControlledFieldErrorCode> | null;
9
9
  export interface SemanticController<State, Event, Effect, Code extends string = CoreErrorCode> {
10
10
  getSnapshot(): RevisionSnapshot<State>;
11
+ syncInteraction(input: InteractionStateInput): Result<InteractionState>;
11
12
  replace(state: Result<State, Code>): Result<RevisionSnapshot<State>, CoreErrorCode | Code>;
12
13
  handle(event: Event, expectedRevision?: number): RevisionResult<State, Effect, CoreErrorCode | Code>;
13
14
  reject<Code extends string>(code: Code, message: string, details?: Readonly<Record<string, unknown>>): RevisionResult<State, Effect, Code>;
@@ -23,12 +24,13 @@ export interface SemanticControllerOptions<State, Event, Command, Effect, Code e
23
24
  readonly complete?: SemanticControllerCompletion<State, Effect>;
24
25
  readonly toEffect: (command: Command) => Effect;
25
26
  readonly interaction?: InteractionStateInput | undefined;
26
- readonly interactionIntent?: (event: Event) => 'navigate' | 'mutate';
27
+ readonly interactionIntent?: (event: Event) => InteractionIntent;
27
28
  }
28
29
  export type HostInputDecoder<HostInput, Event> = (input: HostInput) => Event | null;
29
30
  export type HostEffectProjector<Command, HostEffect> = (command: Command) => HostEffect;
30
31
  export interface HostAdapter<State, HostInput, HostEffect, Code extends string = CoreErrorCode> {
31
32
  getSnapshot(): RevisionSnapshot<State>;
33
+ syncInteraction(input: InteractionStateInput): Result<InteractionState>;
32
34
  replace(state: Result<State, Code>): Result<RevisionSnapshot<State>, CoreErrorCode | Code>;
33
35
  handleInput(input: HostInput, expectedRevision?: number): RevisionResult<State, HostEffect, CoreErrorCode | Code> | null;
34
36
  reject<Code extends string>(code: Code, message: string, details?: Readonly<Record<string, unknown>>): RevisionResult<State, HostEffect, Code>;
@@ -41,6 +43,7 @@ export declare function createSemanticController<State, Event, Command, Effect,
41
43
  export declare function createHostAdapter<State, HostInput, Event, Command, HostEffect, Code extends string = CoreErrorCode>(options: HostAdapterOptions<State, HostInput, Event, Command, HostEffect, Code>): Result<HostAdapter<State, HostInput, HostEffect, Code>, CoreErrorCode | Code>;
42
44
  export interface ControlledComponentController<State, Event, Command, Value, Code extends string = CoreErrorCode> {
43
45
  getSnapshot(): RevisionSnapshot<State>;
46
+ syncInteraction(input: InteractionStateInput): Result<InteractionState>;
44
47
  syncControlledValue(value: Value): Result<RevisionSnapshot<State>, CoreErrorCode | Code>;
45
48
  handle(event: Event, expectedRevision?: number): RevisionResult<State, Command, CoreErrorCode | Code>;
46
49
  }
@@ -54,12 +57,13 @@ export interface ControlledComponentControllerOptions<State, Event, Command, Val
54
57
  readonly publishEffect?: (command: Command) => void;
55
58
  readonly onChange?: (value: Value, previous: Value) => void;
56
59
  readonly interaction?: InteractionStateInput;
57
- readonly interactionIntent?: (event: Event) => 'navigate' | 'mutate';
60
+ readonly interactionIntent?: (event: Event) => InteractionIntent;
58
61
  }
59
62
  export declare function createControlledComponentController<State, Event, Command extends object, Value, Code extends string = CoreErrorCode>(options: ControlledComponentControllerOptions<State, Event, Command, Value, Code>): Result<ControlledComponentController<State, Event, Command, Value, Code>, CoreErrorCode | Code>;
60
63
  export interface CollectionComponentController<Domain, State, Event, Command, Code extends string = CoreErrorCode> {
61
64
  getDomain(): Domain;
62
65
  getSnapshot(): RevisionSnapshot<State>;
66
+ syncInteraction(input: InteractionStateInput): Result<InteractionState>;
63
67
  replaceDomain(domain: Domain): Result<RevisionSnapshot<State>, CoreErrorCode | Code>;
64
68
  replaceState(state: Result<State, Code>): Result<RevisionSnapshot<State>, CoreErrorCode | Code>;
65
69
  handle(event: Event, expectedRevision?: number): RevisionResult<State, Command, CoreErrorCode | Code>;
@@ -75,7 +79,7 @@ export interface CollectionComponentControllerOptions<Domain, State, Event, Comm
75
79
  readonly replaceDomain: (domain: Domain, previous: State) => Result<State, Code>;
76
80
  readonly notify?: (previous: State, proposed: State) => void;
77
81
  readonly interaction?: InteractionStateInput;
78
- readonly interactionIntent?: (event: Event) => 'navigate' | 'mutate';
82
+ readonly interactionIntent?: (event: Event) => InteractionIntent;
79
83
  }
80
84
  export declare function createCollectionComponentController<Domain, State, Event, Command extends object, Code extends string = CoreErrorCode>(options: CollectionComponentControllerOptions<Domain, State, Event, Command, Code>): Result<CollectionComponentController<Domain, State, Event, Command, Code>, CoreErrorCode | Code>;
81
85
  export interface IdentityDomain<ID extends StableID> {
@@ -1,2 +1,2 @@
1
- import{sameStableIDOrder,tryNormalizeStableIDs}from"./identity.js";import{tryCreateSequence}from"./structures/sequence.js";import{tryCreateInteractionState,requireInteraction}from"./interaction.js";import{applyRevisionedEvent,tryCreateRevisionSnapshot,mapRevisionCommands,rejectRevisionInput}from"./revision.js";function prepareControllerEvent(current,expectedRevision,event,reducer,reconcile,toEffect){const semantic=applyRevisionedEvent(current,expectedRevision,event,reducer);if(!semantic.ok)return{result:semantic,proposed:current.state};const committed=reconcile(current.state,semantic.snapshot.state);if(!committed.ok){return{result:rejectRevisionInput(current,committed.error),proposed:semantic.snapshot.state}}const snapshot=Object.freeze({revision:semantic.snapshot.revision,state:committed.value});return{result:mapRevisionCommands(Object.freeze({ok:true,snapshot,commands:semantic.commands}),toEffect),proposed:semantic.snapshot.state}}function synchronizeControllerState(current,state){if(!state.ok)return state;if(current.revision===Number.MAX_SAFE_INTEGER){return{ok:false,error:{class:"resource-rejection",code:"revision-ceiling-reached",message:"Controller revision cannot advance beyond the safe-integer ceiling.",details:{revision:current.revision}}}}return tryCreateRevisionSnapshot(state.value,current.revision+1)}function controlledFieldError(controlled,provided,codeName,label){if(controlled===provided)return null;const code=controlled?`controlled-${codeName}-required`:`uncontrolled-${codeName}-update`;return{class:"construction",code,message:controlled?`Controlled ${label} sync requires its external value.`:`Uncontrolled ${label} cannot be synchronized externally.`}}function createSemanticController(options){if(!options.initial.ok)return options.initial;const interaction=tryCreateInteractionState(options.interaction);if(!interaction.ok)return interaction;const snapshot=tryCreateRevisionSnapshot(options.initial.value);if(!snapshot.ok)return snapshot;const notifiers=options.notify===void 0?Object.freeze([]):typeof options.notify==="function"?Object.freeze([options.notify]):Object.freeze([...options.notify]);let current=snapshot.value;return{ok:true,value:Object.freeze({getSnapshot:()=>current,replace:state=>{const next=synchronizeControllerState(current,state);if(next.ok)current=next.value;return next},handle:(event,expectedRevision=current.revision)=>{const permitted=requireInteraction(interaction.value,options.interactionIntent?.(event)??"mutate");if(!permitted.ok)return rejectRevisionInput(current,permitted.error);const previous=current;const prepared=prepareControllerEvent(current,expectedRevision,event,options.reducer,options.reconcile??((_previous,proposed)=>({ok:true,value:proposed})),options.toEffect);if(!prepared.result.ok)return prepared.result;current=prepared.result.snapshot;publishControllerUpdate(prepared.result.commands,options.publishEffect,notifiers,options.complete,previous.state,prepared.proposed);return prepared.result},reject:(code,message,details)=>rejectRevisionInput(current,{class:"transition-rejection",code,message,...details===void 0?{}:{details}})})}}function createHostAdapter(options){const controller=createSemanticController({initial:options.initial,reducer:options.reducer,toEffect:options.project,...options.reconcile===void 0?{}:{reconcile:options.reconcile},...options.publishEffect===void 0?{}:{publishEffect:options.publishEffect},...options.notify===void 0?{}:{notify:options.notify},...options.complete===void 0?{}:{complete:options.complete},...options.interaction===void 0?{}:{interaction:options.interaction},...options.interactionIntent===void 0?{}:{interactionIntent:options.interactionIntent}});if(!controller.ok)return controller;return{ok:true,value:Object.freeze({getSnapshot:()=>controller.value.getSnapshot(),replace:state=>controller.value.replace(state),handleInput:(input,expectedRevision)=>{const event=options.decode(input);if(event===null)return null;return controller.value.handle(event,expectedRevision)},reject:(code,message,details)=>controller.value.reject(code,message,details)})}}function createControlledComponentController(options){const runtime=createSemanticController({initial:options.initial,reducer:options.reducer,reconcile:(previous,proposed)=>options.create(options.controlled?options.read(previous):options.read(proposed),proposed),notify:(previous,proposed)=>{const before=options.read(previous);const after=options.read(proposed);if(!Object.is(before,after))options.onChange?.(after,before)},toEffect:command=>command,...options.publishEffect===void 0?{}:{publishEffect:options.publishEffect},...options.interaction===void 0?{}:{interaction:options.interaction},...options.interactionIntent===void 0?{}:{interactionIntent:options.interactionIntent}});if(!runtime.ok)return runtime;const getSnapshot=()=>runtime.value.getSnapshot();const syncControlledValue=value=>{if(!options.controlled){return{ok:false,error:{class:"construction",code:"uncontrolled-controller-sync",message:"An uncontrolled component cannot be synchronized externally."}}}return runtime.value.replace(options.create(value,getSnapshot().state))};return{ok:true,value:Object.freeze({getSnapshot,syncControlledValue,handle:(event,expectedRevision)=>runtime.value.handle(event,expectedRevision)})}}function createCollectionComponentController(options){let domain=options.domain;const runtime=createSemanticController({initial:options.initial(domain),reducer:(state,event)=>options.reducer(domain,state,event),reconcile:(previous,proposed)=>options.reconcile(domain,previous,proposed),toEffect:command=>command,...options.notify===void 0?{}:{notify:options.notify},...options.interaction===void 0?{}:{interaction:options.interaction},...options.interactionIntent===void 0?{}:{interactionIntent:options.interactionIntent}});if(!runtime.ok)return runtime;const replaceDomain=nextDomain=>{if(Object.is(domain,nextDomain))return{ok:true,value:runtime.value.getSnapshot()};const previous=runtime.value.getSnapshot().state;const next=options.replaceDomain(nextDomain,previous);if(!next.ok)return next;const replaced=runtime.value.replace(next);if(replaced.ok){domain=nextDomain;options.notify?.(previous,replaced.value.state)}return replaced};return{ok:true,value:Object.freeze({getDomain:()=>domain,getSnapshot:()=>runtime.value.getSnapshot(),replaceDomain,replaceState:state=>runtime.value.replace(state),handle:(event,expectedRevision)=>runtime.value.handle(event,expectedRevision)})}}function tryReconcileCollectionIdentities(items,selected,current,disabledItems,mode,options={}){if(mode!=="single"&&mode!=="multiple"){return{ok:false,error:{class:"construction",code:"invalid-selection-mode",message:"Collection selection mode must be single or multiple."}}}const domain=tryCreateSequence(items);if(!domain.ok)return domain;const normalizedSelection=tryNormalizeStableIDs(selected);if(!normalizedSelection.ok)return normalizedSelection;const disabled=tryCreateDisabledIdentitySet(domain.value,disabledItems);if(!disabled.ok)return disabled;const requested=new Set(normalizedSelection.value);const selectedInDomain=domain.value.ids.filter(id=>requested.has(id));const nextSelected=Object.freeze(mode==="single"?selectedInDomain.slice(0,1):selectedInDomain);const nextCurrent=current===null&&options.preserveNullCurrent===true?null:current!==null&&domain.value.contains(current)&&!disabled.value.has(current)?current:nextSelected.find(id=>!disabled.value.has(id))??domain.value.ids.find(id=>!disabled.value.has(id))??null;return{ok:true,value:Object.freeze({selected:nextSelected,current:nextCurrent,selectionChanged:!sameStableIDOrder(selected,nextSelected),currentChanged:current!==nextCurrent})}}function tryCreateDisabledIdentitySet(domain,ids=[]){const disabled=new Set(ids);for(const id of disabled){if(!domain.contains(id)){return{ok:false,error:{class:"construction",code:"disabled-item-outside-domain",message:"Every disabled item must exist in the component domain.",details:{id}}}}}return{ok:true,value:disabled}}function createFacadeConnection(options,construct){const subscribers=new Set;let connection;let active=true;let activePublication;const onUpdate=()=>{if(!active)return;const publication={};activePublication=publication;let firstError;let hasError=false;if(connection!==void 0){let snapshot;try{snapshot=connection.getSnapshot()}catch(error){hasError=true;firstError=error}if(snapshot!==void 0&&activePublication===publication){for(const subscriber of[...subscribers]){try{subscriber(snapshot)}catch(error){if(!hasError){hasError=true;firstError=error}}if(activePublication!==publication)break}}}if(activePublication===publication){try{options.onUpdate?.()}catch(error){if(!hasError){hasError=true;firstError=error}}if(activePublication===publication)activePublication=void 0}if(hasError)throw firstError};const constructed=construct({...options,onUpdate});if(!constructed.ok)return constructed;connection=constructed.value;const target=connection;const forwardedMethods=new Map;const inactiveUnsubscribe=()=>void 0;const send=input=>active&&Boolean(callFirst(target,["handleEvent","handleKeyboardInput","handleKeyboardEvent","handleBeforeInput"],input));const update=input=>active?callFirst(target,["syncControlledValues","syncControlledValue","syncWindow"],input):destroyedConnectionResult();const subscribe=listener=>{if(!active)return inactiveUnsubscribe;subscribers.add(listener);return()=>{subscribers.delete(listener)}};const destroy=()=>{if(!active)return;active=false;try{const disconnect=target["disconnect"];if(typeof disconnect==="function")Reflect.apply(disconnect,target,[])}finally{subscribers.clear()}};const facade=new Proxy(target,{get:(_target,property)=>{if(property==="state")return connection?.getSnapshot().state;if(property==="send")return send;if(property==="update")return update;if(property==="subscribe")return subscribe;if(property==="destroy")return destroy;const value=Reflect.get(target,property,target);const ownDescriptor=Reflect.getOwnPropertyDescriptor(target,property);if(ownDescriptor!==void 0&&ownDescriptor.configurable===false)return value;if(typeof value!=="function")return value;const existing=forwardedMethods.get(property);if(existing!==void 0)return existing;const forwarded=(...args)=>{if(active||isPostDestroyRead(property))return Reflect.apply(value,target,args);if(typeof property==="string"&&property.startsWith("handle"))return false;if(typeof property==="string"&&property.startsWith("sync")){return destroyedConnectionResult()}return void 0};forwardedMethods.set(property,forwarded);return forwarded}});return{ok:true,value:facade}}function publishControllerUpdate(effects,publishEffect,notifiers,complete,previous,proposed){let firstError;let hasError=false;if(publishEffect!==void 0){for(const effect of effects){try{publishEffect(effect)}catch(error){if(!hasError){hasError=true;firstError=error}}}}for(const notify of notifiers){try{notify(previous,proposed)}catch(error){if(!hasError){hasError=true;firstError=error}}}try{complete?.(effects,previous,proposed)}catch(error){if(!hasError){hasError=true;firstError=error}}if(hasError)throw firstError}function destroyedConnectionResult(){return{ok:false,error:{class:"resource-rejection",code:"connection-destroyed",message:"A destroyed facade connection cannot be updated."}}}function isPostDestroyRead(property){return property==="getSnapshot"||typeof property==="string"&&property.startsWith("get")}function callFirst(target,names,input){for(const name of names){const method=target[name];if(typeof method==="function")return Reflect.apply(method,target,[input])}throw new TypeError(`The connection does not implement ${names.join(" or ")}.`)}export{controlledFieldError,createCollectionComponentController,createControlledComponentController,createFacadeConnection,createHostAdapter,createSemanticController,synchronizeControllerState,tryCreateDisabledIdentitySet,tryReconcileCollectionIdentities};
1
+ import{sameStableIDOrder,tryNormalizeStableIDs}from"./identity.js";import{tryCreateSequence}from"./structures/sequence.js";import{tryCreateInteractionState,requireInteraction}from"./interaction.js";import{applyRevisionedEvent,tryCreateRevisionSnapshot,mapRevisionCommands,rejectRevisionInput}from"./revision.js";function prepareControllerEvent(current,expectedRevision,event,reducer,reconcile,toEffect){const semantic=applyRevisionedEvent(current,expectedRevision,event,reducer);if(!semantic.ok)return{result:semantic,proposed:current.state};const committed=reconcile(current.state,semantic.snapshot.state);if(!committed.ok){return{result:rejectRevisionInput(current,committed.error),proposed:semantic.snapshot.state}}const snapshot=Object.freeze({revision:semantic.snapshot.revision,state:committed.value});return{result:mapRevisionCommands(Object.freeze({ok:true,snapshot,commands:semantic.commands}),toEffect),proposed:semantic.snapshot.state}}function synchronizeControllerState(current,state){if(!state.ok)return state;if(current.revision===Number.MAX_SAFE_INTEGER){return{ok:false,error:{class:"resource-rejection",code:"revision-ceiling-reached",message:"Controller revision cannot advance beyond the safe-integer ceiling.",details:{revision:current.revision}}}}return tryCreateRevisionSnapshot(state.value,current.revision+1)}function controlledFieldError(controlled,provided,codeName,label){if(controlled===provided)return null;const code=controlled?`controlled-${codeName}-required`:`uncontrolled-${codeName}-update`;return{class:"construction",code,message:controlled?`Controlled ${label} sync requires its external value.`:`Uncontrolled ${label} cannot be synchronized externally.`}}function createSemanticController(options){if(!options.initial.ok)return options.initial;const initialInteraction=tryCreateInteractionState(options.interaction);if(!initialInteraction.ok)return initialInteraction;let interaction=initialInteraction.value;const snapshot=tryCreateRevisionSnapshot(options.initial.value);if(!snapshot.ok)return snapshot;const notifiers=options.notify===void 0?Object.freeze([]):typeof options.notify==="function"?Object.freeze([options.notify]):Object.freeze([...options.notify]);let current=snapshot.value;return{ok:true,value:Object.freeze({getSnapshot:()=>current,syncInteraction:input=>{const next=tryCreateInteractionState(input);if(next.ok)interaction=next.value;return next},replace:state=>{const next=synchronizeControllerState(current,state);if(next.ok)current=next.value;return next},handle:(event,expectedRevision=current.revision)=>{const permitted=requireInteraction(interaction,options.interactionIntent?.(event)??"mutate");if(!permitted.ok)return rejectRevisionInput(current,permitted.error);const previous=current;const prepared=prepareControllerEvent(current,expectedRevision,event,options.reducer,options.reconcile??((_previous,proposed)=>({ok:true,value:proposed})),options.toEffect);if(!prepared.result.ok)return prepared.result;current=prepared.result.snapshot;publishControllerUpdate(prepared.result.commands,options.publishEffect,notifiers,options.complete,previous.state,prepared.proposed);return prepared.result},reject:(code,message,details)=>rejectRevisionInput(current,{class:"transition-rejection",code,message,...details===void 0?{}:{details}})})}}function createHostAdapter(options){const controller=createSemanticController({initial:options.initial,reducer:options.reducer,toEffect:options.project,...options.reconcile===void 0?{}:{reconcile:options.reconcile},...options.publishEffect===void 0?{}:{publishEffect:options.publishEffect},...options.notify===void 0?{}:{notify:options.notify},...options.complete===void 0?{}:{complete:options.complete},...options.interaction===void 0?{}:{interaction:options.interaction},...options.interactionIntent===void 0?{}:{interactionIntent:options.interactionIntent}});if(!controller.ok)return controller;return{ok:true,value:Object.freeze({getSnapshot:()=>controller.value.getSnapshot(),syncInteraction:input=>controller.value.syncInteraction(input),replace:state=>controller.value.replace(state),handleInput:(input,expectedRevision)=>{const event=options.decode(input);if(event===null)return null;return controller.value.handle(event,expectedRevision)},reject:(code,message,details)=>controller.value.reject(code,message,details)})}}function createControlledComponentController(options){const runtime=createSemanticController({initial:options.initial,reducer:options.reducer,reconcile:(previous,proposed)=>options.create(options.controlled?options.read(previous):options.read(proposed),proposed),notify:(previous,proposed)=>{const before=options.read(previous);const after=options.read(proposed);if(!Object.is(before,after))options.onChange?.(after,before)},toEffect:command=>command,...options.publishEffect===void 0?{}:{publishEffect:options.publishEffect},...options.interaction===void 0?{}:{interaction:options.interaction},...options.interactionIntent===void 0?{}:{interactionIntent:options.interactionIntent}});if(!runtime.ok)return runtime;const getSnapshot=()=>runtime.value.getSnapshot();const syncControlledValue=value=>{if(!options.controlled){return{ok:false,error:{class:"construction",code:"uncontrolled-controller-sync",message:"An uncontrolled component cannot be synchronized externally."}}}return runtime.value.replace(options.create(value,getSnapshot().state))};return{ok:true,value:Object.freeze({getSnapshot,syncInteraction:input=>runtime.value.syncInteraction(input),syncControlledValue,handle:(event,expectedRevision)=>runtime.value.handle(event,expectedRevision)})}}function createCollectionComponentController(options){let domain=options.domain;const runtime=createSemanticController({initial:options.initial(domain),reducer:(state,event)=>options.reducer(domain,state,event),reconcile:(previous,proposed)=>options.reconcile(domain,previous,proposed),toEffect:command=>command,...options.notify===void 0?{}:{notify:options.notify},...options.interaction===void 0?{}:{interaction:options.interaction},...options.interactionIntent===void 0?{}:{interactionIntent:options.interactionIntent}});if(!runtime.ok)return runtime;const replaceDomain=nextDomain=>{if(Object.is(domain,nextDomain))return{ok:true,value:runtime.value.getSnapshot()};const previous=runtime.value.getSnapshot().state;const next=options.replaceDomain(nextDomain,previous);if(!next.ok)return next;const replaced=runtime.value.replace(next);if(replaced.ok){domain=nextDomain;options.notify?.(previous,replaced.value.state)}return replaced};return{ok:true,value:Object.freeze({getDomain:()=>domain,getSnapshot:()=>runtime.value.getSnapshot(),syncInteraction:input=>runtime.value.syncInteraction(input),replaceDomain,replaceState:state=>runtime.value.replace(state),handle:(event,expectedRevision)=>runtime.value.handle(event,expectedRevision)})}}function tryReconcileCollectionIdentities(items,selected,current,disabledItems,mode,options={}){if(mode!=="single"&&mode!=="multiple"){return{ok:false,error:{class:"construction",code:"invalid-selection-mode",message:"Collection selection mode must be single or multiple."}}}const domain=tryCreateSequence(items);if(!domain.ok)return domain;const normalizedSelection=tryNormalizeStableIDs(selected);if(!normalizedSelection.ok)return normalizedSelection;const disabled=tryCreateDisabledIdentitySet(domain.value,disabledItems);if(!disabled.ok)return disabled;const requested=new Set(normalizedSelection.value);const selectedInDomain=domain.value.ids.filter(id=>requested.has(id));const nextSelected=Object.freeze(mode==="single"?selectedInDomain.slice(0,1):selectedInDomain);const nextCurrent=current===null&&options.preserveNullCurrent===true?null:current!==null&&domain.value.contains(current)&&!disabled.value.has(current)?current:nextSelected.find(id=>!disabled.value.has(id))??domain.value.ids.find(id=>!disabled.value.has(id))??null;return{ok:true,value:Object.freeze({selected:nextSelected,current:nextCurrent,selectionChanged:!sameStableIDOrder(selected,nextSelected),currentChanged:current!==nextCurrent})}}function tryCreateDisabledIdentitySet(domain,ids=[]){const disabled=new Set(ids);for(const id of disabled){if(!domain.contains(id)){return{ok:false,error:{class:"construction",code:"disabled-item-outside-domain",message:"Every disabled item must exist in the component domain.",details:{id}}}}}return{ok:true,value:disabled}}class FacadeSubscription{#owner;#listener;constructor(owner,listener){this.#owner=owner;this.#listener=listener}unsubscribe=()=>{const owner=this.#owner,listener=this.#listener;this.release();if(listener)owner?.delete(listener)};release(){this.#owner=void 0;this.#listener=void 0}}function createFacadeConnection(options,construct){const subscribers=new Map;let applicationUpdate=options.onUpdate;let connection;let active=true;let activePublication;const onUpdate=()=>{if(!active)return;const publication={};activePublication=publication;let firstError;let hasError=false;if(connection!==void 0){let snapshot;try{snapshot=connection.getSnapshot()}catch(error){hasError=true;firstError=error}if(snapshot!==void 0&&activePublication===publication){for(const subscriber of[...subscribers.keys()]){try{subscriber(snapshot)}catch(error){if(!hasError){hasError=true;firstError=error}}if(activePublication!==publication)break}}}if(activePublication===publication){try{applicationUpdate?.()}catch(error){if(!hasError){hasError=true;firstError=error}}if(activePublication===publication)activePublication=void 0}if(hasError)throw firstError};const constructed=construct({...options,onUpdate});if(!constructed.ok)return constructed;connection=constructed.value;const target=connection;const forwardedMethods=new Map;const inactiveUnsubscribe=()=>void 0;const send=input=>active&&Boolean(callFirst(target,["handleEvent","handleKeyboardInput","handleKeyboardEvent","handleBeforeInput"],input));const update=input=>active?callFirst(target,["syncControlledValues","syncControlledValue","syncWindow"],input):destroyedConnectionResult();const subscribe=listener=>{if(!active)return inactiveUnsubscribe;let subscription=subscribers.get(listener);if(subscription===void 0){subscription=new FacadeSubscription(subscribers,listener);subscribers.set(listener,subscription)}return subscription.unsubscribe};const destroy=()=>{if(!active)return;active=false;activePublication=void 0;try{const disconnect=target["disconnect"];if(typeof disconnect==="function")Reflect.apply(disconnect,target,[])}finally{applicationUpdate=void 0;for(const subscription of subscribers.values())subscription.release();subscribers.clear()}};const facade=new Proxy(target,{get:(_target,property)=>{if(property==="state")return connection?.getSnapshot().state;if(property==="send")return send;if(property==="update")return update;if(property==="subscribe")return subscribe;if(property==="destroy")return destroy;const value=Reflect.get(target,property,target);const ownDescriptor=Reflect.getOwnPropertyDescriptor(target,property);if(ownDescriptor!==void 0&&ownDescriptor.configurable===false)return value;if(typeof value!=="function")return value;const existing=forwardedMethods.get(property);if(existing!==void 0)return existing;const forwarded=(...args)=>{if(active||isPostDestroyRead(property))return Reflect.apply(value,target,args);if(typeof property==="string"&&property.startsWith("handle"))return false;if(typeof property==="string"&&property.startsWith("sync")){return destroyedConnectionResult()}return void 0};forwardedMethods.set(property,forwarded);return forwarded}});return{ok:true,value:facade}}function publishControllerUpdate(effects,publishEffect,notifiers,complete,previous,proposed){let firstError;let hasError=false;if(publishEffect!==void 0){for(const effect of effects){try{publishEffect(effect)}catch(error){if(!hasError){hasError=true;firstError=error}}}}for(const notify of notifiers){try{notify(previous,proposed)}catch(error){if(!hasError){hasError=true;firstError=error}}}try{complete?.(effects,previous,proposed)}catch(error){if(!hasError){hasError=true;firstError=error}}if(hasError)throw firstError}function destroyedConnectionResult(){return{ok:false,error:{class:"resource-rejection",code:"connection-destroyed",message:"A destroyed facade connection cannot be updated."}}}function isPostDestroyRead(property){return property==="getSnapshot"||typeof property==="string"&&property.startsWith("get")}function callFirst(target,names,input){for(const name of names){const method=target[name];if(typeof method==="function")return Reflect.apply(method,target,[input])}throw new TypeError(`The connection does not implement ${names.join(" or ")}.`)}export{controlledFieldError,createCollectionComponentController,createControlledComponentController,createFacadeConnection,createHostAdapter,createSemanticController,synchronizeControllerState,tryCreateDisabledIdentitySet,tryReconcileCollectionIdentities};
2
2
  //# sourceMappingURL=adapter-runtime.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/adapter-runtime.ts"],"mappings":"AAEA,OAAS,kBAAmB,0BAA6B,gBACzD,OAAS,sBAAyB,2BAClC,OACE,0BACA,uBAEK,mBACP,OACE,qBACA,0BACA,oBACA,wBAIK,gBAEP,SAAS,uBACP,QACA,iBACA,MACA,QACA,UACA,SAAsC,CAKtC,MAAM,SAAW,qBAAqB,QAAS,iBAAkB,MAAO,OAAO,EAC/E,GAAI,CAAC,SAAS,GAAI,MAAO,CAAE,OAAQ,SAAU,SAAU,QAAQ,KAAK,EACpE,MAAM,UAAY,UAAU,QAAQ,MAAO,SAAS,SAAS,KAAK,EAClE,G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AQ,OAAQ,CAAC,KAAK,CAAC,CAChF,CACA,MAAM,IAAI,UAAU,qCAAqC,MAAM,KAAK,MAAM,CAAC,GAAG,CAChF","names":[],"file":"adapter-runtime.js"}
@@ -24,14 +24,18 @@ export interface ColorAreaValue {
24
24
  }
25
25
  /** Integer RGBA channels in the inclusive 0..255 interval. */
26
26
  export type ColorValue = Rgba8;
27
+ /** Exact editing coordinates; RGB8 remains the accepted color value. */
28
+ export type ColorAreaSelection = Omit<ColorAreaValue, 'alpha'>;
27
29
  export interface ColorPickerState {
28
30
  readonly value: ColorValue;
31
+ readonly area?: ColorAreaSelection;
29
32
  readonly draft: string | null;
30
33
  readonly format: ColorFormat;
31
34
  readonly channel: ColorChannel;
32
35
  }
33
36
  export interface ColorPickerStateInput {
34
37
  readonly value?: ColorValue | string;
38
+ readonly area?: ColorAreaSelection;
35
39
  readonly draft?: string | null;
36
40
  readonly format?: ColorFormat;
37
41
  readonly channel?: ColorChannel;
@@ -88,9 +92,11 @@ export declare function createColorValue(red: number, green: number, blue: numbe
88
92
  export declare function tryCreateColorValue(red: number, green: number, blue: number, alpha?: number): Result<ColorValue>;
89
93
  export declare function parseColorValue(text: string): Result<ColorValue>;
90
94
  export declare function formatColorValue(value: ColorValue, format?: ColorFormat): Result<string>;
91
- export declare function getColorAreaValue(value: ColorValue): Result<ColorAreaValue>;
92
- export declare function getColorCoordinates(value: ColorValue, format: ColorFormat): Result<readonly ColorCoordinateValue[]>;
95
+ export declare function getColorAreaValue(value: ColorValue, selection?: ColorAreaSelection): Result<ColorAreaValue>;
96
+ export declare function getColorCoordinates(value: ColorValue, format: ColorFormat, selection?: ColorAreaSelection): Result<readonly ColorCoordinateValue[]>;
93
97
  export declare function setColorCoordinate(value: ColorValue, format: ColorModel, name: ColorCoordinate, next: number): Result<ColorValue>;
94
98
  export declare function createColorPickerState(input?: ColorPickerStateInput, policies?: ColorPickerPolicies): ColorPickerState;
95
99
  export declare function tryCreateColorPickerState(input?: ColorPickerStateInput, policies?: ColorPickerPolicies): Result<ColorPickerState>;
100
+ /** Reconcile owner values without discarding a matching current or proposed area selection. */
101
+ export declare function reconcileColorPickerState(previous: ColorPickerState, input: ColorPickerStateInput, policies?: ColorPickerPolicies, proposal?: ColorPickerState): Result<ColorPickerState>;
96
102
  export declare function applyColorPickerEvent(state: ColorPickerState, event: ColorPickerEvent, policies?: ColorPickerPolicies): Result<ColorPickerUpdate>;
@@ -1,2 +1,2 @@
1
- import{unwrap}from"./result.js";import{fail,ok}from"./internal/kernel/foundation.js";import{createMachineUpdate}from"./internal/kernel/machine.js";import{deviceCmykToSrgb,hslToSrgb,hsvToSrgb,oklchToSrgb,rgba8ToSrgb,srgbToDeviceCmyk,srgbToHsl,srgbToHsv,srgbToOklch,srgbToRgba8,tryCreateRgba8}from"./structures/color.js";import{formatColorText,parseColorText}from"./editing/color-text.js";function createColorValue(red,green,blue,alpha=255){return unwrap(tryCreateColorValue(red,green,blue,alpha))}function tryCreateColorValue(red,green,blue,alpha=255){return tryCreateRgba8(red,green,blue,alpha)}function parseColorValue(text){return parseColorText(text)}function formatColorValue(value,format="hex"){return isFormat(format)?formatColorText(value,format):fail("construction","color-format-invalid","Color format is unsupported.")}function getColorAreaValue(value){if(!validColorValue(value)){const invalid=tryCreateColorValue(value.red,value.green,value.blue,value.alpha);if(!invalid.ok)return invalid}const hsv=srgbToHsv(rgba8ToSrgb(value));return ok(Object.freeze({x:hsv.saturation,y:hsv.value,hue:hsv.hue,alpha:value.alpha/255}))}function getColorCoordinates(value,format){if(!validColorValue(value)){const invalid=tryCreateColorValue(value.red,value.green,value.blue,value.alpha);if(!invalid.ok)return invalid}if(!isFormat(format))return fail("construction","color-format-invalid","Color format is unsupported.");if(format==="hex")return ok(Object.freeze([]));const alpha=coordinate("alpha","Alpha",value.alpha/255*100,0,100,1,"%");if(format==="rgb"){return ok(Object.freeze([coordinate("red","Red",value.red,0,255,1),coordinate("green","Green",value.green,0,255,1),coordinate("blue","Blue",value.blue,0,255,1),alpha]))}if(format==="hsv"){const red=value.red/255;const green=value.green/255;const blue=value.blue/255;const maximum=Math.max(red,green,blue);const delta=maximum-Math.min(red,green,blue);const sector=delta===0?0:maximum===red?(green-blue)/delta:maximum===green?2+(blue-red)/delta:4+(red-green)/delta;const hue=(60*(sector<0?sector+6:sector)%360+360)%360;return ok(Object.freeze([coordinate("hue","Hue",hue,0,360,1,"\xB0"),coordinate("saturation","Saturation",(maximum===0?0:delta/maximum)*100,0,100,1,"%"),coordinate("value","Value",maximum*100,0,100,1,"%"),alpha]))}const converted=rgba8ToSrgb(value);if(format==="hsl"){const hsl=srgbToHsl(converted);return ok(Object.freeze([coordinate("hue","Hue",hsl.hue,0,360,1,"\xB0"),coordinate("saturation","Saturation",hsl.saturation*100,0,100,1,"%"),coordinate("lightness","Lightness",hsl.lightness*100,0,100,1,"%"),alpha]))}if(format==="cmyk"){const cmyk=srgbToDeviceCmyk(converted);return ok(Object.freeze([coordinate("cyan","Cyan",cmyk.cyan*100,0,100,1,"%"),coordinate("magenta","Magenta",cmyk.magenta*100,0,100,1,"%"),coordinate("yellow","Yellow",cmyk.yellow*100,0,100,1,"%"),coordinate("black","Black",cmyk.black*100,0,100,1,"%"),alpha]))}const oklch=srgbToOklch(converted);return ok(Object.freeze([coordinate("lightness","Lightness",oklch.lightness*100,0,100,.1,"%"),coordinate("chroma","Chroma",oklch.chroma,0,.4,.001),coordinate("hue","Hue",oklch.hue,0,360,.1,"\xB0"),alpha]))}function setColorCoordinate(value,format,name,next){if(!Number.isFinite(next))return fail("construction","color-coordinate-invalid","Color coordinates must be finite numbers.",{format,coordinate:name,value:next});const coordinates=getColorCoordinates(value,format);if(!coordinates.ok)return coordinates;const selected=coordinates.value.find(entry=>entry.coordinate===name);if(selected===void 0||next<selected.min||next>selected.max)return fail("construction","color-coordinate-out-of-range","Color coordinate is unavailable or outside its supported range.",{format,coordinate:name,value:next});if(name==="alpha")return tryCreateColorValue(value.red,value.green,value.blue,Math.round(next/100*255));if(format==="rgb")return tryCreateColorValue(name==="red"?Math.round(next):value.red,name==="green"?Math.round(next):value.green,name==="blue"?Math.round(next):value.blue,value.alpha);const currentSrgb=rgba8ToSrgb(value);if(format==="hsl"){const current2=srgbToHsl(currentSrgb);return ok(srgbToRgba8(hslToSrgb({hue:name==="hue"?next:current2.hue,saturation:name==="saturation"?next/100:current2.saturation,lightness:name==="lightness"?next/100:current2.lightness,alpha:current2.alpha})))}if(format==="hsv"){const current2=srgbToHsv(currentSrgb);return ok(srgbToRgba8(hsvToSrgb({hue:name==="hue"?next:current2.hue,saturation:name==="saturation"?next/100:current2.saturation,value:name==="value"?next/100:current2.value,alpha:current2.alpha})))}if(format==="cmyk"){const current2=srgbToDeviceCmyk(currentSrgb);return ok(srgbToRgba8(deviceCmykToSrgb({cyan:name==="cyan"?next/100:current2.cyan,magenta:name==="magenta"?next/100:current2.magenta,yellow:name==="yellow"?next/100:current2.yellow,black:name==="black"?next/100:current2.black,alpha:current2.alpha})))}const current=srgbToOklch(currentSrgb);const rgb=oklchToSrgb({lightness:name==="lightness"?next/100:current.lightness,chroma:name==="chroma"?next:current.chroma,hue:name==="hue"?next:current.hue,alpha:current.alpha});return rgb.ok?ok(srgbToRgba8(rgb.value)):fail("construction",rgb.error.code,rgb.error.message,{coordinate:name,value:next})}function createColorPickerState(input={},policies={}){return unwrap(tryCreateColorPickerState(input,policies))}function tryCreateColorPickerState(input={},policies={}){const validPolicies=validatePolicies(policies);if(!validPolicies.ok)return validPolicies;const value=typeof input.value==="string"?parseColorValue(input.value):input.value===void 0?tryCreateColorValue(0,0,0):tryCreateColorValue(input.value.red,input.value.green,input.value.blue,input.value.alpha);if(!value.ok)return value;if(policies.allowAlpha===false&&value.value.alpha!==255)return fail("construction","color-alpha-disabled","Alpha must be opaque when alpha editing is disabled.");const format=input.format??"hex";if(!isFormat(format))return fail("construction","color-format-invalid","Color format is unsupported.");const channel=input.channel??"red";if(!isChannel(channel))return fail("construction","color-channel-invalid","Color channel is unsupported.");if(channel==="alpha"&&policies.allowAlpha===false)return fail("construction","color-alpha-disabled","Alpha cannot be active when alpha editing is disabled.");if(input.draft!==void 0&&input.draft!==null&&typeof input.draft!=="string")return fail("construction","color-draft-invalid","Color draft must be text or null.");return ok(Object.freeze({value:value.value,draft:input.draft??null,format,channel}))}function applyColorPickerEvent(state,event,policies={}){const valid=tryCreateColorPickerState(state,policies);if(!valid.ok)return fail("transition-rejection",valid.error.code,valid.error.message,valid.error.details);if(event==="cancel")return createMachineUpdate(colorState(state,{draft:null}));if(event==="commit"){if(state.draft===null)return createMachineUpdate(state);const parsed=parseColorValue(state.draft);if(!parsed.ok)return fail("transition-rejection",parsed.error.code,parsed.error.message,parsed.error.details);return commit(state,parsed.value,policies)}if(event==="increment"||event==="decrement"){const step=state.channel==="alpha"?policies.alphaStep??17:policies.channelStep??1;const value2=Math.min(255,Math.max(0,state.value[state.channel]+(event==="increment"?step:-step)));return commit(state,withChannel(state.value,state.channel,value2),policies)}if(event.type==="input")return createMachineUpdate(colorState(state,{draft:event.text}));if(event.type==="set-format"){if(!isFormat(event.format))return fail("transition-rejection","color-format-invalid","Color format is unsupported.");return createMachineUpdate(colorState(state,{format:event.format,draft:null}))}if(event.type==="focus-channel"){if(!isChannel(event.channel))return fail("transition-rejection","color-channel-invalid","Color channel is unsupported.");if(event.channel==="alpha"&&policies.allowAlpha===false)return fail("transition-rejection","color-alpha-disabled","Alpha editing is disabled.");return createMachineUpdate(colorState(state,{channel:event.channel}))}if(event.type==="set-channel"){const channel=event.channel;if(!isChannel(channel)||!Number.isInteger(event.value)||event.value<0||event.value>255)return fail("transition-rejection","color-channel-out-of-range","Color channels must be integers from 0 through 255.");return commit(colorState(state,{channel}),withChannel(state.value,channel,event.value),policies)}if(event.type==="set-coordinate"){const value2=setColorCoordinate(state.value,event.format,event.coordinate,event.value);return value2.ok?commit(state,value2.value,policies):fail("transition-rejection",value2.error.code,value2.error.message,value2.error.details)}if(event.type==="set-area"){if(!unitInterval(event.x)||!unitInterval(event.y))return fail("transition-rejection","color-area-out-of-range","Color area coordinates must be from 0 through 1.");const current=srgbToHsv(rgba8ToSrgb(state.value));return commit(state,srgbToRgba8(hsvToSrgb({hue:current.hue,saturation:event.x,value:event.y,alpha:current.alpha})),policies)}if(event.type==="set-hue"){if(!Number.isFinite(event.value)||event.value<0||event.value>360)return fail("transition-rejection","color-hue-out-of-range","Hue must be from 0 through 360.");const current=srgbToHsv(rgba8ToSrgb(state.value));return commit(state,srgbToRgba8(hsvToSrgb({hue:event.value,saturation:current.saturation,value:current.value,alpha:current.alpha})),policies)}if(event.type==="set-alpha"){if(!unitInterval(event.value))return fail("transition-rejection","color-alpha-out-of-range","Alpha must be from 0 through 1.");return commit(state,Object.freeze({...state.value,alpha:Math.round(event.value*255)}),policies)}const value=typeof event.value==="string"?parseColorValue(event.value):tryCreateColorValue(event.value.red,event.value.green,event.value.blue,event.value.alpha);if(!value.ok)return fail("transition-rejection",value.error.code,value.error.message,value.error.details);return commit(state,value.value,policies)}function commit(state,value,policies){if(policies.allowAlpha===false&&value.alpha!==255)return fail("transition-rejection","color-alpha-disabled","Alpha editing is disabled.");const next=colorState(state,{value,draft:null});if(sameColor(state.value,value)&&state.draft===null)return createMachineUpdate(next);const text=formatColorValue(value,state.format);if(!text.ok)return fail("transition-rejection",text.error.code,text.error.message,text.error.details);return createMachineUpdate(next,[{type:"color-change",value},{type:"announce-color",text:text.value}])}function withChannel(value,channel,next){return Object.freeze({...value,[channel]:next})}function colorState(state,patch){return Object.freeze({value:patch.value??state.value,draft:patch.draft===void 0?state.draft:patch.draft,format:patch.format??state.format,channel:patch.channel??state.channel})}function validatePolicies(policies){for(const[name,value]of[["channelStep",policies.channelStep],["alphaStep",policies.alphaStep]]){if(value!==void 0&&(!Number.isInteger(value)||value<=0||value>255))return fail("construction","color-step-invalid","Color channel steps must be positive integers no greater than 255.",{name,value})}return ok(true)}function sameColor(left,right){return left.red===right.red&&left.green===right.green&&left.blue===right.blue&&left.alpha===right.alpha}function isChannel(value){return value==="red"||value==="green"||value==="blue"||value==="alpha"}function isFormat(value){return value==="hex"||value==="rgb"||value==="hsl"||value==="hsv"||value==="cmyk"||value==="oklch"}function validColorValue(value){return validChannelValue(value.red)&&validChannelValue(value.green)&&validChannelValue(value.blue)&&validChannelValue(value.alpha)}function validChannelValue(value){return Number.isInteger(value)&&value>=0&&value<=255}function coordinate(name,label,value,min,max,step,unit=""){return Object.freeze({coordinate:name,label,value:Number(value.toFixed(step<.01?4:step<1?2:0)),min,max,step,unit})}function unitInterval(value){return Number.isFinite(value)&&value>=0&&value<=1}export{applyColorPickerEvent,createColorPickerState,createColorValue,formatColorValue,getColorAreaValue,getColorCoordinates,parseColorValue,setColorCoordinate,tryCreateColorPickerState,tryCreateColorValue};
1
+ import{unwrap}from"./result.js";import{fail,ok}from"./internal/kernel/foundation.js";import{createMachineUpdate}from"./internal/kernel/machine.js";import{deviceCmykToSrgb,hslToSrgb,hsvToSrgb,oklchToSrgb,rgba8ToSrgb,srgbToDeviceCmyk,srgbToHsl,srgbToHsv,srgbToOklch,srgbToRgba8,tryCreateRgba8}from"./structures/color.js";import{formatColorText,parseColorText}from"./editing/color-text.js";function createColorValue(red,green,blue,alpha=255){return unwrap(tryCreateColorValue(red,green,blue,alpha))}function tryCreateColorValue(red,green,blue,alpha=255){return tryCreateRgba8(red,green,blue,alpha)}function parseColorValue(text){return parseColorText(text)}function formatColorValue(value,format="hex"){return isFormat(format)?formatColorText(value,format):fail("construction","color-format-invalid","Color format is unsupported.")}function getColorAreaValue(value,selection){if(!validColorValue(value)){const invalid=tryCreateColorValue(value.red,value.green,value.blue,value.alpha);if(!invalid.ok)return invalid}if(selection!==void 0){if(!unitInterval(selection.x)||!unitInterval(selection.y)||!Number.isFinite(selection.hue)||selection.hue<0||selection.hue>360)return fail("construction","color-area-out-of-range","Color area selection must have bounded finite coordinates.");const projected=colorFromArea(selection,value.alpha/255);if(!sameRGB(value,projected))return fail("construction","color-coordinate-invalid","Color area selection must represent the accepted RGB value.");return ok(Object.freeze({x:selection.x,y:selection.y,hue:selection.hue,alpha:value.alpha/255}))}const hsv=srgbToHsv(rgba8ToSrgb(value));return ok(Object.freeze({x:hsv.saturation,y:hsv.value,hue:hsv.hue,alpha:value.alpha/255}))}function getColorCoordinates(value,format,selection){if(!validColorValue(value)){const invalid=tryCreateColorValue(value.red,value.green,value.blue,value.alpha);if(!invalid.ok)return invalid}if(!isFormat(format))return fail("construction","color-format-invalid","Color format is unsupported.");if(format==="hex")return ok(Object.freeze([]));const alpha=coordinate("alpha","Alpha",value.alpha/255*100,0,100,1,"%");if(format==="rgb"){return ok(Object.freeze([coordinate("red","Red",value.red,0,255,1),coordinate("green","Green",value.green,0,255,1),coordinate("blue","Blue",value.blue,0,255,1),alpha]))}if(format==="hsv"){const area=getColorAreaValue(value,selection);if(!area.ok)return area;return ok(Object.freeze([coordinate("hue","Hue",area.value.hue,0,360,1,"\xB0"),coordinate("saturation","Saturation",area.value.x*100,0,100,1,"%"),coordinate("value","Value",area.value.y*100,0,100,1,"%"),alpha]))}const converted=rgba8ToSrgb(value);if(format==="hsl"){const hsl=srgbToHsl(converted);return ok(Object.freeze([coordinate("hue","Hue",hsl.hue,0,360,1,"\xB0"),coordinate("saturation","Saturation",hsl.saturation*100,0,100,1,"%"),coordinate("lightness","Lightness",hsl.lightness*100,0,100,1,"%"),alpha]))}if(format==="cmyk"){const cmyk=srgbToDeviceCmyk(converted);return ok(Object.freeze([coordinate("cyan","Cyan",cmyk.cyan*100,0,100,1,"%"),coordinate("magenta","Magenta",cmyk.magenta*100,0,100,1,"%"),coordinate("yellow","Yellow",cmyk.yellow*100,0,100,1,"%"),coordinate("black","Black",cmyk.black*100,0,100,1,"%"),alpha]))}const oklch=srgbToOklch(converted);return ok(Object.freeze([coordinate("lightness","Lightness",oklch.lightness*100,0,100,.1,"%"),coordinate("chroma","Chroma",oklch.chroma,0,.4,.001),coordinate("hue","Hue",oklch.hue,0,360,.1,"\xB0"),alpha]))}function setColorCoordinate(value,format,name,next){if(!Number.isFinite(next))return fail("construction","color-coordinate-invalid","Color coordinates must be finite numbers.",{format,coordinate:name,value:next});const coordinates=getColorCoordinates(value,format);if(!coordinates.ok)return coordinates;const selected=coordinates.value.find(entry=>entry.coordinate===name);if(selected===void 0||next<selected.min||next>selected.max)return fail("construction","color-coordinate-out-of-range","Color coordinate is unavailable or outside its supported range.",{format,coordinate:name,value:next});if(name==="alpha")return tryCreateColorValue(value.red,value.green,value.blue,Math.round(next/100*255));if(format==="rgb")return tryCreateColorValue(name==="red"?Math.round(next):value.red,name==="green"?Math.round(next):value.green,name==="blue"?Math.round(next):value.blue,value.alpha);const currentSrgb=rgba8ToSrgb(value);if(format==="hsl"){const current2=srgbToHsl(currentSrgb);return ok(srgbToRgba8(hslToSrgb({hue:name==="hue"?next:current2.hue,saturation:name==="saturation"?next/100:current2.saturation,lightness:name==="lightness"?next/100:current2.lightness,alpha:current2.alpha})))}if(format==="hsv"){const current2=srgbToHsv(currentSrgb);return ok(srgbToRgba8(hsvToSrgb({hue:name==="hue"?next:current2.hue,saturation:name==="saturation"?next/100:current2.saturation,value:name==="value"?next/100:current2.value,alpha:current2.alpha})))}if(format==="cmyk"){const current2=srgbToDeviceCmyk(currentSrgb);return ok(srgbToRgba8(deviceCmykToSrgb({cyan:name==="cyan"?next/100:current2.cyan,magenta:name==="magenta"?next/100:current2.magenta,yellow:name==="yellow"?next/100:current2.yellow,black:name==="black"?next/100:current2.black,alpha:current2.alpha})))}const current=srgbToOklch(currentSrgb);const rgb=oklchToSrgb({lightness:name==="lightness"?next/100:current.lightness,chroma:name==="chroma"?next:current.chroma,hue:name==="hue"?next:current.hue,alpha:current.alpha});return rgb.ok?ok(srgbToRgba8(rgb.value)):fail("construction",rgb.error.code,rgb.error.message,{coordinate:name,value:next})}function createColorPickerState(input={},policies={}){return unwrap(tryCreateColorPickerState(input,policies))}function tryCreateColorPickerState(input={},policies={}){const validPolicies=validatePolicies(policies);if(!validPolicies.ok)return validPolicies;const value=typeof input.value==="string"?parseColorValue(input.value):input.value===void 0?tryCreateColorValue(0,0,0):tryCreateColorValue(input.value.red,input.value.green,input.value.blue,input.value.alpha);if(!value.ok)return value;if(policies.allowAlpha===false&&value.value.alpha!==255)return fail("construction","color-alpha-disabled","Alpha must be opaque when alpha editing is disabled.");const format=input.format??"hex";if(!isFormat(format))return fail("construction","color-format-invalid","Color format is unsupported.");const channel=input.channel??"red";if(!isChannel(channel))return fail("construction","color-channel-invalid","Color channel is unsupported.");if(channel==="alpha"&&policies.allowAlpha===false)return fail("construction","color-alpha-disabled","Alpha cannot be active when alpha editing is disabled.");if(input.draft!==void 0&&input.draft!==null&&typeof input.draft!=="string")return fail("construction","color-draft-invalid","Color draft must be text or null.");const area=getColorAreaValue(value.value,input.area);if(!area.ok)return area;return ok(Object.freeze({value:value.value,area:areaSelection(area.value),draft:input.draft??null,format,channel}))}function reconcileColorPickerState(previous,input,policies={},proposal){const{area:_area,...base}=previous;const next=tryCreateColorPickerState({...base,...input},policies);if(!next.ok||input.area!==void 0)return next;const retained=proposal!==void 0&&sameRGB(proposal.value,next.value.value)?proposal:previous;if(!sameRGB(retained.value,next.value.value)||retained.area===void 0)return next;return tryCreateColorPickerState({...next.value,area:retained.area},policies)}function applyColorPickerEvent(state,event,policies={}){const valid=tryCreateColorPickerState(state,policies);if(!valid.ok)return fail("transition-rejection",valid.error.code,valid.error.message,valid.error.details);if(event==="cancel")return createMachineUpdate(colorState(state,{draft:null}));if(event==="commit"){if(state.draft===null)return createMachineUpdate(state);const parsed=parseColorValue(state.draft);if(!parsed.ok)return fail("transition-rejection",parsed.error.code,parsed.error.message,parsed.error.details);return commit(state,parsed.value,policies)}if(event==="increment"||event==="decrement"){const step=state.channel==="alpha"?policies.alphaStep??17:policies.channelStep??1;const value2=Math.min(255,Math.max(0,state.value[state.channel]+(event==="increment"?step:-step)));return commit(state,withChannel(state.value,state.channel,value2),policies)}if(event.type==="input")return createMachineUpdate(colorState(state,{draft:event.text}));if(event.type==="set-format"){if(!isFormat(event.format))return fail("transition-rejection","color-format-invalid","Color format is unsupported.");return createMachineUpdate(colorState(state,{format:event.format,draft:null}))}if(event.type==="focus-channel"){if(!isChannel(event.channel))return fail("transition-rejection","color-channel-invalid","Color channel is unsupported.");if(event.channel==="alpha"&&policies.allowAlpha===false)return fail("transition-rejection","color-alpha-disabled","Alpha editing is disabled.");return createMachineUpdate(colorState(state,{channel:event.channel}))}if(event.type==="set-channel"){const channel=event.channel;if(!isChannel(channel)||!Number.isInteger(event.value)||event.value<0||event.value>255)return fail("transition-rejection","color-channel-out-of-range","Color channels must be integers from 0 through 255.");return commit(colorState(state,{channel}),withChannel(state.value,channel,event.value),policies)}if(event.type==="set-coordinate"){if(event.format==="hsv"&&(event.coordinate==="hue"||event.coordinate==="saturation"||event.coordinate==="value")){const limit=event.coordinate==="hue"?360:100;if(!Number.isFinite(event.value)||event.value<0||event.value>limit)return fail("transition-rejection","color-coordinate-out-of-range","Color coordinate is outside its supported range.");const current=valid.value.area;const area={x:event.coordinate==="saturation"?event.value/100:current.x,y:event.coordinate==="value"?event.value/100:current.y,hue:event.coordinate==="hue"?event.value:current.hue};return commit(state,colorFromArea(area,state.value.alpha/255),policies,area)}const value2=setColorCoordinate(state.value,event.format,event.coordinate,event.value);return value2.ok?commit(state,value2.value,policies):fail("transition-rejection",value2.error.code,value2.error.message,value2.error.details)}if(event.type==="set-area"){if(!unitInterval(event.x)||!unitInterval(event.y))return fail("transition-rejection","color-area-out-of-range","Color area coordinates must be from 0 through 1.");const current=valid.value.area;const area={x:event.x,y:event.y,hue:current.hue};return commit(state,colorFromArea(area,state.value.alpha/255),policies,area)}if(event.type==="set-hue"){if(!Number.isFinite(event.value)||event.value<0||event.value>360)return fail("transition-rejection","color-hue-out-of-range","Hue must be from 0 through 360.");const current=valid.value.area;const area={x:current.x,y:current.y,hue:event.value};return commit(state,colorFromArea(area,state.value.alpha/255),policies,area)}if(event.type==="set-alpha"){if(!unitInterval(event.value))return fail("transition-rejection","color-alpha-out-of-range","Alpha must be from 0 through 1.");return commit(state,Object.freeze({...state.value,alpha:Math.round(event.value*255)}),policies)}const value=typeof event.value==="string"?parseColorValue(event.value):tryCreateColorValue(event.value.red,event.value.green,event.value.blue,event.value.alpha);if(!value.ok)return fail("transition-rejection",value.error.code,value.error.message,value.error.details);return commit(state,value.value,policies)}function colorFromArea(area,alpha){return srgbToRgba8(hsvToSrgb({hue:area.hue,saturation:area.x,value:area.y,alpha}))}function commit(state,value,policies,selection){if(policies.allowAlpha===false&&value.alpha!==255)return fail("transition-rejection","color-alpha-disabled","Alpha editing is disabled.");const area=getColorAreaValue(value,selection??(sameRGB(state.value,value)?state.area:void 0));if(!area.ok)return area;const next=colorState(state,{value,area:areaSelection(area.value),draft:null});if(sameColor(state.value,value)&&state.draft===null)return createMachineUpdate(next);const text=formatColorValue(value,state.format);if(!text.ok)return fail("transition-rejection",text.error.code,text.error.message,text.error.details);return createMachineUpdate(next,[{type:"color-change",value},{type:"announce-color",text:text.value}])}function withChannel(value,channel,next){return Object.freeze({...value,[channel]:next})}function colorState(state,patch){return Object.freeze({value:patch.value??state.value,...patch.area===void 0&&state.area===void 0?{}:{area:patch.area??state.area},draft:patch.draft===void 0?state.draft:patch.draft,format:patch.format??state.format,channel:patch.channel??state.channel})}function validatePolicies(policies){for(const[name,value]of[["channelStep",policies.channelStep],["alphaStep",policies.alphaStep]]){if(value!==void 0&&(!Number.isInteger(value)||value<=0||value>255))return fail("construction","color-step-invalid","Color channel steps must be positive integers no greater than 255.",{name,value})}return ok(true)}function sameColor(left,right){return left.red===right.red&&left.green===right.green&&left.blue===right.blue&&left.alpha===right.alpha}function sameRGB(left,right){return left.red===right.red&&left.green===right.green&&left.blue===right.blue}function areaSelection(value){return Object.freeze({x:value.x,y:value.y,hue:value.hue})}function isChannel(value){return value==="red"||value==="green"||value==="blue"||value==="alpha"}function isFormat(value){return value==="hex"||value==="rgb"||value==="hsl"||value==="hsv"||value==="cmyk"||value==="oklch"}function validColorValue(value){return validChannelValue(value.red)&&validChannelValue(value.green)&&validChannelValue(value.blue)&&validChannelValue(value.alpha)}function validChannelValue(value){return Number.isInteger(value)&&value>=0&&value<=255}function coordinate(name,label,value,min,max,step,unit=""){return Object.freeze({coordinate:name,label,value:Number(value.toFixed(step<.01?4:step<1?2:0)),min,max,step,unit})}function unitInterval(value){return Number.isFinite(value)&&value>=0&&value<=1}export{applyColorPickerEvent,createColorPickerState,createColorValue,formatColorValue,getColorAreaValue,getColorCoordinates,parseColorValue,reconcileColorPickerState,setColorCoordinate,tryCreateColorPickerState,tryCreateColorValue};
2
2
  //# sourceMappingURL=color-picker.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/color-picker.ts"],"mappings":"AAAA,OAAS,WAAc,cAEvB,OAAS,KAAM,OAAU,kCACzB,OAAS,wBAA2B,+BACpC,OACE,iBACA,UACA,UACA,YACA,YACA,iBACA,UACA,UACA,YACA,YACA,mBAEK,wBACP,OAAS,gBAAiB,mBAAsB,0BAuE1C,SAAU,iBAAiB,IAAa,MAAe,KAAc,MAAQ,IAAG,CACpF,OAAO,OAAO,oBAAoB,IAAK,MAAO,KAAM,KAAK,CAAC,CAC5D,CAEM,SAAU,oBAAoB,IAAa,MAAe,KAAc,MAAQ,IAAG,CACvF,OAAO,eAAe,IAAK,MAAO,KAAM,KAAK,CAC/C,CAEM,SAAU,gBAAgB,KAAY,CAAwB,OAAO,eAAe,IAAI,CAAG,CAE3F,SAAU,iBAAiB,MAAmB,OAAsB,MAAK,CAC7E,OAAO,SAAS,MAAM,EAAI,gBAAgB,MAAO,MAAM,EAAI,KAAK,eAAgB,uBAAwB,8BAA8B,CACxI,CAEM,SAAU,kBAAkB,MAAiB,CACjD,GAAI,CAAC,gBAAgB,KAAK,EAAG,CAC3B,MAAM,QAAU,oBAAoB,MAAM,IAAK,MAAM,MAAO,MAAM,KAAM,MAAM,KAAK,EACnF,GAAI,CAAC,QAAQ,GAAI,OAAO,OAC1B,CACA,MAAM,IAAM,U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pD,OAAO,KAAK,MAAQ,MAAM,KAAO,KAAK,QAAU,MAAM,OAAS,KAAK,OAAS,MAAM,MAAQ,KAAK,QAAU,MAAM,KAClH,CAEA,SAAS,QAAQ,KAAkB,MAAiB,CAAa,OAAO,KAAK,MAAQ,MAAM,KAAO,KAAK,QAAU,MAAM,OAAS,KAAK,OAAS,MAAM,IAAM,CAC1J,SAAS,cAAc,MAAqB,CAAwB,OAAO,OAAO,OAAO,CAAE,EAAG,MAAM,EAAG,EAAG,MAAM,EAAG,IAAK,MAAM,GAAG,CAAE,CAAG,CAEtI,SAAS,UAAU,MAAa,CAC9B,OAAO,QAAU,OAAS,QAAU,SAAW,QAAU,QAAU,QAAU,OAC/E,CAEA,SAAS,SAAS,MAAa,CAC7B,OAAO,QAAU,OAAS,QAAU,OAAS,QAAU,OAAS,QAAU,OAAS,QAAU,QAAU,QAAU,OACnH,CAEA,SAAS,gBAAgB,MAAiB,CACxC,OAAO,kBAAkB,MAAM,GAAG,GAAK,kBAAkB,MAAM,KAAK,GAAK,kBAAkB,MAAM,IAAI,GAAK,kBAAkB,MAAM,KAAK,CACzI,CAEA,SAAS,kBAAkB,MAAa,CACtC,OAAO,OAAO,UAAU,KAAK,GAAK,OAAS,GAAK,OAAS,GAC3D,CAEA,SAAS,WAAW,KAAuB,MAAe,MAAe,IAAa,IAAa,KAAc,KAAqC,GAAE,CACtJ,OAAO,OAAO,OAAO,CAAE,WAAY,KAAM,MAAO,MAAO,OAAO,MAAM,QAAQ,KAAO,IAAO,EAAI,KAAO,EAAI,EAAI,CAAC,CAAC,EAAG,IAAK,IAAK,KAAM,IAAI,CAAE,CAC1I,CAEA,SAAS,aAAa,MAAa,CAAa,OAAO,OAAO,SAAS,KAAK,GAAK,OAAS,GAAK,OAAS,CAAG","names":["current","value"],"file":"color-picker.js"}
@@ -1 +1 @@
1
- export type CoreErrorCode = 'accordion-collapse-forbidden' | 'accordion-cursor-outside-domain' | 'accordion-open-item-required' | 'accordion-single-expansion' | 'accordion-target-unavailable' | 'affine-unit-in-compound-expression' | 'ambiguous-combobox-text' | 'ambiguous-unit-token' | 'calculator-closing-parenthesis-expected' | 'calculator-code-unit-ceiling-exceeded' | 'calculator-depth-ceiling-exceeded' | 'calculator-division-by-zero' | 'calculator-exponent-ceiling-exceeded' | 'calculator-fractional-exponent' | 'calculator-operand-expected' | 'calculator-operation-ceiling-exceeded' | 'calculator-result-ceiling-exceeded' | 'calculator-token-ceiling-exceeded' | 'cardinality-not-safe' | 'carousel-autoplay-delay-invalid' | 'carousel-cursor-outside-slides' | 'carousel-target-unavailable' | 'cascade-list-highlight-outside-tree' | 'cascade-list-leaf-in-path' | 'cascade-list-path-outside-tree' | 'cascade-list-target-disabled' | 'cascade-list-target-unavailable' | 'cascade-list-target-unselectable' | 'cascade-list-value-outside-tree' | 'cascade-select-highlight-outside-tree' | 'cascade-select-leaf-in-path' | 'cascade-select-path-outside-tree' | 'cascade-select-target-disabled' | 'cascade-select-target-unavailable' | 'cascade-select-target-unselectable' | 'cascade-select-value-outside-tree' | 'cell-ceiling-exceeded' | 'closed-menu-has-active-state' | 'collection-window-direction-invalid' | 'collection-window-generation-exhausted' | 'collection-window-generation-invalid' | 'collection-window-pending-invalid' | 'collection-window-range-invalid' | 'collection-window-request-generation-required' | 'collection-window-request-stale' | 'collection-window-revision-invalid' | 'collection-window-revision-stale' | 'collection-window-size-invalid' | 'collection-window-start-invalid' | 'collection-window-total-invalid' | 'color-alpha-disabled' | 'color-alpha-out-of-range' | 'color-area-out-of-range' | 'color-channel-invalid' | 'color-channel-out-of-range' | 'color-coordinate-invalid' | 'color-coordinate-out-of-range' | 'color-draft-invalid' | 'color-format-invalid' | 'color-hue-out-of-range' | 'color-out-of-gamut' | 'color-step-invalid' | 'color-text-invalid' | 'column-ceiling-exceeded' | 'column-count-too-small' | 'combobox-candidate-unavailable' | 'combobox-cursor-outside-domain' | 'composition-active' | 'composition-inactive' | 'connection-destroyed' | 'controlled-shape-mismatch' | 'controlled-edit-mode-required' | 'controlled-expanded-value-required' | 'controlled-expanded-values-required' | 'controlled-highlighted-value-required' | 'controlled-input-state-required' | 'controlled-open-required' | 'controlled-value-required' | 'count-ceiling-exceeded' | 'count-not-safe' | 'cycle' | 'decimal-code-unit-ceiling-exceeded' | 'decimal-scale-ceiling-exceeded' | 'depth-ceiling-exceeded' | 'disabled-item-outside-domain' | 'disconnected-menu-open-path' | 'duplicate-id' | 'duplicate-tag' | 'duplicate-tree-grid-row' | 'duplicate-unit-id' | 'duplicate-unit-system-dimension' | 'editable-empty-value' | 'editable-invalid-value' | 'editable-not-editing' | 'empty-calculator-expression' | 'empty-id' | 'empty-tag' | 'empty-unit-expression' | 'empty-unit-registry' | 'endpoint-off-lattice' | 'feed-cursor-outside-window' | 'feed-target-unavailable' | 'feed-window-size-mismatch' | 'grid-cursor-outside-grid' | 'grid-edit-active' | 'grid-edit-without-cursor' | 'grid-not-editing' | 'grid-target-unavailable' | 'id-code-unit-ceiling-exceeded' | 'idle-editable-has-draft' | 'ill-formed-id' | 'ill-formed-replacement' | 'ill-formed-text' | 'incompatible-display-unit' | 'incompatible-unit-dimensions' | 'incompatible-unit-system-preference' | 'incomplete-controlled-pagination' | 'inconsistent-composition-snapshot' | 'interaction-disabled' | 'interaction-read-only' | 'interactive-tty-required' | 'invalid-accordion-event' | 'invalid-accordion-open-set' | 'invalid-accordion-policy' | 'invalid-boundary' | 'invalid-calculator-expression' | 'invalid-calculator-number' | 'invalid-candidate-label' | 'invalid-canonical-quantity' | 'invalid-cascade-list-path' | 'invalid-cascade-select-open' | 'invalid-cascade-select-path' | 'invalid-checked-event' | 'invalid-checked-value' | 'invalid-column-count' | 'invalid-combobox-boundary' | 'invalid-combobox-event' | 'invalid-combobox-input-value' | 'invalid-combobox-policies' | 'invalid-count' | 'invalid-decimal' | 'invalid-decimal-rounding' | 'invalid-deselectable-policy' | 'invalid-dimension-exponent' | 'invalid-direction' | 'invalid-disabled-state' | 'invalid-drawer-open' | 'invalid-drawer-side' | 'invalid-drawer-swipe-threshold' | 'invalid-drawer-swipe-velocity-threshold' | 'invalid-editable-text' | 'invalid-eligibility-policy' | 'invalid-expected-revision' | 'invalid-filter-policy' | 'invalid-grid-boundary' | 'invalid-grid-edit-mode' | 'invalid-grid-movement' | 'invalid-id-type' | 'invalid-items-per-page' | 'invalid-linear-action-boundary' | 'invalid-linear-action-event' | 'invalid-linear-choice-boundary' | 'invalid-linear-choice-event' | 'invalid-linear-choice-selection' | 'invalid-listbox-boundary' | 'invalid-listbox-event' | 'invalid-listbox-selection' | 'invalid-machine-reducer' | 'invalid-max-cells' | 'invalid-max-code-units' | 'invalid-max-columns' | 'invalid-max-count' | 'invalid-max-decimal-code-units' | 'invalid-max-depth' | 'invalid-max-exponent' | 'invalid-max-id-code-units' | 'invalid-max-items' | 'invalid-max-operations' | 'invalid-max-rows' | 'invalid-max-scale' | 'invalid-max-tokens' | 'invalid-menu-open-path' | 'invalid-node' | 'invalid-number-evaluator' | 'invalid-number-field-evaluation' | 'invalid-number-field-maximum' | 'invalid-number-field-minimum' | 'invalid-number-field-text-event' | 'invalid-number-field-value' | 'invalid-number-literal' | 'invalid-open-event' | 'invalid-open-state' | 'invalid-pagination-event' | 'invalid-pagination-model' | 'invalid-pagination-show-controls' | 'invalid-pagination-show-edges' | 'invalid-pin-input-event' | 'invalid-pin-input-index' | 'invalid-pin-input-length' | 'invalid-pin-input-state' | 'invalid-pin-input-value' | 'invalid-popup-event' | 'invalid-popup-state' | 'invalid-precision' | 'invalid-quantity-input' | 'invalid-quantity-maximum' | 'invalid-quantity-minimum' | 'invalid-quantity-value' | 'invalid-read-only-state' | 'invalid-revision' | 'invalid-scan-ceiling' | 'invalid-select-open' | 'invalid-selection-cardinality' | 'invalid-selection-follows-focus' | 'invalid-selection-mode' | 'invalid-sibling-count' | 'invalid-slider-event' | 'invalid-slider-page' | 'invalid-spin-button-draft' | 'invalid-spin-button-input' | 'invalid-spin-button-value' | 'invalid-tabs-activation' | 'invalid-tags-input-current' | 'invalid-tags-input-draft' | 'invalid-tags-input-value' | 'invalid-text-composition' | 'invalid-text-event' | 'invalid-text-offset' | 'invalid-text-range' | 'invalid-text-selection' | 'invalid-text-snapshot' | 'invalid-text-state' | 'invalid-thumb-gap' | 'invalid-toggle-group-multiple' | 'invalid-total' | 'invalid-tree-grid-boundary' | 'invalid-tree-grid-edit-mode' | 'invalid-tree-grid-event' | 'invalid-tree-grid-selection' | 'invalid-tree-view-event' | 'invalid-tree-view-selection' | 'invalid-typeahead-normalizer' | 'invalid-typeahead-text-value' | 'invalid-typeahead-timeout' | 'invalid-unit-aliases' | 'invalid-unit-definition' | 'invalid-unit-dimension' | 'invalid-unit-exponent' | 'invalid-unit-expression' | 'invalid-unit-expression-factor' | 'invalid-unit-id' | 'invalid-unit-offset' | 'invalid-unit-registry' | 'invalid-unit-rounding' | 'invalid-unit-scale' | 'invalid-unit-symbol' | 'invalid-unit-system' | 'invalid-unit-system-preference' | 'invalid-unit-value' | 'inverted-bounds' | 'inverted-number-field-bounds' | 'inverted-quantity-bounds' | 'item-ceiling-exceeded' | 'layer-dismiss-policy-invalid' | 'layer-id-duplicate' | 'layer-id-missing' | 'layer-mode-invalid' | 'layer-parent-not-topmost' | 'layer-self-parent' | 'linear-action-cursor-outside-domain' | 'linear-action-target-unavailable' | 'linear-choice-anchor-outside-domain' | 'linear-choice-cursor-outside-domain' | 'linear-choice-selection-outside-domain' | 'linear-choice-target-unavailable' | 'listbox-anchor-outside-domain' | 'listbox-cursor-outside-domain' | 'listbox-selection-outside-domain' | 'listbox-target-unavailable' | 'max-tags-exceeded' | 'menu-closed' | 'menu-cursor-hidden' | 'menu-target-hidden' | 'meter-threshold-order-invalid' | 'meter-threshold-outside-range' | 'meter-value-outside-range' | 'meter-group-maximum-not-positive' | 'meter-group-total-exceeds-maximum' | 'meter-group-value-negative' | 'progress-maximum-not-positive' | 'progress-value-outside-range' | 'missing-candidate-label' | 'missing-parent' | 'missing-quantity-expression-result' | 'multi-thumb-cursor-outside-domain' | 'multi-thumb-target-unavailable' | 'no-candidate' | 'no-cursor' | 'non-positive-step' | 'not-controlled' | 'number-evaluator-threw' | 'number-field-composition-active' | 'number-field-value-above-maximum' | 'number-field-value-below-minimum' | 'number-field-value-required' | 'pagination-page-out-of-range' | 'pagination-sibling-ceiling-exceeded' | 'pin-input-value-rejected' | 'quantity-above-maximum' | 'quantity-below-minimum' | 'quantity-commit-during-composition' | 'reorder-id-missing' | 'reorder-tree-cycle' | 'reorder-tree-sibling-invalid' | 'required-quantity' | 'revision-ceiling-reached' | 'row-ceiling-exceeded' | 'scan-ceiling-reached' | 'selected-id-outside-domain' | 'selection-anchor-outside-domain' | 'sequence-patch-invalid' | 'self-parent' | 'slider-tick-outside-range' | 'slider-value-off-range' | 'spin-button-draft-invalid' | 'spin-button-value-outside-lattice' | 'stale-revision' | 'surrogate-boundary' | 'tags-input-index-outside-domain' | 'thumb-order-violation' | 'thumb-tick-outside-range' | 'thumb-value-count-mismatch' | 'timer-countdown-order-invalid' | 'timer-countup-order-invalid' | 'timer-elapsed-invalid' | 'timer-start-invalid' | 'timer-target-invalid' | 'timer-value-after-target' | 'timer-value-before-target' | 'timer-value-invalid' | 'toast-duration-invalid' | 'toast-elapsed-invalid' | 'toast-id-duplicate' | 'toast-id-missing' | 'toast-max-visible-invalid' | 'toast-title-empty' | 'tree-grid-anchor-outside-grid' | 'tree-grid-cursor-hidden' | 'tree-grid-edit-active' | 'tree-grid-edit-without-cursor' | 'tree-grid-not-editing' | 'tree-grid-row-count-mismatch' | 'tree-grid-row-outside-tree' | 'tree-grid-selection-outside-grid' | 'tree-grid-target-unavailable' | 'tree-view-anchor-outside-tree' | 'tree-view-cursor-hidden' | 'tree-view-selection-outside-tree' | 'tree-view-target-hidden' | 'tree-view-target-ineligible' | 'tree-view-target-outside-tree' | 'tty-input-already-owned' | 'tty-input-setup-failed' | 'typeahead-no-match' | 'uncontrolled-controller-sync' | 'uncontrolled-edit-mode-update' | 'uncontrolled-expanded-value-update' | 'uncontrolled-expanded-values-update' | 'uncontrolled-highlighted-value-update' | 'uncontrolled-input-state-update' | 'uncontrolled-open-update' | 'uncontrolled-value-update' | 'unexpected-calculator-token' | 'unexpected-pagination-success' | 'unexpected-valid-result' | 'unit-conversion-zero-scale' | 'unit-exponent-out-of-range' | 'unknown-canonical-unit' | 'unknown-display-unit' | 'unknown-unit' | 'unknown-unit-token' | 'unsupported-calculator-token' | 'unsupported-dom-key' | 'unsupported-dom-text-input' | 'unsupported-number-field-event' | 'unsupported-terminal-key' | 'unsupported-terminal-text-input';
1
+ export type CoreErrorCode = 'tree-select-match-outside-tree' | 'tree-select-duplicate-match' | 'tree-select-state-owner-mismatch' | 'tree-select-results-owner-mismatch' | 'tree-select-stale-results' | 'tree-select-search-pending' | 'tree-select-popup-closed' | 'tree-select-target-unselectable' | 'invalid-tree-select-query' | 'invalid-tree-select-event' | 'accordion-collapse-forbidden' | 'accordion-cursor-outside-domain' | 'accordion-open-item-required' | 'accordion-single-expansion' | 'accordion-target-unavailable' | 'affine-unit-in-compound-expression' | 'ambiguous-combobox-text' | 'ambiguous-unit-token' | 'calculator-closing-parenthesis-expected' | 'calculator-code-unit-ceiling-exceeded' | 'calculator-depth-ceiling-exceeded' | 'calculator-division-by-zero' | 'calculator-exponent-ceiling-exceeded' | 'calculator-fractional-exponent' | 'calculator-operand-expected' | 'calculator-operation-ceiling-exceeded' | 'calculator-result-ceiling-exceeded' | 'calculator-token-ceiling-exceeded' | 'cardinality-not-safe' | 'carousel-autoplay-delay-invalid' | 'carousel-cursor-outside-slides' | 'carousel-target-unavailable' | 'cascade-list-highlight-outside-tree' | 'cascade-list-leaf-in-path' | 'cascade-list-path-outside-tree' | 'cascade-list-target-disabled' | 'cascade-list-target-unavailable' | 'cascade-list-target-unselectable' | 'cascade-list-value-outside-tree' | 'cascade-select-highlight-outside-tree' | 'cascade-select-leaf-in-path' | 'cascade-select-path-outside-tree' | 'cascade-select-target-disabled' | 'cascade-select-target-unavailable' | 'cascade-select-target-unselectable' | 'cascade-select-value-outside-tree' | 'cell-ceiling-exceeded' | 'closed-menu-has-active-state' | 'collection-window-direction-invalid' | 'collection-window-generation-exhausted' | 'collection-window-generation-invalid' | 'collection-window-pending-invalid' | 'collection-window-range-invalid' | 'collection-window-request-generation-required' | 'collection-window-request-stale' | 'collection-window-revision-invalid' | 'collection-window-revision-stale' | 'collection-window-size-invalid' | 'collection-window-start-invalid' | 'collection-window-total-invalid' | 'color-alpha-disabled' | 'color-alpha-out-of-range' | 'color-area-out-of-range' | 'color-channel-invalid' | 'color-channel-out-of-range' | 'color-coordinate-invalid' | 'color-coordinate-out-of-range' | 'color-draft-invalid' | 'color-format-invalid' | 'color-hue-out-of-range' | 'color-out-of-gamut' | 'color-step-invalid' | 'color-text-invalid' | 'column-ceiling-exceeded' | 'column-count-too-small' | 'combobox-candidate-unavailable' | 'combobox-cursor-outside-domain' | 'composition-active' | 'composition-inactive' | 'connection-destroyed' | 'controlled-shape-mismatch' | 'controlled-edit-mode-required' | 'controlled-expanded-value-required' | 'controlled-expanded-values-required' | 'controlled-highlighted-value-required' | 'controlled-input-state-required' | 'controlled-open-required' | 'controlled-value-required' | 'count-ceiling-exceeded' | 'count-not-safe' | 'cycle' | 'decimal-code-unit-ceiling-exceeded' | 'decimal-scale-ceiling-exceeded' | 'depth-ceiling-exceeded' | 'disabled-item-outside-domain' | 'disconnected-menu-open-path' | 'duplicate-id' | 'duplicate-tag' | 'duplicate-tree-grid-row' | 'duplicate-unit-id' | 'duplicate-unit-system-dimension' | 'editable-empty-value' | 'editable-invalid-value' | 'editable-not-editing' | 'empty-calculator-expression' | 'empty-id' | 'empty-tag' | 'empty-unit-expression' | 'empty-unit-registry' | 'endpoint-off-lattice' | 'feed-cursor-outside-window' | 'feed-target-unavailable' | 'feed-window-size-mismatch' | 'grid-cursor-outside-grid' | 'grid-edit-active' | 'grid-edit-without-cursor' | 'grid-not-editing' | 'grid-target-unavailable' | 'id-code-unit-ceiling-exceeded' | 'idle-editable-has-draft' | 'ill-formed-id' | 'ill-formed-replacement' | 'ill-formed-text' | 'incompatible-display-unit' | 'incompatible-unit-dimensions' | 'incompatible-unit-system-preference' | 'incomplete-controlled-pagination' | 'inconsistent-composition-snapshot' | 'interaction-disabled' | 'interaction-read-only' | 'interactive-tty-required' | 'invalid-accordion-event' | 'invalid-accordion-open-set' | 'invalid-accordion-policy' | 'invalid-boundary' | 'invalid-calculator-expression' | 'invalid-calculator-number' | 'invalid-candidate-label' | 'invalid-canonical-quantity' | 'invalid-cascade-list-path' | 'invalid-cascade-select-open' | 'invalid-cascade-select-path' | 'invalid-checked-event' | 'invalid-checked-value' | 'invalid-column-count' | 'invalid-combobox-boundary' | 'invalid-combobox-event' | 'invalid-combobox-input-value' | 'invalid-combobox-policies' | 'invalid-count' | 'invalid-decimal' | 'invalid-decimal-rounding' | 'invalid-deselectable-policy' | 'invalid-dimension-exponent' | 'invalid-direction' | 'invalid-disabled-state' | 'invalid-drawer-open' | 'invalid-drawer-side' | 'invalid-drawer-swipe-threshold' | 'invalid-drawer-swipe-velocity-threshold' | 'invalid-editable-text' | 'invalid-eligibility-policy' | 'invalid-expected-revision' | 'invalid-filter-policy' | 'invalid-grid-boundary' | 'invalid-grid-edit-mode' | 'invalid-grid-movement' | 'invalid-id-type' | 'invalid-items-per-page' | 'invalid-json-data' | 'invalid-json-data-options' | 'invalid-json-text' | 'invalid-linear-action-boundary' | 'invalid-linear-action-event' | 'invalid-linear-choice-boundary' | 'invalid-linear-choice-event' | 'invalid-linear-choice-selection' | 'invalid-listbox-boundary' | 'invalid-listbox-event' | 'invalid-listbox-selection' | 'invalid-machine-reducer' | 'invalid-max-cells' | 'invalid-max-code-units' | 'invalid-max-columns' | 'invalid-max-count' | 'invalid-max-decimal-code-units' | 'invalid-max-depth' | 'invalid-max-exponent' | 'invalid-max-id-code-units' | 'invalid-max-items' | 'invalid-max-operations' | 'invalid-max-rows' | 'invalid-max-scale' | 'invalid-max-tokens' | 'invalid-menu-open-path' | 'invalid-node' | 'invalid-number-evaluator' | 'invalid-number-field-evaluation' | 'invalid-number-field-maximum' | 'invalid-number-field-minimum' | 'invalid-number-field-text-event' | 'invalid-number-field-value' | 'invalid-number-literal' | 'invalid-open-event' | 'invalid-open-state' | 'invalid-pagination-event' | 'invalid-pagination-model' | 'invalid-pagination-show-controls' | 'invalid-pagination-show-edges' | 'invalid-pin-input-event' | 'invalid-pin-input-index' | 'invalid-pin-input-length' | 'invalid-pin-input-state' | 'invalid-pin-input-value' | 'invalid-popup-event' | 'invalid-popup-state' | 'invalid-precision' | 'invalid-quantity-input' | 'invalid-quantity-maximum' | 'invalid-quantity-minimum' | 'invalid-quantity-value' | 'invalid-read-only-state' | 'invalid-revision' | 'invalid-scan-ceiling' | 'invalid-select-open' | 'invalid-selection-cardinality' | 'invalid-selection-follows-focus' | 'invalid-selection-mode' | 'invalid-sibling-count' | 'invalid-slider-event' | 'invalid-slider-page' | 'invalid-spin-button-draft' | 'invalid-spin-button-input' | 'invalid-spin-button-value' | 'invalid-tabs-activation' | 'invalid-tags-input-current' | 'invalid-tags-input-draft' | 'invalid-tags-input-value' | 'invalid-text-composition' | 'invalid-text-event' | 'invalid-text-offset' | 'invalid-text-query-options' | 'invalid-text-range' | 'invalid-text-selection' | 'invalid-text-snapshot' | 'invalid-text-state' | 'invalid-thumb-gap' | 'invalid-toggle-group-multiple' | 'invalid-total' | 'invalid-tree-grid-boundary' | 'invalid-tree-grid-edit-mode' | 'invalid-tree-grid-event' | 'invalid-tree-grid-selection' | 'invalid-tree-view-event' | 'invalid-tree-view-selection' | 'invalid-typeahead-normalizer' | 'invalid-typeahead-text-value' | 'invalid-typeahead-timeout' | 'invalid-unit-aliases' | 'invalid-unit-definition' | 'invalid-unit-dimension' | 'invalid-unit-exponent' | 'invalid-unit-expression' | 'invalid-unit-expression-factor' | 'invalid-unit-id' | 'invalid-unit-offset' | 'invalid-unit-registry' | 'invalid-unit-rounding' | 'invalid-unit-scale' | 'invalid-unit-symbol' | 'invalid-unit-system' | 'invalid-unit-system-preference' | 'invalid-unit-value' | 'inverted-bounds' | 'inverted-number-field-bounds' | 'inverted-quantity-bounds' | 'item-ceiling-exceeded' | 'layer-dismiss-policy-invalid' | 'json-data-limit-exceeded' | 'layer-id-duplicate' | 'layer-id-missing' | 'layer-mode-invalid' | 'layer-parent-cycle' | 'layer-parent-missing' | 'layer-parent-not-topmost' | 'layer-presentation-counter-exhausted' | 'layer-presentation-generation-invalid' | 'layer-presentation-generation-stale' | 'layer-presentation-state-invalid' | 'layer-self-parent' | 'linear-action-cursor-outside-domain' | 'linear-action-target-unavailable' | 'linear-choice-anchor-outside-domain' | 'linear-choice-cursor-outside-domain' | 'linear-choice-selection-outside-domain' | 'linear-choice-target-unavailable' | 'listbox-anchor-outside-domain' | 'listbox-cursor-outside-domain' | 'listbox-selection-outside-domain' | 'listbox-target-unavailable' | 'max-tags-exceeded' | 'menu-closed' | 'menu-cursor-hidden' | 'menu-target-hidden' | 'meter-threshold-order-invalid' | 'meter-threshold-outside-range' | 'meter-value-outside-range' | 'meter-group-maximum-not-positive' | 'meter-group-total-exceeds-maximum' | 'meter-group-value-negative' | 'progress-maximum-not-positive' | 'progress-value-outside-range' | 'missing-candidate-label' | 'missing-parent' | 'missing-quantity-expression-result' | 'multi-thumb-cursor-outside-domain' | 'multi-thumb-target-unavailable' | 'no-candidate' | 'no-cursor' | 'non-positive-step' | 'not-controlled' | 'number-evaluator-threw' | 'number-field-composition-active' | 'number-field-value-above-maximum' | 'number-field-value-below-minimum' | 'number-field-value-required' | 'pagination-page-out-of-range' | 'pagination-sibling-ceiling-exceeded' | 'pin-input-value-rejected' | 'quantity-above-maximum' | 'quantity-below-minimum' | 'quantity-commit-during-composition' | 'reorder-id-missing' | 'reorder-tree-cycle' | 'reorder-tree-sibling-invalid' | 'reorder-tree-ids-duplicate' | 'reorder-tree-move-overlap' | 'reorder-tree-depth-exceeded' | 'reorder-tree-move-rejected' | 'reorder-tree-capacity-exceeded' | 'invalid-transfer-event' | 'transfer-bucket-invalid' | 'transfer-capacity-exceeded' | 'transfer-item-outside-source' | 'transfer-state-owner-mismatch' | 'transfer-target-unavailable' | 'required-quantity' | 'revision-ceiling-reached' | 'row-ceiling-exceeded' | 'scan-ceiling-reached' | 'selected-id-outside-domain' | 'selection-anchor-outside-domain' | 'sequence-patch-invalid' | 'self-parent' | 'slider-tick-outside-range' | 'slider-value-off-range' | 'spin-button-draft-invalid' | 'spin-button-value-outside-lattice' | 'stale-revision' | 'surrogate-boundary' | 'tags-input-index-outside-domain' | 'thumb-order-violation' | 'thumb-tick-outside-range' | 'thumb-value-count-mismatch' | 'timer-countdown-order-invalid' | 'timer-countup-order-invalid' | 'timer-elapsed-invalid' | 'timer-start-invalid' | 'timer-target-invalid' | 'timer-value-after-target' | 'timer-value-before-target' | 'timer-value-invalid' | 'toast-duration-invalid' | 'toast-elapsed-invalid' | 'toast-id-duplicate' | 'toast-id-missing' | 'toast-max-visible-invalid' | 'toast-title-empty' | 'tree-grid-anchor-outside-grid' | 'tree-grid-cursor-hidden' | 'tree-grid-edit-active' | 'tree-grid-edit-without-cursor' | 'tree-grid-not-editing' | 'tree-grid-row-count-mismatch' | 'tree-grid-row-outside-tree' | 'tree-grid-selection-outside-grid' | 'tree-grid-target-unavailable' | 'tree-selection-disabled-outside-tree' | 'tree-selection-owner-mismatch' | 'tree-selection-reentrant' | 'tree-selection-stale' | 'tree-selection-target-disabled' | 'tree-selection-target-outside-tree' | 'tree-view-anchor-outside-tree' | 'tree-view-cursor-hidden' | 'tree-view-selection-outside-tree' | 'tree-view-target-hidden' | 'tree-view-target-ineligible' | 'tree-view-target-outside-tree' | 'tty-input-already-owned' | 'tty-input-setup-failed' | 'typeahead-no-match' | 'uncontrolled-controller-sync' | 'uncontrolled-edit-mode-update' | 'uncontrolled-expanded-value-update' | 'uncontrolled-expanded-values-update' | 'uncontrolled-highlighted-value-update' | 'uncontrolled-input-state-update' | 'uncontrolled-open-update' | 'uncontrolled-value-update' | 'unexpected-calculator-token' | 'unexpected-pagination-success' | 'unexpected-valid-result' | 'unit-conversion-zero-scale' | 'unit-exponent-out-of-range' | 'unknown-canonical-unit' | 'unknown-display-unit' | 'unknown-unit' | 'unknown-unit-token' | 'unsupported-calculator-token' | 'unsupported-dom-key' | 'unsupported-dom-text-input' | 'unsupported-json-data-key' | 'unsupported-number-field-event' | 'unsupported-terminal-key' | 'unsupported-terminal-text-input';
@@ -1,5 +1,5 @@
1
1
  import type { Result } from './shared.js';
2
- export type InteractionIntent = 'navigate' | 'mutate';
2
+ export type InteractionIntent = 'navigate' | 'mutate' | 'configure';
3
3
  export interface InteractionStateInput {
4
4
  readonly disabled?: boolean;
5
5
  readonly readOnly?: boolean;
@@ -1,2 +1,2 @@
1
- import{unwrap}from"./result.js";function createInteractionState(input={}){return unwrap(tryCreateInteractionState(input))}function tryCreateInteractionState(input={}){if(input.disabled!==void 0&&typeof input.disabled!=="boolean"){return failure("construction","invalid-disabled-state","disabled must be boolean.")}if(input.readOnly!==void 0&&typeof input.readOnly!=="boolean"){return failure("construction","invalid-read-only-state","readOnly must be boolean.")}return{ok:true,value:Object.freeze({disabled:input.disabled??false,readOnly:input.readOnly??false})}}function permitsInteraction(state,intent){return!state.disabled&&(intent==="navigate"||!state.readOnly)}function requireInteraction(state,intent){if(state.disabled){return failure("transition-rejection","interaction-disabled","Disabled controls reject user interaction.")}if(state.readOnly&&intent==="mutate"){return failure("transition-rejection","interaction-read-only","Read-only controls reject value mutation.")}return{ok:true,value:true}}function failure(errorClass,code,message){return{ok:false,error:{class:errorClass,code,message}}}export{createInteractionState,permitsInteraction,requireInteraction,tryCreateInteractionState};
1
+ import{unwrap}from"./result.js";function createInteractionState(input={}){return unwrap(tryCreateInteractionState(input))}function tryCreateInteractionState(input={}){if(input.disabled!==void 0&&typeof input.disabled!=="boolean"){return failure("construction","invalid-disabled-state","disabled must be boolean.")}if(input.readOnly!==void 0&&typeof input.readOnly!=="boolean"){return failure("construction","invalid-read-only-state","readOnly must be boolean.")}return{ok:true,value:Object.freeze({disabled:input.disabled??false,readOnly:input.readOnly??false})}}function permitsInteraction(state,intent){return intent==="configure"||!state.disabled&&(intent==="navigate"||!state.readOnly)}function requireInteraction(state,intent){if(intent==="configure")return{ok:true,value:true};if(state.disabled){return failure("transition-rejection","interaction-disabled","Disabled controls reject user interaction.")}if(state.readOnly&&intent==="mutate"){return failure("transition-rejection","interaction-read-only","Read-only controls reject value mutation.")}return{ok:true,value:true}}function failure(errorClass,code,message){return{ok:false,error:{class:errorClass,code,message}}}export{createInteractionState,permitsInteraction,requireInteraction,tryCreateInteractionState};
2
2
  //# sourceMappingURL=interaction.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/interaction.ts"],"mappings":"AAAA,OAAS,WAAc,cAqBjB,SAAU,uBACd,MAA+B,CAAA,EAAE,CAEjC,OAAO,OAAO,0BAA0B,KAAK,CAAC,CAChD,CAEM,SAAU,0BACd,MAA+B,CAAA,EAAE,CAEjC,GAAI,MAAM,WAAa,QAAa,OAAO,MAAM,WAAa,UAAW,CACvE,OAAO,QAAQ,eAAgB,yBAA0B,2BAA2B,CACtF,CACA,GAAI,MAAM,WAAa,QAAa,OAAO,MAAM,WAAa,UAAW,CACvE,OAAO,QAAQ,eAAgB,0BAA2B,2BAA2B,CACvF,CACA,MAAO,CACL,GAAI,KACJ,MAAO,OAAO,OAAO,CACnB,SAAU,MAAM,UAAY,MAC5B,SAAU,MAAM,UAAY,MAC7B,EAEL,CAEM,SAAU,mBACd,MACA,OAAyB,CAEzB,MAAO,CAAC,MAAM,WAAa,SAAW,YAAc,CAAC,MAAM,SAC7D,CAEM,SAAU,mBACd,MACA,OAAyB,CAEzB,GAAI,MAAM,SAAU,CAClB,OAAO,QACL,uBACA,uBACA,4CAA4C,CAEhD,CACA,GAAI,MAAM,UAAY,SAAW,SAAU,CACzC,OAAO,QACL,uBACA,wBACA,2CAA2C,CAE/C,CACA,MAAO,CAAE,GAAI,KAAM,MAAO,IAAI,CAChC,CAEA,SAAS,QACP,WACA,KACA,QAAe,CAEf,MAAO,CACL,GAAI,MACJ,MAAO,CACL,MAAO,WACP,KACA,SAGN","names":[],"file":"interaction.js"}
1
+ {"version":3,"sources":["../src/interaction.ts"],"mappings":"AAAA,OAAS,WAAc,cAqBjB,SAAU,uBACd,MAA+B,CAAA,EAAE,CAEjC,OAAO,OAAO,0BAA0B,KAAK,CAAC,CAChD,CAEM,SAAU,0BACd,MAA+B,CAAA,EAAE,CAEjC,GAAI,MAAM,WAAa,QAAa,OAAO,MAAM,WAAa,UAAW,CACvE,OAAO,QAAQ,eAAgB,yBAA0B,2BAA2B,CACtF,CACA,GAAI,MAAM,WAAa,QAAa,OAAO,MAAM,WAAa,UAAW,CACvE,OAAO,QAAQ,eAAgB,0BAA2B,2BAA2B,CACvF,CACA,MAAO,CACL,GAAI,KACJ,MAAO,OAAO,OAAO,CACnB,SAAU,MAAM,UAAY,MAC5B,SAAU,MAAM,UAAY,MAC7B,EAEL,CAEM,SAAU,mBACd,MACA,OAAyB,CAEzB,OAAO,SAAW,aAAgB,CAAC,MAAM,WAAa,SAAW,YAAc,CAAC,MAAM,SACxF,CAEM,SAAU,mBACd,MACA,OAAyB,CAEzB,GAAI,SAAW,YAAa,MAAO,CAAE,GAAI,KAAM,MAAO,IAAI,EAC1D,GAAI,MAAM,SAAU,CAClB,OAAO,QACL,uBACA,uBACA,4CAA4C,CAEhD,CACA,GAAI,MAAM,UAAY,SAAW,SAAU,CACzC,OAAO,QACL,uBACA,wBACA,2CAA2C,CAE/C,CACA,MAAO,CAAE,GAAI,KAAM,MAAO,IAAI,CAChC,CAEA,SAAS,QACP,WACA,KACA,QAAe,CAEf,MAAO,CACL,GAAI,MACJ,MAAO,CACL,MAAO,WACP,KACA,SAGN","names":[],"file":"interaction.js"}
@@ -29,6 +29,8 @@ export interface ComboboxStateInput<ID extends StableID = StableID> extends Sele
29
29
  }
30
30
  export interface ComboboxPolicies<ID extends StableID = StableID> {
31
31
  readonly matches?: (label: string, query: string, id: ID) => boolean;
32
+ /** Candidate participation, independent of whether a matching row is visible. */
33
+ readonly eligible?: (id: ID) => boolean;
32
34
  readonly boundary?: BoundaryPolicy;
33
35
  }
34
36
  export interface ComboboxUpdate<ID extends StableID = StableID> {
@@ -1,2 +1,2 @@
1
- import{applyTextEvent,createTextEditingState,isWellFormedPlainText,normalizeTextEditingState,tryCreateTextEditingState}from"../editing/text.js";import{bindCanonicalState,fail,hasCanonicalState,ok}from"../kernel/foundation.js";import{findEligibleFromEdge}from"../kernel/indexed-sequence.js";import{createMachineUpdate}from"../kernel/machine.js";import{unwrap}from"../../result.js";import{createCursorState}from"../state/cursor.js";import{createSelectionState,selectOne}from"../state/selection.js";function createComboboxState(domain,text,input={}){return unwrap(tryCreateComboboxState(domain,text,input))}function tryCreateComboboxState(domain,text,input={}){const normalizedText=normalizeTextEditingState(text);if(!normalizedText.ok)return normalizedText;const current=input.current??null;if(current!==null&&!domain.contains(current)){return fail("construction","combobox-cursor-outside-domain","Combobox cursor must exist in the candidate domain.",{current})}const popupOpen=input.popupOpen??false;if(typeof popupOpen!=="boolean"){return fail("construction","invalid-popup-state","Combobox popupOpen must be boolean.")}const selection=createSelectionState(domain,"single",input);if(!selection.ok)return selection;return ok(comboboxState(domain,normalizedText.value,popupOpen,createCursorState(current),selection.value))}function applyComboboxEvent(domain,labels,state,event,policies={}){const policyValidation=validatePolicies(policies);if(!policyValidation.ok)return policyValidation;const stateValidation=validateComboboxState(domain,state);if(stateValidation!==null)return stateValidation;const current=state;if(isTextEvent(event)){return editComboboxText(domain,labels,current,event.event,policies)}if(isDirectAcceptEvent(event)){const eligible=resolveEligible(domain,labels,committedQuery(current.text),policies.matches);if(!eligible.ok)return eligible;if(!eligible.value.has(event.id)){return fail("transition-rejection","combobox-candidate-unavailable","Direct combobox acceptance requires a matching candidate.",{id:event.id})}return acceptComboboxCandidate(domain,labels,comboboxState(domain,current.text,current.popupOpen,createCursorState(event.id),current.selection))}if(!isComboboxEvent(event)){return fail("transition-rejection","invalid-combobox-event","Combobox event must be text, navigation, popup, or acceptance.",{event})}switch(event){case"next":return moveCombobox(domain,labels,current,1,policies);case"previous":return moveCombobox(domain,labels,current,-1,policies);case"close":return createMachineUpdate(comboboxState(domain,current.text,false,current.cursor,current.selection));case"accept":return acceptComboboxCandidate(domain,labels,current)}}function acceptComboboxCandidate(domain,labels,state){const stateValidation=validateComboboxState(domain,state);if(stateValidation!==null)return stateValidation;const current=state.cursor.current;if(current===null||!domain.contains(current)){return fail("transition-rejection","no-candidate","Combobox acceptance requires a current candidate.")}if(state.text.composition!==null){return fail("transition-rejection","composition-active","Combobox acceptance requires composition to be committed or cancelled first.")}const label=labels.get(current);if(label===void 0){return fail("transition-rejection","missing-candidate-label","Combobox candidate must have a label.",{current})}if(!isWellFormedPlainText(label)){return fail("transition-rejection","invalid-candidate-label","Combobox candidate label must be well-formed plain text.",{current})}const text=tryCreateTextEditingState(label,{anchorCodeUnitOffset:label.length,focusCodeUnitOffset:label.length});if(!text.ok)return text;const selection=selectOne(state.selection,current,domain);const next=comboboxState(domain,text.value,false,state.cursor,selection);return createMachineUpdate(next,[{type:"accept",id:current}])}function editComboboxText(domain,labels,state,event,policies){const edited=applyTextEvent(state.text,event);if(!edited.ok)return edited;const previousQuery=committedQuery(state.text);const nextQuery=committedQuery(edited.value.state);const eligible=resolveEligible(domain,labels,nextQuery,policies.matches);if(!eligible.ok)return eligible;let current=state.cursor.current;if(previousQuery!==nextQuery||current===null||!eligible.value.has(current)){const first=findEligibleFromEdge(domain,1,{eligible:id=>eligible.value.has(id)});if(!first.ok)return first;current=first.value}const next=comboboxState(domain,edited.value.state,true,createCursorState(current),state.selection);return createMachineUpdate(next,current!==null&&current!==state.cursor.current?[{type:"focus",id:current}]:[])}function moveCombobox(domain,labels,state,direction,policies){const eligible=resolveEligible(domain,labels,committedQuery(state.text),policies.matches);if(!eligible.ok)return eligible;const options={eligible:id=>eligible.value.has(id)};const currentEligible=state.cursor.current!==null&&eligible.value.has(state.cursor.current);let target;if(!currentEligible){const first=findEligibleFromEdge(domain,direction,options);if(!first.ok)return first;target=first.value}else{const movement=domain.move(state.cursor.current,direction,policies.boundary??"stop",options);if(movement.kind==="resource-rejected")return{ok:false,error:movement.error};target=movement.kind==="found"?movement.id:state.cursor.current}return updateCursor(domain,state,target)}function updateCursor(domain,state,current){const next=comboboxState(domain,state.text,true,current===state.cursor.current?state.cursor:createCursorState(current),state.selection);return createMachineUpdate(next,current!==null&&current!==state.cursor.current?[{type:"focus",id:current}]:[])}function resolveEligible(domain,labels,query,matches){if(matches===void 0)return ok(new Set(domain.ids));const eligible=new Set;for(const id of domain.ids){const label=labels.get(id);if(label===void 0){return fail("transition-rejection","missing-candidate-label","Every filtered combobox candidate must have a label.",{id})}if(!isWellFormedPlainText(label)){return fail("transition-rejection","invalid-candidate-label","Every filtered combobox candidate label must be well-formed plain text.",{id})}if(matches(label,query,id))eligible.add(id)}return ok(eligible)}function validatePolicies(policies){if(!isObject(policies)){return fail("transition-rejection","invalid-combobox-policies","Combobox policies must be an object.")}if(policies.matches!==void 0&&typeof policies.matches!=="function"){return fail("transition-rejection","invalid-filter-policy","Combobox matches policy must be a function.")}const boundary=policies.boundary??"stop";if(boundary!=="stop"&&boundary!=="wrap"){return fail("transition-rejection","invalid-combobox-boundary","Combobox boundary must be stop or wrap.",{boundary})}return ok(true)}function committedQuery(text){return text.composition===null?text.snapshot.text:text.composition.baseline.text}function comboboxState(domain,text,popupOpen,cursor,selection){return bindCanonicalState(domain,Object.freeze({text,popupOpen,cursor,selection}))}function validateComboboxState(domain,state){if(hasCanonicalState(domain,state))return null;const validation=tryCreateComboboxState(domain,state.text,{current:state.cursor.current,selected:state.selection.selected,anchor:state.selection.anchor,popupOpen:state.popupOpen});return validation.ok?null:{ok:false,error:{...validation.error,class:"transition-rejection"}}}function isTextEvent(event){return isObject(event)&&event.type==="text"}function isDirectAcceptEvent(event){return isObject(event)&&event.type==="accept"}function isComboboxEvent(event){return event==="next"||event==="previous"||event==="close"||event==="accept"}function isObject(value){return typeof value==="object"&&value!==null}export{acceptComboboxCandidate,applyComboboxEvent,createComboboxState,tryCreateComboboxState};
1
+ import{applyTextEvent,createTextEditingState,isWellFormedPlainText,normalizeTextEditingState,tryCreateTextEditingState}from"../editing/text.js";import{bindCanonicalState,fail,hasCanonicalState,ok}from"../kernel/foundation.js";import{findEligibleFromEdge}from"../kernel/indexed-sequence.js";import{createMachineUpdate}from"../kernel/machine.js";import{unwrap}from"../../result.js";import{createCursorState}from"../state/cursor.js";import{createSelectionState,selectOne}from"../state/selection.js";function createComboboxState(domain,text,input={}){return unwrap(tryCreateComboboxState(domain,text,input))}function tryCreateComboboxState(domain,text,input={}){const normalizedText=normalizeTextEditingState(text);if(!normalizedText.ok)return normalizedText;const current=input.current??null;if(current!==null&&!domain.contains(current)){return fail("construction","combobox-cursor-outside-domain","Combobox cursor must exist in the candidate domain.",{current})}const popupOpen=input.popupOpen??false;if(typeof popupOpen!=="boolean"){return fail("construction","invalid-popup-state","Combobox popupOpen must be boolean.")}const selection=createSelectionState(domain,"single",input);if(!selection.ok)return selection;return ok(comboboxState(domain,normalizedText.value,popupOpen,createCursorState(current),selection.value))}function applyComboboxEvent(domain,labels,state,event,policies={}){const policyValidation=validatePolicies(policies);if(!policyValidation.ok)return policyValidation;const stateValidation=validateComboboxState(domain,state);if(stateValidation!==null)return stateValidation;const current=state;if(isTextEvent(event)){return editComboboxText(domain,labels,current,event.event,policies)}if(isDirectAcceptEvent(event)){const eligible=resolveEligible(domain,labels,committedQuery(current.text),policies.matches,policies.eligible);if(!eligible.ok)return eligible;if(!eligible.value.has(event.id)){return fail("transition-rejection","combobox-candidate-unavailable","Direct combobox acceptance requires a matching candidate.",{id:event.id})}return acceptComboboxCandidate(domain,labels,comboboxState(domain,current.text,current.popupOpen,createCursorState(event.id),current.selection))}if(!isComboboxEvent(event)){return fail("transition-rejection","invalid-combobox-event","Combobox event must be text, navigation, popup, or acceptance.",{event})}switch(event){case"next":return moveCombobox(domain,labels,current,1,policies);case"previous":return moveCombobox(domain,labels,current,-1,policies);case"close":return createMachineUpdate(comboboxState(domain,current.text,false,current.cursor,current.selection));case"accept":if(current.text.composition===null&&current.cursor.current!==null&&policies.eligible?.(current.cursor.current)===false){return fail("transition-rejection","combobox-candidate-unavailable","Combobox acceptance requires an eligible candidate.",{id:current.cursor.current})}return acceptComboboxCandidate(domain,labels,current)}}function acceptComboboxCandidate(domain,labels,state){const stateValidation=validateComboboxState(domain,state);if(stateValidation!==null)return stateValidation;const current=state.cursor.current;if(current===null||!domain.contains(current)){return fail("transition-rejection","no-candidate","Combobox acceptance requires a current candidate.")}if(state.text.composition!==null){return fail("transition-rejection","composition-active","Combobox acceptance requires composition to be committed or cancelled first.")}const label=labels.get(current);if(label===void 0){return fail("transition-rejection","missing-candidate-label","Combobox candidate must have a label.",{current})}if(!isWellFormedPlainText(label)){return fail("transition-rejection","invalid-candidate-label","Combobox candidate label must be well-formed plain text.",{current})}const text=tryCreateTextEditingState(label,{anchorCodeUnitOffset:label.length,focusCodeUnitOffset:label.length});if(!text.ok)return text;const selection=selectOne(state.selection,current,domain);const next=comboboxState(domain,text.value,false,state.cursor,selection);return createMachineUpdate(next,[{type:"accept",id:current}])}function editComboboxText(domain,labels,state,event,policies){const edited=applyTextEvent(state.text,event);if(!edited.ok)return edited;if(event.type==="select"){return createMachineUpdate(edited.value.state===state.text?state:comboboxState(domain,edited.value.state,state.popupOpen,state.cursor,state.selection))}const previousQuery=committedQuery(state.text);const nextQuery=committedQuery(edited.value.state);const eligible=resolveEligible(domain,labels,nextQuery,policies.matches,policies.eligible);if(!eligible.ok)return eligible;let current=state.cursor.current;if(previousQuery!==nextQuery||current===null||!eligible.value.has(current)){const first=findEligibleFromEdge(domain,1,{eligible:id=>eligible.value.has(id)});if(!first.ok)return first;current=first.value}const next=comboboxState(domain,edited.value.state,true,createCursorState(current),state.selection);return createMachineUpdate(next,current!==null&&current!==state.cursor.current?[{type:"focus",id:current}]:[])}function moveCombobox(domain,labels,state,direction,policies){const eligible=resolveEligible(domain,labels,committedQuery(state.text),policies.matches,policies.eligible);if(!eligible.ok)return eligible;const options={eligible:id=>eligible.value.has(id)};const currentEligible=state.cursor.current!==null&&eligible.value.has(state.cursor.current);let target;if(!currentEligible){const first=findEligibleFromEdge(domain,direction,options);if(!first.ok)return first;target=first.value}else{const movement=domain.move(state.cursor.current,direction,policies.boundary??"stop",options);if(movement.kind==="resource-rejected")return{ok:false,error:movement.error};target=movement.kind==="found"?movement.id:state.cursor.current}return updateCursor(domain,state,target)}function updateCursor(domain,state,current){const next=comboboxState(domain,state.text,true,current===state.cursor.current?state.cursor:createCursorState(current),state.selection);return createMachineUpdate(next,current!==null&&current!==state.cursor.current?[{type:"focus",id:current}]:[])}function resolveEligible(domain,labels,query,matches,participates){if(matches===void 0&&participates===void 0)return ok(new Set(domain.ids));const eligible=new Set;for(const id of domain.ids){if(participates?.(id)===false)continue;if(matches===void 0){eligible.add(id);continue}const label=labels.get(id);if(label===void 0){return fail("transition-rejection","missing-candidate-label","Every filtered combobox candidate must have a label.",{id})}if(!isWellFormedPlainText(label)){return fail("transition-rejection","invalid-candidate-label","Every filtered combobox candidate label must be well-formed plain text.",{id})}if(matches(label,query,id))eligible.add(id)}return ok(eligible)}function validatePolicies(policies){if(!isObject(policies)){return fail("transition-rejection","invalid-combobox-policies","Combobox policies must be an object.")}if(policies.matches!==void 0&&typeof policies.matches!=="function"){return fail("transition-rejection","invalid-filter-policy","Combobox matches policy must be a function.")}if(policies.eligible!==void 0&&typeof policies.eligible!=="function"){return fail("transition-rejection","invalid-combobox-policies","Combobox eligible policy must be a function.")}const boundary=policies.boundary??"stop";if(boundary!=="stop"&&boundary!=="wrap"){return fail("transition-rejection","invalid-combobox-boundary","Combobox boundary must be stop or wrap.",{boundary})}return ok(true)}function committedQuery(text){return text.composition===null?text.snapshot.text:text.composition.baseline.text}function comboboxState(domain,text,popupOpen,cursor,selection){return bindCanonicalState(domain,Object.freeze({text,popupOpen,cursor,selection}))}function validateComboboxState(domain,state){if(hasCanonicalState(domain,state))return null;const validation=tryCreateComboboxState(domain,state.text,{current:state.cursor.current,selected:state.selection.selected,anchor:state.selection.anchor,popupOpen:state.popupOpen});return validation.ok?null:{ok:false,error:{...validation.error,class:"transition-rejection"}}}function isTextEvent(event){return isObject(event)&&event.type==="text"}function isDirectAcceptEvent(event){return isObject(event)&&event.type==="accept"}function isComboboxEvent(event){return event==="next"||event==="previous"||event==="close"||event==="accept"}function isObject(value){return typeof value==="object"&&value!==null}export{acceptComboboxCandidate,applyComboboxEvent,createComboboxState,tryCreateComboboxState};
2
2
  //# sourceMappingURL=combobox.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/internal/composites/combobox.ts"],"mappings":"AAEA,OACE,eACA,uBACA,sBACA,0BAGA,8BACK,qBACP,OAAS,mBAAoB,KAAM,kBAAmB,OAAU,0BAChE,OAAS,yBAA4B,gCACrC,OAAS,wBAA2B,uBACpC,OAAS,WAAc,kBACvB,OAAS,sBAA2C,qBACpD,OACE,qBACA,cAGK,wBAqCD,SAAU,oBACd,OACA,KACA,MAAgC,CAAA,EAAE,CAElC,OAAO,OAAO,uBAAuB,OAAQ,KAAM,KAAK,CAAC,CAC3D,CAEM,SAAU,uBACd,OACA,KACA,MAAgC,CAAA,EAAE,CAElC,MAAM,eAAiB,0BAA0B,IAAI,EACrD,GAAI,CAAC,eAAe,GAAI,OAAO,eAC/B,MAAM,QAAU,MAAM,SAAW,KACjC,GAAI,UAAY,MAAQ,CAAC,OAAO,SAAS,OAAO,EAAG,CACjD,OAAO,KACL,eACA,iCACA,sDACA,CAAE,OAAO,CAAE,CAEf,CACA,MAAM,UAAY,MAAM,WAAa,MACrC,GAAI,OAAO,YAAc,UAAW,CAClC,OAAO,KAAK,eAAgB,sBAAuB,qCAAqC,CAC1F,CACA,MAAM,UAAY,qBAAqB,OAAQ,SAAU,KAAK,EAC9D,GAAI,CAAC,UAAU,GAAI,OAAO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Q,KAAK,EAAG,OAAO,KAC7C,MAAM,WAAa,uBAAuB,OAAQ,MAAM,KAAM,CAC5D,QAAS,MAAM,OAAO,QACtB,SAAU,MAAM,UAAU,SAC1B,OAAQ,MAAM,UAAU,OACxB,UAAW,MAAM,UAClB,EACD,OAAO,WAAW,GAAK,KAAO,CAAE,GAAI,MAAO,MAAO,CAAE,GAAG,WAAW,MAAO,MAAO,sBAAsB,CAAE,CAC1G,CAEA,SAAS,YACP,MAAwB,CAExB,OAAO,SAAS,KAAK,GAAK,MAAM,OAAS,MAC3C,CAEA,SAAS,oBACP,MAAwB,CAExB,OAAO,SAAS,KAAK,GAAK,MAAM,OAAS,QAC3C,CAEA,SAAS,gBACP,MAAwB,CAExB,OAAO,QAAU,QACZ,QAAU,YACV,QAAU,SACV,QAAU,QACjB,CAEA,SAAS,SAAS,MAAc,CAC9B,OAAO,OAAO,QAAU,UAAY,QAAU,IAChD","names":[],"file":"combobox.js"}
1
+ {"version":3,"sources":["../../../src/internal/composites/combobox.ts"],"mappings":"AAEA,OACE,eACA,uBACA,sBACA,0BAGA,8BACK,qBACP,OAAS,mBAAoB,KAAM,kBAAmB,OAAU,0BAChE,OAAS,yBAA4B,gCACrC,OAAS,wBAA2B,uBACpC,OAAS,WAAc,kBACvB,OAAS,sBAA2C,qBACpD,OACE,qBACA,cAGK,wBAuCD,SAAU,oBACd,OACA,KACA,MAAgC,CAAA,EAAE,CAElC,OAAO,OAAO,uBAAuB,OAAQ,KAAM,KAAK,CAAC,CAC3D,CAEM,SAAU,uBACd,OACA,KACA,MAAgC,CAAA,EAAE,CAElC,MAAM,eAAiB,0BAA0B,IAAI,EACrD,GAAI,CAAC,eAAe,GAAI,OAAO,eAC/B,MAAM,QAAU,MAAM,SAAW,KACjC,GAAI,UAAY,MAAQ,CAAC,OAAO,SAAS,OAAO,EAAG,CACjD,OAAO,KACL,eACA,iCACA,sDACA,CAAE,OAAO,CAAE,CAEf,CACA,MAAM,UAAY,MAAM,WAAa,MACrC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OAAO,QAAU,QACZ,QAAU,YACV,QAAU,SACV,QAAU,QACjB,CAEA,SAAS,SAAS,MAAc,CAC9B,OAAO,OAAO,QAAU,UAAY,QAAU,IAChD","names":[],"file":"combobox.js"}
@@ -42,6 +42,8 @@ export interface ListboxUpdate<ID extends StableID = StableID> {
42
42
  }
43
43
  export declare function createListboxState<ID extends StableID>(domain: Sequence<ID>, input?: ListboxStateInput<ID>, selectionMode?: SelectionMode): ListboxState<ID>;
44
44
  export declare function tryCreateListboxState<ID extends StableID>(domain: Sequence<ID>, input?: ListboxStateInput<ID>, selectionMode?: SelectionMode): Result<ListboxState<ID>>;
45
+ /** Owner-local domain replacement; intentional null cursors do not request focus. */
46
+ export declare function rebaseListboxState<ID extends StableID>(domain: Sequence<ID>, state: ListboxState<ID>, selectionMode: SelectionMode, policies?: Pick<ListboxPolicies<ID>, 'eligible' | 'maxScan'>): Result<ListboxState<ID>>;
45
47
  export declare function applyListboxEvent<ID extends StableID>(domain: Sequence<ID>, state: ListboxState<ID>, event: ListboxEvent<ID>, policies?: ListboxPolicies<ID>): Result<ListboxUpdate<ID>>;
46
48
  export interface ListboxTypeaheadOptions<ID extends StableID = StableID> {
47
49
  readonly textValue: (id: ID) => string;