@elastic/eui 113.3.0 → 114.0.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/es/components/button/split_button/split_button.js +13 -0
- package/es/components/button/split_button/split_button_actions.js +15 -0
- package/es/components/collapsible_nav/collapsible_nav.js +5 -0
- package/es/components/color_picker/color_picker.js +31 -8
- package/es/components/datagrid/utils/scrolling.js +39 -10
- package/es/components/flyout/_flyout_overlay.js +34 -4
- package/es/components/flyout/flyout.component.js +13 -9
- package/es/components/flyout/flyout.js +9 -1
- package/es/components/flyout/flyout.styles.js +2 -2
- package/es/components/flyout/flyout_menu.js +2 -1
- package/es/components/flyout/flyout_resizable.js +5 -0
- package/es/components/flyout/manager/actions.js +5 -2
- package/es/components/flyout/manager/flyout_child.js +1 -0
- package/es/components/flyout/manager/flyout_managed.js +5 -3
- package/es/components/flyout/manager/reducer.js +116 -57
- package/es/components/flyout/manager/store.js +13 -6
- package/es/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -1
- package/es/components/markdown_editor/plugins/remark/remark_intraword_underscore.js +172 -0
- package/es/components/overlay_mask/overlay_mask.js +10 -3
- package/es/components/tree_view/tree_view_item.styles.js +1 -1
- package/es/services/hooks/index.js +8 -8
- package/es/services/hooks/useIsPointerDown.js +6 -15
- package/es/services/index.js +1 -1
- package/eui.d.ts +83 -51
- package/i18ntokens.json +661 -643
- package/lib/components/button/split_button/split_button.js +13 -0
- package/lib/components/button/split_button/split_button_actions.js +15 -0
- package/lib/components/collapsible_nav/collapsible_nav.js +5 -0
- package/lib/components/color_picker/color_picker.js +30 -7
- package/lib/components/datagrid/utils/scrolling.js +37 -8
- package/lib/components/flyout/_flyout_overlay.js +33 -3
- package/lib/components/flyout/flyout.component.js +13 -9
- package/lib/components/flyout/flyout.js +9 -1
- package/lib/components/flyout/flyout.styles.js +2 -2
- package/lib/components/flyout/flyout_menu.js +2 -1
- package/lib/components/flyout/flyout_resizable.js +5 -0
- package/lib/components/flyout/manager/actions.js +5 -2
- package/lib/components/flyout/manager/flyout_child.js +1 -0
- package/lib/components/flyout/manager/flyout_managed.js +5 -3
- package/lib/components/flyout/manager/reducer.js +116 -57
- package/lib/components/flyout/manager/store.js +13 -6
- package/lib/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -1
- package/lib/components/markdown_editor/plugins/remark/remark_intraword_underscore.js +179 -0
- package/lib/components/overlay_mask/overlay_mask.js +10 -3
- package/lib/components/tree_view/tree_view_item.styles.js +1 -1
- package/lib/services/hooks/index.js +60 -91
- package/lib/services/hooks/useIsPointerDown.js +7 -14
- package/lib/services/index.js +70 -11
- package/optimize/es/components/color_picker/color_picker.js +31 -8
- package/optimize/es/components/datagrid/utils/scrolling.js +39 -10
- package/optimize/es/components/flyout/_flyout_overlay.js +34 -4
- package/optimize/es/components/flyout/flyout.component.js +13 -9
- package/optimize/es/components/flyout/flyout.js +4 -1
- package/optimize/es/components/flyout/flyout.styles.js +2 -2
- package/optimize/es/components/flyout/flyout_menu.js +2 -1
- package/optimize/es/components/flyout/manager/actions.js +5 -2
- package/optimize/es/components/flyout/manager/flyout_managed.js +4 -3
- package/optimize/es/components/flyout/manager/reducer.js +116 -57
- package/optimize/es/components/flyout/manager/store.js +13 -6
- package/optimize/es/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -1
- package/optimize/es/components/markdown_editor/plugins/remark/remark_intraword_underscore.js +172 -0
- package/optimize/es/components/overlay_mask/overlay_mask.js +4 -2
- package/optimize/es/components/tree_view/tree_view_item.styles.js +1 -1
- package/optimize/es/services/hooks/index.js +8 -8
- package/optimize/es/services/hooks/useIsPointerDown.js +6 -10
- package/optimize/es/services/index.js +1 -1
- package/optimize/lib/components/color_picker/color_picker.js +30 -7
- package/optimize/lib/components/datagrid/utils/scrolling.js +37 -8
- package/optimize/lib/components/flyout/_flyout_overlay.js +33 -3
- package/optimize/lib/components/flyout/flyout.component.js +13 -9
- package/optimize/lib/components/flyout/flyout.js +4 -1
- package/optimize/lib/components/flyout/flyout.styles.js +2 -2
- package/optimize/lib/components/flyout/flyout_menu.js +2 -1
- package/optimize/lib/components/flyout/manager/actions.js +5 -2
- package/optimize/lib/components/flyout/manager/flyout_managed.js +4 -3
- package/optimize/lib/components/flyout/manager/reducer.js +116 -57
- package/optimize/lib/components/flyout/manager/store.js +13 -6
- package/optimize/lib/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -1
- package/optimize/lib/components/markdown_editor/plugins/remark/remark_intraword_underscore.js +179 -0
- package/optimize/lib/components/overlay_mask/overlay_mask.js +4 -2
- package/optimize/lib/components/tree_view/tree_view_item.styles.js +1 -1
- package/optimize/lib/services/hooks/index.js +60 -91
- package/optimize/lib/services/hooks/useIsPointerDown.js +5 -10
- package/optimize/lib/services/index.js +70 -11
- package/package.json +4 -4
- package/test-env/components/button/split_button/split_button.js +13 -0
- package/test-env/components/button/split_button/split_button_actions.js +15 -0
- package/test-env/components/collapsible_nav/collapsible_nav.js +5 -0
- package/test-env/components/color_picker/color_picker.js +30 -7
- package/test-env/components/datagrid/utils/scrolling.js +37 -8
- package/test-env/components/flyout/_flyout_overlay.js +33 -3
- package/test-env/components/flyout/flyout.component.js +13 -9
- package/test-env/components/flyout/flyout.styles.js +2 -2
- package/test-env/components/flyout/flyout_menu.js +2 -1
- package/test-env/components/flyout/flyout_resizable.js +5 -0
- package/test-env/components/flyout/manager/actions.js +5 -2
- package/test-env/components/flyout/manager/flyout_child.js +1 -0
- package/test-env/components/flyout/manager/flyout_managed.js +5 -3
- package/test-env/components/flyout/manager/reducer.js +116 -57
- package/test-env/components/flyout/manager/store.js +13 -6
- package/test-env/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -1
- package/test-env/components/markdown_editor/plugins/remark/remark_intraword_underscore.js +179 -0
- package/test-env/components/overlay_mask/overlay_mask.js +10 -3
- package/test-env/components/tree_view/tree_view_item.styles.js +1 -1
- package/test-env/services/hooks/index.js +60 -91
- package/test-env/services/hooks/useIsPointerDown.js +5 -10
- package/test-env/services/index.js +70 -11
|
@@ -32,6 +32,28 @@ var initialState = exports.initialState = {
|
|
|
32
32
|
currentZIndex: 0,
|
|
33
33
|
unmanagedFlyouts: []
|
|
34
34
|
};
|
|
35
|
+
var addSessionFlyoutsToRemove = function addSessionFlyoutsToRemove(session, flyoutsToRemove) {
|
|
36
|
+
var _session$childHistory;
|
|
37
|
+
flyoutsToRemove.add(session.mainFlyoutId);
|
|
38
|
+
if (session.childFlyoutId) {
|
|
39
|
+
flyoutsToRemove.add(session.childFlyoutId);
|
|
40
|
+
}
|
|
41
|
+
((_session$childHistory = session.childHistory) !== null && _session$childHistory !== void 0 ? _session$childHistory : []).forEach(function (e) {
|
|
42
|
+
return flyoutsToRemove.add(e.flyoutId);
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
var moveHistoryGroupToTop = function moveHistoryGroupToTop(sessions, historyKey) {
|
|
46
|
+
var groupSessions = [];
|
|
47
|
+
var otherSessions = [];
|
|
48
|
+
sessions.forEach(function (session) {
|
|
49
|
+
if (session.historyKey === historyKey) {
|
|
50
|
+
groupSessions.push(session);
|
|
51
|
+
} else {
|
|
52
|
+
otherSessions.push(session);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
return [].concat(otherSessions, groupSessions);
|
|
56
|
+
};
|
|
35
57
|
|
|
36
58
|
/**
|
|
37
59
|
* Reducer handling all flyout manager actions and state transitions.
|
|
@@ -80,6 +102,7 @@ function flyoutManagerReducer() {
|
|
|
80
102
|
title = action.title,
|
|
81
103
|
level = action.level,
|
|
82
104
|
size = action.size,
|
|
105
|
+
historyKey = action.historyKey,
|
|
83
106
|
iconType = action.iconType,
|
|
84
107
|
minWidth = action.minWidth;
|
|
85
108
|
var isDuplicate = state.flyouts.some(function (f) {
|
|
@@ -106,7 +129,8 @@ function flyoutManagerReducer() {
|
|
|
106
129
|
iconType: iconType,
|
|
107
130
|
childFlyoutId: null,
|
|
108
131
|
childHistory: [],
|
|
109
|
-
zIndex: state.currentZIndex
|
|
132
|
+
zIndex: state.currentZIndex,
|
|
133
|
+
historyKey: historyKey !== null && historyKey !== void 0 ? historyKey : Symbol()
|
|
110
134
|
};
|
|
111
135
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
112
136
|
sessions: [].concat((0, _toConsumableArray2.default)(state.sessions), [newSession]),
|
|
@@ -233,8 +257,8 @@ function flyoutManagerReducer() {
|
|
|
233
257
|
});
|
|
234
258
|
}
|
|
235
259
|
var owningSessionIndex = state.sessions.findIndex(function (session) {
|
|
236
|
-
var _session$
|
|
237
|
-
return session.childFlyoutId === action.flyoutId || ((_session$
|
|
260
|
+
var _session$childHistory2;
|
|
261
|
+
return session.childFlyoutId === action.flyoutId || ((_session$childHistory2 = session.childHistory) !== null && _session$childHistory2 !== void 0 ? _session$childHistory2 : []).some(function (entry) {
|
|
238
262
|
return entry.flyoutId === action.flyoutId;
|
|
239
263
|
});
|
|
240
264
|
});
|
|
@@ -266,21 +290,37 @@ function flyoutManagerReducer() {
|
|
|
266
290
|
});
|
|
267
291
|
}
|
|
268
292
|
|
|
269
|
-
// Unregister all flyouts.
|
|
293
|
+
// Unregister all flyouts (within the current history group only).
|
|
270
294
|
case _actions.ACTION_CLOSE_ALL:
|
|
271
295
|
{
|
|
272
296
|
if (state.sessions.length === 0) {
|
|
273
297
|
return state;
|
|
274
298
|
}
|
|
299
|
+
var _currentSessionIndex = state.sessions.length - 1;
|
|
300
|
+
var _currentSession = state.sessions[_currentSessionIndex];
|
|
301
|
+
var currentKey = _currentSession.historyKey;
|
|
275
302
|
|
|
276
|
-
//
|
|
303
|
+
// Remove all sessions that have the current historyKey (entire group)
|
|
304
|
+
var _newSessions = state.sessions.filter(function (s) {
|
|
305
|
+
return s.historyKey !== currentKey;
|
|
306
|
+
});
|
|
307
|
+
var _flyoutsToRemove = new Set();
|
|
308
|
+
state.sessions.forEach(function (session) {
|
|
309
|
+
if (session.historyKey === currentKey) {
|
|
310
|
+
addSessionFlyoutsToRemove(session, _flyoutsToRemove);
|
|
311
|
+
}
|
|
312
|
+
});
|
|
313
|
+
var _newFlyouts3 = state.flyouts.filter(function (f) {
|
|
314
|
+
return !_flyoutsToRemove.has(f.flyoutId);
|
|
315
|
+
});
|
|
277
316
|
var _newCurrentZIndex2 = state.currentZIndex;
|
|
278
|
-
if (state.unmanagedFlyouts.length === 0) {
|
|
317
|
+
if (_newSessions.length === 0 && state.unmanagedFlyouts.length === 0) {
|
|
279
318
|
_newCurrentZIndex2 = 0;
|
|
280
319
|
}
|
|
281
|
-
return _objectSpread(_objectSpread({},
|
|
282
|
-
|
|
283
|
-
|
|
320
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
321
|
+
sessions: _newSessions,
|
|
322
|
+
flyouts: _newFlyouts3,
|
|
323
|
+
currentZIndex: _newCurrentZIndex2
|
|
284
324
|
});
|
|
285
325
|
}
|
|
286
326
|
|
|
@@ -292,8 +332,8 @@ function flyoutManagerReducer() {
|
|
|
292
332
|
return state;
|
|
293
333
|
}
|
|
294
334
|
var _updatedSessions2 = (0, _toConsumableArray2.default)(state.sessions);
|
|
295
|
-
var
|
|
296
|
-
_updatedSessions2[
|
|
335
|
+
var _currentSessionIndex2 = _updatedSessions2.length - 1;
|
|
336
|
+
_updatedSessions2[_currentSessionIndex2] = _objectSpread(_objectSpread({}, _updatedSessions2[_currentSessionIndex2]), {}, {
|
|
297
337
|
childFlyoutId: action.flyoutId
|
|
298
338
|
});
|
|
299
339
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
@@ -339,51 +379,50 @@ function flyoutManagerReducer() {
|
|
|
339
379
|
});
|
|
340
380
|
}
|
|
341
381
|
|
|
342
|
-
// Go back: pop child history when any, else pop current session
|
|
382
|
+
// Go back: pop child history when any, else pop current session (only within same historyKey).
|
|
343
383
|
case _actions.ACTION_GO_BACK:
|
|
344
384
|
{
|
|
345
|
-
var
|
|
385
|
+
var _currentSession2$chil;
|
|
346
386
|
if (state.sessions.length === 0) {
|
|
347
387
|
return state;
|
|
348
388
|
}
|
|
349
|
-
var
|
|
350
|
-
var
|
|
351
|
-
var _childHistory = (
|
|
389
|
+
var _currentSessionIndex3 = state.sessions.length - 1;
|
|
390
|
+
var _currentSession2 = state.sessions[_currentSessionIndex3];
|
|
391
|
+
var _childHistory = (_currentSession2$chil = _currentSession2.childHistory) !== null && _currentSession2$chil !== void 0 ? _currentSession2$chil : [];
|
|
352
392
|
if (_childHistory.length > 0) {
|
|
353
393
|
// Pop one child: set current child to the last entry in history, remove the current child flyout
|
|
354
394
|
var popped = _childHistory[_childHistory.length - 1];
|
|
355
395
|
var newChildHistory = _childHistory.slice(0, -1);
|
|
356
396
|
var _updatedSessions3 = (0, _toConsumableArray2.default)(state.sessions);
|
|
357
|
-
_updatedSessions3[
|
|
397
|
+
_updatedSessions3[_currentSessionIndex3] = _objectSpread(_objectSpread({}, _currentSession2), {}, {
|
|
358
398
|
childHistory: newChildHistory,
|
|
359
399
|
childFlyoutId: popped.flyoutId,
|
|
360
400
|
childTitle: popped.title,
|
|
361
401
|
childIconType: popped.iconType
|
|
362
402
|
});
|
|
363
|
-
var
|
|
364
|
-
return f.flyoutId !==
|
|
403
|
+
var _newFlyouts4 = state.flyouts.filter(function (f) {
|
|
404
|
+
return f.flyoutId !== _currentSession2.childFlyoutId;
|
|
365
405
|
});
|
|
366
406
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
367
407
|
sessions: _updatedSessions3,
|
|
368
|
-
flyouts:
|
|
408
|
+
flyouts: _newFlyouts4
|
|
369
409
|
});
|
|
370
410
|
}
|
|
371
411
|
|
|
372
412
|
// No child history: pop current session (main + all its children)
|
|
373
|
-
var
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
return _flyoutsToRemove.add(e.flyoutId);
|
|
413
|
+
var _flyoutsToRemove2 = new Set();
|
|
414
|
+
addSessionFlyoutsToRemove(_currentSession2, _flyoutsToRemove2);
|
|
415
|
+
var sessionsWithoutCurrent = state.sessions.slice(0, _currentSessionIndex3);
|
|
416
|
+
var hasRemainingInCurrentGroup = sessionsWithoutCurrent.some(function (s) {
|
|
417
|
+
return s.historyKey === _currentSession2.historyKey;
|
|
379
418
|
});
|
|
380
|
-
var
|
|
381
|
-
|
|
419
|
+
var _newSessions2 = hasRemainingInCurrentGroup ? moveHistoryGroupToTop(sessionsWithoutCurrent, _currentSession2.historyKey) : sessionsWithoutCurrent;
|
|
420
|
+
var _newFlyouts5 = state.flyouts.filter(function (f) {
|
|
421
|
+
return !_flyoutsToRemove2.has(f.flyoutId);
|
|
382
422
|
});
|
|
383
|
-
var _newSessions = state.sessions.slice(0, _currentSessionIndex2);
|
|
384
423
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
385
|
-
sessions:
|
|
386
|
-
flyouts:
|
|
424
|
+
sessions: _newSessions2,
|
|
425
|
+
flyouts: _newFlyouts5
|
|
387
426
|
});
|
|
388
427
|
}
|
|
389
428
|
|
|
@@ -392,11 +431,11 @@ function flyoutManagerReducer() {
|
|
|
392
431
|
{
|
|
393
432
|
var _flyoutId3 = action.flyoutId,
|
|
394
433
|
_level = action.level;
|
|
395
|
-
var
|
|
434
|
+
var _currentSessionIndex4 = state.sessions.length - 1;
|
|
396
435
|
if (_level === _const.LEVEL_CHILD && state.sessions.length > 0) {
|
|
397
|
-
var
|
|
398
|
-
var
|
|
399
|
-
var _childHistory2 = (
|
|
436
|
+
var _currentSession3$chil;
|
|
437
|
+
var _currentSession3 = state.sessions[_currentSessionIndex4];
|
|
438
|
+
var _childHistory2 = (_currentSession3$chil = _currentSession3.childHistory) !== null && _currentSession3$chil !== void 0 ? _currentSession3$chil : [];
|
|
400
439
|
var targetIndex = _childHistory2.findIndex(function (entry) {
|
|
401
440
|
return entry.flyoutId === _flyoutId3;
|
|
402
441
|
});
|
|
@@ -405,18 +444,18 @@ function flyoutManagerReducer() {
|
|
|
405
444
|
}
|
|
406
445
|
var targetEntry = _childHistory2[targetIndex];
|
|
407
446
|
var _newChildHistory = _childHistory2.slice(0, targetIndex);
|
|
408
|
-
var
|
|
409
|
-
if (
|
|
410
|
-
|
|
447
|
+
var _flyoutsToRemove3 = new Set();
|
|
448
|
+
if (_currentSession3.childFlyoutId) {
|
|
449
|
+
_flyoutsToRemove3.add(_currentSession3.childFlyoutId);
|
|
411
450
|
}
|
|
412
451
|
_childHistory2.slice(targetIndex + 1).forEach(function (e) {
|
|
413
|
-
|
|
452
|
+
_flyoutsToRemove3.add(e.flyoutId);
|
|
414
453
|
});
|
|
415
|
-
var
|
|
416
|
-
return !
|
|
454
|
+
var _newFlyouts6 = state.flyouts.filter(function (f) {
|
|
455
|
+
return !_flyoutsToRemove3.has(f.flyoutId);
|
|
417
456
|
});
|
|
418
457
|
var _updatedSessions4 = (0, _toConsumableArray2.default)(state.sessions);
|
|
419
|
-
_updatedSessions4[
|
|
458
|
+
_updatedSessions4[_currentSessionIndex4] = _objectSpread(_objectSpread({}, _currentSession3), {}, {
|
|
420
459
|
childHistory: _newChildHistory,
|
|
421
460
|
childFlyoutId: targetEntry.flyoutId,
|
|
422
461
|
childTitle: targetEntry.title,
|
|
@@ -424,7 +463,7 @@ function flyoutManagerReducer() {
|
|
|
424
463
|
});
|
|
425
464
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
426
465
|
sessions: _updatedSessions4,
|
|
427
|
-
flyouts:
|
|
466
|
+
flyouts: _newFlyouts6
|
|
428
467
|
});
|
|
429
468
|
}
|
|
430
469
|
|
|
@@ -435,25 +474,45 @@ function flyoutManagerReducer() {
|
|
|
435
474
|
if (targetSessionIndex === -1) {
|
|
436
475
|
return state; // Target flyout not found
|
|
437
476
|
}
|
|
477
|
+
var _currentSession4 = state.sessions[_currentSessionIndex4];
|
|
478
|
+
var targetSession = state.sessions[targetSessionIndex];
|
|
479
|
+
|
|
480
|
+
// Group-local navigation: keep other history groups, remove only newer sessions in target's group,
|
|
481
|
+
// then bring that group to the top.
|
|
482
|
+
if (targetSession.historyKey === _currentSession4.historyKey) {
|
|
483
|
+
var _flyoutsToRemove4 = new Set();
|
|
484
|
+
var sessionsAfterTargetInGroup = state.sessions.filter(function (session, index) {
|
|
485
|
+
return index > targetSessionIndex && session.historyKey === targetSession.historyKey;
|
|
486
|
+
});
|
|
487
|
+
sessionsAfterTargetInGroup.forEach(function (session) {
|
|
488
|
+
addSessionFlyoutsToRemove(session, _flyoutsToRemove4);
|
|
489
|
+
});
|
|
490
|
+
var sessionsWithoutRemoved = state.sessions.filter(function (session) {
|
|
491
|
+
return !sessionsAfterTargetInGroup.some(function (removed) {
|
|
492
|
+
return removed.mainFlyoutId === session.mainFlyoutId;
|
|
493
|
+
});
|
|
494
|
+
});
|
|
495
|
+
var reorderedSessions = moveHistoryGroupToTop(sessionsWithoutRemoved, targetSession.historyKey);
|
|
496
|
+
var _newFlyouts7 = state.flyouts.filter(function (f) {
|
|
497
|
+
return !_flyoutsToRemove4.has(f.flyoutId);
|
|
498
|
+
});
|
|
499
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
500
|
+
sessions: reorderedSessions,
|
|
501
|
+
flyouts: _newFlyouts7
|
|
502
|
+
});
|
|
503
|
+
}
|
|
438
504
|
var sessionsToClose = state.sessions.slice(targetSessionIndex + 1);
|
|
439
|
-
var
|
|
505
|
+
var _flyoutsToRemove5 = new Set();
|
|
440
506
|
sessionsToClose.forEach(function (session) {
|
|
441
|
-
|
|
442
|
-
_flyoutsToRemove3.add(session.mainFlyoutId);
|
|
443
|
-
if (session.childFlyoutId) {
|
|
444
|
-
_flyoutsToRemove3.add(session.childFlyoutId);
|
|
445
|
-
}
|
|
446
|
-
((_session$childHistory2 = session.childHistory) !== null && _session$childHistory2 !== void 0 ? _session$childHistory2 : []).forEach(function (e) {
|
|
447
|
-
return _flyoutsToRemove3.add(e.flyoutId);
|
|
448
|
-
});
|
|
507
|
+
addSessionFlyoutsToRemove(session, _flyoutsToRemove5);
|
|
449
508
|
});
|
|
450
|
-
var
|
|
451
|
-
return !
|
|
509
|
+
var _newFlyouts8 = state.flyouts.filter(function (f) {
|
|
510
|
+
return !_flyoutsToRemove5.has(f.flyoutId);
|
|
452
511
|
});
|
|
453
|
-
var
|
|
512
|
+
var _newSessions3 = state.sessions.slice(0, targetSessionIndex + 1);
|
|
454
513
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
455
|
-
sessions:
|
|
456
|
-
flyouts:
|
|
514
|
+
sessions: _newSessions3,
|
|
515
|
+
flyouts: _newFlyouts8
|
|
457
516
|
});
|
|
458
517
|
}
|
|
459
518
|
|
|
@@ -54,8 +54,15 @@ function createStore() {
|
|
|
54
54
|
var _currentSession$child;
|
|
55
55
|
var currentSessionIndex = currentState.sessions.length - 1;
|
|
56
56
|
var currentSession = currentSessionIndex >= 0 ? currentState.sessions[currentSessionIndex] : null;
|
|
57
|
+
if (!currentSession) {
|
|
58
|
+
return [];
|
|
59
|
+
}
|
|
57
60
|
var previousSessions = currentState.sessions.slice(0, currentSessionIndex);
|
|
58
|
-
|
|
61
|
+
// Only include sessions in the same history group (same historyKey reference)
|
|
62
|
+
var previousSessionsInGroup = previousSessions.filter(function (session) {
|
|
63
|
+
return session.historyKey === currentSession.historyKey;
|
|
64
|
+
});
|
|
65
|
+
var childHistory = (_currentSession$child = currentSession.childHistory) !== null && _currentSession$child !== void 0 ? _currentSession$child : [];
|
|
59
66
|
var childItems = (0, _toConsumableArray2.default)(childHistory).reverse().map(function (entry) {
|
|
60
67
|
return {
|
|
61
68
|
title: entry.title,
|
|
@@ -66,11 +73,11 @@ function createStore() {
|
|
|
66
73
|
};
|
|
67
74
|
});
|
|
68
75
|
|
|
69
|
-
// Previous sessions: list each session's current child then its child history
|
|
76
|
+
// Previous sessions (same group): list each session's current child then its child history
|
|
70
77
|
var previousSessionItems = [];
|
|
71
78
|
var _loop = function _loop() {
|
|
72
79
|
var _session$childHistory;
|
|
73
|
-
var session =
|
|
80
|
+
var session = previousSessionsInGroup[i];
|
|
74
81
|
var mainTitle = session.title;
|
|
75
82
|
var mainFlyoutId = session.mainFlyoutId;
|
|
76
83
|
var history = (_session$childHistory = session.childHistory) !== null && _session$childHistory !== void 0 ? _session$childHistory : [];
|
|
@@ -108,7 +115,7 @@ function createStore() {
|
|
|
108
115
|
});
|
|
109
116
|
}
|
|
110
117
|
};
|
|
111
|
-
for (var i =
|
|
118
|
+
for (var i = previousSessionsInGroup.length - 1; i >= 0; i--) {
|
|
112
119
|
_loop();
|
|
113
120
|
}
|
|
114
121
|
return [].concat((0, _toConsumableArray2.default)(childItems), previousSessionItems);
|
|
@@ -147,8 +154,8 @@ function createStore() {
|
|
|
147
154
|
subscribe: subscribe,
|
|
148
155
|
subscribeToEvents: subscribeToEvents,
|
|
149
156
|
dispatch: dispatch,
|
|
150
|
-
addFlyout: function addFlyout(flyoutId, title, level, size, iconType, minWidth) {
|
|
151
|
-
return dispatch((0, _actions.addFlyout)(flyoutId, title, level, size, iconType, minWidth));
|
|
157
|
+
addFlyout: function addFlyout(flyoutId, title, level, size, historyKey, iconType, minWidth) {
|
|
158
|
+
return dispatch((0, _actions.addFlyout)(flyoutId, title, level, size, historyKey, iconType, minWidth));
|
|
152
159
|
},
|
|
153
160
|
closeFlyout: function closeFlyout(flyoutId) {
|
|
154
161
|
return dispatch((0, _actions.closeFlyout)(flyoutId));
|
package/optimize/lib/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js
CHANGED
|
@@ -12,6 +12,7 @@ var _remarkParseNoTrim = _interopRequireDefault(require("remark-parse-no-trim"))
|
|
|
12
12
|
var _remarkEmoji = _interopRequireDefault(require("remark-emoji"));
|
|
13
13
|
var _remarkBreaks = _interopRequireDefault(require("remark-breaks"));
|
|
14
14
|
var _remark_prismjs = _interopRequireDefault(require("../remark/remark_prismjs"));
|
|
15
|
+
var _remark_intraword_underscore = _interopRequireDefault(require("../remark/remark_intraword_underscore"));
|
|
15
16
|
var MarkdownTooltip = _interopRequireWildcard(require("../markdown_tooltip"));
|
|
16
17
|
var MarkdownCheckbox = _interopRequireWildcard(require("../markdown_checkbox"));
|
|
17
18
|
var _markdown_link_validator = require("../markdown_link_validator");
|
|
@@ -42,7 +43,7 @@ var getDefaultEuiMarkdownParsingPlugins = exports.getDefaultEuiMarkdownParsingPl
|
|
|
42
43
|
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
43
44
|
var exclude = _ref.exclude,
|
|
44
45
|
parsingConfig = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
45
|
-
var parsingPlugins = [[_remarkParseNoTrim.default, {}], [_remark_prismjs.default, {}]];
|
|
46
|
+
var parsingPlugins = [[_remarkParseNoTrim.default, {}], [_remark_prismjs.default, {}], [_remark_intraword_underscore.default, {}]];
|
|
46
47
|
Object.entries(DEFAULT_PARSING_PLUGINS).forEach(function (_ref2) {
|
|
47
48
|
var _ref3 = (0, _slicedToArray2.default)(_ref2, 2),
|
|
48
49
|
pluginName = _ref3[0],
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
8
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
9
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
10
|
+
/*
|
|
11
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
12
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
13
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
14
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
15
|
+
* Side Public License, v 1.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
// Temporary workaround for https://github.com/elastic/eui/issues/9404
|
|
19
|
+
// remark-parse v8 doesn't implement the CommonMark rule that underscore
|
|
20
|
+
// emphasis delimiters flanked by alphanumerics on both sides (intraword)
|
|
21
|
+
// cannot open or close emphasis. This causes identifiers like
|
|
22
|
+
// `ABCD__PineappleCherry__e` to render with bold formatting.
|
|
23
|
+
// This plugin walks the parsed AST and reverses incorrectly applied
|
|
24
|
+
// emphasis/strong nodes when both sides are alphanumeric characters.
|
|
25
|
+
|
|
26
|
+
// eslint-disable-next-line import/no-unresolved
|
|
27
|
+
|
|
28
|
+
var isTextNode = function isTextNode(node) {
|
|
29
|
+
return node.type === 'text';
|
|
30
|
+
};
|
|
31
|
+
var isEmphasisOrStrong = function isEmphasisOrStrong(node) {
|
|
32
|
+
return node.type === 'emphasis' || node.type === 'strong';
|
|
33
|
+
};
|
|
34
|
+
var isAlphanumeric = function isAlphanumeric(ch) {
|
|
35
|
+
return /[a-zA-Z0-9]/.test(ch);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Recursively converts an emphasis/strong node back into plain text
|
|
40
|
+
* with underscore delimiters restored.
|
|
41
|
+
*/
|
|
42
|
+
function flattenToText(node) {
|
|
43
|
+
var delimiter = node.type === 'emphasis' ? '_' : '__';
|
|
44
|
+
var inner = '';
|
|
45
|
+
var _iterator = _createForOfIteratorHelper(node.children),
|
|
46
|
+
_step;
|
|
47
|
+
try {
|
|
48
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
49
|
+
var child = _step.value;
|
|
50
|
+
if (isTextNode(child)) {
|
|
51
|
+
inner += child.value;
|
|
52
|
+
} else if (isEmphasisOrStrong(child)) {
|
|
53
|
+
inner += flattenToText(child);
|
|
54
|
+
} else {
|
|
55
|
+
// Contains non-text children (links, images, etc.) — leave emphasis intact
|
|
56
|
+
return delimiter + collectText(node) + delimiter;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
} catch (err) {
|
|
60
|
+
_iterator.e(err);
|
|
61
|
+
} finally {
|
|
62
|
+
_iterator.f();
|
|
63
|
+
}
|
|
64
|
+
return delimiter + inner + delimiter;
|
|
65
|
+
}
|
|
66
|
+
function collectText(node) {
|
|
67
|
+
if (isTextNode(node)) return node.value;
|
|
68
|
+
if ('children' in node) {
|
|
69
|
+
return node.children.map(collectText).join('');
|
|
70
|
+
}
|
|
71
|
+
return '';
|
|
72
|
+
}
|
|
73
|
+
function processParent(parent, source) {
|
|
74
|
+
var modified = false;
|
|
75
|
+
var i = 0;
|
|
76
|
+
while (i < parent.children.length) {
|
|
77
|
+
var child = parent.children[i];
|
|
78
|
+
if (isEmphasisOrStrong(child) && isIntraword(parent, i, source)) {
|
|
79
|
+
var textValue = flattenToText(child);
|
|
80
|
+
var replacement = {
|
|
81
|
+
type: 'text',
|
|
82
|
+
value: textValue
|
|
83
|
+
};
|
|
84
|
+
parent.children.splice(i, 1, replacement);
|
|
85
|
+
modified = true;
|
|
86
|
+
// Don't advance — the replaced node may need to merge with neighbors
|
|
87
|
+
} else {
|
|
88
|
+
if ('children' in child) {
|
|
89
|
+
processParent(child, source);
|
|
90
|
+
}
|
|
91
|
+
i++;
|
|
92
|
+
}
|
|
93
|
+
if (modified) {
|
|
94
|
+
mergeAdjacentText(parent);
|
|
95
|
+
modified = false;
|
|
96
|
+
// After merging, restart scan since indices shifted
|
|
97
|
+
i = 0;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
function getInnerText(node) {
|
|
102
|
+
if (isTextNode(node)) return node.value;
|
|
103
|
+
if ('children' in node) {
|
|
104
|
+
var children = node.children;
|
|
105
|
+
if (children.length > 0) return getInnerText(children[0]);
|
|
106
|
+
}
|
|
107
|
+
return '';
|
|
108
|
+
}
|
|
109
|
+
function getInnerTextEnd(node) {
|
|
110
|
+
if (isTextNode(node)) return node.value;
|
|
111
|
+
if ('children' in node) {
|
|
112
|
+
var children = node.children;
|
|
113
|
+
if (children.length > 0) return getInnerTextEnd(children[children.length - 1]);
|
|
114
|
+
}
|
|
115
|
+
return '';
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Checks whether the emphasis/strong node at `index` within `parent`
|
|
120
|
+
* is an intraword usage of underscore delimiters.
|
|
121
|
+
*
|
|
122
|
+
* A node is intraword when at least one side has an alphanumeric text
|
|
123
|
+
* neighbor AND the inner content on the corresponding delimiter side
|
|
124
|
+
* also touches word characters — proving the underscores are embedded
|
|
125
|
+
* in a word rather than used as formatting.
|
|
126
|
+
*/
|
|
127
|
+
function isIntraword(parent, index, source) {
|
|
128
|
+
var _node$position;
|
|
129
|
+
var node = parent.children[index];
|
|
130
|
+
|
|
131
|
+
// Verify the delimiter is `_` (not `*`) by inspecting the source
|
|
132
|
+
if (((_node$position = node.position) === null || _node$position === void 0 || (_node$position = _node$position.start) === null || _node$position === void 0 ? void 0 : _node$position.offset) != null) {
|
|
133
|
+
var ch = source[node.position.start.offset];
|
|
134
|
+
if (ch !== '_') return false;
|
|
135
|
+
}
|
|
136
|
+
var prev = index > 0 ? parent.children[index - 1] : null;
|
|
137
|
+
var next = index < parent.children.length - 1 ? parent.children[index + 1] : null;
|
|
138
|
+
var prevChar = prev != null && isTextNode(prev) && prev.value.length > 0 ? prev.value[prev.value.length - 1] : null;
|
|
139
|
+
var nextChar = next != null && isTextNode(next) && next.value.length > 0 ? next.value[0] : null;
|
|
140
|
+
var prevIsAlpha = prevChar != null && isAlphanumeric(prevChar);
|
|
141
|
+
var nextIsAlpha = nextChar != null && isAlphanumeric(nextChar);
|
|
142
|
+
|
|
143
|
+
// Both sides flanked by alphanumeric — classic intraword (e.g. `foo__bar__baz`)
|
|
144
|
+
if (prevIsAlpha && nextIsAlpha) return true;
|
|
145
|
+
|
|
146
|
+
// One-sided: prev is alpha or underscore, no alpha next — check inner text
|
|
147
|
+
// starts with alpha (e.g. `Lorem__ipsum__` or `Lorem__ipsum_`)
|
|
148
|
+
if (prevIsAlpha || prevChar === '_') {
|
|
149
|
+
var inner = getInnerText(node);
|
|
150
|
+
if (inner.length > 0 && isAlphanumeric(inner[0])) return true;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// One-sided: next is alpha or underscore, no alpha prev — check inner text
|
|
154
|
+
// ends with alpha (e.g. `__Lorem__ipsum` or `_Lorem__ipsum`)
|
|
155
|
+
if (nextIsAlpha || nextChar === '_') {
|
|
156
|
+
var _inner = getInnerTextEnd(node);
|
|
157
|
+
if (_inner.length > 0 && isAlphanumeric(_inner[_inner.length - 1])) return true;
|
|
158
|
+
}
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
function mergeAdjacentText(parent) {
|
|
162
|
+
var i = 0;
|
|
163
|
+
while (i < parent.children.length - 1) {
|
|
164
|
+
if (isTextNode(parent.children[i]) && isTextNode(parent.children[i + 1])) {
|
|
165
|
+
parent.children[i].value += parent.children[i + 1].value;
|
|
166
|
+
parent.children.splice(i + 1, 1);
|
|
167
|
+
} else {
|
|
168
|
+
i++;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
var attacher = function remarkIntrawordUnderscore() {
|
|
173
|
+
return function (tree, file) {
|
|
174
|
+
var source = String(file);
|
|
175
|
+
processParent(tree, source);
|
|
176
|
+
};
|
|
177
|
+
};
|
|
178
|
+
var _default = exports.default = attacher;
|
|
179
|
+
module.exports = exports.default;
|
|
@@ -17,7 +17,7 @@ var _services = require("../../services");
|
|
|
17
17
|
var _portal = require("../portal");
|
|
18
18
|
var _overlay_mask = require("./overlay_mask.styles");
|
|
19
19
|
var _overlay_mask_body = require("./overlay_mask_body.styles");
|
|
20
|
-
var _excluded = ["className", "children", "headerZindexLocation", "maskRef"];
|
|
20
|
+
var _excluded = ["className", "children", "headerZindexLocation", "maskRef", "hasAnimation"];
|
|
21
21
|
/*
|
|
22
22
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
23
23
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -33,6 +33,8 @@ var EuiOverlayMask = exports.EuiOverlayMask = function EuiOverlayMask(_ref) {
|
|
|
33
33
|
_ref$headerZindexLoca = _ref.headerZindexLocation,
|
|
34
34
|
headerZindexLocation = _ref$headerZindexLoca === void 0 ? 'above' : _ref$headerZindexLoca,
|
|
35
35
|
maskRef = _ref.maskRef,
|
|
36
|
+
_ref$hasAnimation = _ref.hasAnimation,
|
|
37
|
+
hasAnimation = _ref$hasAnimation === void 0 ? true : _ref$hasAnimation,
|
|
36
38
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
37
39
|
var hasRendered = (0, _react.useRef)(false);
|
|
38
40
|
var _useState = (0, _react.useState)(null),
|
|
@@ -44,7 +46,7 @@ var EuiOverlayMask = exports.EuiOverlayMask = function EuiOverlayMask(_ref) {
|
|
|
44
46
|
hasRendered.current = true;
|
|
45
47
|
}, []);
|
|
46
48
|
var styles = (0, _services.useEuiMemoizedStyles)(_overlay_mask.euiOverlayMaskStyles);
|
|
47
|
-
var cssStyles = (0, _css.cx)([styles.euiOverlayMask, styles["".concat(headerZindexLocation, "Header")], hasRendered.current && styles.noAnimation]);
|
|
49
|
+
var cssStyles = (0, _css.cx)([styles.euiOverlayMask, styles["".concat(headerZindexLocation, "Header")], (hasRendered.current || !hasAnimation) && styles.noAnimation]);
|
|
48
50
|
(0, _react.useEffect)(function () {
|
|
49
51
|
if (!overlayMaskNode) return;
|
|
50
52
|
(0, _common.keysOf)(rest).forEach(function (key) {
|
|
@@ -30,7 +30,7 @@ var euiTreeViewItemStyles = exports.euiTreeViewItemStyles = function euiTreeView
|
|
|
30
30
|
euiTreeView__node: _ref,
|
|
31
31
|
default: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('max-height', defaultSize), " line-height:", defaultSize, ";;label:default;"),
|
|
32
32
|
compressed: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('max-height', compressedSize), " line-height:", compressedSize, ";;label:compressed;"),
|
|
33
|
-
expanded: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('max-height', '
|
|
33
|
+
expanded: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('max-height', 'none'), ";;label:expanded;")
|
|
34
34
|
},
|
|
35
35
|
button: {
|
|
36
36
|
euiTreeView__nodeInner: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('width', '100%'), " ", (0, _global_styling.logicalCSS)('padding-left', euiTheme.size.s), " ", (0, _global_styling.logicalCSS)('padding-right', euiTheme.size.xxs), " display:flex;align-items:center;&:focus{", (0, _global_styling.euiFocusRing)(euiThemeContext, 'inset'), ";}&:hover,&:active,&:focus{background-color:", euiTheme.components.treeViewItemBackgroundHover, ";};label:euiTreeView__nodeInner;"),
|