@garagem-ai/site-sdk 0.5.0 → 0.5.1
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 +5 -4
- package/dist/index.d.mts +16 -7
- package/dist/index.d.ts +16 -7
- package/dist/index.js +19 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -8
- package/dist/index.mjs.map +1 -1
- package/dist/react.js +1 -1
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +1 -1
- package/dist/react.mjs.map +1 -1
- package/package.json +1 -1
- package/src/react/styles/search-chrome-css.generated.ts +1 -1
- package/src/studio-contract.ts +19 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@garagem-ai/site-sdk",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Typed, runtime-agnostic SDK for building custom real estate sites against the Garagem platform. Drop into any Next.js (or other JS) project to fetch listings, sites and CMS data.",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* Generated by scripts/build-search-chrome-css.mjs — do not edit. */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/* prettier-ignore */
|
|
4
|
-
export const SEARCH_CHROME_CSS_VERSION = "0.5.
|
|
4
|
+
export const SEARCH_CHROME_CSS_VERSION = "0.5.1";
|
|
5
5
|
export const SEARCH_CHROME_CSS = ":root{--garagem-listing-card-radius:0.75rem;--garagem-listing-card-gap:1.5rem;--garagem-listing-price-size:1.125rem;--garagem-listing-media-ratio:4 / 3;--garagem-skeleton:var(--muted,#e7e5e4)}[data-slot=\"search-grid\"],[data-slot=\"search-skeleton\"]{display:grid;grid-template-columns:1fr;gap:var(--garagem-listing-card-gap)}@media (min-width:640px){[data-slot=\"search-grid\"],[data-slot=\"search-skeleton\"]{grid-template-columns:repeat(2,minmax(0,1fr))}}@media (min-width:1024px){[data-slot=\"search-grid\"],[data-slot=\"search-skeleton\"]{grid-template-columns:repeat(3,minmax(0,1fr))}}[data-slot=\"listing-card\"]{overflow:hidden;border-radius:var(--garagem-listing-card-radius);border:1px solid var(--border,#e4e4e7);background:var(--card,var(--background,#fff))}[data-slot=\"listing-card-price-row\"]{display:inline-flex;align-items:baseline;gap:0.25rem}[data-slot=\"listing-card-price\"]{font-size:var(--garagem-listing-price-size);font-weight:600}[data-slot=\"listing-card-period\"]{font-size:0.75rem;color:var(--muted-foreground,#737373)}[data-slot=\"listing-card-link\"]{display:block;color:inherit;text-decoration:none;cursor:pointer}[data-slot=\"listing-card-media\"]{position:relative;width:100%;overflow:hidden;background:var(--muted,#f5f5f4);aspect-ratio:var(--garagem-listing-media-ratio)}[data-slot=\"listing-card-media\"] img{height:100%;width:100%;object-fit:cover;transition:transform 0.3s}[data-slot=\"listing-card\"]:hover [data-slot=\"listing-card-media\"] img{transform:scale(1.05)}@media (prefers-reduced-motion:reduce){[data-slot=\"listing-card-media\"] img{transition:none}[data-slot=\"listing-card\"]:hover [data-slot=\"listing-card-media\"] img{transform:none}}[data-slot=\"listing-card-empty\"]{display:flex;height:100%;width:100%;align-items:center;justify-content:center;font-size:0.75rem;color:var(--muted-foreground,#737373)}[data-slot=\"listing-card-cta\"]{margin-top:0.75rem}[data-slot=\"listing-card-badge\"]{position:absolute;left:0.75rem;top:0.75rem;border-radius:999px;background:color-mix(in srgb,var(--background,#fff) 90%,transparent);padding:0.25rem 0.5rem;font-size:0.75rem;font-weight:500}[data-slot=\"listing-card-body\"]{padding:1rem}[data-slot=\"listing-card-title\"]{display:-webkit-box;margin-top:0.25rem;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:1;font-size:0.875rem;font-weight:500}[data-slot=\"listing-card-location\"]{margin-top:0.125rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:0.75rem;color:var(--muted-foreground,#737373)}[data-slot=\"listing-card-features\"]{display:flex;flex-wrap:wrap;margin-top:0.75rem;gap:0.25rem 1rem;padding:0;list-style:none;font-size:0.75rem;color:var(--muted-foreground,#737373)}[data-slot=\"search-skeleton-block\"]{animation:garagem-search-pulse 1.2s ease-in-out infinite;background:var(--garagem-skeleton);border-radius:0.375rem}[data-slot=\"search-skeleton-card\"]{overflow:hidden;border-radius:var(--garagem-listing-card-radius);border:1px solid var(--border,#e4e4e7)}[data-slot=\"search-skeleton-body\"]{display:flex;flex-direction:column;gap:0.5rem;padding:1rem}[data-slot=\"search-skeleton-block\"][data-kind=\"media\"]{aspect-ratio:var(--garagem-listing-media-ratio)}[data-slot=\"search-skeleton-block\"][data-kind=\"line-lg\"]{height:1.25rem;width:50%}[data-slot=\"search-skeleton-block\"][data-kind=\"line-md\"]{height:1rem;width:75%}[data-slot=\"search-skeleton-block\"][data-kind=\"line-sm\"]{height:0.75rem;width:66.666667%}[data-slot=\"search-skeleton-block\"][data-kind=\"detail-media\"]{max-width:45rem;aspect-ratio:4 / 3}[data-slot=\"search-skeleton-block\"][data-kind=\"detail-title\"]{width:66.666667%;height:2rem;margin-top:1.5rem}@media (prefers-reduced-motion:reduce){[data-slot=\"search-skeleton-block\"]{animation:none}}@keyframes garagem-search-pulse{50%{opacity:0.55}}";
|
package/src/studio-contract.ts
CHANGED
|
@@ -16,9 +16,11 @@ export const STUDIO_SDK_CONTRACT = {
|
|
|
16
16
|
package: STUDIO_SDK_PACKAGE,
|
|
17
17
|
/**
|
|
18
18
|
* Exact pin for generated Studio sites. Must match a tarball already on
|
|
19
|
-
* npm — v0 installs this version. After
|
|
20
|
-
*
|
|
21
|
-
* into
|
|
19
|
+
* npm — v0 installs this version. After a later changeset publishes, bump
|
|
20
|
+
* this and move that release's names from `optionalReactExports` /
|
|
21
|
+
* `unpublishedSearchExports` into the prompt-safe lists. Do not bump here
|
|
22
|
+
* until that tarball is on npm. Headless SearchPage already shipped in
|
|
23
|
+
* 0.4.12 (`visibleSearchFilters` / `toolbarFilterIds` are on that pin).
|
|
22
24
|
*/
|
|
23
25
|
minNpmVersion: "0.4.12",
|
|
24
26
|
/** First release where ListingCard and ResultsSkeleton inject card CSS. */
|
|
@@ -63,16 +65,25 @@ export const STUDIO_SDK_CONTRACT = {
|
|
|
63
65
|
] as const,
|
|
64
66
|
listingDetailExports: ["listingDetailModel", "getSimilarListings"] as const,
|
|
65
67
|
amenityExports: ["listingAmenityGroups"] as const,
|
|
66
|
-
/**
|
|
68
|
+
/**
|
|
69
|
+
* Names already on the pinned npm tarball (`minNpmVersion` / 0.4.12) —
|
|
70
|
+
* safe for Studio prompts and completeness. Includes
|
|
71
|
+
* `visibleSearchFilters` + `toolbarFilterIds` (shipped in 0.4.12). Do not
|
|
72
|
+
* confuse with `unpublishedSearchExports` (`searchChromeModel`, …).
|
|
73
|
+
*/
|
|
67
74
|
searchExports: [
|
|
68
75
|
"searchResultsHeading",
|
|
69
76
|
"searchSortOptions",
|
|
77
|
+
"visibleSearchFilters",
|
|
78
|
+
"toolbarFilterIds",
|
|
70
79
|
"paginationPages",
|
|
71
80
|
"hrefWithExplicitPage",
|
|
72
81
|
] as const,
|
|
73
82
|
/**
|
|
74
|
-
* Main-package helpers in git but not on
|
|
75
|
-
* not mention these until the pin bumps and
|
|
83
|
+
* Main-package helpers in git / newer tarballs but not required on
|
|
84
|
+
* `minNpmVersion`. Prompts must not mention these until the pin bumps and
|
|
85
|
+
* they move into `searchExports`. Independent of the 0.4.12 filter helpers
|
|
86
|
+
* already listed in `searchExports`.
|
|
76
87
|
*/
|
|
77
88
|
unpublishedSearchExports: [
|
|
78
89
|
"searchChromeModel",
|
|
@@ -118,7 +129,7 @@ Every page section is two layers: (1) surface — \`section\` / header / footer
|
|
|
118
129
|
}
|
|
119
130
|
|
|
120
131
|
export function studioSearchLandmarkInstruction(): string {
|
|
121
|
-
return `Search at \`/imoveis\` (hard rule). The page landmark is \`<main className="${STUDIO_SITE_LAYOUT.searchMainClassName}">\` with one child \`${STUDIO_SITE_LAYOUT.wrapperClassName}\`. Wire the catalog with \`usePublicSearch\` from \`${STUDIO_SDK_PACKAGE}/react\` inside \`<Suspense fallback={<ResultsSkeleton />}>\`. Do not wrap the search UI in \`<section>\` or a second max-width. The page owns the SEO heading
|
|
132
|
+
return `Search at \`/imoveis\` (hard rule). The page landmark is \`<main className="${STUDIO_SITE_LAYOUT.searchMainClassName}">\` with one child \`${STUDIO_SITE_LAYOUT.wrapperClassName}\`. Wire the catalog with \`usePublicSearch\` from \`${STUDIO_SDK_PACKAGE}/react\` inside \`<Suspense fallback={<ResultsSkeleton />}>\`. Do not wrap the search UI in \`<section>\` or a second max-width. The page owns the SEO heading as \`<div data-slot="search-heading">\`: count \`<span data-slot="search-heading-count">\` FIRST, then \`<h1 data-slot="search-heading-title">\` — never put the count inside the H1 and never put the h1 first. \`pt-4 pb-12\` is the default on that search \`<main>\` — change those values if the design needs it. Flush search (glued to the header) is allowed only with \`${STUDIO_SITE_LAYOUT.searchFlushMarker}\` on that \`<main>\`. Never add that vertical padding to home heroes or listing galleries.`;
|
|
122
133
|
}
|
|
123
134
|
|
|
124
135
|
const REACT_SDK_NAMED_IMPORT_RE =
|
|
@@ -209,7 +220,7 @@ export function studioAmenityInstruction(): string {
|
|
|
209
220
|
export function studioSearchInstruction(): string {
|
|
210
221
|
const reactNames = STUDIO_SDK_CONTRACT.reactExports.join(", ");
|
|
211
222
|
const libNames = STUDIO_SDK_CONTRACT.searchExports.join(", ");
|
|
212
|
-
return `Search: import ${reactNames} from \`${STUDIO_SDK_PACKAGE}/react\`. From \`${STUDIO_SDK_PACKAGE}\` import ${libNames}. Call \`usePublicSearch({ siteId, baseUrl: GARAGEM_API_BASE })\` in a client component inside \`<Suspense>\` (\`useSearchParams\`). Compose the page UI in the app — do not paste a canonical search TSX.
|
|
223
|
+
return `Search: import ${reactNames} from \`${STUDIO_SDK_PACKAGE}/react\`. From \`${STUDIO_SDK_PACKAGE}\` import ${libNames}. Call \`const search = usePublicSearch({ siteId, baseUrl: GARAGEM_API_BASE })\` in a client component inside \`<Suspense>\` (\`useSearchParams\`). Compose the page UI in the app — do not paste a canonical search TSX. Required chrome (design is free; omit none): query (\`qDraft\` / \`setQDraft\` / form \`preventDefault\` + \`submitQuery\`), heading (count span FIRST then h1 from \`searchResultsHeading(search.pathFilters, search.schema?.dictionary, search.locationNames)\` — never \`searchResultsHeading({})\`), toolbar (\`toolbarFilterIds\` + \`applyFilter\`; range “Atualizar” on that toolbar item only) vs sheet (\`visibleSearchFilters\` extras, \`stageFilter\`, one footer \`applyStaged\`), sort (\`searchSortOptions\` + \`setSort\`), grid (\`listings.map\` + \`ListingCard\`; \`ResultsSkeleton\` is only the Suspense fallback), pagination (\`paginationPages\` + \`hrefWithExplicitPage\`). Never interpolate \`schema\`, \`pathFilters\`, or a filter object as a React child. \`queryListings\` key is \`params\`. The URL is the document. Empty copy: ${JSON.stringify(SEARCH_EMPTY_COPY)}`;
|
|
213
224
|
}
|
|
214
225
|
|
|
215
226
|
export function studioChromeInstruction(): string {
|