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