vuewrite 0.0.16 → 0.0.18

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.
@@ -6,11 +6,12 @@ import { HTMLAttributes } from 'vue';
6
6
  import { PropType } from 'vue';
7
7
  import { PublicProps } from 'vue';
8
8
  import { Ref } from 'vue';
9
+ import { RendererElement } from 'vue';
10
+ import { RendererNode } from 'vue';
11
+ import { VNode } from 'vue';
9
12
 
10
13
  declare type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
11
14
 
12
- declare type __VLS_NonUndefinedable_2<T> = T extends undefined ? never : T;
13
-
14
15
  declare type __VLS_TypePropsToRuntimeProps<T> = {
15
16
  [K in keyof T]-?: {} extends Pick<T, K> ? {
16
17
  type: PropType<__VLS_NonUndefinedable<T[K]>>;
@@ -20,15 +21,6 @@ declare type __VLS_TypePropsToRuntimeProps<T> = {
20
21
  };
21
22
  };
22
23
 
23
- declare type __VLS_TypePropsToRuntimeProps_2<T> = {
24
- [K in keyof T]-?: {} extends Pick<T, K> ? {
25
- type: PropType<__VLS_NonUndefinedable_2<T[K]>>;
26
- } : {
27
- type: PropType<T[K]>;
28
- required: true;
29
- };
30
- };
31
-
32
24
  declare type __VLS_WithTemplateSlots<T, S> = T & {
33
25
  new (): {
34
26
  $slots: S;
@@ -242,27 +234,24 @@ declare class TextEditorStore {
242
234
  selectAll(): void;
243
235
  }
244
236
 
245
- export declare const TextEditorView: DefineComponent<__VLS_TypePropsToRuntimeProps_2<{
246
- modelValue: {
247
- text: string;
248
- styles?: Style[];
249
- type?: string;
250
- }[] | string;
251
- decorator?: Decorator | undefined;
252
- parser?: TextParser | undefined;
253
- styles?: Style[] | undefined;
254
- preventMultiline?: boolean | undefined;
255
- }>, {}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ExtractPropTypes<__VLS_TypePropsToRuntimeProps_2<{
256
- modelValue: {
257
- text: string;
258
- styles?: Style[];
259
- type?: string;
260
- }[] | string;
261
- decorator?: Decorator | undefined;
262
- parser?: TextParser | undefined;
263
- styles?: Style[] | undefined;
264
- preventMultiline?: boolean | undefined;
265
- }>>>, {}, {}>;
237
+ export declare const TextEditorView: DefineComponent<Readonly<{
238
+ styles?: any;
239
+ decorator?: any;
240
+ parser?: any;
241
+ modelValue?: any;
242
+ }>, () => VNode<RendererNode, RendererElement, {
243
+ [key: string]: any;
244
+ }>, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ExtractPropTypes<Readonly<{
245
+ styles?: any;
246
+ decorator?: any;
247
+ parser?: any;
248
+ modelValue?: any;
249
+ }>>>, {
250
+ readonly styles?: any;
251
+ readonly decorator?: any;
252
+ readonly parser?: any;
253
+ readonly modelValue?: any;
254
+ }, {}>;
266
255
 
267
256
  declare type TextParser = (text: string) => Style[];
268
257
 
package/dist/vuewrite.js CHANGED
@@ -666,8 +666,12 @@ const _sfc_main$2 = defineComponent({
666
666
  return h(elementTag, attrs, text);
667
667
  };
668
668
  return () => {
669
- if (slot.value)
670
- return h(slot.value, { content, props: blockProps, block: props.block });
669
+ if (slot.value) {
670
+ const component = slot.value({ content, props: blockProps, block: props.block });
671
+ if (Array.isArray(component) && component.length === 1)
672
+ return component[0];
673
+ return component;
674
+ }
671
675
  return h("div", blockProps, content());
672
676
  };
673
677
  }
@@ -913,38 +917,23 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
913
917
  };
914
918
  }
915
919
  });
916
- const _sfc_main = /* @__PURE__ */ defineComponent({
917
- __name: "TextEditorView",
918
- props: {
919
- modelValue: {},
920
- decorator: { type: Function },
921
- parser: {},
922
- styles: {},
923
- preventMultiline: { type: Boolean }
924
- },
925
- setup(__props) {
926
- const props = __props;
927
- const slots = useSlots();
920
+ const _sfc_main = defineComponent({
921
+ props: ["modelValue", "decorator", "parser", "styles"],
922
+ setup(props, { slots }) {
928
923
  const blocks = computed(() => {
929
924
  if (Array.isArray(props.modelValue)) {
930
925
  return props.modelValue;
931
926
  }
932
927
  return [{ text: props.modelValue, styles: props.styles ?? [] }];
933
928
  });
934
- return (_ctx, _cache) => {
935
- return openBlock(), createElementBlock("div", null, [
936
- (openBlock(true), createElementBlock(Fragment, null, renderList(blocks.value, (block) => {
937
- return openBlock(), createBlock(_sfc_main$2, {
938
- key: block.id,
939
- block,
940
- slots: unref(slots),
941
- decorator: props.decorator,
942
- parser: props.parser,
943
- static: ""
944
- }, null, 8, ["block", "slots", "decorator", "parser"]);
945
- }), 128))
946
- ]);
947
- };
929
+ return () => h("div", blocks.value.map((block) => h(_sfc_main$2, {
930
+ key: block.id,
931
+ block,
932
+ slots,
933
+ decorator: props.decorator,
934
+ parser: props.parser,
935
+ static: true
936
+ })));
948
937
  }
949
938
  });
950
939
  export {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "vuewrite",
3
3
  "description": "Rich Text Editor based on Vue3 reactivity",
4
4
  "private": false,
5
- "version": "0.0.16",
5
+ "version": "0.0.18",
6
6
  "type": "module",
7
7
  "license": "MIT",
8
8
  "author": "den59k",