@venite/components 0.16.17 → 0.16.21

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.
Files changed (128) hide show
  1. package/dist/cjs/{change-cdb1e8c0.js → change-deff223a.js} +0 -0
  2. package/dist/cjs/{cursor-81bfd01e.js → cursor-849a5372.js} +0 -0
  3. package/dist/cjs/{heading-5afc2b24.js → heading-fae3ce98.js} +2 -2
  4. package/dist/cjs/{image-3bee3e73.js → image-41000c7b.js} +2 -2
  5. package/dist/cjs/{book-1a92678a.js → index-c9b940c7.js} +96 -2
  6. package/dist/cjs/ion-button_13.cjs.entry.js +25 -4
  7. package/dist/cjs/ion-card-content_6.cjs.entry.js +4 -3
  8. package/dist/cjs/ion-checkbox_3.cjs.entry.js +3 -2
  9. package/dist/cjs/ion-input_2.cjs.entry.js +3 -3
  10. package/dist/cjs/ion-segment_16.cjs.entry.js +20 -20
  11. package/dist/cjs/ldf-day-name_5.cjs.entry.js +90 -76
  12. package/dist/cjs/ldf-editable-add-block-menu.cjs.entry.js +10 -9
  13. package/dist/cjs/ldf-editable-condition-piece.cjs.entry.js +7 -6
  14. package/dist/cjs/ldf-editable-condition.cjs.entry.js +5 -4
  15. package/dist/cjs/ldf-editable-filter-documents.cjs.entry.js +11 -10
  16. package/dist/cjs/ldf-editable-lookup_2.cjs.entry.js +10 -9
  17. package/dist/cjs/ldf-editable-metadata.cjs.entry.js +11 -10
  18. package/dist/cjs/ldf-editable-preference-option.cjs.entry.js +4 -3
  19. package/dist/cjs/ldf-editable-preference.cjs.entry.js +4 -3
  20. package/dist/cjs/ldf-editable-preferences.cjs.entry.js +4 -3
  21. package/dist/cjs/ldf-editable-string-list.cjs.entry.js +3 -2
  22. package/dist/cjs/ldf-editor.cjs.entry.js +14 -14
  23. package/dist/cjs/ldf.cjs.js +1 -1
  24. package/dist/cjs/loader.cjs.js +1 -1
  25. package/dist/cjs/{option-a078d432.js → option-6fb78f5c.js} +5 -17
  26. package/dist/cjs/{preference-a4bd51c4.js → preference-1365e161.js} +0 -0
  27. package/dist/cjs/{refrain-91fb446b.js → refrain-f51fd88d.js} +2 -2
  28. package/dist/cjs/{rubric-9cc04cb0.js → rubric-ad2f926f.js} +15 -482
  29. package/dist/cjs/{specific-class-36a74859.js → specific-class-071762e7.js} +5 -5
  30. package/dist/cjs/{text-5edb80f3.js → text-8d8d32e7.js} +2 -2
  31. package/dist/collection/components/prayers-and-thanksgivings/dist/prayers-and-thanksgivings.js +21 -5
  32. package/dist/collection/components/prayers-and-thanksgivings/prayers-and-thanksgivings.i18n.es.json +3 -0
  33. package/dist/collection/components/prayers-and-thanksgivings/prayers-and-thanksgivings.js +20 -4
  34. package/dist/collection/components/text/dist/text.js +43 -16
  35. package/dist/collection/components/text/text.css +14 -1
  36. package/dist/collection/components/text/text.i18n.en.json +2 -1
  37. package/dist/collection/components/text/text.i18n.es.json +2 -1
  38. package/dist/collection/components/text/text.js +71 -19
  39. package/dist/collection/i18n/prayers-and-thanksgivings.i18n.es.json +3 -0
  40. package/dist/collection/i18n/text.i18n.en.json +2 -1
  41. package/dist/collection/i18n/text.i18n.es.json +2 -1
  42. package/dist/esm/{change-ea574d32.js → change-b077b77c.js} +0 -0
  43. package/dist/esm/{cursor-0e47f111.js → cursor-cb97384b.js} +0 -0
  44. package/dist/esm/{heading-cc5ffa8a.js → heading-c03fbe8b.js} +1 -1
  45. package/dist/esm/{image-c6a3f0c5.js → image-a1336f0a.js} +1 -1
  46. package/dist/esm/{book-31b8cdde.js → index-2e220677.js} +96 -2
  47. package/dist/esm/ion-button_13.entry.js +25 -4
  48. package/dist/esm/ion-card-content_6.entry.js +4 -3
  49. package/dist/esm/ion-checkbox_3.entry.js +3 -2
  50. package/dist/esm/ion-input_2.entry.js +3 -3
  51. package/dist/esm/ion-segment_16.entry.js +7 -7
  52. package/dist/esm/ldf-day-name_5.entry.js +31 -17
  53. package/dist/esm/ldf-editable-add-block-menu.entry.js +8 -7
  54. package/dist/esm/ldf-editable-condition-piece.entry.js +3 -2
  55. package/dist/esm/ldf-editable-condition.entry.js +3 -2
  56. package/dist/esm/ldf-editable-filter-documents.entry.js +3 -2
  57. package/dist/esm/ldf-editable-lookup_2.entry.js +9 -8
  58. package/dist/esm/ldf-editable-metadata.entry.js +9 -8
  59. package/dist/esm/ldf-editable-preference-option.entry.js +4 -3
  60. package/dist/esm/ldf-editable-preference.entry.js +4 -3
  61. package/dist/esm/ldf-editable-preferences.entry.js +4 -3
  62. package/dist/esm/ldf-editable-string-list.entry.js +3 -2
  63. package/dist/esm/ldf-editor.entry.js +3 -3
  64. package/dist/esm/ldf.js +1 -1
  65. package/dist/esm/loader.js +1 -1
  66. package/dist/esm/{option-c16af13a.js → option-e130a4b2.js} +4 -16
  67. package/dist/esm/{preference-d070d4cb.js → preference-60cdfde3.js} +0 -0
  68. package/dist/esm/{refrain-75a412cb.js → refrain-9b9f05cc.js} +1 -1
  69. package/dist/esm/{rubric-09337f3c.js → rubric-0d2b870d.js} +8 -475
  70. package/dist/esm/{specific-class-e890ce29.js → specific-class-3f0e0c45.js} +5 -5
  71. package/dist/esm/{text-ed75fbd4.js → text-801eb7de.js} +1 -1
  72. package/dist/ldf/i18n/prayers-and-thanksgivings.i18n.es.json +3 -0
  73. package/dist/ldf/i18n/text.i18n.en.json +2 -1
  74. package/dist/ldf/i18n/text.i18n.es.json +2 -1
  75. package/dist/ldf/ldf.esm.js +1 -1
  76. package/dist/ldf/{p-935cb02a.entry.js → p-05ac8045.entry.js} +1 -1
  77. package/dist/ldf/{p-23af1bc3.entry.js → p-0d9b71a8.entry.js} +1 -1
  78. package/dist/ldf/{p-8ec26587.js → p-12d81208.js} +0 -0
  79. package/dist/ldf/{p-991c0877.js → p-2a08ff25.js} +0 -0
  80. package/dist/ldf/p-31a1f740.js +1 -0
  81. package/dist/ldf/p-34e37c39.entry.js +1 -0
  82. package/dist/ldf/p-37d9f551.entry.js +1 -0
  83. package/dist/ldf/p-3a7cb4d5.entry.js +1 -0
  84. package/dist/ldf/p-3e0814c2.entry.js +1 -0
  85. package/dist/ldf/p-405928d1.js +1 -0
  86. package/dist/ldf/p-4ed034a1.js +1 -0
  87. package/dist/ldf/p-5eef960d.entry.js +1 -0
  88. package/dist/ldf/p-67c52455.entry.js +1 -0
  89. package/dist/ldf/p-69d493f3.entry.js +1 -0
  90. package/dist/ldf/{p-5066eaa5.js → p-6a68fa7b.js} +0 -0
  91. package/dist/ldf/p-80f6ec9f.js +1 -0
  92. package/dist/ldf/p-82f2facb.entry.js +1 -0
  93. package/dist/ldf/{p-5b43e6be.js → p-93911ad1.js} +1 -1
  94. package/dist/ldf/p-9424ca03.entry.js +1 -0
  95. package/dist/ldf/p-952f8992.entry.js +1 -0
  96. package/dist/ldf/p-9b008ca8.entry.js +1 -0
  97. package/dist/ldf/p-a712728b.js +1 -0
  98. package/dist/ldf/p-b37dd77a.entry.js +1 -0
  99. package/dist/ldf/p-b3b245a2.entry.js +1 -0
  100. package/dist/ldf/p-bc84c531.entry.js +1 -0
  101. package/dist/ldf/p-c02098e2.entry.js +1 -0
  102. package/dist/ldf/p-cec60628.js +1 -0
  103. package/dist/ldf/p-ff0452c1.js +3 -0
  104. package/dist/types/components/text/text.d.ts +4 -0
  105. package/dist/types/components.d.ts +5 -0
  106. package/package.json +2 -2
  107. package/dist/ldf/p-03afc8cb.entry.js +0 -1
  108. package/dist/ldf/p-2ae548b3.entry.js +0 -1
  109. package/dist/ldf/p-304a2bdb.entry.js +0 -1
  110. package/dist/ldf/p-30b07706.js +0 -1
  111. package/dist/ldf/p-476327d6.js +0 -1
  112. package/dist/ldf/p-4aa9a6f2.js +0 -1
  113. package/dist/ldf/p-594fa9d4.entry.js +0 -1
  114. package/dist/ldf/p-65563763.entry.js +0 -1
  115. package/dist/ldf/p-65d26c45.js +0 -1
  116. package/dist/ldf/p-65ea7ab3.entry.js +0 -1
  117. package/dist/ldf/p-800a115c.entry.js +0 -1
  118. package/dist/ldf/p-8d1a3849.entry.js +0 -1
  119. package/dist/ldf/p-9c1973a6.entry.js +0 -1
  120. package/dist/ldf/p-9d09f906.js +0 -3
  121. package/dist/ldf/p-a1729dbd.js +0 -1
  122. package/dist/ldf/p-cc383802.entry.js +0 -1
  123. package/dist/ldf/p-e4f0cd91.entry.js +0 -1
  124. package/dist/ldf/p-e7a449d7.js +0 -1
  125. package/dist/ldf/p-f0de7628.entry.js +0 -1
  126. package/dist/ldf/p-f184d804.entry.js +0 -1
  127. package/dist/ldf/p-f529ee3c.entry.js +0 -1
  128. package/dist/ldf/p-fa191f47.entry.js +0 -1
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
- const rubric = require('./rubric-9cc04cb0.js');
4
- const heading = require('./heading-5afc2b24.js');
5
- const option = require('./option-a078d432.js');
6
- const refrain = require('./refrain-91fb446b.js');
7
- const text = require('./text-5edb80f3.js');
3
+ const rubric = require('./rubric-ad2f926f.js');
4
+ const heading = require('./heading-fae3ce98.js');
5
+ const option = require('./option-6fb78f5c.js');
6
+ const refrain = require('./refrain-f51fd88d.js');
7
+ const text = require('./text-8d8d32e7.js');
8
8
 
9
9
  /** Transforms a generic `LiturgicalDocument` (either a class instance or an `Object` that matches the type),
10
10
  * into an instance of a more-specific inherited class */
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
- const book = require('./book-1a92678a.js');
3
+ const index = require('./index-c9b940c7.js');
4
4
 
5
5
  const STYLES = ['text', 'prayer', 'markdown', 'authorized-prayers'];
6
6
  /** Text represents collect or any other short prayer. */
7
- class Text extends book.LiturgicalDocument {
7
+ class Text extends index.LiturgicalDocument {
8
8
  //** Constructor takes a Javascript object containing the class's properties */
9
9
  constructor(data = {}) {
10
10
  super(data);
@@ -66,8 +66,10 @@ var core_2 = require("@stencil/core");
66
66
  var ldf_1 = require("@venite/ldf");
67
67
  var locale_1 = require("../../utils/locale");
68
68
  var prayers_and_thanksgivings_i18n_en_json_1 = require("./prayers-and-thanksgivings.i18n.en.json");
69
+ var prayers_and_thanksgivings_i18n_es_json_1 = require("./prayers-and-thanksgivings.i18n.es.json");
69
70
  var LOCALE = {
70
- 'en': prayers_and_thanksgivings_i18n_en_json_1["default"]
71
+ 'en': prayers_and_thanksgivings_i18n_en_json_1["default"],
72
+ 'es': prayers_and_thanksgivings_i18n_es_json_1["default"]
71
73
  };
72
74
  var PrayersAndThanksgivingsComponent = /** @class */ (function () {
73
75
  function PrayersAndThanksgivingsComponent() {
@@ -192,10 +194,24 @@ var PrayersAndThanksgivingsComponent = /** @class */ (function () {
192
194
  React.createElement("h3", { "class": "padded" }, subcategory)
193
195
  ], subvalues
194
196
  .sort(function (a, b) { var _a, _b; return Number((_a = a.label) === null || _a === void 0 ? void 0 : _a.split('.')[0]) < Number((_b = b.label) === null || _b === void 0 ? void 0 : _b.split('.')[0]) ? -1 : 1; })
195
- .map(function (option) { return React.createElement("ion-item", { button: true, onClick: function () { return _this.addPrayer(option); } },
196
- React.createElement("ion-label", null,
197
- React.createElement("h3", null, option.label),
198
- React.createElement("p", null, option.value[0].replace(/\*/g, '').replace(" ", " ")))); }));
197
+ .map(function (option) {
198
+ var _a, _b, _c, _d;
199
+ var summary;
200
+ if (option.type == "text") {
201
+ summary = option.value[0].replace(/\*/g, '').replace(" ", " ");
202
+ }
203
+ else if (option.type == "liturgy") {
204
+ summary = (_c = (_b = (_a = option.value[0]) === null || _a === void 0 ? void 0 : _a.value[0]) === null || _b === void 0 ? void 0 : _b.replace(/\*/g, '')) === null || _c === void 0 ? void 0 : _c.replace(" ", " ");
205
+ }
206
+ else if (option.type == "responsive-prayer") {
207
+ summary = (_d = option.value[0]) === null || _d === void 0 ? void 0 : _d.text;
208
+ }
209
+ summary = summary || "";
210
+ return React.createElement("ion-item", { button: true, onClick: function () { return _this.addPrayer(option); } },
211
+ React.createElement("ion-label", null,
212
+ React.createElement("h3", null, option.label),
213
+ React.createElement("p", null, summary)));
214
+ }));
199
215
  }));
200
216
  }));
201
217
  return this.modal
@@ -0,0 +1,3 @@
1
+ {
2
+ "title": "Oraciones y Acciones de Gracias"
3
+ }
@@ -3,8 +3,10 @@ import { Component, Prop, Watch, State, Element, h, Event, Method } from '@stenc
3
3
  import { Change } from '@venite/ldf';
4
4
  import { getComponentClosestLanguage } from '../../utils/locale';
5
5
  import EN from './prayers-and-thanksgivings.i18n.en.json';
6
+ import ES from './prayers-and-thanksgivings.i18n.es.json';
6
7
  const LOCALE = {
7
8
  'en': EN,
9
+ 'es': ES
8
10
  };
9
11
  export class PrayersAndThanksgivingsComponent {
10
12
  constructor() {
@@ -95,10 +97,24 @@ export class PrayersAndThanksgivingsComponent {
95
97
  h("h3", { class: "padded" }, subcategory),
96
98
  ...subvalues
97
99
  .sort((a, b) => { var _a, _b; return Number((_a = a.label) === null || _a === void 0 ? void 0 : _a.split('.')[0]) < Number((_b = b.label) === null || _b === void 0 ? void 0 : _b.split('.')[0]) ? -1 : 1; })
98
- .map(option => h("ion-item", { button: true, onClick: () => this.addPrayer(option) },
99
- h("ion-label", null,
100
- h("h3", null, option.label),
101
- h("p", null, option.value[0].replace(/\*/g, '').replace(" ", " ")))))
100
+ .map(option => {
101
+ var _a, _b, _c, _d;
102
+ let summary;
103
+ if (option.type == "text") {
104
+ summary = option.value[0].replace(/\*/g, '').replace(" ", " ");
105
+ }
106
+ else if (option.type == "liturgy") {
107
+ summary = (_c = (_b = (_a = option.value[0]) === null || _a === void 0 ? void 0 : _a.value[0]) === null || _b === void 0 ? void 0 : _b.replace(/\*/g, '')) === null || _c === void 0 ? void 0 : _c.replace(" ", " ");
108
+ }
109
+ else if (option.type == "responsive-prayer") {
110
+ summary = (_d = option.value[0]) === null || _d === void 0 ? void 0 : _d.text;
111
+ }
112
+ summary = summary || "";
113
+ return h("ion-item", { button: true, onClick: () => this.addPrayer(option) },
114
+ h("ion-label", null,
115
+ h("h3", null, option.label),
116
+ h("p", null, summary)));
117
+ })
102
118
  ])
103
119
  ]));
104
120
  return this.modal
@@ -56,8 +56,20 @@ var LOCALE = {
56
56
  };
57
57
  var TextComponent = /** @class */ (function () {
58
58
  function TextComponent() {
59
+ // prayer list for authorized prayers
60
+ this.intentions = [];
59
61
  }
62
+ TextComponent.prototype.setPrayerList = function (intentions) {
63
+ return __awaiter(this, void 0, Promise, function () {
64
+ return __generator(this, function (_a) {
65
+ console.log("(PrayerList) setPrayerList", intentions);
66
+ this.intentions = intentions;
67
+ return [2 /*return*/];
68
+ });
69
+ });
70
+ };
60
71
  TextComponent.prototype.docChanged = function (newDoc) {
72
+ var _a;
61
73
  try {
62
74
  if (typeof newDoc == 'string') {
63
75
  this.obj = new ldf_1.Text(JSON.parse(newDoc));
@@ -65,6 +77,10 @@ var TextComponent = /** @class */ (function () {
65
77
  else {
66
78
  this.obj = new ldf_1.Text(newDoc);
67
79
  }
80
+ if (((_a = this.obj) === null || _a === void 0 ? void 0 : _a.style) == "authorized-prayers") {
81
+ console.log("(PrayerList) ldfAskForPrayerList");
82
+ this.ldfAskForPrayerList.emit(true);
83
+ }
68
84
  }
69
85
  catch (e) {
70
86
  console.warn(e);
@@ -133,21 +149,23 @@ var TextComponent = /** @class */ (function () {
133
149
  // Render
134
150
  TextComponent.prototype.render = function () {
135
151
  var _this = this;
136
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5;
152
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7;
137
153
  var localeStrings = this.localeStrings || {};
138
154
  /** `authorized-prayer` type */
139
155
  if (((_a = this.obj) === null || _a === void 0 ? void 0 : _a.style) === 'authorized-prayers') {
140
156
  var splits = this.path.split('/'), index_1 = Number(splits[splits.length - 1]), base_1 = splits.slice(0, splits.length - 1).join('/');
141
- return React.createElement("ldf-label-bar", null,
142
- React.createElement("ion-button", { onClick: function () { return _this.addPAndT(base_1, index_1); }, fill: "clear" }, localeStrings.authorized_prayers));
157
+ return React.createElement(core_1.Host, null,
158
+ React.createElement("ldf-label-bar", null,
159
+ React.createElement("ion-button", { onClick: function () { return _this.addPAndT(base_1, index_1); }, fill: "clear" }, localeStrings.authorized_prayers)), (_c = ((_b = this.intentions) === null || _b === void 0 ? void 0 : _b.length) > 0) !== null && _c !== void 0 ? _c : React.createElement("strong", { "class": "prayer-list" }, localeStrings['prayer-list']),
160
+ React.createElement("ul", { "class": "prayer-list" }, (this.intentions || []).map(function (intention) { return React.createElement("li", null, intention); })));
143
161
  }
144
162
  else {
145
- var value = ((_c = (_b = this.obj) === null || _b === void 0 ? void 0 : _b.metadata) === null || _c === void 0 ? void 0 : _c.rollup) ? (((_d = this.obj) === null || _d === void 0 ? void 0 : _d.value) || []).map(function (s) { return s.replace(/\s+/g, ' '); })
146
- : (((_e = this.obj) === null || _e === void 0 ? void 0 : _e.value) || []);
163
+ var value = ((_e = (_d = this.obj) === null || _d === void 0 ? void 0 : _d.metadata) === null || _e === void 0 ? void 0 : _e.rollup) ? (((_f = this.obj) === null || _f === void 0 ? void 0 : _f.value) || []).map(function (s) { return s.replace(/\s+/g, ' '); })
164
+ : (((_g = this.obj) === null || _g === void 0 ? void 0 : _g.value) || []);
147
165
  var compiledValue_1 = value.map(function (s) {
148
166
  return s.split(/([\*\w\n\s,:;\.\-–—'“☩✠”‘’\!\?”\[\]\%\(\)\/\u0041-\u024F]+([^\*\w\n\s,;:\.'“”☩✠‘’”\-–—\!\?\[\]\%\(\)\/\u0041-\u024F]))/g);
149
167
  });
150
- if (!this.editable && ((_f = this.obj) === null || _f === void 0 ? void 0 : _f.display_format) === 'abbreviated') {
168
+ if (!this.editable && ((_h = this.obj) === null || _h === void 0 ? void 0 : _h.display_format) === 'abbreviated') {
151
169
  var firstSection = compiledValue_1[0], lastSection = compiledValue_1[compiledValue_1.length - 1];
152
170
  var firstChunk = this.truncate(firstSection[0]), lastChunk = this.truncate(lastSection[lastSection.length - 1], true);
153
171
  compiledValue_1 = [[firstChunk], [lastChunk]];
@@ -158,27 +176,27 @@ var TextComponent = /** @class */ (function () {
158
176
  React.createElement("slot", { slot: 'end', name: 'controls' })),
159
177
  !this.editable && React.createElement("ldf-heading", { path: this.path + "/label", doc: new ldf_1.Heading({ type: 'heading', metadata: { level: 3 }, value: [this.obj.label], citation: this.obj.citation, source: this.obj.source }) }),
160
178
  this.editable && React.createElement("ldf-label-bar", null,
161
- !((_h = (_g = this.obj) === null || _g === void 0 ? void 0 : _g.metadata) === null || _h === void 0 ? void 0 : _h.omit_label) && React.createElement("h3", { "class": "editable-label", slot: "start" },
162
- React.createElement("ldf-editable-text", { id: (this.obj.uid || this.obj.slug) + "-label", text: (_j = this.obj) === null || _j === void 0 ? void 0 : _j.label, placeholder: localeStrings.label, path: this.path + "/label" })),
163
- React.createElement("ldf-editable-text", { slot: "end", id: "source-source", text: (_l = (_k = this.obj) === null || _k === void 0 ? void 0 : _k.source) === null || _l === void 0 ? void 0 : _l.source, path: this.path + "/source/source", placeholder: (_m = this.localeStrings) === null || _m === void 0 ? void 0 : _m.source }),
164
- React.createElement("ldf-editable-text", { slot: "end", id: "source-citation", text: (_p = (_o = this.obj) === null || _o === void 0 ? void 0 : _o.source) === null || _p === void 0 ? void 0 : _p.citation, path: this.path + "/source/citation", placeholder: (_q = this.localeStrings) === null || _q === void 0 ? void 0 : _q.source_citation })),
165
- React.createElement("div", { "class": "text " + (this.editable ? 'editable' : '') + " " + (((_r = this.obj) === null || _r === void 0 ? void 0 : _r.display_format) || 'default') },
179
+ !((_k = (_j = this.obj) === null || _j === void 0 ? void 0 : _j.metadata) === null || _k === void 0 ? void 0 : _k.omit_label) && React.createElement("h3", { "class": "editable-label", slot: "start" },
180
+ React.createElement("ldf-editable-text", { id: (this.obj.uid || this.obj.slug) + "-label", text: (_l = this.obj) === null || _l === void 0 ? void 0 : _l.label, placeholder: localeStrings.label, path: this.path + "/label" })),
181
+ React.createElement("ldf-editable-text", { slot: "end", id: "source-source", text: (_o = (_m = this.obj) === null || _m === void 0 ? void 0 : _m.source) === null || _o === void 0 ? void 0 : _o.source, path: this.path + "/source/source", placeholder: (_p = this.localeStrings) === null || _p === void 0 ? void 0 : _p.source }),
182
+ React.createElement("ldf-editable-text", { slot: "end", id: "source-citation", text: (_r = (_q = this.obj) === null || _q === void 0 ? void 0 : _q.source) === null || _r === void 0 ? void 0 : _r.citation, path: this.path + "/source/citation", placeholder: (_s = this.localeStrings) === null || _s === void 0 ? void 0 : _s.source_citation })),
183
+ React.createElement("div", { "class": "text " + (this.editable ? 'editable' : '') + " " + (((_t = this.obj) === null || _t === void 0 ? void 0 : _t.display_format) || 'default') },
166
184
  this.obj.value.map(function (prayer, prayerIndex) {
167
185
  return React.createElement("ldf-editable-text", { id: (_this.obj.uid || _this.obj.slug) + "-" + prayerIndex, text: prayer, path: _this.path + "/value/" + prayerIndex });
168
186
  }),
169
- (((_s = this.obj) === null || _s === void 0 ? void 0 : _s.style) === 'prayer' || (((_u = (_t = this.obj) === null || _t === void 0 ? void 0 : _t.metadata) === null || _u === void 0 ? void 0 : _u.response) && !((_w = (_v = this.obj) === null || _v === void 0 ? void 0 : _v.metadata) === null || _w === void 0 ? void 0 : _w.omit_response))) && React.createElement("span", { "class": 'response' },
187
+ (((_u = this.obj) === null || _u === void 0 ? void 0 : _u.style) === 'prayer' || (((_w = (_v = this.obj) === null || _v === void 0 ? void 0 : _v.metadata) === null || _w === void 0 ? void 0 : _w.response) && !((_y = (_x = this.obj) === null || _x === void 0 ? void 0 : _x.metadata) === null || _y === void 0 ? void 0 : _y.omit_response))) && React.createElement("span", { "class": 'response' },
170
188
  React.createElement("ldf-editable-text", { id: (this.obj.uid || this.obj.slug) + "-response", text: this.obj.metadata && this.obj.metadata.response, path: this.path + "/response", placeholder: localeStrings.amen })))));
171
189
  }
172
190
  else {
173
191
  /** `markdown` types */
174
- if (((_x = this.obj) === null || _x === void 0 ? void 0 : _x.style) === 'markdown') {
192
+ if (((_z = this.obj) === null || _z === void 0 ? void 0 : _z.style) === 'markdown') {
175
193
  var converter_1 = new showdown_1["default"].Converter();
176
- return (((_y = this.obj) === null || _y === void 0 ? void 0 : _y.value) || []).map(function (value) { return React.createElement("div", { innerHTML: converter_1.makeHtml(value) }); });
194
+ return (((_0 = this.obj) === null || _0 === void 0 ? void 0 : _0.value) || []).map(function (value) { return React.createElement("div", { innerHTML: converter_1.makeHtml(value) }); });
177
195
  }
178
196
  /** `text` and `prayer` types */
179
197
  else {
180
- return (React.createElement("div", { lang: ((_z = this.obj) === null || _z === void 0 ? void 0 : _z.language) || 'en', "class": "text " + (((_0 = this.obj) === null || _0 === void 0 ? void 0 : _0.display_format) || 'default') },
181
- ((((_1 = this.obj) === null || _1 === void 0 ? void 0 : _1.label) && !((_3 = (_2 = this.obj) === null || _2 === void 0 ? void 0 : _2.metadata) === null || _3 === void 0 ? void 0 : _3.omit_label)) || ((_4 = this.obj) === null || _4 === void 0 ? void 0 : _4.citation)) && React.createElement("ldf-heading", { path: this.path, doc: new ldf_1.Heading({ type: 'heading', metadata: { level: 3 }, value: [((_5 = this.obj.metadata) === null || _5 === void 0 ? void 0 : _5.omit_label) ? '' : this.obj.label], citation: this.obj.citation, source: this.obj.source }) }),
198
+ return (React.createElement("div", { lang: ((_1 = this.obj) === null || _1 === void 0 ? void 0 : _1.language) || 'en', "class": "text " + (((_2 = this.obj) === null || _2 === void 0 ? void 0 : _2.display_format) || 'default') },
199
+ ((((_3 = this.obj) === null || _3 === void 0 ? void 0 : _3.label) && !((_5 = (_4 = this.obj) === null || _4 === void 0 ? void 0 : _4.metadata) === null || _5 === void 0 ? void 0 : _5.omit_label)) || ((_6 = this.obj) === null || _6 === void 0 ? void 0 : _6.citation)) && React.createElement("ldf-heading", { path: this.path, doc: new ldf_1.Heading({ type: 'heading', metadata: { level: 3 }, value: [((_7 = this.obj.metadata) === null || _7 === void 0 ? void 0 : _7.omit_label) ? '' : this.obj.label], citation: this.obj.citation, source: this.obj.source }) }),
182
200
  compiledValue_1.map(function (prayer, prayerIndex) {
183
201
  var _a, _b, _c, _d;
184
202
  return React.createElement("p", { "class": "text-body", id: (_this.obj.uid || _this.obj.slug) + "-prayerIndex" }, prayer === null || prayer === void 0 ? void 0 :
@@ -207,6 +225,12 @@ var TextComponent = /** @class */ (function () {
207
225
  __decorate([
208
226
  core_1.State()
209
227
  ], TextComponent.prototype, "localeStrings");
228
+ __decorate([
229
+ core_1.State()
230
+ ], TextComponent.prototype, "intentions");
231
+ __decorate([
232
+ core_1.Method()
233
+ ], TextComponent.prototype, "setPrayerList");
210
234
  __decorate([
211
235
  core_1.Prop()
212
236
  ], TextComponent.prototype, "doc");
@@ -222,6 +246,9 @@ var TextComponent = /** @class */ (function () {
222
246
  __decorate([
223
247
  core_1.Event({ bubbles: true })
224
248
  ], TextComponent.prototype, "ldfDocShouldChange");
249
+ __decorate([
250
+ core_1.Event({ bubbles: true })
251
+ ], TextComponent.prototype, "ldfAskForPrayerList");
225
252
  TextComponent = __decorate([
226
253
  core_1.Component({
227
254
  tag: 'ldf-text',
@@ -49,4 +49,17 @@ h3.editable-label {
49
49
  text-transform: var(--ldf-h3-text-transform);
50
50
  }
51
51
 
52
- /* .text.abbreviated is handled in the DOM itself, in the component */
52
+ /* .text.abbreviated is handled in the DOM itself, in the component */
53
+ .prayer-list {
54
+ display: block;
55
+ margin: 0;
56
+ padding: 0;
57
+ text-align: center;
58
+ }
59
+
60
+ .prayer-list li {
61
+ list-style-type: none;
62
+ text-align: center;
63
+ margin: 0.5em 0;
64
+ padding: 0;
65
+ }
@@ -3,5 +3,6 @@
3
3
  "authorized_prayers": "Prayers and Thanksgivings",
4
4
  "label": "Label",
5
5
  "source": "Source",
6
- "source_citation": "Citation"
6
+ "source_citation": "Citation",
7
+ "prayer-list": "Prayer List"
7
8
  }
@@ -1,3 +1,4 @@
1
1
  {
2
- "amen": "Amén."
2
+ "amen": "Amén.",
3
+ "prayer-list": "Oraciones"
3
4
  }
@@ -1,4 +1,4 @@
1
- import { Component, Prop, Watch, State, Element, Host, Event, h } from '@stencil/core';
1
+ import { Component, Prop, Watch, State, Element, Host, Event, h, Method } from '@stencil/core';
2
2
  import { Text, Heading } from '@venite/ldf';
3
3
  import { getComponentClosestLanguage } from '../../utils/locale';
4
4
  import showdown from 'showdown';
@@ -10,7 +10,16 @@ const LOCALE = {
10
10
  'es': ES
11
11
  };
12
12
  export class TextComponent {
13
+ constructor() {
14
+ // prayer list for authorized prayers
15
+ this.intentions = [];
16
+ }
17
+ async setPrayerList(intentions) {
18
+ console.log("(PrayerList) setPrayerList", intentions);
19
+ this.intentions = intentions;
20
+ }
13
21
  docChanged(newDoc) {
22
+ var _a;
14
23
  try {
15
24
  if (typeof newDoc == 'string') {
16
25
  this.obj = new Text(JSON.parse(newDoc));
@@ -18,6 +27,10 @@ export class TextComponent {
18
27
  else {
19
28
  this.obj = new Text(newDoc);
20
29
  }
30
+ if (((_a = this.obj) === null || _a === void 0 ? void 0 : _a.style) == "authorized-prayers") {
31
+ console.log("(PrayerList) ldfAskForPrayerList");
32
+ this.ldfAskForPrayerList.emit(true);
33
+ }
21
34
  }
22
35
  catch (e) {
23
36
  console.warn(e);
@@ -61,22 +74,24 @@ export class TextComponent {
61
74
  }
62
75
  // Render
63
76
  render() {
64
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5;
77
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7;
65
78
  const localeStrings = this.localeStrings || {};
66
79
  /** `authorized-prayer` type */
67
80
  if (((_a = this.obj) === null || _a === void 0 ? void 0 : _a.style) === 'authorized-prayers') {
68
81
  const splits = this.path.split('/'), index = Number(splits[splits.length - 1]), base = splits.slice(0, splits.length - 1).join('/');
69
- return h("ldf-label-bar", null,
70
- h("ion-button", { onClick: () => this.addPAndT(base, index), fill: "clear" }, localeStrings.authorized_prayers));
82
+ return h(Host, null,
83
+ h("ldf-label-bar", null,
84
+ h("ion-button", { onClick: () => this.addPAndT(base, index), fill: "clear" }, localeStrings.authorized_prayers)), (_c = ((_b = this.intentions) === null || _b === void 0 ? void 0 : _b.length) > 0) !== null && _c !== void 0 ? _c : h("strong", { class: "prayer-list" }, localeStrings['prayer-list']),
85
+ h("ul", { class: "prayer-list" }, (this.intentions || []).map(intention => h("li", null, intention))));
71
86
  }
72
87
  else {
73
- let value = ((_c = (_b = this.obj) === null || _b === void 0 ? void 0 : _b.metadata) === null || _c === void 0 ? void 0 : _c.rollup)
74
- ? (((_d = this.obj) === null || _d === void 0 ? void 0 : _d.value) || []).map(s => s.replace(/\s+/g, ' '))
75
- : (((_e = this.obj) === null || _e === void 0 ? void 0 : _e.value) || []);
88
+ let value = ((_e = (_d = this.obj) === null || _d === void 0 ? void 0 : _d.metadata) === null || _e === void 0 ? void 0 : _e.rollup)
89
+ ? (((_f = this.obj) === null || _f === void 0 ? void 0 : _f.value) || []).map(s => s.replace(/\s+/g, ' '))
90
+ : (((_g = this.obj) === null || _g === void 0 ? void 0 : _g.value) || []);
76
91
  let compiledValue = value.map(s => {
77
92
  return s.split(/([\*\w\n\s,:;\.\-–—'“☩✠”‘’\!\?”\[\]\%\(\)\/\u0041-\u024F]+([^\*\w\n\s,;:\.'“”☩✠‘’”\-–—\!\?\[\]\%\(\)\/\u0041-\u024F]))/g);
78
93
  });
79
- if (!this.editable && ((_f = this.obj) === null || _f === void 0 ? void 0 : _f.display_format) === 'abbreviated') {
94
+ if (!this.editable && ((_h = this.obj) === null || _h === void 0 ? void 0 : _h.display_format) === 'abbreviated') {
80
95
  const firstSection = compiledValue[0], lastSection = compiledValue[compiledValue.length - 1];
81
96
  const firstChunk = this.truncate(firstSection[0]), lastChunk = this.truncate(lastSection[lastSection.length - 1], true);
82
97
  compiledValue = [[firstChunk], [lastChunk]];
@@ -87,25 +102,25 @@ export class TextComponent {
87
102
  h("slot", { slot: 'end', name: 'controls' })),
88
103
  !this.editable && h("ldf-heading", { path: `${this.path}/label`, doc: new Heading({ type: 'heading', metadata: { level: 3 }, value: [this.obj.label], citation: this.obj.citation, source: this.obj.source }) }),
89
104
  this.editable && h("ldf-label-bar", null,
90
- !((_h = (_g = this.obj) === null || _g === void 0 ? void 0 : _g.metadata) === null || _h === void 0 ? void 0 : _h.omit_label) && h("h3", { class: "editable-label", slot: "start" },
91
- h("ldf-editable-text", { id: `${this.obj.uid || this.obj.slug}-label`, text: (_j = this.obj) === null || _j === void 0 ? void 0 : _j.label, placeholder: localeStrings.label, path: `${this.path}/label` })),
92
- h("ldf-editable-text", { slot: "end", id: "source-source", text: (_l = (_k = this.obj) === null || _k === void 0 ? void 0 : _k.source) === null || _l === void 0 ? void 0 : _l.source, path: `${this.path}/source/source`, placeholder: (_m = this.localeStrings) === null || _m === void 0 ? void 0 : _m.source }),
93
- h("ldf-editable-text", { slot: "end", id: "source-citation", text: (_p = (_o = this.obj) === null || _o === void 0 ? void 0 : _o.source) === null || _p === void 0 ? void 0 : _p.citation, path: `${this.path}/source/citation`, placeholder: (_q = this.localeStrings) === null || _q === void 0 ? void 0 : _q.source_citation })),
94
- h("div", { class: `text ${this.editable ? 'editable' : ''} ${((_r = this.obj) === null || _r === void 0 ? void 0 : _r.display_format) || 'default'}` },
105
+ !((_k = (_j = this.obj) === null || _j === void 0 ? void 0 : _j.metadata) === null || _k === void 0 ? void 0 : _k.omit_label) && h("h3", { class: "editable-label", slot: "start" },
106
+ h("ldf-editable-text", { id: `${this.obj.uid || this.obj.slug}-label`, text: (_l = this.obj) === null || _l === void 0 ? void 0 : _l.label, placeholder: localeStrings.label, path: `${this.path}/label` })),
107
+ h("ldf-editable-text", { slot: "end", id: "source-source", text: (_o = (_m = this.obj) === null || _m === void 0 ? void 0 : _m.source) === null || _o === void 0 ? void 0 : _o.source, path: `${this.path}/source/source`, placeholder: (_p = this.localeStrings) === null || _p === void 0 ? void 0 : _p.source }),
108
+ h("ldf-editable-text", { slot: "end", id: "source-citation", text: (_r = (_q = this.obj) === null || _q === void 0 ? void 0 : _q.source) === null || _r === void 0 ? void 0 : _r.citation, path: `${this.path}/source/citation`, placeholder: (_s = this.localeStrings) === null || _s === void 0 ? void 0 : _s.source_citation })),
109
+ h("div", { class: `text ${this.editable ? 'editable' : ''} ${((_t = this.obj) === null || _t === void 0 ? void 0 : _t.display_format) || 'default'}` },
95
110
  this.obj.value.map((prayer, prayerIndex) => h("ldf-editable-text", { id: `${this.obj.uid || this.obj.slug}-${prayerIndex}`, text: prayer, path: `${this.path}/value/${prayerIndex}` })),
96
- (((_s = this.obj) === null || _s === void 0 ? void 0 : _s.style) === 'prayer' || (((_u = (_t = this.obj) === null || _t === void 0 ? void 0 : _t.metadata) === null || _u === void 0 ? void 0 : _u.response) && !((_w = (_v = this.obj) === null || _v === void 0 ? void 0 : _v.metadata) === null || _w === void 0 ? void 0 : _w.omit_response))) && h("span", { class: 'response' },
111
+ (((_u = this.obj) === null || _u === void 0 ? void 0 : _u.style) === 'prayer' || (((_w = (_v = this.obj) === null || _v === void 0 ? void 0 : _v.metadata) === null || _w === void 0 ? void 0 : _w.response) && !((_y = (_x = this.obj) === null || _x === void 0 ? void 0 : _x.metadata) === null || _y === void 0 ? void 0 : _y.omit_response))) && h("span", { class: 'response' },
97
112
  h("ldf-editable-text", { id: `${this.obj.uid || this.obj.slug}-response`, text: this.obj.metadata && this.obj.metadata.response, path: `${this.path}/response`, placeholder: localeStrings.amen })))));
98
113
  }
99
114
  else {
100
115
  /** `markdown` types */
101
- if (((_x = this.obj) === null || _x === void 0 ? void 0 : _x.style) === 'markdown') {
116
+ if (((_z = this.obj) === null || _z === void 0 ? void 0 : _z.style) === 'markdown') {
102
117
  const converter = new showdown.Converter();
103
- return (((_y = this.obj) === null || _y === void 0 ? void 0 : _y.value) || []).map(value => h("div", { innerHTML: converter.makeHtml(value) }));
118
+ return (((_0 = this.obj) === null || _0 === void 0 ? void 0 : _0.value) || []).map(value => h("div", { innerHTML: converter.makeHtml(value) }));
104
119
  }
105
120
  /** `text` and `prayer` types */
106
121
  else {
107
- return (h("div", { lang: ((_z = this.obj) === null || _z === void 0 ? void 0 : _z.language) || 'en', class: `text ${((_0 = this.obj) === null || _0 === void 0 ? void 0 : _0.display_format) || 'default'}` },
108
- ((((_1 = this.obj) === null || _1 === void 0 ? void 0 : _1.label) && !((_3 = (_2 = this.obj) === null || _2 === void 0 ? void 0 : _2.metadata) === null || _3 === void 0 ? void 0 : _3.omit_label)) || ((_4 = this.obj) === null || _4 === void 0 ? void 0 : _4.citation)) && h("ldf-heading", { path: this.path, doc: new Heading({ type: 'heading', metadata: { level: 3 }, value: [((_5 = this.obj.metadata) === null || _5 === void 0 ? void 0 : _5.omit_label) ? '' : this.obj.label], citation: this.obj.citation, source: this.obj.source }) }),
122
+ return (h("div", { lang: ((_1 = this.obj) === null || _1 === void 0 ? void 0 : _1.language) || 'en', class: `text ${((_2 = this.obj) === null || _2 === void 0 ? void 0 : _2.display_format) || 'default'}` },
123
+ ((((_3 = this.obj) === null || _3 === void 0 ? void 0 : _3.label) && !((_5 = (_4 = this.obj) === null || _4 === void 0 ? void 0 : _4.metadata) === null || _5 === void 0 ? void 0 : _5.omit_label)) || ((_6 = this.obj) === null || _6 === void 0 ? void 0 : _6.citation)) && h("ldf-heading", { path: this.path, doc: new Heading({ type: 'heading', metadata: { level: 3 }, value: [((_7 = this.obj.metadata) === null || _7 === void 0 ? void 0 : _7.omit_label) ? '' : this.obj.label], citation: this.obj.citation, source: this.obj.source }) }),
109
124
  compiledValue.map((prayer, prayerIndex) => {
110
125
  var _a, _b, _c, _d;
111
126
  return h("p", { class: "text-body", id: `${this.obj.uid || this.obj.slug}-prayerIndex` }, prayer === null || prayer === void 0 ? void 0 :
@@ -193,7 +208,8 @@ export class TextComponent {
193
208
  }; }
194
209
  static get states() { return {
195
210
  "obj": {},
196
- "localeStrings": {}
211
+ "localeStrings": {},
212
+ "intentions": {}
197
213
  }; }
198
214
  static get events() { return [{
199
215
  "method": "ldfDocShouldChange",
@@ -215,7 +231,43 @@ export class TextComponent {
215
231
  }
216
232
  }
217
233
  }
234
+ }, {
235
+ "method": "ldfAskForPrayerList",
236
+ "name": "ldfAskForPrayerList",
237
+ "bubbles": true,
238
+ "cancelable": true,
239
+ "composed": true,
240
+ "docs": {
241
+ "tags": [],
242
+ "text": "Request prayer list for Prayers and Thanksgivings"
243
+ },
244
+ "complexType": {
245
+ "original": "boolean",
246
+ "resolved": "boolean",
247
+ "references": {}
248
+ }
218
249
  }]; }
250
+ static get methods() { return {
251
+ "setPrayerList": {
252
+ "complexType": {
253
+ "signature": "(intentions: string[]) => Promise<void>",
254
+ "parameters": [{
255
+ "tags": [],
256
+ "text": ""
257
+ }],
258
+ "references": {
259
+ "Promise": {
260
+ "location": "global"
261
+ }
262
+ },
263
+ "return": "Promise<void>"
264
+ },
265
+ "docs": {
266
+ "text": "",
267
+ "tags": []
268
+ }
269
+ }
270
+ }; }
219
271
  static get elementRef() { return "element"; }
220
272
  static get watchers() { return [{
221
273
  "propName": "doc",
@@ -0,0 +1,3 @@
1
+ {
2
+ "title": "Oraciones y Acciones de Gracias"
3
+ }
@@ -3,5 +3,6 @@
3
3
  "authorized_prayers": "Prayers and Thanksgivings",
4
4
  "label": "Label",
5
5
  "source": "Source",
6
- "source_citation": "Citation"
6
+ "source_citation": "Citation",
7
+ "prayer-list": "Prayer List"
7
8
  }
@@ -1,3 +1,4 @@
1
1
  {
2
- "amen": "Amén."
2
+ "amen": "Amén.",
3
+ "prayer-list": "Oraciones"
3
4
  }
@@ -1,4 +1,4 @@
1
- import { L as LiturgicalDocument } from './book-31b8cdde.js';
1
+ import { L as LiturgicalDocument } from './index-2e220677.js';
2
2
 
3
3
  const STYLES = ['text', 'day', 'date'];
4
4
  class Heading extends LiturgicalDocument {
@@ -1,4 +1,4 @@
1
- import { L as LiturgicalDocument } from './book-31b8cdde.js';
1
+ import { L as LiturgicalDocument } from './index-2e220677.js';
2
2
 
3
3
  const STYLES = ['normal', 'slideshow', 'carousel'];
4
4
  /** Refrain represents a short text like the Gloria Patri, Hail Mary, or an Antiphon */
@@ -1,3 +1,5 @@
1
+ import { c as createCommonjsModule } from './_commonjsHelpers-ba3f0406.js';
2
+
1
3
  // strip away everything but year, month, day
2
4
  function dateOnly(d) {
3
5
  d.setHours(0);
@@ -140,14 +142,17 @@ const TYPES = [
140
142
  'psalm',
141
143
  'meditation',
142
144
  'image',
143
- 'parallel',
144
145
  ];
145
146
  const LOOKUP_TYPES = ['lectionary', 'canticle', 'category', 'slug', 'collect'];
146
- const DISPLAY_FORMATS = ['default', 'omit', 'unison', 'abbreviated', 'force_dropcap'];
147
+ const DISPLAY_FORMATS = ['default', 'omit', 'unison', 'abbreviated'];
147
148
  /** Represents a liturgy of any scope and concreteness, from a complete bullletin to a single prayer. */
148
149
  class LiturgicalDocument {
149
150
  //** Constructor takes a Javascript object containing the class's properties */
150
151
  constructor(data = {}) {
152
+ /** Marks a document hidden, so it will not display but will not be deleted
153
+ * Typically used to a hide a subdocument within a larger liturgy without removing it entirely from the structure,
154
+ * making it easier to restore or toggle on and off */
155
+ this.hidden = false;
151
156
  Object.assign(this, data);
152
157
  }
153
158
  /** Evaluates the full set of conditions attached to the document and returns a boolean of whether it should be included
@@ -279,4 +284,93 @@ var Book;
279
284
  Book["Bel"] = "Bel";
280
285
  })(Book || (Book = {}));
281
286
 
287
+ createCommonjsModule(function (module, exports) {
288
+ // Reference: https://www.geeksforgeeks.org/jaro-and-jaro-winkler-similarity/
289
+ Object.defineProperty(exports, "__esModule", { value: true });
290
+ exports.jaroWinkler = exports.jaro = void 0;
291
+ /**
292
+ *
293
+ * @param str1 String 1 for compare
294
+ * @param str2 String 2 for compare
295
+ * @param options to control case sensitive or not
296
+ */
297
+ function jaro(str1, str2, options) {
298
+ // Exit early if either are empty.
299
+ if (str1.length === 0 || str2.length === 0) {
300
+ return 0;
301
+ }
302
+ // Convert to upper if case-sensitive is false.
303
+ if (options && !options.caseSensitive) {
304
+ str1 = str1.toUpperCase();
305
+ str2 = str2.toUpperCase();
306
+ }
307
+ // Exact match
308
+ if (str1 === str2) {
309
+ return 1;
310
+ }
311
+ // Number of matches
312
+ var m = 0;
313
+ // Length of two Strings
314
+ var len1 = str1.length;
315
+ var len2 = str2.length;
316
+ // Maximum distance
317
+ var window = Math.floor(Math.max(len1, len2) / 2) - 1;
318
+ // Hash for matches
319
+ var str1Hash = new Array(len1);
320
+ var str2Hash = new Array(len2);
321
+ for (var i = 0; i < len1; i++) {
322
+ for (var j = Math.max(0, i - window); j <= Math.min(len2, i + window + 1); j++) {
323
+ if (!str1Hash[i] && !str2Hash[j] && str1[i] === str2[j]) {
324
+ ++m;
325
+ str1Hash[i] = str2Hash[j] = true;
326
+ break;
327
+ }
328
+ }
329
+ }
330
+ // Exit early if no matches were found.
331
+ if (m === 0) {
332
+ return 0;
333
+ }
334
+ // Count the transpositions.
335
+ var t = 0;
336
+ var point = 0;
337
+ for (var i = 0; i < len1; i++) {
338
+ if (str1Hash[i]) {
339
+ while (!str2Hash[point]) {
340
+ point++;
341
+ }
342
+ if (str1.charAt(i) !== str2.charAt(point++)) {
343
+ t++;
344
+ }
345
+ }
346
+ }
347
+ t /= 2;
348
+ return (m / len1 + m / len2 + (m - t) / m) / 3;
349
+ }
350
+ exports.jaro = jaro;
351
+ /**
352
+ *
353
+ * @param str1 String 1 for compare
354
+ * @param str2 String 2 for compare
355
+ * @param options to control case sensitive or not
356
+ */
357
+ function jaroWinkler(str1, str2, options) {
358
+ // Jaro Distance
359
+ var jaroDist = jaro(str1, str2, options);
360
+ // Same prefix length, maxium is 4
361
+ var prefix = 0;
362
+ if (jaroDist > 0.7) {
363
+ var minIndex = Math.min(str1.length, str2.length);
364
+ var i = 0;
365
+ while (str1[i] === str2[i] && i < 4 && i < minIndex) {
366
+ ++prefix;
367
+ i++;
368
+ }
369
+ jaroDist += 0.1 * prefix * (1 - jaroDist);
370
+ }
371
+ return jaroDist;
372
+ }
373
+ exports.jaroWinkler = jaroWinkler;
374
+ });
375
+
282
376
  export { Condition as C, LiturgicalDocument as L, Responsive as R, dateOnly as a, dateFromYMDString as d };