terrier-engine 4.41.2 → 4.42.0

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.41.2",
7
+ "version": "4.42.0",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "https://github.com/Terrier-Tech/terrier-engine"
@@ -20,18 +20,19 @@
20
20
  "inflection": "^2.0.1",
21
21
  "mime-types": "^2.1.35",
22
22
  "tuff-core": "latest",
23
- "tuff-plot": "^0.3.0",
23
+ "tuff-plot": "latest",
24
24
  "tuff-sortable": "latest",
25
25
  "turbolinks": "^5.2.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/mime-types": "^2.1.4",
29
- "@types/node": "^18.16.3",
29
+ "@types/node": "^22.9.0",
30
30
  "glyphs2font": "^1.2.4",
31
31
  "prettier": "^2.8.8",
32
32
  "svgo": "^3.0.2",
33
- "vite": "^5.4.8",
33
+ "typescript": "^5.6.3",
34
+ "vite": "^5.4.11",
34
35
  "vite-plugin-ruby": "^5.1.0",
35
- "vitest": "^0.31.1"
36
+ "vitest": "^2.1.5"
36
37
  }
37
38
  }
package/terrier/app.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import {Logger} from "tuff-core/logging"
2
- import {Part, PartConstructor, PartParent} from "tuff-core/parts"
2
+ import {Part, PartConstructor} from "tuff-core/parts"
3
3
  import TerrierPart from "./parts/terrier-part"
4
4
  import Tooltips from "./tooltips"
5
5
  import Lightbox from "./lightbox"
@@ -48,8 +48,8 @@ export abstract class TerrierApp<TState> extends TerrierPart<TState> {
48
48
  /// Overlays
49
49
 
50
50
  addOverlay<OverlayType extends Part<StateType>, StateType extends {}>(
51
- constructor: { new(p: PartParent, id: string, state: StateType): OverlayType; },
52
- state: StateType,
51
+ constructor: PartConstructor<OverlayType, StateType>,
52
+ state: NoInfer<StateType>,
53
53
  type: OverlayLayerType
54
54
  ) {
55
55
  return this.overlayPart.pushLayer(constructor, state, type)
@@ -85,7 +85,7 @@ export abstract class TerrierApp<TState> extends TerrierPart<TState> {
85
85
 
86
86
  showModal<ModalType extends ModalPart<StateType>, StateType>(
87
87
  constructor: PartConstructor<ModalType, StateType>,
88
- state: StateType
88
+ state: NoInfer<StateType>
89
89
  ): ModalType {
90
90
  const modalStack = this.overlayPart.getOrCreateLayer(ModalStackPart, {}, 'modal')
91
91
  const modal = modalStack.pushModal(constructor, state)
@@ -70,14 +70,14 @@ class LightboxPart extends Part<LightboxState> {
70
70
  }
71
71
 
72
72
  update(_elem: HTMLElement) {
73
- setTimeout(_ => {
73
+ setTimeout(() => {
74
74
  _elem.classList.add('active') // start css fade in
75
75
  }, 10)
76
76
  }
77
77
 
78
78
  close() {
79
79
  this.element?.classList.remove('active')
80
- setTimeout(_ => {
80
+ setTimeout(() => {
81
81
  this.state.app.removeOverlay(this.state)
82
82
  }, 500)
83
83
  }
package/terrier/modals.ts CHANGED
@@ -147,7 +147,10 @@ export class ModalStackPart extends TerrierPart<{}> {
147
147
  * @param constructor the modal class
148
148
  * @param state the modal's state
149
149
  */
150
- pushModal<StateType>(constructor: PartConstructor<ModalPart<StateType>, StateType>, state: StateType): ModalPart<StateType> {
150
+ pushModal<ModalType extends ModalPart<StateType>, StateType>(
151
+ constructor: PartConstructor<ModalType, StateType>,
152
+ state: NoInfer<StateType>
153
+ ): ModalPart<StateType> {
151
154
  log.info(`Making modal`, constructor.name)
152
155
  const modal = this.makePart(constructor, state)
153
156
  this.modals.push(modal)
@@ -33,7 +33,7 @@ export class OverlayPart extends Part<NoState> {
33
33
  */
34
34
  pushLayer<PartType extends Part<StateType>, StateType extends {}>(
35
35
  constructor: PartConstructor<PartType, StateType>,
36
- state: StateType,
36
+ state: NoInfer<StateType>,
37
37
  type: OverlayLayerType
38
38
  ): PartType {
39
39
  this.layerStates.push({partClass: constructor, partState: state, type})
@@ -50,7 +50,7 @@ export class OverlayPart extends Part<NoState> {
50
50
  */
51
51
  getOrCreateLayer<PartType extends Part<StateType>, StateType extends {}>(
52
52
  constructor: PartConstructor<PartType, StateType>,
53
- state: StateType,
53
+ state: NoInfer<StateType>,
54
54
  type: OverlayLayerType
55
55
  ): PartType {
56
56
  const layers = this.getCollectionParts('layers')
@@ -1,4 +1,4 @@
1
- import {Part, PartParent, PartTag} from "tuff-core/parts"
1
+ import { Part, PartConstructor, PartTag } from "tuff-core/parts"
2
2
  import {TerrierApp} from "../app"
3
3
  import Loading from "../loading"
4
4
  import Theme, {IconName} from "../theme"
@@ -171,8 +171,8 @@ export default abstract class TerrierPart<TState> extends Part<TState> {
171
171
  * @param target the target element around which to show the dropdown
172
172
  */
173
173
  makeDropdown<DropdownType extends Dropdown<DropdownStateType>, DropdownStateType extends {}>(
174
- constructor: { new(p: PartParent, id: string, state: DropdownStateType): DropdownType; },
175
- state: DropdownStateType,
174
+ constructor: PartConstructor<DropdownType, DropdownStateType>,
175
+ state: NoInfer<DropdownStateType>,
176
176
  target: EventTarget | null) {
177
177
  const dropdown = this.app.addOverlay(constructor, state, 'dropdown')
178
178
  dropdown.parentPart = this
@@ -193,8 +193,8 @@ export default abstract class TerrierPart<TState> extends Part<TState> {
193
193
  * @param target the target element around which to show the dropdown
194
194
  */
195
195
  toggleDropdown<DropdownType extends Dropdown<DropdownStateType>, DropdownStateType extends {}>(
196
- constructor: { new(p: PartParent, id: string, state: DropdownStateType): DropdownType; },
197
- state: DropdownStateType,
196
+ constructor: PartConstructor<DropdownType, DropdownStateType>,
197
+ state: NoInfer<DropdownStateType>,
198
198
  target: EventTarget | null) {
199
199
  if (target && target instanceof HTMLElement && target == this.app.lastDropdownTarget) {
200
200
  this.clearDropdowns()
package/tsconfig.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "ESNext",
9
9
  "DOM"
10
10
  ],
11
- "moduleResolution" : "Node",
11
+ "moduleResolution" : "bundler",
12
12
  "strict" : true,
13
13
  "sourceMap" : true,
14
14
  "resolveJsonModule" : true,