@retailcrm/embed-ui 0.3.4 → 0.3.5

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
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### 0.3.5 (2024-11-22)
6
+
7
+
8
+ ### Fixes
9
+
10
+ * TypeScript types: Writable, WidgetRunner ([4b0f656](https://github.com/retailcrm/embed-ui/commit/4b0f656cb88494e3a60ca2bc5afced33f75219b7))
11
+
5
12
  ### 0.3.4 (2024-11-21)
6
13
 
7
14
  ### [0.3.3](https://github.com/retailcrm/embed-ui/compare/v0.3.2...v0.3.3) (2024-11-20)
package/dist/index.cjs CHANGED
@@ -30,7 +30,7 @@ const defineContext = (id, schema2) => {
30
30
  const state = await endpoint.call.get(id, "~");
31
31
  keysOf(schema2).forEach((field) => {
32
32
  context[field] = state[field];
33
- endpoint.call.on(id, `change:${String(field)}`, (value) => {
33
+ endpoint.call.on(id, `change:${field}`, (value) => {
34
34
  context[field] = value;
35
35
  });
36
36
  });
package/dist/index.mjs CHANGED
@@ -28,7 +28,7 @@ const defineContext = (id, schema2) => {
28
28
  const state = await endpoint.call.get(id, "~");
29
29
  keysOf(schema2).forEach((field) => {
30
30
  context[field] = state[field];
31
- endpoint.call.on(id, `change:${String(field)}`, (value) => {
31
+ endpoint.call.on(id, `change:${field}`, (value) => {
32
32
  context[field] = value;
33
33
  });
34
34
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@retailcrm/embed-ui",
3
3
  "type": "module",
4
- "version": "0.3.4",
4
+ "version": "0.3.5",
5
5
  "description": "API and components for creating RetailCRM UI extensions",
6
6
  "repository": "git@github.com:retailcrm/embed-ui.git",
7
7
  "author": "RetailDriverLLC <integration@retailcrm.ru>",
@@ -31,7 +31,7 @@
31
31
  "test": "vitest --run"
32
32
  },
33
33
  "dependencies": {
34
- "@omnicajs/vue-remote": "^0.2.0",
34
+ "@omnicajs/vue-remote": "^0.2.1",
35
35
  "@remote-ui/rpc": "^1.4.5"
36
36
  },
37
37
  "peerDependencies": {
@@ -6,7 +6,7 @@ export type Field<Type, Readonly extends boolean = false> = {
6
6
  readonly: Readonly;
7
7
  }
8
8
 
9
- export type ReadonlyField<Type> = Field<Type, true>
9
+ export type ReadonlyField<Type = unknown> = Field<Type, true>
10
10
 
11
11
  export type TypeOf<F> = F extends Field<infer T>
12
12
  ? T
@@ -33,17 +33,21 @@ export type Context<S extends ContextSchema> = {
33
33
  }
34
34
 
35
35
  export type Writable<S extends ContextSchema> = {
36
- [F in keyof S]: IsReadonly<S[F]> extends true ? never : S[F];
36
+ [F in keyof S as IsReadonly<S[F]> extends true ? never : F]: S[F];
37
37
  }
38
38
 
39
39
  export type EventMap<S extends ContextSchema> = {
40
- [K in keyof S as `change:${K}`]: K;
40
+ [K in keyof S as K extends string ? `change:${K}` : never]: K;
41
+ }
42
+
43
+ export type EventPayloadMap<S extends ContextSchema> = {
44
+ [K in keyof S as K extends string ? `change:${K}` : never]: TypeOf<S[K]>;
41
45
  }
42
46
 
43
47
  export type EventHandler<
44
48
  S extends ContextSchema,
45
- E extends keyof EventMap<S>
46
- > = (payload: TypeOf<S[EventMap<S>[E]]>) => void
49
+ E extends keyof EventPayloadMap<S>
50
+ > = (payload: EventPayloadMap<S>[E]) => void
47
51
 
48
52
  export type ContextAccessor<M extends ContextSchemaMap = ContextSchemaMap> = {
49
53
  get <
package/types/widget.d.ts CHANGED
@@ -7,7 +7,7 @@ import type { Channel } from '@omnicajs/vue-remote/dist/remote'
7
7
 
8
8
  import type { Pinia } from 'pinia'
9
9
 
10
- import type { RemoteRoot } from '@omnicajs/vue-remote/remote'
10
+ import type { RemoteRoot, SchemaOf } from '@omnicajs/vue-remote/remote'
11
11
 
12
12
  import type { SchemaList } from './context'
13
13