saasufy-components 3.1.3 → 3.1.5
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.
- package/README.md +124 -0
- package/package.json +1 -1
- package/styles.css +16 -0
package/README.md
CHANGED
|
@@ -50,6 +50,8 @@ You can apply custom CSS/styling to elements that are rendered inside a viewport
|
|
|
50
50
|
|
|
51
51
|
## How to use
|
|
52
52
|
|
|
53
|
+
### Components
|
|
54
|
+
|
|
53
55
|
To use components, you just need to include them into your `.html` file inside your `<head>` tag like this:
|
|
54
56
|
|
|
55
57
|
```html
|
|
@@ -83,6 +85,14 @@ You should always include the `socket.js` script as shown above whenever you use
|
|
|
83
85
|
Linking the scripts directly from `saasufy.com` as shown above is the simplest way to get started as it doesn't require loading anything or hosting the scripts yourself.
|
|
84
86
|
An alternative approach is to download Saasufy components using `npm install saasufy-components` and then link to them from your own hosting provider.
|
|
85
87
|
|
|
88
|
+
### Styling
|
|
89
|
+
|
|
90
|
+
This project does not impose any specific approach to styling components, however, it comes with an optional `styles.css` stylesheet which can be added inside your `<head>` tag like this:
|
|
91
|
+
|
|
92
|
+
```html
|
|
93
|
+
<link href="https://saasufy.com/node_modules/saasufy-components/styles.css" rel="stylesheet" />
|
|
94
|
+
```
|
|
95
|
+
|
|
86
96
|
## Components
|
|
87
97
|
|
|
88
98
|
### app-router
|
|
@@ -90,6 +100,12 @@ An alternative approach is to download Saasufy components using `npm install saa
|
|
|
90
100
|
A component which allows you build apps which have multiple pages. Inside it, you should specify a template for each page in your app along with the route/path to bind each page to.
|
|
91
101
|
This component also supports simple redirects as well as redirects based on the user's current authentication state. Redirects can be soft or hard; a soft redirect does not change the current URL/path, a hard redirect does.
|
|
92
102
|
|
|
103
|
+
**Import**
|
|
104
|
+
|
|
105
|
+
```html
|
|
106
|
+
<script src="https://saasufy.com/node_modules/saasufy-components/app-router.js" type="module" defer></script>
|
|
107
|
+
```
|
|
108
|
+
|
|
93
109
|
**Example usage**
|
|
94
110
|
|
|
95
111
|
```html
|
|
@@ -141,6 +157,12 @@ So for example, if your `index.html` file is served up from the URL `http://mywe
|
|
|
141
157
|
A top level component which connects to your Saasufy service and inside which you can place other components which depends on Saasufy data.
|
|
142
158
|
A Saasufy component which integrates with data from Saasufy is known as a `socket-consumer` and must always be placed inside a `socket-provider` element (although it does not have to be a direct child).
|
|
143
159
|
|
|
160
|
+
**Import**
|
|
161
|
+
|
|
162
|
+
```html
|
|
163
|
+
<script src="https://saasufy.com/node_modules/saasufy-components/socket.js" type="module" defer></script>
|
|
164
|
+
```
|
|
165
|
+
|
|
144
166
|
**Example usage**
|
|
145
167
|
|
|
146
168
|
```html
|
|
@@ -160,6 +182,12 @@ Used for rendering collections as lists, tables or other sequences based on a sp
|
|
|
160
182
|
Supports pagination by allowing you to specify custom buttons or links to navigate between pages.
|
|
161
183
|
Can also perform basic CRUD operations such as deleting or creating records by listening for events from child components.
|
|
162
184
|
|
|
185
|
+
**Import**
|
|
186
|
+
|
|
187
|
+
```html
|
|
188
|
+
<script src="https://saasufy.com/node_modules/saasufy-components/collection-browser.js" type="module" defer></script>
|
|
189
|
+
```
|
|
190
|
+
|
|
163
191
|
**Example usage**
|
|
164
192
|
|
|
165
193
|
```html
|
|
@@ -206,6 +234,12 @@ Can also perform basic CRUD operations such as deleting or creating records by l
|
|
|
206
234
|
|
|
207
235
|
A form component for inserting data into collections.
|
|
208
236
|
|
|
237
|
+
**Import**
|
|
238
|
+
|
|
239
|
+
```html
|
|
240
|
+
<script src="https://saasufy.com/node_modules/saasufy-components/collection-adder.js" type="module" defer></script>
|
|
241
|
+
```
|
|
242
|
+
|
|
209
243
|
**Example usage**
|
|
210
244
|
|
|
211
245
|
```html
|
|
@@ -235,6 +269,12 @@ A form component for inserting data into collections.
|
|
|
235
269
|
A component which can be placed anywhere inside a `collection-browser` component to delete a specific item from a collection as a result of a user action (e.g. on click).
|
|
236
270
|
It supports either immediate deletion or deletion upon confirmation; in the latter case, the parent `collection-browser` must have a `confirm-modal` component slotted into its `modal` slot.
|
|
237
271
|
|
|
272
|
+
**Import**
|
|
273
|
+
|
|
274
|
+
```html
|
|
275
|
+
<script src="https://saasufy.com/node_modules/saasufy-components/collection-deleter.js" type="module" defer></script>
|
|
276
|
+
```
|
|
277
|
+
|
|
238
278
|
**Example usage**
|
|
239
279
|
|
|
240
280
|
```html
|
|
@@ -276,6 +316,12 @@ If `confirmDeleteItem()` is used, then the parent `collection-browser` must have
|
|
|
276
316
|
Similar to the `collection-browser` component but designed to render collections in combined format. For example, to combine values from multiple records into a single item.
|
|
277
317
|
A common use case is to extract and join values to pass to other child components via their attributes.
|
|
278
318
|
|
|
319
|
+
**Import**
|
|
320
|
+
|
|
321
|
+
```html
|
|
322
|
+
<script src="https://saasufy.com/node_modules/saasufy-components/collection-reducer.js" type="module" defer></script>
|
|
323
|
+
```
|
|
324
|
+
|
|
279
325
|
**Example usage**
|
|
280
326
|
|
|
281
327
|
```html
|
|
@@ -330,6 +376,12 @@ In the example above, the name of the first element can be accessed with `{{Cate
|
|
|
330
376
|
|
|
331
377
|
Used for displaying and editing a single field of a model instance in real time.
|
|
332
378
|
|
|
379
|
+
**Import**
|
|
380
|
+
|
|
381
|
+
```html
|
|
382
|
+
<script src="https://saasufy.com/node_modules/saasufy-components/model-input.js" type="module" defer></script>
|
|
383
|
+
```
|
|
384
|
+
|
|
333
385
|
**Example usage**
|
|
334
386
|
|
|
335
387
|
```html
|
|
@@ -368,6 +420,12 @@ Used for displaying and editing a single field of a model instance in real time.
|
|
|
368
420
|
|
|
369
421
|
Used to displaying a field of a model instance in real time.
|
|
370
422
|
|
|
423
|
+
**Import**
|
|
424
|
+
|
|
425
|
+
```html
|
|
426
|
+
<script src="https://saasufy.com/node_modules/saasufy-components/model-text.js" type="module" defer></script>
|
|
427
|
+
```
|
|
428
|
+
|
|
371
429
|
**Example usage**
|
|
372
430
|
|
|
373
431
|
```html
|
|
@@ -390,6 +448,12 @@ Used to displaying a field of a model instance in real time.
|
|
|
390
448
|
|
|
391
449
|
Used for rendering a single model resource using a template. This is the single-model alternative to the `collection-browser` which works with collections of models.
|
|
392
450
|
|
|
451
|
+
**Import**
|
|
452
|
+
|
|
453
|
+
```html
|
|
454
|
+
<script src="https://saasufy.com/node_modules/saasufy-components/model-viewer.js" type="module" defer></script>
|
|
455
|
+
```
|
|
456
|
+
|
|
393
457
|
**Example usage**
|
|
394
458
|
|
|
395
459
|
```html
|
|
@@ -424,6 +488,12 @@ An input component which can pass data to other components (or HTML elements) vi
|
|
|
424
488
|
A common use case for it is to pass user input to `collection-browser` or `model-viewer` components to then fetch data from Saasufy.
|
|
425
489
|
This component can be configured to provide its data to multiple components (consumers) via custom attributes.
|
|
426
490
|
|
|
491
|
+
**Import**
|
|
492
|
+
|
|
493
|
+
```html
|
|
494
|
+
<script src="https://saasufy.com/node_modules/saasufy-components/input-provider.js" type="module" defer></script>
|
|
495
|
+
```
|
|
496
|
+
|
|
427
497
|
**Example usage**
|
|
428
498
|
|
|
429
499
|
```html
|
|
@@ -458,6 +528,12 @@ Once a user is authenticated, they will be able to access restricted data (as sp
|
|
|
458
528
|
It's also possible to specify a `success-location-hash` attribute to trigger a client-side redirect upon successful authentication.
|
|
459
529
|
The change in the location hash can then be detected by an `app-router` to switch to a different page upon successful login.
|
|
460
530
|
|
|
531
|
+
**Import**
|
|
532
|
+
|
|
533
|
+
```html
|
|
534
|
+
<script src="https://saasufy.com/node_modules/saasufy-components/log-in-form.js" type="module" defer></script>
|
|
535
|
+
```
|
|
536
|
+
|
|
461
537
|
**Example usage**
|
|
462
538
|
|
|
463
539
|
```html
|
|
@@ -484,6 +560,12 @@ The change in the location hash can then be detected by an `app-router` to switc
|
|
|
484
560
|
|
|
485
561
|
A component which can be placed inside a `socket-provider` to deauthenticate the socket (e.g. on click).
|
|
486
562
|
|
|
563
|
+
**Import**
|
|
564
|
+
|
|
565
|
+
```html
|
|
566
|
+
<script src="https://saasufy.com/node_modules/saasufy-components/log-out.js" type="module" defer></script>
|
|
567
|
+
```
|
|
568
|
+
|
|
487
569
|
**Example usage**
|
|
488
570
|
|
|
489
571
|
```html
|
|
@@ -494,6 +576,12 @@ A component which can be placed inside a `socket-provider` to deauthenticate the
|
|
|
494
576
|
|
|
495
577
|
A link to initiate an OAuth flow to authenticate a user as part of log in. Can support a range of different OAuth providers.
|
|
496
578
|
|
|
579
|
+
**Import**
|
|
580
|
+
|
|
581
|
+
```html
|
|
582
|
+
<script src="https://saasufy.com/node_modules/saasufy-components/oauth-link.js" type="module" defer></script>
|
|
583
|
+
```
|
|
584
|
+
|
|
497
585
|
**Example usage**
|
|
498
586
|
|
|
499
587
|
```html
|
|
@@ -519,6 +607,12 @@ A link to initiate an OAuth flow to authenticate a user as part of log in. Can s
|
|
|
519
607
|
This component handles the final stage of OAuth and then redirects the user to the relevant page/URL if successful.
|
|
520
608
|
When using an OAuth provider, the callback URL which you register with the provider must lead the user back to a page which contains this `oauth-handler` component.
|
|
521
609
|
|
|
610
|
+
**Import**
|
|
611
|
+
|
|
612
|
+
```html
|
|
613
|
+
<script src="https://saasufy.com/node_modules/saasufy-components/oauth-handler.js" type="module" defer></script>
|
|
614
|
+
```
|
|
615
|
+
|
|
522
616
|
**Example usage**
|
|
523
617
|
|
|
524
618
|
```html
|
|
@@ -540,6 +634,12 @@ When using an OAuth provider, the callback URL which you register with the provi
|
|
|
540
634
|
|
|
541
635
|
A component which can be used to guarantee that certain children components are always rendered at the same time (once they are loaded) to provide a smooth user experience.
|
|
542
636
|
|
|
637
|
+
**Import**
|
|
638
|
+
|
|
639
|
+
```html
|
|
640
|
+
<script src="https://saasufy.com/node_modules/saasufy-components/render-group.js" type="module" defer></script>
|
|
641
|
+
```
|
|
642
|
+
|
|
543
643
|
**Example usage**
|
|
544
644
|
|
|
545
645
|
```html
|
|
@@ -578,6 +678,12 @@ The `render-group` will only render its content once all the components specifie
|
|
|
578
678
|
A component which exposes a `show-content` property which can be set to true or false to show or hide its content.
|
|
579
679
|
It's intended to be placed inside a `model-viewer`, `collection-browser` or `collection-reducer` component such that the true/false value of the `show-content` attribute can be computed using a template `{{expression}}` placeholder. This component requires a template and a viewport to be slotted in. The content of the template will not be processed unless the `show-content` condition is met.
|
|
580
680
|
|
|
681
|
+
**Import**
|
|
682
|
+
|
|
683
|
+
```html
|
|
684
|
+
<script src="https://saasufy.com/node_modules/saasufy-components/if-group.js" type="module" defer></script>
|
|
685
|
+
```
|
|
686
|
+
|
|
581
687
|
**Example usage**
|
|
582
688
|
|
|
583
689
|
```html
|
|
@@ -596,6 +702,12 @@ It's intended to be placed inside a `model-viewer`, `collection-browser` or `col
|
|
|
596
702
|
A component which exposes a `show-cases` property which can be set to key-value pairs in the format `key1=true,key2=false`. It can be used to conditionally display multiple slotted elements based on multiple conditions. It helps to keep HTML clean when the conditions are complex.
|
|
597
703
|
This element is intended to be placed inside a `model-viewer`, `collection-browser` or `collection-reducer` component such that the true/false values of the `show-cases` attribute can be computed using template `{{expression}}` placeholders. This component requires one or more templates and a viewport to be slotted in. The content of the templates will not be processed unless the `show-cases` condition is met. All templates must have a `slot="content"` attribute and a name attribute in the format `name="key1"` where the value `key1` corresponds to the key specified inside the `show-cases` attribute of the `switch-group`.
|
|
598
704
|
|
|
705
|
+
**Import**
|
|
706
|
+
|
|
707
|
+
```html
|
|
708
|
+
<script src="https://saasufy.com/node_modules/saasufy-components/switch-group.js" type="module" defer></script>
|
|
709
|
+
```
|
|
710
|
+
|
|
599
711
|
**Example usage**
|
|
600
712
|
|
|
601
713
|
```html
|
|
@@ -614,6 +726,12 @@ This element is intended to be placed inside a `model-viewer`, `collection-brows
|
|
|
614
726
|
|
|
615
727
|
A component which can be used to group together multiple `collection-adder` components. It can be used to insert multiple records into a collection via a single button click.
|
|
616
728
|
|
|
729
|
+
**Import**
|
|
730
|
+
|
|
731
|
+
```html
|
|
732
|
+
<script src="https://saasufy.com/node_modules/saasufy-components/collection-adder-group.js" type="module" defer></script>
|
|
733
|
+
```
|
|
734
|
+
|
|
617
735
|
**Example usage**
|
|
618
736
|
|
|
619
737
|
```html
|
|
@@ -650,6 +768,12 @@ A component which can be used to group together multiple `collection-adder` comp
|
|
|
650
768
|
|
|
651
769
|
A modal component to prompt the user for confirmation before performing sensitive operations. Can be slotted into a `collection-browser` component.
|
|
652
770
|
|
|
771
|
+
**Import**
|
|
772
|
+
|
|
773
|
+
```html
|
|
774
|
+
<script src="https://saasufy.com/node_modules/saasufy-components/confirm-modal.js" type="module" defer></script>
|
|
775
|
+
```
|
|
776
|
+
|
|
653
777
|
**Example usage**
|
|
654
778
|
|
|
655
779
|
```html
|
package/package.json
CHANGED
package/styles.css
CHANGED
|
@@ -7,6 +7,14 @@ a {
|
|
|
7
7
|
color: #e37042;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
div.error,span.error,p.error {
|
|
11
|
+
color: #ff0000;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
div.success,span.success,p.success {
|
|
15
|
+
color: #009900;
|
|
16
|
+
}
|
|
17
|
+
|
|
10
18
|
input[type=text],input[type=password],input[type=number],select,textarea {
|
|
11
19
|
border: 1px solid #999999;
|
|
12
20
|
border-radius: 5px;
|
|
@@ -49,6 +57,14 @@ input[type=submit]:not(input[disabled]),input[type=button]:not(input[disabled])
|
|
|
49
57
|
cursor: pointer;
|
|
50
58
|
}
|
|
51
59
|
|
|
60
|
+
input.error,textarea.error {
|
|
61
|
+
border: 1px solid #ff0000;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
input.warning,textarea.warning {
|
|
65
|
+
border: 1px solid #ee9900;
|
|
66
|
+
}
|
|
67
|
+
|
|
52
68
|
.passphrase-container input {
|
|
53
69
|
max-width: 107px;
|
|
54
70
|
}
|