@hcengineering/templates 0.7.0

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/lib/index.js ADDED
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var index_exports = {};
20
+ __export(index_exports, {
21
+ default: () => index_default,
22
+ templateFieldRegexp: () => templateFieldRegexp,
23
+ templatesId: () => templatesId
24
+ });
25
+ module.exports = __toCommonJS(index_exports);
26
+ var import_platform = require("@hcengineering/platform");
27
+ const templateFieldRegexp = /\$\{(\S+?)}/gi;
28
+ const templatesId = "templates";
29
+ var index_default = (0, import_platform.plugin)(templatesId, {
30
+ class: {
31
+ MessageTemplate: "",
32
+ TemplateCategory: "",
33
+ TemplateField: "",
34
+ TemplateFieldCategory: ""
35
+ },
36
+ component: {
37
+ TemplatePopup: ""
38
+ },
39
+ string: {
40
+ Template: ""
41
+ },
42
+ space: {
43
+ Templates: ""
44
+ },
45
+ icon: {
46
+ Templates: "",
47
+ Template: "",
48
+ Copy: ""
49
+ },
50
+ function: {
51
+ GetTemplateDataProvider: ""
52
+ }
53
+ });
54
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/index.ts"],
4
+ "sourcesContent": ["//\n// Copyright \u00A9 2020, 2021 Anticrm Platform Contributors.\n//\n// Licensed under the Eclipse Public License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License. You may\n// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n//\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n\nimport type { Class, Doc, Markup, Ref, Space } from '@hcengineering/core'\nimport type { IntlString, Plugin, Resource, Asset } from '@hcengineering/platform'\nimport { plugin } from '@hcengineering/platform'\nimport { type AnyComponent } from '@hcengineering/ui/src/types'\n\n/**\n * @public\n */\nexport interface TemplateCategory extends Space {}\n\n/**\n * @public\n */\nexport interface MessageTemplate extends Doc {\n space: Ref<TemplateCategory>\n title: string\n message: Markup\n}\n\n/**\n * @public\n */\nexport interface TemplateData {\n owner: string\n data: any\n}\n\n/**\n * @public\n */\nexport interface TemplateDataProvider {\n set: (key: Ref<Class<Doc>>, value: any) => void\n get: (key: Ref<Class<Doc>>) => any | undefined\n fillTemplate: (message: string) => Promise<string>\n destroy: () => void\n}\n\n/**\n * @public\n */\nexport interface TemplateFieldCategory extends Doc {\n label: IntlString\n}\n\n/**\n * @public\n */\nexport declare type TemplateFieldFunc = (provider: TemplateDataProvider) => Promise<string | undefined>\n\n/**\n * @public\n */\nexport interface TemplateField extends Doc {\n category: Ref<TemplateFieldCategory>\n label: IntlString\n func: Resource<TemplateFieldFunc>\n}\n\nexport const templateFieldRegexp = /\\$\\{(\\S+?)}/gi\n\n/**\n * @public\n */\nexport const templatesId = 'templates' as Plugin\n\nexport default plugin(templatesId, {\n class: {\n MessageTemplate: '' as Ref<Class<MessageTemplate>>,\n TemplateCategory: '' as Ref<Class<TemplateCategory>>,\n TemplateField: '' as Ref<Class<TemplateField>>,\n TemplateFieldCategory: '' as Ref<Class<TemplateFieldCategory>>\n },\n component: {\n TemplatePopup: '' as AnyComponent\n },\n string: {\n Template: '' as IntlString\n },\n space: {\n Templates: '' as Ref<TemplateCategory>\n },\n icon: {\n Templates: '' as Asset,\n Template: '' as Asset,\n Copy: '' as Asset\n },\n function: {\n GetTemplateDataProvider: '' as Resource<() => TemplateDataProvider>\n }\n})\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBA,sBAAuB;AAwDhB,MAAM,sBAAsB;AAK5B,MAAM,cAAc;AAE3B,IAAO,oBAAQ,wBAAO,aAAa;AAAA,EACjC,OAAO;AAAA,IACL,iBAAiB;AAAA,IACjB,kBAAkB;AAAA,IAClB,eAAe;AAAA,IACf,uBAAuB;AAAA,EACzB;AAAA,EACA,WAAW;AAAA,IACT,eAAe;AAAA,EACjB;AAAA,EACA,QAAQ;AAAA,IACN,UAAU;AAAA,EACZ;AAAA,EACA,OAAO;AAAA,IACL,WAAW;AAAA,EACb;AAAA,EACA,MAAM;AAAA,IACJ,WAAW;AAAA,IACX,UAAU;AAAA,IACV,MAAM;AAAA,EACR;AAAA,EACA,UAAU;AAAA,IACR,yBAAyB;AAAA,EAC3B;AACF,CAAC;",
6
+ "names": []
7
+ }
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@hcengineering/templates",
3
+ "version": "0.7.0",
4
+ "main": "lib/index.js",
5
+ "svelte": "src/index.ts",
6
+ "types": "types/index.d.ts",
7
+ "files": [
8
+ "lib/**/*",
9
+ "types/**/*",
10
+ "tsconfig.json"
11
+ ],
12
+ "author": "Anticrm Platform Contributors",
13
+ "license": "EPL-2.0",
14
+ "scripts": {
15
+ "build": "compile",
16
+ "build:watch": "compile",
17
+ "format": "format src",
18
+ "test": "jest --passWithNoTests --silent",
19
+ "_phase:build": "compile transpile src",
20
+ "_phase:test": "jest --passWithNoTests --silent",
21
+ "_phase:format": "format src",
22
+ "_phase:validate": "compile validate"
23
+ },
24
+ "devDependencies": {
25
+ "@hcengineering/platform-rig": "^0.7.10",
26
+ "@typescript-eslint/eslint-plugin": "^6.11.0",
27
+ "eslint-plugin-import": "^2.26.0",
28
+ "eslint-plugin-promise": "^6.1.1",
29
+ "eslint-plugin-n": "^15.4.0",
30
+ "eslint": "^8.54.0",
31
+ "@typescript-eslint/parser": "^6.11.0",
32
+ "eslint-config-standard-with-typescript": "^40.0.0",
33
+ "prettier": "^3.1.0",
34
+ "typescript": "^5.8.3",
35
+ "jest": "^29.7.0",
36
+ "ts-jest": "^29.1.1",
37
+ "@types/jest": "^29.5.5"
38
+ },
39
+ "dependencies": {
40
+ "@hcengineering/platform": "^0.7.3",
41
+ "@hcengineering/core": "^0.7.3",
42
+ "@hcengineering/ui": "^0.7.0"
43
+ },
44
+ "repository": "https://github.com/hcengineering/platform",
45
+ "publishConfig": {
46
+ "access": "public"
47
+ }
48
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "extends": "./node_modules/@hcengineering/platform-rig/profiles/default/tsconfig.json",
3
+
4
+ "compilerOptions": {
5
+ "rootDir": "./src",
6
+ "outDir": "./lib",
7
+ "declarationDir": "./types",
8
+ "tsBuildInfoFile": ".build/build.tsbuildinfo"
9
+ },
10
+ "include": ["src/**/*"],
11
+ "exclude": ["node_modules", "lib", "dist", "types", "bundle"]
12
+ }
@@ -0,0 +1,82 @@
1
+ import type { Class, Doc, Markup, Ref, Space } from '@hcengineering/core';
2
+ import type { IntlString, Plugin, Resource, Asset } from '@hcengineering/platform';
3
+ import { type AnyComponent } from '@hcengineering/ui/src/types';
4
+ /**
5
+ * @public
6
+ */
7
+ export interface TemplateCategory extends Space {
8
+ }
9
+ /**
10
+ * @public
11
+ */
12
+ export interface MessageTemplate extends Doc {
13
+ space: Ref<TemplateCategory>;
14
+ title: string;
15
+ message: Markup;
16
+ }
17
+ /**
18
+ * @public
19
+ */
20
+ export interface TemplateData {
21
+ owner: string;
22
+ data: any;
23
+ }
24
+ /**
25
+ * @public
26
+ */
27
+ export interface TemplateDataProvider {
28
+ set: (key: Ref<Class<Doc>>, value: any) => void;
29
+ get: (key: Ref<Class<Doc>>) => any | undefined;
30
+ fillTemplate: (message: string) => Promise<string>;
31
+ destroy: () => void;
32
+ }
33
+ /**
34
+ * @public
35
+ */
36
+ export interface TemplateFieldCategory extends Doc {
37
+ label: IntlString;
38
+ }
39
+ /**
40
+ * @public
41
+ */
42
+ export declare type TemplateFieldFunc = (provider: TemplateDataProvider) => Promise<string | undefined>;
43
+ /**
44
+ * @public
45
+ */
46
+ export interface TemplateField extends Doc {
47
+ category: Ref<TemplateFieldCategory>;
48
+ label: IntlString;
49
+ func: Resource<TemplateFieldFunc>;
50
+ }
51
+ export declare const templateFieldRegexp: RegExp;
52
+ /**
53
+ * @public
54
+ */
55
+ export declare const templatesId: Plugin;
56
+ declare const _default: {
57
+ class: {
58
+ MessageTemplate: Ref<Class<MessageTemplate>>;
59
+ TemplateCategory: Ref<Class<TemplateCategory>>;
60
+ TemplateField: Ref<Class<TemplateField>>;
61
+ TemplateFieldCategory: Ref<Class<TemplateFieldCategory>>;
62
+ };
63
+ component: {
64
+ TemplatePopup: AnyComponent;
65
+ };
66
+ string: {
67
+ Template: IntlString;
68
+ };
69
+ space: {
70
+ Templates: Ref<TemplateCategory>;
71
+ };
72
+ icon: {
73
+ Templates: Asset;
74
+ Template: Asset;
75
+ Copy: Asset;
76
+ };
77
+ function: {
78
+ GetTemplateDataProvider: Resource<() => TemplateDataProvider>;
79
+ };
80
+ };
81
+ export default _default;
82
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AACzE,OAAO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