@threadlabs/looma 0.28.7 → 0.28.9

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.
@@ -0,0 +1,163 @@
1
+ import { _ as uniqueKeys, i as checkHydratedRoot, n as KeyedBoundary, o as createDispatch, p as nativeAttrs, v as useComponentHost, y as useReflectedProp } from "./_plugin-vue_export-helper.js";
2
+ import { a as vPropValidity, n as checkedProp, r as propValidityState } from "./props.js";
3
+ import { t as UiCombobox_default } from "./UiCombobox.js";
4
+ import { Fragment, computed, createElementBlock, createVNode, defineComponent, getCurrentInstance, mergeProps, openBlock, ref, renderList, toDisplayString, unref, watchSyncEffect, withCtx, withDirectives } from "vue";
5
+ //#region .build/vue/UiEditorCodeLanguage.vue?vue&type=script&setup=true&lang.ts
6
+ var _hoisted_1 = ["data-languages", "data-value"];
7
+ var _hoisted_2 = ["value"];
8
+ //#endregion
9
+ //#region .build/vue/UiEditorCodeLanguage.vue
10
+ var UiEditorCodeLanguage_default = /* @__PURE__ */ defineComponent({
11
+ inheritAttrs: false,
12
+ __name: "UiEditorCodeLanguage",
13
+ props: {
14
+ languages: {
15
+ type: null,
16
+ default: () => []
17
+ },
18
+ value: {
19
+ type: null,
20
+ default: "auto"
21
+ }
22
+ },
23
+ emits: ["update:value", "language"],
24
+ setup(__props, { emit: __emit }) {
25
+ const propValidityContract = { props: {
26
+ languages: {
27
+ type: {
28
+ kind: "list",
29
+ item: {
30
+ kind: "object",
31
+ fields: [{
32
+ name: "value",
33
+ type: {
34
+ kind: "terminal",
35
+ name: "string"
36
+ },
37
+ optional: false
38
+ }, {
39
+ name: "label",
40
+ type: {
41
+ kind: "terminal",
42
+ name: "string"
43
+ },
44
+ optional: false
45
+ }],
46
+ open: false
47
+ }
48
+ },
49
+ required: false,
50
+ target: { attribute: "languages" },
51
+ description: "The languages to offer, in order, each with its label; the editor lists Auto first and marks a saved language it cannot highlight.",
52
+ default: []
53
+ },
54
+ value: {
55
+ type: {
56
+ kind: "terminal",
57
+ name: "string"
58
+ },
59
+ required: false,
60
+ target: { attribute: "value" },
61
+ description: "The code block's language, or auto to detect it.",
62
+ default: "auto"
63
+ }
64
+ } };
65
+ const props = __props;
66
+ const acceptedProps = {
67
+ languages: () => [],
68
+ value: "auto"
69
+ };
70
+ const checkedProps = computed(() => ({
71
+ languages: checkedProp(props["languages"], {
72
+ kind: "list",
73
+ item: {
74
+ kind: "object",
75
+ fields: [{
76
+ name: "value",
77
+ type: {
78
+ kind: "terminal",
79
+ name: "string"
80
+ },
81
+ optional: false
82
+ }, {
83
+ name: "label",
84
+ type: {
85
+ kind: "terminal",
86
+ name: "string"
87
+ },
88
+ optional: false
89
+ }],
90
+ open: false
91
+ }
92
+ }, false, "languages", acceptedProps),
93
+ value: checkedProp(props["value"], {
94
+ kind: "terminal",
95
+ name: "string"
96
+ }, false, "value", acceptedProps)
97
+ }));
98
+ checkedProps.value;
99
+ watchSyncEffect(() => {
100
+ checkedProps.value;
101
+ });
102
+ const reflectedProp = useReflectedProp();
103
+ const hydrationInstance = getCurrentInstance();
104
+ const emit = __emit;
105
+ const root = ref(null);
106
+ checkHydratedRoot("div", "ui-editor-code-language");
107
+ const isLanguageDetail = (detail) => detail !== null && typeof detail === "object" && !Array.isArray(detail) && typeof detail["value"] === "string" && Object.keys(detail).every((key) => ["value"].includes(key));
108
+ const dispatch = createDispatch(root, emit, {
109
+ checks: { language: isLanguageDetail },
110
+ modeled: ["value"]
111
+ });
112
+ useComponentHost(() => import("@threadlabs/looma/components/ui-editor-code-language/ui-editor-code-language.js"), {
113
+ root,
114
+ dispatch,
115
+ controllerSource: {
116
+ specifier: "../components/ui-editor-code-language/ui-editor-code-language.js",
117
+ definition: "./components/ui-editor-code-language/ui-editor-code-language.html"
118
+ },
119
+ props: checkedProps,
120
+ propInputs: (name) => {
121
+ const incoming = hydrationInstance?.vnode.props;
122
+ const kebab = name.replace(/[A-Z]/g, (letter) => "-" + letter.toLowerCase());
123
+ return incoming !== null && incoming !== void 0 ? incoming[name] ?? incoming[kebab] ?? null : null;
124
+ },
125
+ propNames: ["languages", "value"],
126
+ propValidity: (name) => propValidityState({
127
+ contract: propValidityContract,
128
+ values: { ...props }
129
+ }, name)
130
+ });
131
+ return (_ctx, _cache) => {
132
+ return withDirectives((openBlock(), createElementBlock("div", mergeProps(unref(nativeAttrs)(_ctx.$attrs), {
133
+ "data-languages": unref(reflectedProp)("languages", "languages", checkedProps.value.languages, void 0, false),
134
+ "data-value": unref(reflectedProp)("value", "value", checkedProps.value.value, void 0, false),
135
+ ref_key: "root",
136
+ ref: root
137
+ }), [createVNode(UiCombobox_default, {
138
+ label: "Code language",
139
+ "label-visibility": "sr-only",
140
+ size: "sm",
141
+ filter: "label",
142
+ disclosure: true,
143
+ value: checkedProps.value.value
144
+ }, {
145
+ default: withCtx(() => [createVNode(unref(KeyedBoundary), null, {
146
+ default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(uniqueKeys)(checkedProps.value.languages, (language, index, loop) => language.value), (language) => {
147
+ return openBlock(), createElementBlock("option", {
148
+ key: language.value,
149
+ value: language.value
150
+ }, toDisplayString(language.label), 9, _hoisted_2);
151
+ }), 128))]),
152
+ _: 1
153
+ })]),
154
+ _: 1
155
+ }, 8, ["value"])], 16, _hoisted_1)), [[unref(vPropValidity), {
156
+ contract: propValidityContract,
157
+ values: { ...props }
158
+ }]]);
159
+ };
160
+ }
161
+ });
162
+ //#endregion
163
+ export { UiEditorCodeLanguage_default as t };