mokkun 0.1.5 → 0.2.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.
Files changed (137) hide show
  1. package/README.md +18 -6
  2. package/bin/cli.mjs +6 -6
  3. package/bin/viewer.html +78 -3
  4. package/dist/example.html +225 -0
  5. package/dist/mokkun.css +1 -1
  6. package/dist/mokkun.esm.js +14476 -9626
  7. package/dist/mokkun.esm.js.map +1 -1
  8. package/dist/mokkun.js +761 -363
  9. package/dist/mokkun.js.map +1 -1
  10. package/dist/types/lib.d.ts +109 -0
  11. package/dist/types/loader/file-loader.d.ts +118 -0
  12. package/dist/types/loader/index.d.ts +4 -0
  13. package/dist/types/parser/index.d.ts +5 -0
  14. package/dist/types/parser/key-normalizer.d.ts +24 -0
  15. package/dist/types/parser/v2/compile-expand.d.ts +23 -0
  16. package/dist/types/parser/v2/compile-field.d.ts +28 -0
  17. package/dist/types/parser/v2/compile-section.d.ts +6 -0
  18. package/dist/types/parser/v2/compile-v2.d.ts +14 -0
  19. package/dist/types/parser/v2/compile-warnings.d.ts +17 -0
  20. package/dist/types/parser/v2/file-spec.d.ts +24 -0
  21. package/dist/types/parser/v2/index.d.ts +5 -0
  22. package/dist/types/parser/v2/iso-date.d.ts +10 -0
  23. package/dist/types/parser/v2/parse-v2.d.ts +24 -0
  24. package/dist/types/parser/v2/validate-action.d.ts +11 -0
  25. package/dist/types/parser/v2/validate-app.d.ts +9 -0
  26. package/dist/types/parser/v2/validate-context.d.ts +41 -0
  27. package/dist/types/parser/v2/validate-field.d.ts +17 -0
  28. package/dist/types/parser/v2/validate-keys.d.ts +29 -0
  29. package/dist/types/parser/v2/validate-list.d.ts +5 -0
  30. package/dist/types/parser/v2/validate-v2.d.ts +6 -0
  31. package/dist/types/parser/v2/validate-view.d.ts +6 -0
  32. package/dist/types/parser/yaml-parser.d.ts +68 -0
  33. package/dist/types/renderer/action-handler.d.ts +76 -0
  34. package/dist/types/renderer/components/accordion-panel.d.ts +144 -0
  35. package/dist/types/renderer/components/action-buttons.d.ts +183 -0
  36. package/dist/types/renderer/components/alert-banner.d.ts +43 -0
  37. package/dist/types/renderer/components/app-header.d.ts +277 -0
  38. package/dist/types/renderer/components/app-navi.d.ts +167 -0
  39. package/dist/types/renderer/components/badge.d.ts +134 -0
  40. package/dist/types/renderer/components/browser.d.ts +134 -0
  41. package/dist/types/renderer/components/calendar.d.ts +198 -0
  42. package/dist/types/renderer/components/checkbox.d.ts +132 -0
  43. package/dist/types/renderer/components/chip.d.ts +120 -0
  44. package/dist/types/renderer/components/combobox.d.ts +217 -0
  45. package/dist/types/renderer/components/data-table.d.ts +186 -0
  46. package/dist/types/renderer/components/date-range-picker.d.ts +203 -0
  47. package/dist/types/renderer/components/definition-list.d.ts +165 -0
  48. package/dist/types/renderer/components/delete-confirm-dialog.d.ts +151 -0
  49. package/dist/types/renderer/components/dialog/action-dialog.d.ts +61 -0
  50. package/dist/types/renderer/components/dialog/base-dialog.d.ts +125 -0
  51. package/dist/types/renderer/components/dialog/dialog-types.d.ts +96 -0
  52. package/dist/types/renderer/components/disclosure.d.ts +118 -0
  53. package/dist/types/renderer/components/dropdown.d.ts +220 -0
  54. package/dist/types/renderer/components/duration-input.d.ts +154 -0
  55. package/dist/types/renderer/components/duration-picker.d.ts +108 -0
  56. package/dist/types/renderer/components/field-renderer.d.ts +22 -0
  57. package/dist/types/renderer/components/float-area.d.ts +196 -0
  58. package/dist/types/renderer/components/form-fields.d.ts +94 -0
  59. package/dist/types/renderer/components/form-section.d.ts +118 -0
  60. package/dist/types/renderer/components/google-map-embed.d.ts +88 -0
  61. package/dist/types/renderer/components/heading.d.ts +119 -0
  62. package/dist/types/renderer/components/image-uploader.d.ts +271 -0
  63. package/dist/types/renderer/components/index.d.ts +48 -0
  64. package/dist/types/renderer/components/information-panel.d.ts +139 -0
  65. package/dist/types/renderer/components/input.d.ts +222 -0
  66. package/dist/types/renderer/components/layout.d.ts +71 -0
  67. package/dist/types/renderer/components/line-clamp.d.ts +170 -0
  68. package/dist/types/renderer/components/loader.d.ts +104 -0
  69. package/dist/types/renderer/components/notification-bar.d.ts +251 -0
  70. package/dist/types/renderer/components/pagination.d.ts +167 -0
  71. package/dist/types/renderer/components/photo-manager-renderer.d.ts +9 -0
  72. package/dist/types/renderer/components/radio-button-panel.d.ts +152 -0
  73. package/dist/types/renderer/components/radio.d.ts +117 -0
  74. package/dist/types/renderer/components/repeater.d.ts +116 -0
  75. package/dist/types/renderer/components/response-message.d.ts +180 -0
  76. package/dist/types/renderer/components/search-input.d.ts +198 -0
  77. package/dist/types/renderer/components/section-nav.d.ts +151 -0
  78. package/dist/types/renderer/components/segmented-control.d.ts +143 -0
  79. package/dist/types/renderer/components/select.d.ts +98 -0
  80. package/dist/types/renderer/components/status-label.d.ts +146 -0
  81. package/dist/types/renderer/components/stepper.d.ts +123 -0
  82. package/dist/types/renderer/components/tabs.d.ts +185 -0
  83. package/dist/types/renderer/components/textarea.d.ts +173 -0
  84. package/dist/types/renderer/components/timeline.d.ts +146 -0
  85. package/dist/types/renderer/components/toggle.d.ts +109 -0
  86. package/dist/types/renderer/components/tooltip.d.ts +158 -0
  87. package/dist/types/renderer/components/wizard.d.ts +118 -0
  88. package/dist/types/renderer/layouts/index.d.ts +5 -0
  89. package/dist/types/renderer/layouts/shell.d.ts +7 -0
  90. package/dist/types/renderer/layouts/types.d.ts +34 -0
  91. package/dist/types/renderer/screen-renderer.d.ts +57 -0
  92. package/dist/types/renderer/utils/dom.d.ts +29 -0
  93. package/dist/types/renderer/utils/dummy-data.d.ts +13 -0
  94. package/dist/types/renderer/utils/field-helpers.d.ts +90 -0
  95. package/dist/types/renderer/utils/icons.d.ts +13 -0
  96. package/dist/types/renderer/utils/index.d.ts +6 -0
  97. package/dist/types/renderer-v2/actions.d.ts +30 -0
  98. package/dist/types/renderer-v2/app-shell.d.ts +15 -0
  99. package/dist/types/renderer-v2/condition.d.ts +19 -0
  100. package/dist/types/renderer-v2/context.d.ts +37 -0
  101. package/dist/types/renderer-v2/fields/choice.d.ts +12 -0
  102. package/dist/types/renderer-v2/fields/control-label.d.ts +57 -0
  103. package/dist/types/renderer-v2/fields/date.d.ts +6 -0
  104. package/dist/types/renderer-v2/fields/display.d.ts +22 -0
  105. package/dist/types/renderer-v2/fields/file-support.d.ts +15 -0
  106. package/dist/types/renderer-v2/fields/file.d.ts +9 -0
  107. package/dist/types/renderer-v2/fields/index.d.ts +20 -0
  108. package/dist/types/renderer-v2/fields/select.d.ts +17 -0
  109. package/dist/types/renderer-v2/fields/text.d.ts +26 -0
  110. package/dist/types/renderer-v2/fields/textarea.d.ts +5 -0
  111. package/dist/types/renderer-v2/fields/toggle.d.ts +6 -0
  112. package/dist/types/renderer-v2/icons.d.ts +35 -0
  113. package/dist/types/renderer-v2/index.d.ts +45 -0
  114. package/dist/types/renderer-v2/list-cells.d.ts +6 -0
  115. package/dist/types/renderer-v2/list-data.d.ts +53 -0
  116. package/dist/types/renderer-v2/mount-parts.d.ts +19 -0
  117. package/dist/types/renderer-v2/mount-repeat.d.ts +8 -0
  118. package/dist/types/renderer-v2/mount-section.d.ts +10 -0
  119. package/dist/types/renderer-v2/mount-visibility.d.ts +13 -0
  120. package/dist/types/renderer-v2/mount.d.ts +9 -0
  121. package/dist/types/renderer-v2/role.d.ts +15 -0
  122. package/dist/types/renderer-v2/section-fields.d.ts +11 -0
  123. package/dist/types/renderer-v2/section-list.d.ts +8 -0
  124. package/dist/types/renderer-v2/section-readonly.d.ts +8 -0
  125. package/dist/types/renderer-v2/section.d.ts +15 -0
  126. package/dist/types/renderer-v2/styles.d.ts +13 -0
  127. package/dist/types/renderer-v2/util.d.ts +28 -0
  128. package/dist/types/renderer-v2/view-state.d.ts +25 -0
  129. package/dist/types/renderer-v2/view.d.ts +8 -0
  130. package/dist/types/theme/index.d.ts +6 -0
  131. package/dist/types/theme/theme-manager.d.ts +102 -0
  132. package/dist/types/types/field-renderable.d.ts +40 -0
  133. package/dist/types/types/index.d.ts +7 -0
  134. package/dist/types/types/schema-v2.d.ts +270 -0
  135. package/dist/types/types/schema.d.ts +1712 -0
  136. package/dist/types/types/theme.d.ts +111 -0
  137. package/package.json +3 -1
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Layout "shell" — アプリシェル型(管理画面)
3
+ * app_header / app_navi を全幅で最上部に置き、本文は 12 カラムグリッドのカード群にする。
4
+ */
5
+ import type { ScreenLayout } from './types';
6
+ import './shell.css';
7
+ export declare const shellLayout: ScreenLayout;
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Screen Layout — 画面全体の骨格(ヘッダ・セクション・アクションの配置)。layout は shell のみ
3
+ */
4
+ import type { ScreenDefinition, InputField, Action } from '../../types/schema';
5
+ /** セクション1つ分の描画済み部品 */
6
+ export interface RenderedSection {
7
+ id: string;
8
+ title: string;
9
+ icon?: string;
10
+ fieldsHtml: string;
11
+ publishToggleHtml: string;
12
+ }
13
+ /** レイアウト実装が利用できるヘルパー群 */
14
+ export interface LayoutHelpers {
15
+ /** 画面タイトル+説明文 */
16
+ renderScreenHeader(screen: ScreenDefinition): string;
17
+ /** app_header / app_navi のマウント先コンテナ */
18
+ renderAppLayoutContainers(screen: ScreenDefinition): string;
19
+ /** 任意のフィールド配列を描画 */
20
+ renderFields(fields: InputField[]): string;
21
+ /** 任意のアクション配列を描画 */
22
+ renderActions(actions: Action[]): string;
23
+ /** sections を部品に分解したもの(sections が無い画面では空配列) */
24
+ renderSections(screen: ScreenDefinition): RenderedSection[];
25
+ /** セクションIDを生成 */
26
+ generateSectionId(sectionName: string, index: number): string;
27
+ escapeHtml(text: string): string;
28
+ }
29
+ export interface ScreenLayout {
30
+ /** レイアウトID */
31
+ id: string;
32
+ /** 画面全体のHTMLを返す(`.screen` 要素を含むこと) */
33
+ render(screen: ScreenDefinition, helpers: LayoutHelpers): string;
34
+ }
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Screen Renderer
3
+ * 画面全体のレンダリングを担当
4
+ */
5
+ import type { ScreenDefinition } from '../types/schema';
6
+ import { AppHeader } from './components/app-header';
7
+ import { AppNavi } from './components/app-navi';
8
+ /**
9
+ * ウィザード画面をレンダリング
10
+ */
11
+ export declare function renderWizardScreen(screen: ScreenDefinition, currentStepIndex?: number): string;
12
+ /**
13
+ * セクションIDを生成(セクション名から安全なIDを生成)
14
+ */
15
+ export declare function generateSectionId(sectionName: string, index: number): string;
16
+ /**
17
+ * 通常画面をレンダリング(shell レイアウト固定)
18
+ */
19
+ export declare function renderScreen(screen: ScreenDefinition): string;
20
+ /**
21
+ * 画面コントローラーインターフェース
22
+ */
23
+ export interface ScreenController {
24
+ /** AppHeaderインスタンス(存在する場合) */
25
+ appHeader?: AppHeader;
26
+ /** AppNaviインスタンス(存在する場合) */
27
+ appNavi?: AppNavi;
28
+ /** 全コンポーネントを破棄 */
29
+ destroy: () => void;
30
+ }
31
+ /**
32
+ * 画面をDOMにマウント
33
+ */
34
+ export declare function mountScreen(container: HTMLElement, screen: ScreenDefinition): ScreenController;
35
+ /**
36
+ * AppHeader / AppNavi のみをマウントする(renderScreen の文字列出力を使う呼び出し側用)
37
+ */
38
+ export interface AppChromeController {
39
+ appHeader?: AppHeader;
40
+ appNavi?: AppNavi;
41
+ destroy: () => void;
42
+ }
43
+ export declare function mountAppChrome(container: HTMLElement, screen: ScreenDefinition): AppChromeController;
44
+ /**
45
+ * ウィザード画面をDOMにマウント(ステップ管理付き)
46
+ */
47
+ export declare function mountWizardScreen(container: HTMLElement, screen: ScreenDefinition, initialStep?: number): WizardController;
48
+ /**
49
+ * ウィザードコントローラーインターフェース
50
+ */
51
+ export interface WizardController {
52
+ getCurrentStep: () => number;
53
+ destroy: () => void;
54
+ goToStep: (step: number) => void;
55
+ nextStep: () => void;
56
+ prevStep: () => void;
57
+ }
@@ -0,0 +1,29 @@
1
+ /**
2
+ * DOM Utilities
3
+ * DOM操作のユーティリティ関数
4
+ */
5
+ /**
6
+ * 要素を作成する
7
+ */
8
+ export declare function createElement<K extends keyof HTMLElementTagNameMap>(tag: K, options?: {
9
+ className?: string;
10
+ attributes?: Record<string, string>;
11
+ textContent?: string;
12
+ children?: (HTMLElement | string)[];
13
+ }): HTMLElementTagNameMap[K];
14
+ /**
15
+ * 要素をクリアする
16
+ */
17
+ export declare function clearElement(element: HTMLElement): void;
18
+ /**
19
+ * 一意なIDを生成する
20
+ */
21
+ export declare function generateId(prefix?: string): string;
22
+ /**
23
+ * HTMLテキストをエスケープする
24
+ */
25
+ export declare function escapeHtml(text: string): string;
26
+ /**
27
+ * タブIDを検証・サニタイズする
28
+ */
29
+ export declare function sanitizeTabId(id: string): string;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Dummy Data Generator
3
+ * リピーター用のダミーデータ自動生成
4
+ */
5
+ import type { InputField } from '../../types';
6
+ /**
7
+ * フィールドタイプに応じたダミーデータを生成
8
+ */
9
+ export declare function generateDummyData(field: InputField, index?: number): unknown;
10
+ /**
11
+ * リピーターアイテム用のダミーデータセットを生成
12
+ */
13
+ export declare function generateRepeaterItemDummyData(itemFields: InputField[], itemIndex: number): Record<string, unknown>;
@@ -0,0 +1,90 @@
1
+ /**
2
+ * Field Helper Utilities
3
+ * フォームフィールドレンダリング用の共有ヘルパー関数
4
+ */
5
+ import type { InputField, SelectOption } from '../../types/schema';
6
+ /**
7
+ * HTML特殊文字をエスケープ
8
+ *
9
+ * @param text - エスケープする文字列
10
+ * @returns エスケープされた文字列
11
+ */
12
+ export declare function escapeHtml(text: string): string;
13
+ /**
14
+ * SSR対応のHTMLエスケープ
15
+ * document が利用できない環境でも動作する
16
+ *
17
+ * @param text - エスケープする文字列
18
+ * @returns エスケープされた文字列
19
+ */
20
+ export declare function escapeHtmlSafe(text: string): string;
21
+ /**
22
+ * radio/checkbox グループの方向を決める。direction 指定があれば優先。
23
+ * 未指定なら 選択肢4個以下かつ全ラベル8文字以下(説明文なし)で horizontal。
24
+ */
25
+ export declare function resolveGroupDirection(direction: 'horizontal' | 'vertical' | undefined, options: Array<{
26
+ label: string;
27
+ description?: string;
28
+ }>): 'horizontal' | 'vertical';
29
+ /** 入力欄ではないが見出しとしてラベルだけ残すタイプ(description は出さない) */
30
+ export declare const HEADING_LABEL_TYPES: Set<string>;
31
+ /**
32
+ * フィールドのラッパーHTML生成
33
+ *
34
+ * @param field - 入力フィールド定義
35
+ * @param content - フィールドのコンテンツHTML
36
+ * @returns ラッパー付きのHTML文字列
37
+ */
38
+ export declare function createFieldWrapper(field: InputField, content: string): string;
39
+ /**
40
+ * 共通属性を生成
41
+ *
42
+ * @param field - 入力フィールド定義
43
+ * @returns 属性文字列
44
+ */
45
+ export declare function getCommonAttributes(field: InputField): string;
46
+ /**
47
+ * 選択肢の配列を取得(文字列参照は未対応)
48
+ *
49
+ * @param options - 選択肢配列または参照文字列
50
+ * @returns 選択肢の配列
51
+ */
52
+ export declare function getOptions(options: SelectOption[] | string): SelectOption[];
53
+ /**
54
+ * ファイルサイズをフォーマット
55
+ *
56
+ * @param bytes - バイト数
57
+ * @returns フォーマットされたサイズ文字列
58
+ */
59
+ export declare function formatFileSize(bytes: number): string;
60
+ /**
61
+ * MIMEタイプから表示名を取得
62
+ *
63
+ * @param mimeType - MIMEタイプ文字列
64
+ * @returns 表示用のフォーマット名
65
+ */
66
+ export declare function formatMimeType(mimeType: string): string;
67
+ /**
68
+ * レベルに基づくデフォルトサイズを取得
69
+ *
70
+ * @param level - 見出しレベル (1-6)
71
+ * @returns サイズバリアント
72
+ */
73
+ export declare function getDefaultSizeForLevel(level: 1 | 2 | 3 | 4 | 5 | 6): 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
74
+ /**
75
+ * 単位ラベルのマッピング
76
+ */
77
+ export declare const unitLabels: Record<string, string>;
78
+ /**
79
+ * ユーザー指定の class 値を検証して返す(英数字・_・-・空白のみ許可)
80
+ * 不正な値は undefined を返し、呼び出し側は無視する。
81
+ */
82
+ export declare function safeClassName(value: unknown): string | undefined;
83
+ /**
84
+ * 数値属性を生成する。有限な数値でない場合は空文字(属性なし)を返す。
85
+ */
86
+ export declare function numAttr(name: string, value: unknown): string;
87
+ /**
88
+ * 識別子(クラス名の一部や data 属性値)として使えるトークンだけを通す
89
+ */
90
+ export declare function safeToken(value: unknown, fallback: string): string;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * アイコン名 → 絵文字/Unicode記号 のマップ
3
+ * YAML の `icon: "refresh"` のような名前指定を、文字列のまま表示せずに記号へ変換する。
4
+ */
5
+ /**
6
+ * アイコン名を記号に変換する。未知の名前は空文字(文字列そのものは表示しない)。
7
+ * 既に絵文字などの非ASCII文字列が直接指定されている場合はそのまま返す。
8
+ */
9
+ export declare function resolveIcon(name: string | undefined | null): string;
10
+ /**
11
+ * アイコン用の <span> HTML を生成(未知の名前は空文字)
12
+ */
13
+ export declare function renderIconHtml(name: string | undefined | null, className: string): string;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Utility Functions Export
3
+ */
4
+ export { createElement, clearElement, generateId } from './dom';
5
+ export { generateDummyData, generateRepeaterItemDummyData } from './dummy-data';
6
+ export { escapeHtml, escapeHtmlSafe, createFieldWrapper, getCommonAttributes, getOptions, formatFileSize, formatMimeType, getDefaultSizeForLevel, unitLabels, } from './field-helpers';
@@ -0,0 +1,30 @@
1
+ /**
2
+ * アクションボタンと確認ダイアログ(modal-dialog)
3
+ * primaryAction: solid-fill lg / secondary: outline md / tertiary: text md / danger: --button-color を error 色に(mokkun-v2.css の .mk2-button--danger)
4
+ * 並び順(DADS): tertiary が左端、secondary、primary が右端。DOM の順序をそのまま見た目にする(CSS で並べ替えない)
5
+ */
6
+ import type { ActionPlacementV2, ActionV2, ListV2, SectionV2 } from '../types/schema-v2';
7
+ import { type ViewContext } from './context';
8
+ export interface PlacedAction {
9
+ action: ActionV2;
10
+ primary: boolean;
11
+ placement: ActionPlacementV2;
12
+ }
13
+ /** Section.actions(見出し行の操作)。現在のロールで表示するもの */
14
+ export declare function sectionActions(section: SectionV2, ctx: ViewContext): ActionV2[];
15
+ /** list.bulkActions(選択した行への操作)。現在のロールで表示するもの */
16
+ export declare function bulkActions(list: ListV2, ctx: ViewContext): ActionV2[];
17
+ /** 画面のアクションを配置先つきで列挙する。primary が先頭。placement 未指定の secondary は primary に揃える。現在のロールで表示するものだけ */
18
+ export declare function collectActions(ctx: ViewContext): PlacedAction[];
19
+ export declare function dialogId(ctx: ViewContext, action: ActionV2): string;
20
+ /**
21
+ * 操作ボタン 1 つ。Section 内の操作(primary ではない)は extra で data-section / data-bulk を付ける。
22
+ * type: solid-fill は primary、text は tertiary、outline はそれ以外
23
+ */
24
+ export declare function renderActionButton(ctx: ViewContext, action: ActionV2, type: 'solid-fill' | 'outline' | 'text', size: 'lg' | 'md', extra?: Record<string, string | boolean | undefined>): string;
25
+ /** Section の操作(見出し行)。tertiary はテキスト、それ以外は outline md */
26
+ export declare function renderSectionButton(ctx: ViewContext, action: ActionV2, sectionId: string): string;
27
+ /** 指定した配置のアクション群。無ければ空文字 */
28
+ export declare function renderActions(ctx: ViewContext, placement: ActionPlacementV2): string;
29
+ /** action.confirm を持つアクションごとの <dialog>。静的 HTML に含め、mount 時にボタンから開く */
30
+ export declare function renderDialogs(ctx: ViewContext): string;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * App 層: ヘッダー、グローバルナビ、パンくず、通知
3
+ */
4
+ import type { NoticeVariantV2 } from '../types/schema-v2';
5
+ import type { ViewContext } from './context';
6
+ /** notification-banner(app.notifications / view.states 共通) */
7
+ export declare function renderBanner(id: string, variant: NoticeVariantV2, message: string, dismissible?: boolean): string;
8
+ /** 共通通知。現在のロールに向けたもので、掲示期限(until)が今日より前でないものだけ。id は定義順の通し番号 */
9
+ export declare function renderNotifications(ctx: ViewContext): string;
10
+ /** グローバルナビ: group が 1 項目ならリンク、複数ならサブメニューボタン + menu-list。現在地は aria-current="page" */
11
+ export declare function renderGlobalNav(ctx: ViewContext): string;
12
+ /** ヘッダー: 左にシステム名とアプリ名、右に利用者名とテナント名(utility-link) */
13
+ export declare function renderHeader(ctx: ViewContext): string;
14
+ /** パンくず: アプリ名 › グループ › 画面タイトル */
15
+ export declare function renderBreadcrumb(ctx: ViewContext): string;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * 条件(visibleWhen / requiredWhen)の評価。静的描画(既定値)と mount 後(DOM の現在値)で共有する。
3
+ *
4
+ * 比較の対象は「項目の現在値のトークン」: 単一値は文字列、複数選択は選択値の配列、
5
+ * 真偽値系(checkbox / toggle)は 'true' / 'false'、date は `y-m-d`(precision: month は `y-m`)。
6
+ */
7
+ import type { ConditionV2 } from '../types/schema-v2';
8
+ export type Token = string | string[];
9
+ /** data 属性に載せる条件(JSON)。equals / notEquals / in のうち書かれたものだけ */
10
+ export declare function serializeCondition(cond: ConditionV2): string;
11
+ /** 条件を評価する。equals は一致、notEquals は不一致、in は配列のどれかと一致 */
12
+ export declare function matchesCondition(token: Token, cond: ConditionV2): boolean;
13
+ /**
14
+ * date の値のトークン。年・月・日を 0 埋めして `-` でつなぎ、末尾の空の部分は落とす
15
+ * (年月だけなら `2026-11`、全部空なら空文字)。静的描画(既定値)と mount 後(入力欄)で同じ形にするための唯一の組み立て
16
+ */
17
+ export declare function dateToken(year: string, month: string, day: string): string;
18
+ /** 値の文字列(YYYY-MM-DD / YYYY-MM)から date のトークンを作る。precision: month は日を無視する。解釈できない値はそのまま */
19
+ export declare function dateTokenOf(text: string, precision: 'day' | 'month' | undefined): string;
@@ -0,0 +1,37 @@
1
+ /**
2
+ * v2 レンダラー内部で共有する描画文脈
3
+ */
4
+ import type { ConditionV2, FieldV2, FlowV2, MokkunV2Schema, ViewV2 } from '../types/schema-v2';
5
+ /** view の状態(ビューアーの「状態」切替)。normal は状態バナーなし */
6
+ export type V2ViewState = 'normal' | 'success' | 'error' | 'empty' | 'loading';
7
+ export declare const V2_VIEW_STATES: readonly V2ViewState[];
8
+ /** 描画オプション */
9
+ export interface V2RenderOptions {
10
+ /** 表示する状態。既定 normal(状態バナーを出さない) */
11
+ state?: V2ViewState;
12
+ /** 現在のロール(app.roles の値)。未指定は全ロール分を表示する */
13
+ role?: string;
14
+ /** 通知の期限(Notice.until)判定に使う今日。既定は実行時の日付(テスト用) */
15
+ today?: Date | string;
16
+ }
17
+ export interface ViewContext {
18
+ schema: MokkunV2Schema;
19
+ viewName: string;
20
+ view: ViewV2;
21
+ /** 展開後の項目 id → 項目定義(visibleWhen の初期評価用) */
22
+ fields: Map<string, FieldV2>;
23
+ state: V2ViewState;
24
+ role: string | undefined;
25
+ /** 今日(YYYY-MM-DD) */
26
+ today: string;
27
+ }
28
+ export declare function createContext(schema: MokkunV2Schema, viewName: string, options?: V2RenderOptions): ViewContext | undefined;
29
+ /** DOM id は view 名で前置して、ページ内で一意にする */
30
+ export declare function domId(ctx: ViewContext, ...parts: Array<string | number>): string;
31
+ /** 条件を既定値で評価する(条件がなければ true)。参照先が無ければ false */
32
+ export declare function isInitiallyVisible(cond: ConditionV2 | undefined, ctx: ViewContext): boolean;
33
+ /** view を含み、手順ナビを出す flow(progress: none は除く) */
34
+ export declare function findFlow(schema: MokkunV2Schema, viewName: string): {
35
+ flow: FlowV2;
36
+ index: number;
37
+ } | undefined;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * radio / checkbox の fieldset と、それを使う select の変種
3
+ * - radio: radio の fieldset
4
+ * - checkbox: checkbox 1 つ / multiple は checkbox の fieldset
5
+ * - select multiple: checkbox の fieldset(DADS の指針: 複数選択はチェックボックス)
6
+ * - select segmented: radio の横並び fieldset
7
+ */
8
+ import { type Ctl } from './control-label';
9
+ export declare function renderRadio(c: Ctl, inline?: boolean): string;
10
+ export declare function renderCheckboxGroup(c: Ctl): string;
11
+ /** 単一チェックボックス: ラベルはチェックボックス自身(必須表示も同じ行に) */
12
+ export declare function renderCheckbox(c: Ctl): string;
@@ -0,0 +1,57 @@
1
+ /**
2
+ * form-control-label(DADS)でのラップ
3
+ * 単一コントロールは <label for>、複数コントロール(グループ)は <fieldset> + <legend>。
4
+ * サポートテキスト・エラーテキストは aria-describedby で関連付ける。
5
+ */
6
+ import type { FieldV2 } from '../../types/schema-v2';
7
+ /** 1 項目の描画入力(DOM id / name は呼び出し側で繰り返しグループの添字まで解決済み) */
8
+ export interface FieldOpts {
9
+ /** コントロールの DOM id(view 名で前置済み) */
10
+ domId: string;
11
+ /** フォーム送信名 */
12
+ name: string;
13
+ /** 初期表示で非表示にするか(visibleWhen を既定値で評価した結果) */
14
+ hidden?: boolean;
15
+ /**
16
+ * props.error(項目のエラー文)を描くか。既定 true(単体で呼ぶとき)。View の描画では状態が error のときだけ true
17
+ * (通常の状態ではエラーを出さない)
18
+ */
19
+ showError?: boolean;
20
+ /** 初期表示で必須か(requiredWhen を既定値で評価した結果)。省略は field.required */
21
+ required?: boolean;
22
+ }
23
+ /** コントロール描画用の文脈 */
24
+ export interface Ctl {
25
+ f: FieldV2;
26
+ domId: string;
27
+ name: string;
28
+ hidden: boolean;
29
+ /** 必須として扱うか(requiredWhen のときは条件の評価結果。mount 後は DOM が追随する) */
30
+ required: boolean;
31
+ supportId?: string;
32
+ errorId?: string;
33
+ error?: string;
34
+ /** aria-describedby に入れる id 列(エラー → サポートの順) */
35
+ describedBy?: string;
36
+ /** 初期値 */
37
+ value: unknown;
38
+ }
39
+ export declare function makeCtl(f: FieldV2, o: FieldOpts): Ctl;
40
+ /** サポートテキストの行(help / ファイル形式と容量 / whyRequired / format / example)。placeholder は使わない */
41
+ export declare function supportLines(f: FieldV2): string[];
42
+ /** aria-invalid / aria-describedby の共通属性 */
43
+ export declare function ariaAttrs(c: Ctl): string;
44
+ /** form-control-label 共通のエラー(各コントロールが専用のエラーテキストを持たない場合) */
45
+ export declare function groupError(c: Ctl): string;
46
+ /** 単一コントロール: <div> + <label for> */
47
+ export declare function wrapSingle(c: Ctl, control: string): string;
48
+ /** グループ: <fieldset> + <legend>。aria-describedby は fieldset に付ける */
49
+ export declare function wrapGroup(c: Ctl, control: string, extra?: Record<string, string | boolean | undefined>, opts?: {
50
+ skipError?: boolean;
51
+ }): string;
52
+ /** ラベルを持たない表示用コントロール(チップ・タイムライン等)用のラップ */
53
+ export declare function wrapDisplay(c: Ctl, control: string): string;
54
+ /** 単一チェックボックス用: ラベルはチェックボックス自身が持つ(必須表示はその中に入れる) */
55
+ export declare function wrapInline(c: Ctl, control: string): string;
56
+ /** 必須/任意の表示(単一チェックボックスのラベル内で使う) */
57
+ export declare function requirementHtml(c: Ctl): string;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * date → date-picker(consolidated)/ inline のときは calendar
3
+ * DADS の date-picker は 年・月・日 の 3 入力。カレンダーのポップオーバーは JS が必要なため出さない。
4
+ */
5
+ import { type Ctl } from './control-label';
6
+ export declare function renderDate(c: Ctl): string;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * 表示系: badge / chip / status → chip-label、timeline → list、map → image 枠
3
+ */
4
+ import type { FieldV2 } from '../../types/schema-v2';
5
+ import { type Ctl } from './control-label';
6
+ /** badge / chip / status。値があれば項目名 + チップ、無ければチップのみ(ラベルを二重に出さない) */
7
+ export declare function renderChip(c: Ctl): string;
8
+ export interface TimelineRow {
9
+ time: string;
10
+ title: string;
11
+ description?: string;
12
+ }
13
+ /**
14
+ * timeline の行。value({ at, label, text? }[])を優先し、なければ props.items({ time, title, description? }[])
15
+ */
16
+ export declare function timelineRows(f: FieldV2): TimelineRow[];
17
+ /** 日時・ラベル・本文の順序なしリスト。readonly の値としても使う */
18
+ export declare function timelineList(f: FieldV2, labelledBy?: string): string;
19
+ /** timeline(value の { at, label, text? }[]、または props.items) */
20
+ export declare function renderTimeline(c: Ctl): string;
21
+ /** 地図は image の枠に「地図」プレースホルダー */
22
+ export declare function renderMap(c: Ctl): string;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * file の accept / multiple / maxSize と、サポートテキストへの自動追記
3
+ */
4
+ import type { FieldV2 } from '../../types/schema-v2';
5
+ /** `<input accept>` の値 */
6
+ export declare function acceptAttr(accept: FieldV2['accept']): string | undefined;
7
+ /** 形式名(「PDF・JPEG・PNG」の形) */
8
+ export declare function acceptLabel(accept: FieldV2['accept']): string | undefined;
9
+ /** 複数選択か(first-class の multiple。props.multiple も受け付ける) */
10
+ export declare function isMultiple(f: FieldV2): boolean;
11
+ /**
12
+ * サポートテキストに自動で足す「形式: …/1ファイル 10MB まで」。
13
+ * help が形式名・容量をすでに書いているときは、その部分を足さない(重複させない)。
14
+ */
15
+ export declare function fileSupportLine(f: FieldV2): string | undefined;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * file → file-upload / photo_grid → file-upload + 画像グリッド
3
+ * DADS の file-upload は JS(カスタム要素)で一覧を更新する。選択ボタンと一覧更新は mount.ts で行う。
4
+ */
5
+ import { type Ctl } from './control-label';
6
+ /** file-upload は label が for で input を指す。ボタンのラベル参照用に label へ id を付ける */
7
+ export declare function renderFile(c: Ctl): string;
8
+ /** 画像グリッド(props.photos: [{ src, alt }])+ 追加用 file-upload */
9
+ export declare function renderPhotoGrid(c: Ctl): string;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Field 層: component(と条件)から DADS 部品への振り分け
3
+ *
4
+ * | component | 条件 | DADS 部品 |
5
+ * |---|---|---|
6
+ * | text / number / time / duration / combobox | | input-text |
7
+ * | textarea | | textarea |
8
+ * | date | | date-picker(inline は calendar)|
9
+ * | file / photo_grid | | file-upload |
10
+ * | select | | select(multiple は checkbox、segmented は radio)|
11
+ * | radio / checkbox / toggle | | radio / checkbox / switch |
12
+ * | browser | | select(階層は optgroup)|
13
+ * | badge / chip / status | | chip-label |
14
+ * | timeline / map | | list / image |
15
+ */
16
+ import type { FieldV2 } from '../../types/schema-v2';
17
+ import { type FieldOpts } from './control-label';
18
+ export type { FieldOpts } from './control-label';
19
+ /** 1 項目を form-control-label でラップした HTML にする */
20
+ export declare function renderFieldV2(field: FieldV2, opts: FieldOpts): string;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * select / browser(階層は optgroup)と、select の変種の振り分け
3
+ */
4
+ import type { OptionV2 } from '../../types/schema-v2';
5
+ import { type Ctl } from './control-label';
6
+ interface BrowserItem {
7
+ value: string;
8
+ label: string;
9
+ children?: BrowserItem[];
10
+ }
11
+ export declare function option(o: OptionV2 | BrowserItem, current: string): string;
12
+ /** select 1 つ(form-control-label の外側)。一覧セルの入力欄からも使う */
13
+ export declare function selectControl(c: Ctl, body: string, ariaLabel?: string): string;
14
+ export declare function renderSelect(c: Ctl): string;
15
+ /** 階層を持つ項目は optgroup、持たない項目は option(props.items は { value, label, children? }) */
16
+ export declare function renderBrowser(c: Ctl): string;
17
+ export {};
@@ -0,0 +1,26 @@
1
+ /**
2
+ * input-text 系: text / number / time / duration / combobox
3
+ */
4
+ import { type Ctl } from './control-label';
5
+ interface InputOpts {
6
+ type: string;
7
+ inputmode?: string;
8
+ list?: string;
9
+ min?: number;
10
+ max?: number;
11
+ step?: number;
12
+ /** 入力欄の後ろに付ける単位(同じ control の中) */
13
+ unit?: string;
14
+ /** ラベルを持たない場所(一覧セル)で使う aria-label */
15
+ ariaLabel?: string;
16
+ }
17
+ /** input-text 1 つ(form-control-label の外側)。一覧セルの入力欄からも使う */
18
+ export declare function inputText(c: Ctl, o: InputOpts): string;
19
+ export declare function renderText(c: Ctl): string;
20
+ export declare function renderNumber(c: Ctl): string;
21
+ export declare function renderTime(c: Ctl): string;
22
+ /** 数値入力 + 単位(unit、なければ props.unit、既定「分」) */
23
+ export declare function renderDuration(c: Ctl): string;
24
+ /** input-text + datalist(候補は options のラベル) */
25
+ export declare function renderCombobox(c: Ctl): string;
26
+ export {};
@@ -0,0 +1,5 @@
1
+ /**
2
+ * textarea
3
+ */
4
+ import { type Ctl } from './control-label';
5
+ export declare function renderTextarea(c: Ctl): string;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * toggle → switch(on-off)
3
+ * DADS の switch は JS で aria-checked を切り替える。クリック処理は mount.ts で行う。
4
+ */
5
+ import { type Ctl } from './control-label';
6
+ export declare function renderToggle(c: Ctl): string;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * DADS が使う SVG アイコン
3
+ * 取得元: design-system-example-components-html の各コンポーネント HTML(dads/NOTICE.md 参照)
4
+ */
5
+ /** select / horizontal-menu の下向きシェブロン */
6
+ export declare const chevronDown: (cls: string) => string;
7
+ export declare const breadcrumbSeparator = "<svg class=\"dads-breadcrumb__separator-icon\" width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" aria-hidden=\"true\"><path d=\"M4.5 11L4 10.5L8 6.5L4 2.5L4.5 2L9 6.5L4.5 11Z\" fill=\"currentcolor\" /></svg>";
8
+ export declare const accordionChevron = "<svg class=\"dads-accordion__icon-svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M3.3 7.3L12 16L20.7 7.3\" fill=\"none\" stroke=\"currentcolor\" stroke-width=\"2\"/></svg>";
9
+ export declare const closeIcon = "<svg class=\"dads-notification-banner__close-icon\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"m6.4 18.6-1-1 5.5-5.6-5.6-5.6 1.1-1 5.6 5.5 5.6-5.6 1 1.1L13 12l5.6 5.6-1 1L12 13l-5.6 5.6Z\" fill=\"currentcolor\"/></svg>";
10
+ export declare const modalCloseIcon = "<svg class=\"dads-modal-dialog__close-icon\" width=\"24\" height=\"24\" viewBox=\"0 0 120 120\" aria-hidden=\"true\"><path d=\"M32 95L25 88L53 60L25 32L32 25L60 53L88 25L95 32L67 60L95 88L88 95L60 67L32 95Z\" fill=\"currentcolor\"/></svg>";
11
+ /** notification-banner の種別アイコン */
12
+ export declare const bannerIcons: {
13
+ readonly 'info-1': "<svg class=\"dads-notification-banner__icon\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" role=\"img\" aria-label=\"インフォメーション\"><circle cx=\"12\" cy=\"12\" r=\"10\" fill=\"currentcolor\"/><circle cx=\"12\" cy=\"8\" r=\"1\" fill=\"Canvas\"/><path d=\"M11 11h2v6h-2z\" fill=\"Canvas\"/></svg>";
14
+ readonly success: "<svg class=\"dads-notification-banner__icon\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" role=\"img\" aria-label=\"成功\"><circle cx=\"12\" cy=\"12\" r=\"10\" fill=\"currentcolor\"/><path d=\"m17.6 9.6-7 7-4.3-4.3L7.7 11l2.9 2.9 5.7-5.6 1.3 1.4Z\" fill=\"Canvas\"/></svg>";
15
+ readonly warning: "<svg class=\"dads-notification-banner__icon\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" role=\"img\" aria-label=\"警告\"><path d=\"M1 21 12 2l11 19H1Z\" fill=\"currentcolor\"/><path d=\"M13 15h-2v-5h2v5Z\" fill=\"Canvas\"/><circle cx=\"12\" cy=\"17\" r=\"1\" fill=\"Canvas\"/></svg>";
16
+ readonly error: "<svg class=\"dads-notification-banner__icon\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" role=\"img\" aria-label=\"エラー\"><path d=\"M8.25 21 3 15.75v-7.5L8.25 3h7.5L21 8.25v7.5L15.75 21h-7.5Z\" fill=\"currentcolor\"/><path d=\"m12 13.4-2.85 2.85-1.4-1.4L10.6 12 7.75 9.15l1.4-1.4L12 10.6l2.85-2.85 1.4 1.4L13.4 12l2.85 2.85-1.4 1.4L12 13.4Z\" fill=\"Canvas\"/></svg>";
17
+ };
18
+ /** step-navigation の完了アイコン(DADS 原文のまま) */
19
+ export declare const stepCompleted = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" aria-hidden=\"true\"><circle cx=\"12\" cy=\"12\" r=\"12\" fill=\"#666\"/><path d=\"M10 17.5 19.8 8l-1.5-1.5-8.1 8-4.1-4L4.5 12l5.6 5.5Z\" fill=\"#fff\"/></svg>";
20
+ export declare const pageNavPrev = "<svg class=\"dads-button__icon\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"m7.9 12 8-8-1.4-1.4L5.1 12l9.4 9.4 1.4-1.4z\" fill=\"currentcolor\"/></svg>";
21
+ export declare const pageNavNext = "<svg class=\"dads-button__icon\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M9 2.6 7.6 4l8 8-8 8L9 21.4l9.4-9.4z\" fill=\"currentcolor\"/></svg>";
22
+ /** table の並べ替えアイコン(none / ascending / descending) */
23
+ export declare const sortIcons: {
24
+ readonly none: "M17 18.11L21.27 14L22 14.7L16.5 20L11 14.7L11.73 14L16 18.12V4H17V18.12ZM8 5.88L12.27 10L13 9.3L7.5 4L2 9.3L2.73 10L7 5.88V20H8V5.88Z";
25
+ readonly ascending: "M17 18.12L21.27 14L22 14.7L16.5 20L11 14.7L11.73 14L16 18.12V4H17V18.12ZM14 8.92L11.73 11L9 8.52V20H6V8.52L3.27 11L1 8.93L7.5 3L14 8.93Z";
26
+ readonly descending: "M7 5.88L2.73 10L2 9.3L7.5 4L13 9.3L12.27 10L8 5.88V20H7V5.88ZM10 15.08L12.27 13L15 15.48V4H18V15.48L20.73 13L23 15.07L16.5 21L10 15.07Z";
27
+ };
28
+ export declare const sortSvg: (path: string) => string;
29
+ export declare const calendarPrev = "<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" role=\"img\" aria-label=\"\u524D\u306E\u6708\"><path d=\"m5.27 8 5.33-5.33-.93-.94L3.4 8l6.27 6.27.93-.94L5.27 8Z\" fill=\"currentcolor\" /></svg>";
30
+ export declare const calendarNext = "<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" role=\"img\" aria-label=\"\u6B21\u306E\u6708\"><path d=\"m6 1.73-.93.94L10.4 8l-5.33 5.33.93.94L12.27 8 6 1.73Z\" fill=\"currentcolor\" /></svg>";
31
+ export declare const switchCheck = "<svg class=\"dads-switch-on-off__icon\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" aria-hidden=\"true\"><path d=\"m10.4 16.3-4.1-4.1 1.2-1.3 2.9 2.9 6-6.1 1.3 1.2z\" fill=\"currentcolor\"/></svg>";
32
+ export declare const disclosureIcon = "<svg class=\"dads-disclosure__icon\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" aria-hidden=\"true\"><circle cx=\"12\" cy=\"12\" r=\"11\" fill=\"currentcolor\"/><circle class=\"dads-disclosure__icon-circle\" cx=\"12\" cy=\"12\" r=\"8\" fill=\"currentcolor\"/><path class=\"dads-disclosure__icon-triangle\" d=\"M17 10H7L12 15L17 10Z\" fill=\"Canvas\"/></svg>";
33
+ export declare const calendarButtonIcon = "<svg class=\"dads-date-picker__calendar-icon\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" role=\"img\" aria-label=\"\u30AB\u30EC\u30F3\u30C0\u30FC\"><rect x=\"5\" y=\"10\" width=\"14\" height=\"10\" fill=\"Canvas\"/><path d=\"M9 16.5C7.62 16.5 6.5 15.38 6.5 14C6.5 12.62 7.62 11.5 9 11.5C10.38 11.5 11.5 12.62 11.5 14C11.5 15.38 10.38 16.5 9 16.5ZM5 22C3.9 22 3 21.09 3 20V6C3 4.91 3.91 4 5 4H6V2H8V4H16V2H18V4H19C20.09 4 21 4.91 21 6V20C21 21.09 20.09 22 19 22H5ZM5 20H19V10H5V20Z\" fill=\"currentcolor\"/></svg><svg class=\"dads-date-picker__calendar-chevron\" viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M12 17.1L3 8L4 7L12 15L20 7L21 8L12 17.1Z\" fill=\"currentcolor\" /></svg>";
34
+ /** 新規タブで開くリンクのアイコン(上流 link/new-tab.html) */
35
+ export declare const externalIcon = "<svg class=\"dads-link__icon\" width=\"16\" height=\"16\" viewBox=\"0 0 48 48\" role=\"img\" aria-label=\"\u65B0\u898F\u30BF\u30D6\u3067\u958B\u304D\u307E\u3059\"><path d=\"M22 6V9H9V39H39V26H42V42H6V6H22ZM42 6V20H39V11.2L21 29L19 27L36.8 9H28V6H42Z\" fill=\"currentcolor\"/></svg>";