@jinntec/fore 1.0.0-4 → 1.0.0-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/index.js CHANGED
@@ -40,3 +40,5 @@ import './src/actions/fx-show.js';
40
40
  import './src/actions/fx-hide.js';
41
41
 
42
42
  import './src/functions/fx-function.js';
43
+
44
+ // import '@teipublisher/pb-components/src/pb-components-bundle.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jinntec/fore",
3
- "version": "1.0.0-4",
3
+ "version": "1.0.0-5",
4
4
  "description": "Fore - Forms for the Web",
5
5
  "module": "./index.js",
6
6
  "publishConfig": {
@@ -19,13 +19,15 @@
19
19
  },
20
20
  "files": [
21
21
  "index.js",
22
- "resources/fore-styles.css",
22
+ "resources/fore.css",
23
+ "resources/vars.css",
24
+ "resources/toastify.css",
23
25
  "src/**/*",
24
26
  "dist/fore-all.js",
25
27
  "dist/fore-debug.js"
26
28
  ],
27
29
  "dependencies": {
28
- "@jinntec/jinn-toast": "^1.0.2",
30
+ "@jinntec/jinn-toast": "^1.0.3",
29
31
  "@polymer/iron-component-page": "^4.0.1",
30
32
  "@polymer/iron-demo-helpers": "^3.1.0",
31
33
  "@polymer/paper-button": "^3.0.1",
@@ -0,0 +1,213 @@
1
+ @import 'toastify.css';
2
+ @import 'vars.css';
3
+
4
+ html{
5
+ --inspector-bg:var(--paper-grey-500);
6
+ --inspector-pre-bg:var(--paper-grey-100);
7
+ --inspector-color:var(--paper-grey-800);
8
+ --inspector-instance-height:200px;
9
+ }
10
+ [unresolved]{
11
+ display: none;
12
+ }
13
+ [disabled] {
14
+ pointer-events: none;
15
+ cursor: default;
16
+ }
17
+ fx-fore{
18
+ opacity: 0;
19
+ }
20
+ fx-fore.fx-ready{
21
+ opacity: 1;
22
+ }
23
+ fx-group, fx-switch, fx-repeat, fx-dialog{
24
+ display: block;
25
+ }
26
+ fx-trigger a[disabled] {
27
+ color:lightgrey;
28
+ }
29
+ fx-trigger img[disabled]{
30
+ filter:blur(2px);
31
+ }
32
+
33
+ .error{
34
+ background: var(--paper-red-500);
35
+ }
36
+ fx-alert{
37
+ color:darkred;
38
+ font-size: 0.9rem;
39
+ }
40
+
41
+ fx-model, fx-model *, fx-model ::slotted(fx-instance), fx-instance{
42
+ display:none;
43
+ }
44
+
45
+ fx-control, fx-trigger{
46
+ white-space: nowrap;
47
+ position: relative;
48
+ }
49
+ .fx-checkbox{
50
+ white-space: nowrap;
51
+ }
52
+ fx-hint{
53
+ display: none;
54
+ }
55
+ fx-repeatitem{
56
+ position:relative;
57
+ /*
58
+ opacity:1;
59
+ -webkit-transition: opacity 3s;
60
+ -moz-transition: opacity 3s;
61
+ transition: opacity 3s;
62
+ */
63
+ }
64
+ .hidden {
65
+ visibility: hidden;
66
+ opacity: 0;
67
+ transition: visibility 0s 2s, opacity 2s linear;
68
+ }
69
+
70
+ /* fx-inspector styles */
71
+ fx-inspector{
72
+ position:fixed;
73
+ left:0;
74
+ right:0;
75
+ bottom:0;
76
+ width: 100%;
77
+ background: var(--inspector-bg);
78
+ color: white;
79
+ max-height: 33%;
80
+ overflow: scroll;
81
+ border-top:3px solid black;
82
+ opacity: 0.9;
83
+ }
84
+ fx-inspector::before{
85
+ content:'Instance Inspector';
86
+ font-style:italic;
87
+ position:absolute;
88
+ top:0;
89
+ right: 0.3rem;
90
+ z-index: 10;
91
+ font-size: 0.8rem;
92
+ }
93
+ fx-inspector details{
94
+ padding: 1rem;
95
+ }
96
+ fx-inspector pre{
97
+ background: var(--inspector-pre-bg);
98
+ border-radius: 0.5rem;
99
+ padding: 0.3rem;
100
+ max-height: var(--inspector-instance-height);
101
+ /*overflow: scroll;*/
102
+ }
103
+ fx-inspector details{
104
+ overflow: auto;
105
+ margin:0;
106
+ }
107
+ fx-inspector summary{
108
+ padding: 0;
109
+ }
110
+
111
+ /* ### FX-DIALOG STYLES ### */
112
+ /* ### FX-DIALOG STYLES ### */
113
+ /* ### FX-DIALOG STYLES ### */
114
+ fx-dialog{
115
+ display: none;
116
+ opacity: 0;
117
+ transition: opacity 1s linear;
118
+ }
119
+ fx-dialog.show{
120
+ display: block;
121
+ min-height: 200px;
122
+ border-radius: 0.5rem;
123
+ opacity: 1;
124
+ background:rgba(0,0,0,0.5);
125
+ z-index: 10;
126
+ transition: opacity 2s linear;
127
+ }
128
+
129
+ fx-dialog.show .dialog-content{
130
+ padding: 1rem;
131
+ width:fit-content;
132
+ height:fit-content;
133
+ border:thin solid;
134
+ border-radius: 0.3rem;
135
+ position: absolute;
136
+ left:50%;
137
+ top:50%;
138
+ transform:translateX(-50%) translateY(-50%);
139
+ background: white;
140
+
141
+ }
142
+ fx-dialog a.close-dialog{
143
+ position: absolute;
144
+ right: 0.4rem;
145
+ top:0.2rem;
146
+ color:var(--paper-grey-900);
147
+ text-decoration: none;
148
+ font-size:1.2rem;
149
+ }
150
+ fx-dialog .action{
151
+ width: 100%;
152
+ text-align: center;
153
+ display: block;
154
+ }
155
+
156
+
157
+
158
+ /*
159
+ .visible {
160
+ visibility: visible;
161
+ opacity: 1;
162
+ transition: opacity 2s linear;
163
+ }
164
+ */
165
+
166
+ .required:after {
167
+ content: '*';
168
+ color: red;
169
+ padding-left: 4px;
170
+ right:3px;
171
+ top:3px;
172
+ z-index: 1;
173
+ }
174
+
175
+ [required]:after {
176
+ content: "*";
177
+ display: inline;
178
+ color: red;
179
+ }
180
+ .logtree details{
181
+ padding:0.1rem 1rem;
182
+ margin:0;
183
+ }
184
+ .logtree details summary{
185
+
186
+ }
187
+ .non-relevant{
188
+ opacity: 0;
189
+ height: 0;
190
+ transition: opacity 1s;
191
+ }
192
+ .vertical label{
193
+ display: block;
194
+ }
195
+ [refresh-on-view]{
196
+ /*opacity: 0;*/
197
+ }
198
+ .loaded{
199
+ animation: fadein 0.3s forwards;
200
+ }
201
+ /* avoid flicker from nested lazily loaded elements */
202
+ .loaded .loaded{
203
+ animation: none;
204
+ opacity: 1;
205
+ }
206
+ @keyframes fadein {
207
+ 0% {
208
+ opacity:0;
209
+ }
210
+ 100% {
211
+ opacity:1;
212
+ }
213
+ }
@@ -0,0 +1,87 @@
1
+ /*!
2
+ * Toastify js 1.11.0
3
+ * https://github.com/apvarun/toastify-js
4
+ * @license MIT licensed
5
+ *
6
+ * Copyright (C) 2018 Varun A P
7
+ */
8
+
9
+ .toastify {
10
+ padding: 12px 20px;
11
+ color: #ffffff;
12
+ display: inline-block;
13
+ box-shadow: 0 3px 6px -1px rgba(0, 0, 0, 0.12), 0 10px 36px -4px rgba(77, 96, 232, 0.3);
14
+ background: -webkit-linear-gradient(315deg, #73a5ff, #5477f5);
15
+ background: linear-gradient(135deg, #f8f8f9, #cfcfcf);
16
+ position: fixed;
17
+ opacity: 0;
18
+ transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1);
19
+ border-radius: 2px;
20
+ cursor: pointer;
21
+ text-decoration: none;
22
+ max-width: calc(50% - 20px);
23
+ z-index: 2147483647;
24
+ font-weight: 300;
25
+ color:black;
26
+ }
27
+
28
+ .toastify.on {
29
+ opacity: 1;
30
+ }
31
+
32
+ .toast-close {
33
+ opacity: 0.8;
34
+ padding: 0 5px;
35
+ }
36
+
37
+ .toastify-right {
38
+ right: 15px;
39
+ }
40
+ .toastify-right .toast-close {
41
+ margin-right:-10px;
42
+ }
43
+
44
+ .toastify-left {
45
+ left: 15px;
46
+ }
47
+ .toastify-left .toast-close{
48
+ margin-left:-10px;
49
+ }
50
+
51
+ .toastify-top {
52
+ top: -150px;
53
+ }
54
+
55
+ .toastify-bottom {
56
+ bottom: -150px;
57
+ }
58
+
59
+ .toastify-rounded {
60
+ border-radius: 25px;
61
+ }
62
+
63
+ .toastify-avatar {
64
+ width: 1.5em;
65
+ height: 1.5em;
66
+ margin: -7px 5px;
67
+ border-radius: 2px;
68
+ }
69
+
70
+ .toastify-center {
71
+ margin-left: auto;
72
+ margin-right: auto;
73
+ left: 0;
74
+ right: 0;
75
+ max-width: fit-content;
76
+ max-width: -moz-fit-content;
77
+ }
78
+
79
+ @media only screen and (max-width: 360px) {
80
+ .toastify-right, .toastify-left {
81
+ margin-left: auto;
82
+ margin-right: auto;
83
+ left: 0;
84
+ right: 0;
85
+ max-width: fit-content;
86
+ }
87
+ }
@@ -1,15 +1,5 @@
1
1
  /* Material Design color palette for Google products */
2
- /* Material Design color palette for Google products */
3
- /* Material Design color palette for Google products */
4
- /* Material Design color palette for Google products */
5
-
6
2
  html {
7
-
8
- --inspector-bg:var(--paper-grey-500);
9
- --inspector-pre-bg:var(--paper-grey-100);
10
- --inspector-color:var(--paper-grey-800);
11
- --inspector-instance-height:200px;
12
-
13
3
  --google-red-100: #f4c7c3;
14
4
  --google-red-300: #e67c73;
15
5
  --google-red-500: #db4437;
@@ -328,285 +318,3 @@ html {
328
318
  --model-element-margin:10px;
329
319
  }
330
320
 
331
- /*!
332
- * Toastify js 1.11.0
333
- * https://github.com/apvarun/toastify-js
334
- * @license MIT licensed
335
- *
336
- * Copyright (C) 2018 Varun A P
337
- */
338
-
339
- .toastify {
340
- padding: 12px 20px;
341
- color: #ffffff;
342
- display: inline-block;
343
- box-shadow: 0 3px 6px -1px rgba(0, 0, 0, 0.12), 0 10px 36px -4px rgba(77, 96, 232, 0.3);
344
- background: -webkit-linear-gradient(315deg, #73a5ff, #5477f5);
345
- background: linear-gradient(135deg, #f8f8f9, #cfcfcf);
346
- position: fixed;
347
- opacity: 0;
348
- transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1);
349
- border-radius: 2px;
350
- cursor: pointer;
351
- text-decoration: none;
352
- max-width: calc(50% - 20px);
353
- z-index: 2147483647;
354
- font-weight: 300;
355
- color:black;
356
- }
357
-
358
- .toastify.on {
359
- opacity: 1;
360
- }
361
-
362
- .toast-close {
363
- opacity: 0.8;
364
- padding: 0 5px;
365
- }
366
-
367
- .toastify-right {
368
- right: 15px;
369
- }
370
- .toastify-right .toast-close {
371
- margin-right:-10px;
372
- }
373
-
374
- .toastify-left {
375
- left: 15px;
376
- }
377
- .toastify-left .toast-close{
378
- margin-left:-10px;
379
- }
380
-
381
- .toastify-top {
382
- top: -150px;
383
- }
384
-
385
- .toastify-bottom {
386
- bottom: -150px;
387
- }
388
-
389
- .toastify-rounded {
390
- border-radius: 25px;
391
- }
392
-
393
- .toastify-avatar {
394
- width: 1.5em;
395
- height: 1.5em;
396
- margin: -7px 5px;
397
- border-radius: 2px;
398
- }
399
-
400
- .toastify-center {
401
- margin-left: auto;
402
- margin-right: auto;
403
- left: 0;
404
- right: 0;
405
- max-width: fit-content;
406
- max-width: -moz-fit-content;
407
- }
408
-
409
- @media only screen and (max-width: 360px) {
410
- .toastify-right, .toastify-left {
411
- margin-left: auto;
412
- margin-right: auto;
413
- left: 0;
414
- right: 0;
415
- max-width: fit-content;
416
- }
417
- }
418
-
419
- /*!
420
- * Fore js 1.0.0-2
421
- * @license MIT licensed
422
- *
423
- * Copyright (C) 2012 Joern Turner
424
- */
425
-
426
- [unresolved]{
427
- display: none;
428
- }
429
- [disabled] {
430
- pointer-events: none;
431
- cursor: default;
432
- }
433
- [refresh-on-view]{
434
- /*opacity: 0;*/
435
- }
436
- [required]:after {
437
- content: "*";
438
- display: inline;
439
- color: red;
440
- }
441
-
442
- .error{
443
- background: var(--paper-red-500);
444
- }
445
-
446
- fx-alert{
447
- color:darkred;
448
- font-size: 0.9rem;
449
- }
450
-
451
- fx-control, fx-trigger{
452
- white-space: nowrap;
453
- position: relative;
454
- }
455
-
456
- .fx-checkbox{
457
- white-space: nowrap;
458
- }
459
- fx-dialog{
460
- display: none;
461
- }
462
- fx-dialog.show{
463
- display: block;
464
- min-height: 200px;
465
- border-radius: 0.5rem;
466
- /*opacity: 0.3;*/
467
- background:rgba(0,0,0,0.5);
468
- z-index: 10;
469
- }
470
- fx-dialog.show .dialog-content{
471
- padding: 1rem;
472
- width:fit-content;
473
- height:fit-content;
474
- border:thin solid;
475
- border-radius: 0.3rem;
476
- position: absolute;
477
- left:50%;
478
- top:50%;
479
- transform:translateX(-50%) translateY(-50%);
480
- background: white;
481
-
482
- }
483
- fx-dialog a.close-dialog{
484
- position: absolute;
485
- right: 0.4rem;
486
- top:0.2rem;
487
- color:var(--paper-grey-900);
488
- text-decoration: none;
489
- font-size:1.2rem;
490
- }
491
- fx-dialog .action{
492
- width: 100%;
493
- text-align: center;
494
- display: block;
495
- }
496
-
497
- fx-hint{
498
- display: none;
499
- }
500
-
501
- /* fx-inspector styles */
502
- fx-inspector{
503
- position:fixed;
504
- left:0;
505
- right:0;
506
- bottom:0;
507
- width: 100%;
508
- background: var(--inspector-bg);
509
- color: white;
510
- max-height: 33%;
511
- overflow: scroll;
512
- border-top:3px solid black;
513
- opacity: 0.9;
514
- }
515
- fx-inspector::before{
516
- content:'Instance Inspector';
517
- font-style:italic;
518
- position:absolute;
519
- top:0;
520
- right: 0.3rem;
521
- z-index: 10;
522
- font-size: 0.8rem;
523
- }
524
- fx-inspector details{
525
- padding: 1rem;
526
- }
527
- fx-inspector pre{
528
- background: var(--inspector-pre-bg);
529
- border-radius: 0.5rem;
530
- padding: 0.3rem;
531
- max-height: var(--inspector-instance-height);
532
- /*overflow: scroll;*/
533
- }
534
- fx-inspector details{
535
- overflow: auto;
536
- margin:0;
537
- }
538
- fx-inspector summary{
539
- padding: 0;
540
- }
541
-
542
- fx-model, fx-model *, fx-model ::slotted(fx-instance), fx-instance{
543
- display:none;
544
- }
545
-
546
- fx-trigger a[disabled] {
547
- color:lightgrey;
548
- }
549
- fx-trigger img[disabled]{
550
- filter:blur(2px);
551
- }
552
-
553
- fx-repeatitem{
554
- position:relative;
555
- /*
556
- opacity:1;
557
- -webkit-transition: opacity 3s;
558
- -moz-transition: opacity 3s;
559
- transition: opacity 3s;
560
- */
561
- }
562
- .hidden {
563
- visibility: hidden;
564
- opacity: 0;
565
- transition: visibility 0s 2s, opacity 2s linear;
566
- }
567
-
568
- .loaded{
569
- animation: fadein 0.3s forwards;
570
- }
571
- /* avoid flicker from nested lazily loaded elements */
572
- .loaded .loaded{
573
- animation: none;
574
- opacity: 1;
575
- }
576
-
577
- .logtree details{
578
- padding:0.1rem 1rem;
579
- margin:0;
580
- }
581
- .logtree details summary{
582
-
583
- }
584
-
585
- .non-relevant{
586
- opacity: 0;
587
- height: 0;
588
- transition: opacity 1s;
589
- }
590
- .required:after {
591
- content: '*';
592
- color: red;
593
- padding-left: 4px;
594
- right:3px;
595
- top:3px;
596
- z-index: 1;
597
- }
598
-
599
- .vertical label{
600
- display: block;
601
- }
602
- @keyframes fadein {
603
- 0% {
604
- opacity:0;
605
- }
606
- 100% {
607
- opacity:1;
608
- }
609
- }
610
-
611
-
612
-
@@ -45,7 +45,7 @@ export class DependencyNotifyingDomFacade {
45
45
  * @param bucket - The bucket that matches the attribute that will be used.
46
46
  */
47
47
  // eslint-disable-next-line class-methods-use-this
48
- /*
48
+ /*
49
49
  getChildNodes(node, bucket) {
50
50
  const matchingNodes = Array.from(node.childNodes).filter(
51
51
  childNode => !bucket || getBucketsForNode(childNode).includes(bucket),
@@ -56,10 +56,12 @@ export class DependencyNotifyingDomFacade {
56
56
 
57
57
  getChildNodes(node, bucket) {
58
58
  const matchingNodes = Array.from(node.childNodes).filter(
59
- childNode => !bucket || getBucketsForNode(childNode).includes(bucket));
59
+ childNode => !bucket || getBucketsForNode(childNode).includes(bucket),
60
+ );
60
61
  matchingNodes.forEach(matchingNode => this._onNodeTouched(matchingNode));
61
62
  return matchingNodes;
62
63
  }
64
+
63
65
  /**
64
66
  * Get the data of this node.
65
67
  *
@@ -83,11 +85,11 @@ export class DependencyNotifyingDomFacade {
83
85
  * @param bucket - The bucket that matches the attribute that will be used.
84
86
  */
85
87
  getFirstChild(node, bucket) {
86
- const matchingNode = Array.from(this.getChildNodes()).filter(
87
- childNode => !bucket || getBucketsForNode(childNode).includes(bucket),
88
- )[0];
89
- if (matchingNode) {
90
- return matchingNode;
88
+ for (const child of node.childNodes) {
89
+ if (!bucket || getBucketsForNode(child).includes(bucket)) {
90
+ this._onNodeTouched(node);
91
+ return child;
92
+ }
91
93
  }
92
94
  return null;
93
95
  }
@@ -7,6 +7,11 @@ import {
7
7
  } from './xpath-evaluation.js';
8
8
  import getInScopeContext from './getInScopeContext.js';
9
9
 
10
+ /**
11
+ * Mixin containing all general functions that are shared by all Fore element classes.
12
+ * @param superclass
13
+ * @returns {{readonly properties: {ref: {type: StringConstructor}, context: {type: ObjectConstructor}, nodeset: {type: ObjectConstructor}, model: {type: ObjectConstructor}, inScopeVariables: {type: MapConstructor}, modelItem: {type: ObjectConstructor}}, new(): ForeElementMixin, context: null, model: null, modelItem: {}, ref: *|string, inScopeVariables: null, nodeset: *, prototype: ForeElementMixin}}
14
+ */
10
15
  export const foreElementMixin = superclass =>
11
16
  class ForeElementMixin extends superclass {
12
17
  static get properties() {
@@ -94,10 +99,19 @@ export const foreElementMixin = superclass =>
94
99
  */
95
100
  evalInContext() {
96
101
  // const inscopeContext = this.getInScopeContext();
97
- const inscopeContext = getInScopeContext(this.getAttributeNode('ref') || this, this.ref);
102
+ let inscopeContext;
103
+ if(this.hasAttribute('context')){
104
+ inscopeContext = getInScopeContext(this.getAttributeNode('context') || this, this.context);
105
+ }
106
+ if(this.hasAttribute('ref')){
107
+ inscopeContext = getInScopeContext(this.getAttributeNode('ref') || this, this.ref);
108
+ }
98
109
  if (!inscopeContext) {
110
+ // ### always fall back to default context with there's neither a 'context' or 'ref' present
111
+ inscopeContext = this.getModel().getDefaultInstance().getDefaultContext();
99
112
  console.warn('no in scopeContext for ', this);
100
- return;
113
+ console.warn('using default context ', this);
114
+ // return;
101
115
  }
102
116
  if (this.ref === '') {
103
117
  this.nodeset = inscopeContext;
@@ -198,6 +198,9 @@ export class AbstractAction extends foreElementMixin(HTMLElement) {
198
198
  }
199
199
 
200
200
  /**
201
+ * dispathes action-performed event
202
+ *
203
+ * @event action-performed - whenever an action has been run
201
204
  */
202
205
  dispatchActionPerformed() {
203
206
  console.log('action-performed ', this);
@@ -54,6 +54,7 @@ export class FxAction extends AbstractAction {
54
54
  // this.needsUpdate = false;
55
55
  }
56
56
  }
57
+
57
58
  }
58
59
 
59
60
  window.customElements.define('fx-action', FxAction);