@pod-os/elements 0.7.1-2196a40.0 → 0.7.1-8b34d0b.0
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/ion-app_46.cjs.entry.js +211 -20
- package/dist/custom-elements/index.js +215 -24
- package/dist/elements/elements.esm.js +1 -1
- package/dist/elements/p-e3ee9fe0.entry.js +79 -0
- package/dist/esm/ion-app_46.entry.js +211 -20
- package/package.json +2 -2
- package/dist/elements/p-a79a6ad9.entry.js +0 -79
|
@@ -2779,7 +2779,7 @@ Toolbar.style = {
|
|
|
2779
2779
|
md: toolbarMdCss
|
|
2780
2780
|
};
|
|
2781
2781
|
|
|
2782
|
-
const appendToMap = (map, propName, value) => {
|
|
2782
|
+
const appendToMap$1 = (map, propName, value) => {
|
|
2783
2783
|
const items = map.get(propName);
|
|
2784
2784
|
if (!items) {
|
|
2785
2785
|
map.set(propName, [value]);
|
|
@@ -2788,7 +2788,7 @@ const appendToMap = (map, propName, value) => {
|
|
|
2788
2788
|
items.push(value);
|
|
2789
2789
|
}
|
|
2790
2790
|
};
|
|
2791
|
-
const debounce = (fn, ms) => {
|
|
2791
|
+
const debounce$1 = (fn, ms) => {
|
|
2792
2792
|
let timeoutId;
|
|
2793
2793
|
return (...args) => {
|
|
2794
2794
|
if (timeoutId) {
|
|
@@ -2810,13 +2810,13 @@ const debounce = (fn, ms) => {
|
|
|
2810
2810
|
*
|
|
2811
2811
|
* Better leak in Edge than to be useless.
|
|
2812
2812
|
*/
|
|
2813
|
-
const isConnected = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;
|
|
2814
|
-
const cleanupElements = debounce((map) => {
|
|
2813
|
+
const isConnected$1 = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;
|
|
2814
|
+
const cleanupElements$1 = debounce$1((map) => {
|
|
2815
2815
|
for (let key of map.keys()) {
|
|
2816
|
-
map.set(key, map.get(key).filter(isConnected));
|
|
2816
|
+
map.set(key, map.get(key).filter(isConnected$1));
|
|
2817
2817
|
}
|
|
2818
2818
|
}, 2000);
|
|
2819
|
-
const stencilSubscription = () => {
|
|
2819
|
+
const stencilSubscription$1 = () => {
|
|
2820
2820
|
if (typeof index$1.getRenderingRef !== 'function') {
|
|
2821
2821
|
// If we are not in a stencil project, we do nothing.
|
|
2822
2822
|
// This function is not really exported by @stencil/core.
|
|
@@ -2828,7 +2828,7 @@ const stencilSubscription = () => {
|
|
|
2828
2828
|
get: (propName) => {
|
|
2829
2829
|
const elm = index$1.getRenderingRef();
|
|
2830
2830
|
if (elm) {
|
|
2831
|
-
appendToMap(elmsToUpdate, propName, elm);
|
|
2831
|
+
appendToMap$1(elmsToUpdate, propName, elm);
|
|
2832
2832
|
}
|
|
2833
2833
|
},
|
|
2834
2834
|
set: (propName) => {
|
|
@@ -2836,17 +2836,19 @@ const stencilSubscription = () => {
|
|
|
2836
2836
|
if (elements) {
|
|
2837
2837
|
elmsToUpdate.set(propName, elements.filter(index$1.forceUpdate));
|
|
2838
2838
|
}
|
|
2839
|
-
cleanupElements(elmsToUpdate);
|
|
2839
|
+
cleanupElements$1(elmsToUpdate);
|
|
2840
2840
|
},
|
|
2841
2841
|
reset: () => {
|
|
2842
2842
|
elmsToUpdate.forEach((elms) => elms.forEach(index$1.forceUpdate));
|
|
2843
|
-
cleanupElements(elmsToUpdate);
|
|
2843
|
+
cleanupElements$1(elmsToUpdate);
|
|
2844
2844
|
},
|
|
2845
2845
|
};
|
|
2846
2846
|
};
|
|
2847
2847
|
|
|
2848
|
-
const
|
|
2849
|
-
|
|
2848
|
+
const unwrap$1 = (val) => (typeof val === 'function' ? val() : val);
|
|
2849
|
+
const createObservableMap$1 = (defaultState, shouldUpdate = (a, b) => a !== b) => {
|
|
2850
|
+
const unwrappedState = unwrap$1(defaultState);
|
|
2851
|
+
let states = new Map(Object.entries(unwrappedState !== null && unwrappedState !== void 0 ? unwrappedState : {}));
|
|
2850
2852
|
const handlers = {
|
|
2851
2853
|
dispose: [],
|
|
2852
2854
|
get: [],
|
|
@@ -2854,7 +2856,10 @@ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) =>
|
|
|
2854
2856
|
reset: [],
|
|
2855
2857
|
};
|
|
2856
2858
|
const reset = () => {
|
|
2857
|
-
|
|
2859
|
+
var _a;
|
|
2860
|
+
// When resetting the state, the default state may be a function - unwrap it to invoke it.
|
|
2861
|
+
// otherwise, the state won't be properly reset
|
|
2862
|
+
states = new Map(Object.entries((_a = unwrap$1(defaultState)) !== null && _a !== void 0 ? _a : {}));
|
|
2858
2863
|
handlers.reset.forEach((cb) => cb());
|
|
2859
2864
|
};
|
|
2860
2865
|
const dispose = () => {
|
|
@@ -2876,7 +2881,7 @@ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) =>
|
|
|
2876
2881
|
};
|
|
2877
2882
|
const state = (typeof Proxy === 'undefined'
|
|
2878
2883
|
? {}
|
|
2879
|
-
: new Proxy(
|
|
2884
|
+
: new Proxy(unwrappedState, {
|
|
2880
2885
|
get(_, propName) {
|
|
2881
2886
|
return get(propName);
|
|
2882
2887
|
},
|
|
@@ -2900,7 +2905,7 @@ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) =>
|
|
|
2900
2905
|
const on = (eventName, callback) => {
|
|
2901
2906
|
handlers[eventName].push(callback);
|
|
2902
2907
|
return () => {
|
|
2903
|
-
removeFromArray(handlers[eventName], callback);
|
|
2908
|
+
removeFromArray$1(handlers[eventName], callback);
|
|
2904
2909
|
};
|
|
2905
2910
|
};
|
|
2906
2911
|
const onChange = (propName, cb) => {
|
|
@@ -2909,7 +2914,9 @@ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) =>
|
|
|
2909
2914
|
cb(newValue);
|
|
2910
2915
|
}
|
|
2911
2916
|
});
|
|
2912
|
-
|
|
2917
|
+
// We need to unwrap the defaultState because it might be a function.
|
|
2918
|
+
// Otherwise we might not be sending the right reset value.
|
|
2919
|
+
const unReset = on('reset', () => cb(unwrap$1(defaultState)[propName]));
|
|
2913
2920
|
return () => {
|
|
2914
2921
|
unSet();
|
|
2915
2922
|
unReset();
|
|
@@ -2949,7 +2956,7 @@ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) =>
|
|
|
2949
2956
|
forceUpdate,
|
|
2950
2957
|
};
|
|
2951
2958
|
};
|
|
2952
|
-
const removeFromArray = (array, item) => {
|
|
2959
|
+
const removeFromArray$1 = (array, item) => {
|
|
2953
2960
|
const index = array.indexOf(item);
|
|
2954
2961
|
if (index >= 0) {
|
|
2955
2962
|
array[index] = array[array.length - 1];
|
|
@@ -2957,15 +2964,15 @@ const removeFromArray = (array, item) => {
|
|
|
2957
2964
|
}
|
|
2958
2965
|
};
|
|
2959
2966
|
|
|
2960
|
-
const createStore = (defaultState, shouldUpdate) => {
|
|
2961
|
-
const map = createObservableMap(defaultState, shouldUpdate);
|
|
2962
|
-
map.use(stencilSubscription());
|
|
2967
|
+
const createStore$1 = (defaultState, shouldUpdate) => {
|
|
2968
|
+
const map = createObservableMap$1(defaultState, shouldUpdate);
|
|
2969
|
+
map.use(stencilSubscription$1());
|
|
2963
2970
|
return map;
|
|
2964
2971
|
};
|
|
2965
2972
|
|
|
2966
2973
|
const getIdpUrl = () => prompt('Please enter your Identity Provider URL', 'http://localhost:3000');
|
|
2967
2974
|
|
|
2968
|
-
const store = createStore({
|
|
2975
|
+
const store = createStore$1({
|
|
2969
2976
|
getIdpUrl,
|
|
2970
2977
|
isLoggedIn: false,
|
|
2971
2978
|
webId: '',
|
|
@@ -41247,6 +41254,190 @@ const PosRichLink = class {
|
|
|
41247
41254
|
}
|
|
41248
41255
|
};
|
|
41249
41256
|
|
|
41257
|
+
const appendToMap = (map, propName, value) => {
|
|
41258
|
+
const items = map.get(propName);
|
|
41259
|
+
if (!items) {
|
|
41260
|
+
map.set(propName, [value]);
|
|
41261
|
+
}
|
|
41262
|
+
else if (!items.includes(value)) {
|
|
41263
|
+
items.push(value);
|
|
41264
|
+
}
|
|
41265
|
+
};
|
|
41266
|
+
const debounce = (fn, ms) => {
|
|
41267
|
+
let timeoutId;
|
|
41268
|
+
return (...args) => {
|
|
41269
|
+
if (timeoutId) {
|
|
41270
|
+
clearTimeout(timeoutId);
|
|
41271
|
+
}
|
|
41272
|
+
timeoutId = setTimeout(() => {
|
|
41273
|
+
timeoutId = 0;
|
|
41274
|
+
fn(...args);
|
|
41275
|
+
}, ms);
|
|
41276
|
+
};
|
|
41277
|
+
};
|
|
41278
|
+
|
|
41279
|
+
/**
|
|
41280
|
+
* Check if a possible element isConnected.
|
|
41281
|
+
* The property might not be there, so we check for it.
|
|
41282
|
+
*
|
|
41283
|
+
* We want it to return true if isConnected is not a property,
|
|
41284
|
+
* otherwise we would remove these elements and would not update.
|
|
41285
|
+
*
|
|
41286
|
+
* Better leak in Edge than to be useless.
|
|
41287
|
+
*/
|
|
41288
|
+
const isConnected = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;
|
|
41289
|
+
const cleanupElements = debounce((map) => {
|
|
41290
|
+
for (let key of map.keys()) {
|
|
41291
|
+
map.set(key, map.get(key).filter(isConnected));
|
|
41292
|
+
}
|
|
41293
|
+
}, 2000);
|
|
41294
|
+
const stencilSubscription = () => {
|
|
41295
|
+
if (typeof index$1.getRenderingRef !== 'function') {
|
|
41296
|
+
// If we are not in a stencil project, we do nothing.
|
|
41297
|
+
// This function is not really exported by @stencil/core.
|
|
41298
|
+
return {};
|
|
41299
|
+
}
|
|
41300
|
+
const elmsToUpdate = new Map();
|
|
41301
|
+
return {
|
|
41302
|
+
dispose: () => elmsToUpdate.clear(),
|
|
41303
|
+
get: (propName) => {
|
|
41304
|
+
const elm = index$1.getRenderingRef();
|
|
41305
|
+
if (elm) {
|
|
41306
|
+
appendToMap(elmsToUpdate, propName, elm);
|
|
41307
|
+
}
|
|
41308
|
+
},
|
|
41309
|
+
set: (propName) => {
|
|
41310
|
+
const elements = elmsToUpdate.get(propName);
|
|
41311
|
+
if (elements) {
|
|
41312
|
+
elmsToUpdate.set(propName, elements.filter(index$1.forceUpdate));
|
|
41313
|
+
}
|
|
41314
|
+
cleanupElements(elmsToUpdate);
|
|
41315
|
+
},
|
|
41316
|
+
reset: () => {
|
|
41317
|
+
elmsToUpdate.forEach((elms) => elms.forEach(index$1.forceUpdate));
|
|
41318
|
+
cleanupElements(elmsToUpdate);
|
|
41319
|
+
},
|
|
41320
|
+
};
|
|
41321
|
+
};
|
|
41322
|
+
|
|
41323
|
+
const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) => {
|
|
41324
|
+
let states = new Map(Object.entries(defaultState !== null && defaultState !== void 0 ? defaultState : {}));
|
|
41325
|
+
const handlers = {
|
|
41326
|
+
dispose: [],
|
|
41327
|
+
get: [],
|
|
41328
|
+
set: [],
|
|
41329
|
+
reset: [],
|
|
41330
|
+
};
|
|
41331
|
+
const reset = () => {
|
|
41332
|
+
states = new Map(Object.entries(defaultState !== null && defaultState !== void 0 ? defaultState : {}));
|
|
41333
|
+
handlers.reset.forEach((cb) => cb());
|
|
41334
|
+
};
|
|
41335
|
+
const dispose = () => {
|
|
41336
|
+
// Call first dispose as resetting the state would
|
|
41337
|
+
// cause less updates ;)
|
|
41338
|
+
handlers.dispose.forEach((cb) => cb());
|
|
41339
|
+
reset();
|
|
41340
|
+
};
|
|
41341
|
+
const get = (propName) => {
|
|
41342
|
+
handlers.get.forEach((cb) => cb(propName));
|
|
41343
|
+
return states.get(propName);
|
|
41344
|
+
};
|
|
41345
|
+
const set = (propName, value) => {
|
|
41346
|
+
const oldValue = states.get(propName);
|
|
41347
|
+
if (shouldUpdate(value, oldValue, propName)) {
|
|
41348
|
+
states.set(propName, value);
|
|
41349
|
+
handlers.set.forEach((cb) => cb(propName, value, oldValue));
|
|
41350
|
+
}
|
|
41351
|
+
};
|
|
41352
|
+
const state = (typeof Proxy === 'undefined'
|
|
41353
|
+
? {}
|
|
41354
|
+
: new Proxy(defaultState, {
|
|
41355
|
+
get(_, propName) {
|
|
41356
|
+
return get(propName);
|
|
41357
|
+
},
|
|
41358
|
+
ownKeys(_) {
|
|
41359
|
+
return Array.from(states.keys());
|
|
41360
|
+
},
|
|
41361
|
+
getOwnPropertyDescriptor() {
|
|
41362
|
+
return {
|
|
41363
|
+
enumerable: true,
|
|
41364
|
+
configurable: true,
|
|
41365
|
+
};
|
|
41366
|
+
},
|
|
41367
|
+
has(_, propName) {
|
|
41368
|
+
return states.has(propName);
|
|
41369
|
+
},
|
|
41370
|
+
set(_, propName, value) {
|
|
41371
|
+
set(propName, value);
|
|
41372
|
+
return true;
|
|
41373
|
+
},
|
|
41374
|
+
}));
|
|
41375
|
+
const on = (eventName, callback) => {
|
|
41376
|
+
handlers[eventName].push(callback);
|
|
41377
|
+
return () => {
|
|
41378
|
+
removeFromArray(handlers[eventName], callback);
|
|
41379
|
+
};
|
|
41380
|
+
};
|
|
41381
|
+
const onChange = (propName, cb) => {
|
|
41382
|
+
const unSet = on('set', (key, newValue) => {
|
|
41383
|
+
if (key === propName) {
|
|
41384
|
+
cb(newValue);
|
|
41385
|
+
}
|
|
41386
|
+
});
|
|
41387
|
+
const unReset = on('reset', () => cb(defaultState[propName]));
|
|
41388
|
+
return () => {
|
|
41389
|
+
unSet();
|
|
41390
|
+
unReset();
|
|
41391
|
+
};
|
|
41392
|
+
};
|
|
41393
|
+
const use = (...subscriptions) => {
|
|
41394
|
+
const unsubs = subscriptions.reduce((unsubs, subscription) => {
|
|
41395
|
+
if (subscription.set) {
|
|
41396
|
+
unsubs.push(on('set', subscription.set));
|
|
41397
|
+
}
|
|
41398
|
+
if (subscription.get) {
|
|
41399
|
+
unsubs.push(on('get', subscription.get));
|
|
41400
|
+
}
|
|
41401
|
+
if (subscription.reset) {
|
|
41402
|
+
unsubs.push(on('reset', subscription.reset));
|
|
41403
|
+
}
|
|
41404
|
+
if (subscription.dispose) {
|
|
41405
|
+
unsubs.push(on('dispose', subscription.dispose));
|
|
41406
|
+
}
|
|
41407
|
+
return unsubs;
|
|
41408
|
+
}, []);
|
|
41409
|
+
return () => unsubs.forEach((unsub) => unsub());
|
|
41410
|
+
};
|
|
41411
|
+
const forceUpdate = (key) => {
|
|
41412
|
+
const oldValue = states.get(key);
|
|
41413
|
+
handlers.set.forEach((cb) => cb(key, oldValue, oldValue));
|
|
41414
|
+
};
|
|
41415
|
+
return {
|
|
41416
|
+
state,
|
|
41417
|
+
get,
|
|
41418
|
+
set,
|
|
41419
|
+
on,
|
|
41420
|
+
onChange,
|
|
41421
|
+
use,
|
|
41422
|
+
dispose,
|
|
41423
|
+
reset,
|
|
41424
|
+
forceUpdate,
|
|
41425
|
+
};
|
|
41426
|
+
};
|
|
41427
|
+
const removeFromArray = (array, item) => {
|
|
41428
|
+
const index = array.indexOf(item);
|
|
41429
|
+
if (index >= 0) {
|
|
41430
|
+
array[index] = array[array.length - 1];
|
|
41431
|
+
array.length--;
|
|
41432
|
+
}
|
|
41433
|
+
};
|
|
41434
|
+
|
|
41435
|
+
const createStore = (defaultState, shouldUpdate) => {
|
|
41436
|
+
const map = createObservableMap(defaultState, shouldUpdate);
|
|
41437
|
+
map.use(stencilSubscription());
|
|
41438
|
+
return map;
|
|
41439
|
+
};
|
|
41440
|
+
|
|
41250
41441
|
const createRouter = (opts) => {
|
|
41251
41442
|
var _a;
|
|
41252
41443
|
const win = window;
|
|
@@ -623,10 +623,10 @@ const debounceEvent = (event, wait) => {
|
|
|
623
623
|
const original = event._original || event;
|
|
624
624
|
return {
|
|
625
625
|
_original: event,
|
|
626
|
-
emit: debounce$
|
|
626
|
+
emit: debounce$2(original.emit.bind(original), wait),
|
|
627
627
|
};
|
|
628
628
|
};
|
|
629
|
-
const debounce$
|
|
629
|
+
const debounce$2 = (func, wait = 0) => {
|
|
630
630
|
let timer;
|
|
631
631
|
return (...args) => {
|
|
632
632
|
clearTimeout(timer);
|
|
@@ -22090,8 +22090,8 @@ const Router$1 = class extends HTMLElement$1 {
|
|
|
22090
22090
|
}
|
|
22091
22091
|
}
|
|
22092
22092
|
componentDidLoad() {
|
|
22093
|
-
window.addEventListener('ionRouteRedirectChanged', debounce$
|
|
22094
|
-
window.addEventListener('ionRouteDataChanged', debounce$
|
|
22093
|
+
window.addEventListener('ionRouteRedirectChanged', debounce$2(this.onRedirectChanged.bind(this), 10));
|
|
22094
|
+
window.addEventListener('ionRouteDataChanged', debounce$2(this.onRoutesChanged.bind(this), 100));
|
|
22095
22095
|
}
|
|
22096
22096
|
async onPopState() {
|
|
22097
22097
|
const direction = this.historyDirection();
|
|
@@ -26382,7 +26382,7 @@ const VirtualProxy = ({ dom }, children, utils) => {
|
|
|
26382
26382
|
});
|
|
26383
26383
|
};
|
|
26384
26384
|
|
|
26385
|
-
const appendToMap = (map, propName, value) => {
|
|
26385
|
+
const appendToMap$1 = (map, propName, value) => {
|
|
26386
26386
|
const items = map.get(propName);
|
|
26387
26387
|
if (!items) {
|
|
26388
26388
|
map.set(propName, [value]);
|
|
@@ -26391,7 +26391,7 @@ const appendToMap = (map, propName, value) => {
|
|
|
26391
26391
|
items.push(value);
|
|
26392
26392
|
}
|
|
26393
26393
|
};
|
|
26394
|
-
const debounce = (fn, ms) => {
|
|
26394
|
+
const debounce$1 = (fn, ms) => {
|
|
26395
26395
|
let timeoutId;
|
|
26396
26396
|
return (...args) => {
|
|
26397
26397
|
if (timeoutId) {
|
|
@@ -26413,13 +26413,13 @@ const debounce = (fn, ms) => {
|
|
|
26413
26413
|
*
|
|
26414
26414
|
* Better leak in Edge than to be useless.
|
|
26415
26415
|
*/
|
|
26416
|
-
const isConnected = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;
|
|
26417
|
-
const cleanupElements = debounce((map) => {
|
|
26416
|
+
const isConnected$1 = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;
|
|
26417
|
+
const cleanupElements$1 = debounce$1((map) => {
|
|
26418
26418
|
for (let key of map.keys()) {
|
|
26419
|
-
map.set(key, map.get(key).filter(isConnected));
|
|
26419
|
+
map.set(key, map.get(key).filter(isConnected$1));
|
|
26420
26420
|
}
|
|
26421
26421
|
}, 2000);
|
|
26422
|
-
const stencilSubscription = () => {
|
|
26422
|
+
const stencilSubscription$1 = () => {
|
|
26423
26423
|
if (typeof getRenderingRef !== 'function') {
|
|
26424
26424
|
// If we are not in a stencil project, we do nothing.
|
|
26425
26425
|
// This function is not really exported by @stencil/core.
|
|
@@ -26431,7 +26431,7 @@ const stencilSubscription = () => {
|
|
|
26431
26431
|
get: (propName) => {
|
|
26432
26432
|
const elm = getRenderingRef();
|
|
26433
26433
|
if (elm) {
|
|
26434
|
-
appendToMap(elmsToUpdate, propName, elm);
|
|
26434
|
+
appendToMap$1(elmsToUpdate, propName, elm);
|
|
26435
26435
|
}
|
|
26436
26436
|
},
|
|
26437
26437
|
set: (propName) => {
|
|
@@ -26439,17 +26439,19 @@ const stencilSubscription = () => {
|
|
|
26439
26439
|
if (elements) {
|
|
26440
26440
|
elmsToUpdate.set(propName, elements.filter(forceUpdate));
|
|
26441
26441
|
}
|
|
26442
|
-
cleanupElements(elmsToUpdate);
|
|
26442
|
+
cleanupElements$1(elmsToUpdate);
|
|
26443
26443
|
},
|
|
26444
26444
|
reset: () => {
|
|
26445
26445
|
elmsToUpdate.forEach((elms) => elms.forEach(forceUpdate));
|
|
26446
|
-
cleanupElements(elmsToUpdate);
|
|
26446
|
+
cleanupElements$1(elmsToUpdate);
|
|
26447
26447
|
},
|
|
26448
26448
|
};
|
|
26449
26449
|
};
|
|
26450
26450
|
|
|
26451
|
-
const
|
|
26452
|
-
|
|
26451
|
+
const unwrap$1 = (val) => (typeof val === 'function' ? val() : val);
|
|
26452
|
+
const createObservableMap$1 = (defaultState, shouldUpdate = (a, b) => a !== b) => {
|
|
26453
|
+
const unwrappedState = unwrap$1(defaultState);
|
|
26454
|
+
let states = new Map(Object.entries(unwrappedState !== null && unwrappedState !== void 0 ? unwrappedState : {}));
|
|
26453
26455
|
const handlers = {
|
|
26454
26456
|
dispose: [],
|
|
26455
26457
|
get: [],
|
|
@@ -26457,7 +26459,10 @@ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) =>
|
|
|
26457
26459
|
reset: [],
|
|
26458
26460
|
};
|
|
26459
26461
|
const reset = () => {
|
|
26460
|
-
|
|
26462
|
+
var _a;
|
|
26463
|
+
// When resetting the state, the default state may be a function - unwrap it to invoke it.
|
|
26464
|
+
// otherwise, the state won't be properly reset
|
|
26465
|
+
states = new Map(Object.entries((_a = unwrap$1(defaultState)) !== null && _a !== void 0 ? _a : {}));
|
|
26461
26466
|
handlers.reset.forEach((cb) => cb());
|
|
26462
26467
|
};
|
|
26463
26468
|
const dispose = () => {
|
|
@@ -26479,7 +26484,7 @@ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) =>
|
|
|
26479
26484
|
};
|
|
26480
26485
|
const state = (typeof Proxy === 'undefined'
|
|
26481
26486
|
? {}
|
|
26482
|
-
: new Proxy(
|
|
26487
|
+
: new Proxy(unwrappedState, {
|
|
26483
26488
|
get(_, propName) {
|
|
26484
26489
|
return get(propName);
|
|
26485
26490
|
},
|
|
@@ -26503,7 +26508,7 @@ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) =>
|
|
|
26503
26508
|
const on = (eventName, callback) => {
|
|
26504
26509
|
handlers[eventName].push(callback);
|
|
26505
26510
|
return () => {
|
|
26506
|
-
removeFromArray(handlers[eventName], callback);
|
|
26511
|
+
removeFromArray$1(handlers[eventName], callback);
|
|
26507
26512
|
};
|
|
26508
26513
|
};
|
|
26509
26514
|
const onChange = (propName, cb) => {
|
|
@@ -26512,7 +26517,9 @@ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) =>
|
|
|
26512
26517
|
cb(newValue);
|
|
26513
26518
|
}
|
|
26514
26519
|
});
|
|
26515
|
-
|
|
26520
|
+
// We need to unwrap the defaultState because it might be a function.
|
|
26521
|
+
// Otherwise we might not be sending the right reset value.
|
|
26522
|
+
const unReset = on('reset', () => cb(unwrap$1(defaultState)[propName]));
|
|
26516
26523
|
return () => {
|
|
26517
26524
|
unSet();
|
|
26518
26525
|
unReset();
|
|
@@ -26552,7 +26559,7 @@ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) =>
|
|
|
26552
26559
|
forceUpdate,
|
|
26553
26560
|
};
|
|
26554
26561
|
};
|
|
26555
|
-
const removeFromArray = (array, item) => {
|
|
26562
|
+
const removeFromArray$1 = (array, item) => {
|
|
26556
26563
|
const index = array.indexOf(item);
|
|
26557
26564
|
if (index >= 0) {
|
|
26558
26565
|
array[index] = array[array.length - 1];
|
|
@@ -26560,15 +26567,15 @@ const removeFromArray = (array, item) => {
|
|
|
26560
26567
|
}
|
|
26561
26568
|
};
|
|
26562
26569
|
|
|
26563
|
-
const createStore = (defaultState, shouldUpdate) => {
|
|
26564
|
-
const map = createObservableMap(defaultState, shouldUpdate);
|
|
26565
|
-
map.use(stencilSubscription());
|
|
26570
|
+
const createStore$1 = (defaultState, shouldUpdate) => {
|
|
26571
|
+
const map = createObservableMap$1(defaultState, shouldUpdate);
|
|
26572
|
+
map.use(stencilSubscription$1());
|
|
26566
26573
|
return map;
|
|
26567
26574
|
};
|
|
26568
26575
|
|
|
26569
26576
|
const getIdpUrl = () => prompt('Please enter your Identity Provider URL', 'http://localhost:3000');
|
|
26570
26577
|
|
|
26571
|
-
const store = createStore({
|
|
26578
|
+
const store = createStore$1({
|
|
26572
26579
|
getIdpUrl,
|
|
26573
26580
|
isLoggedIn: false,
|
|
26574
26581
|
webId: '',
|
|
@@ -64878,6 +64885,190 @@ const PosRichLink$1 = class extends HTMLElement$1 {
|
|
|
64878
64885
|
}
|
|
64879
64886
|
};
|
|
64880
64887
|
|
|
64888
|
+
const appendToMap = (map, propName, value) => {
|
|
64889
|
+
const items = map.get(propName);
|
|
64890
|
+
if (!items) {
|
|
64891
|
+
map.set(propName, [value]);
|
|
64892
|
+
}
|
|
64893
|
+
else if (!items.includes(value)) {
|
|
64894
|
+
items.push(value);
|
|
64895
|
+
}
|
|
64896
|
+
};
|
|
64897
|
+
const debounce = (fn, ms) => {
|
|
64898
|
+
let timeoutId;
|
|
64899
|
+
return (...args) => {
|
|
64900
|
+
if (timeoutId) {
|
|
64901
|
+
clearTimeout(timeoutId);
|
|
64902
|
+
}
|
|
64903
|
+
timeoutId = setTimeout(() => {
|
|
64904
|
+
timeoutId = 0;
|
|
64905
|
+
fn(...args);
|
|
64906
|
+
}, ms);
|
|
64907
|
+
};
|
|
64908
|
+
};
|
|
64909
|
+
|
|
64910
|
+
/**
|
|
64911
|
+
* Check if a possible element isConnected.
|
|
64912
|
+
* The property might not be there, so we check for it.
|
|
64913
|
+
*
|
|
64914
|
+
* We want it to return true if isConnected is not a property,
|
|
64915
|
+
* otherwise we would remove these elements and would not update.
|
|
64916
|
+
*
|
|
64917
|
+
* Better leak in Edge than to be useless.
|
|
64918
|
+
*/
|
|
64919
|
+
const isConnected = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;
|
|
64920
|
+
const cleanupElements = debounce((map) => {
|
|
64921
|
+
for (let key of map.keys()) {
|
|
64922
|
+
map.set(key, map.get(key).filter(isConnected));
|
|
64923
|
+
}
|
|
64924
|
+
}, 2000);
|
|
64925
|
+
const stencilSubscription = () => {
|
|
64926
|
+
if (typeof getRenderingRef !== 'function') {
|
|
64927
|
+
// If we are not in a stencil project, we do nothing.
|
|
64928
|
+
// This function is not really exported by @stencil/core.
|
|
64929
|
+
return {};
|
|
64930
|
+
}
|
|
64931
|
+
const elmsToUpdate = new Map();
|
|
64932
|
+
return {
|
|
64933
|
+
dispose: () => elmsToUpdate.clear(),
|
|
64934
|
+
get: (propName) => {
|
|
64935
|
+
const elm = getRenderingRef();
|
|
64936
|
+
if (elm) {
|
|
64937
|
+
appendToMap(elmsToUpdate, propName, elm);
|
|
64938
|
+
}
|
|
64939
|
+
},
|
|
64940
|
+
set: (propName) => {
|
|
64941
|
+
const elements = elmsToUpdate.get(propName);
|
|
64942
|
+
if (elements) {
|
|
64943
|
+
elmsToUpdate.set(propName, elements.filter(forceUpdate));
|
|
64944
|
+
}
|
|
64945
|
+
cleanupElements(elmsToUpdate);
|
|
64946
|
+
},
|
|
64947
|
+
reset: () => {
|
|
64948
|
+
elmsToUpdate.forEach((elms) => elms.forEach(forceUpdate));
|
|
64949
|
+
cleanupElements(elmsToUpdate);
|
|
64950
|
+
},
|
|
64951
|
+
};
|
|
64952
|
+
};
|
|
64953
|
+
|
|
64954
|
+
const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) => {
|
|
64955
|
+
let states = new Map(Object.entries(defaultState !== null && defaultState !== void 0 ? defaultState : {}));
|
|
64956
|
+
const handlers = {
|
|
64957
|
+
dispose: [],
|
|
64958
|
+
get: [],
|
|
64959
|
+
set: [],
|
|
64960
|
+
reset: [],
|
|
64961
|
+
};
|
|
64962
|
+
const reset = () => {
|
|
64963
|
+
states = new Map(Object.entries(defaultState !== null && defaultState !== void 0 ? defaultState : {}));
|
|
64964
|
+
handlers.reset.forEach((cb) => cb());
|
|
64965
|
+
};
|
|
64966
|
+
const dispose = () => {
|
|
64967
|
+
// Call first dispose as resetting the state would
|
|
64968
|
+
// cause less updates ;)
|
|
64969
|
+
handlers.dispose.forEach((cb) => cb());
|
|
64970
|
+
reset();
|
|
64971
|
+
};
|
|
64972
|
+
const get = (propName) => {
|
|
64973
|
+
handlers.get.forEach((cb) => cb(propName));
|
|
64974
|
+
return states.get(propName);
|
|
64975
|
+
};
|
|
64976
|
+
const set = (propName, value) => {
|
|
64977
|
+
const oldValue = states.get(propName);
|
|
64978
|
+
if (shouldUpdate(value, oldValue, propName)) {
|
|
64979
|
+
states.set(propName, value);
|
|
64980
|
+
handlers.set.forEach((cb) => cb(propName, value, oldValue));
|
|
64981
|
+
}
|
|
64982
|
+
};
|
|
64983
|
+
const state = (typeof Proxy === 'undefined'
|
|
64984
|
+
? {}
|
|
64985
|
+
: new Proxy(defaultState, {
|
|
64986
|
+
get(_, propName) {
|
|
64987
|
+
return get(propName);
|
|
64988
|
+
},
|
|
64989
|
+
ownKeys(_) {
|
|
64990
|
+
return Array.from(states.keys());
|
|
64991
|
+
},
|
|
64992
|
+
getOwnPropertyDescriptor() {
|
|
64993
|
+
return {
|
|
64994
|
+
enumerable: true,
|
|
64995
|
+
configurable: true,
|
|
64996
|
+
};
|
|
64997
|
+
},
|
|
64998
|
+
has(_, propName) {
|
|
64999
|
+
return states.has(propName);
|
|
65000
|
+
},
|
|
65001
|
+
set(_, propName, value) {
|
|
65002
|
+
set(propName, value);
|
|
65003
|
+
return true;
|
|
65004
|
+
},
|
|
65005
|
+
}));
|
|
65006
|
+
const on = (eventName, callback) => {
|
|
65007
|
+
handlers[eventName].push(callback);
|
|
65008
|
+
return () => {
|
|
65009
|
+
removeFromArray(handlers[eventName], callback);
|
|
65010
|
+
};
|
|
65011
|
+
};
|
|
65012
|
+
const onChange = (propName, cb) => {
|
|
65013
|
+
const unSet = on('set', (key, newValue) => {
|
|
65014
|
+
if (key === propName) {
|
|
65015
|
+
cb(newValue);
|
|
65016
|
+
}
|
|
65017
|
+
});
|
|
65018
|
+
const unReset = on('reset', () => cb(defaultState[propName]));
|
|
65019
|
+
return () => {
|
|
65020
|
+
unSet();
|
|
65021
|
+
unReset();
|
|
65022
|
+
};
|
|
65023
|
+
};
|
|
65024
|
+
const use = (...subscriptions) => {
|
|
65025
|
+
const unsubs = subscriptions.reduce((unsubs, subscription) => {
|
|
65026
|
+
if (subscription.set) {
|
|
65027
|
+
unsubs.push(on('set', subscription.set));
|
|
65028
|
+
}
|
|
65029
|
+
if (subscription.get) {
|
|
65030
|
+
unsubs.push(on('get', subscription.get));
|
|
65031
|
+
}
|
|
65032
|
+
if (subscription.reset) {
|
|
65033
|
+
unsubs.push(on('reset', subscription.reset));
|
|
65034
|
+
}
|
|
65035
|
+
if (subscription.dispose) {
|
|
65036
|
+
unsubs.push(on('dispose', subscription.dispose));
|
|
65037
|
+
}
|
|
65038
|
+
return unsubs;
|
|
65039
|
+
}, []);
|
|
65040
|
+
return () => unsubs.forEach((unsub) => unsub());
|
|
65041
|
+
};
|
|
65042
|
+
const forceUpdate = (key) => {
|
|
65043
|
+
const oldValue = states.get(key);
|
|
65044
|
+
handlers.set.forEach((cb) => cb(key, oldValue, oldValue));
|
|
65045
|
+
};
|
|
65046
|
+
return {
|
|
65047
|
+
state,
|
|
65048
|
+
get,
|
|
65049
|
+
set,
|
|
65050
|
+
on,
|
|
65051
|
+
onChange,
|
|
65052
|
+
use,
|
|
65053
|
+
dispose,
|
|
65054
|
+
reset,
|
|
65055
|
+
forceUpdate,
|
|
65056
|
+
};
|
|
65057
|
+
};
|
|
65058
|
+
const removeFromArray = (array, item) => {
|
|
65059
|
+
const index = array.indexOf(item);
|
|
65060
|
+
if (index >= 0) {
|
|
65061
|
+
array[index] = array[array.length - 1];
|
|
65062
|
+
array.length--;
|
|
65063
|
+
}
|
|
65064
|
+
};
|
|
65065
|
+
|
|
65066
|
+
const createStore = (defaultState, shouldUpdate) => {
|
|
65067
|
+
const map = createObservableMap(defaultState, shouldUpdate);
|
|
65068
|
+
map.use(stencilSubscription());
|
|
65069
|
+
return map;
|
|
65070
|
+
};
|
|
65071
|
+
|
|
64881
65072
|
const createRouter = (opts) => {
|
|
64882
65073
|
var _a;
|
|
64883
65074
|
const win = window;
|