serverless-ircd 0.6.0 → 0.7.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.
Files changed (247) hide show
  1. package/.github/workflows/ci.yml +6 -1
  2. package/.gitmodules +3 -0
  3. package/CHANGELOG.md +214 -0
  4. package/README.md +110 -23
  5. package/apps/aws-stack/package.json +1 -1
  6. package/apps/cf-tcp-container/package.json +1 -1
  7. package/apps/cf-worker/package.json +1 -1
  8. package/apps/cf-worker/src/origin-allowlist.ts +99 -0
  9. package/apps/cf-worker/src/worker.ts +89 -9
  10. package/apps/cf-worker/tests/fixtures/web-dist/app/index.html +18 -0
  11. package/apps/cf-worker/tests/fixtures/web-dist/index.html +18 -0
  12. package/apps/cf-worker/tests/origin-allowlist.test.ts +101 -0
  13. package/apps/cf-worker/tests/smoke.test.ts +28 -2
  14. package/apps/cf-worker/tests/ws-origin.test.ts +89 -0
  15. package/apps/cf-worker/wrangler.test.toml +23 -0
  16. package/apps/cf-worker/wrangler.toml +54 -0
  17. package/apps/local-cli/package.json +1 -1
  18. package/apps/web/landing/index.html +217 -0
  19. package/apps/web/package.json +28 -0
  20. package/apps/web/scripts/build.mjs +125 -0
  21. package/apps/web/src/build-env.ts +43 -0
  22. package/apps/web/src/config-schema.ts +138 -0
  23. package/apps/web/static/config.json +28 -0
  24. package/apps/web/static/config.prod.json +28 -0
  25. package/apps/web/static/config.staging.json +28 -0
  26. package/apps/web/tests/build-env.test.ts +63 -0
  27. package/apps/web/tests/build-smoke.test.ts +103 -0
  28. package/apps/web/tests/config-schema.test.ts +432 -0
  29. package/apps/web/tests/workspace.test.ts +12 -0
  30. package/apps/web/tsconfig.json +10 -0
  31. package/apps/web/upstream/.browserslistrc +3 -0
  32. package/apps/web/upstream/.editorconfig +9 -0
  33. package/apps/web/upstream/.eslintignore +3 -0
  34. package/apps/web/upstream/.eslintrc.js +90 -0
  35. package/apps/web/upstream/.github/FUNDING.yml +12 -0
  36. package/apps/web/upstream/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
  37. package/apps/web/upstream/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  38. package/apps/web/upstream/.github/workflows/push.yml +26 -0
  39. package/apps/web/upstream/.github/workflows/release.yml +33 -0
  40. package/apps/web/upstream/.github/workflows/release_manual.yml +55 -0
  41. package/apps/web/upstream/.prettierrc.js +9 -0
  42. package/apps/web/upstream/.stylelintignore +5 -0
  43. package/apps/web/upstream/.stylelintrc.js +21 -0
  44. package/apps/web/upstream/LICENSE +201 -0
  45. package/apps/web/upstream/README.md +76 -0
  46. package/apps/web/upstream/babel.config.js +25 -0
  47. package/apps/web/upstream/crowdin.yml +3 -0
  48. package/apps/web/upstream/index.html +35 -0
  49. package/apps/web/upstream/jest.config.js +7 -0
  50. package/apps/web/upstream/jsdoc.json +22 -0
  51. package/apps/web/upstream/package.json +80 -0
  52. package/apps/web/upstream/scripts/pre-commit +43 -0
  53. package/apps/web/upstream/src/components/App.vue +516 -0
  54. package/apps/web/upstream/src/components/AppSettings.vue +587 -0
  55. package/apps/web/upstream/src/components/AutoComplete.vue +284 -0
  56. package/apps/web/upstream/src/components/Avatar.vue +105 -0
  57. package/apps/web/upstream/src/components/AwayStatusIndicator.vue +77 -0
  58. package/apps/web/upstream/src/components/BufferKey.vue +121 -0
  59. package/apps/web/upstream/src/components/BufferSettings.vue +97 -0
  60. package/apps/web/upstream/src/components/Captcha.vue +85 -0
  61. package/apps/web/upstream/src/components/ChannelBanlist.vue +96 -0
  62. package/apps/web/upstream/src/components/ChannelInfo.vue +159 -0
  63. package/apps/web/upstream/src/components/ChannelInvitelist.vue +276 -0
  64. package/apps/web/upstream/src/components/ChannelList.vue +345 -0
  65. package/apps/web/upstream/src/components/Container.vue +401 -0
  66. package/apps/web/upstream/src/components/ContainerHeader.vue +522 -0
  67. package/apps/web/upstream/src/components/ControlInput.vue +1016 -0
  68. package/apps/web/upstream/src/components/LoadingAnimation.vue +104 -0
  69. package/apps/web/upstream/src/components/MediaViewer.vue +199 -0
  70. package/apps/web/upstream/src/components/MessageInfo.vue +192 -0
  71. package/apps/web/upstream/src/components/MessageList.vue +1028 -0
  72. package/apps/web/upstream/src/components/MessageListAvatar.vue +20 -0
  73. package/apps/web/upstream/src/components/MessageListMessageCompact.vue +361 -0
  74. package/apps/web/upstream/src/components/MessageListMessageInline.vue +257 -0
  75. package/apps/web/upstream/src/components/MessageListMessageModern.vue +430 -0
  76. package/apps/web/upstream/src/components/NetworkSettings.vue +528 -0
  77. package/apps/web/upstream/src/components/Nicklist.vue +309 -0
  78. package/apps/web/upstream/src/components/NicklistUser.vue +181 -0
  79. package/apps/web/upstream/src/components/NotConnected.vue +271 -0
  80. package/apps/web/upstream/src/components/SelfUser.vue +283 -0
  81. package/apps/web/upstream/src/components/ServerSelector.vue +162 -0
  82. package/apps/web/upstream/src/components/ServerView.vue +126 -0
  83. package/apps/web/upstream/src/components/SettingsAdvanced.vue +232 -0
  84. package/apps/web/upstream/src/components/SettingsAliases.vue +121 -0
  85. package/apps/web/upstream/src/components/Sidebar.vue +429 -0
  86. package/apps/web/upstream/src/components/SidebarAboutBuffer.vue +288 -0
  87. package/apps/web/upstream/src/components/SidebarState.vue +145 -0
  88. package/apps/web/upstream/src/components/StartupError.vue +35 -0
  89. package/apps/web/upstream/src/components/StateBrowser.vue +420 -0
  90. package/apps/web/upstream/src/components/StateBrowserBuffer.vue +124 -0
  91. package/apps/web/upstream/src/components/StateBrowserNetwork.vue +823 -0
  92. package/apps/web/upstream/src/components/StateBrowserUsermenu.vue +162 -0
  93. package/apps/web/upstream/src/components/TypingStatusIndicator.vue +34 -0
  94. package/apps/web/upstream/src/components/TypingUsersList.vue +56 -0
  95. package/apps/web/upstream/src/components/UrlEmbed.vue +149 -0
  96. package/apps/web/upstream/src/components/UserBox.vue +728 -0
  97. package/apps/web/upstream/src/components/inputtools/Emoji.vue +67 -0
  98. package/apps/web/upstream/src/components/inputtools/TextStyle.vue +142 -0
  99. package/apps/web/upstream/src/components/startups/CommonLayout.vue +208 -0
  100. package/apps/web/upstream/src/components/startups/CustomServer.vue +495 -0
  101. package/apps/web/upstream/src/components/startups/KiwiBnc.vue +361 -0
  102. package/apps/web/upstream/src/components/startups/Personal.vue +317 -0
  103. package/apps/web/upstream/src/components/startups/Welcome.vue +544 -0
  104. package/apps/web/upstream/src/components/startups/ZncLogin.vue +229 -0
  105. package/apps/web/upstream/src/components/utils/InputConfirm.vue +68 -0
  106. package/apps/web/upstream/src/components/utils/InputPrompt.vue +118 -0
  107. package/apps/web/upstream/src/components/utils/InputText.vue +172 -0
  108. package/apps/web/upstream/src/components/utils/IrcInput.vue +579 -0
  109. package/apps/web/upstream/src/components/utils/PluginWrapper.vue +26 -0
  110. package/apps/web/upstream/src/components/utils/TabbedView.vue +149 -0
  111. package/apps/web/upstream/src/components/utils/TransitionExpand.vue +97 -0
  112. package/apps/web/upstream/src/helpers/Colours.js +128 -0
  113. package/apps/web/upstream/src/helpers/IrcdDiffs.js +26 -0
  114. package/apps/web/upstream/src/helpers/Md5.js +193 -0
  115. package/apps/web/upstream/src/helpers/Misc.js +401 -0
  116. package/apps/web/upstream/src/helpers/TextFormatting.js +237 -0
  117. package/apps/web/upstream/src/libs/AliasRewriter.js +157 -0
  118. package/apps/web/upstream/src/libs/AudioManager.js +60 -0
  119. package/apps/web/upstream/src/libs/BouncerMiddleware.js +247 -0
  120. package/apps/web/upstream/src/libs/BouncerProvider.js +551 -0
  121. package/apps/web/upstream/src/libs/ChathistoryMiddleware.js +153 -0
  122. package/apps/web/upstream/src/libs/ConfigLoader.js +94 -0
  123. package/apps/web/upstream/src/libs/EmojiProvider.js +46 -0
  124. package/apps/web/upstream/src/libs/GlobalApi.js +346 -0
  125. package/apps/web/upstream/src/libs/IPC.js +51 -0
  126. package/apps/web/upstream/src/libs/InputHandler.js +921 -0
  127. package/apps/web/upstream/src/libs/IrcClient.js +1506 -0
  128. package/apps/web/upstream/src/libs/Logger.js +71 -0
  129. package/apps/web/upstream/src/libs/Message.js +169 -0
  130. package/apps/web/upstream/src/libs/MessageFormatter.js +364 -0
  131. package/apps/web/upstream/src/libs/MessageParser.js +249 -0
  132. package/apps/web/upstream/src/libs/Notifications.js +78 -0
  133. package/apps/web/upstream/src/libs/ServerConnection.js +270 -0
  134. package/apps/web/upstream/src/libs/ServerSession.js +102 -0
  135. package/apps/web/upstream/src/libs/SoundBleep.js +20 -0
  136. package/apps/web/upstream/src/libs/StatePersistence.js +90 -0
  137. package/apps/web/upstream/src/libs/ThemeManager.js +128 -0
  138. package/apps/web/upstream/src/libs/TypingMiddleware.js +105 -0
  139. package/apps/web/upstream/src/libs/WindowTitle.js +63 -0
  140. package/apps/web/upstream/src/libs/batchedAdd.js +74 -0
  141. package/apps/web/upstream/src/libs/bufferTools.js +177 -0
  142. package/apps/web/upstream/src/libs/polyfill/Element.closest.js +18 -0
  143. package/apps/web/upstream/src/libs/renderers/Html.js +113 -0
  144. package/apps/web/upstream/src/libs/settingTools.js +31 -0
  145. package/apps/web/upstream/src/libs/state/BufferState.js +703 -0
  146. package/apps/web/upstream/src/libs/state/NetworkState.js +158 -0
  147. package/apps/web/upstream/src/libs/state/UserState.js +89 -0
  148. package/apps/web/upstream/src/libs/state/common.js +26 -0
  149. package/apps/web/upstream/src/libs/state.js +961 -0
  150. package/apps/web/upstream/src/libs/storage/Local.js +51 -0
  151. package/apps/web/upstream/src/main.js +566 -0
  152. package/apps/web/upstream/src/res/autocompleteCommands.js +31 -0
  153. package/apps/web/upstream/src/res/configTemplates.js +373 -0
  154. package/apps/web/upstream/src/res/globalStyle.css +277 -0
  155. package/apps/web/upstream/src/res/kiwiLoadingLogo.png +0 -0
  156. package/apps/web/upstream/src/res/locales/app.af-ZA.po +1145 -0
  157. package/apps/web/upstream/src/res/locales/app.ar-SA.po +1145 -0
  158. package/apps/web/upstream/src/res/locales/app.bg-BG.po +1145 -0
  159. package/apps/web/upstream/src/res/locales/app.bs-BA.po +1145 -0
  160. package/apps/web/upstream/src/res/locales/app.ca-ES.po +1145 -0
  161. package/apps/web/upstream/src/res/locales/app.cs-CZ.po +1145 -0
  162. package/apps/web/upstream/src/res/locales/app.da-DK.po +1145 -0
  163. package/apps/web/upstream/src/res/locales/app.de-DE.po +1145 -0
  164. package/apps/web/upstream/src/res/locales/app.dev.po +1246 -0
  165. package/apps/web/upstream/src/res/locales/app.el-GR.po +1145 -0
  166. package/apps/web/upstream/src/res/locales/app.en-US.po +1145 -0
  167. package/apps/web/upstream/src/res/locales/app.es-419.po +1145 -0
  168. package/apps/web/upstream/src/res/locales/app.es-AR.po +1145 -0
  169. package/apps/web/upstream/src/res/locales/app.es-EM.po +536 -0
  170. package/apps/web/upstream/src/res/locales/app.es-ES.po +1145 -0
  171. package/apps/web/upstream/src/res/locales/app.es-US.po +1145 -0
  172. package/apps/web/upstream/src/res/locales/app.eu-ES.po +1145 -0
  173. package/apps/web/upstream/src/res/locales/app.fi-FI.po +1145 -0
  174. package/apps/web/upstream/src/res/locales/app.fr-FR.po +1145 -0
  175. package/apps/web/upstream/src/res/locales/app.gl-ES.po +1145 -0
  176. package/apps/web/upstream/src/res/locales/app.he-IL.po +1145 -0
  177. package/apps/web/upstream/src/res/locales/app.hi-IN.po +1145 -0
  178. package/apps/web/upstream/src/res/locales/app.hu-HU.po +1145 -0
  179. package/apps/web/upstream/src/res/locales/app.id-ID.po +1145 -0
  180. package/apps/web/upstream/src/res/locales/app.it-IT.po +1145 -0
  181. package/apps/web/upstream/src/res/locales/app.ja-JP.po +1145 -0
  182. package/apps/web/upstream/src/res/locales/app.ko-KR.po +1145 -0
  183. package/apps/web/upstream/src/res/locales/app.nl-NL.po +1145 -0
  184. package/apps/web/upstream/src/res/locales/app.no-NO.po +1145 -0
  185. package/apps/web/upstream/src/res/locales/app.pl-PL.po +1145 -0
  186. package/apps/web/upstream/src/res/locales/app.pt-BR.po +1145 -0
  187. package/apps/web/upstream/src/res/locales/app.pt-PT.po +1145 -0
  188. package/apps/web/upstream/src/res/locales/app.ro-RO.po +1145 -0
  189. package/apps/web/upstream/src/res/locales/app.ru-RU.po +1145 -0
  190. package/apps/web/upstream/src/res/locales/app.sl-SI.po +1145 -0
  191. package/apps/web/upstream/src/res/locales/app.sq-AL.po +1145 -0
  192. package/apps/web/upstream/src/res/locales/app.sr-SP.po +1145 -0
  193. package/apps/web/upstream/src/res/locales/app.sv-SE.po +1145 -0
  194. package/apps/web/upstream/src/res/locales/app.tr-TR.po +1145 -0
  195. package/apps/web/upstream/src/res/locales/app.uk-UA.po +1145 -0
  196. package/apps/web/upstream/src/res/locales/app.vi-VN.po +1145 -0
  197. package/apps/web/upstream/src/res/locales/app.zh-CN.po +1145 -0
  198. package/apps/web/upstream/src/res/locales/app.zh-TW.po +1145 -0
  199. package/apps/web/upstream/src/res/localesList.json +27 -0
  200. package/apps/web/upstream/src/res/logo.png +0 -0
  201. package/apps/web/upstream/src/thirdparty/about.html +43 -0
  202. package/apps/web/upstream/src/thirdparty/index.js +5 -0
  203. package/apps/web/upstream/src/thirdparty/kiwiirccom.vue +185 -0
  204. package/apps/web/upstream/static/config.json +28 -0
  205. package/apps/web/upstream/static/emoticons/smile.png +0 -0
  206. package/apps/web/upstream/static/favicon.png +0 -0
  207. package/apps/web/upstream/static/highlight.mp3 +0 -0
  208. package/apps/web/upstream/static/highlight.ogg +0 -0
  209. package/apps/web/upstream/static/locales/.gitignore +2 -0
  210. package/apps/web/upstream/static/plugins/customise.html.example +10 -0
  211. package/apps/web/upstream/static/themes/coffee/theme.css +145 -0
  212. package/apps/web/upstream/static/themes/common/base.css +1064 -0
  213. package/apps/web/upstream/static/themes/dark/theme.css +196 -0
  214. package/apps/web/upstream/static/themes/default/theme.css +92 -0
  215. package/apps/web/upstream/static/themes/elite/theme.css +248 -0
  216. package/apps/web/upstream/static/themes/grayfox/theme.css +143 -0
  217. package/apps/web/upstream/static/themes/nightswatch/theme.css +367 -0
  218. package/apps/web/upstream/static/themes/osprey/theme.css +115 -0
  219. package/apps/web/upstream/static/themes/radioactive/theme.css +1211 -0
  220. package/apps/web/upstream/static/themes/sky/theme.css +107 -0
  221. package/apps/web/upstream/tests/unit/BatchAdd.spec.js +174 -0
  222. package/apps/web/upstream/tests/unit/MessageParser.spec.js +125 -0
  223. package/apps/web/upstream/tests/unit/Misc.spec.js +24 -0
  224. package/apps/web/upstream/tests/unit/NetworkState.spec.js +58 -0
  225. package/apps/web/upstream/tests/unit/StartupError.spec.js +20 -0
  226. package/apps/web/upstream/vue.config.js +150 -0
  227. package/apps/web/upstream/yarn.lock +9767 -0
  228. package/apps/web/vitest.config.ts +13 -0
  229. package/biome.json +1 -0
  230. package/docs/Home.md +1 -0
  231. package/docs/WebClientGuide.md +535 -0
  232. package/package.json +2 -2
  233. package/packages/aws-adapter/package.json +1 -1
  234. package/packages/cf-adapter/package.json +1 -1
  235. package/packages/cf-adapter/tests/cf-harness.ts +12 -1
  236. package/packages/in-memory-runtime/package.json +1 -1
  237. package/packages/irc-core/package.json +1 -1
  238. package/packages/irc-core/reports/mutation/mutation.html +342 -0
  239. package/packages/irc-core/tests/batch.test.ts +15 -0
  240. package/packages/irc-core/tests/numerics.test.ts +13 -0
  241. package/packages/irc-core/tests/parser.test.ts +109 -0
  242. package/packages/irc-server/package.json +1 -1
  243. package/packages/irc-test-support/package.json +1 -1
  244. package/packages/irc-test-support/src/scenarios.ts +24 -2
  245. package/tools/ci-hardening/package.json +1 -1
  246. package/tools/load-test/package.json +1 -1
  247. package/tools/tcp-ws-forwarder/package.json +1 -1
@@ -0,0 +1,149 @@
1
+ <template>
2
+ <div class="u-tabbed-view">
3
+ <div :key="prefixID + a" class="u-tabbed-view-tabs">
4
+ <a
5
+ v-for="c in tabs"
6
+ :key="c.name || c.header"
7
+ :class="{
8
+ 'u-tabbed-view-tab': true,
9
+ 'u-tabbed-view-tab--active': c.active
10
+ }"
11
+ @click="setActive(c)"
12
+ >{{ c.header }}</a>
13
+ </div>
14
+ <slot />
15
+ </div>
16
+ </template>
17
+
18
+ <script>
19
+ 'kiwi public';
20
+
21
+ let Vue = require('vue');
22
+
23
+ Vue.component('tabbed-tab', {
24
+ props: {
25
+ header: { status: String },
26
+ focus: { status: Boolean },
27
+ name: { status: String },
28
+ },
29
+ data: function data() {
30
+ return { active: false };
31
+ },
32
+ template: '<div v-if="active" class="u-tabbed-content"><slot></slot></div>',
33
+ });
34
+
35
+ export default Vue.component('tabbed-view', {
36
+ data: function data() {
37
+ return {
38
+ // We increment this when we need to re-render the tabs.
39
+ // Vue doesn't pick up on the $children changes all the time so we handle
40
+ // it ourselves.
41
+ a: 1,
42
+ prefixID: Math.floor(Math.random() * 100000).toString(36),
43
+ };
44
+ },
45
+ computed: {
46
+ tabs: function computedtabs() {
47
+ return this.$children;
48
+ },
49
+ },
50
+ mounted() {
51
+ this.setActiveCheck();
52
+ },
53
+ methods: {
54
+ getActive: function getActive() {
55
+ let foundChild = null;
56
+ this.$children.forEach((child) => {
57
+ if (child.active) {
58
+ foundChild = child;
59
+ }
60
+ });
61
+
62
+ return foundChild;
63
+ },
64
+ setActive: function setActive(c) {
65
+ this.$children.forEach((child) => {
66
+ if (child !== c) {
67
+ child.active = false;
68
+ }
69
+ });
70
+ c.active = true;
71
+
72
+ // Without this, vue doesnt update itself with the new $children :(
73
+ this.a++;
74
+ this.$emit('changed', c.name);
75
+ },
76
+ setActiveByName: function setActiveByName(name) {
77
+ this.$children.forEach((child) => {
78
+ if (child.name === name) {
79
+ this.setActive(child);
80
+ }
81
+ });
82
+ },
83
+ setActiveCheck: function setActiveCheck() {
84
+ this.$children.forEach((t) => {
85
+ if (t.focus) {
86
+ this.setActive(t);
87
+ }
88
+ });
89
+ },
90
+ },
91
+ });
92
+ </script>
93
+
94
+ <style>
95
+ .u-tabbed-view {
96
+ display: flex;
97
+ flex-direction: column;
98
+ height: 100%;
99
+ }
100
+
101
+ .u-tabbed-view-tabs {
102
+ padding-top: 15px;
103
+ }
104
+
105
+ .u-tabbed-view-tab {
106
+ display: inline-block;
107
+ cursor: pointer;
108
+ border-width: 0;
109
+ border-style: solid;
110
+ background: #fff;
111
+ font-weight: 600;
112
+ opacity: 1;
113
+ z-index: 1;
114
+ margin-bottom: -3px;
115
+ position: relative;
116
+ width: auto;
117
+ text-align: left;
118
+ box-sizing: border-box;
119
+ padding: 0.5em 1em;
120
+ border-bottom: 3px solid rgba(0, 0, 0, 0.1);
121
+ transition: border 0.3s;
122
+ }
123
+
124
+ .u-tabbed-view-tab:hover,
125
+ .u-tabbed-view-tab--active {
126
+ border-bottom-width: 3px;
127
+ }
128
+
129
+ .u-tabbed-view-tab:last-of-type {
130
+ z-index: 1;
131
+ border-radius: 0 4px 0 0;
132
+ }
133
+
134
+ .u-tabbed-content {
135
+ overflow: auto;
136
+ height: 100%;
137
+ }
138
+
139
+ @media screen and (max-width: 769px) {
140
+ .u-tabbed-view-tabs {
141
+ padding-top: 0;
142
+ }
143
+
144
+ .u-tabbed-view-tab {
145
+ padding: 10px 20px;
146
+ width: auto;
147
+ }
148
+ }
149
+ </style>
@@ -0,0 +1,97 @@
1
+ <template>
2
+ <transition
3
+ name="u-transition-expand"
4
+ @enter="enter"
5
+ @after-enter="afterEnter"
6
+ @leave="leave"
7
+ >
8
+ <div v-if="$slots.default"><slot /></div>
9
+ </transition>
10
+ </template>
11
+
12
+ <script>
13
+ 'kiwi public';
14
+
15
+ const Vue = require('vue');
16
+
17
+ // Code created from https://markus.oberlehner.net/blog/transition-to-height-auto-with-vue/
18
+
19
+ export default Vue.component('transition-expand', {
20
+ name: 'TransitionExpand',
21
+ methods: {
22
+ enter(element) {
23
+ const width = getComputedStyle(element).width;
24
+
25
+ element.style.width = width;
26
+ element.style.position = 'absolute';
27
+ element.style.visibility = 'hidden';
28
+ element.style.height = 'auto';
29
+
30
+ const height = getComputedStyle(element).height;
31
+
32
+ element.style.width = null;
33
+ element.style.position = null;
34
+ element.style.visibility = null;
35
+ element.style.height = 0;
36
+
37
+ // Force repaint to make sure the
38
+ // animation is triggered correctly.
39
+ // eslint-disable-next-line no-unused-expressions
40
+ getComputedStyle(element).height;
41
+
42
+ // Trigger the animation.
43
+ // We use `requestAnimationFrame` because we need
44
+ // to make sure the browser has finished
45
+ // painting after setting the `height`
46
+ // to `0` in the line above.
47
+ requestAnimationFrame(() => {
48
+ element.style.height = height;
49
+ });
50
+ },
51
+ afterEnter(element) {
52
+ element.style.height = 'auto';
53
+ },
54
+ leave(element) {
55
+ const height = getComputedStyle(element).height;
56
+
57
+ element.style.height = height;
58
+
59
+ // Force repaint to make sure the
60
+ // animation is triggered correctly.
61
+ // eslint-disable-next-line no-unused-expressions
62
+ getComputedStyle(element).height;
63
+
64
+ requestAnimationFrame(() => {
65
+ element.style.height = 0;
66
+ });
67
+ },
68
+ },
69
+ });
70
+ </script>
71
+
72
+ <style>
73
+ .u-transition-expand-enter-active,
74
+ .u-transition-expand-leave-active {
75
+ transition: height 0.2s, opacity 0.2s;
76
+ overflow: hidden;
77
+ }
78
+
79
+ .u-transition-expand-enter,
80
+ .u-transition-expand-leave-to {
81
+ opacity: 0;
82
+ height: 0;
83
+ }
84
+ </style>
85
+
86
+ <style scoped>
87
+ /*
88
+ try to force the browser into optimizing the animation
89
+ using hardware acceleration
90
+ */
91
+ * {
92
+ will-change: height;
93
+ transform: translateZ(0);
94
+ backface-visibility: hidden;
95
+ perspective: 1000px;
96
+ }
97
+ </style>
@@ -0,0 +1,128 @@
1
+ 'kiwi public';
2
+
3
+ /** @module */
4
+
5
+ /**
6
+ * Converts a hex CSS color value to RGB.
7
+ * Adapted from http://stackoverflow.com/a/5624139.
8
+ *
9
+ * @param {String} _hex The hexadecimal color value
10
+ * @return {Object} The RGB representation
11
+ */
12
+ export function hex2rgb(_hex) {
13
+ // Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF")
14
+ let shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
15
+ let hex = _hex.replace(shorthandRegex, (m, r, g, b) => r + r + g + g + b + b);
16
+
17
+ let result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
18
+ return result ? {
19
+ r: parseInt(result[1], 16),
20
+ g: parseInt(result[2], 16),
21
+ b: parseInt(result[3], 16),
22
+ } : null;
23
+ }
24
+
25
+ /**
26
+ * Converts an RGB color value to a hex string.
27
+ * @param {Object} rgb RGB as r, g, and b keys
28
+ * @return {String} Hex color string
29
+ */
30
+ export function rgb2hex(rgb) {
31
+ return '#' + ['r', 'g', 'b']
32
+ .map((key) => ('0' + rgb[key].toString(16)).slice(-2))
33
+ .join('');
34
+ }
35
+
36
+ /**
37
+ * Converts an RGB color value to HSL. Conversion formula adapted from
38
+ * http://en.wikipedia.org/wiki/HSL_color_space. This function adapted
39
+ * from http://stackoverflow.com/a/9493060.
40
+ * Assumes r, g, and b are contained in the set [0, 255] and
41
+ * returns h, s, and l in the set [0, 1].
42
+ *
43
+ * @param Object rgb RGB as r, g, and b keys
44
+ * @return Object HSL as h, s, and l keys
45
+ */
46
+ export function rgb2hsl(rgb) {
47
+ let r = rgb.r;
48
+ let g = rgb.g;
49
+ let b = rgb.b;
50
+
51
+ r /= 255;
52
+ g /= 255;
53
+ b /= 255;
54
+
55
+ let max = Math.max(r, g, b);
56
+ let min = Math.min(r, g, b);
57
+ let h = 0;
58
+ let s = 0;
59
+ let l = (max + min) / 2;
60
+
61
+ if (max === min) {
62
+ h = s = 0; // achromatic
63
+ } else {
64
+ let d = max - min;
65
+ s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
66
+ if (max === r) {
67
+ h = (g - b) / d + (g < b ? 6 : 0);
68
+ } else if (max === g) {
69
+ h = (b - r) / d + 2;
70
+ } else if (max === b) {
71
+ h = (r - g) / d + 4;
72
+ }
73
+ h /= 6;
74
+ }
75
+
76
+ return { h, s, l };
77
+ }
78
+
79
+ /**
80
+ * Converts an HSL color value to RGB. Conversion formula adapted from
81
+ * http://en.wikipedia.org/wiki/HSL_color_space. This function adapted
82
+ * from http://stackoverflow.com/a/9493060.
83
+ * Assumes h, s, and l are contained in the set [0, 1] and
84
+ * returns r, g, and b in the set [0, 255].
85
+ *
86
+ * @param Object hsl HSL as h, s, and l keys
87
+ * @return Object RGB as r, g, and b values
88
+ */
89
+ export function hsl2rgb(hsl) {
90
+ function hue2rgb(_p, _q, _t) {
91
+ let p = _p;
92
+ let q = _q;
93
+ let t = _t;
94
+ if (t < 0) t += 1;
95
+ if (t > 1) t -= 1;
96
+ if (t < 1 / 6) return p + (q - p) * 6 * t;
97
+ if (t < 1 / 2) return q;
98
+ if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
99
+ return p;
100
+ }
101
+
102
+ let h = hsl.h;
103
+ let s = hsl.s;
104
+ let l = hsl.l;
105
+ let r = 0;
106
+ let g = 0;
107
+ let b = 0;
108
+
109
+ if (s === 0) {
110
+ r = g = b = l; // achromatic
111
+ } else {
112
+ let q = l < 0.5 ? l * (1 + s) : l + s - l * s;
113
+ let p = 2 * l - q;
114
+ r = hue2rgb(p, q, h + 1 / 3);
115
+ g = hue2rgb(p, q, h);
116
+ b = hue2rgb(p, q, h - 1 / 3);
117
+ }
118
+
119
+ return {
120
+ r: Math.round(r * 255),
121
+ g: Math.round(g * 255),
122
+ b: Math.round(b * 255),
123
+ };
124
+ }
125
+
126
+ export function rgb2rgbString(rgb) {
127
+ return 'rgb(' + [rgb.r, rgb.g, rgb.b].join(',') + ')';
128
+ }
@@ -0,0 +1,26 @@
1
+ 'kiwi public';
2
+
3
+ export function extbanAccount(network) {
4
+ // Eg. InspIRCd-2.0
5
+ // Eg. UnrealIRCd-4.0.17
6
+ // Eg. ircd-seven-1.1.7
7
+ // Eg. u2.10.12.10+snircd(1.3.4a)
8
+ let ircdType = network.ircd.toLowerCase();
9
+
10
+ // Eg. ~,qjncrRa
11
+ // Eg. ,qjncrRa
12
+ let extban = network.ircClient.network.supports('EXTBAN') || '';
13
+ if (!extban) {
14
+ return '';
15
+ }
16
+
17
+ let prefix = extban.split(',')[0];
18
+ let type = 'a';
19
+
20
+ // https://docs.inspircd.org/3/modules/services_account/#extended-bans
21
+ if (ircdType.indexOf('inspircd') > -1) {
22
+ type = 'R';
23
+ }
24
+
25
+ return prefix + type;
26
+ }
@@ -0,0 +1,193 @@
1
+ 'kiwi public';
2
+
3
+ /** @module */
4
+
5
+ /* eslint-disable */
6
+ // http://www.myersdaily.org/joseph/javascript/md5-text.html
7
+
8
+ function md5cycle(x, k) {
9
+ var a = x[0], b = x[1], c = x[2], d = x[3];
10
+
11
+ a = ff(a, b, c, d, k[0], 7, -680876936);
12
+ d = ff(d, a, b, c, k[1], 12, -389564586);
13
+ c = ff(c, d, a, b, k[2], 17, 606105819);
14
+ b = ff(b, c, d, a, k[3], 22, -1044525330);
15
+ a = ff(a, b, c, d, k[4], 7, -176418897);
16
+ d = ff(d, a, b, c, k[5], 12, 1200080426);
17
+ c = ff(c, d, a, b, k[6], 17, -1473231341);
18
+ b = ff(b, c, d, a, k[7], 22, -45705983);
19
+ a = ff(a, b, c, d, k[8], 7, 1770035416);
20
+ d = ff(d, a, b, c, k[9], 12, -1958414417);
21
+ c = ff(c, d, a, b, k[10], 17, -42063);
22
+ b = ff(b, c, d, a, k[11], 22, -1990404162);
23
+ a = ff(a, b, c, d, k[12], 7, 1804603682);
24
+ d = ff(d, a, b, c, k[13], 12, -40341101);
25
+ c = ff(c, d, a, b, k[14], 17, -1502002290);
26
+ b = ff(b, c, d, a, k[15], 22, 1236535329);
27
+
28
+ a = gg(a, b, c, d, k[1], 5, -165796510);
29
+ d = gg(d, a, b, c, k[6], 9, -1069501632);
30
+ c = gg(c, d, a, b, k[11], 14, 643717713);
31
+ b = gg(b, c, d, a, k[0], 20, -373897302);
32
+ a = gg(a, b, c, d, k[5], 5, -701558691);
33
+ d = gg(d, a, b, c, k[10], 9, 38016083);
34
+ c = gg(c, d, a, b, k[15], 14, -660478335);
35
+ b = gg(b, c, d, a, k[4], 20, -405537848);
36
+ a = gg(a, b, c, d, k[9], 5, 568446438);
37
+ d = gg(d, a, b, c, k[14], 9, -1019803690);
38
+ c = gg(c, d, a, b, k[3], 14, -187363961);
39
+ b = gg(b, c, d, a, k[8], 20, 1163531501);
40
+ a = gg(a, b, c, d, k[13], 5, -1444681467);
41
+ d = gg(d, a, b, c, k[2], 9, -51403784);
42
+ c = gg(c, d, a, b, k[7], 14, 1735328473);
43
+ b = gg(b, c, d, a, k[12], 20, -1926607734);
44
+
45
+ a = hh(a, b, c, d, k[5], 4, -378558);
46
+ d = hh(d, a, b, c, k[8], 11, -2022574463);
47
+ c = hh(c, d, a, b, k[11], 16, 1839030562);
48
+ b = hh(b, c, d, a, k[14], 23, -35309556);
49
+ a = hh(a, b, c, d, k[1], 4, -1530992060);
50
+ d = hh(d, a, b, c, k[4], 11, 1272893353);
51
+ c = hh(c, d, a, b, k[7], 16, -155497632);
52
+ b = hh(b, c, d, a, k[10], 23, -1094730640);
53
+ a = hh(a, b, c, d, k[13], 4, 681279174);
54
+ d = hh(d, a, b, c, k[0], 11, -358537222);
55
+ c = hh(c, d, a, b, k[3], 16, -722521979);
56
+ b = hh(b, c, d, a, k[6], 23, 76029189);
57
+ a = hh(a, b, c, d, k[9], 4, -640364487);
58
+ d = hh(d, a, b, c, k[12], 11, -421815835);
59
+ c = hh(c, d, a, b, k[15], 16, 530742520);
60
+ b = hh(b, c, d, a, k[2], 23, -995338651);
61
+
62
+ a = ii(a, b, c, d, k[0], 6, -198630844);
63
+ d = ii(d, a, b, c, k[7], 10, 1126891415);
64
+ c = ii(c, d, a, b, k[14], 15, -1416354905);
65
+ b = ii(b, c, d, a, k[5], 21, -57434055);
66
+ a = ii(a, b, c, d, k[12], 6, 1700485571);
67
+ d = ii(d, a, b, c, k[3], 10, -1894986606);
68
+ c = ii(c, d, a, b, k[10], 15, -1051523);
69
+ b = ii(b, c, d, a, k[1], 21, -2054922799);
70
+ a = ii(a, b, c, d, k[8], 6, 1873313359);
71
+ d = ii(d, a, b, c, k[15], 10, -30611744);
72
+ c = ii(c, d, a, b, k[6], 15, -1560198380);
73
+ b = ii(b, c, d, a, k[13], 21, 1309151649);
74
+ a = ii(a, b, c, d, k[4], 6, -145523070);
75
+ d = ii(d, a, b, c, k[11], 10, -1120210379);
76
+ c = ii(c, d, a, b, k[2], 15, 718787259);
77
+ b = ii(b, c, d, a, k[9], 21, -343485551);
78
+
79
+ x[0] = add32(a, x[0]);
80
+ x[1] = add32(b, x[1]);
81
+ x[2] = add32(c, x[2]);
82
+ x[3] = add32(d, x[3]);
83
+
84
+ }
85
+
86
+ function cmn(q, a, b, x, s, t) {
87
+ a = add32(add32(a, q), add32(x, t));
88
+ return add32((a << s) | (a >>> (32 - s)), b);
89
+ }
90
+
91
+ function ff(a, b, c, d, x, s, t) {
92
+ return cmn((b & c) | ((~b) & d), a, b, x, s, t);
93
+ }
94
+
95
+ function gg(a, b, c, d, x, s, t) {
96
+ return cmn((b & d) | (c & (~d)), a, b, x, s, t);
97
+ }
98
+
99
+ function hh(a, b, c, d, x, s, t) {
100
+ return cmn(b ^ c ^ d, a, b, x, s, t);
101
+ }
102
+
103
+ function ii(a, b, c, d, x, s, t) {
104
+ return cmn(c ^ (b | (~d)), a, b, x, s, t);
105
+ }
106
+
107
+ function md51(s) {
108
+ //txt = '';
109
+ var n = s.length,
110
+ state = [1732584193, -271733879, -1732584194, 271733878], i;
111
+ for (i=64; i<=s.length; i+=64) {
112
+ md5cycle(state, md5blk(s.substring(i-64, i)));
113
+ }
114
+ s = s.substring(i-64);
115
+ var tail = [0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0];
116
+ for (i=0; i<s.length; i++)
117
+ tail[i>>2] |= s.charCodeAt(i) << ((i%4) << 3);
118
+ tail[i>>2] |= 0x80 << ((i%4) << 3);
119
+ if (i > 55) {
120
+ md5cycle(state, tail);
121
+ for (i=0; i<16; i++) tail[i] = 0;
122
+ }
123
+ tail[14] = n*8;
124
+ md5cycle(state, tail);
125
+ return state;
126
+ }
127
+
128
+ /* there needs to be support for Unicode here,
129
+ * unless we pretend that we can redefine the MD-5
130
+ * algorithm for multi-byte characters (perhaps
131
+ * by adding every four 16-bit characters and
132
+ * shortening the sum to 32 bits). Otherwise
133
+ * I suggest performing MD-5 as if every character
134
+ * was two bytes--e.g., 0040 0025 = @%--but then
135
+ * how will an ordinary MD-5 sum be matched?
136
+ * There is no way to standardize text to something
137
+ * like UTF-8 before transformation; speed cost is
138
+ * utterly prohibitive. The JavaScript standard
139
+ * itself needs to look at this: it should start
140
+ * providing access to strings as preformed UTF-8
141
+ * 8-bit unsigned value arrays.
142
+ */
143
+ function md5blk(s) { /* I figured global was faster. */
144
+ var md5blks = [], i; /* Andy King said do it this way. */
145
+ for (i=0; i<64; i+=4) {
146
+ md5blks[i>>2] = s.charCodeAt(i)
147
+ + (s.charCodeAt(i+1) << 8)
148
+ + (s.charCodeAt(i+2) << 16)
149
+ + (s.charCodeAt(i+3) << 24);
150
+ }
151
+ return md5blks;
152
+ }
153
+
154
+ var hex_chr = '0123456789abcdef'.split('');
155
+
156
+ function rhex(n){
157
+ var s='', j=0;
158
+ for(; j<4; j++)
159
+ s += hex_chr[(n >> (j * 8 + 4)) & 0x0F]
160
+ + hex_chr[(n >> (j * 8)) & 0x0F];
161
+ return s;
162
+ }
163
+
164
+ function hex(x) {
165
+ for (var i=0; i<x.length; i++)
166
+ x[i] = rhex(x[i]);
167
+ return x.join('');
168
+ }
169
+
170
+ function md5(s) {
171
+ return hex(md51(s));
172
+ }
173
+
174
+ /* this function is much faster,
175
+ so if possible we use it. Some IEs
176
+ are the only ones I know of that
177
+ need the idiotic second function,
178
+ generated by an if clause. */
179
+
180
+ function add32(a, b) {
181
+ return (a + b) & 0xFFFFFFFF;
182
+ }
183
+
184
+ if (md5('hello') != '5d41402abc4b2a76b9719d911017c592') {
185
+ function add32(x, y) {
186
+ var lsw = (x & 0xFFFF) + (y & 0xFFFF),
187
+ msw = (x >> 16) + (y >> 16) + (lsw >> 16);
188
+ return (msw << 16) | (lsw & 0xFFFF);
189
+ }
190
+ }
191
+
192
+
193
+ export {md5};