@puckeditor/plugin-heading-analyzer 0.22.0-canary.c0cc3b3c → 0.22.0-canary.caeacf97
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 +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +28 -35
- package/dist/index.mjs +28 -35
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -428,7 +428,7 @@ UserField extends BaseField = {}> = {
|
|
|
428
428
|
metadata: ComponentMetadata;
|
|
429
429
|
trigger: ResolveDataTrigger;
|
|
430
430
|
parent: ComponentData | null;
|
|
431
|
-
root:
|
|
431
|
+
root: RootData;
|
|
432
432
|
}) => Promise<WithPartialProps<DataShape, FieldProps>> | WithPartialProps<DataShape, FieldProps>;
|
|
433
433
|
resolvePermissions?: (data: DataShape, params: {
|
|
434
434
|
changed: Partial<Record<keyof FieldProps, boolean> & {
|
package/dist/index.d.ts
CHANGED
|
@@ -428,7 +428,7 @@ UserField extends BaseField = {}> = {
|
|
|
428
428
|
metadata: ComponentMetadata;
|
|
429
429
|
trigger: ResolveDataTrigger;
|
|
430
430
|
parent: ComponentData | null;
|
|
431
|
-
root:
|
|
431
|
+
root: RootData;
|
|
432
432
|
}) => Promise<WithPartialProps<DataShape, FieldProps>> | WithPartialProps<DataShape, FieldProps>;
|
|
433
433
|
resolvePermissions?: (data: DataShape, params: {
|
|
434
434
|
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, root =
|
|
2271
|
+
var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace", parent = null, root = { props: {} }) {
|
|
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,
|
|
@@ -2301,7 +2296,7 @@ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], fun
|
|
|
2301
2296
|
metadata: __spreadValues(__spreadValues({}, metadata), configForItem.metadata),
|
|
2302
2297
|
trigger,
|
|
2303
2298
|
parent,
|
|
2304
|
-
root
|
|
2299
|
+
root
|
|
2305
2300
|
});
|
|
2306
2301
|
resolvedItem.props = __spreadValues(__spreadValues({}, item.props), resolvedProps);
|
|
2307
2302
|
if (Object.keys(readOnly).length) {
|
|
@@ -2309,7 +2304,6 @@ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], fun
|
|
|
2309
2304
|
}
|
|
2310
2305
|
}
|
|
2311
2306
|
const itemAsComponentData = toComponent(resolvedItem);
|
|
2312
|
-
const rootForChildren = itemAsComponentData.type === "root" ? itemAsComponentData : rootForItem;
|
|
2313
2307
|
let itemWithResolvedChildren = yield mapFields(
|
|
2314
2308
|
resolvedItem,
|
|
2315
2309
|
{
|
|
@@ -2326,7 +2320,7 @@ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], fun
|
|
|
2326
2320
|
onResolveEnd,
|
|
2327
2321
|
trigger,
|
|
2328
2322
|
itemAsComponentData,
|
|
2329
|
-
|
|
2323
|
+
root
|
|
2330
2324
|
)).node;
|
|
2331
2325
|
})
|
|
2332
2326
|
)
|
|
@@ -2526,7 +2520,6 @@ var createAppStore = (initialAppStore) => create()(
|
|
|
2526
2520
|
const parentId = (_a2 = state.indexes.nodes[componentId]) == null ? void 0 : _a2.parentId;
|
|
2527
2521
|
const parentNode = parentId ? state.indexes.nodes[parentId] : null;
|
|
2528
2522
|
const parentData = (_b2 = parentNode == null ? void 0 : parentNode.data) != null ? _b2 : null;
|
|
2529
|
-
const rootData = componentId === "root" ? toComponent(componentData) : toComponent(state.data.root);
|
|
2530
2523
|
const timeouts = {};
|
|
2531
2524
|
return yield resolveComponentData(
|
|
2532
2525
|
componentData,
|
|
@@ -2547,7 +2540,7 @@ var createAppStore = (initialAppStore) => create()(
|
|
|
2547
2540
|
}),
|
|
2548
2541
|
trigger,
|
|
2549
2542
|
parentData,
|
|
2550
|
-
|
|
2543
|
+
state.data.root
|
|
2551
2544
|
);
|
|
2552
2545
|
}),
|
|
2553
2546
|
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, root =
|
|
2259
|
+
var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace", parent = null, root = { props: {} }) {
|
|
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,
|
|
@@ -2289,7 +2284,7 @@ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], fun
|
|
|
2289
2284
|
metadata: __spreadValues(__spreadValues({}, metadata), configForItem.metadata),
|
|
2290
2285
|
trigger,
|
|
2291
2286
|
parent,
|
|
2292
|
-
root
|
|
2287
|
+
root
|
|
2293
2288
|
});
|
|
2294
2289
|
resolvedItem.props = __spreadValues(__spreadValues({}, item.props), resolvedProps);
|
|
2295
2290
|
if (Object.keys(readOnly).length) {
|
|
@@ -2297,7 +2292,6 @@ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], fun
|
|
|
2297
2292
|
}
|
|
2298
2293
|
}
|
|
2299
2294
|
const itemAsComponentData = toComponent(resolvedItem);
|
|
2300
|
-
const rootForChildren = itemAsComponentData.type === "root" ? itemAsComponentData : rootForItem;
|
|
2301
2295
|
let itemWithResolvedChildren = yield mapFields(
|
|
2302
2296
|
resolvedItem,
|
|
2303
2297
|
{
|
|
@@ -2314,7 +2308,7 @@ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], fun
|
|
|
2314
2308
|
onResolveEnd,
|
|
2315
2309
|
trigger,
|
|
2316
2310
|
itemAsComponentData,
|
|
2317
|
-
|
|
2311
|
+
root
|
|
2318
2312
|
)).node;
|
|
2319
2313
|
})
|
|
2320
2314
|
)
|
|
@@ -2514,7 +2508,6 @@ var createAppStore = (initialAppStore) => create()(
|
|
|
2514
2508
|
const parentId = (_a2 = state.indexes.nodes[componentId]) == null ? void 0 : _a2.parentId;
|
|
2515
2509
|
const parentNode = parentId ? state.indexes.nodes[parentId] : null;
|
|
2516
2510
|
const parentData = (_b2 = parentNode == null ? void 0 : parentNode.data) != null ? _b2 : null;
|
|
2517
|
-
const rootData = componentId === "root" ? toComponent(componentData) : toComponent(state.data.root);
|
|
2518
2511
|
const timeouts = {};
|
|
2519
2512
|
return yield resolveComponentData(
|
|
2520
2513
|
componentData,
|
|
@@ -2535,7 +2528,7 @@ var createAppStore = (initialAppStore) => create()(
|
|
|
2535
2528
|
}),
|
|
2536
2529
|
trigger,
|
|
2537
2530
|
parentData,
|
|
2538
|
-
|
|
2531
|
+
state.data.root
|
|
2539
2532
|
);
|
|
2540
2533
|
}),
|
|
2541
2534
|
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.caeacf97",
|
|
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.caeacf97",
|
|
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",
|