c0ckp1t 1.0.12 → 1.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/c0ckp1t-demo/{C0ckp1tConfig.mjs → Config.mjs} +6 -3
- package/c0ckp1t-demo/components/sidebar.vue +1 -2
- package/c0ckp1t-demo/docs/Introduction.md +1 -0
- package/c0ckp1t-demo/docs/Issues.md +3 -0
- package/c0ckp1t-demo/pages/documentation.vue +64 -0
- package/c0ckp1t-demo/store.mjs +2 -2
- package/components/xsound.vue +1 -2
- package/core/PageMain.vue +2 -2
- package/core/VueUtils.mjs +23 -13
- package/core/pages/frontend/ComponentsBasic.vue +4 -0
- package/index-cdn.html +18 -8
- package/index.html +1 -1
- package/package.json +2 -5
- package/c0ckp1t-demo/CdnConfig.mjs +0 -68
- package/docs/Introduction.md +0 -3
- package/docs/Issues.md +0 -13
|
@@ -10,6 +10,8 @@ const instanceId = "demo";
|
|
|
10
10
|
// Used for requestion app components and files
|
|
11
11
|
const appEndpoint = "";
|
|
12
12
|
|
|
13
|
+
const islandDir = "c0ckp1t-demo"
|
|
14
|
+
|
|
13
15
|
// ________________________________________________________________________________
|
|
14
16
|
// GLOBAL CONSTANTS
|
|
15
17
|
// ________________________________________________________________________________
|
|
@@ -21,6 +23,7 @@ export default {
|
|
|
21
23
|
type: "LOCAL",
|
|
22
24
|
appName: "C0ckp1t Demo",
|
|
23
25
|
appEndpoint: appEndpoint,
|
|
26
|
+
islandDir: islandDir,
|
|
24
27
|
|
|
25
28
|
// This creates the navigation tree
|
|
26
29
|
root: {
|
|
@@ -55,11 +58,11 @@ export default {
|
|
|
55
58
|
|
|
56
59
|
// This is used to create routes for the vue router
|
|
57
60
|
routes: [
|
|
58
|
-
{path: instanceId, location: `${appEndpoint}/
|
|
61
|
+
{path: instanceId, location: `${appEndpoint}/${islandDir}/main.vue`, children: [
|
|
59
62
|
{path: '', redirect: `/${instanceId}/homepage`},
|
|
60
|
-
{path: 'homepage', location: `${appEndpoint}/
|
|
63
|
+
{path: 'homepage', location: `${appEndpoint}/${islandDir}/pages/homepage.vue`},
|
|
61
64
|
{path: 'docs', redirect: `/${instanceId}/docs/Introduction.md`},
|
|
62
|
-
{path: 'docs/:pathMatch(.*)*', location: `${appEndpoint}/
|
|
65
|
+
{path: 'docs/:pathMatch(.*)*', location: `${appEndpoint}/${islandDir}/pages/documentation.vue`},
|
|
63
66
|
] },
|
|
64
67
|
]
|
|
65
68
|
|
|
@@ -39,8 +39,7 @@ logger.debug("[INIT]")
|
|
|
39
39
|
|
|
40
40
|
<ul class="nav flex-column mb-auto">
|
|
41
41
|
<RouterLink class="nav-link d-flex align-items-center gap-2" :to="`${routerEndpoint}/homepage`">Homepage</RouterLink>
|
|
42
|
-
<RouterLink class="nav-link d-flex align-items-center gap-2" :class="{ 'router-link-active': isDocsActive }" :to="`${routerEndpoint}/docs`"
|
|
43
|
-
<RouterLink class="nav-link d-flex align-items-center gap-2" :to="`${routerEndpoint}/admin`" v-if="registry?.store?.context?.accessLevel <= 500">Admin</RouterLink>
|
|
42
|
+
<RouterLink class="nav-link d-flex align-items-center gap-2" :class="{ 'router-link-active': isDocsActive }" :to="`${routerEndpoint}/docs`" >Documentation</RouterLink>
|
|
44
43
|
</ul>
|
|
45
44
|
|
|
46
45
|
<hr class="my-2">
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
/*
|
|
3
|
+
[VARS] - init, imports, template, script, style, name
|
|
4
|
+
|
|
5
|
+
Usage:
|
|
6
|
+
const documentation = defineAsyncComponent(() => import("/v3/actions/auth/www/pages/documentation.vue"))
|
|
7
|
+
<documentation/>
|
|
8
|
+
*/
|
|
9
|
+
// ________________________________________________________________________________
|
|
10
|
+
// IMPORTS
|
|
11
|
+
// ________________________________________________________________________________
|
|
12
|
+
import {reactive, computed, ref, onMounted, onUnmounted, defineAsyncComponent, watch} from 'vue'
|
|
13
|
+
import {getLogger} from "Logging";
|
|
14
|
+
import {store as storeLocal, api as apiLocal, registry, instanceId} from '../store.mjs'
|
|
15
|
+
import Documentation from "/core/pages/Documentation.vue"
|
|
16
|
+
|
|
17
|
+
// !# C0CKP1T_START imports
|
|
18
|
+
|
|
19
|
+
// !# C0CKP1T_END imports
|
|
20
|
+
|
|
21
|
+
// ________________________________________________________________________________
|
|
22
|
+
// LOGGING
|
|
23
|
+
// ________________________________________________________________________________
|
|
24
|
+
const LOG_HEADER = "pages/homepage.vue"
|
|
25
|
+
const logger = getLogger(LOG_HEADER)
|
|
26
|
+
logger.debug("[INIT]")
|
|
27
|
+
|
|
28
|
+
// !# C0CKP1T_START script
|
|
29
|
+
const local = reactive({
|
|
30
|
+
id: LOG_HEADER,
|
|
31
|
+
instanceId: instanceId
|
|
32
|
+
})
|
|
33
|
+
// !# C0CKP1T_END script
|
|
34
|
+
|
|
35
|
+
// ________________________________________________________________________________
|
|
36
|
+
// INIT
|
|
37
|
+
// ________________________________________________________________________________
|
|
38
|
+
async function init() {
|
|
39
|
+
if (registry.state.isReady) {
|
|
40
|
+
// !# C0CKP1T_START init
|
|
41
|
+
|
|
42
|
+
// !# C0CKP1T_END init
|
|
43
|
+
} else {
|
|
44
|
+
setTimeout(async () => { await init() }, 1000)
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
onMounted(async () => { init() })
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<template>
|
|
51
|
+
<!-- !# C0CKP1T_START template -->
|
|
52
|
+
<x-section extra="fs-3" k="Documentation" :visible="true">
|
|
53
|
+
<Documentation :remotePathMapping="`/${storeLocal.islandDir}/docs`"></Documentation>
|
|
54
|
+
</x-section>
|
|
55
|
+
<!-- !# C0CKP1T_END template -->
|
|
56
|
+
</template>
|
|
57
|
+
|
|
58
|
+
<style scoped>
|
|
59
|
+
/* !# C0CKP1T_START style */
|
|
60
|
+
|
|
61
|
+
/* !# C0CKP1T_END style */
|
|
62
|
+
</style>
|
|
63
|
+
|
|
64
|
+
|
package/c0ckp1t-demo/store.mjs
CHANGED
|
@@ -12,7 +12,7 @@ import {getLogger} from "Logging";
|
|
|
12
12
|
import {store as storeMain, api as apiMain} from 'GlobalStore'
|
|
13
13
|
|
|
14
14
|
// !# C0CKP1T_START import
|
|
15
|
-
import C0ckp1tConfig from "./
|
|
15
|
+
import C0ckp1tConfig from "./Config.mjs";
|
|
16
16
|
// !# C0CKP1T_END import
|
|
17
17
|
|
|
18
18
|
export const instanceId = C0ckp1tConfig.instanceId
|
|
@@ -38,7 +38,7 @@ export const store = reactive({
|
|
|
38
38
|
endpoint: routerEndpoint,
|
|
39
39
|
|
|
40
40
|
// !# C0CKP1T_START store
|
|
41
|
-
|
|
41
|
+
islandDir: C0ckp1tConfig.islandDir,
|
|
42
42
|
// !# C0CKP1T_END store
|
|
43
43
|
})
|
|
44
44
|
|
package/components/xsound.vue
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { reactive, computed, markRaw, onMounted, onBeforeUnmount } from 'vue'
|
|
3
|
-
import XDropdown2 from '/components/xdropdown2.vue'
|
|
4
3
|
|
|
5
4
|
// https://wavesurfer-js.org/docs/
|
|
6
5
|
// NOTE: streaming not supported?
|
|
@@ -197,7 +196,7 @@ onBeforeUnmount(() => {
|
|
|
197
196
|
</div>
|
|
198
197
|
|
|
199
198
|
<!-- Playback Rate -->
|
|
200
|
-
<
|
|
199
|
+
<x-dropdown2
|
|
201
200
|
v-model="local.playbackRate"
|
|
202
201
|
:items="playbackRateOptions"
|
|
203
202
|
:on-change="onPlaybackRateChange"
|
package/core/PageMain.vue
CHANGED
|
@@ -31,8 +31,8 @@ const local = reactive({
|
|
|
31
31
|
toggle: false,
|
|
32
32
|
items: [ ],
|
|
33
33
|
|
|
34
|
-
navCloseLogo: storeMain.config?.navCloseLogo ?? "
|
|
35
|
-
navOpenLogo: storeMain.config?.navOpenLogo ?? "
|
|
34
|
+
navCloseLogo: storeMain.config?.navCloseLogo ?? "./img/logo_v1.svg",
|
|
35
|
+
navOpenLogo: storeMain.config?.navOpenLogo ?? "./img/logo_v2.svg",
|
|
36
36
|
navHasSearch: storeMain.config?.navHasSearch ?? true,
|
|
37
37
|
navHasThemeSel: storeMain.config?.navHasThemeSel ?? true,
|
|
38
38
|
})
|
package/core/VueUtils.mjs
CHANGED
|
@@ -38,11 +38,18 @@ logger.debug("INIT")
|
|
|
38
38
|
logger.info(`vue3-sfc-loader vue version ${vueVersion}`)
|
|
39
39
|
logger.info(`vue.js version ${Vue.version}`)
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
function validateVueSFC(text) {
|
|
42
|
+
if(text.startsWith("<!DOCTYPE html")) {
|
|
43
|
+
throw Error(`[validateVueSFC] - Invalid SFC content: starts with !DOCTYPE html - likely an error page or non-SFC content`)
|
|
44
|
+
}
|
|
45
|
+
// if(!text.includes("<template>") || !text.includes("<script>")) { }
|
|
46
|
+
}
|
|
42
47
|
//________________________________________________________________________________
|
|
43
48
|
// LOCAL APP SFC LOADER OPTIONS
|
|
44
49
|
//________________________________________________________________________________
|
|
50
|
+
// Configuration passed to vue3-sfc-loader's loadModule
|
|
45
51
|
const options = {
|
|
52
|
+
devMode: false,
|
|
46
53
|
// separate, custom cache of raw source text
|
|
47
54
|
sourceCode: {},
|
|
48
55
|
// ADD THIS:
|
|
@@ -68,37 +75,37 @@ const options = {
|
|
|
68
75
|
GlobalStore: GlobalStore,
|
|
69
76
|
},
|
|
70
77
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
type = path.substring(path.lastIndexOf('.'));
|
|
74
|
-
}
|
|
78
|
+
// Step 1. Fetch the file content
|
|
79
|
+
async getFile(path) {
|
|
75
80
|
|
|
76
81
|
const instanceId = JsUtils.substrAfterFirstSlash(path)
|
|
77
82
|
|
|
78
83
|
let res = null
|
|
79
84
|
if(sourceCode[path]) {
|
|
80
|
-
logger.debug(`[getFile] - cached - ${path}
|
|
85
|
+
logger.debug(`[getFile] - cached - ${path}`)
|
|
81
86
|
const cached = sourceCode[path];
|
|
82
87
|
res = new Response(cached.code, {status: 200, statusText: 'OK'});
|
|
83
88
|
} else if (path.startsWith("http") || path.startsWith("HTTP")) {
|
|
84
|
-
logger.debug(`[getFile] -
|
|
85
|
-
res = await GlobalStore.store.r["default"].resolver(path
|
|
89
|
+
logger.debug(`[getFile] - http - ${path}`)
|
|
90
|
+
res = await GlobalStore.store.r["default"].resolver(path)
|
|
86
91
|
} else if (GlobalStore.store.r[instanceId]) {
|
|
87
|
-
logger.debug(`[getFile] - instance - ${path}
|
|
92
|
+
logger.debug(`[getFile] - instance - ${path}`)
|
|
88
93
|
const pathAfterInstanceId = path.replace("/" + instanceId, "")
|
|
89
|
-
res = await GlobalStore.store.r[instanceId].resolver(pathAfterInstanceId
|
|
94
|
+
res = await GlobalStore.store.r[instanceId].resolver(pathAfterInstanceId)
|
|
90
95
|
} else {
|
|
91
|
-
logger.debug(`[getFile] - default - ${path}
|
|
92
|
-
res = await GlobalStore.store.r["default"].resolver(path
|
|
96
|
+
logger.debug(`[getFile] - default - ${path}`)
|
|
97
|
+
res = await GlobalStore.store.r["default"].resolver(path)
|
|
93
98
|
}
|
|
94
99
|
|
|
95
100
|
return {
|
|
96
|
-
// type: type,
|
|
97
101
|
getContentData: asBinary => {
|
|
98
102
|
if (asBinary) {
|
|
99
103
|
return res.arrayBuffer();
|
|
100
104
|
} else {
|
|
101
105
|
return res.text().then(text => {
|
|
106
|
+
if(path.endsWith(".vue")) {
|
|
107
|
+
validateVueSFC(text)
|
|
108
|
+
}
|
|
102
109
|
cacheSourceCode(path, text);
|
|
103
110
|
return text;
|
|
104
111
|
});
|
|
@@ -114,7 +121,10 @@ const options = {
|
|
|
114
121
|
document.head.insertBefore(style, ref);
|
|
115
122
|
},
|
|
116
123
|
|
|
124
|
+
// Step 2. Handle the module request
|
|
125
|
+
// built-in handling for .vue, .js, .mjs, .css (return undefined)
|
|
117
126
|
handleModule: async function (type, getContentData, path, options) {
|
|
127
|
+
// type=.vue - path=/core/PageMain.vue
|
|
118
128
|
logger.debug(`[handleModule] - type=${type} - path=${path}`)
|
|
119
129
|
|
|
120
130
|
// Handle esm.sh external modules (used by code-mirror.vue)
|
|
@@ -215,6 +215,10 @@ onMounted(async () => {
|
|
|
215
215
|
<x-dropdown k="Route Type: " :items="local.myDropDownItems" v-model="local.myDropDown"></x-dropdown>
|
|
216
216
|
</ComponentView>
|
|
217
217
|
|
|
218
|
+
<ComponentView name="x-dropdown2" url="/components/xdropdown2.vue">
|
|
219
|
+
<x-dropdown2 k="Route Type: " :items="local.myDropDownItems" v-model="local.myDropDown"></x-dropdown2>
|
|
220
|
+
</ComponentView>
|
|
221
|
+
|
|
218
222
|
<ComponentView name="x-json" url="/components/xjson.vue">
|
|
219
223
|
<x-json :obj="local.myTableData"></x-json>
|
|
220
224
|
<div class="mt-2">
|
package/index-cdn.html
CHANGED
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
</head>
|
|
48
48
|
|
|
49
49
|
<body class="main-body">
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
<div id="app-default">
|
|
51
|
+
<app-main></app-main>
|
|
52
|
+
</div>
|
|
53
53
|
</body>
|
|
54
54
|
|
|
55
55
|
<!-- =================== SCRIPTS =================== -->
|
|
@@ -57,12 +57,22 @@
|
|
|
57
57
|
<script src="https://cdn.jsdelivr.net/npm/c0ckp1t@latest/js_ext/loglevel-plugin-prefix.min.js"></script>
|
|
58
58
|
|
|
59
59
|
<script type="module">
|
|
60
|
-
import {init as initLogger} from 'Logging';
|
|
61
|
-
import {api as apiMain} from 'GlobalStore'
|
|
62
|
-
import
|
|
60
|
+
import {init as initLogger} from 'Logging';
|
|
61
|
+
import {api as apiMain} from 'GlobalStore'
|
|
62
|
+
import { createConfig } from 'https://cdn.jsdelivr.net/npm/c0ckp1t@latest/Config.mjs'
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
const config = createConfig({
|
|
65
|
+
appEndpoint: "https://cdn.jsdelivr.net/npm/c0ckp1t@latest",
|
|
66
|
+
routePrefix: "https://cdn.jsdelivr.net/npm/c0ckp1t@latest",
|
|
67
|
+
componentPrefix: "https://cdn.jsdelivr.net/npm/c0ckp1t@latest",
|
|
68
|
+
appMainComponent: "https://cdn.jsdelivr.net/npm/c0ckp1t@latest/core/PageMain.vue",
|
|
69
|
+
defaultLoggerLevels: {
|
|
70
|
+
"VueUtils.mjs": "INFO"
|
|
71
|
+
}
|
|
72
|
+
})
|
|
73
|
+
initLogger(config)
|
|
74
|
+
console.log(config)
|
|
75
|
+
await apiMain.init("app-default", config)
|
|
66
76
|
|
|
67
77
|
</script>
|
|
68
78
|
|
package/index.html
CHANGED
|
@@ -63,7 +63,7 @@ import { createConfig } from './Config.mjs';
|
|
|
63
63
|
// Islands
|
|
64
64
|
import ConfigAdmin from './ConfigAdmin.mjs'
|
|
65
65
|
import ConfigAnonymous from './ConfigAnonymous.mjs'
|
|
66
|
-
import ConfigDemo from './c0ckp1t-demo/
|
|
66
|
+
import ConfigDemo from './c0ckp1t-demo/Config.mjs'
|
|
67
67
|
// Create Application
|
|
68
68
|
const config = createConfig();
|
|
69
69
|
initLogger(config)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "c0ckp1t",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"description": "A Vue 3 zero-build web dashboard framework with Islands architecture, WebSocket backends, and reusable UI components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -27,8 +27,6 @@
|
|
|
27
27
|
"index.html",
|
|
28
28
|
"style.css",
|
|
29
29
|
"Config.mjs",
|
|
30
|
-
"DefaultConfig.mjs",
|
|
31
|
-
"CdnConfig.mjs",
|
|
32
30
|
"favicon.ico",
|
|
33
31
|
"favicon-32x32.png",
|
|
34
32
|
"favicon-64x64.png",
|
|
@@ -37,8 +35,7 @@
|
|
|
37
35
|
"components/",
|
|
38
36
|
"js_ext/",
|
|
39
37
|
"css/",
|
|
40
|
-
"c0ckp1t-demo/"
|
|
41
|
-
"docs/"
|
|
38
|
+
"c0ckp1t-demo/"
|
|
42
39
|
],
|
|
43
40
|
"scripts": {
|
|
44
41
|
"lint": "eslint .",
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
// ________________________________________________________________________________
|
|
2
|
-
// Properties
|
|
3
|
-
// ________________________________________________________________________________
|
|
4
|
-
// XMLHttpRequest from a different domain cannot set cookie values for their own
|
|
5
|
-
// domain unless withCredentials is set to true before making the request.
|
|
6
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials
|
|
7
|
-
const WITH_CREDENTIALS = false
|
|
8
|
-
// Note: VueUtils requires this to be 'default'
|
|
9
|
-
const instanceId = "demo";
|
|
10
|
-
// Used for requestion app components and files
|
|
11
|
-
const appEndpoint = "https://cdn.jsdelivr.net/npm/c0ckp1t@latest";
|
|
12
|
-
|
|
13
|
-
// ________________________________________________________________________________
|
|
14
|
-
// GLOBAL CONSTANTS
|
|
15
|
-
// ________________________________________________________________________________
|
|
16
|
-
export default {
|
|
17
|
-
isDev: true,
|
|
18
|
-
WITH_CREDENTIALS: WITH_CREDENTIALS,
|
|
19
|
-
|
|
20
|
-
instanceId: instanceId,
|
|
21
|
-
type: "LOCAL",
|
|
22
|
-
appName: "C0ckp1t Demo",
|
|
23
|
-
appEndpoint: appEndpoint,
|
|
24
|
-
|
|
25
|
-
// This creates the navigation tree
|
|
26
|
-
root: {
|
|
27
|
-
icon: "fa-house",
|
|
28
|
-
depth: 0,
|
|
29
|
-
endpoint: "/",
|
|
30
|
-
isLeaf: false,
|
|
31
|
-
isRoot: true,
|
|
32
|
-
name: "",
|
|
33
|
-
path: [],
|
|
34
|
-
children: [
|
|
35
|
-
{
|
|
36
|
-
depth: 1,
|
|
37
|
-
endpoint: `/${instanceId}/homepage`,
|
|
38
|
-
isLeaf: true,
|
|
39
|
-
isRoot: false,
|
|
40
|
-
path: ["homepage"],
|
|
41
|
-
name: "homepage",
|
|
42
|
-
children: []
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
depth: 1,
|
|
46
|
-
endpoint: `/${instanceId}/docs`,
|
|
47
|
-
isLeaf: true,
|
|
48
|
-
isRoot: false,
|
|
49
|
-
path: ["docs"],
|
|
50
|
-
name: "docs",
|
|
51
|
-
children: []
|
|
52
|
-
}
|
|
53
|
-
]
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
// This is used to create routes for the vue router
|
|
57
|
-
routes: [
|
|
58
|
-
{path: instanceId, location: `${appEndpoint}/c0ckp1t-demo/main.vue`, children: [
|
|
59
|
-
{path: '', redirect: `/${instanceId}/homepage`},
|
|
60
|
-
{path: 'homepage', location: `${appEndpoint}/c0ckp1t-demo/pages/homepage.vue`},
|
|
61
|
-
{path: 'docs', redirect: `/${instanceId}/docs/Introduction.md`},
|
|
62
|
-
{path: 'docs/:pathMatch(.*)*', location: `${appEndpoint}/core/pages/Documentation.vue`},
|
|
63
|
-
] },
|
|
64
|
-
]
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
} // end of Constants
|
|
68
|
-
|
package/docs/Introduction.md
DELETED