@@ -5,14 +5,27 @@ import { type IncludesMap, type Settings, getSettings, updateSettings } from './
55
66type RefreshViewCallback = ( ) => void ;
77
8+ /**
9+ * Manages the user interface for configuring includes settings in the Tasks plugin.
10+ *
11+ * This class handles rendering, updating, and managing the includes settings UI components.
12+ */
813export class IncludesSettingsUI {
914 private readonly plugin : TasksPlugin ;
1015 private readonly includesSettingsService = new IncludesSettingsService ( ) ;
1116
17+ /**
18+ * Creates a new instance of IncludesSettingsUI
19+ * @param plugin The Tasks plugin instance
20+ */
1221 constructor ( plugin : TasksPlugin ) {
1322 this . plugin = plugin ;
1423 }
1524
25+ /**
26+ * Renders the includes settings interface in the specified container
27+ * @param containerEl The HTML element to render the settings interface in
28+ */
1629 public renderIncludesSettings ( containerEl : HTMLElement ) {
1730 const includesContainer = containerEl . createDiv ( ) ;
1831 const settings = getSettings ( ) ;
@@ -30,6 +43,14 @@ export class IncludesSettingsUI {
3043 this . createAddNewIncludeButton ( containerEl , settings , renderIncludes ) ;
3144 }
3245
46+ /**
47+ * Renders a single include item with its controls
48+ * @param includesContainer The container element for the include item
49+ * @param settings The current plugin settings
50+ * @param key The key/name of the include
51+ * @param value The value/query of the include
52+ * @param refreshView Callback to refresh the view after changes
53+ */
3354 private renderIncludeItem (
3455 includesContainer : HTMLDivElement ,
3556 settings : Settings ,
@@ -99,6 +120,10 @@ export class IncludesSettingsUI {
99120 } ) ;
100121 }
101122
123+ /**
124+ * Sets up auto-resizing behaviour for a textarea component
125+ * @param textArea The textarea component to configure
126+ */
102127 private setupAutoResizingTextarea ( textArea : TextAreaComponent ) {
103128 const resize = ( ) => {
104129 textArea . inputEl . style . height = 'auto' ; // reset first
@@ -112,6 +137,12 @@ export class IncludesSettingsUI {
112137 textArea . inputEl . addEventListener ( 'input' , resize ) ;
113138 }
114139
140+ /**
141+ * Creates and configures the "Add new include" button
142+ * @param containerEl The container element for the button
143+ * @param settings The current plugin settings
144+ * @param refreshView Callback to refresh the view after adding a new include
145+ */
115146 private createAddNewIncludeButton ( containerEl : HTMLElement , settings : Settings , refreshView : RefreshViewCallback ) {
116147 new Setting ( containerEl ) . addButton ( ( btn ) => {
117148 btn . setButtonText ( 'Add new include' )
0 commit comments