@measured/puck-plugin-heading-analyzer 0.16.0-canary.a1d52cb → 0.16.0-canary.a3518ca

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.d.mts CHANGED
@@ -1,48 +1,10 @@
1
- import { ReactNode, ReactElement } from 'react';
1
+ import { ReactElement, ReactNode } from 'react';
2
2
 
3
3
  type ItemSelector = {
4
4
  index: number;
5
5
  zone?: string;
6
6
  };
7
7
 
8
- type iconTypes = "Smartphone" | "Monitor" | "Tablet";
9
- type Viewport = {
10
- width: number;
11
- height?: number | "auto";
12
- label?: string;
13
- icon?: iconTypes | ReactNode;
14
- };
15
-
16
- type ItemWithId = {
17
- _arrayId: string;
18
- _originalIndex: number;
19
- };
20
- type ArrayState = {
21
- items: ItemWithId[];
22
- openId: string;
23
- };
24
- type UiState = {
25
- leftSideBarVisible: boolean;
26
- rightSideBarVisible: boolean;
27
- itemSelector: ItemSelector | null;
28
- arrayState: Record<string, ArrayState | undefined>;
29
- componentList: Record<string, {
30
- components?: string[];
31
- title?: string;
32
- visible?: boolean;
33
- expanded?: boolean;
34
- }>;
35
- isDragging: boolean;
36
- viewports: {
37
- current: {
38
- width: number;
39
- height: number | "auto";
40
- };
41
- controlsVisible: boolean;
42
- options: Viewport[];
43
- };
44
- };
45
-
46
8
  type FieldOption = {
47
9
  label: string;
48
10
  value: string | number | boolean;
@@ -157,6 +119,36 @@ type FieldProps<ValueType = any, F = Field<any>> = {
157
119
  readOnly?: boolean;
158
120
  };
159
121
 
122
+ type ItemWithId = {
123
+ _arrayId: string;
124
+ _originalIndex: number;
125
+ };
126
+ type ArrayState = {
127
+ items: ItemWithId[];
128
+ openId: string;
129
+ };
130
+ type UiState = {
131
+ leftSideBarVisible: boolean;
132
+ rightSideBarVisible: boolean;
133
+ itemSelector: ItemSelector | null;
134
+ arrayState: Record<string, ArrayState | undefined>;
135
+ componentList: Record<string, {
136
+ components?: string[];
137
+ title?: string;
138
+ visible?: boolean;
139
+ expanded?: boolean;
140
+ }>;
141
+ isDragging: boolean;
142
+ viewports: {
143
+ current: {
144
+ width: number;
145
+ height: number | "auto";
146
+ };
147
+ controlsVisible: boolean;
148
+ options: Viewport[];
149
+ };
150
+ };
151
+
160
152
  type RenderFunc<Props extends {
161
153
  [key: string]: any;
162
154
  } = {
@@ -220,6 +212,14 @@ type FieldRenderFunctions = Omit<{
220
212
  }>;
221
213
  };
222
214
 
215
+ type iconTypes = "Smartphone" | "Monitor" | "Tablet";
216
+ type Viewport = {
217
+ width: number;
218
+ height?: number | "auto";
219
+ label?: string;
220
+ icon?: iconTypes | ReactNode;
221
+ };
222
+
223
223
  type Plugin = {
224
224
  overrides: Partial<Overrides>;
225
225
  };
package/dist/index.d.ts CHANGED
@@ -1,48 +1,10 @@
1
- import { ReactNode, ReactElement } from 'react';
1
+ import { ReactElement, ReactNode } from 'react';
2
2
 
3
3
  type ItemSelector = {
4
4
  index: number;
5
5
  zone?: string;
6
6
  };
7
7
 
8
- type iconTypes = "Smartphone" | "Monitor" | "Tablet";
9
- type Viewport = {
10
- width: number;
11
- height?: number | "auto";
12
- label?: string;
13
- icon?: iconTypes | ReactNode;
14
- };
15
-
16
- type ItemWithId = {
17
- _arrayId: string;
18
- _originalIndex: number;
19
- };
20
- type ArrayState = {
21
- items: ItemWithId[];
22
- openId: string;
23
- };
24
- type UiState = {
25
- leftSideBarVisible: boolean;
26
- rightSideBarVisible: boolean;
27
- itemSelector: ItemSelector | null;
28
- arrayState: Record<string, ArrayState | undefined>;
29
- componentList: Record<string, {
30
- components?: string[];
31
- title?: string;
32
- visible?: boolean;
33
- expanded?: boolean;
34
- }>;
35
- isDragging: boolean;
36
- viewports: {
37
- current: {
38
- width: number;
39
- height: number | "auto";
40
- };
41
- controlsVisible: boolean;
42
- options: Viewport[];
43
- };
44
- };
45
-
46
8
  type FieldOption = {
47
9
  label: string;
48
10
  value: string | number | boolean;
@@ -157,6 +119,36 @@ type FieldProps<ValueType = any, F = Field<any>> = {
157
119
  readOnly?: boolean;
158
120
  };
159
121
 
122
+ type ItemWithId = {
123
+ _arrayId: string;
124
+ _originalIndex: number;
125
+ };
126
+ type ArrayState = {
127
+ items: ItemWithId[];
128
+ openId: string;
129
+ };
130
+ type UiState = {
131
+ leftSideBarVisible: boolean;
132
+ rightSideBarVisible: boolean;
133
+ itemSelector: ItemSelector | null;
134
+ arrayState: Record<string, ArrayState | undefined>;
135
+ componentList: Record<string, {
136
+ components?: string[];
137
+ title?: string;
138
+ visible?: boolean;
139
+ expanded?: boolean;
140
+ }>;
141
+ isDragging: boolean;
142
+ viewports: {
143
+ current: {
144
+ width: number;
145
+ height: number | "auto";
146
+ };
147
+ controlsVisible: boolean;
148
+ options: Viewport[];
149
+ };
150
+ };
151
+
160
152
  type RenderFunc<Props extends {
161
153
  [key: string]: any;
162
154
  } = {
@@ -220,6 +212,14 @@ type FieldRenderFunctions = Omit<{
220
212
  }>;
221
213
  };
222
214
 
215
+ type iconTypes = "Smartphone" | "Monitor" | "Tablet";
216
+ type Viewport = {
217
+ width: number;
218
+ height?: number | "auto";
219
+ label?: string;
220
+ icon?: iconTypes | ReactNode;
221
+ };
222
+
223
223
  type Plugin = {
224
224
  overrides: Partial<Overrides>;
225
225
  };
package/dist/index.js CHANGED
@@ -1438,31 +1438,26 @@ var styles_module_default = { "SidebarSection": "_SidebarSection_125qe_1", "Side
1438
1438
  // ../core/lib/get-class-name-factory.ts
1439
1439
  init_react_import();
1440
1440
  var import_classnames = __toESM(require_classnames());
1441
- var getClassNameFactory = (rootClass, styles, { baseClass = "" } = {}) => (options = {}) => {
1442
- let descendant = false;
1443
- let modifiers = false;
1441
+ var getClassNameFactory = (rootClass, styles, config = { baseClass: "" }) => (options = {}) => {
1444
1442
  if (typeof options === "string") {
1445
- descendant = options;
1446
- } else if (typeof options === "object") {
1447
- modifiers = options;
1448
- }
1449
- if (descendant) {
1443
+ const descendant = options;
1450
1444
  const style = styles[`${rootClass}-${descendant}`];
1451
1445
  if (style) {
1452
- return baseClass + styles[`${rootClass}-${descendant}`] || "";
1446
+ return config.baseClass + styles[`${rootClass}-${descendant}`] || "";
1453
1447
  }
1454
1448
  return "";
1455
- } else if (modifiers) {
1449
+ } else if (typeof options === "object") {
1450
+ const modifiers = options;
1456
1451
  const prefixedModifiers = {};
1457
1452
  for (let modifier in modifiers) {
1458
1453
  prefixedModifiers[styles[`${rootClass}--${modifier}`]] = modifiers[modifier];
1459
1454
  }
1460
1455
  const c = styles[rootClass];
1461
- return baseClass + (0, import_classnames.default)(__spreadValues({
1456
+ return config.baseClass + (0, import_classnames.default)(__spreadValues({
1462
1457
  [c]: !!c
1463
1458
  }, prefixedModifiers));
1464
1459
  } else {
1465
- return baseClass + styles[rootClass] || "";
1460
+ return config.baseClass + styles[rootClass] || "";
1466
1461
  }
1467
1462
  };
1468
1463
  var get_class_name_factory_default = getClassNameFactory;
@@ -1566,21 +1561,22 @@ var setupZone = (data, zoneKey) => {
1566
1561
  if (zoneKey === rootDroppableId) {
1567
1562
  return data;
1568
1563
  }
1569
- const newData = __spreadValues({}, data);
1570
- newData.zones = data.zones || {};
1564
+ const newData = __spreadProps(__spreadValues({}, data), {
1565
+ zones: data.zones || {}
1566
+ });
1571
1567
  newData.zones[zoneKey] = newData.zones[zoneKey] || [];
1572
1568
  return newData;
1573
1569
  };
1574
1570
 
1575
1571
  // ../core/lib/get-item.ts
1576
- var getItem = (selector, data, dynamicProps = {}) => {
1572
+ function getItem(selector, data, dynamicProps = {}) {
1577
1573
  if (!selector.zone || selector.zone === rootDroppableId) {
1578
1574
  const item2 = data.content[selector.index];
1579
1575
  return (item2 == null ? void 0 : item2.props) ? __spreadProps(__spreadValues({}, item2), { props: dynamicProps[item2.props.id] || item2.props }) : void 0;
1580
1576
  }
1581
1577
  const item = setupZone(data, selector.zone).zones[selector.zone][selector.index];
1582
1578
  return (item == null ? void 0 : item.props) ? __spreadProps(__spreadValues({}, item), { props: dynamicProps[item.props.id] || item.props }) : void 0;
1583
- };
1579
+ }
1584
1580
 
1585
1581
  // ../core/lib/get-zone-id.ts
1586
1582
  init_react_import();
@@ -1614,7 +1610,7 @@ var defaultViewports = [
1614
1610
  var import_ua_parser_js = __toESM(require_ua_parser());
1615
1611
  var import_jsx_runtime3 = require("react/jsx-runtime");
1616
1612
  var defaultAppState = {
1617
- data: { content: [], root: { props: {} } },
1613
+ data: { content: [], root: {} },
1618
1614
  ui: {
1619
1615
  leftSideBarVisible: true,
1620
1616
  rightSideBarVisible: true,
@@ -1805,6 +1801,7 @@ var SidebarSection = ({
1805
1801
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1806
1802
  "button",
1807
1803
  {
1804
+ type: "button",
1808
1805
  className: getClassName3("breadcrumbLabel"),
1809
1806
  onClick: () => setUi({ itemSelector: breadcrumb.selector }),
1810
1807
  children: breadcrumb.label
@@ -1812,7 +1809,7 @@ var SidebarSection = ({
1812
1809
  ),
1813
1810
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ChevronRight, { size: 16 })
1814
1811
  ] }, i)) : null,
1815
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: getClassName3("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Heading, { rank: 2, size: "xs", children: title }) })
1812
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: getClassName3("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Heading, { rank: "2", size: "xs", children: title }) })
1816
1813
  ] }) }),
1817
1814
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: getClassName3("content"), children }),
1818
1815
  isLoading && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: getClassName3("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Loader, { size: 32 }) })
package/dist/index.mjs CHANGED
@@ -1426,31 +1426,26 @@ var styles_module_default = { "SidebarSection": "_SidebarSection_125qe_1", "Side
1426
1426
  // ../core/lib/get-class-name-factory.ts
1427
1427
  init_react_import();
1428
1428
  var import_classnames = __toESM(require_classnames());
1429
- var getClassNameFactory = (rootClass, styles, { baseClass = "" } = {}) => (options = {}) => {
1430
- let descendant = false;
1431
- let modifiers = false;
1429
+ var getClassNameFactory = (rootClass, styles, config = { baseClass: "" }) => (options = {}) => {
1432
1430
  if (typeof options === "string") {
1433
- descendant = options;
1434
- } else if (typeof options === "object") {
1435
- modifiers = options;
1436
- }
1437
- if (descendant) {
1431
+ const descendant = options;
1438
1432
  const style = styles[`${rootClass}-${descendant}`];
1439
1433
  if (style) {
1440
- return baseClass + styles[`${rootClass}-${descendant}`] || "";
1434
+ return config.baseClass + styles[`${rootClass}-${descendant}`] || "";
1441
1435
  }
1442
1436
  return "";
1443
- } else if (modifiers) {
1437
+ } else if (typeof options === "object") {
1438
+ const modifiers = options;
1444
1439
  const prefixedModifiers = {};
1445
1440
  for (let modifier in modifiers) {
1446
1441
  prefixedModifiers[styles[`${rootClass}--${modifier}`]] = modifiers[modifier];
1447
1442
  }
1448
1443
  const c = styles[rootClass];
1449
- return baseClass + (0, import_classnames.default)(__spreadValues({
1444
+ return config.baseClass + (0, import_classnames.default)(__spreadValues({
1450
1445
  [c]: !!c
1451
1446
  }, prefixedModifiers));
1452
1447
  } else {
1453
- return baseClass + styles[rootClass] || "";
1448
+ return config.baseClass + styles[rootClass] || "";
1454
1449
  }
1455
1450
  };
1456
1451
  var get_class_name_factory_default = getClassNameFactory;
@@ -1558,21 +1553,22 @@ var setupZone = (data, zoneKey) => {
1558
1553
  if (zoneKey === rootDroppableId) {
1559
1554
  return data;
1560
1555
  }
1561
- const newData = __spreadValues({}, data);
1562
- newData.zones = data.zones || {};
1556
+ const newData = __spreadProps(__spreadValues({}, data), {
1557
+ zones: data.zones || {}
1558
+ });
1563
1559
  newData.zones[zoneKey] = newData.zones[zoneKey] || [];
1564
1560
  return newData;
1565
1561
  };
1566
1562
 
1567
1563
  // ../core/lib/get-item.ts
1568
- var getItem = (selector, data, dynamicProps = {}) => {
1564
+ function getItem(selector, data, dynamicProps = {}) {
1569
1565
  if (!selector.zone || selector.zone === rootDroppableId) {
1570
1566
  const item2 = data.content[selector.index];
1571
1567
  return (item2 == null ? void 0 : item2.props) ? __spreadProps(__spreadValues({}, item2), { props: dynamicProps[item2.props.id] || item2.props }) : void 0;
1572
1568
  }
1573
1569
  const item = setupZone(data, selector.zone).zones[selector.zone][selector.index];
1574
1570
  return (item == null ? void 0 : item.props) ? __spreadProps(__spreadValues({}, item), { props: dynamicProps[item.props.id] || item.props }) : void 0;
1575
- };
1571
+ }
1576
1572
 
1577
1573
  // ../core/lib/get-zone-id.ts
1578
1574
  init_react_import();
@@ -1611,7 +1607,7 @@ var defaultViewports = [
1611
1607
  var import_ua_parser_js = __toESM(require_ua_parser());
1612
1608
  import { jsx as jsx3 } from "react/jsx-runtime";
1613
1609
  var defaultAppState = {
1614
- data: { content: [], root: { props: {} } },
1610
+ data: { content: [], root: {} },
1615
1611
  ui: {
1616
1612
  leftSideBarVisible: true,
1617
1613
  rightSideBarVisible: true,
@@ -1802,6 +1798,7 @@ var SidebarSection = ({
1802
1798
  /* @__PURE__ */ jsx5(
1803
1799
  "button",
1804
1800
  {
1801
+ type: "button",
1805
1802
  className: getClassName3("breadcrumbLabel"),
1806
1803
  onClick: () => setUi({ itemSelector: breadcrumb.selector }),
1807
1804
  children: breadcrumb.label
@@ -1809,7 +1806,7 @@ var SidebarSection = ({
1809
1806
  ),
1810
1807
  /* @__PURE__ */ jsx5(ChevronRight, { size: 16 })
1811
1808
  ] }, i)) : null,
1812
- /* @__PURE__ */ jsx5("div", { className: getClassName3("heading"), children: /* @__PURE__ */ jsx5(Heading, { rank: 2, size: "xs", children: title }) })
1809
+ /* @__PURE__ */ jsx5("div", { className: getClassName3("heading"), children: /* @__PURE__ */ jsx5(Heading, { rank: "2", size: "xs", children: title }) })
1813
1810
  ] }) }),
1814
1811
  /* @__PURE__ */ jsx5("div", { className: getClassName3("content"), children }),
1815
1812
  isLoading && /* @__PURE__ */ jsx5("div", { className: getClassName3("loadingOverlay"), children: /* @__PURE__ */ jsx5(Loader, { size: 32 }) })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@measured/puck-plugin-heading-analyzer",
3
- "version": "0.16.0-canary.a1d52cb",
3
+ "version": "0.16.0-canary.a3518ca",
4
4
  "author": "Measured Corporation Ltd <hello@measured.co>",
5
5
  "repository": "measuredco/puck",
6
6
  "bugs": "https://github.com/measuredco/puck/issues",
@@ -9,8 +9,11 @@
9
9
  "main": "./dist/index.js",
10
10
  "types": "./dist/index.d.ts",
11
11
  "exports": {
12
- "import": "./dist/index.mjs",
13
- "types": "./dist/index.d.ts"
12
+ ".": {
13
+ "import": "./dist/index.mjs",
14
+ "types": "./dist/index.d.ts"
15
+ },
16
+ "./dist/index.css": "./dist/index.css"
14
17
  },
15
18
  "license": "MIT",
16
19
  "scripts": {
@@ -22,7 +25,7 @@
22
25
  "dist"
23
26
  ],
24
27
  "devDependencies": {
25
- "@measured/puck": "^0.16.0-canary.a1d52cb",
28
+ "@measured/puck": "^0.16.0-canary.a3518ca",
26
29
  "@types/react": "^18.2.0",
27
30
  "@types/react-dom": "^18.2.0",
28
31
  "eslint": "^7.32.0",