refactor(core): standardize Widget API with EditorWidget base class#147
Open
bunbun79 wants to merge 1 commit into
Open
refactor(core): standardize Widget API with EditorWidget base class#147bunbun79 wants to merge 1 commit into
bunbun79 wants to merge 1 commit into
Conversation
- Add EditorWidget abstract base class (extends WidgetType) with: editing lock management, lifecycle hooks, WidgetContext, estimatedHeight contract - Add WidgetInteractionState / isWidgetEditing() to replace bare tableEditingCount - Add WidgetContext interface for safe CM6 view access from widgets - Migrate EditableTableWidget to extend EditorWidget - Migrate NexusWidget to extend EditorWidget with lifecycle hook support - Add WidgetLifecycleHooks to WidgetDefinition (backward-compatible) - Deprecate WidgetDefinition.destroy in favor of lifecycle.willDestroy - Add 6 table clipboard/native-selection tests - Add OpenSpec proposal for widget-api standardization Closes: P1 roadmap item 'Widget API standardization'
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Unify the two separate widget systems under a shared
EditorWidgetbase class. Replace the baretableEditingCountglobal withisWidgetEditing(). Add lifecycle hooks andWidgetContext.Motivation
docs/ROADMAP.mdfeat(search): support regex queries #9)openspec/changes/add-widget-api-standardization/Before this PR, Nexus had two independent widget systems with zero shared infrastructure. The bare
tableEditingCountglobal was untestable. Plugin widgets had no lifecycle hooks or lock management.Changes
packages/core/src/widget-base.tsEditorWidgetabstract base classpackages/core/src/widget-state.tsisWidgetEditing()/ lock managementpackages/core/src/widget-context.tsWidgetContextinterfacepackages/core/src/live-preview-table.tsEditableTableWidget extends EditorWidgetpackages/core/src/widget-extension.tsNexusWidget extends EditorWidget+ lifecyclepackages/core/src/types.tsWidgetLifecycleHooks, deprecateddestroypackages/core/test/live-preview.test.tsArchitecture
Testing
pnpm test— 521 tests, 34 files, 0 failuresopenspec/changes/add-widget-api-standardization/