@measured/puck-plugin-heading-analyzer 0.16.0-canary.345374c → 0.16.0-canary.39e7f40
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.js +46 -13
- package/package.json +2 -2
package/dist/index.js
CHANGED
@@ -73709,6 +73709,7 @@ var require_dist = __commonJS({
|
|
73709
73709
|
init_react_import2();
|
73710
73710
|
init_react_import2();
|
73711
73711
|
init_react_import2();
|
73712
|
+
init_react_import2();
|
73712
73713
|
var import_classnames2 = __toESM2(require_classnames2());
|
73713
73714
|
var getClassNameFactory2 = (rootClass, styles, { baseClass = "" } = {}) => (options = {}) => {
|
73714
73715
|
let descendant = false;
|
@@ -77478,26 +77479,50 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77478
77479
|
historyStore.forward();
|
77479
77480
|
}
|
77480
77481
|
};
|
77482
|
+
const setHistories = (histories) => {
|
77483
|
+
var _a3;
|
77484
|
+
dispatch({
|
77485
|
+
type: "set",
|
77486
|
+
state: ((_a3 = histories[histories.length - 1]) == null ? void 0 : _a3.data) || initialAppState
|
77487
|
+
});
|
77488
|
+
historyStore.setHistories(histories);
|
77489
|
+
};
|
77490
|
+
const setHistoryIndex = (index) => {
|
77491
|
+
var _a3;
|
77492
|
+
if (historyStore.histories.length > index) {
|
77493
|
+
dispatch({
|
77494
|
+
type: "set",
|
77495
|
+
state: ((_a3 = historyStore.histories[index]) == null ? void 0 : _a3.data) || initialAppState
|
77496
|
+
});
|
77497
|
+
historyStore.setHistoryIndex(index);
|
77498
|
+
}
|
77499
|
+
};
|
77481
77500
|
(0, import_react_hotkeys_hook.useHotkeys)("meta+z", back, { preventDefault: true });
|
77482
77501
|
(0, import_react_hotkeys_hook.useHotkeys)("meta+shift+z", forward, { preventDefault: true });
|
77483
77502
|
(0, import_react_hotkeys_hook.useHotkeys)("meta+y", forward, { preventDefault: true });
|
77484
77503
|
return {
|
77485
77504
|
back,
|
77486
77505
|
forward,
|
77487
|
-
historyStore
|
77506
|
+
historyStore,
|
77507
|
+
setHistories,
|
77508
|
+
setHistoryIndex
|
77488
77509
|
};
|
77489
77510
|
}
|
77490
77511
|
init_react_import2();
|
77491
77512
|
var import_react27 = require("react");
|
77492
77513
|
var import_use_debounce3 = (init_index_module(), __toCommonJS(index_module_exports));
|
77493
77514
|
var EMPTY_HISTORY_INDEX = -1;
|
77494
|
-
function useHistoryStore(
|
77515
|
+
function useHistoryStore(initialHistory) {
|
77495
77516
|
var _a3, _b;
|
77496
77517
|
const [histories, setHistories] = (0, import_react27.useState)(
|
77497
|
-
(_a3 =
|
77518
|
+
(_a3 = initialHistory == null ? void 0 : initialHistory.histories) != null ? _a3 : []
|
77498
77519
|
);
|
77520
|
+
const updateHistories = (histories2) => {
|
77521
|
+
setHistories(histories2);
|
77522
|
+
setIndex(histories2.length - 1);
|
77523
|
+
};
|
77499
77524
|
const [index, setIndex] = (0, import_react27.useState)(
|
77500
|
-
(_b =
|
77525
|
+
(_b = initialHistory == null ? void 0 : initialHistory.index) != null ? _b : EMPTY_HISTORY_INDEX
|
77501
77526
|
);
|
77502
77527
|
const hasPast = index > EMPTY_HISTORY_INDEX;
|
77503
77528
|
const hasFuture = index < histories.length - 1;
|
@@ -77509,11 +77534,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77509
77534
|
data,
|
77510
77535
|
id: generateId("history")
|
77511
77536
|
};
|
77512
|
-
|
77513
|
-
const newVal = [...prev.slice(0, index + 1), history];
|
77514
|
-
setIndex(newVal.length - 1);
|
77515
|
-
return newVal;
|
77516
|
-
});
|
77537
|
+
updateHistories([...histories.slice(0, index + 1), history]);
|
77517
77538
|
}, 250);
|
77518
77539
|
const back = () => {
|
77519
77540
|
setIndex(index - 1);
|
@@ -77531,7 +77552,9 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77531
77552
|
forward,
|
77532
77553
|
nextHistory,
|
77533
77554
|
prevHistory,
|
77534
|
-
histories
|
77555
|
+
histories,
|
77556
|
+
setHistories: updateHistories,
|
77557
|
+
setHistoryIndex: setIndex
|
77535
77558
|
};
|
77536
77559
|
}
|
77537
77560
|
init_react_import2();
|
@@ -77952,10 +77975,10 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77952
77975
|
enabled: true
|
77953
77976
|
},
|
77954
77977
|
dnd,
|
77955
|
-
|
77978
|
+
initialHistory
|
77956
77979
|
}) {
|
77957
77980
|
var _a3;
|
77958
|
-
const historyStore = useHistoryStore(
|
77981
|
+
const historyStore = useHistoryStore(initialHistory);
|
77959
77982
|
const [reducer2] = (0, import_react30.useState)(
|
77960
77983
|
() => createReducer({ config, record: historyStore.record })
|
77961
77984
|
);
|
@@ -78497,7 +78520,17 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
78497
78520
|
appState,
|
78498
78521
|
config,
|
78499
78522
|
dispatch,
|
78500
|
-
history
|
78523
|
+
history: {
|
78524
|
+
back: history.back,
|
78525
|
+
forward: history.forward,
|
78526
|
+
setHistories: history.setHistories,
|
78527
|
+
setHistoryIndex: history.setHistoryIndex,
|
78528
|
+
hasPast: history.historyStore.hasPast,
|
78529
|
+
hasFuture: history.historyStore.hasFuture,
|
78530
|
+
histories: history.historyStore.histories,
|
78531
|
+
index: history.historyStore.index,
|
78532
|
+
historyStore: history.historyStore
|
78533
|
+
},
|
78501
78534
|
selectedItem: selectedItem || null
|
78502
78535
|
};
|
78503
78536
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@measured/puck-plugin-heading-analyzer",
|
3
|
-
"version": "0.16.0-canary.
|
3
|
+
"version": "0.16.0-canary.39e7f40",
|
4
4
|
"author": "Measured Corporation Ltd <hello@measured.co>",
|
5
5
|
"repository": "measuredco/puck",
|
6
6
|
"bugs": "https://github.com/measuredco/puck/issues",
|
@@ -18,7 +18,7 @@
|
|
18
18
|
"dist"
|
19
19
|
],
|
20
20
|
"devDependencies": {
|
21
|
-
"@measured/puck": "^0.16.0-canary.
|
21
|
+
"@measured/puck": "^0.16.0-canary.39e7f40",
|
22
22
|
"@types/react": "^18.2.0",
|
23
23
|
"@types/react-dom": "^18.2.0",
|
24
24
|
"eslint": "^7.32.0",
|