@snack-kit/core 0.1.0 → 0.3.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.
@@ -1229,8 +1229,22 @@ interface Props {
1229
1229
  }
1230
1230
  declare const Loading: (props: Props) => React.JSX.Element;
1231
1231
 
1232
+ /**
1233
+ * 统一的 React Root 接口,兼容 React 17/18/19
1234
+ */
1235
+ interface SnackReactRoot {
1236
+ render: (element: React.ReactElement) => void;
1237
+ unmount: () => void;
1238
+ }
1239
+ /**
1240
+ * 运行时检测 React 主版本号,返回对应的挂载/卸载接口。
1241
+ * - React 18+:使用 `createRoot`(react-dom/client)
1242
+ * - React 17:使用旧版 `ReactDOM.render` / `unmountComponentAtNode`
1243
+ */
1244
+ declare function createReactRoot(container: Element): SnackReactRoot;
1245
+
1232
1246
  declare const _default: {
1233
1247
  version: string;
1234
1248
  };
1235
1249
 
1236
- export { Core, type CoreConfig, DisplayModule, type DropChildrenItem, Error$1 as Error, type ExprArgv, type FormDataFormatArgs, GetDefaultEvents, GetParamsDetails, type I18nMap, type ImportModules, type LoadConfig, type LoadModuleConfig, type LoadModuleURLConfig, Loading, type ModuleConfig, ParamsDetails, type RenderPageConfig, type RenderPageRule, type RequireConfig, Snack, type SnackCreateModule, type SnackData, type SnackDefineFunction, type SnackEvent, type SnackFormAttribute, type SnackFormVerifyRule, type SnackMapItem, type SnackPageCompleteEvent, type SnackPageConfig, type SnackPageContent, type SnackPageContentModule, type SnackPageData, type SnackPageParams, type SnackRequireFunction, SnackSDK, SnackSetting, type SnackSettingModelItem, _default as default, enParamsDetails, evalFunc, replaceVars };
1250
+ export { Core, type CoreConfig, DisplayModule, type DropChildrenItem, Error$1 as Error, type ExprArgv, type FormDataFormatArgs, GetDefaultEvents, GetParamsDetails, type I18nMap, type ImportModules, type LoadConfig, type LoadModuleConfig, type LoadModuleURLConfig, Loading, type ModuleConfig, ParamsDetails, type RenderPageConfig, type RenderPageRule, type RequireConfig, Snack, type SnackCreateModule, type SnackData, type SnackDefineFunction, type SnackEvent, type SnackFormAttribute, type SnackFormVerifyRule, type SnackMapItem, type SnackPageCompleteEvent, type SnackPageConfig, type SnackPageContent, type SnackPageContentModule, type SnackPageData, type SnackPageParams, type SnackReactRoot, type SnackRequireFunction, SnackSDK, SnackSetting, type SnackSettingModelItem, createReactRoot, _default as default, enParamsDetails, evalFunc, replaceVars };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snack-kit/core",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/es/index.js",
6
6
  "typings": "dist/types/index.d.ts",
@@ -33,9 +33,11 @@
33
33
  "author": "",
34
34
  "license": "ISC",
35
35
  "dependencies": {
36
- "@snack-kit/lib": "^0.6.0",
37
- "react": "^19.2.0",
38
- "react-dom": "^19.2.0"
36
+ "@snack-kit/lib": "^0.6.0"
37
+ },
38
+ "peerDependencies": {
39
+ "react": ">=17.0.0",
40
+ "react-dom": ">=17.0.0"
39
41
  },
40
42
  "devDependencies": {
41
43
  "@swc/core": "^1.15.18",
@@ -46,6 +48,8 @@
46
48
  "html-webpack-plugin": "^5.6.6",
47
49
  "jsdom": "^24.0.0",
48
50
  "minimist": "^1.2.8",
51
+ "react": "^19.2.0",
52
+ "react-dom": "^19.2.0",
49
53
  "rimraf": "^5.0.0",
50
54
  "sass": "^1.97.3",
51
55
  "sass-loader": "^16.0.7",