@hedystia/view 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constants.cjs +13 -0
- package/dist/constants.cjs.map +1 -0
- package/dist/constants.mjs +13 -0
- package/dist/constants.mjs.map +1 -0
- package/dist/context/context.cjs +51 -0
- package/dist/context/context.cjs.map +1 -0
- package/dist/context/context.d.cts +25 -0
- package/dist/context/context.d.mts +25 -0
- package/dist/context/context.mjs +50 -0
- package/dist/context/context.mjs.map +1 -0
- package/dist/fetch/resource.cjs +89 -0
- package/dist/fetch/resource.cjs.map +1 -0
- package/dist/fetch/resource.d.cts +14 -0
- package/dist/fetch/resource.d.mts +14 -0
- package/dist/fetch/resource.mjs +88 -0
- package/dist/fetch/resource.mjs.map +1 -0
- package/dist/index.cjs +58 -0
- package/dist/index.d.cts +15 -0
- package/dist/index.d.mts +15 -0
- package/dist/index.mjs +14 -0
- package/dist/jsx/element.cjs +201 -0
- package/dist/jsx/element.cjs.map +1 -0
- package/dist/jsx/element.d.cts +48 -0
- package/dist/jsx/element.d.mts +48 -0
- package/dist/jsx/element.mjs +199 -0
- package/dist/jsx/element.mjs.map +1 -0
- package/dist/jsx-dev-runtime.cjs +40 -0
- package/dist/jsx-dev-runtime.cjs.map +1 -0
- package/dist/jsx-dev-runtime.d.cts +21 -0
- package/dist/jsx-dev-runtime.d.mts +21 -0
- package/dist/jsx-dev-runtime.mjs +36 -0
- package/dist/jsx-dev-runtime.mjs.map +1 -0
- package/dist/jsx-runtime.cjs +5 -0
- package/dist/jsx-runtime.d.cts +3 -0
- package/dist/jsx-runtime.d.mts +3 -0
- package/dist/jsx-runtime.mjs +2 -0
- package/dist/jsx.d.cts +942 -0
- package/dist/jsx.d.mts +942 -0
- package/dist/lifecycle/hooks.cjs +56 -0
- package/dist/lifecycle/hooks.cjs.map +1 -0
- package/dist/lifecycle/hooks.d.cts +37 -0
- package/dist/lifecycle/hooks.d.mts +37 -0
- package/dist/lifecycle/hooks.mjs +54 -0
- package/dist/lifecycle/hooks.mjs.map +1 -0
- package/dist/render/engine.cjs +52 -0
- package/dist/render/engine.cjs.map +1 -0
- package/dist/render/engine.d.cts +31 -0
- package/dist/render/engine.d.mts +31 -0
- package/dist/render/engine.mjs +51 -0
- package/dist/render/engine.mjs.map +1 -0
- package/dist/render/flow.cjs +286 -0
- package/dist/render/flow.cjs.map +1 -0
- package/dist/render/flow.d.cts +64 -0
- package/dist/render/flow.d.mts +64 -0
- package/dist/render/flow.mjs +279 -0
- package/dist/render/flow.mjs.map +1 -0
- package/dist/scheduler/scheduler.cjs +61 -0
- package/dist/scheduler/scheduler.cjs.map +1 -0
- package/dist/scheduler/scheduler.d.cts +31 -0
- package/dist/scheduler/scheduler.d.mts +31 -0
- package/dist/scheduler/scheduler.mjs +59 -0
- package/dist/scheduler/scheduler.mjs.map +1 -0
- package/dist/signal/signal.cjs +387 -0
- package/dist/signal/signal.cjs.map +1 -0
- package/dist/signal/signal.d.cts +44 -0
- package/dist/signal/signal.d.mts +44 -0
- package/dist/signal/signal.mjs +370 -0
- package/dist/signal/signal.mjs.map +1 -0
- package/dist/store/index.cjs +1 -0
- package/dist/store/index.mjs +2 -0
- package/dist/store/store.cjs +94 -0
- package/dist/store/store.cjs.map +1 -0
- package/dist/store/store.d.cts +22 -0
- package/dist/store/store.d.mts +22 -0
- package/dist/store/store.mjs +91 -0
- package/dist/store/store.mjs.map +1 -0
- package/dist/style/computed.cjs +65 -0
- package/dist/style/computed.cjs.map +1 -0
- package/dist/style/computed.d.cts +18 -0
- package/dist/style/computed.d.mts +18 -0
- package/dist/style/computed.mjs +63 -0
- package/dist/style/computed.mjs.map +1 -0
- package/dist/text/text.cjs +74 -0
- package/dist/text/text.cjs.map +1 -0
- package/dist/text/text.d.cts +31 -0
- package/dist/text/text.d.mts +31 -0
- package/dist/text/text.mjs +72 -0
- package/dist/text/text.mjs.map +1 -0
- package/dist/types.d.cts +185 -0
- package/dist/types.d.mts +185 -0
- package/dist/utils/index.cjs +34 -0
- package/dist/utils/index.cjs.map +1 -0
- package/dist/utils/index.mjs +33 -0
- package/dist/utils/index.mjs.map +1 -0
- package/dist/watch/watcher.cjs +71 -0
- package/dist/watch/watcher.cjs.map +1 -0
- package/dist/watch/watcher.d.cts +17 -0
- package/dist/watch/watcher.d.mts +17 -0
- package/dist/watch/watcher.mjs +70 -0
- package/dist/watch/watcher.mjs.map +1 -0
- package/package.json +34 -0
- package/readme.md +395 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/constants.ts
|
|
2
|
+
/**
|
|
3
|
+
* Internal constants for the reactive system
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Symbol to mark proxy objects for store reactivity
|
|
7
|
+
*/
|
|
8
|
+
const $STORE = Symbol("hedystia-store");
|
|
9
|
+
typeof window !== "undefined" && window.__DEV__;
|
|
10
|
+
//#endregion
|
|
11
|
+
exports.$STORE = $STORE;
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=constants.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.cjs","names":[],"sources":["../src/constants.ts"],"sourcesContent":["/**\n * Internal constants for the reactive system\n */\n\n/**\n * Symbol to mark proxy objects for store reactivity\n */\nexport const $STORE = Symbol(\"hedystia-store\");\n\n/**\n * Symbol to track signal access for dependency tracking\n */\nexport const $TRACK = Symbol(\"hedystia-track\");\n\n/**\n * Symbol for fragment type in JSX\n */\nexport const $FRAGMENT = Symbol(\"hedystia-fragment\");\n\n/**\n * Development mode flag\n */\nexport const IS_DEV = typeof window !== \"undefined\" && (window as any).__DEV__ === true;\n"],"mappings":";;;;;;;AAOA,MAAa,SAAS,OAAO,iBAAiB;AAexB,OAAO,WAAW,eAAgB,OAAe"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/constants.ts
|
|
2
|
+
/**
|
|
3
|
+
* Internal constants for the reactive system
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Symbol to mark proxy objects for store reactivity
|
|
7
|
+
*/
|
|
8
|
+
const $STORE = Symbol("hedystia-store");
|
|
9
|
+
typeof window !== "undefined" && window.__DEV__;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { $STORE };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=constants.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.mjs","names":[],"sources":["../src/constants.ts"],"sourcesContent":["/**\n * Internal constants for the reactive system\n */\n\n/**\n * Symbol to mark proxy objects for store reactivity\n */\nexport const $STORE = Symbol(\"hedystia-store\");\n\n/**\n * Symbol to track signal access for dependency tracking\n */\nexport const $TRACK = Symbol(\"hedystia-track\");\n\n/**\n * Symbol for fragment type in JSX\n */\nexport const $FRAGMENT = Symbol(\"hedystia-fragment\");\n\n/**\n * Development mode flag\n */\nexport const IS_DEV = typeof window !== \"undefined\" && (window as any).__DEV__ === true;\n"],"mappings":";;;;;;;AAOA,MAAa,SAAS,OAAO,iBAAiB;AAexB,OAAO,WAAW,eAAgB,OAAe"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
const require_signal = require("../signal/signal.cjs");
|
|
2
|
+
//#region src/context/context.ts
|
|
3
|
+
const contextMap = /* @__PURE__ */ new Map();
|
|
4
|
+
/**
|
|
5
|
+
* Create a typed context for dependency injection
|
|
6
|
+
* @template T - The type of the context value
|
|
7
|
+
* @param {T} [defaultValue] - Optional default value
|
|
8
|
+
* @returns {Context<T>} A context object with Provider
|
|
9
|
+
* @example
|
|
10
|
+
* const ThemeCtx = ctx<{ mode: "dark" | "light"; accent: string }>();
|
|
11
|
+
*/
|
|
12
|
+
function ctx(defaultValue) {
|
|
13
|
+
const id = Symbol("context");
|
|
14
|
+
if (defaultValue !== void 0) contextMap.set(id, require_signal.sig(defaultValue));
|
|
15
|
+
const Provider = (props) => {
|
|
16
|
+
const prevValue = contextMap.get(id);
|
|
17
|
+
const newSignal = require_signal.sig(props.value);
|
|
18
|
+
contextMap.set(id, newSignal);
|
|
19
|
+
try {
|
|
20
|
+
return props.children;
|
|
21
|
+
} finally {
|
|
22
|
+
if (prevValue !== void 0) contextMap.set(id, prevValue);
|
|
23
|
+
else contextMap.delete(id);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
return {
|
|
27
|
+
_id: id,
|
|
28
|
+
_defaultValue: defaultValue,
|
|
29
|
+
Provider
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Consume a context value
|
|
34
|
+
* @template T - The type of the context value
|
|
35
|
+
* @param {Context<T>} context - The context to consume
|
|
36
|
+
* @returns {T} The context value
|
|
37
|
+
* @throws {Error} When context is not found and no default exists
|
|
38
|
+
* @example
|
|
39
|
+
* const theme = use(ThemeCtx);
|
|
40
|
+
*/
|
|
41
|
+
function use(context) {
|
|
42
|
+
const signal = contextMap.get(context._id);
|
|
43
|
+
if (signal !== void 0) return require_signal.val(signal);
|
|
44
|
+
if (context._defaultValue !== void 0) return context._defaultValue;
|
|
45
|
+
throw new Error(`Context not found: ${String(context._id)}`);
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
exports.ctx = ctx;
|
|
49
|
+
exports.use = use;
|
|
50
|
+
|
|
51
|
+
//# sourceMappingURL=context.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.cjs","names":["sig","val"],"sources":["../../src/context/context.ts"],"sourcesContent":["/**\n * Typed context system for @hedystia/view\n *\n * Provides provider/consumer pattern for dependency injection.\n */\n\nimport type { JSX } from \"../jsx.d\";\nimport { sig, val } from \"../signal\";\nimport type { Component, Context } from \"../types\";\n\nconst contextMap = new Map<symbol, any>();\n\n/**\n * Create a typed context for dependency injection\n * @template T - The type of the context value\n * @param {T} [defaultValue] - Optional default value\n * @returns {Context<T>} A context object with Provider\n * @example\n * const ThemeCtx = ctx<{ mode: \"dark\" | \"light\"; accent: string }>();\n */\nexport function ctx<T>(defaultValue?: T): Context<T> {\n const id = Symbol(\"context\");\n if (defaultValue !== undefined) {\n contextMap.set(id, sig(defaultValue));\n }\n\n const Provider: Component<{ value: T; children: JSX.Element }> = (props) => {\n const prevValue = contextMap.get(id);\n const newSignal = sig(props.value);\n contextMap.set(id, newSignal);\n\n try {\n return props.children;\n } finally {\n if (prevValue !== undefined) {\n contextMap.set(id, prevValue);\n } else {\n contextMap.delete(id);\n }\n }\n };\n\n return {\n _id: id,\n _defaultValue: defaultValue,\n Provider,\n };\n}\n\n/**\n * Consume a context value\n * @template T - The type of the context value\n * @param {Context<T>} context - The context to consume\n * @returns {T} The context value\n * @throws {Error} When context is not found and no default exists\n * @example\n * const theme = use(ThemeCtx);\n */\nexport function use<T>(context: Context<T>): T {\n const signal = contextMap.get(context._id);\n if (signal !== undefined) {\n return val(signal);\n }\n if (context._defaultValue !== undefined) {\n return context._defaultValue;\n }\n throw new Error(`Context not found: ${String(context._id)}`);\n}\n"],"mappings":";;AAUA,MAAM,6BAAa,IAAI,KAAkB;;;;;;;;;AAUzC,SAAgB,IAAO,cAA8B;CACnD,MAAM,KAAK,OAAO,UAAU;AAC5B,KAAI,iBAAiB,KAAA,EACnB,YAAW,IAAI,IAAIA,eAAAA,IAAI,aAAa,CAAC;CAGvC,MAAM,YAA4D,UAAU;EAC1E,MAAM,YAAY,WAAW,IAAI,GAAG;EACpC,MAAM,YAAYA,eAAAA,IAAI,MAAM,MAAM;AAClC,aAAW,IAAI,IAAI,UAAU;AAE7B,MAAI;AACF,UAAO,MAAM;YACL;AACR,OAAI,cAAc,KAAA,EAChB,YAAW,IAAI,IAAI,UAAU;OAE7B,YAAW,OAAO,GAAG;;;AAK3B,QAAO;EACL,KAAK;EACL,eAAe;EACf;EACD;;;;;;;;;;;AAYH,SAAgB,IAAO,SAAwB;CAC7C,MAAM,SAAS,WAAW,IAAI,QAAQ,IAAI;AAC1C,KAAI,WAAW,KAAA,EACb,QAAOC,eAAAA,IAAI,OAAO;AAEpB,KAAI,QAAQ,kBAAkB,KAAA,EAC5B,QAAO,QAAQ;AAEjB,OAAM,IAAI,MAAM,sBAAsB,OAAO,QAAQ,IAAI,GAAG"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Context } from "../types.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/context/context.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Create a typed context for dependency injection
|
|
6
|
+
* @template T - The type of the context value
|
|
7
|
+
* @param {T} [defaultValue] - Optional default value
|
|
8
|
+
* @returns {Context<T>} A context object with Provider
|
|
9
|
+
* @example
|
|
10
|
+
* const ThemeCtx = ctx<{ mode: "dark" | "light"; accent: string }>();
|
|
11
|
+
*/
|
|
12
|
+
declare function ctx<T>(defaultValue?: T): Context<T>;
|
|
13
|
+
/**
|
|
14
|
+
* Consume a context value
|
|
15
|
+
* @template T - The type of the context value
|
|
16
|
+
* @param {Context<T>} context - The context to consume
|
|
17
|
+
* @returns {T} The context value
|
|
18
|
+
* @throws {Error} When context is not found and no default exists
|
|
19
|
+
* @example
|
|
20
|
+
* const theme = use(ThemeCtx);
|
|
21
|
+
*/
|
|
22
|
+
declare function use<T>(context: Context<T>): T;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { ctx, use };
|
|
25
|
+
//# sourceMappingURL=context.d.cts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Context } from "../types.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/context/context.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Create a typed context for dependency injection
|
|
6
|
+
* @template T - The type of the context value
|
|
7
|
+
* @param {T} [defaultValue] - Optional default value
|
|
8
|
+
* @returns {Context<T>} A context object with Provider
|
|
9
|
+
* @example
|
|
10
|
+
* const ThemeCtx = ctx<{ mode: "dark" | "light"; accent: string }>();
|
|
11
|
+
*/
|
|
12
|
+
declare function ctx<T>(defaultValue?: T): Context<T>;
|
|
13
|
+
/**
|
|
14
|
+
* Consume a context value
|
|
15
|
+
* @template T - The type of the context value
|
|
16
|
+
* @param {Context<T>} context - The context to consume
|
|
17
|
+
* @returns {T} The context value
|
|
18
|
+
* @throws {Error} When context is not found and no default exists
|
|
19
|
+
* @example
|
|
20
|
+
* const theme = use(ThemeCtx);
|
|
21
|
+
*/
|
|
22
|
+
declare function use<T>(context: Context<T>): T;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { ctx, use };
|
|
25
|
+
//# sourceMappingURL=context.d.mts.map
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { sig, val } from "../signal/signal.mjs";
|
|
2
|
+
//#region src/context/context.ts
|
|
3
|
+
const contextMap = /* @__PURE__ */ new Map();
|
|
4
|
+
/**
|
|
5
|
+
* Create a typed context for dependency injection
|
|
6
|
+
* @template T - The type of the context value
|
|
7
|
+
* @param {T} [defaultValue] - Optional default value
|
|
8
|
+
* @returns {Context<T>} A context object with Provider
|
|
9
|
+
* @example
|
|
10
|
+
* const ThemeCtx = ctx<{ mode: "dark" | "light"; accent: string }>();
|
|
11
|
+
*/
|
|
12
|
+
function ctx(defaultValue) {
|
|
13
|
+
const id = Symbol("context");
|
|
14
|
+
if (defaultValue !== void 0) contextMap.set(id, sig(defaultValue));
|
|
15
|
+
const Provider = (props) => {
|
|
16
|
+
const prevValue = contextMap.get(id);
|
|
17
|
+
const newSignal = sig(props.value);
|
|
18
|
+
contextMap.set(id, newSignal);
|
|
19
|
+
try {
|
|
20
|
+
return props.children;
|
|
21
|
+
} finally {
|
|
22
|
+
if (prevValue !== void 0) contextMap.set(id, prevValue);
|
|
23
|
+
else contextMap.delete(id);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
return {
|
|
27
|
+
_id: id,
|
|
28
|
+
_defaultValue: defaultValue,
|
|
29
|
+
Provider
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Consume a context value
|
|
34
|
+
* @template T - The type of the context value
|
|
35
|
+
* @param {Context<T>} context - The context to consume
|
|
36
|
+
* @returns {T} The context value
|
|
37
|
+
* @throws {Error} When context is not found and no default exists
|
|
38
|
+
* @example
|
|
39
|
+
* const theme = use(ThemeCtx);
|
|
40
|
+
*/
|
|
41
|
+
function use(context) {
|
|
42
|
+
const signal = contextMap.get(context._id);
|
|
43
|
+
if (signal !== void 0) return val(signal);
|
|
44
|
+
if (context._defaultValue !== void 0) return context._defaultValue;
|
|
45
|
+
throw new Error(`Context not found: ${String(context._id)}`);
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
export { ctx, use };
|
|
49
|
+
|
|
50
|
+
//# sourceMappingURL=context.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.mjs","names":[],"sources":["../../src/context/context.ts"],"sourcesContent":["/**\n * Typed context system for @hedystia/view\n *\n * Provides provider/consumer pattern for dependency injection.\n */\n\nimport type { JSX } from \"../jsx.d\";\nimport { sig, val } from \"../signal\";\nimport type { Component, Context } from \"../types\";\n\nconst contextMap = new Map<symbol, any>();\n\n/**\n * Create a typed context for dependency injection\n * @template T - The type of the context value\n * @param {T} [defaultValue] - Optional default value\n * @returns {Context<T>} A context object with Provider\n * @example\n * const ThemeCtx = ctx<{ mode: \"dark\" | \"light\"; accent: string }>();\n */\nexport function ctx<T>(defaultValue?: T): Context<T> {\n const id = Symbol(\"context\");\n if (defaultValue !== undefined) {\n contextMap.set(id, sig(defaultValue));\n }\n\n const Provider: Component<{ value: T; children: JSX.Element }> = (props) => {\n const prevValue = contextMap.get(id);\n const newSignal = sig(props.value);\n contextMap.set(id, newSignal);\n\n try {\n return props.children;\n } finally {\n if (prevValue !== undefined) {\n contextMap.set(id, prevValue);\n } else {\n contextMap.delete(id);\n }\n }\n };\n\n return {\n _id: id,\n _defaultValue: defaultValue,\n Provider,\n };\n}\n\n/**\n * Consume a context value\n * @template T - The type of the context value\n * @param {Context<T>} context - The context to consume\n * @returns {T} The context value\n * @throws {Error} When context is not found and no default exists\n * @example\n * const theme = use(ThemeCtx);\n */\nexport function use<T>(context: Context<T>): T {\n const signal = contextMap.get(context._id);\n if (signal !== undefined) {\n return val(signal);\n }\n if (context._defaultValue !== undefined) {\n return context._defaultValue;\n }\n throw new Error(`Context not found: ${String(context._id)}`);\n}\n"],"mappings":";;AAUA,MAAM,6BAAa,IAAI,KAAkB;;;;;;;;;AAUzC,SAAgB,IAAO,cAA8B;CACnD,MAAM,KAAK,OAAO,UAAU;AAC5B,KAAI,iBAAiB,KAAA,EACnB,YAAW,IAAI,IAAI,IAAI,aAAa,CAAC;CAGvC,MAAM,YAA4D,UAAU;EAC1E,MAAM,YAAY,WAAW,IAAI,GAAG;EACpC,MAAM,YAAY,IAAI,MAAM,MAAM;AAClC,aAAW,IAAI,IAAI,UAAU;AAE7B,MAAI;AACF,UAAO,MAAM;YACL;AACR,OAAI,cAAc,KAAA,EAChB,YAAW,IAAI,IAAI,UAAU;OAE7B,YAAW,OAAO,GAAG;;;AAK3B,QAAO;EACL,KAAK;EACL,eAAe;EACf;EACD;;;;;;;;;;;AAYH,SAAgB,IAAO,SAAwB;CAC7C,MAAM,SAAS,WAAW,IAAI,QAAQ,IAAI;AAC1C,KAAI,WAAW,KAAA,EACb,QAAO,IAAI,OAAO;AAEpB,KAAI,QAAQ,kBAAkB,KAAA,EAC5B,QAAO,QAAQ;AAEjB,OAAM,IAAI,MAAM,sBAAsB,OAAO,QAAQ,IAAI,GAAG"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
const require_signal = require("../signal/signal.cjs");
|
|
2
|
+
const require_watcher = require("../watch/watcher.cjs");
|
|
3
|
+
//#region src/fetch/resource.ts
|
|
4
|
+
/**
|
|
5
|
+
* Reactive data fetching for @hedystia/view
|
|
6
|
+
*
|
|
7
|
+
* Provides load() for reactive data fetching and action() for mutations.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Create a reactive resource for data fetching
|
|
11
|
+
*/
|
|
12
|
+
function load(key, fetcher) {
|
|
13
|
+
const dataSig = require_signal.sig(void 0);
|
|
14
|
+
const loadingSig = require_signal.sig(true);
|
|
15
|
+
const errorSig = require_signal.sig(void 0);
|
|
16
|
+
const stateSig = require_signal.sig("pending");
|
|
17
|
+
let hasResolved = false;
|
|
18
|
+
let currentAbort = null;
|
|
19
|
+
const execute = async (keyValue) => {
|
|
20
|
+
if (currentAbort) currentAbort.abort();
|
|
21
|
+
currentAbort = new AbortController();
|
|
22
|
+
if (hasResolved) require_signal.batch(() => {
|
|
23
|
+
require_signal.set(loadingSig, true);
|
|
24
|
+
require_signal.set(stateSig, "refreshing");
|
|
25
|
+
});
|
|
26
|
+
try {
|
|
27
|
+
const result = await fetcher(keyValue);
|
|
28
|
+
require_signal.batch(() => {
|
|
29
|
+
require_signal.set(dataSig, result);
|
|
30
|
+
require_signal.set(errorSig, void 0);
|
|
31
|
+
require_signal.set(loadingSig, false);
|
|
32
|
+
require_signal.set(stateSig, "ready");
|
|
33
|
+
});
|
|
34
|
+
hasResolved = true;
|
|
35
|
+
} catch (err) {
|
|
36
|
+
if (err.name === "AbortError") return;
|
|
37
|
+
require_signal.batch(() => {
|
|
38
|
+
require_signal.set(errorSig, err instanceof Error ? err : new Error(String(err)));
|
|
39
|
+
require_signal.set(loadingSig, false);
|
|
40
|
+
require_signal.set(stateSig, "errored");
|
|
41
|
+
});
|
|
42
|
+
hasResolved = true;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
require_watcher.on(key, (keyValue) => {
|
|
46
|
+
queueMicrotask(() => execute(keyValue));
|
|
47
|
+
});
|
|
48
|
+
return {
|
|
49
|
+
state: stateSig,
|
|
50
|
+
loading: loadingSig,
|
|
51
|
+
error: errorSig,
|
|
52
|
+
data: dataSig,
|
|
53
|
+
get ready() {
|
|
54
|
+
return require_signal.val(stateSig) === "ready";
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Create a reactive action for mutations
|
|
60
|
+
*/
|
|
61
|
+
function action(fn) {
|
|
62
|
+
const loadingSig = require_signal.sig(false);
|
|
63
|
+
const errorSig = require_signal.sig(void 0);
|
|
64
|
+
const dataSig = require_signal.sig(void 0);
|
|
65
|
+
const run = (args) => {
|
|
66
|
+
require_signal.set(loadingSig, true);
|
|
67
|
+
require_signal.set(errorSig, void 0);
|
|
68
|
+
return fn(args).then((result) => {
|
|
69
|
+
require_signal.set(dataSig, result);
|
|
70
|
+
require_signal.set(loadingSig, false);
|
|
71
|
+
return result;
|
|
72
|
+
}).catch((err) => {
|
|
73
|
+
require_signal.set(errorSig, err instanceof Error ? err : new Error(String(err)));
|
|
74
|
+
require_signal.set(loadingSig, false);
|
|
75
|
+
throw err;
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
return {
|
|
79
|
+
run,
|
|
80
|
+
loading: loadingSig,
|
|
81
|
+
error: errorSig,
|
|
82
|
+
data: dataSig
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
//#endregion
|
|
86
|
+
exports.action = action;
|
|
87
|
+
exports.load = load;
|
|
88
|
+
|
|
89
|
+
//# sourceMappingURL=resource.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource.cjs","names":["sig","val"],"sources":["../../src/fetch/resource.ts"],"sourcesContent":["/**\n * Reactive data fetching for @hedystia/view\n *\n * Provides load() for reactive data fetching and action() for mutations.\n */\n\nimport { batch, set, sig, val } from \"../signal\";\nimport type { Accessor, Action, Resource } from \"../types\";\nimport { on } from \"../watch\";\n\n/**\n * Create a reactive resource for data fetching\n */\nexport function load<T, K>(key: Accessor<K>, fetcher: (key: K) => Promise<T>): Resource<T> {\n const dataSig = sig<T | undefined>(undefined);\n const loadingSig = sig(true);\n const errorSig = sig<Error | undefined>(undefined);\n const stateSig = sig<\"unresolved\" | \"pending\" | \"ready\" | \"refreshing\" | \"errored\">(\"pending\");\n\n let hasResolved = false;\n let currentAbort: AbortController | null = null;\n\n const execute = async (keyValue: K) => {\n if (currentAbort) {\n currentAbort.abort();\n }\n currentAbort = new AbortController();\n\n if (hasResolved) {\n batch(() => {\n set(loadingSig, true);\n set(stateSig, \"refreshing\");\n });\n }\n\n try {\n const result = await fetcher(keyValue);\n batch(() => {\n set(dataSig, result as T);\n set(errorSig, undefined);\n set(loadingSig, false);\n set(stateSig, \"ready\");\n });\n hasResolved = true;\n } catch (err) {\n if ((err as Error).name === \"AbortError\") {\n return;\n }\n batch(() => {\n set(errorSig, err instanceof Error ? err : new Error(String(err)));\n set(loadingSig, false);\n set(stateSig, \"errored\");\n });\n hasResolved = true;\n }\n };\n\n on(key, (keyValue) => {\n queueMicrotask(() => execute(keyValue));\n });\n\n const resource: Resource<T> = {\n state: stateSig,\n loading: loadingSig,\n error: errorSig,\n data: dataSig,\n get ready() {\n return val(stateSig) === \"ready\";\n },\n } as Resource<T>;\n\n return resource;\n}\n\n/**\n * Create a reactive action for mutations\n */\nexport function action<T, A>(fn: (args: A) => Promise<T>): Action<T, A> {\n const loadingSig = sig(false);\n const errorSig = sig<Error | undefined>(undefined);\n const dataSig = sig<T | undefined>(undefined);\n\n const run = (args: A): Promise<T> => {\n set(loadingSig, true);\n set(errorSig, undefined);\n\n return fn(args)\n .then((result) => {\n set(dataSig, result as T);\n set(loadingSig, false);\n return result;\n })\n .catch((err) => {\n set(errorSig, err instanceof Error ? err : new Error(String(err)));\n set(loadingSig, false);\n throw err;\n });\n };\n\n const actionFn: Action<T, A> = {\n run,\n loading: loadingSig,\n error: errorSig,\n data: dataSig,\n } as Action<T, A>;\n\n return actionFn;\n}\n"],"mappings":";;;;;;;;;;;AAaA,SAAgB,KAAW,KAAkB,SAA8C;CACzF,MAAM,UAAUA,eAAAA,IAAmB,KAAA,EAAU;CAC7C,MAAM,aAAaA,eAAAA,IAAI,KAAK;CAC5B,MAAM,WAAWA,eAAAA,IAAuB,KAAA,EAAU;CAClD,MAAM,WAAWA,eAAAA,IAAmE,UAAU;CAE9F,IAAI,cAAc;CAClB,IAAI,eAAuC;CAE3C,MAAM,UAAU,OAAO,aAAgB;AACrC,MAAI,aACF,cAAa,OAAO;AAEtB,iBAAe,IAAI,iBAAiB;AAEpC,MAAI,YACF,gBAAA,YAAY;AACV,kBAAA,IAAI,YAAY,KAAK;AACrB,kBAAA,IAAI,UAAU,aAAa;IAC3B;AAGJ,MAAI;GACF,MAAM,SAAS,MAAM,QAAQ,SAAS;AACtC,kBAAA,YAAY;AACV,mBAAA,IAAI,SAAS,OAAY;AACzB,mBAAA,IAAI,UAAU,KAAA,EAAU;AACxB,mBAAA,IAAI,YAAY,MAAM;AACtB,mBAAA,IAAI,UAAU,QAAQ;KACtB;AACF,iBAAc;WACP,KAAK;AACZ,OAAK,IAAc,SAAS,aAC1B;AAEF,kBAAA,YAAY;AACV,mBAAA,IAAI,UAAU,eAAe,QAAQ,MAAM,IAAI,MAAM,OAAO,IAAI,CAAC,CAAC;AAClE,mBAAA,IAAI,YAAY,MAAM;AACtB,mBAAA,IAAI,UAAU,UAAU;KACxB;AACF,iBAAc;;;AAIlB,iBAAA,GAAG,MAAM,aAAa;AACpB,uBAAqB,QAAQ,SAAS,CAAC;GACvC;AAYF,QAV8B;EAC5B,OAAO;EACP,SAAS;EACT,OAAO;EACP,MAAM;EACN,IAAI,QAAQ;AACV,UAAOC,eAAAA,IAAI,SAAS,KAAK;;EAE5B;;;;;AAQH,SAAgB,OAAa,IAA2C;CACtE,MAAM,aAAaD,eAAAA,IAAI,MAAM;CAC7B,MAAM,WAAWA,eAAAA,IAAuB,KAAA,EAAU;CAClD,MAAM,UAAUA,eAAAA,IAAmB,KAAA,EAAU;CAE7C,MAAM,OAAO,SAAwB;AACnC,iBAAA,IAAI,YAAY,KAAK;AACrB,iBAAA,IAAI,UAAU,KAAA,EAAU;AAExB,SAAO,GAAG,KAAK,CACZ,MAAM,WAAW;AAChB,kBAAA,IAAI,SAAS,OAAY;AACzB,kBAAA,IAAI,YAAY,MAAM;AACtB,UAAO;IACP,CACD,OAAO,QAAQ;AACd,kBAAA,IAAI,UAAU,eAAe,QAAQ,MAAM,IAAI,MAAM,OAAO,IAAI,CAAC,CAAC;AAClE,kBAAA,IAAI,YAAY,MAAM;AACtB,SAAM;IACN;;AAUN,QAP+B;EAC7B;EACA,SAAS;EACT,OAAO;EACP,MAAM;EACP"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Accessor, Action, Resource } from "../types.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/fetch/resource.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Create a reactive resource for data fetching
|
|
6
|
+
*/
|
|
7
|
+
declare function load<T, K>(key: Accessor<K>, fetcher: (key: K) => Promise<T>): Resource<T>;
|
|
8
|
+
/**
|
|
9
|
+
* Create a reactive action for mutations
|
|
10
|
+
*/
|
|
11
|
+
declare function action<T, A>(fn: (args: A) => Promise<T>): Action<T, A>;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { action, load };
|
|
14
|
+
//# sourceMappingURL=resource.d.cts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Accessor, Action, Resource } from "../types.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/fetch/resource.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Create a reactive resource for data fetching
|
|
6
|
+
*/
|
|
7
|
+
declare function load<T, K>(key: Accessor<K>, fetcher: (key: K) => Promise<T>): Resource<T>;
|
|
8
|
+
/**
|
|
9
|
+
* Create a reactive action for mutations
|
|
10
|
+
*/
|
|
11
|
+
declare function action<T, A>(fn: (args: A) => Promise<T>): Action<T, A>;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { action, load };
|
|
14
|
+
//# sourceMappingURL=resource.d.mts.map
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { batch, set, sig, val } from "../signal/signal.mjs";
|
|
2
|
+
import { on } from "../watch/watcher.mjs";
|
|
3
|
+
//#region src/fetch/resource.ts
|
|
4
|
+
/**
|
|
5
|
+
* Reactive data fetching for @hedystia/view
|
|
6
|
+
*
|
|
7
|
+
* Provides load() for reactive data fetching and action() for mutations.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Create a reactive resource for data fetching
|
|
11
|
+
*/
|
|
12
|
+
function load(key, fetcher) {
|
|
13
|
+
const dataSig = sig(void 0);
|
|
14
|
+
const loadingSig = sig(true);
|
|
15
|
+
const errorSig = sig(void 0);
|
|
16
|
+
const stateSig = sig("pending");
|
|
17
|
+
let hasResolved = false;
|
|
18
|
+
let currentAbort = null;
|
|
19
|
+
const execute = async (keyValue) => {
|
|
20
|
+
if (currentAbort) currentAbort.abort();
|
|
21
|
+
currentAbort = new AbortController();
|
|
22
|
+
if (hasResolved) batch(() => {
|
|
23
|
+
set(loadingSig, true);
|
|
24
|
+
set(stateSig, "refreshing");
|
|
25
|
+
});
|
|
26
|
+
try {
|
|
27
|
+
const result = await fetcher(keyValue);
|
|
28
|
+
batch(() => {
|
|
29
|
+
set(dataSig, result);
|
|
30
|
+
set(errorSig, void 0);
|
|
31
|
+
set(loadingSig, false);
|
|
32
|
+
set(stateSig, "ready");
|
|
33
|
+
});
|
|
34
|
+
hasResolved = true;
|
|
35
|
+
} catch (err) {
|
|
36
|
+
if (err.name === "AbortError") return;
|
|
37
|
+
batch(() => {
|
|
38
|
+
set(errorSig, err instanceof Error ? err : new Error(String(err)));
|
|
39
|
+
set(loadingSig, false);
|
|
40
|
+
set(stateSig, "errored");
|
|
41
|
+
});
|
|
42
|
+
hasResolved = true;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
on(key, (keyValue) => {
|
|
46
|
+
queueMicrotask(() => execute(keyValue));
|
|
47
|
+
});
|
|
48
|
+
return {
|
|
49
|
+
state: stateSig,
|
|
50
|
+
loading: loadingSig,
|
|
51
|
+
error: errorSig,
|
|
52
|
+
data: dataSig,
|
|
53
|
+
get ready() {
|
|
54
|
+
return val(stateSig) === "ready";
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Create a reactive action for mutations
|
|
60
|
+
*/
|
|
61
|
+
function action(fn) {
|
|
62
|
+
const loadingSig = sig(false);
|
|
63
|
+
const errorSig = sig(void 0);
|
|
64
|
+
const dataSig = sig(void 0);
|
|
65
|
+
const run = (args) => {
|
|
66
|
+
set(loadingSig, true);
|
|
67
|
+
set(errorSig, void 0);
|
|
68
|
+
return fn(args).then((result) => {
|
|
69
|
+
set(dataSig, result);
|
|
70
|
+
set(loadingSig, false);
|
|
71
|
+
return result;
|
|
72
|
+
}).catch((err) => {
|
|
73
|
+
set(errorSig, err instanceof Error ? err : new Error(String(err)));
|
|
74
|
+
set(loadingSig, false);
|
|
75
|
+
throw err;
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
return {
|
|
79
|
+
run,
|
|
80
|
+
loading: loadingSig,
|
|
81
|
+
error: errorSig,
|
|
82
|
+
data: dataSig
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
//#endregion
|
|
86
|
+
export { action, load };
|
|
87
|
+
|
|
88
|
+
//# sourceMappingURL=resource.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource.mjs","names":[],"sources":["../../src/fetch/resource.ts"],"sourcesContent":["/**\n * Reactive data fetching for @hedystia/view\n *\n * Provides load() for reactive data fetching and action() for mutations.\n */\n\nimport { batch, set, sig, val } from \"../signal\";\nimport type { Accessor, Action, Resource } from \"../types\";\nimport { on } from \"../watch\";\n\n/**\n * Create a reactive resource for data fetching\n */\nexport function load<T, K>(key: Accessor<K>, fetcher: (key: K) => Promise<T>): Resource<T> {\n const dataSig = sig<T | undefined>(undefined);\n const loadingSig = sig(true);\n const errorSig = sig<Error | undefined>(undefined);\n const stateSig = sig<\"unresolved\" | \"pending\" | \"ready\" | \"refreshing\" | \"errored\">(\"pending\");\n\n let hasResolved = false;\n let currentAbort: AbortController | null = null;\n\n const execute = async (keyValue: K) => {\n if (currentAbort) {\n currentAbort.abort();\n }\n currentAbort = new AbortController();\n\n if (hasResolved) {\n batch(() => {\n set(loadingSig, true);\n set(stateSig, \"refreshing\");\n });\n }\n\n try {\n const result = await fetcher(keyValue);\n batch(() => {\n set(dataSig, result as T);\n set(errorSig, undefined);\n set(loadingSig, false);\n set(stateSig, \"ready\");\n });\n hasResolved = true;\n } catch (err) {\n if ((err as Error).name === \"AbortError\") {\n return;\n }\n batch(() => {\n set(errorSig, err instanceof Error ? err : new Error(String(err)));\n set(loadingSig, false);\n set(stateSig, \"errored\");\n });\n hasResolved = true;\n }\n };\n\n on(key, (keyValue) => {\n queueMicrotask(() => execute(keyValue));\n });\n\n const resource: Resource<T> = {\n state: stateSig,\n loading: loadingSig,\n error: errorSig,\n data: dataSig,\n get ready() {\n return val(stateSig) === \"ready\";\n },\n } as Resource<T>;\n\n return resource;\n}\n\n/**\n * Create a reactive action for mutations\n */\nexport function action<T, A>(fn: (args: A) => Promise<T>): Action<T, A> {\n const loadingSig = sig(false);\n const errorSig = sig<Error | undefined>(undefined);\n const dataSig = sig<T | undefined>(undefined);\n\n const run = (args: A): Promise<T> => {\n set(loadingSig, true);\n set(errorSig, undefined);\n\n return fn(args)\n .then((result) => {\n set(dataSig, result as T);\n set(loadingSig, false);\n return result;\n })\n .catch((err) => {\n set(errorSig, err instanceof Error ? err : new Error(String(err)));\n set(loadingSig, false);\n throw err;\n });\n };\n\n const actionFn: Action<T, A> = {\n run,\n loading: loadingSig,\n error: errorSig,\n data: dataSig,\n } as Action<T, A>;\n\n return actionFn;\n}\n"],"mappings":";;;;;;;;;;;AAaA,SAAgB,KAAW,KAAkB,SAA8C;CACzF,MAAM,UAAU,IAAmB,KAAA,EAAU;CAC7C,MAAM,aAAa,IAAI,KAAK;CAC5B,MAAM,WAAW,IAAuB,KAAA,EAAU;CAClD,MAAM,WAAW,IAAmE,UAAU;CAE9F,IAAI,cAAc;CAClB,IAAI,eAAuC;CAE3C,MAAM,UAAU,OAAO,aAAgB;AACrC,MAAI,aACF,cAAa,OAAO;AAEtB,iBAAe,IAAI,iBAAiB;AAEpC,MAAI,YACF,aAAY;AACV,OAAI,YAAY,KAAK;AACrB,OAAI,UAAU,aAAa;IAC3B;AAGJ,MAAI;GACF,MAAM,SAAS,MAAM,QAAQ,SAAS;AACtC,eAAY;AACV,QAAI,SAAS,OAAY;AACzB,QAAI,UAAU,KAAA,EAAU;AACxB,QAAI,YAAY,MAAM;AACtB,QAAI,UAAU,QAAQ;KACtB;AACF,iBAAc;WACP,KAAK;AACZ,OAAK,IAAc,SAAS,aAC1B;AAEF,eAAY;AACV,QAAI,UAAU,eAAe,QAAQ,MAAM,IAAI,MAAM,OAAO,IAAI,CAAC,CAAC;AAClE,QAAI,YAAY,MAAM;AACtB,QAAI,UAAU,UAAU;KACxB;AACF,iBAAc;;;AAIlB,IAAG,MAAM,aAAa;AACpB,uBAAqB,QAAQ,SAAS,CAAC;GACvC;AAYF,QAV8B;EAC5B,OAAO;EACP,SAAS;EACT,OAAO;EACP,MAAM;EACN,IAAI,QAAQ;AACV,UAAO,IAAI,SAAS,KAAK;;EAE5B;;;;;AAQH,SAAgB,OAAa,IAA2C;CACtE,MAAM,aAAa,IAAI,MAAM;CAC7B,MAAM,WAAW,IAAuB,KAAA,EAAU;CAClD,MAAM,UAAU,IAAmB,KAAA,EAAU;CAE7C,MAAM,OAAO,SAAwB;AACnC,MAAI,YAAY,KAAK;AACrB,MAAI,UAAU,KAAA,EAAU;AAExB,SAAO,GAAG,KAAK,CACZ,MAAM,WAAW;AAChB,OAAI,SAAS,OAAY;AACzB,OAAI,YAAY,MAAM;AACtB,UAAO;IACP,CACD,OAAO,QAAQ;AACd,OAAI,UAAU,eAAe,QAAQ,MAAM,IAAI,MAAM,OAAO,IAAI,CAAC,CAAC;AAClE,OAAI,YAAY,MAAM;AACtB,SAAM;IACN;;AAUN,QAP+B;EAC7B;EACA,SAAS;EACT,OAAO;EACP,MAAM;EACP"}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_signal = require("./signal/signal.cjs");
|
|
3
|
+
const require_context = require("./context/context.cjs");
|
|
4
|
+
const require_watcher = require("./watch/watcher.cjs");
|
|
5
|
+
const require_resource = require("./fetch/resource.cjs");
|
|
6
|
+
const require_scheduler = require("./scheduler/scheduler.cjs");
|
|
7
|
+
const require_element = require("./jsx/element.cjs");
|
|
8
|
+
const require_hooks = require("./lifecycle/hooks.cjs");
|
|
9
|
+
const require_engine = require("./render/engine.cjs");
|
|
10
|
+
const require_flow = require("./render/flow.cjs");
|
|
11
|
+
const require_store = require("./store/store.cjs");
|
|
12
|
+
require("./store/index.cjs");
|
|
13
|
+
const require_computed = require("./style/computed.cjs");
|
|
14
|
+
const require_text = require("./text/text.cjs");
|
|
15
|
+
exports.ErrorBoundary = require_flow.ErrorBoundary;
|
|
16
|
+
exports.For = require_flow.For;
|
|
17
|
+
exports.Fragment = require_element.Fragment;
|
|
18
|
+
exports.Index = require_flow.Index;
|
|
19
|
+
exports.Match = require_flow.Match;
|
|
20
|
+
exports.Portal = require_flow.Portal;
|
|
21
|
+
exports.Show = require_flow.Show;
|
|
22
|
+
exports.Suspense = require_flow.Suspense;
|
|
23
|
+
exports.Switch = require_flow.Switch;
|
|
24
|
+
exports.action = require_resource.action;
|
|
25
|
+
exports.batch = require_signal.batch;
|
|
26
|
+
exports.createRoot = require_signal.createRoot;
|
|
27
|
+
exports.ctx = require_context.ctx;
|
|
28
|
+
exports.forceFlush = require_scheduler.forceFlush;
|
|
29
|
+
exports.jsx = require_element.jsx;
|
|
30
|
+
exports.jsxs = require_element.jsxs;
|
|
31
|
+
exports.layout = require_text.layout;
|
|
32
|
+
exports.load = require_resource.load;
|
|
33
|
+
exports.memo = require_signal.memo;
|
|
34
|
+
exports.merge = require_computed.merge;
|
|
35
|
+
exports.mount = require_engine.mount;
|
|
36
|
+
exports.nextFrame = require_scheduler.nextFrame;
|
|
37
|
+
exports.on = require_watcher.on;
|
|
38
|
+
exports.onCleanup = require_hooks.onCleanup;
|
|
39
|
+
exports.onMount = require_hooks.onMount;
|
|
40
|
+
exports.onReady = require_hooks.onReady;
|
|
41
|
+
exports.once = require_watcher.once;
|
|
42
|
+
exports.patch = require_store.patch;
|
|
43
|
+
exports.peek = require_signal.peek;
|
|
44
|
+
exports.prepare = require_text.prepare;
|
|
45
|
+
exports.reactiveLayout = require_text.reactiveLayout;
|
|
46
|
+
exports.renderToString = require_engine.renderToString;
|
|
47
|
+
exports.reset = require_store.reset;
|
|
48
|
+
exports.set = require_signal.set;
|
|
49
|
+
exports.sig = require_signal.sig;
|
|
50
|
+
exports.snap = require_store.snap;
|
|
51
|
+
exports.store = require_store.store;
|
|
52
|
+
exports.style = require_computed.style;
|
|
53
|
+
exports.tick = require_scheduler.tick;
|
|
54
|
+
exports.toCssString = require_computed.toCssString;
|
|
55
|
+
exports.untrack = require_signal.untrack;
|
|
56
|
+
exports.update = require_signal.update;
|
|
57
|
+
exports.use = require_context.use;
|
|
58
|
+
exports.val = require_signal.val;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { JSX } from "./jsx.cjs";
|
|
2
|
+
import { Action, Component, Computed, ComputedStyle, Context, FlowComponent, ParentComponent, ReadonlySignal, Resource, Signal, Store, StoreNode, StoreValue, StyleProps } from "./types.cjs";
|
|
3
|
+
import { ctx, use } from "./context/context.cjs";
|
|
4
|
+
import { action, load } from "./fetch/resource.cjs";
|
|
5
|
+
import { ElementType, Fragment, FunctionComponent, jsx, jsxs } from "./jsx/element.cjs";
|
|
6
|
+
import { onCleanup, onMount, onReady } from "./lifecycle/hooks.cjs";
|
|
7
|
+
import { ViewApp, mount, renderToString } from "./render/engine.cjs";
|
|
8
|
+
import { ErrorBoundary, For, Index, Match, Portal, Show, Suspense, Switch } from "./render/flow.cjs";
|
|
9
|
+
import { forceFlush, nextFrame, tick } from "./scheduler/scheduler.cjs";
|
|
10
|
+
import { Owner, batch, createRoot, memo, peek, set, sig, untrack, update, val } from "./signal/signal.cjs";
|
|
11
|
+
import { patch, reset, snap, store } from "./store/store.cjs";
|
|
12
|
+
import { merge, style, toCssString } from "./style/computed.cjs";
|
|
13
|
+
import { LayoutResult, PreparedText, layout, prepare, reactiveLayout } from "./text/text.cjs";
|
|
14
|
+
import { on, once } from "./watch/watcher.cjs";
|
|
15
|
+
export { type Action, type Component, type Computed as ComputedSignal, type ComputedStyle, type Context, type ElementType, ErrorBoundary, type FlowComponent, For, Fragment, type FunctionComponent, Index, type JSX, type LayoutResult, Match, type Owner, type ParentComponent, Portal, type PreparedText, type ReadonlySignal, type Resource, Show, type Signal, type Store, type StoreNode, type StoreValue, type StyleProps, Suspense, Switch, type ViewApp, action, batch, createRoot, ctx, forceFlush, jsx, jsxs, layout, load, memo, merge, mount, nextFrame, on, onCleanup, onMount, onReady, once, patch, peek, prepare, reactiveLayout, renderToString, reset, set, sig, snap, store, style, tick, toCssString, untrack, update, use, val };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { JSX } from "./jsx.mjs";
|
|
2
|
+
import { Action, Component, Computed, ComputedStyle, Context, FlowComponent, ParentComponent, ReadonlySignal, Resource, Signal, Store, StoreNode, StoreValue, StyleProps } from "./types.mjs";
|
|
3
|
+
import { ctx, use } from "./context/context.mjs";
|
|
4
|
+
import { action, load } from "./fetch/resource.mjs";
|
|
5
|
+
import { ElementType, Fragment, FunctionComponent, jsx, jsxs } from "./jsx/element.mjs";
|
|
6
|
+
import { onCleanup, onMount, onReady } from "./lifecycle/hooks.mjs";
|
|
7
|
+
import { ViewApp, mount, renderToString } from "./render/engine.mjs";
|
|
8
|
+
import { ErrorBoundary, For, Index, Match, Portal, Show, Suspense, Switch } from "./render/flow.mjs";
|
|
9
|
+
import { forceFlush, nextFrame, tick } from "./scheduler/scheduler.mjs";
|
|
10
|
+
import { Owner, batch, createRoot, memo, peek, set, sig, untrack, update, val } from "./signal/signal.mjs";
|
|
11
|
+
import { patch, reset, snap, store } from "./store/store.mjs";
|
|
12
|
+
import { merge, style, toCssString } from "./style/computed.mjs";
|
|
13
|
+
import { LayoutResult, PreparedText, layout, prepare, reactiveLayout } from "./text/text.mjs";
|
|
14
|
+
import { on, once } from "./watch/watcher.mjs";
|
|
15
|
+
export { type Action, type Component, type Computed as ComputedSignal, type ComputedStyle, type Context, type ElementType, ErrorBoundary, type FlowComponent, For, Fragment, type FunctionComponent, Index, type JSX, type LayoutResult, Match, type Owner, type ParentComponent, Portal, type PreparedText, type ReadonlySignal, type Resource, Show, type Signal, type Store, type StoreNode, type StoreValue, type StyleProps, Suspense, Switch, type ViewApp, action, batch, createRoot, ctx, forceFlush, jsx, jsxs, layout, load, memo, merge, mount, nextFrame, on, onCleanup, onMount, onReady, once, patch, peek, prepare, reactiveLayout, renderToString, reset, set, sig, snap, store, style, tick, toCssString, untrack, update, use, val };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { batch, createRoot, memo, peek, set, sig, untrack, update, val } from "./signal/signal.mjs";
|
|
2
|
+
import { ctx, use } from "./context/context.mjs";
|
|
3
|
+
import { on, once } from "./watch/watcher.mjs";
|
|
4
|
+
import { action, load } from "./fetch/resource.mjs";
|
|
5
|
+
import { forceFlush, nextFrame, tick } from "./scheduler/scheduler.mjs";
|
|
6
|
+
import { Fragment, jsx, jsxs } from "./jsx/element.mjs";
|
|
7
|
+
import { onCleanup, onMount, onReady } from "./lifecycle/hooks.mjs";
|
|
8
|
+
import { mount, renderToString } from "./render/engine.mjs";
|
|
9
|
+
import { ErrorBoundary, For, Index, Match, Portal, Show, Suspense, Switch } from "./render/flow.mjs";
|
|
10
|
+
import { patch, reset, snap, store } from "./store/store.mjs";
|
|
11
|
+
import "./store/index.mjs";
|
|
12
|
+
import { merge, style, toCssString } from "./style/computed.mjs";
|
|
13
|
+
import { layout, prepare, reactiveLayout } from "./text/text.mjs";
|
|
14
|
+
export { ErrorBoundary, For, Fragment, Index, Match, Portal, Show, Suspense, Switch, action, batch, createRoot, ctx, forceFlush, jsx, jsxs, layout, load, memo, merge, mount, nextFrame, on, onCleanup, onMount, onReady, once, patch, peek, prepare, reactiveLayout, renderToString, reset, set, sig, snap, store, style, tick, toCssString, untrack, update, use, val };
|