@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
|
@@ -2775,7 +2775,7 @@ Toolbar.style = {
|
|
|
2775
2775
|
md: toolbarMdCss
|
|
2776
2776
|
};
|
|
2777
2777
|
|
|
2778
|
-
const appendToMap = (map, propName, value) => {
|
|
2778
|
+
const appendToMap$1 = (map, propName, value) => {
|
|
2779
2779
|
const items = map.get(propName);
|
|
2780
2780
|
if (!items) {
|
|
2781
2781
|
map.set(propName, [value]);
|
|
@@ -2784,7 +2784,7 @@ const appendToMap = (map, propName, value) => {
|
|
|
2784
2784
|
items.push(value);
|
|
2785
2785
|
}
|
|
2786
2786
|
};
|
|
2787
|
-
const debounce = (fn, ms) => {
|
|
2787
|
+
const debounce$1 = (fn, ms) => {
|
|
2788
2788
|
let timeoutId;
|
|
2789
2789
|
return (...args) => {
|
|
2790
2790
|
if (timeoutId) {
|
|
@@ -2806,13 +2806,13 @@ const debounce = (fn, ms) => {
|
|
|
2806
2806
|
*
|
|
2807
2807
|
* Better leak in Edge than to be useless.
|
|
2808
2808
|
*/
|
|
2809
|
-
const isConnected = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;
|
|
2810
|
-
const cleanupElements = debounce((map) => {
|
|
2809
|
+
const isConnected$1 = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;
|
|
2810
|
+
const cleanupElements$1 = debounce$1((map) => {
|
|
2811
2811
|
for (let key of map.keys()) {
|
|
2812
|
-
map.set(key, map.get(key).filter(isConnected));
|
|
2812
|
+
map.set(key, map.get(key).filter(isConnected$1));
|
|
2813
2813
|
}
|
|
2814
2814
|
}, 2000);
|
|
2815
|
-
const stencilSubscription = () => {
|
|
2815
|
+
const stencilSubscription$1 = () => {
|
|
2816
2816
|
if (typeof getRenderingRef !== 'function') {
|
|
2817
2817
|
// If we are not in a stencil project, we do nothing.
|
|
2818
2818
|
// This function is not really exported by @stencil/core.
|
|
@@ -2824,7 +2824,7 @@ const stencilSubscription = () => {
|
|
|
2824
2824
|
get: (propName) => {
|
|
2825
2825
|
const elm = getRenderingRef();
|
|
2826
2826
|
if (elm) {
|
|
2827
|
-
appendToMap(elmsToUpdate, propName, elm);
|
|
2827
|
+
appendToMap$1(elmsToUpdate, propName, elm);
|
|
2828
2828
|
}
|
|
2829
2829
|
},
|
|
2830
2830
|
set: (propName) => {
|
|
@@ -2832,17 +2832,19 @@ const stencilSubscription = () => {
|
|
|
2832
2832
|
if (elements) {
|
|
2833
2833
|
elmsToUpdate.set(propName, elements.filter(forceUpdate));
|
|
2834
2834
|
}
|
|
2835
|
-
cleanupElements(elmsToUpdate);
|
|
2835
|
+
cleanupElements$1(elmsToUpdate);
|
|
2836
2836
|
},
|
|
2837
2837
|
reset: () => {
|
|
2838
2838
|
elmsToUpdate.forEach((elms) => elms.forEach(forceUpdate));
|
|
2839
|
-
cleanupElements(elmsToUpdate);
|
|
2839
|
+
cleanupElements$1(elmsToUpdate);
|
|
2840
2840
|
},
|
|
2841
2841
|
};
|
|
2842
2842
|
};
|
|
2843
2843
|
|
|
2844
|
-
const
|
|
2845
|
-
|
|
2844
|
+
const unwrap$1 = (val) => (typeof val === 'function' ? val() : val);
|
|
2845
|
+
const createObservableMap$1 = (defaultState, shouldUpdate = (a, b) => a !== b) => {
|
|
2846
|
+
const unwrappedState = unwrap$1(defaultState);
|
|
2847
|
+
let states = new Map(Object.entries(unwrappedState !== null && unwrappedState !== void 0 ? unwrappedState : {}));
|
|
2846
2848
|
const handlers = {
|
|
2847
2849
|
dispose: [],
|
|
2848
2850
|
get: [],
|
|
@@ -2850,7 +2852,10 @@ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) =>
|
|
|
2850
2852
|
reset: [],
|
|
2851
2853
|
};
|
|
2852
2854
|
const reset = () => {
|
|
2853
|
-
|
|
2855
|
+
var _a;
|
|
2856
|
+
// When resetting the state, the default state may be a function - unwrap it to invoke it.
|
|
2857
|
+
// otherwise, the state won't be properly reset
|
|
2858
|
+
states = new Map(Object.entries((_a = unwrap$1(defaultState)) !== null && _a !== void 0 ? _a : {}));
|
|
2854
2859
|
handlers.reset.forEach((cb) => cb());
|
|
2855
2860
|
};
|
|
2856
2861
|
const dispose = () => {
|
|
@@ -2872,7 +2877,7 @@ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) =>
|
|
|
2872
2877
|
};
|
|
2873
2878
|
const state = (typeof Proxy === 'undefined'
|
|
2874
2879
|
? {}
|
|
2875
|
-
: new Proxy(
|
|
2880
|
+
: new Proxy(unwrappedState, {
|
|
2876
2881
|
get(_, propName) {
|
|
2877
2882
|
return get(propName);
|
|
2878
2883
|
},
|
|
@@ -2896,7 +2901,7 @@ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) =>
|
|
|
2896
2901
|
const on = (eventName, callback) => {
|
|
2897
2902
|
handlers[eventName].push(callback);
|
|
2898
2903
|
return () => {
|
|
2899
|
-
removeFromArray(handlers[eventName], callback);
|
|
2904
|
+
removeFromArray$1(handlers[eventName], callback);
|
|
2900
2905
|
};
|
|
2901
2906
|
};
|
|
2902
2907
|
const onChange = (propName, cb) => {
|
|
@@ -2905,7 +2910,9 @@ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) =>
|
|
|
2905
2910
|
cb(newValue);
|
|
2906
2911
|
}
|
|
2907
2912
|
});
|
|
2908
|
-
|
|
2913
|
+
// We need to unwrap the defaultState because it might be a function.
|
|
2914
|
+
// Otherwise we might not be sending the right reset value.
|
|
2915
|
+
const unReset = on('reset', () => cb(unwrap$1(defaultState)[propName]));
|
|
2909
2916
|
return () => {
|
|
2910
2917
|
unSet();
|
|
2911
2918
|
unReset();
|
|
@@ -2945,7 +2952,7 @@ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) =>
|
|
|
2945
2952
|
forceUpdate,
|
|
2946
2953
|
};
|
|
2947
2954
|
};
|
|
2948
|
-
const removeFromArray = (array, item) => {
|
|
2955
|
+
const removeFromArray$1 = (array, item) => {
|
|
2949
2956
|
const index = array.indexOf(item);
|
|
2950
2957
|
if (index >= 0) {
|
|
2951
2958
|
array[index] = array[array.length - 1];
|
|
@@ -2953,15 +2960,15 @@ const removeFromArray = (array, item) => {
|
|
|
2953
2960
|
}
|
|
2954
2961
|
};
|
|
2955
2962
|
|
|
2956
|
-
const createStore = (defaultState, shouldUpdate) => {
|
|
2957
|
-
const map = createObservableMap(defaultState, shouldUpdate);
|
|
2958
|
-
map.use(stencilSubscription());
|
|
2963
|
+
const createStore$1 = (defaultState, shouldUpdate) => {
|
|
2964
|
+
const map = createObservableMap$1(defaultState, shouldUpdate);
|
|
2965
|
+
map.use(stencilSubscription$1());
|
|
2959
2966
|
return map;
|
|
2960
2967
|
};
|
|
2961
2968
|
|
|
2962
2969
|
const getIdpUrl = () => prompt('Please enter your Identity Provider URL', 'http://localhost:3000');
|
|
2963
2970
|
|
|
2964
|
-
const store = createStore({
|
|
2971
|
+
const store = createStore$1({
|
|
2965
2972
|
getIdpUrl,
|
|
2966
2973
|
isLoggedIn: false,
|
|
2967
2974
|
webId: '',
|
|
@@ -41243,6 +41250,190 @@ const PosRichLink = class {
|
|
|
41243
41250
|
}
|
|
41244
41251
|
};
|
|
41245
41252
|
|
|
41253
|
+
const appendToMap = (map, propName, value) => {
|
|
41254
|
+
const items = map.get(propName);
|
|
41255
|
+
if (!items) {
|
|
41256
|
+
map.set(propName, [value]);
|
|
41257
|
+
}
|
|
41258
|
+
else if (!items.includes(value)) {
|
|
41259
|
+
items.push(value);
|
|
41260
|
+
}
|
|
41261
|
+
};
|
|
41262
|
+
const debounce = (fn, ms) => {
|
|
41263
|
+
let timeoutId;
|
|
41264
|
+
return (...args) => {
|
|
41265
|
+
if (timeoutId) {
|
|
41266
|
+
clearTimeout(timeoutId);
|
|
41267
|
+
}
|
|
41268
|
+
timeoutId = setTimeout(() => {
|
|
41269
|
+
timeoutId = 0;
|
|
41270
|
+
fn(...args);
|
|
41271
|
+
}, ms);
|
|
41272
|
+
};
|
|
41273
|
+
};
|
|
41274
|
+
|
|
41275
|
+
/**
|
|
41276
|
+
* Check if a possible element isConnected.
|
|
41277
|
+
* The property might not be there, so we check for it.
|
|
41278
|
+
*
|
|
41279
|
+
* We want it to return true if isConnected is not a property,
|
|
41280
|
+
* otherwise we would remove these elements and would not update.
|
|
41281
|
+
*
|
|
41282
|
+
* Better leak in Edge than to be useless.
|
|
41283
|
+
*/
|
|
41284
|
+
const isConnected = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;
|
|
41285
|
+
const cleanupElements = debounce((map) => {
|
|
41286
|
+
for (let key of map.keys()) {
|
|
41287
|
+
map.set(key, map.get(key).filter(isConnected));
|
|
41288
|
+
}
|
|
41289
|
+
}, 2000);
|
|
41290
|
+
const stencilSubscription = () => {
|
|
41291
|
+
if (typeof getRenderingRef !== 'function') {
|
|
41292
|
+
// If we are not in a stencil project, we do nothing.
|
|
41293
|
+
// This function is not really exported by @stencil/core.
|
|
41294
|
+
return {};
|
|
41295
|
+
}
|
|
41296
|
+
const elmsToUpdate = new Map();
|
|
41297
|
+
return {
|
|
41298
|
+
dispose: () => elmsToUpdate.clear(),
|
|
41299
|
+
get: (propName) => {
|
|
41300
|
+
const elm = getRenderingRef();
|
|
41301
|
+
if (elm) {
|
|
41302
|
+
appendToMap(elmsToUpdate, propName, elm);
|
|
41303
|
+
}
|
|
41304
|
+
},
|
|
41305
|
+
set: (propName) => {
|
|
41306
|
+
const elements = elmsToUpdate.get(propName);
|
|
41307
|
+
if (elements) {
|
|
41308
|
+
elmsToUpdate.set(propName, elements.filter(forceUpdate));
|
|
41309
|
+
}
|
|
41310
|
+
cleanupElements(elmsToUpdate);
|
|
41311
|
+
},
|
|
41312
|
+
reset: () => {
|
|
41313
|
+
elmsToUpdate.forEach((elms) => elms.forEach(forceUpdate));
|
|
41314
|
+
cleanupElements(elmsToUpdate);
|
|
41315
|
+
},
|
|
41316
|
+
};
|
|
41317
|
+
};
|
|
41318
|
+
|
|
41319
|
+
const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) => {
|
|
41320
|
+
let states = new Map(Object.entries(defaultState !== null && defaultState !== void 0 ? defaultState : {}));
|
|
41321
|
+
const handlers = {
|
|
41322
|
+
dispose: [],
|
|
41323
|
+
get: [],
|
|
41324
|
+
set: [],
|
|
41325
|
+
reset: [],
|
|
41326
|
+
};
|
|
41327
|
+
const reset = () => {
|
|
41328
|
+
states = new Map(Object.entries(defaultState !== null && defaultState !== void 0 ? defaultState : {}));
|
|
41329
|
+
handlers.reset.forEach((cb) => cb());
|
|
41330
|
+
};
|
|
41331
|
+
const dispose = () => {
|
|
41332
|
+
// Call first dispose as resetting the state would
|
|
41333
|
+
// cause less updates ;)
|
|
41334
|
+
handlers.dispose.forEach((cb) => cb());
|
|
41335
|
+
reset();
|
|
41336
|
+
};
|
|
41337
|
+
const get = (propName) => {
|
|
41338
|
+
handlers.get.forEach((cb) => cb(propName));
|
|
41339
|
+
return states.get(propName);
|
|
41340
|
+
};
|
|
41341
|
+
const set = (propName, value) => {
|
|
41342
|
+
const oldValue = states.get(propName);
|
|
41343
|
+
if (shouldUpdate(value, oldValue, propName)) {
|
|
41344
|
+
states.set(propName, value);
|
|
41345
|
+
handlers.set.forEach((cb) => cb(propName, value, oldValue));
|
|
41346
|
+
}
|
|
41347
|
+
};
|
|
41348
|
+
const state = (typeof Proxy === 'undefined'
|
|
41349
|
+
? {}
|
|
41350
|
+
: new Proxy(defaultState, {
|
|
41351
|
+
get(_, propName) {
|
|
41352
|
+
return get(propName);
|
|
41353
|
+
},
|
|
41354
|
+
ownKeys(_) {
|
|
41355
|
+
return Array.from(states.keys());
|
|
41356
|
+
},
|
|
41357
|
+
getOwnPropertyDescriptor() {
|
|
41358
|
+
return {
|
|
41359
|
+
enumerable: true,
|
|
41360
|
+
configurable: true,
|
|
41361
|
+
};
|
|
41362
|
+
},
|
|
41363
|
+
has(_, propName) {
|
|
41364
|
+
return states.has(propName);
|
|
41365
|
+
},
|
|
41366
|
+
set(_, propName, value) {
|
|
41367
|
+
set(propName, value);
|
|
41368
|
+
return true;
|
|
41369
|
+
},
|
|
41370
|
+
}));
|
|
41371
|
+
const on = (eventName, callback) => {
|
|
41372
|
+
handlers[eventName].push(callback);
|
|
41373
|
+
return () => {
|
|
41374
|
+
removeFromArray(handlers[eventName], callback);
|
|
41375
|
+
};
|
|
41376
|
+
};
|
|
41377
|
+
const onChange = (propName, cb) => {
|
|
41378
|
+
const unSet = on('set', (key, newValue) => {
|
|
41379
|
+
if (key === propName) {
|
|
41380
|
+
cb(newValue);
|
|
41381
|
+
}
|
|
41382
|
+
});
|
|
41383
|
+
const unReset = on('reset', () => cb(defaultState[propName]));
|
|
41384
|
+
return () => {
|
|
41385
|
+
unSet();
|
|
41386
|
+
unReset();
|
|
41387
|
+
};
|
|
41388
|
+
};
|
|
41389
|
+
const use = (...subscriptions) => {
|
|
41390
|
+
const unsubs = subscriptions.reduce((unsubs, subscription) => {
|
|
41391
|
+
if (subscription.set) {
|
|
41392
|
+
unsubs.push(on('set', subscription.set));
|
|
41393
|
+
}
|
|
41394
|
+
if (subscription.get) {
|
|
41395
|
+
unsubs.push(on('get', subscription.get));
|
|
41396
|
+
}
|
|
41397
|
+
if (subscription.reset) {
|
|
41398
|
+
unsubs.push(on('reset', subscription.reset));
|
|
41399
|
+
}
|
|
41400
|
+
if (subscription.dispose) {
|
|
41401
|
+
unsubs.push(on('dispose', subscription.dispose));
|
|
41402
|
+
}
|
|
41403
|
+
return unsubs;
|
|
41404
|
+
}, []);
|
|
41405
|
+
return () => unsubs.forEach((unsub) => unsub());
|
|
41406
|
+
};
|
|
41407
|
+
const forceUpdate = (key) => {
|
|
41408
|
+
const oldValue = states.get(key);
|
|
41409
|
+
handlers.set.forEach((cb) => cb(key, oldValue, oldValue));
|
|
41410
|
+
};
|
|
41411
|
+
return {
|
|
41412
|
+
state,
|
|
41413
|
+
get,
|
|
41414
|
+
set,
|
|
41415
|
+
on,
|
|
41416
|
+
onChange,
|
|
41417
|
+
use,
|
|
41418
|
+
dispose,
|
|
41419
|
+
reset,
|
|
41420
|
+
forceUpdate,
|
|
41421
|
+
};
|
|
41422
|
+
};
|
|
41423
|
+
const removeFromArray = (array, item) => {
|
|
41424
|
+
const index = array.indexOf(item);
|
|
41425
|
+
if (index >= 0) {
|
|
41426
|
+
array[index] = array[array.length - 1];
|
|
41427
|
+
array.length--;
|
|
41428
|
+
}
|
|
41429
|
+
};
|
|
41430
|
+
|
|
41431
|
+
const createStore = (defaultState, shouldUpdate) => {
|
|
41432
|
+
const map = createObservableMap(defaultState, shouldUpdate);
|
|
41433
|
+
map.use(stencilSubscription());
|
|
41434
|
+
return map;
|
|
41435
|
+
};
|
|
41436
|
+
|
|
41246
41437
|
const createRouter = (opts) => {
|
|
41247
41438
|
var _a;
|
|
41248
41439
|
const win = window;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pod-os/elements",
|
|
3
|
-
"version": "0.7.1-
|
|
3
|
+
"version": "0.7.1-8b34d0b.0",
|
|
4
4
|
"description": "Stencil Component Starter",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/custom-elements/index.js",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@ionic/core": "^6.3.9",
|
|
25
25
|
"@pod-os/core": "^0.6.0",
|
|
26
26
|
"@stencil/core": "^2.19.3",
|
|
27
|
-
"@stencil/store": "^
|
|
27
|
+
"@stencil/store": "^2.0.1",
|
|
28
28
|
"jest-when": "^3.5.2",
|
|
29
29
|
"stencil-router-v2": "^0.6.0"
|
|
30
30
|
},
|