handlebarsjs 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.builders/generators/domain_model.rb +146 -442
- data/CHANGELOG.md +7 -0
- data/Gemfile +1 -1
- data/docs/domain_model.drawio +94 -0
- data/docs/domain_model.json +741 -0
- data/docs/domain_model.svg +3 -0
- data/docs/domain_model_custom.drawio +61 -0
- data/lib/handlebarsjs/api.rb +7 -0
- data/lib/handlebarsjs/handlebars.rb +15 -0
- data/lib/handlebarsjs/helpers/comparison/and.rb +45 -0
- data/lib/handlebarsjs/javascript/handlebars-4.7.7.js +5210 -0
- data/lib/handlebarsjs/javascript/handlebars-api.js +11 -0
- data/lib/handlebarsjs/javascript/handlebars-helpers.js +3 -0
- data/lib/handlebarsjs/snapshot_builder.rb +51 -0
- data/lib/handlebarsjs/version.rb +1 -1
- data/lib/handlebarsjs.rb +6 -1
- data/package-lock.json +2 -2
- data/package.json +1 -1
- metadata +27 -2
@@ -0,0 +1,3 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="1087px" height="367px" viewBox="-0.5 -0.5 1087 367"><defs/><g><rect x="0" y="0" width="210" height="210" fill="#f5f5f5" stroke="#666666" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe flex-start; justify-content: unsafe center; width: 208px; height: 1px; padding-top: 7px; margin-left: 1px;"><div data-drawio-colors="color: #333333; " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 20px; font-family: Helvetica; color: rgb(51, 51, 51); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Tailwind GEM</div></div></div></foreignObject><text x="105" y="27" fill="#333333" font-family="Helvetica" font-size="20px" text-anchor="middle">Tailwind GEM</text></switch></g><rect x="205" y="25" width="160" height="160" fill="#ffe6cc" stroke="#d79b00" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 158px; height: 1px; padding-top: 105px; margin-left: 206px;"><div data-drawio-colors="color: #333333; " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(51, 51, 51); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Handlebars-Helpers (ruby)</div></div></div></foreignObject><text x="285" y="109" fill="#333333" font-family="Helvetica" font-size="12px" text-anchor="middle">Handlebars-Helpers (ruby)</text></switch></g><rect x="385" y="25" width="160" height="160" fill="#f8cecc" stroke="#b85450" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 158px; height: 1px; padding-top: 105px; margin-left: 386px;"><div data-drawio-colors="color: #333333; " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(51, 51, 51); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Handlebars (ruby)</div></div></div></foreignObject><text x="465" y="109" fill="#333333" font-family="Helvetica" font-size="12px" text-anchor="middle">Handlebars (ruby)</text></switch></g><rect x="565" y="25" width="160" height="160" fill="#f8cecc" stroke="#b85450" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 158px; height: 1px; padding-top: 105px; margin-left: 566px;"><div data-drawio-colors="color: #333333; " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(51, 51, 51); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">The Ruby Racer</div></div></div></foreignObject><text x="645" y="109" fill="#333333" font-family="Helvetica" font-size="12px" text-anchor="middle">The Ruby Racer</text></switch></g><rect x="745" y="25" width="160" height="160" fill="#f8cecc" stroke="#b85450" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 158px; height: 1px; padding-top: 105px; margin-left: 746px;"><div data-drawio-colors="color: #333333; " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(51, 51, 51); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Node V8 engine</div></div></div></foreignObject><text x="825" y="109" fill="#333333" font-family="Helvetica" font-size="12px" text-anchor="middle">Node V8 engine</text></switch></g><rect x="925" y="25" width="160" height="160" fill="#ffe6cc" stroke="#d79b00" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 158px; height: 1px; padding-top: 105px; margin-left: 926px;"><div data-drawio-colors="color: #333333; " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(51, 51, 51); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Handlebars JS (javascript</div></div></div></foreignObject><text x="1005" y="109" fill="#333333" font-family="Helvetica" font-size="12px" text-anchor="middle">Handlebars JS (javascript</text></switch></g><rect x="25" y="205" width="160" height="160" fill="#d5e8d4" stroke="#82b366" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 158px; height: 1px; padding-top: 285px; margin-left: 26px;"><div data-drawio-colors="color: #333333; " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(51, 51, 51); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">HandlebarsJS (ruby)</div></div></div></foreignObject><text x="105" y="289" fill="#333333" font-family="Helvetica" font-size="12px" text-anchor="middle">HandlebarsJS (ruby)</text></switch></g><rect x="205" y="205" width="160" height="160" fill="#d5e8d4" stroke="#82b366" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 158px; height: 1px; padding-top: 285px; margin-left: 206px;"><div data-drawio-colors="color: #333333; " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(51, 51, 51); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Mini Racer</div></div></div></foreignObject><text x="285" y="289" fill="#333333" font-family="Helvetica" font-size="12px" text-anchor="middle">Mini Racer</text></switch></g><rect x="365" y="205" width="200" height="160" fill="#ffe6cc" stroke="#d79b00" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe flex-start; width: 202px; height: 160px; padding-top: 205px; margin-left: 365px;"><div data-drawio-colors="color: #333333; " style="box-sizing: border-box; font-size: 0px; text-align: left; width: 200px; height: 160px; overflow: hidden;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(51, 51, 51); line-height: 1.2; pointer-events: all; width: 100%; height: 100%; white-space: normal; overflow-wrap: normal;"><p style="margin: 0px ; margin-left: 4px ; margin-bottom: 4px ; text-align: center"><b>Component</b></p><hr size="1" /><p style="margin: 0px ; margin-left: 4px ; margin-bottom: 4px">key: Symbol</p><p style="margin: 0px ; margin-left: 4px ; margin-bottom: 4px">name: String</p><p style="margin: 0px ; margin-left: 4px ; margin-bottom: 4px">description: String</p><p style="margin: 0px ; margin-left: 4px ; margin-bottom: 4px">data_shape: DataShape</p></div></div></div></foreignObject><text x="365" y="289" fill="#333333" font-family="Helvetica" font-size="12px">Component...</text></switch></g></g><switch><g requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"/><a transform="translate(0,-5)" xlink:href="https://www.diagrams.net/doc/faq/svg-export-text-problems" target="_blank"><text text-anchor="middle" font-size="10px" x="50%" y="100%">Text is not SVG - cannot display</text></a></switch></svg>
|
@@ -0,0 +1,61 @@
|
|
1
|
+
<mxfile host="65bd71144e">
|
2
|
+
<diagram id="eju" name="Domain Modal">
|
3
|
+
<mxGraphModel dx="1097" dy="583" grid="0" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1169" pageHeight="827" background="#fafafa" math="0" shadow="0">
|
4
|
+
<root>
|
5
|
+
<mxCell id="page_root_eju"/>
|
6
|
+
<mxCell id="node_root_eju" parent="page_root_eju"/>
|
7
|
+
<mxCell id="eju-10" value="GEM Architecture Flow" style="whiteSpace=wrap;html=1;rounded=0;fillColor=#f5f5f5;strokeColor=#666666;fontColor=#333333;fontSize=20;verticalAlign=top" parent="node_root_eju" vertex="1">
|
8
|
+
<mxGeometry x="8" y="10" width="1113" height="581" as="geometry"/>
|
9
|
+
</mxCell>
|
10
|
+
<mxCell id="a1" value="KManager -> KBuilder" style="whiteSpace=wrap;html=1;rounded=0;fillColor=#dae8fc;strokeColor=#6c8ebf;fontColor=#333333" parent="node_root_eju" vertex="1">
|
11
|
+
<mxGeometry x="47" y="334" width="160" height="160" as="geometry"/>
|
12
|
+
</mxCell>
|
13
|
+
<mxCell id="a2" value="Handlebars-Helpers (ruby)" style="whiteSpace=wrap;html=1;rounded=0;fillColor=#ffe6cc;strokeColor=#d79b00;fontColor=#333333" parent="node_root_eju" vertex="1">
|
14
|
+
<mxGeometry x="231" y="188" width="160" height="160" as="geometry"/>
|
15
|
+
</mxCell>
|
16
|
+
<mxCell id="a3" value="Handlebars (ruby)" style="whiteSpace=wrap;html=1;rounded=0;fillColor=#f8cecc;strokeColor=#b85450;fontColor=#333333" parent="node_root_eju" vertex="1">
|
17
|
+
<mxGeometry x="468" y="304" width="160" height="160" as="geometry"/>
|
18
|
+
</mxCell>
|
19
|
+
<mxCell id="a4" value="The Ruby Racer" style="whiteSpace=wrap;html=1;rounded=0;fillColor=#f8cecc;strokeColor=#b85450;fontColor=#333333" parent="node_root_eju" vertex="1">
|
20
|
+
<mxGeometry x="686" y="304" width="160" height="160" as="geometry"/>
|
21
|
+
</mxCell>
|
22
|
+
<mxCell id="a5" value="HandlebarsJS (ruby)" style="whiteSpace=wrap;html=1;rounded=0;fillColor=#d5e8d4;strokeColor=#82b366;fontColor=#333333" parent="node_root_eju" vertex="1">
|
23
|
+
<mxGeometry x="468" y="68" width="160" height="160" as="geometry"/>
|
24
|
+
</mxCell>
|
25
|
+
<mxCell id="a6" value="Mini Racer" style="whiteSpace=wrap;html=1;rounded=0;fillColor=#d5e8d4;strokeColor=#82b366;fontColor=#333333" parent="node_root_eju" vertex="1">
|
26
|
+
<mxGeometry x="686" y="68" width="160" height="160" as="geometry"/>
|
27
|
+
</mxCell>
|
28
|
+
<mxCell id="a7" value="Node V8 engine" style="whiteSpace=wrap;html=1;rounded=0;fillColor=#1ba1e2;strokeColor=#006EAF;fontColor=#ffffff" parent="node_root_eju" vertex="1">
|
29
|
+
<mxGeometry x="936" y="177" width="160" height="160" as="geometry"/>
|
30
|
+
</mxCell>
|
31
|
+
<mxCell id="a8" value="<span>Handlebars.js (javascript)</span>" style="whiteSpace=wrap;html=1;rounded=0;fillColor=#ffe6cc;strokeColor=#d79b00;fontColor=#333333" parent="node_root_eju" vertex="1">
|
32
|
+
<mxGeometry x="936" y="393" width="160" height="160" as="geometry"/>
|
33
|
+
</mxCell>
|
34
|
+
<mxCell id="eju-12" value="" style="edgeStyle=orthogonalEdgeStyle;curved=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;startArrow=none;startFill=1;endArrow=open;endFill=1;whiteSpace=wrap;html=1;rounded=0;fillColor=#ffe6cc;strokeColor=#d79b00" parent="node_root_eju" source="a2" target="a3" edge="1">
|
35
|
+
<mxGeometry relative="1" as="geometry"/>
|
36
|
+
</mxCell>
|
37
|
+
<mxCell id="eju-13" value="" style="edgeStyle=orthogonalEdgeStyle;curved=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;startArrow=none;startFill=1;endArrow=open;endFill=1;whiteSpace=wrap;html=1;rounded=0;fillColor=#ffe6cc;strokeColor=#d79b00" parent="node_root_eju" source="a3" target="a4" edge="1">
|
38
|
+
<mxGeometry relative="1" as="geometry"/>
|
39
|
+
</mxCell>
|
40
|
+
<mxCell id="eju-14" value="" style="edgeStyle=orthogonalEdgeStyle;curved=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;startArrow=none;startFill=1;endArrow=open;endFill=1;whiteSpace=wrap;html=1;rounded=0;fillColor=#ffe6cc;strokeColor=#d79b00" parent="node_root_eju" source="a2" target="a5" edge="1">
|
41
|
+
<mxGeometry relative="1" as="geometry"/>
|
42
|
+
</mxCell>
|
43
|
+
<mxCell id="eju-15" value="" style="edgeStyle=orthogonalEdgeStyle;curved=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;startArrow=none;startFill=1;endArrow=open;endFill=1;whiteSpace=wrap;html=1;rounded=0;fillColor=#ffe6cc;strokeColor=#d79b00" parent="node_root_eju" source="a5" target="a6" edge="1">
|
44
|
+
<mxGeometry relative="1" as="geometry"/>
|
45
|
+
</mxCell>
|
46
|
+
<mxCell id="eju-16" value="" style="edgeStyle=orthogonalEdgeStyle;curved=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;startArrow=none;startFill=1;endArrow=open;endFill=1;whiteSpace=wrap;html=1;rounded=0;fillColor=#ffe6cc;strokeColor=#d79b00" parent="node_root_eju" source="a4" target="a7" edge="1">
|
47
|
+
<mxGeometry relative="1" as="geometry"/>
|
48
|
+
</mxCell>
|
49
|
+
<mxCell id="eju-17" value="" style="edgeStyle=orthogonalEdgeStyle;curved=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;startArrow=none;startFill=1;endArrow=open;endFill=1;whiteSpace=wrap;html=1;rounded=0;fillColor=#ffe6cc;strokeColor=#d79b00" parent="node_root_eju" source="a6" target="a7" edge="1">
|
50
|
+
<mxGeometry relative="1" as="geometry"/>
|
51
|
+
</mxCell>
|
52
|
+
<mxCell id="eju-18" value="" style="edgeStyle=orthogonalEdgeStyle;curved=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;startArrow=none;startFill=1;endArrow=open;endFill=1;whiteSpace=wrap;html=1;rounded=0;fillColor=#ffe6cc;strokeColor=#d79b00" parent="node_root_eju" source="a7" target="a8" edge="1">
|
53
|
+
<mxGeometry relative="1" as="geometry"/>
|
54
|
+
</mxCell>
|
55
|
+
<mxCell id="eju-19" value="" style="edgeStyle=orthogonalEdgeStyle;curved=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;startArrow=none;startFill=1;endArrow=open;endFill=1;whiteSpace=wrap;html=1;rounded=0;fillColor=#ffe6cc;strokeColor=#d79b00" parent="node_root_eju" source="a1" target="a2" edge="1">
|
56
|
+
<mxGeometry relative="1" as="geometry"/>
|
57
|
+
</mxCell>
|
58
|
+
</root>
|
59
|
+
</mxGraphModel>
|
60
|
+
</diagram>
|
61
|
+
</mxfile>
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# reference: https://github.com/rails/rails/blob/master/activesupport/lib/active_support/inflector/methods.rb
|
4
|
+
# require 'active_support/core_ext/string'
|
5
|
+
|
6
|
+
# require 'handlebars/helpers/base_helper'
|
7
|
+
|
8
|
+
module Handlebarsjs
|
9
|
+
module Helpers
|
10
|
+
# Comparison helpers, eg. or, and, equal, not equal, less than, greater than etc.
|
11
|
+
module Comparison
|
12
|
+
# And: Block helper that renders a block if **all of** the given values are truthy. If an inverse block is specified it will be rendered when falsy.
|
13
|
+
# < Handlebars::Helpers::BaseHelper
|
14
|
+
class And
|
15
|
+
# Parse will And: Block helper that renders a block if **all of** the given values are truthy. If an inverse block is specified it will be rendered when falsy.
|
16
|
+
#
|
17
|
+
# @example
|
18
|
+
#
|
19
|
+
# {{#if (and p1 p2 p3 p4 p5)}}
|
20
|
+
# found
|
21
|
+
# {{/if}}
|
22
|
+
#
|
23
|
+
# @example
|
24
|
+
#
|
25
|
+
# @example
|
26
|
+
# {{#if (and name age)}}
|
27
|
+
# {{name}}-{{age}}
|
28
|
+
# {{else}}
|
29
|
+
# no name or age
|
30
|
+
# {{/if}}
|
31
|
+
#
|
32
|
+
# @param values list of values (via *splat) to be checked via AND condition
|
33
|
+
# @return [String] return block when every value is truthy
|
34
|
+
def parse(values)
|
35
|
+
values.all? { |value| value }
|
36
|
+
end
|
37
|
+
|
38
|
+
def handlebars_helper
|
39
|
+
# Exclude last paramater which is the context V8::Object
|
40
|
+
proc { |_context, *values| wrapper(parse(values[0..-2])) }
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|