@farm.js/core 0.1.86 → 0.2.0-beta.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/dist/{agent-mcp.d-7uKdOttc.d.ts → agent-mcp.d-BdM0pIrD.d.ts} +1 -1
- package/dist/{agent-mcp.d-LChlR2au.d.mts → agent-mcp.d-CMGqpUbk.d.mts} +1 -1
- package/dist/agent-runtime.d.mts +1 -1
- package/dist/agent-runtime.d.ts +1 -1
- package/dist/analyzer-B2TRJT3B.cjs +17 -0
- package/dist/{analyzer-I5S5YKHM.mjs → analyzer-PWHYGER6.mjs} +2 -2
- package/dist/api/node.d.mts +3 -3
- package/dist/api/node.d.ts +3 -3
- package/dist/api/route-manager.cjs +4 -4
- package/dist/api/route-manager.d.mts +3 -3
- package/dist/api/route-manager.d.ts +3 -3
- package/dist/api/route-manager.mjs +3 -3
- package/dist/api/runtime.d.mts +2 -2
- package/dist/api/runtime.d.ts +2 -2
- package/dist/api.cjs +5 -5
- package/dist/api.d.mts +4 -4
- package/dist/api.d.ts +4 -4
- package/dist/api.mjs +4 -4
- package/dist/{app-manifest.d-QMdmqqCr.d.mts → app-manifest.d-BeDB2OVm.d.mts} +1 -1
- package/dist/{app-manifest.d-CRp21oAz.d.ts → app-manifest.d-COhjPgHn.d.ts} +1 -1
- package/dist/app-markdown.d.mts +2 -2
- package/dist/app-markdown.d.ts +2 -2
- package/dist/{app.d-Bvpc2eJq.d.mts → app.d-AVZXCfcO.d.mts} +5 -4
- package/dist/{app.d-DEKpJEp4.d.ts → app.d-b3A4cca5.d.ts} +5 -4
- package/dist/{chunk-B7L24VPX.cjs → chunk-22KXTL3I.cjs} +6 -4
- package/dist/chunk-2HTNASSB.cjs +134 -0
- package/dist/{chunk-FULX5RYX.cjs → chunk-2OR5WAD5.cjs} +19 -13
- package/dist/{chunk-5P65LXGU.cjs → chunk-3MY6TNNE.cjs} +15 -14
- package/dist/{chunk-A4WWKG2B.cjs → chunk-5ZWXTIGE.cjs} +2 -2
- package/dist/{chunk-2NKNP4AH.cjs → chunk-6266WH6X.cjs} +1 -1
- package/dist/chunk-65LZRVCZ.mjs +18 -0
- package/dist/{chunk-L2IULWKV.cjs → chunk-7LBNWL3L.cjs} +3 -3
- package/dist/{chunk-KHIEGVG7.mjs → chunk-BGEA4K7C.mjs} +10 -4
- package/dist/{chunk-CVKTYG4L.mjs → chunk-BJHXFEAF.mjs} +2 -2
- package/dist/chunk-BQHIJOZM.cjs +13 -0
- package/dist/{chunk-IAERD73G.cjs → chunk-CFLRUCN7.cjs} +384 -339
- package/dist/{chunk-NXOZRI3B.cjs → chunk-CNGGEHXY.cjs} +2 -2
- package/dist/{chunk-3RVLJTFZ.mjs → chunk-D7LXBLUW.mjs} +1 -1
- package/dist/{chunk-B5QRNCIE.mjs → chunk-DATICPTO.mjs} +1 -1
- package/dist/{chunk-XMVZXZ32.cjs → chunk-ERV422FO.cjs} +2 -2
- package/dist/{chunk-BAD6T5NU.cjs → chunk-FEWCWBOF.cjs} +4 -4
- package/dist/{chunk-FLMALEY2.mjs → chunk-GGD57DJA.mjs} +3 -25
- package/dist/{chunk-HQ2VAJLW.mjs → chunk-GV5D5EM6.mjs} +1 -1
- package/dist/{chunk-6MZSTPD2.mjs → chunk-H47EH24T.mjs} +1 -1
- package/dist/{chunk-OBVBII5K.cjs → chunk-HU4R2PPW.cjs} +2 -2
- package/dist/{chunk-7H2TXT2K.mjs → chunk-HX5HLFBZ.mjs} +7 -0
- package/dist/{chunk-N3VMHPIY.mjs → chunk-HZY63K5C.mjs} +2 -2
- package/dist/{chunk-25JGHAGH.cjs → chunk-I2RBHZF7.cjs} +15 -8
- package/dist/{chunk-FDU4Q4QP.cjs → chunk-IRPXOTEN.cjs} +10 -4
- package/dist/{chunk-NAHDG6UX.mjs → chunk-JDO3X7RB.mjs} +6 -5
- package/dist/{chunk-TQJ35BBW.cjs → chunk-JGUMFTZT.cjs} +4 -4
- package/dist/chunk-JIGWHFA5.mjs +32 -0
- package/dist/{chunk-YBXIVQCE.cjs → chunk-JP5TWUK2.cjs} +4 -4
- package/dist/chunk-K6RMOB25.mjs +134 -0
- package/dist/{chunk-UGD53SNO.cjs → chunk-KQ6TYQU7.cjs} +16 -12
- package/dist/{chunk-6QYPP5KC.mjs → chunk-L6ZL35ZJ.mjs} +7 -5
- package/dist/{chunk-7UTRNV6R.mjs → chunk-LUGQUU4S.mjs} +1 -1
- package/dist/{chunk-QYWP5KDY.mjs → chunk-M4CNAZMS.mjs} +74 -29
- package/dist/{chunk-3TKGMIPX.mjs → chunk-MM4U2NNI.mjs} +91 -12
- package/dist/{chunk-CFKAYV7B.mjs → chunk-MRULVIH3.mjs} +1 -1
- package/dist/{chunk-UAQQUQWE.mjs → chunk-MZPPT5NA.mjs} +1 -1
- package/dist/{chunk-2UYYXSUS.mjs → chunk-N5NRXLCX.mjs} +4 -2
- package/dist/chunk-NDMPGFKL.cjs +47 -0
- package/dist/{chunk-YHM4PXJY.mjs → chunk-O5YM6GU3.mjs} +1 -1
- package/dist/{chunk-QYDGIXQ5.cjs → chunk-PA3VZNWU.cjs} +9 -9
- package/dist/{chunk-2PJVEL56.cjs → chunk-PCAEJNQF.cjs} +5 -27
- package/dist/{chunk-P253SZJF.cjs → chunk-PQ6DBVJ2.cjs} +360 -281
- package/dist/chunk-PTAGDZ7I.mjs +13 -0
- package/dist/{chunk-3AV4DCXY.mjs → chunk-PWTBXYJY.mjs} +12 -6
- package/dist/{chunk-PO5MZIWK.mjs → chunk-QBXS4TNG.mjs} +6 -2
- package/dist/chunk-QZUCVJZJ.cjs +18 -0
- package/dist/{chunk-45ANSCTO.mjs → chunk-SCOKBXHS.mjs} +98 -56
- package/dist/{chunk-BLZCAFGJ.cjs → chunk-SG5RFGV6.cjs} +2 -2
- package/dist/{chunk-U54REWMJ.cjs → chunk-SUACCCZG.cjs} +18 -16
- package/dist/chunk-TCGPBSVY.mjs +47 -0
- package/dist/{chunk-CN2JOTRO.cjs → chunk-THGSPDFD.cjs} +7 -7
- package/dist/{chunk-FWLXYNWA.cjs → chunk-TQFIZRON.cjs} +387 -345
- package/dist/{chunk-VGHDPEPQ.cjs → chunk-UA77C2ZA.cjs} +2 -2
- package/dist/{chunk-Q3YWQEUS.cjs → chunk-VMGQOP7X.cjs} +2 -2
- package/dist/{chunk-4SJ22WTT.mjs → chunk-W3ZBLFLU.mjs} +1 -1
- package/dist/{chunk-SB74WCKC.mjs → chunk-WOTAU3BN.mjs} +4 -4
- package/dist/{chunk-JB4BHRFK.cjs → chunk-WP77JDKI.cjs} +16 -16
- package/dist/{chunk-YMAE32O7.mjs → chunk-WPB6HJC7.mjs} +1 -1
- package/dist/{chunk-VPGEYX5Y.mjs → chunk-WX752VMN.mjs} +2 -2
- package/dist/{chunk-VTEAUQMT.mjs → chunk-X2SMVPLH.mjs} +19 -3
- package/dist/{chunk-DJ3PVHTW.cjs → chunk-XGPRM7OK.cjs} +3 -3
- package/dist/{chunk-GWPANDW3.mjs → chunk-XJJQAFZX.mjs} +1 -1
- package/dist/{chunk-UDWBTABT.cjs → chunk-XRYLMTYF.cjs} +3 -3
- package/dist/{chunk-PAENAKTC.mjs → chunk-YCHIR3X6.mjs} +1 -1
- package/dist/chunk-YIGUFJMR.cjs +32 -0
- package/dist/{chunk-CPSFDQKJ.cjs → chunk-Z43CIBUR.cjs} +20 -4
- package/dist/{chunk-RA5OUXOJ.mjs → chunk-ZOD6EYWE.mjs} +2 -2
- package/dist/{cli-runtime.d-DaElKjaL.d.ts → cli-runtime.d-jqZ7YCsm.d.ts} +5 -5
- package/dist/{cli-runtime.d-C7aMfoTq.d.mts → cli-runtime.d-qL44rqYO.d.mts} +5 -5
- package/dist/{client-component.d-miqIXyQv.d.mts → client-component.d-B2L2LyAr.d.mts} +1 -1
- package/dist/{client-component.d-CZG02pIh.d.ts → client-component.d-BDD5aiUb.d.ts} +1 -1
- package/dist/{client-plugins.d-BVXjyIkY.d.ts → client-plugins.d-Crct3m_r.d.ts} +14 -5
- package/dist/{client-plugins.d-BwKwuO_0.d.mts → client-plugins.d-Dzc3vOw_.d.mts} +14 -5
- package/dist/client-plugins.d.mts +1 -1
- package/dist/client-plugins.d.ts +1 -1
- package/dist/client.cjs +8 -6
- package/dist/client.d.mts +8 -7
- package/dist/client.d.ts +8 -7
- package/dist/client.mjs +7 -5
- package/dist/config.d.mts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/desktop.d.mts +2 -2
- package/dist/desktop.d.ts +2 -2
- package/dist/{devtools-DGC2247E.mjs → devtools-2CRVXV7E.mjs} +4 -2
- package/dist/{devtools-A3L7WNTB.cjs → devtools-RL4AU5KD.cjs} +5 -3
- package/dist/docs.cjs +6 -4
- package/dist/docs.d.mts +3 -3
- package/dist/docs.d.ts +3 -3
- package/dist/docs.mjs +5 -3
- package/dist/environment/vite.cjs +4 -4
- package/dist/environment/vite.mjs +3 -3
- package/dist/font.cjs +4 -2
- package/dist/font.d.mts +13 -1
- package/dist/font.d.ts +13 -1
- package/dist/font.mjs +3 -1
- package/dist/{handler.d-BKTWzzNA.d.mts → handler.d-B1S1ZBqS.d.mts} +1 -1
- package/dist/{handler.d-Dzpyg3-N.d.ts → handler.d-ZweCBJD4.d.ts} +1 -1
- package/dist/{headers.d-PZyXcDAH.d.ts → headers.d-BgBdQN8x.d.ts} +1 -1
- package/dist/{headers.d-5opjyhXw.d.mts → headers.d-C-yGl_f6.d.mts} +1 -1
- package/dist/i18n/client.cjs +11 -10
- package/dist/i18n/client.mjs +3 -2
- package/dist/image-attributes.d-BMPDQO1q.d.mts +55 -0
- package/dist/image-attributes.d-BMPDQO1q.d.ts +55 -0
- package/dist/image.cjs +5 -127
- package/dist/image.d.mts +3 -13
- package/dist/image.d.ts +3 -13
- package/dist/image.mjs +5 -127
- package/dist/index.cjs +40 -36
- package/dist/{index.d-C0Mie66f.d.mts → index.d-13h3oDu7.d.mts} +1 -1
- package/dist/{index.d-DV2q-0mE.d.ts → index.d-CtoniAXT.d.ts} +1 -1
- package/dist/index.d.mts +24 -23
- package/dist/index.d.ts +24 -23
- package/dist/index.mjs +35 -31
- package/dist/integrations/orm.d.mts +1 -1
- package/dist/integrations/orm.d.ts +1 -1
- package/dist/integrations.d.mts +1 -1
- package/dist/integrations.d.ts +1 -1
- package/dist/internal/app-markdown-runtime.d.mts +2 -2
- package/dist/internal/app-markdown-runtime.d.ts +2 -2
- package/dist/internal/build-runtime.cjs +22 -22
- package/dist/internal/build-runtime.d.mts +4 -4
- package/dist/internal/build-runtime.d.ts +4 -4
- package/dist/internal/build-runtime.mjs +21 -21
- package/dist/internal/cli-runtime.cjs +8 -6
- package/dist/internal/cli-runtime.d.mts +7 -7
- package/dist/internal/cli-runtime.d.ts +7 -7
- package/dist/internal/cli-runtime.mjs +7 -5
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/client-runtime.cjs +77 -52
- package/dist/internal/client-runtime.d.mts +9 -7
- package/dist/internal/client-runtime.d.ts +9 -7
- package/dist/internal/client-runtime.mjs +64 -39
- package/dist/internal/compression-runtime.d.mts +1 -1
- package/dist/internal/compression-runtime.d.ts +1 -1
- package/dist/internal/config-runtime.cjs +6 -4
- package/dist/internal/config-runtime.d.mts +3 -3
- package/dist/internal/config-runtime.d.ts +3 -3
- package/dist/internal/config-runtime.mjs +5 -3
- package/dist/internal/infra-analytics-runtime.cjs +6 -6
- package/dist/internal/infra-analytics-runtime.mjs +4 -4
- package/dist/internal/islands-boot.cjs +51 -18
- package/dist/internal/islands-boot.d.mts +3 -1
- package/dist/internal/islands-boot.d.ts +3 -1
- package/dist/internal/islands-boot.mjs +34 -1
- package/dist/internal/native-server-fns.cjs +4 -4
- package/dist/internal/native-server-fns.mjs +3 -3
- package/dist/internal/product-telemetry-runtime.cjs +3 -3
- package/dist/internal/product-telemetry-runtime.mjs +2 -2
- package/dist/internal/production-runtime.cjs +6 -6
- package/dist/internal/production-runtime.d.mts +10 -10
- package/dist/internal/production-runtime.d.ts +10 -10
- package/dist/internal/production-runtime.mjs +5 -5
- package/dist/internal/renderer-islands.cjs +35 -8
- package/dist/internal/renderer-islands.d.mts +9 -1
- package/dist/internal/renderer-islands.d.ts +9 -1
- package/dist/internal/renderer-islands.mjs +35 -8
- package/dist/internal/spa-router.cjs +4 -3
- package/dist/internal/spa-router.d.mts +3 -3
- package/dist/internal/spa-router.d.ts +3 -3
- package/dist/internal/spa-router.mjs +3 -2
- package/dist/internal/start-manifest.d.mts +1 -1
- package/dist/internal/start-manifest.d.ts +1 -1
- package/dist/{island-runtime.d-BA7EPo1v.d.ts → island-runtime.d-D2Mh5eTU.d.ts} +5 -1
- package/dist/{island-runtime.d-BBS_YUSX.d.mts → island-runtime.d-lrpEJlgg.d.mts} +5 -1
- package/dist/{manager-PX4QN4HK.cjs → manager-D4DZRBRS.cjs} +4 -4
- package/dist/{manager-OMTC5FOJ.mjs → manager-PKPQGBAE.mjs} +3 -3
- package/dist/markdown.d.mts +1 -1
- package/dist/markdown.d.ts +1 -1
- package/dist/middleware.cjs +4 -4
- package/dist/middleware.d.mts +1 -1
- package/dist/middleware.d.ts +1 -1
- package/dist/middleware.mjs +3 -3
- package/dist/{mount.d-gWul1GA1.d.ts → mount.d-DyKlRR6z.d.ts} +1 -1
- package/dist/{mount.d-CZ_qL1iS.d.mts → mount.d-_6Un9wdK.d.mts} +1 -1
- package/dist/{navigation-delegate.d-BBTzhJLj.d.mts → navigation-delegate.d-B9GjWbov.d.mts} +1 -1
- package/dist/{navigation-delegate.d-BZsYEAet.d.ts → navigation-delegate.d-BbW1_pf_.d.ts} +1 -1
- package/dist/navigation.cjs +6 -5
- package/dist/navigation.d.mts +4 -4
- package/dist/navigation.d.ts +4 -4
- package/dist/navigation.mjs +5 -4
- package/dist/{plugin-QOTAPTVV.mjs → plugin-EVKQZBNW.mjs} +1 -1
- package/dist/{plugin-3PT7I26P.cjs → plugin-MWO3G2XM.cjs} +2 -2
- package/dist/plugin.cjs +19 -19
- package/dist/plugin.d.mts +5 -5
- package/dist/plugin.d.ts +5 -5
- package/dist/plugin.mjs +18 -18
- package/dist/query/client.cjs +8 -7
- package/dist/query/client.mjs +3 -2
- package/dist/{render-plan.d-AaJsYPX-.d.ts → render-plan.d-D0FV9lDT.d.ts} +1 -1
- package/dist/{render-plan.d-bnWxS12w.d.mts → render-plan.d-DaM1NPnm.d.mts} +1 -1
- package/dist/renderer-client.cjs +19 -13
- package/dist/renderer-client.d.mts +6 -5
- package/dist/renderer-client.d.ts +6 -5
- package/dist/renderer-client.mjs +10 -4
- package/dist/renderer.cjs +3 -3
- package/dist/renderer.mjs +2 -2
- package/dist/{request.d-CAeitOG1.d.ts → request.d-CrXC7voZ.d.ts} +1 -1
- package/dist/{request.d-C2HOn3Hi.d.mts → request.d-DVSLilGx.d.mts} +1 -1
- package/dist/request.d.mts +2 -2
- package/dist/request.d.ts +2 -2
- package/dist/{route-rendering.d-CYA-ulnX.d.mts → route-rendering.d-CWi3UYtR.d.mts} +1 -1
- package/dist/{route-rendering.d-A1dIkUK5.d.ts → route-rendering.d-OfbM_rj8.d.ts} +1 -1
- package/dist/{router.d-A_Yt6jYz.d.ts → router.d-Bm9FNSu3.d.ts} +1 -1
- package/dist/{router.d-8lxnzlkr.d.mts → router.d-YKVirmj4.d.mts} +1 -1
- package/dist/routes.d.mts +1 -1
- package/dist/routes.d.ts +1 -1
- package/dist/{rsc-pipeline-SNGPAXGW.cjs → rsc-pipeline-3DYC5ZXW.cjs} +6 -4
- package/dist/{rsc-pipeline-BROS3NEB.mjs → rsc-pipeline-LRB4ZG6I.mjs} +5 -3
- package/dist/{runtime-SLJLW37A.mjs → runtime-3WJNNAAR.mjs} +5 -3
- package/dist/{runtime-7T5TRAWL.cjs → runtime-CRFF32H6.cjs} +7 -5
- package/dist/{runtime.d-C_rZ9_DD.d.mts → runtime.d-BVj6apd0.d.mts} +1 -1
- package/dist/{runtime.d-BPyvWrgQ.d.ts → runtime.d-D7QYVJGO.d.ts} +1 -1
- package/dist/{server-components-status.d-BpxiEMQE.d.mts → server-components-status.d-BDVcxi0z.d.mts} +1 -1
- package/dist/{server-components-status.d-C2UEKJn7.d.ts → server-components-status.d-CfKDpmCH.d.ts} +1 -1
- package/dist/server-plugins.d.mts +3 -3
- package/dist/server-plugins.d.ts +3 -3
- package/dist/server.cjs +54 -40
- package/dist/server.d.mts +11 -11
- package/dist/server.d.ts +11 -11
- package/dist/server.mjs +34 -20
- package/dist/{spa-router.d-BD-6WX1R.d.mts → spa-router.d-DGmropfK.d.mts} +5 -3
- package/dist/{spa-router.d-Cw5i_15e.d.ts → spa-router.d-nE1jHNGt.d.ts} +5 -3
- package/dist/{ssg.d-CCE9aob5.d.mts → ssg.d-DS-gXUbf.d.mts} +2 -2
- package/dist/{ssg.d-Bifiq0EL.d.ts → ssg.d-jXlUAKzg.d.ts} +2 -2
- package/dist/{store-core.d-5tVn5vi1.d.ts → store-core.d-B5cwOd8g.d.ts} +3 -2
- package/dist/{store-core.d-BN2MxSG9.d.mts → store-core.d-C-gATBwd.d.mts} +3 -2
- package/dist/testing.cjs +3 -3
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.mjs +3 -3
- package/dist/{utils.d-BUjpSNIO.d.ts → utils.d-BODwBtkz.d.ts} +1 -1
- package/dist/{utils.d-wGPLeVbq.d.mts → utils.d-Cmj-fzds.d.mts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +24 -22
- package/dist/vite.d.mts +21 -7
- package/dist/vite.d.ts +21 -7
- package/dist/vite.mjs +23 -21
- package/package.json +3 -3
- package/dist/analyzer-OEMQSLYT.cjs +0 -17
- package/dist/chunk-7EPYN7GW.cjs +0 -30
- package/dist/chunk-HZOMT5DY.mjs +0 -30
- package/dist/chunk-SBDWCDS6.cjs +0 -8
- package/dist/chunk-YX6AFPXC.mjs +0 -8
- package/dist/{chunk-4B6YJ5DS.cjs → chunk-4ZVKDHS6.cjs} +3 -3
- package/dist/{chunk-4EEAPBNV.mjs → chunk-PEQJ4UUT.mjs} +3 -3
package/dist/i18n/client.cjs
CHANGED
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkJP5TWUK2cjs = require('../chunk-JP5TWUK2.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkPCAEJNQFcjs = require('../chunk-PCAEJNQF.cjs');
|
|
11
|
+
require('../chunk-YIGUFJMR.cjs');
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
var _chunk7Q2YWZF7cjs = require('../chunk-7Q2YWZF7.cjs');
|
|
@@ -36,7 +37,7 @@ function useLocale() {
|
|
|
36
37
|
}
|
|
37
38
|
function useTranslations() {
|
|
38
39
|
useFarmI18nSnapshot();
|
|
39
|
-
return
|
|
40
|
+
return _chunkJP5TWUK2cjs.createFarmClientTranslator.call(void 0, );
|
|
40
41
|
}
|
|
41
42
|
function getLocale() {
|
|
42
43
|
return requireSnapshot().locale;
|
|
@@ -45,7 +46,7 @@ function getLocaleSource() {
|
|
|
45
46
|
return requireSnapshot().source;
|
|
46
47
|
}
|
|
47
48
|
function createTranslator() {
|
|
48
|
-
return
|
|
49
|
+
return _chunkJP5TWUK2cjs.createFarmClientTranslator.call(void 0, );
|
|
49
50
|
}
|
|
50
51
|
function setLocale(locale) {
|
|
51
52
|
const snapshot = requireSnapshot();
|
|
@@ -59,7 +60,7 @@ function setLocale(locale) {
|
|
|
59
60
|
window.location.assign(nextHref);
|
|
60
61
|
}
|
|
61
62
|
function _setFarmI18nClientSnapshot(snapshot) {
|
|
62
|
-
|
|
63
|
+
_chunkPCAEJNQFcjs._hydrateFarmI18n.call(void 0, snapshot);
|
|
63
64
|
}
|
|
64
65
|
var format = {
|
|
65
66
|
number(value, options) {
|
|
@@ -85,9 +86,9 @@ var format = {
|
|
|
85
86
|
};
|
|
86
87
|
function useFarmI18nSnapshot() {
|
|
87
88
|
const snapshot = _react.useSyncExternalStore.call(void 0,
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
_chunkPCAEJNQFcjs.subscribeFarmI18n,
|
|
90
|
+
_chunkPCAEJNQFcjs.getFarmI18nClientState,
|
|
91
|
+
_chunkPCAEJNQFcjs.getFarmI18nClientState
|
|
91
92
|
);
|
|
92
93
|
if (!snapshot) {
|
|
93
94
|
throw new Error("Farm i18n is not configured or has not been hydrated.");
|
|
@@ -95,7 +96,7 @@ function useFarmI18nSnapshot() {
|
|
|
95
96
|
return snapshot;
|
|
96
97
|
}
|
|
97
98
|
function requireSnapshot() {
|
|
98
|
-
const snapshot =
|
|
99
|
+
const snapshot = _chunkPCAEJNQFcjs.getFarmI18nClientState.call(void 0, );
|
|
99
100
|
if (!snapshot) {
|
|
100
101
|
throw new Error("Farm i18n is not configured or has not been hydrated.");
|
|
101
102
|
}
|
|
@@ -111,4 +112,4 @@ function requireSnapshot() {
|
|
|
111
112
|
|
|
112
113
|
|
|
113
114
|
|
|
114
|
-
exports._setFarmI18nClientSnapshot = _setFarmI18nClientSnapshot; exports.createTranslator = createTranslator; exports.format = format; exports.getLocale = getLocale; exports.getLocaleSource = getLocaleSource; exports.setLocale = setLocale; exports.t =
|
|
115
|
+
exports._setFarmI18nClientSnapshot = _setFarmI18nClientSnapshot; exports.createTranslator = createTranslator; exports.format = format; exports.getLocale = getLocale; exports.getLocaleSource = getLocaleSource; exports.setLocale = setLocale; exports.t = _chunkJP5TWUK2cjs.t; exports.useLocale = useLocale; exports.useTranslations = useTranslations;
|
package/dist/i18n/client.mjs
CHANGED
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
import {
|
|
3
3
|
createFarmClientTranslator,
|
|
4
4
|
t
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-DATICPTO.mjs";
|
|
6
6
|
import {
|
|
7
7
|
_hydrateFarmI18n,
|
|
8
8
|
getFarmI18nClientState,
|
|
9
9
|
subscribeFarmI18n
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-GGD57DJA.mjs";
|
|
11
|
+
import "../chunk-JIGWHFA5.mjs";
|
|
11
12
|
import {
|
|
12
13
|
createFarmLocaleCookie
|
|
13
14
|
} from "../chunk-UJIBSFUE.mjs";
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/** What a static image import (`import hero from "./hero.png"`) gives you. */
|
|
2
|
+
interface StaticImageData {
|
|
3
|
+
src: string;
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
blurDataURL?: string;
|
|
7
|
+
}
|
|
8
|
+
interface FarmImageLoaderProps {
|
|
9
|
+
src: string;
|
|
10
|
+
width: number;
|
|
11
|
+
quality: number;
|
|
12
|
+
}
|
|
13
|
+
type FarmImageLoader = (props: FarmImageLoaderProps) => string;
|
|
14
|
+
/** A style object with camelCased properties, as `createElement()` takes it. */
|
|
15
|
+
type FarmImageStyle = Record<string, string | number | undefined>;
|
|
16
|
+
/** What `resolveImageAttributes()` takes: Farm's image options, plus any other `<img>` attribute. */
|
|
17
|
+
interface FarmImageOptions {
|
|
18
|
+
src: string | StaticImageData;
|
|
19
|
+
alt: string;
|
|
20
|
+
width?: number | `${number}`;
|
|
21
|
+
height?: number | `${number}`;
|
|
22
|
+
fill?: boolean;
|
|
23
|
+
quality?: number;
|
|
24
|
+
sizes?: string;
|
|
25
|
+
loading?: "eager" | "lazy";
|
|
26
|
+
preload?: boolean;
|
|
27
|
+
placeholder?: "empty" | "blur";
|
|
28
|
+
blurDataURL?: string;
|
|
29
|
+
unoptimized?: boolean;
|
|
30
|
+
loader?: FarmImageLoader;
|
|
31
|
+
style?: FarmImageStyle;
|
|
32
|
+
[attribute: string]: unknown;
|
|
33
|
+
}
|
|
34
|
+
/** The `<img>` attributes for an image, named as `createElement()` takes them. */
|
|
35
|
+
interface FarmImageAttributes {
|
|
36
|
+
alt: string;
|
|
37
|
+
src: string;
|
|
38
|
+
srcSet?: string;
|
|
39
|
+
sizes?: string;
|
|
40
|
+
width?: number;
|
|
41
|
+
height?: number;
|
|
42
|
+
loading: "eager" | "lazy";
|
|
43
|
+
fetchPriority?: unknown;
|
|
44
|
+
decoding: unknown;
|
|
45
|
+
style: FarmImageStyle;
|
|
46
|
+
[attribute: string]: unknown;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The `<img>` attributes for an image served through Farm's image endpoint: `src` and `srcSet`
|
|
50
|
+
* sized to `images.deviceSizes` and `images.imageSizes`, lazy loading, and the blur placeholder.
|
|
51
|
+
* It loads no UI library, so any renderer can spread the result onto its own `<img>`.
|
|
52
|
+
*/
|
|
53
|
+
declare function resolveImageAttributes(options: FarmImageOptions): FarmImageAttributes;
|
|
54
|
+
|
|
55
|
+
export { type FarmImageLoader as F, type StaticImageData as S, type FarmImageLoaderProps as a, type FarmImageAttributes as b, type FarmImageOptions as c, type FarmImageStyle as d, resolveImageAttributes as r };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/** What a static image import (`import hero from "./hero.png"`) gives you. */
|
|
2
|
+
interface StaticImageData {
|
|
3
|
+
src: string;
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
blurDataURL?: string;
|
|
7
|
+
}
|
|
8
|
+
interface FarmImageLoaderProps {
|
|
9
|
+
src: string;
|
|
10
|
+
width: number;
|
|
11
|
+
quality: number;
|
|
12
|
+
}
|
|
13
|
+
type FarmImageLoader = (props: FarmImageLoaderProps) => string;
|
|
14
|
+
/** A style object with camelCased properties, as `createElement()` takes it. */
|
|
15
|
+
type FarmImageStyle = Record<string, string | number | undefined>;
|
|
16
|
+
/** What `resolveImageAttributes()` takes: Farm's image options, plus any other `<img>` attribute. */
|
|
17
|
+
interface FarmImageOptions {
|
|
18
|
+
src: string | StaticImageData;
|
|
19
|
+
alt: string;
|
|
20
|
+
width?: number | `${number}`;
|
|
21
|
+
height?: number | `${number}`;
|
|
22
|
+
fill?: boolean;
|
|
23
|
+
quality?: number;
|
|
24
|
+
sizes?: string;
|
|
25
|
+
loading?: "eager" | "lazy";
|
|
26
|
+
preload?: boolean;
|
|
27
|
+
placeholder?: "empty" | "blur";
|
|
28
|
+
blurDataURL?: string;
|
|
29
|
+
unoptimized?: boolean;
|
|
30
|
+
loader?: FarmImageLoader;
|
|
31
|
+
style?: FarmImageStyle;
|
|
32
|
+
[attribute: string]: unknown;
|
|
33
|
+
}
|
|
34
|
+
/** The `<img>` attributes for an image, named as `createElement()` takes them. */
|
|
35
|
+
interface FarmImageAttributes {
|
|
36
|
+
alt: string;
|
|
37
|
+
src: string;
|
|
38
|
+
srcSet?: string;
|
|
39
|
+
sizes?: string;
|
|
40
|
+
width?: number;
|
|
41
|
+
height?: number;
|
|
42
|
+
loading: "eager" | "lazy";
|
|
43
|
+
fetchPriority?: unknown;
|
|
44
|
+
decoding: unknown;
|
|
45
|
+
style: FarmImageStyle;
|
|
46
|
+
[attribute: string]: unknown;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The `<img>` attributes for an image served through Farm's image endpoint: `src` and `srcSet`
|
|
50
|
+
* sized to `images.deviceSizes` and `images.imageSizes`, lazy loading, and the blur placeholder.
|
|
51
|
+
* It loads no UI library, so any renderer can spread the result onto its own `<img>`.
|
|
52
|
+
*/
|
|
53
|
+
declare function resolveImageAttributes(options: FarmImageOptions): FarmImageAttributes;
|
|
54
|
+
|
|
55
|
+
export { type FarmImageLoader as F, type StaticImageData as S, type FarmImageLoaderProps as a, type FarmImageAttributes as b, type FarmImageOptions as c, type FarmImageStyle as d, resolveImageAttributes as r };
|
package/dist/image.cjs
CHANGED
|
@@ -1,138 +1,16 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var _chunkMCSRMEQVcjs = require('./chunk-MCSRMEQV.cjs');
|
|
3
|
+
var _chunk2HTNASSBcjs = require('./chunk-2HTNASSB.cjs');
|
|
4
|
+
require('./chunk-MCSRMEQV.cjs');
|
|
8
5
|
require('./chunk-UZM3PDKK.cjs');
|
|
9
6
|
|
|
10
7
|
// src/image.tsx
|
|
11
8
|
var _react = require('react');
|
|
12
9
|
var _reactdom = require('react-dom'); var ReactDOM = _interopRequireWildcard(_reactdom);
|
|
13
10
|
var _jsxruntime = require('react/jsx-runtime');
|
|
14
|
-
var FALLBACK_CONFIG = {
|
|
15
|
-
provider: "auto",
|
|
16
|
-
path: _chunkMCSRMEQVcjs.DEFAULT_FARM_IMAGE_PATH,
|
|
17
|
-
deviceSizes: _chunkMCSRMEQVcjs.DEFAULT_FARM_IMAGE_DEVICE_SIZES,
|
|
18
|
-
imageSizes: _chunkMCSRMEQVcjs.DEFAULT_FARM_IMAGE_SIZES,
|
|
19
|
-
qualities: _chunkMCSRMEQVcjs.DEFAULT_FARM_IMAGE_QUALITIES,
|
|
20
|
-
formats: _chunkMCSRMEQVcjs.DEFAULT_FARM_IMAGE_FORMATS
|
|
21
|
-
};
|
|
22
|
-
function getImageConfig() {
|
|
23
|
-
return typeof __FARM_IMAGE_CONFIG__ !== "undefined" && __FARM_IMAGE_CONFIG__ ? __FARM_IMAGE_CONFIG__ : FALLBACK_CONFIG;
|
|
24
|
-
}
|
|
25
|
-
function defaultImageLoader(config) {
|
|
26
|
-
return ({ src, width, quality }) => {
|
|
27
|
-
const query = new URLSearchParams({
|
|
28
|
-
url: src,
|
|
29
|
-
w: String(width),
|
|
30
|
-
q: String(quality)
|
|
31
|
-
});
|
|
32
|
-
return `${config.path}?${query}`;
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
function getClosestQuality(quality, allowed) {
|
|
36
|
-
const requested = _nullishCoalesce(quality, () => ( 75));
|
|
37
|
-
return allowed.reduce(
|
|
38
|
-
(closest, candidate) => Math.abs(candidate - requested) < Math.abs(closest - requested) ? candidate : closest
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
function getCandidateWidths(config, width, sizes, fill) {
|
|
42
|
-
const allSizes = [.../* @__PURE__ */ new Set([...config.imageSizes, ...config.deviceSizes])].sort(
|
|
43
|
-
(left, right) => left - right
|
|
44
|
-
);
|
|
45
|
-
if (fill || sizes) {
|
|
46
|
-
const viewportPercentages = [..._nullishCoalesce(_optionalChain([sizes, 'optionalAccess', _ => _.matchAll, 'call', _2 => _2(/(^|\s)(\d{1,3})vw/g)]), () => ( []))].map(
|
|
47
|
-
(match) => Number(match[2])
|
|
48
|
-
);
|
|
49
|
-
if (viewportPercentages.length > 0) {
|
|
50
|
-
const smallestRatio = Math.min(...viewportPercentages) / 100;
|
|
51
|
-
const minimum = config.deviceSizes[0] * smallestRatio;
|
|
52
|
-
return { widths: allSizes.filter((candidate) => candidate >= minimum), descriptor: "w" };
|
|
53
|
-
}
|
|
54
|
-
return { widths: allSizes, descriptor: "w" };
|
|
55
|
-
}
|
|
56
|
-
if (!width) return { widths: config.deviceSizes.slice(), descriptor: "w" };
|
|
57
|
-
const requested = [width, width * 2];
|
|
58
|
-
const widths = requested.map(
|
|
59
|
-
(target) => _nullishCoalesce(allSizes.find((candidate) => candidate >= target), () => ( allSizes.at(-1)))
|
|
60
|
-
);
|
|
61
|
-
return { widths: [...new Set(widths)], descriptor: "x" };
|
|
62
|
-
}
|
|
63
|
-
function isStaticImageData(value) {
|
|
64
|
-
return typeof value === "object" && value !== null && typeof value.src === "string";
|
|
65
|
-
}
|
|
66
|
-
function shouldSkipOptimization(src, config) {
|
|
67
|
-
return config.provider === "none" || src.startsWith("data:") || src.startsWith("blob:") || /\.svg(?:$|[?#])/i.test(src);
|
|
68
|
-
}
|
|
69
11
|
function getImageProps(input) {
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
alt,
|
|
73
|
-
width: widthInput,
|
|
74
|
-
height: heightInput,
|
|
75
|
-
fill = false,
|
|
76
|
-
quality: qualityInput,
|
|
77
|
-
sizes: sizesInput,
|
|
78
|
-
loading,
|
|
79
|
-
preload: preload2 = false,
|
|
80
|
-
placeholder = "empty",
|
|
81
|
-
blurDataURL: blurDataURLInput,
|
|
82
|
-
unoptimized: unoptimizedInput = false,
|
|
83
|
-
loader: loaderInput,
|
|
84
|
-
style,
|
|
85
|
-
...rest
|
|
86
|
-
} = input;
|
|
87
|
-
const config = getImageConfig();
|
|
88
|
-
const staticImage = isStaticImageData(srcInput) ? srcInput : void 0;
|
|
89
|
-
const src = typeof srcInput === "string" ? srcInput : srcInput.src;
|
|
90
|
-
const width = Number(_nullishCoalesce(widthInput, () => ( _optionalChain([staticImage, 'optionalAccess', _3 => _3.width])))) || void 0;
|
|
91
|
-
const height = Number(_nullishCoalesce(heightInput, () => ( _optionalChain([staticImage, 'optionalAccess', _4 => _4.height])))) || void 0;
|
|
92
|
-
const blurDataURL = _nullishCoalesce(blurDataURLInput, () => ( _optionalChain([staticImage, 'optionalAccess', _5 => _5.blurDataURL])));
|
|
93
|
-
if (!fill && (!width || !height)) {
|
|
94
|
-
throw new TypeError(
|
|
95
|
-
"Farm Image requires width and height unless src is a static import or fill is enabled"
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
if (fill && (widthInput !== void 0 || heightInput !== void 0)) {
|
|
99
|
-
throw new TypeError("Farm Image cannot use width or height together with fill");
|
|
100
|
-
}
|
|
101
|
-
if (placeholder === "blur" && !blurDataURL) {
|
|
102
|
-
throw new TypeError("Farm Image placeholder=blur requires a static import or blurDataURL");
|
|
103
|
-
}
|
|
104
|
-
const unoptimized = unoptimizedInput || shouldSkipOptimization(src, config);
|
|
105
|
-
const quality = getClosestQuality(qualityInput, config.qualities);
|
|
106
|
-
const loader = _nullishCoalesce(loaderInput, () => ( defaultImageLoader(config)));
|
|
107
|
-
const sizes = _nullishCoalesce(sizesInput, () => ( (fill ? "100vw" : void 0)));
|
|
108
|
-
const candidates = getCandidateWidths(config, width, sizes, fill);
|
|
109
|
-
const srcSet = unoptimized ? void 0 : candidates.widths.map((candidate, index) => {
|
|
110
|
-
const descriptor = candidates.descriptor === "w" ? `${candidate}w` : `${index + 1}x`;
|
|
111
|
-
return `${loader({ src, width: candidate, quality })} ${descriptor}`;
|
|
112
|
-
}).join(", ");
|
|
113
|
-
const renderedSrc = unoptimized ? src : loader({ src, width: _nullishCoalesce(_nullishCoalesce(candidates.widths.at(-1), () => ( width)), () => ( config.deviceSizes[0])), quality });
|
|
114
|
-
const fillStyle = fill ? { position: "absolute", inset: 0, width: "100%", height: "100%" } : void 0;
|
|
115
|
-
const placeholderStyle = placeholder === "blur" ? {
|
|
116
|
-
backgroundImage: `url("${blurDataURL}")`,
|
|
117
|
-
backgroundPosition: "50% 50%",
|
|
118
|
-
backgroundRepeat: "no-repeat",
|
|
119
|
-
backgroundSize: "cover"
|
|
120
|
-
} : void 0;
|
|
121
|
-
return {
|
|
122
|
-
props: {
|
|
123
|
-
...rest,
|
|
124
|
-
alt,
|
|
125
|
-
src: renderedSrc,
|
|
126
|
-
srcSet,
|
|
127
|
-
sizes,
|
|
128
|
-
width: fill ? void 0 : width,
|
|
129
|
-
height: fill ? void 0 : height,
|
|
130
|
-
loading: preload2 ? "eager" : _nullishCoalesce(loading, () => ( "lazy")),
|
|
131
|
-
fetchPriority: preload2 ? "high" : rest.fetchPriority,
|
|
132
|
-
decoding: _nullishCoalesce(rest.decoding, () => ( "async")),
|
|
133
|
-
style: { ...fillStyle, ...placeholderStyle, ...style }
|
|
134
|
-
}
|
|
135
|
-
};
|
|
12
|
+
const attributes = _chunk2HTNASSBcjs.resolveImageAttributes.call(void 0, input);
|
|
13
|
+
return { props: attributes };
|
|
136
14
|
}
|
|
137
15
|
var Image = _react.forwardRef.call(void 0, function Image2(input, ref) {
|
|
138
16
|
const { props } = getImageProps(input);
|
package/dist/image.d.mts
CHANGED
|
@@ -1,19 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ImgHTMLAttributes, SyntheticEvent } from 'react';
|
|
3
|
+
import { S as StaticImageData, F as FarmImageLoader } from './image-attributes.d-BMPDQO1q.mjs';
|
|
4
|
+
export { a as FarmImageLoaderProps } from './image-attributes.d-BMPDQO1q.mjs';
|
|
3
5
|
export { a as FarmImageConfig, F as FarmImageFormat, b as FarmImageLocalPattern, c as FarmImageProvider, d as FarmImageRemotePattern, R as ResolvedFarmImageConfig } from './image-config.d-ByhQ0TT7.mjs';
|
|
4
6
|
|
|
5
|
-
interface StaticImageData {
|
|
6
|
-
src: string;
|
|
7
|
-
width: number;
|
|
8
|
-
height: number;
|
|
9
|
-
blurDataURL?: string;
|
|
10
|
-
}
|
|
11
|
-
interface FarmImageLoaderProps {
|
|
12
|
-
src: string;
|
|
13
|
-
width: number;
|
|
14
|
-
quality: number;
|
|
15
|
-
}
|
|
16
|
-
type FarmImageLoader = (props: FarmImageLoaderProps) => string;
|
|
17
7
|
interface ImageProps extends Omit<ImgHTMLAttributes<HTMLImageElement>, "src" | "srcSet" | "width" | "height" | "loading" | "placeholder"> {
|
|
18
8
|
src: string | StaticImageData;
|
|
19
9
|
alt: string;
|
|
@@ -36,4 +26,4 @@ interface ImagePropsResult {
|
|
|
36
26
|
declare function getImageProps(input: ImageProps): ImagePropsResult;
|
|
37
27
|
declare const Image: React.ForwardRefExoticComponent<ImageProps & React.RefAttributes<HTMLImageElement>>;
|
|
38
28
|
|
|
39
|
-
export {
|
|
29
|
+
export { FarmImageLoader, Image, type ImageProps, type ImagePropsResult, StaticImageData, Image as default, getImageProps };
|
package/dist/image.d.ts
CHANGED
|
@@ -1,19 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ImgHTMLAttributes, SyntheticEvent } from 'react';
|
|
3
|
+
import { S as StaticImageData, F as FarmImageLoader } from './image-attributes.d-BMPDQO1q.js';
|
|
4
|
+
export { a as FarmImageLoaderProps } from './image-attributes.d-BMPDQO1q.js';
|
|
3
5
|
export { a as FarmImageConfig, F as FarmImageFormat, b as FarmImageLocalPattern, c as FarmImageProvider, d as FarmImageRemotePattern, R as ResolvedFarmImageConfig } from './image-config.d-ByhQ0TT7.js';
|
|
4
6
|
|
|
5
|
-
interface StaticImageData {
|
|
6
|
-
src: string;
|
|
7
|
-
width: number;
|
|
8
|
-
height: number;
|
|
9
|
-
blurDataURL?: string;
|
|
10
|
-
}
|
|
11
|
-
interface FarmImageLoaderProps {
|
|
12
|
-
src: string;
|
|
13
|
-
width: number;
|
|
14
|
-
quality: number;
|
|
15
|
-
}
|
|
16
|
-
type FarmImageLoader = (props: FarmImageLoaderProps) => string;
|
|
17
7
|
interface ImageProps extends Omit<ImgHTMLAttributes<HTMLImageElement>, "src" | "srcSet" | "width" | "height" | "loading" | "placeholder"> {
|
|
18
8
|
src: string | StaticImageData;
|
|
19
9
|
alt: string;
|
|
@@ -36,4 +26,4 @@ interface ImagePropsResult {
|
|
|
36
26
|
declare function getImageProps(input: ImageProps): ImagePropsResult;
|
|
37
27
|
declare const Image: React.ForwardRefExoticComponent<ImageProps & React.RefAttributes<HTMLImageElement>>;
|
|
38
28
|
|
|
39
|
-
export {
|
|
29
|
+
export { FarmImageLoader, Image, type ImageProps, type ImagePropsResult, StaticImageData, Image as default, getImageProps };
|
package/dist/image.mjs
CHANGED
|
@@ -1,138 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
DEFAULT_FARM_IMAGE_QUALITIES,
|
|
6
|
-
DEFAULT_FARM_IMAGE_SIZES
|
|
7
|
-
} from "./chunk-AOIUYHPH.mjs";
|
|
2
|
+
resolveImageAttributes
|
|
3
|
+
} from "./chunk-K6RMOB25.mjs";
|
|
4
|
+
import "./chunk-AOIUYHPH.mjs";
|
|
8
5
|
import "./chunk-TIZJYHB7.mjs";
|
|
9
6
|
|
|
10
7
|
// src/image.tsx
|
|
11
8
|
import { forwardRef } from "react";
|
|
12
9
|
import * as ReactDOM from "react-dom";
|
|
13
10
|
import { jsx } from "react/jsx-runtime";
|
|
14
|
-
var FALLBACK_CONFIG = {
|
|
15
|
-
provider: "auto",
|
|
16
|
-
path: DEFAULT_FARM_IMAGE_PATH,
|
|
17
|
-
deviceSizes: DEFAULT_FARM_IMAGE_DEVICE_SIZES,
|
|
18
|
-
imageSizes: DEFAULT_FARM_IMAGE_SIZES,
|
|
19
|
-
qualities: DEFAULT_FARM_IMAGE_QUALITIES,
|
|
20
|
-
formats: DEFAULT_FARM_IMAGE_FORMATS
|
|
21
|
-
};
|
|
22
|
-
function getImageConfig() {
|
|
23
|
-
return typeof __FARM_IMAGE_CONFIG__ !== "undefined" && __FARM_IMAGE_CONFIG__ ? __FARM_IMAGE_CONFIG__ : FALLBACK_CONFIG;
|
|
24
|
-
}
|
|
25
|
-
function defaultImageLoader(config) {
|
|
26
|
-
return ({ src, width, quality }) => {
|
|
27
|
-
const query = new URLSearchParams({
|
|
28
|
-
url: src,
|
|
29
|
-
w: String(width),
|
|
30
|
-
q: String(quality)
|
|
31
|
-
});
|
|
32
|
-
return `${config.path}?${query}`;
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
function getClosestQuality(quality, allowed) {
|
|
36
|
-
const requested = quality ?? 75;
|
|
37
|
-
return allowed.reduce(
|
|
38
|
-
(closest, candidate) => Math.abs(candidate - requested) < Math.abs(closest - requested) ? candidate : closest
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
function getCandidateWidths(config, width, sizes, fill) {
|
|
42
|
-
const allSizes = [.../* @__PURE__ */ new Set([...config.imageSizes, ...config.deviceSizes])].sort(
|
|
43
|
-
(left, right) => left - right
|
|
44
|
-
);
|
|
45
|
-
if (fill || sizes) {
|
|
46
|
-
const viewportPercentages = [...sizes?.matchAll(/(^|\s)(\d{1,3})vw/g) ?? []].map(
|
|
47
|
-
(match) => Number(match[2])
|
|
48
|
-
);
|
|
49
|
-
if (viewportPercentages.length > 0) {
|
|
50
|
-
const smallestRatio = Math.min(...viewportPercentages) / 100;
|
|
51
|
-
const minimum = config.deviceSizes[0] * smallestRatio;
|
|
52
|
-
return { widths: allSizes.filter((candidate) => candidate >= minimum), descriptor: "w" };
|
|
53
|
-
}
|
|
54
|
-
return { widths: allSizes, descriptor: "w" };
|
|
55
|
-
}
|
|
56
|
-
if (!width) return { widths: config.deviceSizes.slice(), descriptor: "w" };
|
|
57
|
-
const requested = [width, width * 2];
|
|
58
|
-
const widths = requested.map(
|
|
59
|
-
(target) => allSizes.find((candidate) => candidate >= target) ?? allSizes.at(-1)
|
|
60
|
-
);
|
|
61
|
-
return { widths: [...new Set(widths)], descriptor: "x" };
|
|
62
|
-
}
|
|
63
|
-
function isStaticImageData(value) {
|
|
64
|
-
return typeof value === "object" && value !== null && typeof value.src === "string";
|
|
65
|
-
}
|
|
66
|
-
function shouldSkipOptimization(src, config) {
|
|
67
|
-
return config.provider === "none" || src.startsWith("data:") || src.startsWith("blob:") || /\.svg(?:$|[?#])/i.test(src);
|
|
68
|
-
}
|
|
69
11
|
function getImageProps(input) {
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
alt,
|
|
73
|
-
width: widthInput,
|
|
74
|
-
height: heightInput,
|
|
75
|
-
fill = false,
|
|
76
|
-
quality: qualityInput,
|
|
77
|
-
sizes: sizesInput,
|
|
78
|
-
loading,
|
|
79
|
-
preload: preload2 = false,
|
|
80
|
-
placeholder = "empty",
|
|
81
|
-
blurDataURL: blurDataURLInput,
|
|
82
|
-
unoptimized: unoptimizedInput = false,
|
|
83
|
-
loader: loaderInput,
|
|
84
|
-
style,
|
|
85
|
-
...rest
|
|
86
|
-
} = input;
|
|
87
|
-
const config = getImageConfig();
|
|
88
|
-
const staticImage = isStaticImageData(srcInput) ? srcInput : void 0;
|
|
89
|
-
const src = typeof srcInput === "string" ? srcInput : srcInput.src;
|
|
90
|
-
const width = Number(widthInput ?? staticImage?.width) || void 0;
|
|
91
|
-
const height = Number(heightInput ?? staticImage?.height) || void 0;
|
|
92
|
-
const blurDataURL = blurDataURLInput ?? staticImage?.blurDataURL;
|
|
93
|
-
if (!fill && (!width || !height)) {
|
|
94
|
-
throw new TypeError(
|
|
95
|
-
"Farm Image requires width and height unless src is a static import or fill is enabled"
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
if (fill && (widthInput !== void 0 || heightInput !== void 0)) {
|
|
99
|
-
throw new TypeError("Farm Image cannot use width or height together with fill");
|
|
100
|
-
}
|
|
101
|
-
if (placeholder === "blur" && !blurDataURL) {
|
|
102
|
-
throw new TypeError("Farm Image placeholder=blur requires a static import or blurDataURL");
|
|
103
|
-
}
|
|
104
|
-
const unoptimized = unoptimizedInput || shouldSkipOptimization(src, config);
|
|
105
|
-
const quality = getClosestQuality(qualityInput, config.qualities);
|
|
106
|
-
const loader = loaderInput ?? defaultImageLoader(config);
|
|
107
|
-
const sizes = sizesInput ?? (fill ? "100vw" : void 0);
|
|
108
|
-
const candidates = getCandidateWidths(config, width, sizes, fill);
|
|
109
|
-
const srcSet = unoptimized ? void 0 : candidates.widths.map((candidate, index) => {
|
|
110
|
-
const descriptor = candidates.descriptor === "w" ? `${candidate}w` : `${index + 1}x`;
|
|
111
|
-
return `${loader({ src, width: candidate, quality })} ${descriptor}`;
|
|
112
|
-
}).join(", ");
|
|
113
|
-
const renderedSrc = unoptimized ? src : loader({ src, width: candidates.widths.at(-1) ?? width ?? config.deviceSizes[0], quality });
|
|
114
|
-
const fillStyle = fill ? { position: "absolute", inset: 0, width: "100%", height: "100%" } : void 0;
|
|
115
|
-
const placeholderStyle = placeholder === "blur" ? {
|
|
116
|
-
backgroundImage: `url("${blurDataURL}")`,
|
|
117
|
-
backgroundPosition: "50% 50%",
|
|
118
|
-
backgroundRepeat: "no-repeat",
|
|
119
|
-
backgroundSize: "cover"
|
|
120
|
-
} : void 0;
|
|
121
|
-
return {
|
|
122
|
-
props: {
|
|
123
|
-
...rest,
|
|
124
|
-
alt,
|
|
125
|
-
src: renderedSrc,
|
|
126
|
-
srcSet,
|
|
127
|
-
sizes,
|
|
128
|
-
width: fill ? void 0 : width,
|
|
129
|
-
height: fill ? void 0 : height,
|
|
130
|
-
loading: preload2 ? "eager" : loading ?? "lazy",
|
|
131
|
-
fetchPriority: preload2 ? "high" : rest.fetchPriority,
|
|
132
|
-
decoding: rest.decoding ?? "async",
|
|
133
|
-
style: { ...fillStyle, ...placeholderStyle, ...style }
|
|
134
|
-
}
|
|
135
|
-
};
|
|
12
|
+
const attributes = resolveImageAttributes(input);
|
|
13
|
+
return { props: attributes };
|
|
136
14
|
}
|
|
137
15
|
var Image = forwardRef(function Image2(input, ref) {
|
|
138
16
|
const { props } = getImageProps(input);
|