plutonium 0.15.23 → 0.15.24

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,11 +8,11 @@ module Plutonium
8
8
 
9
9
  class Builder < Builder
10
10
  def association_tag(**, &)
11
- create_component(Plutonium::UI::Display::Component::AssociationField, :association, **, &)
11
+ create_component(Plutonium::UI::Display::Component::Association, :association, **, &)
12
12
  end
13
13
 
14
14
  def markdown_tag(**, &)
15
- create_component(Plutonium::UI::Display::Component::MarkdownField, :markdown, **, &)
15
+ create_component(Plutonium::UI::Display::Component::Markdown, :markdown, **, &)
16
16
  end
17
17
  end
18
18
 
@@ -4,7 +4,7 @@ module Plutonium
4
4
  module UI
5
5
  module Display
6
6
  module Component
7
- class AssociationField < Phlexi::Display::Components::Association
7
+ class Association < Phlexi::Display::Components::Association
8
8
  include Plutonium::UI::Component::Methods
9
9
 
10
10
  def render_value(value)
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "redcarpet"
4
+
5
+ module Plutonium
6
+ module UI
7
+ module Display
8
+ module Component
9
+ class Markdown < Phlexi::Display::Components::Base
10
+ include Phlexi::Display::Components::Concerns::DisplaysValue
11
+
12
+ RENDERER = Redcarpet::Markdown.new(
13
+ Redcarpet::Render::HTML.new(
14
+ safe_links_only: true, with_toc_data: true, hard_wrap: true,
15
+ link_attributes: {rel: :nofollow, target: :_blank}
16
+ ),
17
+ autolink: true, tables: true, no_intra_emphasis: true,
18
+ fenced_code_blocks: true, disable_indented_code_blocks: true,
19
+ strikethrough: true, space_after_headers: true, superscript: true,
20
+ footnotes: true, highlight: true, underline: true
21
+ )
22
+
23
+ def render_value(value)
24
+ article(**attributes) {
25
+ unsafe_raw(render_markdown(value))
26
+ }
27
+ end
28
+
29
+ private
30
+
31
+ def render_markdown(value)
32
+ RENDERER.render(
33
+ ActionController::Base.helpers.sanitize(
34
+ value,
35
+ tags: %w[strong em sub sup details summary],
36
+ attributes: []
37
+ )
38
+ )
39
+ end
40
+
41
+ def normalize_value(value)
42
+ if value.respond_to?(:to_plain_text)
43
+ value.to_plain_text
44
+ else
45
+ value.to_s
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -10,7 +10,7 @@ module Plutonium
10
10
  include Plutonium::UI::Form::Options::InferredTypes
11
11
 
12
12
  def easymde_tag(**, &)
13
- create_component(Plutonium::UI::Form::Components::EasymdeInput, :easymde, **, &)
13
+ create_component(Plutonium::UI::Form::Components::Easymde, :easymde, **, &)
14
14
  end
15
15
  alias_method :markdown_tag, :easymde_tag
16
16
 
@@ -21,7 +21,7 @@ module Plutonium
21
21
  alias_method :select_tag, :slim_select_tag
22
22
 
23
23
  def flatpickr_tag(**, &)
24
- create_component(Plutonium::UI::Form::Components::FlatpickrInput, :flatpickr, **, &)
24
+ create_component(Plutonium::UI::Form::Components::Flatpickr, :flatpickr, **, &)
25
25
  end
26
26
  end
27
27
 
@@ -4,7 +4,7 @@ module Plutonium
4
4
  module UI
5
5
  module Form
6
6
  module Components
7
- class EasymdeInput < Phlexi::Form::Components::Base
7
+ class Easymde < Phlexi::Form::Components::Base
8
8
  include Phlexi::Form::Components::Concerns::HandlesInput
9
9
 
10
10
  def view_template
@@ -4,7 +4,7 @@ module Plutonium
4
4
  module UI
5
5
  module Form
6
6
  module Components
7
- class FlatpickrInput < Phlexi::Form::Components::Input
7
+ class Flatpickr < Phlexi::Form::Components::Input
8
8
  private
9
9
 
10
10
  def build_input_attributes
@@ -1,5 +1,5 @@
1
1
  module Plutonium
2
- VERSION = "0.15.23"
2
+ VERSION = "0.15.24"
3
3
  NEXT_MAJOR_VERSION = VERSION.split(".").tap { |v|
4
4
  v[1] = v[1].to_i + 1
5
5
  v[2] = 0
data/package-lock.json CHANGED
@@ -1,16 +1,17 @@
1
1
  {
2
2
  "name": "@radioactive-labs/plutonium",
3
- "version": "0.1.12",
3
+ "version": "0.1.15",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@radioactive-labs/plutonium",
9
- "version": "0.1.12",
9
+ "version": "0.1.15",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@hotwired/stimulus": "^3.2.2",
13
13
  "@hotwired/turbo": "^8.0.4",
14
+ "dompurify": "^3.2.2",
14
15
  "flowbite": "^2.3.0",
15
16
  "lodash.debounce": "^4.0.8"
16
17
  },
@@ -1868,7 +1869,7 @@
1868
1869
  "version": "2.0.7",
1869
1870
  "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz",
1870
1871
  "integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==",
1871
- "dev": true,
1872
+ "devOptional": true,
1872
1873
  "license": "MIT"
1873
1874
  },
1874
1875
  "node_modules/@types/unist": {
@@ -3757,11 +3758,13 @@
3757
3758
  }
3758
3759
  },
3759
3760
  "node_modules/dompurify": {
3760
- "version": "3.1.6",
3761
- "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.1.6.tgz",
3762
- "integrity": "sha512-cTOAhc36AalkjtBpfG6O8JimdTMWNXjiePT2xQH/ppBGi/4uIpmj8eKyIkMJErXWARyINV/sB38yf8JCLF5pbQ==",
3763
- "dev": true,
3764
- "license": "(MPL-2.0 OR Apache-2.0)"
3761
+ "version": "3.2.2",
3762
+ "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.2.2.tgz",
3763
+ "integrity": "sha512-YMM+erhdZ2nkZ4fTNRTSI94mb7VG7uVF5vj5Zde7tImgnhZE3R6YW/IACGIHb2ux+QkEXMhe591N+5jWOmL4Zw==",
3764
+ "license": "(MPL-2.0 OR Apache-2.0)",
3765
+ "optionalDependencies": {
3766
+ "@types/trusted-types": "^2.0.7"
3767
+ }
3765
3768
  },
3766
3769
  "node_modules/domutils": {
3767
3770
  "version": "3.1.0",
@@ -4590,6 +4593,13 @@
4590
4593
  "uuid": "^9.0.1"
4591
4594
  }
4592
4595
  },
4596
+ "node_modules/mermaid/node_modules/dompurify": {
4597
+ "version": "3.1.6",
4598
+ "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.1.6.tgz",
4599
+ "integrity": "sha512-cTOAhc36AalkjtBpfG6O8JimdTMWNXjiePT2xQH/ppBGi/4uIpmj8eKyIkMJErXWARyINV/sB38yf8JCLF5pbQ==",
4600
+ "dev": true,
4601
+ "license": "(MPL-2.0 OR Apache-2.0)"
4602
+ },
4593
4603
  "node_modules/micromark-util-character": {
4594
4604
  "version": "2.1.0",
4595
4605
  "resolved": "https://registry.npmjs.org/micromark-util-character/-/micromark-util-character-2.1.0.tgz",
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@radioactive-labs/plutonium",
3
- "version": "0.1.12",
3
+ "version": "0.1.15",
4
4
  "description": "Core assets for the Plutonium gem",
5
5
  "type": "module",
6
6
  "main": "src/js/core.js",
@@ -20,6 +20,7 @@
20
20
  "dependencies": {
21
21
  "@hotwired/stimulus": "^3.2.2",
22
22
  "@hotwired/turbo": "^8.0.4",
23
+ "dompurify": "^3.2.2",
23
24
  "flowbite": "^2.3.0",
24
25
  "lodash.debounce": "^4.0.8"
25
26
  },
data/src/css/easymde.css CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * EasyMDE + CodeMirror Styles
3
- * Based on easymde v2.18.0
4
- * Adapted for Tailwind with dark mode support
3
+ * Based on https://cdn.jsdelivr.net/npm/easymde@2.18.0/dist/easymde.min.css
4
+ * Adapted for Flowbite with dark mode support
5
5
  */
6
6
 
7
7
  @layer components {
@@ -304,47 +304,68 @@
304
304
  }
305
305
 
306
306
  .cm-s-easymde .cm-quote {
307
- @apply text-green-700 dark:text-green-400;
307
+ @apply text-gray-900 dark:text-white;
308
308
  }
309
309
 
310
310
  .cm-s-easymde .cm-keyword {
311
- @apply text-purple-600 dark:text-purple-400;
311
+ @apply text-gray-900 dark:text-white;
312
312
  }
313
313
 
314
314
  .cm-s-easymde .cm-atom {
315
- @apply text-blue-800 dark:text-blue-300;
315
+ @apply text-gray-900 dark:text-white;
316
316
  }
317
317
 
318
318
  .cm-s-easymde .cm-number {
319
- @apply text-green-800 dark:text-green-300;
319
+ @apply text-gray-900 dark:text-white;
320
320
  }
321
321
 
322
322
  .cm-s-easymde .cm-def {
323
- @apply text-blue-600 dark:text-blue-400;
323
+ @apply text-gray-900 dark:text-white;
324
324
  }
325
325
 
326
326
  .cm-s-easymde .cm-variable {
327
- @apply text-gray-800 dark:text-gray-300;
327
+ @apply text-gray-900 dark:text-white;
328
328
  }
329
329
 
330
330
  .cm-s-easymde .cm-variable-2 {
331
- @apply text-blue-700 dark:text-blue-300;
331
+ @apply text-gray-900 dark:text-white;
332
332
  }
333
333
 
334
334
  .cm-s-easymde .cm-variable-3 {
335
- @apply text-teal-700 dark:text-teal-300;
335
+ @apply text-gray-900 dark:text-white;
336
+ }
337
+
338
+ .cm-formatting.cm-formatting-list {
339
+ @apply text-gray-900 dark:text-white;
340
+ }
341
+
342
+ .cm-formatting.cm-formatting-link {
343
+ @apply text-secondary-900 dark:text-secondary-400 !important;
344
+ }
345
+
346
+ .cm-formatting.cm-formatting-link-string {
347
+ @apply text-secondary-900 dark:text-secondary-400 !important;
348
+ }
349
+
350
+
351
+ .cm-s-easymde .cm-string {
352
+ @apply text-accent-600 dark:text-accent-400;
336
353
  }
337
354
 
338
- .cm-s-easymde .cm-link {
339
- @apply text-secondary-700 dark:text-secondary-300;
355
+ .cm-s-easymde .cm-string.cm-url {
356
+ @apply text-accent-600 dark:text-accent-400;
340
357
  }
341
358
 
359
+ /* .cm-s-easymde .cm-link {
360
+ @apply text-accent-600 dark:text-accent-400;
361
+ } */
362
+
342
363
  .cm-s-easymde .cm-url {
343
- @apply text-primary-700 dark:text-primary-300;
364
+ @apply text-gray-900 dark:text-white;
344
365
  }
345
366
 
346
367
  .cm-s-easymde .cm-string-2 {
347
- @apply text-orange-600 dark:text-orange-300;
368
+ @apply text-gray-900 dark:text-white;
348
369
  }
349
370
 
350
371
  .cm-s-easymde .cm-comment {
@@ -360,7 +381,7 @@
360
381
  }
361
382
 
362
383
  .cm-s-easymde .cm-attribute {
363
- color: #795da3;
384
+ @apply text-secondary-600 dark:text-secondary-400;
364
385
  }
365
386
 
366
387
  .cm-s-easymde .cm-error {
@@ -467,19 +488,6 @@
467
488
  direction: rtl;
468
489
  }
469
490
 
470
- /* Selection Styles */
471
- /* .CodeMirror-line::selection,
472
- .CodeMirror-line>span::selection,
473
- .CodeMirror-line>span>span::selection {
474
- @apply bg-accent-100 dark:bg-accent-900/30;
475
- }
476
-
477
- .CodeMirror-line::-moz-selection,
478
- .CodeMirror-line>span::-moz-selection,
479
- .CodeMirror-line>span>span::-moz-selection {
480
- @apply bg-accent-100 dark:bg-accent-900/30;
481
- } */
482
-
483
491
  .CodeMirror-selectedtext {
484
492
  @apply bg-gray-200/70 dark:bg-gray-600/50;
485
493
  }
@@ -553,6 +561,10 @@
553
561
  @apply outline-none;
554
562
  }
555
563
 
564
+ .cm-tab {
565
+ @apply inline-block no-underline;
566
+ }
567
+
556
568
  /* Fix for tab character rendering */
557
569
  .cm-tab-wrap-hack:after {
558
570
  content: '';
@@ -646,4 +658,69 @@
646
658
  -webkit-font-smoothing: antialiased;
647
659
  -moz-osx-font-smoothing: grayscale;
648
660
  }
661
+
662
+ /* Typography Styles */
663
+ .cm-s-easymde .cm-header {
664
+ @apply text-gray-900 dark:text-white;
665
+ }
666
+
667
+ /* Focus/Selection Styles */
668
+ .CodeMirror-line::selection,
669
+ .CodeMirror-line>span::selection,
670
+ .CodeMirror-line>span>span::selection {
671
+ @apply bg-primary-100 dark:bg-primary-900/30;
672
+ }
673
+
674
+ .CodeMirror-line::-moz-selection,
675
+ .CodeMirror-line>span::-moz-selection,
676
+ .CodeMirror-line>span>span::-moz-selection {
677
+ @apply bg-primary-100 dark:bg-primary-900/30;
678
+ }
679
+
680
+ /* Tag Match Styles */
681
+ .CodeMirror-matchingtag {
682
+ @apply bg-yellow-200/30 dark:bg-yellow-900/30;
683
+ }
684
+
685
+ /* Search Highlight Styles */
686
+ .cm-searching {
687
+ @apply bg-yellow-200/40 dark:bg-yellow-900/40;
688
+ }
689
+
690
+ /* Ruler Styles */
691
+ .CodeMirror-rulers {
692
+ @apply absolute inset-x-0 -top-[50px] bottom-0 overflow-hidden;
693
+ }
694
+
695
+ .CodeMirror-ruler {
696
+ @apply border-l border-gray-300 dark:border-gray-600 top-0 bottom-0 absolute;
697
+ }
698
+
699
+ /* Editor Preview Full */
700
+ .editor-preview-full {
701
+ @apply absolute w-full h-full top-0 left-0 z-[7] overflow-auto hidden box-border;
702
+ }
703
+
704
+ /* Add active state for full preview */
705
+ .editor-preview-active {
706
+ @apply block;
707
+ }
708
+
709
+ /* Preview content specific styles */
710
+ .editor-preview-full {
711
+ @apply p-2.5 bg-gray-50 dark:bg-gray-900 format dark:format-invert format-primary max-w-none;
712
+ }
713
+
714
+ .editor-preview-full>p {
715
+ @apply mt-0;
716
+ }
717
+
718
+ .editor-preview-full pre {
719
+ @apply bg-gray-100 dark:bg-gray-800 mb-2.5;
720
+ }
721
+
722
+ .editor-preview-full table td,
723
+ .editor-preview-full table th {
724
+ @apply border border-gray-300 dark:border-gray-600 p-1.5;
725
+ }
649
726
  }
@@ -1,3 +1,9 @@
1
+ /**
2
+ * Slim Select Styles
3
+ * Based on https://cdn.jsdelivr.net/npm/slim-select@2.10.0/dist/slimselect.min.css
4
+ * Adapted for Flowbite with dark mode support
5
+ */
6
+
1
7
  @layer components {
2
8
  :root {
3
9
  --ss-primary-color: theme('colors.primary.500');
@@ -1,14 +1,52 @@
1
1
  import { Controller } from "@hotwired/stimulus"
2
+ import DOMPurify from 'dompurify';
3
+ import { marked } from 'marked';
2
4
 
3
5
  // Connects to data-controller="easymde"
4
6
  export default class extends Controller {
5
7
  connect() {
6
8
  console.log(`easymde connected: ${this.element}`)
7
- self.easyMDE = new EasyMDE({ element: this.element })
9
+ self.easyMDE = new EasyMDE(this.#buildOptions())
10
+ this.element.setAttribute("data-action", "turbo:morph-element->easymde#reconnect")
8
11
  }
9
12
 
10
13
  disconnect() {
11
14
  self.easyMDE.toTextArea()
12
15
  self.easyMDE = null
13
16
  }
17
+
18
+ reconnect() {
19
+ this.disconnect()
20
+ this.connect()
21
+ }
22
+
23
+ #buildOptions() {
24
+ let options = {
25
+ element: this.element,
26
+ promptURLs: true,
27
+ spellChecker: false,
28
+ // Override the default preview renderer
29
+ previewRender: (plainText) => {
30
+ // First sanitize the input to remove any undesired HTML
31
+ const cleanedText = DOMPurify.sanitize(plainText, {
32
+ ALLOWED_TAGS: ['strong', 'em', 'sub', 'sup', 'details', 'summary'],
33
+ ALLOWED_ATTR: []
34
+ });
35
+
36
+ // Then convert markdown to HTML
37
+ const cleanedHTML = marked(cleanedText);
38
+
39
+ // Finally, another pass, since marked does not sanitize html
40
+ return DOMPurify.sanitize(cleanedHTML, { USE_PROFILES: { html: true } })
41
+ }
42
+ }
43
+ if (this.element.attributes.id.value) {
44
+ options.autosave = {
45
+ enabled: true,
46
+ uniqueId: this.element.attributes.id.value,
47
+ delay: 1000,
48
+ }
49
+ }
50
+ return options
51
+ }
14
52
  }
@@ -5,6 +5,7 @@ export default class extends Controller {
5
5
  connect() {
6
6
  console.log(`flatpickr connected: ${this.element}`)
7
7
  self.picker = new flatpickr(this.element, this.#buildOptions())
8
+ this.element.setAttribute("data-action", "turbo:morph-element->flatpickr#reconnect")
8
9
  }
9
10
 
10
11
  disconnect() {
@@ -12,6 +13,11 @@ export default class extends Controller {
12
13
  self.picker = null
13
14
  }
14
15
 
16
+ reconnect() {
17
+ this.disconnect()
18
+ this.connect()
19
+ }
20
+
15
21
  #buildOptions() {
16
22
  let options = { altInput: true }
17
23
  if (this.element.attributes.type.value == "datetime-local") {
@@ -7,10 +7,16 @@ export default class extends Controller {
7
7
  self.slimSelect = new SlimSelect({
8
8
  select: this.element
9
9
  })
10
+ this.element.setAttribute("data-action", "turbo:morph-element->slim-select#reconnect")
10
11
  }
11
12
 
12
13
  disconnect() {
13
14
  self.slimSelect.destroy()
14
15
  self.slimSelect = null
15
16
  }
17
+
18
+ reconnect() {
19
+ this.disconnect()
20
+ this.connect()
21
+ }
16
22
  }
data/tailwind.options.js CHANGED
@@ -29,42 +29,44 @@ export const theme = {
29
29
  typography: ({ theme }) => ({
30
30
  primary: {
31
31
  css: {
32
- '--tw-prose-body': theme('colors.secondary.700'),
33
- '--tw-prose-headings': theme('colors.secondary.900'),
34
- '--tw-prose-lead': theme('colors.secondary.600'),
35
- '--tw-prose-links': theme('colors.primary.600'),
36
- '--tw-prose-bold': theme('colors.secondary.900'),
37
- '--tw-prose-counters': theme('colors.primary.500'),
38
- '--tw-prose-bullets': theme('colors.primary.500'),
39
- '--tw-prose-hr': theme('colors.primary.200'),
40
- '--tw-prose-quotes': theme('colors.secondary.900'),
41
- '--tw-prose-quote-borders': theme('colors.primary.300'),
42
- '--tw-prose-captions': theme('colors.secondary.700'),
43
- '--tw-prose-code': theme('colors.secondary.900'),
32
+ '--tw-prose-body': theme('colors.gray.900'),
33
+ '--tw-prose-headings': theme('colors.gray.900'),
34
+ '--tw-prose-lead': theme('colors.gray.600'),
35
+ '--tw-prose-links': theme('colors.primary.700'),
36
+ '--tw-prose-bold': theme('colors.gray.900'),
37
+ '--tw-prose-counters': theme('colors.gray.600'),
38
+ '--tw-prose-bullets': theme('colors.gray.600'),
39
+ '--tw-prose-hr': theme('colors.gray.200'),
40
+ '--tw-prose-quotes': theme('colors.gray.900'),
41
+ '--tw-prose-quote-borders': theme('colors.gray.300'),
42
+ '--tw-prose-captions': theme('colors.gray.700'),
43
+ '--tw-prose-code': theme('colors.gray.900'),
44
44
  '--tw-prose-code-bg': theme('colors.primary.50'),
45
45
  '--tw-prose-pre-code': theme('colors.primary.100'),
46
- '--tw-prose-pre-bg': theme('colors.secondary.900'),
47
- '--tw-prose-th-borders': theme('colors.primary.300'),
48
- '--tw-prose-td-borders': theme('colors.primary.200'),
49
- '--tw-prose-th-bg': theme('colors.primary.50'),
46
+ '--tw-prose-pre-bg': theme('colors.gray.900'),
47
+ '--tw-prose-th-borders': theme('colors.gray.300'),
48
+ '--tw-prose-td-borders': theme('colors.gray.200'),
49
+ '--tw-prose-th-bg': theme('colors.gray.100'),
50
+
50
51
  // Dark mode
51
- '--tw-prose-invert-body': theme('colors.primary.200'),
52
- '--tw-prose-invert-headings': theme('colors.white'),
53
- '--tw-prose-invert-lead': theme('colors.primary.300'),
54
- '--tw-prose-invert-links': theme('colors.primary.400'),
55
- '--tw-prose-invert-bold': theme('colors.white'),
56
- '--tw-prose-invert-counters': theme('colors.primary.400'),
57
- '--tw-prose-invert-bullets': theme('colors.primary.600'),
58
- '--tw-prose-invert-hr': theme('colors.primary.700'),
59
- '--tw-prose-invert-quotes': theme('colors.primary.100'),
60
- '--tw-prose-invert-quote-borders': theme('colors.primary.700'),
61
- '--tw-prose-invert-captions': theme('colors.primary.400'),
62
- '--tw-prose-invert-code': theme('colors.white'),
63
- '--tw-prose-invert-pre-code': theme('colors.primary.300'),
64
- '--tw-prose-invert-pre-bg': 'rgb(0 0 0 / 50%)',
65
- '--tw-prose-invert-th-borders': theme('colors.primary.600'),
66
- '--tw-prose-invert-td-borders': theme('colors.primary.700'),
67
- '--tw-prose-invert-th-bg': theme('colors.primary.700'),
52
+ '--tw-prose-invert-body': theme('colors.white'),
53
+ '--tw-prose-invert-headings': theme('colors.secondary.100'),
54
+ '--tw-prose-invert-lead': theme('colors.secondary.400'),
55
+ '--tw-prose-invert-links': theme('colors.primary.500'),
56
+ '--tw-prose-invert-bold': theme('colors.secondary.100'),
57
+ '--tw-prose-invert-counters': theme('colors.gray.400'),
58
+ '--tw-prose-invert-bullets': theme('colors.gray.400'),
59
+ '--tw-prose-invert-hr': theme('colors.primary.800'),
60
+ '--tw-prose-invert-quotes': theme('colors.secondary.100'),
61
+ '--tw-prose-invert-quote-borders': theme('colors.gray.500'),
62
+ '--tw-prose-invert-captions': theme('colors.secondary.300'),
63
+ '--tw-prose-invert-code': theme('colors.secondary.100'),
64
+ '--tw-prose-invert-code-bg': theme('colors.primary.950'),
65
+ '--tw-prose-invert-pre-code': theme('colors.primary.900'),
66
+ '--tw-prose-invert-pre-bg': theme('colors.secondary.100'),
67
+ '--tw-prose-invert-th-borders': theme('colors.gray.600'),
68
+ '--tw-prose-invert-td-borders': theme('colors.gray.700'),
69
+ '--tw-prose-invert-th-bg': theme('colors.gray.800'),
68
70
  },
69
71
  },
70
72
  }),
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plutonium
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.23
4
+ version: 0.15.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Froelich
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-11-30 00:00:00.000000000 Z
11
+ date: 2024-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: zeitwerk
@@ -1400,16 +1400,16 @@ files:
1400
1400
  - lib/plutonium/ui/component/kit.rb
1401
1401
  - lib/plutonium/ui/component/methods.rb
1402
1402
  - lib/plutonium/ui/display/base.rb
1403
- - lib/plutonium/ui/display/component/association_field.rb
1404
- - lib/plutonium/ui/display/component/markdown_field.rb
1403
+ - lib/plutonium/ui/display/component/association.rb
1404
+ - lib/plutonium/ui/display/component/markdown.rb
1405
1405
  - lib/plutonium/ui/display/resource.rb
1406
1406
  - lib/plutonium/ui/display/theme.rb
1407
1407
  - lib/plutonium/ui/dyna_frame/content.rb
1408
1408
  - lib/plutonium/ui/dyna_frame/host.rb
1409
1409
  - lib/plutonium/ui/empty_card.rb
1410
1410
  - lib/plutonium/ui/form/base.rb
1411
- - lib/plutonium/ui/form/components/easymde_input.rb
1412
- - lib/plutonium/ui/form/components/flatpickr_input.rb
1411
+ - lib/plutonium/ui/form/components/easymde.rb
1412
+ - lib/plutonium/ui/form/components/flatpickr.rb
1413
1413
  - lib/plutonium/ui/form/concerns/renders_nested_resource_fields.rb
1414
1414
  - lib/plutonium/ui/form/interaction.rb
1415
1415
  - lib/plutonium/ui/form/options/inferred_types.rb
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "redcarpet"
4
-
5
- module Plutonium
6
- module UI
7
- module Display
8
- module Component
9
- class MarkdownField < Phlexi::Display::Components::Base
10
- include Phlexi::Display::Components::Concerns::DisplaysValue
11
-
12
- RENDERER = Redcarpet::Markdown.new(Redcarpet::Render::HTML, autolink: true, tables: true)
13
-
14
- def render_value(value)
15
- article(**attributes) do
16
- unsafe_raw RENDERER.render(value)
17
- end
18
- end
19
-
20
- private
21
-
22
- def normalize_value(value)
23
- if value.respond_to?(:to_plain_text)
24
- value.to_plain_text
25
- else
26
- value.to_s
27
- end
28
- end
29
- end
30
- end
31
- end
32
- end
33
- end