@lmvz-ds/components 0.13.0 → 0.13.2
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/{esm/assets-ozES4zSA.js → cjs/Effect-CpZhfb0D.js} +5538 -1194
- package/dist/cjs/aria-loader-BhgXpCuo.js +77 -0
- package/dist/cjs/assets-BnJmIx_h.js +26 -0
- package/dist/cjs/{icons-DM_TTn48.js → icons-Brr4vqiE.js} +165 -369
- package/dist/cjs/{index-D3BMpL5w.js → index-9ZJx0550.js} +3 -0
- package/dist/cjs/index-BVxGxK9i.js +35629 -0
- package/dist/cjs/index.cjs.js +12 -4
- package/dist/cjs/lmvz-action.cjs.entry.js +1 -1
- package/dist/cjs/lmvz-button.cjs.entry.js +6 -3
- package/dist/cjs/lmvz-card.cjs.entry.js +4 -4
- package/dist/cjs/lmvz-chip.cjs.entry.js +1 -1
- package/dist/cjs/lmvz-components.cjs.js +1 -1
- package/dist/cjs/lmvz-header.cjs.entry.js +8 -5
- package/dist/cjs/lmvz-icon.cjs.entry.js +20 -9
- package/dist/cjs/lmvz-input.cjs.entry.js +8 -5
- package/dist/cjs/lmvz-menuitem.cjs.entry.js +7 -4
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{reactive-controller-host-BMDEj1kX.js → reactive-controller-host-t3uLq_s2.js} +71 -50
- package/dist/collection/components/lmvz-button/lmvz-button.js +3 -1
- package/dist/collection/components/lmvz-card/lmvz-card.js +3 -4
- package/dist/collection/components/lmvz-header/lmvz-header.js +5 -3
- package/dist/collection/components/lmvz-icon/icons.js +2 -2
- package/dist/collection/components/lmvz-icon/lmvz-icon.js +14 -5
- package/dist/collection/components/lmvz-input/lmvz-input.js +5 -3
- package/dist/collection/components/lmvz-menuitem/lmvz-menuitem.js +4 -2
- package/dist/collection/index.js +1 -0
- package/dist/collection/integration/header-integration.js +1 -3
- package/dist/collection/utils/aria/aria-validation-controller.js +68 -27
- package/dist/collection/utils/assets.js +9 -6
- package/dist/collection/utils/http.js +2 -2
- package/dist/collection/utils/http.unit.js +1 -1
- package/dist/collection/utils/validation/svg.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/lmvz-action.js +1 -1
- package/dist/components/lmvz-button.js +1 -1
- package/dist/components/lmvz-card.js +1 -1
- package/dist/components/lmvz-chip.js +1 -1
- package/dist/components/lmvz-header.js +1 -1
- package/dist/components/lmvz-icon.js +1 -1
- package/dist/components/lmvz-input.js +1 -1
- package/dist/components/lmvz-menuitem.js +1 -1
- package/dist/components/p-B68hOTYN.js +12 -0
- package/dist/components/p-BaPwpeMs.js +1 -0
- package/dist/components/p-CSRpdnrt.js +1 -0
- package/dist/components/p-DFXwtZsD.js +1 -0
- package/dist/components/p-DcMNH3fv.js +1 -0
- package/dist/components/p-dQa_lGo8.js +1 -0
- package/dist/{cjs/assets-CB5ikzmP.js → esm/Effect-DyamyJqO.js} +5329 -1266
- package/dist/esm/aria-loader-BQXogs4-.js +70 -0
- package/dist/esm/assets-CvV1KMMV.js +23 -0
- package/dist/esm/{icons-kpJZ1u9g.js → icons-C69Um2xB.js} +69 -273
- package/dist/esm/index-BRxn9h5l.js +35626 -0
- package/dist/esm/{index-T5ljELGS.js → index-smGPjoDX.js} +3 -1
- package/dist/esm/index.js +5 -3
- package/dist/esm/lmvz-action.entry.js +1 -1
- package/dist/esm/lmvz-button.entry.js +6 -3
- package/dist/esm/lmvz-card.entry.js +4 -4
- package/dist/esm/lmvz-chip.entry.js +1 -1
- package/dist/esm/lmvz-components.js +2 -2
- package/dist/esm/lmvz-header.entry.js +8 -5
- package/dist/esm/lmvz-icon.entry.js +20 -9
- package/dist/esm/lmvz-input.entry.js +8 -5
- package/dist/esm/lmvz-menuitem.entry.js +7 -4
- package/dist/esm/loader.js +2 -2
- package/dist/esm/{reactive-controller-host-CZ3dGAjR.js → reactive-controller-host-puHvKP9Y.js} +65 -44
- package/dist/lmvz-components/index.esm.js +1 -1
- package/dist/lmvz-components/lmvz-components.esm.js +1 -1
- package/dist/lmvz-components/p-0e5aa1a3.entry.js +1 -0
- package/dist/lmvz-components/p-0f930140.entry.js +1 -0
- package/dist/lmvz-components/p-2df3646d.entry.js +1 -0
- package/dist/lmvz-components/p-470f6f56.entry.js +1 -0
- package/dist/lmvz-components/p-67af4826.entry.js +1 -0
- package/dist/lmvz-components/p-775b737d.entry.js +1 -0
- package/dist/lmvz-components/{p-feda2ec5.entry.js → p-9faac8f3.entry.js} +1 -1
- package/dist/lmvz-components/p-BEoSvNlI.js +1 -0
- package/dist/lmvz-components/p-D7GrtdQF.js +1 -0
- package/dist/lmvz-components/p-DJp2UHon.js +12 -0
- package/dist/lmvz-components/p-DWVncv6N.js +1 -0
- package/dist/lmvz-components/p-DyamyJqO.js +1 -0
- package/dist/lmvz-components/{p-980688a0.entry.js → p-d4b68381.entry.js} +1 -1
- package/dist/lmvz-components/p-qPGwETYT.js +1 -0
- package/dist/lmvz-components/p-smGPjoDX.js +2 -0
- package/dist/manifest.json +1 -1
- package/dist/types/components/lmvz-button/lmvz-button.d.ts +1 -0
- package/dist/types/components/lmvz-header/lmvz-header.d.ts +1 -0
- package/dist/types/components/lmvz-icon/lmvz-icon.d.ts +3 -0
- package/dist/types/components/lmvz-input/lmvz-input.d.ts +2 -1
- package/dist/types/components/lmvz-menuitem/lmvz-menuitem.d.ts +3 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/utils/aria/aria-validation-controller.d.ts +8 -2
- package/dist/types/utils/assets.d.ts +1 -8
- package/dist/types/utils/http.d.ts +3 -3
- package/dist/types/utils/validation/svg.d.ts +2 -2
- package/hydrate/index.js +2225 -12448
- package/hydrate/index.mjs +2225 -12448
- package/package.json +6 -8
- package/dist/components/p-BBDH9X49.js +0 -1
- package/dist/components/p-Bs6_m7Uw.js +0 -1
- package/dist/components/p-CMteT-Yo.js +0 -1
- package/dist/components/p-vi4YzJmv.js +0 -1
- package/dist/lmvz-components/p-16878d4c.entry.js +0 -1
- package/dist/lmvz-components/p-4ad8c332.entry.js +0 -1
- package/dist/lmvz-components/p-5eee0752.entry.js +0 -1
- package/dist/lmvz-components/p-8ea1a349.entry.js +0 -1
- package/dist/lmvz-components/p-CZ3dGAjR.js +0 -1
- package/dist/lmvz-components/p-D9lc4ayG.js +0 -1
- package/dist/lmvz-components/p-T5ljELGS.js +0 -2
- package/dist/lmvz-components/p-a34542fa.entry.js +0 -1
- package/dist/lmvz-components/p-d2bf6a3f.entry.js +0 -1
- package/dist/lmvz-components/p-iviTjlUy.js +0 -1
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
const GLOBAL_STATE_KEY = Symbol('__lmvzAriaValidationRuntimeState');
|
|
2
|
+
const ARIA_VALIDATION_RUNTIME_CHANGED_EVENT = 'lmvz:aria-validation-runtime-changed';
|
|
3
|
+
const getRuntimeState = () => {
|
|
4
|
+
const globalState = globalThis;
|
|
5
|
+
if (!globalState[GLOBAL_STATE_KEY]) {
|
|
6
|
+
globalState[GLOBAL_STATE_KEY] = {
|
|
7
|
+
enabled: false,
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
return globalState[GLOBAL_STATE_KEY];
|
|
11
|
+
};
|
|
12
|
+
const notifyRuntimeChange = () => {
|
|
13
|
+
if (typeof window === 'undefined')
|
|
14
|
+
return;
|
|
15
|
+
window.dispatchEvent(new CustomEvent(ARIA_VALIDATION_RUNTIME_CHANGED_EVENT));
|
|
16
|
+
};
|
|
17
|
+
const isAriaValidationEnabled = () => getRuntimeState().enabled;
|
|
18
|
+
const useVerboseLogging = () => getRuntimeState().verboseLogging ?? false;
|
|
19
|
+
const fetchRuntime = async () => {
|
|
20
|
+
const state = getRuntimeState();
|
|
21
|
+
if (!state.enabled)
|
|
22
|
+
return null;
|
|
23
|
+
if (state.runtime)
|
|
24
|
+
return state.runtime;
|
|
25
|
+
if (!state.loadPromise) {
|
|
26
|
+
state.loadPromise = import('./index-BRxn9h5l.js').catch(() => null);
|
|
27
|
+
}
|
|
28
|
+
const runtime = await state.loadPromise;
|
|
29
|
+
if (runtime) {
|
|
30
|
+
state.runtime = runtime;
|
|
31
|
+
}
|
|
32
|
+
return runtime;
|
|
33
|
+
};
|
|
34
|
+
const enableAriaValidation = (options = {}) => {
|
|
35
|
+
const state = getRuntimeState();
|
|
36
|
+
if (state.enabled)
|
|
37
|
+
return;
|
|
38
|
+
Object.assign(state, options);
|
|
39
|
+
state.enabled = true;
|
|
40
|
+
initializeValidation().then(() => {
|
|
41
|
+
notifyRuntimeChange();
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
const disableAriaValidation = () => {
|
|
45
|
+
const state = getRuntimeState();
|
|
46
|
+
if (!state.enabled)
|
|
47
|
+
return;
|
|
48
|
+
state.enabled = false;
|
|
49
|
+
notifyRuntimeChange();
|
|
50
|
+
};
|
|
51
|
+
function initializeValidation(...args) {
|
|
52
|
+
return fetchRuntime().then((runtime) => {
|
|
53
|
+
const s = getRuntimeState();
|
|
54
|
+
if (!s.enabled)
|
|
55
|
+
return;
|
|
56
|
+
if (!runtime) {
|
|
57
|
+
console.warn('Failed to load aria validation runtime');
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
runtime.initializeValidationStream(...args);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
function queueValidation(...args) {
|
|
64
|
+
const state = getRuntimeState();
|
|
65
|
+
if (!state.enabled || !state.runtime)
|
|
66
|
+
return;
|
|
67
|
+
state.runtime.enqueueValidation(...args);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export { ARIA_VALIDATION_RUNTIME_CHANGED_EVENT as A, disableAriaValidation as d, enableAriaValidation as e, isAriaValidationEnabled as i, queueValidation as q, useVerboseLogging as u };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { a as getAssetPath } from './index-smGPjoDX.js';
|
|
2
|
+
|
|
3
|
+
function getLocationBase() {
|
|
4
|
+
return import.meta?.url ?? window?.location?.origin ?? '';
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
const relativeAssetsPath = '../../assets';
|
|
8
|
+
const createAssetUrlSafely = (file, pathFromAssetRoot) => {
|
|
9
|
+
const relativeAssetPath = joinPath(relativeAssetsPath, pathFromAssetRoot, file);
|
|
10
|
+
try {
|
|
11
|
+
return getAssetPath(relativeAssetPath);
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
console.warn(`Failed to create URL for asset "${file}" in path "${pathFromAssetRoot}".
|
|
15
|
+
Please provide an absolute URL in your app's 'setAssetPath(...)' configuration! Falling back to a relative URL, which may work in some environments but is not guaranteed to be correct.`);
|
|
16
|
+
return new URL(relativeAssetPath, getLocationBase());
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
function joinPath(...parts) {
|
|
20
|
+
return parts.filter(Boolean).join('/').replace('//', '/').replace('/./', '/');
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { createAssetUrlSafely as c };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { g as getOrThrowWith,
|
|
1
|
+
import { g as getOrThrowWith, a as right, b as left, i as identity, d as isRight, e as getRight, m as match, f as decode, h as map, j as all, k as merge, n as sync, o as suspend, p as get, q as succeed, u as none, v as getOrUndefined, w as unsafeMake, x as has, y as set, z as struct, A as flatMap, B as clockWith, C as offer, D as compareAndSet, E as poll, F as EmptyMutableQueue, G as remove, H as set$1, I as size, J as isSome, K as some, L as empty, M as make$2, N as unbounded, O as symbol, P as pipe, Q as cached, R as combine, S as hash, T as symbol$1, U as hasProperty, V as equals, W as asVoid, _ as _await, X as when, Y as succeed$1, Z as toMillis, $ as onInterrupt, a0 as zipRight, a1 as interrupt, a2 as done, a3 as exit, a4 as provideContext, a5 as context, a6 as fiberId, a7 as YieldableError, a8 as gen, a9 as tryPromise, aa as fail, ab as try_, ac as gen$1, ad as infinity, ae as logWarning } from './Effect-DyamyJqO.js';
|
|
2
|
+
import { c as createAssetUrlSafely } from './assets-CvV1KMMV.js';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* This module provides types and utility functions to create and work with branded types,
|
|
@@ -48,258 +49,6 @@ function refined(...args) {
|
|
|
48
49
|
});
|
|
49
50
|
}
|
|
50
51
|
|
|
51
|
-
const _await = deferredAwait;
|
|
52
|
-
/**
|
|
53
|
-
* Exits the `Deferred` with the specified `Exit` value, which will be
|
|
54
|
-
* propagated to all fibers waiting on the value of the `Deferred`.
|
|
55
|
-
*
|
|
56
|
-
* @since 2.0.0
|
|
57
|
-
* @category utils
|
|
58
|
-
*/
|
|
59
|
-
const done = deferredDone;
|
|
60
|
-
/**
|
|
61
|
-
* Completes the `Deferred` with interruption. This will interrupt all fibers
|
|
62
|
-
* waiting on the value of the `Deferred` with the `FiberId` of the fiber
|
|
63
|
-
* calling this method.
|
|
64
|
-
*
|
|
65
|
-
* @since 2.0.0
|
|
66
|
-
* @category utils
|
|
67
|
-
*/
|
|
68
|
-
const interrupt = deferredInterrupt;
|
|
69
|
-
/**
|
|
70
|
-
* Unsafely creates a new `Deferred` from the specified `FiberId`.
|
|
71
|
-
*
|
|
72
|
-
* @since 2.0.0
|
|
73
|
-
* @category unsafe
|
|
74
|
-
*/
|
|
75
|
-
const unsafeMake = deferredUnsafeMake;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Constructs a new `Exit.Success` containing the specified value of type `A`.
|
|
79
|
-
*
|
|
80
|
-
* @since 2.0.0
|
|
81
|
-
* @category constructors
|
|
82
|
-
*/
|
|
83
|
-
const succeed = exitSucceed;
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* @since 2.0.0
|
|
87
|
-
*/
|
|
88
|
-
const TypeId$1 = /*#__PURE__*/Symbol.for("effect/MutableList");
|
|
89
|
-
const MutableListProto = {
|
|
90
|
-
[TypeId$1]: TypeId$1,
|
|
91
|
-
[Symbol.iterator]() {
|
|
92
|
-
let done = false;
|
|
93
|
-
let head = this.head;
|
|
94
|
-
return {
|
|
95
|
-
next() {
|
|
96
|
-
if (done) {
|
|
97
|
-
return this.return();
|
|
98
|
-
}
|
|
99
|
-
if (head == null) {
|
|
100
|
-
done = true;
|
|
101
|
-
return this.return();
|
|
102
|
-
}
|
|
103
|
-
const value = head.value;
|
|
104
|
-
head = head.next;
|
|
105
|
-
return {
|
|
106
|
-
done,
|
|
107
|
-
value
|
|
108
|
-
};
|
|
109
|
-
},
|
|
110
|
-
return(value) {
|
|
111
|
-
if (!done) {
|
|
112
|
-
done = true;
|
|
113
|
-
}
|
|
114
|
-
return {
|
|
115
|
-
done: true,
|
|
116
|
-
value
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
},
|
|
121
|
-
toString() {
|
|
122
|
-
return format(this.toJSON());
|
|
123
|
-
},
|
|
124
|
-
toJSON() {
|
|
125
|
-
return {
|
|
126
|
-
_id: "MutableList",
|
|
127
|
-
values: Array.from(this).map(toJSON)
|
|
128
|
-
};
|
|
129
|
-
},
|
|
130
|
-
[NodeInspectSymbol]() {
|
|
131
|
-
return this.toJSON();
|
|
132
|
-
},
|
|
133
|
-
pipe() {
|
|
134
|
-
return pipeArguments(this, arguments);
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
/** @internal */
|
|
138
|
-
const makeNode = value => ({
|
|
139
|
-
value,
|
|
140
|
-
removed: false,
|
|
141
|
-
prev: undefined,
|
|
142
|
-
next: undefined
|
|
143
|
-
});
|
|
144
|
-
/**
|
|
145
|
-
* Creates an empty `MutableList`.
|
|
146
|
-
*
|
|
147
|
-
* @since 2.0.0
|
|
148
|
-
* @category constructors
|
|
149
|
-
*/
|
|
150
|
-
const empty = () => {
|
|
151
|
-
const list = Object.create(MutableListProto);
|
|
152
|
-
list.head = undefined;
|
|
153
|
-
list.tail = undefined;
|
|
154
|
-
list._length = 0;
|
|
155
|
-
return list;
|
|
156
|
-
};
|
|
157
|
-
/**
|
|
158
|
-
* Returns `true` if the list contains zero elements, `false`, otherwise.
|
|
159
|
-
*
|
|
160
|
-
* @since 2.0.0
|
|
161
|
-
* @category getters
|
|
162
|
-
*/
|
|
163
|
-
const isEmpty = self => length(self) === 0;
|
|
164
|
-
/**
|
|
165
|
-
* Returns the length of the list.
|
|
166
|
-
*
|
|
167
|
-
* @since 2.0.0
|
|
168
|
-
* @category getters
|
|
169
|
-
*/
|
|
170
|
-
const length = self => self._length;
|
|
171
|
-
/**
|
|
172
|
-
* Appends the specified element to the end of the `MutableList`.
|
|
173
|
-
*
|
|
174
|
-
* @category concatenating
|
|
175
|
-
* @since 2.0.0
|
|
176
|
-
*/
|
|
177
|
-
const append = /*#__PURE__*/dual(2, (self, value) => {
|
|
178
|
-
const node = makeNode(value);
|
|
179
|
-
if (self.head === undefined) {
|
|
180
|
-
self.head = node;
|
|
181
|
-
}
|
|
182
|
-
if (self.tail === undefined) {
|
|
183
|
-
self.tail = node;
|
|
184
|
-
} else {
|
|
185
|
-
self.tail.next = node;
|
|
186
|
-
node.prev = self.tail;
|
|
187
|
-
self.tail = node;
|
|
188
|
-
}
|
|
189
|
-
self._length += 1;
|
|
190
|
-
return self;
|
|
191
|
-
});
|
|
192
|
-
/**
|
|
193
|
-
* Removes the first value from the list and returns it, if it exists.
|
|
194
|
-
*
|
|
195
|
-
* @since 0.0.1
|
|
196
|
-
*/
|
|
197
|
-
const shift = self => {
|
|
198
|
-
const head = self.head;
|
|
199
|
-
if (head !== undefined) {
|
|
200
|
-
remove(self, head);
|
|
201
|
-
return head.value;
|
|
202
|
-
}
|
|
203
|
-
return undefined;
|
|
204
|
-
};
|
|
205
|
-
const remove = (self, node) => {
|
|
206
|
-
if (node.removed) {
|
|
207
|
-
return;
|
|
208
|
-
}
|
|
209
|
-
node.removed = true;
|
|
210
|
-
if (node.prev !== undefined && node.next !== undefined) {
|
|
211
|
-
node.prev.next = node.next;
|
|
212
|
-
node.next.prev = node.prev;
|
|
213
|
-
} else if (node.prev !== undefined) {
|
|
214
|
-
self.tail = node.prev;
|
|
215
|
-
node.prev.next = undefined;
|
|
216
|
-
} else if (node.next !== undefined) {
|
|
217
|
-
self.head = node.next;
|
|
218
|
-
node.next.prev = undefined;
|
|
219
|
-
} else {
|
|
220
|
-
self.tail = undefined;
|
|
221
|
-
self.head = undefined;
|
|
222
|
-
}
|
|
223
|
-
if (self._length > 0) {
|
|
224
|
-
self._length -= 1;
|
|
225
|
-
}
|
|
226
|
-
};
|
|
227
|
-
|
|
228
|
-
/**
|
|
229
|
-
* @since 2.0.0
|
|
230
|
-
*/
|
|
231
|
-
const TypeId = /*#__PURE__*/Symbol.for("effect/MutableQueue");
|
|
232
|
-
/**
|
|
233
|
-
* @since 2.0.0
|
|
234
|
-
* @category symbol
|
|
235
|
-
*/
|
|
236
|
-
const EmptyMutableQueue = /*#__PURE__*/Symbol.for("effect/mutable/MutableQueue/Empty");
|
|
237
|
-
const MutableQueueProto = {
|
|
238
|
-
[TypeId]: TypeId,
|
|
239
|
-
[Symbol.iterator]() {
|
|
240
|
-
return Array.from(this.queue)[Symbol.iterator]();
|
|
241
|
-
},
|
|
242
|
-
toString() {
|
|
243
|
-
return format(this.toJSON());
|
|
244
|
-
},
|
|
245
|
-
toJSON() {
|
|
246
|
-
return {
|
|
247
|
-
_id: "MutableQueue",
|
|
248
|
-
values: Array.from(this).map(toJSON)
|
|
249
|
-
};
|
|
250
|
-
},
|
|
251
|
-
[NodeInspectSymbol]() {
|
|
252
|
-
return this.toJSON();
|
|
253
|
-
},
|
|
254
|
-
pipe() {
|
|
255
|
-
return pipeArguments(this, arguments);
|
|
256
|
-
}
|
|
257
|
-
};
|
|
258
|
-
const make$2 = capacity => {
|
|
259
|
-
const queue = Object.create(MutableQueueProto);
|
|
260
|
-
queue.queue = empty();
|
|
261
|
-
queue.capacity = capacity;
|
|
262
|
-
return queue;
|
|
263
|
-
};
|
|
264
|
-
/**
|
|
265
|
-
* Creates a new unbounded `MutableQueue`.
|
|
266
|
-
*
|
|
267
|
-
* @since 2.0.0
|
|
268
|
-
* @category constructors
|
|
269
|
-
*/
|
|
270
|
-
const unbounded = () => make$2(undefined);
|
|
271
|
-
/**
|
|
272
|
-
* Offers an element to the queue.
|
|
273
|
-
*
|
|
274
|
-
* Returns whether the enqueue was successful or not.
|
|
275
|
-
*
|
|
276
|
-
* @since 2.0.0
|
|
277
|
-
*/
|
|
278
|
-
const offer = /*#__PURE__*/dual(2, (self, value) => {
|
|
279
|
-
const queueLength = length(self.queue);
|
|
280
|
-
if (self.capacity !== undefined && queueLength === self.capacity) {
|
|
281
|
-
return false;
|
|
282
|
-
}
|
|
283
|
-
append(value)(self.queue);
|
|
284
|
-
return true;
|
|
285
|
-
});
|
|
286
|
-
/**
|
|
287
|
-
* Dequeues an element from the queue.
|
|
288
|
-
*
|
|
289
|
-
* Returns either an element from the queue, or the `def` param.
|
|
290
|
-
*
|
|
291
|
-
* **Note**: if there is no meaningful default for your type, you can always
|
|
292
|
-
* use `poll(MutableQueue.EmptyMutableQueue)`.
|
|
293
|
-
*
|
|
294
|
-
* @since 2.0.0
|
|
295
|
-
*/
|
|
296
|
-
const poll = /*#__PURE__*/dual(2, (self, def) => {
|
|
297
|
-
if (isEmpty(self.queue)) {
|
|
298
|
-
return def;
|
|
299
|
-
}
|
|
300
|
-
return shift(self.queue);
|
|
301
|
-
});
|
|
302
|
-
|
|
303
52
|
/** @internal */
|
|
304
53
|
const complete = (key, exit, entryStats, timeToLiveMillis) => struct({
|
|
305
54
|
_tag: "Complete",
|
|
@@ -407,7 +156,7 @@ const makeCacheState = (map, keys, accesses, updating, hits, misses) => ({
|
|
|
407
156
|
*
|
|
408
157
|
* @internal
|
|
409
158
|
*/
|
|
410
|
-
const initialCacheState = () => makeCacheState(empty
|
|
159
|
+
const initialCacheState = () => makeCacheState(empty(), makeKeySet(), unbounded(), make$2(false), 0, 0);
|
|
411
160
|
/** @internal */
|
|
412
161
|
const CacheSymbolKey = "effect/Cache";
|
|
413
162
|
/** @internal */
|
|
@@ -471,7 +220,7 @@ class CacheImpl {
|
|
|
471
220
|
const mapKey = makeMapKey(key);
|
|
472
221
|
this.trackAccess(mapKey);
|
|
473
222
|
this.trackMiss();
|
|
474
|
-
return succeed
|
|
223
|
+
return succeed(none());
|
|
475
224
|
},
|
|
476
225
|
onSome: value => this.resolveMapValue(value)
|
|
477
226
|
}));
|
|
@@ -482,7 +231,7 @@ class CacheImpl {
|
|
|
482
231
|
const mapKey = makeMapKey(key);
|
|
483
232
|
this.trackAccess(mapKey);
|
|
484
233
|
this.trackMiss();
|
|
485
|
-
return succeed
|
|
234
|
+
return succeed(none());
|
|
486
235
|
},
|
|
487
236
|
onSome: value => this.resolveMapValue(value, true)
|
|
488
237
|
}));
|
|
@@ -536,14 +285,14 @@ class CacheImpl {
|
|
|
536
285
|
} else {
|
|
537
286
|
return flatMap(this.resolveMapValue(value), match({
|
|
538
287
|
onNone: () => this.getEither(key),
|
|
539
|
-
onSome: value => succeed
|
|
288
|
+
onSome: value => succeed(left(value))
|
|
540
289
|
}));
|
|
541
290
|
}
|
|
542
291
|
});
|
|
543
292
|
}
|
|
544
293
|
invalidate(key) {
|
|
545
294
|
return sync(() => {
|
|
546
|
-
remove
|
|
295
|
+
remove(this.cacheState.map, key);
|
|
547
296
|
});
|
|
548
297
|
}
|
|
549
298
|
invalidateWhen(key, when) {
|
|
@@ -552,7 +301,7 @@ class CacheImpl {
|
|
|
552
301
|
if (isSome(value) && value.value._tag === "Complete") {
|
|
553
302
|
if (value.value.exit._tag === "Success") {
|
|
554
303
|
if (when(value.value.exit.value)) {
|
|
555
|
-
remove
|
|
304
|
+
remove(this.cacheState.map, key);
|
|
556
305
|
}
|
|
557
306
|
}
|
|
558
307
|
}
|
|
@@ -560,7 +309,7 @@ class CacheImpl {
|
|
|
560
309
|
}
|
|
561
310
|
get invalidateAll() {
|
|
562
311
|
return sync(() => {
|
|
563
|
-
this.cacheState.map = empty
|
|
312
|
+
this.cacheState.map = empty();
|
|
564
313
|
});
|
|
565
314
|
}
|
|
566
315
|
refresh(key) {
|
|
@@ -584,7 +333,7 @@ class CacheImpl {
|
|
|
584
333
|
if (this.hasExpired(clock, value.timeToLiveMillis)) {
|
|
585
334
|
const found = getOrUndefined(get(this.cacheState.map, k));
|
|
586
335
|
if (equals(found, value)) {
|
|
587
|
-
remove
|
|
336
|
+
remove(this.cacheState.map, k);
|
|
588
337
|
}
|
|
589
338
|
return asVoid(this.get(key));
|
|
590
339
|
}
|
|
@@ -615,7 +364,7 @@ class CacheImpl {
|
|
|
615
364
|
return clockWith(clock => sync(() => {
|
|
616
365
|
const now = clock.unsafeCurrentTimeMillis();
|
|
617
366
|
const k = key;
|
|
618
|
-
const lookupResult = succeed(value);
|
|
367
|
+
const lookupResult = succeed$1(value);
|
|
619
368
|
const mapValue = complete(makeMapKey(k), lookupResult, makeEntryStats(now), now + toMillis(decode(this.timeToLive(lookupResult))));
|
|
620
369
|
set(this.cacheState.map, k, mapValue);
|
|
621
370
|
}));
|
|
@@ -665,8 +414,8 @@ class CacheImpl {
|
|
|
665
414
|
{
|
|
666
415
|
this.trackAccess(value.key);
|
|
667
416
|
if (this.hasExpired(clock, value.timeToLiveMillis)) {
|
|
668
|
-
remove
|
|
669
|
-
return succeed
|
|
417
|
+
remove(this.cacheState.map, value.key.current);
|
|
418
|
+
return succeed(none());
|
|
670
419
|
}
|
|
671
420
|
this.trackHit();
|
|
672
421
|
return map(value.exit, some);
|
|
@@ -676,7 +425,7 @@ class CacheImpl {
|
|
|
676
425
|
this.trackAccess(value.key);
|
|
677
426
|
this.trackHit();
|
|
678
427
|
if (ignorePending) {
|
|
679
|
-
return succeed
|
|
428
|
+
return succeed(none());
|
|
680
429
|
}
|
|
681
430
|
return map(_await(value.deferred), some);
|
|
682
431
|
}
|
|
@@ -686,7 +435,7 @@ class CacheImpl {
|
|
|
686
435
|
this.trackHit();
|
|
687
436
|
if (this.hasExpired(clock, value.complete.timeToLiveMillis)) {
|
|
688
437
|
if (ignorePending) {
|
|
689
|
-
return succeed
|
|
438
|
+
return succeed(none());
|
|
690
439
|
}
|
|
691
440
|
return map(_await(value.deferred), some);
|
|
692
441
|
}
|
|
@@ -719,7 +468,7 @@ class CacheImpl {
|
|
|
719
468
|
const key = this.cacheState.keys.remove();
|
|
720
469
|
if (key !== undefined) {
|
|
721
470
|
if (has(this.cacheState.map, key.current)) {
|
|
722
|
-
remove
|
|
471
|
+
remove(this.cacheState.map, key.current);
|
|
723
472
|
size$1 = size$1 - 1;
|
|
724
473
|
loop = size$1 > this.capacity;
|
|
725
474
|
}
|
|
@@ -743,7 +492,7 @@ class CacheImpl {
|
|
|
743
492
|
set(this.cacheState.map, key, value);
|
|
744
493
|
return zipRight(done(deferred, exit), exit);
|
|
745
494
|
}), onInterrupt(() => zipRight(interrupt(deferred), sync(() => {
|
|
746
|
-
remove
|
|
495
|
+
remove(this.cacheState.map, key);
|
|
747
496
|
}))));
|
|
748
497
|
}));
|
|
749
498
|
}
|
|
@@ -769,6 +518,53 @@ const makeWith = options => map(all([context(), fiberId]), ([context, fiberId])
|
|
|
769
518
|
*/
|
|
770
519
|
const make = make$1;
|
|
771
520
|
|
|
521
|
+
/**
|
|
522
|
+
* Provides a constructor for a Case Class.
|
|
523
|
+
*
|
|
524
|
+
* @since 2.0.0
|
|
525
|
+
* @category constructors
|
|
526
|
+
*/
|
|
527
|
+
const Error$1 = /*#__PURE__*/function () {
|
|
528
|
+
const plainArgsSymbol = /*#__PURE__*/Symbol.for("effect/Data/Error/plainArgs");
|
|
529
|
+
const O = {
|
|
530
|
+
BaseEffectError: class extends YieldableError {
|
|
531
|
+
constructor(args) {
|
|
532
|
+
super(args?.message, args?.cause ? {
|
|
533
|
+
cause: args.cause
|
|
534
|
+
} : undefined);
|
|
535
|
+
if (args) {
|
|
536
|
+
Object.assign(this, args);
|
|
537
|
+
// @effect-diagnostics-next-line floatingEffect:off
|
|
538
|
+
Object.defineProperty(this, plainArgsSymbol, {
|
|
539
|
+
value: args,
|
|
540
|
+
enumerable: false
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
toJSON() {
|
|
545
|
+
return {
|
|
546
|
+
...this[plainArgsSymbol],
|
|
547
|
+
...this
|
|
548
|
+
};
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
};
|
|
552
|
+
return O.BaseEffectError;
|
|
553
|
+
}();
|
|
554
|
+
/**
|
|
555
|
+
* @since 2.0.0
|
|
556
|
+
* @category constructors
|
|
557
|
+
*/
|
|
558
|
+
const TaggedError = tag => {
|
|
559
|
+
const O = {
|
|
560
|
+
BaseEffectError: class extends Error$1 {
|
|
561
|
+
_tag = tag;
|
|
562
|
+
}
|
|
563
|
+
};
|
|
564
|
+
O.BaseEffectError.prototype.name = tag;
|
|
565
|
+
return O.BaseEffectError;
|
|
566
|
+
};
|
|
567
|
+
|
|
772
568
|
class FetchError extends TaggedError('FetchError') {
|
|
773
569
|
}
|
|
774
570
|
class NotFoundError extends TaggedError('NotFoundError') {
|
|
@@ -779,7 +575,7 @@ const httpClient = (input, init) => gen(function* () {
|
|
|
779
575
|
catch: error => new FetchError({ cause: error }),
|
|
780
576
|
});
|
|
781
577
|
if (response.status === 404) {
|
|
782
|
-
return yield* new NotFoundError({ url: response.url });
|
|
578
|
+
return yield* fail(new NotFoundError({ url: response.url }));
|
|
783
579
|
}
|
|
784
580
|
return response;
|
|
785
581
|
});
|
|
@@ -821,9 +617,9 @@ const emptyDefaultSvg = () => SVGString(`<svg width="24" height="24" viewBox="0
|
|
|
821
617
|
const createIconCache = () => make({
|
|
822
618
|
capacity: 200,
|
|
823
619
|
timeToLive: infinity,
|
|
824
|
-
lookup: (key) => gen(function* () {
|
|
620
|
+
lookup: (key) => gen$1(function* () {
|
|
825
621
|
const name = key;
|
|
826
|
-
const assetPath =
|
|
622
|
+
const assetPath = createAssetUrlSafely(`${name}.svg`, 'icons');
|
|
827
623
|
const res = yield* httpClient(assetPath);
|
|
828
624
|
const responseString = yield* responseAsText(res);
|
|
829
625
|
return yield* createValidSVGString(responseString);
|
|
@@ -832,7 +628,7 @@ const createIconCache = () => make({
|
|
|
832
628
|
let cacheInstance = null;
|
|
833
629
|
function fetchIconSvg(name) {
|
|
834
630
|
const key = name;
|
|
835
|
-
return gen(function* () {
|
|
631
|
+
return gen$1(function* () {
|
|
836
632
|
if (!cacheInstance) {
|
|
837
633
|
cacheInstance = yield* createIconCache();
|
|
838
634
|
}
|
|
@@ -840,7 +636,7 @@ function fetchIconSvg(name) {
|
|
|
840
636
|
});
|
|
841
637
|
}
|
|
842
638
|
function clearIconCache() {
|
|
843
|
-
return gen(function* () {
|
|
639
|
+
return gen$1(function* () {
|
|
844
640
|
if (cacheInstance) {
|
|
845
641
|
yield* cacheInstance.invalidateAll;
|
|
846
642
|
}
|