@wordpress/components
Version:
UI components for WordPress.
1 lines • 19 kB
Source Map (JSON)
{"version":3,"file":"index.mjs","names":["richTextPrivateApis"],"sources":["../../src/autocomplete/index.tsx"],"sourcesContent":["import {\n\trenderToString,\n\tuseEffect,\n\tuseMemo,\n\tuseReducer,\n\tuseRef,\n} from '@wordpress/element';\nimport {\n\tuseEvent,\n\tuseInstanceId,\n\tuseMergeRefs,\n\tuseRefEffect,\n} from '@wordpress/compose';\nimport {\n\tcreate,\n\tslice,\n\tinsert,\n\tisCollapsed,\n\tgetTextContent,\n\tprivateApis as richTextPrivateApis,\n} from '@wordpress/rich-text';\nimport { speak } from '@wordpress/a11y';\nimport { isAppleOS, withIgnoreIMEEvents } from '@wordpress/keycodes';\nimport type { RichTextValue } from '@wordpress/rich-text';\nimport { AutocompleterUI } from './autocompleter-ui';\nimport { getAutocompleteMatch } from './get-autocomplete-match';\nimport type {\n\tAutocompleteAction,\n\tAutocompleteProps,\n\tAutocompleteState,\n\tInsertOption,\n\tKeyedOption,\n\tOptionCompletion,\n\tReplaceOption,\n\tUseAutocompleteProps,\n} from './types';\nimport getNodeText from '../utils/get-node-text';\nimport { unlock } from '../lock-unlock';\n\nconst { subscribeOwnedListener } = unlock( richTextPrivateApis );\n\nconst EMPTY_FILTERED_OPTIONS: KeyedOption[] = [];\n\n// Used for generating the instance ID\nconst AUTOCOMPLETE_HOOK_REFERENCE = {};\n\nfunction getCompletionObject< TReplacement >(\n\tcompletion: OptionCompletion< TReplacement >\n): InsertOption | ReplaceOption< TReplacement > {\n\tif (\n\t\tcompletion !== null &&\n\t\ttypeof completion === 'object' &&\n\t\t'action' in completion &&\n\t\tcompletion.action !== undefined &&\n\t\t'value' in completion &&\n\t\tcompletion.value !== undefined\n\t) {\n\t\treturn completion;\n\t}\n\treturn {\n\t\taction: 'insert-at-caret',\n\t\tvalue: completion as React.ReactNode,\n\t};\n}\n\nconst initialState: AutocompleteState< never > = {\n\tselectedIndex: 0,\n\tfilteredOptions: EMPTY_FILTERED_OPTIONS,\n\tfilterValue: '',\n\tautocompleter: null,\n};\n\nfunction autocompleteReducer< TReplacement >(\n\tstate: AutocompleteState< TReplacement >,\n\taction: AutocompleteAction< TReplacement >\n): AutocompleteState< TReplacement > {\n\tswitch ( action.type ) {\n\t\tcase 'RESET':\n\t\t\treturn initialState;\n\t\tcase 'SELECT':\n\t\t\treturn { ...state, selectedIndex: action.index };\n\t\tcase 'OPTIONS':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tfilteredOptions: action.options,\n\t\t\t\tselectedIndex:\n\t\t\t\t\taction.options.length === state.filteredOptions.length\n\t\t\t\t\t\t? state.selectedIndex\n\t\t\t\t\t\t: 0,\n\t\t\t};\n\t\tcase 'MATCH':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tautocompleter: action.completer,\n\t\t\t\tfilterValue: action.query,\n\t\t\t};\n\t}\n}\n\nexport function useAutocomplete< TReplacement = RichTextValue >( {\n\trecord,\n\tonChange,\n\tonReplace,\n\tcompleters,\n\tcontentRef,\n}: UseAutocompleteProps< TReplacement > ) {\n\tconst instanceId = useInstanceId( AUTOCOMPLETE_HOOK_REFERENCE );\n\tconst [ state, dispatch ] = useReducer(\n\t\tautocompleteReducer< TReplacement >,\n\t\tinitialState\n\t);\n\tconst { selectedIndex, filteredOptions, filterValue, autocompleter } =\n\t\tstate;\n\n\tconst backspacingRef = useRef( false );\n\tconst prevRecordTextRef = useRef( '' );\n\tconst lastCompletionRef = useRef< {\n\t\tname: string;\n\t\tvalue: string;\n\t} | null >( null );\n\n\tfunction insertCompletion( replacement: React.ReactNode ) {\n\t\tif ( autocompleter === null ) {\n\t\t\treturn '';\n\t\t}\n\t\tconst end = record.start;\n\t\tconst start =\n\t\t\tend - autocompleter.triggerPrefix.length - filterValue.length;\n\t\tconst toInsert = create( { html: renderToString( replacement ) } );\n\n\t\tonChange( insert( record, toInsert, start, end ) );\n\t\treturn getTextContent( toInsert );\n\t}\n\n\tfunction select( option: KeyedOption ) {\n\t\tif ( option.isDisabled || ! autocompleter ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { getOptionCompletion } = autocompleter;\n\t\tif ( ! getOptionCompletion ) {\n\t\t\tdispatch( { type: 'RESET' } );\n\t\t\tcontentRef.current?.focus();\n\t\t\treturn;\n\t\t}\n\n\t\tconst completionObject = getCompletionObject(\n\t\t\tgetOptionCompletion( option.value, filterValue )\n\t\t);\n\n\t\tif ( 'replace' === completionObject.action ) {\n\t\t\tonReplace( [ completionObject.value ] );\n\t\t\t// When replacing, the component will unmount, so don't reset\n\t\t\t// state (below) on an unmounted component.\n\t\t\treturn;\n\t\t}\n\n\t\tif ( 'insert-at-caret' === completionObject.action ) {\n\t\t\tconst completionText = insertCompletion( completionObject.value );\n\t\t\t// When the completion value starts with the trigger prefix\n\t\t\t// (e.g. @username), the trigger stays in the text and would\n\t\t\t// re-activate the autocompleter. Store the completed text so\n\t\t\t// the effect can suppress the stale re-match.\n\t\t\tif ( completionText.startsWith( autocompleter.triggerPrefix ) ) {\n\t\t\t\tconst afterPrefix = completionText.slice(\n\t\t\t\t\tautocompleter.triggerPrefix.length\n\t\t\t\t);\n\t\t\t\tif ( afterPrefix ) {\n\t\t\t\t\tlastCompletionRef.current = {\n\t\t\t\t\t\tname: autocompleter.name,\n\t\t\t\t\t\tvalue: afterPrefix,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Reset autocomplete state after insertion rather than before\n\t\t// so insertion events don't cause the completion menu to redisplay.\n\t\tdispatch( { type: 'RESET' } );\n\n\t\t// Make sure that the content remains focused after making a selection\n\t\t// and that the text cursor position is not lost.\n\t\tcontentRef.current?.focus();\n\t}\n\n\tfunction onChangeOptions( options: Array< KeyedOption > ) {\n\t\tdispatch( { type: 'OPTIONS', options } );\n\t}\n\n\tfunction handleKeyDown( event: KeyboardEvent ) {\n\t\tbackspacingRef.current = event.key === 'Backspace';\n\n\t\tif ( ! autocompleter ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( filteredOptions.length === 0 ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( event.defaultPrevented ) {\n\t\t\treturn;\n\t\t}\n\n\t\tswitch ( event.key ) {\n\t\t\tcase 'ArrowUp':\n\t\t\tcase 'ArrowDown': {\n\t\t\t\tconst offset = event.key === 'ArrowUp' ? -1 : 1;\n\t\t\t\tconst newIndex =\n\t\t\t\t\t( selectedIndex + offset + filteredOptions.length ) %\n\t\t\t\t\tfilteredOptions.length;\n\t\t\t\tdispatch( { type: 'SELECT', index: newIndex } );\n\t\t\t\t// See the related PR as to why this is necessary: https://github.com/WordPress/gutenberg/pull/54902.\n\t\t\t\tif ( isAppleOS() ) {\n\t\t\t\t\tspeak(\n\t\t\t\t\t\tgetNodeText( filteredOptions[ newIndex ].label ),\n\t\t\t\t\t\t'assertive'\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase 'Escape':\n\t\t\t\tdispatch( { type: 'RESET' } );\n\t\t\t\tevent.preventDefault();\n\t\t\t\tbreak;\n\n\t\t\tcase 'Enter':\n\t\t\t\tselect( filteredOptions[ selectedIndex ] );\n\t\t\t\tbreak;\n\n\t\t\tcase 'ArrowLeft':\n\t\t\tcase 'ArrowRight':\n\t\t\t\tdispatch( { type: 'RESET' } );\n\t\t\t\treturn;\n\n\t\t\tdefault:\n\t\t\t\treturn;\n\t\t}\n\n\t\t// Any handled key should prevent original behavior. This relies on\n\t\t// the early return in the default case.\n\t\tevent.preventDefault();\n\t}\n\n\t// textContent is a primitive (string), memoizing is not strictly necessary\n\t// but this is a preemptive performance improvement, since the autocompleter\n\t// is a potential bottleneck for the editor type metric.\n\tconst textContent = useMemo( () => {\n\t\tif ( isCollapsed( record ) ) {\n\t\t\treturn getTextContent( slice( record, 0 ) );\n\t\t}\n\t\treturn '';\n\t}, [ record ] );\n\n\tuseEffect( () => {\n\t\tconst isTextChange = record.text !== prevRecordTextRef.current;\n\t\tprevRecordTextRef.current = record.text;\n\n\t\tfunction getTextAfterSelection() {\n\t\t\treturn textContent\n\t\t\t\t? getTextContent(\n\t\t\t\t\t\tslice(\n\t\t\t\t\t\t\trecord,\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\tgetTextContent( record ).length\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t: '';\n\t\t}\n\n\t\tconst match = getAutocompleteMatch( textContent, completers, {\n\t\t\tmatchCount: filteredOptions.length,\n\t\t\tisBackspacing: backspacingRef.current,\n\t\t\tgetTextAfterSelection,\n\t\t\tlastCompletion: lastCompletionRef.current,\n\t\t} );\n\n\t\tif ( ! match ) {\n\t\t\tif ( autocompleter ) {\n\t\t\t\tdispatch( { type: 'RESET' } );\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tconst { completer, filterValue: query } = match;\n\n\t\t// Don't re-activate a dismissed autocompleter on cursor-only\n\t\t// movement. `textContent` (text before cursor) changes with the\n\t\t// caret, so the effect re-runs, but `record.text` does not.\n\t\t// Complements the render-time `didUserInput` gate in\n\t\t// `useAutocompleteProps` for callers using this hook directly.\n\t\tif ( ! autocompleter && ! isTextChange ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Clear stale completion ref when the user types a new trigger\n\t\t// for the same completer (the previous completion is no longer\n\t\t// relevant). Must be after the cursor-only check so that mere\n\t\t// cursor movement doesn't discard the suppression state.\n\t\tif (\n\t\t\tlastCompletionRef.current &&\n\t\t\tlastCompletionRef.current.name === completer.name\n\t\t) {\n\t\t\tlastCompletionRef.current = null;\n\t\t}\n\n\t\tdispatch( { type: 'MATCH', completer, query } );\n\t\t// We want to avoid introducing unexpected side effects.\n\t\t// See https://github.com/WordPress/gutenberg/pull/41820\n\t}, [ textContent ] );\n\n\tconst { key: selectedKey = '' } = filteredOptions[ selectedIndex ] || {};\n\tconst { className } = autocompleter || {};\n\tconst isExpanded = !! autocompleter && filteredOptions.length > 0;\n\tconst listBoxId = isExpanded\n\t\t? `components-autocomplete-listbox-${ instanceId }`\n\t\t: undefined;\n\tconst activeId = isExpanded\n\t\t? `components-autocomplete-item-${ instanceId }-${ selectedKey }`\n\t\t: null;\n\tconst hasSelection = record.start !== undefined;\n\tconst showPopover = !! textContent && hasSelection && !! autocompleter;\n\n\treturn {\n\t\tlistBoxId,\n\t\tactiveId,\n\t\tonKeyDown: withIgnoreIMEEvents( handleKeyDown ),\n\t\tpopover: showPopover && (\n\t\t\t<AutocompleterUI\n\t\t\t\tkey={ autocompleter.name + autocompleter.triggerPrefix }\n\t\t\t\tautocompleter={ autocompleter }\n\t\t\t\tclassName={ className }\n\t\t\t\tfilterValue={ filterValue }\n\t\t\t\tinstanceId={ instanceId }\n\t\t\t\tlistBoxId={ listBoxId }\n\t\t\t\tselectedIndex={ selectedIndex }\n\t\t\t\tonChangeOptions={ onChangeOptions }\n\t\t\t\tonSelect={ select }\n\t\t\t\tonHover={ ( index ) => dispatch( { type: 'SELECT', index } ) }\n\t\t\t\tcontentRef={ contentRef }\n\t\t\t\treset={ () => dispatch( { type: 'RESET' } ) }\n\t\t\t/>\n\t\t),\n\t};\n}\n\n/**\n * Checks whether two records represent the same user-visible state\n * (same text content and cursor position).\n */\nfunction recordValuesMatch(\n\ta: UseAutocompleteProps[ 'record' ],\n\tb: UseAutocompleteProps[ 'record' ]\n) {\n\treturn a.text === b.text && a.start === b.start && a.end === b.end;\n}\n\n/**\n * Tracks the last record whose value differed from the current one.\n * Used to determine whether the user has actually typed something\n */\nexport function useLastDifferentValue(\n\tvalue: UseAutocompleteProps[ 'record' ]\n) {\n\tconst history = useRef< Array< typeof value > >( [] );\n\n\tconst lastEntry = history.current[ history.current.length - 1 ];\n\n\t// Only add to history if the value is meaningfully different from\n\t// the most recent entry (analogous to Set.add being a no-op for\n\t// duplicate references in the original implementation).\n\tif ( ! lastEntry || ! recordValuesMatch( value, lastEntry ) ) {\n\t\thistory.current.push( value );\n\t}\n\n\t// Keep the history size to 2.\n\tif ( history.current.length > 2 ) {\n\t\thistory.current.shift();\n\t}\n\n\treturn history.current[ 0 ];\n}\n\n// The popover is anchored to the element this hook's own `ref` lands on, so it\n// owns `contentRef` and callers don't provide one.\nexport function useAutocompleteProps< TReplacement = RichTextValue >(\n\toptions: Omit< UseAutocompleteProps< TReplacement >, 'contentRef' >\n) {\n\tconst ref = useRef< HTMLElement >( null );\n\tconst { record } = options;\n\tconst previousRecord = useLastDifferentValue( record );\n\tconst { popover, listBoxId, activeId, onKeyDown } = useAutocomplete( {\n\t\t...options,\n\t\tcontentRef: ref,\n\t} );\n\tconst onKeyDownEvent = useEvent( onKeyDown );\n\n\tconst mergedRefs = useMergeRefs( [\n\t\tref,\n\t\tuseRefEffect(\n\t\t\t( element: HTMLElement ) => {\n\t\t\t\tfunction _onKeyDown( event: Event ) {\n\t\t\t\t\tonKeyDownEvent( event as KeyboardEvent );\n\t\t\t\t}\n\t\t\t\t// Capture phase. When the autocomplete popover is open,\n\t\t\t\t// Up/Down/Enter/Escape must navigate the completion list —\n\t\t\t\t// they shouldn't be consumed by ancestor handlers (e.g.\n\t\t\t\t// block-editor's writing-flow) for block navigation, block\n\t\t\t\t// splitting, or \"move out of parent\" actions. Those handlers\n\t\t\t\t// fire at bubble phase and gate on `event.defaultPrevented`,\n\t\t\t\t// so firing in capture lets us preventDefault first when the\n\t\t\t\t// popover is active.\n\t\t\t\treturn subscribeOwnedListener(\n\t\t\t\t\telement,\n\t\t\t\t\t'keydown',\n\t\t\t\t\t_onKeyDown,\n\t\t\t\t\ttrue\n\t\t\t\t);\n\t\t\t},\n\t\t\t[ onKeyDownEvent ]\n\t\t),\n\t] );\n\n\t// We only want to show the popover if the user has typed something.\n\tconst didUserInput = record.text !== previousRecord?.text;\n\n\tif ( ! didUserInput ) {\n\t\treturn { ref: mergedRefs };\n\t}\n\n\t// `aria-owns` and `aria-controls` point at the same list: either one lets\n\t// `aria-activedescendant` resolve to an option rendered outside this\n\t// element, and assistive technology support differs between them.\n\t//\n\t// No `aria-expanded`: consumers are `textbox` elements, which don't\n\t// support it; that would mean `role=\"combobox\"`, which in turn doesn't\n\t// support the `aria-multiline` these fields set.\n\treturn {\n\t\tref: mergedRefs,\n\t\tchildren: popover,\n\t\t'aria-autocomplete': listBoxId ? ( 'list' as const ) : undefined,\n\t\t'aria-haspopup': listBoxId ? ( 'listbox' as const ) : undefined,\n\t\t'aria-controls': listBoxId,\n\t\t'aria-owns': listBoxId,\n\t\t'aria-activedescendant': activeId ?? undefined,\n\t};\n}\n\nexport default function Autocomplete< TReplacement = RichTextValue >( {\n\tchildren,\n\tisSelected,\n\t...options\n}: AutocompleteProps< TReplacement > ) {\n\tconst { popover, ...props } = useAutocomplete( options );\n\treturn (\n\t\t<>\n\t\t\t{ children( props ) }\n\t\t\t{ isSelected && popover }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;;;;AAuCA,MAAM,EAAE,2BAA2B,OAAQA,WAAoB;AAE/D,MAAM,yBAAwC,CAAC;AAG/C,MAAM,8BAA8B,CAAC;AAErC,SAAS,oBACR,YAC+C;CAC/C,IACC,eAAe,QACf,OAAO,eAAe,YACtB,YAAY,cACZ,WAAW,WAAW,KAAA,KACtB,WAAW,cACX,WAAW,UAAU,KAAA,GAErB,OAAO;CAER,OAAO;EACN,QAAQ;EACR,OAAO;CACR;AACD;AAEA,MAAM,eAA2C;CAChD,eAAe;CACf,iBAAiB;CACjB,aAAa;CACb,eAAe;AAChB;AAEA,SAAS,oBACR,OACA,QACoC;CACpC,QAAS,OAAO,MAAhB;EACC,KAAK,SACJ,OAAO;EACR,KAAK,UACJ,OAAO;GAAE,GAAG;GAAO,eAAe,OAAO;EAAM;EAChD,KAAK,WACJ,OAAO;GACN,GAAG;GACH,iBAAiB,OAAO;GACxB,eACC,OAAO,QAAQ,WAAW,MAAM,gBAAgB,SAC7C,MAAM,gBACN;EACL;EACD,KAAK,SACJ,OAAO;GACN,GAAG;GACH,eAAe,OAAO;GACtB,aAAa,OAAO;EACrB;CACF;AACD;AAEA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