@atlaskit/editor-plugin-autocomplete 2.3.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +42 -0
- package/afm-cc/tsconfig.json +3 -0
- package/afm-products/tsconfig.json +3 -0
- package/autocompletePlugin/package.json +15 -0
- package/autocompletePluginType/package.json +15 -0
- package/dist/cjs/analytics/ufo.js +111 -0
- package/dist/cjs/entry-points/autocompletePlugin.js +12 -0
- package/dist/cjs/entry-points/autocompletePluginType.js +1 -0
- package/dist/cjs/entry-points/src-pm-plugins-autocomplete-plugin.js +18 -0
- package/dist/cjs/entry-points/src-pm-plugins-slow-lane-client.js +36 -0
- package/dist/cjs/entry-points/src-pm-plugins-text-predictor.js +66 -0
- package/dist/cjs/pm-plugins/autocomplete-plugin.js +126 -64
- package/dist/cjs/pm-plugins/local-slow-lane-client.js +447 -0
- package/dist/cjs/pm-plugins/slow-lane-client.js +45 -16
- package/dist/cjs/pm-plugins/text-predictor.js +72 -40
- package/dist/es2019/analytics/ufo.js +110 -0
- package/dist/es2019/entry-points/autocompletePlugin.js +2 -0
- package/dist/es2019/entry-points/autocompletePluginType.js +0 -0
- package/dist/es2019/entry-points/src-pm-plugins-autocomplete-plugin.js +2 -0
- package/dist/es2019/entry-points/src-pm-plugins-slow-lane-client.js +2 -0
- package/dist/es2019/entry-points/src-pm-plugins-text-predictor.js +2 -0
- package/dist/es2019/pm-plugins/autocomplete-plugin.js +132 -72
- package/dist/es2019/pm-plugins/local-slow-lane-client.js +355 -0
- package/dist/es2019/pm-plugins/slow-lane-client.js +29 -2
- package/dist/es2019/pm-plugins/text-predictor.js +48 -15
- package/dist/esm/analytics/ufo.js +105 -0
- package/dist/esm/entry-points/autocompletePlugin.js +2 -0
- package/dist/esm/entry-points/autocompletePluginType.js +0 -0
- package/dist/esm/entry-points/src-pm-plugins-autocomplete-plugin.js +2 -0
- package/dist/esm/entry-points/src-pm-plugins-slow-lane-client.js +2 -0
- package/dist/esm/entry-points/src-pm-plugins-text-predictor.js +2 -0
- package/dist/esm/pm-plugins/autocomplete-plugin.js +126 -64
- package/dist/esm/pm-plugins/local-slow-lane-client.js +439 -0
- package/dist/esm/pm-plugins/slow-lane-client.js +45 -16
- package/dist/esm/pm-plugins/text-predictor.js +73 -40
- package/dist/types/analytics/ufo.d.ts +38 -0
- package/dist/types/entry-points/autocompletePlugin.d.ts +1 -0
- package/dist/types/entry-points/autocompletePluginType.d.ts +1 -0
- package/dist/types/entry-points/src-pm-plugins-autocomplete-plugin.d.ts +2 -0
- package/dist/types/entry-points/src-pm-plugins-slow-lane-client.d.ts +2 -0
- package/dist/types/entry-points/src-pm-plugins-text-predictor.d.ts +2 -0
- package/dist/types/pm-plugins/autocomplete-plugin.d.ts +5 -0
- package/dist/types/pm-plugins/local-slow-lane-client.d.ts +102 -0
- package/dist/types-ts4.5/analytics/ufo.d.ts +38 -0
- package/dist/types-ts4.5/entry-points/autocompletePlugin.d.ts +1 -0
- package/dist/types-ts4.5/entry-points/autocompletePluginType.d.ts +1 -0
- package/dist/types-ts4.5/entry-points/src-pm-plugins-autocomplete-plugin.d.ts +2 -0
- package/dist/types-ts4.5/entry-points/src-pm-plugins-slow-lane-client.d.ts +2 -0
- package/dist/types-ts4.5/entry-points/src-pm-plugins-text-predictor.d.ts +2 -0
- package/dist/types-ts4.5/pm-plugins/autocomplete-plugin.d.ts +5 -0
- package/dist/types-ts4.5/pm-plugins/local-slow-lane-client.d.ts +102 -0
- package/package.json +8 -3
- package/src/analytics/ufo.ts +139 -0
- package/src/entry-points/autocompletePlugin.tsx +2 -0
- package/src/entry-points/autocompletePluginType.ts +2 -0
- package/src/entry-points/src-pm-plugins-autocomplete-plugin.ts +7 -0
- package/src/entry-points/src-pm-plugins-slow-lane-client.ts +13 -0
- package/src/entry-points/src-pm-plugins-text-predictor.ts +14 -0
- package/src/pm-plugins/autocomplete-plugin/package.json +5 -5
- package/src/pm-plugins/autocomplete-plugin.ts +126 -64
- package/src/pm-plugins/local-slow-lane-client.ts +480 -0
- package/src/pm-plugins/slow-lane-client/package.json +5 -5
- package/src/pm-plugins/slow-lane-client.ts +28 -2
- package/src/pm-plugins/text-predictor/package.json +5 -5
- package/src/pm-plugins/text-predictor.ts +42 -12
- package/tsconfig.app.json +3 -0
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
* via incrementSessionFreq(), called on word boundaries from the plugin.
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
+
import { EXPERIENCE_NAME, failExp, startExp, succeedExp } from '../analytics/ufo';
|
|
19
|
+
|
|
18
20
|
// import bigramsData from './data/bigrams.json';
|
|
19
21
|
import l3VocabularyData from './data/l3_vocabulary.json';
|
|
20
22
|
import vocabularyData from './data/vocabulary_10k.json';
|
|
@@ -723,12 +725,14 @@ export const loadVectorsAsync = async (options?: {
|
|
|
723
725
|
return;
|
|
724
726
|
}
|
|
725
727
|
vectorsLoadStarted = true;
|
|
728
|
+
startExp(EXPERIENCE_NAME.LOAD_VECTORS, 'singleton');
|
|
726
729
|
|
|
727
730
|
let url: string;
|
|
728
731
|
try {
|
|
729
732
|
url = await options.getBinaryUrl();
|
|
730
733
|
} catch (e) {
|
|
731
734
|
vectorsLoadStarted = false;
|
|
735
|
+
failExp(EXPERIENCE_NAME.LOAD_VECTORS, 'singleton', { errorType: 'resolve_url' });
|
|
732
736
|
// eslint-disable-next-line no-console
|
|
733
737
|
console.warn('[text-predictor] Failed to resolve vectors URL:', e);
|
|
734
738
|
return;
|
|
@@ -738,6 +742,10 @@ export const loadVectorsAsync = async (options?: {
|
|
|
738
742
|
const res = await fetch(url);
|
|
739
743
|
if (!res.ok) {
|
|
740
744
|
vectorsLoadStarted = false;
|
|
745
|
+
failExp(EXPERIENCE_NAME.LOAD_VECTORS, 'singleton', {
|
|
746
|
+
status: res.status,
|
|
747
|
+
errorType: 'http_error',
|
|
748
|
+
});
|
|
741
749
|
// eslint-disable-next-line no-console
|
|
742
750
|
console.warn(`[text-predictor] Failed to load vectors: ${res.status}`);
|
|
743
751
|
return;
|
|
@@ -749,6 +757,11 @@ export const loadVectorsAsync = async (options?: {
|
|
|
749
757
|
const dim = float32.length / nWords;
|
|
750
758
|
|
|
751
759
|
vectorStore = { float32, wordIndex, dim };
|
|
760
|
+
succeedExp(EXPERIENCE_NAME.LOAD_VECTORS, 'singleton', {
|
|
761
|
+
wordCount: nWords,
|
|
762
|
+
dim,
|
|
763
|
+
sizeBytes: float32.byteLength,
|
|
764
|
+
});
|
|
752
765
|
if (isAutocompleteDebugEnabled()) {
|
|
753
766
|
// eslint-disable-next-line no-console
|
|
754
767
|
console.log('[text-predictor] Vectors loaded:', {
|
|
@@ -759,6 +772,7 @@ export const loadVectorsAsync = async (options?: {
|
|
|
759
772
|
}
|
|
760
773
|
} catch (e) {
|
|
761
774
|
vectorsLoadStarted = false;
|
|
775
|
+
failExp(EXPERIENCE_NAME.LOAD_VECTORS, 'singleton', { errorType: 'network' });
|
|
762
776
|
// eslint-disable-next-line no-console
|
|
763
777
|
console.warn('[text-predictor] Failed to load vectors:', e);
|
|
764
778
|
}
|
|
@@ -769,17 +783,33 @@ export const initVectors = (store: VectorStore): void => {
|
|
|
769
783
|
};
|
|
770
784
|
|
|
771
785
|
export const loadDefaultVocabulary = (): void => {
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
docFreq: stats.doc_freq,
|
|
778
|
-
authorFreq: stats.author_freq,
|
|
779
|
-
}));
|
|
780
|
-
initVocabulary({ terms });
|
|
786
|
+
if (isInitialized) {
|
|
787
|
+
return;
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
startExp(EXPERIENCE_NAME.LOAD_VOCABULARY, 'singleton');
|
|
781
791
|
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
792
|
+
try {
|
|
793
|
+
// 1. Load the Atlassian Domain (L2)
|
|
794
|
+
const data = vocabularyData as VocabularyJson;
|
|
795
|
+
const terms = Object.entries(data.words).map(([word, stats]) => ({
|
|
796
|
+
word,
|
|
797
|
+
freq: stats.freq,
|
|
798
|
+
docFreq: stats.doc_freq,
|
|
799
|
+
authorFreq: stats.author_freq,
|
|
800
|
+
}));
|
|
801
|
+
initVocabulary({ terms });
|
|
802
|
+
|
|
803
|
+
// 2. Load General English (L3)
|
|
804
|
+
const l3Words = l3VocabularyData as string[];
|
|
805
|
+
initL3Vocabulary(l3Words);
|
|
806
|
+
|
|
807
|
+
succeedExp(EXPERIENCE_NAME.LOAD_VOCABULARY, 'singleton', {
|
|
808
|
+
l2WordCount: terms.length,
|
|
809
|
+
l3WordCount: l3Words.length,
|
|
810
|
+
});
|
|
811
|
+
} catch (e) {
|
|
812
|
+
failExp(EXPERIENCE_NAME.LOAD_VOCABULARY, 'singleton', { errorType: 'parse_error' });
|
|
813
|
+
throw e;
|
|
814
|
+
}
|
|
785
815
|
};
|