@bpmn-io/properties-panel 0.20.2 → 0.21.0

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.js CHANGED
@@ -270,59 +270,6 @@ function useEvent(event, callback, eventBus) {
270
270
  }, [callback, event, eventBus]);
271
271
  }
272
272
 
273
- const HIGH_PRIORITY = 10000;
274
- /**
275
- * Buffer events and re-fire during passive effect phase.
276
- *
277
- * @param {string[]} bufferedEvents
278
- * @param {Object} [eventBus]
279
- */
280
-
281
- function useEventBuffer(bufferedEvents, eventBus) {
282
- const buffer = hooks.useRef([]),
283
- buffering = hooks.useRef(true);
284
-
285
- const createCallback = event => data => {
286
- if (buffering.current === true) {
287
- buffer.current.unshift([event, data]);
288
- }
289
- }; // (1) buffer events
290
-
291
-
292
- hooks.useEffect(() => {
293
- if (!eventBus) {
294
- return;
295
- }
296
-
297
- const listeners = bufferedEvents.map(event => {
298
- return [event, createCallback(event)];
299
- });
300
- listeners.forEach(([event, callback]) => {
301
- eventBus.on(event, HIGH_PRIORITY, callback);
302
- });
303
- return () => {
304
- listeners.forEach(([event, callback]) => {
305
- eventBus.off(event, callback);
306
- });
307
- };
308
- }, [bufferedEvents, eventBus]); // (2) re-fire events
309
-
310
- hooks.useEffect(() => {
311
- if (!eventBus) {
312
- return;
313
- }
314
-
315
- buffering.current = false;
316
-
317
- while (buffer.current.length) {
318
- const [event, data] = buffer.current.pop();
319
- eventBus.fire(event, data);
320
- }
321
-
322
- buffering.current = true;
323
- });
324
- }
325
-
326
273
  const KEY_LENGTH = 6;
327
274
  /**
328
275
  * Create a persistent key factory for plain objects without id.
@@ -433,7 +380,7 @@ function useShowEntryEvent(id) {
433
380
  }
434
381
  }
435
382
  }, [id]);
436
- hooks.useLayoutEffect(() => {
383
+ hooks.useEffect(() => {
437
384
  if (focus.current && ref.current) {
438
385
  if (minDash.isFunction(ref.current.focus)) {
439
386
  ref.current.focus();
@@ -642,7 +589,6 @@ const DEFAULT_LAYOUT = {
642
589
  open: true
643
590
  };
644
591
  const DEFAULT_DESCRIPTION = {};
645
- const bufferedEvents = ['propertiesPanel.showEntry', 'propertiesPanel.setErrors'];
646
592
  /**
647
593
  * @typedef { {
648
594
  * component: import('preact').Component,
@@ -762,7 +708,6 @@ function PropertiesPanel(props) {
762
708
  description,
763
709
  getDescriptionForId
764
710
  };
765
- useEventBuffer(bufferedEvents, eventBus);
766
711
  const [errors, setErrors] = hooks.useState({});
767
712
 
768
713
  const onSetErrors = ({
@@ -5118,7 +5063,7 @@ function FeelTextfield(props) {
5118
5063
  const editorRef = useShowEntryEvent(id);
5119
5064
  const containerRef = hooks.useRef();
5120
5065
  const feelActive = localValue.startsWith('=') || feel === 'required';
5121
- const feelOnlyValue = localValue.substring(1);
5066
+ const feelOnlyValue = localValue.startsWith('=') ? localValue.substring(1) : localValue;
5122
5067
  const [focus, _setFocus] = hooks.useState(undefined);
5123
5068
 
5124
5069
  const setFocus = (offset = 0) => {
@@ -6363,7 +6308,6 @@ exports.isToggleSwitchEntryEdited = isEdited;
6363
6308
  exports.useDescriptionContext = useDescriptionContext;
6364
6309
  exports.useError = useError;
6365
6310
  exports.useEvent = useEvent;
6366
- exports.useEventBuffer = useEventBuffer;
6367
6311
  exports.useKeyFactory = useKeyFactory;
6368
6312
  exports.useLayoutState = useLayoutState;
6369
6313
  exports.usePrevious = usePrevious;