@lvce-editor/renderer-process 30.12.4 → 30.13.1

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.
@@ -118,25 +118,25 @@ const confirm = message => {
118
118
  return window.confirm(message);
119
119
  };
120
120
 
121
- const state$a = {
121
+ const state$b = {
122
122
  styleSheets: Object.create(null),
123
123
  texts: Object.create(null)
124
124
  };
125
125
  const set$b = (id, sheet) => {
126
- state$a.styleSheets[id] = sheet;
126
+ state$b.styleSheets[id] = sheet;
127
127
  };
128
128
  const get$b = id => {
129
- return state$a.styleSheets[id];
129
+ return state$b.styleSheets[id];
130
130
  };
131
131
  const setText$2 = (id, text) => {
132
- state$a.texts[id] = text;
132
+ state$b.texts[id] = text;
133
133
  };
134
134
  const getText = id => {
135
- return state$a.texts[id];
135
+ return state$b.texts[id];
136
136
  };
137
137
  const remove$5 = id => {
138
- delete state$a.styleSheets[id];
139
- delete state$a.texts[id];
138
+ delete state$b.styleSheets[id];
139
+ delete state$b.texts[id];
140
140
  };
141
141
 
142
142
  const addCssStyleSheet = (id, text) => {
@@ -338,10 +338,10 @@ const createIdGenerator = () => {
338
338
  };
339
339
  const create$L = createIdGenerator();
340
340
 
341
- const state$9 = Object.create(null);
341
+ const state$a = Object.create(null);
342
342
  const acquire$1 = id => {
343
- const promise = state$9[id];
344
- delete state$9[id];
343
+ const promise = state$a[id];
344
+ delete state$a[id];
345
345
  return promise;
346
346
  };
347
347
  const getFileHandles$1 = async ids => {
@@ -351,7 +351,7 @@ const getFileHandles$1 = async ids => {
351
351
  };
352
352
  const add$1 = promise => {
353
353
  const id = create$L();
354
- state$9[id] = promise;
354
+ state$a[id] = promise;
355
355
  return id;
356
356
  };
357
357
  const addFileHandle$1 = fileHandle => {
@@ -528,14 +528,14 @@ const getEventListenerArgs = (params, event) => {
528
528
  return serialized;
529
529
  };
530
530
 
531
- const state$8 = {
531
+ const state$9 = {
532
532
  ipc: undefined
533
533
  };
534
534
  const getIpc = () => {
535
- return state$8.ipc;
535
+ return state$9.ipc;
536
536
  };
537
537
  const setIpc = value => {
538
- state$8.ipc = value;
538
+ state$9.ipc = value;
539
539
  };
540
540
 
541
541
  const nameAnonymousFunction$1 = (fn, name) => {
@@ -1457,6 +1457,10 @@ const removeProp = ($Element, key) => {
1457
1457
  $Element.removeAttribute(attributeName);
1458
1458
  };
1459
1459
  const setProp = ($Element, key, value, eventMap, newEventMap) => {
1460
+ if (key.startsWith('aria-')) {
1461
+ $Element.setAttribute(key, String(value));
1462
+ return;
1463
+ }
1460
1464
  switch (key) {
1461
1465
  case 'ariaActivedescendant':
1462
1466
  setOptionalAttribute($Element, 'aria-activedescendant', value);
@@ -1544,18 +1548,20 @@ const renderDomElement = (element, eventMap, newEventMap) => {
1544
1548
  setProps($Element, element, eventMap, newEventMap);
1545
1549
  return $Element;
1546
1550
  };
1547
- const renderReferenceNode = element => {
1551
+ const renderReferenceNode = (element, eventMap, newEventMap) => {
1548
1552
  const instance = get$a(element.uid);
1549
1553
  if (!instance || !instance.state) {
1550
1554
  return document.createTextNode('Reference node not found');
1551
1555
  }
1552
1556
  const $Node = instance.state.$Viewlet;
1557
+ const props = Object.fromEntries(Object.entries(element).filter(([key]) => key !== 'uid'));
1558
+ setProps($Node, props, eventMap, newEventMap);
1553
1559
  return $Node;
1554
1560
  };
1555
1561
  const render$1 = (element, eventMap, newEventMap) => {
1556
1562
  switch (element.type) {
1557
1563
  case Reference:
1558
- return renderReferenceNode(element);
1564
+ return renderReferenceNode(element, eventMap, newEventMap);
1559
1565
  case Text:
1560
1566
  return renderDomTextNode(element);
1561
1567
  default:
@@ -3580,6 +3586,109 @@ const launchRendererWorker = async () => {
3580
3586
  });
3581
3587
  };
3582
3588
 
3589
+ const selector = 'script.RendererWorkerTrace';
3590
+ const state$8 = {
3591
+ enabled: false,
3592
+ entries: []
3593
+ };
3594
+ const serialize = value => {
3595
+ const seen = new WeakSet();
3596
+ const text = JSON.stringify(value, (_key, currentValue) => {
3597
+ if (typeof currentValue === 'bigint') {
3598
+ return `${currentValue}n`;
3599
+ }
3600
+ if (typeof currentValue !== 'object' || currentValue === null) {
3601
+ return currentValue;
3602
+ }
3603
+ if (seen.has(currentValue)) {
3604
+ return '[Circular]';
3605
+ }
3606
+ seen.add(currentValue);
3607
+ if (currentValue instanceof ArrayBuffer) {
3608
+ return {
3609
+ byteLength: currentValue.byteLength,
3610
+ type: 'ArrayBuffer'
3611
+ };
3612
+ }
3613
+ if (ArrayBuffer.isView(currentValue)) {
3614
+ return {
3615
+ byteLength: currentValue.byteLength,
3616
+ type: currentValue.constructor.name
3617
+ };
3618
+ }
3619
+ if (currentValue instanceof Error) {
3620
+ return {
3621
+ message: currentValue.message,
3622
+ name: currentValue.name,
3623
+ stack: currentValue.stack
3624
+ };
3625
+ }
3626
+ if (currentValue.constructor?.name === 'MessagePort') {
3627
+ return {
3628
+ type: 'MessagePort'
3629
+ };
3630
+ }
3631
+ return currentValue;
3632
+ });
3633
+ return JSON.parse(text);
3634
+ };
3635
+ const isCommand = value => {
3636
+ return typeof value === 'object' && value !== null && 'method' in value && typeof value.method === 'string';
3637
+ };
3638
+ const initialize = search => {
3639
+ const searchParams = new URLSearchParams(search);
3640
+ state$8.enabled = searchParams.has('traceRendererWorker');
3641
+ state$8.entries = [];
3642
+ };
3643
+ const record = (direction, method, params) => {
3644
+ if (!state$8.enabled) {
3645
+ return;
3646
+ }
3647
+ state$8.entries.push({
3648
+ direction,
3649
+ method,
3650
+ params: serialize(params),
3651
+ timestamp: performance.now()
3652
+ });
3653
+ };
3654
+ const listen = rpc => {
3655
+ if (!state$8.enabled) {
3656
+ return;
3657
+ }
3658
+ const ipc = rpc.ipc;
3659
+ if (!ipc) {
3660
+ return;
3661
+ }
3662
+ ipc.addEventListener('message', event => {
3663
+ const message = ipc.getData(event);
3664
+ if (isCommand(message)) {
3665
+ record('received', message.method, message.params || []);
3666
+ }
3667
+ });
3668
+ };
3669
+ const exportToDom = () => {
3670
+ if (!state$8.enabled) {
3671
+ return;
3672
+ }
3673
+ const existing = document.querySelector(selector);
3674
+ const script = existing || document.createElement('script');
3675
+ script.className = 'RendererWorkerTrace';
3676
+ script.type = 'application/json';
3677
+ script.textContent = JSON.stringify({
3678
+ entries: state$8.entries,
3679
+ version: 1
3680
+ });
3681
+ if (!existing) {
3682
+ document.body.append(script);
3683
+ }
3684
+ };
3685
+ const scheduleExport = () => {
3686
+ if (!state$8.enabled) {
3687
+ return;
3688
+ }
3689
+ queueMicrotask(exportToDom);
3690
+ };
3691
+
3583
3692
  const state$7 = {
3584
3693
  rpc: undefined
3585
3694
  };
@@ -3590,6 +3699,7 @@ const hydrate$3 = async () => {
3590
3699
  return result;
3591
3700
  }
3592
3701
  state$7.rpc = result.value;
3702
+ listen(result.value);
3593
3703
  return success(undefined);
3594
3704
  };
3595
3705
 
@@ -3600,18 +3710,24 @@ const dispose$k = () => {
3600
3710
  }
3601
3711
  };
3602
3712
  const send = (method, ...params) => {
3713
+ record('sent', method, params);
3603
3714
  // @ts-ignore
3604
3715
  state$7.rpc.send(method, ...params);
3605
3716
  };
3606
3717
  const invoke$1 = (method, ...params) => {
3718
+ record('sent', method, params);
3607
3719
  // @ts-ignore
3608
3720
  return state$7.rpc.invoke(method, ...params);
3609
3721
  };
3610
3722
  const sendAndTransfer = message => {
3723
+ if (Array.isArray(message) && typeof message[0] === 'string') {
3724
+ record('sent', message[0], message.slice(1));
3725
+ }
3611
3726
  // @ts-expect-error
3612
3727
  state$7.rpc.sendAndTransfer(message);
3613
3728
  };
3614
3729
  const invokeAndTransfer = (method, ...params) => {
3730
+ record('sent', method, params);
3615
3731
  // @ts-ignore
3616
3732
  return state$7.rpc.invokeAndTransfer(method, ...params);
3617
3733
  };
@@ -4965,6 +5081,7 @@ const showOverlay = (state, background, text, actions = []) => {
4965
5081
  const $actions = actions.map(createAction);
4966
5082
  $TestOverlay.append(span, ...$actions);
4967
5083
  document.body.append($TestOverlay);
5084
+ scheduleExport();
4968
5085
  };
4969
5086
  const showTestResults = text => {
4970
5087
  const existing = document.querySelector('.TestResults');
@@ -4975,6 +5092,7 @@ const showTestResults = text => {
4975
5092
  if (!existing) {
4976
5093
  document.body.append($TestResults);
4977
5094
  }
5095
+ scheduleExport();
4978
5096
  };
4979
5097
  const performAction = async (locator, fnName, options) => {
4980
5098
  object(locator);
@@ -9938,6 +10056,7 @@ const enable = async window => {
9938
10056
  };
9939
10057
 
9940
10058
  const main = async () => {
10059
+ initialize(location.search);
9941
10060
  Object.assign(commandMapRef, commandMap);
9942
10061
  enable(window);
9943
10062
  state$1.modules[ColorPicker] = ViewletColorPicker;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/renderer-process",
3
- "version": "30.12.4",
3
+ "version": "30.13.1",
4
4
  "keywords": [
5
5
  "lvce-editor",
6
6
  "renderer-process"