@nu-art/live-docs-frontend 0.401.9 → 0.500.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/index.d.ts +3 -3
- package/index.js +3 -3
- package/modules/ModuleFE_LiveDocs.d.ts +9 -8
- package/modules/ModuleFE_LiveDocs.js +91 -27
- package/package.json +10 -9
- package/ui/LiveDoc.js +1 -1
- package/utils.js +1 -1
package/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
1
|
+
export * from './core/module-pack.js';
|
|
2
|
+
export * from './ui/LiveDoc.js';
|
|
3
|
+
export * from './utils.js';
|
package/index.js
CHANGED
|
@@ -16,6 +16,6 @@
|
|
|
16
16
|
* See the License for the specific language governing permissions and
|
|
17
17
|
* limitations under the License.
|
|
18
18
|
*/
|
|
19
|
-
export * from
|
|
20
|
-
export * from
|
|
21
|
-
export * from
|
|
19
|
+
export * from './core/module-pack.js';
|
|
20
|
+
export * from './ui/LiveDoc.js';
|
|
21
|
+
export * from './utils.js';
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { Module } from '@nu-art/ts-common';
|
|
2
|
-
import { ToastBuilder } from '@nu-art/
|
|
3
|
-
import { DB_Document
|
|
4
|
-
import {
|
|
5
|
-
import { ApiDefCaller } from '@nu-art/thunderstorm-shared';
|
|
2
|
+
import { ToastBuilder } from '@nu-art/thunder-widgets';
|
|
3
|
+
import { DB_Document } from '@nu-art/live-docs-shared';
|
|
4
|
+
import { API_LiveDoc } from '@nu-art/live-docs-shared/api';
|
|
6
5
|
export type LiveDocActionResolver = (doc: DB_Document) => ToastBuilder;
|
|
7
|
-
export declare class ModuleFE_LiveDocs_Class extends Module
|
|
6
|
+
export declare class ModuleFE_LiveDocs_Class extends Module {
|
|
8
7
|
private docs;
|
|
9
8
|
private toasterResolver;
|
|
10
|
-
readonly v1: ApiDefCaller<ApiStruct_LiveDoc>['v1'];
|
|
11
9
|
constructor();
|
|
12
10
|
protected init(): void;
|
|
13
|
-
onGotDoc: (response: DB_Document,
|
|
14
|
-
get(
|
|
11
|
+
onGotDoc: (response: DB_Document, key: string) => Promise<void>;
|
|
12
|
+
get(params: API_LiveDoc['get']['Params']): Promise<API_LiveDoc['get']['Response']>;
|
|
13
|
+
upsert(body: API_LiveDoc['upsert']['Body']): Promise<API_LiveDoc['upsert']['Response']>;
|
|
14
|
+
history(params: API_LiveDoc['history']['Params']): Promise<API_LiveDoc['history']['Response']>;
|
|
15
|
+
getDoc(key: string): DB_Document;
|
|
15
16
|
setActionsResolver(resolver: LiveDocActionResolver): void;
|
|
16
17
|
}
|
|
17
18
|
export declare const ModuleFE_LiveDocs: ModuleFE_LiveDocs_Class;
|
|
@@ -15,36 +15,100 @@
|
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
19
|
+
var useValue = arguments.length > 2;
|
|
20
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
21
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
22
|
+
}
|
|
23
|
+
return useValue ? value : void 0;
|
|
24
|
+
};
|
|
25
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
26
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
27
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
28
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
29
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
30
|
+
var _, done = false;
|
|
31
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
32
|
+
var context = {};
|
|
33
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
34
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
35
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
36
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
37
|
+
if (kind === "accessor") {
|
|
38
|
+
if (result === void 0) continue;
|
|
39
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
40
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
41
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
42
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
43
|
+
}
|
|
44
|
+
else if (_ = accept(result)) {
|
|
45
|
+
if (kind === "field") initializers.unshift(_);
|
|
46
|
+
else descriptor[key] = _;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
50
|
+
done = true;
|
|
51
|
+
};
|
|
18
52
|
import { Module } from '@nu-art/ts-common';
|
|
19
|
-
import {
|
|
53
|
+
import { ApiCaller } from '@nu-art/http-client';
|
|
20
54
|
import { ApiDef_LiveDoc } from '@nu-art/live-docs-shared/api';
|
|
21
55
|
import { DefaultLiveDocEditor } from '../utils.js';
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
56
|
+
let ModuleFE_LiveDocs_Class = (() => {
|
|
57
|
+
let _classSuper = Module;
|
|
58
|
+
let _instanceExtraInitializers = [];
|
|
59
|
+
let _get_decorators;
|
|
60
|
+
let _upsert_decorators;
|
|
61
|
+
let _history_decorators;
|
|
62
|
+
return class ModuleFE_LiveDocs_Class extends _classSuper {
|
|
63
|
+
static {
|
|
64
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
65
|
+
_get_decorators = [ApiCaller(ApiDef_LiveDoc.get, {
|
|
66
|
+
onComplete: (m, ctx) => m.onGotDoc(ctx.response, ctx.params.key)
|
|
67
|
+
})];
|
|
68
|
+
_upsert_decorators = [ApiCaller(ApiDef_LiveDoc.upsert, {
|
|
69
|
+
onComplete: (m, ctx) => m.onGotDoc(ctx.response, ctx.body.key)
|
|
70
|
+
})];
|
|
71
|
+
_history_decorators = [ApiCaller(ApiDef_LiveDoc.history, {
|
|
72
|
+
onComplete: (m, ctx) => m.onGotDoc(ctx.response, ctx.params.key)
|
|
73
|
+
})];
|
|
74
|
+
__esDecorate(this, null, _get_decorators, { kind: "method", name: "get", static: false, private: false, access: { has: obj => "get" in obj, get: obj => obj.get }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
75
|
+
__esDecorate(this, null, _upsert_decorators, { kind: "method", name: "upsert", static: false, private: false, access: { has: obj => "upsert" in obj, get: obj => obj.upsert }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
76
|
+
__esDecorate(this, null, _history_decorators, { kind: "method", name: "history", static: false, private: false, access: { has: obj => "history" in obj, get: obj => obj.history }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
77
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
78
|
+
}
|
|
79
|
+
docs = (__runInitializers(this, _instanceExtraInitializers), {});
|
|
80
|
+
toasterResolver = DefaultLiveDocEditor;
|
|
81
|
+
constructor() {
|
|
82
|
+
super();
|
|
83
|
+
}
|
|
84
|
+
init() {
|
|
85
|
+
}
|
|
86
|
+
onGotDoc = async (response, key) => {
|
|
87
|
+
const _doc = this.docs[key];
|
|
88
|
+
if (_doc && response.document === _doc.document)
|
|
89
|
+
return;
|
|
90
|
+
this.docs[key] = response;
|
|
91
|
+
this.toasterResolver(response).show();
|
|
32
92
|
};
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return;
|
|
40
|
-
|
|
41
|
-
|
|
93
|
+
async get(params) {
|
|
94
|
+
void params;
|
|
95
|
+
return undefined;
|
|
96
|
+
}
|
|
97
|
+
async upsert(body) {
|
|
98
|
+
void body;
|
|
99
|
+
return undefined;
|
|
100
|
+
}
|
|
101
|
+
async history(params) {
|
|
102
|
+
void params;
|
|
103
|
+
return undefined;
|
|
104
|
+
}
|
|
105
|
+
getDoc(key) {
|
|
106
|
+
return this.docs[key];
|
|
107
|
+
}
|
|
108
|
+
setActionsResolver(resolver) {
|
|
109
|
+
this.toasterResolver = resolver;
|
|
110
|
+
}
|
|
42
111
|
};
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
setActionsResolver(resolver) {
|
|
47
|
-
this.toasterResolver = resolver;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
112
|
+
})();
|
|
113
|
+
export { ModuleFE_LiveDocs_Class };
|
|
50
114
|
export const ModuleFE_LiveDocs = new ModuleFE_LiveDocs_Class();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nu-art/live-docs-frontend",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.500.0",
|
|
4
4
|
"description": "Live docs Frontend",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"TacB0sS",
|
|
@@ -38,12 +38,10 @@
|
|
|
38
38
|
}
|
|
39
39
|
],
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@nu-art/live-docs-shared": "0.
|
|
42
|
-
"@nu-art/firebase-frontend": "0.
|
|
43
|
-
"@nu-art/firebase-shared": "0.
|
|
44
|
-
"@nu-art/
|
|
45
|
-
"@nu-art/thunderstorm-shared": "0.401.9",
|
|
46
|
-
"@nu-art/ts-common": "0.401.9",
|
|
41
|
+
"@nu-art/live-docs-shared": "0.500.0",
|
|
42
|
+
"@nu-art/firebase-frontend": "0.500.0",
|
|
43
|
+
"@nu-art/firebase-shared": "0.500.0",
|
|
44
|
+
"@nu-art/ts-common": "0.500.0",
|
|
47
45
|
"express": "^4.18.2",
|
|
48
46
|
"firebase": "^11.9.0",
|
|
49
47
|
"firebase-admin": "13.4.0",
|
|
@@ -51,12 +49,15 @@
|
|
|
51
49
|
"moment": "^2.29.4",
|
|
52
50
|
"react": "^18.0.0",
|
|
53
51
|
"react-dom": "^18.0.0",
|
|
54
|
-
"react-router-dom": "^6.9.0"
|
|
52
|
+
"react-router-dom": "^6.9.0",
|
|
53
|
+
"@nu-art/http-client": "{{THUNDERSTORM_VERSION}}",
|
|
54
|
+
"@nu-art/thunder-widgets": "{{THUNDERSTORM_VERSION}}"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@types/react": "^18.0.0",
|
|
58
58
|
"@types/express": "^4.17.17",
|
|
59
|
-
"@types/history": "^4.7.2"
|
|
59
|
+
"@types/history": "^4.7.2",
|
|
60
|
+
"@types/request": "^2.48.1"
|
|
60
61
|
},
|
|
61
62
|
"unitConfig": {
|
|
62
63
|
"type": "typescript-lib"
|
package/ui/LiveDoc.js
CHANGED
|
@@ -20,7 +20,7 @@ import * as React from 'react';
|
|
|
20
20
|
import { ModuleFE_LiveDocs } from '../modules/ModuleFE_LiveDocs.js';
|
|
21
21
|
const showLiveDoc = (e) => {
|
|
22
22
|
const key = e.currentTarget.id;
|
|
23
|
-
ModuleFE_LiveDocs.
|
|
23
|
+
void ModuleFE_LiveDocs.get({ key });
|
|
24
24
|
};
|
|
25
25
|
export class LiveDoc extends React.Component {
|
|
26
26
|
static defaultProps = {
|
package/utils.js
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
// import * as React from 'react';
|
|
19
|
-
import { ToastBuilder } from '@nu-art/
|
|
19
|
+
import { ToastBuilder } from '@nu-art/thunder-widgets';
|
|
20
20
|
export const DefaultLiveDocEditor = (doc) => {
|
|
21
21
|
return new ToastBuilder().setContent(doc.document.length === 0 ? `No Content for document with key: ${doc.document}` : doc.document);
|
|
22
22
|
// .setActions(
|