aac-board-viewer 0.2.9 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/board-viewer.d.mts +2 -2
- package/dist/board-viewer.d.ts +2 -2
- package/dist/board-viewer.js +14 -2
- package/dist/board-viewer.js.map +1 -1
- package/dist/board-viewer.mjs +14 -2
- package/dist/board-viewer.mjs.map +1 -1
- package/dist/{index-BL1tS3BY.d.mts → index-B783kPn6.d.mts} +8 -11
- package/dist/{index-BL1tS3BY.d.ts → index-B783kPn6.d.ts} +8 -11
- package/dist/index.d.mts +7 -10
- package/dist/index.d.ts +7 -10
- package/dist/index.js +22 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -4
- package/dist/index.mjs.map +1 -1
- package/dist/vue/index.js +21 -4
- package/dist/vue/index.js.map +1 -1
- package/dist/vue/index.mjs +21 -4
- package/dist/vue/index.mjs.map +1 -1
- package/dist/vue.d.mts +2 -2
- package/dist/vue.d.ts +2 -2
- package/package.json +5 -5
|
@@ -4,18 +4,18 @@ import * as _willwade_aac_processors from '@willwade/aac-processors';
|
|
|
4
4
|
* Button metric information for effort scoring
|
|
5
5
|
*/
|
|
6
6
|
interface ButtonMetric {
|
|
7
|
-
/** Button ID */
|
|
8
7
|
id: string;
|
|
9
|
-
/** Button label text */
|
|
10
8
|
label: string;
|
|
11
|
-
/** Cognitive effort score (lower is easier) */
|
|
12
9
|
effort: number;
|
|
13
|
-
/** Usage count */
|
|
14
10
|
count?: number;
|
|
15
|
-
/** Whether the button represents a word */
|
|
16
11
|
is_word?: boolean;
|
|
17
|
-
/** Depth level in navigation tree */
|
|
18
12
|
level?: number;
|
|
13
|
+
pos?: string;
|
|
14
|
+
is_word_form?: boolean;
|
|
15
|
+
parent_button_id?: string;
|
|
16
|
+
parent_button_label?: string;
|
|
17
|
+
semantic_id?: string;
|
|
18
|
+
clone_id?: string;
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* Props for BoardViewer component
|
|
@@ -64,17 +64,14 @@ interface LoadAACFileResult {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
interface MetricsOptions {
|
|
67
|
-
/** Access method: 'direct' or 'scanning' */
|
|
68
67
|
accessMethod?: 'direct' | 'scanning';
|
|
69
|
-
/** Scanning configuration */
|
|
70
68
|
scanningConfig?: {
|
|
71
|
-
/** Scanning pattern: 'linear', 'row-column', or 'block' */
|
|
72
69
|
pattern?: 'linear' | 'row-column' | 'block';
|
|
73
|
-
/** Selection method for scanning */
|
|
74
70
|
selectionMethod?: string;
|
|
75
|
-
/** Enable error correction */
|
|
76
71
|
errorCorrection?: boolean;
|
|
77
72
|
};
|
|
73
|
+
useSmartGrammar?: boolean;
|
|
74
|
+
morphologyLocale?: string;
|
|
78
75
|
}
|
|
79
76
|
|
|
80
77
|
export type { ButtonMetric as B, LoadAACFileResult as L, MetricsOptions as M, BoardViewerProps as a };
|
|
@@ -4,18 +4,18 @@ import * as _willwade_aac_processors from '@willwade/aac-processors';
|
|
|
4
4
|
* Button metric information for effort scoring
|
|
5
5
|
*/
|
|
6
6
|
interface ButtonMetric {
|
|
7
|
-
/** Button ID */
|
|
8
7
|
id: string;
|
|
9
|
-
/** Button label text */
|
|
10
8
|
label: string;
|
|
11
|
-
/** Cognitive effort score (lower is easier) */
|
|
12
9
|
effort: number;
|
|
13
|
-
/** Usage count */
|
|
14
10
|
count?: number;
|
|
15
|
-
/** Whether the button represents a word */
|
|
16
11
|
is_word?: boolean;
|
|
17
|
-
/** Depth level in navigation tree */
|
|
18
12
|
level?: number;
|
|
13
|
+
pos?: string;
|
|
14
|
+
is_word_form?: boolean;
|
|
15
|
+
parent_button_id?: string;
|
|
16
|
+
parent_button_label?: string;
|
|
17
|
+
semantic_id?: string;
|
|
18
|
+
clone_id?: string;
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* Props for BoardViewer component
|
|
@@ -64,17 +64,14 @@ interface LoadAACFileResult {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
interface MetricsOptions {
|
|
67
|
-
/** Access method: 'direct' or 'scanning' */
|
|
68
67
|
accessMethod?: 'direct' | 'scanning';
|
|
69
|
-
/** Scanning configuration */
|
|
70
68
|
scanningConfig?: {
|
|
71
|
-
/** Scanning pattern: 'linear', 'row-column', or 'block' */
|
|
72
69
|
pattern?: 'linear' | 'row-column' | 'block';
|
|
73
|
-
/** Selection method for scanning */
|
|
74
70
|
selectionMethod?: string;
|
|
75
|
-
/** Enable error correction */
|
|
76
71
|
errorCorrection?: boolean;
|
|
77
72
|
};
|
|
73
|
+
useSmartGrammar?: boolean;
|
|
74
|
+
morphologyLocale?: string;
|
|
78
75
|
}
|
|
79
76
|
|
|
80
77
|
export type { ButtonMetric as B, LoadAACFileResult as L, MetricsOptions as M, BoardViewerProps as a };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { BoardViewer } from './board-viewer.mjs';
|
|
2
2
|
import { AACTree } from '@willwade/aac-processors';
|
|
3
3
|
export { AACButton, AACPage, AACSemanticAction, AACSemanticCategory, AACSemanticIntent, AACTree } from '@willwade/aac-processors';
|
|
4
|
-
import { M as MetricsOptions, B as ButtonMetric, L as LoadAACFileResult } from './index-
|
|
5
|
-
export { a as BoardViewerProps } from './index-
|
|
4
|
+
import { M as MetricsOptions, B as ButtonMetric, L as LoadAACFileResult } from './index-B783kPn6.mjs';
|
|
5
|
+
export { a as BoardViewerProps } from './index-B783kPn6.mjs';
|
|
6
6
|
import 'react/jsx-runtime';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -292,14 +292,7 @@ declare function loadAACFileWithMetadata(input: string | File | Blob, options?:
|
|
|
292
292
|
* });
|
|
293
293
|
* ```
|
|
294
294
|
*/
|
|
295
|
-
declare function calculateMetrics(tree: AACTree, options?: {
|
|
296
|
-
accessMethod?: 'direct' | 'scanning';
|
|
297
|
-
scanningConfig?: {
|
|
298
|
-
pattern?: 'linear' | 'row-column' | 'block';
|
|
299
|
-
selectionMethod?: string;
|
|
300
|
-
errorCorrection?: boolean;
|
|
301
|
-
};
|
|
302
|
-
}): Promise<{
|
|
295
|
+
declare function calculateMetrics(tree: AACTree, options?: MetricsOptions): Promise<{
|
|
303
296
|
id: string;
|
|
304
297
|
label: string;
|
|
305
298
|
effort: number;
|
|
@@ -308,6 +301,10 @@ declare function calculateMetrics(tree: AACTree, options?: {
|
|
|
308
301
|
level: number | undefined;
|
|
309
302
|
semantic_id: string | undefined;
|
|
310
303
|
clone_id: string | undefined;
|
|
304
|
+
pos: string | undefined;
|
|
305
|
+
is_word_form: boolean | undefined;
|
|
306
|
+
parent_button_id: string | undefined;
|
|
307
|
+
parent_button_label: string | undefined;
|
|
311
308
|
}[]>;
|
|
312
309
|
/**
|
|
313
310
|
* Get a list of supported file formats
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { BoardViewer } from './board-viewer.js';
|
|
2
2
|
import { AACTree } from '@willwade/aac-processors';
|
|
3
3
|
export { AACButton, AACPage, AACSemanticAction, AACSemanticCategory, AACSemanticIntent, AACTree } from '@willwade/aac-processors';
|
|
4
|
-
import { M as MetricsOptions, B as ButtonMetric, L as LoadAACFileResult } from './index-
|
|
5
|
-
export { a as BoardViewerProps } from './index-
|
|
4
|
+
import { M as MetricsOptions, B as ButtonMetric, L as LoadAACFileResult } from './index-B783kPn6.js';
|
|
5
|
+
export { a as BoardViewerProps } from './index-B783kPn6.js';
|
|
6
6
|
import 'react/jsx-runtime';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -292,14 +292,7 @@ declare function loadAACFileWithMetadata(input: string | File | Blob, options?:
|
|
|
292
292
|
* });
|
|
293
293
|
* ```
|
|
294
294
|
*/
|
|
295
|
-
declare function calculateMetrics(tree: AACTree, options?: {
|
|
296
|
-
accessMethod?: 'direct' | 'scanning';
|
|
297
|
-
scanningConfig?: {
|
|
298
|
-
pattern?: 'linear' | 'row-column' | 'block';
|
|
299
|
-
selectionMethod?: string;
|
|
300
|
-
errorCorrection?: boolean;
|
|
301
|
-
};
|
|
302
|
-
}): Promise<{
|
|
295
|
+
declare function calculateMetrics(tree: AACTree, options?: MetricsOptions): Promise<{
|
|
303
296
|
id: string;
|
|
304
297
|
label: string;
|
|
305
298
|
effort: number;
|
|
@@ -308,6 +301,10 @@ declare function calculateMetrics(tree: AACTree, options?: {
|
|
|
308
301
|
level: number | undefined;
|
|
309
302
|
semantic_id: string | undefined;
|
|
310
303
|
clone_id: string | undefined;
|
|
304
|
+
pos: string | undefined;
|
|
305
|
+
is_word_form: boolean | undefined;
|
|
306
|
+
parent_button_id: string | undefined;
|
|
307
|
+
parent_button_label: string | undefined;
|
|
311
308
|
}[]>;
|
|
312
309
|
/**
|
|
313
310
|
* Get a list of supported file formats
|
package/dist/index.js
CHANGED
|
@@ -52,7 +52,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
52
52
|
// src/components/BoardViewer.tsx
|
|
53
53
|
var import_react = __toESM(require("react"));
|
|
54
54
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
55
|
-
function PredictionsTooltip({ predictions, label, position, buttonMetricsLookup, onClose, onWordClick }) {
|
|
55
|
+
function PredictionsTooltip({ predictions, label, position, buttonMetricsLookup, onClose, onWordClick, pos }) {
|
|
56
56
|
import_react.default.useEffect(() => {
|
|
57
57
|
const handleClickOutside = (e) => {
|
|
58
58
|
if (e.target instanceof HTMLElement && !e.target.closest(".predictions-tooltip")) {
|
|
@@ -76,7 +76,8 @@ function PredictionsTooltip({ predictions, label, position, buttonMetricsLookup,
|
|
|
76
76
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("h4", { className: "text-sm font-semibold text-gray-900 dark:text-white", children: [
|
|
77
77
|
'Word forms for "',
|
|
78
78
|
label,
|
|
79
|
-
'"'
|
|
79
|
+
'"',
|
|
80
|
+
pos && pos !== "Unknown" && pos !== "Ignore" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `ml-1.5 px-1.5 py-0 text-[10px] font-semibold rounded text-white ${pos === "Verb" ? "bg-orange-500" : pos === "Noun" ? "bg-teal-500" : pos === "Pronoun" ? "bg-pink-500" : pos === "Adjective" ? "bg-yellow-500" : "bg-gray-500"}`, children: pos })
|
|
80
81
|
] }),
|
|
81
82
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
82
83
|
"button",
|
|
@@ -292,12 +293,14 @@ function BoardViewer({
|
|
|
292
293
|
const handleShowPredictions = (button, event) => {
|
|
293
294
|
event.stopPropagation();
|
|
294
295
|
const predictions = button.predictions || button.parameters?.predictions;
|
|
296
|
+
const buttonMetric = buttonMetricsLookup[button.id];
|
|
295
297
|
if (predictions && predictions.length > 0) {
|
|
296
298
|
setPredictionsTooltip({
|
|
297
299
|
predictions,
|
|
298
300
|
label: button.label,
|
|
299
301
|
position: { x: event.clientX, y: event.clientY },
|
|
300
302
|
buttonMetricsLookup,
|
|
303
|
+
pos: buttonMetric?.pos || button.pos,
|
|
301
304
|
onWordClick: (word, effort) => {
|
|
302
305
|
const trimmed = word || "";
|
|
303
306
|
if (trimmed) {
|
|
@@ -542,6 +545,14 @@ ${button.message || ""}`,
|
|
|
542
545
|
children: [
|
|
543
546
|
buttonMetric && showEffortBadges && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "absolute top-1 right-1 px-1.5 py-0.5 text-xs font-semibold rounded bg-blue-600 text-white shadow-sm", children: effort.toFixed(1) }),
|
|
544
547
|
hasLink && showLinkIndicators && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "absolute top-1 left-1 w-2 h-2 bg-green-500 rounded-full shadow-sm" }),
|
|
548
|
+
buttonMetric?.pos && buttonMetric.pos !== "Unknown" && buttonMetric.pos !== "Ignore" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
549
|
+
"div",
|
|
550
|
+
{
|
|
551
|
+
className: `absolute top-1 left-1 ${hasLink && showLinkIndicators ? "left-4" : "left-1"} px-1 py-0 text-[8px] font-semibold rounded shadow-sm text-white ${buttonMetric.pos === "Verb" ? "bg-orange-500" : buttonMetric.pos === "Noun" ? "bg-teal-500" : buttonMetric.pos === "Pronoun" ? "bg-pink-500" : buttonMetric.pos === "Adjective" ? "bg-yellow-500" : "bg-gray-500"}`,
|
|
552
|
+
title: `Part of speech: ${buttonMetric.pos}`,
|
|
553
|
+
children: buttonMetric.pos.charAt(0)
|
|
554
|
+
}
|
|
555
|
+
),
|
|
545
556
|
hasPredictions && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
546
557
|
"div",
|
|
547
558
|
{
|
|
@@ -606,6 +617,7 @@ ${button.message || ""}`,
|
|
|
606
617
|
position: predictionsTooltip.position,
|
|
607
618
|
buttonMetricsLookup: predictionsTooltip.buttonMetricsLookup,
|
|
608
619
|
onWordClick: predictionsTooltip.onWordClick,
|
|
620
|
+
pos: predictionsTooltip.pos,
|
|
609
621
|
onClose: () => setPredictionsTooltip(null)
|
|
610
622
|
}
|
|
611
623
|
)
|
|
@@ -792,7 +804,9 @@ async function calculateMetrics(tree, options = {}) {
|
|
|
792
804
|
selectionMethod,
|
|
793
805
|
errorCorrectionEnabled: options.scanningConfig.errorCorrection || false,
|
|
794
806
|
errorRate: 0.1
|
|
795
|
-
}
|
|
807
|
+
},
|
|
808
|
+
useSmartGrammar: options.useSmartGrammar,
|
|
809
|
+
morphologyLocale: options.morphologyLocale
|
|
796
810
|
};
|
|
797
811
|
}
|
|
798
812
|
const metricsResult = calculator.analyze(tree, metricsOptions);
|
|
@@ -804,7 +818,11 @@ async function calculateMetrics(tree, options = {}) {
|
|
|
804
818
|
is_word: true,
|
|
805
819
|
level: btn.level,
|
|
806
820
|
semantic_id: btn.semantic_id,
|
|
807
|
-
clone_id: btn.clone_id
|
|
821
|
+
clone_id: btn.clone_id,
|
|
822
|
+
pos: btn.pos,
|
|
823
|
+
is_word_form: btn.is_word_form,
|
|
824
|
+
parent_button_id: btn.parent_button_id,
|
|
825
|
+
parent_button_label: btn.parent_button_label
|
|
808
826
|
}));
|
|
809
827
|
}
|
|
810
828
|
function getSupportedFormats() {
|