@tailor-cms/tce-preview-runtime 0.0.4

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/.eslintrc.cjs ADDED
@@ -0,0 +1,13 @@
1
+ module.exports = {
2
+ root: true,
3
+ extends: '@tailor-cms/eslint-config',
4
+ parserOptions: {
5
+ tsconfigRootDir: __dirname,
6
+ ecmaVersion: 2022,
7
+ sourceType: 'module',
8
+ parser: '@typescript-eslint/parser',
9
+ project: ['./tsconfig.json', './tsconfig.node.json'],
10
+ extraFileExtensions: ['vue'],
11
+ },
12
+ ignorePatterns: ['**/components.d.ts', '**/shims-vue.d.ts'],
13
+ };
package/.prettierrc ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "singleQuote": true,
3
+ "trailingComma": "all"
4
+ }
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1 @@
1
+ # Content Element Kit preview
package/index.html ADDED
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en" class="h-screen overflow-hidden dark">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" href="/favicon.ico" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>Content Element Kit</title>
8
+ </head>
9
+ <body class="overflow-hidden">
10
+ <div id="app"></div>
11
+ <script type="module" src="/src/main.ts"></script>
12
+ </body>
13
+ </html>
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "@tailor-cms/tce-preview-runtime",
3
+ "version": "0.0.4",
4
+ "dependencies": {
5
+ "@mdi/font": "^7.0.96",
6
+ "@vitejs/plugin-vue": "^3.0.3",
7
+ "@vueuse/core": "^9.1.1",
8
+ "split.js": "^1.6.4",
9
+ "typescript": "^5.1.6",
10
+ "vite-plugin-vuetify": "^1.0.2",
11
+ "vite": "^3.0.7",
12
+ "vue": "^3.2.37",
13
+ "vue-tsc": "^0.39.5",
14
+ "vuetify": "^3.3.14"
15
+ },
16
+ "devDependencies": {
17
+ "@tailor-cms/eslint-config": "0.0.2"
18
+ },
19
+ "publishConfig": {
20
+ "access": "public"
21
+ },
22
+ "scripts": {
23
+ "dev": "vite",
24
+ "build": "vue-tsc --noEmit && vite build",
25
+ "serve": "vite preview",
26
+ "lint": "eslint --ext .js,.ts,.vue .",
27
+ "lint:fix": "pnpm lint --fix"
28
+ }
29
+ }
Binary file
package/src/App.vue ADDED
@@ -0,0 +1,17 @@
1
+ <script setup lang="ts">
2
+ import AppBar from './components/AppBar.vue';
3
+ import MainLayout from './components/MainLayout.vue';
4
+ </script>
5
+
6
+ <template>
7
+ <v-app>
8
+ <AppBar />
9
+ <MainLayout class="mt-14" />
10
+ </v-app>
11
+ </template>
12
+
13
+ <style>
14
+ body {
15
+ --nav-height: 4.2rem;
16
+ }
17
+ </style>
Binary file
@@ -0,0 +1,27 @@
1
+ <script setup lang="ts">
2
+ import { useToggle } from '@vueuse/core';
3
+
4
+ import logoUrl from '../assets/logo.png';
5
+ import { useDarkGlobal } from '../utils';
6
+
7
+ const isDark = useDarkGlobal();
8
+ const toggleDark = useToggle(isDark);
9
+ </script>
10
+
11
+ <template>
12
+ <v-app-bar :color="isDark ? 'blue-grey-darken-4' : 'grey-lighten-4'">
13
+ <template #prepend>
14
+ <v-app-bar-nav-icon>
15
+ <img :src="logoUrl" alt="Tailor logo" width="32" />
16
+ </v-app-bar-nav-icon>
17
+ </template>
18
+ <v-app-bar-title> Dev Kit </v-app-bar-title>
19
+ <v-spacer />
20
+ <v-btn icon>
21
+ <v-icon>mdi-github</v-icon>
22
+ </v-btn>
23
+ <v-btn icon @click.prevent="toggleDark()">
24
+ <v-icon>mdi-theme-light-dark</v-icon>
25
+ </v-btn>
26
+ </v-app-bar>
27
+ </template>
@@ -0,0 +1,58 @@
1
+ <script setup lang="ts">
2
+ import { onMounted, ref, watch } from 'vue';
3
+ import Split from 'split.js';
4
+
5
+ import { useDarkGlobal } from '../utils';
6
+ const isDark = useDarkGlobal();
7
+ const iframe = ref<HTMLIFrameElement>();
8
+
9
+ watch(isDark, (value) => {
10
+ iframe.value?.contentWindow?.postMessage(
11
+ `theme-${value ? 'dark' : 'light'}`,
12
+ '*',
13
+ );
14
+ });
15
+
16
+ onMounted(() => Split(['#splitA', '#splitB']));
17
+ </script>
18
+
19
+ <template>
20
+ <main>
21
+ <div class="d-flex flex-row h-100">
22
+ <iframe
23
+ id="splitA"
24
+ ref="iframe"
25
+ class="w-full p-4"
26
+ frameBorder="0"
27
+ sandbox="allow-scripts"
28
+ src="http://localhost:8010"
29
+ title="Edit component container"
30
+ ></iframe>
31
+ <iframe
32
+ id="splitB"
33
+ ref="iframe"
34
+ class="w-full p-4"
35
+ frameBorder="0"
36
+ sandbox="allow-scripts"
37
+ src="http://localhost:8020"
38
+ title="Display component container"
39
+ ></iframe>
40
+ </div>
41
+ </main>
42
+ </template>
43
+
44
+ <style>
45
+ main {
46
+ height: calc(100vh - var(--nav-height));
47
+ }
48
+
49
+ .gutter {
50
+ background-position: 50%;
51
+ }
52
+
53
+ .gutter.gutter-horizontal {
54
+ background-color: #333;
55
+ background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAeCAYAAADkftS9AAAAIklEQVQoU2M4c+bMfxAGAgYYmwGrIIiDjrELjpo5aiZeMwF+yNnOs5KSvgAAAABJRU5ErkJggg==');
56
+ cursor: col-resize;
57
+ }
58
+ </style>
package/src/main.ts ADDED
@@ -0,0 +1,11 @@
1
+ import '@mdi/font/css/materialdesignicons.css';
2
+ import 'vuetify/styles';
3
+
4
+ import { createApp } from 'vue';
5
+ import { createVuetify } from 'vuetify';
6
+
7
+ import App from './App.vue';
8
+
9
+ createApp(App)
10
+ .use(createVuetify({ icons: { defaultSet: 'mdi' } }))
11
+ .mount('#app');
@@ -0,0 +1,5 @@
1
+ declare module "*.vue" {
2
+ import { DefineComponent } from "vue";
3
+ const component: DefineComponent<{}, {}, any>;
4
+ export default component;
5
+ }
@@ -0,0 +1,3 @@
1
+ import { createGlobalState, useDark } from '@vueuse/core';
2
+
3
+ export const useDarkGlobal = createGlobalState(() => useDark());
@@ -0,0 +1 @@
1
+ export * from './helpers';
@@ -0,0 +1 @@
1
+ /// <reference types="vite/client" />
package/tsconfig.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ESNext",
4
+ "useDefineForClassFields": true,
5
+ "module": "ESNext",
6
+ "moduleResolution": "Node",
7
+ "strict": true,
8
+ "jsx": "preserve",
9
+ "sourceMap": true,
10
+ "resolveJsonModule": true,
11
+ "isolatedModules": true,
12
+ "esModuleInterop": true,
13
+ "lib": ["ESNext", "DOM"],
14
+ "skipLibCheck": true
15
+ },
16
+ "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
17
+ "references": [{ "path": "./tsconfig.node.json" }]
18
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "compilerOptions": {
3
+ "composite": true,
4
+ "module": "ESNext",
5
+ "moduleResolution": "Node",
6
+ "allowSyntheticDefaultImports": true
7
+ },
8
+ "include": ["vite.config.ts"]
9
+ }
package/vite.config.ts ADDED
@@ -0,0 +1,11 @@
1
+ import { defineConfig } from 'vite';
2
+ import vue from '@vitejs/plugin-vue';
3
+ import vuetify from 'vite-plugin-vuetify';
4
+
5
+ // https://vitejs.dev/config/
6
+ export default defineConfig({
7
+ server: {
8
+ port: 8080,
9
+ },
10
+ plugins: [vue(), vuetify({ autoImport: true })],
11
+ });