@microsoft/dragon-copilot-sdk-lexical-react 0.2.6-beta.4636686 → 1.0.1
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/node_modules/@hccm/web-tcl/CHANGELOG.md +161 -0
- package/node_modules/@hccm/web-tcl/README.md +99 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/cleanup-helper.d.ts +23 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/cleanup-helper.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/common/browser.d.ts +17 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/common/browser.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/common/coordinates.d.ts +6 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/common/coordinates.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/common/dom.d.ts +44 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/common/dom.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/common/element-extensions.d.ts +26 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/common/element-extensions.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/common/error.d.ts +7 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/common/error.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/common/local-store.d.ts +10 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/common/local-store.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/common/selection-info.d.ts +4 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/common/selection-info.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/common/string.d.ts +7 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/common/string.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/common/util.d.ts +73 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/common/util.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/logger/logging.d.ts +67 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/logger/logging.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/main.d.ts +8 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/main.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/package-info.d.ts +2 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/package-info.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/shared-data.d.ts +27 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/shared-data.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/speech-document.d.ts +91 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/speech-document.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/text-control-lib/base-control.d.ts +100 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/text-control-lib/base-control.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/text-control-lib/contenteditable-control.d.ts +18 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/text-control-lib/contenteditable-control.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/text-control-lib/custom-control.d.ts +41 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/text-control-lib/custom-control.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/text-control-lib/factory.d.ts +9 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/text-control-lib/factory.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/text-control-lib/helpers.d.ts +33 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/text-control-lib/helpers.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/text-control-lib/index.d.ts +6 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/text-control-lib/index.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/text-control-lib/input-control.d.ts +7 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/text-control-lib/input-control.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/text-control-lib/processing-status.d.ts +1 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/text-control-lib/processing-status.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/text-control-lib/text-control-manager.d.ts +38 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/text-control-lib/text-control-manager.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/text-control-lib/text-control.d.ts +64 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/text-control-lib/text-control.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/text-control-lib/textarea-control.d.ts +7 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/text-control-lib/textarea-control.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/text-control-lib/tinymce-control.d.ts +11 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/text-control-lib/tinymce-control.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/webtcl/channel.d.ts +15 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/webtcl/channel.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/webtcl/commands.d.ts +64 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/webtcl/commands.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/webtcl/custom-controls/custom-control.d.ts +212 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/webtcl/custom-controls/custom-control.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/webtcl/custom-controls/index.d.ts +6 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/webtcl/custom-controls/index.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/webtcl/custom-controls/input-custom-control.d.ts +2 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/webtcl/custom-controls/input-custom-control.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/webtcl/custom-controls/textarea-custom-control.d.ts +2 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/webtcl/custom-controls/textarea-custom-control.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/webtcl/diagnostics.d.ts +37 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/webtcl/diagnostics.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/webtcl/dom-observable.d.ts +13 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/webtcl/dom-observable.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/webtcl/events.d.ts +39 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/webtcl/events.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/webtcl/iframe-support.d.ts +29 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/webtcl/iframe-support.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/webtcl/index.d.ts +26 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/webtcl/index.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/webtcl/processing-status.d.ts +1 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/webtcl/processing-status.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/webtcl/state.d.ts +165 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/webtcl/state.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/webtcl/types.d.ts +21 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/webtcl/types.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/webtcl/utility-types.d.ts +3 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/webtcl/utility-types.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/webtcl/validation.d.ts +35 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/webtcl/validation.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/webtcl/webtcl-attributes.d.ts +104 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/webtcl/webtcl-attributes.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/webtcl/webtcl-client.d.ts +16 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/webtcl/webtcl-client.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/webtcl/webtcl-controller.d.ts +8 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/webtcl/webtcl-controller.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/webtcl/worker.d.ts +18 -0
- package/node_modules/@hccm/web-tcl/dist/cjs/webtcl/worker.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/esm/cleanup-helper.d.ts +23 -0
- package/node_modules/@hccm/web-tcl/dist/esm/cleanup-helper.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/esm/common/browser.d.ts +17 -0
- package/node_modules/@hccm/web-tcl/dist/esm/common/browser.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/esm/common/coordinates.d.ts +6 -0
- package/node_modules/@hccm/web-tcl/dist/esm/common/coordinates.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/esm/common/dom.d.ts +44 -0
- package/node_modules/@hccm/web-tcl/dist/esm/common/dom.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/esm/common/element-extensions.d.ts +26 -0
- package/node_modules/@hccm/web-tcl/dist/esm/common/element-extensions.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/esm/common/error.d.ts +7 -0
- package/node_modules/@hccm/web-tcl/dist/esm/common/error.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/esm/common/local-store.d.ts +10 -0
- package/node_modules/@hccm/web-tcl/dist/esm/common/local-store.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/esm/common/selection-info.d.ts +4 -0
- package/node_modules/@hccm/web-tcl/dist/esm/common/selection-info.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/esm/common/string.d.ts +7 -0
- package/node_modules/@hccm/web-tcl/dist/esm/common/string.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/esm/common/util.d.ts +73 -0
- package/node_modules/@hccm/web-tcl/dist/esm/common/util.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/esm/logger/logging.d.ts +67 -0
- package/node_modules/@hccm/web-tcl/dist/esm/logger/logging.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/esm/main.d.ts +8 -0
- package/node_modules/@hccm/web-tcl/dist/esm/main.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/esm/package-info.d.ts +2 -0
- package/node_modules/@hccm/web-tcl/dist/esm/package-info.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/esm/shared-data.d.ts +27 -0
- package/node_modules/@hccm/web-tcl/dist/esm/shared-data.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/esm/speech-document.d.ts +91 -0
- package/node_modules/@hccm/web-tcl/dist/esm/speech-document.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/esm/text-control-lib/base-control.d.ts +100 -0
- package/node_modules/@hccm/web-tcl/dist/esm/text-control-lib/base-control.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/esm/text-control-lib/contenteditable-control.d.ts +18 -0
- package/node_modules/@hccm/web-tcl/dist/esm/text-control-lib/contenteditable-control.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/esm/text-control-lib/custom-control.d.ts +41 -0
- package/node_modules/@hccm/web-tcl/dist/esm/text-control-lib/custom-control.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/esm/text-control-lib/factory.d.ts +9 -0
- package/node_modules/@hccm/web-tcl/dist/esm/text-control-lib/factory.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/esm/text-control-lib/helpers.d.ts +33 -0
- package/node_modules/@hccm/web-tcl/dist/esm/text-control-lib/helpers.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/esm/text-control-lib/index.d.ts +6 -0
- package/node_modules/@hccm/web-tcl/dist/esm/text-control-lib/index.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/esm/text-control-lib/input-control.d.ts +7 -0
- package/node_modules/@hccm/web-tcl/dist/esm/text-control-lib/input-control.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/esm/text-control-lib/processing-status.d.ts +1 -0
- package/node_modules/@hccm/web-tcl/dist/esm/text-control-lib/processing-status.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/esm/text-control-lib/text-control-manager.d.ts +38 -0
- package/node_modules/@hccm/web-tcl/dist/esm/text-control-lib/text-control-manager.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/esm/text-control-lib/text-control.d.ts +64 -0
- package/node_modules/@hccm/web-tcl/dist/esm/text-control-lib/text-control.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/esm/text-control-lib/textarea-control.d.ts +7 -0
- package/node_modules/@hccm/web-tcl/dist/esm/text-control-lib/textarea-control.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/esm/text-control-lib/tinymce-control.d.ts +11 -0
- package/node_modules/@hccm/web-tcl/dist/esm/text-control-lib/tinymce-control.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/esm/webtcl/channel.d.ts +15 -0
- package/node_modules/@hccm/web-tcl/dist/esm/webtcl/channel.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/esm/webtcl/commands.d.ts +64 -0
- package/node_modules/@hccm/web-tcl/dist/esm/webtcl/commands.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/esm/webtcl/custom-controls/custom-control.d.ts +212 -0
- package/node_modules/@hccm/web-tcl/dist/esm/webtcl/custom-controls/custom-control.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/esm/webtcl/custom-controls/index.d.ts +6 -0
- package/node_modules/@hccm/web-tcl/dist/esm/webtcl/custom-controls/index.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/esm/webtcl/custom-controls/input-custom-control.d.ts +2 -0
- package/node_modules/@hccm/web-tcl/dist/esm/webtcl/custom-controls/input-custom-control.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/esm/webtcl/custom-controls/textarea-custom-control.d.ts +2 -0
- package/node_modules/@hccm/web-tcl/dist/esm/webtcl/custom-controls/textarea-custom-control.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/esm/webtcl/diagnostics.d.ts +37 -0
- package/node_modules/@hccm/web-tcl/dist/esm/webtcl/diagnostics.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/esm/webtcl/dom-observable.d.ts +13 -0
- package/node_modules/@hccm/web-tcl/dist/esm/webtcl/dom-observable.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/esm/webtcl/events.d.ts +39 -0
- package/node_modules/@hccm/web-tcl/dist/esm/webtcl/events.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/esm/webtcl/iframe-support.d.ts +29 -0
- package/node_modules/@hccm/web-tcl/dist/esm/webtcl/iframe-support.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/esm/webtcl/index.d.ts +26 -0
- package/node_modules/@hccm/web-tcl/dist/esm/webtcl/index.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/esm/webtcl/processing-status.d.ts +1 -0
- package/node_modules/@hccm/web-tcl/dist/esm/webtcl/processing-status.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/esm/webtcl/state.d.ts +165 -0
- package/node_modules/@hccm/web-tcl/dist/esm/webtcl/state.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/esm/webtcl/types.d.ts +21 -0
- package/node_modules/@hccm/web-tcl/dist/esm/webtcl/types.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/esm/webtcl/utility-types.d.ts +3 -0
- package/node_modules/@hccm/web-tcl/dist/esm/webtcl/utility-types.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/esm/webtcl/validation.d.ts +35 -0
- package/node_modules/@hccm/web-tcl/dist/esm/webtcl/validation.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/esm/webtcl/webtcl-attributes.d.ts +104 -0
- package/node_modules/@hccm/web-tcl/dist/esm/webtcl/webtcl-attributes.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/esm/webtcl/webtcl-client.d.ts +16 -0
- package/node_modules/@hccm/web-tcl/dist/esm/webtcl/webtcl-client.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/esm/webtcl/webtcl-controller.d.ts +8 -0
- package/node_modules/@hccm/web-tcl/dist/esm/webtcl/webtcl-controller.js +1 -0
- package/node_modules/@hccm/web-tcl/dist/esm/webtcl/worker.d.ts +18 -0
- package/node_modules/@hccm/web-tcl/dist/esm/webtcl/worker.js +1 -0
- package/node_modules/@hccm/web-tcl/package.json +72 -0
- package/package.json +5 -3
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { WebTCLClient } from "./webtcl-client";
|
|
2
|
+
import type { CustomControlInitializer, CustomControlCollection } from "./custom-controls";
|
|
3
|
+
import { getAttributeValue, setAttributeValue, hasAttribute, removeAttribute } from "./webtcl-attributes";
|
|
4
|
+
export type { WebTCLCommands, WebTCLCommand } from "./commands";
|
|
5
|
+
export type { WebTCLEvents, WebTCLEvent } from "./events";
|
|
6
|
+
export type { WebTCLState } from "./state";
|
|
7
|
+
export type { WebTCLClient };
|
|
8
|
+
export { subscribeToIframeMessages } from "./iframe-support";
|
|
9
|
+
export type { AdditionalReplaceTextParameters, FormattingBoundary } from "./types";
|
|
10
|
+
export { FormattingBoundaries } from "./types";
|
|
11
|
+
export declare const webTCLAttributes: {
|
|
12
|
+
getValue: typeof getAttributeValue;
|
|
13
|
+
setValue: typeof setAttributeValue;
|
|
14
|
+
has: typeof hasAttribute;
|
|
15
|
+
remove: typeof removeAttribute;
|
|
16
|
+
};
|
|
17
|
+
export type { CustomControlInitializer, CustomControlCollection };
|
|
18
|
+
export type WebTCLClientOptions = {
|
|
19
|
+
selector: string;
|
|
20
|
+
/**
|
|
21
|
+
* Custom Controls
|
|
22
|
+
* @see {@link CustomControlCollection}
|
|
23
|
+
*/
|
|
24
|
+
customControls?: CustomControlCollection;
|
|
25
|
+
};
|
|
26
|
+
export declare function createClient({ customControls, ...otherOptions }: WebTCLClientOptions): WebTCLClient;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__rest as t}from"tslib";import{SpeechDocument as e}from"../speech-document";import{createController as o}from"./webtcl-controller";import{createClient as r}from"./webtcl-client";import{getAttributeValue as s,setAttributeValue as c,hasAttribute as m,removeAttribute as n}from"./webtcl-attributes";export{subscribeToIframeMessages}from"./iframe-support";export{FormattingBoundaries}from"./types";export const webTCLAttributes={getValue:s,setValue:c,has:m,remove:n};export function createClient(s){var{customControls:c}=s,m=t(s,["customControls"]);const n=o(Object.assign(Object.assign({},m),{speechdocument:new e({customControls:c})}));return r({controller:n})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ProcessingStatus = "pending" | "idle";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{};
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { type Observable } from "rxjs";
|
|
2
|
+
import type { WebTCLEvent, WebTCLEvents } from "./events";
|
|
3
|
+
import type { Capabilities } from "../text-control-lib/text-control";
|
|
4
|
+
export type WebTCLState = {
|
|
5
|
+
timestamp: number;
|
|
6
|
+
isInitialized: boolean;
|
|
7
|
+
isDisabled: boolean;
|
|
8
|
+
focusedControl: string | null;
|
|
9
|
+
textControls: {
|
|
10
|
+
id: string;
|
|
11
|
+
containerId: string;
|
|
12
|
+
text: string;
|
|
13
|
+
selection: {
|
|
14
|
+
start: number;
|
|
15
|
+
length: number;
|
|
16
|
+
};
|
|
17
|
+
status: "pending" | "idle";
|
|
18
|
+
paragraph: string;
|
|
19
|
+
newLine: string;
|
|
20
|
+
capabilities?: Capabilities;
|
|
21
|
+
conceptName?: string;
|
|
22
|
+
documentFieldId?: string;
|
|
23
|
+
dictationMode?: string;
|
|
24
|
+
isMultiline?: boolean;
|
|
25
|
+
}[];
|
|
26
|
+
};
|
|
27
|
+
export type Reducers<TState, TMap> = {
|
|
28
|
+
[K in keyof TMap]: ({ state, payload }: {
|
|
29
|
+
state: TState;
|
|
30
|
+
payload: TMap[K];
|
|
31
|
+
}) => Partial<WebTCLState> | undefined;
|
|
32
|
+
};
|
|
33
|
+
export declare function createState(event$: Observable<WebTCLEvent>, initialState: WebTCLState, reducers: Reducers<WebTCLState, WebTCLEvents>): Observable<WebTCLState>;
|
|
34
|
+
export declare const stateReducers: {
|
|
35
|
+
readonly initialized: ({ payload }: {
|
|
36
|
+
state: WebTCLState;
|
|
37
|
+
payload: {
|
|
38
|
+
type: "initialized";
|
|
39
|
+
timestamp: number;
|
|
40
|
+
} & Pick<WebTCLState, "isInitialized" | "isDisabled">;
|
|
41
|
+
}) => {
|
|
42
|
+
timestamp: number;
|
|
43
|
+
isInitialized: boolean;
|
|
44
|
+
isDisabled: boolean;
|
|
45
|
+
};
|
|
46
|
+
readonly disposed: ({ payload }: {
|
|
47
|
+
state: WebTCLState;
|
|
48
|
+
payload: {
|
|
49
|
+
type: "disposed";
|
|
50
|
+
timestamp: number;
|
|
51
|
+
};
|
|
52
|
+
}) => {
|
|
53
|
+
timestamp: number;
|
|
54
|
+
focusedControl: string;
|
|
55
|
+
isInitialized: false;
|
|
56
|
+
isDisabled: false;
|
|
57
|
+
textControls: never[];
|
|
58
|
+
};
|
|
59
|
+
readonly focusChanged: ({ state, payload }: {
|
|
60
|
+
state: WebTCLState;
|
|
61
|
+
payload: {
|
|
62
|
+
type: "focusChanged";
|
|
63
|
+
timestamp: number;
|
|
64
|
+
} & {
|
|
65
|
+
id: string;
|
|
66
|
+
isFocused: boolean;
|
|
67
|
+
};
|
|
68
|
+
}) => {
|
|
69
|
+
timestamp: number;
|
|
70
|
+
focusedControl: string;
|
|
71
|
+
} | undefined;
|
|
72
|
+
readonly controlChanged: ({ state, payload }: {
|
|
73
|
+
state: WebTCLState;
|
|
74
|
+
payload: {
|
|
75
|
+
type: "controlChanged";
|
|
76
|
+
timestamp: number;
|
|
77
|
+
} & {
|
|
78
|
+
id: string;
|
|
79
|
+
text: string;
|
|
80
|
+
selection: {
|
|
81
|
+
start: number;
|
|
82
|
+
length: number;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
}) => {
|
|
86
|
+
timestamp: number;
|
|
87
|
+
textControls: {
|
|
88
|
+
id: string;
|
|
89
|
+
containerId: string;
|
|
90
|
+
text: string;
|
|
91
|
+
selection: {
|
|
92
|
+
start: number;
|
|
93
|
+
length: number;
|
|
94
|
+
};
|
|
95
|
+
status: "pending" | "idle";
|
|
96
|
+
paragraph: string;
|
|
97
|
+
newLine: string;
|
|
98
|
+
capabilities?: Capabilities;
|
|
99
|
+
conceptName?: string;
|
|
100
|
+
documentFieldId?: string;
|
|
101
|
+
dictationMode?: string;
|
|
102
|
+
isMultiline?: boolean;
|
|
103
|
+
}[];
|
|
104
|
+
} | undefined;
|
|
105
|
+
readonly controlsChanged: ({ payload }: {
|
|
106
|
+
state: WebTCLState;
|
|
107
|
+
payload: {
|
|
108
|
+
type: "controlsChanged";
|
|
109
|
+
timestamp: number;
|
|
110
|
+
} & Pick<WebTCLState, "textControls" | "focusedControl">;
|
|
111
|
+
}) => {
|
|
112
|
+
timestamp: number;
|
|
113
|
+
textControls: {
|
|
114
|
+
id: string;
|
|
115
|
+
containerId: string;
|
|
116
|
+
text: string;
|
|
117
|
+
selection: {
|
|
118
|
+
start: number;
|
|
119
|
+
length: number;
|
|
120
|
+
};
|
|
121
|
+
status: "pending" | "idle";
|
|
122
|
+
paragraph: string;
|
|
123
|
+
newLine: string;
|
|
124
|
+
capabilities?: Capabilities;
|
|
125
|
+
conceptName?: string;
|
|
126
|
+
documentFieldId?: string;
|
|
127
|
+
dictationMode?: string;
|
|
128
|
+
isMultiline?: boolean;
|
|
129
|
+
}[];
|
|
130
|
+
focusedControl: string | null;
|
|
131
|
+
};
|
|
132
|
+
readonly statusChanged: ({ state, payload }: {
|
|
133
|
+
state: WebTCLState;
|
|
134
|
+
payload: {
|
|
135
|
+
type: "statusChanged";
|
|
136
|
+
timestamp: number;
|
|
137
|
+
} & {
|
|
138
|
+
id: string;
|
|
139
|
+
status: import("./processing-status").ProcessingStatus;
|
|
140
|
+
};
|
|
141
|
+
}) => {
|
|
142
|
+
timestamp: number;
|
|
143
|
+
textControls: {
|
|
144
|
+
id: string;
|
|
145
|
+
containerId: string;
|
|
146
|
+
text: string;
|
|
147
|
+
selection: {
|
|
148
|
+
start: number;
|
|
149
|
+
length: number;
|
|
150
|
+
};
|
|
151
|
+
status: "pending" | "idle";
|
|
152
|
+
paragraph: string;
|
|
153
|
+
newLine: string;
|
|
154
|
+
capabilities?: Capabilities;
|
|
155
|
+
conceptName?: string;
|
|
156
|
+
documentFieldId?: string;
|
|
157
|
+
dictationMode?: string;
|
|
158
|
+
isMultiline?: boolean;
|
|
159
|
+
}[];
|
|
160
|
+
} | undefined;
|
|
161
|
+
};
|
|
162
|
+
export declare function reduceState({ state, event }: {
|
|
163
|
+
state: WebTCLState;
|
|
164
|
+
event: WebTCLEvent;
|
|
165
|
+
}): Partial<WebTCLState>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{filter as t,scan as e,shareReplay as s,startWith as n}from"rxjs";export function createState(o,i,a){return o.pipe(t(t=>t.type in a),e((t,e)=>{const s=a[e.type];return Object.assign(Object.assign({},t),s({state:t,payload:e}))},i),n(i),s(1))}export const stateReducers={initialized({payload:t}){return{timestamp:t.timestamp,isInitialized:t.isInitialized,isDisabled:t.isDisabled}},disposed({payload:t}){return{timestamp:t.timestamp,focusedControl:"",isInitialized:false,isDisabled:false,textControls:[]}},focusChanged({state:t,payload:e}){if(e.isFocused&&t.focusedControl!==e.id){return{timestamp:e.timestamp,focusedControl:e.id}}if(!e.isFocused&&t.focusedControl!==""){return{timestamp:e.timestamp,focusedControl:""}}return undefined},controlChanged({state:t,payload:e}){const s=t.textControls.findIndex(t=>t.id===e.id);const n=s>-1?t.textControls[s]:undefined;if(!n||n.text===e.text&&n.selection.start===e.selection.start&&n.selection.length===e.selection.length){return undefined}return{timestamp:e.timestamp,textControls:[...t.textControls.slice(0,s),Object.assign(Object.assign({},n),{text:e.text,selection:e.selection}),...t.textControls.slice(s+1)]}},controlsChanged({payload:t}){return{timestamp:t.timestamp,textControls:t.textControls,focusedControl:t.focusedControl}},statusChanged({state:t,payload:e}){const s=t.textControls.findIndex(t=>t.id===e.id);const n=s>-1?t.textControls[s]:undefined;if(!n||n.status===e.status){return undefined}return{timestamp:e.timestamp,textControls:[...t.textControls.slice(0,s),Object.assign(Object.assign({},n),{status:e.status}),...t.textControls.slice(s+1)]}}};export function reduceState({state:t,event:e}){const s=stateReducers[e.type];if(!s){throw new Error(`Event type: ${e.type} has no reducers`)}return s({state:t,payload:e})}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type NextObserver, type Observable } from "rxjs";
|
|
2
|
+
import type { WebTCLCommand } from "./commands";
|
|
3
|
+
import type { WebTCLEvent } from "./events";
|
|
4
|
+
export type WebTCLController = {
|
|
5
|
+
isValidCommand: (type: WebTCLCommand) => boolean;
|
|
6
|
+
readonly commands: NextObserver<WebTCLCommand>;
|
|
7
|
+
readonly event$: Observable<WebTCLEvent>;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Enum representing values to determine text formatting based on cursor position.
|
|
11
|
+
* @param Start Use start side text format (bold, italic, etc) of of the defined selection.
|
|
12
|
+
* @param End Use end side text format (bold, italic, etc) of of the defined selection.
|
|
13
|
+
*/
|
|
14
|
+
export declare const FormattingBoundaries: Readonly<{
|
|
15
|
+
Start: "start";
|
|
16
|
+
End: "end";
|
|
17
|
+
}>;
|
|
18
|
+
export type FormattingBoundary = (typeof FormattingBoundaries)[keyof typeof FormattingBoundaries];
|
|
19
|
+
export type AdditionalReplaceTextParameters = {
|
|
20
|
+
matchFormattingAtThe?: FormattingBoundary;
|
|
21
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{}from"rxjs";export const FormattingBoundaries=Object.freeze({Start:"start",End:"end"});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if the given HTML element is supported by the text control library.
|
|
3
|
+
*
|
|
4
|
+
* @param element - The HTML element to check.
|
|
5
|
+
* @returns A boolean indicating whether the element is supported or not.
|
|
6
|
+
*/
|
|
7
|
+
export declare function isSupportedHtmlElement(element: HTMLElement): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Checks if the given HTML element or any of its children are supported HTML elements.
|
|
10
|
+
*
|
|
11
|
+
* @param element - The HTML element to check.
|
|
12
|
+
* @returns A boolean indicating whether the element or any of its children are supported HTML elements.
|
|
13
|
+
*/
|
|
14
|
+
export declare function containsSupportedHtmlElement(element: HTMLElement): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Checks if the given HTMLInputElement is a supported input type.
|
|
17
|
+
*
|
|
18
|
+
* @param element - The HTMLInputElement to check.
|
|
19
|
+
* @returns A boolean indicating whether the input type is supported or not.
|
|
20
|
+
*/
|
|
21
|
+
export declare function isSupportedHtmlInputElement(element: HTMLInputElement): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Checks if the given HTML element is a custom control.
|
|
24
|
+
*
|
|
25
|
+
* @param element - The HTML element to check.
|
|
26
|
+
* @returns `true` if the element is a custom control, otherwise `false`.
|
|
27
|
+
*/
|
|
28
|
+
export declare function isCustomControl(element: HTMLElement): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Checks if the given HTML element is a custom container.
|
|
31
|
+
*
|
|
32
|
+
* @param element - The HTML element to check.
|
|
33
|
+
* @returns A boolean indicating whether the element is a custom container.
|
|
34
|
+
*/
|
|
35
|
+
export declare function isCustomContainer(element: HTMLElement): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{isElementAttributeEnabled as t}from"../shared-data";import{getTinyMceEditor as e,getCustomControlType as r,getCustomContainerType as n}from"../text-control-lib";export function isSupportedHtmlElement(t){if(isCustomControl(t))return true;if(t instanceof HTMLInputElement)return isSupportedHtmlInputElement(t);if(t instanceof HTMLTextAreaElement)return true;if(e(t))return true;if(t.contentEditable==="true")return true;return false}export function containsSupportedHtmlElement(t){if(isSupportedHtmlElement(t)){return true}for(const e of t.children){if(containsSupportedHtmlElement(e)){return true}}return false}export function isSupportedHtmlInputElement(e){const r=e.type?e.type.toLowerCase():"";if(r==="text"){return true}else if(r==="search"||r==="number"){return t(e)}return false}export function isCustomControl(t){return r(t)!=null}export function isCustomContainer(t){return n(t)!=null}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A frozen mapping of logical attribute names to their corresponding HTML data attribute names
|
|
3
|
+
* for both "dragon" and "nusa" naming conventions. "nusa" is only for backwards compatibility.
|
|
4
|
+
*
|
|
5
|
+
* Each key represents a logical attribute used within the application, and its value is a tuple
|
|
6
|
+
* containing the "dragon" and "nusa" data attribute names, respectively.
|
|
7
|
+
*
|
|
8
|
+
* This map is used to ensure consistent access and manipulation of custom data attributes
|
|
9
|
+
* across different naming schemes in the codebase.
|
|
10
|
+
*
|
|
11
|
+
* @property controlId - Unique identifier for speech enabled controls
|
|
12
|
+
* @property container - Identifies elements that contain controls to speech enable
|
|
13
|
+
* @property conceptName - Semantic name for voice commands and accessibility
|
|
14
|
+
* @property isEnabled - Controls whether a control should be speech enabled or not
|
|
15
|
+
* @property dictationMode - Specifies the dictation mode (e.g., "dictation", "nli")
|
|
16
|
+
* @property documentFieldId - Links controls to document field identifiers
|
|
17
|
+
* @property markerContainer - Identifies containers for Dragon logo/marker elements
|
|
18
|
+
* @property internalIgnore - Internal attribute that is used for contenteditable support
|
|
19
|
+
* @property customControlType - Specifies the type of a custom control implementation
|
|
20
|
+
*/
|
|
21
|
+
export declare const DragonAttributesMap: Readonly<{
|
|
22
|
+
readonly controlId: readonly ["data-dragon-id", "data-nusa-id"];
|
|
23
|
+
readonly container: readonly ["data-dragon-container", "data-nusa-container"];
|
|
24
|
+
readonly conceptName: readonly ["data-dragon-concept-name", "data-nusa-concept-name"];
|
|
25
|
+
readonly isEnabled: readonly ["data-dragon-enabled", "data-nusa-enabled"];
|
|
26
|
+
readonly dictationMode: readonly ["data-dragon-dictation-mode", "data-nusa-dictation-mode"];
|
|
27
|
+
readonly documentFieldId: readonly ["data-dragon-document-field-id", "data-nusa-document-field-id"];
|
|
28
|
+
readonly markerContainer: readonly ["data-dragon-marker-container", "data-nusa-marker-container"];
|
|
29
|
+
readonly internalIgnore: readonly ["data-dragon-internal-ignore", "data-nusai-ignore"];
|
|
30
|
+
readonly customControlType: readonly ["data-dragon-custom-control-type", "data-nusa-custom-control-type"];
|
|
31
|
+
}>;
|
|
32
|
+
/**
|
|
33
|
+
* Represents the set of valid attribute names defined in the `DragonAttributesMap` object.
|
|
34
|
+
*
|
|
35
|
+
* This type is a union of all string keys present in `DragonAttributesMap`, ensuring type safety
|
|
36
|
+
* when working with attribute names throughout the application.
|
|
37
|
+
*/
|
|
38
|
+
export type DragonAttribute = keyof typeof DragonAttributesMap;
|
|
39
|
+
/**
|
|
40
|
+
* Retrieves the value of a specified attribute from a given DOM element.
|
|
41
|
+
*
|
|
42
|
+
* Looks up the attribute key in the `DragonAttributesMap` to find possible attribute names,
|
|
43
|
+
* then attempts to get the value of the first attribute. If not found, it tries the second attribute.
|
|
44
|
+
*
|
|
45
|
+
* @param element - The DOM element from which to retrieve the attribute value.
|
|
46
|
+
* @param key - The key used to look up possible attribute names in `DragonAttributesMap`.
|
|
47
|
+
* @returns The value of the found attribute, or `null` if neither attribute is present.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```typescript
|
|
51
|
+
* // Assuming 'element' is a DOM element and a data-dragon-id or data-nusa-id attribute is set
|
|
52
|
+
* const value = getAttributeValue(element, 'controlId');
|
|
53
|
+
* // value === '123'
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export declare function getAttributeValue(element: Element, key: DragonAttribute): string | null;
|
|
57
|
+
/**
|
|
58
|
+
* Sets the value of a specified attribute on a given DOM element using the Dragon attribute mapping.
|
|
59
|
+
*
|
|
60
|
+
* @param element - The DOM element on which to set the attribute.
|
|
61
|
+
* @param key - The DragonAttribute key used to look up the corresponding attribute name.
|
|
62
|
+
* @param value - The value to assign to the attribute.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```typescript
|
|
66
|
+
* // Assuming 'element' is a DOM element
|
|
67
|
+
* setAttributeValue(element, 'controlId', '123');
|
|
68
|
+
* // The element now has the mapped 'data-dragon-id' attribute set to '123'
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
export declare function setAttributeValue(element: Element, key: DragonAttribute, value: string): void;
|
|
72
|
+
/**
|
|
73
|
+
* Removes the specified attribute from the given DOM element.
|
|
74
|
+
*
|
|
75
|
+
* This function looks up the attribute mapping for the provided `key` using `DragonAttributesMap`,
|
|
76
|
+
* and removes the mapped attribute names from the element.
|
|
77
|
+
*
|
|
78
|
+
* @param element - The DOM element from which the attribute(s) will be removed.
|
|
79
|
+
* @param key - The logical attribute key, used to look up the actual attribute names in `DragonAttributesMap`.
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```typescript
|
|
83
|
+
* // Assuming 'element' is a DOM element and a data-dragon-id or data-nusa-id attribute is set
|
|
84
|
+
* removeAttribute(element, 'controlId');
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
export declare function removeAttribute(element: Element, key: DragonAttribute): void;
|
|
88
|
+
/**
|
|
89
|
+
* Checks if the specified element has the given Dragon attribute.
|
|
90
|
+
*
|
|
91
|
+
* This function looks up the attribute key in the `DragonAttributesMap` and checks
|
|
92
|
+
* if the element has either the primary or secondary attribute name associated with the key.
|
|
93
|
+
*
|
|
94
|
+
* @param element - The DOM element to check for the attribute.
|
|
95
|
+
* @param key - The Dragon attribute key to look up in the `DragonAttributesMap`.
|
|
96
|
+
* @returns `true` if the element has the attribute, otherwise `false`.
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```typescript
|
|
100
|
+
* // Assuming 'element' is a DOM element and a data-dragon-id or data-nusa-id attribute is set
|
|
101
|
+
* const hasControlId = hasAttribute(element, 'controlId'); // returns true
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
export declare function hasAttribute(element: Element, key: DragonAttribute): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const DragonAttributesMap=Object.freeze({controlId:["data-dragon-id","data-nusa-id"],container:["data-dragon-container","data-nusa-container"],conceptName:["data-dragon-concept-name","data-nusa-concept-name"],isEnabled:["data-dragon-enabled","data-nusa-enabled"],dictationMode:["data-dragon-dictation-mode","data-nusa-dictation-mode"],documentFieldId:["data-dragon-document-field-id","data-nusa-document-field-id"],markerContainer:["data-dragon-marker-container","data-nusa-marker-container"],internalIgnore:["data-dragon-internal-ignore","data-nusai-ignore"],customControlType:["data-dragon-custom-control-type","data-nusa-custom-control-type"]});export function getAttributeValue(t,a){const n=DragonAttributesMap[a];const e=t.getAttribute(n[0]);return e!==null&&e!==void 0?e:t.getAttribute(n[1])}export function setAttributeValue(t,a,n){const e=DragonAttributesMap[a][0];t.setAttribute(e,n)}export function removeAttribute(t,a){const n=DragonAttributesMap[a];t.removeAttribute(n[0]);t.removeAttribute(n[1])}export function hasAttribute(t,a){const n=DragonAttributesMap[a];const e=t.hasAttribute(n[0]);return e?e:t.hasAttribute(n[1])}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type Observable } from "rxjs";
|
|
2
|
+
import type { WebTCLEvents } from "./events";
|
|
3
|
+
import type { WebTCLCommands } from "./commands";
|
|
4
|
+
import type { WebTCLState } from "./state";
|
|
5
|
+
import { type ChannelReceiver, type ChannelSender } from "./channel";
|
|
6
|
+
import type { WebTCLController } from "./types";
|
|
7
|
+
export type WebTCLClient = Readonly<{
|
|
8
|
+
commands: ChannelSender<WebTCLCommands>;
|
|
9
|
+
events: ChannelReceiver<WebTCLEvents>;
|
|
10
|
+
state$: Observable<WebTCLState>;
|
|
11
|
+
currentState: WebTCLState;
|
|
12
|
+
dispose(this: void): void;
|
|
13
|
+
}>;
|
|
14
|
+
export declare function createClient({ controller }: {
|
|
15
|
+
controller: WebTCLController;
|
|
16
|
+
}): WebTCLClient;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{BehaviorSubject as e,Subject as t}from"rxjs";import{channelReceiver as s,channelSender as o}from"./channel";import{createWorker as n}from"./worker";export function createClient({controller:r}){const a={focusedControl:"",isDisabled:false,isInitialized:false,textControls:[],timestamp:0};const l=new t;const i=new t;const c=new e(a);const m=n({controller:r,client:{command$:l.asObservable(),events:i},states:c});return{commands:o(l),events:s(i.asObservable()),state$:c.asObservable(),get currentState(){return c.value},dispose(){l.next({type:"dispose"});m.dispose()}}}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SpeechDocument } from "../speech-document";
|
|
2
|
+
import type { WebTCLController } from "./types";
|
|
3
|
+
type ControllerOptions = {
|
|
4
|
+
speechdocument: SpeechDocument;
|
|
5
|
+
selector?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function createController({ speechdocument, selector }: ControllerOptions): WebTCLController;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{CustomControl as t}from"../text-control-lib";import{SharedData as e}from"../shared-data";import{currentTimestamp as n}from"./events";import{bufferTime as s,concatMap as o,delay as i,distinctUntilChanged as c,filter as r,fromEvent as u,map as a,merge as l,of as d,startWith as p,Subject as m,Subscription as g,tap as b,withLatestFrom as f}from"rxjs";import{attributesToObserve as v,createDomObservable as h}from"./dom-observable";import{containsSupportedHtmlElement as x}from"./validation";export function createController({speechdocument:t,selector:o}){const i=new m;const c={};let u=g.EMPTY;const l={activate(e){t.setControlActive(e.id,true)},deactivate(e){t.setControlActive(e.id,false)},dispose(){T({subscriptions:c});u.unsubscribe();t.deInitialize();const e=n();i.next({type:"controlsChanged",timestamp:e,focusedControl:"",textControls:[]});i.next({type:"disposed",timestamp:e})},focus(e){t.setControlFocus(e.id)},initialize(l){var d;e.shouldEnableAllElements=!l.isDisabled;t.initialize({document:document,selector:o,disableGuiMarkup:!l.useGuiMarkup});const p=n();i.next({type:"initialized",timestamp:p,isDisabled:l.isDisabled,isInitialized:t.isInitialized});S({speechdocument:t,events:i,subscriptions:c});const m=M({speechdocument:t,timestamp:p});i.next(m);const g=(d=o?document.querySelector(o):document.body)!==null&&d!==void 0?d:document.body;u=h(g).pipe(a(C),r(t=>t),s(200),r(t=>t.length>0),b(()=>y({speechdocument:t,selector:o,events:i,subscriptions:c}))).subscribe()},replaceText(e){t.replaceText(e.id,e.text,e.selection.start,e.selection.start+e.selection.length,e.additionalParameters)},selectNode(e){t.selectNode(e.id,e.shouldFocus)},setRecordingState(t){e.isRecording=t.state==="started"},setSelection(e){t.setSelection(e.id,e.selection.start,e.selection.length)},setStatus(e){t.setProcessingStatus(e.id,e.status)},setText(e){t.setText(e.id,e.text)},redo(e){t.redo(e.id)},undo(e){t.undo(e.id)}};const d=t=>{if(!t.type){return false}return!!l[t.type]};return{isValidCommand:d,commands:{next(t){const e=l[t.type];if(!e){throw new Error(`Command type: ${t.type} has no handlers`)}e(t)}},event$:i.asObservable()}}function C(t){if(!(t.target instanceof HTMLElement)){return false}switch(t.type){case"childList":if(!t.target.isContentEditable&&t.target.tagName!=="TEXTAREA"&&!!t.target.parentElement){return t.added.some(x)||t.removed.some(x)}else{return false}case"attributes":return v.some(e=>t.attributeName===e);default:return false}}function y({speechdocument:t,events:e,subscriptions:s,selector:o}){const i=n();t.scanDocument(o);S({speechdocument:t,events:e,subscriptions:s});const c=M({speechdocument:t,timestamp:i});e.next(c)}function S({speechdocument:e,events:n,subscriptions:s}){T({subscriptions:s});const o=e.textControlManager.getTextControls();for(const e of o){if(!e.isValid()||!e.guid){continue}const o=e.guid;s[o]=e instanceof t?E({textControl:e,events:n}):w({textControl:e,events:n})}}function w({textControl:t,events:e}){var s;const g=(s=t.guid)!==null&&s!==void 0?s:"";const v=t.htmlElement;const h=u(document,"selectionchange");const x=u(document,"mouseup");const C=new m;const y=new MutationObserver(t=>C.next({type:"mutation"}));y.observe(v,{attributes:true,attributeFilter:["value"],characterData:true,subtree:true,childList:true});const S=u(v,"keyup");const w=u(v,"keydown");const E=u(v,"mouseup");const T=u(v,"mousedown");const M=u(v,"change");const A=u(v,"focusout");const k=u(v,"focusin");const z=u(v,"input");const D=u(v,"touchend");const I=u(v,"processingStatusChanged");const N=u(v,"pendingSelectionChanged");const P=l(w.pipe(a(t=>t.shiftKey&&(t.key==="ArrowLeft"||t.key==="ArrowRight"||t.key==="ArrowUp"||t.key==="ArrowDown"))),S.pipe(a(()=>false)),T.pipe(a(()=>true)),x.pipe(a(()=>false))).pipe(p(false),c());const L=l(h,P).pipe(f(P),r(([,t])=>{if(t){return false}const e=document.getSelection();if(!e||e.rangeCount===0){return false}return document.activeElement===v}));const $=l(N,P).pipe(f(P),r(([,t])=>{if(v===document.activeElement){return false}return!t}));const R=l(k,A).subscribe(t=>{const s=t.type==="focusin";e.next({type:"focusChanged",id:g,isFocused:s,timestamp:n()})});const O=l(S,E,M,L,$,z,D,C).pipe(o(e=>d(e).pipe(i(0),a(()=>{var e;const{start:s,length:o}=t.getSelection();return{type:"controlChanged",id:(e=t.guid)!==null&&e!==void 0?e:"",timestamp:n(),selection:{start:s,length:o},text:t.getText()}}))),c(F),b(t=>e.next(t))).subscribe();const j=I.pipe(a(e=>{var s;return{type:"statusChanged",id:(s=t.guid)!==null&&s!==void 0?s:"",timestamp:n(),status:t.getProcessingStatus()}}),c((t,e)=>t.status===e.status),b(t=>e.next(t))).subscribe();return()=>{R.unsubscribe();O.unsubscribe();j.unsubscribe();y.disconnect()}}function E({textControl:t,events:e}){const s=t.state$.pipe(r(t=>t.focus!==null),a(e=>{var s;return{type:"focusChanged",id:(s=t.guid)!==null&&s!==void 0?s:"",isFocused:e.focus,timestamp:n()}}),c(A),b(t=>e.next(t))).subscribe();const o=t.state$.pipe(r(t=>t.selection!==null||t.text!==null),a(()=>{var e;return{type:"controlChanged",id:(e=t.guid)!==null&&e!==void 0?e:"",timestamp:n(),selection:t.getSelection(),text:t.getText()}}),c(F),b(t=>e.next(t))).subscribe();const i=t.processingStatus$.pipe(a(e=>{var s;return{type:"statusChanged",id:(s=t.guid)!==null&&s!==void 0?s:"",timestamp:n(),status:t.getProcessingStatus()}}),c((t,e)=>t.status===e.status),b(t=>e.next(t))).subscribe();return()=>{s===null||s===void 0?void 0:s.unsubscribe();o===null||o===void 0?void 0:o.unsubscribe();i.unsubscribe()}}function T({subscriptions:t}){for(const[e,n]of Object.entries(t)){n();delete t[e]}}function M({speechdocument:t,timestamp:e}){var n,s;const o=t.textControlManager.getContainers();const i=t.textControlManager.getTextControls();const c=i.map(t=>{var e,n;const s=(e=t.guid)!==null&&e!==void 0?e:"";const{start:i,length:c}=t.getSelection();return{id:s,containerId:(n=o[s])!==null&&n!==void 0?n:"",newLine:t.newlineFormat,paragraph:t.paragraphFormat,selection:{start:i,length:c},status:t.getProcessingStatus(),text:t.getText(),conceptName:t.conceptName,dictationMode:t.dictationMode,isMultiline:t.isMultiline,documentFieldId:t.documentFieldId,capabilities:t.capabilities}});const r=(s=(n=i.find(t=>document.activeElement===t.htmlElement))===null||n===void 0?void 0:n.guid)!==null&&s!==void 0?s:"";return{type:"controlsChanged",timestamp:e,focusedControl:r,textControls:c}}function F(t,e){if(!t||!e){return false}return t.id===e.id&&t.text===e.text&&t.selection.start===e.selection.start&&t.selection.length===e.selection.length}function A(t,e){if(!t||!e){return false}return t.id===e.id&&t.isFocused===e.isFocused}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type BehaviorSubject, type NextObserver, type Observable } from "rxjs";
|
|
2
|
+
import { type WebTCLState } from "./state";
|
|
3
|
+
import type { WebTCLCommand } from "./commands";
|
|
4
|
+
import type { WebTCLEvent } from "./events";
|
|
5
|
+
export type WebTCLWorkerOptions = {
|
|
6
|
+
client: {
|
|
7
|
+
command$: Observable<WebTCLCommand>;
|
|
8
|
+
events: NextObserver<WebTCLEvent>;
|
|
9
|
+
};
|
|
10
|
+
controller: {
|
|
11
|
+
commands: NextObserver<WebTCLCommand>;
|
|
12
|
+
event$: Observable<WebTCLEvent>;
|
|
13
|
+
};
|
|
14
|
+
states: BehaviorSubject<WebTCLState>;
|
|
15
|
+
};
|
|
16
|
+
export declare function createWorker({ client, controller, states }: WebTCLWorkerOptions): {
|
|
17
|
+
dispose(this: void): void;
|
|
18
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{withLatestFrom as e}from"rxjs";import{reduceState as t}from"./state";import{createDiagnostics as n}from"./diagnostics";export function createWorker({client:r,controller:s,states:c}){const a=n();const i=[r.command$.subscribe(e=>{if(a.isEnabled){a.trace({type:"command-executing",command:e})}s.commands.next(e);if(a.isEnabled){a.trace({type:"command-executed",command:e})}}),s.event$.pipe(e(c)).subscribe(([e,n])=>{const s=t({state:n,event:e});if(!s){return}const i=Object.assign({},n,s);c.next(i);if(a.isEnabled){a.trace({type:"state-changed",state:n,newState:i,trigger:e});a.trace({type:"event-dispatching",event:e})}r.events.next(e);if(a.isEnabled){a.trace({type:"event-dispatched",event:e})}})];if(a.isEnabled){a.trace({type:"worker-created"})}return{dispose(){for(const e of i){e.unsubscribe()}if(a.isEnabled){a.trace({type:"worker-destroyed"})}}}}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@hccm/web-tcl",
|
|
3
|
+
"version": "1.20.0",
|
|
4
|
+
"files": [
|
|
5
|
+
"dist",
|
|
6
|
+
"CHANGELOG.md"
|
|
7
|
+
],
|
|
8
|
+
"sideEffects": false,
|
|
9
|
+
"keywords": [
|
|
10
|
+
"dragon",
|
|
11
|
+
"speech"
|
|
12
|
+
],
|
|
13
|
+
"license": "TBD",
|
|
14
|
+
"author": "Microsoft HLS AI Engineering Team",
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@eslint/js": "^9.24.0",
|
|
17
|
+
"@types/jsdom": "^21.1.7",
|
|
18
|
+
"@types/node": "^22.14.0",
|
|
19
|
+
"@typescript-eslint/parser": "^8.29.1",
|
|
20
|
+
"@vitest/coverage-v8": "^3.1.1",
|
|
21
|
+
"concurrently": "^9.1.2",
|
|
22
|
+
"eslint": "^9.24.0",
|
|
23
|
+
"eslint-config-prettier": "^10.1.1",
|
|
24
|
+
"eslint-plugin-prettier": "^5.2.6",
|
|
25
|
+
"globals": "^16.0.0",
|
|
26
|
+
"jsdom": "^26.0.0",
|
|
27
|
+
"prettier": "^3.5.3",
|
|
28
|
+
"rimraf": "^6.0.1",
|
|
29
|
+
"rxjs": "^7.8.2",
|
|
30
|
+
"terser": "^5.44.0",
|
|
31
|
+
"tslib": "^2.8.1",
|
|
32
|
+
"typescript": "^5.8.3",
|
|
33
|
+
"typescript-eslint": "^8.29.1",
|
|
34
|
+
"vitest": "^3.1.1"
|
|
35
|
+
},
|
|
36
|
+
"main": "dist/cjs/main.js",
|
|
37
|
+
"module": "dist/esm/main.js",
|
|
38
|
+
"exports": {
|
|
39
|
+
".": {
|
|
40
|
+
"import": {
|
|
41
|
+
"types": "./dist/esm/main.d.js",
|
|
42
|
+
"default": "./dist/esm/main.js"
|
|
43
|
+
},
|
|
44
|
+
"require": {
|
|
45
|
+
"types": "./dist/cjs/main.d.js",
|
|
46
|
+
"default": "./dist/cjs/main.js"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"./package.json": "./package.json"
|
|
50
|
+
},
|
|
51
|
+
"peerDependencies": {
|
|
52
|
+
"rxjs": "^7.8.0"
|
|
53
|
+
},
|
|
54
|
+
"scripts": {
|
|
55
|
+
"ts": "tsc -p tsconfig.build.esm.json --noEmit",
|
|
56
|
+
"clean": "rimraf dist/esm dist/cjs",
|
|
57
|
+
"dev": "concurrently --kill-others \"npm run dev:esm\" \"npm run dev:cjs\" --names \"ESM,CJS\" --prefix name --prefix-colors \"bgBlue.bold,bgMagenta.bold\"",
|
|
58
|
+
"dev:esm": "tsc -p tsconfig.build.esm.dev.json --watch",
|
|
59
|
+
"dev:cjs": "tsc -p tsconfig.build.cjs.dev.json --watch",
|
|
60
|
+
"build:ci": "npm run lint && npm run format && npm run build:prod",
|
|
61
|
+
"build:prod": "node ./prebuild.cjs && npm run build:esm && npm run build:cjs && npm run minify",
|
|
62
|
+
"build:dev": "node ./prebuild.cjs && npm run build:esm:dev && npm run build:cjs:dev",
|
|
63
|
+
"build:esm": "rimraf dist/esm && tsc -p tsconfig.build.esm.json",
|
|
64
|
+
"build:cjs": "rimraf dist/cjs && tsc -p tsconfig.build.cjs.json",
|
|
65
|
+
"build:esm:dev": "rimraf dist/esm && tsc -p tsconfig.build.esm.dev.json",
|
|
66
|
+
"build:cjs:dev": "rimraf dist/cjs && tsc -p tsconfig.build.cjs.dev.json",
|
|
67
|
+
"minify": "node ./minify.mjs",
|
|
68
|
+
"lint": "eslint . --report-unused-disable-directives --max-warnings 0",
|
|
69
|
+
"format": "prettier --check 'src/**/*.{js,jsx,ts,tsx,json}'",
|
|
70
|
+
"format:fix": "prettier --write 'src/**/*.{js,jsx,ts,tsx,json}'"
|
|
71
|
+
}
|
|
72
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/dragon-copilot-sdk-lexical-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Lexical React integration for Dragon Copilot SDK",
|
|
5
5
|
"license": "See LICENSE file",
|
|
6
6
|
"homepage": "https://github.com/microsoft/dragon-copilot-sdk-samples",
|
|
@@ -33,10 +33,12 @@
|
|
|
33
33
|
"vitest": "^3.0.0"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@dragon-speech-sdk/lexical-react": "1.0.0-official.4593501"
|
|
36
|
+
"@dragon-speech-sdk/lexical-react": "1.0.0-official.4593501",
|
|
37
|
+
"@hccm/web-tcl": "1.20.0"
|
|
37
38
|
},
|
|
38
39
|
"bundledDependencies": [
|
|
39
|
-
"@dragon-speech-sdk/lexical-react"
|
|
40
|
+
"@dragon-speech-sdk/lexical-react",
|
|
41
|
+
"@hccm/web-tcl"
|
|
40
42
|
],
|
|
41
43
|
"peerDependencies": {
|
|
42
44
|
"@lexical/react": ">=0.34.0",
|