proto-autos-wc 0.1.118 → 0.1.119
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/index-CHtgcRuD.js +4470 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/proto-autos-wc.cjs.js +29 -2
- package/dist/cjs/proto-autos.cjs.entry.js +90 -21
- package/dist/esm/index-CUeCNkv1.js +4458 -0
- package/dist/esm/loader.js +2 -2
- package/dist/esm/proto-autos-wc.js +30 -3
- package/dist/esm/proto-autos.entry.js +90 -21
- package/dist/proto-autos-wc/p-CUeCNkv1.js +2 -0
- package/dist/proto-autos-wc/p-bbe15c02.entry.js +1 -0
- package/dist/proto-autos-wc/proto-autos-wc.esm.js +1 -1
- package/package.json +2 -2
- package/dist/cjs/index-DblfkAfB.js +0 -1482
- package/dist/esm/index-B_Sspfrn.js +0 -1474
- package/dist/proto-autos-wc/p-51d95483.entry.js +0 -1
- package/dist/proto-autos-wc/p-B_Sspfrn.js +0 -2
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-CHtgcRuD.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('proto-autos-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();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-CHtgcRuD.js');
|
|
4
4
|
|
|
5
5
|
const KEY = 'proto-autos';
|
|
6
6
|
const DATA = 'data';
|
|
@@ -23,12 +23,13 @@ const bag = {
|
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
const appendToMap = (map, propName, value) => {
|
|
26
|
-
|
|
27
|
-
if (!
|
|
28
|
-
|
|
26
|
+
let refs = map.get(propName);
|
|
27
|
+
if (!refs) {
|
|
28
|
+
refs = [];
|
|
29
|
+
map.set(propName, refs);
|
|
29
30
|
}
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
if (!refs.some((ref) => ref.deref() === value)) {
|
|
32
|
+
refs.push(new WeakRef(value));
|
|
32
33
|
}
|
|
33
34
|
};
|
|
34
35
|
const debounce = (fn, ms) => {
|
|
@@ -56,33 +57,54 @@ const debounce = (fn, ms) => {
|
|
|
56
57
|
const isConnected = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;
|
|
57
58
|
const cleanupElements = debounce((map) => {
|
|
58
59
|
for (let key of map.keys()) {
|
|
59
|
-
|
|
60
|
+
const refs = map.get(key).filter((ref) => {
|
|
61
|
+
const elm = ref.deref();
|
|
62
|
+
return elm && isConnected(elm);
|
|
63
|
+
});
|
|
64
|
+
map.set(key, refs);
|
|
60
65
|
}
|
|
61
66
|
}, 2_000);
|
|
67
|
+
const core = index.StencilCore;
|
|
68
|
+
const forceUpdate = core.forceUpdate;
|
|
69
|
+
const getRenderingRef = core.getRenderingRef;
|
|
62
70
|
const stencilSubscription = () => {
|
|
63
|
-
if (typeof
|
|
71
|
+
if (typeof getRenderingRef !== 'function' || typeof forceUpdate !== 'function') {
|
|
64
72
|
// If we are not in a stencil project, we do nothing.
|
|
65
73
|
// This function is not really exported by @stencil/core.
|
|
66
74
|
return {};
|
|
67
75
|
}
|
|
76
|
+
const ensureForceUpdate = forceUpdate;
|
|
77
|
+
const ensureGetRenderingRef = getRenderingRef;
|
|
68
78
|
const elmsToUpdate = new Map();
|
|
69
79
|
return {
|
|
70
80
|
dispose: () => elmsToUpdate.clear(),
|
|
71
81
|
get: (propName) => {
|
|
72
|
-
const elm =
|
|
82
|
+
const elm = ensureGetRenderingRef();
|
|
73
83
|
if (elm) {
|
|
74
84
|
appendToMap(elmsToUpdate, propName, elm);
|
|
75
85
|
}
|
|
76
86
|
},
|
|
77
87
|
set: (propName) => {
|
|
78
|
-
const
|
|
79
|
-
if (
|
|
80
|
-
|
|
88
|
+
const refs = elmsToUpdate.get(propName);
|
|
89
|
+
if (refs) {
|
|
90
|
+
const nextRefs = refs.filter((ref) => {
|
|
91
|
+
const elm = ref.deref();
|
|
92
|
+
if (!elm)
|
|
93
|
+
return false;
|
|
94
|
+
return ensureForceUpdate(elm);
|
|
95
|
+
});
|
|
96
|
+
elmsToUpdate.set(propName, nextRefs);
|
|
81
97
|
}
|
|
82
98
|
cleanupElements(elmsToUpdate);
|
|
83
99
|
},
|
|
84
100
|
reset: () => {
|
|
85
|
-
elmsToUpdate.forEach((
|
|
101
|
+
elmsToUpdate.forEach((refs) => {
|
|
102
|
+
refs.forEach((ref) => {
|
|
103
|
+
const elm = ref.deref();
|
|
104
|
+
if (elm)
|
|
105
|
+
ensureForceUpdate(elm);
|
|
106
|
+
});
|
|
107
|
+
});
|
|
86
108
|
cleanupElements(elmsToUpdate);
|
|
87
109
|
},
|
|
88
110
|
};
|
|
@@ -90,8 +112,11 @@ const stencilSubscription = () => {
|
|
|
90
112
|
|
|
91
113
|
const unwrap = (val) => (typeof val === 'function' ? val() : val);
|
|
92
114
|
const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) => {
|
|
93
|
-
const
|
|
94
|
-
|
|
115
|
+
const resolveDefaultState = () => (unwrap(defaultState) ?? {});
|
|
116
|
+
const initialState = resolveDefaultState();
|
|
117
|
+
let states = new Map(Object.entries(initialState));
|
|
118
|
+
const proxyAvailable = typeof Proxy !== 'undefined';
|
|
119
|
+
const plainState = proxyAvailable ? null : {};
|
|
95
120
|
const handlers = {
|
|
96
121
|
dispose: [],
|
|
97
122
|
get: [],
|
|
@@ -103,7 +128,10 @@ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) =>
|
|
|
103
128
|
const reset = () => {
|
|
104
129
|
// When resetting the state, the default state may be a function - unwrap it to invoke it.
|
|
105
130
|
// otherwise, the state won't be properly reset
|
|
106
|
-
states = new Map(Object.entries(
|
|
131
|
+
states = new Map(Object.entries(resolveDefaultState()));
|
|
132
|
+
if (!proxyAvailable) {
|
|
133
|
+
syncPlainStateKeys();
|
|
134
|
+
}
|
|
107
135
|
handlers.reset.forEach((cb) => cb());
|
|
108
136
|
};
|
|
109
137
|
const dispose = () => {
|
|
@@ -120,12 +148,14 @@ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) =>
|
|
|
120
148
|
const oldValue = states.get(propName);
|
|
121
149
|
if (shouldUpdate(value, oldValue, propName)) {
|
|
122
150
|
states.set(propName, value);
|
|
151
|
+
if (!proxyAvailable) {
|
|
152
|
+
ensurePlainProperty(propName);
|
|
153
|
+
}
|
|
123
154
|
handlers.set.forEach((cb) => cb(propName, value, oldValue));
|
|
124
155
|
}
|
|
125
156
|
};
|
|
126
|
-
const state = (
|
|
127
|
-
? {
|
|
128
|
-
: new Proxy(unwrappedState, {
|
|
157
|
+
const state = (proxyAvailable
|
|
158
|
+
? new Proxy(initialState, {
|
|
129
159
|
get(_, propName) {
|
|
130
160
|
return get(propName);
|
|
131
161
|
},
|
|
@@ -145,7 +175,11 @@ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) =>
|
|
|
145
175
|
set(propName, value);
|
|
146
176
|
return true;
|
|
147
177
|
},
|
|
148
|
-
})
|
|
178
|
+
})
|
|
179
|
+
: (() => {
|
|
180
|
+
syncPlainStateKeys();
|
|
181
|
+
return plainState;
|
|
182
|
+
})());
|
|
149
183
|
const on = (eventName, callback) => {
|
|
150
184
|
handlers[eventName].push(callback);
|
|
151
185
|
return () => {
|
|
@@ -158,7 +192,10 @@ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) =>
|
|
|
158
192
|
cb(newValue);
|
|
159
193
|
}
|
|
160
194
|
};
|
|
161
|
-
const resetHandler = () =>
|
|
195
|
+
const resetHandler = () => {
|
|
196
|
+
const snapshot = resolveDefaultState();
|
|
197
|
+
cb(snapshot[propName]);
|
|
198
|
+
};
|
|
162
199
|
// Register the handlers
|
|
163
200
|
const unSet = on('set', setHandler);
|
|
164
201
|
const unReset = on('reset', resetHandler);
|
|
@@ -201,6 +238,38 @@ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) =>
|
|
|
201
238
|
changeListeners.delete(listener);
|
|
202
239
|
}
|
|
203
240
|
};
|
|
241
|
+
function ensurePlainProperty(key) {
|
|
242
|
+
if (proxyAvailable || !plainState) {
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
if (Object.prototype.hasOwnProperty.call(plainState, key)) {
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
Object.defineProperty(plainState, key, {
|
|
249
|
+
configurable: true,
|
|
250
|
+
enumerable: true,
|
|
251
|
+
get() {
|
|
252
|
+
return get(key);
|
|
253
|
+
},
|
|
254
|
+
set(value) {
|
|
255
|
+
set(key, value);
|
|
256
|
+
},
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
function syncPlainStateKeys() {
|
|
260
|
+
if (proxyAvailable || !plainState) {
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
const knownKeys = new Set(states.keys());
|
|
264
|
+
for (const key of Object.keys(plainState)) {
|
|
265
|
+
if (!knownKeys.has(key)) {
|
|
266
|
+
delete plainState[key];
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
for (const key of knownKeys) {
|
|
270
|
+
ensurePlainProperty(key);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
204
273
|
return {
|
|
205
274
|
state,
|
|
206
275
|
get,
|