mobx-mantle 0.3.7 → 0.7.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/README.md +1558 -722
- package/dist/behaviors/index.cjs +419 -0
- package/dist/behaviors/index.cjs.map +1 -0
- package/dist/behaviors/index.d.cts +275 -0
- package/dist/behaviors/index.d.ts +275 -0
- package/dist/behaviors/index.js +419 -0
- package/dist/behaviors/index.js.map +1 -0
- package/dist/chunk-LP5TAGSI.js +9 -0
- package/dist/chunk-LP5TAGSI.js.map +1 -0
- package/dist/chunk-WNF647U6.cjs +9 -0
- package/dist/chunk-WNF647U6.cjs.map +1 -0
- package/dist/index.cjs +1237 -256
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +468 -83
- package/dist/index.d.ts +468 -83
- package/dist/index.js +1223 -197
- package/dist/index.js.map +1 -1
- package/dist/reactive-args-BBucrU54.d.cts +32 -0
- package/dist/reactive-args-BBucrU54.d.ts +32 -0
- package/dist/testing/index.cjs +33 -0
- package/dist/testing/index.cjs.map +1 -0
- package/dist/testing/index.d.cts +18 -0
- package/dist/testing/index.d.ts +18 -0
- package/dist/testing/index.js +33 -0
- package/dist/testing/index.js.map +1 -0
- package/package.json +42 -8
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/testing/index.tsx"],"sourcesContent":["import React from 'react';\n// Import the public core, including in CJS: one construction runtime/context.\nimport { ModelProvider, ServiceProvider, type ModelClass, type ModelSubstitution, type ServiceToken, type ServiceResolver } from 'mobx-mantle';\n\n/** Test-local registrations. Providers snapshot them at mount; no global mocks. */\nexport function createTestScope(options: { resolve?: ServiceResolver } = {}) {\n const services = new Map<ServiceToken<any>, object>();\n const models = new Map<ModelClass, ModelSubstitution>();\n return {\n service<T extends object>(token: ServiceToken<T>, value: T) { services.set(token, value); },\n model<C extends InstanceType<ModelClass>>(type: ModelClass<C>, state: () => object, options?: { template?: (model: C) => React.JSX.Element }) {\n models.set(type, { state, template: options?.template } as ModelSubstitution);\n },\n Provider({ children }: { children?: React.ReactNode }) {\n const [snapshot] = React.useState(() => {\n const values = new Map(services);\n const fallback = options.resolve;\n const resolve: ServiceResolver = token => {\n if (values.has(token)) return values.get(token) as any;\n if (fallback) return fallback(token);\n throw new Error(`[mobx-mantle/testing] No service registered for ${String(token)}.`);\n };\n return { resolve, models: new Map(models) };\n });\n return <ServiceProvider resolve={snapshot.resolve}><ModelProvider models={snapshot.models}>{children}</ModelProvider></ServiceProvider>;\n },\n };\n}\n"],"mappings":";AAAA,OAAO,WAAW;AAElB,SAAS,eAAe,uBAAyG;AAsBxE;AAnBlD,SAAS,gBAAgB,UAAyC,CAAC,GAAG;AAC3E,QAAM,WAAW,oBAAI,IAA+B;AACpD,QAAM,SAAS,oBAAI,IAAmC;AACtD,SAAO;AAAA,IACL,QAA0B,OAAwB,OAAU;AAAE,eAAS,IAAI,OAAO,KAAK;AAAA,IAAG;AAAA,IAC1F,MAA0C,MAAqB,OAAqBA,UAA0D;AAC5I,aAAO,IAAI,MAAM,EAAE,OAAO,UAAUA,UAAS,SAAS,CAAsB;AAAA,IAC9E;AAAA,IACA,SAAS,EAAE,SAAS,GAAmC;AACrD,YAAM,CAAC,QAAQ,IAAI,MAAM,SAAS,MAAM;AACtC,cAAM,SAAS,IAAI,IAAI,QAAQ;AAC/B,cAAM,WAAW,QAAQ;AACzB,cAAM,UAA2B,WAAS;AACxC,cAAI,OAAO,IAAI,KAAK,EAAG,QAAO,OAAO,IAAI,KAAK;AAC9C,cAAI,SAAU,QAAO,SAAS,KAAK;AACnC,gBAAM,IAAI,MAAM,mDAAmD,OAAO,KAAK,CAAC,GAAG;AAAA,QACrF;AACA,eAAO,EAAE,SAAS,QAAQ,IAAI,IAAI,MAAM,EAAE;AAAA,MAC5C,CAAC;AACD,aAAO,oBAAC,mBAAgB,SAAS,SAAS,SAAS,8BAAC,iBAAc,QAAQ,SAAS,QAAS,UAAS,GAAgB;AAAA,IACvH;AAAA,EACF;AACF;","names":["options"]}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mobx-mantle",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "A lightweight library for building React components with a familiar class-based API and MobX reactivity built in.",
|
|
5
5
|
"author": "Craig Albert <me@craigalbert.com>",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
|
-
"url": "https://github.com/craigthings/mobx-mantle"
|
|
8
|
+
"url": "git+https://github.com/craigthings/mobx-mantle.git"
|
|
9
9
|
},
|
|
10
10
|
"homepage": "https://github.com/craigthings/mobx-mantle#readme",
|
|
11
11
|
"bugs": {
|
|
@@ -33,33 +33,67 @@
|
|
|
33
33
|
"types": "./dist/index.d.cts",
|
|
34
34
|
"default": "./dist/index.cjs"
|
|
35
35
|
}
|
|
36
|
+
},
|
|
37
|
+
"./behaviors": {
|
|
38
|
+
"import": {
|
|
39
|
+
"types": "./dist/behaviors/index.d.ts",
|
|
40
|
+
"default": "./dist/behaviors/index.js"
|
|
41
|
+
},
|
|
42
|
+
"require": {
|
|
43
|
+
"types": "./dist/behaviors/index.d.cts",
|
|
44
|
+
"default": "./dist/behaviors/index.cjs"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"./testing": {
|
|
48
|
+
"import": {
|
|
49
|
+
"types": "./dist/testing/index.d.ts",
|
|
50
|
+
"default": "./dist/testing/index.js"
|
|
51
|
+
},
|
|
52
|
+
"require": {
|
|
53
|
+
"types": "./dist/testing/index.d.cts",
|
|
54
|
+
"default": "./dist/testing/index.cjs"
|
|
55
|
+
}
|
|
36
56
|
}
|
|
37
57
|
},
|
|
38
58
|
"files": [
|
|
39
59
|
"dist"
|
|
40
60
|
],
|
|
41
61
|
"sideEffects": false,
|
|
62
|
+
"engines": {
|
|
63
|
+
"node": ">=24 <25",
|
|
64
|
+
"npm": ">=11"
|
|
65
|
+
},
|
|
42
66
|
"scripts": {
|
|
43
67
|
"dev": "vite",
|
|
44
68
|
"build": "tsup",
|
|
45
|
-
"
|
|
69
|
+
"test": "vitest run",
|
|
70
|
+
"test:watch": "vitest",
|
|
71
|
+
"test:types": "tsc --noEmit -p tsconfig.test.json",
|
|
72
|
+
"prepublishOnly": "npm run build",
|
|
73
|
+
"test:package": "npm run build && node test/package-entries.mjs && node test/package-types.mjs"
|
|
46
74
|
},
|
|
47
75
|
"peerDependencies": {
|
|
48
76
|
"mobx": ">=6.0.0",
|
|
49
|
-
"
|
|
50
|
-
"react": ">=17.0.0"
|
|
77
|
+
"react": ">=18.0.0"
|
|
51
78
|
},
|
|
52
79
|
"devDependencies": {
|
|
53
|
-
"@
|
|
80
|
+
"@testing-library/dom": "^10.4.1",
|
|
81
|
+
"@testing-library/react": "^16.3.2",
|
|
82
|
+
"@types/node": "^24.0.0",
|
|
54
83
|
"@types/react": "^18.2.0",
|
|
55
84
|
"@types/react-dom": "^18.2.0",
|
|
56
85
|
"@vitejs/plugin-react": "^4.2.0",
|
|
86
|
+
"@vitest/coverage-v8": "^3.2.7",
|
|
87
|
+
"expect-type": "^1.4.0",
|
|
88
|
+
"jsdom": "^29.1.1",
|
|
57
89
|
"mobx": "^6.12.0",
|
|
58
|
-
"mobx-react-lite": "^4.0.0",
|
|
59
90
|
"react": "^18.2.0",
|
|
60
91
|
"react-dom": "^18.2.0",
|
|
92
|
+
"reflect-metadata": "^0.2.2",
|
|
61
93
|
"tsup": "^8.0.0",
|
|
94
|
+
"tsyringe": "^4.10.0",
|
|
62
95
|
"typescript": "^5.3.0",
|
|
63
|
-
"vite": "^5.0.0"
|
|
96
|
+
"vite": "^5.0.0",
|
|
97
|
+
"vitest": "^3.2.7"
|
|
64
98
|
}
|
|
65
99
|
}
|