@measured/puck-plugin-heading-analyzer 0.1.0 → 0.1.3
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.d.ts +1 -1
 - package/dist/index.js +8 -36
 - package/package.json +4 -3
 
    
        package/dist/index.d.ts
    CHANGED
    
    
    
        package/dist/index.js
    CHANGED
    
    | 
         @@ -19,9 +19,6 @@ 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 
     | 
    
         
            -
            };
         
     | 
| 
       25 
22 
     | 
    
         
             
            var __commonJS = (cb, mod) => function __require() {
         
     | 
| 
       26 
23 
     | 
    
         
             
              return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
         
     | 
| 
       27 
24 
     | 
    
         
             
            };
         
     | 
| 
         @@ -47,19 +44,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge 
     | 
|
| 
       47 
44 
     | 
    
         
             
            ));
         
     | 
| 
       48 
45 
     | 
    
         
             
            var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
         
     | 
| 
       49 
46 
     | 
    
         | 
| 
       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 
     | 
    
         
            -
             
     | 
| 
       59 
47 
     | 
    
         
             
            // ../../node_modules/classnames/index.js
         
     | 
| 
       60 
48 
     | 
    
         
             
            var require_classnames = __commonJS({
         
     | 
| 
       61 
49 
     | 
    
         
             
              "../../node_modules/classnames/index.js"(exports, module2) {
         
     | 
| 
       62 
     | 
    
         
            -
                init_react_import();
         
     | 
| 
       63 
50 
     | 
    
         
             
                (function() {
         
     | 
| 
       64 
51 
     | 
    
         
             
                  "use strict";
         
     | 
| 
       65 
52 
     | 
    
         
             
                  var hasOwn = {}.hasOwnProperty;
         
     | 
| 
         @@ -114,18 +101,12 @@ __export(plugin_heading_analyzer_exports, { 
     | 
|
| 
       114 
101 
     | 
    
         
             
              default: () => plugin_heading_analyzer_default
         
     | 
| 
       115 
102 
     | 
    
         
             
            });
         
     | 
| 
       116 
103 
     | 
    
         
             
            module.exports = __toCommonJS(plugin_heading_analyzer_exports);
         
     | 
| 
       117 
     | 
    
         
            -
             
     | 
| 
       118 
     | 
    
         
            -
            var import_react2 = require("react");
         
     | 
| 
       119 
     | 
    
         
            -
             
     | 
| 
       120 
     | 
    
         
            -
            // ../core/SidebarSection/index.tsx
         
     | 
| 
       121 
     | 
    
         
            -
            init_react_import();
         
     | 
| 
      
 104 
     | 
    
         
            +
            var import_react = require("react");
         
     | 
| 
       122 
105 
     | 
    
         | 
| 
       123 
106 
     | 
    
         
             
            // css-module:/Users/chrisvilla/Projects/puck/packages/core/SidebarSection/styles.module.css#css-module
         
     | 
| 
       124 
     | 
    
         
            -
            init_react_import();
         
     | 
| 
       125 
107 
     | 
    
         
             
            var styles_module_default = { "SidebarSection": "_SidebarSection_jsf8x_1", "SidebarSection-content": "_SidebarSection-content_jsf8x_1", "SidebarSection-title": "_SidebarSection-title_jsf8x_6" };
         
     | 
| 
       126 
108 
     | 
    
         | 
| 
       127 
109 
     | 
    
         
             
            // ../core/lib/get-class-name-factory.ts
         
     | 
| 
       128 
     | 
    
         
            -
            init_react_import();
         
     | 
| 
       129 
110 
     | 
    
         
             
            var import_classnames = __toESM(require_classnames());
         
     | 
| 
       130 
111 
     | 
    
         
             
            var getClassNameFactory = (rootClass, styles, { baseClass = "" } = {}) => (options = {}) => {
         
     | 
| 
       131 
112 
     | 
    
         
             
              let descendant = false;
         
     | 
| 
         @@ -152,11 +133,7 @@ var getClassNameFactory = (rootClass, styles, { baseClass = "" } = {}) => (optio 
     | 
|
| 
       152 
133 
     | 
    
         
             
            };
         
     | 
| 
       153 
134 
     | 
    
         
             
            var get_class_name_factory_default = getClassNameFactory;
         
     | 
| 
       154 
135 
     | 
    
         | 
| 
       155 
     | 
    
         
            -
            // ../core/Heading/index.tsx
         
     | 
| 
       156 
     | 
    
         
            -
            init_react_import();
         
     | 
| 
       157 
     | 
    
         
            -
             
     | 
| 
       158 
136 
     | 
    
         
             
            // css-module:/Users/chrisvilla/Projects/puck/packages/core/Heading/styles.module.css#css-module
         
     | 
| 
       159 
     | 
    
         
            -
            init_react_import();
         
     | 
| 
       160 
137 
     | 
    
         
             
            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" };
         
     | 
| 
       161 
138 
     | 
    
         | 
| 
       162 
139 
     | 
    
         
             
            // ../core/Heading/index.tsx
         
     | 
| 
         @@ -181,27 +158,23 @@ var SidebarSection = ({ 
     | 
|
| 
       181 
158 
     | 
    
         
             
              children,
         
     | 
| 
       182 
159 
     | 
    
         
             
              title
         
     | 
| 
       183 
160 
     | 
    
         
             
            }) => {
         
     | 
| 
       184 
     | 
    
         
            -
              return /* @__PURE__ */  
     | 
| 
      
 161 
     | 
    
         
            +
              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));
         
     | 
| 
       185 
162 
     | 
    
         
             
            };
         
     | 
| 
       186 
163 
     | 
    
         | 
| 
       187 
     | 
    
         
            -
            // ../core/OutlineList/index.tsx
         
     | 
| 
       188 
     | 
    
         
            -
            init_react_import();
         
     | 
| 
       189 
     | 
    
         
            -
             
     | 
| 
       190 
164 
     | 
    
         
             
            // css-module:/Users/chrisvilla/Projects/puck/packages/core/OutlineList/styles.module.css#css-module
         
     | 
| 
       191 
     | 
    
         
            -
            init_react_import();
         
     | 
| 
       192 
165 
     | 
    
         
             
            var styles_module_default3 = { "OutlineList": "_OutlineList_gor6f_1", "OutlineList-clickableItem": "_OutlineList-clickableItem_gor6f_36" };
         
     | 
| 
       193 
166 
     | 
    
         | 
| 
       194 
167 
     | 
    
         
             
            // ../core/OutlineList/index.tsx
         
     | 
| 
       195 
168 
     | 
    
         
             
            var getClassName3 = get_class_name_factory_default("OutlineList", styles_module_default3);
         
     | 
| 
       196 
169 
     | 
    
         
             
            var OutlineList = ({ children }) => {
         
     | 
| 
       197 
     | 
    
         
            -
              return /* @__PURE__ */  
     | 
| 
      
 170 
     | 
    
         
            +
              return /* @__PURE__ */ React.createElement("ul", { className: getClassName3() }, children);
         
     | 
| 
       198 
171 
     | 
    
         
             
            };
         
     | 
| 
       199 
     | 
    
         
            -
            OutlineList.Clickable = ({ children }) => /* @__PURE__ */  
     | 
| 
      
 172 
     | 
    
         
            +
            OutlineList.Clickable = ({ children }) => /* @__PURE__ */ React.createElement("div", { className: getClassName3("clickableItem") }, children);
         
     | 
| 
       200 
173 
     | 
    
         
             
            OutlineList.Item = ({
         
     | 
| 
       201 
174 
     | 
    
         
             
              children,
         
     | 
| 
       202 
175 
     | 
    
         
             
              onClick
         
     | 
| 
       203 
176 
     | 
    
         
             
            }) => {
         
     | 
| 
       204 
     | 
    
         
            -
              return /* @__PURE__ */  
     | 
| 
      
 177 
     | 
    
         
            +
              return /* @__PURE__ */ React.createElement(
         
     | 
| 
       205 
178 
     | 
    
         
             
                "li",
         
     | 
| 
       206 
179 
     | 
    
         
             
                {
         
     | 
| 
       207 
180 
     | 
    
         
             
                  className: onClick ? getClassName3("clickableItem") : "",
         
     | 
| 
         @@ -212,7 +185,6 @@ OutlineList.Item = ({ 
     | 
|
| 
       212 
185 
     | 
    
         
             
            };
         
     | 
| 
       213 
186 
     | 
    
         | 
| 
       214 
187 
     | 
    
         
             
            // ../core/lib/scroll-into-view.ts
         
     | 
| 
       215 
     | 
    
         
            -
            init_react_import();
         
     | 
| 
       216 
188 
     | 
    
         
             
            var scrollIntoView = (el) => {
         
     | 
| 
       217 
189 
     | 
    
         
             
              const oldStyle = __spreadValues({}, el.style);
         
     | 
| 
       218 
190 
     | 
    
         
             
              el.style.scrollMargin = "256px";
         
     | 
| 
         @@ -281,9 +253,9 @@ var HeadingOutlineAnalyser = ({ 
     | 
|
| 
       281 
253 
     | 
    
         
             
              children,
         
     | 
| 
       282 
254 
     | 
    
         
             
              data
         
     | 
| 
       283 
255 
     | 
    
         
             
            }) => {
         
     | 
| 
       284 
     | 
    
         
            -
              const [hierarchy, setHierarchy] = (0,  
     | 
| 
       285 
     | 
    
         
            -
              const [firstRender, setFirstRender] = (0,  
     | 
| 
       286 
     | 
    
         
            -
              (0,  
     | 
| 
      
 256 
     | 
    
         
            +
              const [hierarchy, setHierarchy] = (0, import_react.useState)([]);
         
     | 
| 
      
 257 
     | 
    
         
            +
              const [firstRender, setFirstRender] = (0, import_react.useState)(true);
         
     | 
| 
      
 258 
     | 
    
         
            +
              (0, import_react.useEffect)(() => {
         
     | 
| 
       287 
259 
     | 
    
         
             
                if (firstRender) {
         
     | 
| 
       288 
260 
     | 
    
         
             
                  setTimeout(() => {
         
     | 
| 
       289 
261 
     | 
    
         
             
                    setHierarchy(buildHierarchy());
         
     | 
    
        package/package.json
    CHANGED
    
    | 
         @@ -1,21 +1,22 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            {
         
     | 
| 
       2 
2 
     | 
    
         
             
              "name": "@measured/puck-plugin-heading-analyzer",
         
     | 
| 
       3 
     | 
    
         
            -
              "version": "0.1. 
     | 
| 
      
 3 
     | 
    
         
            +
              "version": "0.1.3",
         
     | 
| 
       4 
4 
     | 
    
         
             
              "private": false,
         
     | 
| 
       5 
5 
     | 
    
         
             
              "main": "./dist/index.js",
         
     | 
| 
       6 
6 
     | 
    
         
             
              "types": "./dist/index.d.ts",
         
     | 
| 
       7 
7 
     | 
    
         
             
              "license": "MIT",
         
     | 
| 
       8 
8 
     | 
    
         
             
              "scripts": {
         
     | 
| 
       9 
9 
     | 
    
         
             
                "lint": "eslint \"**/*.ts*\"",
         
     | 
| 
       10 
     | 
    
         
            -
                "build": "rm -rf dist && tsup index.tsx"
         
     | 
| 
      
 10 
     | 
    
         
            +
                "build": "rm -rf dist && tsup index.tsx",
         
     | 
| 
      
 11 
     | 
    
         
            +
                "prepublish": "yarn build"
         
     | 
| 
       11 
12 
     | 
    
         
             
              },
         
     | 
| 
       12 
13 
     | 
    
         
             
              "files": [
         
     | 
| 
       13 
14 
     | 
    
         
             
                "dist"
         
     | 
| 
       14 
15 
     | 
    
         
             
              ],
         
     | 
| 
       15 
16 
     | 
    
         
             
              "devDependencies": {
         
     | 
| 
      
 17 
     | 
    
         
            +
                "@measured/puck": "^0.1.3",
         
     | 
| 
       16 
18 
     | 
    
         
             
                "@types/react": "^18.2.0",
         
     | 
| 
       17 
19 
     | 
    
         
             
                "@types/react-dom": "^18.2.0",
         
     | 
| 
       18 
     | 
    
         
            -
                "@puck/core": "*",
         
     | 
| 
       19 
20 
     | 
    
         
             
                "eslint": "^7.32.0",
         
     | 
| 
       20 
21 
     | 
    
         
             
                "eslint-config-custom": "*",
         
     | 
| 
       21 
22 
     | 
    
         
             
                "tsconfig": "*",
         
     |