@pixpilot/formily-shadcn 2.0.4 → 2.2.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.
Files changed (38) hide show
  1. package/dist/components/array-dialog/EditDialog.cjs +1 -1
  2. package/dist/components/array-dialog/EditDialog.js +2 -2
  3. package/dist/components/array-drawer/EditDrawer.cjs +1 -1
  4. package/dist/components/array-drawer/EditDrawer.js +2 -2
  5. package/dist/components/array-popover/Popover.cjs +1 -1
  6. package/dist/components/array-popover/Popover.js +1 -1
  7. package/dist/components/array-toggle-group/ArrayToggleGroup.d.ts +2 -2
  8. package/dist/components/column/Column.d.ts +2 -2
  9. package/dist/components/date-picker/DatePicker.d.cts +3 -3
  10. package/dist/components/dialog-item/BaseDialogItem.cjs +1 -2
  11. package/dist/components/dialog-item/BaseDialogItem.js +1 -2
  12. package/dist/components/dialog-item/ConnectedDialogItem.d.cts +4 -4
  13. package/dist/components/drawer-item/BaseDrawerItem.cjs +1 -2
  14. package/dist/components/drawer-item/BaseDrawerItem.js +1 -2
  15. package/dist/components/drawer-item/ConnectedDrawerItem.d.cts +4 -4
  16. package/dist/components/form/Form.d.cts +2 -2
  17. package/dist/components/form/Form.d.ts +2 -2
  18. package/dist/components/form/mcp.js +38 -1
  19. package/dist/components/form-grid/FormGrid.d.cts +2 -2
  20. package/dist/components/form-grid/FormGrid.d.ts +2 -2
  21. package/dist/components/popover-item/BasePopoverItem.cjs +3 -2
  22. package/dist/components/popover-item/BasePopoverItem.js +8 -8
  23. package/dist/components/radio/Radio.d.cts +2 -2
  24. package/dist/components/radio/Radio.d.ts +2 -2
  25. package/dist/components/rich-text-editor/mcp.js +53 -8
  26. package/dist/components/row/Row.d.cts +2 -2
  27. package/dist/components/row/Row.d.ts +2 -2
  28. package/dist/components/schema-field/schema-field-basics.d.cts +380 -380
  29. package/dist/components/schema-field/schema-field-basics.d.ts +380 -380
  30. package/dist/components/schema-field/schema-field-extended.d.cts +534 -534
  31. package/dist/components/schema-field/schema-field-extended.d.ts +534 -534
  32. package/dist/components/schema-field/schema-field.d.cts +467 -467
  33. package/dist/components/schema-field/schema-field.d.ts +467 -467
  34. package/dist/{components/array-common → shadcn-ui/src/shake-styles}/ShakeStyles.cjs +2 -2
  35. package/dist/{components/array-common → shadcn-ui/src/shake-styles}/ShakeStyles.js +1 -1
  36. package/dist/utils/transform-schema.cjs +26 -6
  37. package/dist/utils/transform-schema.js +26 -6
  38. package/package.json +7 -6
@@ -1,10 +1,10 @@
1
- const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
1
+ const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
2
  let react = require("react");
3
3
  react = require_rolldown_runtime.__toESM(react);
4
4
  let react_jsx_runtime = require("react/jsx-runtime");
5
5
  react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
6
6
 
7
- //#region src/components/array-common/ShakeStyles.tsx
7
+ //#region ../shadcn-ui/src/shake-styles/ShakeStyles.tsx
8
8
  /**
9
9
  * Inline styles for shake animation
10
10
  * Can be included in any component that needs shake effect
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { jsx } from "react/jsx-runtime";
3
3
 
4
- //#region src/components/array-common/ShakeStyles.tsx
4
+ //#region ../shadcn-ui/src/shake-styles/ShakeStyles.tsx
5
5
  /**
6
6
  * Inline styles for shake animation
7
7
  * Can be included in any component that needs shake effect
@@ -26,13 +26,33 @@ const inputSchemaMap = {
26
26
  },
27
27
  object: { "x-component": "ObjectContainer" }
28
28
  };
29
- function transformSchema(schema, fieldsDecorators) {
30
- let normalizedSchema;
31
- try {
32
- normalizedSchema = JSON.parse(JSON.stringify(schema));
33
- } catch {
34
- normalizedSchema = JSON.parse(JSON.stringify(schema));
29
+ /**
30
+ * Deep-clone the plain-object/array structure of a schema while keeping any
31
+ * non-plain values (functions, class instances such as TipTap extensions,
32
+ * Dates, etc.) by reference.
33
+ *
34
+ * A plain `JSON.parse(JSON.stringify(...))` clone silently drops function
35
+ * values, which breaks `x-component-props` that carry callbacks (e.g. custom
36
+ * toolbar `onClick` handlers) or class instances (e.g. TipTap `extensions`,
37
+ * whose `parseHTML`/`renderHTML` methods would be stripped). This clone only
38
+ * copies plain objects and arrays — the parts `transformSchema` actually
39
+ * mutates — and leaves everything else untouched.
40
+ */
41
+ function cloneSchemaPreservingRefs(value) {
42
+ if (Array.isArray(value)) return value.map((item) => cloneSchemaPreservingRefs(item));
43
+ if (value !== null && typeof value === "object") {
44
+ const proto = Object.getPrototypeOf(value);
45
+ if (proto === Object.prototype || proto === null) {
46
+ const source = value;
47
+ const out = {};
48
+ for (const key of Object.keys(source)) out[key] = cloneSchemaPreservingRefs(source[key]);
49
+ return out;
50
+ }
35
51
  }
52
+ return value;
53
+ }
54
+ function transformSchema(schema, fieldsDecorators) {
55
+ const normalizedSchema = cloneSchemaPreservingRefs(schema);
36
56
  (0, json_schema_traverse.default)(normalizedSchema, { allKeys: true }, (currentSchema, _jsonPtr, _rootSchema, _parentJSONPtr, parentKeyword, _parentSchema, _keyIndex) => {
37
57
  const { type } = currentSchema;
38
58
  const xComponent = currentSchema["x-component"];
@@ -24,13 +24,33 @@ const inputSchemaMap = {
24
24
  },
25
25
  object: { "x-component": "ObjectContainer" }
26
26
  };
27
- function transformSchema(schema, fieldsDecorators) {
28
- let normalizedSchema;
29
- try {
30
- normalizedSchema = JSON.parse(JSON.stringify(schema));
31
- } catch {
32
- normalizedSchema = JSON.parse(JSON.stringify(schema));
27
+ /**
28
+ * Deep-clone the plain-object/array structure of a schema while keeping any
29
+ * non-plain values (functions, class instances such as TipTap extensions,
30
+ * Dates, etc.) by reference.
31
+ *
32
+ * A plain `JSON.parse(JSON.stringify(...))` clone silently drops function
33
+ * values, which breaks `x-component-props` that carry callbacks (e.g. custom
34
+ * toolbar `onClick` handlers) or class instances (e.g. TipTap `extensions`,
35
+ * whose `parseHTML`/`renderHTML` methods would be stripped). This clone only
36
+ * copies plain objects and arrays — the parts `transformSchema` actually
37
+ * mutates — and leaves everything else untouched.
38
+ */
39
+ function cloneSchemaPreservingRefs(value) {
40
+ if (Array.isArray(value)) return value.map((item) => cloneSchemaPreservingRefs(item));
41
+ if (value !== null && typeof value === "object") {
42
+ const proto = Object.getPrototypeOf(value);
43
+ if (proto === Object.prototype || proto === null) {
44
+ const source = value;
45
+ const out = {};
46
+ for (const key of Object.keys(source)) out[key] = cloneSchemaPreservingRefs(source[key]);
47
+ return out;
48
+ }
33
49
  }
50
+ return value;
51
+ }
52
+ function transformSchema(schema, fieldsDecorators) {
53
+ const normalizedSchema = cloneSchemaPreservingRefs(schema);
34
54
  traverse(normalizedSchema, { allKeys: true }, (currentSchema, _jsonPtr, _rootSchema, _parentJSONPtr, parentKeyword, _parentSchema, _keyIndex) => {
35
55
  const { type } = currentSchema;
36
56
  const xComponent = currentSchema["x-component"];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pixpilot/formily-shadcn",
3
3
  "type": "module",
4
- "version": "2.0.4",
4
+ "version": "2.2.0",
5
5
  "description": "Formily integration for shadcn/ui components",
6
6
  "author": "m.doaie <m.doaie@hotmail.com>",
7
7
  "license": "MIT",
@@ -50,12 +50,13 @@
50
50
  "lucide-react": "^0.562.0",
51
51
  "pretty-bytes": "^7.1.0",
52
52
  "zod": "^4.3.6",
53
- "@pixpilot/shadcn-ui": "3.4.0",
54
- "@pixpilot/shadcn": "2.1.0"
53
+ "@pixpilot/shadcn": "2.1.0",
54
+ "@pixpilot/shadcn-ui": "3.6.0"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@storybook/react": "^8.6.18",
58
58
  "@testing-library/react": "^16.3.2",
59
+ "@tiptap/core": "^3.22.3",
59
60
  "@types/node": "^22.19.17",
60
61
  "@types/react": "^19.2.14",
61
62
  "@types/react-dom": "^19.2.3",
@@ -66,11 +67,11 @@
66
67
  "tsx": "^4.21.0",
67
68
  "typescript": "^5.9.3",
68
69
  "@internal/eslint-config": "0.3.0",
69
- "@internal/mcp": "0.0.0",
70
70
  "@internal/prettier-config": "0.0.1",
71
- "@internal/tsconfig": "0.1.0",
71
+ "@internal/mcp": "0.0.0",
72
+ "@internal/vitest-config": "0.1.0",
72
73
  "@internal/tsdown-config": "0.1.0",
73
- "@internal/vitest-config": "0.1.0"
74
+ "@internal/tsconfig": "0.1.0"
74
75
  },
75
76
  "prettier": "@internal/prettier-config",
76
77
  "scripts": {