patron-oop 1.45.0 → 1.46.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.
- package/CHANGELOG.md +12 -0
- package/dist/patron.cjs +106 -35
- package/dist/patron.cjs.map +1 -1
- package/dist/patron.d.ts +40 -1
- package/dist/patron.js +103 -36
- package/dist/patron.js.map +1 -1
- package/dist/patron.min.js +1 -1
- package/dist/patron.min.mjs +1 -1
- package/dist/patron.min.mjs.map +1 -1
- package/dist/patron.mjs +103 -36
- package/dist/patron.mjs.map +1 -1
- package/docs/README.md +3 -0
- package/docs/assets/css/base.css +42 -0
- package/docs/assets/favicon/android-icon-144x144.png +0 -0
- package/docs/assets/favicon/android-icon-192x192.png +0 -0
- package/docs/assets/favicon/android-icon-36x36.png +0 -0
- package/docs/assets/favicon/android-icon-48x48.png +0 -0
- package/docs/assets/favicon/android-icon-72x72.png +0 -0
- package/docs/assets/favicon/android-icon-96x96.png +0 -0
- package/docs/assets/favicon/apple-icon-114x114.png +0 -0
- package/docs/assets/favicon/apple-icon-120x120.png +0 -0
- package/docs/assets/favicon/apple-icon-144x144.png +0 -0
- package/docs/assets/favicon/apple-icon-152x152.png +0 -0
- package/docs/assets/favicon/apple-icon-180x180.png +0 -0
- package/docs/assets/favicon/apple-icon-57x57.png +0 -0
- package/docs/assets/favicon/apple-icon-60x60.png +0 -0
- package/docs/assets/favicon/apple-icon-72x72.png +0 -0
- package/docs/assets/favicon/apple-icon-76x76.png +0 -0
- package/docs/assets/favicon/apple-icon-precomposed.png +0 -0
- package/docs/assets/favicon/apple-icon.png +0 -0
- package/docs/assets/favicon/browserconfig.xml +2 -0
- package/docs/assets/favicon/favicon-16x16.png +0 -0
- package/docs/assets/favicon/favicon-32x32.png +0 -0
- package/docs/assets/favicon/favicon-96x96.png +0 -0
- package/docs/assets/favicon/favicon.ico +0 -0
- package/docs/assets/favicon/manifest.json +41 -0
- package/docs/assets/favicon/ms-icon-144x144.png +0 -0
- package/docs/assets/favicon/ms-icon-150x150.png +0 -0
- package/docs/assets/favicon/ms-icon-310x310.png +0 -0
- package/docs/assets/favicon/ms-icon-70x70.png +0 -0
- package/docs/assets/img/404.jpg +0 -0
- package/docs/assets/img/angular_16.jpg +0 -0
- package/docs/assets/img/angular_32.jpg +0 -0
- package/docs/assets/img/eo_16.jpg +0 -0
- package/docs/assets/img/eo_big.png +0 -0
- package/docs/assets/img/github_16.jpg +0 -0
- package/docs/assets/img/logo.jpg +0 -0
- package/docs/assets/img/philosofy/observable.jpg +0 -0
- package/docs/assets/img/philosofy/responsible.jpg +0 -0
- package/docs/assets/img/philosofy/result.jpg +0 -0
- package/docs/assets/img/philosofy/tell.jpg +0 -0
- package/docs/assets/img/react_16.jpg +0 -0
- package/docs/assets/img/react_32.jpg +0 -0
- package/docs/assets/img/vue_16.jpg +0 -0
- package/docs/assets/img/vue_32.jpg +0 -0
- package/docs/assets/js/components/linkDynamic.mjs +11 -0
- package/docs/assets/js/components/linkReloadable.mjs +13 -0
- package/docs/assets/js/entrypoints/compatibility.mjs +31 -0
- package/docs/assets/js/entrypoints/components.mjs +2 -0
- package/docs/assets/js/entrypoints/examples.mjs +25 -0
- package/docs/assets/js/entrypoints/factory.mjs +20 -0
- package/docs/assets/js/entrypoints/guest.mjs +61 -0
- package/docs/assets/js/entrypoints/index.mjs +110 -0
- package/docs/assets/js/entrypoints/integrations.mjs +36 -0
- package/docs/assets/js/entrypoints/patron.mjs +46 -0
- package/docs/assets/js/entrypoints/source.mjs +76 -0
- package/docs/assets/js/entrypoints/terminology.mjs +51 -0
- package/docs/assets/js/entrypoints/utils.mjs +61 -0
- package/docs/assets/js/lib/StyleFetched.mjs +14 -0
- package/docs/assets/js/routing.mjs +110 -0
- package/docs/assets/schemes/dip.html +28 -0
- package/docs/favicon.ico +0 -0
- package/docs/index-dev.html +346 -0
- package/docs/index.html +346 -0
- package/docs/manifest.json +41 -0
- package/docs/pages/404.html +9 -0
- package/docs/pages/common/layout.html +17 -0
- package/docs/pages/compatibility/dip.html +82 -0
- package/docs/pages/compatibility/elegant-objects.html +373 -0
- package/docs/pages/compatibility/layout.html +17 -0
- package/docs/pages/examples/errors.html +167 -0
- package/docs/pages/examples/index.html +10 -0
- package/docs/pages/examples.html +41 -0
- package/docs/pages/factory/index.html +18 -0
- package/docs/pages/factory.html +36 -0
- package/docs/pages/guest/guest-applied.html +51 -0
- package/docs/pages/guest/guest-cast.html +219 -0
- package/docs/pages/guest/guest-disposable.html +147 -0
- package/docs/pages/guest/guest-executor-applied.html +65 -0
- package/docs/pages/guest/guest-object.html +101 -0
- package/docs/pages/guest/guest-pool.html +107 -0
- package/docs/pages/guest/guest-sync.html +66 -0
- package/docs/pages/guest/index.html +115 -0
- package/docs/pages/guest.html +59 -0
- package/docs/pages/index.html +72 -0
- package/docs/pages/integrations/angular.html +5 -0
- package/docs/pages/integrations/layout.html +17 -0
- package/docs/pages/integrations/react.html +7 -0
- package/docs/pages/integrations/vue.html +102 -0
- package/docs/pages/patron/index.html +140 -0
- package/docs/pages/patron/patron-applied.html +66 -0
- package/docs/pages/patron/patron-executor-applied.html +94 -0
- package/docs/pages/patron/patron-once.html +110 -0
- package/docs/pages/patron/patron-pool.html +99 -0
- package/docs/pages/patron.html +50 -0
- package/docs/pages/philosofy.html +210 -0
- package/docs/pages/source/index.html +167 -0
- package/docs/pages/source/source-active.html +113 -0
- package/docs/pages/source/source-all.html +129 -0
- package/docs/pages/source/source-applied.html +73 -0
- package/docs/pages/source/source-dynamic.html +93 -0
- package/docs/pages/source/source-executor-applied.html +64 -0
- package/docs/pages/source/source-map.html +192 -0
- package/docs/pages/source/source-once.html +73 -0
- package/docs/pages/source/source-race.html +171 -0
- package/docs/pages/source/source-sequence.html +160 -0
- package/docs/pages/source/source-with-pool.html +102 -0
- package/docs/pages/source/source.html +167 -0
- package/docs/pages/source.html +68 -0
- package/docs/pages/terminology/guest.html +14 -0
- package/docs/pages/terminology/index.html +6 -0
- package/docs/pages/terminology/introduction.html +25 -0
- package/docs/pages/terminology/patron.html +10 -0
- package/docs/pages/terminology/source.html +55 -0
- package/docs/pages/terminology/visitor.html +19 -0
- package/docs/pages/terminology.html +53 -0
- package/docs/pages/utils/give.html +47 -0
- package/docs/pages/utils/index.html +24 -0
- package/docs/pages/utils/is-guest-aware.html +22 -0
- package/docs/pages/utils/is-guest.html +21 -0
- package/docs/pages/utils/is-patron-in-pools.html +53 -0
- package/docs/pages/utils/private.html +44 -0
- package/docs/pages/utils/remove-patron-from-pools.html +57 -0
- package/docs/pages/utils/value.html +47 -0
- package/docs/pages/utils.html +61 -0
- package/eslint.config.mjs +6 -0
- package/package.json +1 -1
- package/src/Patron/PatronApplied.ts +22 -0
- package/src/Patron/PatronExecutorApplied.ts +25 -0
- package/src/index.ts +4 -0
@@ -0,0 +1,110 @@
|
|
1
|
+
import { EntryPointPage, CurrentPage, Page, Link } from "patron-components";
|
2
|
+
import { EntryPointRouting } from "../routing.mjs";
|
3
|
+
import { SourceWithPool } from "patron-oop";
|
4
|
+
import { StyleFetched } from "../lib/StyleFetched.mjs";
|
5
|
+
import "./components.mjs";
|
6
|
+
|
7
|
+
new StyleFetched(
|
8
|
+
"https://raw.githubusercontent.com/kosukhin/patorn-design-system/refs/heads/main/dist/assets/index.css",
|
9
|
+
).install();
|
10
|
+
|
11
|
+
const routing = new EntryPointRouting(".loader", ".page-area", ".menu");
|
12
|
+
|
13
|
+
const [basePath] = location.href.replace(location.origin, "").split("#");
|
14
|
+
let [fullPath] = location.href.split("#");
|
15
|
+
fullPath = fullPath.replace(/[^/]+\.html$/, "");
|
16
|
+
const currentPage = new CurrentPage();
|
17
|
+
const basePathSource = new SourceWithPool(
|
18
|
+
`${basePath}#`.replace("index.html", "").replace("//", "/"),
|
19
|
+
);
|
20
|
+
|
21
|
+
const link = new Link(currentPage, basePathSource);
|
22
|
+
link.watchClick(".global-body", ".dynamic-navigation > a");
|
23
|
+
|
24
|
+
routing.routes(
|
25
|
+
[
|
26
|
+
{
|
27
|
+
url: "/",
|
28
|
+
template: "pages/index.html",
|
29
|
+
aliases: [basePath, `${basePath}index.html`, ""],
|
30
|
+
page: new Page("Patron OOP"),
|
31
|
+
},
|
32
|
+
{
|
33
|
+
url: "/guest*",
|
34
|
+
template: "pages/guest.html",
|
35
|
+
page: new EntryPointPage(
|
36
|
+
"Класс Guest",
|
37
|
+
`${fullPath}assets/js/entrypoints/guest.mjs`,
|
38
|
+
),
|
39
|
+
},
|
40
|
+
{
|
41
|
+
url: "/patron*",
|
42
|
+
template: "pages/patron.html",
|
43
|
+
page: new EntryPointPage(
|
44
|
+
"Патрон",
|
45
|
+
`${fullPath}assets/js/entrypoints/patron.mjs`,
|
46
|
+
),
|
47
|
+
},
|
48
|
+
{
|
49
|
+
url: "/source*",
|
50
|
+
template: "pages/source.html",
|
51
|
+
page: new EntryPointPage(
|
52
|
+
"Источник",
|
53
|
+
`${fullPath}assets/js/entrypoints/source.mjs`,
|
54
|
+
),
|
55
|
+
},
|
56
|
+
{
|
57
|
+
url: "/compatibility*",
|
58
|
+
template: "pages/compatibility/layout.html",
|
59
|
+
page: new EntryPointPage(
|
60
|
+
"",
|
61
|
+
`${fullPath}assets/js/entrypoints/compatibility.mjs`,
|
62
|
+
),
|
63
|
+
},
|
64
|
+
{
|
65
|
+
url: "/integrations*",
|
66
|
+
template: "pages/integrations/layout.html",
|
67
|
+
page: new EntryPointPage(
|
68
|
+
"",
|
69
|
+
`${fullPath}assets/js/entrypoints/integrations.mjs`,
|
70
|
+
),
|
71
|
+
},
|
72
|
+
{
|
73
|
+
url: "/utils*",
|
74
|
+
template: "pages/utils.html",
|
75
|
+
page: new EntryPointPage(
|
76
|
+
"",
|
77
|
+
`${fullPath}assets/js/entrypoints/utils.mjs`,
|
78
|
+
),
|
79
|
+
},
|
80
|
+
{
|
81
|
+
url: "/terminology*",
|
82
|
+
template: "pages/terminology.html",
|
83
|
+
page: new EntryPointPage(
|
84
|
+
"",
|
85
|
+
`${fullPath}assets/js/entrypoints/terminology.mjs`,
|
86
|
+
),
|
87
|
+
},
|
88
|
+
{
|
89
|
+
url: "/examples*",
|
90
|
+
template: "pages/examples.html",
|
91
|
+
page: new EntryPointPage(
|
92
|
+
"",
|
93
|
+
`${fullPath}assets/js/entrypoints/examples.mjs`,
|
94
|
+
),
|
95
|
+
},
|
96
|
+
{
|
97
|
+
url: "/philosofy",
|
98
|
+
template: "pages/philosofy.html",
|
99
|
+
page: new Page("Философия"),
|
100
|
+
},
|
101
|
+
{
|
102
|
+
url: "",
|
103
|
+
template: "pages/404.html",
|
104
|
+
page: new Page("Страница не найдена"),
|
105
|
+
default: true,
|
106
|
+
},
|
107
|
+
],
|
108
|
+
currentPage,
|
109
|
+
basePathSource,
|
110
|
+
);
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import { Page } from "patron-components";
|
2
|
+
import { EntryPointRouting } from "../routing.mjs";
|
3
|
+
|
4
|
+
const main = () => {
|
5
|
+
const routing = new EntryPointRouting(
|
6
|
+
".integrations-loader",
|
7
|
+
".integrations-page-area",
|
8
|
+
".integrations-menu"
|
9
|
+
);
|
10
|
+
|
11
|
+
routing.routes([
|
12
|
+
{
|
13
|
+
url: "/integrations/vue",
|
14
|
+
template: "pages/integrations/vue.html",
|
15
|
+
page: new Page("Vue"),
|
16
|
+
},
|
17
|
+
{
|
18
|
+
url: "/integrations/angular",
|
19
|
+
template: "pages/integrations/angular.html",
|
20
|
+
page: new Page("Angular"),
|
21
|
+
},
|
22
|
+
{
|
23
|
+
url: "/integrations/react",
|
24
|
+
template: "pages/integrations/react.html",
|
25
|
+
page: new Page("React"),
|
26
|
+
},
|
27
|
+
{
|
28
|
+
url: "",
|
29
|
+
template: "pages/404.html",
|
30
|
+
page: new Page("Страница не найдена"),
|
31
|
+
default: true,
|
32
|
+
},
|
33
|
+
]);
|
34
|
+
};
|
35
|
+
|
36
|
+
export { main };
|
@@ -0,0 +1,46 @@
|
|
1
|
+
import { Page } from "patron-components";
|
2
|
+
import { EntryPointRouting } from "../routing.mjs";
|
3
|
+
|
4
|
+
const main = () => {
|
5
|
+
const routing = new EntryPointRouting(
|
6
|
+
".patron-loader",
|
7
|
+
".patron-page-area",
|
8
|
+
".patron-menu"
|
9
|
+
);
|
10
|
+
|
11
|
+
routing.routes([
|
12
|
+
{
|
13
|
+
url: "/patron",
|
14
|
+
template: "pages/patron/index.html",
|
15
|
+
page: new Page("Патрон"),
|
16
|
+
},
|
17
|
+
{
|
18
|
+
url: "/patron/patron-once",
|
19
|
+
template: "pages/patron/patron-once.html",
|
20
|
+
page: new Page("Patron Once"),
|
21
|
+
},
|
22
|
+
{
|
23
|
+
url: "/patron/patron-pool",
|
24
|
+
template: "pages/patron/patron-pool.html",
|
25
|
+
page: new Page("PatronPool"),
|
26
|
+
},
|
27
|
+
{
|
28
|
+
url: "/patron/patron-applied",
|
29
|
+
template: "pages/patron/patron-applied.html",
|
30
|
+
page: new Page("PatronApplied"),
|
31
|
+
},
|
32
|
+
{
|
33
|
+
url: "/patron/patron-executor-applied",
|
34
|
+
template: "pages/patron/patron-executor-applied.html",
|
35
|
+
page: new Page("PatronExecutorApplied"),
|
36
|
+
},
|
37
|
+
{
|
38
|
+
url: "",
|
39
|
+
template: "pages/404.html",
|
40
|
+
page: new Page("Страница не найдена"),
|
41
|
+
default: true,
|
42
|
+
},
|
43
|
+
]);
|
44
|
+
};
|
45
|
+
|
46
|
+
export { main };
|
@@ -0,0 +1,76 @@
|
|
1
|
+
import { Page } from "patron-components";
|
2
|
+
import { EntryPointRouting } from "../routing.mjs";
|
3
|
+
|
4
|
+
const main = () => {
|
5
|
+
const routing = new EntryPointRouting(
|
6
|
+
".source-loader",
|
7
|
+
".source-page-area",
|
8
|
+
".source-menu"
|
9
|
+
);
|
10
|
+
|
11
|
+
routing.routes([
|
12
|
+
{
|
13
|
+
url: "/source",
|
14
|
+
template: "pages/source/index.html",
|
15
|
+
page: new Page("Источник"),
|
16
|
+
},
|
17
|
+
{
|
18
|
+
url: "/source/source-active",
|
19
|
+
template: "pages/source/source-active.html",
|
20
|
+
page: new Page("SourceActive"),
|
21
|
+
},
|
22
|
+
{
|
23
|
+
url: "/source/source-all",
|
24
|
+
template: "pages/source/source-all.html",
|
25
|
+
page: new Page("SourceAll"),
|
26
|
+
},
|
27
|
+
{
|
28
|
+
url: "/source/source-applied",
|
29
|
+
template: "pages/source/source-applied.html",
|
30
|
+
page: new Page("SourceApplied"),
|
31
|
+
},
|
32
|
+
{
|
33
|
+
url: "/source/source-dynamic",
|
34
|
+
template: "pages/source/source-dynamic.html",
|
35
|
+
page: new Page("Source Dynamic"),
|
36
|
+
},
|
37
|
+
{
|
38
|
+
url: "/source/source-executor-applied",
|
39
|
+
template: "pages/source/source-executor-applied.html",
|
40
|
+
page: new Page("SourceExecutorApplied"),
|
41
|
+
},
|
42
|
+
{
|
43
|
+
url: "/source/source-map",
|
44
|
+
template: "pages/source/source-map.html",
|
45
|
+
page: new Page("SourceMap"),
|
46
|
+
},
|
47
|
+
{
|
48
|
+
url: "/source/source-once",
|
49
|
+
template: "pages/source/source-once.html",
|
50
|
+
page: new Page("SourceOnce"),
|
51
|
+
},
|
52
|
+
{
|
53
|
+
url: "/source/source-race",
|
54
|
+
template: "pages/source/source-race.html",
|
55
|
+
page: new Page("SourceRace"),
|
56
|
+
},
|
57
|
+
{
|
58
|
+
url: "/source/source-sequence",
|
59
|
+
template: "pages/source/source-sequence.html",
|
60
|
+
page: new Page("SourceSequence"),
|
61
|
+
},
|
62
|
+
{
|
63
|
+
url: "/source/source-with-pool",
|
64
|
+
template: "pages/source/source-with-pool.html",
|
65
|
+
page: new Page("SourceWithPool"),
|
66
|
+
},
|
67
|
+
{
|
68
|
+
url: "",
|
69
|
+
template: "pages/404.html",
|
70
|
+
page: new Page("Страница не найдена"),
|
71
|
+
default: true,
|
72
|
+
},
|
73
|
+
]);
|
74
|
+
};
|
75
|
+
|
76
|
+
export { main };
|
@@ -0,0 +1,51 @@
|
|
1
|
+
import { Page } from "patron-components";
|
2
|
+
import { EntryPointRouting } from "../routing.mjs";
|
3
|
+
|
4
|
+
const main = () => {
|
5
|
+
const routing = new EntryPointRouting(
|
6
|
+
".terminology-loader",
|
7
|
+
".terminology-page-area",
|
8
|
+
".terminology-menu"
|
9
|
+
);
|
10
|
+
|
11
|
+
routing.routes([
|
12
|
+
{
|
13
|
+
url: "/terminology",
|
14
|
+
template: "pages/terminology/index.html",
|
15
|
+
page: new Page("Терминология"),
|
16
|
+
},
|
17
|
+
{
|
18
|
+
url: "/terminology/introduction",
|
19
|
+
template: "pages/terminology/introduction.html",
|
20
|
+
page: new Page("Представление"),
|
21
|
+
},
|
22
|
+
{
|
23
|
+
url: "/terminology/visitor",
|
24
|
+
template: "pages/terminology/visitor.html",
|
25
|
+
page: new Page("Представление"),
|
26
|
+
},
|
27
|
+
{
|
28
|
+
url: "/terminology/the-guest",
|
29
|
+
template: "pages/terminology/guest.html",
|
30
|
+
page: new Page("Гость"),
|
31
|
+
},
|
32
|
+
{
|
33
|
+
url: "/terminology/the-patron",
|
34
|
+
template: "pages/terminology/patron.html",
|
35
|
+
page: new Page("Патрон"),
|
36
|
+
},
|
37
|
+
{
|
38
|
+
url: "/terminology/the-source",
|
39
|
+
template: "pages/terminology/source.html",
|
40
|
+
page: new Page("Источник данных"),
|
41
|
+
},
|
42
|
+
{
|
43
|
+
url: "",
|
44
|
+
template: "pages/404.html",
|
45
|
+
page: new Page("Страница не найдена"),
|
46
|
+
default: true,
|
47
|
+
},
|
48
|
+
]);
|
49
|
+
};
|
50
|
+
|
51
|
+
export { main };
|
@@ -0,0 +1,61 @@
|
|
1
|
+
import { Page } from "patron-components";
|
2
|
+
import { EntryPointRouting } from "../routing.mjs";
|
3
|
+
|
4
|
+
const main = () => {
|
5
|
+
const routing = new EntryPointRouting(
|
6
|
+
".utils-loader",
|
7
|
+
".utils-page-area",
|
8
|
+
".utils-menu"
|
9
|
+
);
|
10
|
+
|
11
|
+
routing.routes([
|
12
|
+
{
|
13
|
+
url: "/utils",
|
14
|
+
template: "pages/utils/index.html",
|
15
|
+
page: new Page("Утилиты"),
|
16
|
+
},
|
17
|
+
{
|
18
|
+
url: "/utils/give",
|
19
|
+
template: "pages/utils/give.html",
|
20
|
+
page: new Page("give функция"),
|
21
|
+
},
|
22
|
+
{
|
23
|
+
url: "/utils/value",
|
24
|
+
template: "pages/utils/value.html",
|
25
|
+
page: new Page("value функция"),
|
26
|
+
},
|
27
|
+
{
|
28
|
+
url: "/utils/private",
|
29
|
+
template: "pages/utils/private.html",
|
30
|
+
page: new Page("Private"),
|
31
|
+
},
|
32
|
+
{
|
33
|
+
url: "/utils/is-patron-in-pools",
|
34
|
+
template: "pages/utils/is-patron-in-pools.html",
|
35
|
+
page: new Page("isPatronInPools"),
|
36
|
+
},
|
37
|
+
{
|
38
|
+
url: "/utils/remove-patron-from-pools",
|
39
|
+
template: "pages/utils/remove-patron-from-pools.html",
|
40
|
+
page: new Page("removePatronFromPools"),
|
41
|
+
},
|
42
|
+
{
|
43
|
+
url: "/utils/is-source",
|
44
|
+
template: "pages/utils/is-source.html",
|
45
|
+
page: new Page("isSource"),
|
46
|
+
},
|
47
|
+
{
|
48
|
+
url: "/utils/is-guest",
|
49
|
+
template: "pages/utils/is-guest.html",
|
50
|
+
page: new Page("isGuest"),
|
51
|
+
},
|
52
|
+
{
|
53
|
+
url: "",
|
54
|
+
template: "pages/404.html",
|
55
|
+
page: new Page("Страница не найдена"),
|
56
|
+
default: true,
|
57
|
+
},
|
58
|
+
]);
|
59
|
+
};
|
60
|
+
|
61
|
+
export { main };
|
@@ -0,0 +1,14 @@
|
|
1
|
+
export class StyleFetched {
|
2
|
+
constructor(styleUrl) {
|
3
|
+
this.styleUrl = styleUrl;
|
4
|
+
}
|
5
|
+
|
6
|
+
install() {
|
7
|
+
fetch(this.styleUrl).then(r => r.text()).then((styleContent) => {
|
8
|
+
const styleEl = document.createElement('style');
|
9
|
+
styleEl.textContent = styleContent;
|
10
|
+
document.head.appendChild(styleEl);
|
11
|
+
document.body.classList.remove('body-loading')
|
12
|
+
})
|
13
|
+
}
|
14
|
+
}
|
@@ -0,0 +1,110 @@
|
|
1
|
+
import {
|
2
|
+
ComputedElement,
|
3
|
+
CurrentPage,
|
4
|
+
GroupActiveClass,
|
5
|
+
Link,
|
6
|
+
Navigation,
|
7
|
+
PageFetchTransport,
|
8
|
+
RouteDisplay,
|
9
|
+
Visible,
|
10
|
+
} from "patron-components";
|
11
|
+
import {
|
12
|
+
Source,
|
13
|
+
SourceAll,
|
14
|
+
GuestCast,
|
15
|
+
Patron,
|
16
|
+
PrivateClass,
|
17
|
+
SourceWithPool,
|
18
|
+
give,
|
19
|
+
sourceOf,
|
20
|
+
} from "patron-oop";
|
21
|
+
import { HistoryNewPage, HistoryPoppedPage } from "patron-web-api";
|
22
|
+
|
23
|
+
export class EntryPointRouting {
|
24
|
+
constructor(loaderSelector, navigationResultSelector, menuSelector) {
|
25
|
+
this.loaderSelector = loaderSelector;
|
26
|
+
this.navigationResultSelector = navigationResultSelector;
|
27
|
+
this.menuSelector = menuSelector;
|
28
|
+
}
|
29
|
+
|
30
|
+
routes(routes, currentPage, basePathSource) {
|
31
|
+
if (!currentPage) {
|
32
|
+
currentPage = new CurrentPage();
|
33
|
+
}
|
34
|
+
currentPage.value(new Patron(new HistoryNewPage()));
|
35
|
+
|
36
|
+
const [basePath] = location.href.replace(location.origin, "").split("#");
|
37
|
+
if (!basePathSource) {
|
38
|
+
basePathSource = new SourceWithPool(
|
39
|
+
`${basePath}#`.replace("index.html", "").replace("//", "/"),
|
40
|
+
);
|
41
|
+
}
|
42
|
+
|
43
|
+
const pageLoading = new SourceWithPool(false);
|
44
|
+
pageLoading.value(new Patron(new Visible(this.loaderSelector)));
|
45
|
+
|
46
|
+
const historyPoppedPage = new HistoryPoppedPage(currentPage);
|
47
|
+
historyPoppedPage.watchPop();
|
48
|
+
|
49
|
+
const navigation = new Navigation(
|
50
|
+
pageLoading,
|
51
|
+
basePathSource,
|
52
|
+
currentPage,
|
53
|
+
new RouteDisplay(this.navigationResultSelector),
|
54
|
+
new PrivateClass(PageFetchTransport),
|
55
|
+
);
|
56
|
+
navigation.routes(routes);
|
57
|
+
|
58
|
+
const link = new Link(currentPage, basePathSource);
|
59
|
+
link.watchClick(this.menuSelector);
|
60
|
+
|
61
|
+
const urlChain = new SourceAll();
|
62
|
+
basePathSource.value(new Patron(urlChain.guestKey("basePath")));
|
63
|
+
currentPage.value(new Patron(urlChain.guestKey("page")));
|
64
|
+
const url = new Source((guest) => {
|
65
|
+
urlChain.value(
|
66
|
+
new GuestCast(guest, ({ basePath, page }) => {
|
67
|
+
give(page.replace(basePath, ""), guest);
|
68
|
+
}),
|
69
|
+
);
|
70
|
+
});
|
71
|
+
|
72
|
+
const activeLink = new ComputedElement(
|
73
|
+
[{ source: url, placeholder: "{url}" }],
|
74
|
+
`${this.menuSelector} a[href="{url}"]`,
|
75
|
+
);
|
76
|
+
activeLink.element(
|
77
|
+
new Patron(
|
78
|
+
new GroupActiveClass(
|
79
|
+
"active",
|
80
|
+
`${this.menuSelector} a`,
|
81
|
+
sourceOf(document),
|
82
|
+
),
|
83
|
+
),
|
84
|
+
);
|
85
|
+
|
86
|
+
pageLoading.value(
|
87
|
+
new Patron((isInLoading) => {
|
88
|
+
if (isInLoading) {
|
89
|
+
return;
|
90
|
+
}
|
91
|
+
|
92
|
+
hljs.highlightAll();
|
93
|
+
hljs.initLineNumbersOnLoad();
|
94
|
+
|
95
|
+
const divDestination = document.querySelector(
|
96
|
+
this.navigationResultSelector,
|
97
|
+
);
|
98
|
+
if (divDestination) {
|
99
|
+
// Оживляем script тэги
|
100
|
+
divDestination.querySelectorAll("script").forEach((x) => {
|
101
|
+
var sc = document.createElement("script");
|
102
|
+
sc.setAttribute("type", "module");
|
103
|
+
sc.appendChild(document.createTextNode(x.innerText));
|
104
|
+
divDestination.appendChild(sc);
|
105
|
+
});
|
106
|
+
}
|
107
|
+
}),
|
108
|
+
);
|
109
|
+
}
|
110
|
+
}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="UTF-8" />
|
5
|
+
<meta
|
6
|
+
name="viewport"
|
7
|
+
content="width=device-width, initial-scale=1.0"
|
8
|
+
/>
|
9
|
+
<title>PatronSchemeEditor</title>
|
10
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/patron-scheme-editor/dist/style.css" />
|
11
|
+
</head>
|
12
|
+
<body>
|
13
|
+
<div id="app"></div>
|
14
|
+
<script type="module">
|
15
|
+
window.content = 'eyJjdXJyZW50Ijp7InByb2dyZXNzIjowLCJzZXR0aW5ncyI6eyJjb2xvcmVkIjpmYWxzZSwidGl0bGUiOiJESVAgKyBQYXRyb24ifSwib2JqZWN0cyI6eyIxNzM4NTEwNzE4MTU1Ijp7ImFkZGl0aW9uYWxOYW1lIjoiPHA+Y2xhc3MgLSDQv9C70LDQs9C40L0g0JHQlDwvcD4iLCJhcnJvd3MiOlt7ImlkIjoiMTczODUxMDc2NzQzMCIsImxhYmVsIjoiIn0seyJpZCI6IjE3Mzg1MTA3OTM1NDkiLCJsYWJlbCI6IiJ9XSwiZGVzY3JpcHRpb24iOiIiLCJpbk1lbnUiOmZhbHNlLCJsYXN0Q2xpY2siOjE3Mzg1MTA3MTgxNTUsImxpbmtlZCI6ZmFsc2UsIm1lbnVPcmRlciI6MCwibmFtZSI6IiIsIm91dGxpbmsiOiIvY3VycmVudCIsInRhcmdldEJsYW5rIjpmYWxzZSwidHlwZSI6ItCa0LvQsNGB0YEiLCJ3aWR0aCI6MjUwLCJoZWlnaHQiOjgxLCJ6aW5kZXgiOjAsImlkIjoiMTczODUxMDcxODE1NSIsImNyZWF0ZVRpbWVzdGFtcCI6MTczODUxMDcxODE1NSwiY2hhbmdlVGltZXN0YW1wIjoxNzM4NTExNDYyODE5LCJwb3NpdGlvbiI6WzQ1LDI4NV0sImFkZGl0aW9uYWxGaWVsZHMiOnsibmFtZSI6I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vPlxuJHt0ZXh0fVxuPC9kaXY+Iiwid2lkdGgiOiIxODAiLCJoZWlnaHQiOiI3MCJ9LCLQmNC90YLQtdGA0YTQtdC50YEiOnsibmFtZSI6ItCY0L3RgtC10YDRhNC10LnRgSIsInN2ZyI6IjxzdHlsZT4uc3ZnLXR5cGUtdG9kb3tkaXNwbGF5OmJsb2NrO2NvbG9yOmJsYWNrO292ZXJmbG93OmF1dG87cGFkZGluZzo5cHg7Ym9yZGVyOnNvbGlkIDJweCAjY2NjO2JhY2tncm91bmQ6I2ZmZWVlZTt3aWR0aDphdXRvO308L3N0eWxlPjxkaXYgY2xhc3M9XCJzdmctdHlwZS10b2RvXCIgc3R5bGU9XCJ3aWR0aDoke3dpZHRofXB4XCI+JHt0ZXh0fTwvZGl2PiIsIndpZHRoIjoiMTgwIiwiaGVpZ2h0Ijo0MH19LCJ1cmwiOiIvY3VycmVudCIsInBhcmVudCI6IiJ9fQ==';
|
16
|
+
window.content = fromBase64(window.content);
|
17
|
+
function fromBase64(binstr) {
|
18
|
+
const safeStr = atob(binstr);
|
19
|
+
const arr = new Uint8Array(safeStr.length);
|
20
|
+
for (let i = 0; i < safeStr.length; i += 1) {
|
21
|
+
arr[i] = safeStr.charCodeAt(i);
|
22
|
+
}
|
23
|
+
return new TextDecoder().decode(arr);
|
24
|
+
}
|
25
|
+
</script>
|
26
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/patron-scheme-editor/dist-embedable/assets/index.js"></script>
|
27
|
+
</body>
|
28
|
+
</html>
|
package/docs/favicon.ico
ADDED
Binary file
|