@moku-labs/web 0.1.0-alpha.4 → 0.3.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.
Files changed (39) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +64 -51
  3. package/dist/chunk-D7D4PA-g.mjs +13 -0
  4. package/dist/index.cjs +5972 -113
  5. package/dist/index.d.cts +2078 -106
  6. package/dist/index.d.mts +2078 -106
  7. package/dist/index.mjs +5859 -33
  8. package/package.json +65 -65
  9. package/dist/bin/moku.cjs +0 -1383
  10. package/dist/bin/moku.d.cts +0 -1
  11. package/dist/bin/moku.d.mts +0 -1
  12. package/dist/bin/moku.mjs +0 -1383
  13. package/dist/chunk-DQk6qfdC.mjs +0 -18
  14. package/dist/factory-CMOo4n6a.cjs +0 -1722
  15. package/dist/factory-DRFGSslp.d.mts +0 -114
  16. package/dist/factory-DiKypQqs.mjs +0 -1602
  17. package/dist/factory-k-YoScgB.d.cts +0 -114
  18. package/dist/index-DH3jlpNi.d.mts +0 -503
  19. package/dist/index-DaY7vTuo.d.cts +0 -503
  20. package/dist/plugins/head/build.cjs +0 -35
  21. package/dist/plugins/head/build.d.cts +0 -17
  22. package/dist/plugins/head/build.d.mts +0 -17
  23. package/dist/plugins/head/build.mjs +0 -27
  24. package/dist/plugins/spa/index.cjs +0 -26
  25. package/dist/plugins/spa/index.d.cts +0 -30
  26. package/dist/plugins/spa/index.d.mts +0 -30
  27. package/dist/plugins/spa/index.mjs +0 -24
  28. package/dist/primitives-BYUp6kae.cjs +0 -100
  29. package/dist/primitives-DKgZfRAO.d.mts +0 -71
  30. package/dist/primitives-Dhko-oLM.mjs +0 -58
  31. package/dist/primitives-yZqQkOVR.d.cts +0 -71
  32. package/dist/project-B8z4jeMC.cjs +0 -1383
  33. package/dist/project-guCYpUeD.mjs +0 -1244
  34. package/dist/test.cjs +0 -82
  35. package/dist/test.d.cts +0 -61
  36. package/dist/test.d.mts +0 -61
  37. package/dist/test.mjs +0 -79
  38. package/dist/wrangler-BlZWVmX9.mjs +0 -369
  39. package/dist/wrangler-Bomk9mU-.cjs +0 -423
@@ -1,30 +0,0 @@
1
- import { a as SpaConfig, i as SpaApi, o as SpaState, t as createComponent } from "../../factory-DRFGSslp.mjs";
2
- import * as _moku_labs_core0 from "@moku-labs/core";
3
-
4
- //#region src/plugins/spa/index.d.ts
5
- declare const spa: _moku_labs_core0.PluginInstance<"spa", SpaConfig, SpaState, SpaApi, {
6
- 'component:create': {
7
- name: string;
8
- element: Element;
9
- };
10
- 'component:mount': {
11
- name: string;
12
- element: Element;
13
- };
14
- 'component:unmount': {
15
- name: string;
16
- reason: "navigation" | "destroy";
17
- };
18
- 'component:destroy': {
19
- name: string;
20
- };
21
- 'nav:start': {
22
- url: string;
23
- fromUrl: string;
24
- };
25
- 'nav:end': {
26
- url: string;
27
- };
28
- }> & Record<never, never>;
29
- //#endregion
30
- export { createComponent, spa };
@@ -1,24 +0,0 @@
1
- import { a as createSpaApi, i as createClientRuntime, n as createSpaState, o as head, p as createPlugin, r as registerSpaEvents, s as router, t as createComponent } from "../../factory-DiKypQqs.mjs";
2
-
3
- //#region src/plugins/spa/index.ts
4
- /** @file spa plugin: Very Complex tier — router + head + progress + components sub-modules. */
5
- const defaultConfig = {
6
- config: {
7
- viewTransitions: false,
8
- progressBar: true
9
- },
10
- components: []
11
- };
12
- const spa = createPlugin("spa", {
13
- depends: [router, head],
14
- config: defaultConfig,
15
- events: registerSpaEvents,
16
- createState: createSpaState,
17
- api: createSpaApi,
18
- onStart: async (ctx) => {
19
- if (typeof window !== "undefined") await createClientRuntime(ctx).start();
20
- }
21
- });
22
-
23
- //#endregion
24
- export { createComponent, spa };
@@ -1,100 +0,0 @@
1
-
2
- //#region src/plugins/head/primitives.ts
3
- const meta = (name, content) => ({
4
- tag: "meta",
5
- attrs: {
6
- name,
7
- content
8
- }
9
- });
10
- const og = (property, content) => ({
11
- tag: "meta",
12
- attrs: {
13
- property: `og:${property}`,
14
- content
15
- }
16
- });
17
- /**
18
- * JSON-LD with unicode-escape XSS protection. `JSON.stringify` alone is exploitable via `<\/script>` injection.
19
- * Escape sequence prevents script-context breakout. NEVER add an `unsafe: true` opt-out — this is non-negotiable.
20
- */
21
- const jsonLd = (data) => ({
22
- tag: "script",
23
- attrs: { type: "application/ld+json" },
24
- content: JSON.stringify(data).replace(/</g, "\\u003c").replace(/>/g, "\\u003e").replace(/&/g, "\\u0026")
25
- });
26
- const canonical = (url) => ({
27
- tag: "link",
28
- attrs: {
29
- rel: "canonical",
30
- href: url
31
- }
32
- });
33
- const hreflang = (locale, url) => ({
34
- tag: "link",
35
- attrs: {
36
- rel: "alternate",
37
- hreflang: locale,
38
- href: url
39
- }
40
- });
41
- const twitter = (name, content) => ({
42
- tag: "meta",
43
- attrs: {
44
- name: `twitter:${name}`,
45
- content
46
- }
47
- });
48
- const feedLink = (title, url, type = "rss") => ({
49
- tag: "link",
50
- attrs: {
51
- rel: "alternate",
52
- type: type === "rss" ? "application/rss+xml" : "application/atom+xml",
53
- title,
54
- href: url
55
- }
56
- });
57
-
58
- //#endregion
59
- Object.defineProperty(exports, 'canonical', {
60
- enumerable: true,
61
- get: function () {
62
- return canonical;
63
- }
64
- });
65
- Object.defineProperty(exports, 'feedLink', {
66
- enumerable: true,
67
- get: function () {
68
- return feedLink;
69
- }
70
- });
71
- Object.defineProperty(exports, 'hreflang', {
72
- enumerable: true,
73
- get: function () {
74
- return hreflang;
75
- }
76
- });
77
- Object.defineProperty(exports, 'jsonLd', {
78
- enumerable: true,
79
- get: function () {
80
- return jsonLd;
81
- }
82
- });
83
- Object.defineProperty(exports, 'meta', {
84
- enumerable: true,
85
- get: function () {
86
- return meta;
87
- }
88
- });
89
- Object.defineProperty(exports, 'og', {
90
- enumerable: true,
91
- get: function () {
92
- return og;
93
- }
94
- });
95
- Object.defineProperty(exports, 'twitter', {
96
- enumerable: true,
97
- get: function () {
98
- return twitter;
99
- }
100
- });
@@ -1,71 +0,0 @@
1
- declare namespace types_d_exports {
2
- export { ArticleMeta, HeadApi, HeadConfig, HeadElement, HeadPluginConfig, HeadState, OGFontConfig, OGImageConfig, RenderContext };
3
- }
4
- /** @file head plugin types — HeadElement, HeadConfig, ArticleMeta, OGImageConfig. */
5
- type HeadElement = {
6
- tag: 'meta' | 'link' | 'script' | 'title';
7
- attrs: Record<string, string>;
8
- content?: string;
9
- };
10
- type HeadConfig = {
11
- title?: string;
12
- elements?: HeadElement[];
13
- };
14
- type ArticleMeta = {
15
- publishedTime?: string;
16
- modifiedTime?: string;
17
- author?: string;
18
- tags?: string[];
19
- section?: string;
20
- };
21
- type OGFontConfig = {
22
- subset: string;
23
- weights: number[];
24
- };
25
- type OGImageConfig = {
26
- template?: unknown;
27
- fontDir?: string;
28
- fontName?: string;
29
- fonts?: OGFontConfig[];
30
- };
31
- type HeadPluginConfig = {
32
- ogImage?: OGImageConfig;
33
- titleSeparator?: string;
34
- autoCanonical?: boolean;
35
- };
36
- type HeadState = {
37
- config: Readonly<HeadPluginConfig>;
38
- ogImageDefaults: Readonly<OGImageConfig> | null;
39
- };
40
- type RenderContext = {
41
- url: string;
42
- locale: string;
43
- };
44
- type HeadApi = {
45
- render(config: HeadConfig, ctx: RenderContext): string;
46
- primitives: {
47
- meta(name: string, content: string): HeadElement;
48
- og(property: string, content: string): HeadElement;
49
- jsonLd(data: unknown): HeadElement;
50
- canonical(url: string): HeadElement;
51
- hreflang(locale: string, url: string): HeadElement;
52
- twitter(name: string, content: string): HeadElement;
53
- feedLink(title: string, url: string, type?: 'rss' | 'atom'): HeadElement;
54
- };
55
- buildArticleHead(meta: ArticleMeta, canonicalUrl: string): HeadElement[];
56
- };
57
- //#endregion
58
- //#region src/plugins/head/primitives.d.ts
59
- declare const meta: (name: string, content: string) => HeadElement;
60
- declare const og: (property: string, content: string) => HeadElement;
61
- /**
62
- * JSON-LD with unicode-escape XSS protection. `JSON.stringify` alone is exploitable via `</script>` injection.
63
- * Escape sequence prevents script-context breakout. NEVER add an `unsafe: true` opt-out — this is non-negotiable.
64
- */
65
- declare const jsonLd: (data: unknown) => HeadElement;
66
- declare const canonical: (url: string) => HeadElement;
67
- declare const hreflang: (locale: string, url: string) => HeadElement;
68
- declare const twitter: (name: string, content: string) => HeadElement;
69
- declare const feedLink: (title: string, url: string, type?: "rss" | "atom") => HeadElement;
70
- //#endregion
71
- export { meta as a, ArticleMeta as c, HeadPluginConfig as d, HeadState as f, jsonLd as i, HeadApi as l, types_d_exports as m, feedLink as n, og as o, OGImageConfig as p, hreflang as r, twitter as s, canonical as t, HeadElement as u };
@@ -1,58 +0,0 @@
1
- //#region src/plugins/head/primitives.ts
2
- const meta = (name, content) => ({
3
- tag: "meta",
4
- attrs: {
5
- name,
6
- content
7
- }
8
- });
9
- const og = (property, content) => ({
10
- tag: "meta",
11
- attrs: {
12
- property: `og:${property}`,
13
- content
14
- }
15
- });
16
- /**
17
- * JSON-LD with unicode-escape XSS protection. `JSON.stringify` alone is exploitable via `<\/script>` injection.
18
- * Escape sequence prevents script-context breakout. NEVER add an `unsafe: true` opt-out — this is non-negotiable.
19
- */
20
- const jsonLd = (data) => ({
21
- tag: "script",
22
- attrs: { type: "application/ld+json" },
23
- content: JSON.stringify(data).replace(/</g, "\\u003c").replace(/>/g, "\\u003e").replace(/&/g, "\\u0026")
24
- });
25
- const canonical = (url) => ({
26
- tag: "link",
27
- attrs: {
28
- rel: "canonical",
29
- href: url
30
- }
31
- });
32
- const hreflang = (locale, url) => ({
33
- tag: "link",
34
- attrs: {
35
- rel: "alternate",
36
- hreflang: locale,
37
- href: url
38
- }
39
- });
40
- const twitter = (name, content) => ({
41
- tag: "meta",
42
- attrs: {
43
- name: `twitter:${name}`,
44
- content
45
- }
46
- });
47
- const feedLink = (title, url, type = "rss") => ({
48
- tag: "link",
49
- attrs: {
50
- rel: "alternate",
51
- type: type === "rss" ? "application/rss+xml" : "application/atom+xml",
52
- title,
53
- href: url
54
- }
55
- });
56
-
57
- //#endregion
58
- export { meta as a, jsonLd as i, feedLink as n, og as o, hreflang as r, twitter as s, canonical as t };
@@ -1,71 +0,0 @@
1
- declare namespace types_d_exports {
2
- export { ArticleMeta, HeadApi, HeadConfig, HeadElement, HeadPluginConfig, HeadState, OGFontConfig, OGImageConfig, RenderContext };
3
- }
4
- /** @file head plugin types — HeadElement, HeadConfig, ArticleMeta, OGImageConfig. */
5
- type HeadElement = {
6
- tag: 'meta' | 'link' | 'script' | 'title';
7
- attrs: Record<string, string>;
8
- content?: string;
9
- };
10
- type HeadConfig = {
11
- title?: string;
12
- elements?: HeadElement[];
13
- };
14
- type ArticleMeta = {
15
- publishedTime?: string;
16
- modifiedTime?: string;
17
- author?: string;
18
- tags?: string[];
19
- section?: string;
20
- };
21
- type OGFontConfig = {
22
- subset: string;
23
- weights: number[];
24
- };
25
- type OGImageConfig = {
26
- template?: unknown;
27
- fontDir?: string;
28
- fontName?: string;
29
- fonts?: OGFontConfig[];
30
- };
31
- type HeadPluginConfig = {
32
- ogImage?: OGImageConfig;
33
- titleSeparator?: string;
34
- autoCanonical?: boolean;
35
- };
36
- type HeadState = {
37
- config: Readonly<HeadPluginConfig>;
38
- ogImageDefaults: Readonly<OGImageConfig> | null;
39
- };
40
- type RenderContext = {
41
- url: string;
42
- locale: string;
43
- };
44
- type HeadApi = {
45
- render(config: HeadConfig, ctx: RenderContext): string;
46
- primitives: {
47
- meta(name: string, content: string): HeadElement;
48
- og(property: string, content: string): HeadElement;
49
- jsonLd(data: unknown): HeadElement;
50
- canonical(url: string): HeadElement;
51
- hreflang(locale: string, url: string): HeadElement;
52
- twitter(name: string, content: string): HeadElement;
53
- feedLink(title: string, url: string, type?: 'rss' | 'atom'): HeadElement;
54
- };
55
- buildArticleHead(meta: ArticleMeta, canonicalUrl: string): HeadElement[];
56
- };
57
- //#endregion
58
- //#region src/plugins/head/primitives.d.ts
59
- declare const meta: (name: string, content: string) => HeadElement;
60
- declare const og: (property: string, content: string) => HeadElement;
61
- /**
62
- * JSON-LD with unicode-escape XSS protection. `JSON.stringify` alone is exploitable via `</script>` injection.
63
- * Escape sequence prevents script-context breakout. NEVER add an `unsafe: true` opt-out — this is non-negotiable.
64
- */
65
- declare const jsonLd: (data: unknown) => HeadElement;
66
- declare const canonical: (url: string) => HeadElement;
67
- declare const hreflang: (locale: string, url: string) => HeadElement;
68
- declare const twitter: (name: string, content: string) => HeadElement;
69
- declare const feedLink: (title: string, url: string, type?: "rss" | "atom") => HeadElement;
70
- //#endregion
71
- export { meta as a, ArticleMeta as c, HeadPluginConfig as d, HeadState as f, jsonLd as i, HeadApi as l, types_d_exports as m, feedLink as n, og as o, OGImageConfig as p, hreflang as r, twitter as s, canonical as t, HeadElement as u };