@sonordev/site-kit 8.0.0 → 8.1.0
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/CHANGELOG.md +11 -0
- package/agent-manifest.json +1 -1
- package/dist/{AnalyticsProvider-LYFDQRRJ.js → AnalyticsProvider-UWTCE5UO.js} +4 -4
- package/dist/{ArticleViewTracker-HG7IIRJY.js → ArticleViewTracker-MYD6SGNH.js} +3 -3
- package/dist/{BlocksPopup-GFX3GZIK.js → BlocksPopup-OY5G3EFH.js} +4 -4
- package/dist/{ChatWidget-DVS7MLBN.js → ChatWidget-BTR5VERC.js} +5 -5
- package/dist/{FileField-DVN7NUBI.js → FileField-DEHVYXAO.js} +3 -3
- package/dist/{FormSpotlight-W4SXKKO6.js → FormSpotlight-VGC4CZL4.js} +1 -1
- package/dist/{FormStage-JTEE5MZD.js → FormStage-CJUSCSAL.js} +1 -1
- package/dist/{ManagedForm-ZAUHIHGP.js → ManagedForm-JCI2KPMO.js} +6 -6
- package/dist/{ManagedNewsletterForm-DQIB5Z4Y.js → ManagedNewsletterForm-DTE4KKXV.js} +4 -4
- package/dist/{SignalCore-W5PYYMGX.js → SignalCore-LGCBQDEH.js} +3 -3
- package/dist/{SiteChat-MY2GATWC.js → SiteChat-6SF7PVUT.js} +1 -1
- package/dist/{SiteDesignReporter-ICZWEGCY.js → SiteDesignReporter-VISQZ5NQ.js} +5 -5
- package/dist/{SitePopups-TGULLAER.js → SitePopups-T6YPHAVY.js} +4 -4
- package/dist/{SitemapSync-AN2OBJE6.js → SitemapSync-VKMVRPZL.js} +4 -4
- package/dist/_client/booking-widget.js +5 -5
- package/dist/affiliates/index.js +3 -3
- package/dist/analytics/index.js +4 -4
- package/dist/{article-styles-6CM5FUMV.js → article-styles-GGZOQG5X.js} +2 -0
- package/dist/articles/article-photos.d.ts +9 -0
- package/dist/articles/index.d.ts +1 -0
- package/dist/articles/index.js +1 -1
- package/dist/articles/server-core.d.ts +2 -0
- package/dist/articles/server-ui.d.ts +2 -0
- package/dist/articles/server-ui.js +7 -5
- package/dist/articles/server.d.ts +2 -0
- package/dist/articles/server.js +2 -1
- package/dist/articles/types.d.ts +16 -0
- package/dist/chat/index.js +6 -6
- package/dist/{chunk-OE3NXEOF.js → chunk-255NCCPB.js} +1 -1
- package/dist/{chunk-IJQ767JS.js → chunk-2JEUDTL6.js} +1 -1
- package/dist/chunk-2UO4HPGE.js +109 -0
- package/dist/{chunk-BQ2CXKTQ.js → chunk-47VB5INH.js} +1 -1
- package/dist/{chunk-XPTJRVL2.js → chunk-4Z3DI2EL.js} +3 -2
- package/dist/{chunk-OGK7OL3T.js → chunk-55GHBRCN.js} +1 -1
- package/dist/{chunk-LKH44GI3.js → chunk-5L467Z5Q.js} +3 -3
- package/dist/{chunk-LBIQ5LTC.js → chunk-6VHDCJIZ.js} +1 -1
- package/dist/{chunk-PD7K54EQ.js → chunk-A3EU6HB5.js} +1 -1
- package/dist/{chunk-TOSZGJEQ.js → chunk-ADI6IYFH.js} +1 -1
- package/dist/{chunk-M62U7TJF.js → chunk-AIDIEVPZ.js} +1 -1
- package/dist/{chunk-GNSXOTIK.js → chunk-CSTC6HZO.js} +2 -2
- package/dist/{chunk-ROAOI6GG.js → chunk-DOMBP3FW.js} +8 -8
- package/dist/{chunk-KRBBH64S.js → chunk-DSNCU2E3.js} +2 -2
- package/dist/{chunk-6ZXJ3SXR.js → chunk-DZV3KPVF.js} +1 -1
- package/dist/{chunk-ZLFGXKLG.js → chunk-F2VYN3QL.js} +1 -1
- package/dist/{chunk-ZHNQFNO3.js → chunk-G2HCCWZQ.js} +1 -1
- package/dist/{chunk-K22OLAPC.js → chunk-IAYGTQJD.js} +1 -1
- package/dist/{chunk-PIX7FAMX.js → chunk-JT52KYHQ.js} +1 -1
- package/dist/{chunk-S7SSYGUJ.js → chunk-LLW5HKEE.js} +2 -2
- package/dist/{chunk-5S2XDG5O.js → chunk-NWVB75ER.js} +1 -1
- package/dist/{chunk-6QFINXLH.js → chunk-O4DETQJI.js} +1 -1
- package/dist/{chunk-ICAVVF6D.js → chunk-RSBMQFZW.js} +2 -2
- package/dist/{chunk-UUWUAMUC.js → chunk-S6IGQYHW.js} +1 -1
- package/dist/{chunk-J65N34YM.js → chunk-TAO6BVA2.js} +1 -1
- package/dist/{chunk-7YEEOIWI.js → chunk-V56RZH7J.js} +1 -1
- package/dist/{chunk-56VDS2RP.js → chunk-WPOFTCKL.js} +2 -2
- package/dist/{chunk-SBPAXWLF.js → chunk-XUCU3LX4.js} +1 -1
- package/dist/client/index.js +3 -3
- package/dist/contracts/entries.d.ts +1 -1
- package/dist/contracts/knowledge.d.ts +84 -0
- package/dist/fleet/index.js +4 -4
- package/dist/forms/index.js +7 -7
- package/dist/forms/server.js +2 -2
- package/dist/images/index.js +4 -4
- package/dist/index.js +1 -1
- package/dist/layout/client.js +7 -7
- package/dist/layout/index.js +8 -8
- package/dist/llms/index.js +4 -4
- package/dist/maps/index.js +3 -3
- package/dist/mcp/sonor.js +11 -9
- package/dist/revalidate/index.js +2 -2
- package/dist/runtime/index.js +3 -3
- package/dist/seo/client.js +4 -4
- package/dist/seo/index.js +4 -4
- package/dist/seo/llms.js +4 -4
- package/dist/seo/register-sitemap-cli.js +1 -1
- package/dist/seo/sitemap.js +2 -2
- package/dist/server/index.js +2 -2
- package/dist/shared/import-specifiers.d.ts +57 -9
- package/dist/shared/source-graph.d.ts +4 -1
- package/dist/shared/version.d.ts +1 -1
- package/dist/signal/index.js +2 -2
- package/dist/sitemap/index.js +2 -2
- package/dist/sync/index.js +5 -5
- package/dist/website/images.js +4 -4
- package/dist/website/index.js +5 -5
- package/dist/website/popups.js +4 -4
- package/dist/{writeLLMsTxt-UZGN6IBU.js → writeLLMsTxt-OS2WBSLM.js} +1 -1
- package/docs/MIGRATING-TO-8.md +1 -1
- package/package.json +5 -3
- package/src/articles/README.md +33 -0
- /package/dist/{chunk-TZ5RTANX.js → chunk-GC2QWXJ3.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @sonordev/site-kit Changelog
|
|
2
2
|
|
|
3
|
+
## 8.1.0
|
|
4
|
+
|
|
5
|
+
- **Supporting article photos.** The default `Article` server component places approved photo snapshots after the introduction or the opening paragraph of an exact section heading. Figures include descriptions, optional credit captions, intrinsic dimensions, and lazy loading. Missing or ambiguous headings are skipped; existing inline images aren't duplicated. Older articles render unchanged.
|
|
6
|
+
- **Custom publications and feeds.** `insertArticlePhotos`, `articlePhotoCss`, and `ArticleEditorialPhoto` are exported from the article entries. Custom renderers can apply the same placement contract to their HTML. RSS and Atom include the approved photos; the public `get_article` MCP tool exposes their descriptions and placements without private planning data.
|
|
7
|
+
- **Sonor owns the photo plan.** The authenticated app and MCP save source selection, image briefs, focal points, and readiness. Sites consume only `editorial_photos` from the public article response. This release doesn't add public write tools.
|
|
8
|
+
|
|
9
|
+
## 8.0.1
|
|
10
|
+
|
|
11
|
+
- **`server-only` is a dependency.** The entries that run only on the server (`@sonordev/site-kit/server`, `/seo/server`, `/forms/server` and the others that import the `server-only` marker) didn't list it. A Next build never noticed, because Next supplies its own copy, but a Node script or a test that imported one of those entries from a pnpm install failed with `ERR_MODULE_NOT_FOUND`. site-kit now depends on `server-only` ^0.0.1, so the import resolves anywhere. Inside a build Next still uses its own copy, so nothing changes for a site. Outside Next, load a server entry under the `react-server` condition (`node --conditions=react-server`), the way a server component loads it; without that condition, `server-only` stops the import on purpose.
|
|
12
|
+
- **Moving a commerce site to 8? Use sonor-setup 7.3.1 or later.** Its codemod writes the `pnpm-workspace.yaml` line it adds as valid YAML, and it adds `@sonordev/commerce-kit` only to a project whose code imports commerce, not to one that merely mentions it in a code sample or a redirect table. [docs/MIGRATING-TO-8.md](docs/MIGRATING-TO-8.md) says so too.
|
|
13
|
+
|
|
3
14
|
## 8.0.0
|
|
4
15
|
|
|
5
16
|
Two things leave site-kit in this release. Commerce (products, services, events and checkout) and the new memberships module move into their own package, [`@sonordev/commerce-kit`](https://sonor.dev/commerce-kit), which versions and releases on its own. And the entries for the modules Sonor retired, Engage and the Sanity CMS, are removed, as the 7.0, 7.1 and 7.2 notes said they'd be. A site that uses neither changes nothing: update site-kit and rebuild.
|
package/agent-manifest.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"package": "@sonordev/site-kit",
|
|
4
|
-
"version": "8.
|
|
4
|
+
"version": "8.1.0",
|
|
5
5
|
"description": "Machine-readable manifest for coding agents integrating a site with Sonor. See AGENTS.md (shipped) and docs/SITE-KIT-AGENT-NATIVE.md.",
|
|
6
6
|
"env": {
|
|
7
7
|
"required": [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { AnalyticsProvider, useAnalytics, useAnalyticsOptional, useTrackEvent } from './chunk-
|
|
1
|
+
export { AnalyticsProvider, useAnalytics, useAnalyticsOptional, useTrackEvent } from './chunk-TAO6BVA2.js';
|
|
2
2
|
import './chunk-LCDVPAMR.js';
|
|
3
3
|
import './chunk-ZKADJNR2.js';
|
|
4
4
|
import './chunk-L2V5PUFN.js';
|
|
@@ -7,7 +7,7 @@ import './chunk-GJWI74ZZ.js';
|
|
|
7
7
|
import './chunk-CAH4Y4PY.js';
|
|
8
8
|
import './chunk-EKBEOXTH.js';
|
|
9
9
|
import './chunk-3G7YABRA.js';
|
|
10
|
-
import './chunk-
|
|
11
|
-
import './chunk-
|
|
12
|
-
import './chunk-
|
|
10
|
+
import './chunk-WPOFTCKL.js';
|
|
11
|
+
import './chunk-F2VYN3QL.js';
|
|
12
|
+
import './chunk-NWVB75ER.js';
|
|
13
13
|
import './chunk-PKBMQBKP.js';
|
|
@@ -4,9 +4,9 @@ import { withSiteBody } from './chunk-MJP63SSS.js';
|
|
|
4
4
|
import './chunk-FESKKJAS.js';
|
|
5
5
|
import './chunk-A4CC4ZG3.js';
|
|
6
6
|
import { readPublishedApiConfig } from './chunk-3G7YABRA.js';
|
|
7
|
-
import { sonorFetch } from './chunk-
|
|
8
|
-
import './chunk-
|
|
9
|
-
import './chunk-
|
|
7
|
+
import { sonorFetch } from './chunk-WPOFTCKL.js';
|
|
8
|
+
import './chunk-F2VYN3QL.js';
|
|
9
|
+
import './chunk-NWVB75ER.js';
|
|
10
10
|
import './chunk-PKBMQBKP.js';
|
|
11
11
|
import { useEffect } from 'react';
|
|
12
12
|
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { getSiteDesignTokens } from './chunk-
|
|
2
|
+
import { getSiteDesignTokens } from './chunk-DSNCU2E3.js';
|
|
3
3
|
import { DEFAULT_POPUP_TOKENS, PopupBlocks } from './chunk-BF7TZYC3.js';
|
|
4
4
|
import { normalizePopupBlocks, toHexColor, readableOn } from './chunk-IHG36STL.js';
|
|
5
5
|
import './chunk-S22FSH7C.js';
|
|
6
6
|
import './chunk-CAH4Y4PY.js';
|
|
7
7
|
import './chunk-EKBEOXTH.js';
|
|
8
8
|
import './chunk-3G7YABRA.js';
|
|
9
|
-
import './chunk-
|
|
10
|
-
import './chunk-
|
|
11
|
-
import './chunk-
|
|
9
|
+
import './chunk-WPOFTCKL.js';
|
|
10
|
+
import './chunk-F2VYN3QL.js';
|
|
11
|
+
import './chunk-NWVB75ER.js';
|
|
12
12
|
import './chunk-PKBMQBKP.js';
|
|
13
13
|
import { useState } from 'react';
|
|
14
14
|
import { jsx } from 'react/jsx-runtime';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { ChatWidget, EchoChat, isChatEnabled } from './chunk-
|
|
1
|
+
export { ChatWidget, EchoChat, isChatEnabled } from './chunk-CSTC6HZO.js';
|
|
2
2
|
import './chunk-6T6CQVNL.js';
|
|
3
3
|
import './chunk-JE4A5S4F.js';
|
|
4
4
|
import './chunk-27FISYK4.js';
|
|
5
|
-
import './chunk-
|
|
5
|
+
import './chunk-S6IGQYHW.js';
|
|
6
6
|
import './chunk-Q6E4OPGG.js';
|
|
7
7
|
import './chunk-5ROTTMBL.js';
|
|
8
8
|
import './chunk-C2FZBUSS.js';
|
|
@@ -14,7 +14,7 @@ import './chunk-L2V5PUFN.js';
|
|
|
14
14
|
import './chunk-5TM3WPCI.js';
|
|
15
15
|
import './chunk-GJWI74ZZ.js';
|
|
16
16
|
import './chunk-3G7YABRA.js';
|
|
17
|
-
import './chunk-
|
|
18
|
-
import './chunk-
|
|
19
|
-
import './chunk-
|
|
17
|
+
import './chunk-WPOFTCKL.js';
|
|
18
|
+
import './chunk-F2VYN3QL.js';
|
|
19
|
+
import './chunk-NWVB75ER.js';
|
|
20
20
|
import './chunk-PKBMQBKP.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { getClientApiConfig } from './chunk-3G7YABRA.js';
|
|
3
|
-
import { sonorFetch } from './chunk-
|
|
4
|
-
import './chunk-
|
|
5
|
-
import './chunk-
|
|
3
|
+
import { sonorFetch } from './chunk-WPOFTCKL.js';
|
|
4
|
+
import './chunk-F2VYN3QL.js';
|
|
5
|
+
import './chunk-NWVB75ER.js';
|
|
6
6
|
import './chunk-PKBMQBKP.js';
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { StageStyles, SummaryTick } from './chunk-3YKQLC7J.js';
|
|
3
|
-
import { stageFirstName, useFieldControls, stageViews, stageEstimate, AUTO_ADVANCE_TYPES } from './chunk-
|
|
3
|
+
import { stageFirstName, useFieldControls, stageViews, stageEstimate, AUTO_ADVANCE_TYPES } from './chunk-XUCU3LX4.js';
|
|
4
4
|
import { readAgentSubmit, formToolAttributes } from './chunk-Q6E4OPGG.js';
|
|
5
5
|
import { isEmptyValue, unseenControlValues, isDisplayOnly } from './chunk-C2FZBUSS.js';
|
|
6
6
|
import { FormField } from './chunk-TYAVHRWH.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { StageStyles, SummaryTick } from './chunk-3YKQLC7J.js';
|
|
3
|
-
import { useFieldControls, stageViews, stageFirstName, stageEstimate, formatAnswer, AUTO_ADVANCE_TYPES } from './chunk-
|
|
3
|
+
import { useFieldControls, stageViews, stageFirstName, stageEstimate, formatAnswer, AUTO_ADVANCE_TYPES } from './chunk-XUCU3LX4.js';
|
|
4
4
|
import { readAgentSubmit, formToolAttributes } from './chunk-Q6E4OPGG.js';
|
|
5
5
|
import { isEmptyValue, unseenControlValues } from './chunk-C2FZBUSS.js';
|
|
6
6
|
import { FormField } from './chunk-TYAVHRWH.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { ManagedForm } from './chunk-
|
|
2
|
-
import './chunk-
|
|
3
|
-
import './chunk-
|
|
1
|
+
export { ManagedForm } from './chunk-5L467Z5Q.js';
|
|
2
|
+
import './chunk-XUCU3LX4.js';
|
|
3
|
+
import './chunk-S6IGQYHW.js';
|
|
4
4
|
import './chunk-Q6E4OPGG.js';
|
|
5
5
|
import './chunk-5ROTTMBL.js';
|
|
6
6
|
import './chunk-C2FZBUSS.js';
|
|
@@ -13,7 +13,7 @@ import './chunk-L2V5PUFN.js';
|
|
|
13
13
|
import './chunk-5TM3WPCI.js';
|
|
14
14
|
import './chunk-GJWI74ZZ.js';
|
|
15
15
|
import './chunk-3G7YABRA.js';
|
|
16
|
-
import './chunk-
|
|
17
|
-
import './chunk-
|
|
18
|
-
import './chunk-
|
|
16
|
+
import './chunk-WPOFTCKL.js';
|
|
17
|
+
import './chunk-F2VYN3QL.js';
|
|
18
|
+
import './chunk-NWVB75ER.js';
|
|
19
19
|
import './chunk-PKBMQBKP.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useForm } from './chunk-
|
|
1
|
+
import { useForm } from './chunk-S6IGQYHW.js';
|
|
2
2
|
import './chunk-Q6E4OPGG.js';
|
|
3
3
|
import './chunk-5ROTTMBL.js';
|
|
4
4
|
import './chunk-C2FZBUSS.js';
|
|
@@ -11,9 +11,9 @@ import './chunk-L2V5PUFN.js';
|
|
|
11
11
|
import './chunk-5TM3WPCI.js';
|
|
12
12
|
import './chunk-GJWI74ZZ.js';
|
|
13
13
|
import './chunk-3G7YABRA.js';
|
|
14
|
-
import './chunk-
|
|
15
|
-
import './chunk-
|
|
16
|
-
import './chunk-
|
|
14
|
+
import './chunk-WPOFTCKL.js';
|
|
15
|
+
import './chunk-F2VYN3QL.js';
|
|
16
|
+
import './chunk-NWVB75ER.js';
|
|
17
17
|
import './chunk-PKBMQBKP.js';
|
|
18
18
|
import { jsx } from 'react/jsx-runtime';
|
|
19
19
|
|
|
@@ -4,9 +4,9 @@ import { onPageLeave } from './chunk-L2V5PUFN.js';
|
|
|
4
4
|
import './chunk-5TM3WPCI.js';
|
|
5
5
|
import './chunk-GJWI74ZZ.js';
|
|
6
6
|
import { getClientApiConfig } from './chunk-3G7YABRA.js';
|
|
7
|
-
import { sonorFetch } from './chunk-
|
|
8
|
-
import { getFreshCredential, isSiteToken } from './chunk-
|
|
9
|
-
import './chunk-
|
|
7
|
+
import { sonorFetch } from './chunk-WPOFTCKL.js';
|
|
8
|
+
import { getFreshCredential, isSiteToken } from './chunk-F2VYN3QL.js';
|
|
9
|
+
import './chunk-NWVB75ER.js';
|
|
10
10
|
import './chunk-PKBMQBKP.js';
|
|
11
11
|
import { useState, useRef, useEffect, useCallback } from 'react';
|
|
12
12
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export { SiteDesignReporter } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
export { SiteDesignReporter } from './chunk-G2HCCWZQ.js';
|
|
2
|
+
import './chunk-DSNCU2E3.js';
|
|
3
3
|
import './chunk-IHG36STL.js';
|
|
4
4
|
import './chunk-YC7ELZS3.js';
|
|
5
5
|
import './chunk-S22FSH7C.js';
|
|
6
6
|
import './chunk-CAH4Y4PY.js';
|
|
7
7
|
import './chunk-EKBEOXTH.js';
|
|
8
8
|
import './chunk-3G7YABRA.js';
|
|
9
|
-
import './chunk-
|
|
10
|
-
import './chunk-
|
|
11
|
-
import './chunk-
|
|
9
|
+
import './chunk-WPOFTCKL.js';
|
|
10
|
+
import './chunk-F2VYN3QL.js';
|
|
11
|
+
import './chunk-NWVB75ER.js';
|
|
12
12
|
import './chunk-PKBMQBKP.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { SitePopups } from './chunk-
|
|
1
|
+
export { SitePopups } from './chunk-LLW5HKEE.js';
|
|
2
2
|
import './chunk-27FISYK4.js';
|
|
3
3
|
import './chunk-5ROTTMBL.js';
|
|
4
4
|
import './chunk-ZKADJNR2.js';
|
|
@@ -7,7 +7,7 @@ import './chunk-GJWI74ZZ.js';
|
|
|
7
7
|
import './chunk-CAH4Y4PY.js';
|
|
8
8
|
import './chunk-EKBEOXTH.js';
|
|
9
9
|
import './chunk-3G7YABRA.js';
|
|
10
|
-
import './chunk-
|
|
11
|
-
import './chunk-
|
|
12
|
-
import './chunk-
|
|
10
|
+
import './chunk-WPOFTCKL.js';
|
|
11
|
+
import './chunk-F2VYN3QL.js';
|
|
12
|
+
import './chunk-NWVB75ER.js';
|
|
13
13
|
import './chunk-PKBMQBKP.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { SitemapSync } from './chunk-
|
|
1
|
+
export { SitemapSync } from './chunk-IAYGTQJD.js';
|
|
2
2
|
import './chunk-YVKRYQRG.js';
|
|
3
3
|
import './chunk-CAH4Y4PY.js';
|
|
4
4
|
import './chunk-EKBEOXTH.js';
|
|
5
5
|
import './chunk-3G7YABRA.js';
|
|
6
|
-
import './chunk-
|
|
7
|
-
import './chunk-
|
|
8
|
-
import './chunk-
|
|
6
|
+
import './chunk-WPOFTCKL.js';
|
|
7
|
+
import './chunk-F2VYN3QL.js';
|
|
8
|
+
import './chunk-NWVB75ER.js';
|
|
9
9
|
import './chunk-PKBMQBKP.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
export { BookingWidget, BookingWidget_default as default } from '../chunk-
|
|
3
|
-
import '../chunk-
|
|
2
|
+
export { BookingWidget, BookingWidget_default as default } from '../chunk-55GHBRCN.js';
|
|
3
|
+
import '../chunk-2JEUDTL6.js';
|
|
4
4
|
import '../chunk-3G7YABRA.js';
|
|
5
|
-
import '../chunk-
|
|
6
|
-
import '../chunk-
|
|
7
|
-
import '../chunk-
|
|
5
|
+
import '../chunk-WPOFTCKL.js';
|
|
6
|
+
import '../chunk-F2VYN3QL.js';
|
|
7
|
+
import '../chunk-NWVB75ER.js';
|
|
8
8
|
import '../chunk-PKBMQBKP.js';
|
package/dist/affiliates/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { getClientApiConfig } from '../chunk-3G7YABRA.js';
|
|
3
|
-
import { sonorFetch } from '../chunk-
|
|
4
|
-
import '../chunk-
|
|
5
|
-
import '../chunk-
|
|
3
|
+
import { sonorFetch } from '../chunk-WPOFTCKL.js';
|
|
4
|
+
import '../chunk-F2VYN3QL.js';
|
|
5
|
+
import '../chunk-NWVB75ER.js';
|
|
6
6
|
import '../chunk-PKBMQBKP.js';
|
|
7
7
|
import { useState, useEffect } from 'react';
|
|
8
8
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
package/dist/analytics/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
export { AnalyticsProvider, WebVitals, useAnalytics, useAnalyticsOptional, useTrackEvent } from '../chunk-
|
|
2
|
+
export { AnalyticsProvider, WebVitals, useAnalytics, useAnalyticsOptional, useTrackEvent } from '../chunk-TAO6BVA2.js';
|
|
3
3
|
import { trackConversion } from '../chunk-LCDVPAMR.js';
|
|
4
4
|
export { trackConversion, trackEvent } from '../chunk-LCDVPAMR.js';
|
|
5
5
|
import '../chunk-ZKADJNR2.js';
|
|
@@ -9,9 +9,9 @@ import '../chunk-GJWI74ZZ.js';
|
|
|
9
9
|
export { isCrossOriginFrame, isFramed, isTopFrameSameOrigin } from '../chunk-CAH4Y4PY.js';
|
|
10
10
|
import '../chunk-EKBEOXTH.js';
|
|
11
11
|
import '../chunk-3G7YABRA.js';
|
|
12
|
-
import '../chunk-
|
|
13
|
-
import '../chunk-
|
|
14
|
-
import '../chunk-
|
|
12
|
+
import '../chunk-WPOFTCKL.js';
|
|
13
|
+
import '../chunk-F2VYN3QL.js';
|
|
14
|
+
import '../chunk-NWVB75ER.js';
|
|
15
15
|
import '../chunk-PKBMQBKP.js';
|
|
16
16
|
import { useCallback, useEffect } from 'react';
|
|
17
17
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { articlePhotoCss } from './chunk-2UO4HPGE.js';
|
|
1
2
|
import { articleTableCss } from './chunk-Y3INC4QJ.js';
|
|
2
3
|
import './chunk-PKBMQBKP.js';
|
|
3
4
|
|
|
@@ -6,6 +7,7 @@ var articleCss = (
|
|
|
6
7
|
/* css */
|
|
7
8
|
`
|
|
8
9
|
${articleTableCss}
|
|
10
|
+
${articlePhotoCss}
|
|
9
11
|
/* ===== Layout ===== */
|
|
10
12
|
.sk-article {
|
|
11
13
|
--_sk-primary: var(--sk-primary, #2563eb);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ArticleEditorialPhoto } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Inserts approved public photo snapshots at explicitly authored placements.
|
|
4
|
+
* Missing/duplicate headings, unmatched sections and photos already in the body
|
|
5
|
+
* are skipped. Never changes the author's paragraphs, headings or other markup.
|
|
6
|
+
* This is a layout transform, not a sanitizer for the original article HTML.
|
|
7
|
+
*/
|
|
8
|
+
export declare function insertArticlePhotos(html: string, photos?: ArticleEditorialPhoto[] | null): string;
|
|
9
|
+
export declare const articlePhotoCss = "\n.sk-article-photo { margin: 2em 0; max-width: 100%; }\n.sk-article-photo img { display: block; width: 100%; max-width: 100%; height: auto; border-radius: var(--sk-radius, 0.75rem); }\n.sk-article-photo figcaption { margin-top: 0.65em; color: var(--sk-text-secondary, inherit); font-size: 0.875em; line-height: 1.5; overflow-wrap: anywhere; }\n";
|
package/dist/articles/index.d.ts
CHANGED
|
@@ -51,6 +51,7 @@ export { TableOfContents } from './TableOfContents';
|
|
|
51
51
|
export { ServiceCallout, ServiceCallouts } from './ServiceCallout';
|
|
52
52
|
export type { ServiceCalloutProps } from './ServiceCallout';
|
|
53
53
|
export { ArticleFAQ } from './ArticleFAQ';
|
|
54
|
+
export type { ArticleEditorialPhoto } from './types';
|
|
54
55
|
export type { ArticleFAQProps, FaqItem } from './ArticleFAQ';
|
|
55
56
|
export { ClusterNavigation } from './ClusterNavigation';
|
|
56
57
|
export type { ClusterNavigationProps } from './ClusterNavigation';
|
package/dist/articles/index.js
CHANGED
|
@@ -15,7 +15,7 @@ import '../chunk-PKBMQBKP.js';
|
|
|
15
15
|
import React, { useState, Suspense, useEffect } from 'react';
|
|
16
16
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
17
17
|
|
|
18
|
-
var ManagedNewsletterForm = React.lazy(() => import('../ManagedNewsletterForm-
|
|
18
|
+
var ManagedNewsletterForm = React.lazy(() => import('../ManagedNewsletterForm-DTE4KKXV.js'));
|
|
19
19
|
function NewsletterWidget({
|
|
20
20
|
title = "Subscribe to Our Newsletter",
|
|
21
21
|
description = "Get the latest posts delivered straight to your inbox.",
|
|
@@ -455,5 +455,7 @@ export { articleCategorySlug, createPublicationRoutes, resolveArticleUrl, resolv
|
|
|
455
455
|
export type { ArticleRoutePost, PublicationRoutingOptions } from './routes';
|
|
456
456
|
export { resolveArticleArtwork } from './artwork';
|
|
457
457
|
export { wrapArticleTables, articleTableCss } from './article-tables';
|
|
458
|
+
export { insertArticlePhotos, articlePhotoCss } from './article-photos';
|
|
459
|
+
export type { ArticleEditorialPhoto } from './types';
|
|
458
460
|
export { FEED_DEFAULT_ITEMS, NEWS_SITEMAP_MAX_URLS, NEWS_SITEMAP_WINDOW_MS, buildNewsSitemapXml, cdata, recentNewsPosts } from './news-sitemap';
|
|
459
461
|
export type { NewsSitemapOptions, NewsSitemapPost } from './news-sitemap';
|
|
@@ -26,3 +26,5 @@ export { articleCategorySlug, createPublicationRoutes, resolveArticleUrl, resolv
|
|
|
26
26
|
export type { ArticleRoutePost, PublicationRoutingOptions } from './routes';
|
|
27
27
|
export { resolveArticleArtwork } from './artwork';
|
|
28
28
|
export { wrapArticleTables, articleTableCss } from './article-tables';
|
|
29
|
+
export { insertArticlePhotos, articlePhotoCss } from './article-photos';
|
|
30
|
+
export type { ArticleEditorialPhoto } from './types';
|
|
@@ -2,7 +2,9 @@ import { readingTimeMinutes, ServiceCallouts, ClusterNavigation, getAuthorSocial
|
|
|
2
2
|
export { ClusterNavigation } from '../chunk-FV2VD7WM.js';
|
|
3
3
|
import { widgetStyle, widgetTitleStyle } from '../chunk-GYF2ULVO.js';
|
|
4
4
|
import { resolvePublicationSiteUrl, addExternalLinkTargets } from '../chunk-L5UOHS6E.js';
|
|
5
|
-
import { fetchArticleBySlug, fetchRelatedArticles, fetchArticleCategories, getTopicCluster } from '../chunk-
|
|
5
|
+
import { fetchArticleBySlug, fetchRelatedArticles, fetchArticleCategories, getTopicCluster } from '../chunk-4Z3DI2EL.js';
|
|
6
|
+
import { insertArticlePhotos } from '../chunk-2UO4HPGE.js';
|
|
7
|
+
export { articlePhotoCss, insertArticlePhotos } from '../chunk-2UO4HPGE.js';
|
|
6
8
|
export { articleTableCss, wrapArticleTables } from '../chunk-Y3INC4QJ.js';
|
|
7
9
|
import { resolveArticleArtwork, articleArtworkImageStyle } from '../chunk-QXMIKDOL.js';
|
|
8
10
|
export { resolveArticleArtwork } from '../chunk-QXMIKDOL.js';
|
|
@@ -107,7 +109,7 @@ async function Article({
|
|
|
107
109
|
}
|
|
108
110
|
const [post, { articleCss }, { wrapArticleTables: wrapArticleTables2 }] = await Promise.all([
|
|
109
111
|
fetchArticleBySlug({ apiUrl, apiKey, site }, slug),
|
|
110
|
-
unstyled ? Promise.resolve({ articleCss: "" }) : import('../article-styles-
|
|
112
|
+
unstyled ? Promise.resolve({ articleCss: "" }) : import('../article-styles-GGZOQG5X.js'),
|
|
111
113
|
import('../article-tables-AXSZOGNW.js')
|
|
112
114
|
]);
|
|
113
115
|
if (!post) {
|
|
@@ -124,7 +126,7 @@ async function Article({
|
|
|
124
126
|
const rawContent = post.content_html || post.content || "";
|
|
125
127
|
const content = ensureHtml(rawContent);
|
|
126
128
|
const siteUrlResolved = resolvePublicationSiteUrl(siteUrl);
|
|
127
|
-
const contentWithExternalTargets = wrapArticleTables2(addExternalLinkTargets(content, siteUrlResolved));
|
|
129
|
+
const contentWithExternalTargets = wrapArticleTables2(addExternalLinkTargets(insertArticlePhotos(content, post.editorial_photos), siteUrlResolved));
|
|
128
130
|
const artwork = resolveArticleArtwork(post, "article");
|
|
129
131
|
const tableOfContents = showToc ? generateTableOfContents(content) : [];
|
|
130
132
|
const relatedPosts = showRelated ? await fetchRelatedArticles({ apiUrl, apiKey, site }, post.id, relatedCount, { revalidate: 300 }) : [];
|
|
@@ -133,7 +135,7 @@ async function Article({
|
|
|
133
135
|
...item,
|
|
134
136
|
answer: addExternalLinkTargets(item.answer || "", siteUrlResolved)
|
|
135
137
|
})) ?? faqRaw;
|
|
136
|
-
const { ArticleViewTracker } = await import('../ArticleViewTracker-
|
|
138
|
+
const { ArticleViewTracker } = await import('../ArticleViewTracker-MYD6SGNH.js');
|
|
137
139
|
if (children) {
|
|
138
140
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
139
141
|
/* @__PURE__ */ jsx(ArticleViewTracker, { slug: post.slug, site }),
|
|
@@ -407,7 +409,7 @@ async function ArticleList({
|
|
|
407
409
|
const [articleData, categories, { articleListCss }] = await Promise.all([
|
|
408
410
|
fetchArticleList({ apiUrl, apiKey, category, tag, author, featured, search, cluster, page, perPage, orderBy, order, site }),
|
|
409
411
|
showCategoryFilter ? fetchArticleCategories({ apiUrl, apiKey, site }) : Promise.resolve([]),
|
|
410
|
-
unstyled || children ? Promise.resolve({ articleListCss: "" }) : import('../article-styles-
|
|
412
|
+
unstyled || children ? Promise.resolve({ articleListCss: "" }) : import('../article-styles-GGZOQG5X.js')
|
|
411
413
|
]);
|
|
412
414
|
if (children) {
|
|
413
415
|
return children({ posts: articleData.posts, pagination: articleData.pagination, categories });
|
|
@@ -455,5 +455,7 @@ export { articleCategorySlug, createPublicationRoutes, resolveArticleUrl, resolv
|
|
|
455
455
|
export type { ArticleRoutePost, PublicationRoutingOptions } from './routes';
|
|
456
456
|
export { resolveArticleArtwork } from './artwork';
|
|
457
457
|
export { wrapArticleTables, articleTableCss } from './article-tables';
|
|
458
|
+
export { insertArticlePhotos, articlePhotoCss } from './article-photos';
|
|
459
|
+
export type { ArticleEditorialPhoto } from './types';
|
|
458
460
|
export { FEED_DEFAULT_ITEMS, NEWS_SITEMAP_MAX_URLS, NEWS_SITEMAP_WINDOW_MS, buildNewsSitemapXml, cdata, recentNewsPosts } from './news-sitemap';
|
|
459
461
|
export type { NewsSitemapOptions, NewsSitemapPost } from './news-sitemap';
|
package/dist/articles/server.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { FEED_DEFAULT_ITEMS, NEWS_SITEMAP_MAX_URLS, NEWS_SITEMAP_WINDOW_MS, SEO_LIMITS, buildNewsSitemapXml, cdata, generateAllArticleSchemas, generateArticleCategoryMetadata, generateArticleListSchema, generateArticleMetadata, generateArticleSchema, generateArticleSitemap, generateArticleStaticParams, generateAtomFeed, generateAuthorPageMetadata, generateAuthorStaticParams, generateBreadcrumbSchema, generateCategoryStaticParams, generateClusterArticleSchema, generateClusterBreadcrumbSchema, generateClusterItemListSchema, generateClusterLandingSchema, generateClusterPageMetadata, generateFaqSchema, generateHowToSchema, generateNewsSitemap, generatePublicationMetadata, generateRssFeed, getAllArticleSlugs, getAllArticles, getAllAuthorSlugs, getArticle, getArticleCategories, getAuthorBySlug, getAuthorPosts, getClusterNavigation, getPostsByCategory, getRelatedInsights, getTopicCluster, getTopicClusters, recentNewsPosts, requireArticle, sanitizeExcerpt, validateArticleSeo, validateMetaDescription, validateSeoTitle } from '../chunk-
|
|
1
|
+
export { FEED_DEFAULT_ITEMS, NEWS_SITEMAP_MAX_URLS, NEWS_SITEMAP_WINDOW_MS, SEO_LIMITS, buildNewsSitemapXml, cdata, generateAllArticleSchemas, generateArticleCategoryMetadata, generateArticleListSchema, generateArticleMetadata, generateArticleSchema, generateArticleSitemap, generateArticleStaticParams, generateAtomFeed, generateAuthorPageMetadata, generateAuthorStaticParams, generateBreadcrumbSchema, generateCategoryStaticParams, generateClusterArticleSchema, generateClusterBreadcrumbSchema, generateClusterItemListSchema, generateClusterLandingSchema, generateClusterPageMetadata, generateFaqSchema, generateHowToSchema, generateNewsSitemap, generatePublicationMetadata, generateRssFeed, getAllArticleSlugs, getAllArticles, getAllAuthorSlugs, getArticle, getArticleCategories, getAuthorBySlug, getAuthorPosts, getClusterNavigation, getPostsByCategory, getRelatedInsights, getTopicCluster, getTopicClusters, recentNewsPosts, requireArticle, sanitizeExcerpt, validateArticleSeo, validateMetaDescription, validateSeoTitle } from '../chunk-4Z3DI2EL.js';
|
|
2
|
+
export { articlePhotoCss, insertArticlePhotos } from '../chunk-2UO4HPGE.js';
|
|
2
3
|
export { articleTableCss, wrapArticleTables } from '../chunk-Y3INC4QJ.js';
|
|
3
4
|
export { authorEntityId, generateArticleAuthorNode, generateAuthorPersonSchema, generateAuthorSchema, resolveArticleArtwork, withArticleAuthorIdentity } from '../chunk-QXMIKDOL.js';
|
|
4
5
|
export { articleCategorySlug, createPublicationRoutes, resolveArticleUrl, resolvePublicationUrl } from '../chunk-WMVK77ND.js';
|
package/dist/articles/types.d.ts
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
* @sonordev/site-kit/articles - Type definitions
|
|
3
3
|
*/
|
|
4
4
|
import type { PublicationRoutingOptions } from './routes';
|
|
5
|
+
/** Public, approved photo snapshot. Planning briefs and private source metadata stay in Sonor. */
|
|
6
|
+
export interface ArticleEditorialPhoto {
|
|
7
|
+
url: string;
|
|
8
|
+
alt: string;
|
|
9
|
+
caption?: string;
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
placement: {
|
|
13
|
+
kind: 'after_intro';
|
|
14
|
+
} | {
|
|
15
|
+
kind: 'after_heading';
|
|
16
|
+
heading: string;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
5
19
|
export interface Article {
|
|
6
20
|
id: string;
|
|
7
21
|
project_id: string;
|
|
@@ -23,6 +37,8 @@ export interface Article {
|
|
|
23
37
|
/** Dedicated index frame from Sonor's atmosphere + content-stage renderer. */
|
|
24
38
|
index_image?: string;
|
|
25
39
|
index_image_alt?: string;
|
|
40
|
+
/** Supporting photos placed deliberately in the article body; optional on older APIs. */
|
|
41
|
+
editorial_photos?: ArticleEditorialPhoto[];
|
|
26
42
|
/** Author - can be string or object depending on API response */
|
|
27
43
|
author_id?: string;
|
|
28
44
|
author?: ArticleAuthor | string;
|
package/dist/chat/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
export { ChatWidget, DEFAULT_LAUNCHER_OFFSET_BOTTOM, EchoChat, chatLauncherStyles, isChatEnabled } from '../chunk-
|
|
3
|
-
export { SiteChat } from '../chunk-
|
|
2
|
+
export { ChatWidget, DEFAULT_LAUNCHER_OFFSET_BOTTOM, EchoChat, chatLauncherStyles, isChatEnabled } from '../chunk-CSTC6HZO.js';
|
|
3
|
+
export { SiteChat } from '../chunk-A3EU6HB5.js';
|
|
4
4
|
import '../chunk-6T6CQVNL.js';
|
|
5
5
|
import '../chunk-JE4A5S4F.js';
|
|
6
6
|
import '../chunk-27FISYK4.js';
|
|
7
|
-
import '../chunk-
|
|
7
|
+
import '../chunk-S6IGQYHW.js';
|
|
8
8
|
import '../chunk-Q6E4OPGG.js';
|
|
9
9
|
import '../chunk-5ROTTMBL.js';
|
|
10
10
|
import '../chunk-C2FZBUSS.js';
|
|
@@ -18,9 +18,9 @@ import '../chunk-GJWI74ZZ.js';
|
|
|
18
18
|
import '../chunk-CAH4Y4PY.js';
|
|
19
19
|
import '../chunk-EKBEOXTH.js';
|
|
20
20
|
import '../chunk-3G7YABRA.js';
|
|
21
|
-
import '../chunk-
|
|
22
|
-
import '../chunk-
|
|
23
|
-
import '../chunk-
|
|
21
|
+
import '../chunk-WPOFTCKL.js';
|
|
22
|
+
import '../chunk-F2VYN3QL.js';
|
|
23
|
+
import '../chunk-NWVB75ER.js';
|
|
24
24
|
import '../chunk-PKBMQBKP.js';
|
|
25
25
|
|
|
26
26
|
// src/chat/echo-config.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { writeLLMsTxtToPublic } from './chunk-
|
|
1
|
+
import { writeLLMsTxtToPublic } from './chunk-GC2QWXJ3.js';
|
|
2
2
|
import { getSiteConfig } from './chunk-Z22QVHT4.js';
|
|
3
3
|
import { buildFetch } from './chunk-UAYAJPEP.js';
|
|
4
4
|
import { findAppDirForDiscovery } from './chunk-ZEGVKVD5.js';
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
// src/articles/article-photos.ts
|
|
2
|
+
var voidElements = /* @__PURE__ */ new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr"]);
|
|
3
|
+
var rawElements = /* @__PURE__ */ new Set(["pre", "code", "script", "style", "textarea", "xmp", "template"]);
|
|
4
|
+
var excludedAncestors = /* @__PURE__ */ new Set(["figure", "table", "ul", "ol", "blockquote", "aside", "nav", "header", "footer"]);
|
|
5
|
+
var tags = () => /<!--[\s\S]*?(?:-->|$)|<\/?[a-z][\w:-]*(?=[\s/>])(?:[^"'<>]|"[^"]*"|'[^']*')*>/gi;
|
|
6
|
+
var escape = (value) => value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
7
|
+
function headingText(value) {
|
|
8
|
+
const entities = { amp: "&", lt: "<", gt: ">", quot: '"', apos: "'", nbsp: " ", rsquo: "\u2019", lsquo: "\u2018", ldquo: "\u201C", rdquo: "\u201D", ndash: "\u2013", mdash: "\u2014" };
|
|
9
|
+
return value.replace(/<!--[\s\S]*?-->/g, "").replace(tags(), "").replace(/&(#x[\da-f]+|#\d+|[a-z]+);/gi, (full, entity) => {
|
|
10
|
+
if (!entity.startsWith("#")) return entities[entity.toLowerCase()] ?? full;
|
|
11
|
+
const number = entity[1].toLowerCase() === "x" ? parseInt(entity.slice(2), 16) : parseInt(entity.slice(1), 10);
|
|
12
|
+
return number > 0 && number <= 1114111 ? String.fromCodePoint(number) : full;
|
|
13
|
+
}).replace(/\s+/g, " ").trim();
|
|
14
|
+
}
|
|
15
|
+
function photoUrl(value) {
|
|
16
|
+
if (typeof value !== "string" || value.length > 2e3 || /[\s\\]/.test(value)) return null;
|
|
17
|
+
try {
|
|
18
|
+
const url = new URL(value);
|
|
19
|
+
if (url.protocol !== "https:" || url.username || url.password || /\/Blog\/(Cards|Carousel)\//i.test(decodeURIComponent(url.pathname))) return null;
|
|
20
|
+
return url.href;
|
|
21
|
+
} catch {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function figure(photo, index) {
|
|
26
|
+
const url = photoUrl(photo.url);
|
|
27
|
+
if (!url || typeof photo.alt !== "string" || !photo.alt.trim() || photo.alt.length > 300) return null;
|
|
28
|
+
if (![photo.width, photo.height].every((n) => Number.isInteger(n) && n > 0 && n <= 2400)) return null;
|
|
29
|
+
const caption = typeof photo.caption === "string" && photo.caption.trim() ? `<figcaption>${escape(photo.caption.slice(0, 300))}</figcaption>` : "";
|
|
30
|
+
return `<figure class="sk-article-photo" data-sk-editorial-photo="${index}"><img src="${escape(url)}" alt="${escape(photo.alt)}" width="${photo.width}" height="${photo.height}" loading="lazy" decoding="async" style="display:block;max-width:100%;height:auto" />${caption}</figure>`;
|
|
31
|
+
}
|
|
32
|
+
function insertArticlePhotos(html, photos) {
|
|
33
|
+
if (!html || !Array.isArray(photos) || !photos.length) return html;
|
|
34
|
+
const pattern = tags();
|
|
35
|
+
const stack = [];
|
|
36
|
+
const headings = [];
|
|
37
|
+
const paragraphs = [];
|
|
38
|
+
const existing = /* @__PURE__ */ new Set();
|
|
39
|
+
const existingSlots = /* @__PURE__ */ new Set();
|
|
40
|
+
let token;
|
|
41
|
+
while (token = pattern.exec(html)) {
|
|
42
|
+
const tag = token[0];
|
|
43
|
+
if (tag.startsWith("<!--")) continue;
|
|
44
|
+
const name = /^<\/?([\w:-]+)/.exec(tag)[1].toLowerCase();
|
|
45
|
+
if (tag.startsWith("</")) {
|
|
46
|
+
const at = stack.map((frame2) => frame2.name).lastIndexOf(name);
|
|
47
|
+
if (at < 0) continue;
|
|
48
|
+
const frame = stack[at];
|
|
49
|
+
if (frame.eligible) {
|
|
50
|
+
if (/^h[1-6]$/.test(name)) headings.push({ text: headingText(html.slice(frame.inner, token.index)), start: frame.start, end: pattern.lastIndex, level: Number(name[1]) });
|
|
51
|
+
if (name === "p" && headingText(html.slice(frame.inner, token.index))) paragraphs.push({ start: frame.start, end: pattern.lastIndex });
|
|
52
|
+
}
|
|
53
|
+
stack.length = at;
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
if (rawElements.has(name)) {
|
|
57
|
+
const closing = new RegExp(`</${name}\\s*>`, "gi");
|
|
58
|
+
closing.lastIndex = pattern.lastIndex;
|
|
59
|
+
if (!closing.exec(html)) break;
|
|
60
|
+
pattern.lastIndex = closing.lastIndex;
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
const attrs = tag.replace(/^<[\w:-]+/, "").replace(/\/?>$/, "");
|
|
64
|
+
for (const match of attrs.matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/g)) {
|
|
65
|
+
const key = match[1].toLowerCase(), value = match[2] ?? match[3] ?? match[4] ?? "";
|
|
66
|
+
if (name === "img" && key === "src") existing.add(headingText(value));
|
|
67
|
+
if (name === "figure" && key === "data-sk-editorial-photo" && /^\d+$/.test(value)) existingSlots.add(Number(value));
|
|
68
|
+
}
|
|
69
|
+
if (voidElements.has(name) || /\/\s*>$/.test(tag)) continue;
|
|
70
|
+
stack.push({ name, start: token.index, inner: pattern.lastIndex, eligible: !stack.some((frame) => excludedAncestors.has(frame.name)) });
|
|
71
|
+
}
|
|
72
|
+
const additions = /* @__PURE__ */ new Map();
|
|
73
|
+
photos.slice(0, 8).forEach((photo, index) => {
|
|
74
|
+
if (!photo || existingSlots.has(index)) return;
|
|
75
|
+
const rendered = figure(photo, index);
|
|
76
|
+
const url = photoUrl(photo.url);
|
|
77
|
+
if (!rendered || !url || existing.has(url)) return;
|
|
78
|
+
let paragraph;
|
|
79
|
+
if (photo.placement?.kind === "after_intro") {
|
|
80
|
+
const firstSection = headings.find((heading) => heading.level > 1);
|
|
81
|
+
paragraph = paragraphs.find((p) => !firstSection || p.start < firstSection.start);
|
|
82
|
+
} else if (photo.placement?.kind === "after_heading" && typeof photo.placement.heading === "string") {
|
|
83
|
+
const expectedHeading = headingText(photo.placement.heading);
|
|
84
|
+
const matches = headings.filter((heading2) => heading2.text === expectedHeading);
|
|
85
|
+
if (matches.length !== 1) return;
|
|
86
|
+
const heading = matches[0];
|
|
87
|
+
const next = headings.find((item) => item.start > heading.start);
|
|
88
|
+
paragraph = paragraphs.find((p) => p.start >= heading.end && (!next || p.end < next.start));
|
|
89
|
+
}
|
|
90
|
+
if (!paragraph) return;
|
|
91
|
+
const images = additions.get(paragraph.end) || [];
|
|
92
|
+
images.push(rendered);
|
|
93
|
+
additions.set(paragraph.end, images);
|
|
94
|
+
existing.add(url);
|
|
95
|
+
});
|
|
96
|
+
let result = html;
|
|
97
|
+
for (const [offset, images] of [...additions].sort(([a], [b]) => b - a)) result = result.slice(0, offset) + images.join("") + result.slice(offset);
|
|
98
|
+
return result;
|
|
99
|
+
}
|
|
100
|
+
var articlePhotoCss = (
|
|
101
|
+
/* css */
|
|
102
|
+
`
|
|
103
|
+
.sk-article-photo { margin: 2em 0; max-width: 100%; }
|
|
104
|
+
.sk-article-photo img { display: block; width: 100%; max-width: 100%; height: auto; border-radius: var(--sk-radius, 0.75rem); }
|
|
105
|
+
.sk-article-photo figcaption { margin-top: 0.65em; color: var(--sk-text-secondary, inherit); font-size: 0.875em; line-height: 1.5; overflow-wrap: anywhere; }
|
|
106
|
+
`
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
export { articlePhotoCss, insertArticlePhotos };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { trackedFreshFetch } from './chunk-UAYAJPEP.js';
|
|
2
2
|
import { isNextControlFlow } from './chunk-C7TLGL3R.js';
|
|
3
3
|
import { monotonicMs } from './chunk-MH2DSGC6.js';
|
|
4
|
-
import { SITE_KIT_VERSION } from './chunk-
|
|
4
|
+
import { SITE_KIT_VERSION } from './chunk-NWVB75ER.js';
|
|
5
5
|
import 'server-only';
|
|
6
6
|
|
|
7
7
|
var MINT_PATH = "/api/public/site-token";
|