@funhub/platform 0.1.38 → 0.1.43

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 (171) hide show
  1. package/README.md +6 -0
  2. package/dist/common.d.mts +1 -2
  3. package/dist/common.mjs +1 -1
  4. package/dist/components/biz/business/banner/variants/basic-banner/inspector-schema.d.mts +4 -0
  5. package/dist/components/biz/business/banner/variants/basic-banner/material.d.mts +4 -0
  6. package/dist/components/biz/business/banner/variants/basic-banner/runtime/client.d.mts +6 -1
  7. package/dist/components/biz/business/banner/variants/basic-banner/runtime/client.mjs +1 -1
  8. package/dist/components/biz/business/banner/variants/basic-banner/server.mjs +1 -1
  9. package/dist/components/biz/business/banner-carousel/client.mjs +1 -1
  10. package/dist/components/biz/business/banner-carousel/material.d.mts +4 -0
  11. package/dist/components/biz/business/banner-carousel/schema.d.mts +4 -0
  12. package/dist/components/biz/business/banner-carousel/server.mjs +1 -1
  13. package/dist/components/biz/business/channel-list/client.mjs +1 -1
  14. package/dist/components/biz/business/channel-list/material.d.mts +4 -0
  15. package/dist/components/biz/business/channel-list/schema.d.mts +4 -0
  16. package/dist/components/biz/business/detail/detail-operate.mjs +1 -1
  17. package/dist/components/biz/business/detail/materials/registry.d.mts +30 -3
  18. package/dist/components/biz/business/detail/materials/video-detail-actions/client.d.mts +2 -1
  19. package/dist/components/biz/business/detail/materials/video-detail-actions/client.mjs +1 -1
  20. package/dist/components/biz/business/detail/materials/video-detail-actions/material.d.mts +6 -1
  21. package/dist/components/biz/business/detail/materials/video-detail-actions/schema.d.mts +6 -1
  22. package/dist/components/biz/business/detail/materials/video-detail-actions/server.mjs +1 -1
  23. package/dist/components/biz/business/detail/materials/video-detail-info/client.d.mts +2 -1
  24. package/dist/components/biz/business/detail/materials/video-detail-info/client.mjs +1 -1
  25. package/dist/components/biz/business/detail/materials/video-detail-info/material.d.mts +4 -0
  26. package/dist/components/biz/business/detail/materials/video-detail-info/schema.d.mts +4 -0
  27. package/dist/components/biz/business/detail/materials/video-detail-info/server.mjs +1 -1
  28. package/dist/components/biz/business/detail/materials/video-detail-info-title/client.d.mts +2 -1
  29. package/dist/components/biz/business/detail/materials/video-detail-info-title/client.mjs +1 -1
  30. package/dist/components/biz/business/detail/materials/video-detail-info-title/material.d.mts +6 -1
  31. package/dist/components/biz/business/detail/materials/video-detail-info-title/schema.d.mts +6 -1
  32. package/dist/components/biz/business/detail/materials/video-detail-info-title/server.mjs +1 -1
  33. package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/client.d.mts +2 -1
  34. package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/client.mjs +1 -1
  35. package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/material.d.mts +4 -0
  36. package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/schema.d.mts +4 -0
  37. package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/server.mjs +1 -1
  38. package/dist/components/biz/business/detail/materials/video-detail-player/client.d.mts +2 -1
  39. package/dist/components/biz/business/detail/materials/video-detail-player/client.mjs +1 -1
  40. package/dist/components/biz/business/detail/materials/video-detail-player/material.d.mts +6 -1
  41. package/dist/components/biz/business/detail/materials/video-detail-player/schema.d.mts +6 -1
  42. package/dist/components/biz/business/detail/materials/video-detail-player/server.mjs +1 -1
  43. package/dist/components/biz/business/detail/materials/video-detail-recommend/client.d.mts +2 -1
  44. package/dist/components/biz/business/detail/materials/video-detail-recommend/client.mjs +1 -1
  45. package/dist/components/biz/business/detail/materials/video-detail-recommend/material.d.mts +4 -0
  46. package/dist/components/biz/business/detail/materials/video-detail-recommend/schema.d.mts +4 -0
  47. package/dist/components/biz/business/detail/materials/video-detail-recommend/server.mjs +1 -1
  48. package/dist/components/biz/business/detail/video-hero.mjs +1 -1
  49. package/dist/components/biz/business/floating-ball/client.mjs +1 -1
  50. package/dist/components/biz/business/floating-ball/material.d.mts +4 -0
  51. package/dist/components/biz/business/floating-ball/schema.d.mts +4 -0
  52. package/dist/components/biz/business/floating-ball/server.mjs +1 -1
  53. package/dist/components/biz/business/header-search/header-avatar-icon/client.d.mts +3 -1
  54. package/dist/components/biz/business/header-search/header-avatar-icon/client.mjs +1 -1
  55. package/dist/components/biz/business/header-search/header-avatar-icon/material.d.mts +6 -1
  56. package/dist/components/biz/business/header-search/header-avatar-icon/schema.d.mts +6 -1
  57. package/dist/components/biz/business/header-search/header-avatar-icon/server.mjs +1 -1
  58. package/dist/components/biz/business/header-search/header-avatar-logo-search/client.mjs +1 -1
  59. package/dist/components/biz/business/header-search/header-avatar-logo-search/material.d.mts +4 -0
  60. package/dist/components/biz/business/header-search/header-avatar-logo-search/schema.d.mts +4 -0
  61. package/dist/components/biz/business/header-search/header-avatar-logo-search/server.mjs +1 -1
  62. package/dist/components/biz/business/header-search/header-avatar-logo-search-icon/client.mjs +1 -1
  63. package/dist/components/biz/business/header-search/header-avatar-logo-search-icon/material.d.mts +4 -0
  64. package/dist/components/biz/business/header-search/header-avatar-logo-search-icon/schema.d.mts +4 -0
  65. package/dist/components/biz/business/header-search/header-avatar-logo-search-icon/server.mjs +1 -1
  66. package/dist/components/biz/business/header-search/header-logo-search/client.mjs +1 -1
  67. package/dist/components/biz/business/header-search/header-logo-search/material.d.mts +4 -0
  68. package/dist/components/biz/business/header-search/header-logo-search/schema.d.mts +4 -0
  69. package/dist/components/biz/business/header-search/header-logo-search/server.mjs +1 -1
  70. package/dist/components/biz/business/header-search/header-search/client.d.mts +3 -1
  71. package/dist/components/biz/business/header-search/header-search/client.mjs +1 -1
  72. package/dist/components/biz/business/header-search/header-search/material.d.mts +6 -1
  73. package/dist/components/biz/business/header-search/header-search/schema.d.mts +6 -1
  74. package/dist/components/biz/business/header-search/header-search/server.mjs +1 -1
  75. package/dist/components/biz/business/home-recommend/shared/home-recommend-base.mjs +1 -1
  76. package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/inspector-schema.d.mts +4 -0
  77. package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/material.d.mts +4 -0
  78. package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/runtime/client.d.mts +8 -1
  79. package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/runtime/client.mjs +1 -1
  80. package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/server.mjs +1 -1
  81. package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/inspector-schema.d.mts +4 -0
  82. package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/material.d.mts +4 -0
  83. package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/runtime/client.d.mts +8 -1
  84. package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/runtime/client.mjs +1 -1
  85. package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/server.mjs +1 -1
  86. package/dist/components/biz/business/large-feature-grid/card-item.mjs +1 -1
  87. package/dist/components/biz/business/large-feature-grid/client.d.mts +15 -0
  88. package/dist/components/biz/business/large-feature-grid/client.mjs +1 -1
  89. package/dist/components/biz/business/large-feature-grid/material.d.mts +34 -4
  90. package/dist/components/biz/business/large-feature-grid/schema.d.mts +42 -0
  91. package/dist/components/biz/business/large-feature-grid/server.d.mts +15 -0
  92. package/dist/components/biz/business/large-feature-grid/server.mjs +1 -1
  93. package/dist/components/biz/business/marquee/client.mjs +1 -1
  94. package/dist/components/biz/business/marquee/material.d.mts +4 -0
  95. package/dist/components/biz/business/marquee/schema.d.mts +4 -0
  96. package/dist/components/biz/business/marquee/server.mjs +1 -1
  97. package/dist/components/biz/business/profile/profile-header/client.d.mts +2 -1
  98. package/dist/components/biz/business/profile/profile-header/client.mjs +1 -1
  99. package/dist/components/biz/business/profile/profile-header/material.d.mts +18 -2
  100. package/dist/components/biz/business/profile/profile-header/material.mjs +1 -1
  101. package/dist/components/biz/business/profile/profile-header/schema.d.mts +7 -2
  102. package/dist/components/biz/business/profile/profile-header/server.d.mts +4 -1
  103. package/dist/components/biz/business/profile/profile-header/server.mjs +1 -1
  104. package/dist/components/biz/business/profile/profile-header/user-profile-cover-background.mjs +1 -1
  105. package/dist/components/biz/business/profile/profile-main/client.d.mts +2 -1
  106. package/dist/components/biz/business/profile/profile-main/client.mjs +1 -1
  107. package/dist/components/biz/business/profile/profile-main/material.d.mts +6 -1
  108. package/dist/components/biz/business/profile/profile-main/material.mjs +1 -1
  109. package/dist/components/biz/business/profile/profile-main/schema.d.mts +7 -2
  110. package/dist/components/biz/business/profile/profile-main/server.mjs +1 -1
  111. package/dist/components/biz/business/profile/profile-main/tabs/collect-tab/client.d.mts +5 -0
  112. package/dist/components/biz/business/profile/profile-main/tabs/collect-tab/client.mjs +1 -1
  113. package/dist/components/biz/business/profile/profile-main/tabs/collect-tab/server.mjs +1 -1
  114. package/dist/components/biz/business/profile/profile-main/tabs/history-tab/client.d.mts +5 -0
  115. package/dist/components/biz/business/profile/profile-main/tabs/history-tab/client.mjs +1 -1
  116. package/dist/components/biz/business/profile/profile-main/tabs/history-tab/server.mjs +1 -1
  117. package/dist/components/biz/business/profile/profile-main/tabs/like-tab/client.d.mts +5 -0
  118. package/dist/components/biz/business/profile/profile-main/tabs/like-tab/client.mjs +1 -1
  119. package/dist/components/biz/business/profile/profile-main/tabs/like-tab/server.mjs +1 -1
  120. package/dist/components/biz/business/profile/profile-main/tabs/publish-tab/client.d.mts +5 -0
  121. package/dist/components/biz/business/profile/profile-main/tabs/publish-tab/client.mjs +1 -1
  122. package/dist/components/biz/business/profile/profile-main/tabs/publish-tab/server.mjs +1 -1
  123. package/dist/components/biz/business/search-history/client.mjs +1 -1
  124. package/dist/components/biz/business/search-history/material.d.mts +4 -0
  125. package/dist/components/biz/business/search-history/schema.d.mts +4 -0
  126. package/dist/components/biz/business/search-history/server.mjs +1 -1
  127. package/dist/components/biz/business/search-input/client.mjs +1 -1
  128. package/dist/components/biz/business/search-input/material.d.mts +4 -0
  129. package/dist/components/biz/business/search-input/schema.d.mts +4 -0
  130. package/dist/components/biz/business/search-input/server.mjs +1 -1
  131. package/dist/components/biz/business/shortcut-grid/client.mjs +1 -1
  132. package/dist/components/biz/business/shortcut-grid/material.d.mts +4 -0
  133. package/dist/components/biz/business/shortcut-grid/schema.d.mts +4 -0
  134. package/dist/components/biz/business/shortcut-grid/server.mjs +1 -1
  135. package/dist/components/biz/business/tab-bar/client.mjs +1 -1
  136. package/dist/components/biz/business/tab-bar/material.d.mts +9 -1
  137. package/dist/components/biz/business/tab-bar/schema.d.mts +9 -1
  138. package/dist/components/biz/business/tab-bar/server.mjs +1 -1
  139. package/dist/components/biz/business/text-recommend/client.mjs +1 -1
  140. package/dist/components/biz/business/text-recommend/material.d.mts +4 -0
  141. package/dist/components/biz/business/text-recommend/schema.d.mts +4 -0
  142. package/dist/components/biz/business/text-recommend/server.mjs +1 -1
  143. package/dist/components/biz/business/video-horizontal-list/client.mjs +1 -1
  144. package/dist/components/biz/business/video-horizontal-list/material.d.mts +4 -0
  145. package/dist/components/biz/business/video-horizontal-list/schema.d.mts +4 -0
  146. package/dist/components/biz/business/video-horizontal-list/server.mjs +1 -1
  147. package/dist/components/biz/example/button/client.mjs +1 -1
  148. package/dist/components/biz/example/button/material.d.mts +4 -0
  149. package/dist/components/biz/example/button/schema.d.mts +4 -0
  150. package/dist/components/biz/example/button/server.d.mts +4 -1
  151. package/dist/components/biz/example/button/server.mjs +1 -1
  152. package/dist/components/ui/badge.d.mts +1 -1
  153. package/dist/components/ui/button.d.mts +2 -2
  154. package/dist/components/ui/image.d.mts +4 -4
  155. package/dist/hooks.d.mts +1 -4
  156. package/dist/hooks.mjs +1 -1
  157. package/dist/utils/schema/index.d.mts +1 -1
  158. package/dist/utils/schema/material.d.mts +3 -2
  159. package/dist/utils/schema/schema.d.mts +18 -3
  160. package/dist/utils/schema/schema.mjs +1 -1
  161. package/dist/utils.d.mts +2 -2
  162. package/package.json +1 -1
  163. package/dist/components/common/app-context/index.d.mts +0 -19
  164. package/dist/components/common/app-context/index.mjs +0 -2
  165. package/dist/components/common/app-context/provider.mjs +0 -2
  166. package/dist/hooks/app-context.d.mts +0 -20
  167. package/dist/hooks/app-context.mjs +0 -2
  168. package/dist/hooks/get-app-context.d.mts +0 -19
  169. package/dist/hooks/get-app-context.mjs +0 -2
  170. package/dist/hooks/use-app-context/index.d.mts +0 -14
  171. package/dist/hooks/use-app-context/index.mjs +0 -2
package/dist/utils.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- import { INSPECTOR_META_KEY, InferSchemaProps, MaterialComponentProps, SchemaHasDefaultValue, defineArrayItemPropSchema, defineCheckboxPropSchema, defineColorPropSchema, defineComponentPropsSchema, defineDatetimePropSchema, defineNumberPropSchema, defineObjectPropSchema, defineSelectEnumPropSchema, defineSelectPropSchema, defineSwitchPropSchema, defineTextPropSchema, defineTextareaPropSchema, defineTimeRangePropSchema, getSchemaDefaultProps, withInspectorMeta } from "./utils/schema/schema.mjs";
2
+ import { INSPECTOR_META_KEY, InferSchemaProps, MaterialComponentMode, MaterialComponentProps, SchemaHasDefaultValue, defineArrayItemPropSchema, defineCheckboxPropSchema, defineColorPropSchema, defineComponentPropsSchema, defineDatetimePropSchema, defineNumberPropSchema, defineObjectPropSchema, defineSelectEnumPropSchema, defineSelectPropSchema, defineSwitchPropSchema, defineTextPropSchema, defineTextareaPropSchema, defineTimeRangePropSchema, getSchemaDefaultProps, withInspectorMeta } from "./utils/schema/schema.mjs";
3
3
  import { defineMaterial, overwriteMaterial } from "./utils/schema/material.mjs";
4
4
  import { MaterialMap, generateMaterialMap } from "./utils/schema/utils.mjs";
5
5
  import "./utils/schema/index.mjs";
@@ -18,4 +18,4 @@ import { createInputAndSelectFile, getCoverImage, getImageResolutionFromFile } f
18
18
  import { PresignedUploadInfo, UploadToS3Options, UploadToS3Result, uploadToS3WithPresignedUrl } from "./utils/s3-uploader.mjs";
19
19
  import { base64ToUint8Array, uint8ArrayToBase64, uint8ArrayToNumberArray } from "./utils/uint8.mjs";
20
20
  import { UploadFileResult, encryptBncBuffer, uploadFile } from "./utils/upload-file.mjs";
21
- export { eventBus as EventBus, HttpClient, HttpError, INSPECTOR_META_KEY, ImageCompressionQualityRule, InferSchemaProps, MaterialComponentProps, MaterialMap, PresignedUploadInfo, RequestConfig, RequestMethod, ResponseData, SchemaHasDefaultValue, UploadFileResult, UploadToS3Options, UploadToS3Result, base64ToUint8Array, checkFollowStatus, clearMyChannelsFromStorage, cn, components, compressImage, createInputAndSelectFile, debounceFun, decryptImageToArrayBuffer, decryptImageToUint8Array, decryptImageUrl, defaultImageCompressionMaxSizeMB, defaultImageCompressionQuality, defineArrayItemPropSchema, defineCheckboxPropSchema, defineColorPropSchema, defineComponentPropsSchema, defineDatetimePropSchema, defineMaterial, defineNumberPropSchema, defineObjectPropSchema, defineSelectEnumPropSchema, defineSelectPropSchema, defineSwitchPropSchema, defineTextPropSchema, defineTextareaPropSchema, defineTimeRangePropSchema, disablePageScroll, enablePageScroll, encryptBncBuffer, followUser, formatVideoDuration, generateDynamicSign, generateMaterialMap, generateUUID, getAppId, getAtUserElement, getCookie, getCoverImage, getCurrentSecondTime, getCurrentUserId, getImageCompressionQuality, getImageResolutionFromFile, getResUrl, getSchemaDefaultProps, getUserId, guessImageContentTypeFromUrl, hashPassword, httpClient, imageCompressionQualityRules, isClient, isEncryptedImageUrl, isMobileDevice, loadComponent, loadHiddenChannelIdsFromStorage, loadMyChannelsFromStorage, normalizeClassName, numToString, overwriteMaterial, parseResolution, parseTextAtUserIds, pxToVw, randomString, removeCookie, replaceAtUserElement, replaceAtUserElementHtmlStr, rewriteComponent, saveHiddenChannelIdsToStorage, secondToTime, setCookie, stringToNumber, stripHtmlTags, uint8ArrayToBase64, uint8ArrayToNumberArray, unfollowUser, updateUrlParams, uploadFile, uploadToS3WithPresignedUrl, withInspectorMeta };
21
+ export { eventBus as EventBus, HttpClient, HttpError, INSPECTOR_META_KEY, ImageCompressionQualityRule, InferSchemaProps, MaterialComponentMode, MaterialComponentProps, MaterialMap, PresignedUploadInfo, RequestConfig, RequestMethod, ResponseData, SchemaHasDefaultValue, UploadFileResult, UploadToS3Options, UploadToS3Result, base64ToUint8Array, checkFollowStatus, clearMyChannelsFromStorage, cn, components, compressImage, createInputAndSelectFile, debounceFun, decryptImageToArrayBuffer, decryptImageToUint8Array, decryptImageUrl, defaultImageCompressionMaxSizeMB, defaultImageCompressionQuality, defineArrayItemPropSchema, defineCheckboxPropSchema, defineColorPropSchema, defineComponentPropsSchema, defineDatetimePropSchema, defineMaterial, defineNumberPropSchema, defineObjectPropSchema, defineSelectEnumPropSchema, defineSelectPropSchema, defineSwitchPropSchema, defineTextPropSchema, defineTextareaPropSchema, defineTimeRangePropSchema, disablePageScroll, enablePageScroll, encryptBncBuffer, followUser, formatVideoDuration, generateDynamicSign, generateMaterialMap, generateUUID, getAppId, getAtUserElement, getCookie, getCoverImage, getCurrentSecondTime, getCurrentUserId, getImageCompressionQuality, getImageResolutionFromFile, getResUrl, getSchemaDefaultProps, getUserId, guessImageContentTypeFromUrl, hashPassword, httpClient, imageCompressionQualityRules, isClient, isEncryptedImageUrl, isMobileDevice, loadComponent, loadHiddenChannelIdsFromStorage, loadMyChannelsFromStorage, normalizeClassName, numToString, overwriteMaterial, parseResolution, parseTextAtUserIds, pxToVw, randomString, removeCookie, replaceAtUserElement, replaceAtUserElementHtmlStr, rewriteComponent, saveHiddenChannelIdsToStorage, secondToTime, setCookie, stringToNumber, stripHtmlTags, uint8ArrayToBase64, uint8ArrayToNumberArray, unfollowUser, updateUrlParams, uploadFile, uploadToS3WithPresignedUrl, withInspectorMeta };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@funhub/platform",
3
3
  "type": "module",
4
- "version": "0.1.38",
4
+ "version": "0.1.43",
5
5
  "private": false,
6
6
  "sideEffects": [
7
7
  "**/*.css"
@@ -1,19 +0,0 @@
1
-
2
- import { AppContextValue } from "../../../hooks/app-context.mjs";
3
- import { PropsWithChildren } from "react";
4
- import * as react_jsx_runtime0 from "react/jsx-runtime";
5
-
6
- //#region components/common/app-context/index.d.ts
7
- type AppContextProps = PropsWithChildren<{
8
- value: AppContextValue;
9
- context?: never;
10
- } | {
11
- value?: never;
12
- context: AppContextValue;
13
- }>;
14
- /**
15
- * 应用上下文入口,仅建议在页面根部使用。
16
- */
17
- declare function AppContext(props: AppContextProps): react_jsx_runtime0.JSX.Element;
18
- //#endregion
19
- export { AppContext, AppContextProps };
@@ -1,2 +0,0 @@
1
-
2
- import{defaultAppContextValue as e}from"../../../hooks/app-context.mjs";import{provideAppContext as t}from"../../../hooks/get-app-context.mjs";import{AppContextClientProvider as n}from"./provider.mjs";import{jsx as r}from"react/jsx-runtime";function i(i){let{children:a}=i,o=(`value`in i?i.value:i.context)??e;return t(o),r(n,{value:o,children:a})}export{i as AppContext};
@@ -1,2 +0,0 @@
1
-
2
- "use client";import{appContextCookieKey as e,lockAppContext as t,normalizeAppContextValue as n}from"../../../hooks/app-context.mjs";import{AppModeContext as r}from"../../../hooks/use-app-context/index.mjs";import{createContext as i,use as a,useEffect as o}from"react";import{Fragment as s,jsx as c}from"react/jsx-runtime";const l=i(!1);function u(t){typeof document>`u`||(document.cookie=`${e}=${encodeURIComponent(t)}; path=/; max-age=31536000; samesite=lax`)}function d(e){let{children:i,value:d}=e,f=n(d);t(f);let p=a(l);return o(()=>{u(f)},[f]),p?c(s,{children:i}):c(l,{value:!0,children:c(r,{value:f,children:i})})}export{d as AppContextClientProvider};
@@ -1,20 +0,0 @@
1
-
2
- //#region hooks/app-context.d.ts
3
- declare const appContextValues: readonly ["editor", "renderer"];
4
- type AppContextValue = (typeof appContextValues)[number];
5
- declare const defaultAppContextValue: AppContextValue;
6
- declare const appContextCookieKey = "funhub-app-context";
7
- /**
8
- * 标准化应用上下文值。
9
- */
10
- declare function normalizeAppContextValue(value: AppContextValue | null | undefined): AppContextValue;
11
- /**
12
- * 锁定应用上下文,首次设置后不允许变更。
13
- */
14
- declare function lockAppContext(value: AppContextValue): void;
15
- /**
16
- * 获取已锁定的应用上下文。
17
- */
18
- declare function getLockedAppContext(): "editor" | "renderer" | undefined;
19
- //#endregion
20
- export { AppContextValue, appContextCookieKey, appContextValues, defaultAppContextValue, getLockedAppContext, lockAppContext, normalizeAppContextValue };
@@ -1,2 +0,0 @@
1
-
2
- const e=[`editor`,`renderer`],t=`renderer`,n=`funhub-app-context`;let r;function i(e){return e===`editor`?`editor`:`renderer`}function a(e){let t=i(e);if(!r){r=t;return}if(r!==t)throw Error(`[funhub] AppContext 已锁定为 "${r}",不能切换到 "${t}"`)}function o(){return r}export{n as appContextCookieKey,e as appContextValues,t as defaultAppContextValue,o as getLockedAppContext,a as lockAppContext,i as normalizeAppContextValue};
@@ -1,19 +0,0 @@
1
-
2
- import { AppContextValue } from "./app-context.mjs";
3
-
4
- //#region hooks/get-app-context.d.ts
5
- type AppContextResolvedSource = 'provider' | 'locked' | 'cookie' | 'default';
6
- interface AppContextResolvedResult {
7
- value: AppContextValue;
8
- source: AppContextResolvedSource;
9
- }
10
- /**
11
- * 从当前请求作用域读取应用上下文。
12
- */
13
- declare function getAppContext(): "editor" | "renderer";
14
- /**
15
- * 读取应用上下文并返回来源,优先级:provider -> locked -> cookie -> default。
16
- */
17
- declare function getAppContextResolved(): Promise<AppContextResolvedResult>;
18
- //#endregion
19
- export { getAppContext, getAppContextResolved };
@@ -1,2 +0,0 @@
1
-
2
- import{appContextCookieKey as e,defaultAppContextValue as t,getLockedAppContext as n,lockAppContext as r,normalizeAppContextValue as i}from"./app-context.mjs";import{cache as a}from"react";const o=a(()=>({value:t,hasProvider:!1}));function s(e){let t=o(),n=i(e);if(r(n),t.hasProvider){if(t.value!==n)throw Error(`[funhub] 当前请求中 AppContext 已设置为 "${t.value}",不能切换到 "${n}"`);return}t.value=n,t.hasProvider=!0}function c(){let e=o();return e.hasProvider?e.value:n()||t}async function l(){try{let{cookies:t}=await import(`next/headers`),n=(await t()).get(e)?.value;return n?i(n):void 0}catch{return}}async function u(){let e=o();if(e.hasProvider)return{value:e.value,source:`provider`};let i=n();if(i)return{value:i,source:`locked`};let a=await l();return a?(r(a),{value:a,source:`cookie`}):{value:t,source:`default`}}export{c as getAppContext,u as getAppContextResolved,s as provideAppContext};
@@ -1,14 +0,0 @@
1
-
2
- import "react";
3
-
4
- //#region hooks/use-app-context/index.d.ts
5
- /**
6
- * 在客户端读取应用上下文。
7
- *
8
- * 注意:
9
- * - 仅限 Client Component 使用;
10
- * - Server Component 请改用 `getAppContext()`。
11
- */
12
- declare function useAppContext(): "editor" | "renderer";
13
- //#endregion
14
- export { useAppContext };
@@ -1,2 +0,0 @@
1
-
2
- "use client";import{defaultAppContextValue as e}from"../app-context.mjs";import{createContext as t,use as n}from"react";const r=t(e);function i(){return n(r)}export{r as AppModeContext,i as useAppContext};