@magicx-eng/ai-autocomplete-angular 0.5.7 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -1
- package/esm2020/lib/ai-autocomplete/ai-autocomplete.component.mjs +5 -9
- package/esm2020/lib/controller/ai-autocomplete.controller.mjs +18 -11
- package/esm2020/lib/shared/types.mjs +1 -1
- package/esm2020/public-api.mjs +3 -1
- package/fesm2015/magicx-eng-ai-autocomplete-angular.mjs +23 -19
- package/fesm2015/magicx-eng-ai-autocomplete-angular.mjs.map +1 -1
- package/fesm2020/magicx-eng-ai-autocomplete-angular.mjs +23 -19
- package/fesm2020/magicx-eng-ai-autocomplete-angular.mjs.map +1 -1
- package/lib/ai-autocomplete/ai-autocomplete.component.d.ts.map +1 -1
- package/lib/controller/ai-autocomplete.controller.d.ts +8 -1
- package/lib/controller/ai-autocomplete.controller.d.ts.map +1 -1
- package/lib/shared/types.d.ts +7 -1
- package/lib/shared/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/public-api.d.ts +2 -1
- package/public-api.d.ts.map +1 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { buildAttributionUrl, getFooterHint, AIAutocomplete, getCursorOffset, extractPlainText, renderEditableContent, plainTextLength, setCursorOffset, ModeController, buildSubmitResult } from '@magicx-eng/ai-autocomplete-vanilla';
|
|
2
|
+
export { buildSubmitResult, withSkippedParams } from '@magicx-eng/ai-autocomplete-vanilla';
|
|
1
3
|
import * as i1 from '@angular/common';
|
|
2
4
|
import { CommonModule, isPlatformBrowser } from '@angular/common';
|
|
3
5
|
import * as i0 from '@angular/core';
|
|
4
6
|
import { Component, ChangeDetectionStrategy, ViewEncapsulation, Input, EventEmitter, Output, ViewChild, inject, ChangeDetectorRef, ElementRef, Renderer2, NgZone, Directive, PLATFORM_ID, forwardRef, NgModule } from '@angular/core';
|
|
5
7
|
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
6
|
-
import { buildAttributionUrl, getFooterHint, AIAutocomplete, getCursorOffset, extractPlainText, renderEditableContent, plainTextLength, setCursorOffset, ModeController, buildQuery } from '@magicx-eng/ai-autocomplete-vanilla';
|
|
7
8
|
import { BehaviorSubject, combineLatest, map as map$1, distinctUntilChanged, shareReplay, Subject, takeUntil } from 'rxjs';
|
|
8
9
|
import { map } from 'rxjs/operators';
|
|
9
10
|
|
|
@@ -579,16 +580,21 @@ class AIAutocompleteController {
|
|
|
579
580
|
// handed. The core notifies listeners synchronously, and some actions
|
|
580
581
|
// trigger reentrant `store.set` calls (e.g. typing a non-matching char
|
|
581
582
|
// during re-edit makes the core synchronously exit re-edit and kick off a
|
|
582
|
-
// fetch).
|
|
583
|
-
//
|
|
584
|
-
//
|
|
585
|
-
//
|
|
586
|
-
//
|
|
587
|
-
//
|
|
588
|
-
// back to where re-editing started
|
|
589
|
-
//
|
|
590
|
-
//
|
|
591
|
-
//
|
|
583
|
+
// fetch).
|
|
584
|
+
//
|
|
585
|
+
// The core's store used to deliver such a nested set inline and then
|
|
586
|
+
// resume the outer listener loop, so a listener could be handed an older
|
|
587
|
+
// state (still in re-edit) *after* a newer one (re-edit exited) — which
|
|
588
|
+
// resurrected a stale `editingParam` and retriggered the editor's re-edit
|
|
589
|
+
// caret-park, yanking the caret back to where re-editing started. The
|
|
590
|
+
// store now queues notifications and drains them in order, so that
|
|
591
|
+
// out-of-order delivery can no longer happen at the source.
|
|
592
|
+
//
|
|
593
|
+
// Reading `getState()` at emission time is kept as belt-and-braces: it
|
|
594
|
+
// costs nothing (distinctUntilChanged downstream drops the duplicate
|
|
595
|
+
// emissions) and keeps this bridge correct for any future consumer that
|
|
596
|
+
// emits mid-cascade. React needs neither, since it batches renders and
|
|
597
|
+
// gates its caret effects on dependencies.
|
|
592
598
|
this.unsubscribeCore = this.core.subscribe(() => {
|
|
593
599
|
if (!this.isDestroyed)
|
|
594
600
|
this.rawState$.next(this.core.getState());
|
|
@@ -602,6 +608,7 @@ class AIAutocompleteController {
|
|
|
602
608
|
// works fine.
|
|
603
609
|
this.text$ = deriveField(this.rawState$, (s) => s.text);
|
|
604
610
|
this.completedParams$ = deriveField(this.rawState$, (s) => s.completedParams, arrEq);
|
|
611
|
+
this.skippedParams$ = deriveField(this.rawState$, (s) => s.skippedParams, arrEq);
|
|
605
612
|
this.suggestionPills$ = deriveField(this.rawState$, (s) => s.actionableSuggestions, arrEq);
|
|
606
613
|
this.segments$ = deriveField(this.rawState$, (s) => s.segments, arrEq);
|
|
607
614
|
this.newParamId$ = deriveField(this.rawState$, (s) => s.newParamId);
|
|
@@ -809,6 +816,7 @@ function computeState(s) {
|
|
|
809
816
|
return {
|
|
810
817
|
text: s.text,
|
|
811
818
|
completedParams: s.completedParams,
|
|
819
|
+
skippedParams: s.skippedParams,
|
|
812
820
|
suggestionPills: s.actionableSuggestions,
|
|
813
821
|
segments: s.segments,
|
|
814
822
|
newParamId: s.newParamId,
|
|
@@ -1388,13 +1396,9 @@ class AIAutocompleteComponent {
|
|
|
1388
1396
|
if (!editor)
|
|
1389
1397
|
return;
|
|
1390
1398
|
const text = extractPlainText(editor);
|
|
1391
|
-
const
|
|
1392
|
-
const
|
|
1393
|
-
this.submitted.emit(
|
|
1394
|
-
query: text.trim(),
|
|
1395
|
-
raw_query: built.rawQuery,
|
|
1396
|
-
completed_params: built.completedParams,
|
|
1397
|
-
});
|
|
1399
|
+
const state = this.controller.getState();
|
|
1400
|
+
const params = this.completedParams ?? state.completedParams;
|
|
1401
|
+
this.submitted.emit(buildSubmitResult(text, params, state.skippedParams));
|
|
1398
1402
|
this.controller.reset();
|
|
1399
1403
|
}
|
|
1400
1404
|
handleSubmitFromUserAction() {
|
|
@@ -1811,7 +1815,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
1811
1815
|
* planned export list. Only symbols re-exported here are considered part of
|
|
1812
1816
|
* the package's public contract (TDB §19.2).
|
|
1813
1817
|
*/
|
|
1814
|
-
// ===
|
|
1818
|
+
// === Submit-result builder (folds skipped params into completed_params) ===
|
|
1815
1819
|
|
|
1816
1820
|
/**
|
|
1817
1821
|
* Generated bundle index. Do not edit.
|