elegance-js 2.0.17 → 2.0.19
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 +1 -1
- package/scripts/prod.js +1 -0
- package/dist/docs/components/Header.d.ts +0 -1
- package/dist/docs/components/Header.mjs +0 -249
- package/dist/docs/components/RootLayout.d.ts +0 -1
- package/dist/docs/components/RootLayout.mjs +0 -10
- package/dist/docs/docs/basics/page.d.ts +0 -2
- package/dist/docs/docs/basics/page.mjs +0 -1057
- package/dist/docs/docs/compilations/page.d.ts +0 -2
- package/dist/docs/docs/compilations/page.mjs +0 -15
- package/dist/docs/docs/components/CodeBlock.d.ts +0 -2
- package/dist/docs/docs/components/CodeBlock.mjs +0 -324
- package/dist/docs/docs/components/DocsLayout.d.ts +0 -1
- package/dist/docs/docs/components/DocsLayout.mjs +0 -527
- package/dist/docs/docs/components/Header.d.ts +0 -1
- package/dist/docs/docs/components/Header.mjs +0 -160
- package/dist/docs/docs/components/Mono.d.ts +0 -1
- package/dist/docs/docs/components/Mono.mjs +0 -7
- package/dist/docs/docs/components/PageHeading.d.ts +0 -1
- package/dist/docs/docs/components/PageHeading.mjs +0 -9
- package/dist/docs/docs/components/Paragraph.d.ts +0 -1
- package/dist/docs/docs/components/Paragraph.mjs +0 -10
- package/dist/docs/docs/components/Separator.d.ts +0 -1
- package/dist/docs/docs/components/Separator.mjs +0 -7
- package/dist/docs/docs/components/SubHeading.d.ts +0 -1
- package/dist/docs/docs/components/SubHeading.mjs +0 -8
- package/dist/docs/docs/components/SubSeparator.d.ts +0 -1
- package/dist/docs/docs/components/SubSeparator.mjs +0 -7
- package/dist/docs/docs/components/Subtext.d.ts +0 -1
- package/dist/docs/docs/components/Subtext.mjs +0 -8
- package/dist/docs/docs/concepts/page.d.ts +0 -2
- package/dist/docs/docs/concepts/page.mjs +0 -954
- package/dist/docs/docs/page-files/page.d.ts +0 -2
- package/dist/docs/docs/page-files/page.mjs +0 -1206
- package/dist/docs/docs/route.d.ts +0 -2
- package/dist/docs/docs/route.mjs +0 -8
- package/dist/docs/docs/running/page.d.ts +0 -2
- package/dist/docs/docs/running/page.mjs +0 -7
- package/dist/docs/nullpage/page.d.ts +0 -2
- package/dist/docs/nullpage/page.mjs +0 -58
- package/dist/docs/page.d.ts +0 -2
- package/dist/docs/page.mjs +0 -437
- package/dist/docs/utils/MEGALEXER.d.ts +0 -1
- package/dist/docs/utils/MEGALEXER.mjs +0 -171
- package/dist/types/Metadata.d.ts +0 -19
- package/dist/types/Metadata.mjs +0 -15
|
@@ -1,954 +0,0 @@
|
|
|
1
|
-
// src/internal/deprecate.ts
|
|
2
|
-
var ShowDeprecationWarning = (msg) => {
|
|
3
|
-
console.warn("\x1B[31m", msg, "\x1B[0m");
|
|
4
|
-
console.trace("Stack Trace:");
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
// src/server/loadHook.ts
|
|
8
|
-
var loadHook = (deps, fn, bind) => {
|
|
9
|
-
const stringFn = fn.toString();
|
|
10
|
-
const depsArray = (deps || []).map((dep) => ({
|
|
11
|
-
id: dep.id,
|
|
12
|
-
bind: dep.bind
|
|
13
|
-
}));
|
|
14
|
-
let dependencyString = "[";
|
|
15
|
-
for (const dep of depsArray) {
|
|
16
|
-
dependencyString += `{id:${dep.id}`;
|
|
17
|
-
if (dep.bind) dependencyString += `,bind:${dep.bind}`;
|
|
18
|
-
dependencyString += `},`;
|
|
19
|
-
}
|
|
20
|
-
dependencyString += "]";
|
|
21
|
-
const isAsync = fn.constructor.name === "AsyncFunction";
|
|
22
|
-
const wrapperFn = isAsync ? `async (state) => await (${stringFn})(state, ...state.getAll(${dependencyString}))` : `(state) => (${stringFn})(state, ...state.getAll(${dependencyString}))`;
|
|
23
|
-
globalThis.__SERVER_CURRENT_LOADHOOKS__.push({
|
|
24
|
-
fn: wrapperFn,
|
|
25
|
-
bind: bind || ""
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
var createLoadHook = (options) => {
|
|
29
|
-
ShowDeprecationWarning("WARNING: createLoadHook() is a deprecated function. Use loadHook() from elegance-js/loadHook instead.");
|
|
30
|
-
const stringFn = options.fn.toString();
|
|
31
|
-
const deps = (options.deps || []).map((dep) => ({
|
|
32
|
-
id: dep.id,
|
|
33
|
-
bind: dep.bind
|
|
34
|
-
}));
|
|
35
|
-
let dependencyString = "[";
|
|
36
|
-
for (const dep of deps) {
|
|
37
|
-
dependencyString += `{id:${dep.id}`;
|
|
38
|
-
if (dep.bind) dependencyString += `,bind:${dep.bind}`;
|
|
39
|
-
dependencyString += `},`;
|
|
40
|
-
}
|
|
41
|
-
dependencyString += "]";
|
|
42
|
-
const isAsync = options.fn.constructor.name === "AsyncFunction";
|
|
43
|
-
const wrapperFn = isAsync ? `async (state) => await (${stringFn})(state, ...state.getAll(${dependencyString}))` : `(state) => (${stringFn})(state, ...state.getAll(${dependencyString}))`;
|
|
44
|
-
globalThis.__SERVER_CURRENT_LOADHOOKS__.push({
|
|
45
|
-
fn: wrapperFn,
|
|
46
|
-
bind: options.bind || ""
|
|
47
|
-
});
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
// src/server/state.ts
|
|
51
|
-
if (!globalThis.__SERVER_CURRENT_STATE_ID__) {
|
|
52
|
-
globalThis.__SERVER_CURRENT_STATE_ID__ = 1;
|
|
53
|
-
}
|
|
54
|
-
var eventListener = (dependencies, eventListener2) => {
|
|
55
|
-
const deps = dependencies.map((dep) => ({ id: dep.id, bind: dep.bind }));
|
|
56
|
-
let dependencyString = "[";
|
|
57
|
-
for (const dep of deps) {
|
|
58
|
-
dependencyString += `{id:${dep.id}`;
|
|
59
|
-
if (dep.bind) dependencyString += `,bind:${dep.bind}`;
|
|
60
|
-
dependencyString += `},`;
|
|
61
|
-
}
|
|
62
|
-
dependencyString += "]";
|
|
63
|
-
const value = {
|
|
64
|
-
id: __SERVER_CURRENT_STATE_ID__ += 1,
|
|
65
|
-
type: 1 /* STATE */,
|
|
66
|
-
value: new Function(
|
|
67
|
-
"state",
|
|
68
|
-
"event",
|
|
69
|
-
`(${eventListener2.toString()})(event, ...state.getAll(${dependencyString}))`
|
|
70
|
-
)
|
|
71
|
-
};
|
|
72
|
-
globalThis.__SERVER_CURRENT_STATE__.push(value);
|
|
73
|
-
return value;
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
// src/server/observe.ts
|
|
77
|
-
var observe = (refs, update) => {
|
|
78
|
-
const returnValue = {
|
|
79
|
-
type: 2 /* OBSERVER */,
|
|
80
|
-
initialValues: refs.map((ref) => ref.value),
|
|
81
|
-
update,
|
|
82
|
-
refs: refs.map((ref) => ({
|
|
83
|
-
id: ref.id,
|
|
84
|
-
bind: ref.bind
|
|
85
|
-
}))
|
|
86
|
-
};
|
|
87
|
-
return returnValue;
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
// src/components/Link.ts
|
|
91
|
-
loadHook(
|
|
92
|
-
[],
|
|
93
|
-
() => {
|
|
94
|
-
const anchors = Array.from(document.querySelectorAll("a[prefetch]"));
|
|
95
|
-
const elsToClear = [];
|
|
96
|
-
for (const anchor of anchors) {
|
|
97
|
-
const prefetch = anchor.getAttribute("prefetch");
|
|
98
|
-
const href = new URL(anchor.href);
|
|
99
|
-
switch (prefetch) {
|
|
100
|
-
case "load":
|
|
101
|
-
client.fetchPage(href);
|
|
102
|
-
break;
|
|
103
|
-
case "hover":
|
|
104
|
-
const fn = () => {
|
|
105
|
-
client.fetchPage(href);
|
|
106
|
-
};
|
|
107
|
-
anchor.addEventListener("mouseenter", fn);
|
|
108
|
-
elsToClear.push({
|
|
109
|
-
el: anchor,
|
|
110
|
-
fn
|
|
111
|
-
});
|
|
112
|
-
break;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
return () => {
|
|
116
|
-
for (const listener of elsToClear) {
|
|
117
|
-
listener.el.removeEventListener("mouseenter", listener.fn);
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
);
|
|
122
|
-
var navigate = eventListener(
|
|
123
|
-
[],
|
|
124
|
-
(event) => {
|
|
125
|
-
const target = new URL(event.currentTarget.href);
|
|
126
|
-
const client2 = globalThis.client;
|
|
127
|
-
const sanitizedTarget = client2.sanitizePathname(target.pathname);
|
|
128
|
-
const sanitizedCurrent = client2.sanitizePathname(window.location.pathname);
|
|
129
|
-
if (sanitizedTarget === sanitizedCurrent) {
|
|
130
|
-
if (target.hash === window.location.hash) return event.preventDefault();
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
event.preventDefault();
|
|
134
|
-
client2.navigateLocally(target.href);
|
|
135
|
-
}
|
|
136
|
-
);
|
|
137
|
-
var Link = (options, ...children) => {
|
|
138
|
-
if (!options.href) {
|
|
139
|
-
throw `Link elements must have a HREF attribute set.`;
|
|
140
|
-
}
|
|
141
|
-
if (!options.href.startsWith("/")) {
|
|
142
|
-
throw `Link elements may only navigate to local pages. "/"`;
|
|
143
|
-
}
|
|
144
|
-
return a(
|
|
145
|
-
{
|
|
146
|
-
...options,
|
|
147
|
-
onClick: navigate
|
|
148
|
-
},
|
|
149
|
-
...children
|
|
150
|
-
);
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
// src/docs/components/RootLayout.ts
|
|
154
|
-
var RootLayout = (...children) => body(
|
|
155
|
-
{
|
|
156
|
-
class: "bg-background-900 text-text-50 font-inter select-none text-text-50"
|
|
157
|
-
},
|
|
158
|
-
...children
|
|
159
|
-
);
|
|
160
|
-
|
|
161
|
-
// src/server/createState.ts
|
|
162
|
-
if (!globalThis.__SERVER_CURRENT_STATE_ID__) {
|
|
163
|
-
globalThis.__SERVER_CURRENT_STATE_ID__ = 1;
|
|
164
|
-
}
|
|
165
|
-
var createState = (value, options) => {
|
|
166
|
-
ShowDeprecationWarning("WARNING: The createState() and function is deprecated. Please use state() instead, from elegance-js/state.");
|
|
167
|
-
const serverStateEntry = {
|
|
168
|
-
id: __SERVER_CURRENT_STATE_ID__ += 1,
|
|
169
|
-
value,
|
|
170
|
-
type: 1 /* STATE */,
|
|
171
|
-
bind: options?.bind
|
|
172
|
-
};
|
|
173
|
-
globalThis.__SERVER_CURRENT_STATE__.push(serverStateEntry);
|
|
174
|
-
return serverStateEntry;
|
|
175
|
-
};
|
|
176
|
-
var createEventListener = ({
|
|
177
|
-
eventListener: eventListener2,
|
|
178
|
-
dependencies = [],
|
|
179
|
-
params
|
|
180
|
-
}) => {
|
|
181
|
-
ShowDeprecationWarning("WARNING: The createEventListener() and function is deprecated. Please use eventListener() instead, from elegance-js/state.");
|
|
182
|
-
const deps = dependencies.map((dep) => ({ id: dep.id, bind: dep.bind }));
|
|
183
|
-
let dependencyString = "[";
|
|
184
|
-
for (const dep of deps) {
|
|
185
|
-
dependencyString += `{id:${dep.id}`;
|
|
186
|
-
if (dep.bind) dependencyString += `,bind:${dep.bind}`;
|
|
187
|
-
dependencyString += `},`;
|
|
188
|
-
}
|
|
189
|
-
dependencyString += "]";
|
|
190
|
-
const value = {
|
|
191
|
-
id: __SERVER_CURRENT_STATE_ID__ += 1,
|
|
192
|
-
type: 1 /* STATE */,
|
|
193
|
-
value: new Function(
|
|
194
|
-
"state",
|
|
195
|
-
"event",
|
|
196
|
-
`(${eventListener2.toString()})({ event, ...${JSON.stringify(params || {})} }, ...state.getAll(${dependencyString}))`
|
|
197
|
-
)
|
|
198
|
-
};
|
|
199
|
-
globalThis.__SERVER_CURRENT_STATE__.push(value);
|
|
200
|
-
return value;
|
|
201
|
-
};
|
|
202
|
-
|
|
203
|
-
// src/docs/utils/MEGALEXER.ts
|
|
204
|
-
var tokenize = (input) => {
|
|
205
|
-
const tokens = [];
|
|
206
|
-
const length = input.length;
|
|
207
|
-
let index = 0;
|
|
208
|
-
const keywords = /* @__PURE__ */ new Set([
|
|
209
|
-
"if",
|
|
210
|
-
"else",
|
|
211
|
-
"for",
|
|
212
|
-
"while",
|
|
213
|
-
"function",
|
|
214
|
-
"return",
|
|
215
|
-
"class",
|
|
216
|
-
"const",
|
|
217
|
-
"let",
|
|
218
|
-
"var",
|
|
219
|
-
"interface",
|
|
220
|
-
"extends",
|
|
221
|
-
"implements",
|
|
222
|
-
"export",
|
|
223
|
-
"import",
|
|
224
|
-
"from"
|
|
225
|
-
]);
|
|
226
|
-
const operatorChars = /* @__PURE__ */ new Set([
|
|
227
|
-
"+",
|
|
228
|
-
"-",
|
|
229
|
-
"*",
|
|
230
|
-
"/",
|
|
231
|
-
"%",
|
|
232
|
-
"=",
|
|
233
|
-
">",
|
|
234
|
-
"<",
|
|
235
|
-
"!",
|
|
236
|
-
"&",
|
|
237
|
-
"|",
|
|
238
|
-
"^",
|
|
239
|
-
"~",
|
|
240
|
-
"?",
|
|
241
|
-
":"
|
|
242
|
-
]);
|
|
243
|
-
const punctuationChars = /* @__PURE__ */ new Set([
|
|
244
|
-
";",
|
|
245
|
-
",",
|
|
246
|
-
".",
|
|
247
|
-
"(",
|
|
248
|
-
")",
|
|
249
|
-
"{",
|
|
250
|
-
"}",
|
|
251
|
-
"[",
|
|
252
|
-
"]"
|
|
253
|
-
]);
|
|
254
|
-
const peek = (offset = 1) => index + offset < length ? input[index + offset] : "";
|
|
255
|
-
const readWhile = (predicate) => {
|
|
256
|
-
const start = index;
|
|
257
|
-
while (index < length && predicate(input[index])) {
|
|
258
|
-
index++;
|
|
259
|
-
}
|
|
260
|
-
return input.slice(start, index);
|
|
261
|
-
};
|
|
262
|
-
const readString = (quoteType) => {
|
|
263
|
-
let value = input[index++];
|
|
264
|
-
while (index < length && input[index] !== quoteType) {
|
|
265
|
-
if (input[index] === "\\") {
|
|
266
|
-
value += input[index++];
|
|
267
|
-
if (index < length) {
|
|
268
|
-
value += input[index++];
|
|
269
|
-
}
|
|
270
|
-
} else {
|
|
271
|
-
value += input[index++];
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
if (index < length) {
|
|
275
|
-
value += input[index++];
|
|
276
|
-
}
|
|
277
|
-
return value;
|
|
278
|
-
};
|
|
279
|
-
const readLineComment = () => {
|
|
280
|
-
const start = index;
|
|
281
|
-
index += 2;
|
|
282
|
-
while (index < length && input[index] !== "\n") {
|
|
283
|
-
index++;
|
|
284
|
-
}
|
|
285
|
-
return input.slice(start, index);
|
|
286
|
-
};
|
|
287
|
-
const readBlockComment = () => {
|
|
288
|
-
const start = index;
|
|
289
|
-
index += 2;
|
|
290
|
-
while (index < length && !(input[index] === "*" && peek() === "/")) {
|
|
291
|
-
index++;
|
|
292
|
-
}
|
|
293
|
-
if (index < length) {
|
|
294
|
-
index += 2;
|
|
295
|
-
}
|
|
296
|
-
return input.slice(start, index);
|
|
297
|
-
};
|
|
298
|
-
while (index < length) {
|
|
299
|
-
const char = input[index];
|
|
300
|
-
const startPos = index;
|
|
301
|
-
if (/\s/.test(char)) {
|
|
302
|
-
const value = readWhile((c) => /\s/.test(c));
|
|
303
|
-
tokens.push({ type: "" /* Whitespace */, value, position: startPos });
|
|
304
|
-
continue;
|
|
305
|
-
}
|
|
306
|
-
if (char === "/") {
|
|
307
|
-
if (peek() === "/") {
|
|
308
|
-
const value = readLineComment();
|
|
309
|
-
tokens.push({ type: "text-gray-400" /* Comment */, value, position: startPos });
|
|
310
|
-
continue;
|
|
311
|
-
} else if (peek() === "*") {
|
|
312
|
-
const value = readBlockComment();
|
|
313
|
-
tokens.push({ type: "text-gray-400" /* Comment */, value, position: startPos });
|
|
314
|
-
continue;
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
if (char === '"' || char === "'") {
|
|
318
|
-
const value = readString(char);
|
|
319
|
-
tokens.push({ type: "text-green-200" /* String */, value, position: startPos });
|
|
320
|
-
continue;
|
|
321
|
-
}
|
|
322
|
-
if (/\d/.test(char)) {
|
|
323
|
-
const value = readWhile((c) => /[\d\.]/.test(c));
|
|
324
|
-
tokens.push({ type: "text-blue-400" /* Number */, value, position: startPos });
|
|
325
|
-
continue;
|
|
326
|
-
}
|
|
327
|
-
if (/[a-zA-Z_$]/.test(char)) {
|
|
328
|
-
const value = readWhile((c) => /[a-zA-Z0-9_$]/.test(c));
|
|
329
|
-
let type = "text-orange-300" /* Identifier */;
|
|
330
|
-
if (keywords.has(value)) {
|
|
331
|
-
type = "text-amber-100 font-semibold" /* Keyword */;
|
|
332
|
-
} else if (value === "true" || value === "false") {
|
|
333
|
-
type = "text-blue-200" /* Boolean */;
|
|
334
|
-
}
|
|
335
|
-
let tempIndex = index;
|
|
336
|
-
while (tempIndex < length && /\s/.test(input[tempIndex])) {
|
|
337
|
-
tempIndex++;
|
|
338
|
-
}
|
|
339
|
-
if (tempIndex < length && input[tempIndex] === "(") {
|
|
340
|
-
type = "text-red-300" /* FunctionCall */;
|
|
341
|
-
}
|
|
342
|
-
tokens.push({ type, value, position: startPos });
|
|
343
|
-
continue;
|
|
344
|
-
}
|
|
345
|
-
if (operatorChars.has(char)) {
|
|
346
|
-
let value = char;
|
|
347
|
-
index++;
|
|
348
|
-
if (index < length && operatorChars.has(input[index])) {
|
|
349
|
-
value += input[index++];
|
|
350
|
-
}
|
|
351
|
-
tokens.push({ type: "" /* Operator */, value, position: startPos });
|
|
352
|
-
continue;
|
|
353
|
-
}
|
|
354
|
-
if (punctuationChars.has(char)) {
|
|
355
|
-
tokens.push({ type: "text-gray-400" /* Punctuation */, value: char, position: startPos });
|
|
356
|
-
index++;
|
|
357
|
-
continue;
|
|
358
|
-
}
|
|
359
|
-
tokens.push({ type: "" /* Unknown */, value: char, position: startPos });
|
|
360
|
-
index++;
|
|
361
|
-
}
|
|
362
|
-
return tokens;
|
|
363
|
-
};
|
|
364
|
-
var escapeHtml = (text) => text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
365
|
-
var highlightCode = (code) => {
|
|
366
|
-
const tokens = tokenize(code);
|
|
367
|
-
return tokens.map(
|
|
368
|
-
(token) => token.type === "" /* Whitespace */ ? token.value : `<span class="${token.type}">${escapeHtml(token.value)}</span>`
|
|
369
|
-
).join("");
|
|
370
|
-
};
|
|
371
|
-
|
|
372
|
-
// src/docs/docs/components/CodeBlock.ts
|
|
373
|
-
var isToastShowing = createState(false);
|
|
374
|
-
var toastTimeoutId = createState(0);
|
|
375
|
-
var copyCode = createEventListener({
|
|
376
|
-
dependencies: [
|
|
377
|
-
isToastShowing,
|
|
378
|
-
toastTimeoutId
|
|
379
|
-
],
|
|
380
|
-
eventListener: async (params, isToastShowing2, toastTimeoutId2) => {
|
|
381
|
-
const children = params.event.currentTarget.children;
|
|
382
|
-
const pre2 = children.item(0);
|
|
383
|
-
const content = pre2.innerText;
|
|
384
|
-
await navigator.clipboard.writeText(content);
|
|
385
|
-
if (toastTimeoutId2.value !== 0) clearTimeout(toastTimeoutId2.value);
|
|
386
|
-
isToastShowing2.value = true;
|
|
387
|
-
isToastShowing2.signal();
|
|
388
|
-
const timeoutId = window.setTimeout(() => {
|
|
389
|
-
isToastShowing2.value = false;
|
|
390
|
-
isToastShowing2.signal();
|
|
391
|
-
}, 3e3);
|
|
392
|
-
toastTimeoutId2.value = timeoutId;
|
|
393
|
-
}
|
|
394
|
-
});
|
|
395
|
-
var Toast = (bind) => {
|
|
396
|
-
createLoadHook({
|
|
397
|
-
bind,
|
|
398
|
-
deps: [
|
|
399
|
-
toastTimeoutId,
|
|
400
|
-
isToastShowing
|
|
401
|
-
],
|
|
402
|
-
fn: (state2, toastTimeoutId2, isToastShowing2) => {
|
|
403
|
-
return () => {
|
|
404
|
-
clearTimeout(toastTimeoutId2.value);
|
|
405
|
-
isToastShowing2.value = false;
|
|
406
|
-
isToastShowing2.signal();
|
|
407
|
-
};
|
|
408
|
-
}
|
|
409
|
-
});
|
|
410
|
-
return div(
|
|
411
|
-
{
|
|
412
|
-
class: observe(
|
|
413
|
-
[isToastShowing],
|
|
414
|
-
(isShowing) => {
|
|
415
|
-
const modularClass = isShowing ? "right-8" : "right-0 translate-x-full";
|
|
416
|
-
return `fixed z-50 shadow-lg rounded-sm duration-200 bottom-4 px-4 py-2 w-max bg-background-950 ` + modularClass;
|
|
417
|
-
}
|
|
418
|
-
)
|
|
419
|
-
},
|
|
420
|
-
h1({
|
|
421
|
-
class: "font-mono uppercase"
|
|
422
|
-
}, "copied to clipboard")
|
|
423
|
-
);
|
|
424
|
-
};
|
|
425
|
-
var escapeHtml2 = (str) => {
|
|
426
|
-
const replaced = str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
427
|
-
return replaced;
|
|
428
|
-
};
|
|
429
|
-
var CodeBlock = (value, parse = true) => div(
|
|
430
|
-
{
|
|
431
|
-
class: `bg-background-950 hover:cursor-pointer p-2 rounded-sm
|
|
432
|
-
border-[1px] border-background-800 w-max my-3 max-w-full
|
|
433
|
-
overflow-scroll`,
|
|
434
|
-
onClick: copyCode
|
|
435
|
-
},
|
|
436
|
-
pre({}, parse ? highlightCode(value) : escapeHtml2(value))
|
|
437
|
-
);
|
|
438
|
-
|
|
439
|
-
// src/components/Breakpoint.ts
|
|
440
|
-
var Breakpoint = (options, ...children) => {
|
|
441
|
-
process.emitWarning(
|
|
442
|
-
"Function Breakpoint() is deprecated. Prefer layout.ts files instead.",
|
|
443
|
-
{ type: "DeprecationWarning" }
|
|
444
|
-
);
|
|
445
|
-
if (options.id === void 0) throw `Breakpoints must set a name attribute.`;
|
|
446
|
-
const id = options.id;
|
|
447
|
-
delete options.id;
|
|
448
|
-
return div(
|
|
449
|
-
{
|
|
450
|
-
bp: id,
|
|
451
|
-
...options
|
|
452
|
-
},
|
|
453
|
-
...children
|
|
454
|
-
);
|
|
455
|
-
};
|
|
456
|
-
|
|
457
|
-
// src/docs/docs/components/Header.ts
|
|
458
|
-
var Header = () => header(
|
|
459
|
-
{
|
|
460
|
-
class: "sticky z-10 lef-0 right-0 top-0 text-text-50 font-inter overflow-hidden duration-300 border-b-[1px] border-b-transparent"
|
|
461
|
-
},
|
|
462
|
-
div(
|
|
463
|
-
{
|
|
464
|
-
class: "group duration-300 border-b-[1px] hover:border-b-transparent pointer-fine:hover:bg-accent-400 border-b-background-800 bg-background-950"
|
|
465
|
-
},
|
|
466
|
-
div(
|
|
467
|
-
{
|
|
468
|
-
class: "max-w-[1200px] w-full mx-auto flex pr-2 px-3 sm:px-5 sm:min-[calc(1200px+1rem)]:px-0"
|
|
469
|
-
},
|
|
470
|
-
div(
|
|
471
|
-
{
|
|
472
|
-
class: "flex min-w-max w-full items-center z-10"
|
|
473
|
-
},
|
|
474
|
-
Link(
|
|
475
|
-
{
|
|
476
|
-
href: "/",
|
|
477
|
-
class: "flex items-center gap-1 h-full"
|
|
478
|
-
},
|
|
479
|
-
p({
|
|
480
|
-
class: "font-niconne pointer-fine:group-hover:text-background-950 font-bold text-xl sm:text-3xl relative top-0 z-20 duration-300 pointer-events-none",
|
|
481
|
-
innerText: "Elegance"
|
|
482
|
-
}),
|
|
483
|
-
p({
|
|
484
|
-
innerText: "JS",
|
|
485
|
-
class: "font-bold pointer-fine:group-hover:text-background-950 relative top-0 text-xl sm:text-3xl z-10 text-accent-400 duration-300 pointer-events-none"
|
|
486
|
-
})
|
|
487
|
-
)
|
|
488
|
-
),
|
|
489
|
-
div(
|
|
490
|
-
{
|
|
491
|
-
class: "flex py-2 sm:py-4 flex relative items-center justify-end w-full"
|
|
492
|
-
},
|
|
493
|
-
Link({
|
|
494
|
-
prefetch: "hover",
|
|
495
|
-
class: "z-10 text-xs uppercase font-bold px-4 py-2 rounded-full duration-300 bg-accent-400 text-primary-900 pointer-fine:group-hover:bg-background-950 pointer-fine:group-hover:text-accent-400 group-hover:hover:bg-text-50 group-hover:hover:text-background-950",
|
|
496
|
-
href: "/docs",
|
|
497
|
-
innerText: "Docs"
|
|
498
|
-
})
|
|
499
|
-
)
|
|
500
|
-
)
|
|
501
|
-
)
|
|
502
|
-
);
|
|
503
|
-
|
|
504
|
-
// src/server/layout.ts
|
|
505
|
-
if (!globalThis.__SERVER_CURRENT_LAYOUT_ID__) globalThis.__SERVER_CURRENT_LAYOUT_ID__ = 1;
|
|
506
|
-
var createLayout = (name) => {
|
|
507
|
-
process.emitWarning(
|
|
508
|
-
"Function createLayout() is deprecated. Prefer layout.ts files instead.",
|
|
509
|
-
{ type: "DeprecationWarning" }
|
|
510
|
-
);
|
|
511
|
-
const layouts = globalThis.__SERVER_CURRENT_LAYOUTS__;
|
|
512
|
-
if (layouts.has(name)) return layouts.get(name);
|
|
513
|
-
const id = globalThis.__SERVER_CURRENT_LAYOUT_ID__ += 1;
|
|
514
|
-
layouts.set(name, id);
|
|
515
|
-
return id;
|
|
516
|
-
};
|
|
517
|
-
|
|
518
|
-
// src/docs/docs/components/DocsLayout.ts
|
|
519
|
-
var docsLayoutId = createLayout("docs-layout");
|
|
520
|
-
var secondsSpentOnPage = createState(0, {
|
|
521
|
-
bind: docsLayoutId
|
|
522
|
-
});
|
|
523
|
-
createLoadHook({
|
|
524
|
-
deps: [secondsSpentOnPage],
|
|
525
|
-
bind: docsLayoutId,
|
|
526
|
-
fn: (state2, time) => {
|
|
527
|
-
const storedTime = localStorage.getItem("time-on-page");
|
|
528
|
-
if (storedTime) {
|
|
529
|
-
time.value = parseInt(storedTime);
|
|
530
|
-
time.signal();
|
|
531
|
-
}
|
|
532
|
-
let intervalId;
|
|
533
|
-
intervalId = setInterval(() => {
|
|
534
|
-
time.value++;
|
|
535
|
-
time.signal();
|
|
536
|
-
}, 1e3);
|
|
537
|
-
const handlePageLeave = () => {
|
|
538
|
-
localStorage.setItem("time-on-page", `${time.value}`);
|
|
539
|
-
};
|
|
540
|
-
window.addEventListener("beforeunload", handlePageLeave);
|
|
541
|
-
return () => {
|
|
542
|
-
window.removeEventListener("beforeunload", handlePageLeave);
|
|
543
|
-
handlePageLeave();
|
|
544
|
-
clearInterval(intervalId);
|
|
545
|
-
};
|
|
546
|
-
}
|
|
547
|
-
});
|
|
548
|
-
var NavSubLink = (href, innerText) => Link({
|
|
549
|
-
class: "text-sm font-normal flex flex-col gap-2 opacity-80 hover:opacity-60 duration-200",
|
|
550
|
-
innerText,
|
|
551
|
-
href,
|
|
552
|
-
prefetch: "hover"
|
|
553
|
-
});
|
|
554
|
-
var Sidebar = () => nav(
|
|
555
|
-
{
|
|
556
|
-
class: "w-1/5"
|
|
557
|
-
},
|
|
558
|
-
ul(
|
|
559
|
-
{
|
|
560
|
-
class: "flex flex-col gap-4"
|
|
561
|
-
},
|
|
562
|
-
li(
|
|
563
|
-
{},
|
|
564
|
-
h2(
|
|
565
|
-
{
|
|
566
|
-
class: "text-lg font-semibold"
|
|
567
|
-
},
|
|
568
|
-
"Quick Nav"
|
|
569
|
-
),
|
|
570
|
-
span(
|
|
571
|
-
{
|
|
572
|
-
class: "text-xs opacity-75"
|
|
573
|
-
},
|
|
574
|
-
"Elapsed: ",
|
|
575
|
-
span({
|
|
576
|
-
class: "font-mono",
|
|
577
|
-
innerText: observe(
|
|
578
|
-
[secondsSpentOnPage],
|
|
579
|
-
(secondsSpentOnPage2) => {
|
|
580
|
-
const hours = Math.floor(secondsSpentOnPage2 / 60 / 60);
|
|
581
|
-
const minutes = Math.floor(secondsSpentOnPage2 / 60 % 60);
|
|
582
|
-
const seconds = secondsSpentOnPage2 % 60;
|
|
583
|
-
return `${hours}h:${minutes}m:${seconds}s`;
|
|
584
|
-
}
|
|
585
|
-
)
|
|
586
|
-
})
|
|
587
|
-
)
|
|
588
|
-
),
|
|
589
|
-
li(
|
|
590
|
-
{
|
|
591
|
-
class: "flex flex-col gap-1"
|
|
592
|
-
},
|
|
593
|
-
h4({
|
|
594
|
-
class: "text-base font-medium",
|
|
595
|
-
innerText: "The Basics"
|
|
596
|
-
}),
|
|
597
|
-
ol(
|
|
598
|
-
{
|
|
599
|
-
class: "pl-2 ml-2 border-l-[1px] border-background-600 flex flex-col gap-2"
|
|
600
|
-
},
|
|
601
|
-
NavSubLink(
|
|
602
|
-
"/docs/basics#preamble",
|
|
603
|
-
"Preamble"
|
|
604
|
-
),
|
|
605
|
-
NavSubLink(
|
|
606
|
-
"/docs/basics#how-elegance-works",
|
|
607
|
-
"How Elegance Works"
|
|
608
|
-
),
|
|
609
|
-
NavSubLink(
|
|
610
|
-
"/docs/basics#installation",
|
|
611
|
-
"Installation"
|
|
612
|
-
),
|
|
613
|
-
NavSubLink(
|
|
614
|
-
"/docs/basics#your-first-page",
|
|
615
|
-
"Your First Page"
|
|
616
|
-
)
|
|
617
|
-
)
|
|
618
|
-
),
|
|
619
|
-
li(
|
|
620
|
-
{
|
|
621
|
-
class: "flex flex-col gap-1"
|
|
622
|
-
},
|
|
623
|
-
h4({
|
|
624
|
-
class: "text-base font-medium",
|
|
625
|
-
innerText: "Concepts"
|
|
626
|
-
}),
|
|
627
|
-
ol(
|
|
628
|
-
{
|
|
629
|
-
class: "pl-2 ml-2 border-l-[1px] border-background-600 flex flex-col gap-2"
|
|
630
|
-
},
|
|
631
|
-
NavSubLink(
|
|
632
|
-
"/docs/concepts#elements",
|
|
633
|
-
"Elements"
|
|
634
|
-
),
|
|
635
|
-
NavSubLink(
|
|
636
|
-
"/docs/concepts#object-attributes",
|
|
637
|
-
"Object Attributes"
|
|
638
|
-
)
|
|
639
|
-
)
|
|
640
|
-
),
|
|
641
|
-
li(
|
|
642
|
-
{
|
|
643
|
-
class: "flex flex-col gap-1"
|
|
644
|
-
},
|
|
645
|
-
h4({
|
|
646
|
-
class: "text-base font-medium",
|
|
647
|
-
innerText: "Page Files"
|
|
648
|
-
}),
|
|
649
|
-
ol(
|
|
650
|
-
{
|
|
651
|
-
class: "pl-2 ml-2 border-l-[1px] border-background-600 flex flex-col gap-2"
|
|
652
|
-
},
|
|
653
|
-
NavSubLink(
|
|
654
|
-
"/docs/page-files#state",
|
|
655
|
-
"State"
|
|
656
|
-
),
|
|
657
|
-
NavSubLink(
|
|
658
|
-
"/docs/page-files#load-hooks",
|
|
659
|
-
"Load Hooks"
|
|
660
|
-
),
|
|
661
|
-
NavSubLink(
|
|
662
|
-
"/docs/page-files#event-listeners",
|
|
663
|
-
"Event Listeners"
|
|
664
|
-
),
|
|
665
|
-
NavSubLink(
|
|
666
|
-
"/docs/page-files#layouts",
|
|
667
|
-
"Layouts"
|
|
668
|
-
)
|
|
669
|
-
)
|
|
670
|
-
),
|
|
671
|
-
li(
|
|
672
|
-
{
|
|
673
|
-
class: "flex flex-col gap-1"
|
|
674
|
-
},
|
|
675
|
-
h4({
|
|
676
|
-
class: "text-base font-medium",
|
|
677
|
-
innerText: "Compilation"
|
|
678
|
-
}),
|
|
679
|
-
ol(
|
|
680
|
-
{
|
|
681
|
-
class: "pl-2 ml-2 border-l-[1px] border-background-600 flex flex-col gap-2"
|
|
682
|
-
},
|
|
683
|
-
NavSubLink(
|
|
684
|
-
"/docs/compilation#options",
|
|
685
|
-
"Compilation Options"
|
|
686
|
-
)
|
|
687
|
-
)
|
|
688
|
-
)
|
|
689
|
-
)
|
|
690
|
-
);
|
|
691
|
-
var DocsLayout = (...children) => div(
|
|
692
|
-
{
|
|
693
|
-
class: "h-screen overflow-clip"
|
|
694
|
-
},
|
|
695
|
-
Header(),
|
|
696
|
-
Toast(docsLayoutId),
|
|
697
|
-
div(
|
|
698
|
-
{
|
|
699
|
-
class: "max-w-[1200px] h-full w-full mx-auto flex pt-8 px-3 sm:px-5 sm:min-[calc(1200px+1rem)]:px-0"
|
|
700
|
-
},
|
|
701
|
-
Sidebar(),
|
|
702
|
-
article(
|
|
703
|
-
{
|
|
704
|
-
class: "h-full w-full overflow-y-scroll pb-[250px] pl-6 ml-6"
|
|
705
|
-
},
|
|
706
|
-
Breakpoint(
|
|
707
|
-
{
|
|
708
|
-
id: docsLayoutId
|
|
709
|
-
},
|
|
710
|
-
...children
|
|
711
|
-
)
|
|
712
|
-
)
|
|
713
|
-
)
|
|
714
|
-
);
|
|
715
|
-
|
|
716
|
-
// src/docs/docs/components/Mono.ts
|
|
717
|
-
var Mono = (text) => span({
|
|
718
|
-
class: "font-mono select-text"
|
|
719
|
-
}, text);
|
|
720
|
-
|
|
721
|
-
// src/docs/docs/components/PageHeading.ts
|
|
722
|
-
var PageHeading = (title2, id) => h2({
|
|
723
|
-
class: "text-3xl font-semibold mb-4",
|
|
724
|
-
id,
|
|
725
|
-
innerText: title2
|
|
726
|
-
});
|
|
727
|
-
|
|
728
|
-
// src/docs/docs/components/Paragraph.ts
|
|
729
|
-
var Paragraph = (...children) => p(
|
|
730
|
-
{
|
|
731
|
-
class: "opacity-80"
|
|
732
|
-
},
|
|
733
|
-
...children
|
|
734
|
-
);
|
|
735
|
-
|
|
736
|
-
// src/docs/docs/components/Separator.ts
|
|
737
|
-
var Separator = () => div({
|
|
738
|
-
class: "my-20"
|
|
739
|
-
}, []);
|
|
740
|
-
|
|
741
|
-
// src/docs/docs/components/SubSeparator.ts
|
|
742
|
-
var SubSeparator = () => div({
|
|
743
|
-
class: "my-10"
|
|
744
|
-
}, []);
|
|
745
|
-
|
|
746
|
-
// src/docs/docs/concepts/page.ts
|
|
747
|
-
var exampleElementWithNoOptions = `
|
|
748
|
-
h1 ("I'll have 1 child, and no options!"),
|
|
749
|
-
h1 ("I'll have 2 children, and no options!", "I am the second child."),
|
|
750
|
-
`;
|
|
751
|
-
var exampleElementWithNoOptionsResult = `
|
|
752
|
-
[
|
|
753
|
-
{
|
|
754
|
-
tag: "h1",
|
|
755
|
-
options: {},
|
|
756
|
-
children: ["I'll have 1 child, and no options!"],
|
|
757
|
-
},
|
|
758
|
-
{
|
|
759
|
-
tag: "h1",
|
|
760
|
-
options: {},
|
|
761
|
-
children: [
|
|
762
|
-
"I'll have 1 child, and no options!",
|
|
763
|
-
"I am the second child!",
|
|
764
|
-
],
|
|
765
|
-
}
|
|
766
|
-
]
|
|
767
|
-
`;
|
|
768
|
-
var exampleOptions = `
|
|
769
|
-
div ({
|
|
770
|
-
id: "my-element-id",
|
|
771
|
-
customAttribute: "SUPER-IMPORTANT",
|
|
772
|
-
innerText: "Pokemon Platinum was peak Pokemon.",
|
|
773
|
-
})
|
|
774
|
-
`;
|
|
775
|
-
var exampleAllowedChildren = `
|
|
776
|
-
div (
|
|
777
|
-
1,
|
|
778
|
-
true,
|
|
779
|
-
"Hello World!",
|
|
780
|
-
["Apple", "Banana"],
|
|
781
|
-
...someArray.map((value, index) => p(index)),
|
|
782
|
-
)
|
|
783
|
-
`;
|
|
784
|
-
var exampleObjectAttributeType = `export enum ObjectAttributeType {
|
|
785
|
-
GENERIC = 0,
|
|
786
|
-
STATE = 1,
|
|
787
|
-
OBSERVER = 2,
|
|
788
|
-
EVENT_LISTENER = 3,
|
|
789
|
-
REFERENCE = 4,
|
|
790
|
-
}`;
|
|
791
|
-
var exampleObserveReturn = `{
|
|
792
|
-
type: ObjectAttributeType.OBSERVER,
|
|
793
|
-
initialValues: refs.map(ref => ref.value),
|
|
794
|
-
update: update,
|
|
795
|
-
refs: refs.map(ref => ({
|
|
796
|
-
id: ref.id,
|
|
797
|
-
bind: ref.bind,
|
|
798
|
-
})),
|
|
799
|
-
};
|
|
800
|
-
`;
|
|
801
|
-
var metadata = () => head(
|
|
802
|
-
{},
|
|
803
|
-
link({
|
|
804
|
-
rel: "stylesheet",
|
|
805
|
-
href: "/index.css"
|
|
806
|
-
}),
|
|
807
|
-
title("Hi There!")
|
|
808
|
-
);
|
|
809
|
-
var page = RootLayout(
|
|
810
|
-
DocsLayout(
|
|
811
|
-
PageHeading("Elements", "elements"),
|
|
812
|
-
Paragraph(
|
|
813
|
-
"Elements are simple function calls of ambient global variables.",
|
|
814
|
-
br(),
|
|
815
|
-
"All standard HTML5 elements except ",
|
|
816
|
-
Mono("var"),
|
|
817
|
-
" (for obvious reasons) are available."
|
|
818
|
-
),
|
|
819
|
-
SubSeparator(),
|
|
820
|
-
h3({
|
|
821
|
-
class: "text-lg font-medium mb-1",
|
|
822
|
-
innerText: "Element Options"
|
|
823
|
-
}),
|
|
824
|
-
Paragraph(
|
|
825
|
-
"The first parameter you pass to an element can either be another element,",
|
|
826
|
-
br(),
|
|
827
|
-
"or an options object. If the first parameter is an element, then that element is prepended",
|
|
828
|
-
br(),
|
|
829
|
-
"to the elements children; and the element will have no options."
|
|
830
|
-
),
|
|
831
|
-
CodeBlock(exampleElementWithNoOptions),
|
|
832
|
-
CodeBlock(exampleElementWithNoOptionsResult),
|
|
833
|
-
Paragraph(
|
|
834
|
-
"This is done purely for syntax reasons. For example,",
|
|
835
|
-
br(),
|
|
836
|
-
"I think it's nicer to write ",
|
|
837
|
-
Mono('b("bold.")'),
|
|
838
|
-
" than ",
|
|
839
|
-
Mono('b({}, "bold.")'),
|
|
840
|
-
br(),
|
|
841
|
-
br(),
|
|
842
|
-
"An options object may specify ",
|
|
843
|
-
b("any"),
|
|
844
|
-
" attribute, and that attributes value may be a string,",
|
|
845
|
-
br(),
|
|
846
|
-
"number or boolean.",
|
|
847
|
-
CodeBlock(exampleOptions)
|
|
848
|
-
),
|
|
849
|
-
SubSeparator(),
|
|
850
|
-
h3({
|
|
851
|
-
class: "text-lg font-medium mb-1",
|
|
852
|
-
innerText: "Important Considerations"
|
|
853
|
-
}),
|
|
854
|
-
ol(
|
|
855
|
-
{
|
|
856
|
-
class: "flex flex-col gap-2"
|
|
857
|
-
},
|
|
858
|
-
Paragraph(
|
|
859
|
-
"1. You should enter attributes as camelCase. They will be converted into kebab-case upon compilation."
|
|
860
|
-
),
|
|
861
|
-
Paragraph(
|
|
862
|
-
"2. Unlike in React, you'll want to use ",
|
|
863
|
-
Mono("class"),
|
|
864
|
-
" for class names, rather than ",
|
|
865
|
-
Mono("className.")
|
|
866
|
-
),
|
|
867
|
-
Paragraph(
|
|
868
|
-
"3. ",
|
|
869
|
-
Mono("on[Event]"),
|
|
870
|
-
" handlers can only be ",
|
|
871
|
-
Link({
|
|
872
|
-
href: "/docs/concepts/object-attributes",
|
|
873
|
-
class: "border-b-2"
|
|
874
|
-
}, "State Object Attributes")
|
|
875
|
-
),
|
|
876
|
-
Paragraph(
|
|
877
|
-
"4. The attributes ",
|
|
878
|
-
Mono("key"),
|
|
879
|
-
" and ",
|
|
880
|
-
Mono("bp"),
|
|
881
|
-
" are reserved by Elegance."
|
|
882
|
-
),
|
|
883
|
-
Paragraph(
|
|
884
|
-
"5. ",
|
|
885
|
-
Mono("innerText"),
|
|
886
|
-
" prepends its own value to the elements children."
|
|
887
|
-
),
|
|
888
|
-
Paragraph(
|
|
889
|
-
"6. ",
|
|
890
|
-
Mono("innerHTML"),
|
|
891
|
-
" sets the elements children to its value."
|
|
892
|
-
)
|
|
893
|
-
),
|
|
894
|
-
SubSeparator(),
|
|
895
|
-
h3({
|
|
896
|
-
class: "text-lg font-medium mb-1",
|
|
897
|
-
innerText: "Children"
|
|
898
|
-
}),
|
|
899
|
-
Paragraph(
|
|
900
|
-
"The rest of the values passed in to an element call, will be the elements children.",
|
|
901
|
-
br(),
|
|
902
|
-
"Strings, numbers, booleans, arrays, and other element calls, are all valid children."
|
|
903
|
-
),
|
|
904
|
-
CodeBlock(exampleAllowedChildren),
|
|
905
|
-
Separator(),
|
|
906
|
-
PageHeading("Object Attributes", "object-attributes"),
|
|
907
|
-
Paragraph(
|
|
908
|
-
"Object attributes, simply put, are a type of option for elements.",
|
|
909
|
-
br(),
|
|
910
|
-
"Any Element Option with type ",
|
|
911
|
-
Mono("object"),
|
|
912
|
-
" is considered an Object Attribute.",
|
|
913
|
-
br(),
|
|
914
|
-
"They are used to tell the compiler to do special things with the option, instead of just serializing it.",
|
|
915
|
-
br(),
|
|
916
|
-
br(),
|
|
917
|
-
"For brevity, we shorten object attributes to [TYPE]OA.",
|
|
918
|
-
br(),
|
|
919
|
-
"So, a State Object Attribute -> SOA.",
|
|
920
|
-
br(),
|
|
921
|
-
br(),
|
|
922
|
-
"Object Attributes are required to specify a ",
|
|
923
|
-
Mono("type"),
|
|
924
|
-
" property."
|
|
925
|
-
),
|
|
926
|
-
CodeBlock(exampleObjectAttributeType),
|
|
927
|
-
Paragraph(
|
|
928
|
-
"Now, 99% of the time, you won't craft OAs manually.",
|
|
929
|
-
br(),
|
|
930
|
-
"Instead, you'll use a helper function, which returns an OA of a specified type.",
|
|
931
|
-
br(),
|
|
932
|
-
br(),
|
|
933
|
-
"For example, the ",
|
|
934
|
-
Mono("observe()"),
|
|
935
|
-
" function, returns something like this."
|
|
936
|
-
),
|
|
937
|
-
CodeBlock(exampleObserveReturn),
|
|
938
|
-
Paragraph(
|
|
939
|
-
"Then, the compiler; when it encounters an OA that is of type ",
|
|
940
|
-
Mono("ObjectAttributeType.OBSERVER"),
|
|
941
|
-
br(),
|
|
942
|
-
"Calls the update function, sets the return value as the attribute value, and puts the OOA into the page_data.",
|
|
943
|
-
br(),
|
|
944
|
-
br(),
|
|
945
|
-
"This is really all you need to know about OAs, they are just object values for attributes,",
|
|
946
|
-
br(),
|
|
947
|
-
"which the compiler treats differently."
|
|
948
|
-
)
|
|
949
|
-
)
|
|
950
|
-
);
|
|
951
|
-
export {
|
|
952
|
-
metadata,
|
|
953
|
-
page
|
|
954
|
-
};
|