@rainbow-robotics/muscat-plugin-kit 1.1.5 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. package/README.md +99 -0
  2. package/cli/README.md +32 -1
  3. package/cli/bin/muscat-pk.mjs +33 -6
  4. package/cli/src/dev.mjs +2 -1
  5. package/cli/src/devBack.mjs +8 -7
  6. package/cli/src/manifest.mjs +54 -0
  7. package/cli/src/mcp.mjs +58 -3
  8. package/cli/src/new.mjs +3 -0
  9. package/cli/src/ports.mjs +3 -3
  10. package/cli/src/templates-embedded.mjs +3 -0
  11. package/cli/src/util.mjs +13 -0
  12. package/cli/storybook-dist/assets/{Color-YHDXOIA2-YYWRJKA2.js → Color-YHDXOIA2-CSzM1dKs.js} +1 -1
  13. package/cli/storybook-dist/assets/{Docs-DT9RD87x.js → Docs-BIcNCkcj.js} +1 -1
  14. package/cli/storybook-dist/assets/{Docs-CKJ2w--X.js → Docs-Bhl2G8dW.js} +1 -1
  15. package/cli/storybook-dist/assets/{Docs-DIJ7cbFD.js → Docs-CxnHR1EX.js} +1 -1
  16. package/cli/storybook-dist/assets/Docs-DGfEBD4U.js +7 -0
  17. package/cli/storybook-dist/assets/{Docs-UmN7NFo1.js → Docs-Q256LO6R.js} +1 -1
  18. package/cli/storybook-dist/assets/Docs-y19ER8GV.js +20 -0
  19. package/cli/storybook-dist/assets/{DocsRenderer-CFRXHY34-CyAy1mnJ.js → DocsRenderer-CFRXHY34-DnUkc2jA.js} +1 -1
  20. package/cli/storybook-dist/assets/NxAvatar.stories-D8_zg1ow.js +13 -0
  21. package/cli/storybook-dist/assets/NxButton.stories-DJ27PRZJ.js +20 -0
  22. package/cli/storybook-dist/assets/{NxNumberInput.stories-zlQJuGFP.js → NxNumberInput.stories-DAhhfwBb.js} +3 -3
  23. package/cli/storybook-dist/assets/NxPagination.stories-B0B2V-we.js +11 -0
  24. package/cli/storybook-dist/assets/NxPointerHoldButton.stories-Cs9aWGqX.js +14 -0
  25. package/cli/storybook-dist/assets/{NxRangeInput.stories-Cu5ZWU0w.js → NxRangeInput.stories-A3qk290L.js} +3 -3
  26. package/cli/storybook-dist/assets/NxSelectBox.stories-BtA0bI0U.js +17 -0
  27. package/cli/storybook-dist/assets/NxSlideRange.stories-DaVwMyfI.js +14 -0
  28. package/cli/storybook-dist/assets/NxSwitch.stories-MEpYcafd.js +11 -0
  29. package/cli/storybook-dist/assets/NxTextArea.stories-8PqT83b0.js +11 -0
  30. package/cli/storybook-dist/assets/NxTextInput.stories-DwOvyFAK.js +11 -0
  31. package/cli/storybook-dist/assets/RBAccordion.stories-l_KWmznJ.js +17 -0
  32. package/cli/storybook-dist/assets/RBAccordionGroup.stories-BHwMLO_b.js +33 -0
  33. package/cli/storybook-dist/assets/RBAlert.stories-XeJozdck.js +17 -0
  34. package/cli/storybook-dist/assets/RBBadge.stories-BoIw5gFT.js +1 -0
  35. package/cli/storybook-dist/assets/RBBattery.stories-C_qyHveA.js +10 -0
  36. package/cli/storybook-dist/assets/RBCard.stories-jFfiHYKe.js +45 -0
  37. package/cli/storybook-dist/assets/RBCheckBox.stories-DTfCEweM.js +1 -0
  38. package/cli/storybook-dist/assets/RBCheckIconButton.stories-CTDnyUqG.js +1 -0
  39. package/cli/storybook-dist/assets/RBCheckLabelButton.stories-DmquL7n0.js +24 -0
  40. package/cli/storybook-dist/assets/RBChipTab.stories-B8zl9AG8.js +21 -0
  41. package/cli/storybook-dist/assets/RBChipsBoxTab.stories-BGRQ_ix8.js +1 -0
  42. package/cli/storybook-dist/assets/RBColorIcons.stories-s5QE7tL1.js +3 -0
  43. package/cli/storybook-dist/assets/{RBCommand.stories-C3bwPq2T.js → RBCommand.stories-Yrpy_B26.js} +3 -3
  44. package/cli/storybook-dist/assets/RBConfirm.stories-C9qrp3br.js +20 -0
  45. package/cli/storybook-dist/assets/RBDateInput.stories-DZpvxSqb.js +15 -0
  46. package/cli/storybook-dist/assets/RBDialog.stories-DSonk9Bx.js +38 -0
  47. package/cli/storybook-dist/assets/RBDivider.stories-CtuMDRWW.js +1 -0
  48. package/cli/storybook-dist/assets/RBDrawer.stories-BNjRz9Cf.js +14 -0
  49. package/cli/storybook-dist/assets/{RBDropdownMenu.stories-9fBcV2Ct.js → RBDropdownMenu.stories-Bjl9aOPU.js} +2 -2
  50. package/cli/storybook-dist/assets/RBEmptyView.stories-ChMkuohg.js +12 -0
  51. package/cli/storybook-dist/assets/RBIconButton.stories-B5R9unwo.js +1 -0
  52. package/cli/storybook-dist/assets/RBIcons.stories-Cp5JeZNr.js +3 -0
  53. package/cli/storybook-dist/assets/RBInlineLabelButton.stories-Dl_km9SD.js +1 -0
  54. package/cli/storybook-dist/assets/RBJoyStick.stories-g1XwqElo.js +11 -0
  55. package/cli/storybook-dist/assets/RBLabelButton.stories-iNSl-cdD.js +1 -0
  56. package/cli/storybook-dist/assets/RBLight.stories-DptPacw1.js +1 -0
  57. package/cli/storybook-dist/assets/RBMenubar.stories-CTH4jNi6.js +3 -0
  58. package/cli/storybook-dist/assets/RBMultiRangeInput.stories-BD138rOz.js +14 -0
  59. package/cli/storybook-dist/assets/RBPagination.stories-DaXD-840.js +17 -0
  60. package/cli/storybook-dist/assets/RBPopover.stories-BHA1-yYi.js +11 -0
  61. package/cli/storybook-dist/assets/RBPrompt.stories-CoEeIK6d.js +20 -0
  62. package/cli/storybook-dist/assets/RBRadioBox.stories-CePglWfe.js +1 -0
  63. package/cli/storybook-dist/assets/RBRadioButton.stories-BRNRgcJb.js +11 -0
  64. package/cli/storybook-dist/assets/RBRangeDateInput.stories-B6ukx3Pl.js +15 -0
  65. package/cli/storybook-dist/assets/RBResizable.stories-DqoaWeqW.js +20 -0
  66. package/cli/storybook-dist/assets/RBSelectBox.stories-8QBhknxC.js +6 -0
  67. package/cli/storybook-dist/assets/RBSheet.stories-Doaw8VOp.js +39 -0
  68. package/cli/storybook-dist/assets/RBSideNumberInput.stories-BmAEpYFE.js +5 -0
  69. package/cli/storybook-dist/assets/RBSlider.stories-CH-Hkgd6.js +5 -0
  70. package/cli/storybook-dist/assets/RBSpinner.stories-BEceevO_.js +14 -0
  71. package/cli/storybook-dist/assets/{RBSwitch.stories-CBYXvhkd.js → RBSwitch.stories-BoZzoyfx.js} +2 -2
  72. package/cli/storybook-dist/assets/RBTab.stories-CN3Algxc.js +1 -0
  73. package/cli/storybook-dist/assets/RBTable.stories-C1UgfrL_.js +62 -0
  74. package/cli/storybook-dist/assets/RBTableRow.stories-ASxrEiHq.js +11 -0
  75. package/cli/storybook-dist/assets/RBTabs.stories-0tMRRXl4.js +21 -0
  76. package/cli/storybook-dist/assets/RBTextArea.stories-DhWXTnBK.js +5 -0
  77. package/cli/storybook-dist/assets/RBTextField.stories-BLI0HpCu.js +45 -0
  78. package/cli/storybook-dist/assets/RBTextInput.stories-J8FkNDJo.js +5 -0
  79. package/cli/storybook-dist/assets/RBToast.stories-D8UxgdX3.js +11 -0
  80. package/cli/storybook-dist/assets/RBToggle.stories-CjwzqnV-.js +12 -0
  81. package/cli/storybook-dist/assets/RBToggleGroup.stories-3JwuIqYr.js +17 -0
  82. package/cli/storybook-dist/assets/RBTooltip.stories-Wkx6rfug.js +9 -0
  83. package/cli/storybook-dist/assets/{MapEditor-C6_H9h5t.css → SideNumberInput-SAkhydsn.css} +2 -2
  84. package/cli/storybook-dist/assets/SideNumberInput-_BKR64MG.js +1114 -0
  85. package/cli/storybook-dist/assets/{entry-preview-N9dpIJQA.js → entry-preview-VQeOKtPr.js} +1 -1
  86. package/cli/storybook-dist/assets/{iframe-BwCxSq5d.js → iframe-Ci_IjEPD.js} +2 -2
  87. package/cli/storybook-dist/assets/{index-CgJh_5EZ.js → index-DVR_O3uO.js} +3 -3
  88. package/cli/storybook-dist/assets/preview-BVJWkKiZ.css +1 -0
  89. package/cli/storybook-dist/assets/preview-CO9TxipX.js +3 -0
  90. package/cli/storybook-dist/assets/{preview-DsYc6ovL.js → preview-DAZ7L_eg.js} +2 -2
  91. package/cli/storybook-dist/assets/react-resizable-panels.browser-BpHwB_WW.js +102 -0
  92. package/cli/storybook-dist/iframe.html +1 -1
  93. package/cli/storybook-dist/project.json +1 -1
  94. package/cli/templates/common/README.md +229 -19
  95. package/cli/templates/common/manifest.json +1 -0
  96. package/cli/templates/common/requirements.txt +3 -3
  97. package/package.json +3 -3
  98. package/cli/storybook-dist/assets/Docs-DLFwGiks.js +0 -7
  99. package/cli/storybook-dist/assets/Docs-dOc9cH1E.js +0 -20
  100. package/cli/storybook-dist/assets/MapEditor-Jj1J2sUz.js +0 -6418
  101. package/cli/storybook-dist/assets/NxAvatar.stories-B-iQoylp.js +0 -13
  102. package/cli/storybook-dist/assets/NxButton.stories-CawQZN07.js +0 -20
  103. package/cli/storybook-dist/assets/NxPagination.stories-VYXLplNl.js +0 -11
  104. package/cli/storybook-dist/assets/NxPointerHoldButton.stories-BpqIkt0X.js +0 -14
  105. package/cli/storybook-dist/assets/NxSelectBox.stories-JECi_1PM.js +0 -17
  106. package/cli/storybook-dist/assets/NxSlideRange.stories-DJe8F2Mv.js +0 -14
  107. package/cli/storybook-dist/assets/NxSwitch.stories-DX6LxxQL.js +0 -11
  108. package/cli/storybook-dist/assets/NxTextArea.stories-Cy42nYOI.js +0 -11
  109. package/cli/storybook-dist/assets/NxTextInput.stories-Bb_q6FuW.js +0 -11
  110. package/cli/storybook-dist/assets/RBAccordion.stories-ChgPXO0_.js +0 -17
  111. package/cli/storybook-dist/assets/RBAccordionGroup.stories-nmbqYYSE.js +0 -33
  112. package/cli/storybook-dist/assets/RBAlert.stories-ChOPuFxI.js +0 -17
  113. package/cli/storybook-dist/assets/RBBadge.stories-Bas7g4jb.js +0 -1
  114. package/cli/storybook-dist/assets/RBBattery.stories-C0MywWvB.js +0 -10
  115. package/cli/storybook-dist/assets/RBCard.stories-Ba7y0u6Q.js +0 -45
  116. package/cli/storybook-dist/assets/RBCheckBox.stories-CsHFsXCd.js +0 -1
  117. package/cli/storybook-dist/assets/RBCheckIconButton.stories-GERClL9R.js +0 -1
  118. package/cli/storybook-dist/assets/RBCheckLabelButton.stories-C-BrmKaW.js +0 -24
  119. package/cli/storybook-dist/assets/RBChipTab.stories-C8JCa6F9.js +0 -21
  120. package/cli/storybook-dist/assets/RBChipsBoxTab.stories-DmUaHBJ3.js +0 -1
  121. package/cli/storybook-dist/assets/RBColorIcons.stories-Bcah6eZe.js +0 -3
  122. package/cli/storybook-dist/assets/RBConfirm.stories-CT0GuE-J.js +0 -20
  123. package/cli/storybook-dist/assets/RBDateInput.stories-CMd2xRCF.js +0 -15
  124. package/cli/storybook-dist/assets/RBDialog.stories-Ui5Ni-P_.js +0 -38
  125. package/cli/storybook-dist/assets/RBDivider.stories-r8TDiO36.js +0 -1
  126. package/cli/storybook-dist/assets/RBDrawer.stories-CymmrHjI.js +0 -14
  127. package/cli/storybook-dist/assets/RBEmptyView.stories-By9vncNC.js +0 -12
  128. package/cli/storybook-dist/assets/RBIconButton.stories-DC29KMxX.js +0 -1
  129. package/cli/storybook-dist/assets/RBIcons.stories-Dpd_V9b9.js +0 -3
  130. package/cli/storybook-dist/assets/RBInlineLabelButton.stories-CfUQdAdt.js +0 -1
  131. package/cli/storybook-dist/assets/RBJoyStick.stories-Dl-uXk9x.js +0 -11
  132. package/cli/storybook-dist/assets/RBLabelButton.stories-Dx_Vn6EM.js +0 -1
  133. package/cli/storybook-dist/assets/RBLight.stories-Cm5UYJ4n.js +0 -1
  134. package/cli/storybook-dist/assets/RBMenubar.stories-CN5z7F6D.js +0 -3
  135. package/cli/storybook-dist/assets/RBMultiRangeInput.stories-DrAMI4mQ.js +0 -14
  136. package/cli/storybook-dist/assets/RBPagination.stories-BVLXuTLw.js +0 -17
  137. package/cli/storybook-dist/assets/RBPopover.stories-VCws5q80.js +0 -11
  138. package/cli/storybook-dist/assets/RBPrompt.stories-Cw5-wssh.js +0 -20
  139. package/cli/storybook-dist/assets/RBRadioBox.stories-ClqGtGA_.js +0 -1
  140. package/cli/storybook-dist/assets/RBRadioButton.stories-SxcJFioj.js +0 -11
  141. package/cli/storybook-dist/assets/RBRangeDateInput.stories-L_wCftDv.js +0 -15
  142. package/cli/storybook-dist/assets/RBResizable.stories-2VytDv6m.js +0 -20
  143. package/cli/storybook-dist/assets/RBSelectBox.stories-BoOKTSL_.js +0 -6
  144. package/cli/storybook-dist/assets/RBSheet.stories-CUClMqKK.js +0 -39
  145. package/cli/storybook-dist/assets/RBSideNumberInput.stories-BTYDDAmk.js +0 -5
  146. package/cli/storybook-dist/assets/RBSlider.stories-Bu6vD9ym.js +0 -5
  147. package/cli/storybook-dist/assets/RBSpinner.stories-XmVcaTVS.js +0 -14
  148. package/cli/storybook-dist/assets/RBTab.stories-DFFYlkCv.js +0 -1
  149. package/cli/storybook-dist/assets/RBTable.stories-CR2j2EQQ.js +0 -62
  150. package/cli/storybook-dist/assets/RBTableRow.stories-CpPIP1au.js +0 -11
  151. package/cli/storybook-dist/assets/RBTabs.stories-Bew5XVDZ.js +0 -21
  152. package/cli/storybook-dist/assets/RBTextArea.stories-JiRn-tk_.js +0 -5
  153. package/cli/storybook-dist/assets/RBTextField.stories-8LWyUBm9.js +0 -45
  154. package/cli/storybook-dist/assets/RBTextInput.stories-PLJ70xm5.js +0 -5
  155. package/cli/storybook-dist/assets/RBToast.stories-BQf_9x0k.js +0 -11
  156. package/cli/storybook-dist/assets/RBToggle.stories-C5dZnmX_.js +0 -12
  157. package/cli/storybook-dist/assets/RBToggleGroup.stories-D7fwXCxA.js +0 -17
  158. package/cli/storybook-dist/assets/RBTooltip.stories-D-sWRxbA.js +0 -9
  159. package/cli/storybook-dist/assets/RainbowUiProvider-CsMXuxM1.js +0 -31
  160. package/cli/storybook-dist/assets/preview-CzDPTg-k.js +0 -3
  161. package/cli/storybook-dist/assets/preview-DZWUyVBI.css +0 -1
  162. package/cli/storybook-dist/assets/react-resizable-panels.browser-CHDWt8fa.js +0 -72
  163. /package/cli/storybook-dist/assets/{RainbowUiProvider-BaelaOGy.css → react-resizable-panels-BaelaOGy.css} +0 -0
@@ -509,7 +509,7 @@
509
509
  }
510
510
  </script>
511
511
 
512
- <script type="module" crossorigin src="./assets/iframe-BwCxSq5d.js"></script>
512
+ <script type="module" crossorigin src="./assets/iframe-Ci_IjEPD.js"></script>
513
513
  </head>
514
514
 
515
515
  <body>
@@ -1 +1 @@
1
- {"generatedAt":1787013792240,"userSince":1750932757926,"hasCustomBabel":false,"hasCustomWebpack":false,"hasStaticDirs":false,"hasStorybookEslint":true,"refCount":0,"testPackages":{"@vitest/browser":"3.2.4","@vitest/coverage-v8":"3.2.4","playwright":"1.59.1","vitest":"3.2.4"},"hasRouterPackage":false,"monorepo":"Turborepo","packageManager":{"type":"yarn","version":"berry","agent":"yarn@berry"},"preview":{"usesGlobals":false},"framework":{"name":"@storybook/react-vite","options":{}},"builder":"@storybook/builder-vite","renderer":"@storybook/react","portableStoriesFileCount":0,"applicationFileCount":0,"storybookVersion":"8.6.18","storybookVersionSpecifier":"^8.6.4","language":"typescript","storybookPackages":{"@chromatic-com/storybook":{"version":"3.2.7"},"@storybook/addon-essentials":{"version":"8.6.18"},"@storybook/addon-links":{"version":"8.6.18"},"@storybook/addon-onboarding":{"version":"8.6.18"},"@storybook/addon-themes":{"version":"8.6.18"},"@storybook/blocks":{"version":"8.6.18"},"@storybook/experimental-addon-test":{"version":"8.6.18"},"@storybook/react":{"version":"8.6.18"},"@storybook/react-vite":{"version":"8.6.18"},"@storybook/test":{"version":"8.6.18"},"@storybook/theming":{"version":"8.6.18"},"eslint-plugin-storybook":{"version":"0.11.6"},"storybook":{"version":"8.6.18"},"storybook-addon-react-docgen":{"version":"1.2.44"}},"addons":{"$SNIP/node_modules/@storybook/addon-links":{"version":null},"$SNIP/node_modules/@storybook/addon-essentials":{"version":null},"$SNIP/node_modules/@chromatic-com/storybook":{"version":null},"$SNIP/node_modules/@storybook/addon-themes":{"version":null},"$SNIP/node_modules/@storybook/experimental-addon-test":{"version":null}}}
1
+ {"generatedAt":1787300984646,"userSince":1750932757926,"hasCustomBabel":false,"hasCustomWebpack":false,"hasStaticDirs":false,"hasStorybookEslint":true,"refCount":0,"testPackages":{"@vitest/browser":"3.2.4","@vitest/coverage-v8":"3.2.4","playwright":"1.59.1","vitest":"3.2.4"},"hasRouterPackage":false,"monorepo":"Turborepo","packageManager":{"type":"yarn","version":"berry","agent":"yarn@berry"},"preview":{"usesGlobals":false},"framework":{"name":"@storybook/react-vite","options":{}},"builder":"@storybook/builder-vite","renderer":"@storybook/react","portableStoriesFileCount":0,"applicationFileCount":0,"storybookVersion":"8.6.18","storybookVersionSpecifier":"^8.6.4","language":"typescript","storybookPackages":{"@chromatic-com/storybook":{"version":"3.2.7"},"@storybook/addon-essentials":{"version":"8.6.18"},"@storybook/addon-links":{"version":"8.6.18"},"@storybook/addon-onboarding":{"version":"8.6.18"},"@storybook/addon-themes":{"version":"8.6.18"},"@storybook/blocks":{"version":"8.6.18"},"@storybook/experimental-addon-test":{"version":"8.6.18"},"@storybook/react":{"version":"8.6.18"},"@storybook/react-vite":{"version":"8.6.18"},"@storybook/test":{"version":"8.6.18"},"@storybook/theming":{"version":"8.6.18"},"eslint-plugin-storybook":{"version":"0.11.6"},"storybook":{"version":"8.6.18"},"storybook-addon-react-docgen":{"version":"1.2.44"}},"addons":{"$SNIP/node_modules/@storybook/addon-links":{"version":null},"$SNIP/node_modules/@storybook/addon-essentials":{"version":null},"$SNIP/node_modules/@chromatic-com/storybook":{"version":null},"$SNIP/node_modules/@storybook/addon-themes":{"version":null},"$SNIP/node_modules/@storybook/experimental-addon-test":{"version":null}}}
@@ -439,29 +439,202 @@ ctx = PluginProgramContext(plugin_id="my-plugin")
439
439
 
440
440
  @ctx.on_execute
441
441
  async def handle(args: dict) -> None:
442
- message = args.get("message", "")
443
- print(f"[my-plugin] execute called: message={message}", flush=True)
442
+ """Called once when my Step executes. Variable writes apply to the
443
+ running program immediately + broadcast to other robots' main tasks."""
444
+ count = await ctx.get_variable("counter") # read an existing program variable
445
+ await ctx.set_variable("counter", count + 1) # update an existing variable — allowed
446
+ await ctx.set_variable("RBP_TEST", 1) # NEW variables must start with RBP_
444
447
 
445
- # check stop/pause during long-running work
446
- for _ in range(10):
447
- await ctx.check_stop()
448
- await asyncio.sleep(0.1)
448
+ for i in range(100):
449
+ await ctx.check_stop() # auto-scoped to this Step's robot model
450
+ await asyncio.sleep(0.5)
449
451
 
450
- # read a program variable
451
- counter = await ctx.get_variable("counter")
452
- print(f"[my-plugin] counter={counter}", flush=True)
452
+ await ctx.done()
453
453
 
454
- # update a variable
455
- await ctx.set_variable("result", f"done: {message}")
456
454
 
457
- # finish the step
458
- await ctx.done()
455
+ async def background_monitor() -> None:
456
+ """Resident task outside any Step. If no program is running,
457
+ get returns None and set is silently ignored — always safe to call."""
458
+ while True:
459
+ await asyncio.sleep(1.0)
459
460
 
461
+ # targets every running main task (no robot_model param — always broadcast)
462
+ await ctx.set_variable("RBP_TEST", 3)
460
463
 
461
- if __name__ == "__main__":
462
- asyncio.run(ctx.start())
464
+ # get options
465
+ v1 = await ctx.get_variable("counter") # first value found in the whole tree
466
+ v2 = await ctx.get_variable("counter", robot_model="C500920") # a specific robot
467
+ v3 = await ctx.get_variable("RBP_TEST", plugin_id="my-plugin") # the value my-plugin last wrote
468
+
469
+ if ctx.executor_state("C500920") == "paused":
470
+ print("C500920 program is paused")
471
+
472
+
473
+ async def main() -> None:
474
+ asyncio.create_task(background_monitor())
475
+ await ctx.start() # stays resident
476
+
477
+
478
+ asyncio.run(main())
479
+ ```
480
+
481
+ #### Program variables & executor state (`PluginProgramContext`)
482
+
483
+ `rainbow.rb_sdk.PluginProgramContext` lets the plugin process interact with the
484
+ running program (PyFM): read/write program variables and observe execution
485
+ state — inside a Step handler or from a resident task, at any time.
486
+
487
+ - The `on_execute` handler is called **only when PyFM executes this plugin's
488
+ Step**. One Step execution = one handler call, and the Step does not finish
489
+ until you call `ctx.done()` — always call it.
490
+ - The plugin process itself stays resident after `ctx.start()`; executor state
491
+ queries and variable access below keep working whether or not a Step is
492
+ executing.
493
+
494
+ #### Variable naming rules (important)
495
+
496
+ PyFM variables are a **program-wide shared namespace**. One rule:
497
+
498
+ - **Modifying an existing variable** — the name passes as-is. Exchanging
499
+ variables between the program and the plugin is the intended usage.
500
+ - **Creating a variable that doesn't exist** — the `RBP_` prefix is
501
+ **required** (enforced by the SDK/server; a violation raises
502
+ `RuntimeError`). Applies equally inside and outside Step execution.
503
+
504
+ For new variable names, a convention that includes the plugin id is strongly
505
+ recommended:
506
+
507
+ ```
508
+ RBP_{plugin_id}_{name}
509
+
510
+ e.g. RBP_vision_detect_count, RBP_gripper_last_error
511
+ ```
512
+
513
+ Why:
514
+
515
+ - `RBP_` — instantly identifies plugin-created variables in the program
516
+ editor/UI.
517
+ - `{plugin_id}` — **prevents name collisions with other plugins.** If two
518
+ plugins use the same name they overwrite the same variable (`RBP_` alone is
519
+ not something the SDK guards against).
520
+
521
+ #### Reading / writing variables
522
+
523
+ ```python
524
+ value = await ctx.get_variable("counter") # read (no name restriction)
525
+ await ctx.set_variable("counter", value + 1) # modify existing variable — allowed
526
+ await ctx.set_variable("RBP_my-plugin_result", 42) # create new variable — RBP_ required
527
+ ```
528
+
529
+ `set_variable` always applies to **every running main task** (a plugin belongs
530
+ to muscat, not to a specific robot — there is no `robot_model` parameter):
531
+
532
+ | When | Own program | Other robots' main tasks |
533
+ |---|---|---|
534
+ | During own Step execution | via the control queryable — **immediate** | broadcast — each at its next Step boundary |
535
+ | Outside a Step (resident task, …) | resident endpoint — next Step boundary | same |
536
+
537
+ `get_variable` has options:
538
+
539
+ ```python
540
+ await ctx.get_variable("counter") # search all main tasks (first value found)
541
+ await ctx.get_variable("counter", robot_model="C500920") # a specific robot's value
542
+ await ctx.get_variable("RBP_TEST", plugin_id="A.plugin") # the value that plugin last wrote
543
+ ```
544
+
545
+ Caveats:
546
+
547
+ - If no program is running, `set_variable` is **silently ignored** and
548
+ `get_variable` returns `None`. (`RuntimeError` is raised only for real
549
+ errors, like the `RBP_` violation on a new variable — the message is tagged
550
+ `[plugin:{id}]` with the offending plugin.)
551
+ - Rarely, a write can be lost if it races the worker's variable flush
552
+ (lock-free read-modify-write). For important values, re-check and retry on
553
+ the next cycle.
554
+
555
+ #### Per-plugin value storage (meta)
556
+
557
+ Besides the shared value, each variable entry records which plugin last wrote
558
+ what:
559
+
560
+ ```python
561
+ # state_dict["variables"] — after A wrote 1 and B wrote 2
562
+ "RBP_TEST": {
563
+ "value": 2, # shared slot = last written value
564
+ "type": "local",
565
+ "meta": {"writers": {"A.plugin": 1, "B.plugin": 2}}, # per-plugin record
566
+ }
567
+ ```
568
+
569
+ So the exact value is recoverable even when names collide:
570
+
571
+ - Plugin SDK: `ctx.get_variable("RBP_TEST", plugin_id="A.plugin")` → `1`
572
+ - Program step expression: `COUNT = get_var("A.plugin", "RBP_TEST") + 1` → `2`
573
+ - A plain name (`RBP_TEST += 1`) uses the shared slot (last written value) → `3`
574
+
575
+ #### Executor state
576
+
577
+ Subscribes to the `muscat/executor/state` publish (0.8 s interval) and exposes
578
+ per-robot-model state:
579
+
580
+ ```python
581
+ ctx.executor_state("C500920") # "running" | "paused" | "waiting" | ... | None
582
+ ctx.executor_state() # {"C500920": "paused", "amr": "running"}
583
+ ctx.is_paused("C500920") # whether that model is paused
584
+ ctx.is_stopped("C500920") # stop/error transition of a model seen active this run
585
+ ```
586
+
587
+ - States: `idle | running | paused | waiting | stopped | post_start | completed | error`
588
+ - A model with no running task is `None` / absent from the dict.
589
+ - The publish interval is 0.8 s, so expect up to ~1 s of latency.
590
+ - With `IS_DEV=true` there is no publish at all — always `None`.
591
+
592
+ To get a callback at the moment the state changes, without polling:
593
+
594
+ ```python
595
+ @ctx.on_executor_state_change
596
+ async def on_change(robot_model: str, state: str) -> None:
597
+ if state == "paused":
598
+ print(f"{robot_model} paused")
599
+ ```
600
+
601
+ - Not called for repeated publishes of the same state — fires exactly once
602
+ per per-model state change.
603
+ - An exception in the handler is only logged; state tracking keeps running.
604
+
605
+ #### Responding to pause / stop
606
+
607
+ ```python
608
+ @ctx.on_execute
609
+ async def handle(args: dict) -> None:
610
+ for i in range(100):
611
+ # stop → CancelledError (propagated to the executor as a stop),
612
+ # pause → waits here until resumed.
613
+ # Inside on_execute this automatically watches only the robot model
614
+ # executing this Step.
615
+ await ctx.check_stop()
616
+
617
+ ... # actual work
618
+ await asyncio.sleep(0.5)
619
+
620
+ await ctx.done()
463
621
  ```
464
622
 
623
+ Scope priority for `check_stop` / `is_paused` / `is_stopped`:
624
+
625
+ 1. `robot_model` given — that model only
626
+ 2. Omitted inside `on_execute` — **only the model executing this Step**
627
+ (passed in by the executor)
628
+ 3. Omitted elsewhere (resident task, …) — all models
629
+
630
+ A handler doing long-running work must call `check_stop()` every loop
631
+ iteration so it reacts to pause/stop immediately. Without it, the plugin keeps
632
+ running even after the operator presses Stop.
633
+
634
+ Variables your plugin wants the Program page variable picker to offer must be
635
+ pre-declared in `manifest.json` under `"variables"` (see the manifest section
636
+ below).
637
+
465
638
  ### C++
466
639
 
467
640
  C++ plugins use `cpp/` and are built with CMake inside Docker. The current C++
@@ -588,6 +761,15 @@ public:
588
761
  }
589
762
  ],
590
763
 
764
+ // optional: variables this plugin exposes to pyfm programs — the Program
765
+ // page variable picker lists ONLY declared variables. name must start with
766
+ // RBP_; description is optional but without it the UI can't explain the
767
+ // variable, so write one.
768
+ "variables": [
769
+ { "name": "RBP_grip_force", "type": "number", "init": 0.5, "description": { "ko": "그리퍼 힘", "en": "Gripper force" } },
770
+ { "name": "RBP_target_pose", "type": "array", "init": [0, 0, 0] }
771
+ ],
772
+
591
773
  // runtime — one of:
592
774
  // { "type": "none" }
593
775
  // { "type": "python", "entry": "main.py" }
@@ -654,15 +836,36 @@ public:
654
836
  - `commandInfo` — required when `point` is `"program.panel"`
655
837
  - `ports` — optional `number[]`; every port must be within `28600-28999`
656
838
  and must not be a reserved robot/industrial/internal port
839
+ - `variables` — optional array of `{ name, type, init, description? }`:
840
+ - `name` — must start with `RBP_`, then letters/digits/underscore; unique per plugin
841
+ - `type` — `"number" | "string" | "array"`
842
+ - `init` — required initial value, must match `type`
843
+ - `description` — optional `string` or i18n object (`en` required in object form)
657
844
 
658
- `muscat-pk build` throws on any validation error. `muscat-pk dev` prints warnings.
845
+ `muscat-pk build` throws on any validation error. `muscat-pk dev` prints
846
+ warnings — except `variables` errors (e.g. a name without the `RBP_` prefix),
847
+ which are hard errors in `dev` / `dev:back` too.
659
848
 
660
849
  **Backend port rules:**
661
850
  - Declare a port only if your backend opens a TCP server/listener.
662
- - `muscat-pk dev` and `muscat-pk dev:back` stop the backend if it opens an
663
- undeclared managed port.
851
+ - **Every listening TCP port must be declared.** `muscat-pk dev` and
852
+ `muscat-pk dev:back` watch the backend and stop it the moment it opens a port
853
+ that is not in `ports`. A port outside `28600-28999` can't be declared, so it
854
+ must not be opened either — picking e.g. `5500` is not a way around the rule.
855
+ It would escape this check *and* the robot's install-time conflict check, and
856
+ only collide once it's running on a robot.
664
857
  - Reserved ports include `502`, `2222`, `4840`, `5170-5179`, `8000-8999`,
665
858
  `10000`, `30004`, `34964`, `44818`, `50000-50005`, and `50051`.
859
+ - The robot rejects installation (HTTP 409) if a declared port is reserved,
860
+ out of range, or already claimed by another enabled plugin.
861
+
862
+ **Reaching your backend's ports during development:**
863
+ - Declared ports are published to `127.0.0.1` on your machine, so
864
+ `curl http://127.0.0.1:28600` works from the host on macOS, Windows, and Linux.
865
+ - On native Linux the dev container uses host networking, so the ports are on
866
+ the host already.
867
+ - If a declared port is already taken on your machine, `muscat-pk dev` warns and
868
+ skips publishing that one — the backend still listens inside the container.
666
869
 
667
870
  ---
668
871
 
@@ -760,7 +963,14 @@ it works out of the box:
760
963
  }
761
964
  ```
762
965
 
763
- **Codex** — add to `~/.codex/config.toml`:
966
+ **Codex** — register once with:
967
+
968
+ ```bash
969
+ muscat-pk mcp --install codex
970
+ ```
971
+
972
+ This appends the server to `~/.codex/config.toml` (idempotent — safe to run
973
+ again). Equivalent manual config:
764
974
 
765
975
  ```toml
766
976
  [mcp_servers.muscat]
@@ -21,5 +21,6 @@
21
21
  "opens": "popover"
22
22
  }
23
23
  ],
24
+ "variables": [],
24
25
  "runtime": { "type": "__RUNTIME_TYPE__", "entry": "main.py" }
25
26
  }
@@ -1,4 +1,4 @@
1
- rainbow-rb-sdk==0.0.79
2
- rainbow-rb-flat-buffers==0.0.79
3
- rainbow-rb-zenoh==0.0.79
1
+ rainbow-rb-sdk==0.1.0
2
+ rainbow-rb-flat-buffers==0.1.0
3
+ rainbow-rb-zenoh==0.1.0
4
4
  requests==2.34.2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rainbow-robotics/muscat-plugin-kit",
3
- "version": "1.1.5",
3
+ "version": "1.2.1",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=20"
@@ -53,8 +53,8 @@
53
53
  },
54
54
  "dependencies": {
55
55
  "@modelcontextprotocol/sdk": "^1.29.0",
56
- "@rainbow-robotics/plugin-ui": "1.1.5",
57
- "@rainbow-robotics/preview-host": "1.1.5",
56
+ "@rainbow-robotics/plugin-ui": "1.2.1",
57
+ "@rainbow-robotics/preview-host": "1.2.1",
58
58
  "postcss": "^8.5.8",
59
59
  "socket.io": "^4.8.1",
60
60
  "typescript": "^5.8.0",
@@ -1,7 +0,0 @@
1
- import{j as e}from"./jsx-runtime-BTJTZTIL.js";import{useMDXComponents as g}from"./index-B4FGfHer.js";import{b as S,U as $}from"./index-CgJh_5EZ.js";import{d as u,e as s,f as c,g as b}from"./react-resizable-panels.browser-CHDWt8fa.js";import"./index-Dmy2JGbm.js";import"./RainbowUiProvider-CsMXuxM1.js";import{c as v}from"./browserUtils-CxJ5gea3.js";import"./index-ChsGqxH_.js";import"./iframe-BwCxSq5d.js";import"./index-CT3U1fyk.js";import"./index-BRq5TIsn.js";import"./index-DgH-xKnr.js";import"./index-DrFu-skq.js";const F=JSON.parse('{"title":{"01":{"normal":{"$type":"typography","$value":{"fontSize":16,"lineHeight":24,"letterSpacing":0,"fontWeight":400,"fontFamily":"Pretendard Variable"}},"medium":{"$type":"typography","$value":{"fontSize":16,"lineHeight":24,"letterSpacing":0,"fontWeight":500,"fontFamily":"Pretendard Variable"}},"bold":{"$type":"typography","$value":{"fontSize":16,"lineHeight":24,"letterSpacing":0,"fontWeight":700,"fontFamily":"Pretendard Variable"}}},"02":{"normal":{"$type":"typography","$value":{"fontSize":18,"lineHeight":28,"letterSpacing":0,"fontWeight":400,"fontFamily":"Pretendard Variable"}},"medium":{"$type":"typography","$value":{"fontSize":18,"lineHeight":28,"letterSpacing":0,"fontWeight":500,"fontFamily":"Pretendard Variable"}},"bold":{"$type":"typography","$value":{"fontSize":18,"lineHeight":28,"letterSpacing":0,"fontWeight":700,"fontFamily":"Pretendard Variable"}}},"03":{"normal":{"$type":"typography","$value":{"fontSize":20,"lineHeight":32,"letterSpacing":0,"fontWeight":400,"fontFamily":"Pretendard Variable"}},"medium":{"$type":"typography","$value":{"fontSize":20,"lineHeight":32,"letterSpacing":0,"fontWeight":500,"fontFamily":"Pretendard Variable"}},"bold":{"$type":"typography","$value":{"fontSize":20,"lineHeight":32,"letterSpacing":0,"fontWeight":700,"fontFamily":"Pretendard Variable"}}},"04":{"normal":{"$type":"typography","$value":{"fontSize":24,"lineHeight":36,"letterSpacing":0,"fontWeight":400,"fontFamily":"Pretendard Variable"}},"medium":{"$type":"typography","$value":{"fontSize":24,"lineHeight":36,"letterSpacing":0,"fontWeight":500,"fontFamily":"Pretendard Variable"}},"bold":{"$type":"typography","$value":{"fontSize":24,"lineHeight":36,"letterSpacing":0,"fontWeight":700,"fontFamily":"Pretendard Variable"}}},"05":{"normal":{"$type":"typography","$value":{"fontSize":30,"lineHeight":44,"letterSpacing":0,"fontWeight":400,"fontFamily":"Pretendard Variable"}},"medium":{"$type":"typography","$value":{"fontSize":30,"lineHeight":44,"letterSpacing":0,"fontWeight":500,"fontFamily":"Pretendard Variable"}},"bold":{"$type":"typography","$value":{"fontSize":30,"lineHeight":44,"letterSpacing":0,"fontWeight":700,"fontFamily":"Pretendard Variable"}}},"06":{"normal":{"$type":"typography","$value":{"fontSize":36,"lineHeight":54,"letterSpacing":0,"fontWeight":400,"fontFamily":"Pretendard Variable"}},"medium":{"$type":"typography","$value":{"fontSize":36,"lineHeight":54,"letterSpacing":0,"fontWeight":500,"fontFamily":"Pretendard Variable"}},"bold":{"$type":"typography","$value":{"fontSize":36,"lineHeight":54,"letterSpacing":0,"fontWeight":700,"fontFamily":"Pretendard Variable"}}}},"body":{"lg":{"normal":{"$type":"typography","$value":{"fontSize":18,"lineHeight":32,"letterSpacing":0,"fontWeight":400,"fontFamily":"Pretendard Variable"}},"medium":{"$type":"typography","$value":{"fontSize":18,"lineHeight":32,"letterSpacing":0,"fontWeight":500,"fontFamily":"Pretendard Variable"}},"semibold":{"$type":"typography","$value":{"fontSize":18,"lineHeight":32,"letterSpacing":0,"fontWeight":600,"fontFamily":"Pretendard Variable"}}},"md":{"normal":{"$type":"typography","$value":{"fontSize":16,"lineHeight":28,"letterSpacing":0,"fontWeight":400,"fontFamily":"Pretendard Variable"}},"medium":{"$type":"typography","$value":{"fontSize":16,"lineHeight":28,"letterSpacing":0,"fontWeight":500,"fontFamily":"Pretendard Variable"}},"semibold":{"$type":"typography","$value":{"fontSize":16,"lineHeight":28,"letterSpacing":0,"fontWeight":600,"fontFamily":"Pretendard Variable"}}},"sm2":{"normal":{"$type":"typography","$value":{"fontSize":15,"lineHeight":26,"letterSpacing":0,"fontWeight":400,"fontFamily":"Pretendard Variable"}},"medium":{"$type":"typography","$value":{"fontSize":15,"lineHeight":26,"letterSpacing":0,"fontWeight":500,"fontFamily":"Pretendard Variable"}},"semibold":{"$type":"typography","$value":{"fontSize":15,"lineHeight":26,"letterSpacing":0,"fontWeight":600,"fontFamily":"Pretendard Variable"}}},"sm":{"normal":{"$type":"typography","$value":{"fontSize":14,"lineHeight":24,"letterSpacing":0,"fontWeight":400,"fontFamily":"Pretendard Variable"}},"medium":{"$type":"typography","$value":{"fontSize":14,"lineHeight":24,"letterSpacing":0,"fontWeight":500,"fontFamily":"Pretendard Variable"}},"semibold":{"$type":"typography","$value":{"fontSize":14,"lineHeight":24,"letterSpacing":0,"fontWeight":600,"fontFamily":"Pretendard Variable"}}},"xs2":{"normal":{"$type":"typography","$value":{"fontSize":13,"lineHeight":22,"letterSpacing":0,"fontWeight":400,"fontFamily":"Pretendard Variable"}},"medium":{"$type":"typography","$value":{"fontSize":13,"lineHeight":22,"letterSpacing":0,"fontWeight":500,"fontFamily":"Pretendard Variable"}},"semibold":{"$type":"typography","$value":{"fontSize":13,"lineHeight":22,"letterSpacing":0,"fontWeight":600,"fontFamily":"Pretendard Variable"}}},"xs":{"normal":{"$type":"typography","$value":{"fontSize":12,"lineHeight":20,"letterSpacing":0,"fontWeight":400,"fontFamily":"Pretendard Variable"}},"medium":{"$type":"typography","$value":{"fontSize":12,"lineHeight":20,"letterSpacing":0,"fontWeight":500,"fontFamily":"Pretendard Variable"}},"semibold":{"$type":"typography","$value":{"fontSize":12,"lineHeight":20,"letterSpacing":0,"fontWeight":600,"fontFamily":"Pretendard Variable"}}},"2xs":{"normal":{"$type":"typography","$value":{"fontSize":10,"lineHeight":16,"letterSpacing":0,"fontWeight":400,"fontFamily":"Pretendard Variable"}},"medium":{"$type":"typography","$value":{"fontSize":10,"lineHeight":16,"letterSpacing":0,"fontWeight":500,"fontFamily":"Pretendard Variable"}},"semibold":{"$type":"typography","$value":{"fontSize":10,"lineHeight":16,"letterSpacing":0,"fontWeight":600,"fontFamily":"Pretendard Variable"}}}},"compact":{"lg":{"normal":{"$type":"typography","$value":{"fontSize":18,"lineHeight":28,"letterSpacing":0,"fontWeight":400,"fontFamily":"Pretendard Variable"}},"medium":{"$type":"typography","$value":{"fontSize":18,"lineHeight":28,"letterSpacing":0,"fontWeight":500,"fontFamily":"Pretendard Variable"}},"semibold":{"$type":"typography","$value":{"fontSize":18,"lineHeight":28,"letterSpacing":0,"fontWeight":600,"fontFamily":"Pretendard Variable"}}},"md":{"normal":{"$type":"typography","$value":{"fontSize":16,"lineHeight":24,"letterSpacing":0,"fontWeight":400,"fontFamily":"Pretendard Variable"}},"medium":{"$type":"typography","$value":{"fontSize":16,"lineHeight":24,"letterSpacing":0,"fontWeight":500,"fontFamily":"Pretendard Variable"}},"semibold":{"$type":"typography","$value":{"fontSize":16,"lineHeight":24,"letterSpacing":0,"fontWeight":600,"fontFamily":"Pretendard Variable"}}},"sm2":{"normal":{"$type":"typography","$value":{"fontSize":15,"lineHeight":22,"letterSpacing":0,"fontWeight":400,"fontFamily":"Pretendard Variable"}},"medium":{"$type":"typography","$value":{"fontSize":15,"lineHeight":22,"letterSpacing":0,"fontWeight":500,"fontFamily":"Pretendard Variable"}},"semibold":{"$type":"typography","$value":{"fontSize":15,"lineHeight":22,"letterSpacing":0,"fontWeight":600,"fontFamily":"Pretendard Variable"}}},"sm":{"normal":{"$type":"typography","$value":{"fontSize":14,"lineHeight":20,"letterSpacing":0,"fontWeight":400,"fontFamily":"Pretendard Variable"}},"medium":{"$type":"typography","$value":{"fontSize":14,"lineHeight":20,"letterSpacing":0,"fontWeight":500,"fontFamily":"Pretendard Variable"}},"semibold":{"$type":"typography","$value":{"fontSize":14,"lineHeight":20,"letterSpacing":0,"fontWeight":600,"fontFamily":"Pretendard Variable"}}},"xs2":{"normal":{"$type":"typography","$value":{"fontSize":13,"lineHeight":18,"letterSpacing":0,"fontWeight":400,"fontFamily":"Pretendard Variable"}},"medium":{"$type":"typography","$value":{"fontSize":13,"lineHeight":18,"letterSpacing":0,"fontWeight":500,"fontFamily":"Pretendard Variable"}},"semibold":{"$type":"typography","$value":{"fontSize":13,"lineHeight":18,"letterSpacing":0,"fontWeight":600,"fontFamily":"Pretendard Variable"}}},"xs":{"normal":{"$type":"typography","$value":{"fontSize":12,"lineHeight":16,"letterSpacing":0,"fontWeight":400,"fontFamily":"Pretendard Variable"}},"medium":{"$type":"typography","$value":{"fontSize":12,"lineHeight":16,"letterSpacing":0,"fontWeight":500,"fontFamily":"Pretendard Variable"}},"semibold":{"$type":"typography","$value":{"fontSize":12,"lineHeight":16,"letterSpacing":0,"fontWeight":600,"fontFamily":"Pretendard Variable"}}},"2xs":{"normal":{"$type":"typography","$value":{"fontSize":10,"lineHeight":12,"letterSpacing":0,"fontWeight":400,"fontFamily":"Pretendard Variable"}},"medium":{"$type":"typography","$value":{"fontSize":10,"lineHeight":12,"letterSpacing":0,"fontWeight":500,"fontFamily":"Pretendard Variable"}},"semibold":{"$type":"typography","$value":{"fontSize":10,"lineHeight":12,"letterSpacing":0,"fontWeight":600,"fontFamily":"Pretendard Variable"}}}},"code":{"2xs":{"normal":{"$type":"typography","$value":{"fontSize":10,"lineHeight":12,"letterSpacing":0,"fontWeight":400,"fontFamily":"Oxanium"}},"medium":{"$type":"typography","$value":{"fontSize":10,"lineHeight":12,"letterSpacing":0,"fontWeight":500,"fontFamily":"Oxanium"}},"semibold":{"$type":"typography","$value":{"fontSize":10,"lineHeight":12,"letterSpacing":0,"fontWeight":600,"fontFamily":"Oxanium"}}},"xs":{"normal":{"$type":"typography","$value":{"fontSize":12,"lineHeight":14,"letterSpacing":0,"fontWeight":400,"fontFamily":"Oxanium"}},"medium":{"$type":"typography","$value":{"fontSize":12,"lineHeight":14,"letterSpacing":0,"fontWeight":500,"fontFamily":"Oxanium"}},"semibold":{"$type":"typography","$value":{"fontSize":12,"lineHeight":14,"letterSpacing":0,"fontWeight":600,"fontFamily":"Oxanium"}}},"xs2":{"semibold":{"$type":"typography","$value":{"fontSize":13,"lineHeight":18,"letterSpacing":0,"fontWeight":600,"fontFamily":"Oxanium"}},"medium":{"$type":"typography","$value":{"fontSize":13,"lineHeight":18,"letterSpacing":0,"fontWeight":500,"fontFamily":"Oxanium"}},"normal":{"$type":"typography","$value":{"fontSize":13,"lineHeight":18,"letterSpacing":0,"fontWeight":400,"fontFamily":"Oxanium"}}},"sm":{"semibold":{"$type":"typography","$value":{"fontSize":14,"lineHeight":20,"letterSpacing":0,"fontWeight":600,"fontFamily":"Oxanium"}},"medium":{"$type":"typography","$value":{"fontSize":14,"lineHeight":20,"letterSpacing":0,"fontWeight":500,"fontFamily":"Oxanium"}},"normal":{"$type":"typography","$value":{"fontSize":14,"lineHeight":20,"letterSpacing":0,"fontWeight":400,"fontFamily":"Oxanium"}}},"sm2":{"semibold":{"$type":"typography","$value":{"fontSize":15,"lineHeight":22,"letterSpacing":0,"fontWeight":600,"fontFamily":"Oxanium"}},"medium":{"$type":"typography","$value":{"fontSize":15,"lineHeight":22,"letterSpacing":0,"fontWeight":500,"fontFamily":"Oxanium"}},"normal":{"$type":"typography","$value":{"fontSize":15,"lineHeight":22,"letterSpacing":0,"fontWeight":400,"fontFamily":"Oxanium"}}},"md":{"semibold":{"$type":"typography","$value":{"fontSize":16,"lineHeight":24,"letterSpacing":0,"fontWeight":600,"fontFamily":"Oxanium"}},"medium":{"$type":"typography","$value":{"fontSize":16,"lineHeight":24,"letterSpacing":0,"fontWeight":500,"fontFamily":"Oxanium"}},"normal":{"$type":"typography","$value":{"fontSize":16,"lineHeight":24,"letterSpacing":0,"fontWeight":400,"fontFamily":"Oxanium"}}},"lg":{"semibold":{"$type":"typography","$value":{"fontSize":18,"lineHeight":28,"letterSpacing":0,"fontWeight":600,"fontFamily":"Oxanium"}},"medium":{"$type":"typography","$value":{"fontSize":18,"lineHeight":28,"letterSpacing":0,"fontWeight":500,"fontFamily":"Oxanium"}},"normal":{"$type":"typography","$value":{"fontSize":18,"lineHeight":28,"letterSpacing":0,"fontWeight":400,"fontFamily":"Oxanium"}}}}}'),z={text:F},H=({scale:t,weight:i,fontFamilyToken:a})=>[`font-${a??"sans"}`,`text-${t}`,`leading-${t}`,`tracking-${t}`,`font-${i}`].join(" + "),W=t=>{v({text:t}),alert("복사가 완료되었습니다.")},l=Object.entries(z.text??{}),f=()=>{var i;const t=(i=l[0])==null?void 0:i[0];return t?e.jsxs(u,{defaultValue:t,className:"w-full",children:[e.jsx(s,{className:"border-default bg-default text-fg-default supports-[backdrop-filter]:bg-default sticky top-2 z-20 mb-3 rounded-lg border p-1 shadow-sm backdrop-blur",children:l.map(([a])=>e.jsx(c,{value:a,children:a},a))}),l.map(([a,h])=>e.jsx(b,{value:a,children:e.jsx("div",{className:"border-default bg-default text-default space-y-2 rounded-lg border p-4",children:Object.entries(h).flatMap(([o,m])=>Object.entries(m).map(([r,d])=>{var p;const n=`typo-${a}-${o}-${r}`;return e.jsx("button",{type:"button",className:"border-subtle hover:bg-overlay/30 block w-full cursor-copy rounded-md border p-3 text-left transition-colors",onClick:()=>W(n),title:`Copy ${n}`,children:e.jsx("div",{className:"flex items-start justify-between gap-3",children:e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("p",{className:n,children:["Rainbow Robotics UI Typography Test",e.jsx("br",{}),"ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789"]}),e.jsxs("p",{className:"text-subtle mt-1 text-sm",children:[".",n]}),e.jsx("p",{className:"text-subtler mt-1 text-sm",children:H({scale:o,weight:r,fontFamilyToken:(p=d.$value)==null?void 0:p.fontFamilyToken})})]})})},n)}))})},a))]}):null};f.__docgenInfo={description:"",methods:[],displayName:"TextStylePreview"};function y(t){const i={code:"code",h1:"h1",p:"p",pre:"pre",...g(),...t.components};return e.jsxs(e.Fragment,{children:[e.jsx(S,{title:"1.foundations/text-style"}),`
2
- `,e.jsx(i.h1,{id:"text-style",children:"Text Style"}),`
3
- `,e.jsxs(i.p,{children:[e.jsx(i.code,{children:"rb-token.css"}),"의 타이포그래피 유틸리티 전체를 미리보기에서 확인합니다."]}),`
4
- `,e.jsx(i.pre,{children:e.jsx(i.code,{className:"language-tsx",children:`<p className="typo-body-sm-normal text-default">본문</p>
5
- <h3 className="typo-title-03-bold text-default">제목</h3>
6
- `})}),`
7
- `,e.jsx($,{children:e.jsx(f,{})})]})}function D(t={}){const{wrapper:i}={...g(),...t.components};return i?e.jsx(i,{...t,children:e.jsx(y,{...t})}):y(t)}export{D as default};
@@ -1,20 +0,0 @@
1
- import{j as l}from"./jsx-runtime-BTJTZTIL.js";import{useMDXComponents as y}from"./index-B4FGfHer.js";import{b as g,U as b}from"./index-CgJh_5EZ.js";import{d as p,e as n,f as c,g as t}from"./react-resizable-panels.browser-CHDWt8fa.js";import"./index-Dmy2JGbm.js";import"./RainbowUiProvider-CsMXuxM1.js";import{c as f}from"./browserUtils-CxJ5gea3.js";import"./index-ChsGqxH_.js";import"./iframe-BwCxSq5d.js";import"./index-CT3U1fyk.js";import"./index-BRq5TIsn.js";import"./index-DgH-xKnr.js";import"./index-DrFu-skq.js";const k={"scale color":{red:{500:{$type:"color",$value:"#fb2c36"},600:{$type:"color",$value:"#e7000b"},"alpha-50p":{$type:"color",$value:"#fb2c3680"},"alpha-30p":{$type:"color",$value:"#fb2c364d"},"alpha-10p":{$type:"color",$value:"#fb2c361a"},"alpha-20p":{$type:"color",$value:"#fb2c3633"}},orange:{500:{$type:"color",$value:"#ff6900"},600:{$type:"color",$value:"#f54a00"},"alpha-50p":{$type:"color",$value:"#ff690080"},"alpha-30p":{$type:"color",$value:"#ff69004d"},"alpha-10p":{$type:"color",$value:"#ff69001a"},"alpha-20p":{$type:"color",$value:"#ff690033"}},green:{500:{$type:"color",$value:"#00c951"},600:{$type:"color",$value:"#00a63e"},"alpha-50p":{$type:"color",$value:"#00c95180"},"alpha-30p":{$type:"color",$value:"#00c9514d"},"alpha-10p":{$type:"color",$value:"#00c9511a"},"alpha-20p":{$type:"color",$value:"#00c95133"}},blue:{500:{$type:"color",$value:"#2b7fff"},600:{$type:"color",$value:"#155dfc"},"alpha-50p":{$type:"color",$value:"#2b7fff80"},"alpha-30p":{$type:"color",$value:"#2b7fff4d"},"alpha-10p":{$type:"color",$value:"#2b7fff1a"},"alpha-20p":{$type:"color",$value:"#2b7fff33"}},"zinc-950-alpha":{5:{$type:"color",$value:"#09090b0d"},10:{$type:"color",$value:"#09090b1a"},15:{$type:"color",$value:"#09090b26"},20:{$type:"color",$value:"#09090b33"},25:{$type:"color",$value:"#09090b40"},30:{$type:"color",$value:"#09090b4d"},40:{$type:"color",$value:"#09090b66"},50:{$type:"color",$value:"#09090b80"},60:{$type:"color",$value:"#09090b99"},70:{$type:"color",$value:"#09090bb3"},75:{$type:"color",$value:"#09090bbf"},80:{$type:"color",$value:"#09090bcc"},85:{$type:"color",$value:"#09090bd9"},90:{$type:"color",$value:"#09090be6"},95:{$type:"color",$value:"#09090bf2"}},"zinc-50-alpha":{5:{$type:"color",$value:"#fafafa0d"},10:{$type:"color",$value:"#fafafa1a"},15:{$type:"color",$value:"#fafafa26"},20:{$type:"color",$value:"#fafafa33"},25:{$type:"color",$value:"#fafafa40"},30:{$type:"color",$value:"#fafafa4d"},40:{$type:"color",$value:"#fafafa66"},50:{$type:"color",$value:"#fafafa80"},60:{$type:"color",$value:"#fafafa99"},70:{$type:"color",$value:"#fafafab3"},75:{$type:"color",$value:"#fafafabf"},80:{$type:"color",$value:"#fafafacc"},85:{$type:"color",$value:"#fafafad9"},90:{$type:"color",$value:"#fafafae6"},95:{$type:"color",$value:"#fafafaf2"}},zinc:{50:{$type:"color",$value:"#fafafa"},100:{$type:"color",$value:"#f4f4f5"},200:{$type:"color",$value:"#e4e4e7"},300:{$type:"color",$value:"#d4d4d8"},400:{$type:"color",$value:"#9f9fa9"},500:{$type:"color",$value:"#71717b"},600:{$type:"color",$value:"#52525c"},700:{$type:"color",$value:"#3f3f46"},800:{$type:"color",$value:"#232326"},900:{$type:"color",$value:"#18181b"},950:{$type:"color",$value:"#09090b"}},base:{black:{$type:"color",$value:"#000000"},transparent:{$type:"color",$value:"#ffffff00"},white:{$type:"color",$value:"#ffffff"}},yellow:{400:{$type:"color",$value:"#fcc800"},500:{$type:"color",$value:"#efb100"},"alpha-50p":{$type:"color",$value:"#fcc80080"},"alpha-30p":{$type:"color",$value:"#fcc8004d"},"alpha-10p":{$type:"color",$value:"#fcc8001a"},"alpha-20p":{$type:"color",$value:"#fcc80033"}},primary:{"alpha-10p":{$type:"color",$value:"#155dfc1a"},"alpha-30p":{$type:"color",$value:"#155dfc4d"},stronger:{$type:"color",$value:"#003baf"},strong:{$type:"color",$value:"#154dd0"},"alpha-50p":{$type:"color",$value:"#155dfc80"},normal:{$type:"color",$value:"#155dfc"}},custom:{"gray-100":{$type:"color",$value:"#18181a"},"gray-200":{$type:"color",$value:"#1f1f22"},"gray-300":{$type:"color",$value:"#2a2a2d"}},violet:{500:{$type:"color",$value:"#8e51ff"},600:{$type:"color",$value:"#7f22fe"},"alpha-50p":{$type:"color",$value:"#8e51ff80"},"alpha-30p":{$type:"color",$value:"#8e51ff4d"},"alpha-20p":{$type:"color",$value:"#8e51ff33"},"alpha-10p":{$type:"color",$value:"#8e51ff1a"}},rainbow:{normal:{$type:"color",$value:"#e6331b"},strong:{$type:"color",$value:"#cf2d18"},stronger:{$type:"color",$value:"#b82815"},"alpha-50p":{$type:"color",$value:"#e6331b80"},"alpha-30p":{$type:"color",$value:"#e6331b4d"},"alpha-10p":{$type:"color",$value:"#e6331b1a"}},"icon-primary":{$type:"color",$value:"#5c9cff"},navy:{normal:{$type:"color",$value:"#0b558c"},strong:{$type:"color",$value:"#094a7a"},stronger:{$type:"color",$value:"#073e67"},"alpha-50p":{$type:"color",$value:"#0b558c80"},"alpha-30p":{$type:"color",$value:"#082a6c4d"},"alpha-10p":{$type:"color",$value:"#082a6c1a"},"alpha-20p":{$type:"color",$value:"#0b558c33"},"alpha-15p":{$type:"color",$value:"#0b558c26"}}}},L={"semantic color":JSON.parse('{"fg":{"default":{"$type":"color","$value":{"Dark":"{color.scale.zinc.50}","Light":"{color.scale.zinc.950}"}},"danger-subtle":{"$type":"color","$value":{"Dark":"{color.scale.red.alpha-30p}","Light":"{color.scale.red.alpha-50p}"}},"danger":{"$type":"color","$value":{"Dark":"{color.scale.red.500}","Light":"{color.scale.red.500}"}},"warning-subtle":{"$type":"color","$value":{"Dark":"{color.scale.orange.alpha-50p}","Light":"{color.scale.orange.alpha-50p}"}},"warning":{"$type":"color","$value":{"Dark":"{color.scale.orange.500}","Light":"{color.scale.orange.500}"}},"success-subtle":{"$type":"color","$value":{"Dark":"{color.scale.green.alpha-50p}","Light":"{color.scale.green.alpha-50p}"}},"success":{"$type":"color","$value":{"Dark":"{color.scale.green.500}","Light":"{color.scale.green.600}"}},"information-subtle":{"$type":"color","$value":{"Dark":"{color.scale.blue.alpha-50p}","Light":"{color.scale.blue.alpha-50p}"}},"information":{"$type":"color","$value":{"Dark":"{color.scale.blue.500}","Light":"{color.scale.blue.500}"}},"disabled":{"$type":"color","$value":{"Dark":"{color.scale.zinc-50-alpha.20}","Light":"{color.scale.zinc-950-alpha.25}"}},"inverse":{"$type":"color","$value":{"Dark":"{color.scale.zinc.950}","Light":"{color.scale.zinc.50}"}},"subtlest":{"$type":"color","$value":{"Dark":"{color.scale.zinc-50-alpha.30}","Light":"{color.scale.zinc-950-alpha.40}"}},"subtle":{"$type":"color","$value":{"Dark":"{color.scale.zinc-50-alpha.60}","Light":"{color.scale.zinc-950-alpha.70}"}},"subtler":{"$type":"color","$value":{"Dark":"{color.scale.zinc-50-alpha.40}","Light":"{color.scale.zinc-950-alpha.60}"}},"inverse-disabled":{"$type":"color","$value":{"Dark":"{color.scale.zinc-950-alpha.15}","Light":"{color.scale.zinc-50-alpha.20}"}},"brand":{"$type":"color","$value":{"Dark":"{color.scale.primary.normal}","Light":"{color.scale.primary.normal}"}},"brand-subtle":{"$type":"color","$value":{"Dark":"{color.scale.primary.alpha-50p}","Light":"{color.scale.primary.alpha-50p}"}},"default-hovered":{"$type":"color","$value":{"Dark":"{color.scale.zinc-50-alpha.80}","Light":"{color.scale.zinc-950-alpha.80}"}},"brand-hovered":{"$type":"color","$value":{"Dark":"{color.scale.primary.strong}","Light":"{color.scale.primary.strong}"}},"caution":{"$type":"color","$value":{"Dark":"{color.scale.yellow.400}","Light":"{color.scale.yellow.400}"}},"caution-subtle":{"$type":"color","$value":{"Dark":"{color.scale.yellow.alpha-50p}","Light":"{color.scale.yellow.alpha-50p}"}},"static-white":{"$type":"color","$value":{"Dark":"{color.scale.base.white}","Light":"{color.scale.base.white}"}},"static-white-subtle":{"$type":"color","$value":{"Dark":"{color.scale.zinc.500}","Light":"{color.scale.zinc.500}"}},"debug":{"$type":"color","$value":{"Dark":"{color.scale.violet.500}","Light":"{color.scale.violet.500}"}},"debug-subtle":{"$type":"color","$value":{"Dark":"{color.scale.violet.alpha-50p}","Light":"{color.scale.violet.alpha-50p}"}},"rb":{"$type":"color","$value":{"Dark":"{color.scale.rainbow.normal}","Light":"{color.scale.rainbow.normal}"}},"rb-subtle":{"$type":"color","$value":{"Dark":"{color.scale.rainbow.alpha-50p}","Light":"{color.scale.rainbow.alpha-50p}"}},"navy":{"$type":"color","$value":{"Dark":"{color.scale.navy.normal}","Light":"{color.scale.navy.normal}"}},"navy-subtle":{"$type":"color","$value":{"Dark":"{color.scale.navy.alpha-50p}","Light":"{color.scale.navy.alpha-50p}"}},"navy-hovered":{"$type":"color","$value":{"Dark":"{color.scale.navy.strong}","Light":"{color.scale.navy.strong}"}}},"border":{"default":{"$type":"color","$value":{"Dark":"{color.scale.zinc-50-alpha.30}","Light":"{color.scale.zinc-950-alpha.20}"}},"danger-stronger":{"$type":"color","$value":{"Dark":"{color.scale.red.500}","Light":"{color.scale.red.500}"}},"warning-stronger":{"$type":"color","$value":{"Dark":"{color.scale.orange.500}","Light":"{color.scale.orange.500}"}},"success-stronger":{"$type":"color","$value":{"Dark":"{color.scale.green.500}","Light":"{color.scale.green.500}"}},"information-stronger":{"$type":"color","$value":{"Dark":"{color.scale.blue.500}","Light":"{color.scale.blue.500}"}},"disabled":{"$type":"color","$value":{"Dark":"{color.scale.zinc-50-alpha.5}","Light":"{color.scale.zinc-950-alpha.5}"}},"inverse-stronger":{"$type":"color","$value":{"Dark":"{color.scale.zinc-950-alpha.90}","Light":"{color.scale.zinc-50-alpha.90}"}},"stronger":{"$type":"color","$value":{"Dark":"{color.scale.zinc-50-alpha.90}","Light":"{color.scale.zinc-950-alpha.90}"}},"inverse":{"$type":"color","$value":{"Dark":"{color.scale.zinc-950-alpha.20}","Light":"{color.scale.zinc-50-alpha.30}"}},"danger":{"$type":"color","$value":{"Dark":"{color.scale.red.alpha-50p}","Light":"{color.scale.red.alpha-50p}"}},"warning":{"$type":"color","$value":{"Dark":"{color.scale.orange.alpha-50p}","Light":"{color.scale.orange.alpha-50p}"}},"information":{"$type":"color","$value":{"Dark":"{color.scale.blue.alpha-50p}","Light":"{color.scale.blue.alpha-50p}"}},"success":{"$type":"color","$value":{"Dark":"{color.scale.green.alpha-50p}","Light":"{color.scale.green.alpha-50p}"}},"subtle":{"$type":"color","$value":{"Dark":"{color.scale.zinc-50-alpha.15}","Light":"{color.scale.zinc-950-alpha.15}"}},"input-focused":{"$type":"color","$value":{"Dark":"{color.scale.zinc-50-alpha.90}","Light":"{color.scale.zinc-950-alpha.90}"}},"inverse-disabled":{"$type":"color","$value":{"Dark":"{color.scale.zinc-950-alpha.10}","Light":"{color.scale.zinc-50-alpha.10}"}},"brand-stronger":{"$type":"color","$value":{"Dark":"{color.scale.primary.normal}","Light":"{color.scale.primary.normal}"}},"brand":{"$type":"color","$value":{"Dark":"{color.scale.primary.alpha-50p}","Light":"{color.scale.primary.alpha-50p}"}},"caution-stronger":{"$type":"color","$value":{"Dark":"{color.scale.yellow.400}","Light":"{color.scale.yellow.400}"}},"caution":{"$type":"color","$value":{"Dark":"{color.scale.yellow.alpha-50p}","Light":"{color.scale.yellow.alpha-50p}"}},"debug-stronger":{"$type":"color","$value":{"Dark":"{color.scale.violet.500}","Light":"{color.scale.violet.500}"}},"debug":{"$type":"color","$value":{"Dark":"{color.scale.violet.alpha-50p}","Light":"{color.scale.violet.alpha-50p}"}},"subtler":{"$type":"color","$value":{"Dark":"{color.scale.zinc-50-alpha.10}","Light":"{color.scale.zinc-950-alpha.10}"}},"rb-stronger":{"$type":"color","$value":{"Dark":"{color.scale.rainbow.normal}","Light":"{color.scale.rainbow.normal}"}},"rb":{"$type":"color","$value":{"Dark":"{color.scale.rainbow.alpha-50p}","Light":"{color.scale.rainbow.alpha-50p}"}},"navy-stronger":{"$type":"color","$value":{"Dark":"{color.scale.navy.normal}","Light":"{color.scale.navy.normal}"}},"navy":{"$type":"color","$value":{"Dark":"{color.scale.navy.alpha-50p}","Light":"{color.scale.navy.alpha-50p}"}}},"fill":{"danger-subtle":{"$type":"color","$value":{"Dark":"{color.scale.red.alpha-30p}","Light":"{color.scale.red.alpha-30p}"}},"danger":{"$type":"color","$value":{"Dark":"{color.scale.red.500}","Light":"{color.scale.red.500}"}},"warning-subtle":{"$type":"color","$value":{"Dark":"{color.scale.orange.alpha-30p}","Light":"{color.scale.orange.alpha-30p}"}},"warning":{"$type":"color","$value":{"Dark":"{color.scale.orange.500}","Light":"{color.scale.orange.500}"}},"success-subtle":{"$type":"color","$value":{"Dark":"{color.scale.green.alpha-30p}","Light":"{color.scale.green.alpha-30p}"}},"success":{"$type":"color","$value":{"Dark":"{color.scale.green.500}","Light":"{color.scale.green.500}"}},"information-subtle":{"$type":"color","$value":{"Dark":"{color.scale.blue.alpha-30p}","Light":"{color.scale.blue.alpha-30p}"}},"information":{"$type":"color","$value":{"Dark":"{color.scale.blue.500}","Light":"{color.scale.blue.500}"}},"disabled":{"$type":"color","$value":{"Dark":"{color.scale.zinc-50-alpha.5}","Light":"{color.scale.zinc-950-alpha.5}"}},"control surface":{"$type":"color","$value":{"Dark":"{color.scale.zinc-950-alpha.50}","Light":"{color.scale.zinc.50}"}},"inverse":{"$type":"color","$value":{"Dark":"{color.scale.zinc.900}","Light":"{color.scale.zinc.100}"}},"inverse-hovered":{"$type":"color","$value":{"Dark":"{color.scale.zinc.700}","Light":"{color.scale.zinc.300}"}},"subtle":{"$type":"color","$value":{"Dark":"{color.scale.zinc-50-alpha.40}","Light":"{color.scale.zinc-950-alpha.40}"}},"subtle-hovered":{"$type":"color","$value":{"Dark":"{color.scale.zinc-50-alpha.30}","Light":"{color.scale.zinc-950-alpha.30}"}},"transparent":{"$type":"color","$value":{"Dark":"{color.scale.base.transparent}","Light":"{color.scale.base.transparent}"}},"transparent-hovered":{"$type":"color","$value":{"Dark":"{color.scale.zinc-50-alpha.5}","Light":"{color.scale.zinc-950-alpha.5}"}},"default":{"$type":"color","$value":{"Dark":"{color.scale.zinc.100}","Light":"{color.scale.zinc.900}"}},"default-hovered":{"$type":"color","$value":{"Dark":"{color.scale.zinc.300}","Light":"{color.scale.zinc.700}"}},"inverse-subtle":{"$type":"color","$value":{"Dark":"{color.scale.zinc-950-alpha.40}","Light":"{color.scale.zinc-50-alpha.40}"}},"inverse-subtle-hovered":{"$type":"color","$value":{"Dark":"{color.scale.zinc-950-alpha.30}","Light":"{color.scale.zinc-50-alpha.30}"}},"inverse-disabled":{"$type":"color","$value":{"Dark":"{color.scale.zinc-950-alpha.10}","Light":"{color.scale.zinc-50-alpha.10}"}},"brand":{"$type":"color","$value":{"Dark":"{color.scale.primary.normal}","Light":"{color.scale.primary.normal}"}},"brand-subtle":{"$type":"color","$value":{"Dark":"{color.scale.primary.alpha-50p}","Light":"{color.scale.primary.alpha-50p}"}},"subtler":{"$type":"color","$value":{"Dark":"{color.scale.zinc-50-alpha.20}","Light":"{color.scale.zinc-950-alpha.20}"}},"subtler-hovered":{"$type":"color","$value":{"Dark":"{color.scale.zinc-50-alpha.15}","Light":"{color.scale.zinc-950-alpha.15}"}},"brand-hovered":{"$type":"color","$value":{"Dark":"{color.scale.primary.strong}","Light":"{color.scale.primary.strong}"}},"control surface-hovered":{"$type":"color","$value":{"Dark":"{color.scale.zinc-950-alpha.30}","Light":"{color.scale.zinc.100}"}},"caution-subtle":{"$type":"color","$value":{"Dark":"{color.scale.yellow.alpha-30p}","Light":"{color.scale.yellow.alpha-30p}"}},"caution":{"$type":"color","$value":{"Dark":"{color.scale.yellow.400}","Light":"{color.scale.yellow.400}"}},"danger-subtler":{"$type":"color","$value":{"Dark":"{color.scale.red.alpha-20p}","Light":"{color.scale.red.alpha-20p}"}},"warning-subtler":{"$type":"color","$value":{"Dark":"{color.scale.orange.alpha-20p}","Light":"{color.scale.orange.alpha-20p}"}},"caution-subtler":{"$type":"color","$value":{"Dark":"{color.scale.yellow.alpha-20p}","Light":"{color.scale.yellow.alpha-20p}"}},"success-subtler":{"$type":"color","$value":{"Dark":"{color.scale.green.alpha-20p}","Light":"{color.scale.green.alpha-20p}"}},"information-subtler":{"$type":"color","$value":{"Dark":"{color.scale.blue.alpha-20p}","Light":"{color.scale.blue.alpha-20p}"}},"subtlest":{"$type":"color","$value":{"Dark":"{color.scale.zinc-50-alpha.10}","Light":"{color.scale.zinc-950-alpha.10}"}},"subtlest-hovered":{"$type":"color","$value":{"Dark":"{color.scale.zinc-50-alpha.5}","Light":"{color.scale.zinc-950-alpha.5}"}},"warning-subtlest":{"$type":"color","$value":{"Dark":"{color.scale.orange.alpha-10p}","Light":"{color.scale.orange.alpha-10p}"}},"caution-subtlest":{"$type":"color","$value":{"Dark":"{color.scale.yellow.alpha-10p}","Light":"{color.scale.yellow.alpha-10p}"}},"information-subtlest":{"$type":"color","$value":{"Dark":"{color.scale.blue.alpha-10p}","Light":"{color.scale.blue.alpha-10p}"}},"success-subtlest":{"$type":"color","$value":{"Dark":"{color.scale.green.alpha-10p}","Light":"{color.scale.green.alpha-10p}"}},"danger-subtlest":{"$type":"color","$value":{"Dark":"{color.scale.red.alpha-10p}","Light":"{color.scale.red.alpha-10p}"}},"danger-hovered":{"$type":"color","$value":{"Dark":"{color.scale.red.600}","Light":"{color.scale.red.600}"}},"warning-hovered":{"$type":"color","$value":{"Dark":"{color.scale.orange.600}","Light":"{color.scale.orange.600}"}},"caution-hovered":{"$type":"color","$value":{"Dark":"{color.scale.yellow.500}","Light":"{color.scale.yellow.500}"}},"information-hovered":{"$type":"color","$value":{"Dark":"{color.scale.blue.600}","Light":"{color.scale.blue.600}"}},"success-hovered":{"$type":"color","$value":{"Dark":"{color.scale.green.600}","Light":"{color.scale.green.600}"}},"debug":{"$type":"color","$value":{"Dark":"{color.scale.violet.500}","Light":"{color.scale.violet.500}"}},"debug-hovered":{"$type":"color","$value":{"Dark":"{color.scale.violet.600}","Light":"{color.scale.violet.600}"}},"debug-subtle":{"$type":"color","$value":{"Dark":"{color.scale.violet.alpha-30p}","Light":"{color.scale.violet.alpha-30p}"}},"debug-subtler":{"$type":"color","$value":{"Dark":"{color.scale.violet.alpha-20p}","Light":"{color.scale.violet.alpha-20p}"}},"debug-subtlest":{"$type":"color","$value":{"Dark":"{color.scale.violet.alpha-10p}","Light":"{color.scale.violet.alpha-10p}"}},"control surface-disabled":{"$type":"color","$value":{"Dark":"{color.scale.zinc-950-alpha.25}","Light":"{color.scale.zinc.50}"}},"brand-subtler":{"$type":"color","$value":{"Dark":"{color.scale.primary.alpha-30p}","Light":"{color.scale.primary.alpha-30p}"}},"rb":{"$type":"color","$value":{"Dark":"{color.scale.rainbow.normal}","Light":"{color.scale.rainbow.normal}"}},"rb-hovered":{"$type":"color","$value":{"Dark":"{color.scale.rainbow.strong}","Light":"{color.scale.rainbow.strong}"}},"rb-subtle":{"$type":"color","$value":{"Dark":"{color.scale.rainbow.alpha-50p}","Light":"{color.scale.rainbow.alpha-50p}"}},"rb-subtler":{"$type":"color","$value":{"Dark":"{color.scale.rainbow.alpha-30p}","Light":"{color.scale.rainbow.alpha-30p}"}},"rb-subtlest":{"$type":"color","$value":{"Dark":"{color.scale.rainbow.alpha-10p}","Light":"{color.scale.rainbow.alpha-10p}"}},"icon-program":{"$type":"color","$value":{"Dark":"{color.scale.icon-primary}","Light":"{color.scale.icon-primary}"}},"brand-subtlest":{"$type":"color","$value":{"Dark":"{color.scale.primary.alpha-10p}","Light":"{color.scale.primary.alpha-10p}"}},"navy":{"$type":"color","$value":{"Dark":"{color.scale.navy.normal}","Light":"{color.scale.navy.normal}"}},"navy-hovered":{"$type":"color","$value":{"Dark":"{color.scale.navy.strong}","Light":"{color.scale.navy.strong}"}},"navy-subtle":{"$type":"color","$value":{"Dark":"{color.scale.navy.alpha-50p}","Light":"{color.scale.navy.alpha-50p}"}},"navy-subtler":{"$type":"color","$value":{"Dark":"{color.scale.navy.alpha-20p}","Light":"{color.scale.navy.alpha-20p}"}},"navy-subtlest":{"$type":"color","$value":{"Dark":"{color.scale.navy.alpha-15p}","Light":"{color.scale.navy.alpha-15p}"}}},"bg":{"dim":{"$type":"color","$value":{"Dark":"{color.scale.zinc-950-alpha.80}","Light":"{color.scale.zinc-950-alpha.50}"}},"default":{"$type":"color","$value":{"Dark":"{color.scale.zinc.950}","Light":"{color.scale.zinc.50}"}},"overlay":{"$type":"color","$value":{"Dark":"{color.scale.zinc.700}","Light":"{color.scale.zinc.100}"}},"inverse":{"$type":"color","$value":{"Dark":"{color.scale.base.white}","Light":"{color.scale.zinc.950}"}},"raised":{"$type":"color","$value":{"Dark":"{color.scale.custom.gray-300}","Light":"{color.scale.zinc.100}"}},"card":{"$type":"color","$value":{"Dark":"{color.scale.zinc-50-alpha.10}","Light":"{color.scale.base.white}"}},"alt-1":{"$type":"color","$value":{"Dark":"{color.scale.zinc.900}","Light":"{color.scale.zinc.200}"}},"alt-2":{"$type":"color","$value":{"Dark":"{color.scale.zinc.800}","Light":"{color.scale.zinc.300}"}},"translucent":{"$type":"color","$value":{"Dark":"{color.scale.zinc-950-alpha.60}","Light":"{color.scale.zinc-50-alpha.50}"}},"overlay-high":{"$type":"color","$value":{"Dark":"{color.scale.zinc.600}","Light":"{color.scale.zinc.200}"}},"tooltip":{"$type":"color","$value":{"Dark":"{color.scale.zinc.50}","Light":"{color.scale.zinc.900}"}}}}')},m=e=>{f({text:e}),alert("복사가 완료되었습니다.")},D=e=>typeof e=="object"&&e!==null&&"$value"in e,h=(e,a=[])=>{if(D(e))return[a.join("-")];const o=[];return Object.entries(e).forEach(([r,s])=>{r.startsWith("$")||o.push(...h(s,[...a,r]))}),o},z=()=>{const e=k["scale color"];return Object.entries(e).map(([a,o])=>{const r=h(o,[a]);return{title:a,tokens:r.map(s=>`bg-scale-${s}`)}})},x=()=>{const e=L["semantic color"];return Object.entries(e).map(([a,o])=>{const r=h(o,[a]);return{title:a,tokens:r}})},i=z(),$=x(),j={backgroundColor:"#f1f1f4",backgroundImage:"linear-gradient(45deg, #bfbfc7 25%, transparent 25%), linear-gradient(-45deg, #bfbfc7 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #bfbfc7 75%), linear-gradient(-45deg, transparent 75%, #bfbfc7 75%)",backgroundSize:"10px 10px",backgroundPosition:"0 0, 0 5px, 5px -5px, -5px 0px"},w=e=>e.includes("alpha")||e.includes("transparent"),C=e=>e.startsWith("bg-scale-")?`--color-scale-${e.replace(/^bg-scale-/,"")}`:`--color-${e}`,N=({utility:e})=>{const a=C(e),o=w(e);return l.jsxs("button",{type:"button",className:"border-default bg-default cursor-copy rounded-md border p-2 text-left",onClick:()=>m(e),title:`Copy ${e}`,children:[l.jsx("div",{className:"border-subtle relative h-10 overflow-hidden rounded border",style:o?j:void 0,children:l.jsx("div",{className:"absolute inset-0",style:{backgroundColor:`var(${a})`}})}),l.jsx("p",{className:"text-subtle mt-2 text-sm break-all",children:e}),l.jsx("p",{className:"text-subtler mt-1 text-sm break-all",children:a})]})},u=({title:e,tokens:a})=>l.jsxs("section",{className:"border-default bg-default text-default space-y-2 rounded-lg border p-4",children:[l.jsx("h4",{className:"text-base font-semibold capitalize",children:e}),l.jsx("div",{className:"grid gap-2 sm:grid-cols-2 xl:grid-cols-3",children:a.map(o=>l.jsx(N,{utility:o},o))})]}),d=()=>{var e,a;return l.jsxs(p,{defaultValue:"scale",className:"w-full",children:[l.jsxs(n,{className:"border-default bg-default text-default supports-[backdrop-filter]:bg-default sticky top-2 z-20 mb-3 rounded-lg border p-1 shadow-sm backdrop-blur",children:[l.jsx(c,{value:"scale",children:"Scale"}),l.jsx(c,{value:"semantic",children:"Semantic"})]}),l.jsx(t,{value:"scale",className:"text-default",children:l.jsxs(p,{defaultValue:((e=i[0])==null?void 0:e.title)||"",className:"w-full",children:[l.jsx(n,{className:"border-default bg-default text-default supports-[backdrop-filter]:bg-default sticky top-14 z-10 mb-3 rounded-lg border p-1 shadow-sm backdrop-blur",children:i.map(o=>l.jsx(c,{value:o.title,children:o.title},o.title))}),i.map(o=>l.jsx(t,{value:o.title,className:"text-default",children:l.jsx(u,{title:o.title,tokens:o.tokens})},o.title))]})}),l.jsx(t,{value:"semantic",className:"text-default",children:l.jsxs(p,{defaultValue:((a=$[0])==null?void 0:a.title)||"",className:"w-full",children:[l.jsx(n,{className:"border-default bg-default text-default supports-[backdrop-filter]:bg-default sticky top-14 z-10 mb-3 rounded-lg border p-1 shadow-sm backdrop-blur",children:$.map(o=>l.jsx(c,{value:o.title,children:o.title},o.title))}),$.map(o=>l.jsx(t,{value:o.title,className:"text-default",children:l.jsx(u,{title:o.title,tokens:o.tokens})},o.title))]})})]})};d.__docgenInfo={description:"",methods:[],displayName:"ColorPreview"};function v(e){const a={code:"code",h1:"h1",h3:"h3",li:"li",p:"p",pre:"pre",ul:"ul",...y(),...e.components};return l.jsxs(l.Fragment,{children:[l.jsx(g,{title:"1.foundations/color"}),`
2
- `,l.jsx(a.h1,{id:"color",children:"Color"}),`
3
- `,l.jsxs(a.p,{children:[l.jsx(a.code,{children:"rb-token.css"}),"에 정의된 색상 토큰 전체를 미리보기에서 확인합니다."]}),`
4
- `,l.jsx(a.pre,{children:l.jsx(a.code,{className:"language-tsx",children:`<div className="bg-default text-default border border-default" />
5
- <div className="bg-fill-brand text-inverse" />
6
- <div className="text-danger" />
7
- `})}),`
8
- `,l.jsx(a.h3,{id:"구성",children:"구성"}),`
9
- `,l.jsxs(a.ul,{children:[`
10
- `,l.jsxs(a.li,{children:[l.jsx(a.code,{children:"Scale"}),": 원본 팔레트 토큰"]}),`
11
- `,l.jsxs(a.li,{children:[l.jsx(a.code,{children:"Semantic"}),": 역할 기반 토큰"]}),`
12
- `]}),`
13
- `,l.jsx(a.h3,{id:"분류",children:"분류"}),`
14
- `,l.jsxs(a.ul,{children:[`
15
- `,l.jsxs(a.li,{children:[l.jsx(a.code,{children:"Scale"}),": ",l.jsx(a.code,{children:"red"}),", ",l.jsx(a.code,{children:"orange"}),", ",l.jsx(a.code,{children:"green"}),", ",l.jsx(a.code,{children:"blue"}),", ",l.jsx(a.code,{children:"zinc"}),", ",l.jsx(a.code,{children:"zinc-950"}),", ",l.jsx(a.code,{children:"zinc-50"}),", ",l.jsx(a.code,{children:"black"}),", ",l.jsx(a.code,{children:"white"}),", ",l.jsx(a.code,{children:"primary"}),", ",l.jsx(a.code,{children:"yellow"})]}),`
16
- `,l.jsxs(a.li,{children:[l.jsx(a.code,{children:"Semantic"}),": ",l.jsx(a.code,{children:"foreground"}),", ",l.jsx(a.code,{children:"border"}),", ",l.jsx(a.code,{children:"fill"}),", ",l.jsx(a.code,{children:"background"}),", ",l.jsx(a.code,{children:"accent"})]}),`
17
- `]}),`
18
- `,l.jsx(a.p,{children:"투명/alpha 계열 토큰은 체커보드 배경 위에 표시됩니다."}),`
19
- `,l.jsx("br",{}),`
20
- `,l.jsx(b,{children:l.jsx(d,{})})]})}function U(e={}){const{wrapper:a}={...y(),...e.components};return a?l.jsx(a,{...e,children:l.jsx(v,{...e})}):v(e)}export{U as default};