@deck.gl/jupyter-widget 8.8.11 → 8.9.0-alpha.3

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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@deck.gl/jupyter-widget",
3
3
  "description": "Jupyter widget for rendering deck.gl in a Jupyter notebook",
4
4
  "license": "MIT",
5
- "version": "8.8.11",
5
+ "version": "8.9.0-alpha.3",
6
6
  "keywords": [
7
7
  "jupyter",
8
8
  "jupyterlab",
@@ -29,13 +29,12 @@
29
29
  "prepublishOnly": "webpack -p"
30
30
  },
31
31
  "dependencies": {
32
- "@deck.gl/aggregation-layers": "8.8.11",
33
- "@deck.gl/carto": "8.8.11",
34
- "@deck.gl/geo-layers": "8.8.11",
35
- "@deck.gl/google-maps": "8.8.11",
36
- "@deck.gl/json": "8.8.11",
37
- "@deck.gl/layers": "8.8.11",
38
- "@deck.gl/mesh-layers": "8.8.11",
32
+ "@deck.gl/aggregation-layers": "8.9.0-alpha.3",
33
+ "@deck.gl/geo-layers": "8.9.0-alpha.3",
34
+ "@deck.gl/google-maps": "8.9.0-alpha.3",
35
+ "@deck.gl/json": "8.9.0-alpha.3",
36
+ "@deck.gl/layers": "8.9.0-alpha.3",
37
+ "@deck.gl/mesh-layers": "8.9.0-alpha.3",
39
38
  "@jupyter-widgets/base": "^1.1.10 || ^2 || ^3 || ^4",
40
39
  "@loaders.gl/3d-tiles": "^3.2.5",
41
40
  "@loaders.gl/core": "^3.2.5",
@@ -44,7 +43,13 @@
44
43
  "mapbox-gl": "^1.2.1"
45
44
  },
46
45
  "jupyterlab": {
47
- "extension": "src/plugin"
46
+ "extension": "src/plugin",
47
+ "sharedPackages": {
48
+ "@jupyter-widgets/base": {
49
+ "bundled": false,
50
+ "singleton": true
51
+ }
52
+ }
48
53
  },
49
- "gitHead": "f70e8c354aee34949134f9e802f59cf60db4de19"
54
+ "gitHead": "1a42362a310b39b5b26d46354d388e2319a90af3"
50
55
  }
@@ -111,9 +111,37 @@ export function toText(jsonValue) {
111
111
  }
112
112
 
113
113
  export function substituteIn(template, json) {
114
+ /*
115
+ * Flexible substitution of templates using a json:
116
+ * - if the json contains the key, use [key]
117
+ * - if the json does not contain the key, try ['properties'][key]
118
+ * - if the key contains several keys separated with dots, use them all in a row:
119
+ * e.g. 'a.b.c' will read json['a']['b']['c']
120
+ */
121
+ let value;
114
122
  let output = template;
115
- for (const key in json) {
116
- output = output.replace(`{${key}}`, json[key]);
123
+ const propsKey = 'properties';
124
+ const keyPattern = /{[^}]*}/g;
125
+ const cleanKey = k => k.replace(/[{}]/g, '');
126
+ const keys = [...new Set(template.match(keyPattern).map(cleanKey))];
127
+
128
+ for (const key of keys) {
129
+ if (key.includes('.')) {
130
+ value = json;
131
+ const subkeys = key.split('.');
132
+ for (const subkey of subkeys) {
133
+ if (value.hasOwnProperty(subkey)) {
134
+ value = value[subkey];
135
+ }
136
+ }
137
+ } else if (json.hasOwnProperty(key)) {
138
+ value = json[key];
139
+ } else if (json[propsKey] && json[propsKey].hasOwnProperty(key)) {
140
+ value = json[propsKey][key];
141
+ }
142
+ if (value) {
143
+ output = output.replaceAll(`{${key}}`, value);
144
+ }
117
145
  }
118
146
 
119
147
  return output;