eat-js-sdk 0.0.1
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/README.md +40 -0
- package/dist/eat-prompt-builder.mjs +1070 -0
- package/package.json +71 -0
package/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# eat-js-sdk
|
|
2
|
+
|
|
3
|
+
Education Authoring Tool SDK built with SvelteKIt
|
|
4
|
+
|
|
5
|
+
## Requirements
|
|
6
|
+
|
|
7
|
+
- NodeJs 18
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
Use the package manager [npm](https://www.npmjs.com/) to install.
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
#install dependencies
|
|
15
|
+
npm install
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
#convert tailwind css to native css and build JS app
|
|
22
|
+
npm run build
|
|
23
|
+
|
|
24
|
+
## Test in local
|
|
25
|
+
|
|
26
|
+
#add script
|
|
27
|
+
<script src="<path/dist/eat-prompt-builder.mjs>" type="module">
|
|
28
|
+
|
|
29
|
+
#add the component
|
|
30
|
+
<prompt-builder />
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Publish
|
|
34
|
+
```bash
|
|
35
|
+
#publish app
|
|
36
|
+
npm publish
|
|
37
|
+
|
|
38
|
+
#Package url
|
|
39
|
+
https://unpkg.com/eat-js-sdk@<version>/dist/eat-prompt-builder.mjs
|
|
40
|
+
```
|
|
@@ -0,0 +1,1070 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
(() => {
|
|
3
|
+
// node_modules/svelte/src/runtime/internal/utils.js
|
|
4
|
+
function noop() {
|
|
5
|
+
}
|
|
6
|
+
function run(fn) {
|
|
7
|
+
return fn();
|
|
8
|
+
}
|
|
9
|
+
function blank_object() {
|
|
10
|
+
return /* @__PURE__ */ Object.create(null);
|
|
11
|
+
}
|
|
12
|
+
function run_all(fns) {
|
|
13
|
+
fns.forEach(run);
|
|
14
|
+
}
|
|
15
|
+
function is_function(thing) {
|
|
16
|
+
return typeof thing === "function";
|
|
17
|
+
}
|
|
18
|
+
function safe_not_equal(a, b) {
|
|
19
|
+
return a != a ? b == b : a !== b || a && typeof a === "object" || typeof a === "function";
|
|
20
|
+
}
|
|
21
|
+
function is_empty(obj) {
|
|
22
|
+
return Object.keys(obj).length === 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// node_modules/svelte/src/runtime/internal/globals.js
|
|
26
|
+
var globals = typeof window !== "undefined" ? window : typeof globalThis !== "undefined" ? globalThis : (
|
|
27
|
+
// @ts-ignore Node typings have this
|
|
28
|
+
global
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
// node_modules/svelte/src/runtime/internal/ResizeObserverSingleton.js
|
|
32
|
+
var ResizeObserverSingleton = class _ResizeObserverSingleton {
|
|
33
|
+
/**
|
|
34
|
+
* @private
|
|
35
|
+
* @readonly
|
|
36
|
+
* @type {WeakMap<Element, import('./private.js').Listener>}
|
|
37
|
+
*/
|
|
38
|
+
_listeners = "WeakMap" in globals ? /* @__PURE__ */ new WeakMap() : void 0;
|
|
39
|
+
/**
|
|
40
|
+
* @private
|
|
41
|
+
* @type {ResizeObserver}
|
|
42
|
+
*/
|
|
43
|
+
_observer = void 0;
|
|
44
|
+
/** @type {ResizeObserverOptions} */
|
|
45
|
+
options;
|
|
46
|
+
/** @param {ResizeObserverOptions} options */
|
|
47
|
+
constructor(options) {
|
|
48
|
+
this.options = options;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* @param {Element} element
|
|
52
|
+
* @param {import('./private.js').Listener} listener
|
|
53
|
+
* @returns {() => void}
|
|
54
|
+
*/
|
|
55
|
+
observe(element2, listener) {
|
|
56
|
+
this._listeners.set(element2, listener);
|
|
57
|
+
this._getObserver().observe(element2, this.options);
|
|
58
|
+
return () => {
|
|
59
|
+
this._listeners.delete(element2);
|
|
60
|
+
this._observer.unobserve(element2);
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* @private
|
|
65
|
+
*/
|
|
66
|
+
_getObserver() {
|
|
67
|
+
return this._observer ?? (this._observer = new ResizeObserver((entries) => {
|
|
68
|
+
for (const entry of entries) {
|
|
69
|
+
_ResizeObserverSingleton.entries.set(entry.target, entry);
|
|
70
|
+
this._listeners.get(entry.target)?.(entry);
|
|
71
|
+
}
|
|
72
|
+
}));
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
ResizeObserverSingleton.entries = "WeakMap" in globals ? /* @__PURE__ */ new WeakMap() : void 0;
|
|
76
|
+
|
|
77
|
+
// node_modules/svelte/src/runtime/internal/dom.js
|
|
78
|
+
var is_hydrating = false;
|
|
79
|
+
function start_hydrating() {
|
|
80
|
+
is_hydrating = true;
|
|
81
|
+
}
|
|
82
|
+
function end_hydrating() {
|
|
83
|
+
is_hydrating = false;
|
|
84
|
+
}
|
|
85
|
+
function append(target, node) {
|
|
86
|
+
target.appendChild(node);
|
|
87
|
+
}
|
|
88
|
+
function append_styles(target, style_sheet_id, styles) {
|
|
89
|
+
const append_styles_to = get_root_for_style(target);
|
|
90
|
+
if (!append_styles_to.getElementById(style_sheet_id)) {
|
|
91
|
+
const style = element("style");
|
|
92
|
+
style.id = style_sheet_id;
|
|
93
|
+
style.textContent = styles;
|
|
94
|
+
append_stylesheet(append_styles_to, style);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
function get_root_for_style(node) {
|
|
98
|
+
if (!node)
|
|
99
|
+
return document;
|
|
100
|
+
const root = node.getRootNode ? node.getRootNode() : node.ownerDocument;
|
|
101
|
+
if (root && /** @type {ShadowRoot} */
|
|
102
|
+
root.host) {
|
|
103
|
+
return (
|
|
104
|
+
/** @type {ShadowRoot} */
|
|
105
|
+
root
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
return node.ownerDocument;
|
|
109
|
+
}
|
|
110
|
+
function append_stylesheet(node, style) {
|
|
111
|
+
append(
|
|
112
|
+
/** @type {Document} */
|
|
113
|
+
node.head || node,
|
|
114
|
+
style
|
|
115
|
+
);
|
|
116
|
+
return style.sheet;
|
|
117
|
+
}
|
|
118
|
+
function insert(target, node, anchor) {
|
|
119
|
+
target.insertBefore(node, anchor || null);
|
|
120
|
+
}
|
|
121
|
+
function detach(node) {
|
|
122
|
+
if (node.parentNode) {
|
|
123
|
+
node.parentNode.removeChild(node);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
function destroy_each(iterations, detaching) {
|
|
127
|
+
for (let i = 0; i < iterations.length; i += 1) {
|
|
128
|
+
if (iterations[i])
|
|
129
|
+
iterations[i].d(detaching);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
function element(name) {
|
|
133
|
+
return document.createElement(name);
|
|
134
|
+
}
|
|
135
|
+
function text(data) {
|
|
136
|
+
return document.createTextNode(data);
|
|
137
|
+
}
|
|
138
|
+
function space() {
|
|
139
|
+
return text(" ");
|
|
140
|
+
}
|
|
141
|
+
function empty() {
|
|
142
|
+
return text("");
|
|
143
|
+
}
|
|
144
|
+
function listen(node, event, handler, options) {
|
|
145
|
+
node.addEventListener(event, handler, options);
|
|
146
|
+
return () => node.removeEventListener(event, handler, options);
|
|
147
|
+
}
|
|
148
|
+
function attr(node, attribute, value) {
|
|
149
|
+
if (value == null)
|
|
150
|
+
node.removeAttribute(attribute);
|
|
151
|
+
else if (node.getAttribute(attribute) !== value)
|
|
152
|
+
node.setAttribute(attribute, value);
|
|
153
|
+
}
|
|
154
|
+
function children(element2) {
|
|
155
|
+
return Array.from(element2.childNodes);
|
|
156
|
+
}
|
|
157
|
+
function get_custom_elements_slots(element2) {
|
|
158
|
+
const result = {};
|
|
159
|
+
element2.childNodes.forEach(
|
|
160
|
+
/** @param {Element} node */
|
|
161
|
+
(node) => {
|
|
162
|
+
result[node.slot || "default"] = true;
|
|
163
|
+
}
|
|
164
|
+
);
|
|
165
|
+
return result;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// node_modules/svelte/src/runtime/internal/lifecycle.js
|
|
169
|
+
var current_component;
|
|
170
|
+
function set_current_component(component) {
|
|
171
|
+
current_component = component;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// node_modules/svelte/src/runtime/internal/scheduler.js
|
|
175
|
+
var dirty_components = [];
|
|
176
|
+
var binding_callbacks = [];
|
|
177
|
+
var render_callbacks = [];
|
|
178
|
+
var flush_callbacks = [];
|
|
179
|
+
var resolved_promise = /* @__PURE__ */ Promise.resolve();
|
|
180
|
+
var update_scheduled = false;
|
|
181
|
+
function schedule_update() {
|
|
182
|
+
if (!update_scheduled) {
|
|
183
|
+
update_scheduled = true;
|
|
184
|
+
resolved_promise.then(flush);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
function add_render_callback(fn) {
|
|
188
|
+
render_callbacks.push(fn);
|
|
189
|
+
}
|
|
190
|
+
var seen_callbacks = /* @__PURE__ */ new Set();
|
|
191
|
+
var flushidx = 0;
|
|
192
|
+
function flush() {
|
|
193
|
+
if (flushidx !== 0) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
const saved_component = current_component;
|
|
197
|
+
do {
|
|
198
|
+
try {
|
|
199
|
+
while (flushidx < dirty_components.length) {
|
|
200
|
+
const component = dirty_components[flushidx];
|
|
201
|
+
flushidx++;
|
|
202
|
+
set_current_component(component);
|
|
203
|
+
update(component.$$);
|
|
204
|
+
}
|
|
205
|
+
} catch (e) {
|
|
206
|
+
dirty_components.length = 0;
|
|
207
|
+
flushidx = 0;
|
|
208
|
+
throw e;
|
|
209
|
+
}
|
|
210
|
+
set_current_component(null);
|
|
211
|
+
dirty_components.length = 0;
|
|
212
|
+
flushidx = 0;
|
|
213
|
+
while (binding_callbacks.length)
|
|
214
|
+
binding_callbacks.pop()();
|
|
215
|
+
for (let i = 0; i < render_callbacks.length; i += 1) {
|
|
216
|
+
const callback = render_callbacks[i];
|
|
217
|
+
if (!seen_callbacks.has(callback)) {
|
|
218
|
+
seen_callbacks.add(callback);
|
|
219
|
+
callback();
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
render_callbacks.length = 0;
|
|
223
|
+
} while (dirty_components.length);
|
|
224
|
+
while (flush_callbacks.length) {
|
|
225
|
+
flush_callbacks.pop()();
|
|
226
|
+
}
|
|
227
|
+
update_scheduled = false;
|
|
228
|
+
seen_callbacks.clear();
|
|
229
|
+
set_current_component(saved_component);
|
|
230
|
+
}
|
|
231
|
+
function update($$) {
|
|
232
|
+
if ($$.fragment !== null) {
|
|
233
|
+
$$.update();
|
|
234
|
+
run_all($$.before_update);
|
|
235
|
+
const dirty = $$.dirty;
|
|
236
|
+
$$.dirty = [-1];
|
|
237
|
+
$$.fragment && $$.fragment.p($$.ctx, dirty);
|
|
238
|
+
$$.after_update.forEach(add_render_callback);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
function flush_render_callbacks(fns) {
|
|
242
|
+
const filtered = [];
|
|
243
|
+
const targets = [];
|
|
244
|
+
render_callbacks.forEach((c) => fns.indexOf(c) === -1 ? filtered.push(c) : targets.push(c));
|
|
245
|
+
targets.forEach((c) => c());
|
|
246
|
+
render_callbacks = filtered;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// node_modules/svelte/src/runtime/internal/transitions.js
|
|
250
|
+
var outroing = /* @__PURE__ */ new Set();
|
|
251
|
+
var outros;
|
|
252
|
+
function transition_in(block, local) {
|
|
253
|
+
if (block && block.i) {
|
|
254
|
+
outroing.delete(block);
|
|
255
|
+
block.i(local);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
function transition_out(block, local, detach2, callback) {
|
|
259
|
+
if (block && block.o) {
|
|
260
|
+
if (outroing.has(block))
|
|
261
|
+
return;
|
|
262
|
+
outroing.add(block);
|
|
263
|
+
outros.c.push(() => {
|
|
264
|
+
outroing.delete(block);
|
|
265
|
+
if (callback) {
|
|
266
|
+
if (detach2)
|
|
267
|
+
block.d(1);
|
|
268
|
+
callback();
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
block.o(local);
|
|
272
|
+
} else if (callback) {
|
|
273
|
+
callback();
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
// node_modules/svelte/src/runtime/internal/each.js
|
|
278
|
+
function ensure_array_like(array_like_or_iterator) {
|
|
279
|
+
return array_like_or_iterator?.length !== void 0 ? array_like_or_iterator : Array.from(array_like_or_iterator);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// node_modules/svelte/src/shared/boolean_attributes.js
|
|
283
|
+
var _boolean_attributes = (
|
|
284
|
+
/** @type {const} */
|
|
285
|
+
[
|
|
286
|
+
"allowfullscreen",
|
|
287
|
+
"allowpaymentrequest",
|
|
288
|
+
"async",
|
|
289
|
+
"autofocus",
|
|
290
|
+
"autoplay",
|
|
291
|
+
"checked",
|
|
292
|
+
"controls",
|
|
293
|
+
"default",
|
|
294
|
+
"defer",
|
|
295
|
+
"disabled",
|
|
296
|
+
"formnovalidate",
|
|
297
|
+
"hidden",
|
|
298
|
+
"inert",
|
|
299
|
+
"ismap",
|
|
300
|
+
"loop",
|
|
301
|
+
"multiple",
|
|
302
|
+
"muted",
|
|
303
|
+
"nomodule",
|
|
304
|
+
"novalidate",
|
|
305
|
+
"open",
|
|
306
|
+
"playsinline",
|
|
307
|
+
"readonly",
|
|
308
|
+
"required",
|
|
309
|
+
"reversed",
|
|
310
|
+
"selected"
|
|
311
|
+
]
|
|
312
|
+
);
|
|
313
|
+
var boolean_attributes = /* @__PURE__ */ new Set([..._boolean_attributes]);
|
|
314
|
+
|
|
315
|
+
// node_modules/svelte/src/runtime/internal/Component.js
|
|
316
|
+
function create_component(block) {
|
|
317
|
+
block && block.c();
|
|
318
|
+
}
|
|
319
|
+
function mount_component(component, target, anchor) {
|
|
320
|
+
const { fragment, after_update } = component.$$;
|
|
321
|
+
fragment && fragment.m(target, anchor);
|
|
322
|
+
add_render_callback(() => {
|
|
323
|
+
const new_on_destroy = component.$$.on_mount.map(run).filter(is_function);
|
|
324
|
+
if (component.$$.on_destroy) {
|
|
325
|
+
component.$$.on_destroy.push(...new_on_destroy);
|
|
326
|
+
} else {
|
|
327
|
+
run_all(new_on_destroy);
|
|
328
|
+
}
|
|
329
|
+
component.$$.on_mount = [];
|
|
330
|
+
});
|
|
331
|
+
after_update.forEach(add_render_callback);
|
|
332
|
+
}
|
|
333
|
+
function destroy_component(component, detaching) {
|
|
334
|
+
const $$ = component.$$;
|
|
335
|
+
if ($$.fragment !== null) {
|
|
336
|
+
flush_render_callbacks($$.after_update);
|
|
337
|
+
run_all($$.on_destroy);
|
|
338
|
+
$$.fragment && $$.fragment.d(detaching);
|
|
339
|
+
$$.on_destroy = $$.fragment = null;
|
|
340
|
+
$$.ctx = [];
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
function make_dirty(component, i) {
|
|
344
|
+
if (component.$$.dirty[0] === -1) {
|
|
345
|
+
dirty_components.push(component);
|
|
346
|
+
schedule_update();
|
|
347
|
+
component.$$.dirty.fill(0);
|
|
348
|
+
}
|
|
349
|
+
component.$$.dirty[i / 31 | 0] |= 1 << i % 31;
|
|
350
|
+
}
|
|
351
|
+
function init(component, options, instance3, create_fragment3, not_equal, props, append_styles2 = null, dirty = [-1]) {
|
|
352
|
+
const parent_component = current_component;
|
|
353
|
+
set_current_component(component);
|
|
354
|
+
const $$ = component.$$ = {
|
|
355
|
+
fragment: null,
|
|
356
|
+
ctx: [],
|
|
357
|
+
// state
|
|
358
|
+
props,
|
|
359
|
+
update: noop,
|
|
360
|
+
not_equal,
|
|
361
|
+
bound: blank_object(),
|
|
362
|
+
// lifecycle
|
|
363
|
+
on_mount: [],
|
|
364
|
+
on_destroy: [],
|
|
365
|
+
on_disconnect: [],
|
|
366
|
+
before_update: [],
|
|
367
|
+
after_update: [],
|
|
368
|
+
context: new Map(options.context || (parent_component ? parent_component.$$.context : [])),
|
|
369
|
+
// everything else
|
|
370
|
+
callbacks: blank_object(),
|
|
371
|
+
dirty,
|
|
372
|
+
skip_bound: false,
|
|
373
|
+
root: options.target || parent_component.$$.root
|
|
374
|
+
};
|
|
375
|
+
append_styles2 && append_styles2($$.root);
|
|
376
|
+
let ready = false;
|
|
377
|
+
$$.ctx = instance3 ? instance3(component, options.props || {}, (i, ret, ...rest) => {
|
|
378
|
+
const value = rest.length ? rest[0] : ret;
|
|
379
|
+
if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) {
|
|
380
|
+
if (!$$.skip_bound && $$.bound[i])
|
|
381
|
+
$$.bound[i](value);
|
|
382
|
+
if (ready)
|
|
383
|
+
make_dirty(component, i);
|
|
384
|
+
}
|
|
385
|
+
return ret;
|
|
386
|
+
}) : [];
|
|
387
|
+
$$.update();
|
|
388
|
+
ready = true;
|
|
389
|
+
run_all($$.before_update);
|
|
390
|
+
$$.fragment = create_fragment3 ? create_fragment3($$.ctx) : false;
|
|
391
|
+
if (options.target) {
|
|
392
|
+
if (options.hydrate) {
|
|
393
|
+
start_hydrating();
|
|
394
|
+
const nodes = children(options.target);
|
|
395
|
+
$$.fragment && $$.fragment.l(nodes);
|
|
396
|
+
nodes.forEach(detach);
|
|
397
|
+
} else {
|
|
398
|
+
$$.fragment && $$.fragment.c();
|
|
399
|
+
}
|
|
400
|
+
if (options.intro)
|
|
401
|
+
transition_in(component.$$.fragment);
|
|
402
|
+
mount_component(component, options.target, options.anchor);
|
|
403
|
+
end_hydrating();
|
|
404
|
+
flush();
|
|
405
|
+
}
|
|
406
|
+
set_current_component(parent_component);
|
|
407
|
+
}
|
|
408
|
+
var SvelteElement;
|
|
409
|
+
if (typeof HTMLElement === "function") {
|
|
410
|
+
SvelteElement = class extends HTMLElement {
|
|
411
|
+
/** The Svelte component constructor */
|
|
412
|
+
$$ctor;
|
|
413
|
+
/** Slots */
|
|
414
|
+
$$s;
|
|
415
|
+
/** The Svelte component instance */
|
|
416
|
+
$$c;
|
|
417
|
+
/** Whether or not the custom element is connected */
|
|
418
|
+
$$cn = false;
|
|
419
|
+
/** Component props data */
|
|
420
|
+
$$d = {};
|
|
421
|
+
/** `true` if currently in the process of reflecting component props back to attributes */
|
|
422
|
+
$$r = false;
|
|
423
|
+
/** @type {Record<string, CustomElementPropDefinition>} Props definition (name, reflected, type etc) */
|
|
424
|
+
$$p_d = {};
|
|
425
|
+
/** @type {Record<string, Function[]>} Event listeners */
|
|
426
|
+
$$l = {};
|
|
427
|
+
/** @type {Map<Function, Function>} Event listener unsubscribe functions */
|
|
428
|
+
$$l_u = /* @__PURE__ */ new Map();
|
|
429
|
+
constructor($$componentCtor, $$slots, use_shadow_dom) {
|
|
430
|
+
super();
|
|
431
|
+
this.$$ctor = $$componentCtor;
|
|
432
|
+
this.$$s = $$slots;
|
|
433
|
+
if (use_shadow_dom) {
|
|
434
|
+
this.attachShadow({ mode: "open" });
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
addEventListener(type, listener, options) {
|
|
438
|
+
this.$$l[type] = this.$$l[type] || [];
|
|
439
|
+
this.$$l[type].push(listener);
|
|
440
|
+
if (this.$$c) {
|
|
441
|
+
const unsub = this.$$c.$on(type, listener);
|
|
442
|
+
this.$$l_u.set(listener, unsub);
|
|
443
|
+
}
|
|
444
|
+
super.addEventListener(type, listener, options);
|
|
445
|
+
}
|
|
446
|
+
removeEventListener(type, listener, options) {
|
|
447
|
+
super.removeEventListener(type, listener, options);
|
|
448
|
+
if (this.$$c) {
|
|
449
|
+
const unsub = this.$$l_u.get(listener);
|
|
450
|
+
if (unsub) {
|
|
451
|
+
unsub();
|
|
452
|
+
this.$$l_u.delete(listener);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
async connectedCallback() {
|
|
457
|
+
this.$$cn = true;
|
|
458
|
+
if (!this.$$c) {
|
|
459
|
+
let create_slot = function(name) {
|
|
460
|
+
return () => {
|
|
461
|
+
let node;
|
|
462
|
+
const obj = {
|
|
463
|
+
c: function create() {
|
|
464
|
+
node = element("slot");
|
|
465
|
+
if (name !== "default") {
|
|
466
|
+
attr(node, "name", name);
|
|
467
|
+
}
|
|
468
|
+
},
|
|
469
|
+
/**
|
|
470
|
+
* @param {HTMLElement} target
|
|
471
|
+
* @param {HTMLElement} [anchor]
|
|
472
|
+
*/
|
|
473
|
+
m: function mount(target, anchor) {
|
|
474
|
+
insert(target, node, anchor);
|
|
475
|
+
},
|
|
476
|
+
d: function destroy(detaching) {
|
|
477
|
+
if (detaching) {
|
|
478
|
+
detach(node);
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
};
|
|
482
|
+
return obj;
|
|
483
|
+
};
|
|
484
|
+
};
|
|
485
|
+
await Promise.resolve();
|
|
486
|
+
if (!this.$$cn) {
|
|
487
|
+
return;
|
|
488
|
+
}
|
|
489
|
+
const $$slots = {};
|
|
490
|
+
const existing_slots = get_custom_elements_slots(this);
|
|
491
|
+
for (const name of this.$$s) {
|
|
492
|
+
if (name in existing_slots) {
|
|
493
|
+
$$slots[name] = [create_slot(name)];
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
for (const attribute of this.attributes) {
|
|
497
|
+
const name = this.$$g_p(attribute.name);
|
|
498
|
+
if (!(name in this.$$d)) {
|
|
499
|
+
this.$$d[name] = get_custom_element_value(name, attribute.value, this.$$p_d, "toProp");
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
this.$$c = new this.$$ctor({
|
|
503
|
+
target: this.shadowRoot || this,
|
|
504
|
+
props: {
|
|
505
|
+
...this.$$d,
|
|
506
|
+
$$slots,
|
|
507
|
+
$$scope: {
|
|
508
|
+
ctx: []
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
});
|
|
512
|
+
const reflect_attributes = () => {
|
|
513
|
+
this.$$r = true;
|
|
514
|
+
for (const key in this.$$p_d) {
|
|
515
|
+
this.$$d[key] = this.$$c.$$.ctx[this.$$c.$$.props[key]];
|
|
516
|
+
if (this.$$p_d[key].reflect) {
|
|
517
|
+
const attribute_value = get_custom_element_value(
|
|
518
|
+
key,
|
|
519
|
+
this.$$d[key],
|
|
520
|
+
this.$$p_d,
|
|
521
|
+
"toAttribute"
|
|
522
|
+
);
|
|
523
|
+
if (attribute_value == null) {
|
|
524
|
+
this.removeAttribute(this.$$p_d[key].attribute || key);
|
|
525
|
+
} else {
|
|
526
|
+
this.setAttribute(this.$$p_d[key].attribute || key, attribute_value);
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
this.$$r = false;
|
|
531
|
+
};
|
|
532
|
+
this.$$c.$$.after_update.push(reflect_attributes);
|
|
533
|
+
reflect_attributes();
|
|
534
|
+
for (const type in this.$$l) {
|
|
535
|
+
for (const listener of this.$$l[type]) {
|
|
536
|
+
const unsub = this.$$c.$on(type, listener);
|
|
537
|
+
this.$$l_u.set(listener, unsub);
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
this.$$l = {};
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
// We don't need this when working within Svelte code, but for compatibility of people using this outside of Svelte
|
|
544
|
+
// and setting attributes through setAttribute etc, this is helpful
|
|
545
|
+
attributeChangedCallback(attr2, _oldValue, newValue) {
|
|
546
|
+
if (this.$$r)
|
|
547
|
+
return;
|
|
548
|
+
attr2 = this.$$g_p(attr2);
|
|
549
|
+
this.$$d[attr2] = get_custom_element_value(attr2, newValue, this.$$p_d, "toProp");
|
|
550
|
+
this.$$c?.$set({ [attr2]: this.$$d[attr2] });
|
|
551
|
+
}
|
|
552
|
+
disconnectedCallback() {
|
|
553
|
+
this.$$cn = false;
|
|
554
|
+
Promise.resolve().then(() => {
|
|
555
|
+
if (!this.$$cn) {
|
|
556
|
+
this.$$c.$destroy();
|
|
557
|
+
this.$$c = void 0;
|
|
558
|
+
}
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
$$g_p(attribute_name) {
|
|
562
|
+
return Object.keys(this.$$p_d).find(
|
|
563
|
+
(key) => this.$$p_d[key].attribute === attribute_name || !this.$$p_d[key].attribute && key.toLowerCase() === attribute_name
|
|
564
|
+
) || attribute_name;
|
|
565
|
+
}
|
|
566
|
+
};
|
|
567
|
+
}
|
|
568
|
+
function get_custom_element_value(prop, value, props_definition, transform) {
|
|
569
|
+
const type = props_definition[prop]?.type;
|
|
570
|
+
value = type === "Boolean" && typeof value !== "boolean" ? value != null : value;
|
|
571
|
+
if (!transform || !props_definition[prop]) {
|
|
572
|
+
return value;
|
|
573
|
+
} else if (transform === "toAttribute") {
|
|
574
|
+
switch (type) {
|
|
575
|
+
case "Object":
|
|
576
|
+
case "Array":
|
|
577
|
+
return value == null ? null : JSON.stringify(value);
|
|
578
|
+
case "Boolean":
|
|
579
|
+
return value ? "" : null;
|
|
580
|
+
case "Number":
|
|
581
|
+
return value == null ? null : value;
|
|
582
|
+
default:
|
|
583
|
+
return value;
|
|
584
|
+
}
|
|
585
|
+
} else {
|
|
586
|
+
switch (type) {
|
|
587
|
+
case "Object":
|
|
588
|
+
case "Array":
|
|
589
|
+
return value && JSON.parse(value);
|
|
590
|
+
case "Boolean":
|
|
591
|
+
return value;
|
|
592
|
+
case "Number":
|
|
593
|
+
return value != null ? +value : value;
|
|
594
|
+
default:
|
|
595
|
+
return value;
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
function create_custom_element(Component, props_definition, slots, accessors, use_shadow_dom, extend) {
|
|
600
|
+
let Class = class extends SvelteElement {
|
|
601
|
+
constructor() {
|
|
602
|
+
super(Component, slots, use_shadow_dom);
|
|
603
|
+
this.$$p_d = props_definition;
|
|
604
|
+
}
|
|
605
|
+
static get observedAttributes() {
|
|
606
|
+
return Object.keys(props_definition).map(
|
|
607
|
+
(key) => (props_definition[key].attribute || key).toLowerCase()
|
|
608
|
+
);
|
|
609
|
+
}
|
|
610
|
+
};
|
|
611
|
+
Object.keys(props_definition).forEach((prop) => {
|
|
612
|
+
Object.defineProperty(Class.prototype, prop, {
|
|
613
|
+
get() {
|
|
614
|
+
return this.$$c && prop in this.$$c ? this.$$c[prop] : this.$$d[prop];
|
|
615
|
+
},
|
|
616
|
+
set(value) {
|
|
617
|
+
value = get_custom_element_value(prop, value, props_definition);
|
|
618
|
+
this.$$d[prop] = value;
|
|
619
|
+
this.$$c?.$set({ [prop]: value });
|
|
620
|
+
}
|
|
621
|
+
});
|
|
622
|
+
});
|
|
623
|
+
accessors.forEach((accessor) => {
|
|
624
|
+
Object.defineProperty(Class.prototype, accessor, {
|
|
625
|
+
get() {
|
|
626
|
+
return this.$$c?.[accessor];
|
|
627
|
+
}
|
|
628
|
+
});
|
|
629
|
+
});
|
|
630
|
+
if (extend) {
|
|
631
|
+
Class = extend(Class);
|
|
632
|
+
}
|
|
633
|
+
Component.element = /** @type {any} */
|
|
634
|
+
Class;
|
|
635
|
+
return Class;
|
|
636
|
+
}
|
|
637
|
+
var SvelteComponent = class {
|
|
638
|
+
/**
|
|
639
|
+
* ### PRIVATE API
|
|
640
|
+
*
|
|
641
|
+
* Do not use, may change at any time
|
|
642
|
+
*
|
|
643
|
+
* @type {any}
|
|
644
|
+
*/
|
|
645
|
+
$$ = void 0;
|
|
646
|
+
/**
|
|
647
|
+
* ### PRIVATE API
|
|
648
|
+
*
|
|
649
|
+
* Do not use, may change at any time
|
|
650
|
+
*
|
|
651
|
+
* @type {any}
|
|
652
|
+
*/
|
|
653
|
+
$$set = void 0;
|
|
654
|
+
/** @returns {void} */
|
|
655
|
+
$destroy() {
|
|
656
|
+
destroy_component(this, 1);
|
|
657
|
+
this.$destroy = noop;
|
|
658
|
+
}
|
|
659
|
+
/**
|
|
660
|
+
* @template {Extract<keyof Events, string>} K
|
|
661
|
+
* @param {K} type
|
|
662
|
+
* @param {((e: Events[K]) => void) | null | undefined} callback
|
|
663
|
+
* @returns {() => void}
|
|
664
|
+
*/
|
|
665
|
+
$on(type, callback) {
|
|
666
|
+
if (!is_function(callback)) {
|
|
667
|
+
return noop;
|
|
668
|
+
}
|
|
669
|
+
const callbacks = this.$$.callbacks[type] || (this.$$.callbacks[type] = []);
|
|
670
|
+
callbacks.push(callback);
|
|
671
|
+
return () => {
|
|
672
|
+
const index = callbacks.indexOf(callback);
|
|
673
|
+
if (index !== -1)
|
|
674
|
+
callbacks.splice(index, 1);
|
|
675
|
+
};
|
|
676
|
+
}
|
|
677
|
+
/**
|
|
678
|
+
* @param {Partial<Props>} props
|
|
679
|
+
* @returns {void}
|
|
680
|
+
*/
|
|
681
|
+
$set(props) {
|
|
682
|
+
if (this.$$set && !is_empty(props)) {
|
|
683
|
+
this.$$.skip_bound = true;
|
|
684
|
+
this.$$set(props);
|
|
685
|
+
this.$$.skip_bound = false;
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
};
|
|
689
|
+
|
|
690
|
+
// node_modules/svelte/src/shared/version.js
|
|
691
|
+
var PUBLIC_VERSION = "4";
|
|
692
|
+
|
|
693
|
+
// node_modules/svelte/src/runtime/internal/disclose-version/index.js
|
|
694
|
+
if (typeof window !== "undefined")
|
|
695
|
+
(window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(PUBLIC_VERSION);
|
|
696
|
+
|
|
697
|
+
// src/lib/composables/useMCQ.ts
|
|
698
|
+
var useAlphabetEquivalent = (index) => {
|
|
699
|
+
const alphabetArr = [
|
|
700
|
+
"A",
|
|
701
|
+
"B",
|
|
702
|
+
"C",
|
|
703
|
+
"D",
|
|
704
|
+
"E",
|
|
705
|
+
"F",
|
|
706
|
+
"G",
|
|
707
|
+
"H",
|
|
708
|
+
"I",
|
|
709
|
+
"J",
|
|
710
|
+
"K",
|
|
711
|
+
"L",
|
|
712
|
+
"M",
|
|
713
|
+
"N",
|
|
714
|
+
"O",
|
|
715
|
+
"P",
|
|
716
|
+
"Q",
|
|
717
|
+
"R",
|
|
718
|
+
"S",
|
|
719
|
+
"T",
|
|
720
|
+
"U",
|
|
721
|
+
"V",
|
|
722
|
+
"W",
|
|
723
|
+
"X",
|
|
724
|
+
"Y",
|
|
725
|
+
"Z"
|
|
726
|
+
];
|
|
727
|
+
return alphabetArr[index];
|
|
728
|
+
};
|
|
729
|
+
var useMCQ_default = useAlphabetEquivalent;
|
|
730
|
+
|
|
731
|
+
// src/lib/components/prompt/mcq/PromptMCQ.svelte
|
|
732
|
+
function get_each_context(ctx, list, i) {
|
|
733
|
+
const child_ctx = ctx.slice();
|
|
734
|
+
child_ctx[8] = list[i].id;
|
|
735
|
+
child_ctx[9] = list[i].answer;
|
|
736
|
+
child_ctx[11] = i;
|
|
737
|
+
return child_ctx;
|
|
738
|
+
}
|
|
739
|
+
function create_if_block(ctx) {
|
|
740
|
+
let div2;
|
|
741
|
+
let p0;
|
|
742
|
+
let t1;
|
|
743
|
+
let p1;
|
|
744
|
+
let t3;
|
|
745
|
+
let div0;
|
|
746
|
+
let t4;
|
|
747
|
+
let div1;
|
|
748
|
+
let each_value = ensure_array_like(
|
|
749
|
+
/*options*/
|
|
750
|
+
ctx[4]
|
|
751
|
+
);
|
|
752
|
+
let each_blocks = [];
|
|
753
|
+
for (let i = 0; i < each_value.length; i += 1) {
|
|
754
|
+
each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i));
|
|
755
|
+
}
|
|
756
|
+
return {
|
|
757
|
+
c() {
|
|
758
|
+
div2 = element("div");
|
|
759
|
+
p0 = element("p");
|
|
760
|
+
p0.textContent = `${/*rubric*/
|
|
761
|
+
ctx[2].text}`;
|
|
762
|
+
t1 = space();
|
|
763
|
+
p1 = element("p");
|
|
764
|
+
p1.textContent = `${/*prompt*/
|
|
765
|
+
ctx[3]}`;
|
|
766
|
+
t3 = space();
|
|
767
|
+
div0 = element("div");
|
|
768
|
+
t4 = space();
|
|
769
|
+
div1 = element("div");
|
|
770
|
+
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
771
|
+
each_blocks[i].c();
|
|
772
|
+
}
|
|
773
|
+
attr(p0, "class", "h5 mb-2 md:mb-4");
|
|
774
|
+
attr(p1, "class", "h5 font-semibold");
|
|
775
|
+
attr(div0, "class", "divider my-6");
|
|
776
|
+
attr(div2, "class", "bg-transparent");
|
|
777
|
+
},
|
|
778
|
+
m(target, anchor) {
|
|
779
|
+
insert(target, div2, anchor);
|
|
780
|
+
append(div2, p0);
|
|
781
|
+
append(div2, t1);
|
|
782
|
+
append(div2, p1);
|
|
783
|
+
append(div2, t3);
|
|
784
|
+
append(div2, div0);
|
|
785
|
+
append(div2, t4);
|
|
786
|
+
append(div2, div1);
|
|
787
|
+
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
788
|
+
if (each_blocks[i]) {
|
|
789
|
+
each_blocks[i].m(div1, null);
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
},
|
|
793
|
+
p(ctx2, dirty) {
|
|
794
|
+
if (dirty & /*options, selectedOption, handleOptionClick*/
|
|
795
|
+
50) {
|
|
796
|
+
each_value = ensure_array_like(
|
|
797
|
+
/*options*/
|
|
798
|
+
ctx2[4]
|
|
799
|
+
);
|
|
800
|
+
let i;
|
|
801
|
+
for (i = 0; i < each_value.length; i += 1) {
|
|
802
|
+
const child_ctx = get_each_context(ctx2, each_value, i);
|
|
803
|
+
if (each_blocks[i]) {
|
|
804
|
+
each_blocks[i].p(child_ctx, dirty);
|
|
805
|
+
} else {
|
|
806
|
+
each_blocks[i] = create_each_block(child_ctx);
|
|
807
|
+
each_blocks[i].c();
|
|
808
|
+
each_blocks[i].m(div1, null);
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
for (; i < each_blocks.length; i += 1) {
|
|
812
|
+
each_blocks[i].d(1);
|
|
813
|
+
}
|
|
814
|
+
each_blocks.length = each_value.length;
|
|
815
|
+
}
|
|
816
|
+
},
|
|
817
|
+
d(detaching) {
|
|
818
|
+
if (detaching) {
|
|
819
|
+
detach(div2);
|
|
820
|
+
}
|
|
821
|
+
destroy_each(each_blocks, detaching);
|
|
822
|
+
}
|
|
823
|
+
};
|
|
824
|
+
}
|
|
825
|
+
function create_each_block(ctx) {
|
|
826
|
+
let button;
|
|
827
|
+
let span;
|
|
828
|
+
let t1;
|
|
829
|
+
let t2_value = (
|
|
830
|
+
/*answer*/
|
|
831
|
+
ctx[9] + ""
|
|
832
|
+
);
|
|
833
|
+
let t2;
|
|
834
|
+
let t3;
|
|
835
|
+
let button_aria_label_value;
|
|
836
|
+
let button_class_value;
|
|
837
|
+
let mounted;
|
|
838
|
+
let dispose;
|
|
839
|
+
function click_handler() {
|
|
840
|
+
return (
|
|
841
|
+
/*click_handler*/
|
|
842
|
+
ctx[6](
|
|
843
|
+
/*id*/
|
|
844
|
+
ctx[8]
|
|
845
|
+
)
|
|
846
|
+
);
|
|
847
|
+
}
|
|
848
|
+
return {
|
|
849
|
+
c() {
|
|
850
|
+
button = element("button");
|
|
851
|
+
span = element("span");
|
|
852
|
+
span.textContent = `${useMCQ_default(
|
|
853
|
+
/*index*/
|
|
854
|
+
ctx[11]
|
|
855
|
+
)}`;
|
|
856
|
+
t1 = space();
|
|
857
|
+
t2 = text(t2_value);
|
|
858
|
+
t3 = space();
|
|
859
|
+
attr(span, "class", "choice group-active:border-2 group-active:border-blue-1000 group-active:p-[7px]");
|
|
860
|
+
attr(button, "aria-label", button_aria_label_value = `Option ${useMCQ_default(
|
|
861
|
+
/*index*/
|
|
862
|
+
ctx[11]
|
|
863
|
+
)}: ${/*answer*/
|
|
864
|
+
ctx[9]}`);
|
|
865
|
+
attr(button, "class", button_class_value = "btn-mcq-option group " + /*selectedOption*/
|
|
866
|
+
(ctx[1] === /*id*/
|
|
867
|
+
ctx[8] ? "selected" : ""));
|
|
868
|
+
},
|
|
869
|
+
m(target, anchor) {
|
|
870
|
+
insert(target, button, anchor);
|
|
871
|
+
append(button, span);
|
|
872
|
+
append(button, t1);
|
|
873
|
+
append(button, t2);
|
|
874
|
+
append(button, t3);
|
|
875
|
+
if (!mounted) {
|
|
876
|
+
dispose = listen(button, "click", click_handler);
|
|
877
|
+
mounted = true;
|
|
878
|
+
}
|
|
879
|
+
},
|
|
880
|
+
p(new_ctx, dirty) {
|
|
881
|
+
ctx = new_ctx;
|
|
882
|
+
if (dirty & /*selectedOption*/
|
|
883
|
+
2 && button_class_value !== (button_class_value = "btn-mcq-option group " + /*selectedOption*/
|
|
884
|
+
(ctx[1] === /*id*/
|
|
885
|
+
ctx[8] ? "selected" : ""))) {
|
|
886
|
+
attr(button, "class", button_class_value);
|
|
887
|
+
}
|
|
888
|
+
},
|
|
889
|
+
d(detaching) {
|
|
890
|
+
if (detaching) {
|
|
891
|
+
detach(button);
|
|
892
|
+
}
|
|
893
|
+
mounted = false;
|
|
894
|
+
dispose();
|
|
895
|
+
}
|
|
896
|
+
};
|
|
897
|
+
}
|
|
898
|
+
function create_fragment(ctx) {
|
|
899
|
+
let if_block_anchor;
|
|
900
|
+
let if_block = (
|
|
901
|
+
/*promptData*/
|
|
902
|
+
ctx[0] && create_if_block(ctx)
|
|
903
|
+
);
|
|
904
|
+
return {
|
|
905
|
+
c() {
|
|
906
|
+
if (if_block)
|
|
907
|
+
if_block.c();
|
|
908
|
+
if_block_anchor = empty();
|
|
909
|
+
},
|
|
910
|
+
m(target, anchor) {
|
|
911
|
+
if (if_block)
|
|
912
|
+
if_block.m(target, anchor);
|
|
913
|
+
insert(target, if_block_anchor, anchor);
|
|
914
|
+
},
|
|
915
|
+
p(ctx2, [dirty]) {
|
|
916
|
+
if (
|
|
917
|
+
/*promptData*/
|
|
918
|
+
ctx2[0]
|
|
919
|
+
) {
|
|
920
|
+
if (if_block) {
|
|
921
|
+
if_block.p(ctx2, dirty);
|
|
922
|
+
} else {
|
|
923
|
+
if_block = create_if_block(ctx2);
|
|
924
|
+
if_block.c();
|
|
925
|
+
if_block.m(if_block_anchor.parentNode, if_block_anchor);
|
|
926
|
+
}
|
|
927
|
+
} else if (if_block) {
|
|
928
|
+
if_block.d(1);
|
|
929
|
+
if_block = null;
|
|
930
|
+
}
|
|
931
|
+
},
|
|
932
|
+
i: noop,
|
|
933
|
+
o: noop,
|
|
934
|
+
d(detaching) {
|
|
935
|
+
if (detaching) {
|
|
936
|
+
detach(if_block_anchor);
|
|
937
|
+
}
|
|
938
|
+
if (if_block)
|
|
939
|
+
if_block.d(detaching);
|
|
940
|
+
}
|
|
941
|
+
};
|
|
942
|
+
}
|
|
943
|
+
function instance($$self, $$props, $$invalidate) {
|
|
944
|
+
let { promptData } = $$props;
|
|
945
|
+
const { rubric, interaction } = promptData;
|
|
946
|
+
const { prompt, options } = interaction;
|
|
947
|
+
let selectedOption;
|
|
948
|
+
const handleOptionClick = (option) => {
|
|
949
|
+
$$invalidate(1, selectedOption = option);
|
|
950
|
+
};
|
|
951
|
+
const click_handler = (id) => handleOptionClick(id);
|
|
952
|
+
$$self.$$set = ($$props2) => {
|
|
953
|
+
if ("promptData" in $$props2)
|
|
954
|
+
$$invalidate(0, promptData = $$props2.promptData);
|
|
955
|
+
};
|
|
956
|
+
return [
|
|
957
|
+
promptData,
|
|
958
|
+
selectedOption,
|
|
959
|
+
rubric,
|
|
960
|
+
prompt,
|
|
961
|
+
options,
|
|
962
|
+
handleOptionClick,
|
|
963
|
+
click_handler
|
|
964
|
+
];
|
|
965
|
+
}
|
|
966
|
+
var PromptMCQ = class extends SvelteComponent {
|
|
967
|
+
constructor(options) {
|
|
968
|
+
super();
|
|
969
|
+
init(this, options, instance, create_fragment, safe_not_equal, { promptData: 0 });
|
|
970
|
+
}
|
|
971
|
+
get promptData() {
|
|
972
|
+
return this.$$.ctx[0];
|
|
973
|
+
}
|
|
974
|
+
set promptData(promptData) {
|
|
975
|
+
this.$$set({ promptData });
|
|
976
|
+
flush();
|
|
977
|
+
}
|
|
978
|
+
};
|
|
979
|
+
customElements.define("prompt-mcq", create_custom_element(PromptMCQ, { "promptData": {} }, [], [], true));
|
|
980
|
+
var PromptMCQ_default = PromptMCQ;
|
|
981
|
+
|
|
982
|
+
// src/lib/components/prompt/PromptBuilder.svelte
|
|
983
|
+
function add_css(target) {
|
|
984
|
+
append_styles(target, "svelte-hlbios", '*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}html{-webkit-text-size-adjust:100%;font-feature-settings:normal;font-family:Mulish, sans-serif;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]{display:none}*{font-family:Mulish, sans-serif}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.h5{--tw-text-opacity:1;color:rgb(8 38 99/var(--tw-text-opacity));font-size:1.25rem;letter-spacing:-0.025em;line-height:1.5rem}.divider{--tw-border-opacity:1;border-bottom-width:1px;border-color:rgb(218 224 224/var(--tw-border-opacity))}.btn-mcq-option:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);--tw-ring-opacity:1;--tw-ring-color:rgb(251 217 27/var(--tw-ring-opacity));--tw-ring-offset-width:4px;box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 rgba(0, 0, 0, 0));outline:2px solid transparent;outline-offset:2px;transition-duration:50ms}.btn-mcq-option{--tw-text-opacity:1;--tw-border-opacity:1;--tw-bg-opacity:1;align-items:center;background-color:rgb(247 250 250/var(--tw-bg-opacity));border-color:rgb(218 224 224/var(--tw-border-opacity));border-radius:0.5rem;border-width:1px;color:rgb(33 37 41/var(--tw-text-opacity));display:flex;font-size:1rem;line-height:1.5rem;margin-bottom:1rem;max-height:48px;padding:0.5rem 0.75rem 0.5rem 0.5rem;width:100%}.btn-mcq-option:active{--tw-border-opacity:1;--tw-bg-opacity:1;background-color:rgb(222 222 255/var(--tw-bg-opacity));border-color:rgb(8 38 99/var(--tw-border-opacity));border-width:2px}@media(hover: hover) and (pointer: fine){.btn-mcq-option:hover{--tw-bg-opacity:1;background-color:rgb(222 222 255/var(--tw-bg-opacity))}}.btn-mcq-option>.choice{--tw-border-opacity:1;--tw-bg-opacity:1;--tw-text-opacity:1;align-items:center;background-color:rgb(255 255 255/var(--tw-bg-opacity));border-color:rgb(218 224 224/var(--tw-border-opacity));border-radius:1rem;border-width:1px;color:rgb(93 99 107/var(--tw-text-opacity));display:flex;font-size:1rem;font-weight:700;height:2rem;justify-content:center;letter-spacing:0.05em;line-height:1rem;margin-right:1rem;padding:0.5rem;width:2rem}.btn-mcq-option.selected{--tw-border-opacity:1;--tw-bg-opacity:1;background-color:rgb(222 222 255/var(--tw-bg-opacity))}.btn-mcq-option.selected,.btn-mcq-option.selected>.choice{border-color:rgb(8 38 99/var(--tw-border-opacity));border-width:2px}.btn-mcq-option.selected>.choice{--tw-border-opacity:1}.my-6{margin-bottom:1.5rem;margin-top:1.5rem}.mb-2{margin-bottom:0.5rem}.bg-transparent{background-color:transparent}.font-semibold{font-weight:600}.group:active .group-active\\:border-2{border-width:2px}.group:active .group-active\\:border-blue-1000{--tw-border-opacity:1;border-color:rgb(8 38 99/var(--tw-border-opacity))}.group:active .group-active\\:p-\\[7px\\]{padding:7px}@media(min-width: 732px){.md\\:mb-4{margin-bottom:1rem}}');
|
|
985
|
+
}
|
|
986
|
+
function create_fragment2(ctx) {
|
|
987
|
+
let promptmcq;
|
|
988
|
+
let current;
|
|
989
|
+
promptmcq = new PromptMCQ_default({
|
|
990
|
+
props: { promptData: (
|
|
991
|
+
/*promptData*/
|
|
992
|
+
ctx[0]
|
|
993
|
+
) }
|
|
994
|
+
});
|
|
995
|
+
return {
|
|
996
|
+
c() {
|
|
997
|
+
create_component(promptmcq.$$.fragment);
|
|
998
|
+
},
|
|
999
|
+
m(target, anchor) {
|
|
1000
|
+
mount_component(promptmcq, target, anchor);
|
|
1001
|
+
current = true;
|
|
1002
|
+
},
|
|
1003
|
+
p(ctx2, [dirty]) {
|
|
1004
|
+
const promptmcq_changes = {};
|
|
1005
|
+
if (dirty & /*promptData*/
|
|
1006
|
+
1)
|
|
1007
|
+
promptmcq_changes.promptData = /*promptData*/
|
|
1008
|
+
ctx2[0];
|
|
1009
|
+
promptmcq.$set(promptmcq_changes);
|
|
1010
|
+
},
|
|
1011
|
+
i(local) {
|
|
1012
|
+
if (current)
|
|
1013
|
+
return;
|
|
1014
|
+
transition_in(promptmcq.$$.fragment, local);
|
|
1015
|
+
current = true;
|
|
1016
|
+
},
|
|
1017
|
+
o(local) {
|
|
1018
|
+
transition_out(promptmcq.$$.fragment, local);
|
|
1019
|
+
current = false;
|
|
1020
|
+
},
|
|
1021
|
+
d(detaching) {
|
|
1022
|
+
destroy_component(promptmcq, detaching);
|
|
1023
|
+
}
|
|
1024
|
+
};
|
|
1025
|
+
}
|
|
1026
|
+
function instance2($$self, $$props, $$invalidate) {
|
|
1027
|
+
let promptData;
|
|
1028
|
+
promptData = {
|
|
1029
|
+
id: "1o8Y8EU924llb7WoDf1hGq",
|
|
1030
|
+
title: "Contentful Item 1",
|
|
1031
|
+
stimulus: {
|
|
1032
|
+
id: "7F6ErzqqHaFIsK6Pskf2eT",
|
|
1033
|
+
text: "Visual depiction of 1 + 1",
|
|
1034
|
+
media: { id: "7bmwhzN1eB4M75Rrsdc0fu" }
|
|
1035
|
+
},
|
|
1036
|
+
rubric: {
|
|
1037
|
+
id: "4UU4qp6yrns0cX4Y3x40Di",
|
|
1038
|
+
text: "Translate the Latin word"
|
|
1039
|
+
},
|
|
1040
|
+
interaction: {
|
|
1041
|
+
id: "6LzMOGT2Xof94mNwT4FLLP",
|
|
1042
|
+
type: "Multiple Choice",
|
|
1043
|
+
prompt: "f\u0101bula (noun)",
|
|
1044
|
+
options: [
|
|
1045
|
+
{
|
|
1046
|
+
id: "4SA8hlp5rAcUSYSJlAKBRI",
|
|
1047
|
+
answer: "play, story"
|
|
1048
|
+
},
|
|
1049
|
+
{
|
|
1050
|
+
id: "jnbcqJEUvNGc45VQ9lP71",
|
|
1051
|
+
answer: "noise, shouting"
|
|
1052
|
+
},
|
|
1053
|
+
{
|
|
1054
|
+
id: "jnbcqJEUvNGc45VQ9l111",
|
|
1055
|
+
answer: "young person"
|
|
1056
|
+
}
|
|
1057
|
+
]
|
|
1058
|
+
}
|
|
1059
|
+
};
|
|
1060
|
+
return [promptData];
|
|
1061
|
+
}
|
|
1062
|
+
var PromptBuilder = class extends SvelteComponent {
|
|
1063
|
+
constructor(options) {
|
|
1064
|
+
super();
|
|
1065
|
+
init(this, options, instance2, create_fragment2, safe_not_equal, {}, add_css);
|
|
1066
|
+
}
|
|
1067
|
+
};
|
|
1068
|
+
customElements.define("prompt-builder", create_custom_element(PromptBuilder, {}, [], [], true));
|
|
1069
|
+
var PromptBuilder_default = PromptBuilder;
|
|
1070
|
+
})();
|
package/package.json
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "eat-js-sdk",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Authoring tool frontend SDK",
|
|
5
|
+
"contributors": [
|
|
6
|
+
{
|
|
7
|
+
"name": "Earl Anthony Bequillo",
|
|
8
|
+
"email": "earl.bequillo@cambridge.org"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"name": "Joven Ferdinand Miclat",
|
|
12
|
+
"email": "joven.miclat@cambridge.org"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"name": "Ramer Mellizas",
|
|
16
|
+
"email": "ramer.mellizas@cambridge.org"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"name": "Carl Lewi Godoy",
|
|
20
|
+
"email": "carl.godoy@cambridge.org"
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
"scripts": {
|
|
24
|
+
"dev": "vite dev",
|
|
25
|
+
"build": "npm run build:css && node esbuild-bundle.js",
|
|
26
|
+
"preview": "vite preview",
|
|
27
|
+
"package": "svelte-kit sync && svelte-package && publint",
|
|
28
|
+
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
29
|
+
"prepublishOnly": "npm run build",
|
|
30
|
+
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
|
31
|
+
"lint": "prettier --check . && eslint .",
|
|
32
|
+
"format": "prettier --write .",
|
|
33
|
+
"build:css": "postcss src/assets/css/tailwind.css -o src/assets/css/main.scss"
|
|
34
|
+
},
|
|
35
|
+
"files": [
|
|
36
|
+
"README.md",
|
|
37
|
+
"package.json",
|
|
38
|
+
"./dist/**/*"
|
|
39
|
+
],
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"svelte": "^4.0.0"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@sveltejs/adapter-auto": "^2.0.0",
|
|
45
|
+
"@sveltejs/kit": "^1.27.4",
|
|
46
|
+
"@sveltejs/package": "^2.0.0",
|
|
47
|
+
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
|
48
|
+
"@typescript-eslint/parser": "^6.0.0",
|
|
49
|
+
"autoprefixer": "^10.4.14",
|
|
50
|
+
"cssnano": "^6.0.1",
|
|
51
|
+
"esbuild": "^0.19.7",
|
|
52
|
+
"esbuild-svelte": "^0.8.0",
|
|
53
|
+
"eslint": "^8.28.0",
|
|
54
|
+
"eslint-config-prettier": "^9.0.0",
|
|
55
|
+
"eslint-plugin-svelte": "^2.30.0",
|
|
56
|
+
"postcss": "^8.4.31",
|
|
57
|
+
"postcss-cli": "^10.1.0",
|
|
58
|
+
"postcss-load-config": "^4.0.1",
|
|
59
|
+
"prettier": "^3.0.0",
|
|
60
|
+
"prettier-plugin-tailwindcss": "^0.4.1",
|
|
61
|
+
"publint": "^0.1.9",
|
|
62
|
+
"sass": "^1.69.5",
|
|
63
|
+
"svelte": "^4.2.7",
|
|
64
|
+
"svelte-check": "^3.6.0",
|
|
65
|
+
"tailwindcss": "^3.3.2",
|
|
66
|
+
"tslib": "^2.4.1",
|
|
67
|
+
"typescript": "^5.0.0",
|
|
68
|
+
"vite": "^4.4.2"
|
|
69
|
+
},
|
|
70
|
+
"type": "module"
|
|
71
|
+
}
|