@manyducks.co/dolla 2.0.0-alpha.57 → 2.0.0-alpha.59

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.
Files changed (39) hide show
  1. package/dist/core/app.d.ts +17 -0
  2. package/dist/core/context.d.ts +71 -19
  3. package/dist/core/index.d.ts +3 -3
  4. package/dist/core/logger.d.ts +2 -2
  5. package/dist/core/markup.d.ts +14 -13
  6. package/dist/core/mount.d.ts +2 -2
  7. package/dist/core/nodes/dom.d.ts +3 -2
  8. package/dist/core/nodes/dynamic.d.ts +2 -1
  9. package/dist/core/nodes/html.d.ts +7 -5
  10. package/dist/core/nodes/portal.d.ts +4 -3
  11. package/dist/core/nodes/repeat.d.ts +5 -3
  12. package/dist/core/nodes/view.d.ts +6 -8
  13. package/dist/core/signals.d.ts +3 -23
  14. package/dist/core/views/default-crash-view.d.ts +12 -1
  15. package/dist/i18n.js +1 -1
  16. package/dist/index.js +87 -88
  17. package/dist/index.js.map +1 -1
  18. package/dist/jsx-dev-runtime.d.ts +2 -1
  19. package/dist/jsx-dev-runtime.js +4 -11
  20. package/dist/jsx-dev-runtime.js.map +1 -1
  21. package/dist/jsx-runtime.d.ts +3 -2
  22. package/dist/jsx-runtime.js +7 -13
  23. package/dist/jsx-runtime.js.map +1 -1
  24. package/dist/logger-Ck_9LCem.js +516 -0
  25. package/dist/logger-Ck_9LCem.js.map +1 -0
  26. package/dist/markup-BBa4WBj1.js +1019 -0
  27. package/dist/markup-BBa4WBj1.js.map +1 -0
  28. package/dist/{router-ClSFnmRK.js → router-CaR7Xd4T.js} +77 -76
  29. package/dist/router-CaR7Xd4T.js.map +1 -0
  30. package/dist/router.js +1 -1
  31. package/dist/types.d.ts +7 -0
  32. package/docs/markup.md +4 -4
  33. package/notes/observable.md +180 -0
  34. package/package.json +2 -2
  35. package/dist/logger-sSxIw5od.js +0 -626
  36. package/dist/logger-sSxIw5od.js.map +0 -1
  37. package/dist/markup-CAJd0zdA.js +0 -937
  38. package/dist/markup-CAJd0zdA.js.map +0 -1
  39. package/dist/router-ClSFnmRK.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,14 +1,14 @@
1
- import { o as h } from "./logger-sSxIw5od.js";
2
- import { $ as k, f as D, d as F, e as I, g as _, b as q, p as v, c as B, h as V, i as $, s as P, a as S } from "./logger-sSxIw5od.js";
3
- import { m as t, w as y, C as s, L as i, r as u } from "./markup-CAJd0zdA.js";
4
- import { c as z, p as A, a as Y, u as G } from "./markup-CAJd0zdA.js";
5
- import { R as p, M as w, U as b } from "./router-ClSFnmRK.js";
1
+ import { o as g } from "./logger-Ck_9LCem.js";
2
+ import { $ as L, b as T, h as q, d as B, e as $, g as v, c as O, f as P, i as S, j as z, s as A, a as D, u as I } from "./logger-Ck_9LCem.js";
3
+ import { M as h, m as t, w, C as n, V as c } from "./markup-BBa4WBj1.js";
4
+ import { c as j, p as G, r as W, a as _, u as H } from "./markup-BBa4WBj1.js";
5
+ import { R as y, M as p, U as b } from "./router-CaR7Xd4T.js";
6
6
  import { a as x } from "./typeChecking-BJ-ymQ2F.js";
7
- const c = Symbol("Ref.EMPTY");
8
- function C(e = c) {
7
+ const u = Symbol("Ref.EMPTY");
8
+ function N(e = u) {
9
9
  return function() {
10
10
  if (arguments.length === 0) {
11
- if (e === c)
11
+ if (e === u)
12
12
  throw new Error("Ref getter was called, but ref has no value! Be sure to set your refs before accessing them.");
13
13
  } else if (arguments.length === 1)
14
14
  e = arguments[0];
@@ -18,99 +18,98 @@ function C(e = c) {
18
18
  };
19
19
  }
20
20
  function E(e) {
21
- return t(
22
- "div",
23
- {
24
- style: {
25
- backgroundColor: "#880000",
26
- color: "#fff",
27
- padding: "2rem",
28
- position: "fixed",
29
- inset: 0,
30
- fontSize: "20px"
31
- }
21
+ return new h("div", {
22
+ style: {
23
+ backgroundColor: "#880000",
24
+ color: "#fff",
25
+ padding: "2rem",
26
+ position: "fixed",
27
+ inset: 0,
28
+ fontSize: "20px"
32
29
  },
33
- t("h1", { style: { marginBottom: "0.5rem" } }, "The app has crashed"),
34
- t(
35
- "p",
36
- { style: { marginBottom: "0.25rem" } },
37
- t("span", { style: { fontFamily: "monospace" } }, e.loggerName),
38
- y(
39
- e.tag,
40
- t(
41
- "span",
42
- { style: { fontFamily: "monospace", opacity: 0.5 } },
43
- ` [${e.tagName ? `${e.tagName}: ` : ""}${e.tag}]`
44
- )
45
- ),
46
- " says:"
47
- ),
48
- t(
49
- "blockquote",
50
- {
30
+ children: [
31
+ t("h1", { style: { marginBottom: "0.5rem" }, children: "The app has crashed" }),
32
+ t("p", {
33
+ style: { marginBottom: "0.25rem" },
34
+ children: [
35
+ t("span", {
36
+ style: { fontFamily: "monospace" },
37
+ children: e.loggerName
38
+ }),
39
+ w(
40
+ e.tag,
41
+ t("span", {
42
+ style: { fontFamily: "monospace", opacity: 0.5 },
43
+ children: ` [${e.tagName ? `${e.tagName}: ` : ""}${e.tag}]`
44
+ })
45
+ ),
46
+ " says:"
47
+ ]
48
+ }),
49
+ t("blockquote", {
51
50
  style: {
52
51
  backgroundColor: "#991111",
53
52
  padding: "0.25em",
54
53
  borderRadius: "6px",
55
54
  fontFamily: "monospace",
56
55
  marginBottom: "1rem"
57
- }
58
- },
59
- t(
60
- "span",
61
- {
62
- style: {
63
- display: "inline-block",
64
- backgroundColor: "red",
65
- padding: "0.1em 0.4em",
66
- marginRight: "0.5em",
67
- borderRadius: "4px",
68
- fontSize: "0.9em",
69
- fontWeight: "bold"
70
- }
71
56
  },
72
- e.error.name
73
- ),
74
- e.error.message
75
- ),
76
- t("p", {}, "Please see the browser console for details.")
77
- );
57
+ children: [
58
+ t("span", {
59
+ style: {
60
+ display: "inline-block",
61
+ backgroundColor: "red",
62
+ padding: "0.1em 0.4em",
63
+ marginRight: "0.5em",
64
+ borderRadius: "4px",
65
+ fontSize: "0.9em",
66
+ fontWeight: "bold"
67
+ },
68
+ children: e.error.name
69
+ }),
70
+ e.error.message
71
+ ]
72
+ }),
73
+ t("p", { children: "Please see the browser console for details." })
74
+ ]
75
+ });
78
76
  }
79
- let o = !1;
80
- async function R(e, n, r) {
81
- if (x(Element, n, "Expected an element or a selector string. Got type: %t, value: %v"), o)
77
+ let s = !1;
78
+ async function U(e, o, r) {
79
+ if (x(Element, o, "Expected an element or a selector string. Got type: %t, value: %v"), s)
82
80
  throw new Error("A Dolla app is already mounted.");
83
- let m, l, g = (r == null ? void 0 : r.crashView) ?? E;
84
- const a = (r == null ? void 0 : r.context) ?? new s("App");
85
- h((d) => {
86
- o && f(), u(t(g, d), a).mount(n);
87
- }), s.emit(i.WILL_MOUNT, a), e instanceof p ? (l = e, m = await l[w](n, a)) : m = u(t(e), a), m.mount(n), o = !0, s.emit(i.DID_MOUNT, a);
88
- async function f() {
89
- o && (s.emit(i.WILL_UNMOUNT, a), m.unmount(!1), l && await l[b](), o = !1, s.emit(i.DID_UNMOUNT, a));
81
+ let l, i, f = (r == null ? void 0 : r.crashView) ?? E;
82
+ const a = (r == null ? void 0 : r.context) ?? new n("App");
83
+ g((d) => {
84
+ s && m(), new c(a, f, d).mount(o);
85
+ }), n.willMount(a), e instanceof y ? (i = e, l = await i[p](o, a)) : l = new c(a, e, {}), l.mount(o), s = !0, n.didMount(a);
86
+ async function m() {
87
+ s && (n.willUnmount(a), l.unmount(!1), i && await i[b](), s = !1, n.didUnmount(a));
90
88
  }
91
- return f;
89
+ return m;
92
90
  }
93
91
  export {
94
- k as $,
95
- z as createContext,
96
- D as createLogger,
97
- F as deepEqual,
98
- I as effect,
99
- _ as get,
100
- q as getEnv,
92
+ L as $,
93
+ T as batch,
94
+ j as createContext,
95
+ q as createLogger,
96
+ B as deepEqual,
97
+ $ as effect,
98
+ v as get,
99
+ O as getEnv,
101
100
  t as m,
102
- R as mount,
103
- v as peek,
104
- A as portal,
105
- C as ref,
106
- u as render,
107
- Y as repeat,
108
- B as setEnv,
109
- V as setLogFilter,
110
- $ as setLogLevels,
111
- P as shallowEqual,
112
- S as strictEqual,
113
- G as unless,
114
- y as when
101
+ U as mount,
102
+ G as portal,
103
+ N as ref,
104
+ W as render,
105
+ _ as repeat,
106
+ P as setEnv,
107
+ S as setLogFilter,
108
+ z as setLogLevels,
109
+ A as shallowEqual,
110
+ D as strictEqual,
111
+ H as unless,
112
+ I as untracked,
113
+ w as when
115
114
  };
116
115
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/core/ref.ts","../src/core/views/default-crash-view.ts","../src/core/mount.ts"],"sourcesContent":["const EMPTY_REF = Symbol(\"Ref.EMPTY\");\n\n/**\n * A hybrid getter/setter function that stores the last value it was called with.\n * Guarantees a value is held at runtime by throwing an error if no value is set.\n */\nexport interface Ref<T> {\n /**\n * Returns the currently stored value of the ref, or throws an error if no value has been set.\n */\n (): T;\n\n /**\n * Stores a new value to the ref and returns that value.\n */\n (value: T): T;\n}\n\n/**\n * Creates a Ref.\n */\nexport function ref<T>(value?: T): Ref<T>;\n\nexport function ref(value = EMPTY_REF) {\n return function () {\n if (arguments.length === 0) {\n if (value === EMPTY_REF) {\n throw new Error(`Ref getter was called, but ref has no value! Be sure to set your refs before accessing them.`);\n }\n } else if (arguments.length === 1) {\n value = arguments[0];\n } else {\n throw new Error(`Ref called with too many arguments. Expected 0 or 1 arguments.`);\n }\n\n return value;\n };\n}\n","import { when, m } from \"../markup.js\";\n\n/**\n * Props passed to the crash view when a crash occurs.\n */\nexport type CrashViewProps = {\n /**\n * JavaScript Error object.\n */\n error: Error;\n\n /**\n * A string to identify the logger that reported this error.\n */\n loggerName: string;\n\n /**\n * Unique identifier to pinpoint the specific view that reported the crash.\n */\n tag?: string;\n\n /**\n * Label for the tag.\n */\n tagName?: string;\n};\n\nexport function DefaultCrashView(props: CrashViewProps) {\n return m(\n \"div\",\n {\n style: {\n backgroundColor: \"#880000\",\n color: \"#fff\",\n padding: \"2rem\",\n position: \"fixed\",\n inset: 0,\n fontSize: \"20px\",\n },\n },\n m(\"h1\", { style: { marginBottom: \"0.5rem\" } }, \"The app has crashed\"),\n m(\n \"p\",\n { style: { marginBottom: \"0.25rem\" } },\n m(\"span\", { style: { fontFamily: \"monospace\" } }, props.loggerName),\n when(\n props.tag,\n m(\n \"span\",\n { style: { fontFamily: \"monospace\", opacity: 0.5 } },\n ` [${props.tagName ? `${props.tagName}: ` : \"\"}${props.tag}]`,\n ),\n ),\n \" says:\",\n ),\n m(\n \"blockquote\",\n {\n style: {\n backgroundColor: \"#991111\",\n padding: \"0.25em\",\n borderRadius: \"6px\",\n fontFamily: \"monospace\",\n marginBottom: \"1rem\",\n },\n },\n m(\n \"span\",\n {\n style: {\n display: \"inline-block\",\n backgroundColor: \"red\",\n padding: \"0.1em 0.4em\",\n marginRight: \"0.5em\",\n borderRadius: \"4px\",\n fontSize: \"0.9em\",\n fontWeight: \"bold\",\n },\n },\n props.error.name,\n ),\n props.error.message,\n ),\n m(\"p\", {}, \"Please see the browser console for details.\"),\n );\n}\n","import { MOUNT, Router, UNMOUNT } from \"../router/router\";\nimport { assertInstanceOf } from \"../typeChecking\";\nimport type { View } from \"../types\";\nimport { Context, LifecycleEvent } from \"./context\";\nimport { type LoggerErrorContext, onLoggerCrash } from \"./logger\";\nimport { m, type MarkupNode, render } from \"./markup\";\nimport { DefaultCrashView } from \"./views/default-crash-view\";\n\nlet isMounted = false;\n\nexport type UnmountFn = () => Promise<void>;\nexport interface MountOptions {\n crashView?: View<LoggerErrorContext>;\n\n /**\n * An existing Context to use as the root, otherwise a new one will be created.\n * Use this to provide top-level stores and state to the whole app.\n */\n context?: Context;\n}\n\nexport async function mount(view: View<{}>, domNode: Element, options?: MountOptions): Promise<UnmountFn>;\nexport async function mount(router: Router, domNode: Element, options?: MountOptions): Promise<UnmountFn>;\n\nexport async function mount(view: any, rootElement: Element, options?: MountOptions): Promise<UnmountFn> {\n assertInstanceOf(Element, rootElement, \"Expected an element or a selector string. Got type: %t, value: %v\");\n\n if (isMounted) {\n throw new Error(`A Dolla app is already mounted.`);\n }\n\n let rootView: MarkupNode;\n let router: Router | undefined;\n let crashView = options?.crashView ?? DefaultCrashView;\n\n const rootContext = options?.context ?? new Context(\"App\");\n\n onLoggerCrash((ctx) => {\n if (isMounted) {\n unmount();\n }\n\n // Mount the crash page\n render(m(crashView, ctx), rootContext).mount(rootElement);\n });\n\n Context.emit(LifecycleEvent.WILL_MOUNT, rootContext);\n\n if (view instanceof Router) {\n router = view;\n rootView = await router[MOUNT](rootElement, rootContext);\n } else {\n // First, initialize the root view. The router store needs this to connect the initial route.\n rootView = render(m(view), rootContext);\n }\n\n rootView.mount(rootElement);\n isMounted = true;\n\n Context.emit(LifecycleEvent.DID_MOUNT, rootContext);\n\n async function unmount() {\n if (!isMounted) return;\n\n Context.emit(LifecycleEvent.WILL_UNMOUNT, rootContext);\n\n rootView.unmount(false);\n\n if (router) {\n await router[UNMOUNT]();\n }\n\n isMounted = false;\n\n Context.emit(LifecycleEvent.DID_UNMOUNT, rootContext);\n }\n\n return unmount;\n}\n"],"names":["EMPTY_REF","ref","value","DefaultCrashView","props","m","when","isMounted","mount","view","rootElement","options","assertInstanceOf","rootView","router","crashView","rootContext","Context","onLoggerCrash","ctx","unmount","render","LifecycleEvent","Router","MOUNT","UNMOUNT"],"mappings":";;;;;;AAAA,MAAMA,IAAY,OAAO,WAAW;AAuBpB,SAAAC,EAAIC,IAAQF,GAAW;AACrC,SAAO,WAAY;AACb,QAAA,UAAU,WAAW;AACvB,UAAIE,MAAUF;AACN,cAAA,IAAI,MAAM,8FAA8F;AAAA,eAEvG,UAAU,WAAW;AAC9B,MAAAE,IAAQ,UAAU,CAAC;AAAA;AAEb,YAAA,IAAI,MAAM,gEAAgE;AAG3E,WAAAA;AAAA,EACT;AACF;ACVO,SAASC,EAAiBC,GAAuB;AAC/C,SAAAC;AAAA,IACL;AAAA,IACA;AAAA,MACE,OAAO;AAAA,QACL,iBAAiB;AAAA,QACjB,OAAO;AAAA,QACP,SAAS;AAAA,QACT,UAAU;A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AAcL,KAAA,gBAAAA,EAAS,YAAW,IAAIM,EAAQ,KAAK;AAEzD,EAAAC,EAAc,CAACC,MAAQ;AACrB,IAAIZ,KACMa,EAAA,GAIVC,EAAOhB,EAAEU,GAAWI,CAAG,GAAGH,CAAW,EAAE,MAAMN,CAAW;AAAA,EAAA,CACzD,GAEOO,EAAA,KAAKK,EAAe,YAAYN,CAAW,GAE/CP,aAAgBc,KACTT,IAAAL,GACTI,IAAW,MAAMC,EAAOU,CAAK,EAAEd,GAAaM,CAAW,KAGvDH,IAAWQ,EAAOhB,EAAEI,CAAI,GAAGO,CAAW,GAGxCH,EAAS,MAAMH,CAAW,GACdH,IAAA,IAEJU,EAAA,KAAKK,EAAe,WAAWN,CAAW;AAElD,iBAAeI,IAAU;AACvB,IAAKb,MAEGU,EAAA,KAAKK,EAAe,cAAcN,CAAW,GAErDH,EAAS,QAAQ,EAAK,GAElBC,KACI,MAAAA,EAAOW,CAAO,EAAE,GAGZlB,IAAA,IAEJU,EAAA,KAAKK,EAAe,aAAaN,CAAW;AAAA,EAAA;AAG/C,SAAAI;AACT;"}
1
+ {"version":3,"file":"index.js","sources":["../src/core/ref.ts","../src/core/views/default-crash-view.ts","../src/core/mount.ts"],"sourcesContent":["const EMPTY_REF = Symbol(\"Ref.EMPTY\");\n\n/**\n * A hybrid getter/setter function that stores the last value it was called with.\n * Guarantees a value is held at runtime by throwing an error if no value is set.\n */\nexport interface Ref<T> {\n /**\n * Returns the currently stored value of the ref, or throws an error if no value has been set.\n */\n (): T;\n\n /**\n * Stores a new value to the ref and returns that value.\n */\n (value: T): T;\n}\n\n/**\n * Creates a Ref.\n */\nexport function ref<T>(value?: T): Ref<T>;\n\nexport function ref(value = EMPTY_REF) {\n return function () {\n if (arguments.length === 0) {\n if (value === EMPTY_REF) {\n throw new Error(`Ref getter was called, but ref has no value! Be sure to set your refs before accessing them.`);\n }\n } else if (arguments.length === 1) {\n value = arguments[0];\n } else {\n throw new Error(`Ref called with too many arguments. Expected 0 or 1 arguments.`);\n }\n\n return value;\n };\n}\n","import { when, m, Markup } from \"../markup.js\";\n\n/**\n * Props passed to the crash view when a crash occurs.\n */\nexport type CrashViewProps = {\n /**\n * JavaScript Error object.\n */\n error: Error;\n\n /**\n * A string to identify the logger that reported this error.\n */\n loggerName: string;\n\n /**\n * Unique identifier to pinpoint the specific view that reported the crash.\n */\n tag?: string;\n\n /**\n * Label for the tag.\n */\n tagName?: string;\n};\n\nexport function DefaultCrashView(props: CrashViewProps) {\n return new Markup(\"div\", {\n style: {\n backgroundColor: \"#880000\",\n color: \"#fff\",\n padding: \"2rem\",\n position: \"fixed\",\n inset: 0,\n fontSize: \"20px\",\n },\n children: [\n m(\"h1\", { style: { marginBottom: \"0.5rem\" }, children: \"The app has crashed\" }),\n m(\"p\", {\n style: { marginBottom: \"0.25rem\" },\n children: [\n m(\"span\", {\n style: { fontFamily: \"monospace\" },\n children: props.loggerName,\n }),\n when(\n props.tag,\n m(\"span\", {\n style: { fontFamily: \"monospace\", opacity: 0.5 },\n children: ` [${props.tagName ? `${props.tagName}: ` : \"\"}${props.tag}]`,\n }),\n ),\n \" says:\",\n ],\n }),\n m(\"blockquote\", {\n style: {\n backgroundColor: \"#991111\",\n padding: \"0.25em\",\n borderRadius: \"6px\",\n fontFamily: \"monospace\",\n marginBottom: \"1rem\",\n },\n children: [\n m(\"span\", {\n style: {\n display: \"inline-block\",\n backgroundColor: \"red\",\n padding: \"0.1em 0.4em\",\n marginRight: \"0.5em\",\n borderRadius: \"4px\",\n fontSize: \"0.9em\",\n fontWeight: \"bold\",\n },\n children: props.error.name,\n }),\n props.error.message,\n ],\n }),\n m(\"p\", { children: \"Please see the browser console for details.\" }),\n ],\n });\n}\n","import { MOUNT, Router, UNMOUNT } from \"../router/router\";\nimport { assertInstanceOf } from \"../typeChecking\";\nimport type { View } from \"../types\";\nimport { Context } from \"./context\";\nimport { type LoggerErrorProps, onLoggerCrash } from \"./logger\";\nimport { type MarkupNode } from \"./markup\";\nimport { ViewInstance } from \"./nodes/view\";\nimport { DefaultCrashView } from \"./views/default-crash-view\";\n\nlet isMounted = false;\n\nexport type UnmountFn = () => Promise<void>;\nexport interface MountOptions {\n crashView?: View<LoggerErrorProps>;\n\n /**\n * An existing Context to use as the root, otherwise a new one will be created.\n * Use this to provide top-level stores and state to the whole app.\n */\n context?: Context;\n}\n\nexport async function mount(view: View<{}>, domNode: Element, options?: MountOptions): Promise<UnmountFn>;\nexport async function mount(router: Router, domNode: Element, options?: MountOptions): Promise<UnmountFn>;\n\nexport async function mount(view: any, rootElement: Element, options?: MountOptions): Promise<UnmountFn> {\n assertInstanceOf(Element, rootElement, \"Expected an element or a selector string. Got type: %t, value: %v\");\n\n if (isMounted) {\n throw new Error(`A Dolla app is already mounted.`);\n }\n\n let rootView: MarkupNode;\n let router: Router | undefined;\n let crashView = options?.crashView ?? DefaultCrashView;\n\n const rootContext = options?.context ?? new Context(\"App\");\n\n onLoggerCrash((props) => {\n if (isMounted) {\n unmount();\n }\n\n // Mount the crash page\n new ViewInstance(rootContext, crashView, props).mount(rootElement);\n });\n\n Context.willMount(rootContext);\n\n if (view instanceof Router) {\n router = view;\n rootView = await router[MOUNT](rootElement, rootContext);\n } else {\n // First, initialize the root view. The router store needs this to connect the initial route.\n rootView = new ViewInstance(rootContext, view, {});\n }\n\n rootView.mount(rootElement);\n isMounted = true;\n\n Context.didMount(rootContext);\n\n async function unmount() {\n if (!isMounted) return;\n\n Context.willUnmount(rootContext);\n\n rootView.unmount(false);\n\n if (router) {\n await router[UNMOUNT]();\n }\n\n isMounted = false;\n\n Context.didUnmount(rootContext);\n }\n\n return unmount;\n}\n"],"names":["EMPTY_REF","ref","value","DefaultCrashView","props","Markup","m","when","isMounted","mount","view","rootElement","options","assertInstanceOf","rootView","router","crashView","rootContext","Context","onLoggerCrash","unmount","ViewInstance","Router","MOUNT","UNMOUNT"],"mappings":";;;;;;AAAA,MAAMA,IAAY,OAAO,WAAW;AAuBpB,SAAAC,EAAIC,IAAQF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,cACb,cAAc;AAAA,cACd,UAAU;AAAA,cACV,YAAY;AAAA,YACd;AAAA,YACA,UAAUF,EAAM,MAAM;AAAA,UAAA,CACvB;AAAA,UACDA,EAAM,MAAM;AAAA,QAAA;AAAA,MACd,CACD;AAAA,MACDE,EAAE,KAAK,EAAE,UAAU,8CAA+C,CAAA;AAAA,IAAA;AAAA,EACpE,CACD;AACH;AC1EA,IAAIE,IAAY;AAgBM,eAAAC,EAAMC,GAAWC,GAAsBC,GAA4C;AAGvG,MAFiBC,EAAA,SAASF,GAAa,mEAAmE,GAEtGH;AACI,UAAA,IAAI,MAAM,iCAAiC;AAG/C,MAAAM,GACAC,GACAC,KAAYJ,KAAA,gBAAAA,EAAS,cAAaT;AAEtC,QAAMc,KAAcL,KAAA,gBAAAA,EAAS,YAAW,IAAIM,EAAQ,KAAK;AAEzD,EAAAC,EAAc,CAACf,MAAU;AACvB,IAAII,KACMY,EAAA,GAIV,IAAIC,EAAaJ,GAAaD,GAAWZ,CAAK,EAAE,MAAMO,CAAW;AAAA,EAAA,CAClE,GAEDO,EAAQ,UAAUD,CAAW,GAEzBP,aAAgBY,KACTP,IAAAL,GACTI,IAAW,MAAMC,EAAOQ,CAAK,EAAEZ,GAAaM,CAAW,KAGvDH,IAAW,IAAIO,EAAaJ,GAAaP,GAAM,CAAA,CAAE,GAGnDI,EAAS,MAAMH,CAAW,GACdH,IAAA,IAEZU,EAAQ,SAASD,CAAW;AAE5B,iBAAeG,IAAU;AACvB,IAAKZ,MAELU,EAAQ,YAAYD,CAAW,GAE/BH,EAAS,QAAQ,EAAK,GAElBC,KACI,MAAAA,EAAOS,CAAO,EAAE,GAGZhB,IAAA,IAEZU,EAAQ,WAAWD,CAAW;AAAA,EAAA;AAGzB,SAAAG;AACT;"}
@@ -1,2 +1,3 @@
1
- export function jsxDEV(element: any, props: any, key: any, isStaticChildren: any, source: any, self: any): import("./core/markup").Markup<Record<any, any>>;
1
+ export function jsxDEV(element: any, props: any, key: any, isStaticChildren: any, source: any, self: any): Markup<any>;
2
2
  export { Fragment } from "./core/views/fragment";
3
+ import { Markup } from "./core/markup";
@@ -1,17 +1,10 @@
1
- import { m as o } from "./markup-CAJd0zdA.js";
1
+ import { M as n } from "./markup-BBa4WBj1.js";
2
2
  import { F as m } from "./fragment-BahD_BJA.js";
3
- function f(e, r, t, n, l, u) {
4
- const i = { ...s(["children", "key"], r) }, c = Array.isArray(r.children) ? r.children : [r.children];
5
- return o(e, i, ...c);
6
- }
7
- function s(e, r) {
8
- const t = {};
9
- for (const n in r)
10
- e.includes(n) || (t[n] = r[n]);
11
- return t;
3
+ function u(e, r, t, o, a, i) {
4
+ return new n(e, t != null ? { ...r, key: t } : r);
12
5
  }
13
6
  export {
14
7
  m as Fragment,
15
- f as jsxDEV
8
+ u as jsxDEV
16
9
  };
17
10
  //# sourceMappingURL=jsx-dev-runtime.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"jsx-dev-runtime.js","sources":["../src/jsx-dev-runtime.js"],"sourcesContent":["import { m } from \"./core/markup\";\nexport { Fragment } from \"./core/views/fragment\";\n\nexport function jsxDEV(element, props, key, isStaticChildren, source, self) {\n const attributes = { ...omit([\"children\", \"key\"], props) };\n const children = Array.isArray(props.children) ? props.children : [props.children];\n\n // return new _Markup(element, attributes, children);\n return m(element, attributes, ...children);\n}\n\nfunction omit(keys, object) {\n const result = {};\n for (const key in object) {\n if (!keys.includes(key)) {\n result[key] = object[key];\n }\n }\n return result;\n}\n"],"names":["jsxDEV","element","props","key","isStaticChildren","source","self","attributes","omit","children","m","keys","object","result"],"mappings":";;AAGO,SAASA,EAAOC,GAASC,GAAOC,GAAKC,GAAkBC,GAAQC,GAAM;AAC1E,QAAMC,IAAa,EAAE,GAAGC,EAAK,CAAC,YAAY,KAAK,GAAGN,CAAK,EAAG,GACpDO,IAAW,MAAM,QAAQP,EAAM,QAAQ,IAAIA,EAAM,WAAW,CAACA,EAAM,QAAQ;AAGjF,SAAOQ,EAAET,GAASM,GAAY,GAAGE,CAAQ;AAC3C;AAEA,SAASD,EAAKG,GAAMC,GAAQ;AAC1B,QAAMC,IAAS,CAAE;AACjB,aAAWV,KAAOS;AAChB,IAAKD,EAAK,SAASR,CAAG,MACpBU,EAAOV,CAAG,IAAIS,EAAOT,CAAG;AAG5B,SAAOU;AACT;"}
1
+ {"version":3,"file":"jsx-dev-runtime.js","sources":["../src/jsx-dev-runtime.js"],"sourcesContent":["import { m, Markup } from \"./core/markup\";\nexport { Fragment } from \"./core/views/fragment\";\n\nexport function jsxDEV(element, props, key, isStaticChildren, source, self) {\n return new Markup(element, key != null ? { ...props, key } : props);\n}\n\n// function omit(keys, object) {\n// const result = {};\n// for (const key in object) {\n// if (!keys.includes(key)) {\n// result[key] = object[key];\n// }\n// }\n// return result;\n// }\n"],"names":["jsxDEV","element","props","key","isStaticChildren","source","self","Markup"],"mappings":";;AAGO,SAASA,EAAOC,GAASC,GAAOC,GAAKC,GAAkBC,GAAQC,GAAM;AAC1E,SAAO,IAAIC,EAAON,GAASE,KAAO,OAAO,EAAE,GAAGD,GAAO,KAAAC,EAAK,IAAGD,CAAK;AACpE;"}
@@ -1,9 +1,10 @@
1
1
  /**
2
2
  * JSX function for elements with dynamic children.
3
3
  */
4
- export function jsx(element: any, props: any, key: any): import("./core/markup").Markup<Record<any, any>>;
4
+ export function jsx(element: any, props: any, key: any): Markup<any>;
5
5
  /**
6
6
  * JSX function for elements with static children.
7
7
  */
8
- export function jsxs(element: any, props: any, key: any): import("./core/markup").Markup<Record<any, any>>;
8
+ export function jsxs(element: any, props: any, key: any): Markup<any>;
9
9
  export { Fragment } from "./core/views/fragment";
10
+ import { Markup } from "./core/markup";
@@ -1,20 +1,14 @@
1
- import { m as t } from "./markup-CAJd0zdA.js";
1
+ import { M as u } from "./markup-BBa4WBj1.js";
2
2
  import { F as m } from "./fragment-BahD_BJA.js";
3
- function d(e, n, i) {
4
- return t(e, n ? { ...u(["children", "key"], n) } : void 0, n.children);
3
+ function o(t, n, r) {
4
+ return new u(t, r != null ? { ...n, key: r } : n);
5
5
  }
6
- function f(e, n, i) {
7
- return t(e, n ? { ...u(["children", "key"], n) } : void 0, n.children);
8
- }
9
- function u(e, n) {
10
- const i = {};
11
- for (const r in n)
12
- e.includes(r) || (i[r] = n[r]);
13
- return i;
6
+ function a(t, n, r) {
7
+ return new u(t, r != null ? { ...n, key: r } : n);
14
8
  }
15
9
  export {
16
10
  m as Fragment,
17
- d as jsx,
18
- f as jsxs
11
+ o as jsx,
12
+ a as jsxs
19
13
  };
20
14
  //# sourceMappingURL=jsx-runtime.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"jsx-runtime.js","sources":["../src/jsx-runtime.js"],"sourcesContent":["import { m } from \"./core/markup\";\nexport { Fragment } from \"./core/views/fragment\";\n\n/**\n * JSX function for elements with dynamic children.\n */\nexport function jsx(element, props, key) {\n return m(element, props ? { ...omit([\"children\", \"key\"], props) } : undefined, ...[props.children]);\n}\n\n/**\n * JSX function for elements with static children.\n */\nexport function jsxs(element, props, key) {\n return m(element, props ? { ...omit([\"children\", \"key\"], props) } : undefined, props.children);\n}\n\nfunction omit(keys, object) {\n const result = {};\n for (const key in object) {\n if (!keys.includes(key)) {\n result[key] = object[key];\n }\n }\n return result;\n}\n"],"names":["jsx","element","props","key","m","omit","jsxs","keys","object","result"],"mappings":";;AAMO,SAASA,EAAIC,GAASC,GAAOC,GAAK;AACvC,SAAOC,EAAEH,GAASC,IAAQ,EAAE,GAAGG,EAAK,CAAC,YAAY,KAAK,GAAGH,CAAK,EAAC,IAAK,QAAeA,EAAM,QAAS;AACpG;AAKO,SAASI,EAAKL,GAASC,GAAOC,GAAK;AACxC,SAAOC,EAAEH,GAASC,IAAQ,EAAE,GAAGG,EAAK,CAAC,YAAY,KAAK,GAAGH,CAAK,EAAC,IAAK,QAAWA,EAAM,QAAQ;AAC/F;AAEA,SAASG,EAAKE,GAAMC,GAAQ;AAC1B,QAAMC,IAAS,CAAE;AACjB,aAAWN,KAAOK;AAChB,IAAKD,EAAK,SAASJ,CAAG,MACpBM,EAAON,CAAG,IAAIK,EAAOL,CAAG;AAG5B,SAAOM;AACT;"}
1
+ {"version":3,"file":"jsx-runtime.js","sources":["../src/jsx-runtime.js"],"sourcesContent":["import { m, Markup } from \"./core/markup\";\nexport { Fragment } from \"./core/views/fragment\";\n\n/**\n * JSX function for elements with dynamic children.\n */\nexport function jsx(element, props, key) {\n return new Markup(element, key != null ? { ...props, key } : props);\n}\n\n/**\n * JSX function for elements with static children.\n */\nexport function jsxs(element, props, key) {\n return new Markup(element, key != null ? { ...props, key } : props);\n}\n\n// function omit(keys, object) {\n// const result = {};\n// for (const key in object) {\n// if (!keys.includes(key)) {\n// result[key] = object[key];\n// }\n// }\n// return result;\n// }\n"],"names":["jsx","element","props","key","Markup","jsxs"],"mappings":";;AAMO,SAASA,EAAIC,GAASC,GAAOC,GAAK;AACvC,SAAO,IAAIC,EAAOH,GAASE,KAAO,OAAO,EAAE,GAAGD,GAAO,KAAAC,EAAK,IAAGD,CAAK;AACpE;AAKO,SAASG,EAAKJ,GAASC,GAAOC,GAAK;AACxC,SAAO,IAAIC,EAAOH,GAASE,KAAO,OAAO,EAAE,GAAGD,GAAO,KAAAC,EAAK,IAAGD,CAAK;AACpE;"}