@grammarly/editor-sdk
Advanced tools
Comparing version 1.10.0 to 2.0.0-alpha.0
@@ -31,3 +31,3 @@ /** | ||
*/ | ||
declare type Config = Pick<EditorConfig, "collectUserFeedback" | "documentDialect" | "documentDomain" | "introText" | "oauthRedirectUri" | "suggestions" | "showToneDetector" | "autocomplete" | "toneDetector" | "userFeedback">; | ||
declare type Config = Pick<EditorConfig, "documentDialect" | "documentDomain" | "introText" | "oauthRedirectUri" | "suggestionCategories" | "autocomplete" | "toneDetector" | "userFeedback">; | ||
@@ -52,27 +52,5 @@ /** | ||
/** @since v1.3.0 */ | ||
| "auto-browser" | ||
/** @deprecated since v1.3.0 - Use "auto-browser" instead */ | ||
| "auto"; | ||
| "auto-browser"; | ||
/** | ||
* Characteristics and context of the document that inform Grammarly suggestions. | ||
* | ||
* @public | ||
* @deprecated since v1.6.7 | ||
*/ | ||
declare interface DocumentConfig { | ||
/** | ||
* Which English dialect should be assumed? | ||
* @deprecated since v1.6.7 - Moved to {@link EditorConfig} as `documentDialect` | ||
*/ | ||
dialect?: Dialect; | ||
/** | ||
* What is the style or type of writing? | ||
* @defaultValue "general" | ||
* @deprecated since v1.6.7 - Moved to {@link EditorConfig} as `documentDomain` | ||
*/ | ||
domain?: Domain; | ||
} | ||
/** | ||
* Statistics about the user-entered text. | ||
@@ -118,4 +96,4 @@ * | ||
* ```js | ||
* // returns instance of Editor | ||
* const editor = Grammarly.withElement(document.querySelector("textarea")); | ||
* // returns instance of GrammarlyEditorPluginElement | ||
* const plugin = Grammarly.addPlugin(document.querySelector("textarea")); | ||
* ``` | ||
@@ -187,8 +165,2 @@ * | ||
/** | ||
* Context of the input document that informs Grammarly suggestions. | ||
* @public | ||
* @deprecated since v1.6.7 | ||
*/ | ||
document?: DocumentConfig; | ||
/** | ||
* Categories of suggestions that can be muted. | ||
@@ -199,12 +171,3 @@ * | ||
* @public | ||
* @deprecated since v1.9.2 - use `suggestionCategories` instead | ||
*/ | ||
suggestions?: SuggestionCategoriesDeprecated; | ||
/** | ||
* Categories of suggestions that can be muted. | ||
* | ||
* {@link https://codesandbox.io/s/github/grammarly/grammarly-for-developers/tree/main/examples/editor-sdk-suggestions-config?file=/public/index.html | Try it out} | ||
* | ||
* @public | ||
*/ | ||
suggestionCategories?: SuggestionCategories; | ||
@@ -217,13 +180,2 @@ /** | ||
* | ||
* @defaultValue true | ||
* @public | ||
* @deprecated since v1.8.3 - Use `userFeedback` | ||
*/ | ||
collectUserFeedback?: boolean; | ||
/** | ||
* Collect user feedback after the user takes action on 5 suggestions. | ||
* | ||
* @remarks | ||
* We will not request feedback more than once in a 30 day period. | ||
* | ||
* @defaultValue "on" | ||
@@ -254,13 +206,2 @@ * @public | ||
* | ||
* @defaultValue false | ||
* @public | ||
* @deprecated since v1.8.3 - Use `toneDetector` | ||
*/ | ||
showToneDetector?: boolean; | ||
/** | ||
* Show the tone detector interface (beside the Grammarly button). | ||
* | ||
* @remarks | ||
* Note that tone detection requires a text of at least 150 characters. | ||
* | ||
* @defaultValue "off" | ||
@@ -304,12 +245,2 @@ * @public | ||
/** | ||
* Configuration for the user interface of Grammarly. | ||
* @deprecated since v1.6.7 | ||
*/ | ||
ui?: UIConfig; | ||
/** | ||
* Configuration for connected accounts. | ||
* @deprecated since v1.6.7 | ||
*/ | ||
oauth?: OAuthConfig; | ||
/** | ||
* Show suggestion cards when a user hovers over a suggestion underline. | ||
@@ -332,17 +263,2 @@ * | ||
underlines?: "on" | "off"; | ||
/** | ||
* Callback to receive stats about the user-entered text and Grammarly session. | ||
* @deprecated since v1.9.0 - use `document-stats` or `session-stats` events instead. | ||
*/ | ||
onTextStats?: (stats: TextStats) => void; | ||
/** | ||
* Triggered when the user consciously disables the plugin. Not triggered again once already disabled. | ||
* @deprecated since v1.9.0 - use plugin-turned-off event | ||
*/ | ||
onPluginDisable?: (reason: PluginDisableReason) => void; | ||
/** | ||
* Callback triggered on fatal error with the plugin. | ||
* @deprecated since v1.9.0 - use plugin-error event | ||
*/ | ||
onPluginError?: (error: Error) => void; | ||
} | ||
@@ -355,17 +271,2 @@ | ||
* | ||
* Factory that returns {@link Editor}s, which represent HTML editors enhanced with Grammarly. | ||
* | ||
* @example | ||
* ```js | ||
* const Grammarly = await init("YOUR_CLIENT_ID"); | ||
* const plugin = Grammarly.addPlugin(document.querySelector("textarea")); | ||
* ``` | ||
* | ||
* @deprecated since v1.6.7 - use {@link EditorSDK} instead | ||
*/ | ||
declare type EditorFactory = EditorSDK; | ||
/** | ||
* @public | ||
* | ||
* Overall API for the Editor SDK which can be used to create {@link Editor}s, which represent HTML editors enhanced with Grammarly. | ||
@@ -392,22 +293,3 @@ * | ||
addPlugin(element: HTMLElement, config?: EditorConfig, viewport?: HTMLElement): GrammarlyEditorPluginElement; | ||
/** | ||
* Enhance a specific HTML element with Grammarly. | ||
* | ||
* @param element - Element to be enhanced | ||
* @param config - Optional {@link EditorConfig} | ||
* @param viewport - Parent scrolling element, if different from editor element (since 1.6.7) | ||
* @returns An {@link Editor} | ||
* @deprecated since v1.9.0 - renamed to {@link EditorSDK.addPlugin} | ||
*/ | ||
withElement(element: HTMLElement, config?: EditorConfig, viewport?: HTMLElement): Editor; | ||
/** | ||
* Enhance all elements that match provided selectors with Grammarly. | ||
* | ||
* @param selectors - Selectors as provided to {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll | `querySelectorAll`} | ||
* @param config - Optional {@link EditorConfig} | ||
* @deprecated since v1.9.0 - use `document.querySelectorAll(selector).forEach(el => Grammarly.addPlugin(el, config))` | ||
*/ | ||
withQuerySelector(selectors: string, config?: EditorConfig): void; | ||
/** | ||
* Process OAuth callback and complete account connection. | ||
@@ -451,43 +333,2 @@ * | ||
/** | ||
* `<grammarly-button>` is a web component that allows you to place the Grammarly button | ||
* in a custom position in your app. | ||
* | ||
* @remarks | ||
* [Learn more](https://developer.grammarly.com/docs/customization#grammarly-button) | ||
* | ||
* @public | ||
*/ | ||
declare class GrammarlyButtonElement extends HTMLElement { | ||
private readonly _outlet; | ||
private readonly _attrs; | ||
private readonly _cleanup; | ||
/** | ||
* The position of the {@link https://developer.grammarly.com/docs/tone | tone detector} (if present) relative to the Grammarly button. | ||
* | ||
* @example | ||
* ```html | ||
* <grammarly-button tone-position="left"></grammarly-button> | ||
* ``` | ||
* | ||
* @defaultValue "left" | ||
* @public | ||
*/ | ||
get tonePosition(): TonePosition | undefined; | ||
set tonePosition(value: TonePosition | undefined); | ||
private _render; | ||
/** | ||
* Upgrade property to prototype getter/setter. | ||
* | ||
* @see https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties | ||
*/ | ||
private _upgradeProperty; | ||
} | ||
/** @public */ | ||
@@ -540,7 +381,8 @@ declare interface GrammarlyEditorPluginCallbacks { | ||
/** | ||
* `<grammarly-editor-plugin>` is a web component that adds Grammarly suggestions to the HTML element it wraps. | ||
* @public | ||
* | ||
* A web component to encapsulate DOM elements rendered | ||
* for displaying highlights and suggestion cards. | ||
* | ||
* Emits custom events: {@link GrammarlyEditorPluginElementEventMap} | ||
* | ||
* @public | ||
*/ | ||
@@ -562,16 +404,2 @@ declare class GrammarlyEditorPluginElement extends HTMLElement { | ||
* | ||
* @example | ||
* ```html | ||
* <grammarly-editor-plugin> | ||
* <textarea></textarea> | ||
* </grammarly-editor-plugin> | ||
* ``` | ||
* | ||
* ```js | ||
* <script> | ||
* const editor = document.querySelector("grammarly-editor-plugin") | ||
* editor.config = { autocomplete: "on", documentDialect: "british" }; | ||
* </script> | ||
* ``` | ||
* | ||
* @public | ||
@@ -586,10 +414,5 @@ */ | ||
* and connect to an editable child element (editor) and its scrollable container | ||
* (viewport). | ||
* (viewport). This function provides a way to specify the editor and viewport, | ||
* overriding what was automatically detected. | ||
* | ||
* In rare cases, you may need to override what was automatically detected. | ||
* This function provides a way to do that by specifying a different editor and viewport. | ||
* | ||
* @example | ||
* See [editor-sdk-tinymce-imperative](https://codesandbox.io/s/github/grammarly/grammarly-for-developers/tree/main/examples/editor-sdk-tinymce-imperative?file=/public/index.html) | ||
* | ||
* @param editor - the editable element | ||
@@ -698,32 +521,2 @@ * @param viewport - scrollable outer element of the editable element | ||
/** | ||
* Configuration for connected accounts | ||
* | ||
* @public | ||
* @deprecated since v1.6.7 | ||
*/ | ||
declare interface OAuthConfig { | ||
/** | ||
* URI to redirect to after successful account connection. | ||
* | ||
* @public | ||
* @deprecated since v1.6.7 - Moved to {@link EditorConfig} as `oauthRedirectUri` | ||
*/ | ||
redirectUri: string; | ||
} | ||
/** | ||
* Provides more detail when the plugin is disabled by a user. | ||
* | ||
* @remarks | ||
* Clarifies whether the user disabled the plugin for the current session only | ||
* or for all future sessions? | ||
* In either case, the user can change their mind later. | ||
* | ||
* @public | ||
* @deprecated since v1.9.0 | ||
*/ | ||
declare type PluginDisableReason = "user-next-visit" | "user-forever"; | ||
/** | ||
* Statistics about the Grammarly session. | ||
@@ -967,253 +760,2 @@ * | ||
/** | ||
* Categories of suggestions that can be muted. | ||
* | ||
* @public | ||
* @deprecated since v1.9.2 - use `SuggestionCategories` instead | ||
*/ | ||
declare interface SuggestionCategoriesDeprecated { | ||
/** | ||
* Suggests alternatives to words that occur frequently in the same paragraph. | ||
* | ||
* @defaultValue true | ||
*/ | ||
Variety?: boolean; | ||
/** | ||
* Suggests alternatives to bland and overused words such as "good" and "nice". | ||
* | ||
* @defaultValue true | ||
*/ | ||
Vocabulary?: boolean; | ||
/** | ||
* Suggests ways to sound more natural and fluent. | ||
* | ||
* @defaultValue true | ||
*/ | ||
Fluency?: boolean; | ||
/** | ||
* Suggests adding the Oxford comma after the second-to-last item in a list of things. | ||
* | ||
* @defaultValue false | ||
*/ | ||
OxfordComma?: boolean; | ||
/** | ||
* Flags unnecessary use of ellipses (...). | ||
* | ||
* @defaultValue false | ||
*/ | ||
UnnecessaryEllipses?: boolean; | ||
/** | ||
* Suggests placing punctuation before closing quotation marks. | ||
* | ||
* @defaultValue true | ||
*/ | ||
PunctuationWithQuotation?: boolean; | ||
/** | ||
* Suggests completing all incomplete sentences, including stylistic sentence fragments that may be intentional. | ||
* | ||
* @defaultValue false | ||
*/ | ||
StylisticFragments?: boolean; | ||
/** | ||
* Flags use of personal pronouns such as "I" and "you" in academic writing. | ||
* | ||
* @defaultValue false | ||
*/ | ||
InformalPronounsAcademic?: boolean; | ||
/** | ||
* Flags use of conjunctions such as "but" and "and" at the beginning of sentences. | ||
* | ||
* @defaultValue false | ||
*/ | ||
ConjunctionAtStartOfSentence?: boolean; | ||
/** | ||
* Flags use of prepositions such as "with" and "in" at the end of sentences. | ||
* | ||
* @defaultValue false | ||
*/ | ||
PrepositionAtTheEndOfSentence?: boolean; | ||
/** | ||
* Suggests rewriting split infinitives so that an adverb doesn't come between "to" and the verb. | ||
* | ||
* @defaultValue true | ||
*/ | ||
SplitInfinitive?: boolean; | ||
/** | ||
* Suggests adding missing spacing after a numeral when writing times. | ||
* | ||
* @defaultValue true | ||
*/ | ||
MissingSpaces?: boolean; | ||
/** | ||
* Flags use of passive voice. | ||
* | ||
* @defaultValue false | ||
*/ | ||
PassiveVoice?: boolean; | ||
/** | ||
* Flags long, complicated sentences that could potentially confuse your reader. | ||
* | ||
* @defaultValue true | ||
*/ | ||
ReadabilityFillerwords?: boolean; | ||
/** | ||
* Suggests splitting long, complicated sentences that could potentially confuse your reader. | ||
* | ||
* @defaultValue true | ||
*/ | ||
ReadabilityTransforms?: boolean; | ||
/** | ||
* Suggests using person-first language to refer respectfully to an individual with a disability. | ||
* | ||
* @defaultValue true | ||
*/ | ||
PersonFirstLanguage?: boolean; | ||
/** | ||
* Suggests alternatives to potentially gender-biased and non-inclusive phrasing. | ||
* | ||
* @defaultValue true | ||
*/ | ||
PossiblyBiasedLanguageGenderRelated?: boolean; | ||
/** | ||
* Flags LGBTQIA+-related terms that may be seen as biased in some contexts. | ||
* | ||
* @deprecated Use `PossiblyBiasedLanguageLgbtqiaRelated` instead | ||
* @defaultValue true | ||
*/ | ||
PossiblyBiasedLanguageLgbtRelated?: boolean; | ||
/** | ||
* Flags LGBTQIA+-related terms that may be seen as outdated, clinical, or not fully accepted in some contexts. | ||
* | ||
* @deprecated Use `PossiblyBiasedLanguageLgbtqiaRelated` instead | ||
* @defaultValue true | ||
*/ | ||
PossiblyOutdatedLanguageLgbtRelated?: boolean; | ||
/** | ||
* Flags LGBTQIA+-related terms that may be seen as biased, outdated, or disrespectful in some contexts. | ||
* | ||
* @defaultValue true | ||
*/ | ||
PossiblyBiasedLanguageLgbtqiaRelated?: boolean; | ||
/** | ||
* Flags reclaimed LGBTQIA+-related terms that may still be seen as disrespectful in some contexts. | ||
* | ||
* @deprecated Use `PossiblyBiasedLanguageLgbtqiaRelated` instead | ||
* @defaultValue true | ||
*/ | ||
ReclaimedLanguage?: boolean; | ||
/** | ||
* Suggests alternatives to potentially biased or outdated descriptions. | ||
* | ||
* @deprecated Use more specific categories like `PossiblyBiasedLanguageDisabilityRelated` instead | ||
* @defaultValue true | ||
*/ | ||
PossiblyBiasedLanguage?: boolean; | ||
/** | ||
* Suggests alternatives to language that may be considered politically incorrect. | ||
* | ||
* @defaultValue true | ||
*/ | ||
PossiblyPoliticallyIncorrectLanguage?: boolean; | ||
/** | ||
* Suggests alternatives to potentially biased language related to race and ethnicity. | ||
* | ||
* @defaultValue true | ||
*/ | ||
PossiblyBiasedLanguageRaceEthnicityRelated?: boolean; | ||
/** | ||
* Suggests alternatives to potentially biased language related to older adults. | ||
* | ||
* @defaultValue true | ||
*/ | ||
PossiblyBiasedLanguageAgeRelated?: boolean; | ||
/** | ||
* Suggests alternatives to potentially ableist language. | ||
* | ||
* @defaultValue true | ||
*/ | ||
PossiblyBiasedLanguageDisabilityRelated?: boolean; | ||
/** | ||
* Suggests alternatives to potentially biased language related to parenting and family systems. | ||
* | ||
* @example | ||
* Quinn hoped to meet their \{ real father =\> birth father \} one day. | ||
* | ||
* @defaultValue true | ||
*/ | ||
PossiblyBiasedLanguageFamilyRelated?: boolean; | ||
/** | ||
* Suggests spelling out numbers zero through ten. | ||
* | ||
* @defaultValue true | ||
*/ | ||
NumbersZeroThroughTen?: boolean; | ||
/** | ||
* Suggests spelling out numbers at the beginning of sentences. | ||
* | ||
* @defaultValue true | ||
*/ | ||
NumbersBeginningSentences?: boolean; | ||
/** | ||
* Flags a series of nouns that modify a final noun. | ||
* | ||
* @example | ||
* The \{store manager policy handbook update meeting \} is tomorrow. | ||
* | ||
* @defaultValue true | ||
*/ | ||
NounStrings?: boolean; | ||
/** | ||
* Flags series of sentences that follow the same pattern. | ||
* | ||
* @example | ||
* I read an interesting book recently. It was about computers. I usually read novels. | ||
* | ||
* @defaultValue true | ||
*/ | ||
SentenceVariety?: boolean; | ||
/** | ||
* Suggests removing extra spaces surrounding a slash. | ||
* | ||
* @example | ||
* I just wanted to send a \{ reminder / follow-up =\> reminder/follow-up \}. | ||
* | ||
* @defaultValue true | ||
*/ | ||
SpacesSurroundingSlash?: boolean; | ||
/** | ||
* Suggests alternatives to language related to human slavery. | ||
* | ||
* @example | ||
* My professor wrote a book about \{ slaves =\> enslaved people \} in America. | ||
* | ||
* @defaultValue true | ||
*/ | ||
PossiblyBiasedLanguageHumanRights?: boolean; | ||
/** | ||
* Suggests alternatives to terms with origins in the institution of slavery. | ||
* | ||
* @example | ||
* The apartment’s \{ master =\> main|primary \} bedroom has a view of the sea. | ||
* | ||
* @defaultValue true | ||
*/ | ||
PossiblyBiasedLanguageHumanRightsRelated?: boolean; | ||
} | ||
/** | ||
* Statistics about the user-entered text. | ||
* | ||
* @public | ||
* @deprecated since v1.9.0 - use DocumentStats or SessionStats | ||
*/ | ||
declare interface TextStats extends DocumentStats { | ||
/** | ||
* Current number of suggestions. | ||
* @since v1.7.4 | ||
*/ | ||
suggestionsCount: number; | ||
/** Stats about the overall session. */ | ||
session: SessionStats; | ||
} | ||
/** | ||
* Time in hours, minutes, and seconds. | ||
@@ -1232,39 +774,2 @@ * | ||
/** | ||
* Position of the {@link https://developer.grammarly.com/docs/tone | tone detector} (if present) relative to the Grammarly button. | ||
* | ||
* @public | ||
*/ | ||
declare type TonePosition = "left" | "right"; | ||
/** | ||
* Configuration for the user interface of Grammarly. | ||
* | ||
* @public | ||
* @deprecated since v1.6.7 | ||
*/ | ||
declare interface UIConfig { | ||
/** | ||
* Text shown to introduce first-time users to Grammarly. | ||
* | ||
* @remarks | ||
* This introductory text shows in the footer of the first shown suggestion card | ||
* as well as in the Grammarly button menu. | ||
* | ||
* @defaultValue "Grammarly helps you write clearly and mistake-free." | ||
* @deprecated since v1.6.7 - Moved to {@link EditorConfig} | ||
*/ | ||
introText?: string; | ||
/** | ||
* Show the tone detector interface (beside the Grammarly button). | ||
* @defaultValue false | ||
* | ||
* @remarks | ||
* Note that tone detection requires a text of at least 150 characters. | ||
* | ||
* @deprecated since v1.6.7 - Moved to {@link EditorConfig} | ||
*/ | ||
showToneDetector?: boolean; | ||
} | ||
export { ClientId, Config, Dialect, DocumentConfig, DocumentStats, Domain, Editor, EditorConfig, EditorFactory, EditorSDK, Event_2 as Event, EventListener_2 as EventListener, GrammarlyButtonElement, GrammarlyEditorPluginCallbacks, GrammarlyEditorPluginElement, GrammarlyEditorPluginElementEventMap, OAuthConfig, PluginDisableReason, SessionStats, SessionSuggestionBreakdown, SuggestionCategories, SuggestionCategoriesDeprecated, TextStats, Time, TonePosition, UIConfig, init }; | ||
export { ClientId, Config, Dialect, DocumentStats, Domain, Editor, EditorConfig, EditorSDK, Event_2 as Event, EventListener_2 as EventListener, GrammarlyEditorPluginCallbacks, GrammarlyEditorPluginElement, GrammarlyEditorPluginElementEventMap, SessionStats, SessionSuggestionBreakdown, SuggestionCategories, Time, init }; |
@@ -31,3 +31,3 @@ /** | ||
*/ | ||
declare type Config = Pick<EditorConfig, "collectUserFeedback" | "documentDialect" | "documentDomain" | "introText" | "oauthRedirectUri" | "suggestions" | "showToneDetector" | "autocomplete" | "toneDetector" | "userFeedback">; | ||
declare type Config = Pick<EditorConfig, "documentDialect" | "documentDomain" | "introText" | "oauthRedirectUri" | "suggestionCategories" | "autocomplete" | "toneDetector" | "userFeedback">; | ||
@@ -52,27 +52,5 @@ /** | ||
/** @since v1.3.0 */ | ||
| "auto-browser" | ||
/** @deprecated since v1.3.0 - Use "auto-browser" instead */ | ||
| "auto"; | ||
| "auto-browser"; | ||
/** | ||
* Characteristics and context of the document that inform Grammarly suggestions. | ||
* | ||
* @public | ||
* @deprecated since v1.6.7 | ||
*/ | ||
declare interface DocumentConfig { | ||
/** | ||
* Which English dialect should be assumed? | ||
* @deprecated since v1.6.7 - Moved to {@link EditorConfig} as `documentDialect` | ||
*/ | ||
dialect?: Dialect; | ||
/** | ||
* What is the style or type of writing? | ||
* @defaultValue "general" | ||
* @deprecated since v1.6.7 - Moved to {@link EditorConfig} as `documentDomain` | ||
*/ | ||
domain?: Domain; | ||
} | ||
/** | ||
* Statistics about the user-entered text. | ||
@@ -118,4 +96,4 @@ * | ||
* ```js | ||
* // returns instance of Editor | ||
* const editor = Grammarly.withElement(document.querySelector("textarea")); | ||
* // returns instance of GrammarlyEditorPluginElement | ||
* const plugin = Grammarly.addPlugin(document.querySelector("textarea")); | ||
* ``` | ||
@@ -187,8 +165,2 @@ * | ||
/** | ||
* Context of the input document that informs Grammarly suggestions. | ||
* @public | ||
* @deprecated since v1.6.7 | ||
*/ | ||
document?: DocumentConfig; | ||
/** | ||
* Categories of suggestions that can be muted. | ||
@@ -199,12 +171,3 @@ * | ||
* @public | ||
* @deprecated since v1.9.2 - use `suggestionCategories` instead | ||
*/ | ||
suggestions?: SuggestionCategoriesDeprecated; | ||
/** | ||
* Categories of suggestions that can be muted. | ||
* | ||
* {@link https://codesandbox.io/s/github/grammarly/grammarly-for-developers/tree/main/examples/editor-sdk-suggestions-config?file=/public/index.html | Try it out} | ||
* | ||
* @public | ||
*/ | ||
suggestionCategories?: SuggestionCategories; | ||
@@ -217,13 +180,2 @@ /** | ||
* | ||
* @defaultValue true | ||
* @public | ||
* @deprecated since v1.8.3 - Use `userFeedback` | ||
*/ | ||
collectUserFeedback?: boolean; | ||
/** | ||
* Collect user feedback after the user takes action on 5 suggestions. | ||
* | ||
* @remarks | ||
* We will not request feedback more than once in a 30 day period. | ||
* | ||
* @defaultValue "on" | ||
@@ -254,13 +206,2 @@ * @public | ||
* | ||
* @defaultValue false | ||
* @public | ||
* @deprecated since v1.8.3 - Use `toneDetector` | ||
*/ | ||
showToneDetector?: boolean; | ||
/** | ||
* Show the tone detector interface (beside the Grammarly button). | ||
* | ||
* @remarks | ||
* Note that tone detection requires a text of at least 150 characters. | ||
* | ||
* @defaultValue "off" | ||
@@ -296,12 +237,2 @@ * @public | ||
/** | ||
* Configuration for the user interface of Grammarly. | ||
* @deprecated since v1.6.7 | ||
*/ | ||
ui?: UIConfig; | ||
/** | ||
* Configuration for connected accounts. | ||
* @deprecated since v1.6.7 | ||
*/ | ||
oauth?: OAuthConfig; | ||
/** | ||
* Show suggestion cards when a user hovers over a suggestion underline. | ||
@@ -324,17 +255,2 @@ * | ||
underlines?: "on" | "off"; | ||
/** | ||
* Callback to receive stats about the user-entered text and Grammarly session. | ||
* @deprecated since v1.9.0 - use `document-stats` or `session-stats` events instead. | ||
*/ | ||
onTextStats?: (stats: TextStats) => void; | ||
/** | ||
* Triggered when the user consciously disables the plugin. Not triggered again once already disabled. | ||
* @deprecated since v1.9.0 - use plugin-turned-off event | ||
*/ | ||
onPluginDisable?: (reason: PluginDisableReason) => void; | ||
/** | ||
* Callback triggered on fatal error with the plugin. | ||
* @deprecated since v1.9.0 - use plugin-error event | ||
*/ | ||
onPluginError?: (error: Error) => void; | ||
} | ||
@@ -347,17 +263,2 @@ | ||
* | ||
* Factory that returns {@link Editor}s, which represent HTML editors enhanced with Grammarly. | ||
* | ||
* @example | ||
* ```js | ||
* const Grammarly = await init("YOUR_CLIENT_ID"); | ||
* const plugin = Grammarly.addPlugin(document.querySelector("textarea")); | ||
* ``` | ||
* | ||
* @deprecated since v1.6.7 - use {@link EditorSDK} instead | ||
*/ | ||
declare type EditorFactory = EditorSDK; | ||
/** | ||
* @public | ||
* | ||
* Overall API for the Editor SDK which can be used to create {@link Editor}s, which represent HTML editors enhanced with Grammarly. | ||
@@ -384,22 +285,3 @@ * | ||
addPlugin(element: HTMLElement, config?: EditorConfig, viewport?: HTMLElement): GrammarlyEditorPluginElement; | ||
/** | ||
* Enhance a specific HTML element with Grammarly. | ||
* | ||
* @param element - Element to be enhanced | ||
* @param config - Optional {@link EditorConfig} | ||
* @param viewport - Parent scrolling element, if different from editor element (since 1.6.7) | ||
* @returns An {@link Editor} | ||
* @deprecated since v1.9.0 - renamed to {@link EditorSDK.addPlugin} | ||
*/ | ||
withElement(element: HTMLElement, config?: EditorConfig, viewport?: HTMLElement): Editor; | ||
/** | ||
* Enhance all elements that match provided selectors with Grammarly. | ||
* | ||
* @param selectors - Selectors as provided to {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll | `querySelectorAll`} | ||
* @param config - Optional {@link EditorConfig} | ||
* @deprecated since v1.9.0 - use `document.querySelectorAll(selector).forEach(el => Grammarly.addPlugin(el, config))` | ||
*/ | ||
withQuerySelector(selectors: string, config?: EditorConfig): void; | ||
/** | ||
* Process OAuth callback and complete account connection. | ||
@@ -443,43 +325,2 @@ * | ||
/** | ||
* `<grammarly-button>` is a web component that allows you to place the Grammarly button | ||
* in a custom position in your app. | ||
* | ||
* @remarks | ||
* [Learn more](https://developer.grammarly.com/docs/customization#grammarly-button) | ||
* | ||
* @public | ||
*/ | ||
declare class GrammarlyButtonElement extends HTMLElement { | ||
private readonly _outlet; | ||
private readonly _attrs; | ||
private readonly _cleanup; | ||
/** | ||
* The position of the {@link https://developer.grammarly.com/docs/tone | tone detector} (if present) relative to the Grammarly button. | ||
* | ||
* @example | ||
* ```html | ||
* <grammarly-button tone-position="left"></grammarly-button> | ||
* ``` | ||
* | ||
* @defaultValue "left" | ||
* @public | ||
*/ | ||
get tonePosition(): TonePosition | undefined; | ||
set tonePosition(value: TonePosition | undefined); | ||
private _render; | ||
/** | ||
* Upgrade property to prototype getter/setter. | ||
* | ||
* @see https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties | ||
*/ | ||
private _upgradeProperty; | ||
} | ||
/** @public */ | ||
@@ -532,7 +373,8 @@ declare interface GrammarlyEditorPluginCallbacks { | ||
/** | ||
* `<grammarly-editor-plugin>` is a web component that adds Grammarly suggestions to the HTML element it wraps. | ||
* @public | ||
* | ||
* A web component to encapsulate DOM elements rendered | ||
* for displaying highlights and suggestion cards. | ||
* | ||
* Emits custom events: {@link GrammarlyEditorPluginElementEventMap} | ||
* | ||
* @public | ||
*/ | ||
@@ -554,16 +396,2 @@ declare class GrammarlyEditorPluginElement extends HTMLElement { | ||
* | ||
* @example | ||
* ```html | ||
* <grammarly-editor-plugin> | ||
* <textarea></textarea> | ||
* </grammarly-editor-plugin> | ||
* ``` | ||
* | ||
* ```js | ||
* <script> | ||
* const editor = document.querySelector("grammarly-editor-plugin") | ||
* editor.config = { autocomplete: "on", documentDialect: "british" }; | ||
* </script> | ||
* ``` | ||
* | ||
* @public | ||
@@ -578,10 +406,5 @@ */ | ||
* and connect to an editable child element (editor) and its scrollable container | ||
* (viewport). | ||
* (viewport). This function provides a way to specify the editor and viewport, | ||
* overriding what was automatically detected. | ||
* | ||
* In rare cases, you may need to override what was automatically detected. | ||
* This function provides a way to do that by specifying a different editor and viewport. | ||
* | ||
* @example | ||
* See [editor-sdk-tinymce-imperative](https://codesandbox.io/s/github/grammarly/grammarly-for-developers/tree/main/examples/editor-sdk-tinymce-imperative?file=/public/index.html) | ||
* | ||
* @param editor - the editable element | ||
@@ -690,32 +513,2 @@ * @param viewport - scrollable outer element of the editable element | ||
/** | ||
* Configuration for connected accounts | ||
* | ||
* @public | ||
* @deprecated since v1.6.7 | ||
*/ | ||
declare interface OAuthConfig { | ||
/** | ||
* URI to redirect to after successful account connection. | ||
* | ||
* @public | ||
* @deprecated since v1.6.7 - Moved to {@link EditorConfig} as `oauthRedirectUri` | ||
*/ | ||
redirectUri: string; | ||
} | ||
/** | ||
* Provides more detail when the plugin is disabled by a user. | ||
* | ||
* @remarks | ||
* Clarifies whether the user disabled the plugin for the current session only | ||
* or for all future sessions? | ||
* In either case, the user can change their mind later. | ||
* | ||
* @public | ||
* @deprecated since v1.9.0 | ||
*/ | ||
declare type PluginDisableReason = "user-next-visit" | "user-forever"; | ||
/** | ||
* Statistics about the Grammarly session. | ||
@@ -959,253 +752,2 @@ * | ||
/** | ||
* Categories of suggestions that can be muted. | ||
* | ||
* @public | ||
* @deprecated since v1.9.2 - use `SuggestionCategories` instead | ||
*/ | ||
declare interface SuggestionCategoriesDeprecated { | ||
/** | ||
* Suggests alternatives to words that occur frequently in the same paragraph. | ||
* | ||
* @defaultValue true | ||
*/ | ||
Variety?: boolean; | ||
/** | ||
* Suggests alternatives to bland and overused words such as "good" and "nice". | ||
* | ||
* @defaultValue true | ||
*/ | ||
Vocabulary?: boolean; | ||
/** | ||
* Suggests ways to sound more natural and fluent. | ||
* | ||
* @defaultValue true | ||
*/ | ||
Fluency?: boolean; | ||
/** | ||
* Suggests adding the Oxford comma after the second-to-last item in a list of things. | ||
* | ||
* @defaultValue false | ||
*/ | ||
OxfordComma?: boolean; | ||
/** | ||
* Flags unnecessary use of ellipses (...). | ||
* | ||
* @defaultValue false | ||
*/ | ||
UnnecessaryEllipses?: boolean; | ||
/** | ||
* Suggests placing punctuation before closing quotation marks. | ||
* | ||
* @defaultValue true | ||
*/ | ||
PunctuationWithQuotation?: boolean; | ||
/** | ||
* Suggests completing all incomplete sentences, including stylistic sentence fragments that may be intentional. | ||
* | ||
* @defaultValue false | ||
*/ | ||
StylisticFragments?: boolean; | ||
/** | ||
* Flags use of personal pronouns such as "I" and "you" in academic writing. | ||
* | ||
* @defaultValue false | ||
*/ | ||
InformalPronounsAcademic?: boolean; | ||
/** | ||
* Flags use of conjunctions such as "but" and "and" at the beginning of sentences. | ||
* | ||
* @defaultValue false | ||
*/ | ||
ConjunctionAtStartOfSentence?: boolean; | ||
/** | ||
* Flags use of prepositions such as "with" and "in" at the end of sentences. | ||
* | ||
* @defaultValue false | ||
*/ | ||
PrepositionAtTheEndOfSentence?: boolean; | ||
/** | ||
* Suggests rewriting split infinitives so that an adverb doesn't come between "to" and the verb. | ||
* | ||
* @defaultValue true | ||
*/ | ||
SplitInfinitive?: boolean; | ||
/** | ||
* Suggests adding missing spacing after a numeral when writing times. | ||
* | ||
* @defaultValue true | ||
*/ | ||
MissingSpaces?: boolean; | ||
/** | ||
* Flags use of passive voice. | ||
* | ||
* @defaultValue false | ||
*/ | ||
PassiveVoice?: boolean; | ||
/** | ||
* Flags long, complicated sentences that could potentially confuse your reader. | ||
* | ||
* @defaultValue true | ||
*/ | ||
ReadabilityFillerwords?: boolean; | ||
/** | ||
* Suggests splitting long, complicated sentences that could potentially confuse your reader. | ||
* | ||
* @defaultValue true | ||
*/ | ||
ReadabilityTransforms?: boolean; | ||
/** | ||
* Suggests using person-first language to refer respectfully to an individual with a disability. | ||
* | ||
* @defaultValue true | ||
*/ | ||
PersonFirstLanguage?: boolean; | ||
/** | ||
* Suggests alternatives to potentially gender-biased and non-inclusive phrasing. | ||
* | ||
* @defaultValue true | ||
*/ | ||
PossiblyBiasedLanguageGenderRelated?: boolean; | ||
/** | ||
* Flags LGBTQIA+-related terms that may be seen as biased in some contexts. | ||
* | ||
* @deprecated Use `PossiblyBiasedLanguageLgbtqiaRelated` instead | ||
* @defaultValue true | ||
*/ | ||
PossiblyBiasedLanguageLgbtRelated?: boolean; | ||
/** | ||
* Flags LGBTQIA+-related terms that may be seen as outdated, clinical, or not fully accepted in some contexts. | ||
* | ||
* @deprecated Use `PossiblyBiasedLanguageLgbtqiaRelated` instead | ||
* @defaultValue true | ||
*/ | ||
PossiblyOutdatedLanguageLgbtRelated?: boolean; | ||
/** | ||
* Flags LGBTQIA+-related terms that may be seen as biased, outdated, or disrespectful in some contexts. | ||
* | ||
* @defaultValue true | ||
*/ | ||
PossiblyBiasedLanguageLgbtqiaRelated?: boolean; | ||
/** | ||
* Flags reclaimed LGBTQIA+-related terms that may still be seen as disrespectful in some contexts. | ||
* | ||
* @deprecated Use `PossiblyBiasedLanguageLgbtqiaRelated` instead | ||
* @defaultValue true | ||
*/ | ||
ReclaimedLanguage?: boolean; | ||
/** | ||
* Suggests alternatives to potentially biased or outdated descriptions. | ||
* | ||
* @deprecated Use more specific categories like `PossiblyBiasedLanguageDisabilityRelated` instead | ||
* @defaultValue true | ||
*/ | ||
PossiblyBiasedLanguage?: boolean; | ||
/** | ||
* Suggests alternatives to language that may be considered politically incorrect. | ||
* | ||
* @defaultValue true | ||
*/ | ||
PossiblyPoliticallyIncorrectLanguage?: boolean; | ||
/** | ||
* Suggests alternatives to potentially biased language related to race and ethnicity. | ||
* | ||
* @defaultValue true | ||
*/ | ||
PossiblyBiasedLanguageRaceEthnicityRelated?: boolean; | ||
/** | ||
* Suggests alternatives to potentially biased language related to older adults. | ||
* | ||
* @defaultValue true | ||
*/ | ||
PossiblyBiasedLanguageAgeRelated?: boolean; | ||
/** | ||
* Suggests alternatives to potentially ableist language. | ||
* | ||
* @defaultValue true | ||
*/ | ||
PossiblyBiasedLanguageDisabilityRelated?: boolean; | ||
/** | ||
* Suggests alternatives to potentially biased language related to parenting and family systems. | ||
* | ||
* @example | ||
* Quinn hoped to meet their \{ real father =\> birth father \} one day. | ||
* | ||
* @defaultValue true | ||
*/ | ||
PossiblyBiasedLanguageFamilyRelated?: boolean; | ||
/** | ||
* Suggests spelling out numbers zero through ten. | ||
* | ||
* @defaultValue true | ||
*/ | ||
NumbersZeroThroughTen?: boolean; | ||
/** | ||
* Suggests spelling out numbers at the beginning of sentences. | ||
* | ||
* @defaultValue true | ||
*/ | ||
NumbersBeginningSentences?: boolean; | ||
/** | ||
* Flags a series of nouns that modify a final noun. | ||
* | ||
* @example | ||
* The \{store manager policy handbook update meeting \} is tomorrow. | ||
* | ||
* @defaultValue true | ||
*/ | ||
NounStrings?: boolean; | ||
/** | ||
* Flags series of sentences that follow the same pattern. | ||
* | ||
* @example | ||
* I read an interesting book recently. It was about computers. I usually read novels. | ||
* | ||
* @defaultValue true | ||
*/ | ||
SentenceVariety?: boolean; | ||
/** | ||
* Suggests removing extra spaces surrounding a slash. | ||
* | ||
* @example | ||
* I just wanted to send a \{ reminder / follow-up =\> reminder/follow-up \}. | ||
* | ||
* @defaultValue true | ||
*/ | ||
SpacesSurroundingSlash?: boolean; | ||
/** | ||
* Suggests alternatives to language related to human slavery. | ||
* | ||
* @example | ||
* My professor wrote a book about \{ slaves =\> enslaved people \} in America. | ||
* | ||
* @defaultValue true | ||
*/ | ||
PossiblyBiasedLanguageHumanRights?: boolean; | ||
/** | ||
* Suggests alternatives to terms with origins in the institution of slavery. | ||
* | ||
* @example | ||
* The apartment’s \{ master =\> main|primary \} bedroom has a view of the sea. | ||
* | ||
* @defaultValue true | ||
*/ | ||
PossiblyBiasedLanguageHumanRightsRelated?: boolean; | ||
} | ||
/** | ||
* Statistics about the user-entered text. | ||
* | ||
* @public | ||
* @deprecated since v1.9.0 - use DocumentStats or SessionStats | ||
*/ | ||
declare interface TextStats extends DocumentStats { | ||
/** | ||
* Current number of suggestions. | ||
* @since v1.7.4 | ||
*/ | ||
suggestionsCount: number; | ||
/** Stats about the overall session. */ | ||
session: SessionStats; | ||
} | ||
/** | ||
* Time in hours, minutes, and seconds. | ||
@@ -1224,39 +766,2 @@ * | ||
/** | ||
* Position of the {@link https://developer.grammarly.com/docs/tone | tone detector} (if present) relative to the Grammarly button. | ||
* | ||
* @public | ||
*/ | ||
declare type TonePosition = "left" | "right"; | ||
/** | ||
* Configuration for the user interface of Grammarly. | ||
* | ||
* @public | ||
* @deprecated since v1.6.7 | ||
*/ | ||
declare interface UIConfig { | ||
/** | ||
* Text shown to introduce first-time users to Grammarly. | ||
* | ||
* @remarks | ||
* This introductory text shows in the footer of the first shown suggestion card | ||
* as well as in the Grammarly button menu. | ||
* | ||
* @defaultValue "Grammarly helps you write clearly and mistake-free." | ||
* @deprecated since v1.6.7 - Moved to {@link EditorConfig} | ||
*/ | ||
introText?: string; | ||
/** | ||
* Show the tone detector interface (beside the Grammarly button). | ||
* @defaultValue false | ||
* | ||
* @remarks | ||
* Note that tone detection requires a text of at least 150 characters. | ||
* | ||
* @deprecated since v1.6.7 - Moved to {@link EditorConfig} | ||
*/ | ||
showToneDetector?: boolean; | ||
} | ||
export { ClientId, Config, Dialect, DocumentConfig, DocumentStats, Domain, Editor, EditorConfig, EditorFactory, EditorSDK, Event_2 as Event, EventListener_2 as EventListener, GrammarlyButtonElement, GrammarlyEditorPluginCallbacks, GrammarlyEditorPluginElement, GrammarlyEditorPluginElementEventMap, OAuthConfig, PluginDisableReason, SessionStats, SessionSuggestionBreakdown, SuggestionCategories, SuggestionCategoriesDeprecated, TextStats, Time, TonePosition, UIConfig, init }; | ||
export { ClientId, Config, Dialect, DocumentStats, Domain, Editor, EditorConfig, EditorSDK, Event_2 as Event, EventListener_2 as EventListener, GrammarlyEditorPluginCallbacks, GrammarlyEditorPluginElement, GrammarlyEditorPluginElementEventMap, SessionStats, SessionSuggestionBreakdown, SuggestionCategories, Time, init }; |
@@ -17,2 +17,2 @@ /** | ||
*/ | ||
function t(t,r,n){return r in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,t}class r extends Error{constructor(r,n){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";super(),t(this,"args",void 0),t(this,"code",void 0),t(this,"url",void 0);var o=new URL("https://developer.grammarly.com/docs/error-explainer");o.searchParams.set("code",r.toString()),n.forEach((t=>o.searchParams.append("args",String(t)))),null!=this.stack&&o.searchParams.set("trace",this.stack),this.message="Minified error #".concat(r,": ").concat(e," See ").concat(o.toString()," for details."),this.args=n,this.code=r,this.url=o.toString()}}const n=new WeakMap;async function e(t,e,o){if("undefined"==typeof window&&void 0===o)throw new r(21,[]);const a=await async function(t,e,o){const a=n.get(t);if(null!=a)return await a;!function(t){null==t.Grammarly&&(t.Grammarly={})}(t);const s=new Promise(((n,a)=>{try{let n=function(t,r){return t.document.querySelectorAll(`script[src^="${r}"]`)[0]}(t,e);null!=n?s():(n=function(t,r){const n=t.document.createElement("script");return n.src=r,t.document.head.appendChild(n),n}(t,null!=o?`${e}?clientId=${o}`:e),n.addEventListener("load",s),n.addEventListener("error",(function(){try{throw new r(23,[])}catch(t){a(t)}})))}catch(t){return a(t)}function s(){try{if(null==t.Grammarly||"function"!=typeof t.Grammarly.EditorSDK)throw new r(22,[]);n(t.Grammarly)}catch(t){a(t)}}}));return n.set(t,s),await s}(null!=o?o:window,"https://js.grammarly.com/grammarly-editor-sdk@1.10",t);if(null!=t)return new a.EditorSDK(t,e)}const o={onBeforeSuggestionCardOpen:"before-suggestion-card-open",onSuggestionCardOpen:"suggestion-card-open",onSuggestionCardClose:"suggestion-card-close",onPluginTurnedOff:"plugin-turned-off",onPluginError:"plugin-error",onDocumentStats:"document-stats",onSessionStats:"session-stats"};export{o as callbackToEventName,e as init}; | ||
function t(t,r,n){return r in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,t}class r extends Error{constructor(r,n){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";super(),t(this,"args",void 0),t(this,"code",void 0),t(this,"url",void 0);var o=new URL("https://developer.grammarly.com/docs/error-explainer");o.searchParams.set("code",r.toString()),n.forEach((t=>o.searchParams.append("args",String(t)))),null!=this.stack&&o.searchParams.set("trace",this.stack),this.message="Minified error #".concat(r,": ").concat(e," See ").concat(o.toString()," for details."),this.args=n,this.code=r,this.url=o.toString()}}const n=new WeakMap;async function e(t,e,o){if("undefined"==typeof window&&void 0===o)throw new r(21,[]);const a=await async function(t,e,o){const a=n.get(t);if(null!=a)return await a;!function(t){null==t.Grammarly&&(t.Grammarly={})}(t);const s=new Promise(((n,a)=>{try{let n=function(t,r){return t.document.querySelectorAll(`script[src^="${r}"]`)[0]}(t,e);null!=n?s():(n=function(t,r){const n=t.document.createElement("script");return n.src=r,t.document.head.appendChild(n),n}(t,null!=o?`${e}?clientId=${o}`:e),n.addEventListener("load",s),n.addEventListener("error",(function(){try{throw new r(23,[])}catch(t){a(t)}})))}catch(t){return a(t)}function s(){try{if(null==t.Grammarly||"function"!=typeof t.Grammarly.EditorSDK)throw new r(22,[]);n(t.Grammarly)}catch(t){a(t)}}}));return n.set(t,s),await s}(null!=o?o:window,"https://js.grammarly.com/grammarly-editor-sdk@2.0",t);if(null!=t)return new a.EditorSDK(t,e)}const o={onBeforeSuggestionCardOpen:"before-suggestion-card-open",onSuggestionCardOpen:"suggestion-card-open",onSuggestionCardClose:"suggestion-card-close",onPluginTurnedOff:"plugin-turned-off",onPluginError:"plugin-error",onDocumentStats:"document-stats",onSessionStats:"session-stats"};export{o as callbackToEventName,e as init}; |
@@ -17,2 +17,2 @@ /** | ||
*/ | ||
!function(){"use strict";function t(t,r,n){return r in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,t}class r extends Error{constructor(r,n){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";super(),t(this,"args",void 0),t(this,"code",void 0),t(this,"url",void 0);var a=new URL("https://developer.grammarly.com/docs/error-explainer");a.searchParams.set("code",r.toString()),n.forEach((t=>a.searchParams.append("args",String(t)))),null!=this.stack&&a.searchParams.set("trace",this.stack),this.message="Minified error #".concat(r,": ").concat(e," See ").concat(a.toString()," for details."),this.args=n,this.code=r,this.url=a.toString()}}const n=new WeakMap;async function e(t,e,a){if("undefined"==typeof window&&void 0===a)throw new r(21,[]);const c=await async function(t,e,a){const c=n.get(t);if(null!=c)return await c;!function(t){null==t.Grammarly&&(t.Grammarly={})}(t);const i=new Promise(((n,c)=>{try{let n=function(t,r){return t.document.querySelectorAll('script[src^="https://js.grammarly.com/grammarly-editor-sdk@1.10"]')[0]}(t);null!=n?i():(n=function(t,r){const n=t.document.createElement("script");return n.src=r,t.document.head.appendChild(n),n}(t,null!=a?`${e}?clientId=${a}`:e),n.addEventListener("load",i),n.addEventListener("error",(function(){try{throw new r(23,[])}catch(t){c(t)}})))}catch(t){return c(t)}function i(){try{if(null==t.Grammarly||"function"!=typeof t.Grammarly.EditorSDK)throw new r(22,[]);n(t.Grammarly)}catch(t){c(t)}}}));return n.set(t,i),await i}(null!=a?a:window,"https://js.grammarly.com/grammarly-editor-sdk@1.10",t);if(null!=t)return new c.EditorSDK(t,e)}const a=function(){const t=function(){if(document.currentScript instanceof HTMLScriptElement)return document.currentScript}();if(t){const r=t.src;if(r){const t=new URL(r).searchParams.get("clientId");if(null!=t)return t}const n=t.getAttribute("clientId");if(null!=n)return n}}(),c=async function(t){return await t.catch((t=>{console.error(t.message)}))}(null!=a?e(a):e());window.Grammarly.init=async(t=a)=>{const n=a===t?await c:null!=t?await e(t):void 0;if(null==n)throw new r(20,[]);return n}}(); | ||
!function(){"use strict";function t(t,r,n){return r in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,t}class r extends Error{constructor(r,n){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";super(),t(this,"args",void 0),t(this,"code",void 0),t(this,"url",void 0);var a=new URL("https://developer.grammarly.com/docs/error-explainer");a.searchParams.set("code",r.toString()),n.forEach((t=>a.searchParams.append("args",String(t)))),null!=this.stack&&a.searchParams.set("trace",this.stack),this.message="Minified error #".concat(r,": ").concat(e," See ").concat(a.toString()," for details."),this.args=n,this.code=r,this.url=a.toString()}}const n=new WeakMap;async function e(t,e,a){if("undefined"==typeof window&&void 0===a)throw new r(21,[]);const c=await async function(t,e,a){const c=n.get(t);if(null!=c)return await c;!function(t){null==t.Grammarly&&(t.Grammarly={})}(t);const i=new Promise(((n,c)=>{try{let n=function(t,r){return t.document.querySelectorAll('script[src^="https://js.grammarly.com/grammarly-editor-sdk@2.0"]')[0]}(t);null!=n?i():(n=function(t,r){const n=t.document.createElement("script");return n.src=r,t.document.head.appendChild(n),n}(t,null!=a?`${e}?clientId=${a}`:e),n.addEventListener("load",i),n.addEventListener("error",(function(){try{throw new r(23,[])}catch(t){c(t)}})))}catch(t){return c(t)}function i(){try{if(null==t.Grammarly||"function"!=typeof t.Grammarly.EditorSDK)throw new r(22,[]);n(t.Grammarly)}catch(t){c(t)}}}));return n.set(t,i),await i}(null!=a?a:window,"https://js.grammarly.com/grammarly-editor-sdk@2.0",t);if(null!=t)return new c.EditorSDK(t,e)}const a=function(){const t=function(){if(document.currentScript instanceof HTMLScriptElement)return document.currentScript}();if(t){const r=t.src;if(r){const t=new URL(r).searchParams.get("clientId");if(null!=t)return t}const n=t.getAttribute("clientId");if(null!=n)return n}}(),c=async function(t){return await t.catch((t=>{console.error(t.message)}))}(null!=a?e(a):e());window.Grammarly.init=async(t=a)=>{const n=a===t?await c:null!=t?await e(t):void 0;if(null==n)throw new r(20,[]);return n}}(); |
@@ -17,2 +17,2 @@ /** | ||
*/ | ||
"use strict";function e(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});class t extends Error{constructor(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";super(),e(this,"args",void 0),e(this,"code",void 0),e(this,"url",void 0);var o=new URL("https://developer.grammarly.com/docs/error-explainer");o.searchParams.set("code",t.toString()),r.forEach((e=>o.searchParams.append("args",String(e)))),null!=this.stack&&o.searchParams.set("trace",this.stack),this.message="Minified error #".concat(t,": ").concat(n," See ").concat(o.toString()," for details."),this.args=r,this.code=t,this.url=o.toString()}}const r=new WeakMap;exports.callbackToEventName={onBeforeSuggestionCardOpen:"before-suggestion-card-open",onSuggestionCardOpen:"suggestion-card-open",onSuggestionCardClose:"suggestion-card-close",onPluginTurnedOff:"plugin-turned-off",onPluginError:"plugin-error",onDocumentStats:"document-stats",onSessionStats:"session-stats"},exports.init=async function(e,n,o){if("undefined"==typeof window&&void 0===o)throw new t(21,[]);const a=await async function(e,n,o){const a=r.get(e);if(null!=a)return await a;!function(e){null==e.Grammarly&&(e.Grammarly={})}(e);const s=new Promise(((r,a)=>{try{let r=function(e,t){return e.document.querySelectorAll(`script[src^="${t}"]`)[0]}(e,n);null!=r?s():(r=function(e,t){const r=e.document.createElement("script");return r.src=t,e.document.head.appendChild(r),r}(e,null!=o?`${n}?clientId=${o}`:n),r.addEventListener("load",s),r.addEventListener("error",(function(){try{throw new t(23,[])}catch(e){a(e)}})))}catch(e){return a(e)}function s(){try{if(null==e.Grammarly||"function"!=typeof e.Grammarly.EditorSDK)throw new t(22,[]);r(e.Grammarly)}catch(e){a(e)}}}));return r.set(e,s),await s}(null!=o?o:window,"https://js.grammarly.com/grammarly-editor-sdk@1.10",e);if(null!=e)return new a.EditorSDK(e,n)}; | ||
"use strict";function e(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});class t extends Error{constructor(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";super(),e(this,"args",void 0),e(this,"code",void 0),e(this,"url",void 0);var o=new URL("https://developer.grammarly.com/docs/error-explainer");o.searchParams.set("code",t.toString()),r.forEach((e=>o.searchParams.append("args",String(e)))),null!=this.stack&&o.searchParams.set("trace",this.stack),this.message="Minified error #".concat(t,": ").concat(n," See ").concat(o.toString()," for details."),this.args=r,this.code=t,this.url=o.toString()}}const r=new WeakMap;exports.callbackToEventName={onBeforeSuggestionCardOpen:"before-suggestion-card-open",onSuggestionCardOpen:"suggestion-card-open",onSuggestionCardClose:"suggestion-card-close",onPluginTurnedOff:"plugin-turned-off",onPluginError:"plugin-error",onDocumentStats:"document-stats",onSessionStats:"session-stats"},exports.init=async function(e,n,o){if("undefined"==typeof window&&void 0===o)throw new t(21,[]);const a=await async function(e,n,o){const a=r.get(e);if(null!=a)return await a;!function(e){null==e.Grammarly&&(e.Grammarly={})}(e);const s=new Promise(((r,a)=>{try{let r=function(e,t){return e.document.querySelectorAll(`script[src^="${t}"]`)[0]}(e,n);null!=r?s():(r=function(e,t){const r=e.document.createElement("script");return r.src=t,e.document.head.appendChild(r),r}(e,null!=o?`${n}?clientId=${o}`:n),r.addEventListener("load",s),r.addEventListener("error",(function(){try{throw new t(23,[])}catch(e){a(e)}})))}catch(e){return a(e)}function s(){try{if(null==e.Grammarly||"function"!=typeof e.Grammarly.EditorSDK)throw new t(22,[]);r(e.Grammarly)}catch(e){a(e)}}}));return r.set(e,s),await s}(null!=o?o:window,"https://js.grammarly.com/grammarly-editor-sdk@2.0",e);if(null!=e)return new a.EditorSDK(e,n)}; |
@@ -5,3 +5,3 @@ { | ||
"description": "Grammarly writing SDK for web editors", | ||
"version": "1.10.0", | ||
"version": "2.0.0-alpha.0", | ||
"main": "./lib/index.js", | ||
@@ -29,6 +29,6 @@ "module": "./lib/index.esm.js", | ||
"devDependencies": { | ||
"@grammarly/plugin-core": "1.10.0", | ||
"@grammarly/plugin-editor": "1.10.0", | ||
"@grammarly/plugin-invariant": "1.10.0", | ||
"@grammarly/plugin-reactivity": "1.10.0", | ||
"@grammarly/plugin-core": "2.0.0-alpha.0", | ||
"@grammarly/plugin-editor": "2.0.0-alpha.0", | ||
"@grammarly/plugin-invariant": "2.0.0-alpha.0", | ||
"@grammarly/plugin-reactivity": "2.0.0-alpha.0", | ||
"@microsoft/api-extractor": "^7.28.7", | ||
@@ -35,0 +35,0 @@ "@testing-library/jest-dom": "^5.11.10", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
61655
1474
2