@adaas/are-html 0.0.11 → 0.0.13
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/browser/index.d.mts +19 -4
- package/dist/browser/index.mjs +115 -8
- package/dist/browser/index.mjs.map +1 -1
- package/dist/node/{AreBinding.attribute-C6JasbJL.d.ts → AreBinding.attribute-Bm5LlOyE.d.ts} +7 -0
- package/dist/node/{AreBinding.attribute-C6qrxN8K.d.mts → AreBinding.attribute-doUvtOjc.d.mts} +7 -0
- package/dist/node/attributes/AreBinding.attribute.d.mts +1 -1
- package/dist/node/attributes/AreBinding.attribute.d.ts +1 -1
- package/dist/node/attributes/AreDirective.attribute.d.mts +1 -1
- package/dist/node/attributes/AreDirective.attribute.d.ts +1 -1
- package/dist/node/attributes/AreEvent.attribute.d.mts +1 -1
- package/dist/node/attributes/AreEvent.attribute.d.ts +1 -1
- package/dist/node/attributes/AreStatic.attribute.d.mts +1 -1
- package/dist/node/attributes/AreStatic.attribute.d.ts +1 -1
- package/dist/node/directives/AreDirectiveFor.directive.d.mts +1 -1
- package/dist/node/directives/AreDirectiveFor.directive.d.ts +1 -1
- package/dist/node/directives/AreDirectiveFor.directive.js +11 -1
- package/dist/node/directives/AreDirectiveFor.directive.js.map +1 -1
- package/dist/node/directives/AreDirectiveFor.directive.mjs +11 -1
- package/dist/node/directives/AreDirectiveFor.directive.mjs.map +1 -1
- package/dist/node/directives/AreDirectiveIf.directive.d.mts +1 -1
- package/dist/node/directives/AreDirectiveIf.directive.d.ts +1 -1
- package/dist/node/engine/AreHTML.compiler.d.mts +8 -1
- package/dist/node/engine/AreHTML.compiler.d.ts +8 -1
- package/dist/node/engine/AreHTML.compiler.js +17 -0
- package/dist/node/engine/AreHTML.compiler.js.map +1 -1
- package/dist/node/engine/AreHTML.compiler.mjs +17 -0
- package/dist/node/engine/AreHTML.compiler.mjs.map +1 -1
- package/dist/node/engine/AreHTML.context.js +2 -2
- package/dist/node/engine/AreHTML.context.js.map +1 -1
- package/dist/node/engine/AreHTML.context.mjs +3 -3
- package/dist/node/engine/AreHTML.context.mjs.map +1 -1
- package/dist/node/engine/AreHTML.interpreter.d.mts +3 -0
- package/dist/node/engine/AreHTML.interpreter.d.ts +3 -0
- package/dist/node/engine/AreHTML.interpreter.js +44 -0
- package/dist/node/engine/AreHTML.interpreter.js.map +1 -1
- package/dist/node/engine/AreHTML.interpreter.mjs +44 -0
- package/dist/node/engine/AreHTML.interpreter.mjs.map +1 -1
- package/dist/node/engine/AreHTML.lifecycle.d.mts +2 -1
- package/dist/node/engine/AreHTML.lifecycle.d.ts +2 -1
- package/dist/node/engine/AreHTML.lifecycle.js +13 -1
- package/dist/node/engine/AreHTML.lifecycle.js.map +1 -1
- package/dist/node/engine/AreHTML.lifecycle.mjs +13 -1
- package/dist/node/engine/AreHTML.lifecycle.mjs.map +1 -1
- package/dist/node/engine/AreHTML.tokenizer.d.mts +1 -1
- package/dist/node/engine/AreHTML.tokenizer.d.ts +1 -1
- package/dist/node/engine/AreHTML.transformer.d.mts +1 -1
- package/dist/node/engine/AreHTML.transformer.d.ts +1 -1
- package/dist/node/index.d.mts +1 -1
- package/dist/node/index.d.ts +1 -1
- package/dist/node/instructions/AreHTML.instructions.types.d.mts +2 -4
- package/dist/node/instructions/AreHTML.instructions.types.d.ts +2 -4
- package/dist/node/lib/AreDirective/AreDirective.component.d.mts +1 -1
- package/dist/node/lib/AreDirective/AreDirective.component.d.ts +1 -1
- package/dist/node/lib/AreDirective/AreDirective.types.d.mts +1 -1
- package/dist/node/lib/AreDirective/AreDirective.types.d.ts +1 -1
- package/dist/node/lib/AreHTML/AreHTML.tokenizer.d.mts +1 -1
- package/dist/node/lib/AreHTML/AreHTML.tokenizer.d.ts +1 -1
- package/dist/node/lib/AreHTMLAttribute/AreHTML.attribute.d.mts +1 -1
- package/dist/node/lib/AreHTMLAttribute/AreHTML.attribute.d.ts +1 -1
- package/dist/node/lib/AreHTMLNode/AreHTMLNode.d.mts +1 -1
- package/dist/node/lib/AreHTMLNode/AreHTMLNode.d.ts +1 -1
- package/dist/node/lib/AreHTMLNode/AreHTMLNode.js +14 -0
- package/dist/node/lib/AreHTMLNode/AreHTMLNode.js.map +1 -1
- package/dist/node/lib/AreHTMLNode/AreHTMLNode.mjs +14 -0
- package/dist/node/lib/AreHTMLNode/AreHTMLNode.mjs.map +1 -1
- package/dist/node/lib/AreRoot/AreRoot.component.js +16 -3
- package/dist/node/lib/AreRoot/AreRoot.component.js.map +1 -1
- package/dist/node/lib/AreRoot/AreRoot.component.mjs +16 -3
- package/dist/node/lib/AreRoot/AreRoot.component.mjs.map +1 -1
- package/dist/node/nodes/AreComment.d.mts +1 -1
- package/dist/node/nodes/AreComment.d.ts +1 -1
- package/dist/node/nodes/AreComponent.d.mts +1 -1
- package/dist/node/nodes/AreComponent.d.ts +1 -1
- package/dist/node/nodes/AreInterpolation.d.mts +1 -1
- package/dist/node/nodes/AreInterpolation.d.ts +1 -1
- package/dist/node/nodes/AreRoot.d.mts +1 -1
- package/dist/node/nodes/AreRoot.d.ts +1 -1
- package/dist/node/nodes/AreText.d.mts +1 -1
- package/dist/node/nodes/AreText.d.ts +1 -1
- package/examples/component-styles/concept.ts +41 -0
- package/examples/component-styles/containers/UI.container.ts +122 -0
- package/examples/component-styles/dist/index.html +25 -0
- package/examples/{jumpstart/dist/mor90p6y-0plg7g.js → component-styles/dist/mpq29j47-owas2v.js} +8326 -5942
- package/examples/component-styles/public/index.html +25 -0
- package/examples/component-styles/src/components/AppPage.component.ts +74 -0
- package/examples/component-styles/src/components/TheAlert.component.ts +81 -0
- package/examples/component-styles/src/components/TheButton.component.ts +71 -0
- package/examples/component-styles/src/components/TheCard.component.ts +64 -0
- package/examples/component-styles/src/concept.ts +70 -0
- package/examples/dashboard/dist/index.html +1 -1
- package/examples/dashboard/dist/{mpmt0gys-1r9rcu.js → mppzjw80-9gwa4h.js} +1223 -863
- package/examples/jumpstart/dist/index.html +1 -1
- package/examples/jumpstart/dist/{mor90p7p-1898bz.js → mppwx932-xbmb0x.js} +4215 -1984
- package/examples/signal-routing/concept.ts +41 -0
- package/examples/signal-routing/containers/UI.container.ts +126 -0
- package/examples/signal-routing/dist/index.html +18 -0
- package/examples/signal-routing/dist/mpq6u1wz-2pkqe2.js +14002 -0
- package/examples/signal-routing/public/index.html +18 -0
- package/examples/signal-routing/src/components/AboutPage.component.ts +74 -0
- package/examples/signal-routing/src/components/AppShell.component.ts +42 -0
- package/examples/signal-routing/src/components/HomePage.component.ts +76 -0
- package/examples/signal-routing/src/components/NavBar.component.ts +104 -0
- package/examples/signal-routing/src/components/SettingsPage.component.ts +98 -0
- package/examples/signal-routing/src/concept.ts +114 -0
- package/package.json +7 -5
- package/src/directives/AreDirectiveFor.directive.ts +12 -1
- package/src/engine/AreHTML.compiler.ts +24 -7
- package/src/engine/AreHTML.context.ts +6 -4
- package/src/engine/AreHTML.interpreter.ts +54 -0
- package/src/engine/AreHTML.lifecycle.ts +16 -12
- package/src/instructions/AreHTML.instructions.types.ts +2 -4
- package/src/lib/AreHTMLNode/AreHTMLNode.ts +15 -0
- package/src/lib/AreRoot/AreRoot.component.ts +31 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/AreRoot/AreRoot.component.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/AreRoot/AreRoot.component.ts"],"names":[],"mappings":";;;;;;;;AAYO,IAAM,OAAA,GAAN,cAAsB,GAAA,CAAI;AAAA,EAA1B,WAAA,GAAA;AAAA,IAAA,KAAA,CAAA,GAAA,SAAA,CAAA;AAEH,IAAA,IAAA,CAAA,KAAA,GAA2C;AAAA,MACvC,OAAA,EAAS;AAAA,QACL,IAAA,EAAM,QAAA;AAAA,QACN,OAAA,EAAS;AAAA;AACb,KACJ;AAAA,EAAA;AAAA,EAIA,MAAM,QAAA,CACkB,IAAA,EACA,MAAA,EACS,cAAA,EAC/B;AAEE,IAAA,MAAM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,iBAAiB,CAAA;AAAA,CAAA,EArFtB,OAAA,CAgFH,SAAA,EAAA,UAAA,EAAA,CAAA,CAAA;AAhFG,OAAA,GAAN,eAAA,CAAA;AAAA,EAJN,QAAQ,MAAA,CAAO;AAAA,IACZ,SAAA,EAAW,YAAA;AAAA,IACX,WAAA,EAAa;AAAA,GAChB;AAAA,CAAA,EACY,OAAA,CAAA","file":"AreRoot.component.mjs","sourcesContent":["import { A_Caller, A_Context, A_FormatterHelper, A_Inject, } from \"@adaas/a-concept\";\nimport { A_Frame } from \"@adaas/a-frame/core\";\nimport { A_Logger } from \"@adaas/a-utils/a-logger\";\nimport { A_SignalVector } from \"@adaas/a-utils/a-signal\";\nimport { Are, ArePropDefinition, AreStore, AreNode, AreSignals, AreSignalsMeta, AreSignalsContext } from \"@adaas/are\";\nimport { AreRoute } from \"@adaas/are-html/signals/AreRoute.signal\";\n\n\n@A_Frame.Define({\n namespace: 'a-are-html',\n description: 'The AreRoot component serves as the foundational entry point for the A-Concept Rendering Engine (ARE). It is responsible for initializing the rendering process, managing the root node of the component tree, and handling signal-based rendering logic. The AreRoot component processes incoming signals to determine which child components to render, allowing for dynamic and responsive UI updates based on application state and user interactions.'\n})\nexport class AreRoot extends Are {\n\n props: Record<string, ArePropDefinition> = {\n default: {\n type: 'string',\n default: '',\n }\n }\n\n\n @Are.Template\n async template(\n @A_Inject(A_Caller) root: AreNode,\n @A_Inject(A_Logger) logger: A_Logger,\n @A_Inject(AreSignalsContext) signalsContext?: AreSignalsContext,\n ) {\n\n const rootId = root.id;\n\n // No routing config for this root — but still honour body content or\n // a 'default' attribute if one is present on the markup.\n if (signalsContext && !signalsContext.hasRoot(rootId)) {\n if (!root.content?.trim()) {\n // Fallback: legacy default= attribute\n const defaultMatch = root.markup?.match(/\\bdefault=[\"']([^\"']*)[\"']/);\n const defaultComponent = defaultMatch?.[1];\n if (defaultComponent) {\n root.setContent(`<${defaultComponent}></${defaultComponent}>`);\n }\n }\n // Body content (or none) — tokenizer picks it up without intervention\n return;\n }\n\n const currentRoute = AreRoute.default();\n\n let componentName: string | undefined;\n\n if (currentRoute) {\n const initialVector = new A_SignalVector([currentRoute]);\n\n // 1. Lookup via AreSignalsContext (per root-id conditions)\n let renderTarget = signalsContext?.findComponentByVector(rootId, initialVector);\n\n // 2. Fall back to global AreSignalsMeta\n if (!renderTarget) {\n const signalsMeta = A_Context.meta<AreSignalsMeta>(AreSignals);\n renderTarget = signalsMeta?.findComponentByVector(initialVector);\n }\n\n if (renderTarget?.name) {\n componentName = A_FormatterHelper.toKebabCase(renderTarget.name);\n }\n }\n\n // 3. Fall back to body content (the nodes already placed inside the\n // <are-root> tag act as the default). No setContent() call needed —\n // the tokenizer will process root.content as-is.\n if (!componentName) {\n if (root.content?.trim()) {\n return;\n }\n }\n\n // 4. Last resort: legacy default= attribute on the markup.\n if (!componentName) {\n const defaultMatch = root.markup?.match(/\\bdefault=[\"']([^\"']*)[\"']/);\n componentName = defaultMatch?.[1];\n }\n\n if (!componentName) {\n logger.warning('AreRoot: No component found for initial render. Provide body content, a route condition, or a \"default\" attribute.');\n return;\n }\n\n root.setContent(`<${componentName}></${componentName}>`);\n }\n\n\n @Are.Signal\n async onSignal(\n @A_Inject(A_Caller) root: AreNode,\n @A_Inject(A_SignalVector) vector: A_SignalVector,\n @A_Inject(AreStore) store: AreStore<{ default: string }>,\n @A_Inject(A_Logger) logger: A_Logger,\n @A_Inject(AreSignalsContext) signalsContext?: AreSignalsContext,\n ) {\n const rootId = root.id;\n\n // No routing config for this root — signals do not affect its content\n if (signalsContext && !signalsContext.hasRoot(rootId)) {\n return;\n }\n\n // 1. Try root-specific lookup via AreSignalsContext (keyed by the are-root's id attribute)\n let renderTarget = signalsContext?.findComponentByVector(rootId, vector);\n\n // 2. Fall back to global AreSignalsMeta lookup\n if (!renderTarget) {\n const signalsMeta = A_Context.meta<AreSignalsMeta>(AreSignals);\n renderTarget = signalsMeta?.findComponentByVector(vector);\n }\n\n const componentName = renderTarget?.name\n ? A_FormatterHelper.toKebabCase(renderTarget.name)\n : store.get('default');\n\n // No matching condition for this signal vector (e.g. AreInit before any route).\n // Keep the current outlet content and do nothing.\n if (!componentName) {\n return;\n }\n\n root.setContent(`<${componentName}></${componentName}>`);\n\n // Unsubscribe old children BEFORE destroying them.\n // Without this, AreSignals.handleSignalVector keeps iterating stale\n // (scope-less) nodes on every subsequent signal and throws an error.\n for (let i = 0; i < root.children.length; i++) {\n const child = root.children[i];\n signalsContext?.unsubscribe(child);\n child.unmount();\n child.destroy();\n root.removeChild(child);\n }\n\n\n root.tokenize();\n\n for (let i = 0; i < root.children.length; i++) {\n const child = root.children[i];\n child.init();\n\n const res = child.load();\n if (res instanceof Promise) {\n await res;\n }\n child.transform();\n\n child.compile();\n child.mount();\n }\n }\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AreNodeNewProps } from '@adaas/are';
|
|
2
|
-
import { e as AreHTMLNode } from '../AreBinding.attribute-
|
|
2
|
+
import { e as AreHTMLNode } from '../AreBinding.attribute-doUvtOjc.mjs';
|
|
3
3
|
import '@adaas/a-concept';
|
|
4
4
|
import '../lib/AreStyle/AreStyle.context.mjs';
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AreNodeNewProps } from '@adaas/are';
|
|
2
|
-
import { e as AreHTMLNode } from '../AreBinding.attribute-
|
|
2
|
+
import { e as AreHTMLNode } from '../AreBinding.attribute-Bm5LlOyE.js';
|
|
3
3
|
import '@adaas/a-concept';
|
|
4
4
|
import '../lib/AreStyle/AreStyle.context.js';
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AreNodeNewProps } from '@adaas/are';
|
|
2
|
-
import { e as AreHTMLNode } from '../AreBinding.attribute-
|
|
2
|
+
import { e as AreHTMLNode } from '../AreBinding.attribute-doUvtOjc.mjs';
|
|
3
3
|
import '@adaas/a-concept';
|
|
4
4
|
import '../lib/AreStyle/AreStyle.context.mjs';
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AreNodeNewProps } from '@adaas/are';
|
|
2
|
-
import { e as AreHTMLNode } from '../AreBinding.attribute-
|
|
2
|
+
import { e as AreHTMLNode } from '../AreBinding.attribute-Bm5LlOyE.js';
|
|
3
3
|
import '@adaas/a-concept';
|
|
4
4
|
import '../lib/AreStyle/AreStyle.context.js';
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AreNodeNewProps } from '@adaas/are';
|
|
2
|
-
import { e as AreHTMLNode } from '../AreBinding.attribute-
|
|
2
|
+
import { e as AreHTMLNode } from '../AreBinding.attribute-doUvtOjc.mjs';
|
|
3
3
|
import '@adaas/a-concept';
|
|
4
4
|
import '../lib/AreStyle/AreStyle.context.mjs';
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AreNodeNewProps } from '@adaas/are';
|
|
2
|
-
import { e as AreHTMLNode } from '../AreBinding.attribute-
|
|
2
|
+
import { e as AreHTMLNode } from '../AreBinding.attribute-Bm5LlOyE.js';
|
|
3
3
|
import '@adaas/a-concept';
|
|
4
4
|
import '../lib/AreStyle/AreStyle.context.js';
|
|
5
5
|
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { A_Concept, A_Context } from "@adaas/a-concept";
|
|
2
|
+
import { UIContainer } from "./containers/UI.container";
|
|
3
|
+
import { A_Logger } from "@adaas/a-utils/a-logger";
|
|
4
|
+
import { A_Polyfill } from "@adaas/a-utils/a-polyfill";
|
|
5
|
+
import { A_Config, ENVConfigReader } from "@adaas/a-utils/a-config";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
(async () => {
|
|
9
|
+
try {
|
|
10
|
+
const Application = new UIContainer({
|
|
11
|
+
name: 'ARE Component Styles',
|
|
12
|
+
components: [
|
|
13
|
+
A_Polyfill,
|
|
14
|
+
ENVConfigReader,
|
|
15
|
+
A_Logger,
|
|
16
|
+
],
|
|
17
|
+
fragments: [
|
|
18
|
+
new A_Config({
|
|
19
|
+
defaults: {
|
|
20
|
+
PORT: 8083,
|
|
21
|
+
CONFIG_VERBOSE: true,
|
|
22
|
+
DEV_MODE: true,
|
|
23
|
+
}
|
|
24
|
+
}),
|
|
25
|
+
]
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const concept = new A_Concept({
|
|
29
|
+
name: 'adaas-are-example-component-styles',
|
|
30
|
+
components: [A_Logger, A_Polyfill, ENVConfigReader],
|
|
31
|
+
containers: [Application],
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
await concept.load();
|
|
35
|
+
await concept.start();
|
|
36
|
+
|
|
37
|
+
} catch (error) {
|
|
38
|
+
const logger = A_Context.root.resolve<A_Logger>(A_Logger)!;
|
|
39
|
+
logger.error(error);
|
|
40
|
+
}
|
|
41
|
+
})();
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { A_Concept, A_IdentityHelper, A_Inject } from "@adaas/a-concept";
|
|
2
|
+
import { A_Config } from "@adaas/a-utils/a-config";
|
|
3
|
+
import { A_Logger } from "@adaas/a-utils/a-logger";
|
|
4
|
+
import { A_Service } from "@adaas/a-utils/a-service";
|
|
5
|
+
import { build } from "esbuild";
|
|
6
|
+
import fs from "fs";
|
|
7
|
+
import http from "http";
|
|
8
|
+
import path from "path";
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
export class UIContainer extends A_Service {
|
|
12
|
+
|
|
13
|
+
protected server!: any;
|
|
14
|
+
|
|
15
|
+
@A_Concept.Build()
|
|
16
|
+
async build(
|
|
17
|
+
@A_Inject(A_Logger) logger: A_Logger,
|
|
18
|
+
@A_Inject(A_Config) config: A_Config
|
|
19
|
+
): Promise<void> {
|
|
20
|
+
logger.log('Building Component Styles example...');
|
|
21
|
+
const entryFile = path.resolve(__dirname, "../src/concept.ts");
|
|
22
|
+
const BundleID = A_IdentityHelper.generateTimeId();
|
|
23
|
+
const outFile = path.resolve(__dirname, `../dist/${BundleID}.js`);
|
|
24
|
+
|
|
25
|
+
if (fs.existsSync(path.resolve(__dirname, "../dist"))) {
|
|
26
|
+
fs.rmSync(path.resolve(__dirname, "../dist"), { recursive: true, force: true });
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
await build({
|
|
30
|
+
entryPoints: [entryFile],
|
|
31
|
+
outfile: outFile,
|
|
32
|
+
bundle: true,
|
|
33
|
+
minify: false,
|
|
34
|
+
keepNames: true,
|
|
35
|
+
sourcemap: false,
|
|
36
|
+
target: "es2020",
|
|
37
|
+
format: "esm",
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
logger.log('green', 'Bundle built successfully.');
|
|
41
|
+
|
|
42
|
+
let indexHtml = await fs.promises.readFile(
|
|
43
|
+
path.resolve(__dirname, "../public/index.html"), 'utf-8'
|
|
44
|
+
);
|
|
45
|
+
indexHtml = indexHtml.replace('{{BUNDLE_ID}}', BundleID);
|
|
46
|
+
await fs.promises.writeFile(path.resolve(__dirname, "../dist/index.html"), indexHtml);
|
|
47
|
+
|
|
48
|
+
const publicDir = path.resolve(__dirname, "../public");
|
|
49
|
+
const distDir = path.resolve(__dirname, "../dist");
|
|
50
|
+
const copyRecursive = async (src: string, dest: string) => {
|
|
51
|
+
const entries = await fs.promises.readdir(src, { withFileTypes: true });
|
|
52
|
+
await fs.promises.mkdir(dest, { recursive: true });
|
|
53
|
+
for (const entry of entries) {
|
|
54
|
+
const srcPath = path.join(src, entry.name);
|
|
55
|
+
const destPath = path.join(dest, entry.name);
|
|
56
|
+
if (entry.isDirectory()) {
|
|
57
|
+
await copyRecursive(srcPath, destPath);
|
|
58
|
+
} else if (entry.name !== 'index.html') {
|
|
59
|
+
await fs.promises.copyFile(srcPath, destPath);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
await copyRecursive(publicDir, distDir);
|
|
64
|
+
logger.log('green', 'Static assets copied.');
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@A_Concept.Load()
|
|
68
|
+
async preLoadBuild(
|
|
69
|
+
@A_Inject(A_Logger) logger: A_Logger,
|
|
70
|
+
@A_Inject(A_Config) config: A_Config
|
|
71
|
+
) {
|
|
72
|
+
await this.build(logger, config);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@A_Concept.Start()
|
|
76
|
+
async startStaticServer(
|
|
77
|
+
@A_Inject(A_Logger) logger: A_Logger,
|
|
78
|
+
@A_Inject(A_Config) config: A_Config
|
|
79
|
+
) {
|
|
80
|
+
this.server = http.createServer(this.serveStaticFiles.bind(this));
|
|
81
|
+
const PORT = config.get('PORT') || 8083;
|
|
82
|
+
this.server.listen(PORT, () => {
|
|
83
|
+
logger.log('green', `Component Styles example running at http://localhost:${PORT}`);
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
protected async serveStaticFiles(
|
|
88
|
+
req: http.IncomingMessage,
|
|
89
|
+
res: http.ServerResponse,
|
|
90
|
+
) {
|
|
91
|
+
const url = req.url || '/';
|
|
92
|
+
let filePath = path.join(__dirname, '../dist', url === '/' ? 'index.html' : url);
|
|
93
|
+
|
|
94
|
+
const logger = this.scope.resolve<A_Logger>(A_Logger)!;
|
|
95
|
+
logger.log('blue', `Serving: ${filePath}`);
|
|
96
|
+
|
|
97
|
+
const mimeTypes: Record<string, string> = {
|
|
98
|
+
'.html': 'text/html',
|
|
99
|
+
'.js': 'text/javascript',
|
|
100
|
+
'.css': 'text/css',
|
|
101
|
+
'.json': 'application/json',
|
|
102
|
+
'.png': 'image/png',
|
|
103
|
+
'.svg': 'image/svg+xml',
|
|
104
|
+
};
|
|
105
|
+
const ext = path.extname(filePath).toLowerCase();
|
|
106
|
+
const contentType = mimeTypes[ext] || 'application/octet-stream';
|
|
107
|
+
|
|
108
|
+
if (!fs.existsSync(filePath)) {
|
|
109
|
+
filePath = path.join(__dirname, '../dist', 'index.html');
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
fs.readFile(filePath, (err, content) => {
|
|
113
|
+
if (err) {
|
|
114
|
+
res.writeHead(500);
|
|
115
|
+
res.end(`Server Error: ${err.code}`, 'utf-8');
|
|
116
|
+
} else {
|
|
117
|
+
res.writeHead(200, { 'Content-Type': contentType });
|
|
118
|
+
res.end(content, 'utf-8');
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>ARE – Component Styles</title>
|
|
7
|
+
<style>
|
|
8
|
+
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
|
9
|
+
|
|
10
|
+
body {
|
|
11
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
12
|
+
background: #f4f6f9;
|
|
13
|
+
min-height: 100vh;
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
}
|
|
18
|
+
</style>
|
|
19
|
+
</head>
|
|
20
|
+
<body>
|
|
21
|
+
<are-root id="app" default="app-page"></are-root>
|
|
22
|
+
|
|
23
|
+
<script type="module" src="/mpq29j47-owas2v.js"></script>
|
|
24
|
+
</body>
|
|
25
|
+
</html>
|