elegance-js 2.0.18 → 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.
@@ -41,4 +41,21 @@ export declare const getState: () => {
41
41
  id: number;
42
42
  bind?: number;
43
43
  }[];
44
+ export declare const initializeObjectAttributes: () => never[];
45
+ export declare const getObjectAttributes: () => ({
46
+ type: ObjectAttributeType;
47
+ id: string | number;
48
+ value: any;
49
+ bind?: string;
50
+ } | {
51
+ type: ObjectAttributeType;
52
+ refs: {
53
+ id: number;
54
+ bind?: string;
55
+ }[];
56
+ initialValues: any[];
57
+ update: (...value: any) => any;
58
+ } | {
59
+ type: ObjectAttributeType;
60
+ })[];
44
61
  export {};
@@ -58,7 +58,6 @@ var reactiveMap = function(template, deps) {
58
58
  const attributes = [];
59
59
  const currentlyWatched = [];
60
60
  const createElements = () => {
61
- const state3 = pd[client.currentPage].stateManager;
62
61
  for (let i = 0; i < value.length; i += 1) {
63
62
  const htmlElement = client.renderRecursively(templateFn2.value(value[i], i, ...deps2), attributes);
64
63
  htmlElement.setAttribute("map-id", subject2.id.toString());
@@ -71,7 +70,7 @@ var reactiveMap = function(template, deps) {
71
70
  case 2 /* OBSERVER */: {
72
71
  const { field, subjects, updateCallback } = attribute;
73
72
  for (const reference of subjects) {
74
- const subject3 = state3.get(reference.id, reference.bind);
73
+ const subject3 = state2.get(reference.id, reference.bind);
75
74
  const updateFunction = (value2) => {
76
75
  values[subject3.id] = value2;
77
76
  try {
@@ -84,7 +83,7 @@ var reactiveMap = function(template, deps) {
84
83
  }
85
84
  };
86
85
  updateFunction(subject3.value);
87
- state3.observe(subject3, updateFunction, elementKey);
86
+ state2.observe(subject3, updateFunction, elementKey);
88
87
  currentlyWatched.push({
89
88
  key: elementKey,
90
89
  subject: subject3
@@ -112,10 +111,8 @@ var reactiveMap = function(template, deps) {
112
111
  for (const el2 of list) {
113
112
  el2.remove();
114
113
  }
115
- const pageData = pd[client.currentPage];
116
- const state3 = pageData.stateManager;
117
114
  for (const watched of currentlyWatched) {
118
- state3.unobserve(watched.subject, watched.key);
115
+ state2.unobserve(watched.subject, watched.key);
119
116
  }
120
117
  currentlyWatched.splice(0, currentlyWatched.length);
121
118
  };
@@ -156,9 +153,15 @@ var initializeState = () => globalThis.__SERVER_CURRENT_STATE__ = [];
156
153
  var getState = () => {
157
154
  return globalThis.__SERVER_CURRENT_STATE__;
158
155
  };
156
+ var initializeObjectAttributes = () => globalThis.__SERVER_CURRENT_OBJECT_ATTRIBUTES__ = [];
157
+ var getObjectAttributes = () => {
158
+ return globalThis.__SERVER_CURRENT_OBJECT_ATTRIBUTES__;
159
+ };
159
160
  export {
160
161
  eventListener,
162
+ getObjectAttributes,
161
163
  getState,
164
+ initializeObjectAttributes,
162
165
  initializeState,
163
166
  state
164
167
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "elegance-js",
3
- "version": "2.0.18",
3
+ "version": "2.1.0",
4
4
  "description": "Web-Framework",
5
5
  "type": "module",
6
6
  "bin": {
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "devDependencies": {
41
41
  "@tailwindcss/cli": "^4.0.3",
42
- "@types/node": "^22.9.1",
42
+ "@types/node": "^22.18.12",
43
43
  "tailwindcss": "^4.0.3",
44
44
  "typescript": "^5.8.2"
45
45
  }
package/scripts/prod.js CHANGED
@@ -17,6 +17,7 @@ compile({
17
17
  runServer: true,
18
18
  port: 3000,
19
19
  },
20
+ hotReload: undefined,
20
21
  postCompile: () => {
21
22
  if (child !== undefined) {
22
23
  child.kill('SIGKILL');
@@ -1,3 +0,0 @@
1
- export declare const Breakpoint: (options: {
2
- id?: number;
3
- }, ...children: Child[]) => BuiltElement<"div">;
@@ -1,20 +0,0 @@
1
- // src/components/Breakpoint.ts
2
- var Breakpoint = (options, ...children) => {
3
- process.emitWarning(
4
- "Function Breakpoint() is deprecated. Prefer layout.ts files instead.",
5
- { type: "DeprecationWarning" }
6
- );
7
- if (options.id === void 0) throw `Breakpoints must set a name attribute.`;
8
- const id = options.id;
9
- delete options.id;
10
- return div(
11
- {
12
- bp: id,
13
- ...options
14
- },
15
- ...children
16
- );
17
- };
18
- export {
19
- Breakpoint
20
- };
@@ -1,2 +0,0 @@
1
- export declare const processPageElements: (element: Child, objectAttributes: Array<any>, parent: Child) => Promise<Child>;
2
- export declare const buildDynamicPage: (filePath: string, DIST_DIR: string, req: any, res: any) => Promise<string | false>;