@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.
- 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/components/ui-editor-link-form/ui-editor-link-form.html +118 -0
- package/components/ui-editor-link-form/ui-editor-link-form.js +71 -0
- package/dist/index.js +37 -35
- package/package.json +1 -1
- package/styles/ui-editor-code-language.css +1 -0
- package/styles/ui-editor-link-form.css +1 -0
- package/vanilla/UiEditorCodeLanguage.d.ts +16 -0
- package/vanilla/UiEditorCodeLanguage.js +64 -0
- package/vanilla/UiEditorLinkForm.d.ts +32 -0
- package/vanilla/UiEditorLinkForm.js +354 -0
- package/vanilla/index.js +2 -0
- package/vue/UiEditorCodeLanguage.d.ts +44 -0
- package/vue/UiEditorCodeLanguage.js +2 -0
- package/vue/UiEditorCodeLanguage.vue +156 -0
- package/vue/UiEditorLinkForm.d.ts +165 -0
- package/vue/UiEditorLinkForm.js +2 -0
- package/vue/UiEditorLinkForm.vue +557 -0
- package/vue/chunks/UiEditorCodeLanguage.js +163 -0
- package/vue/chunks/UiEditorLinkForm.js +669 -0
- package/vue/components.css +407 -407
- package/vue/editor/index.js +81 -171
- package/vue/editor/primitives.d.ts +21 -1
- package/vue/index.d.ts +2 -0
- package/vue/index.js +5 -3
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
<!-- Generated by HTML Next 1.0.0-alpha.51 for Vue 3.5. Do not edit. -->
|
|
2
|
+
<script setup lang="ts">
|
|
3
|
+
import { computed, getCurrentInstance, ref, watchSyncEffect } from 'vue'
|
|
4
|
+
import type { PropType } from 'vue'
|
|
5
|
+
import {
|
|
6
|
+
checkHydratedRoot,
|
|
7
|
+
createDispatch,
|
|
8
|
+
KeyedBoundary,
|
|
9
|
+
nativeAttrs,
|
|
10
|
+
uniqueKeys,
|
|
11
|
+
useComponentHost,
|
|
12
|
+
useReflectedProp,
|
|
13
|
+
} from './host'
|
|
14
|
+
import { checkedProp, propValidityState, vPropValidity } from './props'
|
|
15
|
+
import UiCombobox from './UiCombobox.vue'
|
|
16
|
+
|
|
17
|
+
defineOptions({ inheritAttrs: false })
|
|
18
|
+
|
|
19
|
+
const propValidityContract = {
|
|
20
|
+
props: {
|
|
21
|
+
languages: {
|
|
22
|
+
type: {
|
|
23
|
+
kind: 'list',
|
|
24
|
+
item: {
|
|
25
|
+
kind: 'object',
|
|
26
|
+
fields: [{ name: 'value', type: { kind: 'terminal', name: 'string' }, optional: false }, {
|
|
27
|
+
name: 'label',
|
|
28
|
+
type: { kind: 'terminal', name: 'string' },
|
|
29
|
+
optional: false,
|
|
30
|
+
}],
|
|
31
|
+
open: false,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
required: false,
|
|
35
|
+
target: { attribute: 'languages' },
|
|
36
|
+
description:
|
|
37
|
+
'The languages to offer, in order, each with its label; the editor lists Auto first and marks a saved language it cannot highlight.',
|
|
38
|
+
default: [],
|
|
39
|
+
},
|
|
40
|
+
value: {
|
|
41
|
+
type: { kind: 'terminal', name: 'string' },
|
|
42
|
+
required: false,
|
|
43
|
+
target: { attribute: 'value' },
|
|
44
|
+
description: 'The code block\'s language, or auto to detect it.',
|
|
45
|
+
default: 'auto',
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
} as const
|
|
49
|
+
const props = defineProps({
|
|
50
|
+
languages: {
|
|
51
|
+
type: null as unknown as PropType<
|
|
52
|
+
readonly ({ readonly value: string; readonly label: string })[] | null
|
|
53
|
+
>,
|
|
54
|
+
default: () => [],
|
|
55
|
+
},
|
|
56
|
+
value: { type: null as unknown as PropType<string | null>, default: 'auto' },
|
|
57
|
+
})
|
|
58
|
+
const acceptedProps: Record<string, unknown> = { languages: () => [], value: 'auto' }
|
|
59
|
+
const checkedProps = computed(() => ({
|
|
60
|
+
languages: checkedProp<readonly ({ readonly value: string; readonly label: string })[]>(
|
|
61
|
+
props['languages'],
|
|
62
|
+
{
|
|
63
|
+
kind: 'list',
|
|
64
|
+
item: {
|
|
65
|
+
kind: 'object',
|
|
66
|
+
fields: [{ name: 'value', type: { kind: 'terminal', name: 'string' }, optional: false }, {
|
|
67
|
+
name: 'label',
|
|
68
|
+
type: { kind: 'terminal', name: 'string' },
|
|
69
|
+
optional: false,
|
|
70
|
+
}],
|
|
71
|
+
open: false,
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
false,
|
|
75
|
+
'languages',
|
|
76
|
+
acceptedProps,
|
|
77
|
+
) as readonly ({ readonly value: string; readonly label: string })[],
|
|
78
|
+
value: checkedProp<string>(
|
|
79
|
+
props['value'],
|
|
80
|
+
{ kind: 'terminal', name: 'string' },
|
|
81
|
+
false,
|
|
82
|
+
'value',
|
|
83
|
+
acceptedProps,
|
|
84
|
+
) as string,
|
|
85
|
+
}))
|
|
86
|
+
void checkedProps.value
|
|
87
|
+
watchSyncEffect(() => {
|
|
88
|
+
void checkedProps.value
|
|
89
|
+
})
|
|
90
|
+
const reflectedProp = useReflectedProp()
|
|
91
|
+
const hydrationInstance = getCurrentInstance()
|
|
92
|
+
const emit = defineEmits<{
|
|
93
|
+
'update:value': [value: string]
|
|
94
|
+
language: [event: CustomEvent<{ readonly value: string }>]
|
|
95
|
+
}>()
|
|
96
|
+
|
|
97
|
+
const root = ref<HTMLElement | null>(null)
|
|
98
|
+
checkHydratedRoot('div', 'ui-editor-code-language')
|
|
99
|
+
|
|
100
|
+
const isLanguageDetail = (
|
|
101
|
+
detail: unknown,
|
|
102
|
+
): boolean => (detail !== null && typeof detail === 'object' && !Array.isArray(detail)
|
|
103
|
+
&& typeof (detail as Record<string, unknown>)['value'] === 'string'
|
|
104
|
+
&& Object.keys(detail as object).every((key) => ['value'].includes(key)))
|
|
105
|
+
const dispatch = createDispatch(root, emit as (name: string, detail: unknown) => void, {
|
|
106
|
+
checks: {
|
|
107
|
+
language: isLanguageDetail,
|
|
108
|
+
},
|
|
109
|
+
modeled: ['value'],
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
useComponentHost(() => import('../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: string) => {
|
|
121
|
+
const incoming = hydrationInstance?.vnode.props
|
|
122
|
+
const kebab = name.replace(/[A-Z]/g, (letter) => '-' + letter.toLowerCase())
|
|
123
|
+
return incoming !== null && incoming !== undefined
|
|
124
|
+
? (incoming[name] ?? incoming[kebab] ?? null)
|
|
125
|
+
: null
|
|
126
|
+
},
|
|
127
|
+
propNames: ['languages', 'value'],
|
|
128
|
+
propValidity: (name: string) =>
|
|
129
|
+
propValidityState({ contract: propValidityContract, values: { ...props } }, name),
|
|
130
|
+
})
|
|
131
|
+
</script>
|
|
132
|
+
|
|
133
|
+
<template>
|
|
134
|
+
<div
|
|
135
|
+
v-bind="nativeAttrs($attrs)"
|
|
136
|
+
v-prop-validity="{ contract: propValidityContract, values: { ...props } }"
|
|
137
|
+
:data-languages="reflectedProp('languages', 'languages', checkedProps.languages, undefined, false)"
|
|
138
|
+
:data-value="reflectedProp('value', 'value', checkedProps.value, undefined, false)"
|
|
139
|
+
ref="root"
|
|
140
|
+
>
|
|
141
|
+
<UiCombobox
|
|
142
|
+
label="Code language"
|
|
143
|
+
label-visibility="sr-only"
|
|
144
|
+
size="sm"
|
|
145
|
+
filter="label"
|
|
146
|
+
:disclosure="true"
|
|
147
|
+
:value="checkedProps.value"
|
|
148
|
+
><KeyedBoundary><option
|
|
149
|
+
v-for="language in uniqueKeys(checkedProps.languages, (language, index, loop) => language.value)"
|
|
150
|
+
:key="language.value"
|
|
151
|
+
:value="language.value"
|
|
152
|
+
>
|
|
153
|
+
{{ language.label }}
|
|
154
|
+
</option></KeyedBoundary></UiCombobox>
|
|
155
|
+
</div>
|
|
156
|
+
</template>
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import type { PropType } from 'vue';
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
3
|
+
error: {
|
|
4
|
+
type: PropType<string | null>;
|
|
5
|
+
default: string;
|
|
6
|
+
};
|
|
7
|
+
existing: {
|
|
8
|
+
type: PropType<boolean | null>;
|
|
9
|
+
default: boolean;
|
|
10
|
+
};
|
|
11
|
+
mode: {
|
|
12
|
+
type: PropType<"url" | "target" | null>;
|
|
13
|
+
default: string;
|
|
14
|
+
};
|
|
15
|
+
newTab: {
|
|
16
|
+
type: PropType<boolean | null>;
|
|
17
|
+
default: boolean;
|
|
18
|
+
};
|
|
19
|
+
placeholder: {
|
|
20
|
+
type: PropType<string | null>;
|
|
21
|
+
default: string;
|
|
22
|
+
};
|
|
23
|
+
results: {
|
|
24
|
+
type: PropType<readonly ({
|
|
25
|
+
readonly id: string;
|
|
26
|
+
readonly label: string;
|
|
27
|
+
readonly detail?: string;
|
|
28
|
+
})[] | null>;
|
|
29
|
+
default: () => never[];
|
|
30
|
+
};
|
|
31
|
+
searchable: {
|
|
32
|
+
type: PropType<boolean | null>;
|
|
33
|
+
default: boolean;
|
|
34
|
+
};
|
|
35
|
+
selected: {
|
|
36
|
+
type: PropType<string | null>;
|
|
37
|
+
default: string;
|
|
38
|
+
};
|
|
39
|
+
status: {
|
|
40
|
+
type: PropType<string | null>;
|
|
41
|
+
default: string;
|
|
42
|
+
};
|
|
43
|
+
text: {
|
|
44
|
+
type: PropType<string | null>;
|
|
45
|
+
default: string;
|
|
46
|
+
};
|
|
47
|
+
textEditable: {
|
|
48
|
+
type: PropType<boolean | null>;
|
|
49
|
+
default: boolean;
|
|
50
|
+
};
|
|
51
|
+
value: {
|
|
52
|
+
type: PropType<string | null>;
|
|
53
|
+
default: string;
|
|
54
|
+
};
|
|
55
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
56
|
+
clear: (event: CustomEvent<Readonly<Record<string, unknown>>>) => any;
|
|
57
|
+
text: (event: CustomEvent<{
|
|
58
|
+
readonly text: string;
|
|
59
|
+
}>) => any;
|
|
60
|
+
"update:value": (value: string) => any;
|
|
61
|
+
save: (event: CustomEvent<Readonly<Record<string, unknown>>>) => any;
|
|
62
|
+
"update:newTab": (value: boolean) => any;
|
|
63
|
+
"update:text": (value: string) => any;
|
|
64
|
+
destination: (event: CustomEvent<{
|
|
65
|
+
readonly value: string;
|
|
66
|
+
}>) => any;
|
|
67
|
+
"new-tab": (event: CustomEvent<{
|
|
68
|
+
readonly newTab: boolean;
|
|
69
|
+
}>) => any;
|
|
70
|
+
choose: (event: CustomEvent<{
|
|
71
|
+
readonly id: string;
|
|
72
|
+
}>) => any;
|
|
73
|
+
dismiss: (event: CustomEvent<Readonly<Record<string, unknown>>>) => any;
|
|
74
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
75
|
+
error: {
|
|
76
|
+
type: PropType<string | null>;
|
|
77
|
+
default: string;
|
|
78
|
+
};
|
|
79
|
+
existing: {
|
|
80
|
+
type: PropType<boolean | null>;
|
|
81
|
+
default: boolean;
|
|
82
|
+
};
|
|
83
|
+
mode: {
|
|
84
|
+
type: PropType<"url" | "target" | null>;
|
|
85
|
+
default: string;
|
|
86
|
+
};
|
|
87
|
+
newTab: {
|
|
88
|
+
type: PropType<boolean | null>;
|
|
89
|
+
default: boolean;
|
|
90
|
+
};
|
|
91
|
+
placeholder: {
|
|
92
|
+
type: PropType<string | null>;
|
|
93
|
+
default: string;
|
|
94
|
+
};
|
|
95
|
+
results: {
|
|
96
|
+
type: PropType<readonly ({
|
|
97
|
+
readonly id: string;
|
|
98
|
+
readonly label: string;
|
|
99
|
+
readonly detail?: string;
|
|
100
|
+
})[] | null>;
|
|
101
|
+
default: () => never[];
|
|
102
|
+
};
|
|
103
|
+
searchable: {
|
|
104
|
+
type: PropType<boolean | null>;
|
|
105
|
+
default: boolean;
|
|
106
|
+
};
|
|
107
|
+
selected: {
|
|
108
|
+
type: PropType<string | null>;
|
|
109
|
+
default: string;
|
|
110
|
+
};
|
|
111
|
+
status: {
|
|
112
|
+
type: PropType<string | null>;
|
|
113
|
+
default: string;
|
|
114
|
+
};
|
|
115
|
+
text: {
|
|
116
|
+
type: PropType<string | null>;
|
|
117
|
+
default: string;
|
|
118
|
+
};
|
|
119
|
+
textEditable: {
|
|
120
|
+
type: PropType<boolean | null>;
|
|
121
|
+
default: boolean;
|
|
122
|
+
};
|
|
123
|
+
value: {
|
|
124
|
+
type: PropType<string | null>;
|
|
125
|
+
default: string;
|
|
126
|
+
};
|
|
127
|
+
}>> & Readonly<{
|
|
128
|
+
onClear?: ((event: CustomEvent<Readonly<Record<string, unknown>>>) => any) | undefined;
|
|
129
|
+
onText?: ((event: CustomEvent<{
|
|
130
|
+
readonly text: string;
|
|
131
|
+
}>) => any) | undefined;
|
|
132
|
+
"onUpdate:value"?: ((value: string) => any) | undefined;
|
|
133
|
+
onSave?: ((event: CustomEvent<Readonly<Record<string, unknown>>>) => any) | undefined;
|
|
134
|
+
"onUpdate:newTab"?: ((value: boolean) => any) | undefined;
|
|
135
|
+
"onUpdate:text"?: ((value: string) => any) | undefined;
|
|
136
|
+
onDestination?: ((event: CustomEvent<{
|
|
137
|
+
readonly value: string;
|
|
138
|
+
}>) => any) | undefined;
|
|
139
|
+
"onNew-tab"?: ((event: CustomEvent<{
|
|
140
|
+
readonly newTab: boolean;
|
|
141
|
+
}>) => any) | undefined;
|
|
142
|
+
onChoose?: ((event: CustomEvent<{
|
|
143
|
+
readonly id: string;
|
|
144
|
+
}>) => any) | undefined;
|
|
145
|
+
onDismiss?: ((event: CustomEvent<Readonly<Record<string, unknown>>>) => any) | undefined;
|
|
146
|
+
}>, {
|
|
147
|
+
value: string | null;
|
|
148
|
+
error: string | null;
|
|
149
|
+
mode: "url" | "target" | null;
|
|
150
|
+
text: string | null;
|
|
151
|
+
selected: string | null;
|
|
152
|
+
status: string | null;
|
|
153
|
+
placeholder: string | null;
|
|
154
|
+
existing: boolean | null;
|
|
155
|
+
results: readonly {
|
|
156
|
+
readonly id: string;
|
|
157
|
+
readonly label: string;
|
|
158
|
+
readonly detail?: string;
|
|
159
|
+
}[] | null;
|
|
160
|
+
searchable: boolean | null;
|
|
161
|
+
newTab: boolean | null;
|
|
162
|
+
textEditable: boolean | null;
|
|
163
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
164
|
+
declare const _default: typeof __VLS_export;
|
|
165
|
+
export default _default;
|