@e1011/es-kit 1.0.234 → 1.1.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/dist/hooks/esm/index.css +121 -47
- package/dist/hooks/index.css +121 -47
- package/dist/lib/cjs/_virtual/_rollupPluginBabelHelpers.js +1 -1
- package/dist/lib/cjs/index.css +74 -0
- package/dist/lib/cjs/node_modules/uuid/dist/esm-browser/native.js +2 -0
- package/dist/lib/cjs/node_modules/uuid/dist/esm-browser/native.js.map +1 -0
- package/dist/lib/cjs/node_modules/uuid/dist/esm-browser/rng.js +2 -0
- package/dist/lib/cjs/node_modules/uuid/dist/esm-browser/rng.js.map +1 -0
- package/dist/lib/cjs/node_modules/uuid/dist/esm-browser/stringify.js +2 -0
- package/dist/lib/cjs/node_modules/uuid/dist/esm-browser/stringify.js.map +1 -0
- package/dist/lib/cjs/node_modules/uuid/dist/esm-browser/v4.js +2 -0
- package/dist/lib/cjs/node_modules/uuid/dist/esm-browser/v4.js.map +1 -0
- package/dist/lib/cjs/src/core/ui/components/field/Field.js +1 -1
- package/dist/lib/cjs/src/core/ui/components/field/Field.js.map +1 -1
- package/dist/lib/cjs/src/core/ui/components/field/field.module.scss.js +2 -0
- package/dist/lib/cjs/src/core/ui/components/field/field.module.scss.js.map +1 -0
- package/dist/lib/cjs/src/core/utils/appState/peregrineMQ/index.js +2 -0
- package/dist/lib/cjs/src/core/utils/appState/peregrineMQ/index.js.map +1 -0
- package/dist/lib/cjs/src/core/utils/appState/peregrineMQ/peregrineMQ.js +2 -0
- package/dist/lib/cjs/src/core/utils/appState/peregrineMQ/peregrineMQ.js.map +1 -0
- package/dist/lib/cjs/src/core/utils/appState/stateMachine/tiny-state-machine.base.js +2 -0
- package/dist/lib/cjs/src/core/utils/appState/stateMachine/tiny-state-machine.base.js.map +1 -0
- package/dist/lib/cjs/src/core/utils/appState/store/store.vanillajs.js +1 -1
- package/dist/lib/cjs/src/core/utils/appState/store/store.vanillajs.js.map +1 -1
- package/dist/lib/cjs/src/core/utils/appState/store/useStore.react.js.map +1 -1
- package/dist/lib/cjs/src/core/utils/helpers/other.js +1 -1
- package/dist/lib/cjs/src/core/utils/helpers/other.js.map +1 -1
- package/dist/lib/cjs/src/index.js +1 -1
- package/dist/lib/esm/_virtual/_rollupPluginBabelHelpers.js +1 -1
- package/dist/lib/esm/index.css +74 -0
- package/dist/lib/esm/node_modules/uuid/dist/esm-browser/native.js +2 -0
- package/dist/lib/esm/node_modules/uuid/dist/esm-browser/native.js.map +1 -0
- package/dist/lib/esm/node_modules/uuid/dist/esm-browser/rng.js +2 -0
- package/dist/lib/esm/node_modules/uuid/dist/esm-browser/rng.js.map +1 -0
- package/dist/lib/esm/node_modules/uuid/dist/esm-browser/stringify.js +2 -0
- package/dist/lib/esm/node_modules/uuid/dist/esm-browser/stringify.js.map +1 -0
- package/dist/lib/esm/node_modules/uuid/dist/esm-browser/v4.js +2 -0
- package/dist/lib/esm/node_modules/uuid/dist/esm-browser/v4.js.map +1 -0
- package/dist/lib/esm/src/core/ui/components/field/Field.js +1 -1
- package/dist/lib/esm/src/core/ui/components/field/Field.js.map +1 -1
- package/dist/lib/esm/src/core/ui/components/field/field.module.scss.js +2 -0
- package/dist/lib/esm/src/core/ui/components/field/field.module.scss.js.map +1 -0
- package/dist/lib/esm/src/core/utils/appState/peregrineMQ/index.js +2 -0
- package/dist/lib/esm/src/core/utils/appState/peregrineMQ/index.js.map +1 -0
- package/dist/lib/esm/src/core/utils/appState/peregrineMQ/peregrineMQ.js +2 -0
- package/dist/lib/esm/src/core/utils/appState/peregrineMQ/peregrineMQ.js.map +1 -0
- package/dist/lib/esm/src/core/utils/appState/stateMachine/tiny-state-machine.base.js +2 -0
- package/dist/lib/esm/src/core/utils/appState/stateMachine/tiny-state-machine.base.js.map +1 -0
- package/dist/lib/esm/src/core/utils/appState/store/store.vanillajs.js +1 -1
- package/dist/lib/esm/src/core/utils/appState/store/store.vanillajs.js.map +1 -1
- package/dist/lib/esm/src/core/utils/appState/store/useStore.react.js.map +1 -1
- package/dist/lib/esm/src/core/utils/helpers/other.js +1 -1
- package/dist/lib/esm/src/core/utils/helpers/other.js.map +1 -1
- package/dist/lib/esm/src/index.js +1 -1
- package/dist/lib/tsconfig.tsbuildinfo +1 -1
- package/dist/types/src/core/ui/components/container/index.d.ts +0 -2
- package/dist/types/src/core/ui/components/container/index.d.ts.map +1 -1
- package/dist/types/src/core/ui/components/field/Field.d.ts +2 -3
- package/dist/types/src/core/ui/components/field/Field.d.ts.map +1 -1
- package/dist/types/src/core/utils/appState/peregrineMQ/index.d.ts +2 -1
- package/dist/types/src/core/utils/appState/peregrineMQ/index.d.ts.map +1 -1
- package/dist/types/src/core/utils/appState/peregrineMQ/peregrineMQ.d.ts +8 -8
- package/dist/types/src/core/utils/appState/peregrineMQ/peregrineMQ.d.ts.map +1 -1
- package/dist/types/src/core/utils/appState/peregrineMQ/peregrineMQ.stories.d.ts +4 -0
- package/dist/types/src/core/utils/appState/peregrineMQ/peregrineMQ.stories.d.ts.map +1 -0
- package/dist/types/src/core/utils/appState/peregrineMQ/peregrineMQ.types.d.ts +38 -45
- package/dist/types/src/core/utils/appState/peregrineMQ/peregrineMQ.types.d.ts.map +1 -1
- package/dist/types/src/core/utils/appState/peregrineMQ/usePeregrineMQ.react.d.ts +10 -0
- package/dist/types/src/core/utils/appState/peregrineMQ/usePeregrineMQ.react.d.ts.map +1 -0
- package/dist/types/src/core/utils/appState/stateMachine/index.d.ts +2 -0
- package/dist/types/src/core/utils/appState/stateMachine/index.d.ts.map +1 -0
- package/dist/types/src/core/utils/appState/stateMachine/tiny-state-machine.base.d.ts +7 -7
- package/dist/types/src/core/utils/appState/stateMachine/tiny-state-machine.base.d.ts.map +1 -1
- package/dist/types/src/core/utils/appState/store/asyncFunc.spec.d.ts +2 -0
- package/dist/types/src/core/utils/appState/store/asyncFunc.spec.d.ts.map +1 -0
- package/dist/types/src/core/utils/appState/store/store.stories.d.ts +4 -0
- package/dist/types/src/core/utils/appState/store/store.stories.d.ts.map +1 -0
- package/dist/types/src/core/utils/appState/store/store.vanillajs.d.ts.map +1 -1
- package/dist/types/src/core/utils/helpers/other.d.ts +2 -0
- package/dist/types/src/core/utils/helpers/other.d.ts.map +1 -1
- package/dist/types/src/core/utils/index.d.ts +2 -0
- package/dist/types/src/core/utils/index.d.ts.map +1 -1
- package/dist/ui/esm/index.css +74 -0
- package/dist/ui/esm/src/core/ui/components/field/Field.js +1 -1
- package/dist/ui/esm/src/core/ui/components/field/Field.js.map +1 -1
- package/dist/ui/esm/src/core/ui/components/field/field.module.scss.js +2 -0
- package/dist/ui/esm/src/core/ui/components/field/field.module.scss.js.map +1 -0
- package/dist/ui/esm/src/core/ui/index.js +1 -1
- package/dist/ui/index.css +74 -0
- package/dist/ui/src/core/ui/components/field/Field.js +1 -1
- package/dist/ui/src/core/ui/components/field/Field.js.map +1 -1
- package/dist/ui/src/core/ui/components/field/field.module.scss.js +2 -0
- package/dist/ui/src/core/ui/components/field/field.module.scss.js.map +1 -0
- package/dist/ui/src/core/ui/index.js +1 -1
- package/dist/utils/_virtual/_rollupPluginBabelHelpers.js +1 -1
- package/dist/utils/esm/_virtual/_rollupPluginBabelHelpers.js +1 -1
- package/dist/utils/esm/index.css +121 -47
- package/dist/utils/esm/node_modules/uuid/dist/esm-browser/native.js +2 -0
- package/dist/utils/esm/node_modules/uuid/dist/esm-browser/native.js.map +1 -0
- package/dist/utils/esm/node_modules/uuid/dist/esm-browser/rng.js +2 -0
- package/dist/utils/esm/node_modules/uuid/dist/esm-browser/rng.js.map +1 -0
- package/dist/utils/esm/node_modules/uuid/dist/esm-browser/stringify.js +2 -0
- package/dist/utils/esm/node_modules/uuid/dist/esm-browser/stringify.js.map +1 -0
- package/dist/utils/esm/node_modules/uuid/dist/esm-browser/v4.js +2 -0
- package/dist/utils/esm/node_modules/uuid/dist/esm-browser/v4.js.map +1 -0
- package/dist/utils/esm/src/core/utils/appState/peregrineMQ/index.js +2 -0
- package/dist/utils/esm/src/core/utils/appState/peregrineMQ/index.js.map +1 -0
- package/dist/utils/esm/src/core/utils/appState/peregrineMQ/peregrineMQ.js +2 -0
- package/dist/utils/esm/src/core/utils/appState/peregrineMQ/peregrineMQ.js.map +1 -0
- package/dist/utils/esm/src/core/utils/appState/stateMachine/tiny-state-machine.base.js +2 -0
- package/dist/utils/esm/src/core/utils/appState/stateMachine/tiny-state-machine.base.js.map +1 -0
- package/dist/utils/esm/src/core/utils/appState/store/store.vanillajs.js +1 -1
- package/dist/utils/esm/src/core/utils/appState/store/store.vanillajs.js.map +1 -1
- package/dist/utils/esm/src/core/utils/appState/store/useStore.react.js.map +1 -1
- package/dist/utils/esm/src/core/utils/helpers/other.js +1 -1
- package/dist/utils/esm/src/core/utils/helpers/other.js.map +1 -1
- package/dist/utils/esm/src/core/utils/index.js +1 -1
- package/dist/utils/index.css +121 -47
- package/dist/utils/node_modules/uuid/dist/esm-browser/native.js +2 -0
- package/dist/utils/node_modules/uuid/dist/esm-browser/native.js.map +1 -0
- package/dist/utils/node_modules/uuid/dist/esm-browser/rng.js +2 -0
- package/dist/utils/node_modules/uuid/dist/esm-browser/rng.js.map +1 -0
- package/dist/utils/node_modules/uuid/dist/esm-browser/stringify.js +2 -0
- package/dist/utils/node_modules/uuid/dist/esm-browser/stringify.js.map +1 -0
- package/dist/utils/node_modules/uuid/dist/esm-browser/v4.js +2 -0
- package/dist/utils/node_modules/uuid/dist/esm-browser/v4.js.map +1 -0
- package/dist/utils/src/core/utils/appState/peregrineMQ/index.js +2 -0
- package/dist/utils/src/core/utils/appState/peregrineMQ/index.js.map +1 -0
- package/dist/utils/src/core/utils/appState/peregrineMQ/peregrineMQ.js +2 -0
- package/dist/utils/src/core/utils/appState/peregrineMQ/peregrineMQ.js.map +1 -0
- package/dist/utils/src/core/utils/appState/stateMachine/tiny-state-machine.base.js +2 -0
- package/dist/utils/src/core/utils/appState/stateMachine/tiny-state-machine.base.js.map +1 -0
- package/dist/utils/src/core/utils/appState/store/store.vanillajs.js +1 -1
- package/dist/utils/src/core/utils/appState/store/store.vanillajs.js.map +1 -1
- package/dist/utils/src/core/utils/appState/store/useStore.react.js.map +1 -1
- package/dist/utils/src/core/utils/helpers/other.js +1 -1
- package/dist/utils/src/core/utils/helpers/other.js.map +1 -1
- package/dist/utils/src/core/utils/index.js +1 -1
- package/package.json +2 -6
- package/dist/lib/cjs/src/core/ui/components/container/Flex.js +0 -2
- package/dist/lib/cjs/src/core/ui/components/container/Flex.js.map +0 -1
- package/dist/lib/cjs/src/core/ui/components/container/Placeholder.js +0 -2
- package/dist/lib/cjs/src/core/ui/components/container/Placeholder.js.map +0 -1
- package/dist/lib/esm/src/core/ui/components/container/Flex.js +0 -2
- package/dist/lib/esm/src/core/ui/components/container/Flex.js.map +0 -1
- package/dist/lib/esm/src/core/ui/components/container/Placeholder.js +0 -2
- package/dist/lib/esm/src/core/ui/components/container/Placeholder.js.map +0 -1
- package/dist/types/src/core/ui/components/container/Flex.d.ts +0 -41
- package/dist/types/src/core/ui/components/container/Flex.d.ts.map +0 -1
- package/dist/types/src/core/ui/components/container/Placeholder.d.ts +0 -11
- package/dist/types/src/core/ui/components/container/Placeholder.d.ts.map +0 -1
- package/dist/ui/esm/src/core/ui/components/container/Flex.js +0 -2
- package/dist/ui/esm/src/core/ui/components/container/Flex.js.map +0 -1
- package/dist/ui/esm/src/core/ui/components/container/Placeholder.js +0 -2
- package/dist/ui/esm/src/core/ui/components/container/Placeholder.js.map +0 -1
- package/dist/ui/src/core/ui/components/container/Flex.js +0 -2
- package/dist/ui/src/core/ui/components/container/Flex.js.map +0 -1
- package/dist/ui/src/core/ui/components/container/Placeholder.js +0 -2
- package/dist/ui/src/core/ui/components/container/Placeholder.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{calculateColors,calculatePercColor,convertHex,convertRGB,defaultFontSize,pxToRem,resolveStyleValue,setDefaultFontSize,toHex}from"./utils/style.js";export{LayoutBox}from"./components/container/layoutBox/LayoutBox.js";export{LayoutDirection}from"./components/container/layoutBox/layoutBox.types.js";export{LazyComponent,PendingBoundary,createLazyModule,createLazyModuleWithStore,wrapPromise}from"./components/container/lazyComponent/LazyComponent.js";export{
|
|
1
|
+
export{calculateColors,calculatePercColor,convertHex,convertRGB,defaultFontSize,pxToRem,resolveStyleValue,setDefaultFontSize,toHex}from"./utils/style.js";export{LayoutBox}from"./components/container/layoutBox/LayoutBox.js";export{LayoutDirection}from"./components/container/layoutBox/layoutBox.types.js";export{LazyComponent,PendingBoundary,createLazyModule,createLazyModuleWithStore,wrapPromise}from"./components/container/lazyComponent/LazyComponent.js";export{CollapsibleContainer}from"./components/container/CollapsibleContainer.js";export{ResizableContainer}from"./components/container/ResizableContainer.js";export{DefaultErrorComponent,ErrorBoundary}from"./components/error/ErrorBoundary.js";export{Field,Select,setIconColor,setIconComponent}from"./components/field/Field.js";export{DividerHorizontal,DividerLine,DividerVertical}from"./components/dividers/DividerLine.js";export{IconBase}from"./components/icon/IconBase.js";export{Icon}from"./components/icon/Icon.js";export{ESIcon,ESIconBase}from"./components/icon/IconWC.js";export{FlowLayout}from"./components/molecules/layouts/FlowLayout.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/ui/index.css
CHANGED
|
@@ -137,6 +137,80 @@
|
|
|
137
137
|
max-width: var(--prop-value);
|
|
138
138
|
opacity: 1;
|
|
139
139
|
}
|
|
140
|
+
.field-module_field__UfKm3 {
|
|
141
|
+
opacity: 1;
|
|
142
|
+
pointer-events: auto;
|
|
143
|
+
flex: 1 1 auto;
|
|
144
|
+
width: 100%;
|
|
145
|
+
/* Chrome, Safari, Edge, Opera */
|
|
146
|
+
/* Firefox */
|
|
147
|
+
}
|
|
148
|
+
.field-module_field__UfKm3.field-module_disabled__4aFNw {
|
|
149
|
+
opacity: 0.5;
|
|
150
|
+
pointer-events: none;
|
|
151
|
+
}
|
|
152
|
+
@media (min-width: 400px) {
|
|
153
|
+
.field-module_field__UfKm3 {
|
|
154
|
+
flex: 1;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
.field-module_field__UfKm3 .field-module_label__pJCHG {
|
|
158
|
+
font-size: 0.8rem !important;
|
|
159
|
+
font-weight: normal;
|
|
160
|
+
}
|
|
161
|
+
.field-module_field__UfKm3 .field-module_help__8psM4 {
|
|
162
|
+
text-align: left;
|
|
163
|
+
}
|
|
164
|
+
.field-module_field__UfKm3 .field-module_mainControl__RIMTe {
|
|
165
|
+
flex: 1;
|
|
166
|
+
border-radius: 6px;
|
|
167
|
+
box-shadow: 0 0 6px 1px rgba(0, 0, 0, 0.06);
|
|
168
|
+
will-change: box-shadow;
|
|
169
|
+
transition: box-shadow 250ms ease-in-out;
|
|
170
|
+
}
|
|
171
|
+
.field-module_field__UfKm3 .field-module_mainControl__RIMTe:hover {
|
|
172
|
+
box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
|
|
173
|
+
}
|
|
174
|
+
.field-module_field__UfKm3 button {
|
|
175
|
+
box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
|
|
176
|
+
}
|
|
177
|
+
.field-module_field__UfKm3 .field-module_select__-wfDp {
|
|
178
|
+
width: 100%;
|
|
179
|
+
flex: 1;
|
|
180
|
+
}
|
|
181
|
+
.field-module_field__UfKm3 .field-module_select__-wfDp::after {
|
|
182
|
+
border-color: #000000 !important;
|
|
183
|
+
}
|
|
184
|
+
.field-module_field__UfKm3 .field-module_icon__6vSNr.field-module_is-action__pf8ZC {
|
|
185
|
+
cursor: pointer;
|
|
186
|
+
pointer-events: initial !important;
|
|
187
|
+
}
|
|
188
|
+
.field-module_field__UfKm3 input::-webkit-outer-spin-button,
|
|
189
|
+
.field-module_field__UfKm3 input::-webkit-inner-spin-button {
|
|
190
|
+
-webkit-appearance: none;
|
|
191
|
+
margin: 0;
|
|
192
|
+
}
|
|
193
|
+
.field-module_field__UfKm3 input[type=number] {
|
|
194
|
+
-moz-appearance: textfield;
|
|
195
|
+
}
|
|
196
|
+
.field-module_field__UfKm3 .field-module_input__v-872[type=date]::-webkit-calendar-picker-indicator {
|
|
197
|
+
opacity: 0;
|
|
198
|
+
-webkit-appearance: none;
|
|
199
|
+
position: absolute;
|
|
200
|
+
left: 0;
|
|
201
|
+
top: 0;
|
|
202
|
+
width: 40px;
|
|
203
|
+
height: 100%;
|
|
204
|
+
margin: 0;
|
|
205
|
+
padding: 0;
|
|
206
|
+
cursor: pointer;
|
|
207
|
+
}
|
|
208
|
+
.field-module_field__UfKm3 textarea {
|
|
209
|
+
resize: none;
|
|
210
|
+
}
|
|
211
|
+
.field-module_field__UfKm3 label {
|
|
212
|
+
text-align: left;
|
|
213
|
+
}
|
|
140
214
|
.divider-module_divider-line__6CesR {
|
|
141
215
|
position: relative;
|
|
142
216
|
display: block;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("../../../../../_virtual/_rollupPluginBabelHelpers.js"),t=require("
|
|
1
|
+
"use strict";var e=require("../../../../../_virtual/_rollupPluginBabelHelpers.js"),t=require("react"),a=require("../../../utils/helpers/ui.js"),l=require("./field.module.scss.js");let n=()=>"#000000";let o=t.memo((function(){return React.createElement("span",null)}));const s=t.memo((function(t){let{options:a,value:l,inputRef:n,...o}=t;return React.createElement("div",{className:"select"},React.createElement("select",e.extends({},o,{ref:n,defaultValue:l}),a?.map((e=>React.createElement("option",{key:`${JSON.stringify(e)}`,value:"object"==typeof e?e?.value:e},"object"==typeof e?e?.label:e)))))})),c=t.memo((e=>t.createElement("textarea",e)));c.displayName="TextAreaComponent";const r=t.memo((e=>t.createElement("input",e)));r.displayName="InputComponent";const i=t.memo((i=>{let{label:m,name:u,type:p="text",value:d,defaultValue:f,placeholder:h,inputRef:R,error:N,disabled:C,userDisabled:E,withoutComponent:g,helpTextInfo:v,helpText:b,children:y,iconLeft:x,iconRight:k,addon:I,className:F,onChange:j,onChangeInner:q,onBlur:B,onFocus:D,rightIconClick:w,leftIconClick:T,options:V,style:$,...K}=i,L=r;y||"textarea"!==p||(L=c);const S=t.useCallback((e=>{E?e?.preventDefault?.():D&&D(e)}),[E,D]),_=t.useCallback((e=>{E||(q&&e?.target?(e.target.value=q(e.target.value),j&&j(e)):j&&j(e))}),[q,j,E]),A=t.useMemo((()=>void 0===d?{defaultValue:f}:{value:d}),[d,f]);return React.createElement("div",{className:a.classNames(l.default.field,(C||E)&&l.default.disable,F),style:$},React.createElement("label",{htmlFor:u,className:"label"},m),React.createElement("div",{className:"field "+(I?"has-addons":"")},React.createElement("div",{className:`control mainControl ${x&&!g?"has-icons-left":""} ${k?"has-icons-right":""}`},!g&&(y||"select"!==p&&!V?!y&&React.createElement(L,e.extends({name:u,id:u,ref:R,className:"input "+(N?"is-danger":""),type:p,placeholder:h},A,{onChange:_,onBlur:B,onFocus:S,onKeyDown:S,autoComplete:"off",disabled:C},K)):React.createElement(s,e.extends({name:u,id:u,inputRef:R,className:"input "+(N?"is-danger":""),type:"select",placeholder:h,value:d,options:V,onChange:j,onBlur:B,onFocus:S,onKeyDown:S,autoComplete:"off",disabled:C},K))),x&&!g&&React.createElement("span",{className:"iconLeft icon is-small is-left "+(T?"is-action":""),onClick:T},React.createElement(o,{iconName:x,color:n})),k&&React.createElement("span",{className:"iconRight icon is-small is-right "+(w?"is-action":""),onClick:w},React.createElement(o,{iconName:k,color:n})),y&&y),I&&I),v&&React.createElement("p",{className:"help"},v),b&&React.createElement("p",{className:"help "+(N?"is-danger":"")},b))}));i.displayName="Field",exports.Field=i,exports.Select=s,exports.setIconColor=e=>{n=e},exports.setIconComponent=e=>{o=e};
|
|
2
2
|
//# sourceMappingURL=Field.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field.js","sources":["../../../../../../../src/core/ui/components/field/Field.tsx"],"sourcesContent":["/* eslint-disable react/jsx-props-no-spreading */\n/* eslint-disable jsx-a11y/no-static-element-interactions */\n/* eslint-disable jsx-a11y/click-events-have-key-events */\nimport { FC, ReactNode, memo, useMemo, useCallback, PropsWithChildren } from 'react'\nimport styled from 'styled-components'\n\nimport type { FieldError, IconComponentType } from './types'\n\nlet iconColor: string | (() => string) = () => '#000000'\n\nexport const setIconColor = (color: string | (() => string)): void => {\n iconColor = color\n}\n\nlet IconComponent: IconComponentType = memo(function IconComponent() { return <span /> })\n\nexport const setIconComponent = (component: IconComponentType): void => {\n IconComponent = component\n}\n\nexport type FileWrapperProps = PropsWithChildren<unknown> & {\n className?: string\n error?: boolean\n disabled?: boolean\n userDisabled?: boolean\n css?: string\n}\n\nexport const FieldWrapper: FC<FileWrapperProps> = styled.div<FileWrapperProps>`\n opacity: ${({ disabled, userDisabled }): number => (disabled || userDisabled ? 0.5 : 1)};\n pointer-events: ${({ disabled, userDisabled }): string => (disabled || userDisabled ? 'none' : 'auto')};\n flex: 1 1 auto;\n width: 100%;\n @media (min-width: 400px) {\n flex: 1;\n }\n .label {\n font-size: 0.8rem !important;\n font-weight: normal;\n }\n\n .help {\n text-align: left;\n }\n\n .mainControl {\n flex: 1;\n border-radius: 6px;\n box-shadow: 0 0 6px 1px rgba(0, 0, 0, 0.06);\n will-change: box-shadow;\n transition: box-shadow 250ms ease-in-out;\n &:hover {\n box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);\n }\n }\n button {\n box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);\n }\n .select {\n width: 100%;\n flex: 1;\n &::after {\n border-color: #000000 !important;\n }\n }\n\n .icon {\n &.is-action {\n cursor: pointer;\n pointer-events: initial !important;\n }\n }\n\n /* Chrome, Safari, Edge, Opera */\n input::-webkit-outer-spin-button,\n input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n /* Firefox */\n input[type=number] {\n -moz-appearance: textfield;\n }\n\n .input[type=date]::-webkit-calendar-picker-indicator {\n opacity:0;\n -webkit-appearance: none;\n position: absolute;\n left: 0;\n top: 0;\n width: 40px;\n height: 100%;\n margin: 0;\n padding: 0;\n cursor: pointer;\n }\n\n textarea {\n resize: none;\n }\n`\n\ntype EventType = { target: any; type?: any } & Partial<Event>\nexport interface FieldProps {\n label?: string\n name?: string\n type?: string\n min?: number | string | Date | any\n max?: number | string | Date | any\n value?: string | number | readonly string[] | undefined\n defaultValue?: string | number | readonly string[] | undefined\n placeholder?: string\n inputRef?: ReactHookFormRef\n error?: boolean\n errors?: FieldError\n disabled?: boolean\n userDisabled?: boolean\n helpTextInfo?: string\n helpText?: string\n iconLeft?: string\n iconRight?: string\n withoutComponent?: boolean\n addon?: ReactNode\n children?: ReactNode\n className?: string\n onChange?: (event?: EventType) => unknown\n // TODO, rename... something like changeHandler or valueDecorator\n onChangeInner?: (value: string | number) => string | number\n onBlur?: (event?: EventType) => void\n onFocus?: (event?: EventType | undefined) => void\n rightIconClick?: (event?: EventType) => void\n leftIconClick?: (event?: EventType) => void\n options?: any[] | null\n creatable?: boolean\n async?: boolean\n css?: string\n [key: string]: any\n}\n\ninterface SelectProps extends FieldProps {\n id?: string\n}\n\ntype OptionObj = { label: string | number | undefined; value: string | number | undefined }\ntype Option = OptionObj | string | number\n\nexport const Select: FC<SelectProps>\n= memo<SelectProps>(\n function Select({ options, value, inputRef, ...props }: SelectProps) {\n return (\n <div className='select'>\n <select {...props} ref={inputRef} defaultValue={value}>\n {options?.map((option: Option) => (\n <option\n key={`${JSON.stringify(option)}`}\n value={typeof option === 'object' ? (option as OptionObj)?.value : option}\n >\n {typeof option === 'object' ? (option as OptionObj)?.label : option}\n </option>\n ))}\n </select>\n </div>\n )\n },\n)\n\nconst InputComponent = styled.input``\nconst TextAreaComponent = styled.textarea``\nconst StyledFieldLabel = styled.label`\n text-align: left;\n`\n\nexport const Field: FC<FieldProps> = memo<FieldProps>(({\n label,\n name,\n type = 'text',\n value,\n defaultValue,\n placeholder,\n inputRef,\n error,\n disabled,\n userDisabled,\n withoutComponent,\n helpTextInfo,\n helpText,\n children,\n iconLeft,\n iconRight,\n addon,\n className,\n onChange,\n onChangeInner,\n onBlur,\n onFocus,\n rightIconClick,\n leftIconClick,\n options,\n css,\n ...props\n}: FieldProps) => {\n let Component: FC<any> = InputComponent\n\n if (!children && type === 'textarea') {\n Component = TextAreaComponent\n }\n const handleFocus = useCallback((event: Event | EventType | undefined) => {\n if (userDisabled) {\n event?.preventDefault?.()\n } else {\n onFocus && onFocus(event)\n }\n }, [userDisabled, onFocus])\n\n const handleChange = useCallback((event: { target: { value: string } }) => {\n if (userDisabled) {\n return\n }\n if (onChangeInner && event?.target) {\n // eslint-disable-next-line no-param-reassign\n event.target.value = onChangeInner((event.target.value as string)) as string\n onChange && onChange(event as EventType)\n } else {\n onChange && onChange(event as EventType)\n }\n }, [onChangeInner, onChange, userDisabled])\n\n const valueProps = useMemo(() => {\n if (value === undefined) {\n return { defaultValue }\n }\n return { value }\n }, [value, defaultValue])\n\n return (\n <FieldWrapper\n className={`field ${className}`}\n error={error}\n disabled={disabled}\n userDisabled={userDisabled}\n css={css}\n >\n <StyledFieldLabel htmlFor={name} className='label'>{label}</StyledFieldLabel>\n <div className={`field ${addon ? 'has-addons' : ''}`}>\n <div\n className={`control mainControl ${iconLeft && !withoutComponent\n ? 'has-icons-left' : ''} ${iconRight ? 'has-icons-right' : ''}`}\n >\n {!withoutComponent && ((!children && (type === 'select' || options))\n ? (\n <Select\n name={name}\n id={name}\n inputRef={inputRef}\n className={`input ${error ? 'is-danger' : ''}`}\n type='select'\n placeholder={placeholder}\n value={value}\n options={options}\n // TODO also handle change but value versus event.target.value issue\n onChange={onChange}\n onBlur={onBlur}\n onFocus={handleFocus}\n onKeyDown={handleFocus}\n autoComplete='off'\n disabled={disabled}\n {...props}\n />\n )\n : (\n !children && (\n <Component\n name={name}\n id={name}\n ref={inputRef}\n className={`input ${error ? 'is-danger' : ''}`}\n type={type}\n placeholder={placeholder}\n {...valueProps}\n onChange={handleChange}\n onBlur={onBlur}\n onFocus={handleFocus}\n onKeyDown={handleFocus}\n autoComplete='off'\n disabled={disabled}\n {...props}\n />\n )))}\n\n {iconLeft && !withoutComponent && (\n <span\n className={`iconLeft icon is-small is-left ${leftIconClick ? 'is-action' : ''}`}\n onClick={leftIconClick}\n >\n <IconComponent\n iconName={iconLeft}\n color={iconColor}\n />\n </span>\n )}\n {iconRight && (\n <span\n className={`iconRight icon is-small is-right ${rightIconClick ? 'is-action' : ''}`}\n onClick={rightIconClick}\n >\n <IconComponent\n iconName={iconRight}\n color={iconColor}\n />\n </span>\n )}\n {children && children}\n </div>\n {addon && addon}\n </div>\n {helpTextInfo && <p className='help'>{helpTextInfo}</p>}\n {helpText && <p className={`help ${error ? 'is-danger' : ''}`}>{helpText}</p>}\n </FieldWrapper>\n )\n})\n\nField.displayName = 'Field'\n"],"names":["iconColor","IconComponent","memo","React","createElement","setIconComponent","FieldWrapper","styled","div","withConfig","displayName","componentId","_ref","disabled","userDisabled","_ref2","_StyledFieldWrapper","default","p","$_css","Select","_ref3","options","value","inputRef","props","className","_extends","ref","defaultValue","map","option","key","JSON","stringify","label","InputComponent","input","TextAreaComponent","textarea","StyledFieldLabel","Field","_ref4","name","type","placeholder","error","withoutComponent","helpTextInfo","helpText","children","iconLeft","iconRight","addon","onChange","onChangeInner","onBlur","onFocus","rightIconClick","leftIconClick","css","Component","handleFocus","useCallback","event","preventDefault","handleChange","target","valueProps","useMemo","undefined","htmlFor","id","onKeyDown","autoComplete","onClick","iconName","color","component"],"mappings":"mMAQA,IAAIA,EAAqCA,IAAM,UAM/C,IAAIC,EAAmCC,EAAAA,MAAK,WAA2B,OAAOC,MAAAC,cAAA,OAAA,KAAS,IAE1EC,MAYAC,EAAqCC,EAAAA,QAAOC,IAAGC,WAAA,CAAAC,YAAA,sBAAAC,YAAA,eAAVJ,CAAU,CAAA,WAAA,mBAAA,61BAC/CK,IAAA,IAACC,SAAEA,EAAQC,aAAEA,GAAcF,EAAA,OAAcC,GAAYC,EAAe,GAAM,CAA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A,CACLgB,KAAMA,EACN6B,GAAI7B,EACJnB,SAAUA,EACVE,UAAW,UAASoB,EAAQ,YAAc,IAC1CF,KAAK,SACLC,YAAaA,EACbtB,MAAOA,EACPD,QAASA,EAETgC,SAAUA,EACVE,OAAQA,EACRC,QAASK,EACTW,UAAWX,EACXY,aAAa,MACb7D,SAAUA,GACNY,KAuBT0B,IAAaJ,GACZ5C,MAAAC,cAAA,OAAA,CACEsB,UAAW,mCAAkCiC,EAAgB,YAAc,IAC3EgB,QAAShB,GAETxD,MAAAC,cAACH,EAAa,CACZ2E,SAAUzB,EACV0B,MAAO7E,KAIZoD,GACCjD,MAAAC,cAAA,OAAA,CACEsB,UAAW,qCAAoCgC,EAAiB,YAAc,IAC9EiB,QAASjB,GAETvD,MAAAC,cAACH,EAAa,CACZ2E,SAAUxB,EACVyB,MAAO7E,KAIZkD,GAAYA,GAEdG,GAASA,GAEXL,GAAgB7C,MAAAC,cAAA,IAAA,CAAGsB,UAAU,QAAQsB,GACrCC,GAAY9C,MAAAC,cAAA,IAAA,CAAGsB,UAAW,SAAQoB,EAAQ,YAAc,KAAOG,GACnD,IAInBR,EAAM/B,YAAc,qFAxTSmE,IAC3B7E,EAAY6E,CAAK,2BAKcC,IAC/B7E,EAAgB6E,CAAS"}
|
|
1
|
+
{"version":3,"file":"Field.js","sources":["../../../../../../../src/core/ui/components/field/Field.tsx"],"sourcesContent":["/* eslint-disable react/jsx-props-no-spreading */\n/* eslint-disable jsx-a11y/no-static-element-interactions */\n/* eslint-disable jsx-a11y/click-events-have-key-events */\nimport { FC, ReactNode, memo, useMemo, useCallback, PropsWithChildren, CSSProperties, createElement } from 'react'\n\nimport { classNames } from '../../../utils/helpers/ui'\n\nimport classes from './field.module.scss'\nimport type { FieldError, IconComponentType } from './types'\n\nlet iconColor: string | (() => string) = () => '#000000'\n\nexport const setIconColor = (color: string | (() => string)): void => {\n iconColor = color\n}\n\nlet IconComponent: IconComponentType = memo(function IconComponent() { return <span /> })\n\nexport const setIconComponent = (component: IconComponentType): void => {\n IconComponent = component\n}\n\nexport type FileWrapperProps = PropsWithChildren<unknown> & {\n className?: string\n error?: boolean\n disabled?: boolean\n userDisabled?: boolean\n css?: string\n}\n\ntype EventType = { target: any; type?: any } & Partial<Event>\nexport interface FieldProps {\n label?: string\n name?: string\n type?: string\n min?: number | string | Date | any\n max?: number | string | Date | any\n value?: string | number | readonly string[] | undefined\n defaultValue?: string | number | readonly string[] | undefined\n placeholder?: string\n inputRef?: ReactHookFormRef\n error?: boolean\n errors?: FieldError\n disabled?: boolean\n userDisabled?: boolean\n helpTextInfo?: string\n helpText?: string\n iconLeft?: string\n iconRight?: string\n withoutComponent?: boolean\n addon?: ReactNode\n children?: ReactNode\n className?: string\n onChange?: (event?: EventType) => unknown\n // TODO, rename... something like changeHandler or valueDecorator\n onChangeInner?: (value: string | number) => string | number\n onBlur?: (event?: EventType) => void\n onFocus?: (event?: EventType | undefined) => void\n rightIconClick?: (event?: EventType) => void\n leftIconClick?: (event?: EventType) => void\n options?: any[] | null\n creatable?: boolean\n async?: boolean\n style?: CSSProperties\n [key: string]: any\n}\n\ninterface SelectProps extends FieldProps {\n id?: string\n}\n\ntype OptionObj = { label: string | number | undefined; value: string | number | undefined }\ntype Option = OptionObj | string | number\n\nexport const Select: FC<SelectProps>\n= memo<SelectProps>(\n function Select({ options, value, inputRef, ...props }: SelectProps) {\n return (\n <div className='select'>\n <select {...props} ref={inputRef} defaultValue={value}>\n {options?.map((option: Option) => (\n <option\n key={`${JSON.stringify(option)}`}\n value={typeof option === 'object' ? (option as OptionObj)?.value : option}\n >\n {typeof option === 'object' ? (option as OptionObj)?.label : option}\n </option>\n ))}\n </select>\n </div>\n )\n },\n)\nconst TextAreaComponent = memo((props) => createElement('textarea', props))\n\nTextAreaComponent.displayName = 'TextAreaComponent'\n\nconst InputComponent = memo((props) => createElement('input', props))\n\nInputComponent.displayName = 'InputComponent'\n\nexport const Field: FC<FieldProps> = memo<FieldProps>(({\n label,\n name,\n type = 'text',\n value,\n defaultValue,\n placeholder,\n inputRef,\n error,\n disabled,\n userDisabled,\n withoutComponent,\n helpTextInfo,\n helpText,\n children,\n iconLeft,\n iconRight,\n addon,\n className,\n onChange,\n onChangeInner,\n onBlur,\n onFocus,\n rightIconClick,\n leftIconClick,\n options,\n style,\n ...props\n}: FieldProps) => {\n let Component: FC<any> = InputComponent\n\n if (!children && type === 'textarea') {\n Component = TextAreaComponent\n }\n const handleFocus = useCallback((event: Event | EventType | undefined) => {\n if (userDisabled) {\n event?.preventDefault?.()\n } else {\n onFocus && onFocus(event)\n }\n }, [userDisabled, onFocus])\n\n const handleChange = useCallback((event: { target: { value: string } }) => {\n if (userDisabled) {\n return\n }\n if (onChangeInner && event?.target) {\n // eslint-disable-next-line no-param-reassign\n event.target.value = onChangeInner((event.target.value as string)) as string\n onChange && onChange(event as EventType)\n } else {\n onChange && onChange(event as EventType)\n }\n }, [onChangeInner, onChange, userDisabled])\n\n const valueProps = useMemo(() => {\n if (value === undefined) {\n return { defaultValue }\n }\n return { value }\n }, [value, defaultValue])\n\n return (\n <div\n className={classNames(\n classes.field,\n (disabled || userDisabled) && classes.disable,\n className,\n )}\n // TODO fix\n // error={error}\n style={style}\n >\n <label htmlFor={name} className='label'>{label}</label>\n <div className={`field ${addon ? 'has-addons' : ''}`}>\n <div\n className={`control mainControl ${iconLeft && !withoutComponent\n ? 'has-icons-left' : ''} ${iconRight ? 'has-icons-right' : ''}`}\n >\n {!withoutComponent && ((!children && (type === 'select' || options))\n ? (\n <Select\n name={name}\n id={name}\n inputRef={inputRef}\n className={`input ${error ? 'is-danger' : ''}`}\n type='select'\n placeholder={placeholder}\n value={value}\n options={options}\n // TODO also handle change but value versus event.target.value issue\n onChange={onChange}\n onBlur={onBlur}\n onFocus={handleFocus}\n onKeyDown={handleFocus}\n autoComplete='off'\n disabled={disabled}\n {...props}\n />\n )\n : (\n !children && (\n <Component\n name={name}\n id={name}\n ref={inputRef}\n className={`input ${error ? 'is-danger' : ''}`}\n type={type}\n placeholder={placeholder}\n {...valueProps}\n onChange={handleChange}\n onBlur={onBlur}\n onFocus={handleFocus}\n onKeyDown={handleFocus}\n autoComplete='off'\n disabled={disabled}\n {...props}\n />\n )))}\n\n {iconLeft && !withoutComponent && (\n <span\n className={`iconLeft icon is-small is-left ${leftIconClick ? 'is-action' : ''}`}\n onClick={leftIconClick}\n >\n <IconComponent\n iconName={iconLeft}\n color={iconColor}\n />\n </span>\n )}\n {iconRight && (\n <span\n className={`iconRight icon is-small is-right ${rightIconClick ? 'is-action' : ''}`}\n onClick={rightIconClick}\n >\n <IconComponent\n iconName={iconRight}\n color={iconColor}\n />\n </span>\n )}\n {children && children}\n </div>\n {addon && addon}\n </div>\n {helpTextInfo && <p className='help'>{helpTextInfo}</p>}\n {helpText && <p className={`help ${error ? 'is-danger' : ''}`}>{helpText}</p>}\n </div>\n )\n})\n\nField.displayName = 'Field'\n"],"names":["iconColor","IconComponent","memo","React","createElement","setIconComponent","Select","_ref","options","value","inputRef","props","className","_extends","ref","defaultValue","map","option","key","JSON","stringify","label","TextAreaComponent","displayName","InputComponent","Field","_ref2","name","type","placeholder","error","disabled","userDisabled","withoutComponent","helpTextInfo","helpText","children","iconLeft","iconRight","addon","onChange","onChangeInner","onBlur","onFocus","rightIconClick","leftIconClick","style","Component","handleFocus","useCallback","event","preventDefault","handleChange","target","valueProps","useMemo","undefined","classNames","classes","default","field","disable","htmlFor","id","onKeyDown","autoComplete","onClick","iconName","color","component"],"mappings":"oLAUA,IAAIA,EAAqCA,IAAM,UAM/C,IAAIC,EAAmCC,EAAAA,MAAK,WAA2B,OAAOC,MAAAC,cAAA,OAAA,KAAS,IAE1EC,MAwDAC,EACXJ,EAAIA,MACJ,SAAeK,GAAsD,IAArDC,QAAEA,EAAOC,MAAEA,EAAKC,SAAEA,KAAaC,GAAoBJ,EACjE,OACEJ,MAAAC,cAAA,MAAA,CAAKQ,UAAU,UACbT,MAAAC,cAAAS,SAAAA,EAAAA,WAAYF,E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IZoC,GAAYA,GAEdG,GAASA,GAEXL,GAAgB/B,MAAAC,cAAA,IAAA,CAAGQ,UAAU,QAAQsB,GACrCC,GAAYhC,MAAAC,cAAA,IAAA,CAAGQ,UAAW,SAAQkB,EAAQ,YAAc,KAAOK,GAC5D,IAIVV,EAAMF,YAAc,8DAjPS6C,IAC3BpE,EAAYoE,CAAK,2BAKcC,IAC/BpE,EAAgBoE,CAAS"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.default={field:"field-module_field__UfKm3",disabled:"field-module_disabled__4aFNw",label:"field-module_label__pJCHG",help:"field-module_help__8psM4",mainControl:"field-module_mainControl__RIMTe",select:"field-module_select__-wfDp",icon:"field-module_icon__6vSNr","is-action":"field-module_is-action__pf8ZC",input:"field-module_input__v-872"};
|
|
2
|
+
//# sourceMappingURL=field.module.scss.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("./utils/style.js"),o=require("./components/container/layoutBox/LayoutBox.js"),r=require("./components/container/layoutBox/layoutBox.types.js"),t=require("./components/container/lazyComponent/LazyComponent.js"),n=require("./components/container/
|
|
1
|
+
"use strict";var e=require("./utils/style.js"),o=require("./components/container/layoutBox/LayoutBox.js"),r=require("./components/container/layoutBox/layoutBox.types.js"),t=require("./components/container/lazyComponent/LazyComponent.js"),n=require("./components/container/CollapsibleContainer.js"),s=require("./components/container/ResizableContainer.js"),i=require("./components/error/ErrorBoundary.js"),a=require("./components/field/Field.js"),l=require("./components/dividers/DividerLine.js"),c=require("./components/icon/IconBase.js"),p=require("./components/icon/Icon.js"),u=require("./components/icon/IconWC.js"),x=require("./components/molecules/layouts/FlowLayout.js");exports.calculateColors=e.calculateColors,exports.calculatePercColor=e.calculatePercColor,exports.convertHex=e.convertHex,exports.convertRGB=e.convertRGB,Object.defineProperty(exports,"defaultFontSize",{enumerable:!0,get:function(){return e.defaultFontSize}}),exports.pxToRem=e.pxToRem,exports.resolveStyleValue=e.resolveStyleValue,exports.setDefaultFontSize=e.setDefaultFontSize,exports.toHex=e.toHex,exports.LayoutBox=o.LayoutBox,exports.LayoutDirection=r.LayoutDirection,exports.LazyComponent=t.LazyComponent,exports.PendingBoundary=t.PendingBoundary,exports.createLazyModule=t.createLazyModule,exports.createLazyModuleWithStore=t.createLazyModuleWithStore,exports.wrapPromise=t.wrapPromise,exports.CollapsibleContainer=n.CollapsibleContainer,exports.ResizableContainer=s.ResizableContainer,exports.DefaultErrorComponent=i.DefaultErrorComponent,exports.ErrorBoundary=i.ErrorBoundary,exports.Field=a.Field,exports.Select=a.Select,exports.setIconColor=a.setIconColor,exports.setIconComponent=a.setIconComponent,exports.DividerHorizontal=l.DividerHorizontal,exports.DividerLine=l.DividerLine,exports.DividerVertical=l.DividerVertical,exports.IconBase=c.IconBase,exports.Icon=p.Icon,exports.ESIcon=u.ESIcon,exports.ESIconBase=u.ESIconBase,exports.FlowLayout=x.FlowLayout;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";function
|
|
1
|
+
"use strict";function e(e,t,r,n,o,i,a){try{var s=e[i](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,o)}var t=0;exports.asyncToGenerator=function(t){return function(){var r=this,n=arguments;return new Promise((function(o,i){var a=t.apply(r,n);function s(t){e(a,o,i,s,c,"next",t)}function c(t){e(a,o,i,s,c,"throw",t)}s(void 0)}))}},exports.classPrivateFieldLooseBase=function(e,t){if(!{}.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e},exports.classPrivateFieldLooseKey=function(e){return"__private_"+t+++"_"+e};
|
|
2
2
|
//# sourceMappingURL=_rollupPluginBabelHelpers.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function
|
|
1
|
+
function e(e,n,r,t,o,a,i){try{var s=e[a](i),c=s.value}catch(e){return void r(e)}s.done?n(c):Promise.resolve(c).then(t,o)}function n(n){return function(){var r=this,t=arguments;return new Promise((function(o,a){var i=n.apply(r,t);function s(n){e(i,o,a,s,c,"next",n)}function c(n){e(i,o,a,s,c,"throw",n)}s(void 0)}))}}function r(e,n){if(!{}.hasOwnProperty.call(e,n))throw new TypeError("attempted to use private field on non-instance");return e}var t=0;function o(e){return"__private_"+t+++"_"+e}export{n as asyncToGenerator,r as classPrivateFieldLooseBase,o as classPrivateFieldLooseKey};
|
|
2
2
|
//# sourceMappingURL=_rollupPluginBabelHelpers.js.map
|
package/dist/utils/esm/index.css
CHANGED
|
@@ -1,21 +1,44 @@
|
|
|
1
|
-
.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
background-color: var(--color);
|
|
6
|
-
opacity: var(--opacity);
|
|
1
|
+
.CollapsibleContainer-module_collapsible-container__u0Jmm {
|
|
2
|
+
transform-origin: 0% 0%;
|
|
3
|
+
opacity: 0;
|
|
4
|
+
overflow: clip;
|
|
7
5
|
}
|
|
8
|
-
.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
width: var(--width);
|
|
12
|
-
margin: var(--margin);
|
|
6
|
+
.CollapsibleContainer-module_collapsible-container__u0Jmm.CollapsibleContainer-module_vertical__w7MVN {
|
|
7
|
+
transition: opacity 0.2s ease-in-out, height 0.2s ease-in-out, max-height 0.2s ease-in-out;
|
|
8
|
+
will-change: opacity, height, max-height;
|
|
13
9
|
}
|
|
14
|
-
.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
.CollapsibleContainer-module_collapsible-container__u0Jmm.CollapsibleContainer-module_vertical__w7MVN.CollapsibleContainer-module_collapsed__q8fs8 {
|
|
11
|
+
height: 0;
|
|
12
|
+
max-height: 0;
|
|
13
|
+
opacity: 0;
|
|
14
|
+
}
|
|
15
|
+
.CollapsibleContainer-module_collapsible-container__u0Jmm.CollapsibleContainer-module_vertical__w7MVN.CollapsibleContainer-module_expanded__O6Vh8 {
|
|
16
|
+
height: var(--prop-value);
|
|
17
|
+
max-height: var(--prop-value);
|
|
18
|
+
opacity: 1;
|
|
19
|
+
}
|
|
20
|
+
.CollapsibleContainer-module_collapsible-container__u0Jmm.CollapsibleContainer-module_horizontal__QJWI- {
|
|
21
|
+
transition: opacity 0.2s ease-in-out, width 0.2s ease-in-out, max-width 0.2s ease-in-out;
|
|
22
|
+
will-change: opacity, width, max-width;
|
|
23
|
+
}
|
|
24
|
+
.CollapsibleContainer-module_collapsible-container__u0Jmm.CollapsibleContainer-module_horizontal__QJWI-.CollapsibleContainer-module_collapsed__q8fs8 {
|
|
25
|
+
width: 0;
|
|
26
|
+
max-width: 0;
|
|
27
|
+
opacity: 0;
|
|
28
|
+
}
|
|
29
|
+
.CollapsibleContainer-module_collapsible-container__u0Jmm.CollapsibleContainer-module_horizontal__QJWI-.CollapsibleContainer-module_expanded__O6Vh8 {
|
|
30
|
+
width: var(--prop-value);
|
|
31
|
+
max-width: var(--prop-value);
|
|
32
|
+
opacity: 1;
|
|
33
|
+
}
|
|
34
|
+
.errorBoundary-module_errorBoundary__gk9ps {
|
|
35
|
+
background: #EFEFEF;
|
|
36
|
+
width: 100%;
|
|
37
|
+
height: 100%;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.errorBoundary-module_StyledIcon__IYHiU {
|
|
41
|
+
margin-right: 10px;
|
|
19
42
|
}
|
|
20
43
|
.icon-module_icon-base-parent__nOMvW {
|
|
21
44
|
line-height: 1px !important;
|
|
@@ -47,47 +70,98 @@
|
|
|
47
70
|
width: var(--height);
|
|
48
71
|
height: var(--width);
|
|
49
72
|
}
|
|
50
|
-
.
|
|
51
|
-
|
|
73
|
+
.divider-module_divider-line__6CesR {
|
|
74
|
+
position: relative;
|
|
75
|
+
display: block;
|
|
76
|
+
transition: opacity, width, height 250ms ease-in-out;
|
|
77
|
+
background-color: var(--color);
|
|
78
|
+
opacity: var(--opacity);
|
|
79
|
+
}
|
|
80
|
+
.divider-module_divider-line__6CesR.divider-module_vertical__qSVWD {
|
|
81
|
+
height: var(--length);
|
|
82
|
+
left: var(--left);
|
|
83
|
+
width: var(--width);
|
|
84
|
+
margin: var(--margin);
|
|
85
|
+
}
|
|
86
|
+
.divider-module_divider-line__6CesR.divider-module_horizontal__Gz-Oj {
|
|
87
|
+
width: var(--length);
|
|
88
|
+
left: var(--left);
|
|
89
|
+
height: var(--height);
|
|
90
|
+
margin: var(--margin);
|
|
91
|
+
}
|
|
92
|
+
.field-module_field__UfKm3 {
|
|
93
|
+
opacity: 1;
|
|
94
|
+
pointer-events: auto;
|
|
95
|
+
flex: 1 1 auto;
|
|
52
96
|
width: 100%;
|
|
53
|
-
|
|
97
|
+
/* Chrome, Safari, Edge, Opera */
|
|
98
|
+
/* Firefox */
|
|
54
99
|
}
|
|
55
|
-
|
|
56
|
-
.
|
|
57
|
-
|
|
100
|
+
.field-module_field__UfKm3.field-module_disabled__4aFNw {
|
|
101
|
+
opacity: 0.5;
|
|
102
|
+
pointer-events: none;
|
|
58
103
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
104
|
+
@media (min-width: 400px) {
|
|
105
|
+
.field-module_field__UfKm3 {
|
|
106
|
+
flex: 1;
|
|
107
|
+
}
|
|
63
108
|
}
|
|
64
|
-
.
|
|
65
|
-
|
|
66
|
-
|
|
109
|
+
.field-module_field__UfKm3 .field-module_label__pJCHG {
|
|
110
|
+
font-size: 0.8rem !important;
|
|
111
|
+
font-weight: normal;
|
|
67
112
|
}
|
|
68
|
-
.
|
|
69
|
-
|
|
70
|
-
max-height: 0;
|
|
71
|
-
opacity: 0;
|
|
113
|
+
.field-module_field__UfKm3 .field-module_help__8psM4 {
|
|
114
|
+
text-align: left;
|
|
72
115
|
}
|
|
73
|
-
.
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
116
|
+
.field-module_field__UfKm3 .field-module_mainControl__RIMTe {
|
|
117
|
+
flex: 1;
|
|
118
|
+
border-radius: 6px;
|
|
119
|
+
box-shadow: 0 0 6px 1px rgba(0, 0, 0, 0.06);
|
|
120
|
+
will-change: box-shadow;
|
|
121
|
+
transition: box-shadow 250ms ease-in-out;
|
|
77
122
|
}
|
|
78
|
-
.
|
|
79
|
-
|
|
80
|
-
will-change: opacity, width, max-width;
|
|
123
|
+
.field-module_field__UfKm3 .field-module_mainControl__RIMTe:hover {
|
|
124
|
+
box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
|
|
81
125
|
}
|
|
82
|
-
.
|
|
83
|
-
|
|
84
|
-
|
|
126
|
+
.field-module_field__UfKm3 button {
|
|
127
|
+
box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
|
|
128
|
+
}
|
|
129
|
+
.field-module_field__UfKm3 .field-module_select__-wfDp {
|
|
130
|
+
width: 100%;
|
|
131
|
+
flex: 1;
|
|
132
|
+
}
|
|
133
|
+
.field-module_field__UfKm3 .field-module_select__-wfDp::after {
|
|
134
|
+
border-color: #000000 !important;
|
|
135
|
+
}
|
|
136
|
+
.field-module_field__UfKm3 .field-module_icon__6vSNr.field-module_is-action__pf8ZC {
|
|
137
|
+
cursor: pointer;
|
|
138
|
+
pointer-events: initial !important;
|
|
139
|
+
}
|
|
140
|
+
.field-module_field__UfKm3 input::-webkit-outer-spin-button,
|
|
141
|
+
.field-module_field__UfKm3 input::-webkit-inner-spin-button {
|
|
142
|
+
-webkit-appearance: none;
|
|
143
|
+
margin: 0;
|
|
144
|
+
}
|
|
145
|
+
.field-module_field__UfKm3 input[type=number] {
|
|
146
|
+
-moz-appearance: textfield;
|
|
147
|
+
}
|
|
148
|
+
.field-module_field__UfKm3 .field-module_input__v-872[type=date]::-webkit-calendar-picker-indicator {
|
|
85
149
|
opacity: 0;
|
|
150
|
+
-webkit-appearance: none;
|
|
151
|
+
position: absolute;
|
|
152
|
+
left: 0;
|
|
153
|
+
top: 0;
|
|
154
|
+
width: 40px;
|
|
155
|
+
height: 100%;
|
|
156
|
+
margin: 0;
|
|
157
|
+
padding: 0;
|
|
158
|
+
cursor: pointer;
|
|
86
159
|
}
|
|
87
|
-
.
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
160
|
+
.field-module_field__UfKm3 textarea {
|
|
161
|
+
resize: none;
|
|
162
|
+
}
|
|
163
|
+
.field-module_field__UfKm3 label {
|
|
164
|
+
text-align: left;
|
|
91
165
|
}
|
|
92
166
|
.layoutBox-module_layout-box__ZIID8 {
|
|
93
167
|
display: flex;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native.js","sources":["../../../../../../../node_modules/uuid/dist/esm-browser/native.js"],"sourcesContent":["const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);\nexport default {\n randomUUID\n};"],"names":["native","randomUUID","crypto","bind"],"mappings":"AACA,IAAeA,EAAA,CACbC,WAFmC,oBAAXC,QAA0BA,OAAOD,YAAcC,OAAOD,WAAWE,KAAKD","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
let t;const e=new Uint8Array(16);function o(){if(!t&&(t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!t))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return t(e)}export{o as default};
|
|
2
|
+
//# sourceMappingURL=rng.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rng.js","sources":["../../../../../../../node_modules/uuid/dist/esm-browser/rng.js"],"sourcesContent":["// Unique ID creation requires a high quality random # generator. In the browser we therefore\n// require the crypto API and do not support built-in fallback to lower quality random number\n// generators (like Math.random()).\nlet getRandomValues;\nconst rnds8 = new Uint8Array(16);\nexport default function rng() {\n // lazy load so that environments that need to polyfill have a chance to do so\n if (!getRandomValues) {\n // getRandomValues needs to be invoked in a context where \"this\" is a Crypto implementation.\n getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);\n\n if (!getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n }\n\n return getRandomValues(rnds8);\n}"],"names":["getRandomValues","rnds8","Uint8Array","rng","crypto","bind","Error"],"mappings":"AAGA,IAAIA,EACJ,MAAMC,EAAQ,IAAIC,WAAW,IACd,SAASC,IAEtB,IAAKH,IAEHA,EAAoC,oBAAXI,QAA0BA,OAAOJ,iBAAmBI,OAAOJ,gBAAgBK,KAAKD,SAEpGJ,GACH,MAAM,IAAIM,MAAM,4GAIpB,OAAON,EAAgBC,EACzB","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const t=[];for(let n=0;n<256;++n)t.push((n+256).toString(16).slice(1));function n(n,o=0){return t[n[o+0]]+t[n[o+1]]+t[n[o+2]]+t[n[o+3]]+"-"+t[n[o+4]]+t[n[o+5]]+"-"+t[n[o+6]]+t[n[o+7]]+"-"+t[n[o+8]]+t[n[o+9]]+"-"+t[n[o+10]]+t[n[o+11]]+t[n[o+12]]+t[n[o+13]]+t[n[o+14]]+t[n[o+15]]}export{n as unsafeStringify};
|
|
2
|
+
//# sourceMappingURL=stringify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stringify.js","sources":["../../../../../../../node_modules/uuid/dist/esm-browser/stringify.js"],"sourcesContent":["import validate from './validate.js';\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\n\nconst byteToHex = [];\n\nfor (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n}\n\nexport function unsafeStringify(arr, offset = 0) {\n // Note: Be careful editing this code! It's been tuned for performance\n // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];\n}\n\nfunction stringify(arr, offset = 0) {\n const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one\n // of the following:\n // - One or more input array values don't map to a hex octet (leading to\n // \"undefined\" in the uuid)\n // - Invalid input values for the RFC `version` or `variant` fields\n\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n\n return uuid;\n}\n\nexport default stringify;"],"names":["byteToHex","i","push","toString","slice","unsafeStringify","arr","offset"],"mappings":"AAMA,MAAMA,EAAY,GAElB,IAAK,IAAIC,EAAI,EAAGA,EAAI,MAAOA,EACzBD,EAAUE,MAAMD,EAAI,KAAOE,SAAS,IAAIC,MAAM,IAGzC,SAASC,EAAgBC,EAAKC,EAAS,GAG5C,OAAOP,EAAUM,EAAIC,EAAS,IAAMP,EAAUM,EAAIC,EAAS,IAAMP,EAAUM,EAAIC,EAAS,IAAMP,EAAUM,EAAIC,EAAS,IAAM,IAAMP,EAAUM,EAAIC,EAAS,IAAMP,EAAUM,EAAIC,EAAS,IAAM,IAAMP,EAAUM,EAAIC,EAAS,IAAMP,EAAUM,EAAIC,EAAS,IAAM,IAAMP,EAAUM,EAAIC,EAAS,IAAMP,EAAUM,EAAIC,EAAS,IAAM,IAAMP,EAAUM,EAAIC,EAAS,KAAOP,EAAUM,EAAIC,EAAS,KAAOP,EAAUM,EAAIC,EAAS,KAAOP,EAAUM,EAAIC,EAAS,KAAOP,EAAUM,EAAIC,EAAS,KAAOP,EAAUM,EAAIC,EAAS,IAChf","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import r from"./native.js";import n from"./rng.js";import{unsafeStringify as o}from"./stringify.js";function t(t,m,i){if(r.randomUUID&&!m&&!t)return r.randomUUID();const f=(t=t||{}).random||(t.rng||n)();return f[6]=15&f[6]|64,f[8]=63&f[8]|128,o(f)}export{t as default};
|
|
2
|
+
//# sourceMappingURL=v4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v4.js","sources":["../../../../../../../node_modules/uuid/dist/esm-browser/v4.js"],"sourcesContent":["import native from './native.js';\nimport rng from './rng.js';\nimport { unsafeStringify } from './stringify.js';\n\nfunction v4(options, buf, offset) {\n if (native.randomUUID && !buf && !options) {\n return native.randomUUID();\n }\n\n options = options || {};\n const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n\n rnds[6] = rnds[6] & 0x0f | 0x40;\n rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided\n\n if (buf) {\n offset = offset || 0;\n\n for (let i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n\n return buf;\n }\n\n return unsafeStringify(rnds);\n}\n\nexport default v4;"],"names":["v4","options","buf","offset","native","randomUUID","rnds","random","rng","unsafeStringify"],"mappings":"oGAIA,SAASA,EAAGC,EAASC,EAAKC,GACxB,GAAIC,EAAOC,aAAeH,IAAQD,EAChC,OAAOG,EAAOC,aAIhB,MAAMC,GADNL,EAAUA,GAAW,IACAM,SAAWN,EAAQO,KAAOA,KAe/C,OAbAF,EAAK,GAAe,GAAVA,EAAK,GAAY,GAC3BA,EAAK,GAAe,GAAVA,EAAK,GAAY,IAYpBG,EAAgBH,EACzB","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../../../src/core/utils/appState/peregrineMQ/index.ts"],"sourcesContent":["import { PeregrineMQ } from './peregrineMQ'\n\nexport { PeregrineMQ, PeregrineMQClearError } from './peregrineMQ'\n\nexport const peregrineMQInstance = new PeregrineMQ()\n\nexport default peregrineMQInstance\n"],"names":["peregrineMQInstance","PeregrineMQ"],"mappings":"yGAIaA,EAAsB,IAAIC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import e from"../../../../../node_modules/uuid/dist/esm-browser/v4.js";class t extends Error{constructor(){super("Clearing PeregrineMQ is not allowed. Please read the documentation for more information."),this.name="PeregrineMQClearError"}}class s{constructor(s,n){this.id=void 0,this.config={allowAutoPrune:!1,pruneInterval:1e4,allowClear:!1},this.channels=new Map,this.listeners=new Map,this.addListener=(e,t)=>{const s=this.listeners.get(e),n=this.channels.get(t);n&&(s?s.push(n):this.listeners.set(e,[n]))},this.removeListener=e=>{const t=this.listeners.get(e);let s=!0;for(const n of t||[])if(s=!n.has(e),!s)break;s&&this.listeners.delete(e)},this.publishToChannel=(e,t,s)=>{const n=this.channels.get(e);if(!n)return t;const r=n[Symbol.iterator]();let i=r.next().value;for(;i;)i(e,s),i=r.next().value;return!0},this.configure=e=>{this.config=e;const{allowAutoPrune:t,pruneInterval:s}=e;let n;t&&(n=setInterval((()=>{this.prune()}),s));const r=this;return{...t?{clearPruneInterval:()=>{clearInterval(n)},restartPruneInterval:()=>{clearInterval(n),n=setInterval((()=>{r.prune()}),s)}}:{}}},this.getChannels=()=>[...this.channels.keys()],this.prune=()=>{const e=this.channels[Symbol.iterator]();let t=e.next().value;const s=[];for(;t;)0===t[1]?.size&&(s.push(t[0]),this.channels.delete(t[0])),t=e.next().value;return s},this.removeChannel=e=>{const t=this.channels.get(e);if(t&&t.size>0){const e=[...t||[]];t.clear();let s=e.length;for(;s--;)this.removeListener(e[s])}return this.channels.delete(e)},this.publish=(e,t)=>{if(e.includes(".")){const s=e.split(".");let{length:n}=s,r=!1;for(;n--;){this.publishToChannel(s.slice(0,n+1).join("."),n!==s.length-1,t)||(r=!0)}return!r}return this.publishToChannel(e,!1,t)},this.subscribe=(e,t)=>{const s=this.channels.get(e);return s?s.add(t):this.channels.set(e,new Set([t])),this.addListener(t,e),()=>this.unsubscribe(t,{channel:e,prune:!0})},this.unsubscribe=(e,t)=>{const{channel:s,prune:n}=t||{};let r=!1;if(s){const t=this.channels.get(s);return r=!!t&&t.delete(e),n&&0===t?.size&&this.channels.delete(s),this.removeListener(e),r}const i=this.listeners.get(e)||[];for(const t of i)r=t.delete(e),n&&0===t.size&&this.prune();return this.listeners.delete(e),r},this.isSubscribed=(e,t)=>{if(t){const s=this.channels.get(t);return!!s&&s.has(e)}return this.listeners.has(e)},this.clear=()=>{if(!this.config.allowClear)throw new t;this.channels.clear(),this.listeners.clear()},this.getId=()=>this.id,this.id=s||e(),this.configure(n||{})}get length(){return[...this.channels.values()].reduce(((e,t)=>e+t.size),0)}}export{s as PeregrineMQ,t as PeregrineMQClearError};
|
|
2
|
+
//# sourceMappingURL=peregrineMQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"peregrineMQ.js","sources":["../../../../../../../../src/core/utils/appState/peregrineMQ/peregrineMQ.ts"],"sourcesContent":["import { v4 as uuidv4 } from 'uuid'\n\nimport { Callback, Config, PeregrineMQApi, SubscribersSet, UnsubscribeOptions } from './peregrineMQ.types'\n\n\nexport class PeregrineMQClearError extends Error {\n constructor() {\n super('Clearing PeregrineMQ is not allowed. Please read the documentation for more information.')\n this.name = 'PeregrineMQClearError'\n }\n}\n\n/**\n * Represents a message queue with publish/subscribe functionality.\n */\nexport class PeregrineMQ implements PeregrineMQApi {\n private id: string\n\n private config: Config = {\n allowAutoPrune: false,\n pruneInterval: 10000,\n allowClear: false,\n }\n\n /**\n * The map of channels and their subscribers sets.\n */\n private channels: Map<string, SubscribersSet> = new Map()\n\n /**\n * The map of listeners and their subscribed channels.\n */\n private listeners: Map<Callback, SubscribersSet[]> = new Map()\n\n /**\n * Adds a callback as a listener to a channel.\n * @param callback The callback function to add as a listener.\n * @param channel The channel to add the listener to.\n */\n private addListener = (callback: Callback, channel: string): void => {\n const listener = this.listeners.get(callback)\n const subscribersSet = this.channels.get(channel)\n\n if (subscribersSet) {\n if (listener) {\n listener.push(subscribersSet)\n } else {\n this.listeners.set(callback, [subscribersSet])\n }\n }\n }\n\n /**\n * Removes the callback from the listeners collection if it is not subscribed to any channels.\n * @description Removes the callback only when it is not present in any other subscriberSet\n * (Ref to Map<string, SubscribersSet>).\n * @param callback The callback to remove from listeners.\n */\n private removeListener = (callback: Callback): void => {\n const channelSubscriberSets = this.listeners.get(callback)\n let isEmpty = true\n\n // eslint-disable-next-line no-restricted-syntax\n for (const channelSubscriberSet of channelSubscriberSets || []) {\n isEmpty = !channelSubscriberSet.has(callback)\n if (!isEmpty) {\n break\n }\n }\n\n if (isEmpty) {\n this.listeners.delete(callback)\n }\n }\n\n /**\n * Publishes data to a channel.\n * @param channel The channel to publish the data to.\n * @param isParent Indicates if the channel is a parent channel.\n * @param data The data to publish.\n * @returns A boolean indicating if the publication was successful.\n */\n private publishToChannel = (channel: string, isParent: boolean, data?: unknown): boolean => {\n const subscribersSet = this.channels.get(channel)\n\n if (!subscribersSet) {\n return isParent\n }\n\n const iterator = subscribersSet[Symbol.iterator]()\n let subscriberFunc = iterator.next().value\n\n // eslint-disable-next-line no-plusplus\n while (subscriberFunc) {\n subscriberFunc(channel, data)\n subscriberFunc = iterator.next().value\n }\n return true\n }\n\n /**\n * Creates a new instance of PeregrineMQ.\n * @param id Specific instance of PeregrineMQ identifier\n * @param config The configuration options for PeregrineMQ.\n */\n constructor(id?: string, config?: Config) {\n this.id = id || uuidv4()\n this.configure(config || {})\n }\n\n /**\n * Gets the total number of subscribers across all channels.\n */\n get length(): number {\n return [...this.channels.values()].reduce((acc, subscribersList) => acc + subscribersList.size, 0)\n }\n\n /**\n * Configures PeregrineMQ with the specified options.\n * @param config The configuration options for PeregrineMQ.\n * @returns An object containing the prune interval handler (if auto prune is enabled).\n */\n configure = (config: Config): {\n clearPruneInterval?: () => void\n restartPruneInterval?: () => void\n } => {\n this.config = config\n const { allowAutoPrune, pruneInterval } = config\n\n let pruneIntervalHandler: ReturnType<typeof setInterval>\n\n if (allowAutoPrune) {\n pruneIntervalHandler = setInterval(() => {\n this.prune()\n }, pruneInterval)\n }\n\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const instance: PeregrineMQ = this\n\n return {\n ...(allowAutoPrune\n ? {\n clearPruneInterval: (): void => {\n clearInterval(pruneIntervalHandler)\n },\n restartPruneInterval: (): void => {\n clearInterval(pruneIntervalHandler)\n pruneIntervalHandler = setInterval(() => {\n instance.prune()\n }, pruneInterval)\n },\n }\n : {}),\n }\n }\n\n /**\n * Gets an array of all channels.\n * @returns An array of channel names.\n */\n getChannels = (): string[] => [...this.channels.keys()]\n\n /**\n * Prunes the channels with no subscribers.\n * @returns An array of pruned channel names.\n */\n prune = (): string[] => {\n const iterator = this.channels[Symbol.iterator]()\n let subscribersSet = iterator.next().value\n const prunedChannels: string[] = []\n\n // eslint-disable-next-line no-plusplus\n while (subscribersSet) {\n if (subscribersSet[1]?.size === 0) {\n prunedChannels.push(subscribersSet[0])\n this.channels.delete(subscribersSet[0])\n }\n subscribersSet = iterator.next().value\n }\n\n return prunedChannels\n }\n\n /**\n * Removes a channel and its subscribers.\n * @param channel The channel to remove.\n * @returns A boolean indicating if the channel was successfully removed.\n */\n removeChannel = (channel: string): boolean => {\n const subscribersSet = this.channels.get(channel)\n\n if (subscribersSet && subscribersSet.size > 0) {\n const channelListeners = [...subscribersSet || []]\n\n subscribersSet.clear()\n\n let index = channelListeners.length\n\n // eslint-disable-next-line no-plusplus\n while (index--) {\n this.removeListener(channelListeners[index])\n }\n }\n\n return this.channels.delete(channel)\n }\n\n /**\n * Publishes data to a channel.\n * @param channel The channel to publish the data to.\n * @param data The data to publish.\n * @returns A boolean indicating if the publication was successful.\n */\n publish = <T>(channel: string, data?: T): boolean => {\n if (channel.includes('.')) {\n const nestedChannels = channel.split('.')\n\n let { length } = nestedChannels\n let failed = false\n\n // eslint-disable-next-line no-plusplus\n while (length--) {\n const result = this.publishToChannel(\n nestedChannels.slice(0, length + 1).join('.'),\n length !== nestedChannels.length - 1,\n data,\n )\n\n if (!result) {\n failed = true\n }\n }\n return !failed\n }\n\n return this.publishToChannel(channel, false, data)\n }\n\n /**\n * Subscribes a callback to a channel.\n * @param channel The channel to subscribe to.\n * @param callback The callback function to subscribe.\n * @returns A function to unsubscribe the callback.\n */\n subscribe = (channel: string, callback: Callback): () => boolean => {\n const subscribersList = this.channels.get(channel)\n\n if (subscribersList) {\n subscribersList.add(callback)\n } else {\n this.channels.set(channel, new Set([callback]))\n }\n\n this.addListener(callback, channel)\n\n return () => this.unsubscribe(callback, { channel, prune: true })\n }\n\n /**\n * Unsubscribes a callback from a channel or all channels.\n * @param callback The callback function to unsubscribe.\n * @param options Optional unsubscribe options.\n * @returns A boolean indicating if the callback was successfully unsubscribed.\n */\n unsubscribe = (callback: Callback, options?: UnsubscribeOptions): boolean => {\n const { channel, prune } = options || {}\n\n let unsubscribed = false\n\n if (channel) {\n const subscriberSet = this.channels.get(channel)\n\n unsubscribed = subscriberSet ? subscriberSet.delete(callback) : false\n if (prune && subscriberSet?.size === 0) {\n this.channels.delete(channel)\n }\n\n this.removeListener(callback)\n\n return unsubscribed\n }\n\n const subscriberSetArray = this.listeners.get(callback) || []\n\n // remove callback form listeners and all channels\n // TODO remove only if has\n // eslint-disable-next-line no-restricted-syntax\n for (const subscriberSet of subscriberSetArray) {\n unsubscribed = subscriberSet.delete(callback) as boolean\n\n if (prune && subscriberSet.size === 0) {\n this.prune()\n }\n }\n\n this.listeners.delete(callback)\n\n return unsubscribed\n }\n\n /**\n * Checks if a callback is subscribed to a specific channel or any channel.\n * @param callback The callback function to check.\n * @param channel Optional channel name to check subscription for.\n * @returns A boolean indicating if the callback is subscribed.\n */\n isSubscribed = (callback: Callback, channel?: string): boolean => {\n if (channel) {\n const subscribersList = this.channels.get(channel)\n\n return subscribersList ? subscribersList.has(callback) : false\n }\n\n return this.listeners.has(callback)\n }\n\n /**\n * Clears all channels and listeners.\n * @throws {Error} If clearing PeregrineMQ is not allowed.\n */\n clear = (): void => {\n if (this.config.allowClear) {\n this.channels.clear()\n this.listeners.clear()\n } else {\n throw new PeregrineMQClearError()\n }\n }\n\n /**\n * Returns the specific instance of PeregrineMQ.\n * @returns A string identifier of the specific instance of PeregrineMQ.\n */\n getId = (): string => this.id\n}\n"],"names":["PeregrineMQClearError","Error","constructor","super","this","name","PeregrineMQ","id","config","allowAutoPrune","pruneInterval","allowClear","channels","Map","listeners","addListener","callback","channel","listener","get","subscribersSet","push","set","removeListener","channelSubscriberSets","isEmpty","channelSubscriberSet","has","delete","publishToChannel","isParent","data","iterator","Symbol","subscriberFunc","next","value","configure","pruneIntervalHandler","setInterval","prune","instance","clearPruneInterval","clearInterval","restartPruneInterval","getChannels","keys","prunedChannels","size","removeChannel","channelListeners","clear","index","length","publish","includes","nestedChannels","split","failed","slice","join","subscribe","subscribersList","add","Set","unsubscribe","options","unsubscribed","subscriberSet","subscriberSetArray","isSubscribed","getId","uuidv4","values","reduce","acc"],"mappings":"uEAKO,MAAMA,UAA8BC,MACzCC,WAAAA,GACEC,MAAM,4FACNC,KAAKC,KAAO,uBACd,EAMK,MAAMC,EA0FXJ,WAAAA,CAAYK,EAAaC,GAAiBJ,KAzFlCG,QAAE,EAAAH,KAEFI,OAAiB,CACvBC,gBAAgB,EAChBC,cAAe,IACfC,YAAY,GAGdP,KAGQQ,SAAwC,IAAIC,IAEpDT,KAGQU,UAA6C,IAAID,IAEzDT,KAKQW,YAAc,CAACC,EAAoBC,KACzC,MAAMC,EAAWd,KAAKU,UAAUK,IAAIH,GAC9BI,EAAiBhB,KAAKQ,SAASO,IAAIF,GAErCG,IACEF,EACFA,EAASG,KAAKD,GAEdhB,KAAKU,UAAUQ,IAAIN,EAAU,CAACI,IAElC,EAGFhB,KAMQmB,eAA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AAUK,IAAIH,IAAa,GAK3D,IAAK,MAAMoD,KAAiBC,EAC1BF,EAAeC,EAAcxC,OAAOZ,GAEhCwB,GAAgC,IAAvB4B,EAAcpB,MACzB5C,KAAKoC,QAMT,OAFApC,KAAKU,UAAUc,OAAOZ,GAEfmD,CAAY,EAGrB/D,KAMAkE,aAAe,CAACtD,EAAoBC,KAClC,GAAIA,EAAS,CACX,MAAM6C,EAAkB1D,KAAKQ,SAASO,IAAIF,GAE1C,QAAO6C,GAAkBA,EAAgBnC,IAAIX,EAC/C,CAEA,OAAOZ,KAAKU,UAAUa,IAAIX,EAAS,EAGrCZ,KAIA+C,MAAQ,KACN,IAAI/C,KAAKI,OAAOG,WAId,MAAM,IAAIX,EAHVI,KAAKQ,SAASuC,QACd/C,KAAKU,UAAUqC,OAGjB,EAGF/C,KAIAmE,MAAQ,IAAcnE,KAAKG,GApOzBH,KAAKG,GAAKA,GAAMiE,IAChBpE,KAAKiC,UAAU7B,GAAU,CAAA,EAC3B,CAKA,UAAI6C,GACF,MAAO,IAAIjD,KAAKQ,SAAS6D,UAAUC,QAAO,CAACC,EAAKb,IAAoBa,EAAMb,EAAgBd,MAAM,EAClG"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{classPrivateFieldLooseBase as t,classPrivateFieldLooseKey as e}from"../../../../../_virtual/_rollupPluginBabelHelpers.js";let i=function(t){return t.CHANGE="change",t.TRANSITIONED_TO="transitionedTo",t.TRANSITIONED_FROM="transitionedFrom",t.ADDED_TO_QUEUE="addedToQueue",t.REMOVED_FROM_QUEUE="removedFromQueue",t}({});class s extends Event{constructor(t,e){super(t,e)}}var r=e("name"),n=e("listeners");class a{constructor(e){Object.defineProperty(this,r,{writable:!0,value:void 0}),Object.defineProperty(this,n,{writable:!0,value:void 0}),this.subscribe=e=>(t(this,n)[n].add(e),()=>t(this,n)[n].delete(e)),this.unsubscribe=e=>t(this,n)[n].delete(e),this.publish=e=>{if(t(this,n)[n]?.size)for(const i of t(this,n)[n])i(e)},this.toString=()=>`TinyStateMachineSate: ${t(this,r)[r]}`,t(this,r)[r]=e,t(this,n)[n]=new Set}get name(){return t(this,r)[r]}get[Symbol.toStringTag](){return`TinyStateMachineSate: ${t(this,r)[r]}`}}const o=t=>new Set(t.map((t=>new a(t))));var h=e("states"),l=e("listeners"),u=e("currentState"),d=e("getStateByName"),c=e("getStateByState");class _{constructor(e){Object.defineProperty(this,h,{writable:!0,value:void 0}),Object.defineProperty(this,l,{writable:!0,value:void 0}),Object.defineProperty(this,u,{writable:!0,value:void 0}),this.addState=e=>{t(this,h)[h].add(e)},this.removeState=e=>{t(this,h)[h].delete(e)},this.subscribe=e=>(t(this,l)[l].add(e),()=>t(this,l)[l].delete(e)),this.unsubscribe=e=>{t(this,l)[l].delete(e)},this.publish=(e,i)=>{if(t(this,l)[l]?.size)for(const s of t(this,l)[l])s(e,i)},Object.defineProperty(this,d,{writable:!0,value:e=>Array.from(t(this,h)[h]).find((t=>t.name===e))}),Object.defineProperty(this,c,{writable:!0,value:e=>t(this,h)[h].has(e)?e:void 0}),this.gotoState=e=>{const r="string"==typeof e?t(this,d)[d](e):t(this,c)[c](e);if(!r)throw Error(`TinyStateMachin::gotoState state not found: ${e}`);const n=t(this,u)[u];return t(this,u)[u]=r,this.publish(new s(i.TRANSITIONED_FROM),n),this.publish(new s(i.TRANSITIONED_TO),r),n?.publish(new s(i.TRANSITIONED_FROM)),t(this,u)[u].publish(new s(i.TRANSITIONED_TO)),!0},this.next=()=>{let e;const i=Array.from(t(this,h)[h]);if(!t(this,u)[u])return[e]=i,this.gotoState(e)?e:null;const s=i.findIndex((e=>e===t(this,u)[u]));return s<t(this,h)[h].size-2?(e=i[s+1],this.gotoState(e)?e:null):null},t(this,h)[h]=e,t(this,l)[l]=new Set}get states(){return t(this,h)[h]}get currentState(){return t(this,u)[u]}}const S=function*(){let t,e=S.IS_RUNNING;for(;;)if(t=yield e,t===S.DO_END){e=S.IS_FINITE,yield e;break}return yield*[1,2,3],yield 123,10};S.DO_END="__DO__END__",S.IS_FINITE="__IS__FINITE__",S.IS_RUNNING="__IS__RUNNING__";export{_ as TinyStateMachine,s as TinyStateMachineEvent,i as TinyStateMachineEventType,a as TinyStateMachineState,o as createStates,S as stateIterator};
|
|
2
|
+
//# sourceMappingURL=tiny-state-machine.base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tiny-state-machine.base.js","sources":["../../../../../../../../src/core/utils/appState/stateMachine/tiny-state-machine.base.ts"],"sourcesContent":["export enum TinyStateMachineEventType {\n CHANGE = 'change',\n TRANSITIONED_TO = 'transitionedTo',\n TRANSITIONED_FROM = 'transitionedFrom',\n ADDED_TO_QUEUE = 'addedToQueue',\n REMOVED_FROM_QUEUE = 'removedFromQueue'\n}\n\nexport type TinyStateMachineListenerCallBack = (\n stateEvent: TinyStateMachineEvent,\n state?: ITinyStateMachineState\n) => void;\n\nexport class TinyStateMachineEvent extends Event {\n constructor(type: TinyStateMachineEventType, eventInitDict?: any) {\n super(type, eventInitDict)\n }\n}\n\ninterface IPubSub {\n subscribe: (listener: TinyStateMachineListenerCallBack) => () => void\n unsubscribe: (listener: TinyStateMachineListenerCallBack) => void\n publish: (...args: any[]) => void\n}\n\nexport interface ITinyStateMachineState extends IPubSub {\n name: string\n}\n\nexport class TinyStateMachineState implements ITinyStateMachineState {\n #name: string\n\n #listeners: Set<TinyStateMachineListenerCallBack>\n\n constructor(name: string) {\n this.#name = name\n this.#listeners = new Set<TinyStateMachineListenerCallBack>()\n }\n\n get name(): string {\n return this.#name\n }\n\n subscribe = (listener: TinyStateMachineListenerCallBack): () => void => {\n this.#listeners.add(listener)\n return () => this.#listeners.delete(listener)\n }\n\n unsubscribe = (listener: TinyStateMachineListenerCallBack): boolean => this.#listeners.delete(listener)\n\n publish = (event: TinyStateMachineEvent): void => {\n if (!this.#listeners?.size) {\n return\n }\n // eslint-disable-next-line no-restricted-syntax\n for (const listener of this.#listeners) {\n listener(event)\n }\n }\n\n toString = (): string => `TinyStateMachineSate: ${this.#name}`\n\n get [Symbol.toStringTag](): string {\n return `TinyStateMachineSate: ${this.#name}`\n }\n}\n\nexport interface ITinyStateMachine extends IPubSub {\n states: Set<TinyStateMachineState>\n addState: (state: TinyStateMachineState) => void\n removeState: (state: TinyStateMachineState) => void\n currentState: undefined | TinyStateMachineState\n gotoState: (state: TinyStateMachineState) => void | boolean\n\n}\n\nexport const createStates = (stateNames: string[]): Set<TinyStateMachineState> => new Set(\n stateNames.map((name: string) => new TinyStateMachineState(name)),\n)\n\nexport class TinyStateMachine implements ITinyStateMachine {\n #states: Set<TinyStateMachineState>\n\n #listeners: Set<TinyStateMachineListenerCallBack>\n\n #currentState: undefined | TinyStateMachineState\n\n constructor(states: Set<TinyStateMachineState>) {\n this.#states = states\n this.#listeners = new Set<TinyStateMachineListenerCallBack>()\n }\n\n addState = (state: TinyStateMachineState): void => {\n this.#states.add(state)\n }\n\n removeState = (state: TinyStateMachineState): void => {\n this.#states.delete(state)\n }\n\n get states (): Set<TinyStateMachineState> {\n return this.#states\n }\n\n get currentState (): undefined | TinyStateMachineState {\n return this.#currentState\n }\n\n subscribe = (listener: TinyStateMachineListenerCallBack): () => void => {\n this.#listeners.add(listener)\n return () => this.#listeners.delete(listener)\n }\n\n unsubscribe = (listener: TinyStateMachineListenerCallBack): void => {\n this.#listeners.delete(listener)\n }\n\n publish = (event: TinyStateMachineEvent, state?: TinyStateMachineState): void => {\n if (!this.#listeners?.size) {\n return\n }\n // eslint-disable-next-line no-restricted-syntax\n for (const listener of this.#listeners) {\n listener(event, state)\n }\n }\n\n #getStateByName = (stateName: string): undefined | TinyStateMachineState => Array\n .from(this.#states).find((state: TinyStateMachineState) => state.name === stateName)\n\n #getStateByState\n = (state: TinyStateMachineState): undefined | TinyStateMachineState => (this.#states.has(state) ? state : undefined)\n\n gotoState = (state: TinyStateMachineState | string): void | boolean => {\n const foundState = typeof state === 'string'\n ? this.#getStateByName(state as string)\n : this.#getStateByState(state as TinyStateMachineState)\n\n if (!foundState) {\n throw Error(`TinyStateMachin::gotoState state not found: ${state}`)\n }\n\n const prevState: undefined | TinyStateMachineState = this.#currentState\n\n this.#currentState = foundState\n this.publish(new TinyStateMachineEvent(TinyStateMachineEventType.TRANSITIONED_FROM), prevState)\n this.publish(new TinyStateMachineEvent(TinyStateMachineEventType.TRANSITIONED_TO), foundState)\n\n prevState?.publish(new TinyStateMachineEvent(TinyStateMachineEventType.TRANSITIONED_FROM))\n this.#currentState.publish(new TinyStateMachineEvent(TinyStateMachineEventType.TRANSITIONED_TO))\n return true\n }\n\n next = (): TinyStateMachineState | null => {\n let nextState: TinyStateMachineState\n const arrayOfStates: TinyStateMachineState[] = Array.from(this.#states)\n\n if (!this.#currentState) {\n [nextState] = arrayOfStates\n\n return this.gotoState(nextState) ? nextState : null\n }\n\n const currentStateIndex = arrayOfStates\n .findIndex((state: TinyStateMachineState) => state === this.#currentState)\n\n if (currentStateIndex < this.#states.size - 2) {\n nextState = arrayOfStates[currentStateIndex + 1]\n return this.gotoState(nextState) ? nextState : null\n }\n\n return null\n }\n}\n\n\n\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport const stateIterator = function* () {\n let operation: string\n let state: string = stateIterator.IS_RUNNING\n\n while (true) {\n // console.log('inside while loop')\n\n // // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // // @ts-ignore\n\n\n // // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // // @ts-ignore\n operation = yield state\n\n // // console.log('operation', operation)\n // // console.log('state', state)\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n if (operation === stateIterator.DO_END) {\n state = stateIterator.IS_FINITE\n yield state\n break\n }\n }\n yield* [1, 2, 3]\n yield 123\n\n return 10\n}\n\nstateIterator.DO_END = '__DO__END__'\nstateIterator.IS_FINITE = '__IS__FINITE__'\nstateIterator.IS_RUNNING = '__IS__RUNNING__'\n"],"names":["TinyStateMachineEventType","TinyStateMachineEvent","Event","constructor","type","eventInitDict","super","_name","_classPrivateFieldLooseKey","_listeners","TinyStateMachineState","name","Object","defineProperty","this","writable","value","subscribe","listener","_classPrivateFieldLooseBase","add","delete","unsubscribe","publish","event","size","toString","Set","Symbol","toStringTag","createStates","stateNames","map","_states","_listeners2","_currentState","_getStateByName","_getStateByState","TinyStateMachine","states","addState","state","removeState","stateName","Array","from","find","has","undefined","gotoState","foundState","Error","prevState","TRANSITIONED_FROM","TRANSITIONED_TO","next","nextState","arrayOfStates","currentStateIndex","findIndex","currentState","stateIterator","operation","IS_RUNNING","DO_END","IS_FINITE"],"mappings":"iIAAYA,IAAAA,WAAAA,GAAyB,OAAzBA,EAAyB,OAAA,SAAzBA,EAAyB,gBAAA,iBAAzBA,EAAyB,kBAAA,mBAAzBA,EAAyB,eAAA,eAAzBA,EAAyB,mBAAA,mBAAzBA,CAAyB,EAAA,IAa9B,MAAMC,UAA8BC,MACzCC,WAAAA,CAAYC,EAAiCC,GAC3CC,MAAMF,EAAMC,EACd,EACD,IAAAE,EAAAC,EAAA,QAAAC,EAAAD,EAAA,aAYM,MAAME,EAKXP,WAAAA,CAAYQ,GAAcC,OAAAC,eAAAC,KAAAP,EAAA,CAAAQ,UAAA,EAAAC,WAAA,IAAAJ,OAAAC,eAAAC,KAAAL,EAAA,CAAAM,UAAA,EAAAC,WAAA,IAAAF,KAS1BG,UAAaC,IACXC,EAAAL,KAAIL,GAAAA,GAAYW,IAAIF,GACb,IAAMC,EAAAL,KAAIL,GAAAA,GAAYY,OAAOH,IACrCJ,KAEDQ,YAAeJ,GAAwDC,EAAIL,KAAAL,GAAAA,GAAYY,OAAOH,GAASJ,KAEvGS,QAAWC,IACT,GAAKL,EAAIL,KAAAL,GAAAA,IAAagB,KAItB,IAAK,MAAMP,KAAQC,EAAIL,KAAIL,GAAAA,GACzBS,EAASM,EACX,EACDV,KAEDY,SAAW,IAAc,yBAAAP,EAAyBL,KAAIP,GAAAA,KAzBpDY,OAAIZ,GAAAA,GAASI,EACbQ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OL,KAAIqB,GAAAA,EACb,EAwEW0B,MAAAA,EAAgB,YAC3B,IAAIC,EACArB,EAAgBoB,EAAcE,WAElC,OAeE,GANAD,QAAkBrB,EAMdqB,IAAcD,EAAcG,OAAQ,CACtCvB,EAAQoB,EAAcI,gBAChBxB,EACN,KACF,CAKF,aAHO,CAAC,EAAG,EAAG,SACR,IAEC,EACT,EAEAoB,EAAcG,OAAS,cACvBH,EAAcI,UAAY,iBAC1BJ,EAAcE,WAAa"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{asyncToGenerator as e}from"../../../../../_virtual/_rollupPluginBabelHelpers.js";const
|
|
1
|
+
import{asyncToGenerator as e}from"../../../../../_virtual/_rollupPluginBabelHelpers.js";import{isFunctionAsync as r}from"../../helpers/other.js";const t=(t,o,n)=>{let s=t;const l=new Set,c=()=>s,u=function(){var r=e((function*(e){s=e;for(const e of l){const r=e?.selector,t=r?r(s):s;void 0!==e.previousValue&&e.previousValue===t||(e.previousValue=t,yield e(t))}return s}));return function(e){return r.apply(this,arguments)}}(),i={getState:c,setState:u,subscribe:(e,r)=>{if(r&&e.selector&&e.selector!==r)throw new Error("Error, mismatchm selector, listener.selector !== selector.");return r&&!e.selector&&(e.selector=r),e.selector&&(e.previousValue=e.selector(c())),l.add(e),()=>l.delete(e)},unsubscribe:e=>{l.delete(e)}},a=o?Object.entries(o)?.reduce(((t,o)=>{let[s,l]=o;return{...t,[s]:e((function*(){const e=r(l);e&&u({...c(),[`${s}-error`]:null,[`${s}-pending`]:!0});try{for(var t=arguments.length,o=new Array(t),i=0;i<t;i++)o[i]=arguments[i];const r=yield l(c,u,...o);return n&&u(n(c(),s,...o)),e&&u({...c(),[`${s}-pending`]:!1}),r}catch(r){throw e&&u({...c(),[`${s}-pending`]:!1,[`${s}-error`]:r}),r}}))}}),{}):null,p={...i,...a?{actions:{...a}}:{}};return p};export{t as createStore};
|
|
2
2
|
//# sourceMappingURL=store.vanillajs.js.map
|