summaryrefslogtreecommitdiff
path: root/luals-stubs
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2024-01-05 17:15:47 +1100
committerjacqueline <me@jacqueline.id.au>2024-01-05 17:15:47 +1100
commite12a68a74d9527d4becde122da4ff1ad6550564e (patch)
tree1d987e513efe693bc48817acbc0e89d7db044828 /luals-stubs
parentaa1dd3d522aa60c2e8ec31ccc49b3459b4f0f8e2 (diff)
downloadtangara-fw-e12a68a74d9527d4becde122da4ff1ad6550564e.tar.gz
split lua stubs into one set for ldoc, and one set for lua-ls
Diffstat (limited to 'luals-stubs')
-rw-r--r--luals-stubs/alerts.lua11
-rw-r--r--luals-stubs/backstack.lua11
-rw-r--r--luals-stubs/bluetooth.lua8
-rw-r--r--luals-stubs/database.lua33
-rw-r--r--luals-stubs/playback.lua10
-rw-r--r--luals-stubs/power.lua10
-rw-r--r--luals-stubs/queue.lua11
-rw-r--r--luals-stubs/types.lua13
-rw-r--r--luals-stubs/volume.lua8
9 files changed, 115 insertions, 0 deletions
diff --git a/luals-stubs/alerts.lua b/luals-stubs/alerts.lua
new file mode 100644
index 00000000..d430f12d
--- /dev/null
+++ b/luals-stubs/alerts.lua
@@ -0,0 +1,11 @@
+--- @meta
+
+--- @class alerts
+local alerts = {}
+
+--- @param constructor function
+function alerts.show(constructor) end
+
+function alerts.hide() end
+
+return alerts
diff --git a/luals-stubs/backstack.lua b/luals-stubs/backstack.lua
new file mode 100644
index 00000000..2e4eccb3
--- /dev/null
+++ b/luals-stubs/backstack.lua
@@ -0,0 +1,11 @@
+--- @meta
+
+--- @class backstack
+local backstack = {}
+
+--- @param constructor function
+function backstack.push(constructor) end
+
+function backstack.pop() end
+
+return backstack
diff --git a/luals-stubs/bluetooth.lua b/luals-stubs/bluetooth.lua
new file mode 100644
index 00000000..09fc7606
--- /dev/null
+++ b/luals-stubs/bluetooth.lua
@@ -0,0 +1,8 @@
+--- @meta
+
+--- @class bluetooth
+--- @field enabled Property
+--- @field connected Property
+local bluetooth = {}
+
+return bluetooth
diff --git a/luals-stubs/database.lua b/luals-stubs/database.lua
new file mode 100644
index 00000000..e23c085b
--- /dev/null
+++ b/luals-stubs/database.lua
@@ -0,0 +1,33 @@
+--- @meta
+
+--- @class database
+local database = {}
+
+--- @return Index[]
+function database.indexes() end
+
+--- @class Iterator
+local Iterator = {}
+
+--- @class TrackId
+local TrackId = {}
+
+--- @class Record
+local Record = {}
+
+--- @return string
+function Record:title() end
+
+--- @return TrackId|Iterator(Record)
+function Record:contents() end
+
+--- @class Index
+local Index = {}
+
+--- @return string
+function Index:name() end
+
+--- @return Iterator(Record)
+function Index:iter() end
+
+return database
diff --git a/luals-stubs/playback.lua b/luals-stubs/playback.lua
new file mode 100644
index 00000000..cd54ddb3
--- /dev/null
+++ b/luals-stubs/playback.lua
@@ -0,0 +1,10 @@
+--- @meta
+
+--- Properties for interacting with the audio playback system
+--- @class playback
+--- @field playing Property Whether or not audio is allowed to be played. if there is a current track, then this indicated whether playback is paused or unpaused. If there is no current track, this determines what will happen when the first track is added to the queue.
+--- @field track Property The currently playing track.
+--- @field position Property The current playback position within the current track, in seconds.
+local playback = {}
+
+return playback
diff --git a/luals-stubs/power.lua b/luals-stubs/power.lua
new file mode 100644
index 00000000..226f8200
--- /dev/null
+++ b/luals-stubs/power.lua
@@ -0,0 +1,10 @@
+--- @meta
+
+--- Properties and functions that deal with the device's battery and power state.
+--- @class power
+--- @field battery_pct Property The battery's current charge, as a percentage of the maximum charge.
+--- @field battery_millivolts Property The battery's current voltage, in millivolts.
+--- @field plugged_in Property Whether or not the device is currently receiving external power.
+local power = {}
+
+return power
diff --git a/luals-stubs/queue.lua b/luals-stubs/queue.lua
new file mode 100644
index 00000000..0c63b8c1
--- /dev/null
+++ b/luals-stubs/queue.lua
@@ -0,0 +1,11 @@
+--- @meta
+
+--- Properties and functions for inspecting and manipulating the track playback queue
+--- @class queue
+--- @field position Property The index in the queue of the currently playing track. This may be zero if the queue is empty. Writeable.
+--- @field size Property The total number of tracks in the queue, including tracks which have already been played.
+--- @field replay Property Whether or not the queue will be restarted after the final track is played. Writeable.
+--- @field random Property Determines whether, when progressing to the next track in the queue, the next track will be chosen randomly. The random selection algorithm used is a Miller Shuffle, which guarantees that no repeat selections will be made until every item in the queue has been played. Writeable.
+local queue = {}
+
+return queue
diff --git a/luals-stubs/types.lua b/luals-stubs/types.lua
new file mode 100644
index 00000000..ecfee29b
--- /dev/null
+++ b/luals-stubs/types.lua
@@ -0,0 +1,13 @@
+--- @meta
+
+---@class Property
+local property = {}
+
+function property:get() end
+
+function property:set(val) end
+
+--- @param fn function
+function property:bind(fn) end
+
+return property
diff --git a/luals-stubs/volume.lua b/luals-stubs/volume.lua
new file mode 100644
index 00000000..42d65884
--- /dev/null
+++ b/luals-stubs/volume.lua
@@ -0,0 +1,8 @@
+--- @meta
+
+--- @class volume
+--- @field current_pct Property
+--- @field current_db Property
+local volume = {}
+
+return volume