@puckeditor/plugin-heading-analyzer 0.22.0-canary.c0cc3b3c → 0.22.0-canary.cbf13a0d
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/dist/index.d.mts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +28 -38
- package/dist/index.mjs +28 -38
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -428,7 +428,6 @@ UserField extends BaseField = {}> = {
|
|
|
428
428
|
metadata: ComponentMetadata;
|
|
429
429
|
trigger: ResolveDataTrigger;
|
|
430
430
|
parent: ComponentData | null;
|
|
431
|
-
root: ComponentData | null;
|
|
432
431
|
}) => Promise<WithPartialProps<DataShape, FieldProps>> | WithPartialProps<DataShape, FieldProps>;
|
|
433
432
|
resolvePermissions?: (data: DataShape, params: {
|
|
434
433
|
changed: Partial<Record<keyof FieldProps, boolean> & {
|
package/dist/index.d.ts
CHANGED
|
@@ -428,7 +428,6 @@ UserField extends BaseField = {}> = {
|
|
|
428
428
|
metadata: ComponentMetadata;
|
|
429
429
|
trigger: ResolveDataTrigger;
|
|
430
430
|
parent: ComponentData | null;
|
|
431
|
-
root: ComponentData | null;
|
|
432
431
|
}) => Promise<WithPartialProps<DataShape, FieldProps>> | WithPartialProps<DataShape, FieldProps>;
|
|
433
432
|
resolvePermissions?: (data: DataShape, params: {
|
|
434
433
|
changed: Partial<Record<keyof FieldProps, boolean> & {
|
package/dist/index.js
CHANGED
|
@@ -877,53 +877,49 @@ var insert = (list, index, item) => {
|
|
|
877
877
|
// ../core/lib/generate-id.ts
|
|
878
878
|
init_react_import();
|
|
879
879
|
|
|
880
|
-
// ../core/
|
|
880
|
+
// ../core/lib/uuid/index.ts
|
|
881
881
|
init_react_import();
|
|
882
882
|
|
|
883
|
-
// ../core/
|
|
883
|
+
// ../core/lib/uuid/rng.ts
|
|
884
884
|
init_react_import();
|
|
885
|
-
var
|
|
886
|
-
var rnds8Pool = new Uint8Array(256);
|
|
887
|
-
var poolPtr = rnds8Pool.length;
|
|
885
|
+
var rnds8 = new Uint8Array(16);
|
|
888
886
|
function rng() {
|
|
889
|
-
|
|
890
|
-
import_crypto.default.randomFillSync(rnds8Pool);
|
|
891
|
-
poolPtr = 0;
|
|
892
|
-
}
|
|
893
|
-
return rnds8Pool.slice(poolPtr, poolPtr += 16);
|
|
887
|
+
return crypto.getRandomValues(rnds8);
|
|
894
888
|
}
|
|
895
889
|
|
|
896
|
-
// ../core/
|
|
890
|
+
// ../core/lib/uuid/stringify.ts
|
|
897
891
|
init_react_import();
|
|
898
892
|
var byteToHex = [];
|
|
899
893
|
for (let i = 0; i < 256; ++i) {
|
|
900
894
|
byteToHex.push((i + 256).toString(16).slice(1));
|
|
901
895
|
}
|
|
902
896
|
function unsafeStringify(arr, offset = 0) {
|
|
903
|
-
return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
|
|
897
|
+
return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
|
|
904
898
|
}
|
|
905
899
|
|
|
906
|
-
// ../core/
|
|
907
|
-
init_react_import();
|
|
908
|
-
|
|
909
|
-
// ../core/node_modules/uuid/dist/esm-node/native.js
|
|
910
|
-
init_react_import();
|
|
911
|
-
var import_crypto2 = __toESM(require("crypto"));
|
|
912
|
-
var native_default = {
|
|
913
|
-
randomUUID: import_crypto2.default.randomUUID
|
|
914
|
-
};
|
|
915
|
-
|
|
916
|
-
// ../core/node_modules/uuid/dist/esm-node/v4.js
|
|
900
|
+
// ../core/lib/uuid/index.ts
|
|
917
901
|
function v4(options, buf, offset) {
|
|
918
|
-
if (
|
|
919
|
-
return
|
|
902
|
+
if (!buf && !options && crypto.randomUUID) {
|
|
903
|
+
return crypto.randomUUID();
|
|
920
904
|
}
|
|
905
|
+
return _v4(options, buf, offset);
|
|
906
|
+
}
|
|
907
|
+
function _v4(options, buf, offset) {
|
|
908
|
+
var _a, _b, _c;
|
|
921
909
|
options = options || {};
|
|
922
|
-
const rnds = options.random
|
|
910
|
+
const rnds = (_c = (_b = options.random) != null ? _b : (_a = options.rng) == null ? void 0 : _a.call(options)) != null ? _c : rng();
|
|
911
|
+
if (rnds.length < 16) {
|
|
912
|
+
throw new Error("Random bytes length must be >= 16");
|
|
913
|
+
}
|
|
923
914
|
rnds[6] = rnds[6] & 15 | 64;
|
|
924
915
|
rnds[8] = rnds[8] & 63 | 128;
|
|
925
916
|
if (buf) {
|
|
926
917
|
offset = offset || 0;
|
|
918
|
+
if (offset < 0 || offset + 16 > buf.length) {
|
|
919
|
+
throw new RangeError(
|
|
920
|
+
`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`
|
|
921
|
+
);
|
|
922
|
+
}
|
|
927
923
|
for (let i = 0; i < 16; ++i) {
|
|
928
924
|
buf[offset + i] = rnds[i];
|
|
929
925
|
}
|
|
@@ -931,10 +927,10 @@ function v4(options, buf, offset) {
|
|
|
931
927
|
}
|
|
932
928
|
return unsafeStringify(rnds);
|
|
933
929
|
}
|
|
934
|
-
var
|
|
930
|
+
var uuid_default = v4;
|
|
935
931
|
|
|
936
932
|
// ../core/lib/generate-id.ts
|
|
937
|
-
var generateId = (type) => type ? `${type}-${
|
|
933
|
+
var generateId = (type) => type ? `${type}-${uuid_default()}` : uuid_default();
|
|
938
934
|
|
|
939
935
|
// ../core/lib/data/get-ids-for-parent.ts
|
|
940
936
|
init_react_import();
|
|
@@ -2272,12 +2268,11 @@ var createFieldsSlice = (_set, _get) => {
|
|
|
2272
2268
|
// ../core/lib/resolve-component-data.ts
|
|
2273
2269
|
init_react_import();
|
|
2274
2270
|
var cache = { lastChange: {} };
|
|
2275
|
-
var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace", parent = null
|
|
2271
|
+
var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace", parent = null) {
|
|
2276
2272
|
const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
|
|
2277
2273
|
const resolvedItem = __spreadValues({}, item);
|
|
2278
2274
|
const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
|
|
2279
2275
|
const id = "id" in item.props ? item.props.id : "root";
|
|
2280
|
-
const rootForItem = root != null ? root : "type" in item && item.type === "root" ? toComponent(item) : null;
|
|
2281
2276
|
if (shouldRunResolver) {
|
|
2282
2277
|
const {
|
|
2283
2278
|
item: oldItem = null,
|
|
@@ -2300,8 +2295,7 @@ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], fun
|
|
|
2300
2295
|
lastData: oldItem,
|
|
2301
2296
|
metadata: __spreadValues(__spreadValues({}, metadata), configForItem.metadata),
|
|
2302
2297
|
trigger,
|
|
2303
|
-
parent
|
|
2304
|
-
root: rootForItem
|
|
2298
|
+
parent
|
|
2305
2299
|
});
|
|
2306
2300
|
resolvedItem.props = __spreadValues(__spreadValues({}, item.props), resolvedProps);
|
|
2307
2301
|
if (Object.keys(readOnly).length) {
|
|
@@ -2309,7 +2303,6 @@ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], fun
|
|
|
2309
2303
|
}
|
|
2310
2304
|
}
|
|
2311
2305
|
const itemAsComponentData = toComponent(resolvedItem);
|
|
2312
|
-
const rootForChildren = itemAsComponentData.type === "root" ? itemAsComponentData : rootForItem;
|
|
2313
2306
|
let itemWithResolvedChildren = yield mapFields(
|
|
2314
2307
|
resolvedItem,
|
|
2315
2308
|
{
|
|
@@ -2325,8 +2318,7 @@ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], fun
|
|
|
2325
2318
|
onResolveStart,
|
|
2326
2319
|
onResolveEnd,
|
|
2327
2320
|
trigger,
|
|
2328
|
-
itemAsComponentData
|
|
2329
|
-
rootForChildren
|
|
2321
|
+
itemAsComponentData
|
|
2330
2322
|
)).node;
|
|
2331
2323
|
})
|
|
2332
2324
|
)
|
|
@@ -2526,7 +2518,6 @@ var createAppStore = (initialAppStore) => create()(
|
|
|
2526
2518
|
const parentId = (_a2 = state.indexes.nodes[componentId]) == null ? void 0 : _a2.parentId;
|
|
2527
2519
|
const parentNode = parentId ? state.indexes.nodes[parentId] : null;
|
|
2528
2520
|
const parentData = (_b2 = parentNode == null ? void 0 : parentNode.data) != null ? _b2 : null;
|
|
2529
|
-
const rootData = componentId === "root" ? toComponent(componentData) : toComponent(state.data.root);
|
|
2530
2521
|
const timeouts = {};
|
|
2531
2522
|
return yield resolveComponentData(
|
|
2532
2523
|
componentData,
|
|
@@ -2546,8 +2537,7 @@ var createAppStore = (initialAppStore) => create()(
|
|
|
2546
2537
|
timeouts[id]();
|
|
2547
2538
|
}),
|
|
2548
2539
|
trigger,
|
|
2549
|
-
parentData
|
|
2550
|
-
rootData
|
|
2540
|
+
parentData
|
|
2551
2541
|
);
|
|
2552
2542
|
}),
|
|
2553
2543
|
resolveAndCommitData: () => __async(null, null, function* () {
|
package/dist/index.mjs
CHANGED
|
@@ -865,53 +865,49 @@ var insert = (list, index, item) => {
|
|
|
865
865
|
// ../core/lib/generate-id.ts
|
|
866
866
|
init_react_import();
|
|
867
867
|
|
|
868
|
-
// ../core/
|
|
868
|
+
// ../core/lib/uuid/index.ts
|
|
869
869
|
init_react_import();
|
|
870
870
|
|
|
871
|
-
// ../core/
|
|
871
|
+
// ../core/lib/uuid/rng.ts
|
|
872
872
|
init_react_import();
|
|
873
|
-
|
|
874
|
-
var rnds8Pool = new Uint8Array(256);
|
|
875
|
-
var poolPtr = rnds8Pool.length;
|
|
873
|
+
var rnds8 = new Uint8Array(16);
|
|
876
874
|
function rng() {
|
|
877
|
-
|
|
878
|
-
crypto.randomFillSync(rnds8Pool);
|
|
879
|
-
poolPtr = 0;
|
|
880
|
-
}
|
|
881
|
-
return rnds8Pool.slice(poolPtr, poolPtr += 16);
|
|
875
|
+
return crypto.getRandomValues(rnds8);
|
|
882
876
|
}
|
|
883
877
|
|
|
884
|
-
// ../core/
|
|
878
|
+
// ../core/lib/uuid/stringify.ts
|
|
885
879
|
init_react_import();
|
|
886
880
|
var byteToHex = [];
|
|
887
881
|
for (let i = 0; i < 256; ++i) {
|
|
888
882
|
byteToHex.push((i + 256).toString(16).slice(1));
|
|
889
883
|
}
|
|
890
884
|
function unsafeStringify(arr, offset = 0) {
|
|
891
|
-
return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
|
|
885
|
+
return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
|
|
892
886
|
}
|
|
893
887
|
|
|
894
|
-
// ../core/
|
|
895
|
-
init_react_import();
|
|
896
|
-
|
|
897
|
-
// ../core/node_modules/uuid/dist/esm-node/native.js
|
|
898
|
-
init_react_import();
|
|
899
|
-
import crypto2 from "crypto";
|
|
900
|
-
var native_default = {
|
|
901
|
-
randomUUID: crypto2.randomUUID
|
|
902
|
-
};
|
|
903
|
-
|
|
904
|
-
// ../core/node_modules/uuid/dist/esm-node/v4.js
|
|
888
|
+
// ../core/lib/uuid/index.ts
|
|
905
889
|
function v4(options, buf, offset) {
|
|
906
|
-
if (
|
|
907
|
-
return
|
|
890
|
+
if (!buf && !options && crypto.randomUUID) {
|
|
891
|
+
return crypto.randomUUID();
|
|
908
892
|
}
|
|
893
|
+
return _v4(options, buf, offset);
|
|
894
|
+
}
|
|
895
|
+
function _v4(options, buf, offset) {
|
|
896
|
+
var _a, _b, _c;
|
|
909
897
|
options = options || {};
|
|
910
|
-
const rnds = options.random
|
|
898
|
+
const rnds = (_c = (_b = options.random) != null ? _b : (_a = options.rng) == null ? void 0 : _a.call(options)) != null ? _c : rng();
|
|
899
|
+
if (rnds.length < 16) {
|
|
900
|
+
throw new Error("Random bytes length must be >= 16");
|
|
901
|
+
}
|
|
911
902
|
rnds[6] = rnds[6] & 15 | 64;
|
|
912
903
|
rnds[8] = rnds[8] & 63 | 128;
|
|
913
904
|
if (buf) {
|
|
914
905
|
offset = offset || 0;
|
|
906
|
+
if (offset < 0 || offset + 16 > buf.length) {
|
|
907
|
+
throw new RangeError(
|
|
908
|
+
`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`
|
|
909
|
+
);
|
|
910
|
+
}
|
|
915
911
|
for (let i = 0; i < 16; ++i) {
|
|
916
912
|
buf[offset + i] = rnds[i];
|
|
917
913
|
}
|
|
@@ -919,10 +915,10 @@ function v4(options, buf, offset) {
|
|
|
919
915
|
}
|
|
920
916
|
return unsafeStringify(rnds);
|
|
921
917
|
}
|
|
922
|
-
var
|
|
918
|
+
var uuid_default = v4;
|
|
923
919
|
|
|
924
920
|
// ../core/lib/generate-id.ts
|
|
925
|
-
var generateId = (type) => type ? `${type}-${
|
|
921
|
+
var generateId = (type) => type ? `${type}-${uuid_default()}` : uuid_default();
|
|
926
922
|
|
|
927
923
|
// ../core/lib/data/get-ids-for-parent.ts
|
|
928
924
|
init_react_import();
|
|
@@ -2260,12 +2256,11 @@ var createFieldsSlice = (_set, _get) => {
|
|
|
2260
2256
|
// ../core/lib/resolve-component-data.ts
|
|
2261
2257
|
init_react_import();
|
|
2262
2258
|
var cache = { lastChange: {} };
|
|
2263
|
-
var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace", parent = null
|
|
2259
|
+
var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace", parent = null) {
|
|
2264
2260
|
const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
|
|
2265
2261
|
const resolvedItem = __spreadValues({}, item);
|
|
2266
2262
|
const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
|
|
2267
2263
|
const id = "id" in item.props ? item.props.id : "root";
|
|
2268
|
-
const rootForItem = root != null ? root : "type" in item && item.type === "root" ? toComponent(item) : null;
|
|
2269
2264
|
if (shouldRunResolver) {
|
|
2270
2265
|
const {
|
|
2271
2266
|
item: oldItem = null,
|
|
@@ -2288,8 +2283,7 @@ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], fun
|
|
|
2288
2283
|
lastData: oldItem,
|
|
2289
2284
|
metadata: __spreadValues(__spreadValues({}, metadata), configForItem.metadata),
|
|
2290
2285
|
trigger,
|
|
2291
|
-
parent
|
|
2292
|
-
root: rootForItem
|
|
2286
|
+
parent
|
|
2293
2287
|
});
|
|
2294
2288
|
resolvedItem.props = __spreadValues(__spreadValues({}, item.props), resolvedProps);
|
|
2295
2289
|
if (Object.keys(readOnly).length) {
|
|
@@ -2297,7 +2291,6 @@ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], fun
|
|
|
2297
2291
|
}
|
|
2298
2292
|
}
|
|
2299
2293
|
const itemAsComponentData = toComponent(resolvedItem);
|
|
2300
|
-
const rootForChildren = itemAsComponentData.type === "root" ? itemAsComponentData : rootForItem;
|
|
2301
2294
|
let itemWithResolvedChildren = yield mapFields(
|
|
2302
2295
|
resolvedItem,
|
|
2303
2296
|
{
|
|
@@ -2313,8 +2306,7 @@ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], fun
|
|
|
2313
2306
|
onResolveStart,
|
|
2314
2307
|
onResolveEnd,
|
|
2315
2308
|
trigger,
|
|
2316
|
-
itemAsComponentData
|
|
2317
|
-
rootForChildren
|
|
2309
|
+
itemAsComponentData
|
|
2318
2310
|
)).node;
|
|
2319
2311
|
})
|
|
2320
2312
|
)
|
|
@@ -2514,7 +2506,6 @@ var createAppStore = (initialAppStore) => create()(
|
|
|
2514
2506
|
const parentId = (_a2 = state.indexes.nodes[componentId]) == null ? void 0 : _a2.parentId;
|
|
2515
2507
|
const parentNode = parentId ? state.indexes.nodes[parentId] : null;
|
|
2516
2508
|
const parentData = (_b2 = parentNode == null ? void 0 : parentNode.data) != null ? _b2 : null;
|
|
2517
|
-
const rootData = componentId === "root" ? toComponent(componentData) : toComponent(state.data.root);
|
|
2518
2509
|
const timeouts = {};
|
|
2519
2510
|
return yield resolveComponentData(
|
|
2520
2511
|
componentData,
|
|
@@ -2534,8 +2525,7 @@ var createAppStore = (initialAppStore) => create()(
|
|
|
2534
2525
|
timeouts[id]();
|
|
2535
2526
|
}),
|
|
2536
2527
|
trigger,
|
|
2537
|
-
parentData
|
|
2538
|
-
rootData
|
|
2528
|
+
parentData
|
|
2539
2529
|
);
|
|
2540
2530
|
}),
|
|
2541
2531
|
resolveAndCommitData: () => __async(null, null, function* () {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@puckeditor/plugin-heading-analyzer",
|
|
3
|
-
"version": "0.22.0-canary.
|
|
3
|
+
"version": "0.22.0-canary.cbf13a0d",
|
|
4
4
|
"author": "Chris Villa <chris@puckeditor.com>",
|
|
5
5
|
"repository": "puckeditor/puck",
|
|
6
6
|
"bugs": "https://github.com/puckeditor/puck/issues",
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
"dist"
|
|
26
26
|
],
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@puckeditor/core": "^0.22.0-canary.
|
|
28
|
+
"@puckeditor/core": "^0.22.0-canary.cbf13a0d",
|
|
29
29
|
"@types/minimatch": "3.0.5",
|
|
30
30
|
"@types/react": "^19.0.1",
|
|
31
31
|
"@types/react-dom": "^19.0.2",
|
|
32
|
-
"eslint": "^
|
|
32
|
+
"eslint": "^9.0.0",
|
|
33
33
|
"eslint-config-custom": "*",
|
|
34
34
|
"tsconfig": "*",
|
|
35
35
|
"tsup": "^8.2.4",
|