@@ -19,7 +19,6 @@ import org.jetbrains.kotlinx.dataframe.columns.ColumnReference
1919import org.jetbrains.kotlinx.dataframe.columns.toColumnSet
2020import org.jetbrains.kotlinx.dataframe.dataTypes.IFRAME
2121import org.jetbrains.kotlinx.dataframe.dataTypes.IMG
22- import org.jetbrains.kotlinx.dataframe.documentation.ExportAsHtml
2322import org.jetbrains.kotlinx.dataframe.documentation.SelectingColumns
2423import org.jetbrains.kotlinx.dataframe.documentation.SelectingRows
2524import org.jetbrains.kotlinx.dataframe.impl.api.MergedAttributes
@@ -34,6 +33,10 @@ import org.jetbrains.kotlinx.dataframe.io.toHtml
3433import org.jetbrains.kotlinx.dataframe.io.toStandaloneHtml
3534import org.jetbrains.kotlinx.dataframe.jupyter.RenderedContent.Companion.media
3635import org.jetbrains.kotlinx.dataframe.util.DEPRECATED_ACCESS_API
36+ import org.jetbrains.kotlinx.dataframe.util.FORMATTING_DSL
37+ import org.jetbrains.kotlinx.dataframe.util.FORMATTING_DSL_REPLACE
38+ import org.jetbrains.kotlinx.dataframe.util.RGB_COLOR
39+ import org.jetbrains.kotlinx.dataframe.util.RGB_COLOR_REPLACE
3740import kotlin.reflect.KProperty
3841
3942// region docs
@@ -214,82 +217,6 @@ internal interface FormatDocs {
214217 */
215218 interface Grammar {
216219
217- /* *
218- * ### Definitions:
219- * `cellFormatter: `[FormattingDsl][org.jetbrains.kotlinx.dataframe.api.FormatDocs.Grammar.FormattingDslGrammarDef]`.(cell: C) -> `[CellAttributes][org.jetbrains.kotlinx.dataframe.api.CellAttributes]`?`
220- *
221- *
222- *
223- * `rowColFormatter: `[FormattingDsl][org.jetbrains.kotlinx.dataframe.api.FormatDocs.Grammar.FormattingDslGrammarDef]`.(row: `[DataRow][org.jetbrains.kotlinx.dataframe.DataRow]`<T>, col: `[DataColumn][org.jetbrains.kotlinx.dataframe.DataColumn]`<C>) -> `[CellAttributes][org.jetbrains.kotlinx.dataframe.api.CellAttributes]`?`
224- *
225- * ### Notation:
226- *
227- * [**format**][DataFrame.format]**` { `**[`columns`][SelectingColumns]**` }`**
228- *
229- *
230- * `[ `__`.`__[**`where`**][FormatClause.where]**` { `**[`filter`][SelectingRows.RowValueCondition]`: `[`RowValueFilter`][RowValueFilter]**` } `**`]`
231- *
232- *
233- * `[ `__`.`__[**`at`**][FormatClause.at]**`(`**`rowIndices: `[Collection][Collection]`<`[Int][Int]`> | `[IntRange][IntRange]` | `**`vararg`**` `[Int][Int]**`)`**` ]`
234- *
235- *
236- * `[ `__`.`__[**`notNull`**][FormatClause.notNull]**`()`**` ]`
237- *
238- *
239- * __`.`__[**`with`**][FormatClause.with]**` { `**[cellFormatter][org.jetbrains.kotlinx.dataframe.api.FormatDocs.Grammar.CellFormatterDef]**` }`**
240- *
241- *
242- * `| `__`.`__[**`notNull`**][FormatClause.notNull]**` { `**[cellFormatter][org.jetbrains.kotlinx.dataframe.api.FormatDocs.Grammar.CellFormatterDef]**` }`**
243- *
244- *
245- * `| `__`.`__[**`perRowCol`**][FormatClause.perRowCol]**` { `**[rowColFormatter][org.jetbrains.kotlinx.dataframe.api.FormatDocs.Grammar.RowColFormatterDef]**` }`**
246- *
247- *
248- * `| `__`.`__[**`linearBg`**][FormatClause.linearBg]**`(`**`from: `[Pair][Pair]`<`[Number][Number]`, `[RgbColor][RgbColor]`>`**`,`**` to: `[Pair][Pair]`<`[Number][Number]`, `[RgbColor][RgbColor]`>`**`)`**
249- *
250- * `[ `__`.`__[**format**][FormattedFrame.format]` ↺ ]`
251- *
252- *
253- *
254- * ## Formatting DSL Grammar
255- *
256- * ### Definitions:
257- * `cellAttributes: `[CellAttributes][org.jetbrains.kotlinx.dataframe.api.CellAttributes]
258- *
259- *
260- *
261- * `color: `[RgbColor][org.jetbrains.kotlinx.dataframe.api.RgbColor]
262- *
263- * ### Notation:
264- * _- Returning [CellAttributes][org.jetbrains.kotlinx.dataframe.api.CellAttributes]_:
265- *
266- * [cellAttributes][org.jetbrains.kotlinx.dataframe.api.FormatDocs.Grammar.CellAttributesDef]` `[**`and`**][org.jetbrains.kotlinx.dataframe.api.CellAttributes.and]` `[cellAttributes][org.jetbrains.kotlinx.dataframe.api.FormatDocs.Grammar.CellAttributesDef]
267- *
268- * `| `[**`italic`**][org.jetbrains.kotlinx.dataframe.api.FormattingDsl.italic]` | `[**`bold`**][org.jetbrains.kotlinx.dataframe.api.FormattingDsl.bold]` | `[**`underline`**][org.jetbrains.kotlinx.dataframe.api.FormattingDsl.underline]
269- *
270- * `| `[**`background`**][org.jetbrains.kotlinx.dataframe.api.FormattingDsl.background]**`(`**[color][org.jetbrains.kotlinx.dataframe.api.FormatDocs.Grammar.RgbColorDef]**`)`**
271- *
272- * `| `[**`background`**][org.jetbrains.kotlinx.dataframe.api.FormattingDsl.background]**`(`**`r: `[Short][Short]**`,`**` g: `[Short][Short]**`,`**` b: `[Short][Short]**`)`**
273- *
274- * `| `[**`linearBg`**][org.jetbrains.kotlinx.dataframe.api.FormattingDsl.linearBg]**`(`**`value: `[Number][Number]**`,`**` from: `[Pair][Pair]`<`[Number][Number]`, `[RgbColor][org.jetbrains.kotlinx.dataframe.api.RgbColor]`>`**`,`**` to: `[Pair][Pair]`<`[Number][Number]`, `[RgbColor][org.jetbrains.kotlinx.dataframe.api.RgbColor]`>`**`)`**
275- *
276- * `| `[**`textColor`**][org.jetbrains.kotlinx.dataframe.api.FormattingDsl.textColor]**`(`**[color][org.jetbrains.kotlinx.dataframe.api.FormatDocs.Grammar.RgbColorDef]**`)`**
277- *
278- * `| `[**`textColor`**][org.jetbrains.kotlinx.dataframe.api.FormattingDsl.textColor]**`(`**`r: `[Short][Short]**`,`**` g: `[Short][Short]**`,`**` b: `[Short][Short]**`)`**
279- *
280- * `| `[**`attr`**][org.jetbrains.kotlinx.dataframe.api.FormattingDsl.attr]**`(`**`name: `[String][String]**`,`**` value: `[String][String]**`)`**
281- *
282- * _- Returning [RgbColor][org.jetbrains.kotlinx.dataframe.api.RgbColor]:_
283- *
284- * [**`black`**][org.jetbrains.kotlinx.dataframe.api.FormattingDsl.black]` | `[**`white`**][org.jetbrains.kotlinx.dataframe.api.FormattingDsl.white]` | `[**`green`**][org.jetbrains.kotlinx.dataframe.api.FormattingDsl.green]` | `[**`red`**][org.jetbrains.kotlinx.dataframe.api.FormattingDsl.red]` | `[**`blue`**][org.jetbrains.kotlinx.dataframe.api.FormattingDsl.blue]` | `[**`gray`**][org.jetbrains.kotlinx.dataframe.api.FormattingDsl.gray]` | `[**`darkGray`**][org.jetbrains.kotlinx.dataframe.api.FormattingDsl.darkGray]` | `[**`lightGray`**][org.jetbrains.kotlinx.dataframe.api.FormattingDsl.lightGray]
285- *
286- * `| `[**`rgb`**][org.jetbrains.kotlinx.dataframe.api.FormattingDsl.rgb]**`(`**`r: `[Short][Short]**`,`**` g: `[Short][Short]**`,`**` b: `[Short][Short]**`)`**
287- *
288- * `| `[**`linear`**][org.jetbrains.kotlinx.dataframe.api.FormattingDsl.linear]**`(`**`value: `[Number][Number]**`,`**` from: `[Pair][Pair]`<`[Number][Number]`, `[RgbColor][org.jetbrains.kotlinx.dataframe.api.RgbColor]`>`**`,`**` to: `[Pair][Pair]`<`[Number][Number]`, `[RgbColor][org.jetbrains.kotlinx.dataframe.api.RgbColor]`>`**`)`**
289- */
290- @ExportAsHtml
291- interface ForHtml
292-
293220 /* *
294221 * ## Formatting DSL Grammar
295222 *
@@ -1134,14 +1061,18 @@ public typealias CellFormatter<C> = FormattingDsl.(cell: C) -> CellAttributes?
11341061 *
11351062 * Call [toHtml] or [toStandaloneHtml] to get the HTML representation of the [DataFrame].
11361063 *
1064+ * In Jupyter kernel (Kotlin Notebook) environments, you can often output this class directly.
1065+ * Use [toHtml] or [toStandaloneHtml] when this produces unexpected results.
1066+ *
11371067 * You can apply further formatting to this [FormattedFrame] by calling [format()][FormattedFrame.format] once again.
11381068 */
11391069public class FormattedFrame <T >(internal val df : DataFrame <T >, internal val formatter : RowColFormatter <T , * >? = null ) {
11401070
11411071 /* *
11421072 * Returns a [DataFrameHtmlData] without additional definitions.
1143- * Can be rendered in Jupyter kernel (Notebook) environments or other environments that already have
1073+ * Can be rendered in Jupyter kernel (Kotlin Notebook) environments or other environments that already have
11441074 * CSS- and script definitions for DataFrame.
1075+ *
11451076 * Use [toStandaloneHtml] if you need the [DataFrameHtmlData] to include CSS- and script definitions.
11461077 *
11471078 * By default, cell content is formatted as text
@@ -1157,6 +1088,8 @@ public class FormattedFrame<T>(internal val df: DataFrame<T>, internal val forma
11571088 /* *
11581089 * Returns a [DataFrameHtmlData] with CSS- and script definitions for DataFrame.
11591090 *
1091+ * Use [toHtml] if you don't need the [DataFrameHtmlData] to include CSS- and script definitions.
1092+ *
11601093 * The [DataFrameHtmlData] can be saved as an *.html file and displayed in the browser.
11611094 * If you save it as a file and find it in the project tree,
11621095 * the ["Open in browser"](https://www.jetbrains.com/help/idea/editing-html-files.html#ws_html_preview_output_procedure)
@@ -1165,6 +1098,10 @@ public class FormattedFrame<T>(internal val df: DataFrame<T>, internal val forma
11651098 * By default, cell content is formatted as text
11661099 * Use [RenderedContent.media][media] or [IMG], [IFRAME] if you need custom HTML inside a cell.
11671100 *
1101+ * __NOTE:__ In Kotlin Notebook, output [FormattedFrame] directly, or use [toHtml],
1102+ * as that environment already has CSS- and script definitions for DataFrame.
1103+ * Using [toStandaloneHtml] might produce unexpected results.
1104+ *
11681105 * @param [configuration] The [DisplayConfiguration] to use as a base for this [FormattedFrame].
11691106 * Default: [DisplayConfiguration.DEFAULT].
11701107 * @see toHtml
@@ -1213,3 +1150,21 @@ public class FormatClause<T, C>(
12131150}
12141151
12151152// endregion
1153+
1154+ // region Deprecated
1155+
1156+ @Deprecated(
1157+ message = FORMATTING_DSL ,
1158+ replaceWith = ReplaceWith (FORMATTING_DSL_REPLACE ),
1159+ level = DeprecationLevel .ERROR ,
1160+ )
1161+ public typealias FormattingDSL = FormattingDsl
1162+
1163+ @Deprecated(
1164+ message = RGB_COLOR ,
1165+ replaceWith = ReplaceWith (RGB_COLOR_REPLACE ),
1166+ level = DeprecationLevel .ERROR ,
1167+ )
1168+ public typealias RGBColor = RgbColor
1169+
1170+ // endregion
0 commit comments