@webwriter/quiz 1.0.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/LICENSE +7 -0
- package/custom.d.ts +176 -0
- package/dist/widgets/webwriter-choice-item.css +444 -0
- package/dist/widgets/webwriter-choice-item.js +288 -0
- package/dist/widgets/webwriter-choice.css +444 -0
- package/dist/widgets/webwriter-choice.js +327 -0
- package/dist/widgets/webwriter-cloze-gap.css +444 -0
- package/dist/widgets/webwriter-cloze-gap.js +722 -0
- package/dist/widgets/webwriter-cloze.css +444 -0
- package/dist/widgets/webwriter-cloze.js +177 -0
- package/dist/widgets/webwriter-mark.css +444 -0
- package/dist/widgets/webwriter-mark.js +410 -0
- package/dist/widgets/webwriter-order-item.css +444 -0
- package/dist/widgets/webwriter-order-item.js +464 -0
- package/dist/widgets/webwriter-order.css +444 -0
- package/dist/widgets/webwriter-order.js +560 -0
- package/dist/widgets/webwriter-pairing-item.css +444 -0
- package/dist/widgets/webwriter-pairing-item.js +203 -0
- package/dist/widgets/webwriter-pairing.css +444 -0
- package/dist/widgets/webwriter-pairing.js +224 -0
- package/dist/widgets/webwriter-quiz.css +444 -0
- package/dist/widgets/webwriter-quiz.js +323 -0
- package/dist/widgets/webwriter-speech.css +444 -0
- package/dist/widgets/webwriter-speech.js +320 -0
- package/dist/widgets/webwriter-task-explainer.css +444 -0
- package/dist/widgets/webwriter-task-explainer.js +90 -0
- package/dist/widgets/webwriter-task-hint.css +444 -0
- package/dist/widgets/webwriter-task-hint.js +67 -0
- package/dist/widgets/webwriter-task-prompt.css +444 -0
- package/dist/widgets/webwriter-task-prompt.js +68 -0
- package/dist/widgets/webwriter-task.css +444 -0
- package/dist/widgets/webwriter-task.js +546 -0
- package/dist/widgets/webwriter-text.css +444 -0
- package/dist/widgets/webwriter-text.js +174 -0
- package/package.json +199 -0
- package/src/lib/combobox.ts +456 -0
- package/src/lib/highlighter-fill.svg +6 -0
- package/src/snippets/choice.html +8 -0
- package/src/snippets/cloze.html +4 -0
- package/src/snippets/mark.html +4 -0
- package/src/snippets/order.html +8 -0
- package/src/snippets/pairing.html +10 -0
- package/src/snippets/speech.html +4 -0
- package/src/snippets/text.html +4 -0
- package/src/snippets/wordsearch.html +4 -0
- package/src/widgets/webwriter-choice-item.ts +251 -0
- package/src/widgets/webwriter-choice.ts +310 -0
- package/src/widgets/webwriter-cloze-gap.ts +217 -0
- package/src/widgets/webwriter-cloze.ts +136 -0
- package/src/widgets/webwriter-mark.ts +435 -0
- package/src/widgets/webwriter-order-item.ts +445 -0
- package/src/widgets/webwriter-order.ts +273 -0
- package/src/widgets/webwriter-pairing-item.ts +156 -0
- package/src/widgets/webwriter-pairing.ts +188 -0
- package/src/widgets/webwriter-quiz.ts +281 -0
- package/src/widgets/webwriter-speech.ts +268 -0
- package/src/widgets/webwriter-task-explainer.ts +38 -0
- package/src/widgets/webwriter-task-hint.ts +17 -0
- package/src/widgets/webwriter-task-prompt.ts +18 -0
- package/src/widgets/webwriter-task.ts +544 -0
- package/src/widgets/webwriter-text.ts +131 -0
- package/tsconfig.json +7 -0
|
@@ -0,0 +1,722 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
|
|
5
|
+
var __typeError = (msg) => {
|
|
6
|
+
throw TypeError(msg);
|
|
7
|
+
};
|
|
8
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
10
|
+
var __decoratorStart = (base) => [, , , __create(base?.[__knownSymbol("metadata")] ?? null)];
|
|
11
|
+
var __decoratorStrings = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
|
|
12
|
+
var __expectFn = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError("Function expected") : fn;
|
|
13
|
+
var __decoratorContext = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError("Already initialized") : fns.push(__expectFn(fn || null)) });
|
|
14
|
+
var __decoratorMetadata = (array, target) => __defNormalProp(target, __knownSymbol("metadata"), array[3]);
|
|
15
|
+
var __runInitializers = (array, flags, self, value) => {
|
|
16
|
+
for (var i = 0, fns = array[flags >> 1], n = fns && fns.length; i < n; i++) flags & 1 ? fns[i].call(self) : value = fns[i].call(self, value);
|
|
17
|
+
return value;
|
|
18
|
+
};
|
|
19
|
+
var __decorateElement = (array, flags, name, decorators, target, extra) => {
|
|
20
|
+
var fn, it, done, ctx, access, k = flags & 7, s = !!(flags & 8), p = !!(flags & 16);
|
|
21
|
+
var j = k > 3 ? array.length + 1 : k ? s ? 1 : 2 : 0, key = __decoratorStrings[k + 5];
|
|
22
|
+
var initializers = k > 3 && (array[j - 1] = []), extraInitializers = array[j] || (array[j] = []);
|
|
23
|
+
var desc = k && (!p && !s && (target = target.prototype), k < 5 && (k > 3 || !p) && __getOwnPropDesc(k < 4 ? target : { get [name]() {
|
|
24
|
+
return __privateGet(this, extra);
|
|
25
|
+
}, set [name](x) {
|
|
26
|
+
return __privateSet(this, extra, x);
|
|
27
|
+
} }, name));
|
|
28
|
+
k ? p && k < 4 && __name(extra, (k > 2 ? "set " : k > 1 ? "get " : "") + name) : __name(target, name);
|
|
29
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
30
|
+
ctx = __decoratorContext(k, name, done = {}, array[3], extraInitializers);
|
|
31
|
+
if (k) {
|
|
32
|
+
ctx.static = s, ctx.private = p, access = ctx.access = { has: p ? (x) => __privateIn(target, x) : (x) => name in x };
|
|
33
|
+
if (k ^ 3) access.get = p ? (x) => (k ^ 1 ? __privateGet : __privateMethod)(x, target, k ^ 4 ? extra : desc.get) : (x) => x[name];
|
|
34
|
+
if (k > 2) access.set = p ? (x, y) => __privateSet(x, target, y, k ^ 4 ? extra : desc.set) : (x, y) => x[name] = y;
|
|
35
|
+
}
|
|
36
|
+
it = (0, decorators[i])(k ? k < 4 ? p ? extra : desc[key] : k > 4 ? void 0 : { get: desc.get, set: desc.set } : target, ctx), done._ = 1;
|
|
37
|
+
if (k ^ 4 || it === void 0) __expectFn(it) && (k > 4 ? initializers.unshift(it) : k ? p ? extra = it : desc[key] = it : target = it);
|
|
38
|
+
else if (typeof it !== "object" || it === null) __typeError("Object expected");
|
|
39
|
+
else __expectFn(fn = it.get) && (desc.get = fn), __expectFn(fn = it.set) && (desc.set = fn), __expectFn(fn = it.init) && initializers.unshift(fn);
|
|
40
|
+
}
|
|
41
|
+
return k || __decoratorMetadata(array, target), desc && __defProp(target, name, desc), p ? k ^ 4 ? extra : desc : target;
|
|
42
|
+
};
|
|
43
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
44
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
45
|
+
var __privateIn = (member, obj) => Object(obj) !== obj ? __typeError('Cannot use the "in" operator on this value') : member.has(obj);
|
|
46
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
47
|
+
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
48
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
49
|
+
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
50
|
+
|
|
51
|
+
// src/widgets/webwriter-cloze-gap.ts
|
|
52
|
+
import { html as html2, css as css2 } from "lit";
|
|
53
|
+
import { LitElementWw } from "@webwriter/lit";
|
|
54
|
+
import { customElement as customElement2, query as query2 } from "lit/decorators.js";
|
|
55
|
+
import SlIconButton from "@shoelace-style/shoelace/dist/components/icon-button/icon-button.component.js";
|
|
56
|
+
import SlOption from "@shoelace-style/shoelace/dist/components/option/option.component.js";
|
|
57
|
+
|
|
58
|
+
// ../../node_modules/bootstrap-icons/icons/plus.svg
|
|
59
|
+
var plus_default = 'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-plus" viewBox="0 0 16 16">%0A <path d="M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4"/>%0A</svg>';
|
|
60
|
+
|
|
61
|
+
// ../../node_modules/bootstrap-icons/icons/slash-circle.svg
|
|
62
|
+
var slash_circle_default = 'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-slash-circle" viewBox="0 0 16 16">%0A <path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16"/>%0A <path d="M11.354 4.646a.5.5 0 0 0-.708 0l-6 6a.5.5 0 0 0 .708.708l6-6a.5.5 0 0 0 0-.708"/>%0A</svg>';
|
|
63
|
+
|
|
64
|
+
// ../../node_modules/bootstrap-icons/icons/check-circle.svg
|
|
65
|
+
var check_circle_default = 'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-check-circle" viewBox="0 0 16 16">%0A <path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16"/>%0A <path d="m10.97 4.97-.02.022-3.473 4.425-2.093-2.094a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-1.071-1.05"/>%0A</svg>';
|
|
66
|
+
|
|
67
|
+
// ../../node_modules/bootstrap-icons/icons/x.svg
|
|
68
|
+
var x_default = 'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-x" viewBox="0 0 16 16">%0A <path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708"/>%0A</svg>';
|
|
69
|
+
|
|
70
|
+
// src/lib/combobox.ts
|
|
71
|
+
import { LitElement, html, css } from "lit";
|
|
72
|
+
import { customElement, property, query, queryAssignedElements } from "lit/decorators.js";
|
|
73
|
+
import SlInput from "@shoelace-style/shoelace/dist/components/input/input.component.js";
|
|
74
|
+
|
|
75
|
+
// ../../node_modules/bootstrap-icons/icons/chevron-down.svg
|
|
76
|
+
var chevron_down_default = 'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-chevron-down" viewBox="0 0 16 16">%0A <path fill-rule="evenodd" d="M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708"/>%0A</svg>';
|
|
77
|
+
|
|
78
|
+
// src/lib/combobox.ts
|
|
79
|
+
import { ifDefined } from "lit/directives/if-defined.js";
|
|
80
|
+
import { styleMap } from "lit/directives/style-map.js";
|
|
81
|
+
var _inputEl_dec, _hideEl_dec, _label_dec, _type_dec, _required_dec, _disabled_dec, _autosize_dec, _placement_dec, _separator_dec, _fixLength_dec, _helpText_dec, _suggestions_dec, _open_dec, _emptyValue_dec, _placeholder_dec, _multiple_dec, _inputDisabled_dec, _active_dec, _autocomplete_dec, _optionElements_dec, _slotElement_dec, _toggleButton_dec, _input_dec, _defaultValue_dec, _value_dec, _a, _Combobox_decorators, _init, _value, _defaultValue, _input, _toggleButton, _slotElement, _optionElements, _autocomplete, _active, _inputDisabled, _multiple, _placeholder, _emptyValue, _open, _suggestions, _helpText, _fixLength, _separator, _placement, _autosize, _disabled, _required, _type, _label, _hideEl, _inputEl;
|
|
82
|
+
_Combobox_decorators = [customElement("ww-combobox")];
|
|
83
|
+
var Combobox = class extends (_a = LitElement, _value_dec = [property({ attribute: false })], _defaultValue_dec = [property({ attribute: false })], _input_dec = [query("input")], _toggleButton_dec = [query("#toggle")], _slotElement_dec = [query("slot:not([name])")], _optionElements_dec = [queryAssignedElements()], _autocomplete_dec = [property({ type: String, attribute: true })], _active_dec = [property({ type: Boolean, attribute: true, reflect: true })], _inputDisabled_dec = [property({ type: Boolean, attribute: true, reflect: true })], _multiple_dec = [property({ type: Boolean, attribute: true, reflect: true })], _placeholder_dec = [property({ type: String })], _emptyValue_dec = [property({ type: String, attribute: true, reflect: true })], _open_dec = [property({ type: Boolean, attribute: true, reflect: true })], _suggestions_dec = [property({ type: Boolean, attribute: true, reflect: true })], _helpText_dec = [property({ type: String, attribute: "help-text" })], _fixLength_dec = [property({ type: Number, attribute: true })], _separator_dec = [property({ type: String, attribute: true })], _placement_dec = [property({ type: String, attribute: true })], _autosize_dec = [property({ type: Boolean, attribute: true, reflect: true })], _disabled_dec = [property({ type: Boolean, attribute: true, reflect: true })], _required_dec = [property({ type: Boolean, attribute: true, reflect: true })], _type_dec = [property({ type: String, attribute: true, reflect: true })], _label_dec = [property({ type: String, attribute: true, reflect: true })], _hideEl_dec = [query("#hide")], _inputEl_dec = [query("input")], _a) {
|
|
84
|
+
constructor() {
|
|
85
|
+
super();
|
|
86
|
+
__publicField(this, "tabIndex", 0);
|
|
87
|
+
//@ts-ignore
|
|
88
|
+
__privateAdd(this, _value, __runInitializers(_init, 8, this)), __runInitializers(_init, 11, this);
|
|
89
|
+
//@ts-ignore
|
|
90
|
+
__privateAdd(this, _defaultValue, __runInitializers(_init, 12, this)), __runInitializers(_init, 15, this);
|
|
91
|
+
//@ts-ignore
|
|
92
|
+
__privateAdd(this, _input, __runInitializers(_init, 16, this)), __runInitializers(_init, 19, this);
|
|
93
|
+
__privateAdd(this, _toggleButton, __runInitializers(_init, 20, this)), __runInitializers(_init, 23, this);
|
|
94
|
+
__privateAdd(this, _slotElement, __runInitializers(_init, 24, this)), __runInitializers(_init, 27, this);
|
|
95
|
+
__privateAdd(this, _optionElements, __runInitializers(_init, 28, this)), __runInitializers(_init, 31, this);
|
|
96
|
+
//@ts-ignore
|
|
97
|
+
__privateAdd(this, _autocomplete, __runInitializers(_init, 32, this, "off")), __runInitializers(_init, 35, this);
|
|
98
|
+
__privateAdd(this, _active, __runInitializers(_init, 36, this)), __runInitializers(_init, 39, this);
|
|
99
|
+
__privateAdd(this, _inputDisabled, __runInitializers(_init, 40, this, false)), __runInitializers(_init, 43, this);
|
|
100
|
+
__privateAdd(this, _multiple, __runInitializers(_init, 44, this, false)), __runInitializers(_init, 47, this);
|
|
101
|
+
//@ts-ignore
|
|
102
|
+
__privateAdd(this, _placeholder, __runInitializers(_init, 48, this)), __runInitializers(_init, 51, this);
|
|
103
|
+
__privateAdd(this, _emptyValue, __runInitializers(_init, 52, this)), __runInitializers(_init, 55, this);
|
|
104
|
+
__privateAdd(this, _open, __runInitializers(_init, 56, this, false)), __runInitializers(_init, 59, this);
|
|
105
|
+
__privateAdd(this, _suggestions, __runInitializers(_init, 60, this, false)), __runInitializers(_init, 63, this);
|
|
106
|
+
//@ts-ignore
|
|
107
|
+
__privateAdd(this, _helpText, __runInitializers(_init, 64, this)), __runInitializers(_init, 67, this);
|
|
108
|
+
__privateAdd(this, _fixLength, __runInitializers(_init, 68, this)), __runInitializers(_init, 71, this);
|
|
109
|
+
__privateAdd(this, _separator, __runInitializers(_init, 72, this, " ")), __runInitializers(_init, 75, this);
|
|
110
|
+
__privateAdd(this, _placement, __runInitializers(_init, 76, this, "bottom")), __runInitializers(_init, 79, this);
|
|
111
|
+
__privateAdd(this, _autosize, __runInitializers(_init, 80, this, false)), __runInitializers(_init, 83, this);
|
|
112
|
+
__privateAdd(this, _disabled, __runInitializers(_init, 84, this, false)), __runInitializers(_init, 87, this);
|
|
113
|
+
__privateAdd(this, _required, __runInitializers(_init, 88, this, false)), __runInitializers(_init, 91, this);
|
|
114
|
+
__privateAdd(this, _type, __runInitializers(_init, 92, this)), __runInitializers(_init, 95, this);
|
|
115
|
+
__privateAdd(this, _label, __runInitializers(_init, 96, this)), __runInitializers(_init, 99, this);
|
|
116
|
+
__publicField(this, "handleOptionClick", (e) => {
|
|
117
|
+
const option = e.target.closest("sl-option");
|
|
118
|
+
if (option) {
|
|
119
|
+
this.value = option.value;
|
|
120
|
+
this.focus();
|
|
121
|
+
this.open = false;
|
|
122
|
+
this.dispatchChange();
|
|
123
|
+
this.requestUpdate();
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
__privateAdd(this, _hideEl, __runInitializers(_init, 100, this)), __runInitializers(_init, 103, this);
|
|
127
|
+
__privateAdd(this, _inputEl, __runInitializers(_init, 104, this)), __runInitializers(_init, 107, this);
|
|
128
|
+
this.addEventListener("focus", (e) => {
|
|
129
|
+
this.active = true;
|
|
130
|
+
this.open = true;
|
|
131
|
+
});
|
|
132
|
+
this.addEventListener("focusout", (e) => {
|
|
133
|
+
this.active = this.open = false;
|
|
134
|
+
});
|
|
135
|
+
this.addEventListener("blur", (e) => {
|
|
136
|
+
this.active = this.open = false;
|
|
137
|
+
});
|
|
138
|
+
this.value = this.defaultValue = this.multiple ? [] : "";
|
|
139
|
+
}
|
|
140
|
+
get validity() {
|
|
141
|
+
return this.input.validity;
|
|
142
|
+
}
|
|
143
|
+
get validationMessage() {
|
|
144
|
+
return this.input.validationMessage;
|
|
145
|
+
}
|
|
146
|
+
setValidity(isValid) {
|
|
147
|
+
const host = this;
|
|
148
|
+
const required = Boolean(this.required);
|
|
149
|
+
host.toggleAttribute("data-required", required);
|
|
150
|
+
host.toggleAttribute("data-optional", !required);
|
|
151
|
+
host.toggleAttribute("data-invalid", !isValid);
|
|
152
|
+
host.toggleAttribute("data-valid", isValid);
|
|
153
|
+
}
|
|
154
|
+
focus() {
|
|
155
|
+
if (this.inputDisabled && this.suggestions) {
|
|
156
|
+
this.open = !this.open;
|
|
157
|
+
super.focus();
|
|
158
|
+
} else {
|
|
159
|
+
this.input?.focus();
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
blur() {
|
|
163
|
+
this.open = false;
|
|
164
|
+
}
|
|
165
|
+
getForm() {
|
|
166
|
+
return this.input.form;
|
|
167
|
+
}
|
|
168
|
+
handleTextInput(e) {
|
|
169
|
+
const input = e.target;
|
|
170
|
+
e.preventDefault();
|
|
171
|
+
if (!this.multiple && this.fixLength && input.value.length < this.fixLength) {
|
|
172
|
+
input.value = this.value;
|
|
173
|
+
} else if (!this.multiple) {
|
|
174
|
+
this.value = input.value;
|
|
175
|
+
} else if (input.value === this.separator) {
|
|
176
|
+
input.value = "";
|
|
177
|
+
} else {
|
|
178
|
+
this.value = [...this.valueList.slice(0, -1), ...input.value.split(this.separator)];
|
|
179
|
+
input.value = this.valueList.at(-1);
|
|
180
|
+
}
|
|
181
|
+
this.dispatchInput();
|
|
182
|
+
this.setValidity(this.validity.valid);
|
|
183
|
+
}
|
|
184
|
+
handleInputKeydown(e) {
|
|
185
|
+
const input = e.target;
|
|
186
|
+
if (this.multiple && e.key === "Backspace" && input.selectionStart === 0 && input.selectionEnd === 0) {
|
|
187
|
+
e.preventDefault();
|
|
188
|
+
this.value = this.valueList.slice(0, -1);
|
|
189
|
+
}
|
|
190
|
+
this.requestUpdate();
|
|
191
|
+
}
|
|
192
|
+
dispatchChange() {
|
|
193
|
+
this.dispatchEvent(new CustomEvent("sl-change", { composed: true, bubbles: true }));
|
|
194
|
+
}
|
|
195
|
+
dispatchInput() {
|
|
196
|
+
this.dispatchEvent(new CustomEvent("sl-input", { composed: true, bubbles: true }));
|
|
197
|
+
}
|
|
198
|
+
get valueList() {
|
|
199
|
+
return this.multiple ? this.value || [] : [this.value];
|
|
200
|
+
}
|
|
201
|
+
get inputSize() {
|
|
202
|
+
return !this.multiple ? void 0 : Math.min(
|
|
203
|
+
Math.max(this.placeholder?.length ?? 1, this.valueList.at(-1)?.length ?? 1 - 1),
|
|
204
|
+
40
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
firstUpdated(_changedProperties) {
|
|
208
|
+
super.firstUpdated(_changedProperties);
|
|
209
|
+
this.requestUpdate();
|
|
210
|
+
}
|
|
211
|
+
connectedCallback() {
|
|
212
|
+
super.connectedCallback();
|
|
213
|
+
this.requestUpdate();
|
|
214
|
+
}
|
|
215
|
+
get inputWidth() {
|
|
216
|
+
return this.hideEl ? this.hideEl.offsetWidth : 0;
|
|
217
|
+
}
|
|
218
|
+
get inputValue() {
|
|
219
|
+
const value = this.multiple ? this.valueList.at(-1) ?? "" : String(this.value ?? "");
|
|
220
|
+
return value !== this.emptyValue ? value : "";
|
|
221
|
+
}
|
|
222
|
+
render() {
|
|
223
|
+
const input = html`
|
|
224
|
+
<input
|
|
225
|
+
part="input"
|
|
226
|
+
type=${this.type}
|
|
227
|
+
size=${ifDefined(this.inputSize)}
|
|
228
|
+
.value=${this.inputValue}
|
|
229
|
+
placeholder=${this.multiple && this.valueList.length > 1 ? "" : this.placeholder}
|
|
230
|
+
?disabled=${this.disabled || this.inputDisabled}
|
|
231
|
+
@input=${this.handleTextInput}
|
|
232
|
+
@change=${this.dispatchChange}
|
|
233
|
+
@keydown=${this.handleInputKeydown}
|
|
234
|
+
autocomplete=${this.autocomplete}
|
|
235
|
+
style=${this.autosize ? styleMap({ width: `calc(${this.inputWidth}px + 2ch)` }) : void 0}
|
|
236
|
+
>
|
|
237
|
+
`;
|
|
238
|
+
return html`
|
|
239
|
+
<slot name="label" part="label" @click=${this.focus}>
|
|
240
|
+
<label>${this.label}</label>
|
|
241
|
+
</slot>
|
|
242
|
+
<div part="base" id="anchor" tabindex=${0}>
|
|
243
|
+
<slot name="prefix"></slot>
|
|
244
|
+
${this.multiple ? html`
|
|
245
|
+
<span id="values">
|
|
246
|
+
<slot name="values"></slot>
|
|
247
|
+
${this.valueList.slice(0, -1).map((v) => html`
|
|
248
|
+
<sl-tag size="small" variant="primary">${v}</sl-tag>
|
|
249
|
+
`)}
|
|
250
|
+
${input}
|
|
251
|
+
</span>
|
|
252
|
+
` : input}
|
|
253
|
+
<div part="suffix">
|
|
254
|
+
<slot name="suffix"></slot>
|
|
255
|
+
<sl-icon-button
|
|
256
|
+
slot="trigger"
|
|
257
|
+
part="trigger"
|
|
258
|
+
id="toggle"
|
|
259
|
+
src=${chevron_down_default}
|
|
260
|
+
@focus=${(e) => e.stopPropagation()}
|
|
261
|
+
@click=${(e) => {
|
|
262
|
+
this.open = !this.open;
|
|
263
|
+
e.stopPropagation();
|
|
264
|
+
}}
|
|
265
|
+
@mousedown=${(e) => {
|
|
266
|
+
e.stopPropagation();
|
|
267
|
+
e.preventDefault();
|
|
268
|
+
}}
|
|
269
|
+
></sl-icon-button>
|
|
270
|
+
</div>
|
|
271
|
+
</div>
|
|
272
|
+
<sl-popup anchor="anchor" placement=${this.placement} strategy="fixed" ?active=${this.open} auto-size="vertical" auto-size-padding="10" flip shift>
|
|
273
|
+
<sl-menu id="options" @click=${this.handleOptionClick}>
|
|
274
|
+
<slot></slot>
|
|
275
|
+
</sl-menu>
|
|
276
|
+
</sl-popup>
|
|
277
|
+
<div id="help-text">${this.helpText}</div>
|
|
278
|
+
<span id="hide">${this.inputEl?.value}</span>
|
|
279
|
+
`;
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
_init = __decoratorStart(_a);
|
|
283
|
+
_value = new WeakMap();
|
|
284
|
+
_defaultValue = new WeakMap();
|
|
285
|
+
_input = new WeakMap();
|
|
286
|
+
_toggleButton = new WeakMap();
|
|
287
|
+
_slotElement = new WeakMap();
|
|
288
|
+
_optionElements = new WeakMap();
|
|
289
|
+
_autocomplete = new WeakMap();
|
|
290
|
+
_active = new WeakMap();
|
|
291
|
+
_inputDisabled = new WeakMap();
|
|
292
|
+
_multiple = new WeakMap();
|
|
293
|
+
_placeholder = new WeakMap();
|
|
294
|
+
_emptyValue = new WeakMap();
|
|
295
|
+
_open = new WeakMap();
|
|
296
|
+
_suggestions = new WeakMap();
|
|
297
|
+
_helpText = new WeakMap();
|
|
298
|
+
_fixLength = new WeakMap();
|
|
299
|
+
_separator = new WeakMap();
|
|
300
|
+
_placement = new WeakMap();
|
|
301
|
+
_autosize = new WeakMap();
|
|
302
|
+
_disabled = new WeakMap();
|
|
303
|
+
_required = new WeakMap();
|
|
304
|
+
_type = new WeakMap();
|
|
305
|
+
_label = new WeakMap();
|
|
306
|
+
_hideEl = new WeakMap();
|
|
307
|
+
_inputEl = new WeakMap();
|
|
308
|
+
__decorateElement(_init, 4, "value", _value_dec, Combobox, _value);
|
|
309
|
+
__decorateElement(_init, 4, "defaultValue", _defaultValue_dec, Combobox, _defaultValue);
|
|
310
|
+
__decorateElement(_init, 4, "input", _input_dec, Combobox, _input);
|
|
311
|
+
__decorateElement(_init, 4, "toggleButton", _toggleButton_dec, Combobox, _toggleButton);
|
|
312
|
+
__decorateElement(_init, 4, "slotElement", _slotElement_dec, Combobox, _slotElement);
|
|
313
|
+
__decorateElement(_init, 4, "optionElements", _optionElements_dec, Combobox, _optionElements);
|
|
314
|
+
__decorateElement(_init, 4, "autocomplete", _autocomplete_dec, Combobox, _autocomplete);
|
|
315
|
+
__decorateElement(_init, 4, "active", _active_dec, Combobox, _active);
|
|
316
|
+
__decorateElement(_init, 4, "inputDisabled", _inputDisabled_dec, Combobox, _inputDisabled);
|
|
317
|
+
__decorateElement(_init, 4, "multiple", _multiple_dec, Combobox, _multiple);
|
|
318
|
+
__decorateElement(_init, 4, "placeholder", _placeholder_dec, Combobox, _placeholder);
|
|
319
|
+
__decorateElement(_init, 4, "emptyValue", _emptyValue_dec, Combobox, _emptyValue);
|
|
320
|
+
__decorateElement(_init, 4, "open", _open_dec, Combobox, _open);
|
|
321
|
+
__decorateElement(_init, 4, "suggestions", _suggestions_dec, Combobox, _suggestions);
|
|
322
|
+
__decorateElement(_init, 4, "helpText", _helpText_dec, Combobox, _helpText);
|
|
323
|
+
__decorateElement(_init, 4, "fixLength", _fixLength_dec, Combobox, _fixLength);
|
|
324
|
+
__decorateElement(_init, 4, "separator", _separator_dec, Combobox, _separator);
|
|
325
|
+
__decorateElement(_init, 4, "placement", _placement_dec, Combobox, _placement);
|
|
326
|
+
__decorateElement(_init, 4, "autosize", _autosize_dec, Combobox, _autosize);
|
|
327
|
+
__decorateElement(_init, 4, "disabled", _disabled_dec, Combobox, _disabled);
|
|
328
|
+
__decorateElement(_init, 4, "required", _required_dec, Combobox, _required);
|
|
329
|
+
__decorateElement(_init, 4, "type", _type_dec, Combobox, _type);
|
|
330
|
+
__decorateElement(_init, 4, "label", _label_dec, Combobox, _label);
|
|
331
|
+
__decorateElement(_init, 4, "hideEl", _hideEl_dec, Combobox, _hideEl);
|
|
332
|
+
__decorateElement(_init, 4, "inputEl", _inputEl_dec, Combobox, _inputEl);
|
|
333
|
+
Combobox = __decorateElement(_init, 0, "Combobox", _Combobox_decorators, Combobox);
|
|
334
|
+
__publicField(Combobox, "shadowRootOptions", { ...LitElement.shadowRootOptions, delegatesFocus: true });
|
|
335
|
+
__publicField(Combobox, "styles", [SlInput.styles, css`
|
|
336
|
+
* {
|
|
337
|
+
font-family: var(--sl-font-sans);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
:host {
|
|
341
|
+
display: flex;
|
|
342
|
+
flex-direction: column;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
[part=base] {
|
|
346
|
+
display: flex;
|
|
347
|
+
flex-direction: row;
|
|
348
|
+
justify-content: space-between;
|
|
349
|
+
align-items: center;
|
|
350
|
+
position: relative;
|
|
351
|
+
border: solid var(--sl-input-border-width) var(--sl-input-border-color);
|
|
352
|
+
border-radius: var(--sl-input-border-radius-medium);
|
|
353
|
+
max-width: 100%;
|
|
354
|
+
min-height: var(--sl-input-height-medium);
|
|
355
|
+
padding: 0 var(--sl-input-spacing-medium);
|
|
356
|
+
padding-right: 0;
|
|
357
|
+
background: white;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
:host(:not([inputDisabled]):not([disabled])) {
|
|
361
|
+
cursor: text;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
:host([inputDisabled]:not([disabled])), :host([inputDisabled]:not([disabled])) input {
|
|
365
|
+
cursor: pointer;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
:host([multiple]) [part=base] {
|
|
369
|
+
flex-wrap: wrap;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
:host([filled]) [part=base] {
|
|
373
|
+
background: var(--sl-input-filled-background-color);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
:host([active]) [part=base] {
|
|
377
|
+
border-color: var(--sl-input-border-color-focus);
|
|
378
|
+
box-shadow: 0 0 0 var(--sl-focus-ring-width) var(--sl-input-focus-ring-color);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
:host([disabled]) [part=base] {
|
|
382
|
+
background: none;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
:host(:hover) [part=base] {
|
|
386
|
+
border-color: var(--sl-color-gray-400);
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
#values {
|
|
390
|
+
display: flex;
|
|
391
|
+
flex-direction: row;
|
|
392
|
+
align-items: center;
|
|
393
|
+
gap: 0.25rem;
|
|
394
|
+
padding-top: 0.25rem;
|
|
395
|
+
padding-bottom: 0.25rem;
|
|
396
|
+
flex-wrap: wrap;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
#values > * {
|
|
400
|
+
margin-top: 0.125rem;
|
|
401
|
+
margin-bottom: 0.125rem;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
#options {
|
|
405
|
+
display: block;
|
|
406
|
+
font-family: var(--sl-font-sans);
|
|
407
|
+
font-size: var(--sl-font-size-medium);
|
|
408
|
+
font-weight: var(--sl-font-weight-normal);
|
|
409
|
+
box-shadow: var(--sl-shadow-large);
|
|
410
|
+
background: var(--sl-panel-background-color);
|
|
411
|
+
border: solid var(--sl-panel-border-width) var(--sl-panel-border-color);
|
|
412
|
+
border-radius: var(--sl-border-radius-medium);
|
|
413
|
+
padding-block: var(--sl-spacing-x-small);
|
|
414
|
+
padding-inline: 0;
|
|
415
|
+
overflow: auto;
|
|
416
|
+
overscroll-behavior: none;
|
|
417
|
+
width: 100%;
|
|
418
|
+
max-height: var(--auto-size-available-height);
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
:host(:is(:not([open]), :not([suggestions]))) #options {
|
|
422
|
+
display: none;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
#options::part(base) {
|
|
426
|
+
width: 100%;
|
|
427
|
+
border-top: none;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
input {
|
|
431
|
+
flex-grow: 1;
|
|
432
|
+
display: inline-flex;
|
|
433
|
+
border: none;
|
|
434
|
+
outline: none;
|
|
435
|
+
background: transparent;
|
|
436
|
+
font-size: var(--sl-input-font-size-small);
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
:host(:not([suggestions])) sl-menu, :host(:not([suggestions])) #toggle {
|
|
440
|
+
display: none;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
#toggle {
|
|
444
|
+
padding-right: var(--sl-input-spacing-medium);
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
:host([size=small]) #toggle {
|
|
448
|
+
padding-right: var(--sl-spacing-2x-small);
|
|
449
|
+
font-size: var(--sl-input-font-size-small);
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
#toggle::part(base) {
|
|
453
|
+
padding: 0;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
#toggle::part(base) {
|
|
457
|
+
transition: transform 0.25s ease;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
:host([open]) #toggle::part(base) {
|
|
461
|
+
transform: rotate(180deg);
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
:host([open]) {
|
|
465
|
+
z-index: 100;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
sl-dropdown::part(panel) {
|
|
469
|
+
width: 100%;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
[part=suffix] {
|
|
473
|
+
display: flex;
|
|
474
|
+
flex-direction: row;
|
|
475
|
+
align-items: center;
|
|
476
|
+
justify-content: flex-end;
|
|
477
|
+
max-width: 50%;
|
|
478
|
+
flex-grow: 0;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
[part=label]::slotted(*), label {
|
|
482
|
+
align-self: flex-start;
|
|
483
|
+
margin-bottom: var(--sl-spacing-3x-small);
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
:host([required]) [part=label]::after {
|
|
487
|
+
content: "*";
|
|
488
|
+
margin-left: 0.25ch;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
:host(:not([help-text])) #help-text {
|
|
492
|
+
display: none;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
#help-text {
|
|
496
|
+
font-size: var(--sl-input-help-text-font-size-medium);
|
|
497
|
+
color: var(--sl-input-help-text-color);
|
|
498
|
+
margin-top: var(--sl-spacing-3x-small);
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
slot[name=prefix]::slotted(:last-child) {
|
|
502
|
+
margin-right: 1ch;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
:host([size=small]) [part=base] {
|
|
506
|
+
min-height: var(--sl-input-height-small);
|
|
507
|
+
padding: 0 var(--sl-input-spacing-small);
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
#hide {
|
|
511
|
+
height: 0;
|
|
512
|
+
position: absolute;
|
|
513
|
+
right: 0;
|
|
514
|
+
bottom: 0;
|
|
515
|
+
white-space: pre;
|
|
516
|
+
overflow: hidden;
|
|
517
|
+
font-size: var(--sl-input-font-size-small);
|
|
518
|
+
}
|
|
519
|
+
`]);
|
|
520
|
+
__runInitializers(_init, 1, Combobox);
|
|
521
|
+
|
|
522
|
+
// src/widgets/webwriter-cloze-gap.ts
|
|
523
|
+
import { property as property2 } from "lit/decorators/property.js";
|
|
524
|
+
var _isAdding_dec, _input_dec2, _showOptions_dec, _distraction_dec, _value_dec2, _solution_dec, _a2, _WebwriterClozeGap_decorators, _init2, _solution, _value2, _distraction, _showOptions, _input2, _isAdding;
|
|
525
|
+
_WebwriterClozeGap_decorators = [customElement2("webwriter-cloze-gap")];
|
|
526
|
+
var _WebwriterClozeGap = class _WebwriterClozeGap extends (_a2 = LitElementWw, _solution_dec = [property2({ type: Array, attribute: true, reflect: true })], _value_dec2 = [property2({ type: String, attribute: true, reflect: true })], _distraction_dec = [property2({ type: Array, attribute: true, reflect: true })], _showOptions_dec = [property2({ type: Boolean, attribute: true, reflect: true })], _input_dec2 = [query2("ww-combobox")], _isAdding_dec = [property2({ type: Boolean, attribute: false })], _a2) {
|
|
527
|
+
constructor() {
|
|
528
|
+
super(...arguments);
|
|
529
|
+
__privateAdd(this, _solution, __runInitializers(_init2, 8, this)), __runInitializers(_init2, 11, this);
|
|
530
|
+
__privateAdd(this, _value2, __runInitializers(_init2, 12, this)), __runInitializers(_init2, 15, this);
|
|
531
|
+
__privateAdd(this, _distraction, __runInitializers(_init2, 16, this, [])), __runInitializers(_init2, 19, this);
|
|
532
|
+
__privateAdd(this, _showOptions, __runInitializers(_init2, 20, this, false)), __runInitializers(_init2, 23, this);
|
|
533
|
+
__publicField(this, "msg", (str) => this.lang in _WebwriterClozeGap.localization ? _WebwriterClozeGap.localization[this.lang][str] ?? str : str);
|
|
534
|
+
__privateAdd(this, _input2, __runInitializers(_init2, 24, this)), __runInitializers(_init2, 27, this);
|
|
535
|
+
__publicField(this, "handleChange", (e) => {
|
|
536
|
+
e.preventDefault();
|
|
537
|
+
if (!this.isContentEditable) {
|
|
538
|
+
this.value = this.input.value;
|
|
539
|
+
}
|
|
540
|
+
});
|
|
541
|
+
__publicField(this, "handleAddClick", (e) => {
|
|
542
|
+
e.stopImmediatePropagation();
|
|
543
|
+
e.preventDefault();
|
|
544
|
+
this.addSolution(this.input.value);
|
|
545
|
+
this.isAdding = true;
|
|
546
|
+
this.input.value = "";
|
|
547
|
+
this.input.open = true;
|
|
548
|
+
});
|
|
549
|
+
__publicField(this, "handleToggleClick", (e, value) => {
|
|
550
|
+
e.stopImmediatePropagation();
|
|
551
|
+
e.preventDefault();
|
|
552
|
+
this.toggleOptionType(value);
|
|
553
|
+
});
|
|
554
|
+
__publicField(this, "handleRemoveClick", (e, value) => {
|
|
555
|
+
e.stopImmediatePropagation();
|
|
556
|
+
e.preventDefault();
|
|
557
|
+
this.removeOption(value);
|
|
558
|
+
});
|
|
559
|
+
__publicField(this, "handleKeydown", (e) => {
|
|
560
|
+
if (e.key === "Enter") {
|
|
561
|
+
this.handleAddClick(e);
|
|
562
|
+
}
|
|
563
|
+
});
|
|
564
|
+
__publicField(this, "handleBlur", (e) => {
|
|
565
|
+
this.isAdding = false;
|
|
566
|
+
if (this.solution.length === 1) {
|
|
567
|
+
this.input.value = this.solution[0];
|
|
568
|
+
}
|
|
569
|
+
});
|
|
570
|
+
__privateAdd(this, _isAdding, __runInitializers(_init2, 28, this, false)), __runInitializers(_init2, 31, this);
|
|
571
|
+
}
|
|
572
|
+
async focus() {
|
|
573
|
+
(await this.input).focus();
|
|
574
|
+
}
|
|
575
|
+
addSolution(value) {
|
|
576
|
+
this.solution = Array.from(/* @__PURE__ */ new Set([...this.solution ?? [], value]));
|
|
577
|
+
}
|
|
578
|
+
toggleOptionType(value) {
|
|
579
|
+
if (this.solution.includes(value)) {
|
|
580
|
+
this.solution = this.solution.filter((v) => v !== value);
|
|
581
|
+
this.distraction = Array.from(/* @__PURE__ */ new Set([...this.distraction ?? [], value]));
|
|
582
|
+
} else if (this.distraction.includes(value)) {
|
|
583
|
+
this.distraction = this.distraction.filter((v) => v !== value);
|
|
584
|
+
this.solution = Array.from(/* @__PURE__ */ new Set([...this.solution ?? [], value]));
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
removeOption(value) {
|
|
588
|
+
this.solution = this.solution.filter((v) => v !== value);
|
|
589
|
+
this.distraction = this.distraction.filter((v) => v !== value);
|
|
590
|
+
if (this.allOptions.length === 0) {
|
|
591
|
+
this.isAdding = false;
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
get allOptions() {
|
|
595
|
+
return [...this.solution ?? [], ...this.distraction];
|
|
596
|
+
}
|
|
597
|
+
render() {
|
|
598
|
+
return html2`<ww-combobox @blur=${this.handleBlur} ?suggestions=${this.allOptions.length > 1 || this.isAdding || this.distraction.length > 0} size="small" autosize .value=${this.value} @sl-change=${this.handleChange} @sl-input=${() => this.requestUpdate()} @keydown=${this.handleKeydown} >
|
|
599
|
+
<sl-icon-button id="add" title="Add another solution" ?disabled=${this.allOptions.includes(this.input?.value)} ?data-hidden=${!this.input?.value} src=${plus_default} size="small" slot="prefix" @click=${this.handleAddClick} @mousedown=${(e) => {
|
|
600
|
+
e.stopPropagation();
|
|
601
|
+
e.preventDefault();
|
|
602
|
+
}} @focus=${(e) => e.stopPropagation()} ></sl-icon-button>
|
|
603
|
+
${this.allOptions.sort().map((value) => html2`
|
|
604
|
+
<sl-option size="small" value=${value} class=${this.solution.includes(value) ? "solution" : "distraction"} >
|
|
605
|
+
<sl-icon-button title=${this.solution.includes(value) ? "Change to a distraction" : "Change to a solution"} class="toggle" slot="prefix" src=${this.solution.includes(value) ? check_circle_default : slash_circle_default} @click=${(e) => this.handleToggleClick(e, value)} @mousedown=${(e) => {
|
|
606
|
+
e.stopPropagation();
|
|
607
|
+
e.preventDefault();
|
|
608
|
+
}}></sl-icon-button>
|
|
609
|
+
<span title=${this.solution.includes(value) ? "Solution" : "Distraction"}>${value}</span>
|
|
610
|
+
<sl-icon-button title="Remove" class="remove" slot="suffix" src=${x_default} @click=${(e) => this.handleRemoveClick(e, value)} @mousedown=${(e) => {
|
|
611
|
+
e.stopPropagation();
|
|
612
|
+
e.preventDefault();
|
|
613
|
+
}}></sl-icon-button>
|
|
614
|
+
</sl-option>
|
|
615
|
+
`)}
|
|
616
|
+
</ww-combobox>`;
|
|
617
|
+
}
|
|
618
|
+
};
|
|
619
|
+
_init2 = __decoratorStart(_a2);
|
|
620
|
+
_solution = new WeakMap();
|
|
621
|
+
_value2 = new WeakMap();
|
|
622
|
+
_distraction = new WeakMap();
|
|
623
|
+
_showOptions = new WeakMap();
|
|
624
|
+
_input2 = new WeakMap();
|
|
625
|
+
_isAdding = new WeakMap();
|
|
626
|
+
__decorateElement(_init2, 4, "solution", _solution_dec, _WebwriterClozeGap, _solution);
|
|
627
|
+
__decorateElement(_init2, 4, "value", _value_dec2, _WebwriterClozeGap, _value2);
|
|
628
|
+
__decorateElement(_init2, 4, "distraction", _distraction_dec, _WebwriterClozeGap, _distraction);
|
|
629
|
+
__decorateElement(_init2, 4, "showOptions", _showOptions_dec, _WebwriterClozeGap, _showOptions);
|
|
630
|
+
__decorateElement(_init2, 4, "input", _input_dec2, _WebwriterClozeGap, _input2);
|
|
631
|
+
__decorateElement(_init2, 4, "isAdding", _isAdding_dec, _WebwriterClozeGap, _isAdding);
|
|
632
|
+
_WebwriterClozeGap = __decorateElement(_init2, 0, "WebwriterClozeGap", _WebwriterClozeGap_decorators, _WebwriterClozeGap);
|
|
633
|
+
__publicField(_WebwriterClozeGap, "localization", {});
|
|
634
|
+
__publicField(_WebwriterClozeGap, "scopedElements", {
|
|
635
|
+
"ww-combobox": Combobox,
|
|
636
|
+
"sl-icon-button": SlIconButton,
|
|
637
|
+
"sl-option": SlOption
|
|
638
|
+
});
|
|
639
|
+
__publicField(_WebwriterClozeGap, "styles", css2`
|
|
640
|
+
:host {
|
|
641
|
+
display: inline-block !important;
|
|
642
|
+
vertical-align: top;
|
|
643
|
+
margin: 0 1ch;
|
|
644
|
+
max-width: calc(100% - 2ch);
|
|
645
|
+
max-height: 1lh;
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
:host(::after) {
|
|
649
|
+
content: " ";
|
|
650
|
+
display: block;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
sl-icon-button[data-hidden] {
|
|
654
|
+
visibility: hidden;
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
sl-icon-button::part(base) {
|
|
658
|
+
padding: 0;
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
:host(:not(:focus-within)) #add {
|
|
662
|
+
visibility: hidden;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
sl-icon-button {
|
|
666
|
+
overflow: visible;
|
|
667
|
+
margin-right: 0;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
ww-combobox::part(base) {
|
|
671
|
+
min-height: unset;
|
|
672
|
+
padding: 2px 2px;
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
:host(:is([contenteditable=true], [contenteditable=""])) ww-combobox::part(input) {
|
|
676
|
+
color: var(--sl-color-success-700);
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
sl-option::part(base) {
|
|
680
|
+
padding: 0;
|
|
681
|
+
font-size: var(--sl-input-font-size-small);
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
sl-option::part(label) {
|
|
685
|
+
padding: var(--sl-spacing-2x-small) 0;
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
sl-option::part(label):hover {
|
|
689
|
+
color: var(--sl-color-primary-600);
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
sl-option::part(checked-icon) {
|
|
693
|
+
display: none;
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
.remove::part(base):hover {
|
|
697
|
+
color: var(--sl-color-danger-600) !important;
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
.remove::part(base):active {
|
|
701
|
+
color: var(--sl-color-danger-800) !important;
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
:is(.toggle, .remove)::part(base) {
|
|
705
|
+
padding: var(--sl-spacing-2x-small);
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
.solution::part(base) {
|
|
709
|
+
color: var(--sl-color-success-700);
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
.toggle {
|
|
713
|
+
color: inherit;
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
|
|
717
|
+
`);
|
|
718
|
+
__runInitializers(_init2, 1, _WebwriterClozeGap);
|
|
719
|
+
var WebwriterClozeGap = _WebwriterClozeGap;
|
|
720
|
+
export {
|
|
721
|
+
WebwriterClozeGap
|
|
722
|
+
};
|