@inshapardaz/likhari-vue 0.0.0-stage → 0.1.2-dev.291
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 +84 -0
- package/dist/LikhariEditor.d.ts.map +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/likhari-vue.js +78 -0
- package/package.json +42 -4
- package/README.md +0 -3
|
@@ -0,0 +1,84 @@
|
|
|
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
|
+
featureConfig: PropType<EditorFeatureConfig>;
|
|
38
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
39
|
+
[key: string]: any;
|
|
40
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
41
|
+
change: (state: unknown) => state is {} | null;
|
|
42
|
+
save: (payload: {
|
|
43
|
+
content: string;
|
|
44
|
+
format: FormatId;
|
|
45
|
+
}) => boolean;
|
|
46
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
47
|
+
documentId: StringConstructor;
|
|
48
|
+
locale: PropType<string>;
|
|
49
|
+
colorScheme: PropType<"light" | "dark">;
|
|
50
|
+
accentColor: StringConstructor;
|
|
51
|
+
placeholder: StringConstructor;
|
|
52
|
+
height: StringConstructor;
|
|
53
|
+
showSave: {
|
|
54
|
+
type: BooleanConstructor;
|
|
55
|
+
default: undefined;
|
|
56
|
+
};
|
|
57
|
+
autosave: {
|
|
58
|
+
type: BooleanConstructor;
|
|
59
|
+
default: undefined;
|
|
60
|
+
};
|
|
61
|
+
featurePreset: PropType<"minimal" | "standard" | "full" | "poetry">;
|
|
62
|
+
toolbarBordered: {
|
|
63
|
+
type: BooleanConstructor;
|
|
64
|
+
default: undefined;
|
|
65
|
+
};
|
|
66
|
+
toolbarVariant: PropType<"light" | "filled">;
|
|
67
|
+
helpUrl: {
|
|
68
|
+
type: PropType<string | false>;
|
|
69
|
+
default: undefined;
|
|
70
|
+
};
|
|
71
|
+
featureConfig: PropType<EditorFeatureConfig>;
|
|
72
|
+
}>> & Readonly<{
|
|
73
|
+
onChange?: ((state: unknown) => any) | undefined;
|
|
74
|
+
onSave?: ((payload: {
|
|
75
|
+
content: string;
|
|
76
|
+
format: FormatId;
|
|
77
|
+
}) => any) | undefined;
|
|
78
|
+
}>, {
|
|
79
|
+
showSave: boolean;
|
|
80
|
+
autosave: boolean;
|
|
81
|
+
toolbarBordered: boolean;
|
|
82
|
+
helpUrl: string | false;
|
|
83
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
84
|
+
//# 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;;;mBACrC,QAAQ,CAAC,mBAAmB,CAAC;;;;oBAGtC,OAAO;oBACP;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,QAAQ,CAAA;KAAE;;;YAhBnC,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;;;mBACrC,QAAQ,CAAC,mBAAmB,CAAC;;;;iBAI3B,MAAM;gBAAU,QAAQ;;;;;;;4EAmCrD,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"}
|
|
@@ -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-dev.291",
|
|
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