@inshapardaz/likhari-vue 0.0.0-stage → 0.1.2
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/likhari-vue.js +78 -0
- package/package.json +42 -4
- package/README.md +0 -3
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { defineComponent as v, ref as c, onMounted as h, onBeforeUnmount as f, watch as s, h as g } from "vue";
|
|
2
|
+
import "@inshapardaz/likhari-webcomponent";
|
|
3
|
+
function m(e) {
|
|
4
|
+
return {
|
|
5
|
+
"document-id": e.documentId ?? null,
|
|
6
|
+
locale: e.locale ?? null,
|
|
7
|
+
"color-scheme": e.colorScheme ?? null,
|
|
8
|
+
"accent-color": e.accentColor ?? null,
|
|
9
|
+
placeholder: e.placeholder ?? null,
|
|
10
|
+
height: e.height ?? null,
|
|
11
|
+
"show-save": e.showSave === void 0 ? null : e.showSave ? "" : "false",
|
|
12
|
+
autosave: e.autosave === void 0 ? null : e.autosave ? "" : "false",
|
|
13
|
+
"feature-preset": e.featurePreset ?? null,
|
|
14
|
+
"toolbar-bordered": e.toolbarBordered === void 0 ? null : e.toolbarBordered ? "" : "false",
|
|
15
|
+
"toolbar-variant": e.toolbarVariant ?? null,
|
|
16
|
+
"help-url": e.helpUrl === void 0 ? null : e.helpUrl === !1 ? "false" : e.helpUrl
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
const b = v({
|
|
20
|
+
name: "LikhariEditor",
|
|
21
|
+
props: {
|
|
22
|
+
documentId: String,
|
|
23
|
+
locale: String,
|
|
24
|
+
colorScheme: String,
|
|
25
|
+
accentColor: String,
|
|
26
|
+
placeholder: String,
|
|
27
|
+
height: String,
|
|
28
|
+
// Vue makes an absent Boolean prop false; `default: undefined` keeps "not set" distinct from false.
|
|
29
|
+
showSave: { type: Boolean, default: void 0 },
|
|
30
|
+
autosave: { type: Boolean, default: void 0 },
|
|
31
|
+
featurePreset: String,
|
|
32
|
+
toolbarBordered: { type: Boolean, default: void 0 },
|
|
33
|
+
toolbarVariant: String,
|
|
34
|
+
helpUrl: { type: [String, Boolean], default: void 0 },
|
|
35
|
+
featureConfig: Object
|
|
36
|
+
},
|
|
37
|
+
emits: {
|
|
38
|
+
change: (e) => e !== void 0,
|
|
39
|
+
save: (e) => e !== void 0
|
|
40
|
+
},
|
|
41
|
+
setup(e, { emit: o, expose: d }) {
|
|
42
|
+
const a = c(null), n = (t) => o("change", t.detail), r = (t) => o("save", t.detail), i = () => {
|
|
43
|
+
a.value && (a.value.featureConfig = e.featureConfig);
|
|
44
|
+
};
|
|
45
|
+
return h(() => {
|
|
46
|
+
var t, l;
|
|
47
|
+
(t = a.value) == null || t.addEventListener("editor-change", n), (l = a.value) == null || l.addEventListener("editor-save", r), i();
|
|
48
|
+
}), f(() => {
|
|
49
|
+
var t, l;
|
|
50
|
+
(t = a.value) == null || t.removeEventListener("editor-change", n), (l = a.value) == null || l.removeEventListener("editor-save", r);
|
|
51
|
+
}), s(() => e.featureConfig, i, { deep: !0 }), d({
|
|
52
|
+
getContent: (t) => {
|
|
53
|
+
var l;
|
|
54
|
+
return ((l = a.value) == null ? void 0 : l.getContent(t)) ?? "";
|
|
55
|
+
},
|
|
56
|
+
setContent: (t, l) => {
|
|
57
|
+
var u;
|
|
58
|
+
return (u = a.value) == null ? void 0 : u.setContent(t, l);
|
|
59
|
+
},
|
|
60
|
+
hasUnsavedChanges: () => {
|
|
61
|
+
var t;
|
|
62
|
+
return ((t = a.value) == null ? void 0 : t.hasUnsavedChanges()) ?? !1;
|
|
63
|
+
},
|
|
64
|
+
confirmDiscard: () => {
|
|
65
|
+
var t;
|
|
66
|
+
return ((t = a.value) == null ? void 0 : t.confirmDiscard()) ?? Promise.resolve(!0);
|
|
67
|
+
},
|
|
68
|
+
focus: () => {
|
|
69
|
+
var t;
|
|
70
|
+
return (t = a.value) == null ? void 0 : t.focus();
|
|
71
|
+
}
|
|
72
|
+
}), () => g("likhari-editor", { ref: a, ...m(e) });
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
export {
|
|
76
|
+
b as LikhariEditor,
|
|
77
|
+
m as toElementAttributes
|
|
78
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,44 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inshapardaz/likhari-vue",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "Vue 3 component for the Likhari editor, a thin wrapper over the <likhari-editor> Web Component.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/inshapardaz/likhari"
|
|
9
|
+
},
|
|
10
|
+
"type": "module",
|
|
11
|
+
"main": "./dist/likhari-vue.js",
|
|
12
|
+
"module": "./dist/likhari-vue.js",
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"import": "./dist/likhari-vue.js"
|
|
18
|
+
},
|
|
19
|
+
"./package.json": "./package.json"
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"dist"
|
|
23
|
+
],
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "npm run build --workspace @inshapardaz/likhari-webcomponent && vite build && tsc -p tsconfig.build.json",
|
|
29
|
+
"prepublishOnly": "npm run build"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@inshapardaz/likhari-converters": "*",
|
|
33
|
+
"@inshapardaz/likhari-core": "*",
|
|
34
|
+
"@inshapardaz/likhari-webcomponent": "*"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"vue": "^3.5.0"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"typescript": "^5.9.0",
|
|
41
|
+
"vite": "^5.4.10",
|
|
42
|
+
"vue": "^3.5.43"
|
|
43
|
+
}
|
|
44
|
+
}
|
package/README.md
DELETED