@operato/shell 1.12.7 → 1.13.9

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.
@@ -22,12 +22,26 @@ function diff(after: any, before: any): any {
22
22
  return changed && changes
23
23
  }
24
24
 
25
+ /**
26
+ * PageView is a base class for creating page elements with lifecycle management.
27
+ * Subclasses can extend PageView to define custom behavior and handle page lifecycle events.
28
+ */
25
29
  export class PageView extends LitElement {
30
+ /**
31
+ * Determines whether the page can be deactivated. Subclasses can override this method
32
+ * to implement custom deactivation logic.
33
+ * @returns A Promise that resolves to true if the page can be deactivated, or false otherwise.
34
+ */
26
35
  async canDeactivate(): Promise<boolean> {
27
36
  return Promise.resolve(true)
28
37
  }
29
38
 
30
- // Only render this page if it's actually visible.
39
+ /**
40
+ * Determines whether the page should update. This method is called whenever there are
41
+ * changes to the page's properties.
42
+ * @param changes - A map of changed property values.
43
+ * @returns True if the page should update, or false otherwise.
44
+ */
31
45
  shouldUpdate(changes: PropertyValues<this>) {
32
46
  var active = String(this.active) == 'true'
33
47
  var { active: oldActive = false } = this._oldLifecycleInfo$ || {}
@@ -50,13 +64,31 @@ export class PageView extends LitElement {
50
64
  return active
51
65
  }
52
66
 
67
+ /**
68
+ * Indicates whether the page is currently active.
69
+ */
53
70
  @property({ type: Boolean }) active: boolean = false
71
+
72
+ /**
73
+ * Stores information about the page's lifecycle.
74
+ */
54
75
  @property({ type: Object }) lifecycle: any
76
+
77
+ /**
78
+ * The context path for the page.
79
+ */
55
80
  @property({ type: String, attribute: 'context-path' }) contextPath?: string
56
81
 
57
82
  _oldLifecycleInfo$: any
58
83
 
59
84
  /* lifecycle */
85
+
86
+ /**
87
+ * Handles page updates and lifecycle events. Subclasses can override this method
88
+ * to implement custom logic for initializing, updating, and disposing of the page.
89
+ * @param changes - A map of changed properties.
90
+ * @param force - If true, forces an update of the page.
91
+ */
60
92
  async pageUpdate(changes: any = {}, force: boolean = false) {
61
93
  var before = this._oldLifecycleInfo$ || {}
62
94
 
@@ -113,6 +145,9 @@ export class PageView extends LitElement {
113
145
  }
114
146
  }
115
147
 
148
+ /**
149
+ * Resets the page. Subclasses can override this method to perform custom reset logic.
150
+ */
116
151
  async pageReset() {
117
152
  var { initialized } = this._oldLifecycleInfo$ || {}
118
153
 
@@ -122,14 +157,35 @@ export class PageView extends LitElement {
122
157
  }
123
158
  }
124
159
 
160
+ /**
161
+ * Disposes of the page. Subclasses can override this method to perform custom disposal logic.
162
+ */
125
163
  async pageDispose() {
126
164
  await this.pageUpdate({
127
165
  initialized: false
128
166
  })
129
167
  }
130
168
 
169
+ /**
170
+ * Initializes the page. Subclasses can override this method to perform custom initialization logic.
171
+ * @param pageInfo - Information about the page's state.
172
+ */
131
173
  pageInitialized(pageInfo: any) {}
174
+
175
+ /**
176
+ * Handles page updates and changes in properties.
177
+ * Subclasses can override this method to implement custom update logic.
178
+ * @param changes - A map of changed properties.
179
+ * @param after - The current state of the page.
180
+ * @param before - The previous state of the page.
181
+ */
132
182
  pageUpdated(changes: any, after: any, before: any) {}
183
+
184
+ /**
185
+ * Handles the disposal of the page. Subclasses can override this method
186
+ * to implement custom disposal logic.
187
+ * @param pageInfo - Information about the page's state.
188
+ */
133
189
  pageDisposed(pageInfo: any) {}
134
190
 
135
191
  /* context */
@@ -140,6 +196,12 @@ export class PageView extends LitElement {
140
196
  })
141
197
  }
142
198
 
199
+ /**
200
+ * Updates the context of the page. Subclasses can override the `context` getter
201
+ * to provide specific context information for the page. The context will be updated
202
+ * using the `updateContext` method inherited from PageView.
203
+ * @param override - An optional object with context properties to override.
204
+ */
143
205
  get context() {
144
206
  return {}
145
207
  }