@awesomeness-js/server 1.1.7 → 1.1.9

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 (62) hide show
  1. package/package.json +1 -1
  2. package/src/componentDependencies.js +24 -0
  3. package/src/koa/routeRequest.js +87 -26
  4. package/example-site/example.awesomenessjs.com/components/example/index.js +0 -3
  5. package/example-site/example.awesomenessjs.com/components/notCommonExample/_.css +0 -1
  6. package/example-site/example.awesomenessjs.com/components/notCommonExample/index.js +0 -3
  7. package/ui/README.md +0 -438
  8. package/ui/awesomeness-ui.instructions.md +0 -156
  9. package/ui/build.js +0 -119
  10. package/ui/commonComponent.test.js +0 -27
  11. package/ui/components/blogPost/all.css +0 -371
  12. package/ui/components/blogPost/headerImage.js +0 -153
  13. package/ui/components/blogPost/index.js +0 -45
  14. package/ui/components/blogPost/marked.js +0 -74
  15. package/ui/components/blogPost/md.js +0 -73
  16. package/ui/components/blogPost/parseAwesomeness.jQuery.js +0 -47
  17. package/ui/components/blogPost/readme.md +0 -8
  18. package/ui/components/colors/README.md +0 -65
  19. package/ui/components/colors/dynamic.css +0 -1884
  20. package/ui/components/colors/dynamic.css.js +0 -135
  21. package/ui/components/colors/dynamic.css.php +0 -79
  22. package/ui/components/colors/example.js +0 -133
  23. package/ui/components/colors/index.js +0 -65
  24. package/ui/components/colors/map.js +0 -13
  25. package/ui/components/colors/random.js +0 -17
  26. package/ui/components/colors/tailwind-colors.css +0 -247
  27. package/ui/components/insertIntoList/insertIntoList.jquery.js +0 -150
  28. package/ui/components/statusPage/index.css +0 -120
  29. package/ui/components/statusPage/index.js +0 -39
  30. package/ui/components/tag/category.js +0 -8
  31. package/ui/components/tag/index.js +0 -33
  32. package/ui/components/tag/list.js +0 -42
  33. package/ui/components/tag/map.js +0 -64
  34. package/ui/components/tag/tagMap.css +0 -60
  35. package/ui/components/tag/tags.css +0 -20
  36. package/ui/core/css/_normalize.css +0 -57
  37. package/ui/core/css/dynamic/flex.js +0 -36
  38. package/ui/core/css/dynamic/grid.js +0 -185
  39. package/ui/core/css/dynamic/shortcuts.js +0 -48
  40. package/ui/core/css/dynamic/spacing.js +0 -61
  41. package/ui/core/css/dynamic/text.js +0 -80
  42. package/ui/core/css/dynamic/width.js +0 -75
  43. package/ui/core/css/dynamic.js +0 -40
  44. package/ui/core/js/app/api.js +0 -143
  45. package/ui/core/js/app/init.js +0 -88
  46. package/ui/core/js/app/initDarkMode.js +0 -26
  47. package/ui/core/js/app/initialScroll.js +0 -28
  48. package/ui/core/js/app/meta/update/components.js +0 -65
  49. package/ui/core/js/app/meta/update/pages.js +0 -86
  50. package/ui/core/js/app/metaUpdates.js +0 -10
  51. package/ui/core/js/app/page.js +0 -319
  52. package/ui/core/js/app/resize.js +0 -52
  53. package/ui/core/js/app/state/back.js +0 -16
  54. package/ui/core/js/app/state/create.js +0 -50
  55. package/ui/core/js/app/state/get.js +0 -5
  56. package/ui/core/js/app/state/init.js +0 -25
  57. package/ui/core/js/app.js +0 -41
  58. package/ui/core/js/jquery-3.7.1.min.js +0 -2
  59. package/ui/core/public/app.css +0 -1
  60. package/ui/core/public/app.js +0 -975
  61. package/ui/core/public/favicon.ico +0 -0
  62. package/ui/core/public/index.html +0 -40
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awesomeness-js/server",
3
- "version": "1.1.7",
3
+ "version": "1.1.9",
4
4
  "description": "Awesomeness Multi-Site Server",
5
5
  "author": "Scott Forte",
6
6
  "type": "module",
@@ -318,6 +318,30 @@ export default function componentDependencies(
318
318
 
319
319
  each(out[component], (files, type) => {
320
320
 
321
+ if (type === "js") {
322
+
323
+ const jsKeys = Object.keys(files);
324
+
325
+ jsKeys.forEach((key) => {
326
+
327
+ const keyParts = key.split(".");
328
+
329
+ for (let i = 2; i < keyParts.length; i++) {
330
+
331
+ const parentPath = keyParts.slice(0, i).join(".");
332
+
333
+ if (!files[parentPath]) {
334
+
335
+ files[parentPath] = `${parentPath} = ${parentPath} || {}; `;
336
+
337
+ }
338
+
339
+ }
340
+
341
+ });
342
+
343
+ }
344
+
321
345
  if (type === "js" && !files[`${namespace}.${component}`]) {
322
346
 
323
347
  files[`${namespace}.${component}`] = `${namespace}.${component} = {}; `;
@@ -165,63 +165,124 @@ export default async function routeRequest(ctx, next) {
165
165
  let specific = false;
166
166
 
167
167
  // Prefer filesystem existence checks so we don't rely on import() throwing for control flow
168
- try {
168
+ awesomenessRequest.log('Trying site specific route.', {
169
+ siteSpecificIndexPath,
170
+ siteSpecificInfoPath
171
+ });
172
+
173
+ let siteSpecificIndexExists = false;
174
+ let siteSpecificInfoExists = false;
169
175
 
170
- awesomenessRequest.log('Trying site specific route.', {
171
- siteSpecificIndexPath,
172
- siteSpecificInfoPath
173
- });
176
+
177
+ try {
174
178
 
175
179
  await fs.access(siteSpecificIndexPath);
180
+ siteSpecificIndexExists = true;
181
+
182
+ } catch {}
183
+
184
+ try {
185
+
176
186
  await fs.access(siteSpecificInfoPath);
187
+ siteSpecificInfoExists = true;
188
+
189
+ } catch {}
190
+
191
+ if (siteSpecificIndexExists && siteSpecificInfoExists) {
177
192
 
178
193
  awesomenessRequest.log('Site specific route found.', {
179
194
  siteSpecificIndexPath,
180
195
  siteSpecificInfoPath
181
196
  });
182
197
 
183
- routeIndex = await import(pathToFileURL(siteSpecificIndexPath).href);
184
- const infoMod = await import(pathToFileURL(siteSpecificInfoPath).href);
185
-
186
- routeInfo = infoMod.default;
198
+ try {
187
199
 
188
- awesomenessRequest.log('Site specific route info loaded.', {
189
- routeInfo
190
- });
200
+ routeIndex = await import(pathToFileURL(siteSpecificIndexPath).href);
201
+ const infoMod = await import(pathToFileURL(siteSpecificInfoPath).href);
191
202
 
203
+ routeInfo = infoMod.default;
204
+ awesomenessRequest.log('Site specific route info loaded.', {
205
+ routeInfo
206
+ });
207
+ specific = true;
208
+
209
+ } catch (importError) {
192
210
 
193
- specific = true;
211
+ ctx.status = 500;
212
+ ctx.body = {
213
+ success: false,
214
+ message: "Site specific route import error",
215
+ error: importError,
216
+ siteSpecificRoute: siteSpecificIndexPath,
217
+ siteSpecificInfo: siteSpecificInfoPath,
218
+ };
219
+ finalFormat(awesomenessRequest, ctx);
220
+
221
+ return;
222
+
223
+ }
194
224
 
195
- } catch (error) {
225
+ } else {
226
+
227
+ awesomenessRequest.log('Site specific route not found, trying generic route.', {
228
+ siteSpecificIndexExists: siteSpecificIndexExists,
229
+ siteSpecificInfoExists: siteSpecificInfoExists
230
+ });
231
+ let genericIndexExists = false;
232
+ let genericInfoExists = false;
196
233
 
197
- awesomenessRequest.log('Site specific route not found, trying generic route.', { error });
198
234
 
199
235
  try {
200
236
 
201
237
  await fs.access(genericIndexPath);
202
- await fs.access(genericInfoPath);
203
-
204
- routeIndex = await import(pathToFileURL(genericIndexPath).href);
205
- const infoMod = await import(pathToFileURL(genericInfoPath).href);
238
+ genericIndexExists = true;
239
+
240
+ } catch {}
206
241
 
207
- routeInfo = infoMod.default;
242
+ try {
208
243
 
209
- specific = false;
244
+ await fs.access(genericInfoPath);
245
+ genericInfoExists = true;
246
+
247
+ } catch {}
248
+
249
+ if (genericIndexExists && genericInfoExists) {
250
+
251
+ try {
252
+
253
+ routeIndex = await import(pathToFileURL(genericIndexPath).href);
254
+ const infoMod = await import(pathToFileURL(genericInfoPath).href);
255
+
256
+ routeInfo = infoMod.default;
257
+ specific = false;
258
+
259
+ } catch (importError2) {
260
+
261
+ ctx.status = 500;
262
+ ctx.body = {
263
+ success: false,
264
+ message: "Generic route import error",
265
+ error: importError2,
266
+ genericRoute: genericIndexPath,
267
+ genericInfo: genericInfoPath,
268
+ };
269
+ finalFormat(awesomenessRequest, ctx);
270
+
271
+ return;
272
+
273
+ }
210
274
 
211
- } catch (error2) {
275
+ } else {
212
276
 
213
277
  ctx.status = 404;
214
-
215
278
  ctx.body = {
216
279
  success: false,
217
280
  message: "route not found",
218
- error: error2,
219
281
  siteSpecificRoute: siteSpecificIndexPath,
220
282
  genericRoute: genericIndexPath,
221
283
  };
222
-
223
284
  finalFormat(awesomenessRequest, ctx);
224
-
285
+
225
286
  return;
226
287
 
227
288
  }
@@ -1,3 +0,0 @@
1
- export default () => {
2
- console.log('This example component over-wrote the common example component');
3
- }
@@ -1,3 +0,0 @@
1
- export default () => {
2
- console.log('This is not a common example');
3
- }
package/ui/README.md DELETED
@@ -1,438 +0,0 @@
1
- # Awesomeness UI
2
-
3
- Awesomeness UI is a utility-first CSS framework focused on responsive, dynamic layouts using a consistent, JS-driven class generator. It replaces traditional media queries with intuitive `app-size-*` modifiers.
4
-
5
- **Awesomeness UI** is a utility-first CSS framework focused on creating **responsive, grid-based layouts** using predictable, reusable class names. It avoids media queries by using automatically applied screen-size classes.
6
-
7
- ---
8
-
9
- ## 📐 Responsive Foundation
10
-
11
- Your layout responds to screen size using `app-size-*` classes:
12
-
13
- ```html
14
- <body class="app-size-p">
15
- <div id="app"></div>
16
- </body>
17
- ```
18
-
19
- These classes (`app-size-p`, `app-size-t`, etc.) are added dynamically based on the screen width, so you can target styles like this:
20
-
21
- ```html
22
- <div class="grid-1-p grid-2-t grid-4-d grid-6-xl">...</div>
23
- ```
24
-
25
- **Size keys:**
26
- - `p` → phone
27
- - `t` → tablet
28
- - `d` → desktop
29
- - `xl` → extra large
30
-
31
- ---
32
-
33
- ## 🧩 Core Class System
34
-
35
- Here’s a breakdown of the key layout utilities:
36
-
37
- ### 🧱 `grid-*`
38
-
39
- Defines how many equal-width columns a container has.
40
-
41
- ```html
42
- <div class="grid-3">...</div>
43
- ```
44
-
45
- Responsive:
46
-
47
- ```html
48
- <div class="grid-1-p grid-2-t grid-4-d grid-4-xl">...</div>
49
- <div class="grid-3 grid-1-p"> three on all except phone </div>
50
- ```
51
-
52
- ---
53
-
54
- ### ↔️ `span-*`
55
-
56
- Defines how many columns a child should span.
57
-
58
- ```html
59
- <div class="span-2">Spans 2 columns</div>
60
- ```
61
-
62
- Also available:
63
- - `.span-full` → spans full width
64
- - `.row-span-*` → spans rows
65
- - `.row-span-full` → full-height span
66
-
67
- Responsive variant:
68
-
69
- ```html
70
- <div class="span-1-p span-2-t span-3-d">...</div>
71
- ```
72
-
73
- ---
74
-
75
- ### 🔄 `justify-*`
76
-
77
- Controls horizontal alignment **inside grid containers**.
78
-
79
- ```css
80
- .justify-center → center content
81
- .justify-start → left-align
82
- .justify-end → right-align
83
- .justify-between → space-between
84
- .justify-around → space-around
85
- .justify-evenly → space-evenly
86
- ```
87
-
88
- ```html
89
- <div class="justify-center-p justify-end-d">...</div>
90
- ```
91
-
92
- ---
93
-
94
- ### ↕️ `align-*`
95
-
96
- Controls vertical alignment (applies to grid items).
97
-
98
- ```css
99
- .align-center → vertically center items
100
- .align-start → align top
101
- .align-end → align bottom
102
- .align-stretch → stretch to fill
103
- .align-baseline → align text baseline
104
- ```
105
-
106
- ---
107
-
108
- ### 🎯 `start-*`, `end-*`
109
-
110
- Control where grid items begin or end:
111
-
112
- ```css
113
- .start-2 → grid-column-start: 2
114
- .end-4 → grid-column-end: 4
115
- .row-start-1 → grid-row-start: 1
116
- .row-end-3 → grid-row-end: 3
117
- ```
118
-
119
- Responsive:
120
-
121
- ```html
122
- <div class="start-1-p start-3-d">...</div>
123
- ```
124
-
125
- ---
126
-
127
- ### 🔢 `order-*`
128
-
129
- Controls item order inside a flex/grid container.
130
-
131
- ```html
132
- <div class="order-1">First</div>
133
- <div class="order-2">Second</div>
134
- ```
135
-
136
- Responsive:
137
-
138
- ```html
139
- <div class="order-1-p order-3-d">...</div>
140
- ```
141
-
142
- ---
143
-
144
- ### 📏 `gap-*`, `gap-x-*`, `gap-y-*`
145
-
146
- Spacing between grid rows and columns.
147
-
148
- ```css
149
- .gap-10 → gap: 10px
150
- .gap-x-20 → column-gap: 20px
151
- .gap-y-5 → row-gap: 5px
152
- ```
153
-
154
- Responsive:
155
-
156
- ```html
157
- <div class="gap-4-p gap-10-d">...</div>
158
- ```
159
-
160
- ---
161
- ## 🎨 Dynamic Color Utilities
162
-
163
- This system auto-generates utility classes for applying color styles using predefined CSS variables (`--colorName-shade`), supporting background, border, and text colors.
164
-
165
- ### ✅ Class Patterns
166
-
167
- Each utility follows this pattern:
168
-
169
- ```
170
- .{prefix}-{color}-{shade}
171
- .{prefix}-{color}-{shade}--hover:hover
172
- ```
173
-
174
- Where:
175
- - `{prefix}` = `bg`, `border`, or `text`
176
- - `{color}` = one of the supported color names (see below)
177
- - `{shade}` = one of the supported shades (e.g., `100`, `500`, `950`)
178
-
179
- ### ✨ Examples
180
-
181
- ```html
182
- <div class="bg-blue-500 text-white border-blue-700">Primary</div>
183
- <div class="bg-gray-100--hover hoverable-box">Hover Me</div>
184
- ```
185
-
186
- ### 🎨 Available Color Names
187
-
188
- ```
189
- red, orange, amber, yellow, lime, green, emerald, teal, cyan, sky,
190
- blue, indigo, violet, purple, fuchsia, pink, rose,
191
- slate, gray, zinc, neutral, stone
192
- ```
193
-
194
- ### 🌗 Shades
195
-
196
- ```
197
- 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950
198
- ```
199
-
200
- ### 🖤 Black and White
201
-
202
- ```html
203
- <div class="bg-black text-white border-white">Dark Card</div>
204
- ```
205
-
206
- ### 🧠 Notes
207
-
208
- - All colors use CSS variables, such as `--blue-500`, so you can theme or dark-mode easily.
209
- - `--hover` suffix variants enable hover state styling directly via class names.
210
-
211
-
212
- ## Core
213
- location: /awesomeness-ui/core
214
-
215
- The core folder is what it takes to load a super minimalistic Awesomeness UI
216
-
217
- Available tools
218
-
219
-
220
-
221
- ## Components
222
- location: /awesomeness-ui/components
223
-
224
- Each folder within this directory is a `component`
225
-
226
-
227
- #### Rules
228
- - Each component should have a unique name
229
- - Each component can have any number of files and folders
230
- - Each js file should export default a single function
231
- - Each component "should" have an `index.js` file at the root level
232
- - It does not need to, such as a css only component or jQuery plugin
233
-
234
-
235
- #### Component Dependencies
236
-
237
- Components can depend on other components.
238
- To use a component in another component, you can import it like this:
239
-
240
- ```js
241
- // awesomeness import 'card';
242
- // awesomeness import 'insertIntoList';
243
- ```
244
- This will import the `card` and `insertIntoList` components.
245
- All of its css, functions / methods, IIFs / jQuery plugins and sub-components will be available at the expected namespace.
246
-
247
- ```js
248
-
249
- const $list = $(`<div class="example-list"></div>`)
250
- .appendTo('body');
251
-
252
- const $card = ui.card();
253
-
254
- $card.insertIntoList($list);
255
-
256
- ```
257
-
258
- ---
259
- ### JS
260
-
261
- The functions will be available in the browser at the `ui` namespace
262
- ```js
263
- ui._example()
264
- ```
265
-
266
- ---
267
- #### Basic Components
268
-
269
- index.js files are available at the root level of the component namespace
270
- [/awesomeness-ui/components/_example/index.js](/awesomeness-ui/components/example/index.js)
271
- ```js
272
- ui._example()
273
- ```
274
-
275
- other files will be available at the component namespace
276
- [/awesomeness-ui/components/_example/grid.js](/awesomeness-ui/components/example/grid.js)
277
- ```js
278
- ui._example.grid()
279
- ```
280
-
281
-
282
- ---
283
- #### Complex Components
284
-
285
- complex components can have any number of sub folders
286
- [/awesomeness-ui/components/example/subComponent/index.js](/awesomeness-ui/components/example/subComponent/index.js)
287
- ```js
288
- ui._example.subComponent()
289
- ```
290
-
291
- sub components can have any number of files
292
- [/awesomeness-ui/components/example/subComponent/simpleTest.js](/awesomeness-ui/components/example/subComponent/simpleTest.js)
293
- ```js
294
- ui._example.subComponent.deep.simpleTest()
295
- ```
296
-
297
- :warning: **Name Conflicts**
298
- If you have multiple files with the same name in a component, they will conflict. Example:
299
-
300
- ```
301
- awesomeness-ui/components/test/someMethod.js
302
- awesomeness-ui/components/test/someMethod/index.js
303
- ```
304
-
305
-
306
- ---
307
- #### IIFs
308
-
309
- IIFs will not be available on `ui` but will be executed immediately when received in browser
310
-
311
- This works well for **jQuery plugins** and loading **3rd party libraries**
312
-
313
- [/awesomeness-ui/components/example/jQuery_example.js](/awesomeness-ui/components/example/example.jQuery.js)
314
-
315
- ---
316
-
317
- ### CSS
318
-
319
- :warning: All CSS is available globally.
320
- Do not **pollute** the global namespace.
321
- Prefix all classes with the component name.
322
-
323
- e.g.,
324
-
325
- ```css
326
-
327
- .componentName-container {
328
- background-color: red;
329
- color: white;
330
- }
331
-
332
- .componentName-button {
333
- background-color: blue;
334
- color: white;
335
- }
336
-
337
- ```
338
-
339
- *Files names do not matter you can name them whatever you want*
340
-
341
-
342
- ---
343
- ## PAGES
344
-
345
- Pages can be located anywhere your router expects a `/pages/` directory.
346
-
347
- Each page is a folder containing the following
348
-
349
- ```
350
- your-site/
351
- └── pages/
352
- └── example/
353
- ├── _info.js
354
- ├── getData.js
355
- ├── js/
356
- │ └── init.js
357
- └── css/
358
- └── example.css
359
- ```
360
-
361
-
362
- #### /_info.js
363
-
364
- _info.js exports an object used by the router to determine what it needs to send back, and who can interact with it.
365
-
366
- the `components` array allows the page to pull, and load each component prior to rendering any page content.
367
-
368
- ```js
369
- export default {
370
- version: 1,
371
- name: '',
372
- description: '',
373
- permissions: [ '*' ],
374
- components: [
375
- 'heroWordsOverText'
376
- ]
377
- };
378
-
379
- ```
380
-
381
- #### /getData.js
382
-
383
- ```js
384
-
385
- export default async function getData(awesomenessRequest) {
386
-
387
- const {
388
- data, // payload sent by the client
389
- user // user information - set by the server
390
- } = awesomenessRequest;
391
-
392
- // do payload cleaning and validation here
393
-
394
- // do user validation here
395
-
396
- // return data to the client
397
-
398
- return { page: 'template' };
399
-
400
- }
401
-
402
- ```
403
-
404
- #### /scripts/init.js
405
-
406
- example:
407
-
408
- ```js
409
- app.pages.examplePage.init = function(responseFromGetData){
410
-
411
- // do stuff with data
412
-
413
- // state management
414
- app.state.create({
415
- title: 'Example Page',
416
- url: '/example-page',
417
- reload:function(){ app.page('examplePage'); }
418
- });
419
-
420
- // do stuff with the DOM
421
-
422
- };
423
- ```
424
-
425
- #### /css/example.css
426
-
427
- Optionally, you can add a css file to the page.
428
-
429
- Ideally, you should use component who have their own css files, but if you need to add a page specific css file, you can do so here.
430
-
431
- ```css
432
-
433
- .example-page {
434
- background-color: red;
435
- color: white;
436
- }
437
-
438
- ```