amateras 0.7.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "amateras",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Amateras is a DOM Utility library.",
5
5
  "module": "index.ts",
6
6
  "type": "module",
@@ -31,7 +31,6 @@
31
31
  "./css": "./packages/css/src/index.ts",
32
32
  "./css/*": "./packages/css/src/ext/*.ts",
33
33
  "./router": "./packages/router/src/index.ts",
34
- "./ssr": "./packages/ssr/src/index.ts",
35
34
  "./i18n": "./packages/i18n/src/index.ts",
36
35
  "./idb": "./packages/idb/src/index.ts",
37
36
  "./idb/core": "./packages/idb/src/core.ts",
@@ -1,19 +0,0 @@
1
- {
2
- "name": "@amateras/ssr",
3
- "peerDependencies": {
4
- "@amateras/core": "workspace:*",
5
- "@amateras/utils": "workspace:*",
6
- "@amateras/router": "workspace:*",
7
- "@amateras/signal": "workspace:*"
8
- },
9
- "imports": {
10
- "#structure/*": "./src/structure/*.ts",
11
- "#lib/*": "./src/lib/*.ts",
12
- "#node/*": "./src/node/*.ts"
13
- },
14
- "exports": {
15
- "./structure/*": "./src/structure/*.ts",
16
- "./lib/*": "./src/lib/*.ts",
17
- "./node/*": "./src/node/*.ts"
18
- }
19
- }
@@ -1,38 +0,0 @@
1
- import '@amateras/signal';
2
- import { Page } from "@amateras/router";
3
- import type { SignalFunction } from "@amateras/signal";
4
- import { isAsyncFunction, isFunction } from '@amateras/utils';
5
- import { onclient, onserver } from '@amateras/core/env';
6
-
7
- declare global {
8
- export var hydrate: Record<string, any>;
9
- }
10
-
11
- declare module '@amateras/router' {
12
- export interface Page {
13
- data<D>(data: D | (() => OrPromise<D>)): Promise<SignalFunction<D>>
14
- }
15
- }
16
-
17
- onclient(() => {
18
- if (typeof window.hydrate === 'undefined') window.hydrate = {};
19
- })
20
-
21
- //@ts-expect-error
22
- onserver(() => global.hydrate = {})
23
-
24
- Object.assign(Page.prototype, {
25
- async data<D>(this: Page, data: D | (() => OrPromise<D>)) {
26
- const hydrateData = hydrate[this.pathId];
27
- const d = hydrateData ?? (
28
- isFunction(data)
29
- ? isAsyncFunction(data)
30
- ? await data()
31
- : data()
32
- : data
33
- )
34
- const data$ = $.signal(d);
35
- onserver(() => $.effect(() => hydrate[this.pathId] = data$()))
36
- return data$;
37
- }
38
- })