@quenty/promptqueue 1.18.0 → 1.18.2-canary.547.11ae689.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/CHANGELOG.md CHANGED
@@ -3,6 +3,29 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.18.2-canary.547.11ae689.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/promptqueue@1.18.0...@quenty/promptqueue@1.18.2-canary.547.11ae689.0) (2025-04-07)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * Add types to packages ([2374fb2](https://github.com/Quenty/NevermoreEngine/commit/2374fb2b043cfbe0e9b507b3316eec46a4e353a0))
12
+ * Bump package versions for republishing ([ba47c62](https://github.com/Quenty/NevermoreEngine/commit/ba47c62e32170bf74377b0c658c60b84306dc294))
13
+
14
+
15
+
16
+
17
+
18
+ ## [1.18.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/promptqueue@1.18.0...@quenty/promptqueue@1.18.1) (2025-04-07)
19
+
20
+
21
+ ### Bug Fixes
22
+
23
+ * Add types to packages ([2374fb2](https://github.com/Quenty/NevermoreEngine/commit/2374fb2b043cfbe0e9b507b3316eec46a4e353a0))
24
+
25
+
26
+
27
+
28
+
6
29
  # [1.18.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/promptqueue@1.17.2...@quenty/promptqueue@1.18.0) (2025-04-02)
7
30
 
8
31
  **Note:** Version bump only for package @quenty/promptqueue
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2014-2024 James Onnen (Quenty)
3
+ Copyright (c) 2014-2025 James Onnen (Quenty)
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/promptqueue",
3
- "version": "1.18.0",
3
+ "version": "1.18.2-canary.547.11ae689.0",
4
4
  "description": "Queue system for prompts and other UI",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -25,14 +25,14 @@
25
25
  "Quenty"
26
26
  ],
27
27
  "dependencies": {
28
- "@quenty/baseobject": "^10.8.0",
29
- "@quenty/loader": "^10.8.0",
30
- "@quenty/promise": "^10.10.1",
31
- "@quenty/signal": "^7.10.0",
32
- "@quenty/transitionmodel": "^7.19.0"
28
+ "@quenty/baseobject": "10.8.2-canary.547.11ae689.0",
29
+ "@quenty/loader": "10.8.2-canary.547.11ae689.0",
30
+ "@quenty/promise": "10.10.3-canary.547.11ae689.0",
31
+ "@quenty/signal": "7.10.2-canary.547.11ae689.0",
32
+ "@quenty/transitionmodel": "7.19.2-canary.547.11ae689.0"
33
33
  },
34
34
  "publishConfig": {
35
35
  "access": "public"
36
36
  },
37
- "gitHead": "e8ea56930e65322fcffc05a1556d5df988068f0b"
37
+ "gitHead": "11ae6894c9c40c596e521dc1d2a71977af63752f"
38
38
  }
@@ -1,3 +1,4 @@
1
+ --!strict
1
2
  --[=[
2
3
  Queue system for prompts and other UI
3
4
 
@@ -12,17 +13,35 @@ local Promise = require("Promise")
12
13
  local TransitionModel = require("TransitionModel")
13
14
  local ValueObject = require("ValueObject")
14
15
  local Signal = require("Signal")
16
+ local _Observable = require("Observable")
15
17
 
16
18
  local PromptQueue = setmetatable({}, BaseObject)
17
19
  PromptQueue.ClassName = "PromptQueue"
18
20
  PromptQueue.__index = PromptQueue
19
21
 
22
+ type PromptEntry = {
23
+ promise: Promise.Promise<()>,
24
+ execute: () -> (),
25
+ cancel: (doNotAnimate: boolean?) -> (),
26
+ }
27
+
28
+ export type PromptQueue = typeof(setmetatable(
29
+ {} :: {
30
+ _maid: Maid.Maid,
31
+ _isShowing: ValueObject.ValueObject<boolean>,
32
+ _clearRequested: Signal.Signal<(boolean?)>,
33
+ _queue: { PromptEntry },
34
+ _currentProcessingEntry: PromptEntry?,
35
+ },
36
+ { __index = PromptQueue }
37
+ ))
38
+
20
39
  --[=[
21
40
  Constructs a new prompt queue
22
41
  @return PromptQueue
23
42
  ]=]
24
- function PromptQueue.new()
25
- local self = setmetatable(BaseObject.new(), PromptQueue)
43
+ function PromptQueue.new(): PromptQueue
44
+ local self = setmetatable(BaseObject.new() :: any, PromptQueue)
26
45
 
27
46
  self._isShowing = self._maid:Add(ValueObject.new(false, "boolean"))
28
47
  self._clearRequested = self._maid:Add(Signal.new())
@@ -30,7 +49,7 @@ function PromptQueue.new()
30
49
  self._queue = {}
31
50
  self._currentProcessingEntry = nil
32
51
 
33
- return self
52
+ return self :: any
34
53
  end
35
54
 
36
55
  --[=[
@@ -38,24 +57,27 @@ end
38
57
 
39
58
  @param transitionModel TransitionModel
40
59
  ]=]
41
- function PromptQueue:Queue(transitionModel)
60
+ function PromptQueue.Queue(self: PromptQueue, transitionModel: TransitionModel.TransitionModel): Promise.Promise<()>
42
61
  assert(TransitionModel.isTransitionModel(transitionModel), "Bad transitionModel")
43
62
 
44
63
  local maid = Maid.new()
45
64
  local promise = maid:Add(Promise.new())
46
65
 
47
- local isCancelling = false
66
+ local isCancelling: boolean = false
48
67
 
49
- local entry = {
50
- promise = promise;
68
+ local entry: PromptEntry = {
69
+ promise = promise,
51
70
  execute = function()
52
71
  assert(promise:IsPending(), "Not pending")
53
72
 
73
+ -- stylua: ignore
54
74
  maid:GivePromise(transitionModel:PromiseShow())
55
75
  :Then(function()
56
76
  if transitionModel.PromiseSustain then
57
77
  return maid:GivePromise(transitionModel:PromiseSustain())
58
78
  end
79
+
80
+ return nil
59
81
  end)
60
82
  :Then(function()
61
83
  return maid:GivePromise(transitionModel:PromiseHide())
@@ -75,7 +97,7 @@ function PromptQueue:Queue(transitionModel)
75
97
  warn(string.format("[PromptQueue] - Failed to execute due to %q", tostring(... or nil)))
76
98
  return Promise.rejected(...)
77
99
  end)
78
- end;
100
+ end,
79
101
  cancel = function(doNotAnimate)
80
102
  assert(promise:IsPending(), "Not pending")
81
103
  if isCancelling then
@@ -97,18 +119,17 @@ function PromptQueue:Queue(transitionModel)
97
119
 
98
120
  return Promise.rejected(...)
99
121
  end)
100
- end;
122
+ end,
101
123
  }
102
124
 
103
125
  table.insert(self._queue, entry)
104
126
 
105
-
106
- maid:GiveTask(self._clearRequested:Connect(function(doNotAnimate)
127
+ maid:GiveTask(self._clearRequested:Connect(function(doNotAnimate: boolean?)
107
128
  entry.cancel(doNotAnimate)
108
129
  end))
109
130
 
110
131
  promise:Finally(function()
111
- self._maid[maid] = nil
132
+ self._maid[maid :: any] = nil
112
133
  end)
113
134
  maid:GiveTask(function()
114
135
  if self._currentProcessingEntry == entry then
@@ -120,10 +141,10 @@ function PromptQueue:Queue(transitionModel)
120
141
  table.remove(self._queue, index)
121
142
  end
122
143
 
123
- self._maid[maid] = nil
144
+ self._maid[maid :: any] = nil
124
145
  end)
125
146
 
126
- self._maid[maid] = maid
147
+ self._maid[maid :: any] = maid
127
148
 
128
149
  self:_startQueueProcessing()
129
150
 
@@ -135,7 +156,7 @@ end
135
156
 
136
157
  @return boolean
137
158
  ]=]
138
- function PromptQueue:HasItems()
159
+ function PromptQueue.HasItems(self: PromptQueue): boolean
139
160
  return #self._queue > 0
140
161
  end
141
162
 
@@ -144,7 +165,7 @@ end
144
165
 
145
166
  @param doNotAnimate boolean?
146
167
  ]=]
147
- function PromptQueue:Clear(doNotAnimate)
168
+ function PromptQueue.Clear(self: PromptQueue, doNotAnimate: boolean?)
148
169
  self._clearRequested:Fire(doNotAnimate)
149
170
  end
150
171
 
@@ -154,13 +175,13 @@ end
154
175
  @param doNotAnimate boolean?
155
176
  @return Promise
156
177
  ]=]
157
- function PromptQueue:HideCurrent(doNotAnimate)
178
+ function PromptQueue.HideCurrent(self: PromptQueue, doNotAnimate: boolean?)
158
179
  if self._currentProcessingEntry then
159
180
  local promise = self._currentProcessingEntry.promise
160
181
 
161
182
  self._currentProcessingEntry.cancel(doNotAnimate)
162
183
 
163
- return promise
184
+ return promise
164
185
  else
165
186
  return Promise.resolved()
166
187
  end
@@ -168,10 +189,10 @@ end
168
189
 
169
190
  --[=[
170
191
  Returns whether or not the PromptQueue is currently showing its contents.
171
-
192
+
172
193
  @return boolean
173
194
  ]=]
174
- function PromptQueue:IsShowing()
195
+ function PromptQueue.IsShowing(self: PromptQueue): boolean
175
196
  return self._isShowing.Value
176
197
  end
177
198
 
@@ -180,11 +201,11 @@ end
180
201
 
181
202
  @return Observable<boolean>
182
203
  ]=]
183
- function PromptQueue:ObserveIsShowing()
204
+ function PromptQueue.ObserveIsShowing(self: PromptQueue): _Observable.Observable<boolean>
184
205
  return self._isShowing:Observe()
185
206
  end
186
207
 
187
- function PromptQueue:_startQueueProcessing()
208
+ function PromptQueue._startQueueProcessing(self: PromptQueue)
188
209
  if self._maid._processing then
189
210
  return
190
211
  end