next 15.2.0-canary.75 → 15.2.0-canary.76

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.

Potentially problematic release.


This version of next might be problematic. Click here for more details.

Files changed (120) hide show
  1. package/dist/bin/next +1 -1
  2. package/dist/build/index.js +2 -2
  3. package/dist/build/swc/index.js +1 -1
  4. package/dist/build/webpack-config.js +2 -2
  5. package/dist/client/app-bootstrap.js +1 -1
  6. package/dist/client/app-dir/form.d.ts +2 -43
  7. package/dist/client/app-dir/form.js +20 -144
  8. package/dist/client/app-dir/form.js.map +1 -1
  9. package/dist/client/components/react-dev-overlay/shared.d.ts +2 -0
  10. package/dist/client/components/react-dev-overlay/shared.js +10 -0
  11. package/dist/client/components/react-dev-overlay/shared.js.map +1 -1
  12. package/dist/client/components/react-dev-overlay/ui/components/call-stack-frame/call-stack-frame.d.ts +1 -1
  13. package/dist/client/components/react-dev-overlay/ui/components/call-stack-frame/call-stack-frame.js +11 -3
  14. package/dist/client/components/react-dev-overlay/ui/components/call-stack-frame/call-stack-frame.js.map +1 -1
  15. package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-indicator.d.ts +3 -4
  16. package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-indicator.js +45 -9
  17. package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-indicator.js.map +1 -1
  18. package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/dev-tools-info.d.ts +4 -4
  19. package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/dev-tools-info.js +5 -4
  20. package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/dev-tools-info.js.map +1 -1
  21. package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/route-info.d.ts +1 -1
  22. package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/route-info.js +1 -1
  23. package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/route-info.js.map +1 -1
  24. package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/turbopack-info.d.ts +1 -1
  25. package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/turbopack-info.js +1 -1
  26. package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/turbopack-info.js.map +1 -1
  27. package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/user-preferences.d.ts +10 -0
  28. package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/user-preferences.js +254 -0
  29. package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/user-preferences.js.map +1 -0
  30. package/dist/client/components/react-dev-overlay/ui/components/shadow-portal.js +12 -0
  31. package/dist/client/components/react-dev-overlay/ui/components/shadow-portal.js.map +1 -1
  32. package/dist/client/components/react-dev-overlay/ui/icons/dark-icon.d.ts +1 -0
  33. package/dist/client/components/react-dev-overlay/ui/icons/dark-icon.js +34 -0
  34. package/dist/client/components/react-dev-overlay/ui/icons/dark-icon.js.map +1 -0
  35. package/dist/client/components/react-dev-overlay/ui/icons/external.d.ts +1 -0
  36. package/dist/client/components/react-dev-overlay/ui/icons/external.js +31 -3
  37. package/dist/client/components/react-dev-overlay/ui/icons/external.js.map +1 -1
  38. package/dist/client/components/react-dev-overlay/ui/icons/eye-icon.d.ts +1 -0
  39. package/dist/client/components/react-dev-overlay/ui/icons/eye-icon.js +33 -0
  40. package/dist/client/components/react-dev-overlay/ui/icons/eye-icon.js.map +1 -0
  41. package/dist/client/components/react-dev-overlay/ui/icons/gear-icon.d.ts +1 -0
  42. package/dist/client/components/react-dev-overlay/ui/icons/gear-icon.js +34 -0
  43. package/dist/client/components/react-dev-overlay/ui/icons/gear-icon.js.map +1 -0
  44. package/dist/client/components/react-dev-overlay/ui/icons/light-icon.d.ts +1 -0
  45. package/dist/client/components/react-dev-overlay/ui/icons/light-icon.js +48 -0
  46. package/dist/client/components/react-dev-overlay/ui/icons/light-icon.js.map +1 -0
  47. package/dist/client/components/react-dev-overlay/ui/styles/base.js +14 -2
  48. package/dist/client/components/react-dev-overlay/ui/styles/base.js.map +1 -1
  49. package/dist/client/components/react-dev-overlay/ui/styles/colors.js +16 -4
  50. package/dist/client/components/react-dev-overlay/ui/styles/colors.js.map +1 -1
  51. package/dist/client/components/react-dev-overlay/ui/styles/component-styles.js +3 -1
  52. package/dist/client/components/react-dev-overlay/ui/styles/component-styles.js.map +1 -1
  53. package/dist/client/form-shared.d.ts +50 -0
  54. package/dist/client/form-shared.js +155 -0
  55. package/dist/client/form-shared.js.map +1 -0
  56. package/dist/client/form.d.ts +6 -41
  57. package/dist/client/form.js +38 -196
  58. package/dist/client/form.js.map +1 -1
  59. package/dist/client/index.js +1 -1
  60. package/dist/compiled/next-server/app-page-experimental.runtime.dev.js +3 -3
  61. package/dist/compiled/next-server/app-page-experimental.runtime.dev.js.map +1 -1
  62. package/dist/compiled/next-server/app-page.runtime.dev.js +3 -3
  63. package/dist/compiled/next-server/app-page.runtime.dev.js.map +1 -1
  64. package/dist/esm/build/index.js +2 -2
  65. package/dist/esm/build/swc/index.js +1 -1
  66. package/dist/esm/build/webpack-config.js +2 -2
  67. package/dist/esm/client/app-bootstrap.js +1 -1
  68. package/dist/esm/client/app-dir/form.js +17 -141
  69. package/dist/esm/client/app-dir/form.js.map +1 -1
  70. package/dist/esm/client/components/react-dev-overlay/shared.js +2 -0
  71. package/dist/esm/client/components/react-dev-overlay/shared.js.map +1 -1
  72. package/dist/esm/client/components/react-dev-overlay/ui/components/call-stack-frame/call-stack-frame.js +12 -4
  73. package/dist/esm/client/components/react-dev-overlay/ui/components/call-stack-frame/call-stack-frame.js.map +1 -1
  74. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-indicator.js +44 -9
  75. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-indicator.js.map +1 -1
  76. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/dev-tools-info.js +5 -4
  77. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/dev-tools-info.js.map +1 -1
  78. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/route-info.js +1 -1
  79. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/route-info.js.map +1 -1
  80. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/turbopack-info.js +1 -1
  81. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/turbopack-info.js.map +1 -1
  82. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/user-preferences.js +225 -0
  83. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-info/user-preferences.js.map +1 -0
  84. package/dist/esm/client/components/react-dev-overlay/ui/components/shadow-portal.js +12 -0
  85. package/dist/esm/client/components/react-dev-overlay/ui/components/shadow-portal.js.map +1 -1
  86. package/dist/esm/client/components/react-dev-overlay/ui/icons/dark-icon.js +18 -0
  87. package/dist/esm/client/components/react-dev-overlay/ui/icons/dark-icon.js.map +1 -0
  88. package/dist/esm/client/components/react-dev-overlay/ui/icons/external.js +16 -0
  89. package/dist/esm/client/components/react-dev-overlay/ui/icons/external.js.map +1 -1
  90. package/dist/esm/client/components/react-dev-overlay/ui/icons/eye-icon.js +17 -0
  91. package/dist/esm/client/components/react-dev-overlay/ui/icons/eye-icon.js.map +1 -0
  92. package/dist/esm/client/components/react-dev-overlay/ui/icons/gear-icon.js +18 -0
  93. package/dist/esm/client/components/react-dev-overlay/ui/icons/gear-icon.js.map +1 -0
  94. package/dist/esm/client/components/react-dev-overlay/ui/icons/light-icon.js +32 -0
  95. package/dist/esm/client/components/react-dev-overlay/ui/icons/light-icon.js.map +1 -0
  96. package/dist/esm/client/components/react-dev-overlay/ui/styles/base.js +14 -2
  97. package/dist/esm/client/components/react-dev-overlay/ui/styles/base.js.map +1 -1
  98. package/dist/esm/client/components/react-dev-overlay/ui/styles/colors.js +16 -4
  99. package/dist/esm/client/components/react-dev-overlay/ui/styles/colors.js.map +1 -1
  100. package/dist/esm/client/components/react-dev-overlay/ui/styles/component-styles.js +3 -1
  101. package/dist/esm/client/components/react-dev-overlay/ui/styles/component-styles.js.map +1 -1
  102. package/dist/esm/client/form-shared.js +103 -0
  103. package/dist/esm/client/form-shared.js.map +1 -0
  104. package/dist/esm/client/form.js +35 -193
  105. package/dist/esm/client/form.js.map +1 -1
  106. package/dist/esm/client/index.js +1 -1
  107. package/dist/esm/server/config.js +1 -1
  108. package/dist/esm/server/dev/hot-reloader-turbopack.js +1 -1
  109. package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
  110. package/dist/esm/server/lib/app-info-log.js +1 -1
  111. package/dist/esm/server/lib/start-server.js +1 -1
  112. package/dist/server/config.js +1 -1
  113. package/dist/server/dev/hot-reloader-turbopack.js +1 -1
  114. package/dist/server/dev/hot-reloader-webpack.js +1 -1
  115. package/dist/server/lib/app-info-log.js +1 -1
  116. package/dist/server/lib/start-server.js +1 -1
  117. package/dist/telemetry/anonymous-meta.js +1 -1
  118. package/dist/telemetry/events/session-stopped.js +2 -2
  119. package/dist/telemetry/events/version.js +2 -2
  120. package/package.json +24 -24
@@ -1,27 +1,39 @@
1
1
  import { _ as _tagged_template_literal_loose } from "@swc/helpers/_/_tagged_template_literal_loose";
2
2
  function _templateObject() {
3
3
  const data = _tagged_template_literal_loose([
4
- "\n :host {\n ",
5
- "\n /* cyan: keyword */\n --color-ansi-cyan: var(--color-syntax-keyword);\n /* yellow: capitalized, jsxIdentifier, punctuation */\n --color-ansi-yellow: var(--color-syntax-punctuation);\n /* magenta: number, regex */\n --color-ansi-magenta: var(--color-syntax-number);\n /* green: string */\n --color-ansi-green: var(--color-syntax-string);\n /* gray (bright black): comment, gutter */\n --color-ansi-bright-black: var(--color-syntax-comment);\n\n /* Ansi - Temporary */\n --color-ansi-selection: var(--color-gray-alpha-300);\n --color-ansi-bg: var(--color-background-200);\n --color-ansi-fg: var(--color-gray-1000);\n\n --color-ansi-white: var(--color-gray-700);\n --color-ansi-black: var(--color-gray-200);\n --color-ansi-blue: var(--color-blue-700);\n --color-ansi-red: var(--color-red-700);\n --color-ansi-bright-white: var(--color-gray-1000);\n --color-ansi-bright-blue: var(--color-blue-800);\n --color-ansi-bright-cyan: var(--color-blue-800);\n --color-ansi-bright-green: var(--color-green-800);\n --color-ansi-bright-magenta: var(--color-blue-800);\n --color-ansi-bright-red: var(--color-red-800);\n --color-ansi-bright-yellow: var(--color-amber-900);\n\n /* Background Light */\n --color-background-100: #ffffff;\n --color-background-200: #fafafa;\n\n /* Syntax Light */\n --color-syntax-comment: #666666;\n --color-syntax-constant: #171717;\n --color-syntax-function: #0068d6;\n --color-syntax-keyword: #c01b5d;\n --color-syntax-link: #067a6e;\n --color-syntax-parameter: #ad4b00;\n --color-syntax-punctuation: #171717;\n --color-syntax-string: #067a6e;\n --color-syntax-string-expression: #067a6e;\n\n /* Gray Scale Light */\n --color-gray-100: #f2f2f2;\n --color-gray-200: #ebebeb;\n --color-gray-300: #e6e6e6;\n --color-gray-400: #eaeaea;\n --color-gray-500: #c9c9c9;\n --color-gray-600: #a8a8a8;\n --color-gray-700: #8f8f8f;\n --color-gray-800: #7d7d7d;\n --color-gray-900: #666666;\n --color-gray-1000: #171717;\n\n /* Gray Alpha Scale Light */\n --color-gray-alpha-100: rgba(0, 0, 0, 0.05);\n --color-gray-alpha-200: rgba(0, 0, 0, 0.081);\n --color-gray-alpha-300: rgba(0, 0, 0, 0.1);\n --color-gray-alpha-400: rgba(0, 0, 0, 0.08);\n --color-gray-alpha-500: rgba(0, 0, 0, 0.21);\n --color-gray-alpha-600: rgba(0, 0, 0, 0.34);\n --color-gray-alpha-700: rgba(0, 0, 0, 0.44);\n --color-gray-alpha-800: rgba(0, 0, 0, 0.51);\n --color-gray-alpha-900: rgba(0, 0, 0, 0.605);\n --color-gray-alpha-1000: rgba(0, 0, 0, 0.91);\n\n /* Blue Scale Light */\n --color-blue-100: #f0f7ff;\n --color-blue-200: #edf6ff;\n --color-blue-300: #e1f0ff;\n --color-blue-400: #cde7ff;\n --color-blue-500: #99ceff;\n --color-blue-600: #52aeff;\n --color-blue-700: #0070f3;\n --color-blue-800: #0060d1;\n --color-blue-900: #0067d6;\n --color-blue-1000: #0025ad;\n\n /* Red Scale Light */\n --color-red-100: #fff0f0;\n --color-red-200: #ffebeb;\n --color-red-300: #ffe5e5;\n --color-red-400: #fdd8d8;\n --color-red-500: #f8baba;\n --color-red-600: #f87274;\n --color-red-700: #e5484d;\n --color-red-800: #da3036;\n --color-red-900: #ca2a30;\n --color-red-1000: #381316;\n\n /* Amber Scale Light */\n --color-amber-100: #fff6e5;\n --color-amber-200: #fff4d5;\n --color-amber-300: #fef0cd;\n --color-amber-400: #ffddbf;\n --color-amber-500: #ffc96b;\n --color-amber-600: #f5b047;\n --color-amber-700: #ffb224;\n --color-amber-800: #ff990a;\n --color-amber-900: #a35200;\n --color-amber-1000: #4e2009;\n\n /* Green Scale Light */\n --color-green-100: #effbef;\n --color-green-200: #eafaea;\n --color-green-300: #dcf6dc;\n --color-green-400: #c8f1c9;\n --color-green-500: #99e59f;\n --color-green-600: #6cda76;\n --color-green-700: #46a758;\n --color-green-800: #388e4a;\n --color-green-900: #297c3b;\n --color-green-1000: #18311e;\n\n /* Turbopack Light - Temporary */\n --color-turbopack-text-red: #ff1e56;\n --color-turbopack-text-blue: #0096ff;\n --color-turbopack-border-red: #f0adbe;\n --color-turbopack-border-blue: #adccea;\n --color-turbopack-background-red: #fff7f9;\n --color-turbopack-background-blue: #f6fbff;\n }\n\n @media (prefers-color-scheme: dark) {\n :host {\n /* Background Dark */\n --color-background-100: #0a0a0a;\n --color-background-200: #000000;\n\n /* Syntax Dark */\n --color-syntax-comment: #a0a0a0;\n --color-syntax-constant: #ededed;\n --color-syntax-function: #52a9ff;\n --color-syntax-keyword: #f76191;\n --color-syntax-link: #0ac5b2;\n --color-syntax-parameter: #f1a10d;\n --color-syntax-punctuation: #ededed;\n --color-syntax-string: #0ac5b2;\n --color-syntax-string-expression: #0ac5b2;\n\n /* Gray Scale Dark */\n --color-gray-100: #1a1a1a;\n --color-gray-200: #1f1f1f;\n --color-gray-300: #292929;\n --color-gray-400: #2e2e2e;\n --color-gray-500: #454545;\n --color-gray-600: #878787;\n --color-gray-700: #8f8f8f;\n --color-gray-800: #7d7d7d;\n --color-gray-900: #a0a0a0;\n --color-gray-1000: #ededed;\n\n /* Gray Alpha Scale Dark */\n --color-gray-alpha-100: rgba(255, 255, 255, 0.066);\n --color-gray-alpha-200: rgba(255, 255, 255, 0.087);\n --color-gray-alpha-300: rgba(255, 255, 255, 0.125);\n --color-gray-alpha-400: rgba(255, 255, 255, 0.145);\n --color-gray-alpha-500: rgba(255, 255, 255, 0.239);\n --color-gray-alpha-600: rgba(255, 255, 255, 0.506);\n --color-gray-alpha-700: rgba(255, 255, 255, 0.54);\n --color-gray-alpha-800: rgba(255, 255, 255, 0.47);\n --color-gray-alpha-900: rgba(255, 255, 255, 0.61);\n --color-gray-alpha-1000: rgba(255, 255, 255, 0.923);\n\n /* Blue Scale Dark */\n --color-blue-100: #0f1b2d;\n --color-blue-200: #10243e;\n --color-blue-300: #0f3058;\n --color-blue-400: #0d3868;\n --color-blue-500: #0a4481;\n --color-blue-600: #0091ff;\n --color-blue-700: #0070f3;\n --color-blue-800: #0060d1;\n --color-blue-900: #52a9ff;\n --color-blue-1000: #eaf6ff;\n\n /* Red Scale Dark */\n --color-red-100: #2a1314;\n --color-red-200: #3d1719;\n --color-red-300: #551a1e;\n --color-red-400: #671e22;\n --color-red-500: #822025;\n --color-red-600: #e5484d;\n --color-red-700: #e5484d;\n --color-red-800: #da3036;\n --color-red-900: #ff6369;\n --color-red-1000: #ffecee;\n\n /* Amber Scale Dark */\n --color-amber-100: #271700;\n --color-amber-200: #341c00;\n --color-amber-300: #4a2900;\n --color-amber-400: #573300;\n --color-amber-500: #693f05;\n --color-amber-600: #e79c13;\n --color-amber-700: #ffb224;\n --color-amber-800: #ff990a;\n --color-amber-900: #f1a10d;\n --color-amber-1000: #fef3dd;\n\n /* Green Scale Dark */\n --color-green-100: #0b2211;\n --color-green-200: #0f2c17;\n --color-green-300: #11351b;\n --color-green-400: #0c461b;\n --color-green-500: #126427;\n --color-green-600: #1a9338;\n --color-green-700: #46a758;\n --color-green-800: #388e4a;\n --color-green-900: #63c174;\n --color-green-1000: #e5fbeb;\n\n /* Turbopack Dark - Temporary */\n --color-turbopack-text-red: #ff6d92;\n --color-turbopack-text-blue: #45b2ff;\n --color-turbopack-border-red: #6e293b;\n --color-turbopack-border-blue: #284f80;\n --color-turbopack-background-red: #250d12;\n --color-turbopack-background-blue: #0a1723;\n }\n }\n "
4
+ "\n /* Background Dark */\n --color-background-100: #0a0a0a;\n --color-background-200: #000000;\n\n /* Syntax Dark */\n --color-syntax-comment: #a0a0a0;\n --color-syntax-constant: #ededed;\n --color-syntax-function: #52a9ff;\n --color-syntax-keyword: #f76191;\n --color-syntax-link: #0ac5b2;\n --color-syntax-parameter: #f1a10d;\n --color-syntax-punctuation: #ededed;\n --color-syntax-string: #0ac5b2;\n --color-syntax-string-expression: #0ac5b2;\n\n /* Gray Scale Dark */\n --color-gray-100: #1a1a1a;\n --color-gray-200: #1f1f1f;\n --color-gray-300: #292929;\n --color-gray-400: #2e2e2e;\n --color-gray-500: #454545;\n --color-gray-600: #878787;\n --color-gray-700: #8f8f8f;\n --color-gray-800: #7d7d7d;\n --color-gray-900: #a0a0a0;\n --color-gray-1000: #ededed;\n\n /* Gray Alpha Scale Dark */\n --color-gray-alpha-100: rgba(255, 255, 255, 0.066);\n --color-gray-alpha-200: rgba(255, 255, 255, 0.087);\n --color-gray-alpha-300: rgba(255, 255, 255, 0.125);\n --color-gray-alpha-400: rgba(255, 255, 255, 0.145);\n --color-gray-alpha-500: rgba(255, 255, 255, 0.239);\n --color-gray-alpha-600: rgba(255, 255, 255, 0.506);\n --color-gray-alpha-700: rgba(255, 255, 255, 0.54);\n --color-gray-alpha-800: rgba(255, 255, 255, 0.47);\n --color-gray-alpha-900: rgba(255, 255, 255, 0.61);\n --color-gray-alpha-1000: rgba(255, 255, 255, 0.923);\n\n /* Blue Scale Dark */\n --color-blue-100: #0f1b2d;\n --color-blue-200: #10243e;\n --color-blue-300: #0f3058;\n --color-blue-400: #0d3868;\n --color-blue-500: #0a4481;\n --color-blue-600: #0091ff;\n --color-blue-700: #0070f3;\n --color-blue-800: #0060d1;\n --color-blue-900: #52a9ff;\n --color-blue-1000: #eaf6ff;\n\n /* Red Scale Dark */\n --color-red-100: #2a1314;\n --color-red-200: #3d1719;\n --color-red-300: #551a1e;\n --color-red-400: #671e22;\n --color-red-500: #822025;\n --color-red-600: #e5484d;\n --color-red-700: #e5484d;\n --color-red-800: #da3036;\n --color-red-900: #ff6369;\n --color-red-1000: #ffecee;\n\n /* Amber Scale Dark */\n --color-amber-100: #271700;\n --color-amber-200: #341c00;\n --color-amber-300: #4a2900;\n --color-amber-400: #573300;\n --color-amber-500: #693f05;\n --color-amber-600: #e79c13;\n --color-amber-700: #ffb224;\n --color-amber-800: #ff990a;\n --color-amber-900: #f1a10d;\n --color-amber-1000: #fef3dd;\n\n /* Green Scale Dark */\n --color-green-100: #0b2211;\n --color-green-200: #0f2c17;\n --color-green-300: #11351b;\n --color-green-400: #0c461b;\n --color-green-500: #126427;\n --color-green-600: #1a9338;\n --color-green-700: #46a758;\n --color-green-800: #388e4a;\n --color-green-900: #63c174;\n --color-green-1000: #e5fbeb;\n\n /* Turbopack Dark - Temporary */\n --color-turbopack-text-red: #ff6d92;\n --color-turbopack-text-blue: #45b2ff;\n --color-turbopack-border-red: #6e293b;\n --color-turbopack-border-blue: #284f80;\n --color-turbopack-background-red: #250d12;\n --color-turbopack-background-blue: #0a1723;\n"
6
5
  ]);
7
6
  _templateObject = function() {
8
7
  return data;
9
8
  };
10
9
  return data;
11
10
  }
11
+ function _templateObject1() {
12
+ const data = _tagged_template_literal_loose([
13
+ "\n :host {\n ",
14
+ "\n /* cyan: keyword */\n --color-ansi-cyan: var(--color-syntax-keyword);\n /* yellow: capitalized, jsxIdentifier, punctuation */\n --color-ansi-yellow: var(--color-syntax-punctuation);\n /* magenta: number, regex */\n --color-ansi-magenta: var(--color-syntax-number);\n /* green: string */\n --color-ansi-green: var(--color-syntax-string);\n /* gray (bright black): comment, gutter */\n --color-ansi-bright-black: var(--color-syntax-comment);\n\n /* Ansi - Temporary */\n --color-ansi-selection: var(--color-gray-alpha-300);\n --color-ansi-bg: var(--color-background-200);\n --color-ansi-fg: var(--color-gray-1000);\n\n --color-ansi-white: var(--color-gray-700);\n --color-ansi-black: var(--color-gray-200);\n --color-ansi-blue: var(--color-blue-700);\n --color-ansi-red: var(--color-red-700);\n --color-ansi-bright-white: var(--color-gray-1000);\n --color-ansi-bright-blue: var(--color-blue-800);\n --color-ansi-bright-cyan: var(--color-blue-800);\n --color-ansi-bright-green: var(--color-green-800);\n --color-ansi-bright-magenta: var(--color-blue-800);\n --color-ansi-bright-red: var(--color-red-800);\n --color-ansi-bright-yellow: var(--color-amber-900);\n\n /* Background Light */\n --color-background-100: #ffffff;\n --color-background-200: #fafafa;\n\n /* Syntax Light */\n --color-syntax-comment: #666666;\n --color-syntax-constant: #171717;\n --color-syntax-function: #0068d6;\n --color-syntax-keyword: #c01b5d;\n --color-syntax-link: #067a6e;\n --color-syntax-parameter: #ad4b00;\n --color-syntax-punctuation: #171717;\n --color-syntax-string: #067a6e;\n --color-syntax-string-expression: #067a6e;\n\n /* Gray Scale Light */\n --color-gray-100: #f2f2f2;\n --color-gray-200: #ebebeb;\n --color-gray-300: #e6e6e6;\n --color-gray-400: #eaeaea;\n --color-gray-500: #c9c9c9;\n --color-gray-600: #a8a8a8;\n --color-gray-700: #8f8f8f;\n --color-gray-800: #7d7d7d;\n --color-gray-900: #666666;\n --color-gray-1000: #171717;\n\n /* Gray Alpha Scale Light */\n --color-gray-alpha-100: rgba(0, 0, 0, 0.05);\n --color-gray-alpha-200: rgba(0, 0, 0, 0.081);\n --color-gray-alpha-300: rgba(0, 0, 0, 0.1);\n --color-gray-alpha-400: rgba(0, 0, 0, 0.08);\n --color-gray-alpha-500: rgba(0, 0, 0, 0.21);\n --color-gray-alpha-600: rgba(0, 0, 0, 0.34);\n --color-gray-alpha-700: rgba(0, 0, 0, 0.44);\n --color-gray-alpha-800: rgba(0, 0, 0, 0.51);\n --color-gray-alpha-900: rgba(0, 0, 0, 0.605);\n --color-gray-alpha-1000: rgba(0, 0, 0, 0.91);\n\n /* Blue Scale Light */\n --color-blue-100: #f0f7ff;\n --color-blue-200: #edf6ff;\n --color-blue-300: #e1f0ff;\n --color-blue-400: #cde7ff;\n --color-blue-500: #99ceff;\n --color-blue-600: #52aeff;\n --color-blue-700: #0070f3;\n --color-blue-800: #0060d1;\n --color-blue-900: #0067d6;\n --color-blue-1000: #0025ad;\n\n /* Red Scale Light */\n --color-red-100: #fff0f0;\n --color-red-200: #ffebeb;\n --color-red-300: #ffe5e5;\n --color-red-400: #fdd8d8;\n --color-red-500: #f8baba;\n --color-red-600: #f87274;\n --color-red-700: #e5484d;\n --color-red-800: #da3036;\n --color-red-900: #ca2a30;\n --color-red-1000: #381316;\n\n /* Amber Scale Light */\n --color-amber-100: #fff6e5;\n --color-amber-200: #fff4d5;\n --color-amber-300: #fef0cd;\n --color-amber-400: #ffddbf;\n --color-amber-500: #ffc96b;\n --color-amber-600: #f5b047;\n --color-amber-700: #ffb224;\n --color-amber-800: #ff990a;\n --color-amber-900: #a35200;\n --color-amber-1000: #4e2009;\n\n /* Green Scale Light */\n --color-green-100: #effbef;\n --color-green-200: #eafaea;\n --color-green-300: #dcf6dc;\n --color-green-400: #c8f1c9;\n --color-green-500: #99e59f;\n --color-green-600: #6cda76;\n --color-green-700: #46a758;\n --color-green-800: #388e4a;\n --color-green-900: #297c3b;\n --color-green-1000: #18311e;\n\n /* Turbopack Light - Temporary */\n --color-turbopack-text-red: #ff1e56;\n --color-turbopack-text-blue: #0096ff;\n --color-turbopack-border-red: #f0adbe;\n --color-turbopack-border-blue: #adccea;\n --color-turbopack-background-red: #fff7f9;\n --color-turbopack-background-blue: #f6fbff;\n }\n\n :host(.dark) {\n ",
15
+ "\n }\n\n @media (prefers-color-scheme: dark) {\n :host(:not(.light)) {\n ",
16
+ "\n }\n }\n "
17
+ ]);
18
+ _templateObject1 = function() {
19
+ return data;
20
+ };
21
+ return data;
22
+ }
12
23
  import { jsx as _jsx } from "react/jsx-runtime";
13
24
  import { css } from '../../utils/css';
25
+ const darkTheme = css(_templateObject());
14
26
  // TODO: Replace the existing colors in Base.tsx.
15
27
  export function Colors() {
16
28
  return /*#__PURE__*/ _jsx("style", {
17
- children: css(_templateObject(), // CAUTION: THIS IS A WORKAROUND!
29
+ children: css(_templateObject1(), // CAUTION: THIS IS A WORKAROUND!
18
30
  // For now, we use @babel/code-frame to parse the code frame which does not support option to change the color.
19
31
  // x-ref: https://github.com/babel/babel/blob/efa52324ff835b794c48080f14877b6caf32cd15/packages/babel-code-frame/src/defs.ts#L40-L54
20
32
  // So, we do a workaround mapping to change the color matching the theme.
21
33
  // For example, in @babel/code-frame, the `keyword` is mapped to ANSI "cyan".
22
34
  // We want the `keyword` to use the `syntax-keyword` color in the theme.
23
35
  // So, we map the "cyan" to the `syntax-keyword` in the theme.
24
- '')
36
+ '', darkTheme, darkTheme)
25
37
  });
26
38
  }
27
39
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/client/components/react-dev-overlay/ui/styles/colors.tsx"],"sourcesContent":["import { css } from '../../utils/css'\n\n// TODO: Replace the existing colors in Base.tsx.\nexport function Colors() {\n return (\n <style>\n {css`\n :host {\n ${\n // CAUTION: THIS IS A WORKAROUND!\n // For now, we use @babel/code-frame to parse the code frame which does not support option to change the color.\n // x-ref: https://github.com/babel/babel/blob/efa52324ff835b794c48080f14877b6caf32cd15/packages/babel-code-frame/src/defs.ts#L40-L54\n // So, we do a workaround mapping to change the color matching the theme.\n\n // For example, in @babel/code-frame, the `keyword` is mapped to ANSI \"cyan\".\n // We want the `keyword` to use the `syntax-keyword` color in the theme.\n // So, we map the \"cyan\" to the `syntax-keyword` in the theme.\n ''\n }\n /* cyan: keyword */\n --color-ansi-cyan: var(--color-syntax-keyword);\n /* yellow: capitalized, jsxIdentifier, punctuation */\n --color-ansi-yellow: var(--color-syntax-punctuation);\n /* magenta: number, regex */\n --color-ansi-magenta: var(--color-syntax-number);\n /* green: string */\n --color-ansi-green: var(--color-syntax-string);\n /* gray (bright black): comment, gutter */\n --color-ansi-bright-black: var(--color-syntax-comment);\n\n /* Ansi - Temporary */\n --color-ansi-selection: var(--color-gray-alpha-300);\n --color-ansi-bg: var(--color-background-200);\n --color-ansi-fg: var(--color-gray-1000);\n\n --color-ansi-white: var(--color-gray-700);\n --color-ansi-black: var(--color-gray-200);\n --color-ansi-blue: var(--color-blue-700);\n --color-ansi-red: var(--color-red-700);\n --color-ansi-bright-white: var(--color-gray-1000);\n --color-ansi-bright-blue: var(--color-blue-800);\n --color-ansi-bright-cyan: var(--color-blue-800);\n --color-ansi-bright-green: var(--color-green-800);\n --color-ansi-bright-magenta: var(--color-blue-800);\n --color-ansi-bright-red: var(--color-red-800);\n --color-ansi-bright-yellow: var(--color-amber-900);\n\n /* Background Light */\n --color-background-100: #ffffff;\n --color-background-200: #fafafa;\n\n /* Syntax Light */\n --color-syntax-comment: #666666;\n --color-syntax-constant: #171717;\n --color-syntax-function: #0068d6;\n --color-syntax-keyword: #c01b5d;\n --color-syntax-link: #067a6e;\n --color-syntax-parameter: #ad4b00;\n --color-syntax-punctuation: #171717;\n --color-syntax-string: #067a6e;\n --color-syntax-string-expression: #067a6e;\n\n /* Gray Scale Light */\n --color-gray-100: #f2f2f2;\n --color-gray-200: #ebebeb;\n --color-gray-300: #e6e6e6;\n --color-gray-400: #eaeaea;\n --color-gray-500: #c9c9c9;\n --color-gray-600: #a8a8a8;\n --color-gray-700: #8f8f8f;\n --color-gray-800: #7d7d7d;\n --color-gray-900: #666666;\n --color-gray-1000: #171717;\n\n /* Gray Alpha Scale Light */\n --color-gray-alpha-100: rgba(0, 0, 0, 0.05);\n --color-gray-alpha-200: rgba(0, 0, 0, 0.081);\n --color-gray-alpha-300: rgba(0, 0, 0, 0.1);\n --color-gray-alpha-400: rgba(0, 0, 0, 0.08);\n --color-gray-alpha-500: rgba(0, 0, 0, 0.21);\n --color-gray-alpha-600: rgba(0, 0, 0, 0.34);\n --color-gray-alpha-700: rgba(0, 0, 0, 0.44);\n --color-gray-alpha-800: rgba(0, 0, 0, 0.51);\n --color-gray-alpha-900: rgba(0, 0, 0, 0.605);\n --color-gray-alpha-1000: rgba(0, 0, 0, 0.91);\n\n /* Blue Scale Light */\n --color-blue-100: #f0f7ff;\n --color-blue-200: #edf6ff;\n --color-blue-300: #e1f0ff;\n --color-blue-400: #cde7ff;\n --color-blue-500: #99ceff;\n --color-blue-600: #52aeff;\n --color-blue-700: #0070f3;\n --color-blue-800: #0060d1;\n --color-blue-900: #0067d6;\n --color-blue-1000: #0025ad;\n\n /* Red Scale Light */\n --color-red-100: #fff0f0;\n --color-red-200: #ffebeb;\n --color-red-300: #ffe5e5;\n --color-red-400: #fdd8d8;\n --color-red-500: #f8baba;\n --color-red-600: #f87274;\n --color-red-700: #e5484d;\n --color-red-800: #da3036;\n --color-red-900: #ca2a30;\n --color-red-1000: #381316;\n\n /* Amber Scale Light */\n --color-amber-100: #fff6e5;\n --color-amber-200: #fff4d5;\n --color-amber-300: #fef0cd;\n --color-amber-400: #ffddbf;\n --color-amber-500: #ffc96b;\n --color-amber-600: #f5b047;\n --color-amber-700: #ffb224;\n --color-amber-800: #ff990a;\n --color-amber-900: #a35200;\n --color-amber-1000: #4e2009;\n\n /* Green Scale Light */\n --color-green-100: #effbef;\n --color-green-200: #eafaea;\n --color-green-300: #dcf6dc;\n --color-green-400: #c8f1c9;\n --color-green-500: #99e59f;\n --color-green-600: #6cda76;\n --color-green-700: #46a758;\n --color-green-800: #388e4a;\n --color-green-900: #297c3b;\n --color-green-1000: #18311e;\n\n /* Turbopack Light - Temporary */\n --color-turbopack-text-red: #ff1e56;\n --color-turbopack-text-blue: #0096ff;\n --color-turbopack-border-red: #f0adbe;\n --color-turbopack-border-blue: #adccea;\n --color-turbopack-background-red: #fff7f9;\n --color-turbopack-background-blue: #f6fbff;\n }\n\n @media (prefers-color-scheme: dark) {\n :host {\n /* Background Dark */\n --color-background-100: #0a0a0a;\n --color-background-200: #000000;\n\n /* Syntax Dark */\n --color-syntax-comment: #a0a0a0;\n --color-syntax-constant: #ededed;\n --color-syntax-function: #52a9ff;\n --color-syntax-keyword: #f76191;\n --color-syntax-link: #0ac5b2;\n --color-syntax-parameter: #f1a10d;\n --color-syntax-punctuation: #ededed;\n --color-syntax-string: #0ac5b2;\n --color-syntax-string-expression: #0ac5b2;\n\n /* Gray Scale Dark */\n --color-gray-100: #1a1a1a;\n --color-gray-200: #1f1f1f;\n --color-gray-300: #292929;\n --color-gray-400: #2e2e2e;\n --color-gray-500: #454545;\n --color-gray-600: #878787;\n --color-gray-700: #8f8f8f;\n --color-gray-800: #7d7d7d;\n --color-gray-900: #a0a0a0;\n --color-gray-1000: #ededed;\n\n /* Gray Alpha Scale Dark */\n --color-gray-alpha-100: rgba(255, 255, 255, 0.066);\n --color-gray-alpha-200: rgba(255, 255, 255, 0.087);\n --color-gray-alpha-300: rgba(255, 255, 255, 0.125);\n --color-gray-alpha-400: rgba(255, 255, 255, 0.145);\n --color-gray-alpha-500: rgba(255, 255, 255, 0.239);\n --color-gray-alpha-600: rgba(255, 255, 255, 0.506);\n --color-gray-alpha-700: rgba(255, 255, 255, 0.54);\n --color-gray-alpha-800: rgba(255, 255, 255, 0.47);\n --color-gray-alpha-900: rgba(255, 255, 255, 0.61);\n --color-gray-alpha-1000: rgba(255, 255, 255, 0.923);\n\n /* Blue Scale Dark */\n --color-blue-100: #0f1b2d;\n --color-blue-200: #10243e;\n --color-blue-300: #0f3058;\n --color-blue-400: #0d3868;\n --color-blue-500: #0a4481;\n --color-blue-600: #0091ff;\n --color-blue-700: #0070f3;\n --color-blue-800: #0060d1;\n --color-blue-900: #52a9ff;\n --color-blue-1000: #eaf6ff;\n\n /* Red Scale Dark */\n --color-red-100: #2a1314;\n --color-red-200: #3d1719;\n --color-red-300: #551a1e;\n --color-red-400: #671e22;\n --color-red-500: #822025;\n --color-red-600: #e5484d;\n --color-red-700: #e5484d;\n --color-red-800: #da3036;\n --color-red-900: #ff6369;\n --color-red-1000: #ffecee;\n\n /* Amber Scale Dark */\n --color-amber-100: #271700;\n --color-amber-200: #341c00;\n --color-amber-300: #4a2900;\n --color-amber-400: #573300;\n --color-amber-500: #693f05;\n --color-amber-600: #e79c13;\n --color-amber-700: #ffb224;\n --color-amber-800: #ff990a;\n --color-amber-900: #f1a10d;\n --color-amber-1000: #fef3dd;\n\n /* Green Scale Dark */\n --color-green-100: #0b2211;\n --color-green-200: #0f2c17;\n --color-green-300: #11351b;\n --color-green-400: #0c461b;\n --color-green-500: #126427;\n --color-green-600: #1a9338;\n --color-green-700: #46a758;\n --color-green-800: #388e4a;\n --color-green-900: #63c174;\n --color-green-1000: #e5fbeb;\n\n /* Turbopack Dark - Temporary */\n --color-turbopack-text-red: #ff6d92;\n --color-turbopack-text-blue: #45b2ff;\n --color-turbopack-border-red: #6e293b;\n --color-turbopack-border-blue: #284f80;\n --color-turbopack-background-red: #250d12;\n --color-turbopack-background-blue: #0a1723;\n }\n }\n `}\n </style>\n )\n}\n"],"names":["css","Colors","style"],"mappings":";;;;;;;;;;;;AAAA,SAASA,GAAG,QAAQ,kBAAiB;AAErC,iDAAiD;AACjD,OAAO,SAASC;IACd,qBACE,KAACC;kBACEF,uBAGK,iCAAiC;QACjC,+GAA+G;QAC/G,oIAAoI;QACpI,yEAAyE;QAEzE,6EAA6E;QAC7E,wEAAwE;QACxE,8DAA8D;QAC9D;;AAmOZ"}
1
+ {"version":3,"sources":["../../../../../../src/client/components/react-dev-overlay/ui/styles/colors.tsx"],"sourcesContent":["import { css } from '../../utils/css'\n\nconst darkTheme = css`\n /* Background Dark */\n --color-background-100: #0a0a0a;\n --color-background-200: #000000;\n\n /* Syntax Dark */\n --color-syntax-comment: #a0a0a0;\n --color-syntax-constant: #ededed;\n --color-syntax-function: #52a9ff;\n --color-syntax-keyword: #f76191;\n --color-syntax-link: #0ac5b2;\n --color-syntax-parameter: #f1a10d;\n --color-syntax-punctuation: #ededed;\n --color-syntax-string: #0ac5b2;\n --color-syntax-string-expression: #0ac5b2;\n\n /* Gray Scale Dark */\n --color-gray-100: #1a1a1a;\n --color-gray-200: #1f1f1f;\n --color-gray-300: #292929;\n --color-gray-400: #2e2e2e;\n --color-gray-500: #454545;\n --color-gray-600: #878787;\n --color-gray-700: #8f8f8f;\n --color-gray-800: #7d7d7d;\n --color-gray-900: #a0a0a0;\n --color-gray-1000: #ededed;\n\n /* Gray Alpha Scale Dark */\n --color-gray-alpha-100: rgba(255, 255, 255, 0.066);\n --color-gray-alpha-200: rgba(255, 255, 255, 0.087);\n --color-gray-alpha-300: rgba(255, 255, 255, 0.125);\n --color-gray-alpha-400: rgba(255, 255, 255, 0.145);\n --color-gray-alpha-500: rgba(255, 255, 255, 0.239);\n --color-gray-alpha-600: rgba(255, 255, 255, 0.506);\n --color-gray-alpha-700: rgba(255, 255, 255, 0.54);\n --color-gray-alpha-800: rgba(255, 255, 255, 0.47);\n --color-gray-alpha-900: rgba(255, 255, 255, 0.61);\n --color-gray-alpha-1000: rgba(255, 255, 255, 0.923);\n\n /* Blue Scale Dark */\n --color-blue-100: #0f1b2d;\n --color-blue-200: #10243e;\n --color-blue-300: #0f3058;\n --color-blue-400: #0d3868;\n --color-blue-500: #0a4481;\n --color-blue-600: #0091ff;\n --color-blue-700: #0070f3;\n --color-blue-800: #0060d1;\n --color-blue-900: #52a9ff;\n --color-blue-1000: #eaf6ff;\n\n /* Red Scale Dark */\n --color-red-100: #2a1314;\n --color-red-200: #3d1719;\n --color-red-300: #551a1e;\n --color-red-400: #671e22;\n --color-red-500: #822025;\n --color-red-600: #e5484d;\n --color-red-700: #e5484d;\n --color-red-800: #da3036;\n --color-red-900: #ff6369;\n --color-red-1000: #ffecee;\n\n /* Amber Scale Dark */\n --color-amber-100: #271700;\n --color-amber-200: #341c00;\n --color-amber-300: #4a2900;\n --color-amber-400: #573300;\n --color-amber-500: #693f05;\n --color-amber-600: #e79c13;\n --color-amber-700: #ffb224;\n --color-amber-800: #ff990a;\n --color-amber-900: #f1a10d;\n --color-amber-1000: #fef3dd;\n\n /* Green Scale Dark */\n --color-green-100: #0b2211;\n --color-green-200: #0f2c17;\n --color-green-300: #11351b;\n --color-green-400: #0c461b;\n --color-green-500: #126427;\n --color-green-600: #1a9338;\n --color-green-700: #46a758;\n --color-green-800: #388e4a;\n --color-green-900: #63c174;\n --color-green-1000: #e5fbeb;\n\n /* Turbopack Dark - Temporary */\n --color-turbopack-text-red: #ff6d92;\n --color-turbopack-text-blue: #45b2ff;\n --color-turbopack-border-red: #6e293b;\n --color-turbopack-border-blue: #284f80;\n --color-turbopack-background-red: #250d12;\n --color-turbopack-background-blue: #0a1723;\n`\n\n// TODO: Replace the existing colors in Base.tsx.\nexport function Colors() {\n return (\n <style>\n {css`\n :host {\n ${\n // CAUTION: THIS IS A WORKAROUND!\n // For now, we use @babel/code-frame to parse the code frame which does not support option to change the color.\n // x-ref: https://github.com/babel/babel/blob/efa52324ff835b794c48080f14877b6caf32cd15/packages/babel-code-frame/src/defs.ts#L40-L54\n // So, we do a workaround mapping to change the color matching the theme.\n\n // For example, in @babel/code-frame, the `keyword` is mapped to ANSI \"cyan\".\n // We want the `keyword` to use the `syntax-keyword` color in the theme.\n // So, we map the \"cyan\" to the `syntax-keyword` in the theme.\n ''\n }\n /* cyan: keyword */\n --color-ansi-cyan: var(--color-syntax-keyword);\n /* yellow: capitalized, jsxIdentifier, punctuation */\n --color-ansi-yellow: var(--color-syntax-punctuation);\n /* magenta: number, regex */\n --color-ansi-magenta: var(--color-syntax-number);\n /* green: string */\n --color-ansi-green: var(--color-syntax-string);\n /* gray (bright black): comment, gutter */\n --color-ansi-bright-black: var(--color-syntax-comment);\n\n /* Ansi - Temporary */\n --color-ansi-selection: var(--color-gray-alpha-300);\n --color-ansi-bg: var(--color-background-200);\n --color-ansi-fg: var(--color-gray-1000);\n\n --color-ansi-white: var(--color-gray-700);\n --color-ansi-black: var(--color-gray-200);\n --color-ansi-blue: var(--color-blue-700);\n --color-ansi-red: var(--color-red-700);\n --color-ansi-bright-white: var(--color-gray-1000);\n --color-ansi-bright-blue: var(--color-blue-800);\n --color-ansi-bright-cyan: var(--color-blue-800);\n --color-ansi-bright-green: var(--color-green-800);\n --color-ansi-bright-magenta: var(--color-blue-800);\n --color-ansi-bright-red: var(--color-red-800);\n --color-ansi-bright-yellow: var(--color-amber-900);\n\n /* Background Light */\n --color-background-100: #ffffff;\n --color-background-200: #fafafa;\n\n /* Syntax Light */\n --color-syntax-comment: #666666;\n --color-syntax-constant: #171717;\n --color-syntax-function: #0068d6;\n --color-syntax-keyword: #c01b5d;\n --color-syntax-link: #067a6e;\n --color-syntax-parameter: #ad4b00;\n --color-syntax-punctuation: #171717;\n --color-syntax-string: #067a6e;\n --color-syntax-string-expression: #067a6e;\n\n /* Gray Scale Light */\n --color-gray-100: #f2f2f2;\n --color-gray-200: #ebebeb;\n --color-gray-300: #e6e6e6;\n --color-gray-400: #eaeaea;\n --color-gray-500: #c9c9c9;\n --color-gray-600: #a8a8a8;\n --color-gray-700: #8f8f8f;\n --color-gray-800: #7d7d7d;\n --color-gray-900: #666666;\n --color-gray-1000: #171717;\n\n /* Gray Alpha Scale Light */\n --color-gray-alpha-100: rgba(0, 0, 0, 0.05);\n --color-gray-alpha-200: rgba(0, 0, 0, 0.081);\n --color-gray-alpha-300: rgba(0, 0, 0, 0.1);\n --color-gray-alpha-400: rgba(0, 0, 0, 0.08);\n --color-gray-alpha-500: rgba(0, 0, 0, 0.21);\n --color-gray-alpha-600: rgba(0, 0, 0, 0.34);\n --color-gray-alpha-700: rgba(0, 0, 0, 0.44);\n --color-gray-alpha-800: rgba(0, 0, 0, 0.51);\n --color-gray-alpha-900: rgba(0, 0, 0, 0.605);\n --color-gray-alpha-1000: rgba(0, 0, 0, 0.91);\n\n /* Blue Scale Light */\n --color-blue-100: #f0f7ff;\n --color-blue-200: #edf6ff;\n --color-blue-300: #e1f0ff;\n --color-blue-400: #cde7ff;\n --color-blue-500: #99ceff;\n --color-blue-600: #52aeff;\n --color-blue-700: #0070f3;\n --color-blue-800: #0060d1;\n --color-blue-900: #0067d6;\n --color-blue-1000: #0025ad;\n\n /* Red Scale Light */\n --color-red-100: #fff0f0;\n --color-red-200: #ffebeb;\n --color-red-300: #ffe5e5;\n --color-red-400: #fdd8d8;\n --color-red-500: #f8baba;\n --color-red-600: #f87274;\n --color-red-700: #e5484d;\n --color-red-800: #da3036;\n --color-red-900: #ca2a30;\n --color-red-1000: #381316;\n\n /* Amber Scale Light */\n --color-amber-100: #fff6e5;\n --color-amber-200: #fff4d5;\n --color-amber-300: #fef0cd;\n --color-amber-400: #ffddbf;\n --color-amber-500: #ffc96b;\n --color-amber-600: #f5b047;\n --color-amber-700: #ffb224;\n --color-amber-800: #ff990a;\n --color-amber-900: #a35200;\n --color-amber-1000: #4e2009;\n\n /* Green Scale Light */\n --color-green-100: #effbef;\n --color-green-200: #eafaea;\n --color-green-300: #dcf6dc;\n --color-green-400: #c8f1c9;\n --color-green-500: #99e59f;\n --color-green-600: #6cda76;\n --color-green-700: #46a758;\n --color-green-800: #388e4a;\n --color-green-900: #297c3b;\n --color-green-1000: #18311e;\n\n /* Turbopack Light - Temporary */\n --color-turbopack-text-red: #ff1e56;\n --color-turbopack-text-blue: #0096ff;\n --color-turbopack-border-red: #f0adbe;\n --color-turbopack-border-blue: #adccea;\n --color-turbopack-background-red: #fff7f9;\n --color-turbopack-background-blue: #f6fbff;\n }\n\n :host(.dark) {\n ${darkTheme}\n }\n\n @media (prefers-color-scheme: dark) {\n :host(:not(.light)) {\n ${darkTheme}\n }\n }\n `}\n </style>\n )\n}\n"],"names":["css","darkTheme","Colors","style"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,GAAG,QAAQ,kBAAiB;AAErC,MAAMC,YAAYD;AAiGlB,iDAAiD;AACjD,OAAO,SAASE;IACd,qBACE,KAACC;kBACEH,wBAGK,iCAAiC;QACjC,+GAA+G;QAC/G,oIAAoI;QACpI,yEAAyE;QAEzE,6EAA6E;QAC7E,wEAAwE;QACxE,8DAA8D;QAC9D,IA+HAC,WAKEA;;AAMd"}
@@ -22,6 +22,7 @@ function _templateObject() {
22
22
  "\n ",
23
23
  "\n ",
24
24
  "\n ",
25
+ "\n ",
25
26
  "\n "
26
27
  ]);
27
28
  _templateObject = function() {
@@ -52,9 +53,10 @@ import { ENVIRONMENT_NAME_LABEL_STYLES } from '../components/errors/environment-
52
53
  import { DEV_TOOLS_INFO_STYLES } from '../components/errors/dev-tools-indicator/dev-tools-info/dev-tools-info';
53
54
  import { DEV_TOOLS_INFO_TURBOPACK_INFO_STYLES } from '../components/errors/dev-tools-indicator/dev-tools-info/turbopack-info';
54
55
  import { DEV_TOOLS_INFO_ROUTE_INFO_STYLES } from '../components/errors/dev-tools-indicator/dev-tools-info/route-info';
56
+ import { DEV_TOOLS_INFO_USER_PREFERENCES_STYLES } from '../components/errors/dev-tools-indicator/dev-tools-info/user-preferences';
55
57
  export function ComponentStyles() {
56
58
  return /*#__PURE__*/ _jsx("style", {
57
- children: css(_templateObject(), COPY_BUTTON_STYLES, CALL_STACK_FRAME_STYLES, ENVIRONMENT_NAME_LABEL_STYLES, overlay, toast, dialog, errorLayout, footer, bottomStack, pagination, CODE_FRAME_STYLES, TERMINAL_STYLES, EDITOR_LINK_STYLES, buildErrorStyles, containerErrorStyles, containerRuntimeErrorStyles, versionStaleness, DEV_TOOLS_INDICATOR_STYLES, DEV_TOOLS_INFO_STYLES, DEV_TOOLS_INFO_TURBOPACK_INFO_STYLES, DEV_TOOLS_INFO_ROUTE_INFO_STYLES)
59
+ children: css(_templateObject(), COPY_BUTTON_STYLES, CALL_STACK_FRAME_STYLES, ENVIRONMENT_NAME_LABEL_STYLES, overlay, toast, dialog, errorLayout, footer, bottomStack, pagination, CODE_FRAME_STYLES, TERMINAL_STYLES, EDITOR_LINK_STYLES, buildErrorStyles, containerErrorStyles, containerRuntimeErrorStyles, versionStaleness, DEV_TOOLS_INDICATOR_STYLES, DEV_TOOLS_INFO_STYLES, DEV_TOOLS_INFO_TURBOPACK_INFO_STYLES, DEV_TOOLS_INFO_ROUTE_INFO_STYLES, DEV_TOOLS_INFO_USER_PREFERENCES_STYLES)
58
60
  });
59
61
  }
60
62
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/client/components/react-dev-overlay/ui/styles/component-styles.tsx"],"sourcesContent":["import { CODE_FRAME_STYLES } from '../components/code-frame/code-frame'\nimport { styles as dialog } from '../components/dialog'\nimport { styles as errorLayout } from '../components/errors/error-overlay-layout/error-overlay-layout'\nimport { styles as bottomStack } from '../components/errors/error-overlay-bottom-stack'\nimport { styles as pagination } from '../components/errors/error-overlay-pagination/error-overlay-pagination'\nimport { styles as overlay } from '../components/overlay/styles'\nimport { styles as footer } from '../components/errors/error-overlay-footer/error-overlay-footer'\nimport { TERMINAL_STYLES } from '../components/terminal/terminal'\nimport { styles as toast } from '../components/toast'\nimport { styles as versionStaleness } from '../components/version-staleness-info/version-staleness-info'\nimport { styles as buildErrorStyles } from '../container/build-error'\nimport { styles as containerErrorStyles } from '../container/errors'\nimport { styles as containerRuntimeErrorStyles } from '../container/runtime-error'\nimport { COPY_BUTTON_STYLES } from '../components/copy-button'\nimport { CALL_STACK_FRAME_STYLES } from '../components/call-stack-frame/call-stack-frame'\nimport { DEV_TOOLS_INDICATOR_STYLES } from '../components/errors/dev-tools-indicator/dev-tools-indicator'\nimport { css } from '../../utils/css'\nimport { EDITOR_LINK_STYLES } from '../components/terminal/editor-link'\nimport { ENVIRONMENT_NAME_LABEL_STYLES } from '../components/errors/environment-name-label/environment-name-label'\nimport { DEV_TOOLS_INFO_STYLES } from '../components/errors/dev-tools-indicator/dev-tools-info/dev-tools-info'\nimport { DEV_TOOLS_INFO_TURBOPACK_INFO_STYLES } from '../components/errors/dev-tools-indicator/dev-tools-info/turbopack-info'\nimport { DEV_TOOLS_INFO_ROUTE_INFO_STYLES } from '../components/errors/dev-tools-indicator/dev-tools-info/route-info'\n\nexport function ComponentStyles() {\n return (\n <style>\n {css`\n ${COPY_BUTTON_STYLES}\n ${CALL_STACK_FRAME_STYLES}\n ${ENVIRONMENT_NAME_LABEL_STYLES}\n ${overlay}\n ${toast}\n ${dialog}\n ${errorLayout}\n ${footer}\n ${bottomStack}\n ${pagination}\n ${CODE_FRAME_STYLES}\n ${TERMINAL_STYLES}\n ${EDITOR_LINK_STYLES}\n ${buildErrorStyles}\n ${containerErrorStyles}\n ${containerRuntimeErrorStyles}\n ${versionStaleness}\n ${DEV_TOOLS_INDICATOR_STYLES}\n ${DEV_TOOLS_INFO_STYLES}\n ${DEV_TOOLS_INFO_TURBOPACK_INFO_STYLES}\n ${DEV_TOOLS_INFO_ROUTE_INFO_STYLES}\n `}\n </style>\n )\n}\n"],"names":["CODE_FRAME_STYLES","styles","dialog","errorLayout","bottomStack","pagination","overlay","footer","TERMINAL_STYLES","toast","versionStaleness","buildErrorStyles","containerErrorStyles","containerRuntimeErrorStyles","COPY_BUTTON_STYLES","CALL_STACK_FRAME_STYLES","DEV_TOOLS_INDICATOR_STYLES","css","EDITOR_LINK_STYLES","ENVIRONMENT_NAME_LABEL_STYLES","DEV_TOOLS_INFO_STYLES","DEV_TOOLS_INFO_TURBOPACK_INFO_STYLES","DEV_TOOLS_INFO_ROUTE_INFO_STYLES","ComponentStyles","style"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,iBAAiB,QAAQ,sCAAqC;AACvE,SAASC,UAAUC,MAAM,QAAQ,uBAAsB;AACvD,SAASD,UAAUE,WAAW,QAAQ,iEAAgE;AACtG,SAASF,UAAUG,WAAW,QAAQ,kDAAiD;AACvF,SAASH,UAAUI,UAAU,QAAQ,yEAAwE;AAC7G,SAASJ,UAAUK,OAAO,QAAQ,+BAA8B;AAChE,SAASL,UAAUM,MAAM,QAAQ,iEAAgE;AACjG,SAASC,eAAe,QAAQ,kCAAiC;AACjE,SAASP,UAAUQ,KAAK,QAAQ,sBAAqB;AACrD,SAASR,UAAUS,gBAAgB,QAAQ,8DAA6D;AACxG,SAAST,UAAUU,gBAAgB,QAAQ,2BAA0B;AACrE,SAASV,UAAUW,oBAAoB,QAAQ,sBAAqB;AACpE,SAASX,UAAUY,2BAA2B,QAAQ,6BAA4B;AAClF,SAASC,kBAAkB,QAAQ,4BAA2B;AAC9D,SAASC,uBAAuB,QAAQ,kDAAiD;AACzF,SAASC,0BAA0B,QAAQ,+DAA8D;AACzG,SAASC,GAAG,QAAQ,kBAAiB;AACrC,SAASC,kBAAkB,QAAQ,qCAAoC;AACvE,SAASC,6BAA6B,QAAQ,qEAAoE;AAClH,SAASC,qBAAqB,QAAQ,yEAAwE;AAC9G,SAASC,oCAAoC,QAAQ,yEAAwE;AAC7H,SAASC,gCAAgC,QAAQ,qEAAoE;AAErH,OAAO,SAASC;IACd,qBACE,KAACC;kBACEP,uBACGH,oBACAC,yBACAI,+BACAb,SACAG,OACAP,QACAC,aACAI,QACAH,aACAC,YACAL,mBACAQ,iBACAU,oBACAP,kBACAC,sBACAC,6BACAH,kBACAM,4BACAI,uBACAC,sCACAC;;AAIV"}
1
+ {"version":3,"sources":["../../../../../../src/client/components/react-dev-overlay/ui/styles/component-styles.tsx"],"sourcesContent":["import { CODE_FRAME_STYLES } from '../components/code-frame/code-frame'\nimport { styles as dialog } from '../components/dialog'\nimport { styles as errorLayout } from '../components/errors/error-overlay-layout/error-overlay-layout'\nimport { styles as bottomStack } from '../components/errors/error-overlay-bottom-stack'\nimport { styles as pagination } from '../components/errors/error-overlay-pagination/error-overlay-pagination'\nimport { styles as overlay } from '../components/overlay/styles'\nimport { styles as footer } from '../components/errors/error-overlay-footer/error-overlay-footer'\nimport { TERMINAL_STYLES } from '../components/terminal/terminal'\nimport { styles as toast } from '../components/toast'\nimport { styles as versionStaleness } from '../components/version-staleness-info/version-staleness-info'\nimport { styles as buildErrorStyles } from '../container/build-error'\nimport { styles as containerErrorStyles } from '../container/errors'\nimport { styles as containerRuntimeErrorStyles } from '../container/runtime-error'\nimport { COPY_BUTTON_STYLES } from '../components/copy-button'\nimport { CALL_STACK_FRAME_STYLES } from '../components/call-stack-frame/call-stack-frame'\nimport { DEV_TOOLS_INDICATOR_STYLES } from '../components/errors/dev-tools-indicator/dev-tools-indicator'\nimport { css } from '../../utils/css'\nimport { EDITOR_LINK_STYLES } from '../components/terminal/editor-link'\nimport { ENVIRONMENT_NAME_LABEL_STYLES } from '../components/errors/environment-name-label/environment-name-label'\nimport { DEV_TOOLS_INFO_STYLES } from '../components/errors/dev-tools-indicator/dev-tools-info/dev-tools-info'\nimport { DEV_TOOLS_INFO_TURBOPACK_INFO_STYLES } from '../components/errors/dev-tools-indicator/dev-tools-info/turbopack-info'\nimport { DEV_TOOLS_INFO_ROUTE_INFO_STYLES } from '../components/errors/dev-tools-indicator/dev-tools-info/route-info'\nimport { DEV_TOOLS_INFO_USER_PREFERENCES_STYLES } from '../components/errors/dev-tools-indicator/dev-tools-info/user-preferences'\n\nexport function ComponentStyles() {\n return (\n <style>\n {css`\n ${COPY_BUTTON_STYLES}\n ${CALL_STACK_FRAME_STYLES}\n ${ENVIRONMENT_NAME_LABEL_STYLES}\n ${overlay}\n ${toast}\n ${dialog}\n ${errorLayout}\n ${footer}\n ${bottomStack}\n ${pagination}\n ${CODE_FRAME_STYLES}\n ${TERMINAL_STYLES}\n ${EDITOR_LINK_STYLES}\n ${buildErrorStyles}\n ${containerErrorStyles}\n ${containerRuntimeErrorStyles}\n ${versionStaleness}\n ${DEV_TOOLS_INDICATOR_STYLES}\n ${DEV_TOOLS_INFO_STYLES}\n ${DEV_TOOLS_INFO_TURBOPACK_INFO_STYLES}\n ${DEV_TOOLS_INFO_ROUTE_INFO_STYLES}\n ${DEV_TOOLS_INFO_USER_PREFERENCES_STYLES}\n `}\n </style>\n )\n}\n"],"names":["CODE_FRAME_STYLES","styles","dialog","errorLayout","bottomStack","pagination","overlay","footer","TERMINAL_STYLES","toast","versionStaleness","buildErrorStyles","containerErrorStyles","containerRuntimeErrorStyles","COPY_BUTTON_STYLES","CALL_STACK_FRAME_STYLES","DEV_TOOLS_INDICATOR_STYLES","css","EDITOR_LINK_STYLES","ENVIRONMENT_NAME_LABEL_STYLES","DEV_TOOLS_INFO_STYLES","DEV_TOOLS_INFO_TURBOPACK_INFO_STYLES","DEV_TOOLS_INFO_ROUTE_INFO_STYLES","DEV_TOOLS_INFO_USER_PREFERENCES_STYLES","ComponentStyles","style"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,iBAAiB,QAAQ,sCAAqC;AACvE,SAASC,UAAUC,MAAM,QAAQ,uBAAsB;AACvD,SAASD,UAAUE,WAAW,QAAQ,iEAAgE;AACtG,SAASF,UAAUG,WAAW,QAAQ,kDAAiD;AACvF,SAASH,UAAUI,UAAU,QAAQ,yEAAwE;AAC7G,SAASJ,UAAUK,OAAO,QAAQ,+BAA8B;AAChE,SAASL,UAAUM,MAAM,QAAQ,iEAAgE;AACjG,SAASC,eAAe,QAAQ,kCAAiC;AACjE,SAASP,UAAUQ,KAAK,QAAQ,sBAAqB;AACrD,SAASR,UAAUS,gBAAgB,QAAQ,8DAA6D;AACxG,SAAST,UAAUU,gBAAgB,QAAQ,2BAA0B;AACrE,SAASV,UAAUW,oBAAoB,QAAQ,sBAAqB;AACpE,SAASX,UAAUY,2BAA2B,QAAQ,6BAA4B;AAClF,SAASC,kBAAkB,QAAQ,4BAA2B;AAC9D,SAASC,uBAAuB,QAAQ,kDAAiD;AACzF,SAASC,0BAA0B,QAAQ,+DAA8D;AACzG,SAASC,GAAG,QAAQ,kBAAiB;AACrC,SAASC,kBAAkB,QAAQ,qCAAoC;AACvE,SAASC,6BAA6B,QAAQ,qEAAoE;AAClH,SAASC,qBAAqB,QAAQ,yEAAwE;AAC9G,SAASC,oCAAoC,QAAQ,yEAAwE;AAC7H,SAASC,gCAAgC,QAAQ,qEAAoE;AACrH,SAASC,sCAAsC,QAAQ,2EAA0E;AAEjI,OAAO,SAASC;IACd,qBACE,KAACC;kBACER,uBACGH,oBACAC,yBACAI,+BACAb,SACAG,OACAP,QACAC,aACAI,QACAH,aACAC,YACAL,mBACAQ,iBACAU,oBACAP,kBACAC,sBACAC,6BACAH,kBACAM,4BACAI,uBACAC,sCACAC,kCACAC;;AAIV"}
@@ -0,0 +1,103 @@
1
+ export const DISALLOWED_FORM_PROPS = [
2
+ 'method',
3
+ 'encType',
4
+ 'target'
5
+ ];
6
+ export function createFormSubmitDestinationUrl(action, formElement) {
7
+ let targetUrl;
8
+ try {
9
+ // NOTE: It might be more correct to resolve URLs relative to `document.baseURI`,
10
+ // but we already do it relative to `location.href` elsewhere:
11
+ // (see e.g. https://github.com/vercel/next.js/blob/bb0e6722f87ceb2d43015f5b8a413d0072f2badf/packages/next/src/client/components/app-router.tsx#L146)
12
+ // so it's better to stay consistent.
13
+ const base = window.location.href;
14
+ targetUrl = new URL(action, base);
15
+ } catch (err) {
16
+ throw Object.defineProperty(new Error('Cannot parse form action "' + action + '" as a URL', {
17
+ cause: err
18
+ }), "__NEXT_ERROR_CODE", {
19
+ value: "E152",
20
+ enumerable: false,
21
+ configurable: true
22
+ });
23
+ }
24
+ if (targetUrl.searchParams.size) {
25
+ // url-encoded HTML forms *overwrite* any search params in the `action` url:
26
+ //
27
+ // "Let `query` be the result of running the application/x-www-form-urlencoded serializer [...]"
28
+ // "Set parsed action's query component to `query`."
29
+ // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#submit-mutate-action
30
+ //
31
+ // We need to match that.
32
+ // (note that all other parts of the URL, like `hash`, are preserved)
33
+ targetUrl.search = '';
34
+ }
35
+ const formData = new FormData(formElement);
36
+ for (let [name, value] of formData){
37
+ if (typeof value !== 'string') {
38
+ // For file inputs, the native browser behavior is to use the filename as the value instead:
39
+ //
40
+ // "If entry's value is a File object, then let value be entry's value's name. Otherwise, let value be entry's value."
41
+ // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#converting-an-entry-list-to-a-list-of-name-value-pairs
42
+ //
43
+ if (process.env.NODE_ENV === 'development') {
44
+ console.warn("<Form> only supports file inputs if `action` is a function. File inputs cannot be used if `action` is a string, " + "because files cannot be encoded as search params.");
45
+ }
46
+ value = value.name;
47
+ }
48
+ targetUrl.searchParams.append(name, value);
49
+ }
50
+ return targetUrl;
51
+ }
52
+ export function checkFormActionUrl(action, source) {
53
+ const aPropName = source === 'action' ? "an `action`" : "a `formAction`";
54
+ let testUrl;
55
+ try {
56
+ testUrl = new URL(action, 'http://n');
57
+ } catch (err) {
58
+ console.error("<Form> received " + aPropName + ' that cannot be parsed as a URL: "' + action + '".');
59
+ return;
60
+ }
61
+ // url-encoded HTML forms ignore any queryparams in the `action` url. We need to match that.
62
+ if (testUrl.searchParams.size) {
63
+ console.warn("<Form> received " + aPropName + ' that contains search params: "' + action + '". This is not supported, and they will be ignored. ' + 'If you need to pass in additional search params, use an `<input type="hidden" />` instead.');
64
+ }
65
+ }
66
+ export const isSupportedFormEncType = (value)=>value === 'application/x-www-form-urlencoded';
67
+ export const isSupportedFormMethod = (value)=>value === 'get';
68
+ export const isSupportedFormTarget = (value)=>value === '_self';
69
+ export function hasUnsupportedSubmitterAttributes(submitter) {
70
+ // A submitter can override `encType` for the form.
71
+ const formEncType = submitter.getAttribute('formEncType');
72
+ if (formEncType !== null && !isSupportedFormEncType(formEncType)) {
73
+ if (process.env.NODE_ENV === 'development') {
74
+ console.error("<Form>'s `encType` was set to an unsupported value via `formEncType=\"" + formEncType + '"`. ' + "This will disable <Form>'s navigation functionality. If you need this, use a native <form> element instead.");
75
+ }
76
+ return true;
77
+ }
78
+ // A submitter can override `method` for the form.
79
+ const formMethod = submitter.getAttribute('formMethod');
80
+ if (formMethod !== null && !isSupportedFormMethod(formMethod)) {
81
+ if (process.env.NODE_ENV === 'development') {
82
+ console.error("<Form>'s `method` was set to an unsupported value via `formMethod=\"" + formMethod + '"`. ' + "This will disable <Form>'s navigation functionality. If you need this, use a native <form> element instead.");
83
+ }
84
+ return true;
85
+ }
86
+ // A submitter can override `target` for the form.
87
+ const formTarget = submitter.getAttribute('formTarget');
88
+ if (formTarget !== null && !isSupportedFormTarget(formTarget)) {
89
+ if (process.env.NODE_ENV === 'development') {
90
+ console.error("<Form>'s `target` was set to an unsupported value via `formTarget=\"" + formTarget + '"`. ' + "This will disable <Form>'s navigation functionality. If you need this, use a native <form> element instead.");
91
+ }
92
+ return true;
93
+ }
94
+ return false;
95
+ }
96
+ export function hasReactClientActionAttributes(submitter) {
97
+ // CSR: https://github.com/facebook/react/blob/942eb80381b96f8410eab1bef1c539bed1ab0eb1/packages/react-dom-bindings/src/client/ReactDOMComponent.js#L482-L487
98
+ // SSR: https://github.com/facebook/react/blob/942eb80381b96f8410eab1bef1c539bed1ab0eb1/packages/react-dom-bindings/src/client/ReactDOMComponent.js#L2401
99
+ const action = submitter.getAttribute('formAction');
100
+ return action && /\s*javascript:/i.test(action);
101
+ }
102
+
103
+ //# sourceMappingURL=form-shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/client/form-shared.tsx"],"sourcesContent":["import type { HTMLProps } from 'react'\n\nexport const DISALLOWED_FORM_PROPS = ['method', 'encType', 'target'] as const\n\ntype HTMLFormProps = HTMLProps<HTMLFormElement>\ntype DisallowedFormProps = (typeof DISALLOWED_FORM_PROPS)[number]\n\ntype InternalFormProps = {\n /**\n * `action` can be either a `string` or a function.\n * - If `action` is a string, it will be interpreted as a path or URL to navigate to when the form is submitted.\n * The path will be prefetched when the form becomes visible.\n * - If `action` is a function, it will be called when the form is submitted. See the [React docs](https://react.dev/reference/react-dom/components/form#props) for more.\n */\n action: NonNullable<HTMLFormProps['action']>\n /**\n * Controls how the route specified by `action` is prefetched.\n * Any `<Form />` that is in the viewport (initially or through scroll) will be prefetched.\n * Prefetch can be disabled by passing `prefetch={false}`. Prefetching is only enabled in production.\n *\n * Options:\n * - `null` (default): For statically generated pages, this will prefetch the full React Server Component data. For dynamic pages, this will prefetch up to the nearest route segment with a [`loading.js`](https://nextjs.org/docs/app/api-reference/file-conventions/loading) file. If there is no loading file, it will not fetch the full tree to avoid fetching too much data.\n * - `false`: This will not prefetch any data.\n *\n * In pages dir, prefetching is not supported, and passing this prop will emit a warning.\n *\n * @defaultValue `null`\n */\n prefetch?: false | null\n /**\n * Whether submitting the form should replace the current `history` state instead of adding a new url into the stack.\n * Only valid if `action` is a string.\n *\n * @defaultValue `false`\n */\n replace?: boolean\n /**\n * Override the default scroll behavior when navigating.\n * Only valid if `action` is a string.\n *\n * @defaultValue `true`\n */\n scroll?: boolean\n} & Omit<HTMLFormProps, 'action' | DisallowedFormProps>\n\n// `RouteInferType` is a stub here to avoid breaking `typedRoutes` when the type\n// isn't generated yet. It will be replaced when the webpack plugin runs.\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport type FormProps<RouteInferType = any> = InternalFormProps\n\nexport function createFormSubmitDestinationUrl(\n action: string,\n formElement: HTMLFormElement\n) {\n let targetUrl: URL\n try {\n // NOTE: It might be more correct to resolve URLs relative to `document.baseURI`,\n // but we already do it relative to `location.href` elsewhere:\n // (see e.g. https://github.com/vercel/next.js/blob/bb0e6722f87ceb2d43015f5b8a413d0072f2badf/packages/next/src/client/components/app-router.tsx#L146)\n // so it's better to stay consistent.\n const base = window.location.href\n targetUrl = new URL(action, base)\n } catch (err) {\n throw new Error(`Cannot parse form action \"${action}\" as a URL`, {\n cause: err,\n })\n }\n if (targetUrl.searchParams.size) {\n // url-encoded HTML forms *overwrite* any search params in the `action` url:\n //\n // \"Let `query` be the result of running the application/x-www-form-urlencoded serializer [...]\"\n // \"Set parsed action's query component to `query`.\"\n // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#submit-mutate-action\n //\n // We need to match that.\n // (note that all other parts of the URL, like `hash`, are preserved)\n targetUrl.search = ''\n }\n\n const formData = new FormData(formElement)\n\n for (let [name, value] of formData) {\n if (typeof value !== 'string') {\n // For file inputs, the native browser behavior is to use the filename as the value instead:\n //\n // \"If entry's value is a File object, then let value be entry's value's name. Otherwise, let value be entry's value.\"\n // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#converting-an-entry-list-to-a-list-of-name-value-pairs\n //\n if (process.env.NODE_ENV === 'development') {\n console.warn(\n `<Form> only supports file inputs if \\`action\\` is a function. File inputs cannot be used if \\`action\\` is a string, ` +\n `because files cannot be encoded as search params.`\n )\n }\n value = value.name\n }\n\n targetUrl.searchParams.append(name, value)\n }\n return targetUrl\n}\n\nexport function checkFormActionUrl(\n action: string,\n source: 'action' | 'formAction'\n) {\n const aPropName = source === 'action' ? `an \\`action\\`` : `a \\`formAction\\``\n\n let testUrl: URL\n try {\n testUrl = new URL(action, 'http://n')\n } catch (err) {\n console.error(\n `<Form> received ${aPropName} that cannot be parsed as a URL: \"${action}\".`\n )\n return\n }\n\n // url-encoded HTML forms ignore any queryparams in the `action` url. We need to match that.\n if (testUrl.searchParams.size) {\n console.warn(\n `<Form> received ${aPropName} that contains search params: \"${action}\". This is not supported, and they will be ignored. ` +\n `If you need to pass in additional search params, use an \\`<input type=\"hidden\" />\\` instead.`\n )\n }\n}\n\nexport const isSupportedFormEncType = (value: string) =>\n value === 'application/x-www-form-urlencoded'\nexport const isSupportedFormMethod = (value: string) => value === 'get'\nexport const isSupportedFormTarget = (value: string) => value === '_self'\n\nexport function hasUnsupportedSubmitterAttributes(\n submitter: HTMLElement\n): boolean {\n // A submitter can override `encType` for the form.\n const formEncType = submitter.getAttribute('formEncType')\n if (formEncType !== null && !isSupportedFormEncType(formEncType)) {\n if (process.env.NODE_ENV === 'development') {\n console.error(\n `<Form>'s \\`encType\\` was set to an unsupported value via \\`formEncType=\"${formEncType}\"\\`. ` +\n `This will disable <Form>'s navigation functionality. If you need this, use a native <form> element instead.`\n )\n }\n return true\n }\n\n // A submitter can override `method` for the form.\n const formMethod = submitter.getAttribute('formMethod')\n if (formMethod !== null && !isSupportedFormMethod(formMethod)) {\n if (process.env.NODE_ENV === 'development') {\n console.error(\n `<Form>'s \\`method\\` was set to an unsupported value via \\`formMethod=\"${formMethod}\"\\`. ` +\n `This will disable <Form>'s navigation functionality. If you need this, use a native <form> element instead.`\n )\n }\n return true\n }\n\n // A submitter can override `target` for the form.\n const formTarget = submitter.getAttribute('formTarget')\n if (formTarget !== null && !isSupportedFormTarget(formTarget)) {\n if (process.env.NODE_ENV === 'development') {\n console.error(\n `<Form>'s \\`target\\` was set to an unsupported value via \\`formTarget=\"${formTarget}\"\\`. ` +\n `This will disable <Form>'s navigation functionality. If you need this, use a native <form> element instead.`\n )\n }\n return true\n }\n\n return false\n}\n\nexport function hasReactClientActionAttributes(submitter: HTMLElement) {\n // CSR: https://github.com/facebook/react/blob/942eb80381b96f8410eab1bef1c539bed1ab0eb1/packages/react-dom-bindings/src/client/ReactDOMComponent.js#L482-L487\n // SSR: https://github.com/facebook/react/blob/942eb80381b96f8410eab1bef1c539bed1ab0eb1/packages/react-dom-bindings/src/client/ReactDOMComponent.js#L2401\n const action = submitter.getAttribute('formAction')\n return action && /\\s*javascript:/i.test(action)\n}\n"],"names":["DISALLOWED_FORM_PROPS","createFormSubmitDestinationUrl","action","formElement","targetUrl","base","window","location","href","URL","err","Error","cause","searchParams","size","search","formData","FormData","name","value","process","env","NODE_ENV","console","warn","append","checkFormActionUrl","source","aPropName","testUrl","error","isSupportedFormEncType","isSupportedFormMethod","isSupportedFormTarget","hasUnsupportedSubmitterAttributes","submitter","formEncType","getAttribute","formMethod","formTarget","hasReactClientActionAttributes","test"],"mappings":"AAEA,OAAO,MAAMA,wBAAwB;IAAC;IAAU;IAAW;CAAS,CAAS;AAgD7E,OAAO,SAASC,+BACdC,MAAc,EACdC,WAA4B;IAE5B,IAAIC;IACJ,IAAI;QACF,iFAAiF;QACjF,8DAA8D;QAC9D,sJAAsJ;QACtJ,qCAAqC;QACrC,MAAMC,OAAOC,OAAOC,QAAQ,CAACC,IAAI;QACjCJ,YAAY,IAAIK,IAAIP,QAAQG;IAC9B,EAAE,OAAOK,KAAK;QACZ,MAAM,qBAEJ,CAFI,IAAIC,MAAM,AAAC,+BAA4BT,SAAO,cAAa;YAC/DU,OAAOF;QACT,IAFM,qBAAA;mBAAA;wBAAA;0BAAA;QAEL;IACH;IACA,IAAIN,UAAUS,YAAY,CAACC,IAAI,EAAE;QAC/B,4EAA4E;QAC5E,EAAE;QACF,iGAAiG;QACjG,qDAAqD;QACrD,iGAAiG;QACjG,EAAE;QACF,yBAAyB;QACzB,qEAAqE;QACrEV,UAAUW,MAAM,GAAG;IACrB;IAEA,MAAMC,WAAW,IAAIC,SAASd;IAE9B,KAAK,IAAI,CAACe,MAAMC,MAAM,IAAIH,SAAU;QAClC,IAAI,OAAOG,UAAU,UAAU;YAC7B,4FAA4F;YAC5F,EAAE;YACF,wHAAwH;YACxH,mIAAmI;YACnI,EAAE;YACF,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,eAAe;gBAC1CC,QAAQC,IAAI,CACV,AAAC,qHACE;YAEP;YACAL,QAAQA,MAAMD,IAAI;QACpB;QAEAd,UAAUS,YAAY,CAACY,MAAM,CAACP,MAAMC;IACtC;IACA,OAAOf;AACT;AAEA,OAAO,SAASsB,mBACdxB,MAAc,EACdyB,MAA+B;IAE/B,MAAMC,YAAYD,WAAW,WAAY,gBAAkB;IAE3D,IAAIE;IACJ,IAAI;QACFA,UAAU,IAAIpB,IAAIP,QAAQ;IAC5B,EAAE,OAAOQ,KAAK;QACZa,QAAQO,KAAK,CACX,AAAC,qBAAkBF,YAAU,uCAAoC1B,SAAO;QAE1E;IACF;IAEA,4FAA4F;IAC5F,IAAI2B,QAAQhB,YAAY,CAACC,IAAI,EAAE;QAC7BS,QAAQC,IAAI,CACV,AAAC,qBAAkBI,YAAU,oCAAiC1B,SAAO,yDAClE;IAEP;AACF;AAEA,OAAO,MAAM6B,yBAAyB,CAACZ,QACrCA,UAAU,oCAAmC;AAC/C,OAAO,MAAMa,wBAAwB,CAACb,QAAkBA,UAAU,MAAK;AACvE,OAAO,MAAMc,wBAAwB,CAACd,QAAkBA,UAAU,QAAO;AAEzE,OAAO,SAASe,kCACdC,SAAsB;IAEtB,mDAAmD;IACnD,MAAMC,cAAcD,UAAUE,YAAY,CAAC;IAC3C,IAAID,gBAAgB,QAAQ,CAACL,uBAAuBK,cAAc;QAChE,IAAIhB,QAAQC,GAAG,CAACC,QAAQ,KAAK,eAAe;YAC1CC,QAAQO,KAAK,CACX,AAAC,2EAA0EM,cAAY,SACpF;QAEP;QACA,OAAO;IACT;IAEA,kDAAkD;IAClD,MAAME,aAAaH,UAAUE,YAAY,CAAC;IAC1C,IAAIC,eAAe,QAAQ,CAACN,sBAAsBM,aAAa;QAC7D,IAAIlB,QAAQC,GAAG,CAACC,QAAQ,KAAK,eAAe;YAC1CC,QAAQO,KAAK,CACX,AAAC,yEAAwEQ,aAAW,SACjF;QAEP;QACA,OAAO;IACT;IAEA,kDAAkD;IAClD,MAAMC,aAAaJ,UAAUE,YAAY,CAAC;IAC1C,IAAIE,eAAe,QAAQ,CAACN,sBAAsBM,aAAa;QAC7D,IAAInB,QAAQC,GAAG,CAACC,QAAQ,KAAK,eAAe;YAC1CC,QAAQO,KAAK,CACX,AAAC,yEAAwES,aAAW,SACjF;QAEP;QACA,OAAO;IACT;IAEA,OAAO;AACT;AAEA,OAAO,SAASC,+BAA+BL,SAAsB;IACnE,6JAA6J;IAC7J,yJAAyJ;IACzJ,MAAMjC,SAASiC,UAAUE,YAAY,CAAC;IACtC,OAAOnC,UAAU,kBAAkBuC,IAAI,CAACvC;AAC1C"}
@@ -1,94 +1,51 @@
1
1
  'use client';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { useEffect, useContext } from 'react';
3
+ import { useContext, forwardRef } from 'react';
4
4
  import { addBasePath } from './add-base-path';
5
- import { useIntersection } from './use-intersection';
6
- import { useMergedRef } from './use-merged-ref';
7
- import { AppRouterContext } from '../shared/lib/app-router-context.shared-runtime';
8
- import { PrefetchKind } from './components/router-reducer/router-reducer-types';
9
5
  import { RouterContext } from '../shared/lib/router-context.shared-runtime';
10
- const DISALLOWED_FORM_PROPS = [
11
- 'method',
12
- 'encType',
13
- 'target'
14
- ];
15
- export default function Form(param) {
16
- let { replace, scroll, prefetch: prefetchProp, ref: externalRef, ...props } = param;
17
- const router = useAppOrPagesRouter();
6
+ import { checkFormActionUrl, createFormSubmitDestinationUrl, DISALLOWED_FORM_PROPS, hasReactClientActionAttributes, hasUnsupportedSubmitterAttributes } from './form-shared';
7
+ const Form = /*#__PURE__*/ forwardRef(function FormComponent(param, ref) {
8
+ let { replace, scroll, prefetch: prefetchProp, ...props } = param;
9
+ const router = useContext(RouterContext);
18
10
  const actionProp = props.action;
19
11
  const isNavigatingForm = typeof actionProp === 'string';
20
12
  // Validate `action`
21
13
  if (process.env.NODE_ENV === 'development') {
22
14
  if (isNavigatingForm) {
23
- checkActionUrl(actionProp, 'action');
15
+ checkFormActionUrl(actionProp, 'action');
24
16
  }
25
17
  }
26
18
  // Validate `prefetch`
27
19
  if (process.env.NODE_ENV === 'development') {
28
- if (!(prefetchProp === undefined || prefetchProp === false || prefetchProp === null)) {
29
- console.error('The `prefetch` prop of <Form> must be `false` or `null`');
30
- }
31
20
  if (prefetchProp !== undefined) {
32
- if (!isAppRouter(router)) {
33
- console.error('Passing `prefetch` to a <Form> has no effect in the pages directory.');
34
- } else if (!isNavigatingForm) {
35
- console.error('Passing `prefetch` to a <Form> whose `action` is a function has no effect.');
36
- }
21
+ console.error('Passing `prefetch` to a <Form> has no effect in the pages directory.');
37
22
  }
38
23
  }
39
- const prefetch = prefetchProp === false || prefetchProp === null ? prefetchProp : null;
40
24
  // Validate `scroll` and `replace`
41
25
  if (process.env.NODE_ENV === 'development') {
42
26
  if (!isNavigatingForm && (replace !== undefined || scroll !== undefined)) {
43
- console.error('Passing `replace` or `scroll` to a <Form> whose `action` is a function has no effect.\n' + 'See the relevant docs to learn how to control this behavior for navigations triggered from actions:\n' + ' `redirect()` - https://nextjs.org/docs/app/api-reference/functions/redirect#parameters\n' + ' `router.replace()` - https://nextjs.org/docs/app/api-reference/functions/use-router#userouter\n');
27
+ console.error('Passing `replace` or `scroll` to a <Form> whose `action` is a function has no effect.\n' + 'See the relevant docs to learn how to control this behavior for navigations triggered from actions:\n' + ' `router.replace()` - https://nextjs.org/docs/pages/api-reference/functions/use-router#routerreplace\n');
44
28
  }
45
29
  }
46
30
  // Clean up any unsupported form props (and warn if present)
47
31
  for (const key of DISALLOWED_FORM_PROPS){
48
32
  if (key in props) {
49
33
  if (process.env.NODE_ENV === 'development') {
50
- console.error("<Form> does not support changing `" + key + "`. " + (isNavigatingForm ? "If you'd like to use it to perform a mutation, consider making `action` a function instead.\n" + "Learn more: https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations" : ''));
34
+ console.error("<Form> does not support changing `" + key + "`.");
51
35
  }
52
36
  delete props[key];
53
37
  }
54
38
  }
55
- const isPrefetchEnabled = // there is no notion of instant loading states in pages dir, so prefetching is pointless
56
- isAppRouter(router) && // if we don't have an action path, we can't preload anything anyway.
57
- isNavigatingForm && prefetch === null;
58
- const [setIntersectionRef, isVisible] = useIntersection({
59
- rootMargin: '200px',
60
- disabled: !isPrefetchEnabled
61
- });
62
- const ownRef = useMergedRef(setIntersectionRef, externalRef != null ? externalRef : null);
63
- useEffect(()=>{
64
- if (!isVisible || !isPrefetchEnabled) {
65
- return;
66
- }
67
- try {
68
- const prefetchKind = PrefetchKind.AUTO;
69
- router.prefetch(actionProp, {
70
- kind: prefetchKind
71
- });
72
- } catch (err) {
73
- console.error(err);
74
- }
75
- }, [
76
- isPrefetchEnabled,
77
- isVisible,
78
- actionProp,
79
- prefetch,
80
- router
81
- ]);
82
39
  if (!isNavigatingForm) {
83
40
  return /*#__PURE__*/ _jsx("form", {
84
41
  ...props,
85
- ref: ownRef
42
+ ref: ref
86
43
  });
87
44
  }
88
45
  const actionHref = addBasePath(actionProp);
89
46
  return /*#__PURE__*/ _jsx("form", {
90
47
  ...props,
91
- ref: ownRef,
48
+ ref: ref,
92
49
  action: actionHref,
93
50
  onSubmit: (event)=>onFormSubmit(event, {
94
51
  router,
@@ -98,7 +55,8 @@ export default function Form(param) {
98
55
  onSubmit: props.onSubmit
99
56
  })
100
57
  });
101
- }
58
+ });
59
+ export default Form;
102
60
  function onFormSubmit(event, param) {
103
61
  let { actionHref, onSubmit, replace, scroll, router } = param;
104
62
  if (typeof onSubmit === 'function') {
@@ -109,18 +67,17 @@ function onFormSubmit(event, param) {
109
67
  return;
110
68
  }
111
69
  }
70
+ if (!router) {
71
+ // Form was somehow used outside of the router (but not in app/, the implementation is forked!).
72
+ // We can't perform a soft navigation, so let the native submit handling do its thing.
73
+ return;
74
+ }
112
75
  const formElement = event.currentTarget;
113
76
  const submitter = event.nativeEvent.submitter;
114
77
  let action = actionHref;
115
78
  if (submitter) {
116
- if (process.env.NODE_ENV === 'development') {
117
- // the way server actions are encoded (e.g. `formMethod="post")
118
- // causes some unnecessary dev-mode warnings from `hasUnsupportedSubmitterAttributes`.
119
- // we'd bail out anyway, but we just do it silently.
120
- if (hasReactServerActionAttributes(submitter)) {
121
- return;
122
- }
123
- }
79
+ // this is page-router-only, so we don't need to worry about false positives
80
+ // from the attributes that react adds for server actions.
124
81
  if (hasUnsupportedSubmitterAttributes(submitter)) {
125
82
  return;
126
83
  }
@@ -135,143 +92,28 @@ function onFormSubmit(event, param) {
135
92
  const submitterFormAction = submitter.getAttribute('formAction');
136
93
  if (submitterFormAction !== null) {
137
94
  if (process.env.NODE_ENV === 'development') {
138
- checkActionUrl(submitterFormAction, 'formAction');
95
+ checkFormActionUrl(submitterFormAction, 'formAction');
139
96
  }
140
97
  action = submitterFormAction;
141
98
  }
142
99
  }
143
- let targetUrl;
144
- try {
145
- // NOTE: It might be more correct to resolve URLs relative to `document.baseURI`,
146
- // but we already do it relative to `location.href` elsewhere:
147
- // (see e.g. https://github.com/vercel/next.js/blob/bb0e6722f87ceb2d43015f5b8a413d0072f2badf/packages/next/src/client/components/app-router.tsx#L146)
148
- // so it's better to stay consistent.
149
- const base = window.location.href;
150
- targetUrl = new URL(action, base);
151
- } catch (err) {
152
- throw Object.defineProperty(new Error('Cannot parse form action "' + action + '" as a URL', {
153
- cause: err
154
- }), "__NEXT_ERROR_CODE", {
155
- value: "E152",
156
- enumerable: false,
157
- configurable: true
158
- });
159
- }
160
- if (targetUrl.searchParams.size) {
161
- // url-encoded HTML forms *overwrite* any search params in the `action` url:
162
- //
163
- // "Let `query` be the result of running the application/x-www-form-urlencoded serializer [...]"
164
- // "Set parsed action's query component to `query`."
165
- // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#submit-mutate-action
166
- //
167
- // We need to match that.
168
- // (note that all other parts of the URL, like `hash`, are preserved)
169
- targetUrl.search = '';
170
- }
171
- const formData = new FormData(formElement);
172
- for (let [name, value] of formData){
173
- if (typeof value !== 'string') {
174
- // For file inputs, the native browser behavior is to use the filename as the value instead:
175
- //
176
- // "If entry's value is a File object, then let value be entry's value's name. Otherwise, let value be entry's value."
177
- // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#converting-an-entry-list-to-a-list-of-name-value-pairs
178
- //
179
- if (process.env.NODE_ENV === 'development') {
180
- console.warn("<Form> only supports file inputs if `action` is a function. File inputs cannot be used if `action` is a string, " + "because files cannot be encoded as search params.");
181
- }
182
- value = value.name;
183
- }
184
- targetUrl.searchParams.append(name, value);
185
- }
100
+ const targetUrl = createFormSubmitDestinationUrl(action, formElement);
186
101
  // Finally, no more reasons for bailing out.
187
102
  event.preventDefault();
188
103
  const method = replace ? 'replace' : 'push';
189
- const targetHref = targetUrl.href;
190
- if (isAppRouter(router)) {
191
- router[method](targetHref, {
192
- scroll
193
- });
194
- } else {
195
- // TODO(form): Make this use a transition so that pending states work
196
- //
197
- // Unlike the app router, pages router doesn't use startTransition,
198
- // and can't easily be wrapped in one because of implementation details
199
- // (e.g. it doesn't use any react state)
200
- // But it's important to have this wrapped in a transition because
201
- // pending states from e.g. `useFormStatus` rely on that.
202
- // So this needs some follow up work.
203
- router[method](targetHref, undefined, {
204
- scroll
205
- });
206
- }
207
- }
208
- function isAppRouter(router) {
209
- return !('asPath' in router);
210
- }
211
- function useAppOrPagesRouter() {
212
- const pagesRouter = useContext(RouterContext);
213
- const appRouter = useContext(AppRouterContext);
214
- if (pagesRouter) {
215
- return pagesRouter;
216
- } else {
217
- // We're in the app directory if there is no pages router.
218
- return appRouter;
219
- }
220
- }
221
- function checkActionUrl(action, source) {
222
- const aPropName = source === 'action' ? "an `action`" : "a `formAction`";
223
- let testUrl;
224
- try {
225
- testUrl = new URL(action, 'http://n');
226
- } catch (err) {
227
- console.error("<Form> received " + aPropName + ' that cannot be parsed as a URL: "' + action + '".');
228
- return;
229
- }
230
- // url-encoded HTML forms ignore any queryparams in the `action` url. We need to match that.
231
- if (testUrl.searchParams.size) {
232
- console.warn("<Form> received " + aPropName + ' that contains search params: "' + action + '". This is not supported, and they will be ignored. ' + 'If you need to pass in additional search params, use an `<input type="hidden" />` instead.');
233
- }
234
- }
235
- const isSupportedEncType = (value)=>value === 'application/x-www-form-urlencoded';
236
- const isSupportedMethod = (value)=>value === 'get';
237
- const isSupportedTarget = (value)=>value === '_self';
238
- function hasUnsupportedSubmitterAttributes(submitter) {
239
- // A submitter can override `encType` for the form.
240
- const formEncType = submitter.getAttribute('formEncType');
241
- if (formEncType !== null && !isSupportedEncType(formEncType)) {
242
- if (process.env.NODE_ENV === 'development') {
243
- console.error("<Form>'s `encType` was set to an unsupported value via `formEncType=\"" + formEncType + '"`. ' + "This will disable <Form>'s navigation functionality. If you need this, use a native <form> element instead.");
244
- }
245
- return true;
246
- }
247
- // A submitter can override `method` for the form.
248
- const formMethod = submitter.getAttribute('formMethod');
249
- if (formMethod !== null && !isSupportedMethod(formMethod)) {
250
- if (process.env.NODE_ENV === 'development') {
251
- console.error("<Form>'s `method` was set to an unsupported value via `formMethod=\"" + formMethod + '"`. ' + "This will disable <Form>'s navigation functionality. If you need this, use a native <form> element instead.");
252
- }
253
- return true;
254
- }
255
- // A submitter can override `target` for the form.
256
- const formTarget = submitter.getAttribute('formTarget');
257
- if (formTarget !== null && !isSupportedTarget(formTarget)) {
258
- if (process.env.NODE_ENV === 'development') {
259
- console.error("<Form>'s `target` was set to an unsupported value via `formTarget=\"" + formTarget + '"`. ' + "This will disable <Form>'s navigation functionality. If you need this, use a native <form> element instead.");
260
- }
261
- return true;
262
- }
263
- return false;
264
- }
265
- function hasReactServerActionAttributes(submitter) {
266
- // https://github.com/facebook/react/blob/942eb80381b96f8410eab1bef1c539bed1ab0eb1/packages/react-client/src/ReactFlightReplyClient.js#L931-L934
267
- const name = submitter.getAttribute('name');
268
- return name && (name.startsWith('$ACTION_ID_') || name.startsWith('$ACTION_REF_'));
269
- }
270
- function hasReactClientActionAttributes(submitter) {
271
- // CSR: https://github.com/facebook/react/blob/942eb80381b96f8410eab1bef1c539bed1ab0eb1/packages/react-dom-bindings/src/client/ReactDOMComponent.js#L482-L487
272
- // SSR: https://github.com/facebook/react/blob/942eb80381b96f8410eab1bef1c539bed1ab0eb1/packages/react-dom-bindings/src/client/ReactDOMComponent.js#L2401
273
- const action = submitter.getAttribute('formAction');
274
- return action && /\s*javascript:/i.test(action);
104
+ const targetHref = targetUrl.href // TODO: will pages router be happy about an absolute URL here?
105
+ ;
106
+ // TODO(form): Make this use a transition so that pending states work
107
+ //
108
+ // Unlike the app router, pages router doesn't use startTransition,
109
+ // and can't easily be wrapped in one because of implementation details
110
+ // (e.g. it doesn't use any react state)
111
+ // But it's important to have this wrapped in a transition because
112
+ // pending states from e.g. `useFormStatus` rely on that.
113
+ // So this needs some follow up work.
114
+ router[method](targetHref, undefined, {
115
+ scroll
116
+ });
275
117
  }
276
118
 
277
119
  //# sourceMappingURL=form.js.map