zerocodejs 1.0.1-beta.2 → 1.0.1-beta.20
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/README.ja.md +199 -0
- package/README.md +128 -102
- package/dist/components/ZeroCodeCMS.vue.d.ts +7 -0
- package/dist/components/ZeroCodeCMS.vue.d.ts.map +1 -1
- package/dist/components/ZeroCodeEditor.vue.d.ts +60 -1
- package/dist/components/ZeroCodeEditor.vue.d.ts.map +1 -1
- package/dist/components/ZeroCodeStudio.vue.d.ts +398 -0
- package/dist/components/ZeroCodeStudio.vue.d.ts.map +1 -0
- package/dist/core/composables/useZeroCodeData.d.ts +3 -0
- package/dist/core/composables/useZeroCodeData.d.ts.map +1 -1
- package/dist/core/composables/useZeroCodeRenderer.d.ts.map +1 -1
- package/dist/core/renderer/renderer.d.ts +30 -1
- package/dist/core/renderer/renderer.d.ts.map +1 -1
- package/dist/core/utils/css-manager.d.ts.map +1 -1
- package/dist/core/utils/dom-utils.d.ts +3 -0
- package/dist/core/utils/dom-utils.d.ts.map +1 -1
- package/dist/core/utils/edit-panel-fields.d.ts +17 -0
- package/dist/core/utils/edit-panel-fields.d.ts.map +1 -0
- package/dist/core/utils/field-extractor.d.ts.map +1 -1
- package/dist/core/utils/i18n-setup.d.ts.map +1 -1
- package/dist/core/utils/image-utils.d.ts.map +1 -1
- package/dist/core/utils/logger.d.ts +5 -0
- package/dist/core/utils/logger.d.ts.map +1 -0
- package/dist/core/utils/path-utils.d.ts +5 -1
- package/dist/core/utils/path-utils.d.ts.map +1 -1
- package/dist/core/utils/sanitize.d.ts +6 -0
- package/dist/core/utils/sanitize.d.ts.map +1 -1
- package/dist/core/utils/storage.d.ts +0 -1
- package/dist/core/utils/storage.d.ts.map +1 -1
- package/dist/core/utils/template-processor.d.ts +6 -1
- package/dist/core/utils/template-processor.d.ts.map +1 -1
- package/dist/core/utils/template-regex.d.ts +0 -1
- package/dist/core/utils/template-regex.d.ts.map +1 -1
- package/dist/core/utils/template-utils.d.ts +3 -1
- package/dist/core/utils/template-utils.d.ts.map +1 -1
- package/dist/features/add/components/AddPanel.vue.d.ts.map +1 -1
- package/dist/features/add/composables/useAddMode.d.ts +7 -1
- package/dist/features/add/composables/useAddMode.d.ts.map +1 -1
- package/dist/features/data-viewer/components/DataViewer.vue.d.ts +1 -0
- package/dist/features/data-viewer/components/DataViewer.vue.d.ts.map +1 -1
- package/dist/features/delete/components/DeletePanel.vue.d.ts.map +1 -1
- package/dist/features/delete/composables/useDeleteMode.d.ts.map +1 -1
- package/dist/features/editor/components/ContextMenu.vue.d.ts.map +1 -1
- package/dist/features/editor/components/EditPanel.vue.d.ts +1 -4
- package/dist/features/editor/components/EditPanel.vue.d.ts.map +1 -1
- package/dist/features/editor/components/ImageSelectModal.vue.d.ts +1 -7
- package/dist/features/editor/components/ImageSelectModal.vue.d.ts.map +1 -1
- package/dist/features/editor/components/RichTextEditor.vue.d.ts.map +1 -1
- package/dist/features/editor/components/SettingsPanel.vue.d.ts.map +1 -1
- package/dist/features/editor/components/Toolbar.vue.d.ts.map +1 -1
- package/dist/features/editor/composables/useClickHandlers.d.ts.map +1 -1
- package/dist/features/editor/composables/useEditMode.d.ts +4 -16
- package/dist/features/editor/composables/useEditMode.d.ts.map +1 -1
- package/dist/features/editor/composables/useOutlineManager.d.ts.map +1 -1
- package/dist/features/images-manager/components/ImagesManagerPanel.vue.d.ts +2 -0
- package/dist/features/images-manager/components/ImagesManagerPanel.vue.d.ts.map +1 -1
- package/dist/features/parts-manager/components/MonacoEditor.vue.d.ts +3 -1
- package/dist/features/parts-manager/components/MonacoEditor.vue.d.ts.map +1 -1
- package/dist/features/parts-manager/components/PartsManagerPanel.vue.d.ts +44 -1
- package/dist/features/parts-manager/components/PartsManagerPanel.vue.d.ts.map +1 -1
- package/dist/features/parts-manager/composables/usePartsManager.d.ts +15 -1
- package/dist/features/parts-manager/composables/usePartsManager.d.ts.map +1 -1
- package/dist/features/preview/PreviewArea.vue.d.ts.map +1 -1
- package/dist/features/reorder/components/ReorderPanel.vue.d.ts.map +1 -1
- package/dist/features/reorder/composables/useReorderMode.d.ts +3 -1
- package/dist/features/reorder/composables/useReorderMode.d.ts.map +1 -1
- package/dist/i18n/index.d.ts +36 -2
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/locales/en.d.ts +18 -1
- package/dist/i18n/locales/en.d.ts.map +1 -1
- package/dist/i18n/locales/ja.d.ts +18 -1
- package/dist/i18n/locales/ja.d.ts.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/ssr-entry.d.ts +6 -0
- package/dist/ssr-entry.d.ts.map +1 -0
- package/dist/types/index.d.ts +7 -5
- package/dist/types/index.d.ts.map +1 -1
- package/dist/web-components/zcode-cms.d.ts.map +1 -1
- package/dist/web-components/zcode-editor.d.ts.map +1 -1
- package/dist/web-components/zcode-studio.d.ts +28 -0
- package/dist/web-components/zcode-studio.d.ts.map +1 -0
- package/dist/zerocode-ssr.es.js +1409 -0
- package/dist/zerocode.es.js +15764 -15347
- package/dist/zerocode.umd.js +68 -72
- package/dist/zerocodejs.css +1 -1
- package/package.json +27 -7
- package/dist/__tests__/fixtures/sample-data.d.ts +0 -23
- package/dist/__tests__/fixtures/sample-data.d.ts.map +0 -1
- package/dist/__tests__/fixtures/sample-templates.d.ts +0 -25
- package/dist/__tests__/fixtures/sample-templates.d.ts.map +0 -1
- package/dist/core/utils/component-initializer.test.d.ts +0 -2
- package/dist/core/utils/component-initializer.test.d.ts.map +0 -1
- package/dist/core/utils/field-extractor.test.d.ts +0 -2
- package/dist/core/utils/field-extractor.test.d.ts.map +0 -1
- package/dist/core/utils/image-utils.test.d.ts +0 -2
- package/dist/core/utils/image-utils.test.d.ts.map +0 -1
- package/dist/core/utils/path-utils.test.d.ts +0 -2
- package/dist/core/utils/path-utils.test.d.ts.map +0 -1
- package/dist/core/utils/storage.test.d.ts +0 -2
- package/dist/core/utils/storage.test.d.ts.map +0 -1
- package/dist/core/utils/template-processor.test.d.ts +0 -2
- package/dist/core/utils/template-processor.test.d.ts.map +0 -1
- package/dist/core/utils/template-utils.test.d.ts +0 -2
- package/dist/core/utils/template-utils.test.d.ts.map +0 -1
- package/dist/core/utils/validation.test.d.ts +0 -2
- package/dist/core/utils/validation.test.d.ts.map +0 -1
- package/dist/css/common.css +0 -677
- package/dist/css/docs.css +0 -396
- package/dist/css/index.css +0 -1039
- package/dist/css/page.css +0 -290
- package/dist/css/sample.css +0 -26
- package/dist/css/site-common.css +0 -218
- package/dist/footer.html +0 -10
- package/dist/header.html +0 -10
- package/dist/images/customer-avatar.jpg +0 -0
- package/dist/images/default-avatar.jpg +0 -0
- package/dist/images/default.jpg +0 -0
- package/dist/images/hero-bg.jpg +0 -0
- package/dist/images/kv_image.jpg +0 -0
- package/dist/images/page-specific-hero.jpg +0 -0
- package/dist/images/sample-1.jpg +0 -0
- package/dist/images/sample-2.jpg +0 -0
- package/dist/images/sample-3.jpg +0 -0
- package/dist/images/zcode_top_01.png +0 -0
- package/dist/js/accordion.js +0 -24
- package/dist/js/common.js +0 -1093
- package/dist/web-component.d.ts +0 -14
- package/dist/web-component.d.ts.map +0 -1
- package/dist/zerocode.es.js.map +0 -1
- package/dist/zerocode.umd.js.map +0 -1
package/README.ja.md
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
# ZeroCode.js
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/zerocodejs)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
[](https://github.com/atsumi-code/zerocodejs/actions/workflows/ci.yml)
|
|
6
|
+
[](https://atsumi-code.github.io/zerocodejs/)
|
|
7
|
+
|
|
8
|
+
🌐 [English](./README.md)
|
|
9
|
+
|
|
10
|
+
シンプルに編集画面を。フレームワーク非依存のCMSフロントエンドライブラリ
|
|
11
|
+
|
|
12
|
+
> **Status: Beta**
|
|
13
|
+
>
|
|
14
|
+
> ZeroCode.js は現在ベータ版です。仕様・API・データ形式は予告なく変更される可能性があります(破壊的変更を含む)。
|
|
15
|
+
> 不具合報告・改善提案・ユースケース共有・ドキュメントのズレの指摘を歓迎します。
|
|
16
|
+
>
|
|
17
|
+
> - **GitHub**: https://github.com/atsumi-code/zerocodejs
|
|
18
|
+
> - **Issues(バグ・要望)**: [https://github.com/atsumi-code/zerocodejs/issues](https://github.com/atsumi-code/zerocodejs/issues)
|
|
19
|
+
> - **Discussions(質問・意見)**: [https://github.com/atsumi-code/zerocodejs/discussions](https://github.com/atsumi-code/zerocodejs/discussions)
|
|
20
|
+
> - **Contributing**: [./CONTRIBUTING.md](./CONTRIBUTING.md)
|
|
21
|
+
|
|
22
|
+
> ⭐ **スターをお願いします**
|
|
23
|
+
> このプロジェクトに共感していただけたら、[GitHub でスター](https://github.com/atsumi-code/zerocodejs)をいただけると励みになります。
|
|
24
|
+
|
|
25
|
+
## 特徴
|
|
26
|
+
|
|
27
|
+
- **フレームワーク非依存**: Web Componentsとして実装されているため、どのフレームワークでも使用可能
|
|
28
|
+
- **視覚的編集**: クリック操作でコンテンツを編集・追加・削除・並べ替え
|
|
29
|
+
- **パーツ管理**: 再利用可能なパーツを作成・管理
|
|
30
|
+
- **画像管理**: 画像のアップロード・管理機能
|
|
31
|
+
- **柔軟なテンプレート**: カスタムHTMLテンプレート構文で動的なコンテンツを定義
|
|
32
|
+
- **軽量**: gzip後 約260KB
|
|
33
|
+
|
|
34
|
+
## デモ
|
|
35
|
+
|
|
36
|
+
**ライブデモ:** https://atsumi-code.github.io/zerocodejs/
|
|
37
|
+
|
|
38
|
+

|
|
39
|
+
|
|
40
|
+
## クイックスタート
|
|
41
|
+
|
|
42
|
+
### CDN(最も簡単)
|
|
43
|
+
|
|
44
|
+
```html
|
|
45
|
+
<!DOCTYPE html>
|
|
46
|
+
<html>
|
|
47
|
+
<head>
|
|
48
|
+
<link rel="stylesheet" href="https://unpkg.com/zerocodejs/dist/zerocodejs.css" />
|
|
49
|
+
</head>
|
|
50
|
+
<body>
|
|
51
|
+
<zcode-editor></zcode-editor>
|
|
52
|
+
|
|
53
|
+
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
|
|
54
|
+
<script src="https://unpkg.com/zerocodejs/dist/zerocode.umd.js"></script>
|
|
55
|
+
</body>
|
|
56
|
+
</html>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
これだけです!ブラウザでファイルを開いて、パーツの作成を始めましょう。
|
|
60
|
+
|
|
61
|
+
### npm
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
npm install zerocodejs
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
```html
|
|
68
|
+
<!DOCTYPE html>
|
|
69
|
+
<html>
|
|
70
|
+
<head>
|
|
71
|
+
<link rel="stylesheet" href="node_modules/zerocodejs/dist/zerocodejs.css" />
|
|
72
|
+
</head>
|
|
73
|
+
<body>
|
|
74
|
+
<zcode-editor></zcode-editor>
|
|
75
|
+
|
|
76
|
+
<script type="module">
|
|
77
|
+
import 'zerocodejs';
|
|
78
|
+
</script>
|
|
79
|
+
</body>
|
|
80
|
+
</html>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### React
|
|
84
|
+
|
|
85
|
+
```jsx
|
|
86
|
+
import 'zerocodejs';
|
|
87
|
+
import 'zerocodejs/style.css';
|
|
88
|
+
|
|
89
|
+
function App() {
|
|
90
|
+
return <zcode-editor />;
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Vue
|
|
95
|
+
|
|
96
|
+
```vue
|
|
97
|
+
<template>
|
|
98
|
+
<zcode-editor />
|
|
99
|
+
</template>
|
|
100
|
+
|
|
101
|
+
<script setup>
|
|
102
|
+
import 'zerocodejs';
|
|
103
|
+
import 'zerocodejs/style.css';
|
|
104
|
+
</script>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### スタイルシートの読み込み順
|
|
108
|
+
|
|
109
|
+
**`zerocodejs/style.css`**(または `dist/zerocodejs.css`)は、**強いグローバルリセット(Tailwind の Preflight、`input { appearance: none }` など)より後に**読み込むことを推奨します。クラスは `zcode-` でスコープされますが、チェックボックス・ラジオ・`select` などネイティブ要素は広い `input` / `select` リセットの影響を受けることがあります。
|
|
110
|
+
|
|
111
|
+
## コンポーネント
|
|
112
|
+
|
|
113
|
+
### `<zcode-editor>`
|
|
114
|
+
|
|
115
|
+
エンジニア・デザイナー向けエディター。パーツ管理、画像管理、データビューアを含む全機能が利用可能。**はじめての方におすすめ。**
|
|
116
|
+
|
|
117
|
+
```html
|
|
118
|
+
<zcode-editor></zcode-editor>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### `<zcode-cms>`
|
|
122
|
+
|
|
123
|
+
エンドユーザー向けCMSエディター。編集・追加・削除・並べ替えのみ(パーツ管理・画像管理なし)。
|
|
124
|
+
|
|
125
|
+
```html
|
|
126
|
+
<zcode-cms></zcode-cms>
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### `<zcode-studio>`
|
|
130
|
+
|
|
131
|
+
**信頼できるユーザー・制作会社向け**。画面構成は **`zcode-editor` と同じ**(ページ管理・パーツ管理・画像管理・データビューア)。ページ管理は `zcode-cms` 相当の編集(共通/個別/特別のパーツ利用を含む)。パーツ・画像の管理タブとデータビューアのパーツ/画像表示は**特別カテゴリのみ**(共通・個別の切り替えはなし)。エンドユーザー用の `zcode-cms` と役割を分けたいときに使います。
|
|
132
|
+
|
|
133
|
+
`save-request` では `detail.source: 'studio'` と、タブ・表示に応じた `targets` が渡ります。`zcode-cms` からのページ保存は **`targets: ['page']` のみ**です。永続化はホストアプリ側で処理してください。
|
|
134
|
+
|
|
135
|
+
詳細は [技術仕様書 – zcode-studio](./TECHNICAL_SPECIFICATION.md#zcode-studio)。
|
|
136
|
+
|
|
137
|
+
## サーバーサイドレンダリング(SSR)
|
|
138
|
+
|
|
139
|
+
**Node.js** や Next.js などでは、公式サブパス **`zerocodejs/ssr`** から `renderToHtml` / `renderCssToHtml` を import することを推奨します。Vue・Web Components を含まない軽量バンドル(`package.json` の `exports["./ssr"]`)です。テンプレート処理には **jsdom** が必要です(`zerocodejs` の依存として入ります)。
|
|
140
|
+
|
|
141
|
+
```javascript
|
|
142
|
+
import { renderToHtml, renderCssToHtml } from 'zerocodejs/ssr';
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
従来どおり **`zerocodejs`** 本体から同じ関数を import することもできます。
|
|
146
|
+
|
|
147
|
+
## 既存データの読み込み
|
|
148
|
+
|
|
149
|
+
既存データを読み込む場合は、JavaScriptで属性を設定します:
|
|
150
|
+
|
|
151
|
+
```javascript
|
|
152
|
+
const editor = document.querySelector('zcode-editor');
|
|
153
|
+
editor.setAttribute('page', JSON.stringify(pageData));
|
|
154
|
+
editor.setAttribute('parts-common', JSON.stringify(partsData));
|
|
155
|
+
editor.setAttribute('parts-individual', JSON.stringify(partsIndividualData));
|
|
156
|
+
editor.setAttribute('parts-special', JSON.stringify(partsSpecialData));
|
|
157
|
+
editor.setAttribute('images-common', JSON.stringify(imagesData));
|
|
158
|
+
// ... 必要に応じて他の属性も設定(images-individual, images-special など)
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## ドキュメント
|
|
162
|
+
|
|
163
|
+
- [技術仕様書](./TECHNICAL_SPECIFICATION.md)
|
|
164
|
+
- [実装TODO](./TODO.md)
|
|
165
|
+
- [AI向けガイドライン](./AGENTS.md)
|
|
166
|
+
|
|
167
|
+
## なぜ ZeroCode.js?
|
|
168
|
+
|
|
169
|
+
- **編集したいところだけ、手軽にCMSにしたい人** — 更新したい箇所を決めれば、その部分だけ画面で編集できる仕組みを簡単に作れる
|
|
170
|
+
- **HTML・CSS・JavaScriptだけでやりたい人** — 余計なフレームワークを使わず、基本だけで作りたい人
|
|
171
|
+
- **フロントエンドの変化に疲れた人** — 毎年新しい技術が出てきて追いかけるのが大変な人
|
|
172
|
+
- **AI時代に、人にもAIにも扱いやすいコンテンツにしたい人** — テンプレートとデータがシンプルなので、人が編集しやすく、AIとも相性がよい
|
|
173
|
+
|
|
174
|
+
## 日本語コミュニティ
|
|
175
|
+
|
|
176
|
+
- GitHub Issues での日本語での質問・議論を歓迎します
|
|
177
|
+
- Issue は日本語でも英語でもOKです
|
|
178
|
+
- PR のコミットメッセージは英語推奨ですが、日本語の説明も歓迎します
|
|
179
|
+
|
|
180
|
+
## セキュリティ
|
|
181
|
+
|
|
182
|
+
ZeroCode.jsはフロントエンドライブラリのため、クライアント側での完全なセキュリティ保証はできません。
|
|
183
|
+
|
|
184
|
+
### 推奨事項
|
|
185
|
+
|
|
186
|
+
- **サーバー側での検証を必須とする**: データ保存前にサーバー側で検証してください
|
|
187
|
+
- **認証・認可の実装**: パーツデータの変更は認証されたユーザーのみ許可してください
|
|
188
|
+
- **送信元の検証**: `save-request`イベントの`source`フィールド(`cms` / `editor` / `studio`)を確認してください
|
|
189
|
+
- **パーツテンプレートの管理**: パーツテンプレートは信頼できるソースからのみ使用してください
|
|
190
|
+
|
|
191
|
+
詳細は[技術仕様書](./TECHNICAL_SPECIFICATION.md)のセキュリティセクションを参照してください。
|
|
192
|
+
|
|
193
|
+
## ライセンス
|
|
194
|
+
|
|
195
|
+
MIT License
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
**最終更新日**: 2026年3月
|
package/README.md
CHANGED
|
@@ -1,115 +1,94 @@
|
|
|
1
1
|
# ZeroCode.js
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/zerocodejs)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
[](https://github.com/atsumi-code/zerocodejs/actions/workflows/ci.yml)
|
|
6
|
+
[](https://atsumi-code.github.io/zerocodejs/)
|
|
5
7
|
|
|
6
|
-
|
|
8
|
+
🇯🇵 [日本語ドキュメント](./README.ja.md)
|
|
9
|
+
|
|
10
|
+
**Simple editing UI. Framework-agnostic CMS frontend library.**
|
|
7
11
|
|
|
8
12
|
> **Status: Beta**
|
|
9
13
|
>
|
|
10
|
-
> ZeroCode.js
|
|
11
|
-
>
|
|
12
|
-
>
|
|
13
|
-
> - **GitHub**: https://github.com/atsumi-code/zerocodejs
|
|
14
|
-
> - **Issue**: [https://github.com/atsumi-code/zerocodejs/issues](https://github.com/atsumi-code/zerocodejs/issues)
|
|
15
|
-
> - **Discussion**: [https://github.com/atsumi-code/zerocodejs/discussions](https://github.com/atsumi-code/zerocodejs/discussions)(運用していない場合は Issue でOK)
|
|
16
|
-
> - **Contributing**: [./CONTRIBUTING.md](./CONTRIBUTING.md)
|
|
17
|
-
|
|
18
|
-
> ⭐ **スターをお願いします**
|
|
19
|
-
> このプロジェクトに共感していただけたら、[GitHub でスター](https://github.com/atsumi-code/zerocodejs)をいただけると励みになります。
|
|
14
|
+
> ZeroCode.js is currently in beta. APIs, specifications, and data formats may change without notice (including breaking changes).
|
|
15
|
+
> Bug reports and feature requests: [Issues](https://github.com/atsumi-code/zerocodejs/issues). Questions and feedback: [Discussions](https://github.com/atsumi-code/zerocodejs/discussions).
|
|
20
16
|
|
|
21
|
-
##
|
|
17
|
+
## Features
|
|
22
18
|
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
19
|
+
- **Framework Agnostic** - Works with React, Vue, Svelte, Angular, or Vanilla JS via Web Components
|
|
20
|
+
- **Visual Editor** - Click to edit, drag to reorder, no coding required for content editing
|
|
21
|
+
- **Parts Management** - Create and manage reusable content blocks
|
|
22
|
+
- **Image Management** - Built-in image upload and management
|
|
23
|
+
- **Flexible Templates** - Custom HTML template syntax for dynamic content
|
|
24
|
+
- **Lightweight** - Only ~260KB gzipped
|
|
25
|
+
- **i18n Ready** - Built-in Japanese & English UI support
|
|
29
26
|
|
|
30
|
-
##
|
|
27
|
+
## Demo
|
|
31
28
|
|
|
32
|
-
|
|
33
|
-
npm install zerocodejs
|
|
34
|
-
```
|
|
29
|
+
**Live Demo:** https://atsumi-code.github.io/zerocodejs/
|
|
35
30
|
|
|
36
|
-
ZeroCode.js
|
|
31
|
+

|
|
37
32
|
|
|
38
|
-
|
|
33
|
+
## Quick Start
|
|
39
34
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
### 基本的な使用例
|
|
35
|
+
### CDN (Easiest)
|
|
43
36
|
|
|
44
37
|
```html
|
|
45
38
|
<!DOCTYPE html>
|
|
46
|
-
<html
|
|
47
|
-
<head>
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
<
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
<
|
|
55
|
-
|
|
56
|
-
</zcode-cms>
|
|
57
|
-
|
|
58
|
-
<script type="module">
|
|
59
|
-
import 'zerocodejs';
|
|
60
|
-
|
|
61
|
-
const cms = document.getElementById('cms');
|
|
62
|
-
cms.setAttribute('page', JSON.stringify([]));
|
|
63
|
-
cms.setAttribute('parts-common', JSON.stringify([]));
|
|
64
|
-
cms.setAttribute('parts-individual', JSON.stringify([]));
|
|
65
|
-
cms.setAttribute('parts-special', JSON.stringify([]));
|
|
66
|
-
cms.setAttribute('images-common', JSON.stringify([]));
|
|
67
|
-
cms.setAttribute('images-individual', JSON.stringify([]));
|
|
68
|
-
cms.setAttribute('images-special', JSON.stringify([]));
|
|
69
|
-
</script>
|
|
70
|
-
</body>
|
|
39
|
+
<html>
|
|
40
|
+
<head>
|
|
41
|
+
<link rel="stylesheet" href="https://unpkg.com/zerocodejs/dist/zerocodejs.css" />
|
|
42
|
+
</head>
|
|
43
|
+
<body>
|
|
44
|
+
<zcode-editor locale="en"></zcode-editor>
|
|
45
|
+
|
|
46
|
+
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
|
|
47
|
+
<script src="https://unpkg.com/zerocodejs/dist/zerocode.umd.js"></script>
|
|
48
|
+
</body>
|
|
71
49
|
</html>
|
|
72
50
|
```
|
|
73
51
|
|
|
74
|
-
|
|
52
|
+
That's it! Open the file in a browser and start creating parts.
|
|
53
|
+
|
|
54
|
+
### npm
|
|
75
55
|
|
|
76
56
|
```bash
|
|
77
57
|
npm install zerocodejs
|
|
78
58
|
```
|
|
79
59
|
|
|
60
|
+
```html
|
|
61
|
+
<!DOCTYPE html>
|
|
62
|
+
<html>
|
|
63
|
+
<head>
|
|
64
|
+
<link rel="stylesheet" href="node_modules/zerocodejs/dist/zerocodejs.css" />
|
|
65
|
+
</head>
|
|
66
|
+
<body>
|
|
67
|
+
<zcode-editor locale="en"></zcode-editor>
|
|
68
|
+
|
|
69
|
+
<script type="module">
|
|
70
|
+
import 'zerocodejs';
|
|
71
|
+
</script>
|
|
72
|
+
</body>
|
|
73
|
+
</html>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### React
|
|
77
|
+
|
|
80
78
|
```jsx
|
|
81
|
-
import { useEffect } from 'react';
|
|
82
79
|
import 'zerocodejs';
|
|
83
80
|
import 'zerocodejs/style.css';
|
|
84
81
|
|
|
85
82
|
function App() {
|
|
86
|
-
|
|
87
|
-
const cms = document.getElementById('cms');
|
|
88
|
-
if (cms) {
|
|
89
|
-
cms.setAttribute('page', JSON.stringify([]));
|
|
90
|
-
cms.setAttribute('parts-common', JSON.stringify([]));
|
|
91
|
-
cms.setAttribute('parts-individual', JSON.stringify([]));
|
|
92
|
-
cms.setAttribute('parts-special', JSON.stringify([]));
|
|
93
|
-
cms.setAttribute('images-common', JSON.stringify([]));
|
|
94
|
-
cms.setAttribute('images-individual', JSON.stringify([]));
|
|
95
|
-
cms.setAttribute('images-special', JSON.stringify([]));
|
|
96
|
-
}
|
|
97
|
-
}, []);
|
|
98
|
-
|
|
99
|
-
return <zcode-cms id="cms" locale="ja" />;
|
|
83
|
+
return <zcode-editor locale="en" />;
|
|
100
84
|
}
|
|
101
85
|
```
|
|
102
86
|
|
|
103
|
-
### Vue
|
|
104
|
-
|
|
105
|
-
```bash
|
|
106
|
-
npm install zerocodejs
|
|
107
|
-
# Vueは既にインストール済み
|
|
108
|
-
```
|
|
87
|
+
### Vue
|
|
109
88
|
|
|
110
89
|
```vue
|
|
111
90
|
<template>
|
|
112
|
-
<zcode-
|
|
91
|
+
<zcode-editor locale="en" />
|
|
113
92
|
</template>
|
|
114
93
|
|
|
115
94
|
<script setup>
|
|
@@ -118,48 +97,95 @@ import 'zerocodejs/style.css';
|
|
|
118
97
|
</script>
|
|
119
98
|
```
|
|
120
99
|
|
|
121
|
-
###
|
|
100
|
+
### Stylesheet load order
|
|
101
|
+
|
|
102
|
+
Import **`zerocodejs/style.css`** after any aggressive global reset (for example Tailwind Preflight or rules that set `input { appearance: none }`). ZeroCode scopes UI with `zcode-` classes, but native checkboxes, radios, and selects can still be affected by broad `input` / `select` resets.
|
|
103
|
+
|
|
104
|
+
## Components
|
|
105
|
+
|
|
106
|
+
### `<zcode-editor>`
|
|
107
|
+
|
|
108
|
+
Developer-facing editor with parts management, image management, and data viewer. **Recommended for getting started.**
|
|
122
109
|
|
|
123
110
|
```html
|
|
124
|
-
<zcode-editor
|
|
125
|
-
<link slot="css" rel="stylesheet" href="/css/common.css" />
|
|
126
|
-
<script slot="script" src="/js/accordion.js"></script>
|
|
127
|
-
</zcode-editor>
|
|
111
|
+
<zcode-editor locale="en"></zcode-editor>
|
|
128
112
|
```
|
|
129
113
|
|
|
130
|
-
###
|
|
114
|
+
### `<zcode-cms>`
|
|
115
|
+
|
|
116
|
+
User-facing CMS editor for content management (no parts/image management).
|
|
131
117
|
|
|
132
118
|
```html
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
119
|
+
<zcode-cms locale="en"></zcode-cms>
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### `<zcode-studio>`
|
|
123
|
+
|
|
124
|
+
For **trusted users / agencies**: same **shell as `zcode-editor`** (page, parts, images, data viewer tabs). **Page** management matches `zcode-cms` (including common/individual/special parts when adding to the page). **Parts / images** management and the data viewer’s parts/images views are **special category only** (no common/individual toggles there). Use alongside `zcode-cms` when you want a separate trusted surface.
|
|
125
|
+
|
|
126
|
+
`save-request` uses `detail.source: 'studio'`; `targets` follow the active tab and data viewer view. From `zcode-cms`, page saves use `targets: ['page']` only—handle persistence in your host app.
|
|
127
|
+
|
|
128
|
+
See [Technical Specification – zcode-studio](./TECHNICAL_SPECIFICATION.md#zcode-studio).
|
|
129
|
+
|
|
130
|
+
## Server-side rendering (SSR)
|
|
131
|
+
|
|
132
|
+
For **Node.js** or app frameworks (e.g. Next.js), import from the **`zerocodejs/ssr`** subpath. It is the supported `package.json` export for the SSR bundle (no Vue / Web Components). Template processing needs **jsdom** (already a dependency of `zerocodejs`).
|
|
133
|
+
|
|
134
|
+
```javascript
|
|
135
|
+
import { renderToHtml, renderCssToHtml } from 'zerocodejs/ssr';
|
|
138
136
|
```
|
|
139
137
|
|
|
140
|
-
|
|
138
|
+
The main **`zerocodejs`** entry also exports these functions if you prefer one resolution from the full library.
|
|
139
|
+
|
|
140
|
+
## Loading Existing Data
|
|
141
|
+
|
|
142
|
+
To load existing data, set attributes via JavaScript:
|
|
143
|
+
|
|
144
|
+
```javascript
|
|
145
|
+
const editor = document.querySelector('zcode-editor');
|
|
146
|
+
editor.setAttribute('page', JSON.stringify(pageData));
|
|
147
|
+
editor.setAttribute('parts-common', JSON.stringify(partsData));
|
|
148
|
+
editor.setAttribute('parts-individual', JSON.stringify(partsIndividualData));
|
|
149
|
+
editor.setAttribute('parts-special', JSON.stringify(partsSpecialData));
|
|
150
|
+
editor.setAttribute('images-common', JSON.stringify(imagesData));
|
|
151
|
+
// ... other attributes as needed (images-individual, images-special, etc.)
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Documentation
|
|
155
|
+
|
|
156
|
+
- [Technical Specification](./TECHNICAL_SPECIFICATION.md)
|
|
157
|
+
- [日本語ドキュメント](./README.ja.md)
|
|
158
|
+
|
|
159
|
+
## Why ZeroCode.js?
|
|
160
|
+
|
|
161
|
+
- **For those who want to turn "this part should be editable" into a real CMS easily** — Define what should be editable, and you get a simple CMS for just those parts
|
|
162
|
+
- **For those who want to stick to HTML, CSS, and JavaScript** — No extra frameworks, just the basics
|
|
163
|
+
- **For people tired of the ever-changing frontend** — When keeping up with new tech feels like too much
|
|
164
|
+
- **For the AI era** — Simple template + data is easy for both humans and AI to work with
|
|
165
|
+
|
|
166
|
+
## Contributing
|
|
167
|
+
|
|
168
|
+
Contributions are welcome! Please see [CONTRIBUTING.md](./CONTRIBUTING.md).
|
|
141
169
|
|
|
142
|
-
|
|
143
|
-
- [実装TODO](./TODO.md)
|
|
144
|
-
- [AI向けガイドライン](./AGENTS.md)
|
|
170
|
+
We welcome contributions in both **English and Japanese**.
|
|
145
171
|
|
|
146
|
-
##
|
|
172
|
+
## Security
|
|
147
173
|
|
|
148
|
-
ZeroCode.js
|
|
174
|
+
ZeroCode.js is a frontend library. Complete security cannot be guaranteed on the client side.
|
|
149
175
|
|
|
150
|
-
###
|
|
176
|
+
### Recommendations
|
|
151
177
|
|
|
152
|
-
-
|
|
153
|
-
-
|
|
154
|
-
-
|
|
155
|
-
-
|
|
178
|
+
- **Server-side validation is required**: Validate data before saving on the server
|
|
179
|
+
- **Implement authentication/authorization**: Only allow authenticated users to modify parts data
|
|
180
|
+
- **Verify the source**: Check the `source` field in `save-request` events (`'cms'`, `'editor'`, or `'studio'`)
|
|
181
|
+
- **Template management**: Only use templates from trusted sources
|
|
156
182
|
|
|
157
|
-
|
|
183
|
+
See the [Technical Specification](./TECHNICAL_SPECIFICATION.md) for security details.
|
|
158
184
|
|
|
159
|
-
##
|
|
185
|
+
## License
|
|
160
186
|
|
|
161
187
|
MIT License
|
|
162
188
|
|
|
163
189
|
---
|
|
164
190
|
|
|
165
|
-
|
|
191
|
+
**Last Updated**: March 2026
|
|
@@ -14,6 +14,10 @@ type __VLS_Props = {
|
|
|
14
14
|
config?: string;
|
|
15
15
|
endpoints?: string;
|
|
16
16
|
backendData?: string;
|
|
17
|
+
/** true のとき固定保存ボタンを出さない(親が save-request を送る) */
|
|
18
|
+
hideFixedSaveButton?: boolean;
|
|
19
|
+
/** save-request の detail.source(埋め込み先が studio のときは 'studio') */
|
|
20
|
+
saveRequestSource?: 'cms' | 'studio';
|
|
17
21
|
};
|
|
18
22
|
declare function getData(path?: string): unknown;
|
|
19
23
|
declare const _default: import('vue').DefineComponent<__VLS_Props, {
|
|
@@ -46,6 +50,7 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {
|
|
|
46
50
|
allowedParts?: string[];
|
|
47
51
|
}> | undefined;
|
|
48
52
|
slotOnly?: boolean | undefined;
|
|
53
|
+
outlinePosition?: "inner" | undefined;
|
|
49
54
|
}[];
|
|
50
55
|
}[];
|
|
51
56
|
individual: {
|
|
@@ -61,6 +66,7 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {
|
|
|
61
66
|
allowedParts?: string[];
|
|
62
67
|
}> | undefined;
|
|
63
68
|
slotOnly?: boolean | undefined;
|
|
69
|
+
outlinePosition?: "inner" | undefined;
|
|
64
70
|
}[];
|
|
65
71
|
}[];
|
|
66
72
|
special: {
|
|
@@ -76,6 +82,7 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {
|
|
|
76
82
|
allowedParts?: string[];
|
|
77
83
|
}> | undefined;
|
|
78
84
|
slotOnly?: boolean | undefined;
|
|
85
|
+
outlinePosition?: "inner" | undefined;
|
|
79
86
|
}[];
|
|
80
87
|
}[];
|
|
81
88
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ZeroCodeCMS.vue.d.ts","sourceRoot":"","sources":["../../src/components/ZeroCodeCMS.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ZeroCodeCMS.vue.d.ts","sourceRoot":"","sources":["../../src/components/ZeroCodeCMS.vue"],"names":[],"mappings":"AA2KA;AA21BA,OAAO,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAQ5E,KAAK,WAAW,GAAG;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gDAAgD;IAChD,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,gEAAgE;IAChE,iBAAiB,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;CACtC,CAAC;AA6DF,iBAAS,OAAO,CAAC,IAAI,CAAC,EAAE,MAAM,WAU7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCAxHD,CAlyBS;;;;;;;;;;;;;;;;oCAkyBT,CAlyBS;;;;;;;;;;;;;;;;oCAkyBT,CAlyBS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAi7DT,wBASG"}
|