@easy-editor/core 0.0.3 → 0.0.5

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.
@@ -1,5 +1,3 @@
1
- import { webcrypto } from 'node:crypto';
2
-
3
1
  var niceErrors = {
4
2
  0: "Invalid value for configuration 'enforceActions', expected 'never', 'always' or 'observed'",
5
3
  1: function _(annotationType, key) {
@@ -5280,27 +5278,14 @@ const isPlainObject = value => {
5280
5278
 
5281
5279
  const urlAlphabet = 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict';
5282
5280
 
5283
- const POOL_SIZE_MULTIPLIER = 128;
5284
- let pool, poolOffset;
5285
- function fillPool(bytes) {
5286
- if (!pool || pool.length < bytes) {
5287
- pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER);
5288
- webcrypto.getRandomValues(pool);
5289
- poolOffset = 0;
5290
- } else if (poolOffset + bytes > pool.length) {
5291
- webcrypto.getRandomValues(pool);
5292
- poolOffset = 0;
5293
- }
5294
- poolOffset += bytes;
5295
- }
5296
- function nanoid(size = 21) {
5297
- fillPool(size -= 0);
5281
+ let nanoid = (size = 21) => {
5298
5282
  let id = '';
5299
- for (let i = poolOffset - size; i < poolOffset; i++) {
5300
- id += urlAlphabet[pool[i] & 63];
5283
+ let bytes = crypto.getRandomValues(new Uint8Array(size));
5284
+ while (size--) {
5285
+ id += urlAlphabet[bytes[size] & 63];
5301
5286
  }
5302
5287
  return id;
5303
- }
5288
+ };
5304
5289
 
5305
5290
  const uniqueId = (prefix = '') => {
5306
5291
  return `${prefix}-${nanoid(12)}`;
@@ -5659,15 +5644,6 @@ let TRANSFORM_STAGE = /*#__PURE__*/function (TRANSFORM_STAGE) {
5659
5644
  }({});
5660
5645
 
5661
5646
  const GLOBAL_EVENT = {
5662
- EDITOR_EVENT,
5663
- DESIGNER_EVENT,
5664
- DRAGON_EVENT,
5665
- DETECTING_EVENT,
5666
- SELECTION_EVENT,
5667
- PROJECT_EVENT,
5668
- DOCUMENT_EVENT,
5669
- NODE_EVENT,
5670
- NODE_CHILDREN_EVENT
5671
5647
  };
5672
5648
 
5673
5649
  let HISTORY_EVENT = /*#__PURE__*/function (HISTORY_EVENT) {