@measured/puck-plugin-heading-analyzer 0.1.5 → 0.2.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.css CHANGED
@@ -1,25 +1,32 @@
1
1
  /* css-module:/home/runner/work/puck/puck/packages/core/components/SidebarSection/styles.module.css/#css-module-data */
2
- ._SidebarSection_jsf8x_1:last-of-type ._SidebarSection-content_jsf8x_1 {
3
- border-bottom: none;
4
- height: 100%;
2
+ ._SidebarSection_yd8db_1 {
3
+ display: flex;
4
+ flex-direction: column;
5
+ }
6
+ ._SidebarSection_yd8db_1:last-of-type {
7
+ flex-grow: 1;
5
8
  }
6
- ._SidebarSection-title_jsf8x_6 {
9
+ ._SidebarSection-title_yd8db_10 {
7
10
  background: white;
8
11
  padding: 16px;
9
12
  border-bottom: 1px solid var(--puck-color-grey-8);
10
13
  }
11
- ._SidebarSection-title_jsf8x_6:hover {
14
+ ._SidebarSection-title_yd8db_10:hover {
12
15
  opacity: 0.6;
13
16
  cursor: pointer;
14
17
  }
15
- ._SidebarSection-content_jsf8x_1 {
18
+ ._SidebarSection-content_yd8db_21 {
16
19
  border-bottom: 1px solid var(--puck-color-grey-8);
17
20
  padding: 16px;
18
21
  }
19
- ._SidebarSection_jsf8x_1 > summary {
22
+ ._SidebarSection_yd8db_1:last-of-type ._SidebarSection-content_yd8db_21 {
23
+ border-bottom: none;
24
+ flex-grow: 1;
25
+ }
26
+ ._SidebarSection_yd8db_1 > summary {
20
27
  list-style: none;
21
28
  }
22
- ._SidebarSection_jsf8x_1 > summary::-webkit-details-marker {
29
+ ._SidebarSection_yd8db_1 > summary::-webkit-details-marker {
23
30
  display: none;
24
31
  }
25
32
 
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
- var import_react = require("react");
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
109
- var styles_module_default = { "SidebarSection": "_SidebarSection_jsf8x_1", "SidebarSection-content": "_SidebarSection-content_jsf8x_1", "SidebarSection-title": "_SidebarSection-title_jsf8x_6" };
127
+ init_react_import();
128
+ var styles_module_default = { "SidebarSection": "_SidebarSection_yd8db_1", "SidebarSection-title": "_SidebarSection-title_yd8db_10", "SidebarSection-content": "_SidebarSection-content_yd8db_21" };
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
@@ -158,25 +182,30 @@ var Heading = ({ children, rank, size = "m" }) => {
158
182
  var getClassName2 = get_class_name_factory_default("SidebarSection", styles_module_default);
159
183
  var SidebarSection = ({
160
184
  children,
161
- title
185
+ title,
186
+ background
162
187
  }) => {
163
- return /* @__PURE__ */ React.createElement("details", { className: getClassName2({}), open: true }, /* @__PURE__ */ React.createElement("summary", { className: getClassName2("title") }, /* @__PURE__ */ React.createElement(Heading, { rank: 2, size: "xs" }, title)), /* @__PURE__ */ React.createElement("div", { className: getClassName2("content") }, children));
188
+ return /* @__PURE__ */ import_react.default.createElement("details", { className: getClassName2(), open: true, style: { background } }, /* @__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
189
  };
165
190
 
191
+ // ../core/components/OutlineList/index.tsx
192
+ init_react_import();
193
+
166
194
  // css-module:/home/runner/work/puck/puck/packages/core/components/OutlineList/styles.module.css#css-module
195
+ init_react_import();
167
196
  var styles_module_default3 = { "OutlineList": "_OutlineList_gor6f_1", "OutlineList-clickableItem": "_OutlineList-clickableItem_gor6f_36" };
168
197
 
169
198
  // ../core/components/OutlineList/index.tsx
170
199
  var getClassName3 = get_class_name_factory_default("OutlineList", styles_module_default3);
171
200
  var OutlineList = ({ children }) => {
172
- return /* @__PURE__ */ React.createElement("ul", { className: getClassName3() }, children);
201
+ return /* @__PURE__ */ import_react.default.createElement("ul", { className: getClassName3() }, children);
173
202
  };
174
- OutlineList.Clickable = ({ children }) => /* @__PURE__ */ React.createElement("div", { className: getClassName3("clickableItem") }, children);
203
+ OutlineList.Clickable = ({ children }) => /* @__PURE__ */ import_react.default.createElement("div", { className: getClassName3("clickableItem") }, children);
175
204
  OutlineList.Item = ({
176
205
  children,
177
206
  onClick
178
207
  }) => {
179
- return /* @__PURE__ */ React.createElement(
208
+ return /* @__PURE__ */ import_react.default.createElement(
180
209
  "li",
181
210
  {
182
211
  className: onClick ? getClassName3("clickableItem") : "",
@@ -187,6 +216,7 @@ OutlineList.Item = ({
187
216
  };
188
217
 
189
218
  // ../core/lib/scroll-into-view.ts
219
+ init_react_import();
190
220
  var scrollIntoView = (el) => {
191
221
  const oldStyle = __spreadValues({}, el.style);
192
222
  el.style.scrollMargin = "256px";
@@ -251,13 +281,13 @@ function buildHierarchy() {
251
281
  }
252
282
  return root.children;
253
283
  }
254
- var HeadingOutlineAnalyser = ({
284
+ var HeadingOutlineAnalyer = ({
255
285
  children,
256
286
  data
257
287
  }) => {
258
- const [hierarchy, setHierarchy] = (0, import_react.useState)([]);
259
- const [firstRender, setFirstRender] = (0, import_react.useState)(true);
260
- (0, import_react.useEffect)(() => {
288
+ const [hierarchy, setHierarchy] = (0, import_react2.useState)([]);
289
+ const [firstRender, setFirstRender] = (0, import_react2.useState)(true);
290
+ (0, import_react2.useEffect)(() => {
261
291
  if (firstRender) {
262
292
  setTimeout(() => {
263
293
  setHierarchy(buildHierarchy());
@@ -267,7 +297,7 @@ var HeadingOutlineAnalyser = ({
267
297
  setHierarchy(buildHierarchy());
268
298
  }
269
299
  }, [data.content]);
270
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { children: [
300
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
271
301
  children,
272
302
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(SidebarSection, { title: "Heading Outline", children: [
273
303
  hierarchy.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { children: "No headings." }),
@@ -334,7 +364,7 @@ var HeadingOutlineAnalyser = ({
334
364
  ] });
335
365
  };
336
366
  var HeadingAnalyzer = {
337
- renderPageFields: HeadingOutlineAnalyser
367
+ renderPageFields: HeadingOutlineAnalyer
338
368
  };
339
369
  var HeadingAnalyzer_default = HeadingAnalyzer;
340
370
  /*! 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.5",
3
+ "version": "0.2.0",
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.5",
17
+ "@measured/puck": "^0.2.0",
18
18
  "@types/react": "^18.2.0",
19
19
  "@types/react-dom": "^18.2.0",
20
20
  "eslint": "^7.32.0",