lido-standalone 0.0.0-alpha-1
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/.editorconfig +15 -0
- package/.prettierrc.json +13 -0
- package/LICENSE +21 -0
- package/dist/cjs/app-globals-3a1e7e63.js +7 -0
- package/dist/cjs/app-globals-3a1e7e63.js.map +1 -0
- package/dist/cjs/index-52f24ddb.js +1154 -0
- package/dist/cjs/index-52f24ddb.js.map +1 -0
- package/dist/cjs/index.cjs.js +299 -0
- package/dist/cjs/index.cjs.js.map +1 -0
- package/dist/cjs/index.es2017-d19f0aae.js +1491 -0
- package/dist/cjs/index.es2017-d19f0aae.js.map +1 -0
- package/dist/cjs/lido-avatar_13.entry-e9636d08.js +9227 -0
- package/dist/cjs/lido-avatar_13.entry-e9636d08.js.map +1 -0
- package/dist/cjs/lido-standalone.cjs.entry.js +160 -0
- package/dist/cjs/lido-standalone.cjs.entry.js.map +1 -0
- package/dist/cjs/lido-standalone.cjs.js +27 -0
- package/dist/cjs/lido-standalone.cjs.js.map +1 -0
- package/dist/cjs/loader.cjs.js +17 -0
- package/dist/cjs/loader.cjs.js.map +1 -0
- package/dist/collection/collection-manifest.json +12 -0
- package/dist/collection/components/lido-standalone/lido-standalone.css +0 -0
- package/dist/collection/components/lido-standalone/lido-standalone.js +295 -0
- package/dist/collection/components/lido-standalone/lido-standalone.js.map +1 -0
- package/dist/collection/index.js +3 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/components/index.d.ts +33 -0
- package/dist/components/index.js +996 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/lido-standalone.d.ts +11 -0
- package/dist/components/lido-standalone.js +187 -0
- package/dist/components/lido-standalone.js.map +1 -0
- package/dist/components/p-5510f322.js +1464 -0
- package/dist/components/p-5510f322.js.map +1 -0
- package/dist/components/p-c2ee3e8c.js +959 -0
- package/dist/components/p-c2ee3e8c.js.map +1 -0
- package/dist/components/p-f41b329e.js +9213 -0
- package/dist/components/p-f41b329e.js.map +1 -0
- package/dist/esm/app-globals-0f993ce5.js +5 -0
- package/dist/esm/app-globals-0f993ce5.js.map +1 -0
- package/dist/esm/index-5da3b4be.js +1126 -0
- package/dist/esm/index-5da3b4be.js.map +1 -0
- package/dist/esm/index.es2017-09c06e72.js +1464 -0
- package/dist/esm/index.es2017-09c06e72.js.map +1 -0
- package/dist/esm/index.js +295 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/lido-avatar_13.entry-7e8c9c55.js +9213 -0
- package/dist/esm/lido-avatar_13.entry-7e8c9c55.js.map +1 -0
- package/dist/esm/lido-standalone.entry.js +156 -0
- package/dist/esm/lido-standalone.entry.js.map +1 -0
- package/dist/esm/lido-standalone.js +22 -0
- package/dist/esm/lido-standalone.js.map +1 -0
- package/dist/esm/loader.js +13 -0
- package/dist/esm/loader.js.map +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/lido-standalone/index.esm.js +2 -0
- package/dist/lido-standalone/index.esm.js.map +1 -0
- package/dist/lido-standalone/lido-standalone.esm.js +2 -0
- package/dist/lido-standalone/lido-standalone.esm.js.map +1 -0
- package/dist/lido-standalone/p-3a3323c8.js +3 -0
- package/dist/lido-standalone/p-3a3323c8.js.map +1 -0
- package/dist/lido-standalone/p-4b9cc16f.entry.js +2 -0
- package/dist/lido-standalone/p-4b9cc16f.entry.js.map +1 -0
- package/dist/lido-standalone/p-5510f322.js +2 -0
- package/dist/lido-standalone/p-5510f322.js.map +1 -0
- package/dist/lido-standalone/p-e1255160.js +2 -0
- package/dist/lido-standalone/p-e1255160.js.map +1 -0
- package/dist/lido-standalone/p-f41b329e.js +2 -0
- package/dist/lido-standalone/p-f41b329e.js.map +1 -0
- package/dist/types/components/lido-standalone/lido-standalone.d.ts +65 -0
- package/dist/types/components.d.ts +137 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/stencil-public-runtime.d.ts +1680 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/loader/package.json +11 -0
- package/package.json +46 -0
- package/readme.md +41 -0
- package/src/assets/icon/favicon.ico +0 -0
- package/src/assets/icon/icon.png +0 -0
- package/src/components/lido-standalone/lido-standalone.css +0 -0
- package/src/components/lido-standalone/lido-standalone.tsx +205 -0
- package/src/components/lido-standalone/readme.md +38 -0
- package/src/components.d.ts +137 -0
- package/src/index.html +49 -0
- package/src/index.ts +5 -0
- package/src/manifest.json +13 -0
- package/stencil.config.ts +32 -0
- package/tsconfig.json +25 -0
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-52f24ddb.js');
|
|
6
|
+
|
|
7
|
+
const appendToMap = (map, propName, value) => {
|
|
8
|
+
const items = map.get(propName);
|
|
9
|
+
if (!items) {
|
|
10
|
+
map.set(propName, [value]);
|
|
11
|
+
}
|
|
12
|
+
else if (!items.includes(value)) {
|
|
13
|
+
items.push(value);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
const debounce = (fn, ms) => {
|
|
17
|
+
let timeoutId;
|
|
18
|
+
return (...args) => {
|
|
19
|
+
if (timeoutId) {
|
|
20
|
+
clearTimeout(timeoutId);
|
|
21
|
+
}
|
|
22
|
+
timeoutId = setTimeout(() => {
|
|
23
|
+
timeoutId = 0;
|
|
24
|
+
fn(...args);
|
|
25
|
+
}, ms);
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Check if a possible element isConnected.
|
|
31
|
+
* The property might not be there, so we check for it.
|
|
32
|
+
*
|
|
33
|
+
* We want it to return true if isConnected is not a property,
|
|
34
|
+
* otherwise we would remove these elements and would not update.
|
|
35
|
+
*
|
|
36
|
+
* Better leak in Edge than to be useless.
|
|
37
|
+
*/
|
|
38
|
+
const isConnected = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;
|
|
39
|
+
const cleanupElements = debounce((map) => {
|
|
40
|
+
for (let key of map.keys()) {
|
|
41
|
+
map.set(key, map.get(key).filter(isConnected));
|
|
42
|
+
}
|
|
43
|
+
}, 2000);
|
|
44
|
+
const stencilSubscription = () => {
|
|
45
|
+
if (typeof index.getRenderingRef !== 'function') {
|
|
46
|
+
// If we are not in a stencil project, we do nothing.
|
|
47
|
+
// This function is not really exported by @stencil/core.
|
|
48
|
+
return {};
|
|
49
|
+
}
|
|
50
|
+
const elmsToUpdate = new Map();
|
|
51
|
+
return {
|
|
52
|
+
dispose: () => elmsToUpdate.clear(),
|
|
53
|
+
get: (propName) => {
|
|
54
|
+
const elm = index.getRenderingRef();
|
|
55
|
+
if (elm) {
|
|
56
|
+
appendToMap(elmsToUpdate, propName, elm);
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
set: (propName) => {
|
|
60
|
+
const elements = elmsToUpdate.get(propName);
|
|
61
|
+
if (elements) {
|
|
62
|
+
elmsToUpdate.set(propName, elements.filter(index.forceUpdate));
|
|
63
|
+
}
|
|
64
|
+
cleanupElements(elmsToUpdate);
|
|
65
|
+
},
|
|
66
|
+
reset: () => {
|
|
67
|
+
elmsToUpdate.forEach((elms) => elms.forEach(index.forceUpdate));
|
|
68
|
+
cleanupElements(elmsToUpdate);
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) => {
|
|
74
|
+
let states = new Map(Object.entries(defaultState !== null && defaultState !== void 0 ? defaultState : {}));
|
|
75
|
+
const handlers = {
|
|
76
|
+
dispose: [],
|
|
77
|
+
get: [],
|
|
78
|
+
set: [],
|
|
79
|
+
reset: [],
|
|
80
|
+
};
|
|
81
|
+
const reset = () => {
|
|
82
|
+
states = new Map(Object.entries(defaultState !== null && defaultState !== void 0 ? defaultState : {}));
|
|
83
|
+
handlers.reset.forEach((cb) => cb());
|
|
84
|
+
};
|
|
85
|
+
const dispose = () => {
|
|
86
|
+
// Call first dispose as resetting the state would
|
|
87
|
+
// cause less updates ;)
|
|
88
|
+
handlers.dispose.forEach((cb) => cb());
|
|
89
|
+
reset();
|
|
90
|
+
};
|
|
91
|
+
const get = (propName) => {
|
|
92
|
+
handlers.get.forEach((cb) => cb(propName));
|
|
93
|
+
return states.get(propName);
|
|
94
|
+
};
|
|
95
|
+
const set = (propName, value) => {
|
|
96
|
+
const oldValue = states.get(propName);
|
|
97
|
+
if (shouldUpdate(value, oldValue, propName)) {
|
|
98
|
+
states.set(propName, value);
|
|
99
|
+
handlers.set.forEach((cb) => cb(propName, value, oldValue));
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
const state = (typeof Proxy === 'undefined'
|
|
103
|
+
? {}
|
|
104
|
+
: new Proxy(defaultState, {
|
|
105
|
+
get(_, propName) {
|
|
106
|
+
return get(propName);
|
|
107
|
+
},
|
|
108
|
+
ownKeys(_) {
|
|
109
|
+
return Array.from(states.keys());
|
|
110
|
+
},
|
|
111
|
+
getOwnPropertyDescriptor() {
|
|
112
|
+
return {
|
|
113
|
+
enumerable: true,
|
|
114
|
+
configurable: true,
|
|
115
|
+
};
|
|
116
|
+
},
|
|
117
|
+
has(_, propName) {
|
|
118
|
+
return states.has(propName);
|
|
119
|
+
},
|
|
120
|
+
set(_, propName, value) {
|
|
121
|
+
set(propName, value);
|
|
122
|
+
return true;
|
|
123
|
+
},
|
|
124
|
+
}));
|
|
125
|
+
const on = (eventName, callback) => {
|
|
126
|
+
handlers[eventName].push(callback);
|
|
127
|
+
return () => {
|
|
128
|
+
removeFromArray(handlers[eventName], callback);
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
const onChange = (propName, cb) => {
|
|
132
|
+
const unSet = on('set', (key, newValue) => {
|
|
133
|
+
if (key === propName) {
|
|
134
|
+
cb(newValue);
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
const unReset = on('reset', () => cb(defaultState[propName]));
|
|
138
|
+
return () => {
|
|
139
|
+
unSet();
|
|
140
|
+
unReset();
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
const use = (...subscriptions) => {
|
|
144
|
+
const unsubs = subscriptions.reduce((unsubs, subscription) => {
|
|
145
|
+
if (subscription.set) {
|
|
146
|
+
unsubs.push(on('set', subscription.set));
|
|
147
|
+
}
|
|
148
|
+
if (subscription.get) {
|
|
149
|
+
unsubs.push(on('get', subscription.get));
|
|
150
|
+
}
|
|
151
|
+
if (subscription.reset) {
|
|
152
|
+
unsubs.push(on('reset', subscription.reset));
|
|
153
|
+
}
|
|
154
|
+
if (subscription.dispose) {
|
|
155
|
+
unsubs.push(on('dispose', subscription.dispose));
|
|
156
|
+
}
|
|
157
|
+
return unsubs;
|
|
158
|
+
}, []);
|
|
159
|
+
return () => unsubs.forEach((unsub) => unsub());
|
|
160
|
+
};
|
|
161
|
+
const forceUpdate = (key) => {
|
|
162
|
+
const oldValue = states.get(key);
|
|
163
|
+
handlers.set.forEach((cb) => cb(key, oldValue, oldValue));
|
|
164
|
+
};
|
|
165
|
+
return {
|
|
166
|
+
state,
|
|
167
|
+
get,
|
|
168
|
+
set,
|
|
169
|
+
on,
|
|
170
|
+
onChange,
|
|
171
|
+
use,
|
|
172
|
+
dispose,
|
|
173
|
+
reset,
|
|
174
|
+
forceUpdate,
|
|
175
|
+
};
|
|
176
|
+
};
|
|
177
|
+
const removeFromArray = (array, item) => {
|
|
178
|
+
const index = array.indexOf(item);
|
|
179
|
+
if (index >= 0) {
|
|
180
|
+
array[index] = array[array.length - 1];
|
|
181
|
+
array.length--;
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
const createStore = (defaultState, shouldUpdate) => {
|
|
186
|
+
const map = createObservableMap(defaultState, shouldUpdate);
|
|
187
|
+
map.use(stencilSubscription());
|
|
188
|
+
return map;
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
const createRouter = (opts) => {
|
|
192
|
+
var _a;
|
|
193
|
+
const win = window;
|
|
194
|
+
const url = new URL(win.location.href);
|
|
195
|
+
const parseURL = (_a = opts === null || opts === void 0 ? void 0 : opts.parseURL) !== null && _a !== void 0 ? _a : DEFAULT_PARSE_URL;
|
|
196
|
+
const { state, onChange, dispose } = createStore({
|
|
197
|
+
url,
|
|
198
|
+
activePath: parseURL(url)
|
|
199
|
+
}, (newV, oldV, prop) => {
|
|
200
|
+
if (prop === 'url') {
|
|
201
|
+
return newV.href !== oldV.href;
|
|
202
|
+
}
|
|
203
|
+
return newV !== oldV;
|
|
204
|
+
});
|
|
205
|
+
const push = (href) => {
|
|
206
|
+
history.pushState(null, null, href);
|
|
207
|
+
const url = new URL(href, document.baseURI);
|
|
208
|
+
state.url = url;
|
|
209
|
+
state.activePath = parseURL(url);
|
|
210
|
+
};
|
|
211
|
+
const match = (routes) => {
|
|
212
|
+
const { activePath } = state;
|
|
213
|
+
for (let route of routes) {
|
|
214
|
+
const params = matchPath(activePath, route.path);
|
|
215
|
+
if (params) {
|
|
216
|
+
if (route.to != null) {
|
|
217
|
+
const to = (typeof route.to === 'string')
|
|
218
|
+
? route.to
|
|
219
|
+
: route.to(activePath);
|
|
220
|
+
push(to);
|
|
221
|
+
return match(routes);
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
return { params, route };
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
return undefined;
|
|
229
|
+
};
|
|
230
|
+
const navigationChanged = () => {
|
|
231
|
+
const url = new URL(win.location.href);
|
|
232
|
+
state.url = url;
|
|
233
|
+
state.activePath = parseURL(url);
|
|
234
|
+
};
|
|
235
|
+
const Switch = (_, childrenRoutes) => {
|
|
236
|
+
const result = match(childrenRoutes);
|
|
237
|
+
if (result) {
|
|
238
|
+
if (typeof result.route.jsx === 'function') {
|
|
239
|
+
return result.route.jsx(result.params);
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
return result.route.jsx;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
const disposeRouter = () => {
|
|
247
|
+
win.removeEventListener('popstate', navigationChanged);
|
|
248
|
+
dispose();
|
|
249
|
+
};
|
|
250
|
+
const router = {
|
|
251
|
+
Switch,
|
|
252
|
+
get url() {
|
|
253
|
+
return state.url;
|
|
254
|
+
},
|
|
255
|
+
get activePath() {
|
|
256
|
+
return state.activePath;
|
|
257
|
+
},
|
|
258
|
+
push,
|
|
259
|
+
onChange: onChange,
|
|
260
|
+
dispose: disposeRouter,
|
|
261
|
+
};
|
|
262
|
+
// Initial update
|
|
263
|
+
navigationChanged();
|
|
264
|
+
// Listen URL changes
|
|
265
|
+
win.addEventListener('popstate', navigationChanged);
|
|
266
|
+
return router;
|
|
267
|
+
};
|
|
268
|
+
const matchPath = (pathname, path) => {
|
|
269
|
+
if (typeof path === 'string') {
|
|
270
|
+
if (path === pathname) {
|
|
271
|
+
return {};
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
else if (typeof path === 'function') {
|
|
275
|
+
const params = path(pathname);
|
|
276
|
+
if (params) {
|
|
277
|
+
return params === true
|
|
278
|
+
? {}
|
|
279
|
+
: { ...params };
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
else {
|
|
283
|
+
const results = path.exec(pathname);
|
|
284
|
+
if (results) {
|
|
285
|
+
path.lastIndex = 0;
|
|
286
|
+
return { ...results };
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
return undefined;
|
|
290
|
+
};
|
|
291
|
+
const DEFAULT_PARSE_URL = (url) => {
|
|
292
|
+
return url.pathname.toLowerCase();
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
const Router = createRouter();
|
|
296
|
+
|
|
297
|
+
exports.Router = Router;
|
|
298
|
+
|
|
299
|
+
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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AM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;AACtC,QAAQ,IAAI,MAAM,EAAE;AACpB,YAAY,OAAO,MAAM,KAAK,IAAI;AAClC,kBAAkB,EAAE;AACpB,kBAAkB,EAAE,GAAG,MAAM,EAAE,CAAC;AAChC,SAAS;AACT,KAAK;AACL,SAAS;AACT,QAAQ,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC5C,QAAQ,IAAI,OAAO,EAAE;AACrB,YAAY,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;AAC/B,YAAY,OAAO,EAAE,GAAG,OAAO,EAAE,CAAC;AAClC,SAAS;AACT,KAAK;AACL,IAAI,OAAO,SAAS,CAAC;AACrB,CAAC,CAAC;AACF,MAAM,iBAAiB,GAAG,CAAC,GAAG,KAAK;AACnC,IAAI,OAAO,GAAG,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;AACtC,CAAC;;MC1IY,MAAM,GAAG,YAAY;;;;","names":["getRenderingRef","forceUpdate"],"sources":["node_modules/@stencil/store/dist/index.mjs","node_modules/stencil-router-v2/dist/index.mjs","src/index.ts"],"sourcesContent":["import { getRenderingRef, forceUpdate } from '@stencil/core';\n\nconst appendToMap = (map, propName, value) => {\n const items = map.get(propName);\n if (!items) {\n map.set(propName, [value]);\n }\n else if (!items.includes(value)) {\n items.push(value);\n }\n};\nconst debounce = (fn, ms) => {\n let timeoutId;\n return (...args) => {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n timeoutId = setTimeout(() => {\n timeoutId = 0;\n fn(...args);\n }, ms);\n };\n};\n\n/**\n * Check if a possible element isConnected.\n * The property might not be there, so we check for it.\n *\n * We want it to return true if isConnected is not a property,\n * otherwise we would remove these elements and would not update.\n *\n * Better leak in Edge than to be useless.\n */\nconst isConnected = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;\nconst cleanupElements = debounce((map) => {\n for (let key of map.keys()) {\n map.set(key, map.get(key).filter(isConnected));\n }\n}, 2000);\nconst stencilSubscription = () => {\n if (typeof getRenderingRef !== 'function') {\n // If we are not in a stencil project, we do nothing.\n // This function is not really exported by @stencil/core.\n return {};\n }\n const elmsToUpdate = new Map();\n return {\n dispose: () => elmsToUpdate.clear(),\n get: (propName) => {\n const elm = getRenderingRef();\n if (elm) {\n appendToMap(elmsToUpdate, propName, elm);\n }\n },\n set: (propName) => {\n const elements = elmsToUpdate.get(propName);\n if (elements) {\n elmsToUpdate.set(propName, elements.filter(forceUpdate));\n }\n cleanupElements(elmsToUpdate);\n },\n reset: () => {\n elmsToUpdate.forEach((elms) => elms.forEach(forceUpdate));\n cleanupElements(elmsToUpdate);\n },\n };\n};\n\nconst createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) => {\n let states = new Map(Object.entries(defaultState !== null && defaultState !== void 0 ? defaultState : {}));\n const handlers = {\n dispose: [],\n get: [],\n set: [],\n reset: [],\n };\n const reset = () => {\n states = new Map(Object.entries(defaultState !== null && defaultState !== void 0 ? defaultState : {}));\n handlers.reset.forEach((cb) => cb());\n };\n const dispose = () => {\n // Call first dispose as resetting the state would\n // cause less updates ;)\n handlers.dispose.forEach((cb) => cb());\n reset();\n };\n const get = (propName) => {\n handlers.get.forEach((cb) => cb(propName));\n return states.get(propName);\n };\n const set = (propName, value) => {\n const oldValue = states.get(propName);\n if (shouldUpdate(value, oldValue, propName)) {\n states.set(propName, value);\n handlers.set.forEach((cb) => cb(propName, value, oldValue));\n }\n };\n const state = (typeof Proxy === 'undefined'\n ? {}\n : new Proxy(defaultState, {\n get(_, propName) {\n return get(propName);\n },\n ownKeys(_) {\n return Array.from(states.keys());\n },\n getOwnPropertyDescriptor() {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n has(_, propName) {\n return states.has(propName);\n },\n set(_, propName, value) {\n set(propName, value);\n return true;\n },\n }));\n const on = (eventName, callback) => {\n handlers[eventName].push(callback);\n return () => {\n removeFromArray(handlers[eventName], callback);\n };\n };\n const onChange = (propName, cb) => {\n const unSet = on('set', (key, newValue) => {\n if (key === propName) {\n cb(newValue);\n }\n });\n const unReset = on('reset', () => cb(defaultState[propName]));\n return () => {\n unSet();\n unReset();\n };\n };\n const use = (...subscriptions) => {\n const unsubs = subscriptions.reduce((unsubs, subscription) => {\n if (subscription.set) {\n unsubs.push(on('set', subscription.set));\n }\n if (subscription.get) {\n unsubs.push(on('get', subscription.get));\n }\n if (subscription.reset) {\n unsubs.push(on('reset', subscription.reset));\n }\n if (subscription.dispose) {\n unsubs.push(on('dispose', subscription.dispose));\n }\n return unsubs;\n }, []);\n return () => unsubs.forEach((unsub) => unsub());\n };\n const forceUpdate = (key) => {\n const oldValue = states.get(key);\n handlers.set.forEach((cb) => cb(key, oldValue, oldValue));\n };\n return {\n state,\n get,\n set,\n on,\n onChange,\n use,\n dispose,\n reset,\n forceUpdate,\n };\n};\nconst removeFromArray = (array, item) => {\n const index = array.indexOf(item);\n if (index >= 0) {\n array[index] = array[array.length - 1];\n array.length--;\n }\n};\n\nconst createStore = (defaultState, shouldUpdate) => {\n const map = createObservableMap(defaultState, shouldUpdate);\n map.use(stencilSubscription());\n return map;\n};\n\nexport { createObservableMap, createStore };\n","import { Build } from '@stencil/core';\nimport { createStore } from '@stencil/store';\n\nlet defaultRouter;\nconst createRouter = (opts) => {\n var _a;\n const win = window;\n const url = new URL(win.location.href);\n const parseURL = (_a = opts === null || opts === void 0 ? void 0 : opts.parseURL) !== null && _a !== void 0 ? _a : DEFAULT_PARSE_URL;\n const { state, onChange, dispose } = createStore({\n url,\n activePath: parseURL(url)\n }, (newV, oldV, prop) => {\n if (prop === 'url') {\n return newV.href !== oldV.href;\n }\n return newV !== oldV;\n });\n const push = (href) => {\n history.pushState(null, null, href);\n const url = new URL(href, document.baseURI);\n state.url = url;\n state.activePath = parseURL(url);\n };\n const match = (routes) => {\n const { activePath } = state;\n for (let route of routes) {\n const params = matchPath(activePath, route.path);\n if (params) {\n if (route.to != null) {\n const to = (typeof route.to === 'string')\n ? route.to\n : route.to(activePath);\n push(to);\n return match(routes);\n }\n else {\n return { params, route };\n }\n }\n }\n return undefined;\n };\n const navigationChanged = () => {\n const url = new URL(win.location.href);\n state.url = url;\n state.activePath = parseURL(url);\n };\n const Switch = (_, childrenRoutes) => {\n const result = match(childrenRoutes);\n if (result) {\n if (typeof result.route.jsx === 'function') {\n return result.route.jsx(result.params);\n }\n else {\n return result.route.jsx;\n }\n }\n };\n const disposeRouter = () => {\n defaultRouter = undefined;\n win.removeEventListener('popstate', navigationChanged);\n dispose();\n };\n const router = defaultRouter = {\n Switch,\n get url() {\n return state.url;\n },\n get activePath() {\n return state.activePath;\n },\n push,\n onChange: onChange,\n dispose: disposeRouter,\n };\n // Initial update\n navigationChanged();\n // Listen URL changes\n win.addEventListener('popstate', navigationChanged);\n return router;\n};\nconst Route = (props, children) => {\n var _a;\n if ('to' in props) {\n return {\n path: props.path,\n to: props.to,\n };\n }\n if (Build.isDev && props.render && children.length > 0) {\n console.warn('Route: if `render` is provided, the component should not have any children');\n }\n return {\n path: props.path,\n id: props.id,\n jsx: (_a = props.render) !== null && _a !== void 0 ? _a : children,\n };\n};\nconst href = (href, router = defaultRouter) => {\n if (Build.isDev && !router) {\n throw new Error('Router must be defined in href');\n }\n return {\n href,\n onClick: (ev) => {\n if (ev.metaKey || ev.ctrlKey) {\n return;\n }\n if (ev.which == 2 || ev.button == 1) {\n return;\n }\n ev.preventDefault();\n router.push(href);\n },\n };\n};\nconst matchPath = (pathname, path) => {\n if (typeof path === 'string') {\n if (path === pathname) {\n return {};\n }\n }\n else if (typeof path === 'function') {\n const params = path(pathname);\n if (params) {\n return params === true\n ? {}\n : { ...params };\n }\n }\n else {\n const results = path.exec(pathname);\n if (results) {\n path.lastIndex = 0;\n return { ...results };\n }\n }\n return undefined;\n};\nconst DEFAULT_PARSE_URL = (url) => {\n return url.pathname.toLowerCase();\n};\nconst NotFound = () => ({});\n\n/**\n * TS adaption of https://github.com/pillarjs/path-to-regexp/blob/master/index.js\n */\n/**\n * Default configs.\n */\nconst DEFAULT_DELIMITER = '/';\nconst DEFAULT_DELIMITERS = './';\n/**\n * The main path matching regexp utility.\n */\nconst PATH_REGEXP = new RegExp([\n // Match escaped characters that would otherwise appear in future matches.\n // This allows the user to escape special characters that won't transform.\n '(\\\\\\\\.)',\n // Match Express-style parameters and un-named parameters with a prefix\n // and optional suffixes. Matches appear as:\n //\n // \"/:test(\\\\d+)?\" => [\"/\", \"test\", \"\\d+\", undefined, \"?\"]\n // \"/route(\\\\d+)\" => [undefined, undefined, undefined, \"\\d+\", undefined]\n '(?:\\\\:(\\\\w+)(?:\\\\(((?:\\\\\\\\.|[^\\\\\\\\()])+)\\\\))?|\\\\(((?:\\\\\\\\.|[^\\\\\\\\()])+)\\\\))([+*?])?'\n].join('|'), 'g');\n/**\n * Parse a string for the raw tokens.\n */\nconst parse = (str, options) => {\n var tokens = [];\n var key = 0;\n var index = 0;\n var path = '';\n var defaultDelimiter = (options && options.delimiter) || DEFAULT_DELIMITER;\n var delimiters = (options && options.delimiters) || DEFAULT_DELIMITERS;\n var pathEscaped = false;\n var res;\n while ((res = PATH_REGEXP.exec(str)) !== null) {\n var m = res[0];\n var escaped = res[1];\n var offset = res.index;\n path += str.slice(index, offset);\n index = offset + m.length;\n // Ignore already escaped sequences.\n if (escaped) {\n path += escaped[1];\n pathEscaped = true;\n continue;\n }\n var prev = '';\n var next = str[index];\n var name = res[2];\n var capture = res[3];\n var group = res[4];\n var modifier = res[5];\n if (!pathEscaped && path.length) {\n var k = path.length - 1;\n if (delimiters.indexOf(path[k]) > -1) {\n prev = path[k];\n path = path.slice(0, k);\n }\n }\n // Push the current path onto the tokens.\n if (path) {\n tokens.push(path);\n path = '';\n pathEscaped = false;\n }\n var partial = prev !== '' && next !== undefined && next !== prev;\n var repeat = modifier === '+' || modifier === '*';\n var optional = modifier === '?' || modifier === '*';\n var delimiter = prev || defaultDelimiter;\n var pattern = capture || group;\n tokens.push({\n name: name || key++,\n prefix: prev,\n delimiter: delimiter,\n optional: optional,\n repeat: repeat,\n partial: partial,\n pattern: pattern ? escapeGroup(pattern) : '[^' + escapeString(delimiter) + ']+?'\n });\n }\n // Push any remaining characters.\n if (path || index < str.length) {\n tokens.push(path + str.substr(index));\n }\n return tokens;\n};\n/**\n * Escape a regular expression string.\n */\nconst escapeString = (str) => {\n return str.replace(/([.+*?=^!:${}()[\\]|/\\\\])/g, '\\\\$1');\n};\n/**\n * Escape the capturing group by escaping special characters and meaning.\n */\nconst escapeGroup = (group) => {\n return group.replace(/([=!:$/()])/g, '\\\\$1');\n};\n/**\n * Get the flags for a regexp from the options.\n */\nconst flags = (options) => {\n return options && options.sensitive ? '' : 'i';\n};\n/**\n * Pull out keys from a regexp.\n */\nconst regexpToRegexp = (path, keys) => {\n if (!keys)\n return path;\n // Use a negative lookahead to match only capturing groups.\n var groups = path.source.match(/\\((?!\\?)/g);\n if (groups) {\n for (var i = 0; i < groups.length; i++) {\n keys.push({\n name: i,\n prefix: null,\n delimiter: null,\n optional: false,\n repeat: false,\n partial: false,\n pattern: null\n });\n }\n }\n return path;\n};\n/**\n * Transform an array into a regexp.\n */\nconst arrayToRegexp = (path, keys, options) => {\n var parts = [];\n for (var i = 0; i < path.length; i++) {\n parts.push(pathToRegexp(path[i], keys, options).source);\n }\n return new RegExp('(?:' + parts.join('|') + ')', flags(options));\n};\n/**\n * Create a path regexp from string input.\n */\nconst stringToRegexp = (path, keys, options) => {\n return tokensToRegExp(parse(path, options), keys, options);\n};\n/**\n * Expose a function for taking tokens and returning a RegExp.\n */\nconst tokensToRegExp = (tokens, keys, options) => {\n options = options || {};\n var strict = options.strict;\n var end = options.end !== false;\n var delimiter = escapeString(options.delimiter || DEFAULT_DELIMITER);\n var delimiters = options.delimiters || DEFAULT_DELIMITERS;\n var endsWith = [].concat(options.endsWith || []).map(escapeString).concat('$').join('|');\n var route = '';\n var isEndDelimited = false;\n // Iterate over the tokens and create our regexp string.\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n if (typeof token === 'string') {\n route += escapeString(token);\n isEndDelimited = i === tokens.length - 1 && delimiters.indexOf(token[token.length - 1]) > -1;\n }\n else {\n var prefix = escapeString(token.prefix || '');\n var capture = token.repeat\n ? '(?:' + token.pattern + ')(?:' + prefix + '(?:' + token.pattern + '))*'\n : token.pattern;\n if (keys)\n keys.push(token);\n if (token.optional) {\n if (token.partial) {\n route += prefix + '(' + capture + ')?';\n }\n else {\n route += '(?:' + prefix + '(' + capture + '))?';\n }\n }\n else {\n route += prefix + '(' + capture + ')';\n }\n }\n }\n if (end) {\n if (!strict)\n route += '(?:' + delimiter + ')?';\n route += endsWith === '$' ? '$' : '(?=' + endsWith + ')';\n }\n else {\n if (!strict)\n route += '(?:' + delimiter + '(?=' + endsWith + '))?';\n if (!isEndDelimited)\n route += '(?=' + delimiter + '|' + endsWith + ')';\n }\n return new RegExp('^' + route, flags(options));\n};\n/**\n * Normalize the given path string, returning a regular expression.\n *\n * An empty array can be passed in for the keys, which will hold the\n * placeholder key descriptions. For example, using `/user/:id`, `keys` will\n * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.\n */\nconst pathToRegexp = (path, keys, options) => {\n if (path instanceof RegExp) {\n return regexpToRegexp(path, keys);\n }\n if (Array.isArray(path)) {\n return arrayToRegexp(path, keys, options);\n }\n return stringToRegexp(path, keys, options);\n};\n\nlet cacheCount = 0;\nconst patternCache = {};\nconst cacheLimit = 10000;\n// Memoized function for creating the path match regex\nconst compilePath = (pattern, options) => {\n const cacheKey = `${options.end}${options.strict}`;\n const cache = patternCache[cacheKey] || (patternCache[cacheKey] = {});\n const cachePattern = JSON.stringify(pattern);\n if (cache[cachePattern]) {\n return cache[cachePattern];\n }\n const keys = [];\n const re = pathToRegexp(pattern, keys, options);\n const compiledPattern = { re, keys };\n if (cacheCount < cacheLimit) {\n cache[cachePattern] = compiledPattern;\n cacheCount += 1;\n }\n return compiledPattern;\n};\nconst match = (pathname, options = {}) => {\n const { exact = false, strict = false } = options;\n const { re, keys } = compilePath(pathname, { end: exact, strict });\n return (path) => {\n const match = re.exec(path);\n if (!match) {\n return undefined;\n }\n const [url, ...values] = match;\n const isExact = path === url;\n if (exact && !isExact) {\n return undefined;\n }\n return keys.reduce((memo, key, index) => {\n memo[key.name] = values[index];\n return memo;\n }, {});\n };\n};\n\nexport { NotFound, Route, createRouter, href, match };\n","import { createRouter } from 'stencil-router-v2';\n\nexport { Components, JSX } from './components';\n\nexport const Router = createRouter();\n"],"version":3}
|