@growgroup/visual-editor 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (219) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE +52 -0
  3. package/README.md +143 -0
  4. package/dist/editor.css +2 -0
  5. package/package.json +94 -0
  6. package/src/components/DeckSlideRender.tsx +21 -0
  7. package/src/components/SaveNote.tsx +21 -0
  8. package/src/components/auth/AuthProvider.tsx +44 -0
  9. package/src/components/ui/accordion.tsx +57 -0
  10. package/src/components/ui/alert-dialog.tsx +141 -0
  11. package/src/components/ui/badge.tsx +36 -0
  12. package/src/components/ui/button.tsx +56 -0
  13. package/src/components/ui/card.tsx +76 -0
  14. package/src/components/ui/checkbox.tsx +30 -0
  15. package/src/components/ui/collapsible.tsx +11 -0
  16. package/src/components/ui/context-menu.tsx +200 -0
  17. package/src/components/ui/dialog.tsx +122 -0
  18. package/src/components/ui/dropdown-menu.tsx +201 -0
  19. package/src/components/ui/input.tsx +22 -0
  20. package/src/components/ui/label.tsx +26 -0
  21. package/src/components/ui/popover.tsx +33 -0
  22. package/src/components/ui/scroll-area.tsx +48 -0
  23. package/src/components/ui/scrubbable-label.tsx +95 -0
  24. package/src/components/ui/select.tsx +159 -0
  25. package/src/components/ui/separator.tsx +31 -0
  26. package/src/components/ui/slider.tsx +28 -0
  27. package/src/components/ui/switch.tsx +29 -0
  28. package/src/components/ui/tabs.tsx +55 -0
  29. package/src/components/ui/textarea.tsx +22 -0
  30. package/src/components/ui/tooltip.tsx +32 -0
  31. package/src/components/viewer/useDeck.ts +58 -0
  32. package/src/editor/EditorContext.tsx +632 -0
  33. package/src/editor/EditorToolbar.tsx +446 -0
  34. package/src/editor/FrontendVisualEditor.tsx +2595 -0
  35. package/src/editor/autosave.ts +34 -0
  36. package/src/editor/components/AiPromptPopover.tsx +378 -0
  37. package/src/editor/components/BreakpointGuides.tsx +323 -0
  38. package/src/editor/components/BreakpointSelector.tsx +180 -0
  39. package/src/editor/components/ComponentPropertyEditor.tsx +426 -0
  40. package/src/editor/components/CssEditorDialog.tsx +168 -0
  41. package/src/editor/components/EditorCanvas.tsx +987 -0
  42. package/src/editor/components/EditorContextMenu.tsx +515 -0
  43. package/src/editor/components/EditorFooter.tsx +81 -0
  44. package/src/editor/components/EditorHeader.tsx +524 -0
  45. package/src/editor/components/EditorLayerPanel.tsx +1197 -0
  46. package/src/editor/components/EditorPropertyPanel.tsx +2996 -0
  47. package/src/editor/components/EditorSidebar.tsx +226 -0
  48. package/src/editor/components/FigmaColorPicker.tsx +1577 -0
  49. package/src/editor/components/HtmlEditorDialog.tsx +71 -0
  50. package/src/editor/components/HtmlImportDialog.tsx +346 -0
  51. package/src/editor/components/JsEditorDialog.tsx +175 -0
  52. package/src/editor/components/LayerTreeItem.tsx +494 -0
  53. package/src/editor/components/MasterComponentEditor.tsx +846 -0
  54. package/src/editor/components/MediaLibraryDialog.tsx +447 -0
  55. package/src/editor/components/PageSettingsDialog.tsx +776 -0
  56. package/src/editor/components/VariablePicker.tsx +355 -0
  57. package/src/editor/components/VariablesDialog.tsx +564 -0
  58. package/src/editor/components/VariantEditor.tsx +687 -0
  59. package/src/editor/components/VariantMatrix.tsx +507 -0
  60. package/src/editor/components/component-panel/CategoryAccordion.tsx +139 -0
  61. package/src/editor/components/component-panel/ComponentGrid.tsx +51 -0
  62. package/src/editor/components/component-panel/ComponentItem.tsx +368 -0
  63. package/src/editor/components/component-panel/ComponentPanel.tsx +275 -0
  64. package/src/editor/components/component-panel/ComponentSearch.tsx +82 -0
  65. package/src/editor/components/component-panel/VariantList.tsx +260 -0
  66. package/src/editor/components/component-panel/index.ts +12 -0
  67. package/src/editor/components/index.ts +48 -0
  68. package/src/editor/components/multi-page/CanvasZoomControls.tsx +71 -0
  69. package/src/editor/components/multi-page/InfiniteCanvas.tsx +95 -0
  70. package/src/editor/components/multi-page/MultiPageCanvasView.tsx +1404 -0
  71. package/src/editor/components/multi-page/PageFrameOverlay.tsx +76 -0
  72. package/src/editor/components/multi-page/PageLabel.tsx +34 -0
  73. package/src/editor/components/multi-page/PageLivePreview.tsx +242 -0
  74. package/src/editor/components/multi-page/PageThumbnail.tsx +59 -0
  75. package/src/editor/components/multi-page/index.ts +7 -0
  76. package/src/editor/components/ppt/PptChrome.tsx +2508 -0
  77. package/src/editor/components/ppt/PptComments.tsx +589 -0
  78. package/src/editor/components/ppt/PptDesignProposals.tsx +275 -0
  79. package/src/editor/components/ppt/PptFormatPane.tsx +320 -0
  80. package/src/editor/components/ppt/PptNotes.tsx +246 -0
  81. package/src/editor/components/property-panel/AlignmentPanel.tsx +110 -0
  82. package/src/editor/components/property-panel/AutoLayoutPanel.tsx +615 -0
  83. package/src/editor/components/property-panel/BorderSection.tsx +104 -0
  84. package/src/editor/components/property-panel/CompactNumberInput.tsx +237 -0
  85. package/src/editor/components/property-panel/CompactSizeInput.tsx +148 -0
  86. package/src/editor/components/property-panel/EffectSection.tsx +157 -0
  87. package/src/editor/components/property-panel/FillSection.tsx +69 -0
  88. package/src/editor/components/property-panel/GoogleFontPicker.tsx +192 -0
  89. package/src/editor/components/property-panel/ImageSection.tsx +206 -0
  90. package/src/editor/components/property-panel/ImgSrcSection.tsx +125 -0
  91. package/src/editor/components/property-panel/InstanceOverrideSection.tsx +413 -0
  92. package/src/editor/components/property-panel/LayoutSection.tsx +105 -0
  93. package/src/editor/components/property-panel/LinkSection.tsx +103 -0
  94. package/src/editor/components/property-panel/PropertyVariablePicker.tsx +311 -0
  95. package/src/editor/components/property-panel/ScalePanel.tsx +212 -0
  96. package/src/editor/components/property-panel/TypographySection.tsx +230 -0
  97. package/src/editor/components/property-panel/UnitAwareNumberInput.tsx +238 -0
  98. package/src/editor/components/property-panel/VariableAwareColorInput.tsx +477 -0
  99. package/src/editor/components/property-panel/VariableAwareInput.tsx +606 -0
  100. package/src/editor/components/property-panel/VariableAwareSizeInput.tsx +588 -0
  101. package/src/editor/components/property-panel/VariableAwareUnitInput.tsx +546 -0
  102. package/src/editor/components/property-panel/index.ts +24 -0
  103. package/src/editor/components/property-panel/unit-utils.ts +261 -0
  104. package/src/editor/components/shell/EditorTopBar.tsx +392 -0
  105. package/src/editor/components/shell/LeftPanel.tsx +47 -0
  106. package/src/editor/components/shell/PagesPanel.tsx +118 -0
  107. package/src/editor/components/variables-panel/ColorValueCell.tsx +165 -0
  108. package/src/editor/components/variables-panel/TextValueCell.tsx +116 -0
  109. package/src/editor/components/variables-panel/VariablesPanel.tsx +518 -0
  110. package/src/editor/components/variables-panel/index.ts +7 -0
  111. package/src/editor/constants.ts +468 -0
  112. package/src/editor/contexts/EditorArtboardContext.tsx +229 -0
  113. package/src/editor/contexts/EditorComponentsContext.tsx +1320 -0
  114. package/src/editor/contexts/EditorDocumentContext.tsx +113 -0
  115. package/src/editor/contexts/EditorHistoryContext.tsx +516 -0
  116. package/src/editor/contexts/EditorRefsContext.tsx +204 -0
  117. package/src/editor/contexts/EditorSelectionContext.tsx +54 -0
  118. package/src/editor/contexts/EditorToolContext.tsx +58 -0
  119. package/src/editor/contexts/EditorUIStateContext.tsx +122 -0
  120. package/src/editor/contexts/EditorVariablesContext.tsx +397 -0
  121. package/src/editor/contexts/EditorViewContext.tsx +101 -0
  122. package/src/editor/contexts/MultiPageCanvasContext.tsx +498 -0
  123. package/src/editor/contexts/index.ts +17 -0
  124. package/src/editor/editor-skin.css +122 -0
  125. package/src/editor/hooks/index.ts +38 -0
  126. package/src/editor/hooks/useAiReplace.ts +397 -0
  127. package/src/editor/hooks/useAltMeasure.ts +67 -0
  128. package/src/editor/hooks/useBrowserZoomPrevention.ts +121 -0
  129. package/src/editor/hooks/useCanvasControls.ts +1222 -0
  130. package/src/editor/hooks/useComponentEditMode.ts +658 -0
  131. package/src/editor/hooks/useComponentInstances.ts +515 -0
  132. package/src/editor/hooks/useContextMenuHandler.ts +157 -0
  133. package/src/editor/hooks/useCoordinateTransform.ts +207 -0
  134. package/src/editor/hooks/useDragResize.ts +1317 -0
  135. package/src/editor/hooks/useDrawingMode.ts +472 -0
  136. package/src/editor/hooks/useEditorColors.ts +144 -0
  137. package/src/editor/hooks/useEditorMessages.ts +108 -0
  138. package/src/editor/hooks/useElementActions.ts +1754 -0
  139. package/src/editor/hooks/useElementSelection.ts +1573 -0
  140. package/src/editor/hooks/useFocusManagement.ts +249 -0
  141. package/src/editor/hooks/useGoogleFonts.ts +305 -0
  142. package/src/editor/hooks/useIframeInitializer.ts +584 -0
  143. package/src/editor/hooks/useIframeSetup.ts +360 -0
  144. package/src/editor/hooks/useImageUpload.ts +270 -0
  145. package/src/editor/hooks/useInfiniteCanvas.ts +301 -0
  146. package/src/editor/hooks/useKeyboardShortcuts.ts +205 -0
  147. package/src/editor/hooks/useMarqueeSelection.ts +388 -0
  148. package/src/editor/hooks/useMediaLibrary.ts +129 -0
  149. package/src/editor/hooks/usePageSettingsManager.ts +739 -0
  150. package/src/editor/hooks/useResizablePanel.ts +163 -0
  151. package/src/editor/hooks/useRichPaste.ts +255 -0
  152. package/src/editor/hooks/useTouchGestures.ts +197 -0
  153. package/src/editor/index.ts +27 -0
  154. package/src/editor/types/page-settings.ts +513 -0
  155. package/src/editor/types.ts +382 -0
  156. package/src/editor/utils/align-elements.ts +169 -0
  157. package/src/editor/utils/api-json.ts +21 -0
  158. package/src/editor/utils/aspect-lock.ts +50 -0
  159. package/src/editor/utils/component-renderer.ts +702 -0
  160. package/src/editor/utils/component-sync.ts +845 -0
  161. package/src/editor/utils/crop-mode.ts +265 -0
  162. package/src/editor/utils/dom-utils.ts +2238 -0
  163. package/src/editor/utils/element-effects.ts +218 -0
  164. package/src/editor/utils/eyedropper.ts +35 -0
  165. package/src/editor/utils/figma-export.ts +560 -0
  166. package/src/editor/utils/figma-kiwi-decoder.ts +722 -0
  167. package/src/editor/utils/figma-kiwi-encoder.ts +583 -0
  168. package/src/editor/utils/figma-paste.ts +2262 -0
  169. package/src/editor/utils/flex-reorder.ts +231 -0
  170. package/src/editor/utils/flex-utils.ts +1230 -0
  171. package/src/editor/utils/geometry.ts +232 -0
  172. package/src/editor/utils/grid-layout.ts +210 -0
  173. package/src/editor/utils/html-utils.ts +470 -0
  174. package/src/editor/utils/index.ts +11 -0
  175. package/src/editor/utils/ink-style.ts +57 -0
  176. package/src/editor/utils/inline-format.ts +236 -0
  177. package/src/editor/utils/measure-distance.ts +120 -0
  178. package/src/editor/utils/override-apply.ts +526 -0
  179. package/src/editor/utils/override-detection.ts +613 -0
  180. package/src/editor/utils/paste-processors.ts +609 -0
  181. package/src/editor/utils/paste-sanitizer.ts +244 -0
  182. package/src/editor/utils/restore-flow.ts +188 -0
  183. package/src/editor/utils/shape-library.ts +171 -0
  184. package/src/editor/utils/slide-root.ts +29 -0
  185. package/src/editor/utils/smart-guides.ts +218 -0
  186. package/src/editor/utils/style-utils.ts +685 -0
  187. package/src/editor/utils/table-edit.ts +151 -0
  188. package/src/editor/utils/tailwind-mappings.ts +778 -0
  189. package/src/editor/utils/tailwind-utils.ts +804 -0
  190. package/src/editor/utils/text-highlight.ts +216 -0
  191. package/src/editor/utils/theme-to-variables.ts +341 -0
  192. package/src/editor/utils/variant-resolver.ts +456 -0
  193. package/src/editor/utils/viewport-utils.ts +295 -0
  194. package/src/hooks/useEditorHistory.ts +195 -0
  195. package/src/hooks/useEditorShortcuts.ts +260 -0
  196. package/src/index.ts +40 -0
  197. package/src/io.ts +134 -0
  198. package/src/lib/agent/slide-agent/types.ts +547 -0
  199. package/src/lib/agent/website-agent/types.ts +805 -0
  200. package/src/lib/api/auth-fetch.ts +58 -0
  201. package/src/lib/deck.ts +69 -0
  202. package/src/lib/export.ts +47 -0
  203. package/src/lib/firebase/config.ts +29 -0
  204. package/src/lib/firebase/css-variables.ts +378 -0
  205. package/src/lib/firebase/editor-components.ts +677 -0
  206. package/src/lib/firebase/storage.ts +469 -0
  207. package/src/lib/utils.ts +6 -0
  208. package/src/styles/editor.css +52 -0
  209. package/src/styles/skin.css +122 -0
  210. package/src/types/css-variables.ts +645 -0
  211. package/src/types/editor-components.ts +944 -0
  212. package/src/types/editor.ts +420 -0
  213. package/src/types/page-master.ts +197 -0
  214. package/src/types/page.ts +419 -0
  215. package/src/types/slide.ts +402 -0
  216. package/src/types/website-theme.ts +788 -0
  217. package/src/types/website.ts +374 -0
  218. package/src/vendor/firebase-firestore.ts +13 -0
  219. package/src/vendor/firebase-functions.ts +17 -0
@@ -0,0 +1,778 @@
1
+ /**
2
+ * Tailwind CSS マッピング定義
3
+ *
4
+ * CSSプロパティ値をTailwindクラスに変換するためのマッピングルール
5
+ */
6
+
7
+ /**
8
+ * プロパティグループ定義(競合クラス管理用)
9
+ * 同じプロパティを更新する際、古いクラスを削除するために使用
10
+ */
11
+ export const TAILWIND_CONFLICT_GROUPS: Record<string, string[]> = {
12
+ // Position & Layout
13
+ position: ['static', 'relative', 'absolute', 'fixed', 'sticky'],
14
+ display: [
15
+ 'block',
16
+ 'inline-block',
17
+ 'inline',
18
+ 'flex',
19
+ 'inline-flex',
20
+ 'grid',
21
+ 'inline-grid',
22
+ 'hidden',
23
+ ],
24
+ visibility: ['visible', 'invisible', 'collapse'],
25
+
26
+ // Size
27
+ width: ['w-'],
28
+ minWidth: ['min-w-'],
29
+ maxWidth: ['max-w-'],
30
+ height: ['h-'],
31
+ minHeight: ['min-h-'],
32
+ maxHeight: ['max-h-'],
33
+
34
+ // Position offsets
35
+ top: ['top-'],
36
+ right: ['right-'],
37
+ bottom: ['bottom-'],
38
+ left: ['left-'],
39
+ inset: ['inset-'],
40
+
41
+ // Flexbox
42
+ flexDirection: ['flex-row', 'flex-col'],
43
+ flexWrap: ['flex-wrap', 'flex-nowrap'],
44
+ justifyContent: ['justify-'],
45
+ alignItems: ['items-'],
46
+ alignContent: ['content-'],
47
+ alignSelf: ['self-'],
48
+ flexGrow: ['grow', 'grow-0'],
49
+ flexShrink: ['shrink', 'shrink-0'],
50
+ flexBasis: ['basis-'],
51
+ order: ['order-'],
52
+
53
+ // Grid
54
+ gridTemplateColumns: ['grid-cols-'],
55
+ gridTemplateRows: ['grid-rows-'],
56
+ gridColumn: ['col-'],
57
+ gridRow: ['row-'],
58
+ gridColumnStart: ['col-start-'],
59
+ gridColumnEnd: ['col-end-'],
60
+ gridRowStart: ['row-start-'],
61
+ gridRowEnd: ['row-end-'],
62
+ gridAutoFlow: ['grid-flow-'],
63
+ gridAutoColumns: ['auto-cols-'],
64
+ gridAutoRows: ['auto-rows-'],
65
+
66
+ // Gap
67
+ gap: ['gap-'],
68
+ rowGap: ['gap-y-'],
69
+ columnGap: ['gap-x-'],
70
+
71
+ // Spacing
72
+ padding: ['p-'],
73
+ paddingTop: ['pt-'],
74
+ paddingRight: ['pr-'],
75
+ paddingBottom: ['pb-'],
76
+ paddingLeft: ['pl-'],
77
+ paddingX: ['px-'],
78
+ paddingY: ['py-'],
79
+ margin: ['m-'],
80
+ marginTop: ['mt-'],
81
+ marginRight: ['mr-'],
82
+ marginBottom: ['mb-'],
83
+ marginLeft: ['ml-'],
84
+ marginX: ['mx-'],
85
+ marginY: ['my-'],
86
+
87
+ // Background
88
+ backgroundColor: ['bg-'],
89
+ backgroundOpacity: ['bg-opacity-'],
90
+
91
+ // Border
92
+ borderRadius: ['rounded-'],
93
+ borderTopLeftRadius: ['rounded-tl-'],
94
+ borderTopRightRadius: ['rounded-tr-'],
95
+ borderBottomRightRadius: ['rounded-br-'],
96
+ borderBottomLeftRadius: ['rounded-bl-'],
97
+ borderWidth: ['border-'],
98
+ borderTopWidth: ['border-t-'],
99
+ borderRightWidth: ['border-r-'],
100
+ borderBottomWidth: ['border-b-'],
101
+ borderLeftWidth: ['border-l-'],
102
+ borderColor: ['border-'],
103
+ borderStyle: ['border-solid', 'border-dashed', 'border-dotted', 'border-none'],
104
+
105
+ // Typography
106
+ // 注意: fontSize と color は両方 text- プレフィックスを使用するが、
107
+ // 競合を避けるため、より具体的なパターンで管理する
108
+ // fontSize は text-xs, text-sm, text-base, text-lg, text-xl, text-2xl, etc. と text-[数値]
109
+ // color は text-[色名], text-[#hex], text-[rgb()] 等
110
+ // twMerge がこれらを適切に処理するため、ここでは空配列にして
111
+ // twMerge に任せる(removeConflictingClasses で誤って削除されないようにする)
112
+ fontSize: [], // twMerge handles text size vs color conflicts
113
+ fontWeight: ['font-thin', 'font-extralight', 'font-light', 'font-normal', 'font-medium', 'font-semibold', 'font-bold', 'font-extrabold', 'font-black'],
114
+ fontFamily: ['font-sans', 'font-serif', 'font-mono', 'font-['],
115
+ fontStyle: ['italic', 'not-italic'],
116
+ textAlign: ['text-left', 'text-center', 'text-right', 'text-justify', 'text-start', 'text-end'],
117
+ textDecoration: ['underline', 'overline', 'line-through', 'no-underline'],
118
+ textTransform: ['uppercase', 'lowercase', 'capitalize', 'normal-case'],
119
+ lineHeight: ['leading-'],
120
+ letterSpacing: ['tracking-'],
121
+ color: [], // twMerge handles text color vs size conflicts
122
+ whiteSpace: ['whitespace-'],
123
+ wordBreak: ['break-'],
124
+ textOverflow: ['truncate', 'text-ellipsis', 'text-clip'],
125
+
126
+ // Effects
127
+ opacity: ['opacity-'],
128
+ boxShadow: ['shadow-'],
129
+ mixBlendMode: ['mix-blend-'],
130
+ backgroundBlendMode: ['bg-blend-'],
131
+
132
+ // Layout
133
+ overflow: ['overflow-'],
134
+ overflowX: ['overflow-x-'],
135
+ overflowY: ['overflow-y-'],
136
+ zIndex: ['z-'],
137
+ objectFit: ['object-'],
138
+ objectPosition: ['object-'],
139
+
140
+ // Aspect Ratio
141
+ aspectRatio: ['aspect-'],
142
+
143
+ // Cursor
144
+ cursor: ['cursor-'],
145
+
146
+ // Pointer Events
147
+ pointerEvents: ['pointer-events-'],
148
+
149
+ // User Select
150
+ userSelect: ['select-'],
151
+ };
152
+
153
+ /**
154
+ * 列挙型マッピング
155
+ * CSS値からTailwindクラスへの直接マッピング
156
+ */
157
+ export const ENUM_MAPPINGS: Record<string, Record<string, string>> = {
158
+ position: {
159
+ static: 'static',
160
+ relative: 'relative',
161
+ absolute: 'absolute',
162
+ fixed: 'fixed',
163
+ sticky: 'sticky',
164
+ },
165
+
166
+ display: {
167
+ block: 'block',
168
+ 'inline-block': 'inline-block',
169
+ inline: 'inline',
170
+ flex: 'flex',
171
+ 'inline-flex': 'inline-flex',
172
+ grid: 'grid',
173
+ 'inline-grid': 'inline-grid',
174
+ none: 'hidden',
175
+ },
176
+
177
+ visibility: {
178
+ visible: 'visible',
179
+ hidden: 'invisible',
180
+ collapse: 'collapse',
181
+ },
182
+
183
+ flexDirection: {
184
+ row: 'flex-row',
185
+ 'row-reverse': 'flex-row-reverse',
186
+ column: 'flex-col',
187
+ 'column-reverse': 'flex-col-reverse',
188
+ },
189
+
190
+ flexWrap: {
191
+ wrap: 'flex-wrap',
192
+ 'wrap-reverse': 'flex-wrap-reverse',
193
+ nowrap: 'flex-nowrap',
194
+ },
195
+
196
+ justifyContent: {
197
+ 'flex-start': 'justify-start',
198
+ start: 'justify-start',
199
+ 'flex-end': 'justify-end',
200
+ end: 'justify-end',
201
+ center: 'justify-center',
202
+ 'space-between': 'justify-between',
203
+ 'space-around': 'justify-around',
204
+ 'space-evenly': 'justify-evenly',
205
+ stretch: 'justify-stretch',
206
+ },
207
+
208
+ alignItems: {
209
+ 'flex-start': 'items-start',
210
+ start: 'items-start',
211
+ 'flex-end': 'items-end',
212
+ end: 'items-end',
213
+ center: 'items-center',
214
+ baseline: 'items-baseline',
215
+ stretch: 'items-stretch',
216
+ },
217
+
218
+ alignContent: {
219
+ 'flex-start': 'content-start',
220
+ start: 'content-start',
221
+ 'flex-end': 'content-end',
222
+ end: 'content-end',
223
+ center: 'content-center',
224
+ 'space-between': 'content-between',
225
+ 'space-around': 'content-around',
226
+ 'space-evenly': 'content-evenly',
227
+ stretch: 'content-stretch',
228
+ baseline: 'content-baseline',
229
+ },
230
+
231
+ alignSelf: {
232
+ auto: 'self-auto',
233
+ 'flex-start': 'self-start',
234
+ start: 'self-start',
235
+ 'flex-end': 'self-end',
236
+ end: 'self-end',
237
+ center: 'self-center',
238
+ stretch: 'self-stretch',
239
+ baseline: 'self-baseline',
240
+ },
241
+
242
+ gridAutoFlow: {
243
+ row: 'grid-flow-row',
244
+ column: 'grid-flow-col',
245
+ dense: 'grid-flow-dense',
246
+ 'row dense': 'grid-flow-row-dense',
247
+ 'column dense': 'grid-flow-col-dense',
248
+ },
249
+
250
+ textAlign: {
251
+ left: 'text-left',
252
+ center: 'text-center',
253
+ right: 'text-right',
254
+ justify: 'text-justify',
255
+ start: 'text-start',
256
+ end: 'text-end',
257
+ },
258
+
259
+ textDecoration: {
260
+ underline: 'underline',
261
+ overline: 'overline',
262
+ 'line-through': 'line-through',
263
+ none: 'no-underline',
264
+ },
265
+
266
+ textTransform: {
267
+ uppercase: 'uppercase',
268
+ lowercase: 'lowercase',
269
+ capitalize: 'capitalize',
270
+ none: 'normal-case',
271
+ },
272
+
273
+ fontStyle: {
274
+ italic: 'italic',
275
+ normal: 'not-italic',
276
+ },
277
+
278
+ fontWeight: {
279
+ '100': 'font-thin',
280
+ '200': 'font-extralight',
281
+ '300': 'font-light',
282
+ '400': 'font-normal',
283
+ '500': 'font-medium',
284
+ '600': 'font-semibold',
285
+ '700': 'font-bold',
286
+ '800': 'font-extrabold',
287
+ '900': 'font-black',
288
+ thin: 'font-thin',
289
+ extralight: 'font-extralight',
290
+ light: 'font-light',
291
+ normal: 'font-normal',
292
+ medium: 'font-medium',
293
+ semibold: 'font-semibold',
294
+ bold: 'font-bold',
295
+ extrabold: 'font-extrabold',
296
+ black: 'font-black',
297
+ },
298
+
299
+ overflow: {
300
+ auto: 'overflow-auto',
301
+ hidden: 'overflow-hidden',
302
+ clip: 'overflow-clip',
303
+ visible: 'overflow-visible',
304
+ scroll: 'overflow-scroll',
305
+ },
306
+
307
+ overflowX: {
308
+ auto: 'overflow-x-auto',
309
+ hidden: 'overflow-x-hidden',
310
+ clip: 'overflow-x-clip',
311
+ visible: 'overflow-x-visible',
312
+ scroll: 'overflow-x-scroll',
313
+ },
314
+
315
+ overflowY: {
316
+ auto: 'overflow-y-auto',
317
+ hidden: 'overflow-y-hidden',
318
+ clip: 'overflow-y-clip',
319
+ visible: 'overflow-y-visible',
320
+ scroll: 'overflow-y-scroll',
321
+ },
322
+
323
+ objectFit: {
324
+ contain: 'object-contain',
325
+ cover: 'object-cover',
326
+ fill: 'object-fill',
327
+ none: 'object-none',
328
+ 'scale-down': 'object-scale-down',
329
+ },
330
+
331
+ objectPosition: {
332
+ bottom: 'object-bottom',
333
+ center: 'object-center',
334
+ left: 'object-left',
335
+ 'left bottom': 'object-left-bottom',
336
+ 'left top': 'object-left-top',
337
+ right: 'object-right',
338
+ 'right bottom': 'object-right-bottom',
339
+ 'right top': 'object-right-top',
340
+ top: 'object-top',
341
+ },
342
+
343
+ borderStyle: {
344
+ solid: 'border-solid',
345
+ dashed: 'border-dashed',
346
+ dotted: 'border-dotted',
347
+ double: 'border-double',
348
+ hidden: 'border-hidden',
349
+ none: 'border-none',
350
+ },
351
+
352
+ whiteSpace: {
353
+ normal: 'whitespace-normal',
354
+ nowrap: 'whitespace-nowrap',
355
+ pre: 'whitespace-pre',
356
+ 'pre-line': 'whitespace-pre-line',
357
+ 'pre-wrap': 'whitespace-pre-wrap',
358
+ 'break-spaces': 'whitespace-break-spaces',
359
+ },
360
+
361
+ wordBreak: {
362
+ normal: 'break-normal',
363
+ 'break-all': 'break-all',
364
+ 'keep-all': 'break-keep',
365
+ },
366
+
367
+ cursor: {
368
+ auto: 'cursor-auto',
369
+ default: 'cursor-default',
370
+ pointer: 'cursor-pointer',
371
+ wait: 'cursor-wait',
372
+ text: 'cursor-text',
373
+ move: 'cursor-move',
374
+ help: 'cursor-help',
375
+ 'not-allowed': 'cursor-not-allowed',
376
+ none: 'cursor-none',
377
+ 'context-menu': 'cursor-context-menu',
378
+ progress: 'cursor-progress',
379
+ cell: 'cursor-cell',
380
+ crosshair: 'cursor-crosshair',
381
+ 'vertical-text': 'cursor-vertical-text',
382
+ alias: 'cursor-alias',
383
+ copy: 'cursor-copy',
384
+ 'no-drop': 'cursor-no-drop',
385
+ grab: 'cursor-grab',
386
+ grabbing: 'cursor-grabbing',
387
+ 'all-scroll': 'cursor-all-scroll',
388
+ 'col-resize': 'cursor-col-resize',
389
+ 'row-resize': 'cursor-row-resize',
390
+ 'n-resize': 'cursor-n-resize',
391
+ 'e-resize': 'cursor-e-resize',
392
+ 's-resize': 'cursor-s-resize',
393
+ 'w-resize': 'cursor-w-resize',
394
+ 'ne-resize': 'cursor-ne-resize',
395
+ 'nw-resize': 'cursor-nw-resize',
396
+ 'se-resize': 'cursor-se-resize',
397
+ 'sw-resize': 'cursor-sw-resize',
398
+ 'ew-resize': 'cursor-ew-resize',
399
+ 'ns-resize': 'cursor-ns-resize',
400
+ 'nesw-resize': 'cursor-nesw-resize',
401
+ 'nwse-resize': 'cursor-nwse-resize',
402
+ 'zoom-in': 'cursor-zoom-in',
403
+ 'zoom-out': 'cursor-zoom-out',
404
+ },
405
+
406
+ pointerEvents: {
407
+ none: 'pointer-events-none',
408
+ auto: 'pointer-events-auto',
409
+ },
410
+
411
+ userSelect: {
412
+ none: 'select-none',
413
+ text: 'select-text',
414
+ all: 'select-all',
415
+ auto: 'select-auto',
416
+ },
417
+
418
+ mixBlendMode: {
419
+ normal: 'mix-blend-normal',
420
+ multiply: 'mix-blend-multiply',
421
+ screen: 'mix-blend-screen',
422
+ overlay: 'mix-blend-overlay',
423
+ darken: 'mix-blend-darken',
424
+ lighten: 'mix-blend-lighten',
425
+ 'color-dodge': 'mix-blend-color-dodge',
426
+ 'color-burn': 'mix-blend-color-burn',
427
+ 'hard-light': 'mix-blend-hard-light',
428
+ 'soft-light': 'mix-blend-soft-light',
429
+ difference: 'mix-blend-difference',
430
+ exclusion: 'mix-blend-exclusion',
431
+ hue: 'mix-blend-hue',
432
+ saturation: 'mix-blend-saturation',
433
+ color: 'mix-blend-color',
434
+ luminosity: 'mix-blend-luminosity',
435
+ 'plus-darker': 'mix-blend-plus-darker',
436
+ 'plus-lighter': 'mix-blend-plus-lighter',
437
+ },
438
+
439
+ backgroundBlendMode: {
440
+ normal: 'bg-blend-normal',
441
+ multiply: 'bg-blend-multiply',
442
+ screen: 'bg-blend-screen',
443
+ overlay: 'bg-blend-overlay',
444
+ darken: 'bg-blend-darken',
445
+ lighten: 'bg-blend-lighten',
446
+ 'color-dodge': 'bg-blend-color-dodge',
447
+ 'color-burn': 'bg-blend-color-burn',
448
+ 'hard-light': 'bg-blend-hard-light',
449
+ 'soft-light': 'bg-blend-soft-light',
450
+ difference: 'bg-blend-difference',
451
+ exclusion: 'bg-blend-exclusion',
452
+ hue: 'bg-blend-hue',
453
+ saturation: 'bg-blend-saturation',
454
+ color: 'bg-blend-color',
455
+ luminosity: 'bg-blend-luminosity',
456
+ },
457
+
458
+ aspectRatio: {
459
+ auto: 'aspect-auto',
460
+ '1 / 1': 'aspect-square',
461
+ '16 / 9': 'aspect-video',
462
+ },
463
+ };
464
+
465
+ /**
466
+ * 数値変換プレフィックス
467
+ * px値や%値を任意値形式(例: w-[123px])に変換するためのマッピング
468
+ */
469
+ export const NUMERIC_PREFIXES: Record<string, string> = {
470
+ // Size
471
+ width: 'w',
472
+ minWidth: 'min-w',
473
+ maxWidth: 'max-w',
474
+ height: 'h',
475
+ minHeight: 'min-h',
476
+ maxHeight: 'max-h',
477
+
478
+ // Position offsets
479
+ top: 'top',
480
+ right: 'right',
481
+ bottom: 'bottom',
482
+ left: 'left',
483
+ inset: 'inset',
484
+
485
+ // Gap
486
+ gap: 'gap',
487
+ rowGap: 'gap-y',
488
+ columnGap: 'gap-x',
489
+
490
+ // Padding
491
+ padding: 'p',
492
+ paddingTop: 'pt',
493
+ paddingRight: 'pr',
494
+ paddingBottom: 'pb',
495
+ paddingLeft: 'pl',
496
+
497
+ // Margin
498
+ margin: 'm',
499
+ marginTop: 'mt',
500
+ marginRight: 'mr',
501
+ marginBottom: 'mb',
502
+ marginLeft: 'ml',
503
+
504
+ // Typography
505
+ fontSize: 'text',
506
+ lineHeight: 'leading',
507
+ letterSpacing: 'tracking',
508
+
509
+ // Border
510
+ borderRadius: 'rounded',
511
+ borderTopLeftRadius: 'rounded-tl',
512
+ borderTopRightRadius: 'rounded-tr',
513
+ borderBottomRightRadius: 'rounded-br',
514
+ borderBottomLeftRadius: 'rounded-bl',
515
+ borderWidth: 'border',
516
+ borderTopWidth: 'border-t',
517
+ borderRightWidth: 'border-r',
518
+ borderBottomWidth: 'border-b',
519
+ borderLeftWidth: 'border-l',
520
+
521
+ // Effects
522
+ opacity: 'opacity',
523
+
524
+ // Layout
525
+ zIndex: 'z',
526
+
527
+ // Flex
528
+ flexBasis: 'basis',
529
+ order: 'order',
530
+
531
+ // Grid
532
+ gridColumn: 'col-span',
533
+ gridRow: 'row-span',
534
+ gridColumnStart: 'col-start',
535
+ gridColumnEnd: 'col-end',
536
+ gridRowStart: 'row-start',
537
+ gridRowEnd: 'row-end',
538
+ };
539
+
540
+ /**
541
+ * 色プロパティのプレフィックス
542
+ */
543
+ export const COLOR_PREFIXES: Record<string, string> = {
544
+ backgroundColor: 'bg',
545
+ color: 'text',
546
+ borderColor: 'border',
547
+ outlineColor: 'outline',
548
+ textDecorationColor: 'decoration',
549
+ caretColor: 'caret',
550
+ accentColor: 'accent',
551
+ fill: 'fill',
552
+ stroke: 'stroke',
553
+ };
554
+
555
+ /**
556
+ * style属性にフォールバックするプロパティ
557
+ * Tailwindで表現困難または複雑な値を持つプロパティ
558
+ */
559
+ export const STYLE_ONLY_PROPERTIES: string[] = [
560
+ 'transform',
561
+ 'transformOrigin',
562
+ 'filter',
563
+ 'backdropFilter',
564
+ 'boxShadow',
565
+ 'textShadow',
566
+ 'backgroundImage',
567
+ 'backgroundPosition',
568
+ 'backgroundSize',
569
+ 'backgroundRepeat',
570
+ 'backgroundAttachment',
571
+ 'clipPath',
572
+ 'transition',
573
+ 'transitionProperty',
574
+ 'transitionDuration',
575
+ 'transitionTimingFunction',
576
+ 'transitionDelay',
577
+ 'animation',
578
+ 'animationName',
579
+ 'animationDuration',
580
+ 'animationTimingFunction',
581
+ 'animationDelay',
582
+ 'animationIterationCount',
583
+ 'animationDirection',
584
+ 'animationFillMode',
585
+ 'animationPlayState',
586
+ 'perspective',
587
+ 'perspectiveOrigin',
588
+ 'backfaceVisibility',
589
+ 'transformStyle',
590
+ 'willChange',
591
+ 'outline',
592
+ 'outlineWidth',
593
+ 'outlineStyle',
594
+ 'outlineOffset',
595
+ 'content',
596
+ 'quotes',
597
+ 'counterReset',
598
+ 'counterIncrement',
599
+ 'listStyleType',
600
+ 'listStylePosition',
601
+ 'listStyleImage',
602
+ ];
603
+
604
+ /**
605
+ * 特殊な値マッピング(auto, 100%, 50%など)
606
+ */
607
+ export const SPECIAL_VALUES: Record<string, Record<string, string>> = {
608
+ width: {
609
+ auto: 'w-auto',
610
+ '100%': 'w-full',
611
+ '100vw': 'w-screen',
612
+ '50%': 'w-1/2',
613
+ '33.333333%': 'w-1/3',
614
+ '66.666667%': 'w-2/3',
615
+ '25%': 'w-1/4',
616
+ '75%': 'w-3/4',
617
+ 'fit-content': 'w-fit',
618
+ 'min-content': 'w-min',
619
+ 'max-content': 'w-max',
620
+ },
621
+ height: {
622
+ auto: 'h-auto',
623
+ '100%': 'h-full',
624
+ '100vh': 'h-screen',
625
+ '100dvh': 'h-dvh',
626
+ '50%': 'h-1/2',
627
+ '33.333333%': 'h-1/3',
628
+ '66.666667%': 'h-2/3',
629
+ '25%': 'h-1/4',
630
+ '75%': 'h-3/4',
631
+ 'fit-content': 'h-fit',
632
+ 'min-content': 'h-min',
633
+ 'max-content': 'h-max',
634
+ },
635
+ minWidth: {
636
+ '0': 'min-w-0',
637
+ '100%': 'min-w-full',
638
+ 'fit-content': 'min-w-fit',
639
+ 'min-content': 'min-w-min',
640
+ 'max-content': 'min-w-max',
641
+ },
642
+ maxWidth: {
643
+ none: 'max-w-none',
644
+ '100%': 'max-w-full',
645
+ 'fit-content': 'max-w-fit',
646
+ 'min-content': 'max-w-min',
647
+ 'max-content': 'max-w-max',
648
+ },
649
+ minHeight: {
650
+ '0': 'min-h-0',
651
+ '100%': 'min-h-full',
652
+ '100vh': 'min-h-screen',
653
+ '100dvh': 'min-h-dvh',
654
+ 'fit-content': 'min-h-fit',
655
+ 'min-content': 'min-h-min',
656
+ 'max-content': 'min-h-max',
657
+ },
658
+ maxHeight: {
659
+ none: 'max-h-none',
660
+ '100%': 'max-h-full',
661
+ '100vh': 'max-h-screen',
662
+ '100dvh': 'max-h-dvh',
663
+ 'fit-content': 'max-h-fit',
664
+ 'min-content': 'max-h-min',
665
+ 'max-content': 'max-h-max',
666
+ },
667
+ top: {
668
+ auto: 'top-auto',
669
+ '0': 'top-0',
670
+ '50%': 'top-1/2',
671
+ '100%': 'top-full',
672
+ },
673
+ right: {
674
+ auto: 'right-auto',
675
+ '0': 'right-0',
676
+ '50%': 'right-1/2',
677
+ '100%': 'right-full',
678
+ },
679
+ bottom: {
680
+ auto: 'bottom-auto',
681
+ '0': 'bottom-0',
682
+ '50%': 'bottom-1/2',
683
+ '100%': 'bottom-full',
684
+ },
685
+ left: {
686
+ auto: 'left-auto',
687
+ '0': 'left-0',
688
+ '50%': 'left-1/2',
689
+ '100%': 'left-full',
690
+ },
691
+ inset: {
692
+ auto: 'inset-auto',
693
+ '0': 'inset-0',
694
+ },
695
+ margin: {
696
+ auto: 'm-auto',
697
+ '0': 'm-0',
698
+ },
699
+ marginTop: {
700
+ auto: 'mt-auto',
701
+ '0': 'mt-0',
702
+ },
703
+ marginRight: {
704
+ auto: 'mr-auto',
705
+ '0': 'mr-0',
706
+ },
707
+ marginBottom: {
708
+ auto: 'mb-auto',
709
+ '0': 'mb-0',
710
+ },
711
+ marginLeft: {
712
+ auto: 'ml-auto',
713
+ '0': 'ml-0',
714
+ },
715
+ padding: {
716
+ '0': 'p-0',
717
+ },
718
+ paddingTop: {
719
+ '0': 'pt-0',
720
+ },
721
+ paddingRight: {
722
+ '0': 'pr-0',
723
+ },
724
+ paddingBottom: {
725
+ '0': 'pb-0',
726
+ },
727
+ paddingLeft: {
728
+ '0': 'pl-0',
729
+ },
730
+ gap: {
731
+ '0': 'gap-0',
732
+ },
733
+ rowGap: {
734
+ '0': 'gap-y-0',
735
+ },
736
+ columnGap: {
737
+ '0': 'gap-x-0',
738
+ },
739
+ borderRadius: {
740
+ '0': 'rounded-none',
741
+ '9999px': 'rounded-full',
742
+ },
743
+ borderWidth: {
744
+ '0': 'border-0',
745
+ '1px': 'border',
746
+ },
747
+ opacity: {
748
+ '0': 'opacity-0',
749
+ '1': 'opacity-100',
750
+ '0.5': 'opacity-50',
751
+ },
752
+ zIndex: {
753
+ auto: 'z-auto',
754
+ '0': 'z-0',
755
+ },
756
+ flexGrow: {
757
+ '0': 'grow-0',
758
+ '1': 'grow',
759
+ },
760
+ flexShrink: {
761
+ '0': 'shrink-0',
762
+ '1': 'shrink',
763
+ },
764
+ flexBasis: {
765
+ auto: 'basis-auto',
766
+ '0': 'basis-0',
767
+ '100%': 'basis-full',
768
+ '50%': 'basis-1/2',
769
+ },
770
+ order: {
771
+ '0': 'order-none',
772
+ '1': 'order-1',
773
+ '2': 'order-2',
774
+ '-1': '-order-1',
775
+ '9999': 'order-last',
776
+ '-9999': 'order-first',
777
+ },
778
+ };