@ohhwells/bridge 0.1.49-next.114 → 0.1.49-next.115
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.cjs +41 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +41 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -7152,6 +7152,7 @@ function duplicateNavbarItem(sourceAnchor) {
|
|
|
7152
7152
|
|
|
7153
7153
|
// src/lib/footer-items.ts
|
|
7154
7154
|
var FOOTER_ORDER_KEY = "__ohw_footer_order";
|
|
7155
|
+
var MAX_FOOTER_COLUMNS = 18;
|
|
7155
7156
|
var FOOTER_HREF_RE = /^footer-(\d+)-(\d+)-href$/;
|
|
7156
7157
|
function parseFooterHrefKey(key) {
|
|
7157
7158
|
if (!key) return null;
|
|
@@ -7366,6 +7367,9 @@ function getNextFooterColumnIndex() {
|
|
|
7366
7367
|
if (indices.length === 0) return 0;
|
|
7367
7368
|
return Math.max(...indices) + 1;
|
|
7368
7369
|
}
|
|
7370
|
+
function canAddFooterColumn() {
|
|
7371
|
+
return listFooterColumns().length < MAX_FOOTER_COLUMNS;
|
|
7372
|
+
}
|
|
7369
7373
|
function buildFooterHeading(colIndex, text) {
|
|
7370
7374
|
const heading = document.createElement("p");
|
|
7371
7375
|
heading.setAttribute("data-ohw-editable", "text");
|
|
@@ -7432,6 +7436,9 @@ function insertFooterColumnDom(colIndex, heading, items) {
|
|
|
7432
7436
|
return { column, firstLink };
|
|
7433
7437
|
}
|
|
7434
7438
|
function insertFooterColumn(heading = DEFAULT_FOOTER_COLUMN_HEADING, linkLabel = DEFAULT_FOOTER_COLUMN_LINK_LABEL, linkHref = DEFAULT_FOOTER_COLUMN_LINK_HREF) {
|
|
7439
|
+
if (!canAddFooterColumn()) {
|
|
7440
|
+
throw new Error(`Footer column limit reached (${MAX_FOOTER_COLUMNS})`);
|
|
7441
|
+
}
|
|
7435
7442
|
const colIndex = getNextFooterColumnIndex();
|
|
7436
7443
|
const inserted = insertFooterColumnDom(colIndex, heading, [{ href: linkHref, label: linkLabel }]);
|
|
7437
7444
|
if (!inserted?.firstLink) throw new Error("Failed to insert footer column");
|
|
@@ -7777,6 +7784,14 @@ function buildFooterColumnEditContentPatch(result) {
|
|
|
7777
7784
|
function addFooterColumnWithPersist({
|
|
7778
7785
|
postToParent: postToParent2
|
|
7779
7786
|
}) {
|
|
7787
|
+
if (!canAddFooterColumn()) {
|
|
7788
|
+
postToParent2({
|
|
7789
|
+
type: "ow:toast",
|
|
7790
|
+
title: `Maximum ${MAX_FOOTER_COLUMNS} columns`,
|
|
7791
|
+
toastType: "error"
|
|
7792
|
+
});
|
|
7793
|
+
return null;
|
|
7794
|
+
}
|
|
7780
7795
|
const result = insertFooterColumn();
|
|
7781
7796
|
const patch = buildFooterColumnEditContentPatch(result);
|
|
7782
7797
|
setStoredLinkHref(result.hrefKey, result.href);
|
|
@@ -8324,7 +8339,11 @@ function useNavItemDrag({
|
|
|
8324
8339
|
// src/ui/footer-container-chrome.tsx
|
|
8325
8340
|
var import_lucide_react11 = require("lucide-react");
|
|
8326
8341
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
8327
|
-
function FooterContainerChrome({
|
|
8342
|
+
function FooterContainerChrome({
|
|
8343
|
+
rect,
|
|
8344
|
+
onAdd,
|
|
8345
|
+
addDisabled = false
|
|
8346
|
+
}) {
|
|
8328
8347
|
const chromeGap = 6;
|
|
8329
8348
|
const buttonMargin = 7;
|
|
8330
8349
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
@@ -8345,7 +8364,8 @@ function FooterContainerChrome({ rect, onAdd }) {
|
|
|
8345
8364
|
{
|
|
8346
8365
|
type: "button",
|
|
8347
8366
|
"data-ohw-footer-add-button": "",
|
|
8348
|
-
|
|
8367
|
+
disabled: addDisabled,
|
|
8368
|
+
className: "pointer-events-auto absolute left-1/2 flex size-7 -translate-x-1/2 -translate-y-full items-center justify-center rounded-[10px] border border-border bg-background p-0.5 shadow-sm transition-colors hover:bg-muted/80 disabled:pointer-events-none disabled:opacity-40",
|
|
8349
8369
|
style: { top: chromeGap - buttonMargin },
|
|
8350
8370
|
"aria-label": "Add item",
|
|
8351
8371
|
onMouseDown: (e) => {
|
|
@@ -8355,12 +8375,13 @@ function FooterContainerChrome({ rect, onAdd }) {
|
|
|
8355
8375
|
onClick: (e) => {
|
|
8356
8376
|
e.preventDefault();
|
|
8357
8377
|
e.stopPropagation();
|
|
8378
|
+
if (addDisabled) return;
|
|
8358
8379
|
onAdd();
|
|
8359
8380
|
},
|
|
8360
8381
|
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Plus, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
|
|
8361
8382
|
}
|
|
8362
8383
|
) }),
|
|
8363
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TooltipContent, { side: "bottom", sideOffset: 9, children: "Add item" })
|
|
8384
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TooltipContent, { side: "bottom", sideOffset: 9, children: addDisabled ? "Maximum columns reached" : "Add item" })
|
|
8364
8385
|
] })
|
|
8365
8386
|
}
|
|
8366
8387
|
) });
|
|
@@ -10180,9 +10201,18 @@ function OhhwellsBridge() {
|
|
|
10180
10201
|
});
|
|
10181
10202
|
}, []);
|
|
10182
10203
|
const handleAddFooterColumn = (0, import_react11.useCallback)(() => {
|
|
10204
|
+
if (!canAddFooterColumn()) {
|
|
10205
|
+
postToParent2({
|
|
10206
|
+
type: "ow:toast",
|
|
10207
|
+
title: `Maximum ${MAX_FOOTER_COLUMNS} columns`,
|
|
10208
|
+
toastType: "error"
|
|
10209
|
+
});
|
|
10210
|
+
return;
|
|
10211
|
+
}
|
|
10183
10212
|
deselectRef.current();
|
|
10184
10213
|
deactivateRef.current();
|
|
10185
10214
|
const result = addFooterColumnWithPersist({ postToParent: postToParent2 });
|
|
10215
|
+
if (!result) return;
|
|
10186
10216
|
editContentRef.current = {
|
|
10187
10217
|
...editContentRef.current,
|
|
10188
10218
|
...buildFooterColumnEditContentPatch(result)
|
|
@@ -13098,7 +13128,14 @@ function OhhwellsBridge() {
|
|
|
13098
13128
|
hoveredNavContainerRect && (toolbarVariant !== "select-frame" || isFooterFrameSelection) && !linkPopover && !isItemDragging && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ItemInteractionLayer, { rect: hoveredNavContainerRect, state: "hover" }),
|
|
13099
13129
|
hoveredItemRect && !linkPopover && !hoveredNavContainerRect && !isItemDragging && hoveredItemElRef.current !== selectedElRef.current && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ItemInteractionLayer, { rect: hoveredItemRect, state: "hover" }),
|
|
13100
13130
|
toolbarVariant === "select-frame" && toolbarRect && !linkPopover && !isItemDragging && !isFooterFrameSelection && selectedElRef.current && isNavbarLinksContainer(selectedElRef.current) && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(NavbarContainerChrome, { rect: toolbarRect, onAdd: handleAddTopLevelNavItem }),
|
|
13101
|
-
toolbarVariant === "select-frame" && toolbarRect && !linkPopover && !isItemDragging && !isFooterFrameSelection && selectedElRef.current && isFooterLinksContainer(selectedElRef.current) && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
13131
|
+
toolbarVariant === "select-frame" && toolbarRect && !linkPopover && !isItemDragging && !isFooterFrameSelection && selectedElRef.current && isFooterLinksContainer(selectedElRef.current) && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
13132
|
+
FooterContainerChrome,
|
|
13133
|
+
{
|
|
13134
|
+
rect: toolbarRect,
|
|
13135
|
+
onAdd: handleAddFooterColumn,
|
|
13136
|
+
addDisabled: !canAddFooterColumn()
|
|
13137
|
+
}
|
|
13138
|
+
),
|
|
13102
13139
|
toolbarRect && !linkPopover && (toolbarVariant === "link-action" || toolbarVariant === "select-frame") && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
13103
13140
|
ItemInteractionLayer,
|
|
13104
13141
|
{
|