terrier-engine 4.57.1 → 4.57.3

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/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "files": [
5
5
  "*"
6
6
  ],
7
- "version": "4.57.1",
7
+ "version": "4.57.3",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "https://github.com/Terrier-Tech/terrier-engine"
package/terrier/app.ts CHANGED
@@ -89,7 +89,6 @@ export abstract class TerrierApp<TState> extends TerrierPart<TState> {
89
89
  ): ModalType {
90
90
  const modalStack = this.overlayPart.getOrCreateLayer(ModalStackPart, {}, 'modal')
91
91
  const modal = modalStack.pushModal(constructor, state)
92
- modalStack.dirty()
93
92
  return modal as ModalType
94
93
  }
95
94
 
package/terrier/modals.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { Logger } from "tuff-core/logging"
2
- import TerrierPart from "./parts/terrier-part"
2
+ import Messages from "tuff-core/messages"
3
3
  import { PartConstructor, PartTag } from "tuff-core/parts"
4
4
  import ContentPart from "./parts/content-part"
5
- import Messages from "tuff-core/messages"
5
+ import TerrierPart from "./parts/terrier-part"
6
6
 
7
7
  const log = new Logger('Modals')
8
8
 
@@ -124,12 +124,13 @@ export class ModalStackPart extends TerrierPart<{}> {
124
124
  }
125
125
  const modal = this.modals.pop()
126
126
  if (modal) {
127
+ // remove the modal element with
128
+ modal.element?.remove()
127
129
  this.removeChild(modal)
128
130
  }
129
131
  if (this.modals.length == 0) {
130
132
  this.close()
131
133
  }
132
- this.dirty()
133
134
  }
134
135
 
135
136
  close() {
@@ -141,6 +142,8 @@ export class ModalStackPart extends TerrierPart<{}> {
141
142
  stackElem.classList.remove('show')
142
143
  }
143
144
  }
145
+
146
+ this.dirty()
144
147
  }
145
148
 
146
149
  /**
@@ -155,12 +158,21 @@ export class ModalStackPart extends TerrierPart<{}> {
155
158
  log.info(`Making modal`, constructor.name)
156
159
  const modal = this.makePart(constructor, state)
157
160
  this.modals.push(modal)
158
- this.displayClass = 'show'
159
- this.dirty()
161
+
162
+ const container = this.element?.querySelector<HTMLElement>('.modal-container')
163
+ if (!container || this.displayClass !== 'show') {
164
+ // haven't rendered yet, or was previously closed, make sure the stack is shown, then render
165
+ this.displayClass = 'show'
166
+ this.dirty()
167
+ } else {
168
+ // already rendered, append the modal to the stack without re-rendering the rest of the stack
169
+ modal.appendIntoContainer(container).classList.add('hide')
170
+ this.stale()
171
+ }
172
+
160
173
  return modal
161
174
  }
162
175
 
163
-
164
176
  render(parent: PartTag) {
165
177
  const classes = [`stack-${this.modals.length}`]
166
178
  if (this.displayClass == 'show') {