From daf9ae5d4a31cfe5eaf85985e78449bb0eebbe1e Mon Sep 17 00:00:00 2001
From: FineArchs <133759614+FineArchs@users.noreply.github.com>
Date: Tue, 17 Sep 2024 20:11:50 +0900
Subject: ScratchpadにUIインスペクターを追加 (#14565)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* add ui list
* Update scratchpad.vue
* experiment
* design change
* redesign
* redesign
* Update ja-JP.yml
* redesign
* component properties
* whole json
* use textarea
* fix import
* stringify function
* Update CHANGELOG.md
* UI Component Monitor -> UI Inspector
* uiInspectorOpenedFlags -> uiInspectorOpenedComponents
Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
* fix
* change key i -> c.value.id
---------
Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
---
packages/frontend/src/pages/scratchpad.vue | 59 ++++++++++++++++++++++++++++++
1 file changed, 59 insertions(+)
(limited to 'packages')
diff --git a/packages/frontend/src/pages/scratchpad.vue b/packages/frontend/src/pages/scratchpad.vue
index 9aaa8ff9c6..897ff6acdf 100644
--- a/packages/frontend/src/pages/scratchpad.vue
+++ b/packages/frontend/src/pages/scratchpad.vue
@@ -30,6 +30,24 @@ SPDX-License-Identifier: AGPL-3.0-only
+
+ {{ i18n.ts.uiInspector }}
+
+
+
{{ c.value.type }}
+
{{ c.value.id }}
+
+
+
+
+
+
{{ i18n.ts.uiInspectorDescription }}
+
+
+
{{ i18n.ts.scratchpadDescription }}
@@ -43,6 +61,7 @@ import { onDeactivated, onUnmounted, Ref, ref, watch, computed } from 'vue';
import { Interpreter, Parser, utils } from '@syuilo/aiscript';
import MkContainer from '@/components/MkContainer.vue';
import MkButton from '@/components/MkButton.vue';
+import MkTextarea from '@/components/MkTextarea.vue';
import MkCodeEditor from '@/components/MkCodeEditor.vue';
import { aiScriptReadline, createAiScriptEnv } from '@/scripts/aiscript/api.js';
import * as os from '@/os.js';
@@ -61,6 +80,7 @@ const logs = ref([]);
const root = ref();
const components = ref[[]>([]);
const uiKey = ref(0);
+const uiInspectorOpenedComponents = ref(new Map);
const saved = miLocalStorage.getItem('scratchpad');
if (saved) {
@@ -71,6 +91,14 @@ watch(code, () => {
miLocalStorage.setItem('scratchpad', code.value);
});
+function stringifyUiProps(uiProps) {
+ return JSON.stringify(
+ { ...uiProps, type: undefined, id: undefined },
+ (k, v) => typeof v === 'function' ? '' : v,
+ 2
+ );
+}
+
async function run() {
if (aiscript) aiscript.abort();
root.value = undefined;
@@ -192,4 +220,35 @@ definePageMetadata(() => ({
}
}
}
+
+.uiInspector {
+ display: grid;
+ gap: 8px;
+ padding: 16px;
+}
+
+.uiInspectorType {
+ display: inline-block;
+ border: hidden;
+ border-radius: 10px;
+ background-color: var(--panelHighlight);
+ padding: 2px 8px;
+ font-size: 12px;
+}
+
+.uiInspectorId {
+ display: inline-block;
+ padding-left: 8px;
+}
+
+.uiInspectorDescription {
+ display: block;
+ font-size: 12px;
+ padding-top: 16px;
+}
+
+.uiInspectorPropsToggle {
+ background: none;
+ border: none;
+}
--
cgit v1.2.3-freya
]