create-mendix-widget-gleam 3.0.1 → 4.0.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/README.md +8 -9
- package/package.json +1 -1
- package/src/i18n.mjs +12 -15
- package/src/index.mjs +20 -31
- package/src/templates/claude_md.mjs +10 -8
- package/src/templates/readme_md.mjs +60 -69
- package/src/templates/widgets_readme.mjs +15 -15
- package/template/docs/glendix_guide.md +243 -137
- package/template/docs/mendraw_guide.md +671 -0
- package/template/gleam.toml +3 -1
- package/template/package.json +5 -6
- package/template/src/__widget_name__.gleam +1 -1
- package/template/src/editor_config.gleam +1 -1
- package/template/src/editor_preview.gleam +1 -1
- package/template/rollup.config.mjs +0 -10
|
@@ -48,9 +48,9 @@ For example, placing \`Switch.mpk\` generates \`src/widgets/switch.gleam\`:
|
|
|
48
48
|
|
|
49
49
|
\`\`\`gleam
|
|
50
50
|
// src/widgets/switch.gleam (auto-generated)
|
|
51
|
-
import
|
|
52
|
-
import
|
|
53
|
-
import
|
|
51
|
+
import mendraw/interop
|
|
52
|
+
import mendraw/mendix.{type JsProps}
|
|
53
|
+
import mendraw/widget
|
|
54
54
|
import redraw.{type Element}
|
|
55
55
|
import redraw/dom/attribute
|
|
56
56
|
|
|
@@ -87,7 +87,7 @@ switch.render(props)
|
|
|
87
87
|
|
|
88
88
|
## How it works
|
|
89
89
|
|
|
90
|
-
- \`
|
|
90
|
+
- \`mendraw/widget\` module's \`widget.component("Name")\` imports \`.mpk\` widgets as React components
|
|
91
91
|
- Props are passed via the generic \`attribute.attribute(key, value)\` function
|
|
92
92
|
- Widget names use the \`<name>\` value from the \`.mpk\`'s internal XML, and property keys use the original keys from the \`.mpk\` XML
|
|
93
93
|
- Unlike the \`binding\` module, 1 mpk = 1 component, so \`widget.component("Name")\` imports it in one call
|
|
@@ -96,7 +96,7 @@ switch.render(props)
|
|
|
96
96
|
|
|
97
97
|
- After adding/removing \`.mpk\` files, you must run \`gleam run -m glendix/install\` again
|
|
98
98
|
- \`widget_ffi.mjs\` is auto-generated — do not edit it directly
|
|
99
|
-
- Do not write \`.mjs\` FFI files for \`.mpk\` widgets manually — use the \`widgets/\` directory + \`
|
|
99
|
+
- Do not write \`.mjs\` FFI files for \`.mpk\` widgets manually — use the \`widgets/\` directory + \`mendraw/widget\`
|
|
100
100
|
`;
|
|
101
101
|
}
|
|
102
102
|
|
|
@@ -135,9 +135,9 @@ gleam run -m glendix/install
|
|
|
135
135
|
|
|
136
136
|
\`\`\`gleam
|
|
137
137
|
// src/widgets/switch.gleam (자동 생성)
|
|
138
|
-
import
|
|
139
|
-
import
|
|
140
|
-
import
|
|
138
|
+
import mendraw/interop
|
|
139
|
+
import mendraw/mendix.{type JsProps}
|
|
140
|
+
import mendraw/widget
|
|
141
141
|
import redraw.{type Element}
|
|
142
142
|
import redraw/dom/attribute
|
|
143
143
|
|
|
@@ -174,7 +174,7 @@ switch.render(props)
|
|
|
174
174
|
|
|
175
175
|
## 동작 원리
|
|
176
176
|
|
|
177
|
-
- \`
|
|
177
|
+
- \`mendraw/widget\` 모듈의 \`widget.component("Name")\`으로 \`.mpk\` 위젯을 React 컴포넌트로 가져온다
|
|
178
178
|
- Props는 \`attribute.attribute(key, value)\` 범용 함수로 전달한다
|
|
179
179
|
- 위젯 이름은 \`.mpk\` 내부 XML의 \`<name>\` 값을, property key는 XML의 원본 key를 그대로 사용한다
|
|
180
180
|
- \`binding\` 모듈과 달리 1 mpk = 1 컴포넌트이므로 \`widget.component("Name")\` 한 번에 가져온다
|
|
@@ -183,7 +183,7 @@ switch.render(props)
|
|
|
183
183
|
|
|
184
184
|
- \`.mpk\` 파일을 추가/제거한 후에는 반드시 \`gleam run -m glendix/install\`을 다시 실행해야 한다
|
|
185
185
|
- \`widget_ffi.mjs\`는 자동 생성 파일이므로 직접 수정하지 않는다
|
|
186
|
-
- \`.mpk\` 위젯용 \`.mjs\` FFI 파일을 직접 작성하지 않는다 — \`widgets/\` 디렉토리 + \`
|
|
186
|
+
- \`.mpk\` 위젯용 \`.mjs\` FFI 파일을 직접 작성하지 않는다 — \`widgets/\` 디렉토리 + \`mendraw/widget\`을 사용한다
|
|
187
187
|
`;
|
|
188
188
|
}
|
|
189
189
|
|
|
@@ -222,9 +222,9 @@ gleam run -m glendix/install
|
|
|
222
222
|
|
|
223
223
|
\`\`\`gleam
|
|
224
224
|
// src/widgets/switch.gleam(自動生成)
|
|
225
|
-
import
|
|
226
|
-
import
|
|
227
|
-
import
|
|
225
|
+
import mendraw/interop
|
|
226
|
+
import mendraw/mendix.{type JsProps}
|
|
227
|
+
import mendraw/widget
|
|
228
228
|
import redraw.{type Element}
|
|
229
229
|
import redraw/dom/attribute
|
|
230
230
|
|
|
@@ -261,7 +261,7 @@ switch.render(props)
|
|
|
261
261
|
|
|
262
262
|
## 仕組み
|
|
263
263
|
|
|
264
|
-
- \`
|
|
264
|
+
- \`mendraw/widget\`モジュールの\`widget.component("Name")\`で\`.mpk\`ウィジェットをReactコンポーネントとしてインポートする
|
|
265
265
|
- Propsは\`attribute.attribute(key, value)\`汎用関数で渡す
|
|
266
266
|
- ウィジェット名は\`.mpk\`内部XMLの\`<name>\`値を、プロパティキーはXMLの元のキーをそのまま使用する
|
|
267
267
|
- \`binding\`モジュールと異なり1 mpk = 1コンポーネントなので、\`widget.component("Name")\`で一度にインポートする
|
|
@@ -270,6 +270,6 @@ switch.render(props)
|
|
|
270
270
|
|
|
271
271
|
- \`.mpk\`ファイルを追加/削除した後は必ず\`gleam run -m glendix/install\`を再実行すること
|
|
272
272
|
- \`widget_ffi.mjs\`は自動生成ファイルなので直接編集しない
|
|
273
|
-
- \`.mpk\`ウィジェット用の\`.mjs\` FFIファイルを直接記述しない — \`widgets/\`ディレクトリ + \`
|
|
273
|
+
- \`.mpk\`ウィジェット用の\`.mjs\` FFIファイルを直接記述しない — \`widgets/\`ディレクトリ + \`mendraw/widget\`を使用する
|
|
274
274
|
`;
|
|
275
275
|
}
|