@tightknitai/block-kitchen 0.10.6 → 0.10.7
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/README.md +21 -0
- package/dist/index.cjs +81 -58
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +81 -58
- package/dist/index.js.map +1 -1
- package/dist/styles.css +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -98,6 +98,27 @@ export function MyBuilderPage() {
|
|
|
98
98
|
}
|
|
99
99
|
```
|
|
100
100
|
|
|
101
|
+
### Sizing
|
|
102
|
+
|
|
103
|
+
The builder is an app shell: a fixed toolbar over a palette rail and a preview pane that scroll independently. It fills its container, so the height you give that container is the height it takes.
|
|
104
|
+
|
|
105
|
+
```tsx
|
|
106
|
+
// Give it a definite height and it fills exactly that.
|
|
107
|
+
<div style={{ height: "100%" }}>
|
|
108
|
+
<BlockKitchen {...props} />
|
|
109
|
+
</div>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Given no height to work with — a plain `<div>` in ordinary document flow — it bounds itself to `100svh` rather than growing to fit the palette's full block list, which would run a couple of thousand pixels down the page. Override that bound with `--bk-max-height` on any ancestor:
|
|
113
|
+
|
|
114
|
+
```css
|
|
115
|
+
/* Room for a 4rem page header above the builder. */
|
|
116
|
+
.builder-host { --bk-max-height: calc(100svh - 4rem); }
|
|
117
|
+
|
|
118
|
+
/* Or opt out entirely and let it grow with its content. */
|
|
119
|
+
.builder-host { --bk-max-height: none; }
|
|
120
|
+
```
|
|
121
|
+
|
|
101
122
|
## Props
|
|
102
123
|
|
|
103
124
|
| Prop | Type | Required | Description |
|
package/dist/index.cjs
CHANGED
|
@@ -3876,66 +3876,65 @@ function Palette({
|
|
|
3876
3876
|
isSheet ? "w-full flex-1 bg-background" : "w-72 shrink-0 border-r bg-muted/20"
|
|
3877
3877
|
),
|
|
3878
3878
|
children: [
|
|
3879
|
-
offersSimple || searchVisible ?
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3893
|
-
"span",
|
|
3894
|
-
{
|
|
3895
|
-
className: cn(
|
|
3896
|
-
"min-w-0 truncate font-medium uppercase tracking-wide text-muted-foreground",
|
|
3897
|
-
isSheet ? "text-xs" : "text-[11px]"
|
|
3898
|
-
),
|
|
3899
|
-
children: PALETTE_TITLE
|
|
3900
|
-
}
|
|
3901
|
-
),
|
|
3902
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3903
|
-
ModeLink,
|
|
3904
|
-
{
|
|
3905
|
-
advanced,
|
|
3906
|
-
isSheet,
|
|
3907
|
-
onToggle: () => {
|
|
3908
|
-
setQuery("");
|
|
3909
|
-
setAdvancedOpen((v) => !v);
|
|
3910
|
-
}
|
|
3911
|
-
}
|
|
3912
|
-
)
|
|
3913
|
-
] })
|
|
3914
|
-
) : null,
|
|
3915
|
-
searchVisible ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
3879
|
+
offersSimple || searchVisible ? (
|
|
3880
|
+
// Two elements so the header is opaque *and* the exact color of the
|
|
3881
|
+
// rail. Painted with the rail's own `bg-muted/20`, it composited over
|
|
3882
|
+
// the scrolled list instead and headings read through the search box
|
|
3883
|
+
// (a `backdrop-blur` softened them, it didn't hide them). Restoring
|
|
3884
|
+
// the `bg-background` base under the tint rebuilds the rail's own two
|
|
3885
|
+
// layers, so the match holds under any theme.
|
|
3886
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sticky top-0 z-10 shrink-0 bg-background", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex flex-col gap-2 border-b px-3 pt-3 pb-2", isSheet ? "bg-background" : "bg-muted/20"), children: [
|
|
3887
|
+
offersSimple ? (
|
|
3888
|
+
// Titled row: with the sections gone, simple mode's header would
|
|
3889
|
+
// otherwise be a lone right-aligned link over empty space, and
|
|
3890
|
+
// nothing would name what the rail below it holds.
|
|
3891
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
3916
3892
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3917
|
-
|
|
3893
|
+
"span",
|
|
3918
3894
|
{
|
|
3919
3895
|
className: cn(
|
|
3920
|
-
"
|
|
3921
|
-
isSheet ? "
|
|
3922
|
-
)
|
|
3896
|
+
"min-w-0 truncate font-medium uppercase tracking-wide text-muted-foreground",
|
|
3897
|
+
isSheet ? "text-xs" : "text-[11px]"
|
|
3898
|
+
),
|
|
3899
|
+
children: PALETTE_TITLE
|
|
3923
3900
|
}
|
|
3924
3901
|
),
|
|
3925
3902
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3926
|
-
|
|
3903
|
+
ModeLink,
|
|
3927
3904
|
{
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3905
|
+
advanced,
|
|
3906
|
+
isSheet,
|
|
3907
|
+
onToggle: () => {
|
|
3908
|
+
setQuery("");
|
|
3909
|
+
setAdvancedOpen((v) => !v);
|
|
3910
|
+
}
|
|
3934
3911
|
}
|
|
3935
3912
|
)
|
|
3936
|
-
] })
|
|
3937
|
-
|
|
3938
|
-
|
|
3913
|
+
] })
|
|
3914
|
+
) : null,
|
|
3915
|
+
searchVisible ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
3916
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3917
|
+
lucideReact.Search,
|
|
3918
|
+
{
|
|
3919
|
+
className: cn(
|
|
3920
|
+
"pointer-events-none absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground",
|
|
3921
|
+
isSheet ? "h-4 w-4" : "h-3.5 w-3.5"
|
|
3922
|
+
)
|
|
3923
|
+
}
|
|
3924
|
+
),
|
|
3925
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3926
|
+
Input,
|
|
3927
|
+
{
|
|
3928
|
+
type: "search",
|
|
3929
|
+
value: query,
|
|
3930
|
+
onChange: (e) => setQuery(e.target.value),
|
|
3931
|
+
placeholder: searchPlaceholder,
|
|
3932
|
+
"aria-label": searchPlaceholder,
|
|
3933
|
+
className: cn(isSheet ? "h-10 pl-8 text-base" : "h-8 pl-7 text-sm")
|
|
3934
|
+
}
|
|
3935
|
+
)
|
|
3936
|
+
] }) : null
|
|
3937
|
+
] }) })
|
|
3939
3938
|
) : null,
|
|
3940
3939
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex flex-col", isSheet ? "px-2 pb-6" : "p-3"), children: !advanced ? (
|
|
3941
3940
|
// Simple mode: a flat list, no section headings — with this few
|
|
@@ -10151,18 +10150,29 @@ function Toolbar2({
|
|
|
10151
10150
|
size: "sm",
|
|
10152
10151
|
onClick: onClear,
|
|
10153
10152
|
disabled: !canClear,
|
|
10154
|
-
className: "hover:bg-destructive/10 hover:text-destructive",
|
|
10153
|
+
className: "group gap-0 hover:bg-destructive/10 hover:text-destructive",
|
|
10155
10154
|
"aria-label": "Clear all blocks",
|
|
10156
10155
|
children: [
|
|
10157
10156
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash2, { className: "h-3.5 w-3.5" }),
|
|
10158
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10157
|
+
/* @__PURE__ */ jsxRuntime.jsx(ExpandingLabel, { children: "Clear" })
|
|
10158
|
+
]
|
|
10159
|
+
}
|
|
10160
|
+
),
|
|
10161
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
10162
|
+
Button,
|
|
10163
|
+
{
|
|
10164
|
+
type: "button",
|
|
10165
|
+
variant: "ghost",
|
|
10166
|
+
size: "sm",
|
|
10167
|
+
onClick: onOpenJson,
|
|
10168
|
+
className: "group gap-0",
|
|
10169
|
+
"aria-label": "View JSON",
|
|
10170
|
+
children: [
|
|
10171
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Code2, { className: "h-3.5 w-3.5" }),
|
|
10172
|
+
/* @__PURE__ */ jsxRuntime.jsx(ExpandingLabel, { children: "View JSON" })
|
|
10159
10173
|
]
|
|
10160
10174
|
}
|
|
10161
10175
|
),
|
|
10162
|
-
/* @__PURE__ */ jsxRuntime.jsxs(Button, { type: "button", variant: "ghost", size: "sm", onClick: onOpenJson, "aria-label": "View JSON", children: [
|
|
10163
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Code2, { className: "h-3.5 w-3.5" }),
|
|
10164
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "hidden md:inline", children: "View JSON" })
|
|
10165
|
-
] }),
|
|
10166
10176
|
!showSend ? primaryAction ? (
|
|
10167
10177
|
// Compose-only mode with a host-owned primary action: same
|
|
10168
10178
|
// placement and styling as the built-in send button. No icon —
|
|
@@ -10272,6 +10282,19 @@ function Toolbar2({
|
|
|
10272
10282
|
] }) : null
|
|
10273
10283
|
] });
|
|
10274
10284
|
}
|
|
10285
|
+
function ExpandingLabel({ children }) {
|
|
10286
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
10287
|
+
"span",
|
|
10288
|
+
{
|
|
10289
|
+
className: cn(
|
|
10290
|
+
"grid grid-cols-[0fr] transition-[grid-template-columns] duration-200 ease-out",
|
|
10291
|
+
"group-hover:grid-cols-[1fr] group-focus-visible:grid-cols-[1fr]",
|
|
10292
|
+
"motion-reduce:transition-none"
|
|
10293
|
+
),
|
|
10294
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "block whitespace-nowrap pl-1.5", children }) })
|
|
10295
|
+
}
|
|
10296
|
+
);
|
|
10297
|
+
}
|
|
10275
10298
|
function Menu({
|
|
10276
10299
|
ariaLabel,
|
|
10277
10300
|
options,
|
|
@@ -10694,7 +10717,7 @@ function BlockKitchen(props) {
|
|
|
10694
10717
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
10695
10718
|
"div",
|
|
10696
10719
|
{
|
|
10697
|
-
className: "bk-root flex h-full w-full flex-col overflow-hidden rounded-md border bg-background text-foreground",
|
|
10720
|
+
className: "bk-root flex h-full max-h-[var(--bk-max-height,100svh)] w-full flex-col overflow-hidden rounded-md border bg-background text-foreground",
|
|
10698
10721
|
onKeyDown: handleKeyDown,
|
|
10699
10722
|
children: [
|
|
10700
10723
|
/* @__PURE__ */ jsxRuntime.jsx(
|