@treenity/core 1.0.16 → 1.0.17

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.17
4
+
5
+ ### Patch Changes
6
+
7
+ - Add types
8
+ - Updated dependencies
9
+ - @treenity/js-shared@1.0.16
10
+
3
11
  ## 1.0.16
4
12
 
5
13
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export * from './context';
2
2
  export * from './contexts/json-schema/types';
3
3
  export * from './contexts/react/types';
4
- export type { Node, NodeRef, NodeLink, Meta } from './meta';
4
+ export * from './meta';
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- export{ContextImpl,types}from"./context.mjs";
1
+ export{ContextImpl,types}from"./context.mjs";export{metaType}from"./meta.mjs";
package/dist/meta.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export interface Meta {
1
+ export interface IMeta {
2
2
  $id: string;
3
3
  $name: string;
4
4
  $anchor?: string;
@@ -6,6 +6,7 @@ export interface Meta {
6
6
  $perm?: MetaPermission;
7
7
  $tg?: string[];
8
8
  }
9
+ export type Meta<T = {}> = IMeta & T;
9
10
  export type MetaPermission = Record<string, Array<string>>;
10
11
  export interface NodeRef {
11
12
  ref: string;
@@ -15,7 +16,7 @@ export interface NodeLink {
15
16
  p: string;
16
17
  v: string;
17
18
  }
18
- export interface Node extends Meta {
19
+ export interface INode {
19
20
  $parid: string;
20
21
  /**
21
22
  * if ref exists in $refs, then field value will be replaced with value pointed by NodeRef.url
@@ -29,3 +30,10 @@ export interface Node extends Meta {
29
30
  [name: string]: Meta;
30
31
  };
31
32
  }
33
+ export type Node = Meta<INode>;
34
+ export type MetaType_<T> = {
35
+ readonly $type: string;
36
+ readonly $item?: T;
37
+ };
38
+ export type MetaType<T> = MetaType_<T>;
39
+ export declare function metaType<T>(type: string, item?: Partial<T>): MetaType<T>;
package/dist/meta.mjs ADDED
@@ -0,0 +1 @@
1
+ function t(){return`[${this.$type}]`}function n(n,e){return{$type:n,$item:e,toString:t}}export{n as metaType};
package/dist/stats.html CHANGED
@@ -4822,7 +4822,7 @@ var drawChart = (function (exports) {
4822
4822
  </script>
4823
4823
  <script>
4824
4824
  /*<!--*/
4825
- const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.mjs","children":[{"name":"src/index.ts","uid":"f4cd5fce-1"}]},{"name":"context.mjs","children":[{"name":"src/context.ts","uid":"f4cd5fce-3"}]}],"isRoot":true},"nodeParts":{"f4cd5fce-1":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"metaUid":"f4cd5fce-0"},"f4cd5fce-3":{"renderedLength":2693,"gzipLength":771,"brotliLength":0,"metaUid":"f4cd5fce-2"}},"nodeMetas":{"f4cd5fce-0":{"id":"/src/index.ts","moduleParts":{"index.mjs":"f4cd5fce-1"},"imported":[{"uid":"f4cd5fce-2"},{"uid":"f4cd5fce-4"},{"uid":"f4cd5fce-5"}],"importedBy":[],"isEntry":true},"f4cd5fce-2":{"id":"/src/context.ts","moduleParts":{"context.mjs":"f4cd5fce-3"},"imported":[{"uid":"f4cd5fce-6"},{"uid":"f4cd5fce-7"}],"importedBy":[{"uid":"f4cd5fce-0"}]},"f4cd5fce-4":{"id":"/src/contexts/json-schema/types.ts","moduleParts":{},"imported":[],"importedBy":[{"uid":"f4cd5fce-0"}]},"f4cd5fce-5":{"id":"/src/contexts/react/types.ts","moduleParts":{},"imported":[],"importedBy":[{"uid":"f4cd5fce-0"}]},"f4cd5fce-6":{"id":"@treenity/js-shared/utils","moduleParts":{},"imported":[],"importedBy":[{"uid":"f4cd5fce-2"}],"isExternal":true},"f4cd5fce-7":{"id":"synchronous-promise","moduleParts":{},"imported":[],"importedBy":[{"uid":"f4cd5fce-2"}],"isExternal":true}},"env":{"rollup":"4.9.6"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
4825
+ const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.mjs","children":[{"name":"src/index.ts","uid":"a044ddf7-1"}]},{"name":"context.mjs","children":[{"name":"src/context.ts","uid":"a044ddf7-3"}]},{"name":"meta.mjs","children":[{"name":"src/meta.ts","uid":"a044ddf7-5"}]}],"isRoot":true},"nodeParts":{"a044ddf7-1":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"metaUid":"a044ddf7-0"},"a044ddf7-3":{"renderedLength":2693,"gzipLength":771,"brotliLength":0,"metaUid":"a044ddf7-2"},"a044ddf7-5":{"renderedLength":138,"gzipLength":118,"brotliLength":0,"metaUid":"a044ddf7-4"}},"nodeMetas":{"a044ddf7-0":{"id":"/src/index.ts","moduleParts":{"index.mjs":"a044ddf7-1"},"imported":[{"uid":"a044ddf7-2"},{"uid":"a044ddf7-6"},{"uid":"a044ddf7-7"},{"uid":"a044ddf7-4"}],"importedBy":[],"isEntry":true},"a044ddf7-2":{"id":"/src/context.ts","moduleParts":{"context.mjs":"a044ddf7-3"},"imported":[{"uid":"a044ddf7-8"},{"uid":"a044ddf7-9"}],"importedBy":[{"uid":"a044ddf7-0"}]},"a044ddf7-4":{"id":"/src/meta.ts","moduleParts":{"meta.mjs":"a044ddf7-5"},"imported":[],"importedBy":[{"uid":"a044ddf7-0"}]},"a044ddf7-6":{"id":"/src/contexts/json-schema/types.ts","moduleParts":{},"imported":[],"importedBy":[{"uid":"a044ddf7-0"}]},"a044ddf7-7":{"id":"/src/contexts/react/types.ts","moduleParts":{},"imported":[],"importedBy":[{"uid":"a044ddf7-0"}]},"a044ddf7-8":{"id":"@treenity/js-shared/utils","moduleParts":{},"imported":[],"importedBy":[{"uid":"a044ddf7-2"}],"isExternal":true},"a044ddf7-9":{"id":"synchronous-promise","moduleParts":{},"imported":[],"importedBy":[{"uid":"a044ddf7-2"}],"isExternal":true}},"env":{"rollup":"4.9.6"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
4826
4826
 
4827
4827
  const run = () => {
4828
4828
  const width = window.innerWidth;
package/jest.config.ts ADDED
@@ -0,0 +1,29 @@
1
+ import type { JestConfigWithTsJest } from 'ts-jest';
2
+
3
+ const jestConfig: JestConfigWithTsJest = {
4
+ preset: 'ts-jest',
5
+ globals: {
6
+ 'ts-jest': {
7
+ tsconfig: {
8
+ allowJs: true,
9
+ },
10
+ },
11
+ },
12
+ testEnvironment: 'node',
13
+ moduleNameMapper: {
14
+ '^@/(.*)$': '<rootDir>/src/$1',
15
+ },
16
+ transformIgnorePatterns: ['node_modules/.pnpm/(?!@s-libs*)'],
17
+ transform: {
18
+ // '^.+\\.[tj]sx?$' to process js/ts with `ts-jest`
19
+ // '^.+\\.m?[tj]sx?$' to process js/ts/mjs/mts with `ts-jest`
20
+ '^.+\\.(ts|js|jsx|mjs|tsx)?$': [
21
+ 'ts-jest',
22
+ {
23
+ useESM: true,
24
+ },
25
+ ],
26
+ },
27
+ };
28
+
29
+ export default jestConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@treenity/core",
3
- "version": "1.0.16",
3
+ "version": "1.0.17",
4
4
  "description": "treenity core",
5
5
  "author": "Treenity",
6
6
  "license": "ISC",
@@ -14,7 +14,7 @@
14
14
  }
15
15
  },
16
16
  "dependencies": {
17
- "@treenity/js-shared": "1.0.15",
17
+ "@treenity/js-shared": "1.0.16",
18
18
  "json-schema-to-ts": "3.0.0",
19
19
  "synchronous-promise": "2.0.17",
20
20
  "tslib": "2.6.2"
@@ -26,7 +26,7 @@
26
26
  "@testing-library/dom": "^8.17.1",
27
27
  "@testing-library/jest-dom": "^5.16.5",
28
28
  "@testing-library/preact": "3.2.3",
29
- "@treenity/build-utils": "1.1.5",
29
+ "@treenity/build-utils": "1.1.6",
30
30
  "@treenity/tsconfig": "1.0.8",
31
31
  "@types/jest": "29.5.12",
32
32
  "@types/node": "20.11.16",
@@ -37,7 +37,7 @@
37
37
  "react": "18.2.0",
38
38
  "rollup": "4.9.6",
39
39
  "ts-jest": "29.0.3",
40
- "typescript": "5.3.3"
40
+ "typescript": "5.4.5"
41
41
  },
42
42
  "scripts": {
43
43
  "build": "rollup -c",