@inshapardaz/likhari-vue 0.1.2 → 0.1.3-dev.296
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/dist/LikhariEditor.d.ts +105 -0
- package/dist/LikhariEditor.d.ts.map +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/likhari-vue.js +32 -25
- package/package.json +1 -1
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { type PropType } from 'vue';
|
|
2
|
+
import '@inshapardaz/likhari-webcomponent';
|
|
3
|
+
import type { EditorFeatureConfig } from '@inshapardaz/likhari-core';
|
|
4
|
+
import type { FormatId } from '@inshapardaz/likhari-converters';
|
|
5
|
+
/**
|
|
6
|
+
* `<LikhariEditor>` for Vue. A thin wrapper over the `<likhari-editor>` Web
|
|
7
|
+
* Component: props become attributes, `featureConfig` is set as a property, and the
|
|
8
|
+
* element's `editor-change` and `editor-save` events are re-emitted as `change` and
|
|
9
|
+
* `save`. Template refs can call `getContent`, `setContent`, `hasUnsavedChanges`,
|
|
10
|
+
* `confirmDiscard` and `focus`, which are exposed below.
|
|
11
|
+
*/
|
|
12
|
+
export declare const LikhariEditor: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
13
|
+
documentId: StringConstructor;
|
|
14
|
+
locale: PropType<string>;
|
|
15
|
+
colorScheme: PropType<"light" | "dark">;
|
|
16
|
+
accentColor: StringConstructor;
|
|
17
|
+
placeholder: StringConstructor;
|
|
18
|
+
height: StringConstructor;
|
|
19
|
+
showSave: {
|
|
20
|
+
type: BooleanConstructor;
|
|
21
|
+
default: undefined;
|
|
22
|
+
};
|
|
23
|
+
autosave: {
|
|
24
|
+
type: BooleanConstructor;
|
|
25
|
+
default: undefined;
|
|
26
|
+
};
|
|
27
|
+
featurePreset: PropType<"minimal" | "standard" | "full" | "poetry">;
|
|
28
|
+
toolbarBordered: {
|
|
29
|
+
type: BooleanConstructor;
|
|
30
|
+
default: undefined;
|
|
31
|
+
};
|
|
32
|
+
toolbarVariant: PropType<"light" | "filled">;
|
|
33
|
+
helpUrl: {
|
|
34
|
+
type: PropType<string | false>;
|
|
35
|
+
default: undefined;
|
|
36
|
+
};
|
|
37
|
+
fontMode: PropType<"selective" | "uniform">;
|
|
38
|
+
fontFamily: StringConstructor;
|
|
39
|
+
zoom: {
|
|
40
|
+
type: NumberConstructor;
|
|
41
|
+
default: undefined;
|
|
42
|
+
};
|
|
43
|
+
featureConfig: PropType<EditorFeatureConfig>;
|
|
44
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
45
|
+
[key: string]: any;
|
|
46
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
47
|
+
change: (state: unknown) => state is {} | null;
|
|
48
|
+
save: (payload: {
|
|
49
|
+
content: string;
|
|
50
|
+
format: FormatId;
|
|
51
|
+
}) => boolean;
|
|
52
|
+
fontChange: (payload: {
|
|
53
|
+
fontFamily: string | undefined;
|
|
54
|
+
zoom: number;
|
|
55
|
+
}) => boolean;
|
|
56
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
57
|
+
documentId: StringConstructor;
|
|
58
|
+
locale: PropType<string>;
|
|
59
|
+
colorScheme: PropType<"light" | "dark">;
|
|
60
|
+
accentColor: StringConstructor;
|
|
61
|
+
placeholder: StringConstructor;
|
|
62
|
+
height: StringConstructor;
|
|
63
|
+
showSave: {
|
|
64
|
+
type: BooleanConstructor;
|
|
65
|
+
default: undefined;
|
|
66
|
+
};
|
|
67
|
+
autosave: {
|
|
68
|
+
type: BooleanConstructor;
|
|
69
|
+
default: undefined;
|
|
70
|
+
};
|
|
71
|
+
featurePreset: PropType<"minimal" | "standard" | "full" | "poetry">;
|
|
72
|
+
toolbarBordered: {
|
|
73
|
+
type: BooleanConstructor;
|
|
74
|
+
default: undefined;
|
|
75
|
+
};
|
|
76
|
+
toolbarVariant: PropType<"light" | "filled">;
|
|
77
|
+
helpUrl: {
|
|
78
|
+
type: PropType<string | false>;
|
|
79
|
+
default: undefined;
|
|
80
|
+
};
|
|
81
|
+
fontMode: PropType<"selective" | "uniform">;
|
|
82
|
+
fontFamily: StringConstructor;
|
|
83
|
+
zoom: {
|
|
84
|
+
type: NumberConstructor;
|
|
85
|
+
default: undefined;
|
|
86
|
+
};
|
|
87
|
+
featureConfig: PropType<EditorFeatureConfig>;
|
|
88
|
+
}>> & Readonly<{
|
|
89
|
+
onChange?: ((state: unknown) => any) | undefined;
|
|
90
|
+
onSave?: ((payload: {
|
|
91
|
+
content: string;
|
|
92
|
+
format: FormatId;
|
|
93
|
+
}) => any) | undefined;
|
|
94
|
+
onFontChange?: ((payload: {
|
|
95
|
+
fontFamily: string | undefined;
|
|
96
|
+
zoom: number;
|
|
97
|
+
}) => any) | undefined;
|
|
98
|
+
}>, {
|
|
99
|
+
showSave: boolean;
|
|
100
|
+
autosave: boolean;
|
|
101
|
+
toolbarBordered: boolean;
|
|
102
|
+
helpUrl: string | false;
|
|
103
|
+
zoom: number;
|
|
104
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
105
|
+
//# sourceMappingURL=LikhariEditor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LikhariEditor.d.ts","sourceRoot":"","sources":["../src/LikhariEditor.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8D,KAAK,QAAQ,EAAE,MAAM,KAAK,CAAC;AAChG,OAAO,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAahE;;;;;;GAMG;AACH,eAAO,MAAM,aAAa;;YAIJ,QAAQ,CAAC,MAAM,CAAC;iBACX,QAAQ,CAAC,OAAO,GAAG,MAAM,CAAC;;;;;;;;;;;;mBAOxB,QAAQ,CAAC,SAAS,GAAG,UAAU,GAAG,MAAM,GAAG,QAAQ,CAAC;;;;;oBAEnD,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC;;cAChB,QAAQ,CAAC,MAAM,GAAG,KAAK,CAAC;;;cAC1C,QAAQ,CAAC,WAAW,GAAG,SAAS,CAAC;;;;;;mBAG5B,QAAQ,CAAC,mBAAmB,CAAC;;;;oBAGtC,OAAO;oBACP;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,QAAQ,CAAA;KAAE;0BAC/B;QAAE,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE;;;YApBpD,QAAQ,CAAC,MAAM,CAAC;iBACX,QAAQ,CAAC,OAAO,GAAG,MAAM,CAAC;;;;;;;;;;;;mBAOxB,QAAQ,CAAC,SAAS,GAAG,UAAU,GAAG,MAAM,GAAG,QAAQ,CAAC;;;;;oBAEnD,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC;;cAChB,QAAQ,CAAC,MAAM,GAAG,KAAK,CAAC;;;cAC1C,QAAQ,CAAC,WAAW,GAAG,SAAS,CAAC;;;;;;mBAG5B,QAAQ,CAAC,mBAAmB,CAAC;;;;iBAI3B,MAAM;gBAAU,QAAQ;;;oBACf,MAAM,GAAG,SAAS;cAAQ,MAAM;;;;;;;;4EAsCtE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,YAAY,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/likhari-vue.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as f, ref as c, onMounted as h, onBeforeUnmount as g, watch as s, h as m } from "vue";
|
|
2
2
|
import "@inshapardaz/likhari-webcomponent";
|
|
3
|
-
function
|
|
3
|
+
function C(e) {
|
|
4
4
|
return {
|
|
5
5
|
"document-id": e.documentId ?? null,
|
|
6
6
|
locale: e.locale ?? null,
|
|
@@ -13,10 +13,13 @@ function m(e) {
|
|
|
13
13
|
"feature-preset": e.featurePreset ?? null,
|
|
14
14
|
"toolbar-bordered": e.toolbarBordered === void 0 ? null : e.toolbarBordered ? "" : "false",
|
|
15
15
|
"toolbar-variant": e.toolbarVariant ?? null,
|
|
16
|
-
"help-url": e.helpUrl === void 0 ? null : e.helpUrl === !1 ? "false" : e.helpUrl
|
|
16
|
+
"help-url": e.helpUrl === void 0 ? null : e.helpUrl === !1 ? "false" : e.helpUrl,
|
|
17
|
+
"font-mode": e.fontMode ?? null,
|
|
18
|
+
"font-family": e.fontFamily ?? null,
|
|
19
|
+
zoom: e.zoom === void 0 ? null : String(e.zoom)
|
|
17
20
|
};
|
|
18
21
|
}
|
|
19
|
-
const
|
|
22
|
+
const y = f({
|
|
20
23
|
name: "LikhariEditor",
|
|
21
24
|
props: {
|
|
22
25
|
documentId: String,
|
|
@@ -32,47 +35,51 @@ const b = v({
|
|
|
32
35
|
toolbarBordered: { type: Boolean, default: void 0 },
|
|
33
36
|
toolbarVariant: String,
|
|
34
37
|
helpUrl: { type: [String, Boolean], default: void 0 },
|
|
38
|
+
fontMode: String,
|
|
39
|
+
fontFamily: String,
|
|
40
|
+
zoom: { type: Number, default: void 0 },
|
|
35
41
|
featureConfig: Object
|
|
36
42
|
},
|
|
37
43
|
emits: {
|
|
38
44
|
change: (e) => e !== void 0,
|
|
39
|
-
save: (e) => e !== void 0
|
|
45
|
+
save: (e) => e !== void 0,
|
|
46
|
+
fontChange: (e) => e !== void 0
|
|
40
47
|
},
|
|
41
|
-
setup(e, { emit:
|
|
42
|
-
const
|
|
43
|
-
|
|
48
|
+
setup(e, { emit: l, expose: v }) {
|
|
49
|
+
const o = c(null), r = (t) => l("change", t.detail), i = (t) => l("save", t.detail), d = (t) => l("fontChange", t.detail), u = () => {
|
|
50
|
+
o.value && (o.value.featureConfig = e.featureConfig);
|
|
44
51
|
};
|
|
45
52
|
return h(() => {
|
|
46
|
-
var t,
|
|
47
|
-
(t =
|
|
48
|
-
}),
|
|
49
|
-
var t,
|
|
50
|
-
(t =
|
|
51
|
-
}), s(() => e.featureConfig,
|
|
53
|
+
var t, n, a;
|
|
54
|
+
(t = o.value) == null || t.addEventListener("editor-change", r), (n = o.value) == null || n.addEventListener("editor-save", i), (a = o.value) == null || a.addEventListener("editor-font-change", d), u();
|
|
55
|
+
}), g(() => {
|
|
56
|
+
var t, n, a;
|
|
57
|
+
(t = o.value) == null || t.removeEventListener("editor-change", r), (n = o.value) == null || n.removeEventListener("editor-save", i), (a = o.value) == null || a.removeEventListener("editor-font-change", d);
|
|
58
|
+
}), s(() => e.featureConfig, u, { deep: !0 }), v({
|
|
52
59
|
getContent: (t) => {
|
|
53
|
-
var
|
|
54
|
-
return ((
|
|
60
|
+
var n;
|
|
61
|
+
return ((n = o.value) == null ? void 0 : n.getContent(t)) ?? "";
|
|
55
62
|
},
|
|
56
|
-
setContent: (t,
|
|
57
|
-
var
|
|
58
|
-
return (
|
|
63
|
+
setContent: (t, n) => {
|
|
64
|
+
var a;
|
|
65
|
+
return (a = o.value) == null ? void 0 : a.setContent(t, n);
|
|
59
66
|
},
|
|
60
67
|
hasUnsavedChanges: () => {
|
|
61
68
|
var t;
|
|
62
|
-
return ((t =
|
|
69
|
+
return ((t = o.value) == null ? void 0 : t.hasUnsavedChanges()) ?? !1;
|
|
63
70
|
},
|
|
64
71
|
confirmDiscard: () => {
|
|
65
72
|
var t;
|
|
66
|
-
return ((t =
|
|
73
|
+
return ((t = o.value) == null ? void 0 : t.confirmDiscard()) ?? Promise.resolve(!0);
|
|
67
74
|
},
|
|
68
75
|
focus: () => {
|
|
69
76
|
var t;
|
|
70
|
-
return (t =
|
|
77
|
+
return (t = o.value) == null ? void 0 : t.focus();
|
|
71
78
|
}
|
|
72
|
-
}), () =>
|
|
79
|
+
}), () => m("likhari-editor", { ref: o, ...C(e) });
|
|
73
80
|
}
|
|
74
81
|
});
|
|
75
82
|
export {
|
|
76
|
-
|
|
77
|
-
|
|
83
|
+
y as LikhariEditor,
|
|
84
|
+
C as toElementAttributes
|
|
78
85
|
};
|
package/package.json
CHANGED