@reuters-graphics/graphics-components 0.0.14 → 0.0.15

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.
@@ -23,6 +23,7 @@
23
23
  };
24
24
 
25
25
  let activeEmbed = getDefaultEmbed();
26
+ let activeEmbedIndex = embeds.indexOf(activeEmbed);
26
27
 
27
28
  $: embedTitles = getUniqNames(embeds);
28
29
 
@@ -30,11 +31,17 @@
30
31
  let pymParent;
31
32
 
32
33
  const reframe = (embed) => {
34
+ // Bit of hack for handling adding query strings dynamically to embeds.
35
+ // cf. also the value prop on the Typeahead component...
36
+ const activeEmbed =
37
+ embeds.indexOf(embed) > -1
38
+ ? embed
39
+ : embeds[activeEmbedIndex] || embeds[0];
33
40
  pymParent = new pym.Parent(
34
41
  'frame-parent',
35
- /^http/.test(embed)
36
- ? embed
37
- : urljoin(window.location.origin, embed, { trailingSlash: true })
42
+ /^http/.test(activeEmbed)
43
+ ? activeEmbed
44
+ : urljoin(window.location.origin, activeEmbed, { trailingSlash: true })
38
45
  );
39
46
  };
40
47
 
@@ -68,7 +75,9 @@
68
75
  </div>
69
76
  <Typeahead
70
77
  label="Select an embed"
71
- value="{embedTitles[embeds.indexOf(activeEmbed)]}"
78
+ value="{embedTitles[embeds.indexOf(activeEmbed)] ||
79
+ embedTitles[activeEmbedIndex] ||
80
+ embedTitles[0]}"
72
81
  extract="{(d) => embedTitles[d.index]}"
73
82
  data="{embeds.map((embed, index) => ({ index, embed }))}"
74
83
  placeholder="{'Search'}"
@@ -81,6 +90,7 @@
81
90
  );
82
91
  }
83
92
  activeEmbed = detail.original.embed;
93
+ activeEmbedIndex = detail.original.index;
84
94
  }}"
85
95
  />
86
96
  </div>
@@ -103,62 +113,63 @@
103
113
  maxFrameWidth="{maxFrameWidth}"
104
114
  />
105
115
 
106
- <style>header {
107
- font-family: "Knowledge", "Source Sans Pro", Arial, sans-serif;
108
- font-size: 50px;
109
- text-align: center;
110
- text-transform: uppercase;
111
- font-weight: 700;
112
- margin: 20px 0;
113
- }
114
-
115
- div#typeahead-container {
116
- max-width: 660px;
117
- margin: 0 auto 15px;
118
- position: relative;
119
- }
120
- div#typeahead-container div.embed-link {
121
- position: absolute;
122
- top: 0;
123
- right: 0;
124
- display: inline-block;
125
- z-index: 2;
126
- }
127
- div#typeahead-container div.embed-link a {
128
- font-family: "Knowledge", "Source Sans Pro", Arial, sans-serif;
129
- color: #bbb;
130
- font-size: 12px;
131
- text-decoration: none !important;
132
- }
133
- div#typeahead-container div.embed-link a:hover {
134
- color: #666;
135
- }
136
-
137
- div#preview-label {
138
- margin: 0 auto;
139
- }
140
- div#preview-label p {
141
- font-family: "Knowledge", "Source Sans Pro", Arial, sans-serif;
142
- color: #aaa;
143
- font-size: 0.75rem;
144
- margin: 0 0 0.25rem;
145
- }
146
-
147
- #frame-parent {
148
- border: 1px solid #ddd;
149
- margin: 0 auto;
150
- width: var(--width);
151
- }
152
-
153
- div#home-link {
154
- position: fixed;
155
- bottom: 5px;
156
- left: 10px;
157
- font-size: 18px;
158
- }
159
- div#home-link a {
160
- color: #ccc;
161
- }
162
- div#home-link a:hover {
163
- color: #666;
164
- }</style>
116
+ <style>
117
+ header {
118
+ font-family: 'Knowledge', 'Source Sans Pro', Arial, sans-serif;
119
+ font-size: 50px;
120
+ text-align: center;
121
+ text-transform: uppercase;
122
+ font-weight: 700;
123
+ margin: 20px 0;
124
+ }
125
+
126
+ div#typeahead-container {
127
+ max-width: 660px;
128
+ margin: 0 auto 15px;
129
+ position: relative;
130
+ }
131
+ div#typeahead-container div.embed-link {
132
+ position: absolute;
133
+ top: 0;
134
+ right: 0;
135
+ display: inline-block;
136
+ z-index: 2;
137
+ }
138
+ div#typeahead-container div.embed-link a {
139
+ font-family: 'Knowledge', 'Source Sans Pro', Arial, sans-serif;
140
+ color: #bbb;
141
+ font-size: 12px;
142
+ text-decoration: none !important;
143
+ }
144
+ div#typeahead-container div.embed-link a:hover {
145
+ color: #666;
146
+ }
147
+
148
+ div#preview-label {
149
+ margin: 0 auto;
150
+ }
151
+ div#preview-label p {
152
+ font-family: 'Knowledge', 'Source Sans Pro', Arial, sans-serif;
153
+ color: #aaa;
154
+ font-size: 0.75rem;
155
+ margin: 0 0 0.25rem;
156
+ }
157
+
158
+ #frame-parent {
159
+ border: 1px solid #ddd;
160
+ margin: 0 auto;
161
+ width: var(--width);
162
+ }
163
+
164
+ div#home-link {
165
+ position: fixed;
166
+ bottom: 5px;
167
+ left: 10px;
168
+ font-size: 18px;
169
+ }
170
+ div#home-link a {
171
+ color: #ccc;
172
+ }
173
+ div#home-link a:hover {
174
+ color: #666;
175
+ }</style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reuters-graphics/graphics-components",
3
- "version": "0.0.14",
3
+ "version": "0.0.15",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "homepage": "https://reuters-graphics.github.io/graphics-components",