Skip to content

Commit

Permalink
Merge branch 'dev' into demo
Browse files Browse the repository at this point in the history
# Conflicts:
#	dist/fore-dev.js
#	dist/fore-dev.js.map
#	dist/fore.js
#	dist/fore.js.map
  • Loading branch information
Joern Turner committed Oct 12, 2023
2 parents cada94e + 29843f2 commit a06ae64
Show file tree
Hide file tree
Showing 15 changed files with 309 additions and 27 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,15 @@ Include the following snippet at end of body:
```
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@jinntec/fore@latest/dist/fore-all.js"></script>
```
## Installation
## Installation width npm

Run

```npm install @jinntec/fore```

in your project to install it.


Import it in your HTML page like so:

```
Expand All @@ -155,18 +156,17 @@ Import it in your HTML page like so:
If you intend to hack it yourself ...

> you need to have node installed on your machine (using 15.1.0)
* clone this repo to your machine
* run `npm i` to install dependencies

## Running demos and docs

1. checkout this repo or download the sources
1. change to the rootfolder
1. run `npm i` to install dependencies
1. run `npm run start`

starts the testserver with 'doc/index.html' as entry page. This will send you to 'doc/demos.html' as an
1. change to the rootfolder and execute following command in your shell
1. `npm install` to install Fore dependencies
1. `npm run install-demos` to install Demo dependencies
1. `npm run start` starts the testserver with 'doc/index.html' as entry page. This will send you to 'doc/demos.html' as an
entry point. This lists out running examples to learn and copy from.

## Running test suite
Expand Down
75 changes: 75 additions & 0 deletions demo/actions/call.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes" name="viewport"/>

<title>the 'if' attribute</title>

<!-- <script src="./node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js"></script>-->
<link href="../../resources/demo.css" rel="stylesheet">



</head>
<body unresolved="unresolved">
<fore-corner href="../../doc/demos.html" title="Back to Demos"></fore-corner>
<div class="wrapper">

<h1>Call an action or a function</h1>

<p>
<code>fx-call</code> allows to call action or a function.
</p>

<h2>Calling an action</h2>
<p>Calling an action is useful to avoid duplication of actions needed in several places of a page.</p>
<demo-snippet>
<template>
<fx-fore>
<fx-action id="myAction">
<fx-message>one</fx-message>
<fx-message delay="500">two</fx-message>
<fx-message delay="1000">three</fx-message>
</fx-action>
<fx-trigger>
<button>call action</button>
<fx-call action="myAction"></fx-call>
</fx-trigger>
</fx-fore>
</template>
</demo-snippet>


<h2>Calling a function</h2>
<p>Sometimes you probably just want to call a function for its side-effects without using a bound node.</p>
<demo-snippet>
<template>
<style>
div {
width: 100%;
margin: 1rem 0;
}
</style>

<fx-fore>
<fx-model>
<fx-function signature="hello() as item()?" type="text/javascript">
alert('hello');
return null;
</fx-function>
</fx-model>
<fx-trigger>
<button>call hello()</button>
<fx-call function="hello()"></fx-call>
</fx-trigger>
</fx-fore>
</template>
</demo-snippet>

</div>


<script type="module" src="../demo.js"></script>
</body>
</html>
2 changes: 2 additions & 0 deletions demo/data/sample.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Name;email;phone number;address;
Example;[email protected];555-555-5555;Example Address;
85 changes: 85 additions & 0 deletions demo/submission-replace-blank.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes" name="viewport"/>

<title>Submission - new tab</title>

<!-- <script src="./node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js"></script>-->

<link rel="stylesheet" href="../resources/demo.css">




<custom-style>
<style is="custom-style">
.dynamic {
background: #76ff03;
}

[unresolved] {
display: none;
}

fx-trigger {
display: block;
}

.demo{
border-radius: 10px;
backdrop-filter: blur(5px);
background-color: rgba(135,135,135, 0.2);
box-shadow: rgba(0, 0, 0, 0.2) 2px 8px 8px;
border: 2px rgba(255,255,255,0.4) solid;
border-bottom: 2px rgba(40,40,40,0.35) solid;
border-right: 2px rgba(40,40,40,0.35) solid;

}


</style>
</custom-style>

</head>
<body unresolved="unresolved">
<fore-corner href="../doc/demos.html" title="Back to Demos"></fore-corner>

<div class="wrapper">
<h1>Send response to new tab</h1>
<p>In this demo a little CSV file it loaded into an instance of type 'text'. When the submission is triggered
it will use the '#echo' handler to just return that instance back but sending it to a new browser tab.</p>

<demo-snippet>
<template>
<fx-fore>
<fx-message event="ready">Hey it's ready</fx-message>

<fx-model>
<fx-instance src="data/sample.csv" type="text">
</fx-instance>

<fx-submission id="send"
url="#echo"
method="post"
replace="all"
target="_blank">
</fx-submission>
</fx-model>
<fx-group collapse="true">
<fx-trigger>
<button>open response in new tab</button>
<fx-send submission="send"></fx-send>
</fx-trigger>

</fx-group>
{instance()}
</fx-fore>
</template>
</demo-snippet>
</div>
<script type="module" src="./demo.js"></script>

</body>
</html>
9 changes: 9 additions & 0 deletions dist/fore-dev.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/fore-dev.js.map

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions dist/fore.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/fore.js.map

Large diffs are not rendered by default.

29 changes: 19 additions & 10 deletions doc/demos.html
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ <h3>Submission chaining</h3>
<h3>Submission with Template Expressions</h3>
<p>Resolving expressions on submission URL to send dynamic query parameters</p>
</div></a>
<a href="../demo/submission-relevance.html"><div class="updated">
<a href="../demo/submission-relevance.html"><div>
<h3>Submission & Relevance</h3>
<p>filtering data by their relevance.</p>
</div></a>
Expand All @@ -176,14 +176,19 @@ <h3>Submission with required
values</h3>
<p>How to react to empty but required fields during a submission</p>
</div></a>
<a href="../demo/submission-url-overwrite.html"><div class="updated">
<a href="../demo/submission-url-overwrite.html"><div>
<h3>Send with URL</h3>
<p>Send Action can overwrite submission URL</p>
</div></a>
<a href="../demo/submission-target-overwrite.html"><div class="updated">
<a href="../demo/submission-target-overwrite.html"><div>
<h3>Send with a target</h3>
<p>Send Action can overwrite submission target</p>
</div></a>
<a href="../demo/submission-replace-blank.html" class="updated"><div>
<h3>Send response to new tab</h3>
<p>Submission <code>replace="all"</code> along with <code>target="_blank"</code> sends response
to new tab.</p>
</div></a>
</section>

<h2>UI Controls</h2>
Expand Down Expand Up @@ -218,7 +223,7 @@ <h2>UI Controls</h2>
<a href="../demo/dyn-datalist.html"><div><h3>Ajax datalist</h3>
<p>An Ajax datalist with a third-party lib</p>
</div></a>
<a href="../demo/fx-json-items.html"><div class="updated"><h3><code>fx-items</code> using JSON
<a href="../demo/fx-json-items.html"><div><h3><code>fx-items</code> using JSON
data</h3>
<p>Building a set of chechboxes from JSON data with <code>fx-items.</code></p>
</div></a>
Expand Down Expand Up @@ -258,11 +263,11 @@ <h3>Repeat atomic values</h3>
<h3>Group relevance</h3>
<p>show/hide groups depending on their binding</p>
</div></a>
<a href="../demo/repeat-attributes.html"><div class="updated">
<a href="../demo/repeat-attributes.html"><div>
<h3>Repeats via attributes</h3>
<p>Building repeats by using <code>data-ref</code> attribute</p>
</div></a>
<a href="../demo/lab/fore-component.html"><div class="updated">
<a href="../demo/lab/fore-component.html"><div>
<h3>Fore as Web Component</h3>
<p><code>fore-component</code> a generic Web Component to encapsulate a complete Fore page
in shadowDOM.</p>
Expand Down Expand Up @@ -337,22 +342,26 @@ <h3>Debouncing trigger executions</h3>
<h3>The reload action</h3>
<p>A simple action to reload the window</p>
</div></a>
<a href="../demo/load.html"><div class="updated">
<a href="../demo/load.html"><div>
<h3>The load action</h3>
<p>loading content into document, replacing window or opening a tab.</p>
</div></a>
<a href="../demo/action-block.html"><div class="updated">
<a href="../demo/action-block.html"><div>
<h3>Looping submissions with actions</h3>
<p>Looping submissions with an action block.</p>
</div></a>
<a href="../demo/actions/reset.html"><div class="updated">
<a href="../demo/actions/reset.html"><div>
<h3>Resetting data</h3>
<p>Resetting data to their initial state.</p>
</div></a>
<a href="../demo/actions/toggleboolean.html"><div class="updated">
<a href="../demo/actions/toggleboolean.html"><div>
<h3>Toggle a Boolean value</h3>
<p>Quickest way to toggle a Boolean value.</p>
</div></a>
<a href="../demo/actions/call.html"><div class="updated">
<h3>The call action</h3>
<p>Call an action or a function</p>
</div></a>
</section>

<h2>Functions</h2>
Expand Down
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import './src/actions/fx-reload.js';
import './src/actions/fx-reset.js';
import './src/actions/fx-load.js';
import './src/actions/fx-toggleboolean.js';
import './src/actions/fx-call.js';

import './src/functions/fx-function.js';

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jinntec/fore",
"version": "1.7.2",
"version": "1.8.0",
"description": "Fore - declarative user interfaces in plain HTML",
"module": "./index.js",
"publishConfig": {
Expand Down Expand Up @@ -82,7 +82,7 @@
"start:build": "cd dist && es-dev-server --open",
"build": "rimraf dist && rollup -c rollup.config.js",
"start": "es-dev-server --app-index doc/index.html --node-resolve --watch --open",
"postinstall": "cd demo && npm i"
"install-demos": "cd demo && npm i"
},
"keywords": [
"Fore",
Expand Down
Loading

0 comments on commit a06ae64

Please sign in to comment.