@questpie/admin 3.2.0 → 3.2.1

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 (85) hide show
  1. package/dist/client/blocks/block-renderer.d.mts +12 -2
  2. package/dist/client/blocks/block-renderer.mjs +357 -49
  3. package/dist/client/components/blocks/block-editor-context.mjs +11 -1
  4. package/dist/client/components/blocks/block-editor-provider.mjs +68 -26
  5. package/dist/client/components/blocks/block-item.mjs +181 -170
  6. package/dist/client/components/blocks/utils/tree-utils.mjs +13 -1
  7. package/dist/client/components/fields/array-field.mjs +177 -118
  8. package/dist/client/components/filter-builder/filter-builder-sheet.mjs +305 -310
  9. package/dist/client/components/filter-builder/filters-tab.mjs +1 -1
  10. package/dist/client/components/history-sidebar.mjs +121 -114
  11. package/dist/client/components/preview/live-preview-mode.mjs +140 -114
  12. package/dist/client/components/preview/preview-pane.mjs +288 -333
  13. package/dist/client/components/primitives/option-label.mjs +44 -0
  14. package/dist/client/components/primitives/select-multi.mjs +408 -383
  15. package/dist/client/components/primitives/select-single.mjs +387 -357
  16. package/dist/client/components/widgets/chart-widget.mjs +168 -143
  17. package/dist/client/contexts/focus-context.d.mts +11 -0
  18. package/dist/client/contexts/focus-context.mjs +51 -34
  19. package/dist/client/hooks/use-brand.mjs +2 -1
  20. package/dist/client/preview/block-scope-context.d.mts +2 -2
  21. package/dist/client/preview/block-scope-context.mjs +10 -20
  22. package/dist/client/preview/index.d.mts +1 -1
  23. package/dist/client/preview/patch.mjs +100 -0
  24. package/dist/client/preview/preview-banner.d.mts +2 -2
  25. package/dist/client/preview/preview-field.d.mts +34 -5
  26. package/dist/client/preview/preview-field.mjs +385 -118
  27. package/dist/client/preview/types.d.mts +82 -3
  28. package/dist/client/preview/types.mjs +85 -6
  29. package/dist/client/preview/use-collection-preview.d.mts +19 -1
  30. package/dist/client/preview/use-collection-preview.mjs +182 -58
  31. package/dist/client/runtime/index.d.mts +2 -2
  32. package/dist/client/runtime/index.mjs +2 -2
  33. package/dist/client/runtime/provider.d.mts +5 -5
  34. package/dist/client/utils/build-field-definitions-from-schema.mjs +8 -3
  35. package/dist/client/views/auth/reset-password-form.d.mts +2 -2
  36. package/dist/client/views/auth/setup-form.d.mts +2 -2
  37. package/dist/client/views/collection/bulk-action-toolbar.mjs +23 -25
  38. package/dist/client/views/collection/cells/primitive-cells.mjs +63 -13
  39. package/dist/client/views/collection/columns/build-columns.mjs +1 -0
  40. package/dist/client/views/collection/form-view.mjs +262 -33
  41. package/dist/client/views/collection/table-view.mjs +16 -11
  42. package/dist/client/views/layout/admin-layout-provider.d.mts +5 -5
  43. package/dist/client/views/layout/admin-layout-provider.mjs +107 -16
  44. package/dist/client.d.mts +2 -2
  45. package/dist/client.mjs +1 -1
  46. package/dist/components/rich-text/rich-text-renderer.d.mts +2 -2
  47. package/dist/index.d.mts +2 -2
  48. package/dist/index.mjs +1 -1
  49. package/dist/server/augmentation/common.d.mts +8 -4
  50. package/dist/server/augmentation/form-layout.d.mts +1 -1
  51. package/dist/server/i18n/messages/cs.mjs +11 -0
  52. package/dist/server/i18n/messages/de.mjs +11 -0
  53. package/dist/server/i18n/messages/en.mjs +11 -0
  54. package/dist/server/i18n/messages/es.mjs +11 -0
  55. package/dist/server/i18n/messages/fr.mjs +11 -0
  56. package/dist/server/i18n/messages/pl.mjs +11 -0
  57. package/dist/server/i18n/messages/pt.mjs +11 -0
  58. package/dist/server/i18n/messages/sk.mjs +11 -0
  59. package/dist/server/modules/admin/block/block-builder.d.mts +7 -10
  60. package/dist/server/modules/admin/block/block-builder.mjs +7 -10
  61. package/dist/server/modules/admin/collections/account.d.mts +50 -50
  62. package/dist/server/modules/admin/collections/admin-locks.d.mts +54 -54
  63. package/dist/server/modules/admin/collections/admin-preferences.d.mts +39 -39
  64. package/dist/server/modules/admin/collections/admin-saved-views.d.mts +47 -47
  65. package/dist/server/modules/admin/collections/apikey.d.mts +68 -68
  66. package/dist/server/modules/admin/collections/assets.d.mts +57 -20
  67. package/dist/server/modules/admin/collections/session.d.mts +42 -42
  68. package/dist/server/modules/admin/collections/user.d.mts +100 -34
  69. package/dist/server/modules/admin/collections/user.mjs +4 -4
  70. package/dist/server/modules/admin/collections/verification.d.mts +32 -32
  71. package/dist/server/modules/admin/index.d.mts +3 -3
  72. package/dist/server/modules/admin/routes/admin-config.d.mts +2 -2
  73. package/dist/server/modules/admin/routes/admin-config.mjs +9 -12
  74. package/dist/server/modules/admin/routes/execute-action.d.mts +9 -9
  75. package/dist/server/modules/admin/routes/locales.d.mts +2 -2
  76. package/dist/server/modules/admin/routes/preview.d.mts +11 -11
  77. package/dist/server/modules/admin/routes/reactive.d.mts +9 -9
  78. package/dist/server/modules/admin/routes/setup.d.mts +7 -7
  79. package/dist/server/modules/admin/routes/translations.d.mts +4 -4
  80. package/dist/server/modules/admin/routes/translations.mjs +1 -1
  81. package/dist/server/modules/admin/routes/widget-data.d.mts +5 -5
  82. package/dist/server/modules/admin-preferences/collections/admin-preferences.mjs +4 -6
  83. package/dist/server/modules/admin-preferences/collections/saved-views.d.mts +31 -33
  84. package/dist/server/modules/admin-preferences/collections/saved-views.mjs +4 -6
  85. package/package.json +3 -3
@@ -0,0 +1,100 @@
1
+ //#region src/client/preview/patch.ts
2
+ function cloneSnapshot(value) {
3
+ if (typeof globalThis.structuredClone === "function") return globalThis.structuredClone(value);
4
+ if (value === void 0) return value;
5
+ return JSON.parse(JSON.stringify(value));
6
+ }
7
+ function shouldApplyPatchBatch(lastAppliedSeq, nextSeq) {
8
+ return lastAppliedSeq == null || nextSeq > lastAppliedSeq;
9
+ }
10
+ function applyPatchBatchImmutable(data, ops) {
11
+ return ops.reduce((current, op) => {
12
+ if (op.op === "set") return setAtPath(current, op.path, op.value);
13
+ if (op.op === "remove") return removeAtPath(current, op.path);
14
+ throw new Error(`Unsupported preview patch operation: ${op.op}`);
15
+ }, data);
16
+ }
17
+ function splitPath(path) {
18
+ if (path === "") return [];
19
+ return path.split(".");
20
+ }
21
+ function isObjectRecord(value) {
22
+ return value !== null && typeof value === "object" && !Array.isArray(value);
23
+ }
24
+ function isArrayIndex(segment) {
25
+ return /^(0|[1-9]\d*)$/.test(segment);
26
+ }
27
+ function createContainer(nextSegment) {
28
+ return nextSegment !== void 0 && isArrayIndex(nextSegment) ? [] : {};
29
+ }
30
+ function cloneContainer(value, nextSegment) {
31
+ if (Array.isArray(value)) return [...value];
32
+ if (isObjectRecord(value)) return { ...value };
33
+ return createContainer(nextSegment);
34
+ }
35
+ function readChild(container, segment) {
36
+ if (Array.isArray(container) && isArrayIndex(segment)) return container[Number(segment)];
37
+ if (isObjectRecord(container)) return container[segment];
38
+ }
39
+ function writeChild(container, segment, value) {
40
+ if (Array.isArray(container) && isArrayIndex(segment)) {
41
+ container[Number(segment)] = value;
42
+ return;
43
+ }
44
+ container[segment] = value;
45
+ }
46
+ function hasChild(container, segment) {
47
+ if (Array.isArray(container) && isArrayIndex(segment)) {
48
+ const index = Number(segment);
49
+ return index >= 0 && index < container.length;
50
+ }
51
+ if (isObjectRecord(container)) return Object.prototype.hasOwnProperty.call(container, segment);
52
+ return false;
53
+ }
54
+ function deleteChild(container, segment) {
55
+ if (Array.isArray(container) && isArrayIndex(segment)) {
56
+ container.splice(Number(segment), 1);
57
+ return;
58
+ }
59
+ delete container[segment];
60
+ }
61
+ function setAtPath(data, path, value) {
62
+ const segments = splitPath(path);
63
+ if (segments.length === 0) return cloneSnapshot(value);
64
+ const root = cloneContainer(data, segments[0]);
65
+ let cursor = root;
66
+ for (let index = 0; index < segments.length - 1; index += 1) {
67
+ const segment = segments[index];
68
+ const nextSegment = segments[index + 1];
69
+ const nextChild = cloneContainer(readChild(cursor, segment), nextSegment);
70
+ writeChild(cursor, segment, nextChild);
71
+ cursor = nextChild;
72
+ }
73
+ writeChild(cursor, segments[segments.length - 1], cloneSnapshot(value));
74
+ return root;
75
+ }
76
+ function removeAtPath(data, path) {
77
+ const segments = splitPath(path);
78
+ if (segments.length === 0) return;
79
+ if (!Array.isArray(data) && !isObjectRecord(data)) return data;
80
+ const root = cloneContainer(data, segments[0]);
81
+ let sourceCursor = data;
82
+ let cursor = root;
83
+ for (let index = 0; index < segments.length - 1; index += 1) {
84
+ const segment = segments[index];
85
+ if (!hasChild(sourceCursor, segment)) return data;
86
+ const sourceChild = readChild(sourceCursor, segment);
87
+ if (!Array.isArray(sourceChild) && !isObjectRecord(sourceChild)) return data;
88
+ const nextChild = cloneContainer(sourceChild, segments[index + 1]);
89
+ writeChild(cursor, segment, nextChild);
90
+ sourceCursor = sourceChild;
91
+ cursor = nextChild;
92
+ }
93
+ const finalSegment = segments[segments.length - 1];
94
+ if (!hasChild(sourceCursor, finalSegment)) return data;
95
+ deleteChild(cursor, finalSegment);
96
+ return root;
97
+ }
98
+
99
+ //#endregion
100
+ export { applyPatchBatchImmutable, cloneSnapshot, shouldApplyPatchBatch };
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime21 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime22 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/client/preview/preview-banner.d.ts
4
4
 
@@ -40,6 +40,6 @@ declare function PreviewBanner({
40
40
  isPreviewMode,
41
41
  className,
42
42
  exitPreviewUrl
43
- }: PreviewBannerProps): react_jsx_runtime21.JSX.Element | null;
43
+ }: PreviewBannerProps): react_jsx_runtime22.JSX.Element | null;
44
44
  //#endregion
45
45
  export { PreviewBanner, PreviewBannerProps };
@@ -8,17 +8,30 @@ type PreviewFieldProps = {
8
8
  field: string;
9
9
  /** Field type for routing (regular, block, or relation) */
10
10
  fieldType?: "regular" | "block" | "relation";
11
+ /** Enable inline scalar editing in preview mode */
12
+ editable?: "text" | "textarea";
11
13
  /** Content to render */
12
14
  children: React.ReactNode;
13
15
  /** HTML element type */
14
16
  as?: React.ElementType;
15
17
  /** Additional class names */
16
18
  className?: string;
19
+ /** Inline styles for the rendered element */
20
+ style?: React.CSSProperties;
17
21
  /** Click handler (uses context by default) */
18
22
  onClick?: (fieldPath: string, context?: {
19
23
  blockId?: string;
20
24
  fieldType?: "regular" | "block" | "relation";
21
25
  }) => void;
26
+ /** Inline edit commit handler (uses context/default postMessage by default) */
27
+ onValueCommit?: (payload: PreviewFieldValueEditedPayload) => void;
28
+ };
29
+ type PreviewFieldValueEditedPayload = {
30
+ path: string;
31
+ value: unknown;
32
+ inputKind: "text" | "textarea" | "number" | "boolean";
33
+ blockId?: string;
34
+ fieldType?: "regular" | "block" | "relation";
22
35
  };
23
36
  type PreviewContextValue = {
24
37
  isPreviewMode: boolean;
@@ -26,6 +39,7 @@ type PreviewContextValue = {
26
39
  blockId?: string;
27
40
  fieldType?: "regular" | "block" | "relation";
28
41
  }) => void;
42
+ handleFieldValueEdited?: (payload: PreviewFieldValueEditedPayload) => void;
29
43
  focusedField: string | null;
30
44
  };
31
45
  /**
@@ -33,17 +47,26 @@ type PreviewContextValue = {
33
47
  * Use this at the root of your preview page.
34
48
  */
35
49
  declare function PreviewProvider({
50
+ preview,
36
51
  isPreviewMode,
37
52
  focusedField,
38
53
  onFieldClick,
54
+ onFieldValueEdited,
39
55
  children
40
56
  }: {
41
- isPreviewMode: boolean;
42
- focusedField: string | null;
43
- onFieldClick: (fieldPath: string, context?: {
57
+ preview?: {
58
+ isPreviewMode: boolean;
59
+ focusedField: string | null;
60
+ handleFieldClick: PreviewContextValue["handleFieldClick"];
61
+ handleFieldValueEdited?: PreviewContextValue["handleFieldValueEdited"];
62
+ };
63
+ isPreviewMode?: boolean;
64
+ focusedField?: string | null;
65
+ onFieldClick?: (fieldPath: string, context?: {
44
66
  blockId?: string;
45
67
  fieldType?: "regular" | "block" | "relation";
46
68
  }) => void;
69
+ onFieldValueEdited?: (payload: PreviewFieldValueEditedPayload) => void;
47
70
  children: React.ReactNode;
48
71
  }): react_jsx_runtime23.JSX.Element;
49
72
  /**
@@ -77,10 +100,13 @@ declare function usePreviewContext(): PreviewContextValue | null;
77
100
  declare function PreviewField({
78
101
  field,
79
102
  fieldType,
103
+ editable,
80
104
  children,
81
105
  as: Component,
82
106
  className,
83
- onClick
107
+ style,
108
+ onClick,
109
+ onValueCommit
84
110
  }: PreviewFieldProps): react_jsx_runtime23.JSX.Element;
85
111
  /**
86
112
  * Standalone PreviewField that works without context.
@@ -89,12 +115,15 @@ declare function PreviewField({
89
115
  declare function StandalonePreviewField({
90
116
  field,
91
117
  fieldType,
118
+ editable,
92
119
  children,
93
120
  as: Component,
94
121
  className,
122
+ style,
95
123
  isPreviewMode,
96
124
  isFocused,
97
- onFieldClick
125
+ onFieldClick,
126
+ onValueCommit
98
127
  }: PreviewFieldProps & {
99
128
  isPreviewMode: boolean;
100
129
  isFocused?: boolean;