@threadlabs/looma 0.28.8 → 0.28.10
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/components/ui-editor-code-language/ui-editor-code-language.html +17 -0
- package/components/ui-editor-code-language/ui-editor-code-language.js +14 -0
- package/dist/index.js +37 -36
- package/editor/link-editing.d.ts +85 -0
- package/package.json +1 -1
- package/styles/ui-editor-code-language.css +1 -0
- package/vanilla/UiEditorCodeLanguage.d.ts +16 -0
- package/vanilla/UiEditorCodeLanguage.js +64 -0
- package/vanilla/index.js +1 -0
- package/vue/UiEditorCodeLanguage.d.ts +44 -0
- package/vue/UiEditorCodeLanguage.js +2 -0
- package/vue/UiEditorCodeLanguage.vue +156 -0
- package/vue/chunks/UiEditorCodeLanguage.js +163 -0
- package/vue/editor/LoomaEditor.d.ts +2 -19
- package/vue/editor/index.js +334 -237
- package/vue/editor/primitives.d.ts +5 -1
- package/vue/index.d.ts +1 -0
- package/vue/index.js +2 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<link rel="component" href="../ui-combobox/ui-combobox.html">
|
|
2
|
+
<template component="ui-editor-code-language" controller="./ui-editor-code-language.js">
|
|
3
|
+
<defs>
|
|
4
|
+
<prop name="value" type="string" default="auto">The code block's language, or auto to detect it.</prop>
|
|
5
|
+
<prop name="languages" type="list(object({ value: string, label: string }))" default="[]"
|
|
6
|
+
>The languages to offer, in order, each with its label; the editor lists Auto first and marks a saved language it cannot highlight.</prop>
|
|
7
|
+
<event name="language" type="object">
|
|
8
|
+
<prop name="value" required type="string"></prop>
|
|
9
|
+
A language was chosen, or auto.
|
|
10
|
+
</event>
|
|
11
|
+
</defs>
|
|
12
|
+
<div>
|
|
13
|
+
<ui-combobox label="Code language" label-visibility="sr-only" size="sm" from:disclosure="true" filter="label" from:value="$value">
|
|
14
|
+
<option $each="language of $languages" $key="$language.value" from:value="$language.value">{$language.label}</option>
|
|
15
|
+
</ui-combobox>
|
|
16
|
+
</div>
|
|
17
|
+
</template>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Reports a chosen language; typing a filter is not a choice.
|
|
2
|
+
function connect(host) {
|
|
3
|
+
const element = host.element;
|
|
4
|
+
const onValueChange = (event) => {
|
|
5
|
+
if (event.target !== element && event.detail?.kind === "selection" && event.detail.value) host.dispatch("language", { value: event.detail.value });
|
|
6
|
+
};
|
|
7
|
+
element.addEventListener("value-change", onValueChange);
|
|
8
|
+
return () => element.removeEventListener("value-change", onValueChange);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** Keep DOM setup and its cleanup tied to each connection, including reconnects. */
|
|
12
|
+
export default function controller(host) {
|
|
13
|
+
host.on("connect", () => connect(host));
|
|
14
|
+
}
|