Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | 117x 117x 117x 117x 117x 117x | import { DateTime } from 'luxon';
import { Plugin } from '../model/plugin';
import { Mod } from '../model/tag';
import { Template } from '../model/template';
export const chatTemplate: Template = {
tag: 'chat',
name: $localize`🗨️ Chat`,
config: {
version: 2,
type: 'lens',
mod: $localize`🗨️ Chat`,
genId: true,
internal: true,
generated: $localize`Generated by jasper-ui ${DateTime.now().toISO()}`,
submit: $localize`🗨️ chat/`,
view: $localize`🗨️`,
description: $localize`Activates built-in Chat mode for viewing Refs.`,
aiInstructions: `# chat
The chat template creates chat rooms with real-time chat.
When replying to a chat message, adding a notification to the user is optional, but not required.
Notifying the user is only necessary if they have stepped away fom the chat room and need a ping.
When replying to a chat message, be sure to include the same chat tag. For example, chat/general.
Never include a title in a chat message, only a comment.
NEVER INCLUDE A TITLE IN A CHAT MESSAGE, ONLY A COMMENT.
If you include a title and a comment, only the title text will be visible until the user clicks
on the chat message, which is poor form.
If the comment is longer than 140 characters, the first 140 characters followed by ellipsis will
be used as the title.
Always give the shortest possible response. Responses longer than a line will be wrapped, and only
show past the first line when focused. Respond in multiple messages if necessary.`,
icons: [{ thumbnail: $localize`🗨️`, order: 1 }],
filters: [
{ query: 'chat', label: $localize`🗨️ chats`, title: $localize`Chats`, group: $localize`Templates 🎨️` },
],
// language=CSS
css: `
.chat {
.odd > * {
background-color: var(--bg-accent);
backdrop-filter: blur(1px);
}
.gutter {
opacity: 0.5;
}
.focused {
margin: 4px;
}
.messages {
max-height: 80vh;
.cdk-virtual-scroll-content-wrapper {
display: grid;
grid-template-columns: min-content auto;
width: 100%;
}
}
}
`,
form: [{
key: 'authorTags',
type: 'qtags',
defaultValue: ['user', 'plugin/from'],
props: {
label: $localize`Author Tags:`,
addText: $localize`+ Add another prefix`,
}
}],
},
defaults: {
authorTags: ['user', 'plugin/from', '+plugin'],
noFloatingSidebar: true,
},
schema: {
optionalProperties: {
authorTags: { elements: { type: 'string' } },
}
}
};
export const chatroomPlugin: Plugin = {
tag: 'plugin/chat',
name: $localize`🗨️ Chatroom`,
config: {
mod: $localize`🗨️ Chat`,
version: 1,
type: 'lens',
add: true,
generated: $localize`Generated by jasper-ui ${DateTime.now().toISO()}`,
description: $localize`Activates built-in chatroom in a Ref.`,
icons: [{ label: $localize`🗨️`, order: -1 }],
filters: [
{ query: 'plugin/chat', label: $localize`🗨️ chatroom`, title: $localize`Chatrooms`, group: $localize`Plugins 🧰️` },
],
// language=Handlebars
infoUi: `{{#if (plugins ref 'plugin/user/lobby')}}<span>👥️ {{plugins ref 'plugin/user/lobby'}} in lobby</span>{{/if}}`,
},
schema: {
optionalProperties: {
lobby: { elements: { type: 'string' } },
}
}
};
export const lobbyPlugin: Plugin = {
tag: 'plugin/user/lobby',
name: $localize`🚪️ Lobby`,
config: {
mod: $localize`🗨️ Chat`,
version: 2,
type: 'lens',
generated: $localize`Generated by jasper-ui ${DateTime.now().toISO()}`,
description: $localize`List users in lobby`,
filters: [
{ user: 'plugin/user/lobby', label: $localize`👥️ active`, title: $localize`My meetings`, group: $localize`Lists ☰` },
],
sorts: [
{ sort: 'metadata->plugins->plugin/user/lobby', label: '👥️ participants', title: $localize`Number of people in lobby` },
],
},
};
export const videoPlugin: Plugin = {
tag: 'plugin/user/video',
name: $localize`📞️ Video Call`,
config: {
mod: $localize`🗨️ Chat`,
version: 1,
type: 'lens',
generated: $localize`Generated by jasper-ui ${DateTime.now().toISO()}`,
description: $localize`Join others in a video call`,
rtcConfig: <RTCConfiguration> {
iceServers: [
{ urls: 'stun:stun.l.google.com:19302' },
{ urls: ['stun:stun.cloudflare.com:3478', 'stun:stun.cloudflare.com:53'] },
// { urls: 'stun:openrelay.metered.ca:80' },
// { urls: 'stun:stun.services.mozilla.com:3478' },
// { urls: 'stun:stunserver.stunprotocol.org:3478' },
// { urls: 'stun:stun.services.mozilla.com:3478' },
// { urls: 'stun:stun.nextcloud.com:3478' }
],
iceCandidatePoolSize: 10,
},
gumConfig: {
audio: true,
video: {
width: { ideal: 640 },
height: { ideal: 640 }
}
},
form: [{
key: 'candidate',
type: 'list',
props: {
label: $localize`Candidates: `,
addText: $localize`+ Add Candidate`,
},
fieldArray: {
wrappers: ['form-group'],
fieldGroup: [{
key: 'candidate',
type: 'string',
}, {
key: 'sdpMid',
type: 'string',
}, {
key: 'sdpMLineIndex',
type: 'number',
}, {
key: 'usernameFragment',
type: 'string',
}],
},
}, {
key: 'offer',
wrappers: ['form-group'],
expressions: {
hide: '!field.parent.model.offer',
},
fieldGroup: [{
key: 'type',
type: 'string',
props: {
label: $localize`Offer Type`,
},
}, {
key: 'sdp',
type: 'textarea',
props: {
label: $localize`Offer SDP`,
},
}],
}, {
key: 'answer',
wrappers: ['form-group'],
expressions: {
hide: '!field.parent.model.answer',
},
fieldGroup: [{
key: 'type',
type: 'string',
props: {
label: $localize`Answer Type`,
},
}, {
key: 'sdp',
type: 'textarea',
props: {
label: $localize`Answer SDP`,
},
}],
}]
},
defaults: {
dial: 0,
candidate: [],
},
schema: {
properties: {
candidate: {
elements: {
optionalProperties: {
candidate: { type: 'string', nullable: true },
sdpMid: { type: 'string', nullable: true },
sdpMLineIndex: { type: 'uint32', nullable: true },
usernameFragment: { type: 'string', nullable: true },
}
}
},
},
optionalProperties: {
dial: { type: 'float64' },
offer: {
optionalProperties: {
type: { type: 'string' },
sdp: { type: 'string' },
}
},
answer: {
optionalProperties: {
type: { type: 'string' },
sdp: { type: 'string' },
}
},
}
}
};
export const chatMod: Mod = {
plugin: [
chatroomPlugin,
lobbyPlugin,
videoPlugin,
],
template: [
chatTemplate,
]
};
|