@tunasand/sdk 0.7.0 → 0.11.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 (285) hide show
  1. package/CHANGELOG.md +233 -88
  2. package/README.md +296 -273
  3. package/dist/analytics.js +657 -10
  4. package/dist/app.js +323 -96
  5. package/dist/apps-DIxAWBSZ.js +318 -0
  6. package/dist/astro-image.d.ts +1 -0
  7. package/dist/astro-image.js +33 -0
  8. package/dist/astro-server-Bwau8F6d.js +99 -0
  9. package/dist/astro-server.d.ts +1 -0
  10. package/dist/astro-server.js +1 -0
  11. package/dist/astro.d.ts +1 -0
  12. package/dist/astro.js +306 -0
  13. package/dist/bridge-Dv4NxGZ7.js +81 -0
  14. package/dist/bridge.js +2 -14
  15. package/dist/build-file-DNi0PHC5.js +31 -0
  16. package/dist/cli.js +6214 -9
  17. package/dist/{client-Derrexwr.js → client-C8STAw9T.js} +43 -24
  18. package/dist/code-N8pBUDbq.js +30 -0
  19. package/dist/code.d.ts +1 -0
  20. package/dist/code.js +1 -0
  21. package/dist/collection-nUz1RetA.js +264 -0
  22. package/dist/{declared-C_GvPiGF.js → declared-CE4a61qb.js} +124 -36
  23. package/dist/delivery.js +124 -132
  24. package/dist/dev-operations-Tutwi1On.js +46 -0
  25. package/dist/dev.js +9 -16
  26. package/dist/embeds-B-Dbn64k.js +29 -0
  27. package/dist/end-users.d.ts +1 -0
  28. package/dist/end-users.js +185 -0
  29. package/dist/{customers-C_vJY2_v.js → endUsers-DODfjnv1.js} +31 -38
  30. package/dist/{errorLabels-CPKiPabZ.js → errorLabels-aT2bnMsO.js} +593 -460
  31. package/dist/i18n.js +4 -4
  32. package/dist/ids-DmtIoqBX.js +109 -0
  33. package/dist/integrations.js +95 -49
  34. package/dist/{ja-C6lX0CeJ.js → ja-CrY_72Tn.js} +99 -54
  35. package/dist/{ja-C1HEWWTQ.js → ja-axQPxMJ-.js} +6 -6
  36. package/dist/operations-CIB99rIY.js +95 -0
  37. package/dist/operations.d.ts +1 -0
  38. package/dist/operations.js +1 -0
  39. package/dist/{page-E_cYgZx-.js → page-yo1cw1kW.js} +5 -5
  40. package/dist/preview.js +8 -1
  41. package/dist/{profile-D6t1QMQh.js → profile-DBsXLvvI.js} +52 -52
  42. package/dist/rich-text.d.ts +1 -0
  43. package/dist/{body.js → rich-text.js} +20 -21
  44. package/dist/schema-Dcg1ajnW.js +1267 -0
  45. package/dist/schema.js +324 -1
  46. package/dist/types/access/src/handoff.d.ts +22 -17
  47. package/dist/types/access/src/index.d.ts +2 -2
  48. package/dist/types/access/src/jws.d.ts +41 -0
  49. package/dist/types/access/src/jwt.d.ts +1 -1
  50. package/dist/types/access/src/oidc.d.ts +11 -3
  51. package/dist/types/access/src/signed.d.ts +0 -2
  52. package/dist/types/adapter-cloudflare/src/eventLog/viewSchema.d.ts +11 -0
  53. package/dist/types/contract/src/accountProfile.d.ts +7 -0
  54. package/dist/types/{cms-contract → contract}/src/apiKeys.d.ts +7 -3
  55. package/dist/types/contract/src/app.d.ts +38 -0
  56. package/dist/types/contract/src/appChannels.d.ts +114 -0
  57. package/dist/types/contract/src/appDefinition.d.ts +133 -0
  58. package/dist/types/{cms-contract → contract}/src/appDependencies.d.ts +91 -35
  59. package/dist/types/contract/src/appIdentities.d.ts +21 -0
  60. package/dist/types/contract/src/appInbound.d.ts +28 -0
  61. package/dist/types/contract/src/appMail.d.ts +106 -0
  62. package/dist/types/contract/src/appSecrets.d.ts +45 -0
  63. package/dist/types/contract/src/appServer.d.ts +501 -0
  64. package/dist/types/contract/src/approvalLabels.d.ts +26 -0
  65. package/dist/types/contract/src/approvals.d.ts +63 -0
  66. package/dist/types/contract/src/apps.d.ts +295 -0
  67. package/dist/types/contract/src/auditActions.d.ts +18 -0
  68. package/dist/types/contract/src/auditLabels.d.ts +223 -0
  69. package/dist/types/contract/src/authorize.d.ts +133 -0
  70. package/dist/types/{cms-contract → contract}/src/bridge.d.ts +39 -40
  71. package/dist/types/{cms-contract → contract}/src/consents.d.ts +32 -25
  72. package/dist/types/contract/src/deletion.d.ts +18 -0
  73. package/dist/types/contract/src/embeds.d.ts +105 -0
  74. package/dist/types/{cms-contract/src/customerLabels.d.ts → contract/src/endUserLabels.d.ts} +6 -9
  75. package/dist/types/contract/src/endUsers.d.ts +241 -0
  76. package/dist/types/{cms-contract → contract}/src/errorLabels.d.ts +76 -47
  77. package/dist/types/{cms-contract → contract}/src/errorLabelsEn.d.ts +52 -36
  78. package/dist/types/contract/src/errors.d.ts +117 -0
  79. package/dist/types/contract/src/eventSchemas.d.ts +70 -0
  80. package/dist/types/contract/src/eventTraces.d.ts +43 -0
  81. package/dist/types/{cms-contract → contract}/src/failureStatus.d.ts +16 -23
  82. package/dist/types/contract/src/fieldAccess.d.ts +45 -0
  83. package/dist/types/contract/src/fieldRules.d.ts +41 -0
  84. package/dist/types/{cms-contract/src/assets.d.ts → contract/src/files.d.ts} +5 -5
  85. package/dist/types/contract/src/formLabels.d.ts +3 -0
  86. package/dist/types/contract/src/forms.d.ts +4 -0
  87. package/dist/types/{cms-contract → contract}/src/functions.d.ts +3 -3
  88. package/dist/types/contract/src/grants.d.ts +26 -0
  89. package/dist/types/contract/src/headers.d.ts +5 -0
  90. package/dist/types/contract/src/hostingRpc.d.ts +149 -0
  91. package/dist/types/contract/src/hostnames.d.ts +30 -0
  92. package/dist/types/contract/src/identifiers.d.ts +148 -0
  93. package/dist/types/contract/src/ids.d.ts +112 -0
  94. package/dist/types/{cms-contract → contract}/src/import.d.ts +20 -19
  95. package/dist/types/contract/src/importLabels.d.ts +3 -0
  96. package/dist/types/contract/src/index.d.ts +92 -0
  97. package/dist/types/contract/src/integrationGraph.d.ts +83 -0
  98. package/dist/types/{cms-contract → contract}/src/issueLabels.d.ts +135 -99
  99. package/dist/types/{cms-contract → contract}/src/issueLabelsEn.d.ts +70 -52
  100. package/dist/types/contract/src/labels.d.ts +11 -0
  101. package/dist/types/contract/src/legacyAuditLabels.d.ts +10 -0
  102. package/dist/types/contract/src/livePeriods.d.ts +18 -0
  103. package/dist/types/contract/src/manage.d.ts +51 -0
  104. package/dist/types/contract/src/manageLabels.d.ts +11 -0
  105. package/dist/types/contract/src/manifestText.d.ts +66 -0
  106. package/dist/types/contract/src/mcpAuth.d.ts +139 -0
  107. package/dist/types/contract/src/mcpLabels.d.ts +5 -0
  108. package/dist/types/contract/src/messagePort.d.ts +208 -0
  109. package/dist/types/{cms-contract → contract}/src/migration.d.ts +3 -3
  110. package/dist/types/contract/src/notices.d.ts +38 -0
  111. package/dist/types/contract/src/operatorOperations.d.ts +640 -0
  112. package/dist/types/contract/src/operators.d.ts +33 -0
  113. package/dist/types/contract/src/outbound.d.ts +29 -0
  114. package/dist/types/contract/src/paths.d.ts +34 -0
  115. package/dist/types/contract/src/pending.d.ts +6 -0
  116. package/dist/types/{cms-contract → contract}/src/permissions.d.ts +9 -11
  117. package/dist/types/contract/src/perspective.d.ts +26 -0
  118. package/dist/types/contract/src/powers.d.ts +5 -0
  119. package/dist/types/contract/src/principal.d.ts +181 -0
  120. package/dist/types/{cms-contract → contract}/src/problems.d.ts +4 -4
  121. package/dist/types/contract/src/projectRole.d.ts +6 -0
  122. package/dist/types/contract/src/recordLabels.d.ts +6 -0
  123. package/dist/types/{cms-contract → contract}/src/roles.d.ts +10 -6
  124. package/dist/types/contract/src/ruleLabels.d.ts +16 -0
  125. package/dist/types/contract/src/ruleProblems.d.ts +16 -0
  126. package/dist/types/contract/src/schemaLabels.d.ts +8 -0
  127. package/dist/types/{cms-contract → contract}/src/settingProblems.d.ts +3 -3
  128. package/dist/types/{cms-contract → contract}/src/settings.d.ts +6 -8
  129. package/dist/types/contract/src/settingsLabels.d.ts +3 -0
  130. package/dist/types/{cms-contract → contract}/src/siteDeclaration.d.ts +7 -7
  131. package/dist/types/contract/src/siteIndex.d.ts +76 -0
  132. package/dist/types/contract/src/slugs.d.ts +6 -0
  133. package/dist/types/{cms-contract → contract}/src/transfer.d.ts +4 -4
  134. package/dist/types/contract/src/trial.d.ts +13 -0
  135. package/dist/types/contract/src/versions.d.ts +7 -0
  136. package/dist/types/{analytics/src/view.d.ts → contract/src/viewEvent.d.ts} +0 -9
  137. package/dist/types/contract/src/webhooks.d.ts +135 -0
  138. package/dist/types/contract/src/workflow.d.ts +43 -0
  139. package/dist/types/contract/src/workspaceItems.d.ts +87 -0
  140. package/dist/types/contract/src/workspacePaths.d.ts +4 -0
  141. package/dist/types/{body → rich-text}/src/declared.d.ts +2 -2
  142. package/dist/types/{body → rich-text}/src/embed.d.ts +1 -1
  143. package/dist/types/{body → rich-text}/src/html.d.ts +1 -1
  144. package/dist/types/{body → rich-text}/src/index.d.ts +8 -7
  145. package/dist/types/{body → rich-text}/src/labels/en.d.ts +1 -1
  146. package/dist/types/{body → rich-text}/src/labels/ja.d.ts +4 -4
  147. package/dist/types/{body → rich-text}/src/library.d.ts +1 -1
  148. package/dist/types/rich-text/src/media.d.ts +2 -0
  149. package/dist/types/{body → rich-text}/src/normalize.d.ts +1 -1
  150. package/dist/types/{body → rich-text}/src/problems.d.ts +5 -5
  151. package/dist/types/{body → rich-text}/src/profile.d.ts +11 -11
  152. package/dist/types/{body → rich-text}/src/render.d.ts +1 -1
  153. package/dist/types/{body → rich-text}/src/schema.d.ts +2 -2
  154. package/dist/types/{body → rich-text}/src/standard.d.ts +4 -4
  155. package/dist/types/{body → rich-text}/src/types.d.ts +2 -2
  156. package/dist/types/schema/src/audience.d.ts +36 -0
  157. package/dist/types/schema/src/brand.d.ts +5 -0
  158. package/dist/types/schema/src/capabilities.d.ts +19 -0
  159. package/dist/types/{model → schema}/src/changes.d.ts +9 -7
  160. package/dist/types/{model → schema}/src/check.d.ts +2 -2
  161. package/dist/types/{model/src/model.d.ts → schema/src/collection.d.ts} +150 -121
  162. package/dist/types/schema/src/defaultSchema.d.ts +15 -0
  163. package/dist/types/schema/src/fieldIds.d.ts +18 -0
  164. package/dist/types/{model/src/asset.d.ts → schema/src/file.d.ts} +36 -25
  165. package/dist/types/schema/src/fileRefs.d.ts +14 -0
  166. package/dist/types/schema/src/fileSignature.d.ts +20 -0
  167. package/dist/types/schema/src/filesCollection.d.ts +7 -0
  168. package/dist/types/schema/src/forms.d.ts +43 -0
  169. package/dist/types/{model → schema}/src/image.d.ts +3 -3
  170. package/dist/types/schema/src/imageMetadata.d.ts +9 -0
  171. package/dist/types/schema/src/index.d.ts +35 -0
  172. package/dist/types/{model → schema}/src/input.d.ts +3 -3
  173. package/dist/types/{model → schema}/src/integrity.d.ts +9 -8
  174. package/dist/types/schema/src/kinds.d.ts +26 -0
  175. package/dist/types/{model → schema}/src/labels/en.d.ts +93 -51
  176. package/dist/types/{model → schema}/src/labels/ja.d.ts +97 -52
  177. package/dist/types/schema/src/mediaUrl.d.ts +60 -0
  178. package/dist/types/{model → schema}/src/page.d.ts +6 -6
  179. package/dist/types/{model → schema}/src/problems.d.ts +95 -53
  180. package/dist/types/{model → schema}/src/refs.d.ts +1 -10
  181. package/dist/types/{model → schema}/src/rules.d.ts +2 -2
  182. package/dist/types/{model → schema}/src/schema.d.ts +25 -20
  183. package/dist/types/schema/src/selfOps.d.ts +31 -0
  184. package/dist/types/{model/src/capabilities.d.ts → schema/src/traits.d.ts} +6 -6
  185. package/dist/types/schema/src/typesSource.d.ts +16 -0
  186. package/dist/types/{model → schema}/src/values.d.ts +7 -4
  187. package/dist/types/schema/src/widening.d.ts +3 -0
  188. package/dist/types/sdk/src/analytics.d.ts +3 -2
  189. package/dist/types/sdk/src/app.d.ts +70 -16
  190. package/dist/types/sdk/src/astro-image.d.ts +19 -0
  191. package/dist/types/sdk/src/astro-response.d.ts +6 -0
  192. package/dist/types/sdk/src/astro-server.d.ts +16 -0
  193. package/dist/types/sdk/src/astro.d.ts +19 -0
  194. package/dist/types/sdk/src/bridge.d.ts +13 -15
  195. package/dist/types/sdk/src/code.d.ts +61 -0
  196. package/dist/types/sdk/src/delegation.d.ts +49 -0
  197. package/dist/types/sdk/src/delivery/changes.d.ts +4 -4
  198. package/dist/types/sdk/src/delivery/client.d.ts +40 -28
  199. package/dist/types/sdk/src/delivery/fields.d.ts +5 -5
  200. package/dist/types/sdk/src/delivery/index.d.ts +3 -3
  201. package/dist/types/sdk/src/delivery/media.d.ts +8 -11
  202. package/dist/types/sdk/src/delivery/query.d.ts +16 -12
  203. package/dist/types/sdk/src/delivery/schema.d.ts +5 -5
  204. package/dist/types/sdk/src/delivery/values.d.ts +16 -20
  205. package/dist/types/sdk/src/delivery.d.ts +3 -3
  206. package/dist/types/sdk/src/dev-operations.d.ts +20 -0
  207. package/dist/types/sdk/src/dev.d.ts +6 -5
  208. package/dist/types/sdk/src/end-users.d.ts +190 -0
  209. package/dist/types/sdk/src/i18n.d.ts +11 -11
  210. package/dist/types/sdk/src/integrations.d.ts +20 -27
  211. package/dist/types/sdk/src/operations.d.ts +17 -0
  212. package/dist/types/sdk/src/preview.d.ts +2 -1
  213. package/dist/types/sdk/src/rich-text.d.ts +2 -0
  214. package/dist/types/sdk/src/schema.d.ts +5 -21
  215. package/dist/types/sdk/src/site/artifact.d.ts +64 -0
  216. package/dist/types/sdk/src/site/build-file.d.ts +30 -0
  217. package/dist/types/sdk/src/site/check-code.d.ts +14 -0
  218. package/dist/types/sdk/src/site/check-text.d.ts +19 -0
  219. package/dist/types/sdk/src/site/cli.d.ts +52 -0
  220. package/dist/types/sdk/src/site/content-type.d.ts +2 -0
  221. package/dist/types/sdk/src/site/labels.d.ts +14 -0
  222. package/dist/types/sdk/src/site.d.ts +1 -1
  223. package/dist/types/sdk/src/types.d.ts +21 -0
  224. package/dist/{schema-BPHL7Qr-.js → types-DkO2N7u2.js} +9 -9
  225. package/dist/types.d.ts +1 -0
  226. package/dist/types.js +1 -0
  227. package/dist/typesSource-VJIxtN9b.js +136 -0
  228. package/dist/workflow-CUpl6hO_.js +148 -0
  229. package/package.json +42 -16
  230. package/dist/apps-9u4XMi7E.js +0 -114
  231. package/dist/body.d.ts +0 -1
  232. package/dist/bridge-DYAYGV7t.js +0 -74
  233. package/dist/customers.d.ts +0 -1
  234. package/dist/customers.js +0 -185
  235. package/dist/embed-R-OvDYAw.js +0 -90
  236. package/dist/model-pmXzGX12.js +0 -152
  237. package/dist/model.d.ts +0 -1
  238. package/dist/model.js +0 -345
  239. package/dist/schema-UQJWRyfJ.js +0 -995
  240. package/dist/src-sazhzYui.js +0 -71
  241. package/dist/types/analytics/src/index.d.ts +0 -5
  242. package/dist/types/analytics/src/schedule.d.ts +0 -2
  243. package/dist/types/analytics/src/shared.d.ts +0 -21
  244. package/dist/types/analytics/src/source.d.ts +0 -19
  245. package/dist/types/analytics/src/store.d.ts +0 -24
  246. package/dist/types/cms-contract/src/app.d.ts +0 -35
  247. package/dist/types/cms-contract/src/apps.d.ts +0 -195
  248. package/dist/types/cms-contract/src/authorize.d.ts +0 -146
  249. package/dist/types/cms-contract/src/customers.d.ts +0 -266
  250. package/dist/types/cms-contract/src/embeds.d.ts +0 -165
  251. package/dist/types/cms-contract/src/errors.d.ts +0 -105
  252. package/dist/types/cms-contract/src/identifiers.d.ts +0 -117
  253. package/dist/types/cms-contract/src/paths.d.ts +0 -23
  254. package/dist/types/cms-contract/src/urlLabel.d.ts +0 -13
  255. package/dist/types/cms-contract/src/webhooks.d.ts +0 -139
  256. package/dist/types/model/src/audience.d.ts +0 -38
  257. package/dist/types/model/src/brand.d.ts +0 -25
  258. package/dist/types/model/src/index.d.ts +0 -26
  259. package/dist/types/model/src/legacy.d.ts +0 -2
  260. package/dist/types/model/src/media.d.ts +0 -5
  261. package/dist/types/model/src/mediaUrl.d.ts +0 -67
  262. package/dist/types/model/src/selfOps.d.ts +0 -30
  263. package/dist/types/model/src/typesSource.d.ts +0 -8
  264. package/dist/types/platform/src/defaultModel.d.ts +0 -8
  265. package/dist/types/sdk/src/body.d.ts +0 -2
  266. package/dist/types/sdk/src/customers.d.ts +0 -190
  267. package/dist/types/sdk/src/model.d.ts +0 -5
  268. package/dist/typesSource-bO0jFw1I.js +0 -88
  269. /package/dist/types/{cms-contract → contract}/src/appProblems.d.ts +0 -0
  270. /package/dist/types/{analytics → contract}/src/day.d.ts +0 -0
  271. /package/dist/types/{cms-contract → contract}/src/functionLabels.d.ts +0 -0
  272. /package/dist/types/{cms-contract → contract}/src/permissionLabels.d.ts +0 -0
  273. /package/dist/types/{cms-contract → contract}/src/siteArtifact.d.ts +0 -0
  274. /package/dist/types/{cms-contract → contract}/src/views.d.ts +0 -0
  275. /package/dist/types/{cms-contract → contract}/src/webhookLabels.d.ts +0 -0
  276. /package/dist/types/{body → rich-text}/src/components.d.ts +0 -0
  277. /package/dist/types/{body → rich-text}/src/derive.d.ts +0 -0
  278. /package/dist/types/{body → rich-text}/src/description.d.ts +0 -0
  279. /package/dist/types/{body → rich-text}/src/href.d.ts +0 -0
  280. /package/dist/types/{body → rich-text}/src/inline.d.ts +0 -0
  281. /package/dist/types/{body → rich-text}/src/markdown.d.ts +0 -0
  282. /package/dist/types/{model → schema}/src/contact.d.ts +0 -0
  283. /package/dist/types/{model → schema}/src/json.d.ts +0 -0
  284. /package/dist/types/{model → schema}/src/screens.d.ts +0 -0
  285. /package/dist/types/{model → schema}/src/time.d.ts +0 -0
@@ -69,7 +69,7 @@ const translatorOf = (messages, locale) => createTranslator({
69
69
  function formatMessage(message, params = {}, locale = chooseLocale()) {
70
70
  return translatorOf({ m: message }, locale)("m", params);
71
71
  }
72
- // ../body/src/labels/ja.ts
72
+ // ../rich-text/src/labels/ja.ts
73
73
  const MARK = "{mark, select, strong {太字} em {斜体} code {コード} strike {取り消し線} mark {蛍光ペン} sup {上付き} sub {下付き} other {下線}}";
74
74
  const STYLE = "{kind, select, color {文字の色} background {背景の色} other {文字の大きさ}}";
75
75
  const WHERE = "{where, select, paragraph {文} heading {見出し} list {リスト} quote {引用} figure {figure} caption {キャプション} other {セル}}";
@@ -170,7 +170,7 @@ const DROPPED = {
170
170
  drop_table_element: "表の中の要素 {name}"
171
171
  };
172
172
  /** 本文の検査の問題の文 */
173
- const BODY_PROBLEM_MESSAGES = {
173
+ const RICH_TEXT_PROBLEM_MESSAGES = {
174
174
  ...PROFILE,
175
175
  ...COMPONENT,
176
176
  ...DROPPED
@@ -203,7 +203,7 @@ const BODY_GUIDE_LABELS = {
203
203
  markSyntax: `{mark, select, strong {**太字**} em {*斜体*} code {\`コード\`} strike {~~取り消し線~~} mark {:mark[蛍光ペン]} sup {:sup[上付き]} sub {:sub[下付き]} other {:u[下線]}}`,
204
204
  styleValue: "{key}=\"CSS の値\"",
205
205
  styleNames: "styles=\"{names}\" のどれか(空白で区切る)",
206
- textStyle: "- 文字の見た目: :span[文字]'{'属性'}'(属性: {attrs})",
206
+ text_style: "- 文字の見た目: :span[文字]'{'属性'}'(属性: {attrs})",
207
207
  link: "- リンク: [文字](https://…){rels, select, none {} other {、rel つきは :link[文字]'{'href=\"https://…\" rel={rels}'}'}}{target, select, yes {、別のタブは :link[文字]'{'href=\"https://…\" target=_blank'}'} other {}}{combine, select, no {(装飾つきは不可)} other {}}",
208
208
  component: "- {inline, select, yes {インラインの} other {}}コンポーネント {name}: {description}",
209
209
  componentExample: " 例: {example}",
@@ -214,7 +214,7 @@ const BODY_GUIDE_LABELS = {
214
214
  separator: "・",
215
215
  listSeparator: "、"
216
216
  };
217
- /** 核の部品の説明と例(library.ts、書き手と AI への説明と管理画面の部品の一覧) */
217
+ /** 核の部品の説明と例(library.ts、書き手と AI への説明とワークスペースの部品の一覧) */
218
218
  const CORE_COMPONENT_LABELS = {
219
219
  citeDescription: "注(参考資料の ID を参照、参考資料はコンテンツに結び付けが必要)",
220
220
  citeExample: ":cite'{'#出典の ID'}'",
@@ -227,7 +227,7 @@ const CORE_COMPONENT_LABELS = {
227
227
  diagramDescription: "図(中は Mermaid、alt は図の内容の説明、caption は必須)",
228
228
  diagramExample: ":::diagram'{'alt=\"内容の説明\" caption=\"説明\"'}'\n```mermaid\nflowchart LR\n A --> B\n```\n:::",
229
229
  galleryDescription: "複数の画像を2列で配置(画像は2枚以上)",
230
- galleryExample: ":::gallery\n![](asset/'<'画像の ID'>' \"説明\")\n\n![](asset/'<'画像の ID'>' \"説明\")\n:::",
230
+ galleryExample: ":::gallery\n![](file/'<'画像の ID'>' \"説明\")\n\n![](file/'<'画像の ID'>' \"説明\")\n:::",
231
231
  linkCardDescription: "リンクのカード(外のページは https と題名、site・desc・画像は任意。中のコンテンツは ref=\"コレクションの id/レコードの ID\")",
232
232
  linkCardExample: ":::link-card'{'href=\"https://…\" title=\"ページの題\" site=\"サイト名\" desc=\"説明\"'}'\n:::",
233
233
  embedDescription: "外のサービスの埋め込み(provider は {providers}、id はサービスの中の ID、url は元の URL、start は開始の秒)",
@@ -238,4 +238,4 @@ const CORE_COMPONENT_LABELS = {
238
238
  declaredInlineText: "文字",
239
239
  declaredJoin: "。"
240
240
  };
241
- export { LOCALES as a, formatMessage as c, problemOf as d, problemText as f, BASE_LOCALE as i, problemFactory as l, BODY_PROBLEM_MESSAGES as n, chooseLocale as o, problemTextFactory as p, CORE_COMPONENT_LABELS as r, createTranslator$1 as s, BODY_GUIDE_LABELS as t, problemMessage as u };
241
+ export { LOCALES as a, formatMessage as c, problemOf as d, problemText as f, BASE_LOCALE as i, problemFactory as l, CORE_COMPONENT_LABELS as n, chooseLocale as o, problemTextFactory as p, RICH_TEXT_PROBLEM_MESSAGES as r, createTranslator$1 as s, BODY_GUIDE_LABELS as t, problemMessage as u };
@@ -0,0 +1,95 @@
1
+ import { AsyncLocalStorage } from "node:async_hooks";
2
+ // src/operations.ts
3
+ const KEY = Symbol.for("tunasand.operations");
4
+ const shared = globalThis;
5
+ const scopes = shared[KEY] ??= new AsyncLocalStorage();
6
+ const closed = () => Object.assign(/* @__PURE__ */ new Error("closed"), {
7
+ name: "OperationError",
8
+ code: "closed"
9
+ });
10
+ /** 終わった呼び出しの操作を拒む(先に取り出した値でも使えない) */
11
+ const openOf = (scope) => {
12
+ if (!scope.operations) throw closed();
13
+ return scope.operations;
14
+ };
15
+ const guarded = (scope) => Object.freeze({
16
+ call: async (name, input) => openOf(scope).call(name, input),
17
+ open: async (name, input) => openOf(scope).open(name, input),
18
+ fetch: async (input, init) => openOf(scope).fetch(input, init),
19
+ log: async (level, message) => openOf(scope).log(level, message)
20
+ });
21
+ /**
22
+ * 処理している呼び出しの操作
23
+ * @throws Error `operations_outside_call`(処理の外)、OperationError `closed`(呼び出しの終わりの後)
24
+ */
25
+ function operations() {
26
+ const scope = scopes.getStore();
27
+ if (!scope) throw new Error("operations_outside_call");
28
+ openOf(scope);
29
+ return guarded(scope);
30
+ }
31
+ /** 本文の終わり、打ち切り、失敗のどれかで1回だけ end を呼ぶ応答(本文のない応答はすぐに呼ぶ) */
32
+ function endingResponse(response, end) {
33
+ if (!response.body) {
34
+ end();
35
+ return response;
36
+ }
37
+ const reader = response.body.getReader();
38
+ const body = new ReadableStream({
39
+ async pull(controller) {
40
+ try {
41
+ const { done, value } = await reader.read();
42
+ if (!done) return controller.enqueue(value);
43
+ end();
44
+ controller.close();
45
+ } catch (e) {
46
+ end();
47
+ controller.error(e);
48
+ }
49
+ },
50
+ async cancel(reason) {
51
+ end();
52
+ await reader.cancel(reason);
53
+ }
54
+ }, { highWaterMark: 0 });
55
+ return new Response(body, {
56
+ status: response.status,
57
+ statusText: response.statusText,
58
+ headers: response.headers
59
+ });
60
+ }
61
+ /** given を、work とその中の非同期の処理の `operations()` にする(応答の本文の終わりに閉じる) */
62
+ async function provideOperations(given, work) {
63
+ const scope = { operations: given };
64
+ const end = () => {
65
+ scope.operations = null;
66
+ };
67
+ try {
68
+ const answer = await scopes.run(scope, async () => work());
69
+ if (answer instanceof Response) return endingResponse(answer, end);
70
+ end();
71
+ return answer;
72
+ } catch (e) {
73
+ end();
74
+ throw e;
75
+ }
76
+ }
77
+ /** 種類ごとの処理の中で `operations()` を使えるようにする(defineCode に渡す) */
78
+ function withOperations(handlers) {
79
+ const { request, event, check, schedule } = handlers;
80
+ return {
81
+ request: request && ((call, given) => provideOperations(given, () => request(call, operations()))),
82
+ event: event && ((call, given) => provideOperations(given, () => event(call, operations()))),
83
+ check: check && ((call, given) => provideOperations(given, () => check(call, operations()))),
84
+ schedule: schedule && ((call, given) => provideOperations(given, () => schedule(call, operations())))
85
+ };
86
+ }
87
+ /** 値の入れ物を作る(work とその中の非同期の処理だけが、その値を読む) */
88
+ function scopedValue() {
89
+ const storage = new AsyncLocalStorage();
90
+ return Object.freeze({
91
+ run: (value, work) => storage.run(value, work),
92
+ get: () => storage.getStore()
93
+ });
94
+ }
95
+ export { withOperations as i, provideOperations as n, scopedValue as r, operations as t };
@@ -0,0 +1 @@
1
+ export * from './types/sdk/src/operations.js';
@@ -0,0 +1 @@
1
+ export { t as operations, n as provideOperations, r as scopedValue, i as withOperations } from "./operations-CIB99rIY.js";
@@ -1,4 +1,4 @@
1
- // ../model/src/time.ts
1
+ // ../schema/src/time.ts
2
2
  const DATE_ONLY = /^\d{4}-\d{2}-\d{2}$/;
3
3
  const SQLITE = /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(\.\d+)?$/;
4
4
  const DAY_MS = 864e5;
@@ -49,7 +49,7 @@ function createClock(timeZone) {
49
49
  today: (now = Date.now()) => dateOf(new Date(now).toISOString())
50
50
  };
51
51
  }
52
- // ../model/src/image.ts
52
+ // ../schema/src/image.ts
53
53
  /** 静止画として表示する画像(動画は代わりの画像 poster) */
54
54
  const stillOf = (media) => media.kind === "video" ? media.poster : media;
55
55
  /** 見せたい点を CSS の object-position に(なしは undefined で中央、枠の比が分からない表示の代わり) */
@@ -58,7 +58,7 @@ const objectPosition = (hotspot) => hotspot && `${Math.round(hotspot.x * 1e3) /
58
58
  * 枠を覆う表示で、枠に見える範囲(窓)の始まりの位置: 1次元、画像に対する割合で0〜1 - window
59
59
  * - 見せたい範囲の中心を窓の中央に寄せ、画像の端を越えるときは端と同じ位置
60
60
  * - 範囲が窓に収まる大きさなら、この位置で範囲は必ず窓に入る(範囲が窓より大きいときは範囲の中央を表示)
61
- * - center なしは中央、CMS のプレビュー(apps/admin の crop.ts)とサイトの表示で共通
61
+ * - center なしは中央、CMS のプレビュー(apps/workspace の crop.ts)とサイトの表示で共通
62
62
  */
63
63
  function coverStart(center, window) {
64
64
  const max = Math.max(0, 1 - window);
@@ -100,12 +100,12 @@ function croppedHotspot(hotspot, crop) {
100
100
  } : {}
101
101
  };
102
102
  }
103
- // ../model/src/page.ts
103
+ // ../schema/src/page.ts
104
104
  const matches = (when, record) => !when || when.in.includes(String(record[when.key]));
105
105
  const passes = (rule, record, now) => {
106
106
  const v = record[rule.key];
107
107
  if ("in" in rule) return rule.in.includes(String(v ?? ""));
108
- if ("notIn" in rule) return !rule.notIn.includes(String(v ?? ""));
108
+ if ("not_in" in rule) return !rule.not_in.includes(String(v ?? ""));
109
109
  if ("truthy" in rule) return Boolean(v);
110
110
  return v === void 0 || v === null || v === "" || String(v) <= now;
111
111
  };
package/dist/preview.js CHANGED
@@ -1 +1,8 @@
1
- export { n as SIGNED_HEADERS } from "./src-sazhzYui.js";
1
+ import { t as SECRET_TOKEN_PREFIXES } from "./ids-DmtIoqBX.js";
2
+ // src/preview.ts
3
+ /** CMS の転送のチケット(Authorization: Bearer がチケットの形でなければ null。照合は配信 API) */
4
+ function perspectiveTicketOf(request) {
5
+ const bearer = /^Bearer\s+(\S+)$/i.exec(request.headers.get("authorization") ?? "")?.[1];
6
+ return bearer?.startsWith(SECRET_TOKEN_PREFIXES.perspectiveTicket) ? bearer : null;
7
+ }
8
+ export { perspectiveTicketOf };
@@ -1,5 +1,5 @@
1
- import { i as bodyProblemText } from "./embed-R-OvDYAw.js";
2
- // ../body/src/types.ts
1
+ import { l as richTextProblemText } from "./declared-CE4a61qb.js";
2
+ // ../rich-text/src/types.ts
3
3
  /** 名前のついた値の見た目の種類(色・背景・大きさ) */
4
4
  const STYLE_KINDS = [
5
5
  "color",
@@ -17,13 +17,13 @@ const ALIGNS = [
17
17
  const isTableCell = (cell) => !Array.isArray(cell);
18
18
  /** セルの中の段落(断片の列だけのセルは1段落) */
19
19
  const cellParagraphs = (cell) => isTableCell(cell) ? cell.content : [cell];
20
- // ../body/src/href.ts
20
+ // ../rich-text/src/href.ts
21
21
  const SAFE_HREF = /^(?:https?:\/\/|mailto:|#|\/(?![/\\]))/i;
22
22
  /** 本文のリンク先として許可する形か(保存の検査とサイトの出力で共通) */
23
23
  const isSafeHref = (href) => SAFE_HREF.test(href);
24
24
  /** 許可しないリンク先の問題の文言 */
25
- const unsafeHrefMessage = (href) => bodyProblemText("link_unsafe", { href });
26
- // ../body/src/inline.ts
25
+ const unsafeHrefMessage = (href) => richTextProblemText("link_unsafe", { href });
26
+ // ../rich-text/src/inline.ts
27
27
  /** 装飾の順序(外側から内側、Markdown と HTML の入れ子の順) */
28
28
  const MARK_ORDER = [
29
29
  "strong",
@@ -63,13 +63,13 @@ const mergeStyle = (outer, inner) => outer || inner ? {
63
63
  ...inner,
64
64
  ...outer?.styles || inner?.styles ? { styles: [.../* @__PURE__ */ new Set([...outer?.styles ?? [], ...inner?.styles ?? []])] } : {}
65
65
  } : void 0;
66
- // ../body/src/profile.ts
66
+ // ../rich-text/src/profile.ts
67
67
  const CSS_COLOR = /^(#[0-9a-f]{3,8}|rgba?\(\s*[\d.%\s,/]+\)|hsla?\(\s*[\d.%\sdeg,/]+\)|[a-z]{3,20})$/i;
68
68
  const CSS_SIZE = /^(\d{1,4}(\.\d{1,3})?(%|px|em|rem|pt)|xx-small|x-small|small|medium|large|x-large|xx-large|smaller|larger)$/i;
69
69
  /** 元の CSS の値として描画してよいか(kind は色か大きさ) */
70
70
  const isSafeCssValue = (kind, value) => (kind === "size" ? CSS_SIZE : CSS_COLOR).test(value.trim());
71
71
  /** 本文を設定で検査(合わない箇所をすべて返却) */
72
- function checkBody(body, profile) {
72
+ function checkRichText(body, profile) {
73
73
  const problems = [];
74
74
  const allowedMarks = new Set(profile.marks);
75
75
  body.forEach((block, index) => {
@@ -81,50 +81,50 @@ function checkBody(body, profile) {
81
81
  for (const inline of r) {
82
82
  if (typeof inline === "string") continue;
83
83
  if ("component" in inline) {
84
- if (plain) add(bodyProblemText("inline_component_here"));
85
- else if (!profile.components.includes(inline.component)) add(bodyProblemText("inline_component_unavailable", { name: inline.component }));
84
+ if (plain) add(richTextProblemText("inline_component_here"));
85
+ else if (!profile.components.includes(inline.component)) add(richTextProblemText("inline_component_unavailable", { name: inline.component }));
86
86
  continue;
87
87
  }
88
- if (plain && (inline.marks?.length || inline.link)) add(bodyProblemText("marks_here"));
89
- for (const m of inline.marks ?? []) if (!allowedMarks.has(m)) add(bodyProblemText("mark_unavailable", { mark: m }));
90
- if (profile.combineMarks === false && (inline.marks?.length ?? 0) + (inline.link ? 1 : 0) > 1) add(bodyProblemText("marks_combined"));
91
- if (inline.link?.rel && !profile.linkRels?.includes(inline.link.rel)) add(bodyProblemText("link_rel_unavailable", { rel: inline.link.rel }));
92
- if (inline.link?.target && !profile.linkTargets) add(bodyProblemText("link_target_unavailable"));
88
+ if (plain && (inline.marks?.length || inline.link)) add(richTextProblemText("marks_here"));
89
+ for (const m of inline.marks ?? []) if (!allowedMarks.has(m)) add(richTextProblemText("mark_unavailable", { mark: m }));
90
+ if (profile.combine_marks === false && (inline.marks?.length ?? 0) + (inline.link ? 1 : 0) > 1) add(richTextProblemText("marks_combined"));
91
+ if (inline.link?.rel && !profile.link_rels?.includes(inline.link.rel)) add(richTextProblemText("link_rel_unavailable", { rel: inline.link.rel }));
92
+ if (inline.link?.target && !profile.link_targets) add(richTextProblemText("link_target_unavailable"));
93
93
  if (inline.link && !isSafeHref(inline.link.href)) add(unsafeHrefMessage(inline.link.href));
94
94
  if (inline.style) textStyle(inline.style, plain);
95
95
  }
96
96
  };
97
97
  const textStyle = (style, plain) => {
98
- if (plain) add(bodyProblemText("text_style_here"));
98
+ if (plain) add(richTextProblemText("text_style_here"));
99
99
  for (const kind of STYLE_KINDS) {
100
100
  const v = style[kind];
101
101
  if (!v) continue;
102
- const declared = profile.textStyle?.[kind];
103
- if (!declared) add(bodyProblemText("style_unavailable", { kind }));
104
- else if (v.name && !declared.some((d) => d.name === v.name)) add(bodyProblemText("style_name_unknown", {
102
+ const declared = profile.text_style?.[kind];
103
+ if (!declared) add(richTextProblemText("style_unavailable", { kind }));
104
+ else if (v.name && !declared.some((d) => d.name === v.name)) add(richTextProblemText("style_name_unknown", {
105
105
  kind,
106
106
  name: v.name
107
107
  }));
108
- if (!v.name && !v.value) add(bodyProblemText("style_empty", { kind }));
109
- if (v.value && !isSafeCssValue(kind, v.value)) add(bodyProblemText("style_value_unsafe", {
108
+ if (!v.name && !v.value) add(richTextProblemText("style_empty", { kind }));
109
+ if (v.value && !isSafeCssValue(kind, v.value)) add(richTextProblemText("style_value_unsafe", {
110
110
  kind,
111
111
  value: v.value
112
112
  }));
113
113
  }
114
- for (const name of style.styles ?? []) if (!profile.textStyle?.styles?.some((d) => d.name === name)) add(bodyProblemText("named_style_unknown", { name }));
114
+ for (const name of style.styles ?? []) if (!profile.text_style?.styles?.some((d) => d.name === name)) add(richTextProblemText("named_style_unknown", { name }));
115
115
  };
116
116
  const align = (a) => {
117
- if (a && !profile.align) add(bodyProblemText("align_unavailable"));
117
+ if (a && !profile.align) add(richTextProblemText("align_unavailable"));
118
118
  };
119
119
  const cell = (c, head) => {
120
120
  if (isTableCell(c)) {
121
- if (!profile.table?.cells) add(bodyProblemText("table_cells_unavailable"));
122
- if ((c.colspan ?? 1) < 1 || (c.rowspan ?? 1) < 1) add(bodyProblemText("table_span_invalid"));
123
- c.content.forEach((r) => rich(r, (head || Boolean(c.header)) && profile.plain?.includes("tableHead")));
124
- } else rich(c, head && profile.plain?.includes("tableHead"));
121
+ if (!profile.table?.cells) add(richTextProblemText("table_cells_unavailable"));
122
+ if ((c.colspan ?? 1) < 1 || (c.rowspan ?? 1) < 1) add(richTextProblemText("table_span_invalid"));
123
+ c.content.forEach((r) => rich(r, (head || Boolean(c.header)) && profile.plain?.includes("table_head")));
124
+ } else rich(c, head && profile.plain?.includes("table_head"));
125
125
  };
126
126
  const variant = (v, allowed = []) => {
127
- if (v && !allowed.includes(v)) add(bodyProblemText("variant_unavailable", { variant: v }));
127
+ if (v && !allowed.includes(v)) add(richTextProblemText("variant_unavailable", { variant: v }));
128
128
  };
129
129
  const b = block;
130
130
  switch (b.type) {
@@ -134,7 +134,7 @@ function checkBody(body, profile) {
134
134
  rich(b.content);
135
135
  break;
136
136
  case "heading":
137
- if (!profile.headings.includes(b.level)) add(bodyProblemText("heading_unavailable", {
137
+ if (!profile.headings.includes(b.level)) add(richTextProblemText("heading_unavailable", {
138
138
  level: b.level,
139
139
  levels: profile.headings.join(", ")
140
140
  }));
@@ -145,12 +145,12 @@ function checkBody(body, profile) {
145
145
  case "list": {
146
146
  const p = profile.list;
147
147
  if (!p) {
148
- add(bodyProblemText("list_unavailable"));
148
+ add(richTextProblemText("list_unavailable"));
149
149
  break;
150
150
  }
151
- if (!p.nested && b.items.some((i) => i.children)) add(bodyProblemText("list_nested_unavailable"));
151
+ if (!p.nested && b.items.some((i) => i.children)) add(richTextProblemText("list_nested_unavailable"));
152
152
  const list = (l) => {
153
- if (l.ordered && !p.ordered) add(bodyProblemText("list_ordered_unavailable"));
153
+ if (l.ordered && !p.ordered) add(richTextProblemText("list_ordered_unavailable"));
154
154
  variant(l.variant, p.variants);
155
155
  l.items.forEach((i) => {
156
156
  rich(i.content);
@@ -163,61 +163,61 @@ function checkBody(body, profile) {
163
163
  case "quote": {
164
164
  const p = profile.quote;
165
165
  if (!p) {
166
- add(bodyProblemText("quote_unavailable"));
166
+ add(richTextProblemText("quote_unavailable"));
167
167
  break;
168
168
  }
169
- if (!p.multiple && b.content.length > 1) add(bodyProblemText("quote_single"));
170
- if (!p.cite && b.cite) add(bodyProblemText("quote_cite_unavailable"));
169
+ if (!p.multiple && b.content.length > 1) add(richTextProblemText("quote_single"));
170
+ if (!p.cite && b.cite) add(richTextProblemText("quote_cite_unavailable"));
171
171
  if (b.cite?.href && !isSafeHref(b.cite.href)) add(unsafeHrefMessage(b.cite.href));
172
172
  variant(b.variant);
173
173
  b.content.forEach((r) => rich(r));
174
174
  break;
175
175
  }
176
176
  case "code":
177
- if (!profile.code) add(bodyProblemText("code_unavailable"));
178
- else if (!profile.code.caption && b.caption) add(bodyProblemText("code_caption_unavailable"));
179
- else if (!profile.code.filename && b.filename) add(bodyProblemText("code_filename_unavailable"));
180
- else if (b.lang && profile.code.componentLangs?.[b.lang]) add(bodyProblemText("code_component_lang", {
177
+ if (!profile.code) add(richTextProblemText("code_unavailable"));
178
+ else if (!profile.code.caption && b.caption) add(richTextProblemText("code_caption_unavailable"));
179
+ else if (!profile.code.filename && b.filename) add(richTextProblemText("code_filename_unavailable"));
180
+ else if (b.lang && profile.code.component_langs?.[b.lang]) add(richTextProblemText("code_component_lang", {
181
181
  lang: b.lang,
182
- component: profile.code.componentLangs[b.lang]
182
+ component: profile.code.component_langs[b.lang]
183
183
  }));
184
184
  variant(b.variant);
185
185
  break;
186
186
  case "image":
187
- if (!profile.image) add(bodyProblemText("image_unavailable"));
187
+ if (!profile.image) add(richTextProblemText("image_unavailable"));
188
188
  else {
189
- if (b.link && !profile.image.link) add(bodyProblemText("image_link_unavailable"));
189
+ if (b.link && !profile.image.link) add(richTextProblemText("image_link_unavailable"));
190
190
  if (b.link && !isSafeHref(b.link.href)) add(unsafeHrefMessage(b.link.href));
191
- if (b.align && !profile.image.align) add(bodyProblemText("image_align_unavailable"));
191
+ if (b.align && !profile.image.align) add(richTextProblemText("image_align_unavailable"));
192
192
  }
193
193
  variant(b.variant, profile.image?.variants);
194
194
  break;
195
195
  case "file":
196
- if (!profile.file) add(bodyProblemText("file_unavailable"));
196
+ if (!profile.file) add(richTextProblemText("file_unavailable"));
197
197
  break;
198
198
  case "table": {
199
199
  const p = profile.table;
200
200
  if (!p) {
201
- add(bodyProblemText("table_unavailable"));
201
+ add(richTextProblemText("table_unavailable"));
202
202
  break;
203
203
  }
204
- if (p.head === "required" && !b.head) add(bodyProblemText("table_head_required"));
205
- if (p.caption === "required" && !b.caption) add(bodyProblemText("table_caption_required"));
206
- if (p.caption === "none" && b.caption) add(bodyProblemText("table_caption_unavailable"));
204
+ if (p.head === "required" && !b.head) add(richTextProblemText("table_head_required"));
205
+ if (p.caption === "required" && !b.caption) add(richTextProblemText("table_caption_required"));
206
+ if (p.caption === "none" && b.caption) add(richTextProblemText("table_caption_unavailable"));
207
207
  variant(b.variant);
208
- b.head?.forEach((r) => rich(r, profile.plain?.includes("tableHead")));
208
+ b.head?.forEach((r) => rich(r, profile.plain?.includes("table_head")));
209
209
  b.rows.forEach((row) => row.forEach((c) => cell(c, false)));
210
210
  break;
211
211
  }
212
212
  case "divider":
213
- if (!profile.divider) add(bodyProblemText("divider_unavailable"));
213
+ if (!profile.divider) add(richTextProblemText("divider_unavailable"));
214
214
  break;
215
215
  case "html":
216
- if (!profile.html) add(bodyProblemText("html_unavailable"));
216
+ if (!profile.html) add(richTextProblemText("html_unavailable"));
217
217
  break;
218
- case "component": if (!profile.components.includes(b.name)) add(bodyProblemText("component_unavailable", { name: b.name }));
218
+ case "component": if (!profile.components.includes(b.name)) add(richTextProblemText("component_unavailable", { name: b.name }));
219
219
  }
220
220
  });
221
221
  return problems;
222
222
  }
223
- export { mergeStyle as a, ALIGNS as c, MARK_HTML_TAGS as i, cellParagraphs as l, isSafeCssValue as n, sortMarks as o, HTML_TAG_MARKS as r, isSafeHref as s, checkBody as t, isTableCell as u };
223
+ export { mergeStyle as a, ALIGNS as c, MARK_HTML_TAGS as i, cellParagraphs as l, isSafeCssValue as n, sortMarks as o, HTML_TAG_MARKS as r, isSafeHref as s, checkRichText as t, isTableCell as u };
@@ -0,0 +1 @@
1
+ export * from './types/sdk/src/rich-text.js';
@@ -1,8 +1,7 @@
1
- import { i as bodyProblemText, n as embedOfUrl, r as embedSrcOf, t as EMBED_PROVIDERS } from "./embed-R-OvDYAw.js";
2
- import { a as coreComponentOf, n as declaredPropsZod, r as CITE } from "./declared-C_GvPiGF.js";
3
- import { c as ALIGNS, i as MARK_HTML_TAGS, l as cellParagraphs, n as isSafeCssValue, o as sortMarks, s as isSafeHref, t as checkBody, u as isTableCell } from "./profile-D6t1QMQh.js";
1
+ import { a as coreComponentOf, c as embedSrcOf, l as richTextProblemText, n as declaredPropsZod, o as EMBED_PROVIDERS, r as CITE, s as embedOfUrl } from "./declared-CE4a61qb.js";
2
+ import { c as ALIGNS, i as MARK_HTML_TAGS, l as cellParagraphs, n as isSafeCssValue, o as sortMarks, s as isSafeHref, t as checkRichText, u as isTableCell } from "./profile-DBsXLvvI.js";
4
3
  import { z } from "zod";
5
- // ../body/src/description.ts
4
+ // ../rich-text/src/description.ts
6
5
  /** meta description の長さの上限(検索結果で省略されにくい字数の目安) */
7
6
  const DESCRIPTION_MAX = 120;
8
7
  /**
@@ -16,7 +15,7 @@ function descriptionOf(excerpt, max = 120) {
16
15
  const end = head.lastIndexOf("。");
17
16
  return end > 0 ? head.slice(0, end + 1) : `${[...head].slice(0, max - 1).join("")}…`;
18
17
  }
19
- // ../body/src/derive.ts
18
+ // ../rich-text/src/derive.ts
20
19
  /** 読了時間の既定の分速(字/分) */
21
20
  const READING_SPEED = 500;
22
21
  const listRich = (list) => list.items.flatMap((i) => [i.content, ...i.children ? listRich(i.children) : []]);
@@ -63,7 +62,7 @@ const readMinOf = (body, speed = 500) => Math.max(1, Math.round(chars(body) / sp
63
62
  const hrefs = (v) => Array.isArray(v) ? v.flatMap(hrefs) : v && typeof v === "object" ? Object.entries(v).flatMap(([k, x]) => k === "href" && typeof x === "string" ? [x] : hrefs(x)) : [];
64
63
  /** 本文にあるサイト内へのリンク先(`/` で始まる href、重複なし) */
65
64
  const linksOf = (body) => [...new Set(hrefs(body).filter((h) => h.startsWith("/")))];
66
- // ../body/src/render.ts
65
+ // ../rich-text/src/render.ts
67
66
  const ESCAPES = {
68
67
  "&": "&amp;",
69
68
  "<": "&lt;",
@@ -82,7 +81,7 @@ const CSS_PROPERTY = {
82
81
  const EMBED_SANDBOX = "allow-scripts allow-same-origin allow-popups allow-presentation";
83
82
  const EMBED_ALLOW = "encrypted-media; picture-in-picture; fullscreen";
84
83
  /** 本文を HTML に */
85
- function bodyToHtml(body, options) {
84
+ function richTextToHtml(body, options) {
86
85
  const styleAttr = (style) => {
87
86
  const decls = Object.keys(CSS_PROPERTY).flatMap((kind) => {
88
87
  const v = style[kind];
@@ -181,7 +180,7 @@ function bodyToHtml(body, options) {
181
180
  href
182
181
  })}>${image ?? ""}${text("link-card-title", p.title)}${text("link-card-desc", p.desc)}${text("link-card-site", p.site)}</a>`;
183
182
  }
184
- case "gallery": return `<div class="gallery">${(Array.isArray(p.items) ? p.items : []).map((i) => `<figure>${imageHtml(i.media, void 0) ?? ""}${i.caption ? `<figcaption>${esc(i.caption)}</figcaption>` : ""}</figure>`).join("")}</div>`;
183
+ case "gallery": return `<div class="gallery">${(Array.isArray(p.items) ? p.items : []).map((i) => `<figure>${imageHtml(i.file, void 0) ?? ""}${i.caption ? `<figcaption>${esc(i.caption)}</figcaption>` : ""}</figure>`).join("")}</div>`;
185
184
  default: return "";
186
185
  }
187
186
  };
@@ -206,7 +205,7 @@ function bodyToHtml(body, options) {
206
205
  return b.caption ? `<figure${attrs({ class: b.variant })}>${pre}<figcaption>${esc(b.caption)}</figcaption></figure>` : pre;
207
206
  }
208
207
  case "image": {
209
- const img = imageHtml(b.media, b.alt);
208
+ const img = imageHtml(b.file, b.alt);
210
209
  if (!img) return "";
211
210
  const open = b.link ? linkOpen(b.link) : null;
212
211
  return `<figure${attrs({
@@ -220,7 +219,7 @@ function bodyToHtml(body, options) {
220
219
  return `<table${attrs({ class: b.variant })}>${b.caption ? `<caption>${esc(b.caption)}</caption>` : ""}${head}${rows}</table>`;
221
220
  }
222
221
  case "file": {
223
- const f = options.file?.(b.media);
222
+ const f = options.file?.(b.file);
224
223
  if (!f || !isSafeHref(f.url)) return "";
225
224
  return `<p class="file"><a${attrs({ href: f.url })}>${esc(b.label ?? f.url)}</a></p>`;
226
225
  }
@@ -232,7 +231,7 @@ function bodyToHtml(body, options) {
232
231
  const render = (blocks) => blocks.map(block).join("");
233
232
  return render(body);
234
233
  }
235
- // ../body/src/schema.ts
234
+ // ../rich-text/src/schema.ts
236
235
  const MARKS = [
237
236
  "strong",
238
237
  "em",
@@ -249,7 +248,7 @@ const liftCites = (text) => text.split(CITE_TEXT).flatMap((piece, i) => i % 2 ?
249
248
  props: { id: piece }
250
249
  }] : piece ? [piece] : []);
251
250
  const link = z.object({
252
- href: z.string().min(1, bodyProblemText("link_href_missing")),
251
+ href: z.string().min(1, richTextProblemText("link_href_missing")),
253
252
  title: z.string().optional(),
254
253
  rel: z.string().optional(),
255
254
  target: z.literal("_blank").optional()
@@ -258,7 +257,7 @@ const named = z.object({
258
257
  name: z.string().min(1).optional(),
259
258
  value: z.string().min(1).optional()
260
259
  });
261
- const textStyle = z.object({
260
+ const text_style = z.object({
262
261
  color: named.optional(),
263
262
  background: named.optional(),
264
263
  size: named.optional(),
@@ -268,7 +267,7 @@ const text = z.object({
268
267
  text: z.string(),
269
268
  marks: z.array(z.enum(MARKS)).optional(),
270
269
  link: link.optional(),
271
- style: textStyle.optional()
270
+ style: text_style.optional()
272
271
  });
273
272
  const align = z.enum(ALIGNS).optional();
274
273
  /** 部品の props の検査(名前で核のコンポーネント、なければ宣言した部品、どちらもないか種類が違えば null) */
@@ -286,7 +285,7 @@ const inlineComponentOf = (declared) => z.object({
286
285
  const props = propsOf(c.component, true, z.never(), declared);
287
286
  if (!props) return void ctx.addIssue({
288
287
  code: "custom",
289
- message: bodyProblemText("inline_component_missing", { name: c.component })
288
+ message: richTextProblemText("inline_component_missing", { name: c.component })
290
289
  });
291
290
  const r = props.safeParse(c.props ?? {});
292
291
  if (!r.success) for (const issue of r.error.issues) ctx.addIssue({
@@ -366,7 +365,7 @@ function blockSchemaOf(profile, media, declared = []) {
366
365
  align,
367
366
  variant
368
367
  }),
369
- heading.refine((h) => h.content.some((i) => typeof i === "string" ? i.trim() : "text" in i && i.text?.trim()), bodyProblemText("heading_empty")),
368
+ heading.refine((h) => h.content.some((i) => typeof i === "string" ? i.trim() : "text" in i && i.text?.trim()), richTextProblemText("heading_empty")),
370
369
  list,
371
370
  z.object({
372
371
  type: z.literal("quote"),
@@ -387,7 +386,7 @@ function blockSchemaOf(profile, media, declared = []) {
387
386
  }),
388
387
  z.object({
389
388
  type: z.literal("image"),
390
- media,
389
+ file: media,
391
390
  alt: z.string().optional(),
392
391
  caption: z.string().optional(),
393
392
  link: link.optional(),
@@ -407,7 +406,7 @@ function blockSchemaOf(profile, media, declared = []) {
407
406
  }),
408
407
  z.object({
409
408
  type: z.literal("file"),
410
- media,
409
+ file: media,
411
410
  label: z.string().optional()
412
411
  }),
413
412
  z.object({ type: z.literal("divider") }),
@@ -427,7 +426,7 @@ function blockSchemaOf(profile, media, declared = []) {
427
426
  if (!props) {
428
427
  ctx.addIssue({
429
428
  code: "custom",
430
- message: bodyProblemText("component_missing", { name: out.name })
429
+ message: richTextProblemText("component_missing", { name: out.name })
431
430
  });
432
431
  return z.NEVER;
433
432
  }
@@ -445,11 +444,11 @@ function blockSchemaOf(profile, media, declared = []) {
445
444
  props: r.data
446
445
  };
447
446
  }
448
- for (const p of checkBody([out], profile)) ctx.addIssue({
447
+ for (const p of checkRichText([out], profile)) ctx.addIssue({
449
448
  code: "custom",
450
449
  message: p.message
451
450
  });
452
451
  return out;
453
452
  });
454
453
  }
455
- export { DESCRIPTION_MAX, EMBED_PROVIDERS, READING_SPEED, blockSchemaOf, bodyToHtml, cellParagraphs, citesOf, descriptionOf, embedOfUrl, embedSrcOf, excerptOf, isSafeCssValue, isSafeHref, isTableCell, linksOf, plainOf, readMinOf };
454
+ export { DESCRIPTION_MAX, EMBED_PROVIDERS, READING_SPEED, blockSchemaOf, cellParagraphs, citesOf, descriptionOf, embedOfUrl, embedSrcOf, excerptOf, isSafeCssValue, isSafeHref, isTableCell, linksOf, plainOf, readMinOf, richTextToHtml };