@jant/core 1.0.1 → 1.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.
Files changed (58) hide show
  1. package/dist/{app-Gt7_skt6.js → app-CKQ9PqAr.js} +791 -89
  2. package/dist/client/.vite/manifest.json +115 -75
  3. package/dist/client/_assets/chunks/{confirm-D7GrwsCN.js → confirm-CMe01lne.js} +1 -1
  4. package/dist/client/_assets/chunks/{create-editor-5Y49x7h5.js → create-editor-BQkrw8Ax.js} +4 -4
  5. package/dist/client/_assets/chunks/footnote-rail-B08scyhW.js +2 -0
  6. package/dist/client/_assets/chunks/{jant-locale-picker-DL6mIOT5.js → jant-locale-picker-2L4rkDaz.js} +1 -1
  7. package/dist/client/_assets/chunks/lit-Bw_voPoW.js +2 -0
  8. package/dist/client/_assets/chunks/preload-helper-Czpn1I53.js +1 -0
  9. package/dist/client/_assets/chunks/runtime-paths-y0_gHowM.js +1 -0
  10. package/dist/client/_assets/chunks/{settings-paths-h6RjIe3C.js → settings-paths-B0bNUaih.js} +1 -1
  11. package/dist/client/_assets/chunks/slug-format-CYmQE5ln.js +1 -0
  12. package/dist/client/_assets/chunks/{sortable-list-DWNKv782.js → sortable-list-t11Ma1Ek.js} +1 -1
  13. package/dist/client/_assets/chunks/{unsafe-html-B5ZEXaxg.js → unsafe-html-CWos3v6N.js} +1 -1
  14. package/dist/client/_assets/chunks/unsafe-svg-DZl-yjas.js +1 -0
  15. package/dist/client/_assets/client-B0-s9sqx.css +2 -0
  16. package/dist/client/_assets/client-Dp46QSht.js +354 -0
  17. package/dist/client/_assets/client-auth-CG55rWb5.js +859 -0
  18. package/dist/client/_assets/{client-compose-oxzPb3SS.js → client-compose-DkUTuavR.js} +261 -261
  19. package/dist/client/_assets/{client-manage-C1eDB1Rc.js → client-manage-DnYdQAhf.js} +176 -176
  20. package/dist/client/_assets/{client-settings-DIM44Zqh.js → client-settings-CHgsIqXJ.js} +166 -166
  21. package/dist/client/_assets/client-share-0DICJjAc.css +1 -0
  22. package/dist/client/_assets/client-share-C59mOLJ1.js +149 -0
  23. package/dist/index.js +1 -1
  24. package/dist/node.js +2 -2
  25. package/package.json +2 -1
  26. package/src/client/components/jant-post-menu.ts +80 -13
  27. package/src/client/components/jant-share-dialog.ts +422 -0
  28. package/src/client/components/jant-share-menu.ts +188 -0
  29. package/src/client/lazy-entries.ts +21 -1
  30. package/src/client/post-menu-shared.ts +100 -0
  31. package/src/client/share-capture.ts +443 -0
  32. package/src/client/share-launch.ts +133 -0
  33. package/src/client-share.ts +8 -0
  34. package/src/client.ts +1 -0
  35. package/src/lib/discover.ts +31 -0
  36. package/src/lib/share-card.ts +653 -0
  37. package/src/lib/version.ts +2 -0
  38. package/src/routes/auth/setup.tsx +37 -1
  39. package/src/routes/pages/partials.tsx +23 -0
  40. package/src/style-share.css +16 -0
  41. package/src/styles/components.css +14 -0
  42. package/src/styles/share.css +1103 -0
  43. package/src/styles/ui.css +6 -0
  44. package/src/ui/layouts/BaseLayout.tsx +7 -0
  45. package/src/ui/layouts/SiteLayout.tsx +1 -0
  46. package/src/ui/share/ShareCard.tsx +298 -0
  47. package/src/ui/shared/Icon.tsx +23 -3
  48. package/src/ui/shared/MediaGallery.tsx +12 -1
  49. package/src/ui/shared/PostFooter.tsx +20 -4
  50. package/src/ui/shared/icon-collector.ts +28 -0
  51. package/src/ui/shared/post-article-attributes.ts +3 -0
  52. package/dist/client/_assets/chunks/footnote-rail-BJwswtVQ.js +0 -1
  53. package/dist/client/_assets/chunks/lit-DW8VmJAT.js +0 -2
  54. package/dist/client/_assets/chunks/slug-format-Dsi0e9Xn.js +0 -1
  55. package/dist/client/_assets/chunks/unsafe-svg-DTZZEvLU.js +0 -2
  56. package/dist/client/_assets/client-BaqmpPQ-.css +0 -2
  57. package/dist/client/_assets/client-C6melOtG.js +0 -296
  58. package/dist/client/_assets/client-auth-Ccq8kSqq.js +0 -828
@@ -71,6 +71,7 @@ import { announceInBackground } from "../discover-announce.js";
71
71
  import {
72
72
  DISCOVER_LANGUAGES,
73
73
  discoverIntroRuns,
74
+ getAuthorGroupUrl,
74
75
  getDiscoverPageUrls,
75
76
  isDiscoverLanguage,
76
77
  resolveDiscoverMode,
@@ -179,14 +180,27 @@ const DISCOVER_LANGUAGE_EXPRESSION = `${JSON.stringify(DISCOVER_LANGUAGES)}.incl
179
180
  * first one — the directory's name links to the directory for anyone who wants
180
181
  * more. Where to find the setting again is left to the screen's footnote, which
181
182
  * says it once for every answer on it.
183
+ *
184
+ * On a Chinese screen the help line goes one sentence further than the
185
+ * settings page's, to the Jant author group — a Chinese-language WeChat group
186
+ * for people who write on Jant. It picks up the community the sentence before
187
+ * it names. The sentence is written in Chinese here rather than kept in the
188
+ * catalog, since no other locale has a version of it, and it is left out when
189
+ * there is no directory to find the group's page from.
182
190
  */
183
191
  const DiscoverField: FC<{
184
192
  copy: DiscoverCopy;
185
193
  /** The directory's pages, or null when this deployment announces to none. */
186
194
  pages: DiscoverPageUrls | null;
195
+ /**
196
+ * The author group's page, on Chinese screens with a directory; null
197
+ * everywhere else, and the help line then ends where the settings page's
198
+ * opening does.
199
+ */
200
+ authorGroupUrl: string | null;
187
201
  /** Whether the language the form opens with is one the directory lists. */
188
202
  shown: boolean;
189
- }> = ({ copy, pages, shown }) => {
203
+ }> = ({ copy, pages, authorGroupUrl, shown }) => {
190
204
  const runs = discoverIntroRuns(copy.about, copy, pages);
191
205
 
192
206
  return (
@@ -230,6 +244,20 @@ const DiscoverField: FC<{
230
244
  run.text
231
245
  ),
232
246
  )}
247
+ {authorGroupUrl ? (
248
+ <>
249
+ 你也可以选择加入
250
+ <a
251
+ href={authorGroupUrl}
252
+ target="_blank"
253
+ rel="noopener noreferrer"
254
+ class="underline hover:text-foreground transition-colors"
255
+ >
256
+ Jant 作者群
257
+ </a>
258
+ 。
259
+ </>
260
+ ) : null}
233
261
  </p>
234
262
  </div>
235
263
  );
@@ -454,6 +482,11 @@ export type SetupContentProps = {
454
482
  * deployment announces to no directory, and the line is then plain text.
455
483
  */
456
484
  discoverPages: DiscoverPageUrls | null;
485
+ /**
486
+ * The Jant author group's page, linked from the help line on Chinese
487
+ * screens. Null when this deployment announces to no directory.
488
+ */
489
+ authorGroupUrl: string | null;
457
490
  }
458
491
  );
459
492
 
@@ -489,6 +522,7 @@ export const SetupContent: FC<SetupContentProps> = (props) => {
489
522
  discoverAvailable,
490
523
  discoverDefault,
491
524
  discoverPages,
525
+ authorGroupUrl,
492
526
  } = props;
493
527
 
494
528
  const searchLabel = i18n._(
@@ -511,6 +545,7 @@ export const SetupContent: FC<SetupContentProps> = (props) => {
511
545
  <DiscoverField
512
546
  copy={getDiscoverCopy(i18n)}
513
547
  pages={discoverPages}
548
+ authorGroupUrl={i18n.locale === "zh-Hans" ? authorGroupUrl : null}
514
549
  shown={isDiscoverLanguage(contentLanguage)}
515
550
  />
516
551
  ) : null;
@@ -779,6 +814,7 @@ setupRoutes.get("/setup", async (c) => {
779
814
  // configuration, so this screen can never point at one directory while
780
815
  // the site announces to another.
781
816
  discoverPages={getDiscoverPageUrls(getDiscoverDirectoryBaseUrl(c.env))}
817
+ authorGroupUrl={getAuthorGroupUrl(getDiscoverDirectoryBaseUrl(c.env))}
782
818
  contentLanguage={
783
819
  // On a named site the control plane's guess is already stored, so
784
820
  // offering it back is offering the site's current language. On an
@@ -6,7 +6,10 @@ import {
6
6
  assemblePostCardView,
7
7
  assemblePostPageDisplay,
8
8
  } from "../../lib/post-display.js";
9
+ import { assembleShareCard } from "../../lib/share-card.js";
9
10
  import { assembleTimelineItem } from "../../lib/timeline.js";
11
+ import { ShareCard } from "../../ui/share/ShareCard.js";
12
+ import { renderIconsInline } from "../../ui/shared/icon-collector.js";
10
13
  import { TimelineFeedItemContent } from "../../ui/feed/TimelineFeed.js";
11
14
  import { TimelineItemFromPost } from "../../ui/feed/TimelineItem.js";
12
15
  import { PostPage } from "../../ui/pages/PostPage.js";
@@ -134,6 +137,26 @@ partialPageRoutes.get("/_/post-preview/:postId", async (c) => {
134
137
  );
135
138
  });
136
139
 
140
+ /**
141
+ * The card "Share as image" captures, for the author and readers alike: it
142
+ * shows only what the post's own address already does, and
143
+ * `assembleShareCard` refuses drafts and Private posts. Icons are drawn
144
+ * inline because the capture copies the card without the page's icon sprite.
145
+ */
146
+ partialPageRoutes.get("/_/share-card/:postId", async (c) => {
147
+ const postId = parseIdParam(c.req.param("postId"), ID_PREFIX.post);
148
+ const card = await assembleShareCard(c, postId);
149
+ if (!card) return c.notFound();
150
+ const html = renderIconsInline(() =>
151
+ (
152
+ <I18nProvider c={c}>
153
+ <ShareCard card={card} />
154
+ </I18nProvider>
155
+ ).toString(),
156
+ );
157
+ return c.html(html);
158
+ });
159
+
137
160
  partialPageRoutes.get("/_/post-view/:postId", async (c) => {
138
161
  const postId = parseIdParam(c.req.param("postId"), ID_PREFIX.post);
139
162
  const display = await assemblePostPageDisplay(c, postId, {
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Share stylesheet: the "Share as image" dialog and the card it captures.
3
+ *
4
+ * Linked on demand by `client/share-launch.ts`, never from the page head:
5
+ * `<html data-share-stylesheet>` names it, and a post menu that offers
6
+ * sharing loads it when it opens.
7
+ *
8
+ * Like `style-author.css`, no `@import "tailwindcss"`: `client.css` is
9
+ * already on the page with the layers and every design token these rules
10
+ * reference. The layer order below is the one `client.css` establishes, so
11
+ * `@layer components` here joins the existing components layer.
12
+ */
13
+
14
+ @layer properties, theme, base, components, utilities;
15
+
16
+ @import "./styles/share.css";
@@ -70,6 +70,20 @@ svg[stroke-width].icon-fine {
70
70
  top: 1rem;
71
71
  right: 1rem;
72
72
  }
73
+
74
+ /* While a modal dialog is open, toast.ts mounts the container inside
75
+ it, where BaseCoat's `.dialog > *` styles it as the dialog's panel:
76
+ full width, translated to the centre, shadowed. */
77
+ .dialog > & {
78
+ width: auto;
79
+ max-width: none;
80
+ max-height: none;
81
+ translate: none;
82
+ scale: none;
83
+ border-radius: 0;
84
+ box-shadow: none;
85
+ transition: none;
86
+ }
73
87
  }
74
88
 
75
89
  .toast {