diff --git a/.vscode/launch.json b/.vscode/launch.json index 0131da5761..b7eec7f4f1 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -13,7 +13,10 @@ "ELASTIC_URL": "http://localhost:9200", "MONGO_URL": "mongodb://localhost:27017", "APM_SERVER_URL2": "http://localhost:8200", - "METRICS_CONSOLE": "true" // Show metrics in console evert 30 seconds. + "METRICS_CONSOLE": "true", // Show metrics in console evert 30 seconds., + "MINIO_ENDPOINT": "localhost", + "MINIO_ACCESS_KEY":"minioadmin", + "MINIO_SECRET_KEY":"minioadmin" }, "runtimeArgs": ["--nolazy", "-r", "ts-node/register"], "sourceMaps": true, diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index e9efd89f1a..cd021f95c3 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -64,6 +64,8 @@ specifiers: '@rush-temp/model-setting': file:./projects/model-setting.tgz '@rush-temp/model-task': file:./projects/model-task.tgz '@rush-temp/model-telegram': file:./projects/model-telegram.tgz + '@rush-temp/model-templates': file:./projects/model-templates.tgz + '@rush-temp/model-text-editor': file:./projects/model-text-editor.tgz '@rush-temp/model-view': file:./projects/model-view.tgz '@rush-temp/model-workbench': file:./projects/model-workbench.tgz '@rush-temp/mongo': file:./projects/mongo.tgz @@ -93,6 +95,9 @@ specifiers: '@rush-temp/telegram': file:./projects/telegram.tgz '@rush-temp/telegram-assets': file:./projects/telegram-assets.tgz '@rush-temp/telegram-resources': file:./projects/telegram-resources.tgz + '@rush-temp/templates': file:./projects/templates.tgz + '@rush-temp/templates-assets': file:./projects/templates-assets.tgz + '@rush-temp/templates-resources': file:./projects/templates-resources.tgz '@rush-temp/text-editor': file:./projects/text-editor.tgz '@rush-temp/theme': file:./projects/theme.tgz '@rush-temp/tool': file:./projects/tool.tgz @@ -249,6 +254,8 @@ dependencies: '@rush-temp/model-setting': file:projects/model-setting.tgz_typescript@4.5.4 '@rush-temp/model-task': file:projects/model-task.tgz_typescript@4.5.4 '@rush-temp/model-telegram': file:projects/model-telegram.tgz_typescript@4.5.4 + '@rush-temp/model-templates': file:projects/model-templates.tgz_typescript@4.5.4 + '@rush-temp/model-text-editor': file:projects/model-text-editor.tgz_typescript@4.5.4 '@rush-temp/model-view': file:projects/model-view.tgz_typescript@4.5.4 '@rush-temp/model-workbench': file:projects/model-workbench.tgz_typescript@4.5.4 '@rush-temp/mongo': file:projects/mongo.tgz @@ -278,6 +285,9 @@ dependencies: '@rush-temp/telegram': file:projects/telegram.tgz '@rush-temp/telegram-assets': file:projects/telegram-assets.tgz '@rush-temp/telegram-resources': file:projects/telegram-resources.tgz_096c09b0b673a57c275d9767a12070b1 + '@rush-temp/templates': file:projects/templates.tgz + '@rush-temp/templates-assets': file:projects/templates-assets.tgz + '@rush-temp/templates-resources': file:projects/templates-resources.tgz_096c09b0b673a57c275d9767a12070b1 '@rush-temp/text-editor': file:projects/text-editor.tgz_096c09b0b673a57c275d9767a12070b1 '@rush-temp/theme': file:projects/theme.tgz_096c09b0b673a57c275d9767a12070b1 '@rush-temp/tool': file:projects/tool.tgz @@ -11636,7 +11646,7 @@ packages: dev: false file:projects/model-all.tgz_typescript@4.5.4: - resolution: {integrity: sha512-xDbSAT10XpV9IMIWZmkZF1DKtDmPuh++4I5oxtxRHGrrdJ1h0J37nkAmZ6AayfWgqaCXG8EBn+SplvLw07HESg==, tarball: file:projects/model-all.tgz} + resolution: {integrity: sha512-5WhGhRWED9z51QVhlJWZJ321v4zkTY33gwVOdMVHidlhnmKJ2LPWfIN8Gs1K2I0Z2Gea3GfcgDbSrTYSGQd7bw==, tarball: file:projects/model-all.tgz} id: file:projects/model-all.tgz name: '@rush-temp/model-all' version: 0.0.0 @@ -12015,6 +12025,48 @@ packages: - typescript dev: false + file:projects/model-templates.tgz_typescript@4.5.4: + resolution: {integrity: sha512-yX+lWtzx5DiEX8LI6I8/XaAw+RkthYZgqVcAEvpL7vraVJHwSukdKHyHXRu6XdGAyXeMdlgPcwD9xF6CQts5gA==, tarball: file:projects/model-templates.tgz} + id: file:projects/model-templates.tgz + name: '@rush-temp/model-templates' + version: 0.0.0 + dependencies: + '@rushstack/heft': 0.41.8 + '@types/heft-jest': 1.0.2 + '@typescript-eslint/eslint-plugin': 5.7.0_c25e8c1f4f4f7aaed27aa6f9ce042237 + '@typescript-eslint/parser': 5.7.0_eslint@7.32.0+typescript@4.5.4 + eslint: 7.32.0 + eslint-config-standard-with-typescript: 21.0.1_ce2fa0c4dfa1c256100cababd749a13a + eslint-plugin-import: 2.25.3_eslint@7.32.0 + eslint-plugin-node: 11.1.0_eslint@7.32.0 + eslint-plugin-promise: 5.2.0_eslint@7.32.0 + prettier: 2.5.1 + transitivePeerDependencies: + - supports-color + - typescript + dev: false + + file:projects/model-text-editor.tgz_typescript@4.5.4: + resolution: {integrity: sha512-2B69wwO38YusKx2s2f+p0sf+2ExNVFMTqO41+2SJKIQCfVF6vshEOn9HS3m93V5xIlZ3wJmVW5vl5b5x0beF1g==, tarball: file:projects/model-text-editor.tgz} + id: file:projects/model-text-editor.tgz + name: '@rush-temp/model-text-editor' + version: 0.0.0 + dependencies: + '@rushstack/heft': 0.41.8 + '@types/heft-jest': 1.0.2 + '@typescript-eslint/eslint-plugin': 5.7.0_c25e8c1f4f4f7aaed27aa6f9ce042237 + '@typescript-eslint/parser': 5.7.0_eslint@7.32.0+typescript@4.5.4 + eslint: 7.32.0 + eslint-config-standard-with-typescript: 21.0.1_ce2fa0c4dfa1c256100cababd749a13a + eslint-plugin-import: 2.25.3_eslint@7.32.0 + eslint-plugin-node: 11.1.0_eslint@7.32.0 + eslint-plugin-promise: 5.2.0_eslint@7.32.0 + prettier: 2.5.1 + transitivePeerDependencies: + - supports-color + - typescript + dev: false + file:projects/model-view.tgz_typescript@4.5.4: resolution: {integrity: sha512-Nw3Id7t/uufJKYSapqk8INj5vMWLppU+gjcKnDD4tNoTtbbr/Zfe9NNwpcieZBJphJ0BpMTs1vYBmlZUTEQinw==, tarball: file:projects/model-view.tgz} id: file:projects/model-view.tgz @@ -12252,7 +12304,7 @@ packages: dev: false file:projects/prod.tgz_sass@1.45.0+typescript@4.5.4: - resolution: {integrity: sha512-FWLkhyyIA2ZiXuydQap4fYlvfq02Q18A0fjVgVmy/7Wedebed2Xj6n2uQVjDVN50a5EP+5CutRcLAuxs7bI4Vw==, tarball: file:projects/prod.tgz} + resolution: {integrity: sha512-TRuJuHrFjTf/GKVoEbO9fUjFNW/dRPVDdYd8HyhpTr26o8RpI8yCYWasAX/V7nJiMRXL06FbEp0vwjMh1odogQ==, tarball: file:projects/prod.tgz} id: file:projects/prod.tgz name: '@rush-temp/prod' version: 0.0.0 @@ -12553,7 +12605,7 @@ packages: dev: false file:projects/setting-resources.tgz_096c09b0b673a57c275d9767a12070b1: - resolution: {integrity: sha512-KNZjL1XCVMDaeEnRfQBi4JAMjdg5aUyf6jrCrLGMZfG8Keq4JjHKqCNGVQ+xaYFZcQrEifs7M5OD9D6oimC4ag==, tarball: file:projects/setting-resources.tgz} + resolution: {integrity: sha512-64E4dI7SY+8qkmtk5dn8wbbxOSOqM+AD4Xh+i0BTv09Fhafe/TAcYLdByY5jzVkLmBohrYgBioZJcPbmulsvXg==, tarball: file:projects/setting-resources.tgz} id: file:projects/setting-resources.tgz name: '@rush-temp/setting-resources' version: 0.0.0 @@ -12745,6 +12797,82 @@ packages: - supports-color dev: false + file:projects/templates-assets.tgz: + resolution: {integrity: sha512-ZmNp9/xT3bhobdqstxRpaa+ddU1K3WLzF1ErI6L+cARerFsrgeG0g7+DaaMpd4QIv4Ip3+3MhDIbvjq8JCKE4g==, tarball: file:projects/templates-assets.tgz} + name: '@rush-temp/templates-assets' + version: 0.0.0 + dependencies: + '@rushstack/heft': 0.41.8 + '@types/heft-jest': 1.0.2 + '@types/node': 16.11.14 + '@typescript-eslint/eslint-plugin': 5.7.0_c25e8c1f4f4f7aaed27aa6f9ce042237 + '@typescript-eslint/parser': 5.7.0_eslint@7.32.0+typescript@4.5.4 + eslint: 7.32.0 + eslint-config-standard-with-typescript: 21.0.1_ce2fa0c4dfa1c256100cababd749a13a + eslint-plugin-import: 2.25.3_eslint@7.32.0 + eslint-plugin-node: 11.1.0_eslint@7.32.0 + eslint-plugin-promise: 5.2.0_eslint@7.32.0 + prettier: 2.5.1 + typescript: 4.5.4 + transitivePeerDependencies: + - supports-color + dev: false + + file:projects/templates-resources.tgz_096c09b0b673a57c275d9767a12070b1: + resolution: {integrity: sha512-dsQP6LQ9+rxBOtUE2GXjmu7lhsQUAtP3ZWdzfo58ncdXao64Dn8w2nYrrUZ9dz7rcxwOPP3oHsrK7N2Egs1CMw==, tarball: file:projects/templates-resources.tgz} + id: file:projects/templates-resources.tgz + name: '@rush-temp/templates-resources' + version: 0.0.0 + dependencies: + '@typescript-eslint/eslint-plugin': 5.7.0_c25e8c1f4f4f7aaed27aa6f9ce042237 + '@typescript-eslint/parser': 5.7.0_eslint@7.32.0+typescript@4.5.4 + eslint: 7.32.0 + eslint-config-standard-with-typescript: 21.0.1_ce2fa0c4dfa1c256100cababd749a13a + eslint-plugin-import: 2.25.3_eslint@7.32.0 + eslint-plugin-node: 11.1.0_eslint@7.32.0 + eslint-plugin-promise: 5.2.0_eslint@7.32.0 + eslint-plugin-svelte3: 3.2.1_eslint@7.32.0+svelte@3.44.3 + prettier: 2.5.1 + prettier-plugin-svelte: 2.5.1_prettier@2.5.1+svelte@3.44.3 + sass: 1.45.0 + svelte: 3.44.3 + svelte-check: 2.2.11_4374c622c67ed7479ff0e44c29d09bce + svelte-loader: 3.1.2_svelte@3.44.3 + svelte-preprocess: 4.10.1_14d64cad431e31f100de7363af24a44f + typescript: 4.5.4 + transitivePeerDependencies: + - '@babel/core' + - coffeescript + - less + - node-sass + - postcss + - postcss-load-config + - pug + - stylus + - sugarss + - supports-color + dev: false + + file:projects/templates.tgz: + resolution: {integrity: sha512-GRoSidgyl5TL1m7EI6J/XuUCM7aQ8zp5jH8yl8oDXPHG2rS2v+7pSz9ccBE/ynC0pUkxKL1oSgDRMq9eAXC4Ag==, tarball: file:projects/templates.tgz} + name: '@rush-temp/templates' + version: 0.0.0 + dependencies: + '@rushstack/heft': 0.41.8 + '@types/heft-jest': 1.0.2 + '@typescript-eslint/eslint-plugin': 5.7.0_c25e8c1f4f4f7aaed27aa6f9ce042237 + '@typescript-eslint/parser': 5.7.0_eslint@7.32.0+typescript@4.5.4 + eslint: 7.32.0 + eslint-config-standard-with-typescript: 21.0.1_ce2fa0c4dfa1c256100cababd749a13a + eslint-plugin-import: 2.25.3_eslint@7.32.0 + eslint-plugin-node: 11.1.0_eslint@7.32.0 + eslint-plugin-promise: 5.2.0_eslint@7.32.0 + prettier: 2.5.1 + typescript: 4.5.4 + transitivePeerDependencies: + - supports-color + dev: false + file:projects/text-editor.tgz_096c09b0b673a57c275d9767a12070b1: resolution: {integrity: sha512-mHTzsgBUTd2d3Y8xW1y8GOTLU0r4IyOsF7RpV1N4GVwaqnCZSxuFdC/T7PqX33XYI0hD6q+0KNegRs+MzvOeeg==, tarball: file:projects/text-editor.tgz} id: file:projects/text-editor.tgz diff --git a/dev/prod/package.json b/dev/prod/package.json index f8468e3799..4cc10743bd 100644 --- a/dev/prod/package.json +++ b/dev/prod/package.json @@ -93,6 +93,9 @@ "@anticrm/server-attachment": "~0.6.1", "@anticrm/server-attachment-resources": "~0.6.0", "@anticrm/server-contact": "~0.6.1", - "@anticrm/server-contact-resources": "~0.6.0" + "@anticrm/server-contact-resources": "~0.6.0", + "@anticrm/templates": "~0.6.0", + "@anticrm/templates-assets": "~0.6.0", + "@anticrm/templates-resources": "~0.6.0" } } diff --git a/dev/prod/src/platform.ts b/dev/prod/src/platform.ts index 8a0b7bfdef..db7653d796 100644 --- a/dev/prod/src/platform.ts +++ b/dev/prod/src/platform.ts @@ -31,6 +31,7 @@ import { clientId } from '@anticrm/client' import { gmailId } from '@anticrm/gmail' import { imageCropperId } from '@anticrm/image-cropper' import { inventoryId } from '@anticrm/inventory' +import { templatesId } from '@anticrm/templates' import '@anticrm/login-assets' import '@anticrm/task-assets' @@ -46,6 +47,7 @@ import '@anticrm/lead-assets' import '@anticrm/gmail-assets' import '@anticrm/workbench-assets' import '@anticrm/inventory-assets' +import '@anticrm/templates-assets' import { setMetadata } from '@anticrm/platform' export async function configurePlatform() { @@ -76,4 +78,5 @@ export async function configurePlatform() { addLocation(gmailId, () => import(/* webpackChunkName: "gmail" */ '@anticrm/gmail-resources')) addLocation(imageCropperId, () => import(/* webpackChunkName: "image-cropper" */ '@anticrm/image-cropper-resources')) addLocation(inventoryId, () => import(/* webpackChunkName: "inventory" */ '@anticrm/inventory-resources')) + addLocation(templatesId, () => import(/* webpackChunkName: "templates" */ '@anticrm/templates-resources')) } diff --git a/models/all/package.json b/models/all/package.json index 38d1b99845..5377489233 100644 --- a/models/all/package.json +++ b/models/all/package.json @@ -48,6 +48,8 @@ "@anticrm/model-gmail": "~0.6.0", "@anticrm/model-inventory": "~0.6.0", "@anticrm/model-presentation": "~0.6.0", + "@anticrm/model-templates": "~0.6.0", + "@anticrm/model-text-editor": "~0.6.0", "@anticrm/core": "~0.6.13" } } diff --git a/models/all/src/index.ts b/models/all/src/index.ts index 883fd19afe..e90dfd6d1f 100644 --- a/models/all/src/index.ts +++ b/models/all/src/index.ts @@ -29,6 +29,8 @@ import { createModel as leadModel } from '@anticrm/model-lead' import { createModel as gmailModel } from '@anticrm/model-gmail' import { createModel as inventoryModel } from '@anticrm/model-inventory' import { createModel as presentationModel } from '@anticrm/model-presentation' +import { createModel as templatesModel } from '@anticrm/model-templates' +import { createModel as textEditorModel } from '@anticrm/model-text-editor' import { createModel as serverCoreModel } from '@anticrm/model-server-core' import { createModel as serverAttachmentModel } from '@anticrm/model-server-attachment' @@ -54,6 +56,8 @@ leadModel(builder) gmailModel(builder) inventoryModel(builder) presentationModel(builder) +templatesModel(builder) +textEditorModel(builder) serverCoreModel(builder) serverAttachmentModel(builder) diff --git a/models/setting/src/index.ts b/models/setting/src/index.ts index 2e91940ff8..a812910a8a 100644 --- a/models/setting/src/index.ts +++ b/models/setting/src/index.ts @@ -17,8 +17,8 @@ import { Builder, Model } from '@anticrm/model' import { Ref, Domain, DOMAIN_MODEL } from '@anticrm/core' import core, { TDoc } from '@anticrm/model-core' import setting from '@anticrm/setting' -import type { Integration, IntegrationType, Handler } from '@anticrm/setting' -import type { IntlString } from '@anticrm/platform' +import type { Integration, IntegrationType, Handler, SettingsCategory } from '@anticrm/setting' +import type { Asset, IntlString } from '@anticrm/platform' import task from '@anticrm/task' import workbench from '@anticrm/model-workbench' @@ -31,6 +31,13 @@ export class TIntegration extends TDoc implements Integration { type!: Ref value!: string } +@Model(setting.class.SettingsCategory, core.class.Doc, DOMAIN_MODEL) +export class TSettingsCategory extends TDoc implements SettingsCategory { + name!: string + label!: IntlString + icon!: Asset + component!: AnyComponent +} @Model(setting.class.IntegrationType, core.class.Doc, DOMAIN_MODEL) export class TIntegrationType extends TDoc implements IntegrationType { @@ -42,7 +49,65 @@ export class TIntegrationType extends TDoc implements IntegrationType { } export function createModel (builder: Builder): void { - builder.createModel(TIntegration, TIntegrationType) + builder.createModel(TIntegration, TIntegrationType, TSettingsCategory) + + builder.createDoc(setting.class.SettingsCategory, core.space.Model, { + name: 'profile', + label: setting.string.EditProfile, + icon: setting.icon.EditProfile, + component: setting.component.Profile, + order: 0 + }, setting.ids.Profile) + + builder.createDoc(setting.class.SettingsCategory, core.space.Model, { + name: 'password', + label: setting.string.ChangePassword, + icon: setting.icon.Password, + component: setting.component.Password, + order: 1000 + }, setting.ids.Password) + builder.createDoc(setting.class.SettingsCategory, core.space.Model, { + name: 'setting', + label: setting.string.Setting, + icon: setting.icon.Setting, + component: setting.component.Setting, + order: 2000 + }, setting.ids.Setting) + builder.createDoc(setting.class.SettingsCategory, core.space.Model, { + name: 'integrations', + label: setting.string.Integrations, + icon: setting.icon.Integrations, + component: setting.component.Integrations, + order: 3000 + }, setting.ids.Integrations) + builder.createDoc(setting.class.SettingsCategory, core.space.Model, { + name: 'statuses', + label: setting.string.ManageStatuses, + icon: task.icon.ManageStatuses, + component: setting.component.ManageStatuses, + order: 4000 + }, setting.ids.ManageStatuses) + builder.createDoc(setting.class.SettingsCategory, core.space.Model, { + name: 'support', + label: setting.string.Support, + icon: setting.icon.Support, + component: setting.component.Support, + order: 5000 + }, setting.ids.Support) + builder.createDoc(setting.class.SettingsCategory, core.space.Model, { + name: 'privacy', + label: setting.string.Privacy, + icon: setting.icon.Privacy, + component: setting.component.Privacy, + order: 6000 + }, setting.ids.Privacy) + builder.createDoc(setting.class.SettingsCategory, core.space.Model, { + name: 'terms', + label: setting.string.Terms, + icon: setting.icon.Terms, + component: setting.component.Terms, + order: 10000 + }, setting.ids.Terms) builder.createDoc( workbench.class.Application, @@ -51,59 +116,7 @@ export function createModel (builder: Builder): void { label: setting.string.Setting, icon: setting.icon.Setting, hidden: true, - navigatorModel: { - specials: [ - { - id: 'profile', - label: setting.string.EditProfile, - icon: setting.icon.EditProfile, - component: setting.component.Profile - }, - { - id: 'password', - label: setting.string.ChangePassword, - icon: setting.icon.Password, - component: setting.component.Password - }, - { - id: 'setting', - label: setting.string.Setting, - icon: setting.icon.Setting, - component: setting.component.Setting - }, - { - id: 'integrations', - label: setting.string.Integrations, - icon: setting.icon.Integrations, - component: setting.component.Integrations - }, - { - id: 'statuses', - label: setting.string.ManageStatuses, - icon: task.icon.ManageStatuses, - component: setting.component.ManageStatuses - }, - { - id: 'support', - label: setting.string.Support, - icon: setting.icon.Support, - component: setting.component.Support - }, - { - id: 'privacy', - label: setting.string.Privacy, - icon: setting.icon.Privacy, - component: setting.component.Privacy - }, - { - id: 'terms', - label: setting.string.Terms, - icon: setting.icon.Terms, - component: setting.component.Terms - } - ], - spaces: [] - } + component: setting.component.Settings }, setting.ids.SettingApp ) diff --git a/models/templates/.eslintrc.js b/models/templates/.eslintrc.js new file mode 100644 index 0000000000..c3c2c49417 --- /dev/null +++ b/models/templates/.eslintrc.js @@ -0,0 +1,7 @@ +module.exports = { + extends: ['./node_modules/@anticrm/model-rig/profiles/default/config/eslint.config.json'], + parserOptions: { + tsconfigRootDir: __dirname, + project: './tsconfig.json' + } +} diff --git a/models/templates/.npmignore b/models/templates/.npmignore new file mode 100644 index 0000000000..e3ec093c38 --- /dev/null +++ b/models/templates/.npmignore @@ -0,0 +1,4 @@ +* +!/lib/** +!CHANGELOG.md +/lib/**/__tests__/ diff --git a/models/templates/config/rig.json b/models/templates/config/rig.json new file mode 100644 index 0000000000..e9a9ee9add --- /dev/null +++ b/models/templates/config/rig.json @@ -0,0 +1,18 @@ +// The "rig.json" file directs tools to look for their config files in an external package. +// Documentation for this system: https://www.npmjs.com/package/@rushstack/rig-package +{ + "$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json", + + /** + * (Required) The name of the rig package to inherit from. + * It should be an NPM package name with the "-rig" suffix. + */ + "rigPackageName": "@anticrm/model-rig" + + /** + * (Optional) Selects a config profile from the rig package. The name must consist of + * lowercase alphanumeric words separated by hyphens, for example "sample-profile". + * If omitted, then the "default" profile will be used." + */ + // "rigProfile": "your-profile-name" +} diff --git a/models/templates/package.json b/models/templates/package.json new file mode 100644 index 0000000000..8275a6e5c0 --- /dev/null +++ b/models/templates/package.json @@ -0,0 +1,40 @@ +{ + "name": "@anticrm/model-templates", + "version": "0.6.0", + "main": "lib/index.js", + "author": "Anticrm Platform Contributors", + "license": "EPL-2.0", + "scripts": { + "build": "heft build", + "build:watch": "tsc", + "lint:fix": "eslint --fix src", + "lint": "eslint src", + "format": "prettier --write src && eslint --fix src" + }, + "devDependencies": { + "@anticrm/model-rig": "~0.6.0", + "@typescript-eslint/eslint-plugin": "^5.4.0", + "eslint-plugin-import": "^2.25.3", + "eslint-plugin-promise": "^5.1.1", + "eslint-plugin-node": "^11.1.0", + "eslint": "^7.32.0", + "@types/heft-jest": "^1.0.2", + "@typescript-eslint/parser": "^5.4.0", + "eslint-config-standard-with-typescript": "^21.0.1", + "prettier": "^2.4.1", + "@rushstack/heft": "^0.41.1" + }, + "dependencies": { + "@anticrm/activity": "~0.6.0", + "@anticrm/model": "~0.6.0", + "@anticrm/core": "~0.6.0", + "@anticrm/platform": "~0.6.5", + "@anticrm/model-core": "~0.6.0", + "@anticrm/model-contact": "~0.6.1", + "@anticrm/templates": "~0.6.0", + "@anticrm/templates-resources": "~0.6.0", + "@anticrm/setting": "~0.6.0", + "@anticrm/ui": "~0.6.0", + "@anticrm/model-text-editor": "~0.6.0" + } +} diff --git a/models/templates/src/index.ts b/models/templates/src/index.ts new file mode 100644 index 0000000000..9802102951 --- /dev/null +++ b/models/templates/src/index.ts @@ -0,0 +1,67 @@ +// +// Copyright © 2020, 2021 Anticrm Platform Contributors. +// Copyright © 2021 Hardcore Engineering Inc. +// +// Licensed under the Eclipse Public License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. You may +// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +import type { Domain } from '@anticrm/core' +import { Builder, Model, Prop, TypeString } from '@anticrm/model' +import core, { TDoc } from '@anticrm/model-core' +import textEditor from '@anticrm/model-text-editor' +import { IntlString } from '@anticrm/platform' +import setting from '@anticrm/setting' +import type { MessageTemplate } from '@anticrm/templates' +import templates from './plugin' + +export const DOMAIN_TEMPLATES = 'templates' as Domain + +@Model(templates.class.MessageTemplate, core.class.Doc, DOMAIN_TEMPLATES) +export class TMessageTemplate extends TDoc implements MessageTemplate { + @Prop(TypeString(), 'Title' as IntlString) + title!: string; + + @Prop(TypeString(), 'Message' as IntlString) + message!: string; +} + +export function createModel (builder: Builder): void { + builder.createModel(TMessageTemplate) + + builder.createDoc( + core.class.Space, + core.space.Model, + { + name: 'Templates', + description: 'Space for all templates', + private: true, + archived: false, + members: [] + }, + templates.space.Templates + ) + + builder.createDoc(setting.class.SettingsCategory, core.space.Model, { + name: 'message-templates', + label: templates.string.Templates, + icon: templates.icon.Templates, + component: templates.component.Templates, + order: 3500 + }, templates.ids.Templates) + + builder.createDoc(textEditor.class.RefInputActionItem, core.space.Model, { + label: templates.string.Templates, + icon: templates.icon.Templates, + action: templates.action.ShowTemplates, + order: 1500 + }, templates.ids.TemplatePopupAction) +} diff --git a/models/templates/src/plugin.ts b/models/templates/src/plugin.ts new file mode 100644 index 0000000000..55a8ac4c0c --- /dev/null +++ b/models/templates/src/plugin.ts @@ -0,0 +1,39 @@ +// +// Copyright © 2020, 2021 Anticrm Platform Contributors. +// Copyright © 2021 Hardcore Engineering Inc. +// +// Licensed under the Eclipse Public License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. You may +// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +import { Ref } from '@anticrm/core' +import { mergeIds, Resource } from '@anticrm/platform' +import { SettingsCategory } from '@anticrm/setting' +import { templatesId } from '@anticrm/templates' +import templates from '@anticrm/templates-resources/src/plugin' + +import type { AnyComponent } from '@anticrm/ui' +import { RefInputAction, RefInputActionItem } from '@anticrm/model-text-editor' + +export default mergeIds(templatesId, templates, { + ids: { + Templates: '' as Ref, + TemplatePopupAction: '' as Ref + }, + + // Without it, CLI version is failed with some svelte dependency exception. + componnets: { + Dummy: '' as AnyComponent + }, + action: { + ShowTemplates: '' as Resource + } +}) diff --git a/models/templates/tsconfig.json b/models/templates/tsconfig.json new file mode 100644 index 0000000000..1d60db76b4 --- /dev/null +++ b/models/templates/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "./node_modules/@anticrm/model-rig/profiles/default/tsconfig.json", + + "compilerOptions": { + "rootDir": "./src", + "outDir": "./lib", + } +} \ No newline at end of file diff --git a/models/text-editor/.eslintrc.js b/models/text-editor/.eslintrc.js new file mode 100644 index 0000000000..c3c2c49417 --- /dev/null +++ b/models/text-editor/.eslintrc.js @@ -0,0 +1,7 @@ +module.exports = { + extends: ['./node_modules/@anticrm/model-rig/profiles/default/config/eslint.config.json'], + parserOptions: { + tsconfigRootDir: __dirname, + project: './tsconfig.json' + } +} diff --git a/models/text-editor/.npmignore b/models/text-editor/.npmignore new file mode 100644 index 0000000000..e3ec093c38 --- /dev/null +++ b/models/text-editor/.npmignore @@ -0,0 +1,4 @@ +* +!/lib/** +!CHANGELOG.md +/lib/**/__tests__/ diff --git a/models/text-editor/config/rig.json b/models/text-editor/config/rig.json new file mode 100644 index 0000000000..e9a9ee9add --- /dev/null +++ b/models/text-editor/config/rig.json @@ -0,0 +1,18 @@ +// The "rig.json" file directs tools to look for their config files in an external package. +// Documentation for this system: https://www.npmjs.com/package/@rushstack/rig-package +{ + "$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json", + + /** + * (Required) The name of the rig package to inherit from. + * It should be an NPM package name with the "-rig" suffix. + */ + "rigPackageName": "@anticrm/model-rig" + + /** + * (Optional) Selects a config profile from the rig package. The name must consist of + * lowercase alphanumeric words separated by hyphens, for example "sample-profile". + * If omitted, then the "default" profile will be used." + */ + // "rigProfile": "your-profile-name" +} diff --git a/models/text-editor/package.json b/models/text-editor/package.json new file mode 100644 index 0000000000..c889ab93c5 --- /dev/null +++ b/models/text-editor/package.json @@ -0,0 +1,35 @@ +{ + "name": "@anticrm/model-text-editor", + "version": "0.6.0", + "main": "lib/index.js", + "author": "Anticrm Platform Contributors", + "license": "EPL-2.0", + "scripts": { + "build": "heft build", + "build:watch": "tsc", + "lint:fix": "eslint --fix src", + "lint": "eslint src", + "format": "prettier --write src && eslint --fix src" + }, + "devDependencies": { + "@anticrm/model-rig": "~0.6.0", + "@typescript-eslint/eslint-plugin": "^5.4.0", + "eslint-plugin-import": "^2.25.3", + "eslint-plugin-promise": "^5.1.1", + "eslint-plugin-node": "^11.1.0", + "eslint": "^7.32.0", + "@types/heft-jest": "^1.0.2", + "@typescript-eslint/parser": "^5.4.0", + "eslint-config-standard-with-typescript": "^21.0.1", + "prettier": "^2.4.1", + "@rushstack/heft": "^0.41.1" + }, + "dependencies": { + "@anticrm/core": "~0.6.11", + "@anticrm/model": "~0.6.0", + "@anticrm/platform": "~0.6.5", + "@anticrm/ui": "~0.6.0", + "@anticrm/text-editor": "~0.6.0", + "@anticrm/model-core": "~0.6.0" + } +} diff --git a/models/text-editor/src/index.ts b/models/text-editor/src/index.ts new file mode 100644 index 0000000000..ca741f8e42 --- /dev/null +++ b/models/text-editor/src/index.ts @@ -0,0 +1,40 @@ +// +// Copyright © 2020 Anticrm Platform Contributors. +// +// Licensed under the Eclipse Public License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. You may +// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +import { DOMAIN_MODEL } from '@anticrm/core' +import { Builder, Model } from '@anticrm/model' +import core, { TDoc } from '@anticrm/model-core' +import type { Asset, IntlString, Resource } from '@anticrm/platform' +// Import types to prevent .svelte components to being exposed to type typescript. +import { RefInputAction, RefInputActionItem } from '@anticrm/text-editor/src/types' +import textEditor from './plugin' + +export { default } from './plugin' +export { RefInputAction, RefInputActionItem } + +@Model(textEditor.class.RefInputActionItem, core.class.Doc, DOMAIN_MODEL) +export class TRefInputActionItem extends TDoc implements RefInputActionItem { + label!: IntlString + icon!: Asset + + // Query for documents with pattern + action!: Resource +} + +export function createModel (builder: Builder): void { + builder.createModel( + TRefInputActionItem + ) +} diff --git a/models/text-editor/src/plugin.ts b/models/text-editor/src/plugin.ts new file mode 100644 index 0000000000..7dd7d1c03b --- /dev/null +++ b/models/text-editor/src/plugin.ts @@ -0,0 +1,23 @@ +// +// Copyright © 2020, 2021 Anticrm Platform Contributors. +// Copyright © 2021 Hardcore Engineering Inc. +// +// Licensed under the Eclipse Public License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. You may +// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +import { mergeIds } from '@anticrm/platform' +// Import plugin directly to prevent .svelte components to being exposed to type typescript. +import textEditor, { textEditorId } from '@anticrm/text-editor/src/plugin' + +export default mergeIds(textEditorId, textEditor, { + +}) diff --git a/models/text-editor/tsconfig.json b/models/text-editor/tsconfig.json new file mode 100644 index 0000000000..1d60db76b4 --- /dev/null +++ b/models/text-editor/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "./node_modules/@anticrm/model-rig/profiles/default/tsconfig.json", + + "compilerOptions": { + "rootDir": "./src", + "outDir": "./lib", + } +} \ No newline at end of file diff --git a/packages/text-editor/src/components/MentionList.svelte b/packages/text-editor/src/components/MentionList.svelte index 07f308b26f..789f154611 100644 --- a/packages/text-editor/src/components/MentionList.svelte +++ b/packages/text-editor/src/components/MentionList.svelte @@ -14,7 +14,7 @@ // limitations under the License. -->
- updateItems(category, query) } placeholder={placeholder} /> + updateItems(category, query) } placeholder={category.label} />