@crediblemark/build 0.22.2 → 0.22.7

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 (51) hide show
  1. package/README.md +1 -5
  2. package/dist/ArrayField-EPM4TV3J.mjs +538 -0
  3. package/dist/ArrayField-ZD5UTLNU.css +1216 -0
  4. package/dist/{Editor-XZF6CWVW.css → Editor-E7FALXHL.css} +7 -7
  5. package/dist/{Editor-ZC67OU2A.mjs → Editor-L674TD7T.mjs} +16 -18
  6. package/dist/ObjectField-MW3SSNKI.mjs +87 -0
  7. package/dist/ObjectField-SQKROKJM.css +1216 -0
  8. package/dist/{Render-WCX4AXOX.css → Render-JDXVKZXN.css} +1 -1
  9. package/dist/{Render-JBFI6HYN.mjs → Render-WP5OOTBB.mjs} +4 -7
  10. package/dist/chunk-2JUMF5G3.mjs +1145 -0
  11. package/dist/{chunk-VGDMWS44.mjs → chunk-4PJ4QMWI.mjs} +4 -25
  12. package/dist/{chunk-3AJBFQU4.mjs → chunk-64A37UUC.mjs} +19 -53
  13. package/dist/{chunk-QF3GD5WQ.mjs → chunk-67TMLSKM.mjs} +1 -5
  14. package/dist/{chunk-GUJDGRSM.mjs → chunk-7LXZOPYT.mjs} +5 -29
  15. package/dist/chunk-AEKBE267.mjs +19 -0
  16. package/dist/chunk-AFVEAZTD.mjs +2 -0
  17. package/dist/{chunk-IJHL7BIR.mjs → chunk-AL77I3BV.mjs} +1 -6
  18. package/dist/chunk-BFHV72KK.mjs +31 -0
  19. package/dist/{chunk-PHGC6QYB.mjs → chunk-DEUK76GN.mjs} +0 -5
  20. package/dist/{chunk-4SQOX3ZQ.mjs → chunk-DVK7K7D6.mjs} +5 -27
  21. package/dist/{chunk-VKBVSWU3.mjs → chunk-JNHQNNGW.mjs} +3672 -5905
  22. package/dist/{chunk-HHBUU7WF.mjs → chunk-JNMMY5D7.mjs} +1 -5
  23. package/dist/chunk-K27LFPQL.mjs +339 -0
  24. package/dist/{chunk-VFD76OD5.mjs → chunk-NYBWAKLT.mjs} +1 -5
  25. package/dist/chunk-RDTXKOE7.mjs +60 -0
  26. package/dist/{chunk-CDMESQDA.mjs → chunk-SMAWAXVX.mjs} +1 -10
  27. package/dist/{chunk-DSXRK4QJ.mjs → chunk-T6RT6PV4.mjs} +13 -62
  28. package/dist/{chunk-U2NVBXAC.mjs → chunk-ZY24NW7X.mjs} +246 -358
  29. package/dist/{full-ABQQRJAO.css → full-MY4DABK6.css} +6 -6
  30. package/dist/{full-LJRK5736.mjs → full-SGY5HNVB.mjs} +10 -14
  31. package/dist/index.css +588 -294
  32. package/dist/index.d.mts +5 -8
  33. package/dist/index.d.ts +5 -8
  34. package/dist/index.js +5985 -5656
  35. package/dist/index.mjs +23 -25
  36. package/dist/internal.mjs +3 -8
  37. package/dist/{loaded-NE2PIHUQ.mjs → loaded-2GLOBOVP.mjs} +7 -10
  38. package/dist/{loaded-N7VXUR4O.mjs → loaded-AH3CPHD2.mjs} +7 -10
  39. package/dist/{loaded-DWCENJKQ.mjs → loaded-ARSKBJWP.mjs} +7 -10
  40. package/dist/{loaded-SMEIWWHS.css → loaded-E7C36OKZ.css} +1 -1
  41. package/dist/no-external.css +299 -294
  42. package/dist/no-external.d.mts +1 -1
  43. package/dist/no-external.d.ts +1 -1
  44. package/dist/no-external.js +5985 -5656
  45. package/dist/no-external.mjs +23 -25
  46. package/dist/rsc.css +1 -1
  47. package/dist/rsc.js +5 -79
  48. package/dist/rsc.mjs +6 -12
  49. package/package.json +41 -36
  50. package/dist/chunk-B4BOBGYB.mjs +0 -42
  51. package/dist/chunk-YH7AXYKP.mjs +0 -109
@@ -1,13 +1,9 @@
1
1
  import {
2
2
  List,
3
3
  ListOrdered
4
- } from "./chunk-U2NVBXAC.mjs";
5
- import {
6
- init_react_import
7
- } from "./chunk-B4BOBGYB.mjs";
4
+ } from "./chunk-ZY24NW7X.mjs";
8
5
 
9
6
  // components/RichTextMenu/controls/ListSelect/use-options.ts
10
- init_react_import();
11
7
  import { useMemo } from "react";
12
8
  var optionNodes = {
13
9
  ul: { label: "Bullet list", icon: List },
@@ -0,0 +1,339 @@
1
+ import {
2
+ GripVertical
3
+ } from "./chunk-ZY24NW7X.mjs";
4
+ import {
5
+ get_class_name_factory_default
6
+ } from "./chunk-BFHV72KK.mjs";
7
+
8
+ // css-module:/home/crediblemark/Project/Credibuild/components/DragIcon/styles.module.css#css-module
9
+ var styles_module_default = { "DragIcon": "_DragIcon_ei1r9_1", "DragIcon--disabled": "_DragIcon--disabled_ei1r9_8" };
10
+
11
+ // components/DragIcon/index.tsx
12
+ import { jsx } from "react/jsx-runtime";
13
+ var getClassName = get_class_name_factory_default("DragIcon", styles_module_default);
14
+ var DragIcon = ({ isDragDisabled }) => /* @__PURE__ */ jsx("div", { className: getClassName({ disabled: isDragDisabled }), children: /* @__PURE__ */ jsx(GripVertical, { size: 12, strokeWidth: 2.5 }) });
15
+
16
+ // lib/data/set-deep.ts
17
+ function setDeep(node, path, newVal) {
18
+ const parts = path.split(".");
19
+ const newNode = { ...node };
20
+ let cur = newNode;
21
+ for (let i = 0; i < parts.length; i++) {
22
+ const [prop, idxStr] = parts[i].replace("]", "").split("[");
23
+ const isLast = i === parts.length - 1;
24
+ if (idxStr !== void 0) {
25
+ if (!Array.isArray(cur[prop])) {
26
+ cur[prop] = [];
27
+ }
28
+ const idx = Number(idxStr);
29
+ if (isLast) {
30
+ cur[prop][idx] = newVal;
31
+ continue;
32
+ }
33
+ if (cur[prop][idx] === void 0) cur[prop][idx] = {};
34
+ cur = cur[prop][idx];
35
+ continue;
36
+ }
37
+ if (isLast) {
38
+ cur[prop] = newVal;
39
+ continue;
40
+ }
41
+ if (cur[prop] === void 0) {
42
+ cur[prop] = {};
43
+ }
44
+ cur = cur[prop];
45
+ }
46
+ return { ...node, ...newNode };
47
+ }
48
+
49
+ // lib/dnd/use-sensors.ts
50
+ import { useState } from "react";
51
+ import { PointerSensor } from "@dnd-kit/react";
52
+ import { isElement } from "@dnd-kit/dom/utilities";
53
+ var touchDefault = { delay: { value: 200, tolerance: 10 } };
54
+ var otherDefault = {
55
+ delay: { value: 200, tolerance: 10 },
56
+ distance: { value: 5 }
57
+ };
58
+ var useSensors = ({
59
+ other = otherDefault,
60
+ mouse,
61
+ touch = touchDefault
62
+ } = {
63
+ touch: touchDefault,
64
+ other: otherDefault
65
+ }) => {
66
+ const [sensors] = useState(() => [
67
+ PointerSensor.configure({
68
+ activationConstraints(event, source) {
69
+ const { pointerType, target } = event;
70
+ if (pointerType === "mouse" && isElement(target) && (source.handle === target || source.handle?.contains(target))) {
71
+ return mouse;
72
+ }
73
+ if (pointerType === "touch") {
74
+ return touch;
75
+ }
76
+ return other;
77
+ }
78
+ })
79
+ ]);
80
+ return sensors;
81
+ };
82
+
83
+ // lib/dnd/collision/dynamic/index.ts
84
+ import {
85
+ CollisionPriority,
86
+ CollisionType as CollisionType2
87
+ } from "@dnd-kit/abstract";
88
+
89
+ // lib/dnd/collision/directional/index.ts
90
+ import { CollisionType } from "@dnd-kit/abstract";
91
+
92
+ // lib/dnd/collision/collision-debug.ts
93
+ var DEBUG = false;
94
+ var debugElements = {};
95
+ var timeout;
96
+ var collisionDebug = (a, b, id, color, label) => {
97
+ if (!DEBUG) return;
98
+ const debugId = `${id}-debug`;
99
+ clearTimeout(timeout);
100
+ timeout = setTimeout(() => {
101
+ Object.entries(debugElements).forEach(([id2, { svg }]) => {
102
+ svg.remove();
103
+ delete debugElements[id2];
104
+ });
105
+ }, 1e3);
106
+ requestAnimationFrame(() => {
107
+ const existingEl = debugElements[debugId];
108
+ let line = debugElements[debugId]?.line;
109
+ let text = debugElements[debugId]?.text;
110
+ if (!existingEl) {
111
+ const svgNs = "http://www.w3.org/2000/svg";
112
+ const svg = document.createElementNS(svgNs, "svg");
113
+ line = document.createElementNS(svgNs, "line");
114
+ text = document.createElementNS(svgNs, "text");
115
+ svg.setAttribute("id", debugId);
116
+ svg.setAttribute(
117
+ "style",
118
+ "position: fixed; height: 100%; width: 100%; pointer-events: none; top: 0px; left: 0px;"
119
+ );
120
+ svg.appendChild(line);
121
+ svg.appendChild(text);
122
+ text.setAttribute("fill", `black`);
123
+ document.body.appendChild(svg);
124
+ debugElements[debugId] = { svg, line, text };
125
+ }
126
+ line.setAttribute("x1", a.x.toString());
127
+ line.setAttribute("x2", b.x.toString());
128
+ line.setAttribute("y1", a.y.toString());
129
+ line.setAttribute("y2", b.y.toString());
130
+ line.setAttribute("style", `stroke:${color};stroke-width:2`);
131
+ text.setAttribute("x", (a.x - (a.x - b.x) / 2).toString());
132
+ text.setAttribute("y", (a.y - (a.y - b.y) / 2).toString());
133
+ if (label) {
134
+ text.innerHTML = label;
135
+ }
136
+ });
137
+ };
138
+
139
+ // lib/dnd/collision/directional/index.ts
140
+ var distanceChange = "increasing";
141
+ var directionalCollision = (input, previous) => {
142
+ const { dragOperation, droppable } = input;
143
+ const { shape: dropShape } = droppable;
144
+ const { position } = dragOperation;
145
+ const dragShape = dragOperation.shape?.current;
146
+ if (!dragShape || !dropShape) return null;
147
+ const dropCenter = dropShape.center;
148
+ const distanceToPrevious = Math.sqrt(
149
+ Math.pow(dropCenter.x - previous.x, 2) + Math.pow(dropCenter.y - previous.y, 2)
150
+ );
151
+ const distanceToCurrent = Math.sqrt(
152
+ Math.pow(dropCenter.x - position.current.x, 2) + Math.pow(dropCenter.y - position.current.y, 2)
153
+ );
154
+ distanceChange = distanceToCurrent === distanceToPrevious ? distanceChange : distanceToCurrent < distanceToPrevious ? "decreasing" : "increasing";
155
+ collisionDebug(
156
+ dragShape.center,
157
+ dropCenter,
158
+ droppable.id.toString(),
159
+ "rebeccapurple"
160
+ );
161
+ if (distanceChange === "decreasing") {
162
+ return {
163
+ id: droppable.id,
164
+ value: 1,
165
+ type: CollisionType.Collision
166
+ };
167
+ }
168
+ return null;
169
+ };
170
+
171
+ // lib/dnd/collision/dynamic/get-direction.ts
172
+ var getDirection = (dragAxis, delta) => {
173
+ if (dragAxis === "dynamic") {
174
+ if (Math.abs(delta.y) > Math.abs(delta.x)) {
175
+ return delta.y === 0 ? null : delta.y > 0 ? "down" : "up";
176
+ } else {
177
+ return delta.x === 0 ? null : delta.x > 0 ? "right" : "left";
178
+ }
179
+ } else if (dragAxis === "x") {
180
+ return delta.x === 0 ? null : delta.x > 0 ? "right" : "left";
181
+ }
182
+ return delta.y === 0 ? null : delta.y > 0 ? "down" : "up";
183
+ };
184
+
185
+ // lib/dnd/collision/dynamic/get-midpoint-impact.ts
186
+ var getMidpointImpact = (dragShape, dropShape, direction, offsetMultiplier = 0) => {
187
+ const dragRect = dragShape.boundingRectangle;
188
+ const dropCenter = dropShape.center;
189
+ if (direction === "down") {
190
+ const offset2 = offsetMultiplier * dropShape.boundingRectangle.height;
191
+ return dragRect.bottom >= dropCenter.y + offset2;
192
+ } else if (direction === "up") {
193
+ const offset2 = offsetMultiplier * dropShape.boundingRectangle.height;
194
+ return dragRect.top < dropCenter.y - offset2;
195
+ } else if (direction === "left") {
196
+ const offset2 = offsetMultiplier * dropShape.boundingRectangle.width;
197
+ return dropCenter.x - offset2 >= dragRect.left;
198
+ }
199
+ const offset = offsetMultiplier * dropShape.boundingRectangle.width;
200
+ return dragRect.right - offset >= dropCenter.x;
201
+ };
202
+
203
+ // lib/dnd/collision/dynamic/track-movement-interval.ts
204
+ import { Point } from "@dnd-kit/geometry";
205
+ var INTERVAL_SENSITIVITY = 10;
206
+ var intervalCache = {
207
+ current: { x: 0, y: 0 },
208
+ delta: { x: 0, y: 0 },
209
+ previous: { x: 0, y: 0 },
210
+ direction: null
211
+ };
212
+ var trackMovementInterval = (point, dragAxis = "dynamic") => {
213
+ intervalCache.current = point;
214
+ intervalCache.delta = {
215
+ x: point.x - intervalCache.previous.x,
216
+ y: point.y - intervalCache.previous.y
217
+ };
218
+ intervalCache.direction = getDirection(dragAxis, intervalCache.delta) || intervalCache.direction;
219
+ if (Math.abs(intervalCache.delta.x) > INTERVAL_SENSITIVITY || Math.abs(intervalCache.delta.y) > INTERVAL_SENSITIVITY) {
220
+ intervalCache.previous = Point.from(point);
221
+ }
222
+ return intervalCache;
223
+ };
224
+
225
+ // lib/dnd/collision/dynamic/index.ts
226
+ import { closestCorners } from "@dnd-kit/collision";
227
+
228
+ // lib/dnd/collision/dynamic/store.ts
229
+ import { createStore } from "zustand/vanilla";
230
+ var collisionStore = createStore(() => ({
231
+ fallbackEnabled: false
232
+ }));
233
+
234
+ // lib/dnd/collision/dynamic/index.ts
235
+ var flushNext = "";
236
+ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => ((input) => {
237
+ const { dragOperation, droppable } = input;
238
+ const { position } = dragOperation;
239
+ const dragShape = dragOperation.shape?.current;
240
+ const { shape: dropShape } = droppable;
241
+ if (!dragShape || !dropShape) {
242
+ return null;
243
+ }
244
+ const { center: dragCenter } = dragShape;
245
+ const { fallbackEnabled } = collisionStore.getState();
246
+ const interval = trackMovementInterval(position.current, dragAxis);
247
+ const data = {
248
+ direction: interval.direction
249
+ };
250
+ const { center: dropCenter } = dropShape;
251
+ const overMidpoint = getMidpointImpact(
252
+ dragShape,
253
+ dropShape,
254
+ interval.direction,
255
+ midpointOffset
256
+ );
257
+ if (dragOperation.source?.id === droppable.id) {
258
+ const collision = directionalCollision(input, interval.previous);
259
+ collisionDebug(dragCenter, dropCenter, droppable.id.toString(), "yellow");
260
+ if (collision) {
261
+ return {
262
+ ...collision,
263
+ priority: CollisionPriority.Highest,
264
+ data
265
+ };
266
+ }
267
+ }
268
+ const intersectionArea = dragShape.intersectionArea(dropShape);
269
+ const intersectionRatio = intersectionArea / dropShape.area;
270
+ if (intersectionArea && overMidpoint) {
271
+ collisionDebug(
272
+ dragCenter,
273
+ dropCenter,
274
+ droppable.id.toString(),
275
+ "green",
276
+ interval.direction
277
+ );
278
+ const collision = {
279
+ id: droppable.id,
280
+ value: intersectionRatio,
281
+ priority: CollisionPriority.High,
282
+ type: CollisionType2.Collision
283
+ };
284
+ const shouldFlushId = flushNext === droppable.id;
285
+ flushNext = "";
286
+ return { ...collision, id: shouldFlushId ? "flush" : collision.id, data };
287
+ }
288
+ if (fallbackEnabled && dragOperation.source?.id !== droppable.id) {
289
+ const xAxisIntersection = dropShape.boundingRectangle.right > dragShape.boundingRectangle.left && dropShape.boundingRectangle.left < dragShape.boundingRectangle.right;
290
+ const yAxisIntersection = dropShape.boundingRectangle.bottom > dragShape.boundingRectangle.top && dropShape.boundingRectangle.top < dragShape.boundingRectangle.bottom;
291
+ if (dragAxis === "y" && xAxisIntersection || yAxisIntersection) {
292
+ const fallbackCollision = closestCorners(input);
293
+ if (fallbackCollision) {
294
+ const direction = getDirection(dragAxis, {
295
+ x: dragShape.center.x - (droppable.shape?.center.x || 0),
296
+ y: dragShape.center.y - (droppable.shape?.center.y || 0)
297
+ });
298
+ data.direction = direction;
299
+ if (intersectionArea) {
300
+ collisionDebug(
301
+ dragCenter,
302
+ dropCenter,
303
+ droppable.id.toString(),
304
+ "red",
305
+ direction || ""
306
+ );
307
+ flushNext = droppable.id;
308
+ return {
309
+ ...fallbackCollision,
310
+ priority: CollisionPriority.Low,
311
+ data
312
+ };
313
+ }
314
+ collisionDebug(
315
+ dragCenter,
316
+ dropCenter,
317
+ droppable.id.toString(),
318
+ "orange",
319
+ direction || ""
320
+ );
321
+ return {
322
+ ...fallbackCollision,
323
+ priority: CollisionPriority.Lowest,
324
+ data
325
+ };
326
+ }
327
+ }
328
+ }
329
+ collisionDebug(dragCenter, dropCenter, droppable.id.toString(), "hotpink");
330
+ return null;
331
+ });
332
+
333
+ export {
334
+ DragIcon,
335
+ useSensors,
336
+ collisionStore,
337
+ createDynamicCollisionDetector,
338
+ setDeep
339
+ };
@@ -3,13 +3,9 @@ import {
3
3
  TextAlignEnd,
4
4
  TextAlignJustify,
5
5
  TextAlignStart
6
- } from "./chunk-U2NVBXAC.mjs";
7
- import {
8
- init_react_import
9
- } from "./chunk-B4BOBGYB.mjs";
6
+ } from "./chunk-ZY24NW7X.mjs";
10
7
 
11
8
  // components/RichTextMenu/controls/AlignSelect/use-options.ts
12
- init_react_import();
13
9
  import { useMemo } from "react";
14
10
  var optionNodes = {
15
11
  left: { label: "Left", icon: TextAlignStart },
@@ -0,0 +1,60 @@
1
+ import {
2
+ AutoFieldPrivate,
3
+ NestedFieldProvider,
4
+ useNestedFieldContext
5
+ } from "./chunk-2JUMF5G3.mjs";
6
+
7
+ // components/AutoField/subfield.tsx
8
+ import { memo } from "react";
9
+ import { jsx } from "react/jsx-runtime";
10
+ var SubFieldInternal = ({
11
+ field,
12
+ id,
13
+ index,
14
+ name,
15
+ subName,
16
+ localName,
17
+ onChange,
18
+ forceReadOnly
19
+ }) => {
20
+ const indexName = typeof index !== "undefined" ? `${name}[${index}]` : name;
21
+ const subPath = name ? `${indexName}.${subName}` : subName;
22
+ const localIndexName = typeof index !== "undefined" ? `${localName}[${index}]` : localName ?? subName;
23
+ const localWildcardName = typeof index !== "undefined" ? `${localName}[*]` : localName;
24
+ const localSubPath = `${localIndexName}.${subName}`;
25
+ const localWildcardSubPath = `${localWildcardName}.${subName}`;
26
+ const { readOnlyFields } = useNestedFieldContext();
27
+ const subReadOnly = forceReadOnly ? forceReadOnly : typeof readOnlyFields[subPath] !== "undefined" ? readOnlyFields[localSubPath] : readOnlyFields[localWildcardSubPath];
28
+ const label = field.label || subName;
29
+ return /* @__PURE__ */ jsx(
30
+ NestedFieldProvider,
31
+ {
32
+ name: localIndexName,
33
+ wildcardName: localWildcardName,
34
+ subName,
35
+ readOnlyFields,
36
+ children: /* @__PURE__ */ jsx(
37
+ AutoFieldPrivate,
38
+ {
39
+ name: subPath,
40
+ label,
41
+ id,
42
+ readOnly: subReadOnly,
43
+ field: {
44
+ ...field,
45
+ label
46
+ // May be used by custom fields
47
+ },
48
+ onChange: (val, ui) => {
49
+ onChange(val, ui, subName);
50
+ }
51
+ }
52
+ )
53
+ }
54
+ );
55
+ };
56
+ var SubField = memo(SubFieldInternal);
57
+
58
+ export {
59
+ SubField
60
+ };
@@ -1,13 +1,9 @@
1
1
  import {
2
2
  mapFields,
3
3
  toComponent
4
- } from "./chunk-GUJDGRSM.mjs";
5
- import {
6
- init_react_import
7
- } from "./chunk-B4BOBGYB.mjs";
4
+ } from "./chunk-7LXZOPYT.mjs";
8
5
 
9
6
  // components/ViewportControls/default-viewports.ts
10
- init_react_import();
11
7
  var defaultViewports = [
12
8
  { width: 360, height: "auto", icon: "Smartphone", label: "Small" },
13
9
  { width: 768, height: "auto", icon: "Tablet", label: "Medium" },
@@ -15,11 +11,7 @@ var defaultViewports = [
15
11
  { width: "100%", height: "auto", icon: "FullWidth", label: "Full-width" }
16
12
  ];
17
13
 
18
- // lib/resolve-component-data.ts
19
- init_react_import();
20
-
21
14
  // lib/get-changed.ts
22
- init_react_import();
23
15
  import { deepEqual } from "fast-equals";
24
16
  var getChanged = (newItem, oldItem) => {
25
17
  return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
@@ -112,7 +104,6 @@ var resolveComponentData = async (item, config, metadata = {}, onResolveStart, o
112
104
  };
113
105
 
114
106
  // store/default-app-state.ts
115
- init_react_import();
116
107
  var defaultAppState = {
117
108
  data: { content: [], root: {}, zones: {} },
118
109
  ui: {