@ai-matrx/context-menu 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/engine.cjs +24 -3
- package/dist/engine.cjs.map +1 -1
- package/dist/engine.d.cts +3 -1
- package/dist/engine.d.ts +3 -1
- package/dist/engine.js +15 -3
- package/dist/engine.js.map +1 -1
- package/dist/menu-content.cjs +31 -7
- package/dist/menu-content.cjs.map +1 -1
- package/dist/menu-content.js +31 -7
- package/dist/menu-content.js.map +1 -1
- package/dist/react.cjs +73 -41
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +72 -40
- package/dist/react.js.map +1 -1
- package/package.json +3 -3
package/dist/engine.d.cts
CHANGED
|
@@ -521,6 +521,8 @@ type Callbacks = RichDocumentActionContext["callbacks"];
|
|
|
521
521
|
type Request = NonNullable<NonNullable<Callbacks>["onRequestTextAgentAction"]>;
|
|
522
522
|
declare function editorTextAgentCallbacks(callbacks: Callbacks, source: ContentSource, adapter: Pick<ContentSourceAdapter, "edit">, request: Request | undefined): Callbacks;
|
|
523
523
|
|
|
524
|
+
declare function preloadTableShape(): Promise<unknown>;
|
|
525
|
+
/** Sync; null until the reader has loaded (a click on a table starts the load at open). */
|
|
524
526
|
declare function tableTextAtTarget(target: Element | null): string | null;
|
|
525
527
|
|
|
526
528
|
/**
|
|
@@ -728,4 +730,4 @@ interface ContextMenuSelectionHost {
|
|
|
728
730
|
}
|
|
729
731
|
declare const contextMenuSelectionProvider: ActionProvider;
|
|
730
732
|
|
|
731
|
-
export { type BuildEditableWidgetHandleArgs, type BuildSelectionWriteBackArgs, CONTEXT_MENU_ENGINE_ID_PREFIXES, CONTEXT_MENU_ENGINE_ROWS, CONTEXT_MENU_SELECTION_HOST_KEY, CONTEXT_REGION_TRIGGER_ATTRS, type ClickedKind, type CompositeTargetHost, type ContextMenuSelectionHost, type ContextMenuTargetHost, type EditorInsertPlacement, type EditorInsertTarget, type EditorInsertTargets, type EditorInsertText, FIELD_PREVIEW_MAX, type InventoryRow, type KeyCombo, MANAGED_CONTEXT_MENU_AGENT_CONFIG, type MenuCheckboxNode, type MenuGroup, MenuGrouping, type MenuHeader, type MenuItemNode, type MenuLabelNode, type MenuLeafNode, type MenuLinkNode, type MenuModel, type MenuNode, type MenuRoles, type MenuSection, type MenuSeparatorNode, type MenuSubmenuNode, OWN_ROWS_MAX, PROPOSED_MENU_GROUPING, type ProposedOptions, type ProviderOptions, RECORD_MENU_ATTR, type RecordMenuRows, STRIP_MAX, type TableRowEditCommands, type TableRowItemHit, type TableRowMenuDescriptor, type WhereTheMenuIs, actionsAlreadyHere, buildDefaultTableRowMenuDescriptor, buildEditableWidgetHandle, buildMenuModel, buildSelectionWriteBack, chatMessageSubject, clickedKind, contextMenuActionsFromModel, contextMenuHostOf, contextMenuProvider, contextMenuSelectionProvider, createDefaultTableRowMenuDescriptor, createTableRowMenuDescriptor, editorTextAgentCallbacks, eventMatchesCombo, fieldLabelOf, fieldPreview, findComboMatch, hasActionable, hasEditorInsertTarget, headerPreview, insertIntoEditor, itemMenuConfigToExtraSections, toastPromise as itemToastPromise, joinExtraSections, joinRowAndSurfaceContext, liftPrimarySections, menuEngineRevision, menuHeader, menuHeaderContent, mergeFieldName, mergeResolvedContextData, modelRevision, namedHeader, openContextMenuForElement, openRecordMenu, ownParagraph, parseKeyCombo, proposedArrangement, recordMenuChanged, recordMenusRevision, registerRecordMenu, registerTableRowContextResolver, registryTreeNodes, resolveEffectiveEntity, resolveEffectiveEntityWithDom, resolveRecordMenu, resolveTableRowItem, resolveTableRowMenuDescriptor, rowRecordName, sniffEntityFromDom, subscribeRecordMenus, tableRowEditCommands, tableTextAtTarget };
|
|
733
|
+
export { type BuildEditableWidgetHandleArgs, type BuildSelectionWriteBackArgs, CONTEXT_MENU_ENGINE_ID_PREFIXES, CONTEXT_MENU_ENGINE_ROWS, CONTEXT_MENU_SELECTION_HOST_KEY, CONTEXT_REGION_TRIGGER_ATTRS, type ClickedKind, type CompositeTargetHost, type ContextMenuSelectionHost, type ContextMenuTargetHost, type EditorInsertPlacement, type EditorInsertTarget, type EditorInsertTargets, type EditorInsertText, FIELD_PREVIEW_MAX, type InventoryRow, type KeyCombo, MANAGED_CONTEXT_MENU_AGENT_CONFIG, type MenuCheckboxNode, type MenuGroup, MenuGrouping, type MenuHeader, type MenuItemNode, type MenuLabelNode, type MenuLeafNode, type MenuLinkNode, type MenuModel, type MenuNode, type MenuRoles, type MenuSection, type MenuSeparatorNode, type MenuSubmenuNode, OWN_ROWS_MAX, PROPOSED_MENU_GROUPING, type ProposedOptions, type ProviderOptions, RECORD_MENU_ATTR, type RecordMenuRows, STRIP_MAX, type TableRowEditCommands, type TableRowItemHit, type TableRowMenuDescriptor, type WhereTheMenuIs, actionsAlreadyHere, buildDefaultTableRowMenuDescriptor, buildEditableWidgetHandle, buildMenuModel, buildSelectionWriteBack, chatMessageSubject, clickedKind, contextMenuActionsFromModel, contextMenuHostOf, contextMenuProvider, contextMenuSelectionProvider, createDefaultTableRowMenuDescriptor, createTableRowMenuDescriptor, editorTextAgentCallbacks, eventMatchesCombo, fieldLabelOf, fieldPreview, findComboMatch, hasActionable, hasEditorInsertTarget, headerPreview, insertIntoEditor, itemMenuConfigToExtraSections, toastPromise as itemToastPromise, joinExtraSections, joinRowAndSurfaceContext, liftPrimarySections, menuEngineRevision, menuHeader, menuHeaderContent, mergeFieldName, mergeResolvedContextData, modelRevision, namedHeader, openContextMenuForElement, openRecordMenu, ownParagraph, parseKeyCombo, preloadTableShape, proposedArrangement, recordMenuChanged, recordMenusRevision, registerRecordMenu, registerTableRowContextResolver, registryTreeNodes, resolveEffectiveEntity, resolveEffectiveEntityWithDom, resolveRecordMenu, resolveTableRowItem, resolveTableRowMenuDescriptor, rowRecordName, sniffEntityFromDom, subscribeRecordMenus, tableRowEditCommands, tableTextAtTarget };
|
package/dist/engine.d.ts
CHANGED
|
@@ -521,6 +521,8 @@ type Callbacks = RichDocumentActionContext["callbacks"];
|
|
|
521
521
|
type Request = NonNullable<NonNullable<Callbacks>["onRequestTextAgentAction"]>;
|
|
522
522
|
declare function editorTextAgentCallbacks(callbacks: Callbacks, source: ContentSource, adapter: Pick<ContentSourceAdapter, "edit">, request: Request | undefined): Callbacks;
|
|
523
523
|
|
|
524
|
+
declare function preloadTableShape(): Promise<unknown>;
|
|
525
|
+
/** Sync; null until the reader has loaded (a click on a table starts the load at open). */
|
|
524
526
|
declare function tableTextAtTarget(target: Element | null): string | null;
|
|
525
527
|
|
|
526
528
|
/**
|
|
@@ -728,4 +730,4 @@ interface ContextMenuSelectionHost {
|
|
|
728
730
|
}
|
|
729
731
|
declare const contextMenuSelectionProvider: ActionProvider;
|
|
730
732
|
|
|
731
|
-
export { type BuildEditableWidgetHandleArgs, type BuildSelectionWriteBackArgs, CONTEXT_MENU_ENGINE_ID_PREFIXES, CONTEXT_MENU_ENGINE_ROWS, CONTEXT_MENU_SELECTION_HOST_KEY, CONTEXT_REGION_TRIGGER_ATTRS, type ClickedKind, type CompositeTargetHost, type ContextMenuSelectionHost, type ContextMenuTargetHost, type EditorInsertPlacement, type EditorInsertTarget, type EditorInsertTargets, type EditorInsertText, FIELD_PREVIEW_MAX, type InventoryRow, type KeyCombo, MANAGED_CONTEXT_MENU_AGENT_CONFIG, type MenuCheckboxNode, type MenuGroup, MenuGrouping, type MenuHeader, type MenuItemNode, type MenuLabelNode, type MenuLeafNode, type MenuLinkNode, type MenuModel, type MenuNode, type MenuRoles, type MenuSection, type MenuSeparatorNode, type MenuSubmenuNode, OWN_ROWS_MAX, PROPOSED_MENU_GROUPING, type ProposedOptions, type ProviderOptions, RECORD_MENU_ATTR, type RecordMenuRows, STRIP_MAX, type TableRowEditCommands, type TableRowItemHit, type TableRowMenuDescriptor, type WhereTheMenuIs, actionsAlreadyHere, buildDefaultTableRowMenuDescriptor, buildEditableWidgetHandle, buildMenuModel, buildSelectionWriteBack, chatMessageSubject, clickedKind, contextMenuActionsFromModel, contextMenuHostOf, contextMenuProvider, contextMenuSelectionProvider, createDefaultTableRowMenuDescriptor, createTableRowMenuDescriptor, editorTextAgentCallbacks, eventMatchesCombo, fieldLabelOf, fieldPreview, findComboMatch, hasActionable, hasEditorInsertTarget, headerPreview, insertIntoEditor, itemMenuConfigToExtraSections, toastPromise as itemToastPromise, joinExtraSections, joinRowAndSurfaceContext, liftPrimarySections, menuEngineRevision, menuHeader, menuHeaderContent, mergeFieldName, mergeResolvedContextData, modelRevision, namedHeader, openContextMenuForElement, openRecordMenu, ownParagraph, parseKeyCombo, proposedArrangement, recordMenuChanged, recordMenusRevision, registerRecordMenu, registerTableRowContextResolver, registryTreeNodes, resolveEffectiveEntity, resolveEffectiveEntityWithDom, resolveRecordMenu, resolveTableRowItem, resolveTableRowMenuDescriptor, rowRecordName, sniffEntityFromDom, subscribeRecordMenus, tableRowEditCommands, tableTextAtTarget };
|
|
733
|
+
export { type BuildEditableWidgetHandleArgs, type BuildSelectionWriteBackArgs, CONTEXT_MENU_ENGINE_ID_PREFIXES, CONTEXT_MENU_ENGINE_ROWS, CONTEXT_MENU_SELECTION_HOST_KEY, CONTEXT_REGION_TRIGGER_ATTRS, type ClickedKind, type CompositeTargetHost, type ContextMenuSelectionHost, type ContextMenuTargetHost, type EditorInsertPlacement, type EditorInsertTarget, type EditorInsertTargets, type EditorInsertText, FIELD_PREVIEW_MAX, type InventoryRow, type KeyCombo, MANAGED_CONTEXT_MENU_AGENT_CONFIG, type MenuCheckboxNode, type MenuGroup, MenuGrouping, type MenuHeader, type MenuItemNode, type MenuLabelNode, type MenuLeafNode, type MenuLinkNode, type MenuModel, type MenuNode, type MenuRoles, type MenuSection, type MenuSeparatorNode, type MenuSubmenuNode, OWN_ROWS_MAX, PROPOSED_MENU_GROUPING, type ProposedOptions, type ProviderOptions, RECORD_MENU_ATTR, type RecordMenuRows, STRIP_MAX, type TableRowEditCommands, type TableRowItemHit, type TableRowMenuDescriptor, type WhereTheMenuIs, actionsAlreadyHere, buildDefaultTableRowMenuDescriptor, buildEditableWidgetHandle, buildMenuModel, buildSelectionWriteBack, chatMessageSubject, clickedKind, contextMenuActionsFromModel, contextMenuHostOf, contextMenuProvider, contextMenuSelectionProvider, createDefaultTableRowMenuDescriptor, createTableRowMenuDescriptor, editorTextAgentCallbacks, eventMatchesCombo, fieldLabelOf, fieldPreview, findComboMatch, hasActionable, hasEditorInsertTarget, headerPreview, insertIntoEditor, itemMenuConfigToExtraSections, toastPromise as itemToastPromise, joinExtraSections, joinRowAndSurfaceContext, liftPrimarySections, menuEngineRevision, menuHeader, menuHeaderContent, mergeFieldName, mergeResolvedContextData, modelRevision, namedHeader, openContextMenuForElement, openRecordMenu, ownParagraph, parseKeyCombo, preloadTableShape, proposedArrangement, recordMenuChanged, recordMenusRevision, registerRecordMenu, registerTableRowContextResolver, registryTreeNodes, resolveEffectiveEntity, resolveEffectiveEntityWithDom, resolveRecordMenu, resolveTableRowItem, resolveTableRowMenuDescriptor, rowRecordName, sniffEntityFromDom, subscribeRecordMenus, tableRowEditCommands, tableTextAtTarget };
|
package/dist/engine.js
CHANGED
|
@@ -83,6 +83,7 @@ __export(engine_exports, {
|
|
|
83
83
|
openRecordMenu: () => openRecordMenu,
|
|
84
84
|
ownParagraph: () => ownParagraph,
|
|
85
85
|
parseKeyCombo: () => parseKeyCombo,
|
|
86
|
+
preloadTableShape: () => preloadTableShape,
|
|
86
87
|
proposedArrangement: () => proposedArrangement,
|
|
87
88
|
recordMenuChanged: () => recordMenuChanged,
|
|
88
89
|
recordMenusRevision: () => recordMenusRevision,
|
|
@@ -2754,11 +2755,21 @@ function buildEditableWidgetHandle(args) {
|
|
|
2754
2755
|
}
|
|
2755
2756
|
|
|
2756
2757
|
// src/engine/utils/table-at-target.ts
|
|
2757
|
-
|
|
2758
|
+
var shapeReader = null;
|
|
2759
|
+
var shapeLoad = null;
|
|
2760
|
+
function preloadTableShape() {
|
|
2761
|
+
shapeLoad ??= import("@ai-matrx/records-ui/table-shape").then((m) => {
|
|
2762
|
+
shapeReader = m.shapeTextOfNode;
|
|
2763
|
+
}).catch((error) => {
|
|
2764
|
+
shapeLoad = null;
|
|
2765
|
+
console.error("[ContextMenuV3] could not load the table shape reader", error);
|
|
2766
|
+
});
|
|
2767
|
+
return shapeLoad;
|
|
2768
|
+
}
|
|
2758
2769
|
function tableTextAtTarget(target) {
|
|
2759
2770
|
const table = target?.closest("table");
|
|
2760
|
-
if (!table) return null;
|
|
2761
|
-
const text =
|
|
2771
|
+
if (!table || !shapeReader) return null;
|
|
2772
|
+
const text = shapeReader(table.cloneNode(true));
|
|
2762
2773
|
return text.trim() ? text : null;
|
|
2763
2774
|
}
|
|
2764
2775
|
|
|
@@ -3223,6 +3234,7 @@ export {
|
|
|
3223
3234
|
openRecordMenu,
|
|
3224
3235
|
ownParagraph,
|
|
3225
3236
|
parseKeyCombo,
|
|
3237
|
+
preloadTableShape,
|
|
3226
3238
|
proposedArrangement,
|
|
3227
3239
|
recordMenuChanged,
|
|
3228
3240
|
recordMenusRevision,
|