@yurikilian/lex4 1.5.2 → 1.5.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.
@@ -1 +1 @@
1
- {"version":3,"file":"BlockTypePicker.d.ts","sourceRoot":"","sources":["../../src/components/BlockTypePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAE3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAYpE,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,gBAAgB,EAAE,SAAS,EAAE,SAAS,GAAG,MAAM,CAiBnF;AAMD,UAAU,oBAAoB;IAC5B,KAAK,EAAE,SAAS,CAAC;IACjB,QAAQ,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,IAAI,CAAC;CAC1C;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CA6F1D,CAAC"}
1
+ {"version":3,"file":"BlockTypePicker.d.ts","sourceRoot":"","sources":["../../src/components/BlockTypePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAE3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAYpE,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,gBAAgB,EAAE,SAAS,EAAE,SAAS,GAAG,MAAM,CAiBnF;AAMD,UAAU,oBAAoB;IAC5B,KAAK,EAAE,SAAS,CAAC;IACjB,QAAQ,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,IAAI,CAAC;CAC1C;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAkG1D,CAAC"}
@@ -2,9 +2,9 @@ import { default as React } from 'react';
2
2
  import { ResolvedExtensions, ExtensionContext, Lex4Extension } from './types';
3
3
  /**
4
4
  * Provides resolved extension data to all child components.
5
- * Extensions are resolved when the set of extension names changes,
6
- * not on every array reference change preventing unnecessary
7
- * editor re-initialization.
5
+ * Extensions are resolved when the extension instances change.
6
+ * This keeps providers and side panels in sync when an extension
7
+ * keeps the same name but receives fresh configuration.
8
8
  */
9
9
  export declare const ExtensionProvider: React.FC<{
10
10
  extensions?: Lex4Extension[];
@@ -1 +1 @@
1
- {"version":3,"file":"extension-context.d.ts","sourceRoot":"","sources":["../../src/extensions/extension-context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqD,MAAM,OAAO,CAAC;AAC1E,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAyB7C;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC;IACvC,UAAU,CAAC,EAAE,aAAa,EAAE,CAAC;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAwBA,CAAC;AAEF;;GAEG;AACH,wBAAgB,aAAa,IAAI,kBAAkB,CAElD;AAMD,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,CAO1E,CAAC;AAEF;;GAEG;AACH,wBAAgB,iBAAiB;UAGvB,CAAC,iBAAiB,MAAM,KAAG,CAAC,GAAG,SAAS;UACxC,CAAC,iBAAiB,MAAM,SAAS,CAAC;EAI3C;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,gBAAgB,CAAC,aAAa,CAAC,EAC5C,eAAe,EAAE,gBAAgB,CAAC,iBAAiB,CAAC,GACnD,gBAAgB,CAWlB"}
1
+ {"version":3,"file":"extension-context.d.ts","sourceRoot":"","sources":["../../src/extensions/extension-context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqD,MAAM,OAAO,CAAC;AAC1E,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AA2B7C;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC;IACvC,UAAU,CAAC,EAAE,aAAa,EAAE,CAAC;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAuBA,CAAC;AAEF;;GAEG;AACH,wBAAgB,aAAa,IAAI,kBAAkB,CAElD;AAMD,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,CAO1E,CAAC;AAEF;;GAEG;AACH,wBAAgB,iBAAiB;UAGvB,CAAC,iBAAiB,MAAM,KAAG,CAAC,GAAG,SAAS;UACxC,CAAC,iBAAiB,MAAM,SAAS,CAAC;EAI3C;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,gBAAgB,CAAC,aAAa,CAAC,EAC5C,eAAe,EAAE,gBAAgB,CAAC,iBAAiB,CAAC,GACnD,gBAAgB,CAWlB"}
@@ -1460,33 +1460,33 @@ const createLucideIcon = (iconName, iconNode) => {
1460
1460
  * This source code is licensed under the ISC license.
1461
1461
  * See the LICENSE file in the root directory of this source tree.
1462
1462
  */
1463
- const __iconNode$q = [
1463
+ const __iconNode$r = [
1464
1464
  ["path", { d: "m15 16 2.536-7.328a1.02 1.02 1 0 1 1.928 0L22 16", key: "xik6mr" }],
1465
1465
  ["path", { d: "M15.697 14h5.606", key: "1stdlc" }],
1466
1466
  ["path", { d: "m2 16 4.039-9.69a.5.5 0 0 1 .923 0L11 16", key: "d5nyq2" }],
1467
1467
  ["path", { d: "M3.304 13h6.392", key: "1q3zxz" }]
1468
1468
  ];
1469
- const ALargeSmall = createLucideIcon("a-large-small", __iconNode$q);
1469
+ const ALargeSmall = createLucideIcon("a-large-small", __iconNode$r);
1470
1470
  /**
1471
1471
  * @license lucide-react v1.8.0 - ISC
1472
1472
  *
1473
1473
  * This source code is licensed under the ISC license.
1474
1474
  * See the LICENSE file in the root directory of this source tree.
1475
1475
  */
1476
- const __iconNode$p = [
1476
+ const __iconNode$q = [
1477
1477
  [
1478
1478
  "path",
1479
1479
  { d: "M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8", key: "mg9rjx" }
1480
1480
  ]
1481
1481
  ];
1482
- const Bold = createLucideIcon("bold", __iconNode$p);
1482
+ const Bold = createLucideIcon("bold", __iconNode$q);
1483
1483
  /**
1484
1484
  * @license lucide-react v1.8.0 - ISC
1485
1485
  *
1486
1486
  * This source code is licensed under the ISC license.
1487
1487
  * See the LICENSE file in the root directory of this source tree.
1488
1488
  */
1489
- const __iconNode$o = [
1489
+ const __iconNode$p = [
1490
1490
  [
1491
1491
  "path",
1492
1492
  { d: "M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1", key: "ezmyqa" }
@@ -1499,7 +1499,15 @@ const __iconNode$o = [
1499
1499
  }
1500
1500
  ]
1501
1501
  ];
1502
- const Braces = createLucideIcon("braces", __iconNode$o);
1502
+ const Braces = createLucideIcon("braces", __iconNode$p);
1503
+ /**
1504
+ * @license lucide-react v1.8.0 - ISC
1505
+ *
1506
+ * This source code is licensed under the ISC license.
1507
+ * See the LICENSE file in the root directory of this source tree.
1508
+ */
1509
+ const __iconNode$o = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
1510
+ const Check = createLucideIcon("check", __iconNode$o);
1503
1511
  /**
1504
1512
  * @license lucide-react v1.8.0 - ISC
1505
1513
  *
@@ -1999,7 +2007,9 @@ const EMPTY_RESOLVED = {
1999
2007
  handleFactories: []
2000
2008
  };
2001
2009
  const ExtensionResolvedContext = React.createContext(EMPTY_RESOLVED);
2002
- function arraysEqual(a, b) {
2010
+ function extensionArraysEqual(a, b) {
2011
+ if (a === b) return true;
2012
+ if (!a || !b) return !a && !b;
2003
2013
  if (a.length !== b.length) return false;
2004
2014
  for (let i = 0; i < a.length; i++) {
2005
2015
  if (a[i] !== b[i]) return false;
@@ -2007,12 +2017,11 @@ function arraysEqual(a, b) {
2007
2017
  return true;
2008
2018
  }
2009
2019
  const ExtensionProvider = ({ extensions, children }) => {
2010
- const prevNamesRef = React.useRef([]);
2020
+ const prevExtensionsRef = React.useRef(void 0);
2011
2021
  const resolvedRef = React.useRef(EMPTY_RESOLVED);
2012
- const currentNames = (extensions ?? []).map((e) => e.name);
2013
- if (!arraysEqual(currentNames, prevNamesRef.current)) {
2022
+ if (!extensionArraysEqual(extensions, prevExtensionsRef.current)) {
2014
2023
  resolvedRef.current = extensions && extensions.length > 0 ? resolveExtensions(extensions) : EMPTY_RESOLVED;
2015
- prevNamesRef.current = currentNames;
2024
+ prevExtensionsRef.current = extensions;
2016
2025
  }
2017
2026
  const resolved = resolvedRef.current;
2018
2027
  let wrapped = /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
@@ -2611,7 +2620,8 @@ const BlockTypePicker = ({ value, onChange }) => {
2611
2620
  children: option.shortLabel
2612
2621
  }
2613
2622
  ),
2614
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "lex4-block-type-item-label", children: label })
2623
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "lex4-block-type-item-label", children: label }),
2624
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "lex4-block-type-item-check", "aria-hidden": "true", children: active ? /* @__PURE__ */ jsxRuntime.jsx(Check, { size: 14 }) : null })
2615
2625
  ]
2616
2626
  },
2617
2627
  option.value