bullet_train-themes-light 1.19.2 → 1.20.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.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/light/fields/code_editor.css +10 -0
- data/app/assets/stylesheets/light/fields/index.css +1 -0
- data/app/views/showcase/previews/field_partials/_code_editor.html.erb +56 -0
- data/app/views/showcase/previews/field_partials/attribute_partials/_code_snippet.html.erb +21 -0
- data/app/views/themes/light/fields/_code_editor.html.erb +54 -0
- data/lib/bullet_train/themes/light/version.rb +1 -1
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e9dceda78f3784f0ef0c87e6433ae5b52f90a603189159f5d2e14f14829a3f5
|
4
|
+
data.tar.gz: 0b09bd6809c5f25257abcf73fa73e30a4b62dc965023538fd787d15384c05152
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5493a162466b1c77a0e378ec657c83dd2374d7aea3fefe3d5457c219128acc6d3bee9ae0c0aa1f0012a97f9f2cb590e3443972a147601e998322cc051ec2cb52
|
7
|
+
data.tar.gz: 0d1013a3af1bb4377861babc501a35420fe3249d4cdebd4b69ac7f867611c9237f7e09d3100c459366d3e767f0ab779295127ff7bf8f24cc8518d9e00ab973e1
|
@@ -0,0 +1,56 @@
|
|
1
|
+
<%= render "showcase/previews/field_partials/about_field_partials", showcase: showcase do |form| %>
|
2
|
+
<% showcase.description do %>
|
3
|
+
<p>The code editor field is a custom field that allows you to edit code in a monaco editor, which supports a <a target="_blank" href="https://github.com/microsoft/monaco-editor/tree/main/src/basic-languages">wide range of programming languages</a>.</p>
|
4
|
+
<p class="mt-2">
|
5
|
+
<strong>Note:</strong>
|
6
|
+
The code editor loads the Monaco editor from a CDN on first load. If the CDN is not available, the code editor
|
7
|
+
will fall back to a plain text area.
|
8
|
+
</p>
|
9
|
+
<% end %>
|
10
|
+
|
11
|
+
<% showcase.sample "CSS Example (Default Language)" do %>
|
12
|
+
<%
|
13
|
+
code_field = :text_area_value
|
14
|
+
form.object.text_area_value = <<~CSS
|
15
|
+
.example {
|
16
|
+
color: red;
|
17
|
+
}
|
18
|
+
CSS
|
19
|
+
%>
|
20
|
+
<%= render 'shared/fields/code_editor', form: form, method: code_field %>
|
21
|
+
<% end %>
|
22
|
+
|
23
|
+
<% showcase.sample "JS Example" do %>
|
24
|
+
<%
|
25
|
+
code_field = :text_area_value
|
26
|
+
form.object.text_area_value = <<~JS
|
27
|
+
import { Component } from "@hotwired/stimulus"
|
28
|
+
|
29
|
+
export default class extends Component {
|
30
|
+
connect() {
|
31
|
+
console.log("Hello, world!");
|
32
|
+
}
|
33
|
+
}
|
34
|
+
JS
|
35
|
+
%>
|
36
|
+
<%= render 'shared/fields/code_editor', form: form, method: code_field, language: :javascript %>
|
37
|
+
<% end %>
|
38
|
+
|
39
|
+
<% showcase.sample "HTML Example" do %>
|
40
|
+
<%
|
41
|
+
code_field = :text_area_value
|
42
|
+
form.object.text_area_value = <<~HTML
|
43
|
+
<div class="example">Hello, world!</div>
|
44
|
+
HTML
|
45
|
+
%>
|
46
|
+
<%= render 'shared/fields/code_editor', form: form, method: code_field, language: :html %>
|
47
|
+
<% end %>
|
48
|
+
|
49
|
+
<% showcase.options do |o| %>
|
50
|
+
<% o.optional :language, "The <a target=\"_blank\" href=\"https://github.com/microsoft/monaco-editor/tree/main/src/basic-languages\">coding language</a> of the editor".html_safe, default: "css" %>
|
51
|
+
<% o.optional :theme_light, "The theme of the editor in light mode", default: "vs" %>
|
52
|
+
<% o.optional :theme_dark, "The theme of the editor in dark mode", default: "vs-dark" %>
|
53
|
+
<% o.optional :monaco_config, "Extra config properties to pass to the monaco editor" %>
|
54
|
+
<% o.optional :code_field_options, "Options to pass to the wrapper div of the code editor e.g. for custom data-action properties" %>
|
55
|
+
<% end %>
|
56
|
+
<% end %>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<%= render "showcase/previews/field_partials/attribute_partials/about_attribute_partials", showcase: showcase do |partial| %>
|
2
|
+
<% partial.body do |object| %>
|
3
|
+
<% showcase.sample "CSS example" do %>
|
4
|
+
<%
|
5
|
+
object.text_area_value = <<~CSS
|
6
|
+
h1 {
|
7
|
+
font-size: 3em;
|
8
|
+
color: red;
|
9
|
+
text-transform: uppercase;
|
10
|
+
font-family: Futura, sans-serif;
|
11
|
+
margin-bottom: 3em;
|
12
|
+
line-height: 1;
|
13
|
+
max-inline-size: 50ch;
|
14
|
+
text-wrap: balance;
|
15
|
+
}
|
16
|
+
CSS
|
17
|
+
%>
|
18
|
+
<%= render 'shared/attributes/code_snippet', object: object, strategy: :label, attribute: :text_area_value %>
|
19
|
+
<% end %>
|
20
|
+
<% end %>
|
21
|
+
<% end %>
|
@@ -0,0 +1,54 @@
|
|
1
|
+
<%
|
2
|
+
stimulus_controller = "fields--code-editor"
|
3
|
+
form ||= current_fields_form
|
4
|
+
options ||= {}
|
5
|
+
other_options ||= {}
|
6
|
+
|
7
|
+
language ||= "css" # See https://github.com/microsoft/monaco-editor/tree/main/src/basic-languages
|
8
|
+
monaco_config ||= {}
|
9
|
+
theme_light ||= "vs"
|
10
|
+
theme_dark ||= "vs-dark"
|
11
|
+
|
12
|
+
wrapper_options ||= {}
|
13
|
+
wrapper_options[:class] ||= ""
|
14
|
+
wrapper_options[:class] += " code-editor"
|
15
|
+
wrapper_options[:data] ||= {}
|
16
|
+
wrapper_options[:data][:controller] ||= ""
|
17
|
+
wrapper_options[:data][:controller] += " #{stimulus_controller}"
|
18
|
+
wrapper_options[:data]["#{stimulus_controller}-language-value"] = language
|
19
|
+
wrapper_options[:data]["#{stimulus_controller}-theme-light-value"] = theme_light
|
20
|
+
wrapper_options[:data]["#{stimulus_controller}-theme-dark-value"] = theme_dark
|
21
|
+
wrapper_options[:data]["#{stimulus_controller}-monaco-config-value"] = monaco_config if monaco_config.present?
|
22
|
+
|
23
|
+
field_class = "min-h-32 w-full text-base md:text-[0.75rem] font-mono text-input px-0 "
|
24
|
+
field_class += " bg-[color:--code-editor-background] [--code-editor-background:theme('colors.slate.50')] dark:[--code-editor-background:theme('colors.slate.800')]"
|
25
|
+
field_class += " block rounded-md shadow-sm font-light dark:text-slate-300"
|
26
|
+
field_class += " disabled:[--code-editor-background:theme('colors.slate.200')] disabled:dark:[--code-editor-background:theme('colors.slate.700')]"
|
27
|
+
field_class += " focus:ring-primary-500 focus:border-primary-500 border-slate-300 dark:border-slate-900"
|
28
|
+
|
29
|
+
plain_field_options ||= {}
|
30
|
+
plain_field_options[:class] ||= ""
|
31
|
+
plain_field_options[:class] += "hidden #{field_class} p-0 pl-3"
|
32
|
+
plain_field_options[:data] ||= {}
|
33
|
+
plain_field_options[:data]["#{stimulus_controller}-target"] = "plainField"
|
34
|
+
plain_field_options[:spellcheck] = :false
|
35
|
+
plain_field_options[:autocomplete] = :off
|
36
|
+
plain_field_options[:autocorrect] = :off
|
37
|
+
plain_field_options[:autocapitalize] = :off
|
38
|
+
|
39
|
+
code_field_options ||= {}
|
40
|
+
code_field_options[:class] ||= ""
|
41
|
+
code_field_options[:class] += " #{field_class}"
|
42
|
+
code_field_options[:data] ||= {}
|
43
|
+
code_field_options[:data]["#{stimulus_controller}-target"] = "codeField"
|
44
|
+
code_field_options[:data][:action] ||= ""
|
45
|
+
%>
|
46
|
+
|
47
|
+
<%= tag.div(**wrapper_options) do %>
|
48
|
+
<%= render 'shared/fields/field', form: form, method: method, options: options, other_options: other_options do %>
|
49
|
+
<% content_for :field do %>
|
50
|
+
<%= form.text_area method, plain_field_options %>
|
51
|
+
<%= tag.div(**code_field_options) %>
|
52
|
+
<% end %>
|
53
|
+
<% end %>
|
54
|
+
<% end %>
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bullet_train-themes-light
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.20.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Culver
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: standard
|
@@ -99,6 +99,7 @@ files:
|
|
99
99
|
- app/assets/stylesheets/light/docs.css
|
100
100
|
- app/assets/stylesheets/light/electron.css
|
101
101
|
- app/assets/stylesheets/light/fields/cloudinary_image.css
|
102
|
+
- app/assets/stylesheets/light/fields/code_editor.css
|
102
103
|
- app/assets/stylesheets/light/fields/date_field.css
|
103
104
|
- app/assets/stylesheets/light/fields/index.css
|
104
105
|
- app/assets/stylesheets/light/fields/phone_field.css
|
@@ -166,6 +167,7 @@ files:
|
|
166
167
|
- app/views/showcase/previews/field_partials/_address_field.html.erb
|
167
168
|
- app/views/showcase/previews/field_partials/_buttons.html.erb
|
168
169
|
- app/views/showcase/previews/field_partials/_cloudinary_image.html.erb
|
170
|
+
- app/views/showcase/previews/field_partials/_code_editor.html.erb
|
169
171
|
- app/views/showcase/previews/field_partials/_color_picker.html.erb
|
170
172
|
- app/views/showcase/previews/field_partials/_date_and_time_field.html.erb
|
171
173
|
- app/views/showcase/previews/field_partials/_date_field.html.erb
|
@@ -183,6 +185,7 @@ files:
|
|
183
185
|
- app/views/showcase/previews/field_partials/_trix_editor.html.erb
|
184
186
|
- app/views/showcase/previews/field_partials/attribute_partials/_about_attribute_partials.html.erb
|
185
187
|
- app/views/showcase/previews/field_partials/attribute_partials/_address.html.erb
|
188
|
+
- app/views/showcase/previews/field_partials/attribute_partials/_code_snippet.html.erb
|
186
189
|
- app/views/showcase/previews/partials/_alert.html.erb
|
187
190
|
- app/views/showcase/previews/partials/_box.html.erb
|
188
191
|
- app/views/showcase/previews/partials/_breadcrumb.html.erb
|
@@ -226,6 +229,7 @@ files:
|
|
226
229
|
- app/views/themes/light/conversations/_comment.html.erb
|
227
230
|
- app/views/themes/light/conversations/_message.html.erb
|
228
231
|
- app/views/themes/light/conversations/_thread_border.html.erb
|
232
|
+
- app/views/themes/light/fields/_code_editor.html.erb
|
229
233
|
- app/views/themes/light/fields/_field.html.erb
|
230
234
|
- app/views/themes/light/forms/_errors.html.erb
|
231
235
|
- app/views/themes/light/layouts/_account.html.erb
|
@@ -282,7 +286,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
282
286
|
- !ruby/object:Gem::Version
|
283
287
|
version: '0'
|
284
288
|
requirements: []
|
285
|
-
rubygems_version: 3.6.
|
289
|
+
rubygems_version: 3.6.7
|
286
290
|
specification_version: 4
|
287
291
|
summary: 'Bullet Train Themes: Light'
|
288
292
|
test_files: []
|