@quenty/lipsum 14.18.0 → 14.18.1-canary.545.2374fb2.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 +11 -0
- package/package.json +8 -8
- package/src/Shared/LipsumIconUtils.lua +129 -126
- package/src/Shared/LipsumUtils.lua +51 -42
- package/src/Shared/LipsumUtils.story.lua +14 -14
- package/test/default.project.json +12 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
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
|
+
## [14.18.1-canary.545.2374fb2.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/lipsum@14.18.0...@quenty/lipsum@14.18.1-canary.545.2374fb2.0) (2025-04-05)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* Add types to packages ([2374fb2](https://github.com/Quenty/NevermoreEngine/commit/2374fb2b043cfbe0e9b507b3316eec46a4e353a0))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [14.18.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/lipsum@14.17.2...@quenty/lipsum@14.18.0) (2025-04-02)
|
|
7
18
|
|
|
8
19
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/lipsum",
|
|
3
|
-
"version": "14.18.0",
|
|
3
|
+
"version": "14.18.1-canary.545.2374fb2.0",
|
|
4
4
|
"description": "A Lorem Ipsum generator in Roblox",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -27,17 +27,17 @@
|
|
|
27
27
|
"Quenty"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@quenty/loader": "
|
|
31
|
-
"@quenty/randomutils": "
|
|
32
|
-
"@quenty/string": "
|
|
30
|
+
"@quenty/loader": "10.8.1-canary.545.2374fb2.0",
|
|
31
|
+
"@quenty/randomutils": "6.10.1-canary.545.2374fb2.0",
|
|
32
|
+
"@quenty/string": "3.3.2-canary.545.2374fb2.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@quenty/maid": "
|
|
36
|
-
"@quenty/textserviceutils": "
|
|
37
|
-
"@quenty/uiobjectutils": "
|
|
35
|
+
"@quenty/maid": "3.4.1-canary.545.2374fb2.0",
|
|
36
|
+
"@quenty/textserviceutils": "13.18.1-canary.545.2374fb2.0",
|
|
37
|
+
"@quenty/uiobjectutils": "6.16.1-canary.545.2374fb2.0"
|
|
38
38
|
},
|
|
39
39
|
"publishConfig": {
|
|
40
40
|
"access": "public"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "2374fb2b043cfbe0e9b507b3316eec46a4e353a0"
|
|
43
43
|
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
--!strict
|
|
1
2
|
--[=[
|
|
3
|
+
Provides a lot of random icons for UI
|
|
4
|
+
|
|
2
5
|
@class LipsumIconUtils
|
|
3
6
|
]=]
|
|
4
7
|
|
|
@@ -6,132 +9,132 @@ local require = require(script.Parent.loader).load(script)
|
|
|
6
9
|
|
|
7
10
|
local RandomUtils = require("RandomUtils")
|
|
8
11
|
|
|
9
|
-
local ICONS = {
|
|
10
|
-
"rbxassetid://6022668885"
|
|
11
|
-
"rbxassetid://6022668897"
|
|
12
|
-
"rbxassetid://6022852108"
|
|
13
|
-
"rbxassetid://6023426938"
|
|
14
|
-
"rbxassetid://6023426974"
|
|
15
|
-
"rbxassetid://6023565892"
|
|
16
|
-
"rbxassetid://6026568215"
|
|
17
|
-
"rbxassetid://6026568247"
|
|
18
|
-
"rbxassetid://6026647902"
|
|
19
|
-
"rbxassetid://6026660074"
|
|
20
|
-
"rbxassetid://6026660078"
|
|
21
|
-
"rbxassetid://6031075939"
|
|
22
|
-
"rbxassetid://6031091006"
|
|
23
|
-
"rbxassetid://6031154875"
|
|
24
|
-
"rbxassetid://6031225809"
|
|
25
|
-
"rbxassetid://6031225819"
|
|
26
|
-
"rbxassetid://6031229347"
|
|
27
|
-
"rbxassetid://6031302918"
|
|
28
|
-
"rbxassetid://6031302921"
|
|
29
|
-
"rbxassetid://6031302932"
|
|
30
|
-
"rbxassetid://6031471489"
|
|
31
|
-
"rbxassetid://6031488938"
|
|
32
|
-
"rbxassetid://6031625146"
|
|
33
|
-
"rbxassetid://6031754538"
|
|
34
|
-
"rbxassetid://6031763426"
|
|
35
|
-
"rbxassetid://6031771012"
|
|
36
|
-
"rbxassetid://6034227061"
|
|
37
|
-
"rbxassetid://6034227072"
|
|
38
|
-
"rbxassetid://6034230640"
|
|
39
|
-
"rbxassetid://6034230652"
|
|
40
|
-
"rbxassetid://6034275726"
|
|
41
|
-
"rbxassetid://6034275731"
|
|
42
|
-
"rbxassetid://6034281948"
|
|
43
|
-
"rbxassetid://6034295702"
|
|
44
|
-
"rbxassetid://6034295710"
|
|
45
|
-
"rbxassetid://6034304908"
|
|
46
|
-
"rbxassetid://6034308946"
|
|
47
|
-
"rbxassetid://6034323695"
|
|
48
|
-
"rbxassetid://6034333271"
|
|
49
|
-
"rbxassetid://6034407069"
|
|
50
|
-
"rbxassetid://6034452645"
|
|
51
|
-
"rbxassetid://6034461626"
|
|
52
|
-
"rbxassetid://6034509984"
|
|
53
|
-
"rbxassetid://6034509994"
|
|
54
|
-
"rbxassetid://6034684949"
|
|
55
|
-
"rbxassetid://6034684956"
|
|
56
|
-
"rbxassetid://6034687951"
|
|
57
|
-
"rbxassetid://6034767621"
|
|
58
|
-
"rbxassetid://6034767623"
|
|
59
|
-
"rbxassetid://6034837802"
|
|
60
|
-
"rbxassetid://6034934025"
|
|
61
|
-
"rbxassetid://6034941700"
|
|
62
|
-
"rbxassetid://6034973076"
|
|
63
|
-
"rbxassetid://6034973081"
|
|
64
|
-
"rbxassetid://6034973084"
|
|
65
|
-
"rbxassetid://6034983854"
|
|
66
|
-
"rbxassetid://6035030077"
|
|
67
|
-
"rbxassetid://6035030083"
|
|
68
|
-
"rbxassetid://6035047382"
|
|
69
|
-
"rbxassetid://6035053275"
|
|
70
|
-
"rbxassetid://6035056477"
|
|
71
|
-
"rbxassetid://6035056487"
|
|
72
|
-
"rbxassetid://6035067844"
|
|
73
|
-
"rbxassetid://6035078894"
|
|
74
|
-
"rbxassetid://6035121939"
|
|
75
|
-
"rbxassetid://6035173859"
|
|
76
|
-
"rbxassetid://6035181858"
|
|
12
|
+
local ICONS: { string } = {
|
|
13
|
+
"rbxassetid://6022668885",
|
|
14
|
+
"rbxassetid://6022668897",
|
|
15
|
+
"rbxassetid://6022852108",
|
|
16
|
+
"rbxassetid://6023426938",
|
|
17
|
+
"rbxassetid://6023426974",
|
|
18
|
+
"rbxassetid://6023565892",
|
|
19
|
+
"rbxassetid://6026568215",
|
|
20
|
+
"rbxassetid://6026568247",
|
|
21
|
+
"rbxassetid://6026647902",
|
|
22
|
+
"rbxassetid://6026660074",
|
|
23
|
+
"rbxassetid://6026660078",
|
|
24
|
+
"rbxassetid://6031075939",
|
|
25
|
+
"rbxassetid://6031091006",
|
|
26
|
+
"rbxassetid://6031154875",
|
|
27
|
+
"rbxassetid://6031225809",
|
|
28
|
+
"rbxassetid://6031225819",
|
|
29
|
+
"rbxassetid://6031229347",
|
|
30
|
+
"rbxassetid://6031302918",
|
|
31
|
+
"rbxassetid://6031302921",
|
|
32
|
+
"rbxassetid://6031302932",
|
|
33
|
+
"rbxassetid://6031471489",
|
|
34
|
+
"rbxassetid://6031488938",
|
|
35
|
+
"rbxassetid://6031625146",
|
|
36
|
+
"rbxassetid://6031754538",
|
|
37
|
+
"rbxassetid://6031763426",
|
|
38
|
+
"rbxassetid://6031771012",
|
|
39
|
+
"rbxassetid://6034227061",
|
|
40
|
+
"rbxassetid://6034227072",
|
|
41
|
+
"rbxassetid://6034230640",
|
|
42
|
+
"rbxassetid://6034230652",
|
|
43
|
+
"rbxassetid://6034275726",
|
|
44
|
+
"rbxassetid://6034275731",
|
|
45
|
+
"rbxassetid://6034281948",
|
|
46
|
+
"rbxassetid://6034295702",
|
|
47
|
+
"rbxassetid://6034295710",
|
|
48
|
+
"rbxassetid://6034304908",
|
|
49
|
+
"rbxassetid://6034308946",
|
|
50
|
+
"rbxassetid://6034323695",
|
|
51
|
+
"rbxassetid://6034333271",
|
|
52
|
+
"rbxassetid://6034407069",
|
|
53
|
+
"rbxassetid://6034452645",
|
|
54
|
+
"rbxassetid://6034461626",
|
|
55
|
+
"rbxassetid://6034509984",
|
|
56
|
+
"rbxassetid://6034509994",
|
|
57
|
+
"rbxassetid://6034684949",
|
|
58
|
+
"rbxassetid://6034684956",
|
|
59
|
+
"rbxassetid://6034687951",
|
|
60
|
+
"rbxassetid://6034767621",
|
|
61
|
+
"rbxassetid://6034767623",
|
|
62
|
+
"rbxassetid://6034837802",
|
|
63
|
+
"rbxassetid://6034934025",
|
|
64
|
+
"rbxassetid://6034941700",
|
|
65
|
+
"rbxassetid://6034973076",
|
|
66
|
+
"rbxassetid://6034973081",
|
|
67
|
+
"rbxassetid://6034973084",
|
|
68
|
+
"rbxassetid://6034983854",
|
|
69
|
+
"rbxassetid://6035030077",
|
|
70
|
+
"rbxassetid://6035030083",
|
|
71
|
+
"rbxassetid://6035047382",
|
|
72
|
+
"rbxassetid://6035053275",
|
|
73
|
+
"rbxassetid://6035056477",
|
|
74
|
+
"rbxassetid://6035056487",
|
|
75
|
+
"rbxassetid://6035067844",
|
|
76
|
+
"rbxassetid://6035078894",
|
|
77
|
+
"rbxassetid://6035121939",
|
|
78
|
+
"rbxassetid://6035173859",
|
|
79
|
+
"rbxassetid://6035181858",
|
|
77
80
|
}
|
|
78
81
|
|
|
79
|
-
local OUTLINE_ICONS = {
|
|
80
|
-
"rbxassetid://6022668962"
|
|
81
|
-
"rbxassetid://6022860339"
|
|
82
|
-
"rbxassetid://6023426910"
|
|
83
|
-
"rbxassetid://6023426914"
|
|
84
|
-
"rbxassetid://6023565882"
|
|
85
|
-
"rbxassetid://6026568199"
|
|
86
|
-
"rbxassetid://6026568254"
|
|
87
|
-
"rbxassetid://6026663726"
|
|
88
|
-
"rbxassetid://6026663771"
|
|
89
|
-
"rbxassetid://6031302934"
|
|
90
|
-
"rbxassetid://6031339048"
|
|
91
|
-
"rbxassetid://6031625150"
|
|
92
|
-
"rbxassetid://6031630208"
|
|
93
|
-
"rbxassetid://6034230637"
|
|
94
|
-
"rbxassetid://6034268008"
|
|
95
|
-
"rbxassetid://6034281910"
|
|
96
|
-
"rbxassetid://6034295706"
|
|
97
|
-
"rbxassetid://6034308947"
|
|
98
|
-
"rbxassetid://6034407078"
|
|
99
|
-
"rbxassetid://6034457070"
|
|
100
|
-
"rbxassetid://6035047409"
|
|
101
|
-
"rbxassetid://6035053278"
|
|
102
|
-
"rbxassetid://6035053285"
|
|
103
|
-
"rbxassetid://6035190844"
|
|
82
|
+
local OUTLINE_ICONS: { string } = {
|
|
83
|
+
"rbxassetid://6022668962",
|
|
84
|
+
"rbxassetid://6022860339",
|
|
85
|
+
"rbxassetid://6023426910",
|
|
86
|
+
"rbxassetid://6023426914",
|
|
87
|
+
"rbxassetid://6023565882",
|
|
88
|
+
"rbxassetid://6026568199",
|
|
89
|
+
"rbxassetid://6026568254",
|
|
90
|
+
"rbxassetid://6026663726",
|
|
91
|
+
"rbxassetid://6026663771",
|
|
92
|
+
"rbxassetid://6031302934",
|
|
93
|
+
"rbxassetid://6031339048",
|
|
94
|
+
"rbxassetid://6031625150",
|
|
95
|
+
"rbxassetid://6031630208",
|
|
96
|
+
"rbxassetid://6034230637",
|
|
97
|
+
"rbxassetid://6034268008",
|
|
98
|
+
"rbxassetid://6034281910",
|
|
99
|
+
"rbxassetid://6034295706",
|
|
100
|
+
"rbxassetid://6034308947",
|
|
101
|
+
"rbxassetid://6034407078",
|
|
102
|
+
"rbxassetid://6034457070",
|
|
103
|
+
"rbxassetid://6035047409",
|
|
104
|
+
"rbxassetid://6035053278",
|
|
105
|
+
"rbxassetid://6035053285",
|
|
106
|
+
"rbxassetid://6035190844",
|
|
104
107
|
}
|
|
105
108
|
|
|
106
109
|
-- NOTE: These icons can't be used in production without a license
|
|
107
110
|
-- https://rhosgfx.itch.io/vector-icon-pack
|
|
108
|
-
local COLORED_OUTLINE_ICONS = {
|
|
109
|
-
"rbxassetid://10049672584"
|
|
110
|
-
"rbxassetid://10049673405"
|
|
111
|
-
"rbxassetid://10049674340"
|
|
112
|
-
"rbxassetid://10049676437"
|
|
113
|
-
"rbxassetid://10049677223"
|
|
114
|
-
"rbxassetid://10049679313"
|
|
115
|
-
"rbxassetid://10049681901"
|
|
116
|
-
"rbxassetid://10184125962"
|
|
117
|
-
"rbxassetid://10184127146"
|
|
118
|
-
"rbxassetid://10184128128"
|
|
119
|
-
"rbxassetid://10184139303"
|
|
120
|
-
"rbxassetid://10184140737"
|
|
121
|
-
"rbxassetid://10184144109"
|
|
122
|
-
"rbxassetid://10184774260"
|
|
123
|
-
"rbxassetid://10227981754"
|
|
124
|
-
"rbxassetid://10227983832"
|
|
125
|
-
"rbxassetid://10422318513"
|
|
126
|
-
"rbxassetid://10477537109"
|
|
127
|
-
"rbxassetid://10477544246"
|
|
128
|
-
"rbxassetid://10477548138"
|
|
129
|
-
"rbxassetid://10477567272"
|
|
130
|
-
"rbxassetid://10514673495"
|
|
131
|
-
"rbxassetid://9996257514"
|
|
132
|
-
"rbxassetid://9996311475"
|
|
133
|
-
"rbxassetid://9996312372"
|
|
134
|
-
"rbxassetid://9996372111"
|
|
111
|
+
local COLORED_OUTLINE_ICONS: { string } = {
|
|
112
|
+
"rbxassetid://10049672584",
|
|
113
|
+
"rbxassetid://10049673405",
|
|
114
|
+
"rbxassetid://10049674340",
|
|
115
|
+
"rbxassetid://10049676437",
|
|
116
|
+
"rbxassetid://10049677223",
|
|
117
|
+
"rbxassetid://10049679313",
|
|
118
|
+
"rbxassetid://10049681901",
|
|
119
|
+
"rbxassetid://10184125962",
|
|
120
|
+
"rbxassetid://10184127146",
|
|
121
|
+
"rbxassetid://10184128128",
|
|
122
|
+
"rbxassetid://10184139303",
|
|
123
|
+
"rbxassetid://10184140737",
|
|
124
|
+
"rbxassetid://10184144109",
|
|
125
|
+
"rbxassetid://10184774260",
|
|
126
|
+
"rbxassetid://10227981754",
|
|
127
|
+
"rbxassetid://10227983832",
|
|
128
|
+
"rbxassetid://10422318513",
|
|
129
|
+
"rbxassetid://10477537109",
|
|
130
|
+
"rbxassetid://10477544246",
|
|
131
|
+
"rbxassetid://10477548138",
|
|
132
|
+
"rbxassetid://10477567272",
|
|
133
|
+
"rbxassetid://10514673495",
|
|
134
|
+
"rbxassetid://9996257514",
|
|
135
|
+
"rbxassetid://9996311475",
|
|
136
|
+
"rbxassetid://9996312372",
|
|
137
|
+
"rbxassetid://9996372111",
|
|
135
138
|
}
|
|
136
139
|
|
|
137
140
|
local LipsumIconUtils = {}
|
|
@@ -142,8 +145,8 @@ local LipsumIconUtils = {}
|
|
|
142
145
|
@param random Random
|
|
143
146
|
@return string
|
|
144
147
|
]=]
|
|
145
|
-
function LipsumIconUtils.icon(random)
|
|
146
|
-
return RandomUtils.choice(ICONS, random)
|
|
148
|
+
function LipsumIconUtils.icon(random: Random?): string
|
|
149
|
+
return RandomUtils.choice(ICONS, random) :: string
|
|
147
150
|
end
|
|
148
151
|
|
|
149
152
|
--[=[
|
|
@@ -152,8 +155,8 @@ end
|
|
|
152
155
|
@param random Random
|
|
153
156
|
@return string
|
|
154
157
|
]=]
|
|
155
|
-
function LipsumIconUtils.outlineIcon(random)
|
|
156
|
-
return RandomUtils.choice(OUTLINE_ICONS, random)
|
|
158
|
+
function LipsumIconUtils.outlineIcon(random: Random?): string
|
|
159
|
+
return RandomUtils.choice(OUTLINE_ICONS, random) :: string
|
|
157
160
|
end
|
|
158
161
|
|
|
159
162
|
--[=[
|
|
@@ -168,8 +171,8 @@ end
|
|
|
168
171
|
@param random Random
|
|
169
172
|
@return string
|
|
170
173
|
]=]
|
|
171
|
-
function LipsumIconUtils.coloredOutlineIcon(random)
|
|
172
|
-
return RandomUtils.choice(COLORED_OUTLINE_ICONS, random)
|
|
174
|
+
function LipsumIconUtils.coloredOutlineIcon(random: Random): string
|
|
175
|
+
return RandomUtils.choice(COLORED_OUTLINE_ICONS, random) :: string
|
|
173
176
|
end
|
|
174
177
|
|
|
175
178
|
return LipsumIconUtils
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
--!strict
|
|
1
2
|
--[=[
|
|
2
|
-
Helpers generate test text for a variety of situations, in the standard Lorem-Ipsum utility system.
|
|
3
|
+
Helpers to generate test text for a variety of situations, in the standard Lorem-Ipsum utility system.
|
|
3
4
|
@class LipsumUtils
|
|
4
5
|
]=]
|
|
5
6
|
|
|
@@ -10,6 +11,7 @@ local String = require("String")
|
|
|
10
11
|
|
|
11
12
|
local LipsumUtils = {}
|
|
12
13
|
|
|
14
|
+
-- stylua: ignore
|
|
13
15
|
local WORDS = {
|
|
14
16
|
"lorem", "ipsum", "dolor", "sit", "amet", "consectetuer", "adipiscing", "elit", "sed", "diam", "nonummy",
|
|
15
17
|
"nibh", "euismod", "tincidunt", "ut", "laoreet", "dolore", "magna", "aliquam", "erat"}
|
|
@@ -21,13 +23,13 @@ local WORDS = {
|
|
|
21
23
|
print(LipsumUtils.username()) --> LoremIpsum23
|
|
22
24
|
```
|
|
23
25
|
|
|
24
|
-
@param
|
|
26
|
+
@param optionalRandom Random? -- Optional random
|
|
25
27
|
@return string
|
|
26
28
|
]=]
|
|
27
|
-
function LipsumUtils.username(
|
|
28
|
-
random =
|
|
29
|
+
function LipsumUtils.username(optionalRandom: Random?): string
|
|
30
|
+
local random = optionalRandom or Random.new()
|
|
29
31
|
|
|
30
|
-
local word = RandomUtils.choice(WORDS, random)
|
|
32
|
+
local word = assert(RandomUtils.choice(WORDS, random), "Word list is empty")
|
|
31
33
|
if random:NextNumber() <= 0.5 then
|
|
32
34
|
word = String.uppercaseFirstLetter(word)
|
|
33
35
|
end
|
|
@@ -47,7 +49,7 @@ function LipsumUtils.username(random)
|
|
|
47
49
|
|
|
48
50
|
local number = random:NextNumber()
|
|
49
51
|
if number <= 0.1 then
|
|
50
|
-
return "xXx"
|
|
52
|
+
return string.format("xXx%sxXx", word)
|
|
51
53
|
elseif number <= 0.6 then
|
|
52
54
|
return string.format("%s%03d", word, random:NextInteger(0, 999))
|
|
53
55
|
else
|
|
@@ -65,7 +67,7 @@ end
|
|
|
65
67
|
@param random Random? -- Optional random
|
|
66
68
|
@return string
|
|
67
69
|
]=]
|
|
68
|
-
function LipsumUtils.word(random)
|
|
70
|
+
function LipsumUtils.word(random: Random?): string
|
|
69
71
|
return LipsumUtils.words(1, random)
|
|
70
72
|
end
|
|
71
73
|
|
|
@@ -80,16 +82,16 @@ end
|
|
|
80
82
|
@param random Random? -- Optional random
|
|
81
83
|
@return string
|
|
82
84
|
]=]
|
|
83
|
-
function LipsumUtils.words(numWords, random)
|
|
85
|
+
function LipsumUtils.words(numWords: number, random: Random?): string
|
|
84
86
|
local output = ""
|
|
85
87
|
|
|
86
88
|
for w = 1, numWords do
|
|
87
|
-
local word = RandomUtils.choice(WORDS, random)
|
|
89
|
+
local word = assert(RandomUtils.choice(WORDS, random), "Word list is empty")
|
|
88
90
|
|
|
89
91
|
if w == 1 then
|
|
90
|
-
output
|
|
92
|
+
output ..= String.uppercaseFirstLetter(word)
|
|
91
93
|
else
|
|
92
|
-
output
|
|
94
|
+
output ..= " " .. word
|
|
93
95
|
end
|
|
94
96
|
end
|
|
95
97
|
|
|
@@ -104,38 +106,40 @@ end
|
|
|
104
106
|
```
|
|
105
107
|
|
|
106
108
|
@param numWords number? -- Defaults to a random number 6 to 12.
|
|
107
|
-
@param
|
|
109
|
+
@param optionalRandom Random? -- Optional random
|
|
108
110
|
@return string
|
|
109
111
|
]=]
|
|
110
|
-
function LipsumUtils.sentence(numWords
|
|
111
|
-
random =
|
|
112
|
-
|
|
112
|
+
function LipsumUtils.sentence(numWords: number?, optionalRandom: Random?): string
|
|
113
|
+
local random = optionalRandom or Random.new()
|
|
114
|
+
local sentenceWords = numWords or random:NextInteger(6, 12)
|
|
113
115
|
|
|
114
116
|
local output = ""
|
|
115
117
|
|
|
116
118
|
local commaIndexes = {}
|
|
117
|
-
if random:NextNumber() >= 0.3 and
|
|
119
|
+
if random:NextNumber() >= 0.3 and sentenceWords >= 8 then
|
|
118
120
|
commaIndexes[random:NextInteger(4, 5)] = true
|
|
119
121
|
end
|
|
120
122
|
|
|
121
|
-
for w = 1,
|
|
122
|
-
local word = RandomUtils.choice(WORDS, random)
|
|
123
|
+
for w = 1, sentenceWords do
|
|
124
|
+
local word = assert(RandomUtils.choice(WORDS, random), "Word list is empty")
|
|
123
125
|
|
|
124
126
|
if w == 1 then
|
|
125
|
-
output
|
|
127
|
+
output ..= String.uppercaseFirstLetter(word)
|
|
126
128
|
else
|
|
127
129
|
if commaIndexes[w] then
|
|
128
|
-
output
|
|
130
|
+
output ..= ", " .. word
|
|
129
131
|
else
|
|
130
|
-
output
|
|
132
|
+
output ..= " " .. word
|
|
131
133
|
end
|
|
132
134
|
end
|
|
133
135
|
end
|
|
134
136
|
|
|
135
|
-
output
|
|
137
|
+
output ..= "."
|
|
136
138
|
return output
|
|
137
139
|
end
|
|
138
140
|
|
|
141
|
+
export type GenerateCallback = () -> string
|
|
142
|
+
|
|
139
143
|
--[=[
|
|
140
144
|
Generates a random paragraph.
|
|
141
145
|
|
|
@@ -143,24 +147,29 @@ end
|
|
|
143
147
|
print(LipsumUtils.paragraph(4)) --> Paragraph with 4 sentences.
|
|
144
148
|
```
|
|
145
149
|
|
|
146
|
-
@param numSentences number
|
|
150
|
+
@param numSentences number?
|
|
147
151
|
@param createSentence (() -> string)? -- Optional createSentence
|
|
148
|
-
@param
|
|
152
|
+
@param optionalRandom Random? -- Optional random
|
|
149
153
|
@return string
|
|
150
154
|
]=]
|
|
151
|
-
function LipsumUtils.paragraph(
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
155
|
+
function LipsumUtils.paragraph(
|
|
156
|
+
numSentences: number?,
|
|
157
|
+
createSentence: GenerateCallback?,
|
|
158
|
+
optionalRandom: Random?
|
|
159
|
+
): string
|
|
160
|
+
local random = optionalRandom or Random.new()
|
|
161
|
+
local paragraphnSentences = numSentences or random:NextInteger(5, 15)
|
|
162
|
+
local generateSentence: GenerateCallback = createSentence
|
|
163
|
+
or function()
|
|
164
|
+
return LipsumUtils.sentence(nil, random)
|
|
165
|
+
end
|
|
157
166
|
|
|
158
167
|
local output = ""
|
|
159
|
-
for s=1,
|
|
160
|
-
output
|
|
168
|
+
for s = 1, paragraphnSentences do
|
|
169
|
+
output ..= generateSentence()
|
|
161
170
|
|
|
162
|
-
if s ~=
|
|
163
|
-
output
|
|
171
|
+
if s ~= paragraphnSentences then
|
|
172
|
+
output ..= " "
|
|
164
173
|
end
|
|
165
174
|
end
|
|
166
175
|
return output
|
|
@@ -171,23 +180,23 @@ end
|
|
|
171
180
|
print(LipsumUtils.document(3)) --> Document with 3 paragraphs
|
|
172
181
|
```
|
|
173
182
|
|
|
174
|
-
@param numParagraphs number
|
|
183
|
+
@param numParagraphs number?
|
|
175
184
|
@param createParagraph (() -> string)? -- Optional createParagraph
|
|
176
185
|
@param random Random? -- Optional random
|
|
177
186
|
@return string
|
|
178
187
|
]=]
|
|
179
|
-
function LipsumUtils.document(numParagraphs
|
|
188
|
+
function LipsumUtils.document(numParagraphs: number?, createParagraph: GenerateCallback?, random: Random?): string
|
|
180
189
|
random = random or Random.new()
|
|
181
|
-
|
|
182
|
-
|
|
190
|
+
local paragraphCount = numParagraphs or 5
|
|
191
|
+
local generateParagraph = createParagraph or function()
|
|
183
192
|
return LipsumUtils.paragraph(nil, nil, random)
|
|
184
193
|
end
|
|
185
194
|
|
|
186
195
|
local output = ""
|
|
187
|
-
for p=1,
|
|
188
|
-
output
|
|
189
|
-
if p ~=
|
|
190
|
-
output
|
|
196
|
+
for p=1, paragraphCount do
|
|
197
|
+
output ..= generateParagraph()
|
|
198
|
+
if p ~= paragraphCount then
|
|
199
|
+
output ..= "\n\n"
|
|
191
200
|
end
|
|
192
201
|
end
|
|
193
202
|
|
|
@@ -12,10 +12,11 @@ local TextServiceUtils = require("TextServiceUtils")
|
|
|
12
12
|
local UICornerUtils = require("UICornerUtils")
|
|
13
13
|
local UIPaddingUtils = require("UIPaddingUtils")
|
|
14
14
|
|
|
15
|
-
local function showText(text, maxWidth,
|
|
15
|
+
local function showText(text: string, maxWidth: number, optionalPadding: number?): Frame
|
|
16
16
|
assert(type(text) == "string", "Bad text")
|
|
17
17
|
assert(maxWidth, "Bad maxWidth")
|
|
18
|
-
|
|
18
|
+
|
|
19
|
+
local padding: number = optionalPadding or 10
|
|
19
20
|
|
|
20
21
|
local container = Instance.new("Frame")
|
|
21
22
|
container.BackgroundColor3 = Color3.new(0.8, 0.8, 0.8)
|
|
@@ -40,13 +41,13 @@ local function showText(text, maxWidth, padding)
|
|
|
40
41
|
|
|
41
42
|
UICornerUtils.fromOffset(10, container)
|
|
42
43
|
|
|
43
|
-
local size = TextServiceUtils.getSizeForLabel(textLabel, text, maxWidth - padding*2)
|
|
44
|
-
container.Size = UDim2.new(0, size.x + 2*padding, 0, size.y + 2*padding)
|
|
44
|
+
local size = TextServiceUtils.getSizeForLabel(textLabel, text, maxWidth - padding * 2)
|
|
45
|
+
container.Size = UDim2.new(0, size.x + 2 * padding, 0, size.y + 2 * padding)
|
|
45
46
|
|
|
46
47
|
return container
|
|
47
48
|
end
|
|
48
49
|
|
|
49
|
-
local function makeTitle(title)
|
|
50
|
+
local function makeTitle(title): TextLabel
|
|
50
51
|
local titleLabel = Instance.new("TextLabel")
|
|
51
52
|
titleLabel.Text = title
|
|
52
53
|
titleLabel.TextSize = 24
|
|
@@ -63,7 +64,7 @@ local function makeTitle(title)
|
|
|
63
64
|
return titleLabel
|
|
64
65
|
end
|
|
65
66
|
|
|
66
|
-
local function makeHorizontalSection(factory)
|
|
67
|
+
local function makeHorizontalSection(factory: ((Frame) -> ()) -> ()): Frame
|
|
67
68
|
local container = Instance.new("Frame")
|
|
68
69
|
container.BackgroundTransparency = 1
|
|
69
70
|
container.Size = UDim2.new(1, 0, 1, 0)
|
|
@@ -76,7 +77,7 @@ local function makeHorizontalSection(factory)
|
|
|
76
77
|
|
|
77
78
|
local maxHeight = 0
|
|
78
79
|
local layoutOrder = 1
|
|
79
|
-
local function add(item)
|
|
80
|
+
local function add(item: Frame)
|
|
80
81
|
assert(item, "Bad item")
|
|
81
82
|
|
|
82
83
|
layoutOrder = layoutOrder + 1
|
|
@@ -93,7 +94,7 @@ local function makeHorizontalSection(factory)
|
|
|
93
94
|
return container
|
|
94
95
|
end
|
|
95
96
|
|
|
96
|
-
local function generate(target)
|
|
97
|
+
local function generate(target: Frame)
|
|
97
98
|
local maid = Maid.new()
|
|
98
99
|
|
|
99
100
|
local container = Instance.new("Frame")
|
|
@@ -108,26 +109,26 @@ local function generate(target)
|
|
|
108
109
|
uiListLayout.Parent = container
|
|
109
110
|
|
|
110
111
|
local padding = 10
|
|
111
|
-
local maxWidth = target.AbsoluteSize.
|
|
112
|
+
local maxWidth = target.AbsoluteSize.X - padding * 2
|
|
112
113
|
|
|
113
114
|
local uiPadding = UIPaddingUtils.fromUDim(UDim.new(0, padding))
|
|
114
115
|
uiPadding.Parent = container
|
|
115
116
|
|
|
116
117
|
local layoutOrder = 1
|
|
117
|
-
local function add(item)
|
|
118
|
+
local function add(item: GuiObject)
|
|
118
119
|
layoutOrder = layoutOrder + 1
|
|
119
120
|
item.LayoutOrder = layoutOrder
|
|
120
121
|
item.Parent = container
|
|
121
122
|
end
|
|
122
123
|
|
|
123
124
|
add(makeTitle("Sentences"))
|
|
124
|
-
for _=1, 5 do
|
|
125
|
+
for _ = 1, 5 do
|
|
125
126
|
add(showText(LipsumUtils.sentence(), maxWidth))
|
|
126
127
|
end
|
|
127
128
|
|
|
128
129
|
add(makeTitle("Usernames"))
|
|
129
130
|
add(makeHorizontalSection(function(addToSection)
|
|
130
|
-
for _=1, 10 do
|
|
131
|
+
for _ = 1, 10 do
|
|
131
132
|
addToSection(showText(LipsumUtils.username(), maxWidth))
|
|
132
133
|
end
|
|
133
134
|
end))
|
|
@@ -146,13 +147,12 @@ end
|
|
|
146
147
|
return function(target)
|
|
147
148
|
local maid = Maid.new()
|
|
148
149
|
|
|
149
|
-
local scrollingFrame = Instance.new("ScrollingFrame")
|
|
150
|
+
local scrollingFrame = maid:Add(Instance.new("ScrollingFrame"))
|
|
150
151
|
scrollingFrame.Size = UDim2.new(1, 0, 1, 0)
|
|
151
152
|
scrollingFrame.CanvasSize = UDim2.new(1, 0, 5, 0)
|
|
152
153
|
scrollingFrame.BackgroundColor3 = Color3.new(1, 1, 1)
|
|
153
154
|
scrollingFrame.BackgroundTransparency = 0
|
|
154
155
|
scrollingFrame.BorderSizePixel = 0
|
|
155
|
-
maid:GiveTask(scrollingFrame)
|
|
156
156
|
|
|
157
157
|
local nextGenTime = 0
|
|
158
158
|
|