/
px-app-helpers-api.json
2943 lines (2943 loc) · 105 KB
/
px-app-helpers-api.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{
"schema_version": "1.0.0",
"elements": [
{
"description": "### Usage\n\n <px-app-header>\n <px-app-nav slot=\"app-nav\" items=\"...\"></px-app-nav>\n </px-app-header>\n\nThe default configuration will contain a px-branding-bar that will inherit the `title` attribute from your application.\nTo override the title, use the branding-bar slot instead:\n\n <px-app-header>\n <px-branding-bar slot=\"branding-bar\" application-title=\"...\"></px-branding-bar>\n <px-app-nav slot=\"app-nav\" items=\"...\"></px-app-nav>\n </px-app-header>",
"summary": "",
"path": "px-app-header/px-app-header.es6.js",
"properties": [
{
"name": "fixed",
"type": "boolean",
"description": "By default, the branding bar within the app header container will minimize as the user scrolls away.\nIf this property is set, the branding bar will stay fixed as the user scrolls away.",
"privacy": "public",
"sourceRange": {
"start": {
"line": 8,
"column": 6
},
"end": {
"line": 12,
"column": 7
}
},
"metadata": {
"polymer": {
"observer": "\"_fixedChanged\""
}
},
"defaultValue": "false"
},
{
"name": "_condenses",
"type": "boolean",
"description": "",
"privacy": "protected",
"sourceRange": {
"start": {
"line": 13,
"column": 6
},
"end": {
"line": 16,
"column": 7
}
},
"metadata": {
"polymer": {}
},
"defaultValue": "true"
},
{
"name": "_scrollEffect",
"type": "string",
"description": "",
"privacy": "protected",
"sourceRange": {
"start": {
"line": 17,
"column": 6
},
"end": {
"line": 20,
"column": 7
}
},
"metadata": {
"polymer": {}
},
"defaultValue": "\"px-app-header-scroll-effect\""
}
],
"methods": [
{
"name": "ready",
"description": "",
"privacy": "protected",
"sourceRange": {
"start": {
"line": 22,
"column": 4
},
"end": {
"line": 26,
"column": 5
}
},
"metadata": {},
"params": []
},
{
"name": "_setHeaderFixedState",
"description": "",
"privacy": "protected",
"sourceRange": {
"start": {
"line": 27,
"column": 4
},
"end": {
"line": 30,
"column": 5
}
},
"metadata": {},
"params": []
},
{
"name": "_fixedChanged",
"description": "",
"privacy": "protected",
"sourceRange": {
"start": {
"line": 31,
"column": 4
},
"end": {
"line": 35,
"column": 5
}
},
"metadata": {},
"params": []
}
],
"staticMethods": [],
"demos": [
{
"url": "index.html",
"description": ""
}
],
"metadata": {},
"sourceRange": {
"start": {
"line": 1,
"column": 10
},
"end": {
"line": 36,
"column": 3
}
},
"privacy": "public",
"superclass": "HTMLElement",
"attributes": [
{
"name": "fixed",
"description": "By default, the branding bar within the app header container will minimize as the user scrolls away.\nIf this property is set, the branding bar will stay fixed as the user scrolls away.",
"sourceRange": {
"start": {
"line": 8,
"column": 6
},
"end": {
"line": 12,
"column": 7
}
},
"metadata": {},
"type": "boolean"
}
],
"events": [],
"styling": {
"cssVariables": [],
"selectors": []
},
"slots": [
{
"description": "",
"name": "branding-bar",
"range": {
"file": "px-app-header/px-app-header.html",
"start": {
"line": 43,
"column": 10
},
"end": {
"line": 45,
"column": 17
}
}
},
{
"description": "",
"name": "app-nav",
"range": {
"file": "px-app-header/px-app-header.html",
"start": {
"line": 48,
"column": 10
},
"end": {
"line": 48,
"column": 38
}
}
},
{
"description": "",
"name": "",
"range": {
"file": "px-app-header/px-app-header.html",
"start": {
"line": 51,
"column": 6
},
"end": {
"line": 51,
"column": 19
}
}
}
],
"tagname": "px-app-header"
},
{
"description": "The px-app-route component relies on the Polymer team's [app-location](https://www.webcomponents.org/element/PolymerElements/app-route)\nelement to manage the window location and history state. The element will consume\nthe `route` provided by app-location and send updates to other components\non the page when the URL changes. Interaction with other components on the page\nwill be propagated up to the URL using the same bindings.\n\n### Installing and including in an app\n\nThe px-app-route element is included as part of the [px-app-helpers](https://github.com/PredixDev/px-app-helpers) package.\nTo install the element using bower, use the following command:\n\n bower install --save px-app-helpers\n\nAfter installing, import the code using HTML imports into the app file that\nimplements px-app-helpers. You'll also need to import app-location from the\nPolymer team's app-route package.\n\n <link rel=\"import\" href=\"/bower_components/app-route/app-location.html\"/>\n <link rel=\"import\" href=\"/bower_components/px-app-helpers/px-app-route/px-app-route.html\"/>\n\nThe app-route package will be installed automatically when px-app-helpers\nis included in your bower file.\n\n### Using px-app-route\n\nThe following simplified example shows how px-app-route can be used to send\nupdates to the [px-app-nav](https://www.predix-ui.com/#/components/px-app-nav/)\nelement when the URL changes, and update the URL when the navigation is\ninteracted with:\n\n <app-location route=\"{{route}}\" use-hash-as-path></app-location>\n <px-app-route\n route=\"{{route}}\"\n use-hash-as-path\n update-nav-route\n nav-route=\"{{navRoute}}\">\n </px-app-route>\n <px-app-nav\n items=\"{{navItems}}\"\n selected-route=\"{{navRoute}}\">\n </px-app-nav>\n\nIf the following `navItems` are defined:\n\n [\n {\n \"id\" : \"home\",\n \"label\" : \"Home\"\n },\n {\n \"id\" : \"dashboards\",\n \"label\" : \"Dashboards\",\n \"children\" : [\n {\n \"id\" : \"a1\",\n \"label\" : \"Alerts\"\n }\n ]\n }\n ]\n\nThen tapping on the 'Alerts' navigation button will change the URL to\n\"example.com/#/dashboards/alerts\". Bookmarking that URL and loading\nit again later will automatically select the 'Alerts' navigation item\non page load.\n\n### Complex routing: navigation and assets\n\nMany complex applications require the user the navigate to a view (like the\n'Alerts' dashboard view in the example above) and provide some additional\ninformation about the kind of asset or context they would like to view.\nThe [px-context-browser](https://www.predix-ui.com/#/components/px-context-browser/)\nand [px-breadcrumbs](https://www.predix-ui.com/#/components/px-breadcrumbs/)\nelements both help the user select the specific asset they would like to view.\n\nThe px-app-route element supports binding to the navigation to allow users to\nnavigate to purpose-driven views, and binding to multiple asset browsing elements\nto update whats visible within the view.\n\nThe following example shows all of these elements working together:\n\n <app-location route=\"{{route}}\" use-hash-as-path></app-location>\n <px-app-route\n route=\"{{route}}\"\n use-hash-as-path\n update-nav-route\n nav-route=\"{{navRoute}}\">\n </px-app-route>\n <px-app-nav\n items=\"{{navItems}}\"\n selected-route=\"{{navRoute}}\">\n </px-app-nav>\n <px-context-browser\n items=\"{{assetItems}}\"\n selected-route=\"{{assetRoute}}\">\n </px-context-browser>\n <px-breadcrumbs\n items=\"{{assetItems}}\"\n selected-route=\"{{assetRoute}}\">\n </px-breadcrumbs>\n\nIf the following `navItems` are defined:\n\n [\n {\n \"id\" : \"home\",\n \"label\" : \"Home\"\n },\n {\n \"id\" : \"dashboards\",\n \"label\" : \"Dashboards\",\n \"children\" : [\n {\n \"id\" : \"a1\",\n \"label\" : \"Alerts\"\n }\n ]\n }\n ]\n\nAnd the following `assetItems` are defined:\n\n [\n {\n \"id\" : \"us\",\n \"label\" : \"United States\",\n \"children\" : [\n {\n \"id\" : \"calif\",\n \"label\" : \"California\",\n \"children\" : [\n {\n \"id\" : \"bay-area\",\n \"label\" : \"San Francisco Bay Area\"\n }\n ]\n }\n ]\n }\n ]\n\nIf the user selects the \"Alerts\" view and uses the context browser to choose\n\"San Francisco Bay Area\" as a filter for the visible alerts, the URL will\nbe changed to the following: \"example.com/#/dashboards/alerts~/us/calif/bay-area\"\n\n### Changing the way URLs are built\n\nThe URL path produced by px-app-route can be bound to two models: the navigation\nmodel (through `navRoute`) and the asset model (through `assetRoute`). Depending\non the needs of the web app, one or both models can be bound to.\n\nThe selected item in each model can be represented as:\n\n - a **route**, an array of unique ID strings that start at the root of the model\n graph and terminate at the selected item (e.g. `[\"us\", \"calif\", \"bay-area\"]`).\n - a **path**, a stringified representation of the route that can be used to\n set the URL path (e.g. \"us/calif/bay-area\")\n\nBy default, the route segments are joined together with the '/' character, but\nthat can be changed:\n\n <app-location route=\"{{route}}\" use-hash-as-path></app-location>\n <px-app-route\n route=\"{{route}}\"\n use-hash-as-path\n update-nav-route\n nav-route=\"{{navRoute}}\"\n segment-paths-with=\".\">\n </px-app-route>\n\nIn the above example, the navigation model route `[\"us\", \"calif\", \"bay-area\"]`\nwould be transformed into the path string \"us.calif.bay-area\".\n\nChoose a safe, unreserved URI character to ensure there are no issues setting\nURL path or loading it later. See [RFC 3986](http://www.ietf.org/rfc/rfc3986.txt)\nfor a list of unsafe and reserved characters. In general, use one of: `-`, `.`,\n`_`, or `~`. The chosen character should not appear in any of the unique ID\nstrings in the model route.\n\nWhen two models are used, the models must be joined together with a character\nto divide the two paths. By default, the models are joined with the '~'\ncharacter. Set the `segment-models-with` attribute on the px-app-route element\nto a safe, unreserved URI character to change this.\n\n### Routing with hash\n\nWhen the backend application server is not setup to manage routes and send frontend\nroutes to a single-page web app index file the hash portion of the URL can be\nused to do routing. To enable hash-based URLs, enable the `use-hash-as-path`\nattribute on both the px-app-route element and the app-location element that\nproduces the route.\n\n### Integrating px-app-route with other routers\n\nThe `encodeAllPaths`, `encodePath`, and `decodePath` methods available on all\npx-app-route instances can also be called directly without stamping a\npx-app-route element in your app.\n\nThose methods are available at `window.PxApp.RouteHelpers.[METHOD_NAME]`.\nCalling these methods directly on the window is a useful way to encode and\ndecode model routes on your page and send the result to a third-party router\n(e.g. any Angular or React router).\n\nSee the API documentation for this component for more information on how\nto use the static methods to encode and decode model routes/paths.",
"summary": "",
"path": "px-app-route/px-app-route.html",
"properties": [
{
"name": "segmentPathsWith",
"type": "string",
"description": "Valid URI-safe character used to seperate URL path segments. Defaults\nto '/' (e.g. the path ['about','company-info'] would be joined as\n'about/company-info').\n\nChoose a safe, unreserved URI character to ensure there are no issues.\nSee [RFC 3986](http://www.ietf.org/rfc/rfc3986.txt) for a list of\nunsafe and reserved characters. In general, use one of: `-`, `.`,\n`_`, or `~`. Note that character should not occur in any paths.",
"privacy": "public",
"sourceRange": {
"start": {
"line": 229,
"column": 8
},
"end": {
"line": 232,
"column": 9
}
},
"metadata": {
"polymer": {}
},
"defaultValue": "\"/\""
},
{
"name": "segmentModelsWith",
"type": "string",
"description": "Valid URI-safe character used to seperate different models in the\nURL. Defaults to '~' (e.g. the nav path ['about','company-info'] and\nasset path ['dashboards','trucks'] would be joined as\n'about/company-info~dashboards/trucks'.\n\nChoose a safe, unreserved URI character to ensure there are no issues.\nSee [RFC 3986](http://www.ietf.org/rfc/rfc3986.txt) for a list of\nunsafe and reserved characters. In general, use one of: `-`, `.`,\n`_`, or `~`. Note that character should not occur in any paths.",
"privacy": "public",
"sourceRange": {
"start": {
"line": 245,
"column": 8
},
"end": {
"line": 248,
"column": 9
}
},
"metadata": {
"polymer": {}
},
"defaultValue": "\"~\""
},
{
"name": "route",
"type": "Object",
"description": "Bind this property to the `route` exposes by the <app-location> element.\nUpdates to the URL path will be propagated to `route.path` and decoded\nby this component to update the app-nav and app-asset models. Updates\nto the models will be pushed to the URL path.",
"privacy": "public",
"sourceRange": {
"start": {
"line": 256,
"column": 8
},
"end": {
"line": 260,
"column": 9
}
},
"metadata": {
"polymer": {
"notify": true,
"observer": "\"_handleRouteChanged\""
}
}
},
{
"name": "useHashAsPath",
"type": "boolean",
"description": "Set to `true` if the URL path will be prefixed with a `#` character.\nThis should also be enabled on the <app-location> element that shares\nits route with this component.",
"privacy": "public",
"sourceRange": {
"start": {
"line": 267,
"column": 8
},
"end": {
"line": 270,
"column": 9
}
},
"metadata": {
"polymer": {}
},
"defaultValue": "false"
},
{
"name": "updateNavRoute",
"type": "boolean",
"description": "Set to `true` to sync a <px-app-nav> component's state with the URL\nbar. See the `navRoute` property for help on binding changes.",
"privacy": "public",
"sourceRange": {
"start": {
"line": 276,
"column": 8
},
"end": {
"line": 279,
"column": 9
}
},
"metadata": {
"polymer": {}
},
"defaultValue": "false"
},
{
"name": "navRoute",
"type": "Array",
"description": "Bind this property to a <px-app-nav> component's `selectedRoute`\nproperty to keep the navigation state in sync with the URL path.\nMust enable `updateNavRoute` for this to work.",
"privacy": "public",
"sourceRange": {
"start": {
"line": 286,
"column": 8
},
"end": {
"line": 289,
"column": 9
}
},
"metadata": {
"polymer": {
"notify": true
}
}
},
{
"name": "navPathString",
"type": "string",
"description": "Read-only string that is computed from the `navRoute`. Will be\npushed into the URL path.",
"privacy": "public",
"sourceRange": {
"start": {
"line": 295,
"column": 8
},
"end": {
"line": 300,
"column": 9
}
},
"metadata": {
"polymer": {
"readOnly": true
}
},
"defaultValue": "\"\""
},
{
"name": "updateAssetRoute",
"type": "boolean",
"description": "Set to `true` to sync the state of components that use the Asset Graph\nBehavior with the URL path. See the `assetRoute` property for help\non binding changes.",
"privacy": "public",
"sourceRange": {
"start": {
"line": 307,
"column": 8
},
"end": {
"line": 310,
"column": 9
}
},
"metadata": {
"polymer": {}
},
"defaultValue": "false"
},
{
"name": "assetRoute",
"type": "Array",
"description": "Bind this property to a the `selectedRoute` property of one or more\ncomponents that use the Asset Graph Behavior to keep the selected\nasset state in sync with the URL path. Must enable `updateAssetRoute` for\nthis to work.",
"privacy": "public",
"sourceRange": {
"start": {
"line": 318,
"column": 8
},
"end": {
"line": 321,
"column": 9
}
},
"metadata": {
"polymer": {
"notify": true
}
}
},
{
"name": "assetPathString",
"type": "string",
"description": "Read-only string that is computed from the `assetRoute`. Will be\npushed into the URL path.",
"privacy": "public",
"sourceRange": {
"start": {
"line": 327,
"column": 8
},
"end": {
"line": 332,
"column": 9
}
},
"metadata": {
"polymer": {
"readOnly": true
}
},
"defaultValue": "\"\""
},
{
"name": "path",
"type": "string",
"description": "Read-only string that is computed from the `navRoute` and\n`assetRoute` models (if they are enabled). Will be used to set the\nURL path.",
"privacy": "public",
"sourceRange": {
"start": {
"line": 339,
"column": 8
},
"end": {
"line": 344,
"column": 9
}
},
"metadata": {
"polymer": {
"observer": "\"_handlePathChanged\"",
"readOnly": true
}
}
},
{
"name": "_isReady",
"type": "boolean",
"description": "",
"privacy": "protected",
"sourceRange": {
"start": {
"line": 346,
"column": 8
},
"end": {
"line": 346,
"column": 25
}
},
"metadata": {
"polymer": {}
}
}
],
"methods": [
{
"name": "ready",
"description": "",
"privacy": "protected",
"sourceRange": {
"start": {
"line": 353,
"column": 6
},
"end": {
"line": 355,
"column": 7
}
},
"metadata": {},
"params": []
},
{
"name": "_computeAppNavPathString",
"description": "",
"privacy": "protected",
"sourceRange": {
"start": {
"line": 357,
"column": 6
},
"end": {
"line": 367,
"column": 7
}
},
"metadata": {},
"params": [
{
"name": "updateNavRoute"
},
{
"name": "navRoute"
},
{
"name": "segmentPathsWith"
}
]
},
{
"name": "_computeAppAssetPathString",
"description": "",
"privacy": "protected",
"sourceRange": {
"start": {
"line": 369,
"column": 6
},
"end": {
"line": 379,
"column": 7
}
},
"metadata": {},
"params": [
{
"name": "updateAssetRoute"
},
{
"name": "assetRoute"
},
{
"name": "segmentPathsWith"
}
]
},
{
"name": "_computePath",
"description": "",
"privacy": "protected",
"sourceRange": {
"start": {
"line": 381,
"column": 6
},
"end": {
"line": 396,
"column": 7
}
},
"metadata": {},
"params": [
{
"name": "updateNavRoute"
},
{
"name": "navPath"
},
{
"name": "updateAssetRoute"
},
{
"name": "assetPath"
},
{
"name": "pathSegment"
},
{
"name": "modelSegment"
},
{
"name": "useHash"
}
]
},
{
"name": "_handlePathChanged",
"description": "",
"privacy": "protected",
"sourceRange": {
"start": {
"line": 398,
"column": 6
},
"end": {
"line": 402,
"column": 7
}
},
"metadata": {},
"params": [
{
"name": "newPath"
},
{
"name": "oldPath"
}
]
},
{
"name": "_handleRouteChanged",
"description": "",
"privacy": "protected",
"sourceRange": {
"start": {
"line": 404,
"column": 6
},
"end": {
"line": 411,
"column": 7
}
},
"metadata": {},
"params": [
{
"name": "newRoute"
},
{
"name": "oldRoute"
}
]
},
{
"name": "_windowPathChanged",
"description": "",
"privacy": "protected",
"sourceRange": {
"start": {
"line": 413,
"column": 6
},
"end": {
"line": 431,
"column": 7
}
},
"metadata": {},
"params": [
{
"name": "newPath"
}
]
},
{
"name": "encodeAllPaths",
"description": "Encodes multiple route models into a path string that can be passed to\na JavaScript router (or to `window.location`). Pass an object with\n`navRoute` and `assetRoute` route arrays and an optional configuration\nobject.\n\nTo generate a path for nav and asset items, call with the following\narguments:\n\n```\n encodeAllPaths(\n {\n navRoute: ['dashboards', 'truck-locations'],\n assetRoute: ['us', 'calif', 'bay-area']\n },\n {\n segmentPathsWith: '/',\n segmentModelsWith: '~',\n prefixFirstPath: true\n }\n );\n```\n\nThe following string will be returned:\n\n```\n '/dashboards/truck-locations~/us/calif/bay-area'\n```\n\n## Passing routes\n\nThe `routes` argument should be an object with one or both of the\nfollowing keys:\n\n - `navRoute`: An array of strings\n - `assetRoute`: An array of strings\n\n## Configuring the encoder\n\nThe following `options` can be passed to change the output:\n\n - `segmentPathsWith`: Any URI-safe character (one of `-`, `.`, `_`, or `~`)\n - `segmentModelsWith`: Any URI-safe character (one of `-`, `.`, `_`, or `~`)\n - `prefixFirstPath`: Adds the path segment character to the front of the returned path",
"privacy": "public",
"sourceRange": {
"start": {
"line": 482,
"column": 6
},
"end": {
"line": 484,
"column": 7
}
},
"metadata": {},
"params": [
{
"name": "routes",
"type": "Object"
},
{
"name": "options",
"type": "Object"
}
],
"return": {
"type": "String"
}
},
{
"name": "encodePath",
"description": "Encodes a route (an array of string) into a path string that can be passed\nto a JavaScript router (or to `window.location`). Pass an array of\nstrings and a URI-safe character to segment the strings with (e.g. '/').\nOptionally set the `prefixFirstPath` argument to true to add the segment\ncharacter to the front of the path.\n\nFor example, given the following settings:\n\n```\n encodePath(['dashboards', 'truck-locations'], '/', true);\n```\n\nThe following string will be returned:\n\n```\n '/dashboards/truck-locations'\n```",
"privacy": "public",
"sourceRange": {
"start": {
"line": 511,
"column": 6
},
"end": {
"line": 513,
"column": 7
}
},
"metadata": {},
"params": [
{
"name": "route",
"type": "Array",
"description": "an array of string"
},
{
"name": "segmentWith",
"type": "Object",
"description": "a URI-safe character that will be placed between each path segment"
},
{
"name": "prefixFirstPath",
"type": "Boolean",
"description": "adds the segment character to the front of the returned path"
}
],
"return": {
"type": "String"
}
},
{
"name": "decodePath",
"description": "Decodes a URI path into arrays of route strings that can be passed to\nother components to synchronise state.\n\n## Decode navigation path only\n\nTo decode a path string that only contains nav items, call the method\nwith the path to decode and the following options:\n\n```\n decodePath('/dashboards/truck-locations', {\n navRoute: true\n });\n```\n\nThe following object will be returned:\n\n```\n {\n navRoute: ['dashboards', 'truck-locations']\n }\n```\n\n## Decode navigation and asset paths\n\nTo decode a path string that contains nav items and asset items,\ncall the method with the path to decode and the following options:\n\n```\n decodePath('/dashboards/truck-locations~/us/calif/bay-area', {\n navRoute: true,\n assetRoute: true\n });\n```\n\nThe following object will be returned:\n\n```\n {\n navRoute: ['dashboards', 'truck-locations'],\n assetRoute: ['us', 'calif', 'bay-area']\n }\n```\n\n## Configuring segment seperators\n\nThe characters used to seperate segments of each path, and the character\nused to join multiple model paths, can be set through the options\nobject to any URI-safe character (one of `-`, `.`, `_`, or `~`).\n\nTo decode this custom path, use the following options:\n\n```\n decodePath('alerts.inbox_factories.factory1.area38', {\n navRoute: true,\n assetRoute: true,\n segmentPathsWith: '.',\n segmentModelsWith: '_'\n });\n```\n\nThe following object will be returned:\n\n```\n {\n navRoute: ['alerts', 'inbox'],\n assetRoute: ['factories', 'factory1', 'area38']\n }\n```\n\n## All configurations\n\nThe following `options` can be passed to change the output:\n\n - `navRoute`: A boolean, if `true` the nav route will be decoded\n - `assetRoute`: A boolean, if `true` the asset route will be decoded\n - `segmentPathsWith`: Any URI-safe character (one of `-`, `.`, `_`, or `~`)\n - `segmentModelsWith`: Any URI-safe character (one of `-`, `.`, `_`, or `~`)\n - `stripPrefix`: Strips the `segmentPathsWith` character from the front of the path, if it is found there",
"privacy": "public",
"sourceRange": {
"start": {
"line": 599,
"column": 6
},
"end": {
"line": 601,
"column": 7
}
},
"metadata": {},
"params": [
{
"name": "path",
"type": "String"
},
{
"name": "options",
"type": "Object"
}
],
"return": {
"type": "Object"
}
},
{
"name": "isDeepEqual",
"description": "Determines if two arrays of strings are deeply equal - returns `true`\nif both arrays have the same strings in the same order. Helps perform\nchecks on the equality of arrays of route strings.",
"privacy": "public",
"sourceRange": {
"start": {
"line": 612,
"column": 6
},
"end": {
"line": 614,
"column": 7
}
},
"metadata": {},
"params": [
{
"name": "a1",
"type": "Array"
},
{
"name": "a2",
"type": "Array"
}
],
"return": {
"type": "Boolean"
}
}
],
"staticMethods": [],
"demos": [],
"metadata": {},
"sourceRange": {
"start": {
"line": 215,
"column": 12
},
"end": {
"line": 615,
"column": 5
}
},
"privacy": "public",
"superclass": "HTMLElement",
"attributes": [
{
"name": "segment-paths-with",
"description": "Valid URI-safe character used to seperate URL path segments. Defaults\nto '/' (e.g. the path ['about','company-info'] would be joined as\n'about/company-info').\n\nChoose a safe, unreserved URI character to ensure there are no issues.\nSee [RFC 3986](http://www.ietf.org/rfc/rfc3986.txt) for a list of\nunsafe and reserved characters. In general, use one of: `-`, `.`,\n`_`, or `~`. Note that character should not occur in any paths.",
"sourceRange": {
"start": {
"line": 229,
"column": 8
},
"end": {
"line": 232,
"column": 9
}
},
"metadata": {},
"type": "string"
},
{
"name": "segment-models-with",
"description": "Valid URI-safe character used to seperate different models in the\nURL. Defaults to '~' (e.g. the nav path ['about','company-info'] and\nasset path ['dashboards','trucks'] would be joined as\n'about/company-info~dashboards/trucks'.\n\nChoose a safe, unreserved URI character to ensure there are no issues.\nSee [RFC 3986](http://www.ietf.org/rfc/rfc3986.txt) for a list of\nunsafe and reserved characters. In general, use one of: `-`, `.`,\n`_`, or `~`. Note that character should not occur in any paths.",
"sourceRange": {
"start": {
"line": 245,
"column": 8
},
"end": {
"line": 248,
"column": 9
}
},
"metadata": {},
"type": "string"
},
{
"name": "route",
"description": "Bind this property to the `route` exposes by the <app-location> element.\nUpdates to the URL path will be propagated to `route.path` and decoded\nby this component to update the app-nav and app-asset models. Updates\nto the models will be pushed to the URL path.",
"sourceRange": {
"start": {
"line": 256,
"column": 8
},
"end": {
"line": 260,
"column": 9
}
},
"metadata": {},
"type": "Object"
},
{
"name": "use-hash-as-path",
"description": "Set to `true` if the URL path will be prefixed with a `#` character.\nThis should also be enabled on the <app-location> element that shares\nits route with this component.",
"sourceRange": {
"start": {
"line": 267,
"column": 8
},
"end": {
"line": 270,
"column": 9
}
},
"metadata": {},
"type": "boolean"
},
{
"name": "update-nav-route",
"description": "Set to `true` to sync a <px-app-nav> component's state with the URL\nbar. See the `navRoute` property for help on binding changes.",
"sourceRange": {
"start": {
"line": 276,
"column": 8
},
"end": {
"line": 279,
"column": 9
}
},
"metadata": {},
"type": "boolean"
},
{
"name": "nav-route",
"description": "Bind this property to a <px-app-nav> component's `selectedRoute`\nproperty to keep the navigation state in sync with the URL path.\nMust enable `updateNavRoute` for this to work.",
"sourceRange": {
"start": {
"line": 286,
"column": 8
},
"end": {
"line": 289,
"column": 9
}
},
"metadata": {},
"type": "Array"
},
{
"name": "nav-path-string",
"description": "Read-only string that is computed from the `navRoute`. Will be\npushed into the URL path.",
"sourceRange": {
"start": {
"line": 295,
"column": 8
},
"end": {
"line": 300,
"column": 9
}
},
"metadata": {},
"type": "string"
},
{
"name": "update-asset-route",
"description": "Set to `true` to sync the state of components that use the Asset Graph\nBehavior with the URL path. See the `assetRoute` property for help\non binding changes.",
"sourceRange": {
"start": {
"line": 307,
"column": 8
},
"end": {
"line": 310,
"column": 9
}
},
"metadata": {},
"type": "boolean"
},
{
"name": "asset-route",
"description": "Bind this property to a the `selectedRoute` property of one or more\ncomponents that use the Asset Graph Behavior to keep the selected\nasset state in sync with the URL path. Must enable `updateAssetRoute` for\nthis to work.",
"sourceRange": {
"start": {
"line": 318,
"column": 8
},
"end": {
"line": 321,
"column": 9
}
},
"metadata": {},
"type": "Array"
},
{
"name": "asset-path-string",
"description": "Read-only string that is computed from the `assetRoute`. Will be\npushed into the URL path.",
"sourceRange": {
"start": {
"line": 327,
"column": 8
},
"end": {
"line": 332,
"column": 9
}
},
"metadata": {},
"type": "string"
},
{
"name": "path",
"description": "Read-only string that is computed from the `navRoute` and\n`assetRoute` models (if they are enabled). Will be used to set the\nURL path.",
"sourceRange": {
"start": {
"line": 339,
"column": 8
},
"end": {
"line": 344,
"column": 9
}
},
"metadata": {},
"type": "string"
}
],
"events": [
{
"type": "CustomEvent",
"name": "route-changed",
"description": "Fired when the `route` property changes.",
"metadata": {}
},
{
"type": "CustomEvent",
"name": "nav-route-changed",
"description": "Fired when the `navRoute` property changes.",
"metadata": {}
},
{
"type": "CustomEvent",
"name": "asset-route-changed",
"description": "Fired when the `assetRoute` property changes.",
"metadata": {}
}
],
"styling": {
"cssVariables": [],
"selectors": []
},
"slots": [],
"tagname": "px-app-route"
}
],
"metadata": {
"polymer": {
"behaviors": [
{