svelte-on-rails 0.0.40 → 0.0.41
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/templates/rails_vite_hello_world/app/controllers/svelte_on_rails_hello_world_controller.rb +6 -0
- data/templates/rails_vite_hello_world/app/frontend/images/atom.svg +1 -0
- data/templates/rails_vite_hello_world/app/frontend/images/check-circle-green.png +0 -0
- data/templates/rails_vite_hello_world/app/frontend/images/svg.svg +3 -0
- data/templates/rails_vite_hello_world/app/frontend/javascript/components/Pug.svelte +14 -0
- data/templates/rails_vite_hello_world/app/frontend/javascript/components/SvelteOnRailsHelloWorld.svelte +66 -0
- data/templates/rails_vite_hello_world/app/frontend/javascript/components/sub/NestedComponent.svelte +1 -0
- data/templates/rails_vite_hello_world/app/frontend/javascript/nestedJavascript.js +3 -0
- data/templates/rails_vite_hello_world/app/frontend/javascript/nestedJavascriptToggled.js +3 -0
- data/templates/rails_vite_hello_world/app/views/svelte_on_rails_hello_world/index.html.erb +5 -0
- data/templates/svelte_on_rails_vite_base/app/frontend/initializers/svelte.js +18 -0
- data/templates/svelte_on_rails_vite_base/config/svelte_on_rails.yml +23 -0
- metadata +13 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 683e0e4881fc72969224d9792ba06ff4049c19adbcf55bc8e0ba817ba4be48d4
|
4
|
+
data.tar.gz: 6a9ed00119ddbdb2b9a095458b010150ecd938d751e9112b26629343bc782656
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a166ff91777a7969f50874feb855c522aeac968dae0c6f1659b92ced9ac461683cbac34eee6f3999b961db6669732dbcbea41d3f659f621a3c198fc6b3204e76
|
7
|
+
data.tar.gz: dd7c49785a50f484c936fbac6f5a8000fc46d6fc7165113c55a7e437b4b2ac20a05a1da4d9311b24d8757d307fa14061c35b2fdf607614502bd6ff24aa0ee948
|
@@ -0,0 +1 @@
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.0.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M256 224C238.3 224 223.1 238.4 223.1 256S238.3 288 256 288c17.62 0 32-14.38 32-32C287.9 238.4 273.6 224 256 224zM471.2 128c-15.62-27.75-49.62-41.38-93.11-41.38c-9.499 .125-18.87 .75-28.25 2C327.1 34.38 293.5 0 256 0S184.9 34.38 162.1 88.62c-9.374-1.25-18.75-1.875-28.25-2C90.39 86.62 56.4 100.2 40.78 128c-18.75 33.5-6.499 80.62 27.62 128c-34.12 47.38-46.37 94.5-27.62 128c15.62 27.75 49.62 41.38 93.11 41.38c9.499-.125 18.87-.75 28.25-2C184.9 477.6 218.5 512 256 512s71.12-34.38 93.86-88.63c9.374 1.25 18.75 1.875 28.25 2c43.49 0 77.49-13.62 93.11-41.38c18.75-33.5 6.499-80.63-27.62-128C477.7 208.6 489.1 161.5 471.2 128zM256 48c14.37 0 32.12 18.12 47.12 50C287.1 102.4 271.4 107.8 256 114.1c-15.37-6.375-31.12-11.76-47.12-16.14C223.9 66.12 241.6 48 256 48zM133.9 377.4c-26.5 0-46.74-6.625-52.74-17.38c-7.124-12.75-.5-37.63 18.62-66.63C111.4 305.2 123.8 316.5 136.8 327c2.25 16.5 5.374 33 9.624 49.13C142.3 376.4 137.9 377.4 133.9 377.4zM136.8 185C123.8 195.5 111.4 206.8 99.77 218.6C80.65 189.6 74.02 164.8 81.15 152c5.999-10.75 26.25-17.38 52.74-17.38c3.1 0 8.374 1 12.5 1.25C142.1 152 139 168.5 136.8 185zM256 464c-14.37 0-32.12-18.12-47.12-49.1C224.9 409.6 240.6 404.2 256 397.9c15.37 6.375 31.12 11.76 47.12 16.14C288.1 445.9 270.4 464 256 464zM256 352c-52.99 0-95.99-43-95.99-96S203 160 256 160s95.99 43 95.99 96S308.1 352 256 352zM430.9 360c-5.999 10.75-26.25 17.38-52.74 17.38c-3.1 0-8.374-1-12.5-1.25C369.9 360 372.1 343.5 375.2 327c12.1-10.5 25.37-21.75 36.1-33.63C431.4 322.4 437.1 347.2 430.9 360zM412.2 218.6C400.6 206.8 388.2 195.5 375.2 185C372.1 168.5 369.9 152 365.6 135.9c4.125-.25 8.499-1.25 12.5-1.25c26.5 0 46.74 6.625 52.74 17.38C437.1 164.8 431.4 189.6 412.2 218.6z"/></svg>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<script>
|
2
|
+
export let notice
|
3
|
+
let ary = ['item-1', 'item-2', 'item-3']
|
4
|
+
</script>
|
5
|
+
|
6
|
+
<template lang="pug">
|
7
|
+
h1 Hello, Pug!
|
8
|
+
p {notice}
|
9
|
+
ul
|
10
|
+
<!-- The | Syntax is a workaround for situations where pug integration in svelte is not working really well-->
|
11
|
+
| {#each ary as item}
|
12
|
+
| <li>{item}</li>
|
13
|
+
| {/each}
|
14
|
+
</template>
|
@@ -0,0 +1,66 @@
|
|
1
|
+
<script>
|
2
|
+
import svgRaw from '../../images/svg.svg?raw'
|
3
|
+
//import svg from '../../images/svg.svg'
|
4
|
+
import png from '../../images/check-circle-green.png'
|
5
|
+
import Nested from './sub/NestedComponent.svelte'
|
6
|
+
import {nestedJavascriptFunction} from '../nestedJavascript.js'
|
7
|
+
export let items
|
8
|
+
let count = 0;
|
9
|
+
|
10
|
+
function increment() {
|
11
|
+
count += 1;
|
12
|
+
}
|
13
|
+
</script>
|
14
|
+
|
15
|
+
<span class="svelte-component-wrapper">
|
16
|
+
<h1>Svelte is here!!</h1>
|
17
|
+
|
18
|
+
<hr/>
|
19
|
+
<p>click the button and check if the component is alive</p>
|
20
|
+
<button on:click={increment}>Increment: {count}</button>
|
21
|
+
|
22
|
+
<hr/>
|
23
|
+
<ul>
|
24
|
+
{#each items as item}
|
25
|
+
<li>{item}</li>
|
26
|
+
{/each}
|
27
|
+
</ul>
|
28
|
+
|
29
|
+
<hr/>
|
30
|
+
<span class="wrap-svg">{@html svgRaw}</span>
|
31
|
+
<!-- <img alt="svg ERROR" src={svg} />-->
|
32
|
+
<img alt="png ERROR" src={png} />
|
33
|
+
|
34
|
+
<hr/>
|
35
|
+
<Nested />
|
36
|
+
|
37
|
+
<hr/>
|
38
|
+
<p>{nestedJavascriptFunction()}</p>
|
39
|
+
</span>
|
40
|
+
|
41
|
+
<style>
|
42
|
+
button {
|
43
|
+
background-color: darkred;
|
44
|
+
color: white;
|
45
|
+
padding: 10px;
|
46
|
+
border: none;
|
47
|
+
cursor: pointer;
|
48
|
+
}
|
49
|
+
|
50
|
+
.svelte-component-wrapper {
|
51
|
+
border: 1px solid black;
|
52
|
+
padding: 10px;
|
53
|
+
margin: 10px;
|
54
|
+
background-color: #efefef;
|
55
|
+
display: inline-block;
|
56
|
+
box-shadow: 2px 3px 16px -1px rgba(0, 0, 0, 0.75);
|
57
|
+
-webkit-box-shadow: 2px 3px 16px -1px rgba(0, 0, 0, 0.75);
|
58
|
+
-moz-box-shadow: 2px 3px 16px -1px rgba(0, 0, 0, 0.75);
|
59
|
+
}
|
60
|
+
img, .wrap-svg {
|
61
|
+
display: inline-block;
|
62
|
+
width: 30px;
|
63
|
+
height: 30px;
|
64
|
+
margin: 30px;
|
65
|
+
}
|
66
|
+
</style>
|
data/templates/rails_vite_hello_world/app/frontend/javascript/components/sub/NestedComponent.svelte
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
<p>Nested Svelte Component</p>
|
@@ -0,0 +1,5 @@
|
|
1
|
+
<p>Example view</p>
|
2
|
+
|
3
|
+
<%= svelte_component "SvelteOnRailsHelloWorld", items: ['attributes', 'are', 'parsed'] %>
|
4
|
+
<%= svelte_component "Pug", ssr: true, notice: "Pug is rendered server-side" %>
|
5
|
+
<%= svelte_component "Pug", ssr: false, notice: "Pug is rendered client-side" %>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
|
2
|
+
import { initializeSvelteComponents, cleanupSvelteComponents } from '@csedl/svelte-on-rails';
|
3
|
+
|
4
|
+
const components = import.meta.glob('/javascript/components/**/*.svelte', { eager: true });
|
5
|
+
const componentsRoot = '/javascript/components';
|
6
|
+
|
7
|
+
// Initialize Svelte components
|
8
|
+
initializeSvelteComponents(componentsRoot, components, true);
|
9
|
+
|
10
|
+
// Turbo event listener for page load
|
11
|
+
document.addEventListener('turbo:load', () => {
|
12
|
+
initializeSvelteComponents(componentsRoot, components, true);
|
13
|
+
});
|
14
|
+
|
15
|
+
// Turbo event listener for cleanup before page cache
|
16
|
+
document.addEventListener('turbo:before-cache', () => {
|
17
|
+
cleanupSvelteComponents(false);
|
18
|
+
});
|
@@ -0,0 +1,23 @@
|
|
1
|
+
frontend_folder: "app/frontend"
|
2
|
+
# the entrypoint that is your web root, example for vite: where @ points to
|
3
|
+
# relative to Rails.root
|
4
|
+
|
5
|
+
components_folder: "javascript/components"
|
6
|
+
# relative to frontend_folder
|
7
|
+
# where your svelte components are located
|
8
|
+
|
9
|
+
ssr: :auto
|
10
|
+
# options: true, false, :auto
|
11
|
+
# :auto: render server side if request is initial request (works only with turbo, because it checks for the X-Turbo-Request-ID header)
|
12
|
+
# when not server-side rendered the components must be built as custom elements, see node-package @csedl/svelte-on-rails
|
13
|
+
|
14
|
+
development:
|
15
|
+
watch_changes: true
|
16
|
+
# Check on every request if any file within the svelte components folder have changed, for recompiling
|
17
|
+
# Case sensitive path checking, even the file system is case insensitive
|
18
|
+
# Make sure this ist set to tue for development and test, but not for production
|
19
|
+
|
20
|
+
test:
|
21
|
+
watch_changes: true
|
22
|
+
|
23
|
+
production:
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: svelte-on-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.41
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christian Sedlmair
|
@@ -52,6 +52,18 @@ files:
|
|
52
52
|
- lib/svelte_on_rails/renderer/utils.js
|
53
53
|
- lib/svelte_on_rails/view_helpers.rb
|
54
54
|
- lib/tasks/svelte_on_rails_tasks.rake
|
55
|
+
- templates/rails_vite_hello_world/app/controllers/svelte_on_rails_hello_world_controller.rb
|
56
|
+
- templates/rails_vite_hello_world/app/frontend/images/atom.svg
|
57
|
+
- templates/rails_vite_hello_world/app/frontend/images/check-circle-green.png
|
58
|
+
- templates/rails_vite_hello_world/app/frontend/images/svg.svg
|
59
|
+
- templates/rails_vite_hello_world/app/frontend/javascript/components/Pug.svelte
|
60
|
+
- templates/rails_vite_hello_world/app/frontend/javascript/components/SvelteOnRailsHelloWorld.svelte
|
61
|
+
- templates/rails_vite_hello_world/app/frontend/javascript/components/sub/NestedComponent.svelte
|
62
|
+
- templates/rails_vite_hello_world/app/frontend/javascript/nestedJavascript.js
|
63
|
+
- templates/rails_vite_hello_world/app/frontend/javascript/nestedJavascriptToggled.js
|
64
|
+
- templates/rails_vite_hello_world/app/views/svelte_on_rails_hello_world/index.html.erb
|
65
|
+
- templates/svelte_on_rails_vite_base/app/frontend/initializers/svelte.js
|
66
|
+
- templates/svelte_on_rails_vite_base/config/svelte_on_rails.yml
|
55
67
|
homepage: https://gitlab.com/sedl/svelte-on-rails
|
56
68
|
licenses:
|
57
69
|
- MIT
|