@kaokei/use-vue-service 4.0.1 → 4.0.2

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/README.md CHANGED
@@ -17,15 +17,11 @@
17
17
 
18
18
  本库通过类来声明服务,对 typescript 支持非常棒。
19
19
 
20
- - [入门指南](./docs/guide/index.md)
20
+ - [快速开始](./docs/guide/index.md)
21
21
  - [API 文档](./docs/api/index.md)
22
- - [博客文章](./docs/note/01.父组件与子组件的理解.md)
23
- - [codesandbox example](https://codesandbox.io/s/di-playground-zjnyv)
24
- - [online demo](https://use-vue-service.vercel.app/)
22
+ - [示例代码(Example)](./docs/examples/index.md)
23
+ - [笔记文章](./docs/note/00.README.md)
25
24
 
26
25
  ## Todo List
27
- 1. 优化@Computed
28
- 5. 增加@Raw装饰器
29
- 4. 更新hasOwn
30
- 3. 发布@kaokei/di@5.0.3
31
- 2. 评估是否需要@Watch/@Effect
26
+
27
+ 1. 改成tsdown来打包代码
@@ -4,4 +4,5 @@ import { FindChildService, FindChildrenServices } from './interface.ts';
4
4
  export declare const FIND_CHILD_SERVICE: Token<FindChildService>;
5
5
  export declare const FIND_CHILDREN_SERVICES: Token<FindChildrenServices>;
6
6
  export declare const SCOPE_KEY: unique symbol;
7
+ export declare const RAW_CLASS_KEY = "__raw__";
7
8
  export declare const CONTAINER_TOKEN: InjectionKey<Container>;
@@ -4,4 +4,5 @@ import { FindChildService, FindChildrenServices } from './interface.ts';
4
4
  export declare const FIND_CHILD_SERVICE: Token<FindChildService>;
5
5
  export declare const FIND_CHILDREN_SERVICES: Token<FindChildrenServices>;
6
6
  export declare const SCOPE_KEY: unique symbol;
7
+ export declare const RAW_CLASS_KEY = "__raw__";
7
8
  export declare const CONTAINER_TOKEN: InjectionKey<Container>;
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("@kaokei/di"),o=require("vue"),P=new c.Token("FIND_CHILD_SERVICE"),m=new c.Token("FIND_CHILDREN_SERVICES"),C=Symbol("SCOPE_KEY"),s=Symbol("CONTAINER_TOKEN");function _(t){const e=t,n=o.effectScope(!0);return e[C]=n,n}function b(t){return t[C]}function j(t){const e=t;if(e){const n=b(e);n&&(n.stop(),delete e[C])}}function w(t){const e=b(t);return e||_(t)}function h(t,e,n,r){if(t){for(const i of t)if(i.isCurrentBound(e)&&(n.push(i.get(e)),r)||i.children&&h(i.children,e,n,r))return!0}return!1}function A(t,e){const n=[];return h(e.children,t,n,!0),n[0]}function T(t,e){const n=[];return h(e.children,t,n,!1),n}function V(t,e){return c.isObject(e)?o.reactive(e):e}function H(t){return j(t)}function k({container:t}){return e=>A(e,t)}function F({container:t}){return e=>T(e,t)}function g(t){let e;return t?e=t.createChild():e=new c.Container,e.bind(P).toDynamicValue(k),e.bind(m).toDynamicValue(F),e.onActivation(V),e.onDeactivation(H),e}const d=g();function a(t,e){if(typeof e=="function")e(t);else for(let n=0;n<e.length;n++)t.bind(e[n]).toSelf()}function D(){const t=o.getCurrentInstance();if(t){const e=s,n=t.provides,r=t.parent&&t.parent.provides;if(n&&n!==r&&c.hasOwn(n,e))return n[e]}}function v(){if(o.hasInjectionContext())return o.inject(s,d);throw new Error("getProvideContainer 只能在 setup 中使用")}function L(t){return(D()||v()).get(t)}function K(t){const e=D();if(e)a(e,t);else{const n=v();let r=g(n);a(r,t),o.provide(s,r),o.onUnmounted(()=>{r.destroy(),r=null})}}function q(t){return d.get(t)}function U(t){a(d,t)}function W(t,e){return e.runWithContext(()=>v().get(t))}function N(t,e){e.runWithContext(()=>{const n=o.inject(s,null);if(n)a(n,t);else{let r=g(d);a(r,t),e.provide(s,r),e.onUnmount(()=>{r.destroy(),r=null})}})}function Y(t){return e=>N(t,e)}function R(t,e){const n=e.name;return function(){const r=w(this),i=t,E=o.toRaw(this);let p,f=Object.getPrototypeOf(E);for(;f;){const u=Object.getOwnPropertyDescriptor(f,n);if(u&&u.set){p=u.set;break}f=Object.getPrototypeOf(f)}const S=this,I=p?r.run(()=>o.computed({get:()=>i.call(S),set:u=>p.call(S,u)})):r.run(()=>o.computed(()=>i.call(S)));return Object.defineProperty(E,n,{value:I,writable:!0,configurable:!0,enumerable:!0}),I.value}}function z(t,e){return typeof t=="function"&&(e==null?void 0:e.kind)==="getter"?R(t,e):R}function l(t){return c.isObject(t)?o.markRaw(t):t}function O(t,e){if(e.kind==="accessor")return{get(){return t.get.call(o.toRaw(this))},set(r){t.set.call(o.toRaw(this),l(r))},init:l};const n=e.name;return e.addInitializer(function(){let r;Object.defineProperty(this,n,{configurable:!0,enumerable:!0,get(){return r},set(i){r=l(i)}})}),l}function B(t,e){return(e==null?void 0:e.kind)==="field"||(e==null?void 0:e.kind)==="accessor"?O(t,e):O}function y(t,e){return function(...n){const i=w(this).run(()=>o.effectScope());return i.run(()=>t.call(this,...n)),i}}function G(t,e){return typeof t=="function"&&(e==null?void 0:e.kind)==="method"?y(t):y}exports.Computed=z;exports.FIND_CHILDREN_SERVICES=m;exports.FIND_CHILD_SERVICE=P;exports.Raw=B;exports.RunInScope=G;exports.declareAppProviders=N;exports.declareAppProvidersPlugin=Y;exports.declareProviders=K;exports.declareRootProviders=U;exports.useAppService=W;exports.useRootService=q;exports.useService=L;Object.keys(c).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>c[t]})});
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("@kaokei/di"),o=require("vue"),y=new c.Token("FIND_CHILD_SERVICE"),P=new c.Token("FIND_CHILDREN_SERVICES"),C=Symbol("SCOPE_KEY"),b="__raw__",a=Symbol("CONTAINER_TOKEN");function T(n){const e=n,t=o.effectScope(!0);return e[C]=t,t}function D(n){return n[C]}function V(n){const e=n;if(e){const t=D(e);t&&(t.stop(),delete e[C])}}function N(n){const e=D(n);return e||T(n)}function S(n,e,t,r){if(n){for(const i of n)if(i.isCurrentBound(e)&&(t.push(i.get(e)),r)||S(i.getChildren(),e,t,r))return!0}return!1}function F(n,e){const t=[];return S(e.getChildren(),n,t,!0),t[0]}function H(n,e){const t=[];return S(e.getChildren(),n,t,!1),t}function L(n,e,t){return c.isObject(e)?c.getOwnMetadata(b,t)?o.markRaw(e):o.reactive(e):e}function K(n){return V(n)}function W({container:n}){return e=>F(e,n)}function Y({container:n}){return e=>H(e,n)}function h(n){let e;return n?e=n.createChild():e=new c.Container,e.bind(y).toDynamicValue(W),e.bind(P).toDynamicValue(Y),e.onActivation(L),e.onDeactivation(K),e}const d=h();function s(n,e){if(typeof e=="function")e(n);else for(let t=0;t<e.length;t++)n.bind(e[t]).toSelf()}function A(){const n=o.getCurrentInstance();if(n){const e=a,t=n.provides,r=n.parent&&n.parent.provides;if(t&&t!==r&&c.hasOwn(t,e))return t[e]}}function j(n){if(!o.hasInjectionContext())throw new Error(`${n} must inside setup.`)}function g(){return o.inject(a,d)}function q(n){return j("useService"),(A()||g()).get(n)}function M(n){j("declareProviders");const e=A();if(e)s(e,n);else{const t=g(),r=h(t);s(r,n),o.provide(a,r),o.onUnmounted(()=>{r.destroy()})}}function U(n){return d.get(n)}function z(n){s(d,n)}function B(n,e){return e.runWithContext(()=>g().get(n))}function k(n,e){e.runWithContext(()=>{const t=o.inject(a,null);if(t)s(t,n);else{const r=h(d);s(r,n),e.provide(a,r),e.onUnmount(()=>{r.destroy()})}})}function G(n){return e=>k(n,e)}function _(n,e){const t=e.name;return function(){const r=this,i=o.toRaw(this),R=N(i),E=n;let l,f=Object.getPrototypeOf(i);for(;f;){const u=Object.getOwnPropertyDescriptor(f,t);if(u&&u.set){l=u.set;break}f=Object.getPrototypeOf(f)}const I=l?R.run(()=>o.computed({get:()=>E.call(r),set:u=>l.call(r,u)})):R.run(()=>o.computed(()=>E.call(r)));return Object.defineProperty(i,t,{value:I,writable:!0,configurable:!0,enumerable:!0}),I}}function $(n,e){return typeof n=="function"&&(e==null?void 0:e.kind)==="getter"?_(n,e):_}function p(n){return c.isObject(n)?o.markRaw(n):n}function m(n,e){const t=e.name;e.addInitializer(function(){let r;Object.defineProperty(this,t,{configurable:!0,enumerable:!0,get(){return r},set(i){r=p(i)}})})}function O(n,e){return{get(){return n.get.call(o.toRaw(this))},set(t){n.set.call(o.toRaw(this),p(t))},init:p}}function v(n,e){e.metadata&&(e.metadata[b]=!0)}function J(n,e){return(e==null?void 0:e.kind)==="field"?m(n,e):(e==null?void 0:e.kind)==="accessor"?O(n):(e==null?void 0:e.kind)==="class"?v(n,e):(t,r)=>(r==null?void 0:r.kind)==="field"?m(t,r):(r==null?void 0:r.kind)==="accessor"?O(t):v(t,r)}function w(n,e){return function(...t){const i=N(this).run(()=>o.effectScope());return i.run(()=>n.call(this,...t)),i}}function Q(n,e){return typeof n=="function"&&(e==null?void 0:e.kind)==="method"?w(n):w}exports.Computed=$;exports.FIND_CHILDREN_SERVICES=P;exports.FIND_CHILD_SERVICE=y;exports.Raw=J;exports.RunInScope=Q;exports.declareAppProviders=k;exports.declareAppProvidersPlugin=G;exports.declareProviders=M;exports.declareRootProviders=z;exports.useAppService=B;exports.useRootService=U;exports.useService=q;Object.keys(c).forEach(n=>{n!=="default"&&!Object.prototype.hasOwnProperty.call(exports,n)&&Object.defineProperty(exports,n,{enumerable:!0,get:()=>c[n]})});
package/dist/index.d.cts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from '@kaokei/di';
2
2
  export { useService, declareProviders, useRootService, declareRootProviders, useAppService, declareAppProviders, declareAppProvidersPlugin, } from './core.ts';
3
3
  export { FIND_CHILD_SERVICE, FIND_CHILDREN_SERVICES } from './constants.ts';
4
+ export type { FindChildService, FindChildrenServices } from './interface.ts';
4
5
  export { Computed } from './computed.ts';
5
6
  export { Raw } from './raw.ts';
6
7
  export { RunInScope } from './effect-scope.ts';
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from '@kaokei/di';
2
2
  export { useService, declareProviders, useRootService, declareRootProviders, useAppService, declareAppProviders, declareAppProvidersPlugin, } from './core.ts';
3
3
  export { FIND_CHILD_SERVICE, FIND_CHILDREN_SERVICES } from './constants.ts';
4
+ export type { FindChildService, FindChildrenServices } from './interface.ts';
4
5
  export { Computed } from './computed.ts';
5
6
  export { Raw } from './raw.ts';
6
7
  export { RunInScope } from './effect-scope.ts';
package/dist/index.js CHANGED
@@ -1,170 +1,162 @@
1
- import { Token as R, Container as k, isObject as w, hasOwn as A } from "@kaokei/di";
1
+ import { Token as D, Container as H, isObject as v, getOwnMetadata as j, hasOwn as K } from "@kaokei/di";
2
2
  export * from "@kaokei/di";
3
- import { effectScope as N, reactive as T, inject as P, provide as V, onUnmounted as H, getCurrentInstance as j, hasInjectionContext as F, toRaw as p, computed as I, markRaw as K } from "vue";
4
- const L = new R(
3
+ import { effectScope as N, markRaw as P, reactive as L, inject as b, provide as W, onUnmounted as Y, hasInjectionContext as U, getCurrentInstance as z, toRaw as d, computed as E } from "vue";
4
+ const B = new D(
5
5
  "FIND_CHILD_SERVICE"
6
- ), U = new R(
6
+ ), G = new D(
7
7
  "FIND_CHILDREN_SERVICES"
8
- ), h = Symbol("SCOPE_KEY"), c = Symbol("CONTAINER_TOKEN");
9
- function W(n) {
8
+ ), p = Symbol("SCOPE_KEY"), k = "__raw__", u = Symbol("CONTAINER_TOKEN");
9
+ function M(n) {
10
10
  const e = n, t = N(!0);
11
- return e[h] = t, t;
11
+ return e[p] = t, t;
12
12
  }
13
- function b(n) {
14
- return n[h];
13
+ function A(n) {
14
+ return n[p];
15
15
  }
16
- function Y(n) {
16
+ function $(n) {
17
17
  const e = n;
18
18
  if (e) {
19
- const t = b(e);
20
- t && (t.stop(), delete e[h]);
19
+ const t = A(e);
20
+ t && (t.stop(), delete e[p]);
21
21
  }
22
22
  }
23
- function D(n) {
24
- const e = b(n);
25
- return e || W(n);
23
+ function T(n) {
24
+ const e = A(n);
25
+ return e || M(n);
26
26
  }
27
27
  function C(n, e, t, r) {
28
28
  if (n) {
29
29
  for (const o of n)
30
- if (o.isCurrentBound(e) && (t.push(o.get(e)), r) || o.children && C(o.children, e, t, r))
30
+ if (o.isCurrentBound(e) && (t.push(o.get(e)), r) || C(o.getChildren(), e, t, r))
31
31
  return !0;
32
32
  }
33
33
  return !1;
34
34
  }
35
- function z(n, e) {
35
+ function q(n, e) {
36
36
  const t = [];
37
- return C(e.children, n, t, !0), t[0];
37
+ return C(e.getChildren(), n, t, !0), t[0];
38
38
  }
39
- function B(n, e) {
39
+ function J(n, e) {
40
40
  const t = [];
41
- return C(e.children, n, t, !1), t;
41
+ return C(e.getChildren(), n, t, !1), t;
42
42
  }
43
- function G(n, e) {
44
- return w(e) ? T(e) : e;
43
+ function Q(n, e, t) {
44
+ return v(e) ? j(k, t) ? P(e) : L(e) : e;
45
45
  }
46
- function q(n) {
47
- return Y(n);
46
+ function X(n) {
47
+ return $(n);
48
48
  }
49
- function J({ container: n }) {
50
- return (e) => z(e, n);
49
+ function Z({ container: n }) {
50
+ return (e) => q(e, n);
51
51
  }
52
- function M({
52
+ function x({
53
53
  container: n
54
54
  }) {
55
- return (e) => B(e, n);
55
+ return (e) => J(e, n);
56
56
  }
57
57
  function S(n) {
58
58
  let e;
59
- return n ? e = n.createChild() : e = new k(), e.bind(L).toDynamicValue(J), e.bind(U).toDynamicValue(M), e.onActivation(G), e.onDeactivation(q), e;
59
+ return n ? e = n.createChild() : e = new H(), e.bind(B).toDynamicValue(Z), e.bind(G).toDynamicValue(x), e.onActivation(Q), e.onDeactivation(X), e;
60
60
  }
61
61
  const a = S();
62
- function u(n, e) {
62
+ function c(n, e) {
63
63
  if (typeof e == "function")
64
64
  e(n);
65
65
  else
66
66
  for (let t = 0; t < e.length; t++)
67
67
  n.bind(e[t]).toSelf();
68
68
  }
69
- function _() {
70
- const n = j();
69
+ function V() {
70
+ const n = z();
71
71
  if (n) {
72
- const e = c, t = n.provides, r = n.parent && n.parent.provides;
73
- if (t && t !== r && A(t, e))
72
+ const e = u, t = n.provides, r = n.parent && n.parent.provides;
73
+ if (t && t !== r && K(t, e))
74
74
  return t[e];
75
75
  }
76
76
  }
77
- function g() {
78
- if (F())
79
- return P(c, a);
80
- throw new Error("getProvideContainer 只能在 setup 中使用");
77
+ function F(n) {
78
+ if (!U())
79
+ throw new Error(`${n} must inside setup.`);
81
80
  }
82
- function $(n) {
83
- return (_() || g()).get(n);
81
+ function h() {
82
+ return b(u, a);
83
+ }
84
+ function re(n) {
85
+ return F("useService"), (V() || h()).get(n);
84
86
  }
85
- function x(n) {
86
- const e = _();
87
+ function oe(n) {
88
+ F("declareProviders");
89
+ const e = V();
87
90
  if (e)
88
- u(e, n);
91
+ c(e, n);
89
92
  else {
90
- const t = g();
91
- let r = S(t);
92
- u(r, n), V(c, r), H(() => {
93
- r.destroy(), r = null;
93
+ const t = h(), r = S(t);
94
+ c(r, n), W(u, r), Y(() => {
95
+ r.destroy();
94
96
  });
95
97
  }
96
98
  }
97
- function ee(n) {
99
+ function ie(n) {
98
100
  return a.get(n);
99
101
  }
100
- function ne(n) {
101
- u(a, n);
102
+ function ue(n) {
103
+ c(a, n);
102
104
  }
103
- function te(n, e) {
104
- return e.runWithContext(() => g().get(n));
105
+ function ce(n, e) {
106
+ return e.runWithContext(() => h().get(n));
105
107
  }
106
- function Q(n, e) {
108
+ function ee(n, e) {
107
109
  e.runWithContext(() => {
108
- const t = P(c, null);
110
+ const t = b(u, null);
109
111
  if (t)
110
- u(t, n);
112
+ c(t, n);
111
113
  else {
112
- let r = S(a);
113
- u(r, n), e.provide(c, r), e.onUnmount(() => {
114
- r.destroy(), r = null;
114
+ const r = S(a);
115
+ c(r, n), e.provide(u, r), e.onUnmount(() => {
116
+ r.destroy();
115
117
  });
116
118
  }
117
119
  });
118
120
  }
119
- function re(n) {
120
- return (e) => Q(n, e);
121
+ function se(n) {
122
+ return (e) => ee(n, e);
121
123
  }
122
- function O(n, e) {
124
+ function I(n, e) {
123
125
  const t = e.name;
124
126
  return function() {
125
- const r = D(this), o = n, m = p(this);
126
- let l, s = Object.getPrototypeOf(m);
127
+ const r = this, o = d(this), g = T(o), m = n;
128
+ let f, s = Object.getPrototypeOf(o);
127
129
  for (; s; ) {
128
130
  const i = Object.getOwnPropertyDescriptor(s, t);
129
131
  if (i && i.set) {
130
- l = i.set;
132
+ f = i.set;
131
133
  break;
132
134
  }
133
135
  s = Object.getPrototypeOf(s);
134
136
  }
135
- const d = this, E = l ? r.run(
136
- () => I({
137
- get: () => o.call(d),
138
- set: (i) => l.call(d, i)
137
+ const _ = f ? g.run(
138
+ () => E({
139
+ get: () => m.call(r),
140
+ set: (i) => f.call(r, i)
139
141
  })
140
- ) : r.run(() => I(() => o.call(d)));
141
- return Object.defineProperty(m, t, {
142
- value: E,
142
+ ) : g.run(() => E(() => m.call(r)));
143
+ return Object.defineProperty(o, t, {
144
+ value: _,
143
145
  writable: !0,
144
146
  configurable: !0,
145
147
  enumerable: !0
146
- }), E.value;
148
+ }), _;
147
149
  };
148
150
  }
149
- function oe(n, e) {
150
- return typeof n == "function" && (e == null ? void 0 : e.kind) === "getter" ? O(n, e) : O;
151
+ function ae(n, e) {
152
+ return typeof n == "function" && (e == null ? void 0 : e.kind) === "getter" ? I(n, e) : I;
151
153
  }
152
- function f(n) {
153
- return w(n) ? K(n) : n;
154
+ function l(n) {
155
+ return v(n) ? P(n) : n;
154
156
  }
155
- function v(n, e) {
156
- if (e.kind === "accessor")
157
- return {
158
- get() {
159
- return n.get.call(p(this));
160
- },
161
- set(r) {
162
- n.set.call(p(this), f(r));
163
- },
164
- init: f
165
- };
157
+ function w(n, e) {
166
158
  const t = e.name;
167
- return e.addInitializer(function() {
159
+ e.addInitializer(function() {
168
160
  let r;
169
161
  Object.defineProperty(this, t, {
170
162
  configurable: !0,
@@ -173,34 +165,48 @@ function v(n, e) {
173
165
  return r;
174
166
  },
175
167
  set(o) {
176
- r = f(o);
168
+ r = l(o);
177
169
  }
178
170
  });
179
- }), f;
171
+ });
172
+ }
173
+ function O(n, e) {
174
+ return {
175
+ get() {
176
+ return n.get.call(d(this));
177
+ },
178
+ set(t) {
179
+ n.set.call(d(this), l(t));
180
+ },
181
+ init: l
182
+ };
180
183
  }
181
- function ie(n, e) {
182
- return (e == null ? void 0 : e.kind) === "field" || (e == null ? void 0 : e.kind) === "accessor" ? v(n, e) : v;
184
+ function R(n, e) {
185
+ e.metadata && (e.metadata[k] = !0);
186
+ }
187
+ function fe(n, e) {
188
+ return (e == null ? void 0 : e.kind) === "field" ? w(n, e) : (e == null ? void 0 : e.kind) === "accessor" ? O(n) : (e == null ? void 0 : e.kind) === "class" ? R(n, e) : (t, r) => (r == null ? void 0 : r.kind) === "field" ? w(t, r) : (r == null ? void 0 : r.kind) === "accessor" ? O(t) : R(t, r);
183
189
  }
184
190
  function y(n, e) {
185
191
  return function(...t) {
186
- const o = D(this).run(() => N());
192
+ const o = T(this).run(() => N());
187
193
  return o.run(() => n.call(this, ...t)), o;
188
194
  };
189
195
  }
190
- function ce(n, e) {
196
+ function de(n, e) {
191
197
  return typeof n == "function" && (e == null ? void 0 : e.kind) === "method" ? y(n) : y;
192
198
  }
193
199
  export {
194
- oe as Computed,
195
- U as FIND_CHILDREN_SERVICES,
196
- L as FIND_CHILD_SERVICE,
197
- ie as Raw,
198
- ce as RunInScope,
199
- Q as declareAppProviders,
200
- re as declareAppProvidersPlugin,
201
- x as declareProviders,
202
- ne as declareRootProviders,
203
- te as useAppService,
204
- ee as useRootService,
205
- $ as useService
200
+ ae as Computed,
201
+ G as FIND_CHILDREN_SERVICES,
202
+ B as FIND_CHILD_SERVICE,
203
+ fe as Raw,
204
+ de as RunInScope,
205
+ ee as declareAppProviders,
206
+ se as declareAppProvidersPlugin,
207
+ oe as declareProviders,
208
+ ue as declareRootProviders,
209
+ ce as useAppService,
210
+ ie as useRootService,
211
+ re as useService
206
212
  };
package/dist/raw.d.cts CHANGED
@@ -2,5 +2,7 @@
2
2
  * 将值标记为 raw(如果是对象则调用 markRaw,否则原样返回)
3
3
  */
4
4
  export declare function ensureRaw(val: unknown): unknown;
5
- export declare function Raw(): (value: any, context: ClassFieldDecoratorContext | ClassAccessorDecoratorContext) => any;
6
- export declare function Raw(value: any, context: ClassFieldDecoratorContext | ClassAccessorDecoratorContext): any;
5
+ export declare function Raw(): (value: any, context: ClassFieldDecoratorContext | ClassAccessorDecoratorContext | ClassDecoratorContext) => any;
6
+ export declare function Raw(value: any, context: ClassFieldDecoratorContext): void;
7
+ export declare function Raw(value: any, context: ClassAccessorDecoratorContext): ClassAccessorDecoratorResult<any, any>;
8
+ export declare function Raw(value: any, context: ClassDecoratorContext): void;
package/dist/raw.d.ts CHANGED
@@ -2,5 +2,7 @@
2
2
  * 将值标记为 raw(如果是对象则调用 markRaw,否则原样返回)
3
3
  */
4
4
  export declare function ensureRaw(val: unknown): unknown;
5
- export declare function Raw(): (value: any, context: ClassFieldDecoratorContext | ClassAccessorDecoratorContext) => any;
6
- export declare function Raw(value: any, context: ClassFieldDecoratorContext | ClassAccessorDecoratorContext): any;
5
+ export declare function Raw(): (value: any, context: ClassFieldDecoratorContext | ClassAccessorDecoratorContext | ClassDecoratorContext) => any;
6
+ export declare function Raw(value: any, context: ClassFieldDecoratorContext): void;
7
+ export declare function Raw(value: any, context: ClassAccessorDecoratorContext): ClassAccessorDecoratorResult<any, any>;
8
+ export declare function Raw(value: any, context: ClassDecoratorContext): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaokei/use-vue-service",
3
- "version": "4.0.1",
3
+ "version": "4.0.2",
4
4
  "type": "module",
5
5
  "description": "Lightweight Vue 3 state management with dependency injection, inspired by Angular services.",
6
6
  "main": "./dist/index.cjs",
@@ -53,10 +53,10 @@
53
53
  "docs:preview": "vitepress preview docs"
54
54
  },
55
55
  "peerDependencies": {
56
- "@kaokei/di": "^5.0.4"
56
+ "@kaokei/di": "^5.0.8"
57
57
  },
58
58
  "devDependencies": {
59
- "@kaokei/di": "^5.0.4",
59
+ "@kaokei/di": "^5.0.8",
60
60
  "@types/node": "^22.15.17",
61
61
  "@vitejs/plugin-vue": "^6.0.0",
62
62
  "@vitest/coverage-v8": "^3.1.1",