@lejdar/webdev 0.0.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.
@@ -0,0 +1,14 @@
1
+ var o = Object.defineProperty;
2
+ var r = (n, t, a) => t in n ? o(n, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : n[t] = a;
3
+ var e = (n, t, a) => r(n, typeof t != "symbol" ? t + "" : t, a);
4
+ class c {
5
+ constructor() {
6
+ // @ts-ignore
7
+ e(this, "context");
8
+ // @ts-ignore
9
+ e(this, "brain");
10
+ }
11
+ }
12
+ export {
13
+ c as BrainContext
14
+ };
@@ -0,0 +1,13 @@
1
+ import { patch as f } from "../util/paths.js";
2
+ function a() {
3
+ function n(t, r, o) {
4
+ return function(c) {
5
+ const e = (o ?? ((p) => p))(c ?? {}), i = new t(e), u = new r(e);
6
+ return f(i, u);
7
+ };
8
+ }
9
+ return n;
10
+ }
11
+ export {
12
+ a as BrainDeveloper
13
+ };
@@ -0,0 +1,20 @@
1
+ import { values as a } from "../primitives/object.js";
2
+ import { flatten as l } from "../util/paths.js";
3
+ import { BrainContext as u } from "./brain-context.js";
4
+ function I() {
5
+ function r(e, m) {
6
+ function i(o) {
7
+ const c = (m ?? ((t) => t))(o ?? {}), n = e(o ?? {}), f = l(n);
8
+ return a(f).filter(
9
+ (t) => t instanceof u
10
+ ).forEach((t) => {
11
+ t.brain = n, t.context = c;
12
+ }), n;
13
+ }
14
+ return i;
15
+ }
16
+ return r;
17
+ }
18
+ export {
19
+ I as BrainImplementor
20
+ };
@@ -0,0 +1,8 @@
1
+ import { BrainContext as o } from "./brain-context.js";
2
+ import { BrainImplementor as m } from "./brain-implementor.js";
3
+ import { BrainDeveloper as p } from "./brain-developer.js";
4
+ export {
5
+ o as BrainContext,
6
+ p as BrainDeveloper,
7
+ m as BrainImplementor
8
+ };
package/dist/index.js ADDED
@@ -0,0 +1,66 @@
1
+ import { default as o, defineComponents as t, defineStyle as s } from "./react/classNames.js";
2
+ import { default as m } from "./react/context.js";
3
+ import { useAsync as a, useAsyncCallback as n, useDebounce as u, usePrevious as x } from "./react/hooks.js";
4
+ import { arraify as i, generate as c, groupBy as d, haveEqualItems as g } from "./primitives/array.js";
5
+ import { construct as b, entries as v, fromEntries as C, isPOJO as O, keys as A, values as B } from "./primitives/object.js";
6
+ import { Result as h } from "./interface/result.js";
7
+ import { useAction as S } from "./interface/operations.js";
8
+ import { useOptionalResult as D, useResult as E } from "./interface/use-result.js";
9
+ import { curry as q } from "./util/curry.js";
10
+ import { memo as J } from "./util/memo.js";
11
+ import { flatten as w, get as z, leafs as F, patch as H, paths as K, unflatten as L } from "./util/paths.js";
12
+ import { Range as N } from "./util/range.js";
13
+ import { Guardian as T } from "./util/guardian.js";
14
+ import { uuid as V } from "uuidv4";
15
+ import { BrainContext as X } from "./brain/brain-context.js";
16
+ import { BrainImplementor as Z } from "./brain/brain-implementor.js";
17
+ import { BrainDeveloper as $ } from "./brain/brain-developer.js";
18
+ import { Aggregate as re } from "./reactive/aggregate.js";
19
+ import { Collection as te } from "./reactive/collection.js";
20
+ import { Store as fe } from "./reactive/store.js";
21
+ import { useCollection as pe, useItem as ae, useObservable as ne, useSuspendedObservable as ue } from "./reactive/reactive-hooks.js";
22
+ export {
23
+ re as Aggregate,
24
+ X as BrainContext,
25
+ $ as BrainDeveloper,
26
+ Z as BrainImplementor,
27
+ te as Collection,
28
+ T as Guardian,
29
+ N as Range,
30
+ h as Result,
31
+ fe as Store,
32
+ i as arraify,
33
+ o as cn,
34
+ b as construct,
35
+ m as createContext,
36
+ q as curry,
37
+ t as defineComponents,
38
+ s as defineStyle,
39
+ v as entries,
40
+ w as flatten,
41
+ C as fromEntries,
42
+ c as generate,
43
+ z as get,
44
+ d as groupBy,
45
+ g as haveEqualItems,
46
+ O as isPOJO,
47
+ A as keys,
48
+ F as leafs,
49
+ J as memo,
50
+ H as patch,
51
+ K as paths,
52
+ L as unflatten,
53
+ S as useAction,
54
+ a as useAsync,
55
+ n as useAsyncCallback,
56
+ pe as useCollection,
57
+ u as useDebounce,
58
+ ae as useItem,
59
+ ne as useObservable,
60
+ D as useOptionalResult,
61
+ x as usePrevious,
62
+ E as useResult,
63
+ ue as useSuspendedObservable,
64
+ V as uuid,
65
+ B as values
66
+ };
@@ -0,0 +1,9 @@
1
+ import { Result as t } from "./result.js";
2
+ import { useAction as s } from "./operations.js";
3
+ import { useOptionalResult as l, useResult as p } from "./use-result.js";
4
+ export {
5
+ t as Result,
6
+ s as useAction,
7
+ l as useOptionalResult,
8
+ p as useResult
9
+ };
@@ -0,0 +1,17 @@
1
+ import { useState as l, useCallback as c } from "react";
2
+ import { Result as m } from "./result.js";
3
+ import { useOptionalResult as f } from "./use-result.js";
4
+ function g(t, o) {
5
+ const [r, { reset: n, set: a }] = f(), [u, e] = l(!1);
6
+ return [c(
7
+ async (...i) => {
8
+ e(!0);
9
+ const s = await t(...i).then(m.backlink);
10
+ return a(s), e(!1), s;
11
+ },
12
+ [t, ...o]
13
+ ), r, { reset: n, isLoading: u }];
14
+ }
15
+ export {
16
+ g as useAction
17
+ };
@@ -0,0 +1,34 @@
1
+ import "react";
2
+ var t;
3
+ ((r) => {
4
+ r.ok = (e) => ({
5
+ ok: !0,
6
+ data: e,
7
+ serialized: {
8
+ ok: !0,
9
+ data: e
10
+ },
11
+ get result() {
12
+ return this;
13
+ }
14
+ }), r.fail = (e) => ({
15
+ ok: !1,
16
+ error: e,
17
+ serialized: {
18
+ ok: !1,
19
+ error: e
20
+ },
21
+ get result() {
22
+ return this;
23
+ }
24
+ }), r.backlink = (e) => ({
25
+ ...e,
26
+ serialized: e,
27
+ get result() {
28
+ return this;
29
+ }
30
+ });
31
+ })(t || (t = {}));
32
+ export {
33
+ t as Result
34
+ };
@@ -0,0 +1,23 @@
1
+ import { useState as a, useCallback as o } from "react";
2
+ import { Result as e } from "./result.js";
3
+ function R(c) {
4
+ const [u, n] = a(
5
+ c && e.backlink(c)
6
+ ), s = o((t) => (n(e.backlink(t)), t), []), k = o((t) => s(e.ok(t)), [s]), l = o(
7
+ (t) => s(e.fail(t)),
8
+ []
9
+ );
10
+ return [u, { set: s, success: k, error: l }];
11
+ }
12
+ function i(c) {
13
+ const [u, n] = a(
14
+ c ? e.backlink(c) : void 0
15
+ ), s = o((r) => (n(e.backlink(r)), r), []), k = o((r) => s(e.ok(r)), [s]), l = o((r) => s(e.fail(r)), [s]), t = o(() => {
16
+ n(void 0);
17
+ }, [n]);
18
+ return [u, { set: s, reset: t, success: k, error: l }];
19
+ }
20
+ export {
21
+ i as useOptionalResult,
22
+ R as useResult
23
+ };
@@ -0,0 +1,29 @@
1
+ function a(r, e) {
2
+ const n = [];
3
+ for (let t = 0; t < r; t++)
4
+ n.push(e(t));
5
+ return n;
6
+ }
7
+ function f(r, e, n = Object.is) {
8
+ return r.length !== e.length ? !1 : r.findIndex((t, o) => !n(t, e[o])) === -1;
9
+ }
10
+ function s(r) {
11
+ return Array.isArray(r) ? r : typeof r == "object" && r && Symbol.iterator in r ? (
12
+ // @ts-ignore
13
+ [...r]
14
+ ) : [r];
15
+ }
16
+ function c(r, e) {
17
+ const n = /* @__PURE__ */ new Map();
18
+ for (const t of r) {
19
+ const o = e(t), u = [...n.get(o) ?? [], t];
20
+ n.set(o, u);
21
+ }
22
+ return [...n.values()];
23
+ }
24
+ export {
25
+ s as arraify,
26
+ a as generate,
27
+ c as groupBy,
28
+ f as haveEqualItems
29
+ };
@@ -0,0 +1,26 @@
1
+ function e(t) {
2
+ return [...Object.keys(t)];
3
+ }
4
+ function n(t) {
5
+ return [...Object.values(t)];
6
+ }
7
+ function r(t) {
8
+ return Object.entries(t);
9
+ }
10
+ function u(t) {
11
+ return Object.fromEntries(t);
12
+ }
13
+ function c(t) {
14
+ return typeof t == "object" && t !== null && Object.getPrototypeOf(t) === Object.prototype;
15
+ }
16
+ function o(t) {
17
+ return new t();
18
+ }
19
+ export {
20
+ o as construct,
21
+ r as entries,
22
+ u as fromEntries,
23
+ c as isPOJO,
24
+ e as keys,
25
+ n as values
26
+ };
@@ -0,0 +1,14 @@
1
+ import { arraify as t, generate as o, groupBy as s, haveEqualItems as a } from "./array.js";
2
+ import { construct as i, entries as m, fromEntries as n, isPOJO as u, keys as p, values as y } from "./object.js";
3
+ export {
4
+ t as arraify,
5
+ i as construct,
6
+ m as entries,
7
+ n as fromEntries,
8
+ o as generate,
9
+ s as groupBy,
10
+ a as haveEqualItems,
11
+ u as isPOJO,
12
+ p as keys,
13
+ y as values
14
+ };
@@ -0,0 +1,44 @@
1
+ import { twMerge as d } from "tailwind-merge";
2
+ import { entries as p, isPOJO as i } from "../primitives/object.js";
3
+ function u(...r) {
4
+ let n = r.flat(5).filter((e) => !!e).map((e) => typeof e == "string" ? e : Object.entries(e).filter(([, t]) => t).map(([t]) => t)).flat(1);
5
+ return d(n);
6
+ }
7
+ function l(r) {
8
+ return r.reduce((n, e) => e ? [
9
+ ...n,
10
+ ...typeof e == "object" ? p(e).filter(([, t]) => t).map(([t]) => t) : [e]
11
+ ] : n, []);
12
+ }
13
+ function h(r, n = {}) {
14
+ const e = {}, t = {};
15
+ return p(n).map(([o, f]) => {
16
+ for (const s in f)
17
+ t[o] ?? (t[o] = {}), t[o][s] = u(
18
+ t[o][s],
19
+ f[s]
20
+ );
21
+ }), p(r).map(([o, f]) => {
22
+ e[o] = u(e[o], f);
23
+ }), (...o) => {
24
+ const f = l(o).map((c) => n[c]).map(p).flat(), s = { ...e };
25
+ for (const [c, m] of f)
26
+ s[c] = u(s[c], m);
27
+ return s;
28
+ };
29
+ }
30
+ function N(...r) {
31
+ return (...n) => {
32
+ const e = [], t = l(n);
33
+ for (const o of r)
34
+ i(o) ? t.forEach(
35
+ (f) => e.push(o[f])
36
+ ) : e.push(o);
37
+ return u(...e);
38
+ };
39
+ }
40
+ export {
41
+ u as default,
42
+ h as defineComponents,
43
+ N as defineStyle
44
+ };
@@ -0,0 +1,35 @@
1
+ import n, { createElement as m } from "react";
2
+ import { assert as s } from "../util/assert.js";
3
+ import { Result as c } from "../interface/result.js";
4
+ const r = Symbol("empty-context");
5
+ function f(u) {
6
+ const { initial: i, debugName: t, mapProps: a = (e) => e } = u, o = n.createContext(
7
+ i ?? r
8
+ );
9
+ return {
10
+ context: o,
11
+ useContext() {
12
+ const e = n.useContext(o);
13
+ return s(
14
+ e !== r,
15
+ `No context Provider found in component tree ${t && `(${t})`}`
16
+ ), e;
17
+ },
18
+ useSafe() {
19
+ const e = n.useContext(o);
20
+ return e === r ? c.fail(
21
+ `No context Provider found in component tree ${t && `(${t})`}`
22
+ ) : c.ok(e);
23
+ },
24
+ Provider(e) {
25
+ return m(o.Provider, {
26
+ value: a(e),
27
+ children: e.children
28
+ });
29
+ }
30
+ };
31
+ }
32
+ export {
33
+ f as default,
34
+ r as emptyContext
35
+ };
@@ -0,0 +1,42 @@
1
+ import { useMemo as a, use as f, useState as l, useCallback as b, useRef as m, useEffect as c } from "react";
2
+ import { Subject as p, debounceTime as d } from "rxjs";
3
+ function g(e, s = [e]) {
4
+ const t = a(
5
+ e instanceof Promise ? () => e : e,
6
+ s
7
+ );
8
+ return f(t);
9
+ }
10
+ function x(e, s = [e]) {
11
+ const [t, n] = l({
12
+ isIdle: !0,
13
+ isLoading: !1
14
+ });
15
+ return [b(async (...o) => {
16
+ n({ isLoading: !0, isIdle: !1 });
17
+ const i = await e(...o);
18
+ return n({ isLoading: !1, isIdle: !1, result: i }), i;
19
+ }, s), t];
20
+ }
21
+ const u = Symbol("none");
22
+ function I(e) {
23
+ const s = m(u);
24
+ c(() => {
25
+ s.current = e;
26
+ }, []);
27
+ const t = s.current === u ? void 0 : s.current, n = s.current !== u;
28
+ return [t, n];
29
+ }
30
+ function L(e, s) {
31
+ const [t, n] = l(e), r = a(() => new p(), []);
32
+ return c(() => r.next(e), [r, e]), c(() => {
33
+ const o = r.pipe(d(s)).subscribe(n);
34
+ return () => o.unsubscribe();
35
+ }, [r]), t;
36
+ }
37
+ export {
38
+ g as useAsync,
39
+ x as useAsyncCallback,
40
+ L as useDebounce,
41
+ I as usePrevious
42
+ };
@@ -0,0 +1,13 @@
1
+ import { default as s, defineComponents as t, defineStyle as n } from "./classNames.js";
2
+ import { default as u } from "./context.js";
3
+ import { useAsync as f, useAsyncCallback as c, useDebounce as l, usePrevious as d } from "./hooks.js";
4
+ export {
5
+ s as cn,
6
+ u as createContext,
7
+ t as defineComponents,
8
+ n as defineStyle,
9
+ f as useAsync,
10
+ c as useAsyncCallback,
11
+ l as useDebounce,
12
+ d as usePrevious
13
+ };
@@ -0,0 +1,28 @@
1
+ var a = Object.defineProperty;
2
+ var n = (m, e, t) => e in m ? a(m, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : m[e] = t;
3
+ var r = (m, e, t) => n(m, typeof e != "symbol" ? e + "" : e, t);
4
+ import { combineLatest as h, map as u } from "rxjs";
5
+ import { memo as f } from "../util/memo.js";
6
+ import { Collection as g } from "./collection.js";
7
+ class _ extends g {
8
+ constructor(t, o) {
9
+ super();
10
+ // TODO: Weaken - check weakmap functionality
11
+ r(this, "_cache", /* @__PURE__ */ new WeakMap());
12
+ r(this, "items");
13
+ const i = o.map((s) => s.watch());
14
+ this.items = h(i).pipe(
15
+ u(
16
+ (s) => t(...s).map(
17
+ ({ item: c, dependencies: p }) => this.memo(c, p)
18
+ )
19
+ )
20
+ );
21
+ }
22
+ memo(t, o) {
23
+ return f(t, o, this._cache);
24
+ }
25
+ }
26
+ export {
27
+ _ as Aggregate
28
+ };
@@ -0,0 +1,38 @@
1
+ var c = Object.defineProperty;
2
+ var f = (i, t, e) => t in i ? c(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
3
+ var s = (i, t, e) => f(i, typeof t != "symbol" ? t + "" : t, e);
4
+ import { of as p, map as r, distinctUntilChanged as a, tap as d, firstValueFrom as l } from "rxjs";
5
+ class m {
6
+ static from(t) {
7
+ return new class extends m {
8
+ constructor() {
9
+ super(...arguments);
10
+ s(this, "items", p(t));
11
+ }
12
+ }();
13
+ }
14
+ watchOne(t) {
15
+ return this.items.pipe(
16
+ r((e) => e.find(t) ?? null),
17
+ a()
18
+ );
19
+ }
20
+ watch(t) {
21
+ return this.items.pipe(
22
+ t ? r((e) => e.filter(t)) : d(),
23
+ // TODO: Test this behavior
24
+ a(
25
+ (e, n) => e.length === n.length && e.every((h, u) => h === n[u])
26
+ )
27
+ );
28
+ }
29
+ async find(t) {
30
+ return (await l(this.items)).find(t) ?? null;
31
+ }
32
+ async list(t) {
33
+ return (await l(this.items)).filter(t ?? (() => !0));
34
+ }
35
+ }
36
+ export {
37
+ m as Collection
38
+ };
@@ -0,0 +1,29 @@
1
+ import { ObservableResource as o, useObservableSuspense as c } from "observable-hooks";
2
+ import { useMemo as u, useState as f, useEffect as i } from "react";
3
+ function r(e) {
4
+ const t = u(
5
+ () => new o(e),
6
+ [e]
7
+ );
8
+ return c(t);
9
+ }
10
+ function p(e) {
11
+ const [t, s] = f(null);
12
+ return i(() => {
13
+ e.subscribe(s);
14
+ }, [e]), t;
15
+ }
16
+ function b(e, t, s = []) {
17
+ const n = u(() => e.watch(t), []);
18
+ return r(n);
19
+ }
20
+ function d(e, t, s = []) {
21
+ const n = u(() => e.watchOne(t), []);
22
+ return r(n);
23
+ }
24
+ export {
25
+ b as useCollection,
26
+ d as useItem,
27
+ p as useObservable,
28
+ r as useSuspendedObservable
29
+ };
@@ -0,0 +1,13 @@
1
+ import { Aggregate as r } from "./aggregate.js";
2
+ import { Collection as s } from "./collection.js";
3
+ import { Store as m } from "./store.js";
4
+ import { useCollection as u, useItem as b, useObservable as f, useSuspendedObservable as x } from "./reactive-hooks.js";
5
+ export {
6
+ r as Aggregate,
7
+ s as Collection,
8
+ m as Store,
9
+ u as useCollection,
10
+ b as useItem,
11
+ f as useObservable,
12
+ x as useSuspendedObservable
13
+ };
@@ -0,0 +1,30 @@
1
+ var o = Object.defineProperty;
2
+ var h = (s, e, t) => e in s ? o(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
+ var a = (s, e, t) => h(s, typeof e != "symbol" ? e + "" : e, t);
4
+ import { BehaviorSubject as m } from "rxjs";
5
+ import { Collection as n } from "./collection.js";
6
+ class c extends n {
7
+ constructor(t = []) {
8
+ super();
9
+ a(this, "items");
10
+ this.items = new m([]);
11
+ }
12
+ get state() {
13
+ return this.items.value;
14
+ }
15
+ set state(t) {
16
+ this.items.next(t);
17
+ }
18
+ add(t) {
19
+ return this.items.next([...this.items.value, t]), t;
20
+ }
21
+ update(t, i) {
22
+ this.state = this.state.map((r) => t(r) ? i(r) : r);
23
+ }
24
+ remove(t) {
25
+ this.state = this.state.filter((i) => !t(i));
26
+ }
27
+ }
28
+ export {
29
+ c as Store
30
+ };
@@ -0,0 +1,6 @@
1
+ function r(t, o) {
2
+ if (!t) throw o;
3
+ }
4
+ export {
5
+ r as assert
6
+ };
@@ -0,0 +1,12 @@
1
+ import { generate as o, arraify as r } from "../primitives/array.js";
2
+ function f(n, a, m = []) {
3
+ if (a ?? (a = o(n.length, (t) => t)), m.length < a.length)
4
+ return (...t) => f(n, a, [...m, t]);
5
+ const g = m.map(r), s = a.map(
6
+ (t, p) => r(t).map((e, l) => [e, g[p][l]])
7
+ ).flat(1).sort(([t], [p]) => t - p).map(([, t]) => t);
8
+ return n(...s);
9
+ }
10
+ export {
11
+ f as curry
12
+ };
@@ -0,0 +1,18 @@
1
+ function G(d, t) {
2
+ function v(u, c) {
3
+ return (...r) => {
4
+ const e = d(...c), f = ({ ok: a, data: _, result: s }) => (n.data = _ ?? null, a ? u == null ? void 0 : u(...r) : (t != null && t.alwaysRun && (u == null || u(...r)), s));
5
+ return e instanceof Promise ? e.then(f) : f(e);
6
+ };
7
+ }
8
+ function n(...u) {
9
+ return (c, r, e) => {
10
+ e.value = v(e.value, u);
11
+ };
12
+ }
13
+ return n;
14
+ }
15
+ const h = G;
16
+ export {
17
+ h as Guardian
18
+ };
@@ -0,0 +1,11 @@
1
+ const e = Symbol("value");
2
+ function g(o, r, t) {
3
+ if (r.length) {
4
+ const [n, ...s] = r;
5
+ return t.has(n) || t.set(n, /* @__PURE__ */ new WeakMap()), g(o, s, t.get(n));
6
+ }
7
+ return t.has(e) ? t.get(e) : t.set(e, o).get(e);
8
+ }
9
+ export {
10
+ g as memo
11
+ };
@@ -0,0 +1,51 @@
1
+ import { keys as c, isPOJO as u, construct as l } from "../primitives/object.js";
2
+ function* h(n, s = [], t = "") {
3
+ for (const e of c(n)) {
4
+ const o = n[e];
5
+ yield `${t}${e}`, u(o) && // @ts-ignore
6
+ !s.some((f) => o instanceof f) && (yield* h(o, s, `${t}${e}.`));
7
+ }
8
+ }
9
+ function* a(n, s = [], t = "") {
10
+ for (const e of c(n)) {
11
+ const o = n[e];
12
+ u(o) && // @ts-ignore
13
+ !s.some((f) => o instanceof f) ? yield* a(o, s, `${t}${e}.`) : yield `${t}${e}`;
14
+ }
15
+ }
16
+ function $(n, s) {
17
+ let [t, ...e] = Array.isArray(s) ? s : s.split(".");
18
+ if (!t) return n;
19
+ for (; e.length; ) {
20
+ if (t in n)
21
+ return $(n[t], e);
22
+ t = `${t}.${e.shift()}`;
23
+ }
24
+ return n[t];
25
+ }
26
+ function r(n, s = []) {
27
+ return l(function() {
28
+ for (const t of a(n, s))
29
+ this[t] = $(n, t);
30
+ });
31
+ }
32
+ function y(n) {
33
+ return l(function() {
34
+ const s = r(n);
35
+ for (const t of c(s)) {
36
+ const e = t.split("."), o = e.slice(0, -1).reduce((f, i) => f[i] ?? (f[i] = {}), this);
37
+ o[e.at(-1)] = s[t];
38
+ }
39
+ });
40
+ }
41
+ function d(n, s) {
42
+ return y({ ...r(n), ...r(s) });
43
+ }
44
+ export {
45
+ r as flatten,
46
+ $ as get,
47
+ a as leafs,
48
+ d as patch,
49
+ h as paths,
50
+ y as unflatten
51
+ };
@@ -0,0 +1,30 @@
1
+ var c = Object.defineProperty;
2
+ var f = (r, t, o) => t in r ? c(r, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : r[t] = o;
3
+ var n = (r, t, o) => f(r, typeof t != "symbol" ? t + "" : t, o);
4
+ import { generate as m } from "../primitives/array.js";
5
+ class e {
6
+ constructor(...t) {
7
+ // @ts-ignore
8
+ n(this, "from");
9
+ // @ts-ignore
10
+ n(this, "to");
11
+ // @ts-ignore
12
+ n(this, "range");
13
+ if (t instanceof e) return t;
14
+ const [o, s] = t.flat();
15
+ this.from = o, this.to = s, this.range = m(s - o + 1, (a) => a + o);
16
+ }
17
+ [Symbol.iterator]() {
18
+ return this.range[Symbol.iterator]();
19
+ }
20
+ toArray() {
21
+ return this.range;
22
+ }
23
+ contains(t) {
24
+ const o = t instanceof e ? t.from : t, s = t instanceof e ? t.to : t;
25
+ return o >= this.from && s <= this.to;
26
+ }
27
+ }
28
+ export {
29
+ e as Range
30
+ };
@@ -0,0 +1,19 @@
1
+ import { curry as t } from "./curry.js";
2
+ import { memo as f } from "./memo.js";
3
+ import { flatten as m, get as p, leafs as x, patch as n, paths as u, unflatten as l } from "./paths.js";
4
+ import { Range as d } from "./range.js";
5
+ import { Guardian as h } from "./guardian.js";
6
+ import { uuid as s } from "uuidv4";
7
+ export {
8
+ h as Guardian,
9
+ d as Range,
10
+ t as curry,
11
+ m as flatten,
12
+ p as get,
13
+ x as leafs,
14
+ f as memo,
15
+ n as patch,
16
+ u as paths,
17
+ l as unflatten,
18
+ s as uuid
19
+ };
package/package.json ADDED
@@ -0,0 +1,97 @@
1
+ {
2
+ "name": "@lejdar/webdev",
3
+ "version": "0.0.1",
4
+ "type": "module",
5
+ "files": [
6
+ "dist",
7
+ "index.d.ts"
8
+ ],
9
+ "publishConfig": {
10
+ "access": "public"
11
+ },
12
+ "main": "./dist/index.cjs",
13
+ "module": "./dist/index.js",
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "import": "./dist/index.js",
18
+ "require": "./dist/index.js",
19
+ "default": "./dist/index.js"
20
+ },
21
+ "./react": {
22
+ "types": "./dist/react/react.d.ts",
23
+ "import": "./dist/react/react.js",
24
+ "require": "./dist/react/react.js",
25
+ "default": "./dist/react/react.js"
26
+ },
27
+ "./interface": {
28
+ "types": "./dist/interface/interface.d.ts",
29
+ "import": "./dist/interface/interface.js",
30
+ "require": "./dist/interface/interface.js",
31
+ "default": "./dist/interface/interface.js"
32
+ },
33
+ "./util": {
34
+ "types": "./dist/util/util.d.ts",
35
+ "import": "./dist/util/util.js",
36
+ "require": "./dist/util/util.js",
37
+ "default": "./dist/util/util.js"
38
+ },
39
+ "./primitives": {
40
+ "types": "./dist/primitives/primitives.d.ts",
41
+ "import": "./dist/primitives/primitives.js",
42
+ "require": "./dist/primitives/primitives.js",
43
+ "default": "./dist/primitives/primitives.js"
44
+ },
45
+ "./brain": {
46
+ "types": "./dist/brain/brain.d.ts",
47
+ "import": "./dist/brain/brain.js",
48
+ "require": "./dist/brain/brain.js",
49
+ "default": "./dist/brain/brain.js"
50
+ }
51
+ },
52
+ "scripts": {
53
+ "dev": "vite",
54
+ "build": "vite builde",
55
+ "build:watch": "node build.js",
56
+ "test": "vitest ",
57
+ "test:ui": "vitest --ui --coverage",
58
+ "deploy": "pnpm build && pnpm publish"
59
+ },
60
+ "devDependencies": {
61
+ "@rollup/plugin-typescript": "^12.1.4",
62
+ "@testing-library/jest-dom": "^6.6.3",
63
+ "@testing-library/react": "^16.3.0",
64
+ "@types/react": "^19.2.2",
65
+ "@types/react-dom": "^19.2.2",
66
+ "@typescript/native-preview": "7.0.0-dev.20250908.1",
67
+ "@vitest/coverage-v8": "3.1.1",
68
+ "@vitest/ui": "^3.1.1",
69
+ "jsdom": "^26.1.0",
70
+ "react-dom": "^19.1.0",
71
+ "rxjs": "^7.8.2",
72
+ "typescript": "~5.7.3",
73
+ "vite": "^6.1.1",
74
+ "vitest": "^3.1.1"
75
+ },
76
+ "peerDependencies": {
77
+ "@types/react": "^19.2.2",
78
+ "@types/react-dom": "^19.2.2",
79
+ "react": "^19.1.0",
80
+ "react-dom": "^19.1.0",
81
+ "rxjs": "^7.8.2"
82
+ },
83
+ "dependencies": {
84
+ "@types/assert": "^1.5.11",
85
+ "@types/node": "^22.14.1",
86
+ "assert": "^2.1.0",
87
+ "observable-hooks": "^4.2.4",
88
+ "path": "^0.12.7",
89
+ "react": "^19.1.0",
90
+ "rollup-plugin-dts": "^6.2.1",
91
+ "sift": "^17.1.3",
92
+ "tailwind-merge": "^3.2.0",
93
+ "uuidv4": "^6.2.13",
94
+ "vite-plugin-dts": "^4.5.3",
95
+ "watch": "^1.0.2"
96
+ }
97
+ }