@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.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import { useContext, useRef, useEffect, useMemo, useState, useCallback, useLayoutEffect } from '../preact/hooks';
1
+ import { useContext, useRef, useEffect, useMemo, useState, useCallback } from '../preact/hooks';
2
2
  import { isFunction, isArray, get, assign, set, sortBy, find as find$1, isNumber, debounce } from 'min-dash';
3
3
  import classnames from 'classnames';
4
4
  import { forwardRef } from '../preact/compat';
@@ -262,59 +262,6 @@ function useEvent(event, callback, eventBus) {
262
262
  }, [callback, event, eventBus]);
263
263
  }
264
264
 
265
- const HIGH_PRIORITY = 10000;
266
- /**
267
- * Buffer events and re-fire during passive effect phase.
268
- *
269
- * @param {string[]} bufferedEvents
270
- * @param {Object} [eventBus]
271
- */
272
-
273
- function useEventBuffer(bufferedEvents, eventBus) {
274
- const buffer = useRef([]),
275
- buffering = useRef(true);
276
-
277
- const createCallback = event => data => {
278
- if (buffering.current === true) {
279
- buffer.current.unshift([event, data]);
280
- }
281
- }; // (1) buffer events
282
-
283
-
284
- useEffect(() => {
285
- if (!eventBus) {
286
- return;
287
- }
288
-
289
- const listeners = bufferedEvents.map(event => {
290
- return [event, createCallback(event)];
291
- });
292
- listeners.forEach(([event, callback]) => {
293
- eventBus.on(event, HIGH_PRIORITY, callback);
294
- });
295
- return () => {
296
- listeners.forEach(([event, callback]) => {
297
- eventBus.off(event, callback);
298
- });
299
- };
300
- }, [bufferedEvents, eventBus]); // (2) re-fire events
301
-
302
- useEffect(() => {
303
- if (!eventBus) {
304
- return;
305
- }
306
-
307
- buffering.current = false;
308
-
309
- while (buffer.current.length) {
310
- const [event, data] = buffer.current.pop();
311
- eventBus.fire(event, data);
312
- }
313
-
314
- buffering.current = true;
315
- });
316
- }
317
-
318
265
  const KEY_LENGTH = 6;
319
266
  /**
320
267
  * Create a persistent key factory for plain objects without id.
@@ -425,7 +372,7 @@ function useShowEntryEvent(id) {
425
372
  }
426
373
  }
427
374
  }, [id]);
428
- useLayoutEffect(() => {
375
+ useEffect(() => {
429
376
  if (focus.current && ref.current) {
430
377
  if (isFunction(ref.current.focus)) {
431
378
  ref.current.focus();
@@ -634,7 +581,6 @@ const DEFAULT_LAYOUT = {
634
581
  open: true
635
582
  };
636
583
  const DEFAULT_DESCRIPTION = {};
637
- const bufferedEvents = ['propertiesPanel.showEntry', 'propertiesPanel.setErrors'];
638
584
  /**
639
585
  * @typedef { {
640
586
  * component: import('preact').Component,
@@ -754,7 +700,6 @@ function PropertiesPanel(props) {
754
700
  description,
755
701
  getDescriptionForId
756
702
  };
757
- useEventBuffer(bufferedEvents, eventBus);
758
703
  const [errors, setErrors] = useState({});
759
704
 
760
705
  const onSetErrors = ({
@@ -5110,7 +5055,7 @@ function FeelTextfield(props) {
5110
5055
  const editorRef = useShowEntryEvent(id);
5111
5056
  const containerRef = useRef();
5112
5057
  const feelActive = localValue.startsWith('=') || feel === 'required';
5113
- const feelOnlyValue = localValue.substring(1);
5058
+ const feelOnlyValue = localValue.startsWith('=') ? localValue.substring(1) : localValue;
5114
5059
  const [focus, _setFocus] = useState(undefined);
5115
5060
 
5116
5061
  const setFocus = (offset = 0) => {
@@ -6312,5 +6257,5 @@ var index = {
6312
6257
  debounceInput: ['factory', debounceInput]
6313
6258
  };
6314
6259
 
6315
- export { ArrowIcon, CheckboxEntry, CollapsibleEntry, CreateIcon, index as DebounceInputModule, DeleteIcon, DescriptionContext, Description as DescriptionEntry, DropdownButton, ErrorsContext, EventContext, ExternalLinkIcon, FeelEntry, FeelOptionalIcon, FeelRequiredIcon, FeelTextArea as FeelTextAreaEntry, Group, Header, HeaderButton, LayoutContext, List as ListEntry, ListGroup, ListItem, NumberFieldEntry, Placeholder, PropertiesPanel, LayoutContext as PropertiesPanelContext, SelectEntry, Simple as SimpleEntry, TextAreaEntry, TextfieldEntry as TextFieldEntry, ToggleSwitchEntry, isEdited$7 as isCheckboxEntryEdited, isEdited$6 as isFeelEntryEdited, isEdited$5 as isNumberFieldEntryEdited, isEdited$4 as isSelectEntryEdited, isEdited$3 as isSimpleEntryEdited, isEdited$2 as isTextAreaEntryEdited, isEdited$1 as isTextFieldEntryEdited, isEdited as isToggleSwitchEntryEdited, useDescriptionContext, useError, useEvent, useEventBuffer, useKeyFactory, useLayoutState, usePrevious, useShowEntryEvent, useStaticCallback, useStickyIntersectionObserver };
6260
+ export { ArrowIcon, CheckboxEntry, CollapsibleEntry, CreateIcon, index as DebounceInputModule, DeleteIcon, DescriptionContext, Description as DescriptionEntry, DropdownButton, ErrorsContext, EventContext, ExternalLinkIcon, FeelEntry, FeelOptionalIcon, FeelRequiredIcon, FeelTextArea as FeelTextAreaEntry, Group, Header, HeaderButton, LayoutContext, List as ListEntry, ListGroup, ListItem, NumberFieldEntry, Placeholder, PropertiesPanel, LayoutContext as PropertiesPanelContext, SelectEntry, Simple as SimpleEntry, TextAreaEntry, TextfieldEntry as TextFieldEntry, ToggleSwitchEntry, isEdited$7 as isCheckboxEntryEdited, isEdited$6 as isFeelEntryEdited, isEdited$5 as isNumberFieldEntryEdited, isEdited$4 as isSelectEntryEdited, isEdited$3 as isSimpleEntryEdited, isEdited$2 as isTextAreaEntryEdited, isEdited$1 as isTextFieldEntryEdited, isEdited as isToggleSwitchEntryEdited, useDescriptionContext, useError, useEvent, useKeyFactory, useLayoutState, usePrevious, useShowEntryEvent, useStaticCallback, useStickyIntersectionObserver };
6316
6261
  //# sourceMappingURL=index.esm.js.map