@treenity/core 1.0.13 → 1.0.14

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @treenity/core
2
2
 
3
+ ## 1.0.14
4
+
5
+ ### Patch Changes
6
+
7
+ - Some changes
8
+ - Updated dependencies
9
+ - @treenity/js-shared@1.0.13
10
+
3
11
  ## 1.0.13
4
12
 
5
13
  ### Patch Changes
package/dist/context.mjs CHANGED
@@ -1,90 +1 @@
1
- import { capitalize } from '@treenity/js-shared/utils';
2
- import { SynchronousPromise } from 'synchronous-promise';
3
-
4
- class ContextImpl {
5
- name;
6
- items = new Map();
7
- constructor(name) {
8
- this.name = name;
9
- // @ts-ignore
10
- types[name] = this;
11
- }
12
- // add(...args: Pro<Context<C, O>['add']>): TypeContextInfo<C, O>;
13
- // add(...args: ArgumentTypes<Context<C, O>['add']>): TypeContextInfo<C, O> {
14
- add(...args) {
15
- if (args.length < 3)
16
- args.unshift('');
17
- const [subContext, typeName, component, options] = args;
18
- const contextType = subContext ? subContext + ':' + typeName : typeName;
19
- const t = {
20
- id: contextType,
21
- context: this.name,
22
- subContext,
23
- component,
24
- options,
25
- };
26
- this.items.set(contextType, t);
27
- return t;
28
- }
29
- // get(typeName: string): Promise<TypeContextInfo<C, O>>;
30
- // get(subContext: string, typeName: string): Promise<TypeContextInfo<C, O>>;
31
- getInfo(subContext, typeName) {
32
- if (!typeName) {
33
- typeName = subContext;
34
- subContext = '';
35
- }
36
- const contextType = subContext ? subContext + ':' + typeName : typeName;
37
- const item = this.items.get(contextType);
38
- if (!item) {
39
- return SynchronousPromise.reject(new Error('not found: ' + contextType));
40
- }
41
- return SynchronousPromise.resolve(item);
42
- }
43
- get(subContext, typeName) {
44
- return this.getInfo(subContext, typeName).then(({ component, options }) => [
45
- component,
46
- options,
47
- ]);
48
- }
49
- search(query) {
50
- const result = [];
51
- for (let t of this.items.values()) {
52
- if (!t.subContext && (!query || t.id.includes(query)))
53
- result.push(t);
54
- }
55
- return result;
56
- }
57
- }
58
- class ReactTypeContextImpl extends ContextImpl {
59
- add(...args) {
60
- if (args.length === 4) {
61
- const [, typeName, component] = args;
62
- if (!component.displayName && !component.name)
63
- component.displayName = capitalize(typeName);
64
- }
65
- else {
66
- const [typeName, component] = args;
67
- if (!component.displayName && !component.name)
68
- component.displayName = capitalize(typeName);
69
- }
70
- return super.add(...args);
71
- }
72
- }
73
- class ServiceTypeContextImpl extends ContextImpl {
74
- }
75
- class NodeEngineTypeContextImpl extends ContextImpl {
76
- }
77
- class MetaTypeContextImpl extends ContextImpl {
78
- }
79
- class ProtoTypeContextImpl extends ContextImpl {
80
- }
81
- // @ts-ignore
82
- const types = {};
83
- new ReactTypeContextImpl('react');
84
- new MetaTypeContextImpl('meta');
85
- new ProtoTypeContextImpl('proto');
86
- new ServiceTypeContextImpl('jsSrv');
87
- new NodeEngineTypeContextImpl('noflo');
88
-
89
- export { ContextImpl, types };
90
- //# sourceMappingURL=context.mjs.map
1
+ import{capitalize as e}from"@treenity/js-shared/utils";import{SynchronousPromise as t}from"synchronous-promise";class s{name;items=new Map;constructor(e){this.name=e,n[e]=this}add(...e){e.length<3&&e.unshift("");const[t,s,n,o]=e,r=t?t+":"+s:s,a={id:r,context:this.name,subContext:t,component:n,options:o};return this.items.set(r,a),a}getInfo(e,s){s||(s=e,e="");const n=e?e+":"+s:s,o=this.items.get(n);return o?t.resolve(o):t.reject(new Error("not found: "+n))}get(e,t){return this.getInfo(e,t).then((({component:e,options:t})=>[e,t]))}search(e){const t=[];for(let s of this.items.values())s.subContext||e&&!s.id.includes(e)||t.push(s);return t}}const n={};new class extends s{add(...t){if(4===t.length){const[,s,n]=t;n.displayName||n.name||(n.displayName=e(s))}else{const[s,n]=t;n.displayName||n.name||(n.displayName=e(s))}return super.add(...t)}}("react"),new class extends s{}("meta"),new class extends s{}("proto"),new class extends s{}("jsSrv"),new class extends s{}("noflo");export{s as ContextImpl,n as types};
package/dist/index.mjs CHANGED
@@ -1,2 +1 @@
1
- export { ContextImpl, types } from './context.mjs';
2
- //# sourceMappingURL=index.mjs.map
1
+ export{ContextImpl,types}from"./context.mjs";
package/package.json CHANGED
@@ -1,18 +1,20 @@
1
1
  {
2
2
  "name": "@treenity/core",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "description": "treenity core",
5
5
  "author": "Treenity",
6
6
  "license": "ISC",
7
7
  "type": "module",
8
+ "types": "./dist/index.d.ts",
9
+ "module": "./dist/index.mjs",
8
10
  "exports": {
9
11
  ".": {
12
+ "types": "./dist/index.d.ts",
10
13
  "default": "./dist/index.mjs"
11
14
  }
12
15
  },
13
- "types": "./dist/index.d.ts",
14
16
  "dependencies": {
15
- "@treenity/js-shared": "1.0.12",
17
+ "@treenity/js-shared": "1.0.13",
16
18
  "json-schema-to-ts": "3.0.0",
17
19
  "synchronous-promise": "2.0.17",
18
20
  "tslib": "2.6.2"
@@ -24,7 +26,7 @@
24
26
  "@testing-library/dom": "^8.17.1",
25
27
  "@testing-library/jest-dom": "^5.16.5",
26
28
  "@testing-library/preact": "3.2.3",
27
- "@treenity/build-utils": "1.0.19",
29
+ "@treenity/build-utils": "1.0.20",
28
30
  "@treenity/tsconfig": "1.0.7",
29
31
  "@types/jest": "29.5.12",
30
32
  "@types/node": "20.11.16",