funnel-gfx-wc 0.1.129 → 0.1.134
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/dist/cjs/funnel-app.cjs.entry.js +90 -21
- package/dist/cjs/funnel-gfx-wc.cjs.js +29 -2
- package/dist/cjs/index-BFBRUSYG.js +4470 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/esm/funnel-app.entry.js +90 -21
- package/dist/esm/funnel-gfx-wc.js +30 -3
- package/dist/esm/index-CQ7_4qF8.js +4458 -0
- package/dist/esm/loader.js +2 -2
- package/dist/funnel-gfx-wc/funnel-gfx-wc.esm.js +1 -1
- package/dist/funnel-gfx-wc/p-CQ7_4qF8.js +2 -0
- package/dist/funnel-gfx-wc/{p-89dee5fa.entry.js → p-cf9914a1.entry.js} +33 -33
- package/package.json +2 -2
- package/dist/cjs/index-CJmmK8iX.js +0 -1493
- package/dist/esm/index-Tnvcatci.js +0 -1485
- package/dist/funnel-gfx-wc/p-Tnvcatci.js +0 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-BFBRUSYG.js');
|
|
4
4
|
|
|
5
5
|
const Radio = props => {
|
|
6
6
|
const hex = props.hex || 'currentColor';
|
|
@@ -71,12 +71,13 @@ const colorFor = (key) => _namedColors[key] || _altColors[key];
|
|
|
71
71
|
const colorKeys = Object.keys(_namedColors);
|
|
72
72
|
|
|
73
73
|
const appendToMap = (map, propName, value) => {
|
|
74
|
-
|
|
75
|
-
if (!
|
|
76
|
-
|
|
74
|
+
let refs = map.get(propName);
|
|
75
|
+
if (!refs) {
|
|
76
|
+
refs = [];
|
|
77
|
+
map.set(propName, refs);
|
|
77
78
|
}
|
|
78
|
-
|
|
79
|
-
|
|
79
|
+
if (!refs.some((ref) => ref.deref() === value)) {
|
|
80
|
+
refs.push(new WeakRef(value));
|
|
80
81
|
}
|
|
81
82
|
};
|
|
82
83
|
const debounce = (fn, ms) => {
|
|
@@ -104,33 +105,54 @@ const debounce = (fn, ms) => {
|
|
|
104
105
|
const isConnected = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;
|
|
105
106
|
const cleanupElements = debounce((map) => {
|
|
106
107
|
for (let key of map.keys()) {
|
|
107
|
-
|
|
108
|
+
const refs = map.get(key).filter((ref) => {
|
|
109
|
+
const elm = ref.deref();
|
|
110
|
+
return elm && isConnected(elm);
|
|
111
|
+
});
|
|
112
|
+
map.set(key, refs);
|
|
108
113
|
}
|
|
109
114
|
}, 2_000);
|
|
115
|
+
const core = index.StencilCore;
|
|
116
|
+
const forceUpdate = core.forceUpdate;
|
|
117
|
+
const getRenderingRef = core.getRenderingRef;
|
|
110
118
|
const stencilSubscription = () => {
|
|
111
|
-
if (typeof
|
|
119
|
+
if (typeof getRenderingRef !== 'function' || typeof forceUpdate !== 'function') {
|
|
112
120
|
// If we are not in a stencil project, we do nothing.
|
|
113
121
|
// This function is not really exported by @stencil/core.
|
|
114
122
|
return {};
|
|
115
123
|
}
|
|
124
|
+
const ensureForceUpdate = forceUpdate;
|
|
125
|
+
const ensureGetRenderingRef = getRenderingRef;
|
|
116
126
|
const elmsToUpdate = new Map();
|
|
117
127
|
return {
|
|
118
128
|
dispose: () => elmsToUpdate.clear(),
|
|
119
129
|
get: (propName) => {
|
|
120
|
-
const elm =
|
|
130
|
+
const elm = ensureGetRenderingRef();
|
|
121
131
|
if (elm) {
|
|
122
132
|
appendToMap(elmsToUpdate, propName, elm);
|
|
123
133
|
}
|
|
124
134
|
},
|
|
125
135
|
set: (propName) => {
|
|
126
|
-
const
|
|
127
|
-
if (
|
|
128
|
-
|
|
136
|
+
const refs = elmsToUpdate.get(propName);
|
|
137
|
+
if (refs) {
|
|
138
|
+
const nextRefs = refs.filter((ref) => {
|
|
139
|
+
const elm = ref.deref();
|
|
140
|
+
if (!elm)
|
|
141
|
+
return false;
|
|
142
|
+
return ensureForceUpdate(elm);
|
|
143
|
+
});
|
|
144
|
+
elmsToUpdate.set(propName, nextRefs);
|
|
129
145
|
}
|
|
130
146
|
cleanupElements(elmsToUpdate);
|
|
131
147
|
},
|
|
132
148
|
reset: () => {
|
|
133
|
-
elmsToUpdate.forEach((
|
|
149
|
+
elmsToUpdate.forEach((refs) => {
|
|
150
|
+
refs.forEach((ref) => {
|
|
151
|
+
const elm = ref.deref();
|
|
152
|
+
if (elm)
|
|
153
|
+
ensureForceUpdate(elm);
|
|
154
|
+
});
|
|
155
|
+
});
|
|
134
156
|
cleanupElements(elmsToUpdate);
|
|
135
157
|
},
|
|
136
158
|
};
|
|
@@ -138,8 +160,11 @@ const stencilSubscription = () => {
|
|
|
138
160
|
|
|
139
161
|
const unwrap = (val) => (typeof val === 'function' ? val() : val);
|
|
140
162
|
const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) => {
|
|
141
|
-
const
|
|
142
|
-
|
|
163
|
+
const resolveDefaultState = () => (unwrap(defaultState) ?? {});
|
|
164
|
+
const initialState = resolveDefaultState();
|
|
165
|
+
let states = new Map(Object.entries(initialState));
|
|
166
|
+
const proxyAvailable = typeof Proxy !== 'undefined';
|
|
167
|
+
const plainState = proxyAvailable ? null : {};
|
|
143
168
|
const handlers = {
|
|
144
169
|
dispose: [],
|
|
145
170
|
get: [],
|
|
@@ -151,7 +176,10 @@ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) =>
|
|
|
151
176
|
const reset = () => {
|
|
152
177
|
// When resetting the state, the default state may be a function - unwrap it to invoke it.
|
|
153
178
|
// otherwise, the state won't be properly reset
|
|
154
|
-
states = new Map(Object.entries(
|
|
179
|
+
states = new Map(Object.entries(resolveDefaultState()));
|
|
180
|
+
if (!proxyAvailable) {
|
|
181
|
+
syncPlainStateKeys();
|
|
182
|
+
}
|
|
155
183
|
handlers.reset.forEach((cb) => cb());
|
|
156
184
|
};
|
|
157
185
|
const dispose = () => {
|
|
@@ -168,12 +196,14 @@ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) =>
|
|
|
168
196
|
const oldValue = states.get(propName);
|
|
169
197
|
if (shouldUpdate(value, oldValue, propName)) {
|
|
170
198
|
states.set(propName, value);
|
|
199
|
+
if (!proxyAvailable) {
|
|
200
|
+
ensurePlainProperty(propName);
|
|
201
|
+
}
|
|
171
202
|
handlers.set.forEach((cb) => cb(propName, value, oldValue));
|
|
172
203
|
}
|
|
173
204
|
};
|
|
174
|
-
const state = (
|
|
175
|
-
? {
|
|
176
|
-
: new Proxy(unwrappedState, {
|
|
205
|
+
const state = (proxyAvailable
|
|
206
|
+
? new Proxy(initialState, {
|
|
177
207
|
get(_, propName) {
|
|
178
208
|
return get(propName);
|
|
179
209
|
},
|
|
@@ -193,7 +223,11 @@ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) =>
|
|
|
193
223
|
set(propName, value);
|
|
194
224
|
return true;
|
|
195
225
|
},
|
|
196
|
-
})
|
|
226
|
+
})
|
|
227
|
+
: (() => {
|
|
228
|
+
syncPlainStateKeys();
|
|
229
|
+
return plainState;
|
|
230
|
+
})());
|
|
197
231
|
const on = (eventName, callback) => {
|
|
198
232
|
handlers[eventName].push(callback);
|
|
199
233
|
return () => {
|
|
@@ -206,7 +240,10 @@ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) =>
|
|
|
206
240
|
cb(newValue);
|
|
207
241
|
}
|
|
208
242
|
};
|
|
209
|
-
const resetHandler = () =>
|
|
243
|
+
const resetHandler = () => {
|
|
244
|
+
const snapshot = resolveDefaultState();
|
|
245
|
+
cb(snapshot[propName]);
|
|
246
|
+
};
|
|
210
247
|
// Register the handlers
|
|
211
248
|
const unSet = on('set', setHandler);
|
|
212
249
|
const unReset = on('reset', resetHandler);
|
|
@@ -249,6 +286,38 @@ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) =>
|
|
|
249
286
|
changeListeners.delete(listener);
|
|
250
287
|
}
|
|
251
288
|
};
|
|
289
|
+
function ensurePlainProperty(key) {
|
|
290
|
+
if (proxyAvailable || !plainState) {
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
if (Object.prototype.hasOwnProperty.call(plainState, key)) {
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
Object.defineProperty(plainState, key, {
|
|
297
|
+
configurable: true,
|
|
298
|
+
enumerable: true,
|
|
299
|
+
get() {
|
|
300
|
+
return get(key);
|
|
301
|
+
},
|
|
302
|
+
set(value) {
|
|
303
|
+
set(key, value);
|
|
304
|
+
},
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
function syncPlainStateKeys() {
|
|
308
|
+
if (proxyAvailable || !plainState) {
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
const knownKeys = new Set(states.keys());
|
|
312
|
+
for (const key of Object.keys(plainState)) {
|
|
313
|
+
if (!knownKeys.has(key)) {
|
|
314
|
+
delete plainState[key];
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
for (const key of knownKeys) {
|
|
318
|
+
ensurePlainProperty(key);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
252
321
|
return {
|
|
253
322
|
state,
|
|
254
323
|
get,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-BFBRUSYG.js');
|
|
4
4
|
var appGlobals = require('./app-globals-V2Kpy_OQ.js');
|
|
5
5
|
|
|
6
6
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
@@ -9,13 +9,40 @@ var _documentCurrentScript = typeof document !== 'undefined' ? document.currentS
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
var patchBrowser = () => {
|
|
12
|
+
if (index.BUILD.isDev && !index.BUILD.isTesting) {
|
|
13
|
+
index.consoleDevInfo("Running in development mode.");
|
|
14
|
+
}
|
|
15
|
+
if (index.BUILD.cloneNodeFix) {
|
|
16
|
+
patchCloneNodeFix(index.H.prototype);
|
|
17
|
+
}
|
|
18
|
+
const scriptElm = index.BUILD.scriptDataOpts ? index.win.document && Array.from(index.win.document.querySelectorAll("script")).find(
|
|
19
|
+
(s) => new RegExp(`/${index.NAMESPACE}(\\.esm)?\\.js($|\\?|#)`).test(s.src) || s.getAttribute("data-stencil-namespace") === index.NAMESPACE
|
|
20
|
+
) : null;
|
|
12
21
|
const importMeta = (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('funnel-gfx-wc.cjs.js', document.baseURI).href));
|
|
13
|
-
const opts = {};
|
|
22
|
+
const opts = index.BUILD.scriptDataOpts ? (scriptElm || {})["data-opts"] || {} : {};
|
|
14
23
|
if (importMeta !== "") {
|
|
15
24
|
opts.resourcesUrl = new URL(".", importMeta).href;
|
|
16
25
|
}
|
|
17
26
|
return index.promiseResolve(opts);
|
|
18
27
|
};
|
|
28
|
+
var patchCloneNodeFix = (HTMLElementPrototype) => {
|
|
29
|
+
const nativeCloneNodeFn = HTMLElementPrototype.cloneNode;
|
|
30
|
+
HTMLElementPrototype.cloneNode = function(deep) {
|
|
31
|
+
if (this.nodeName === "TEMPLATE") {
|
|
32
|
+
return nativeCloneNodeFn.call(this, deep);
|
|
33
|
+
}
|
|
34
|
+
const clonedNode = nativeCloneNodeFn.call(this, false);
|
|
35
|
+
const srcChildNodes = this.childNodes;
|
|
36
|
+
if (deep) {
|
|
37
|
+
for (let i = 0; i < srcChildNodes.length; i++) {
|
|
38
|
+
if (srcChildNodes[i].nodeType !== 2) {
|
|
39
|
+
clonedNode.appendChild(srcChildNodes[i].cloneNode(true));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return clonedNode;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
19
46
|
|
|
20
47
|
patchBrowser().then(async (options) => {
|
|
21
48
|
await appGlobals.globalScripts();
|