@measured/puck-plugin-heading-analyzer 0.1.5 → 0.1.6
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 +39 -10
- package/package.json +2 -2
package/dist/index.js
CHANGED
@@ -19,6 +19,9 @@ var __spreadValues = (a, b) => {
|
|
19
19
|
}
|
20
20
|
return a;
|
21
21
|
};
|
22
|
+
var __esm = (fn, res) => function __init() {
|
23
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
24
|
+
};
|
22
25
|
var __commonJS = (cb, mod) => function __require() {
|
23
26
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
24
27
|
};
|
@@ -44,9 +47,19 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
44
47
|
));
|
45
48
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
46
49
|
|
50
|
+
// ../tsup-config/react-import.js
|
51
|
+
var import_react;
|
52
|
+
var init_react_import = __esm({
|
53
|
+
"../tsup-config/react-import.js"() {
|
54
|
+
"use strict";
|
55
|
+
import_react = __toESM(require("react"));
|
56
|
+
}
|
57
|
+
});
|
58
|
+
|
47
59
|
// ../../node_modules/classnames/index.js
|
48
60
|
var require_classnames = __commonJS({
|
49
61
|
"../../node_modules/classnames/index.js"(exports, module2) {
|
62
|
+
init_react_import();
|
50
63
|
(function() {
|
51
64
|
"use strict";
|
52
65
|
var hasOwn = {}.hasOwnProperty;
|
@@ -101,14 +114,21 @@ __export(plugin_heading_analyzer_exports, {
|
|
101
114
|
default: () => HeadingAnalyzer_default
|
102
115
|
});
|
103
116
|
module.exports = __toCommonJS(plugin_heading_analyzer_exports);
|
117
|
+
init_react_import();
|
104
118
|
|
105
119
|
// src/HeadingAnalyzer.tsx
|
106
|
-
|
120
|
+
init_react_import();
|
121
|
+
var import_react2 = require("react");
|
122
|
+
|
123
|
+
// ../core/components/SidebarSection/index.tsx
|
124
|
+
init_react_import();
|
107
125
|
|
108
126
|
// css-module:/home/runner/work/puck/puck/packages/core/components/SidebarSection/styles.module.css#css-module
|
127
|
+
init_react_import();
|
109
128
|
var styles_module_default = { "SidebarSection": "_SidebarSection_jsf8x_1", "SidebarSection-content": "_SidebarSection-content_jsf8x_1", "SidebarSection-title": "_SidebarSection-title_jsf8x_6" };
|
110
129
|
|
111
130
|
// ../core/lib/get-class-name-factory.ts
|
131
|
+
init_react_import();
|
112
132
|
var import_classnames = __toESM(require_classnames());
|
113
133
|
var getClassNameFactory = (rootClass, styles, { baseClass = "" } = {}) => (options = {}) => {
|
114
134
|
let descendant = false;
|
@@ -135,7 +155,11 @@ var getClassNameFactory = (rootClass, styles, { baseClass = "" } = {}) => (optio
|
|
135
155
|
};
|
136
156
|
var get_class_name_factory_default = getClassNameFactory;
|
137
157
|
|
158
|
+
// ../core/components/Heading/index.tsx
|
159
|
+
init_react_import();
|
160
|
+
|
138
161
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Heading/styles.module.css#css-module
|
162
|
+
init_react_import();
|
139
163
|
var styles_module_default2 = { "Heading": "_Heading_1y35v_1", "Heading--xxxxl": "_Heading--xxxxl_1y35v_12", "Heading--xxxl": "_Heading--xxxl_1y35v_18", "Heading--xxl": "_Heading--xxl_1y35v_22", "Heading--xl": "_Heading--xl_1y35v_26", "Heading--l": "_Heading--l_1y35v_30", "Heading--m": "_Heading--m_1y35v_34", "Heading--s": "_Heading--s_1y35v_38", "Heading--xs": "_Heading--xs_1y35v_42" };
|
140
164
|
|
141
165
|
// ../core/components/Heading/index.tsx
|
@@ -160,23 +184,27 @@ var SidebarSection = ({
|
|
160
184
|
children,
|
161
185
|
title
|
162
186
|
}) => {
|
163
|
-
return /* @__PURE__ */
|
187
|
+
return /* @__PURE__ */ import_react.default.createElement("details", { className: getClassName2({}), open: true }, /* @__PURE__ */ import_react.default.createElement("summary", { className: getClassName2("title") }, /* @__PURE__ */ import_react.default.createElement(Heading, { rank: 2, size: "xs" }, title)), /* @__PURE__ */ import_react.default.createElement("div", { className: getClassName2("content") }, children));
|
164
188
|
};
|
165
189
|
|
190
|
+
// ../core/components/OutlineList/index.tsx
|
191
|
+
init_react_import();
|
192
|
+
|
166
193
|
// css-module:/home/runner/work/puck/puck/packages/core/components/OutlineList/styles.module.css#css-module
|
194
|
+
init_react_import();
|
167
195
|
var styles_module_default3 = { "OutlineList": "_OutlineList_gor6f_1", "OutlineList-clickableItem": "_OutlineList-clickableItem_gor6f_36" };
|
168
196
|
|
169
197
|
// ../core/components/OutlineList/index.tsx
|
170
198
|
var getClassName3 = get_class_name_factory_default("OutlineList", styles_module_default3);
|
171
199
|
var OutlineList = ({ children }) => {
|
172
|
-
return /* @__PURE__ */
|
200
|
+
return /* @__PURE__ */ import_react.default.createElement("ul", { className: getClassName3() }, children);
|
173
201
|
};
|
174
|
-
OutlineList.Clickable = ({ children }) => /* @__PURE__ */
|
202
|
+
OutlineList.Clickable = ({ children }) => /* @__PURE__ */ import_react.default.createElement("div", { className: getClassName3("clickableItem") }, children);
|
175
203
|
OutlineList.Item = ({
|
176
204
|
children,
|
177
205
|
onClick
|
178
206
|
}) => {
|
179
|
-
return /* @__PURE__ */
|
207
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
180
208
|
"li",
|
181
209
|
{
|
182
210
|
className: onClick ? getClassName3("clickableItem") : "",
|
@@ -187,6 +215,7 @@ OutlineList.Item = ({
|
|
187
215
|
};
|
188
216
|
|
189
217
|
// ../core/lib/scroll-into-view.ts
|
218
|
+
init_react_import();
|
190
219
|
var scrollIntoView = (el) => {
|
191
220
|
const oldStyle = __spreadValues({}, el.style);
|
192
221
|
el.style.scrollMargin = "256px";
|
@@ -251,13 +280,13 @@ function buildHierarchy() {
|
|
251
280
|
}
|
252
281
|
return root.children;
|
253
282
|
}
|
254
|
-
var
|
283
|
+
var HeadingOutlineAnalyzer = ({
|
255
284
|
children,
|
256
285
|
data
|
257
286
|
}) => {
|
258
|
-
const [hierarchy, setHierarchy] = (0,
|
259
|
-
const [firstRender, setFirstRender] = (0,
|
260
|
-
(0,
|
287
|
+
const [hierarchy, setHierarchy] = (0, import_react2.useState)([]);
|
288
|
+
const [firstRender, setFirstRender] = (0, import_react2.useState)(true);
|
289
|
+
(0, import_react2.useEffect)(() => {
|
261
290
|
if (firstRender) {
|
262
291
|
setTimeout(() => {
|
263
292
|
setHierarchy(buildHierarchy());
|
@@ -334,7 +363,7 @@ var HeadingOutlineAnalyser = ({
|
|
334
363
|
] });
|
335
364
|
};
|
336
365
|
var HeadingAnalyzer = {
|
337
|
-
renderPageFields:
|
366
|
+
renderPageFields: HeadingOutlineAnalyzer
|
338
367
|
};
|
339
368
|
var HeadingAnalyzer_default = HeadingAnalyzer;
|
340
369
|
/*! Bundled license information:
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@measured/puck-plugin-heading-analyzer",
|
3
|
-
"version": "0.1.
|
3
|
+
"version": "0.1.6",
|
4
4
|
"private": false,
|
5
5
|
"main": "./dist/index.js",
|
6
6
|
"types": "./dist/index.d.ts",
|
@@ -14,7 +14,7 @@
|
|
14
14
|
"dist"
|
15
15
|
],
|
16
16
|
"devDependencies": {
|
17
|
-
"@measured/puck": "^0.1.
|
17
|
+
"@measured/puck": "^0.1.6",
|
18
18
|
"@types/react": "^18.2.0",
|
19
19
|
"@types/react-dom": "^18.2.0",
|
20
20
|
"eslint": "^7.32.0",
|