@beehexa/design-rules 2611.5.4 → 2611.6.1

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 (190) hide show
  1. package/README.md +1 -1
  2. package/dist/catalog.json +908 -208
  3. package/dist/docs/public/_redirects +2 -2
  4. package/dist/docs/scripts/color-pairs.mjs +4 -0
  5. package/dist/docs/src/components/ChildPages.astro +8 -1
  6. package/dist/docs/src/components/ColorDemo.astro +12 -9
  7. package/dist/docs/src/components/DocsFooter.astro +1 -1
  8. package/dist/docs/src/components/HelpOptions.astro +8 -6
  9. package/dist/docs/src/components/IconBrowser.astro +2 -2
  10. package/dist/docs/src/components/LayoutDemo.astro +178 -99
  11. package/dist/docs/src/components/NativeControlsDemo.astro +165 -40
  12. package/dist/docs/src/components/NativeFlowDemo.astro +206 -0
  13. package/dist/docs/src/components/PhaseTable.astro +9 -5
  14. package/dist/docs/src/components/RoleGuides.astro +30 -22
  15. package/dist/docs/src/components/RuleDemo.astro +111 -0
  16. package/dist/docs/src/components/ShapeDemo.astro +24 -36
  17. package/dist/docs/src/components/SiteHeader.astro +1 -1
  18. package/dist/docs/src/components/SpacingDemo.astro +2 -0
  19. package/dist/docs/src/components/SwitchToggle.astro +13 -0
  20. package/dist/docs/src/components/SystemAreas.astro +9 -6
  21. package/dist/docs/src/components/TableOfContents.astro +1 -1
  22. package/dist/docs/src/components/TokenSearch.astro +64 -0
  23. package/dist/docs/src/components/TokenTable.astro +14 -9
  24. package/dist/docs/src/components/TypeDemo.astro +1 -1
  25. package/dist/docs/src/components/logos/LogoClearSpace.astro +1 -1
  26. package/dist/docs/src/content/components/button/accessibility.mdx +3 -3
  27. package/dist/docs/src/content/components/button/changelog.mdx +1 -1
  28. package/dist/docs/src/content/components/button/examples.mdx +10 -23
  29. package/dist/docs/src/content/components/button/meta.json +5 -1
  30. package/dist/docs/src/content/components/button/usage.mdx +13 -26
  31. package/dist/docs/src/content/components/resizable-panel/meta.json +5 -1
  32. package/dist/docs/src/content/{foundations/styles/scrollbars.mdx → components/scrollbar/code.mdx} +20 -39
  33. package/dist/docs/src/content/components/scrollbar/meta.json +9 -0
  34. package/dist/docs/src/content/components/scrollbar/usage.mdx +36 -0
  35. package/dist/docs/src/content/components/switch/accessibility.mdx +28 -0
  36. package/dist/docs/src/content/components/switch/examples.mdx +35 -0
  37. package/dist/docs/src/content/components/switch/meta.json +9 -0
  38. package/dist/docs/src/content/components/switch/usage.mdx +44 -0
  39. package/dist/docs/src/content/foundations/guidelines/accessibility/statement.mdx +4 -2
  40. package/dist/docs/src/content/foundations/guidelines/accessibility/testing.mdx +1 -1
  41. package/dist/docs/src/content/foundations/guidelines/accessibility.mdx +1 -1
  42. package/dist/docs/src/content/foundations/guidelines/content/messages.mdx +67 -0
  43. package/dist/docs/src/content/foundations/guidelines/content/numbers-dates-and-currency.mdx +72 -0
  44. package/dist/docs/src/content/foundations/guidelines/content/style-and-grammar.mdx +92 -0
  45. package/dist/docs/src/content/foundations/guidelines/content/terms.mdx +57 -0
  46. package/dist/docs/src/content/foundations/guidelines/content/voice-and-tone.mdx +48 -0
  47. package/dist/docs/src/content/foundations/guidelines/content.mdx +22 -17
  48. package/dist/docs/src/content/foundations/styles/border.mdx +5 -6
  49. package/dist/docs/src/content/foundations/styles/color/accessibility.mdx +31 -7
  50. package/dist/docs/src/content/foundations/styles/color/dark-mode.mdx +66 -6
  51. package/dist/docs/src/content/foundations/styles/color/palette.mdx +2 -2
  52. package/dist/docs/src/content/foundations/styles/color/usage.mdx +5 -5
  53. package/dist/docs/src/content/foundations/styles/data-visualization.mdx +33 -78
  54. package/dist/docs/src/content/foundations/styles/elevation.mdx +2 -2
  55. package/dist/docs/src/content/foundations/styles/icons/accessibility.mdx +1 -1
  56. package/dist/docs/src/content/foundations/styles/icons/code.mdx +1 -1
  57. package/dist/docs/src/content/foundations/styles/icons/library.mdx +2 -2
  58. package/dist/docs/src/content/foundations/styles/icons/usage.mdx +0 -3
  59. package/dist/docs/src/content/foundations/styles/interaction-states.mdx +40 -14
  60. package/dist/docs/src/content/foundations/styles/layout/app-frame.mdx +4 -9
  61. package/dist/docs/src/content/foundations/styles/layout/grid.mdx +1 -1
  62. package/dist/docs/src/content/foundations/styles/layout/overlays.mdx +3 -0
  63. package/dist/docs/src/content/foundations/styles/logos/downloads-and-terms.mdx +3 -3
  64. package/dist/docs/src/content/foundations/styles/logos/using-the-logo.mdx +1 -1
  65. package/dist/docs/src/content/foundations/styles/motion.mdx +2 -0
  66. package/dist/docs/src/content/foundations/styles/radius.mdx +38 -27
  67. package/dist/docs/src/content/foundations/styles/size-and-density.mdx +7 -6
  68. package/dist/docs/src/content/foundations/styles/spacing.mdx +1 -1
  69. package/dist/docs/src/content/foundations/styles/typography/code.mdx +1 -1
  70. package/dist/docs/src/content/foundations/styles/typography/usage.mdx +7 -0
  71. package/dist/docs/src/content/foundations/styles/z-index.mdx +3 -16
  72. package/dist/docs/src/content/foundations/tokens/all-tokens.mdx +51 -2
  73. package/dist/docs/src/content/foundations/tokens/index.mdx +91 -6
  74. package/dist/docs/src/content/get-started/content.mdx +25 -3
  75. package/dist/docs/src/content/get-started/design.mdx +34 -15
  76. package/dist/docs/src/content/get-started/develop.mdx +83 -28
  77. package/dist/docs/src/content/get-started/get-help.mdx +21 -5
  78. package/dist/docs/src/content/get-started/index.mdx +11 -12
  79. package/dist/docs/src/content/tools/ant-design-vue-theme.mdx +176 -48
  80. package/dist/docs/src/content/tools/application-content.mdx +52 -13
  81. package/dist/docs/src/content/tools/editors.mdx +36 -28
  82. package/dist/docs/src/content/tools/mermaid.mdx +42 -9
  83. package/dist/docs/src/content/tools/vueflow.mdx +66 -7
  84. package/dist/docs/src/content-vi/components/button/accessibility.mdx +51 -0
  85. package/dist/docs/src/content-vi/components/button/changelog.mdx +6 -0
  86. package/dist/docs/src/content-vi/components/button/examples.mdx +27 -0
  87. package/dist/docs/src/content-vi/components/button/usage.mdx +31 -0
  88. package/dist/docs/src/content-vi/components/resizable-panel/accessibility.mdx +58 -0
  89. package/dist/docs/src/content-vi/components/resizable-panel/changelog.mdx +20 -0
  90. package/dist/docs/src/content-vi/components/resizable-panel/code.mdx +78 -0
  91. package/dist/docs/src/content-vi/components/resizable-panel/examples.mdx +83 -0
  92. package/dist/docs/src/content-vi/components/resizable-panel/usage.mdx +97 -0
  93. package/dist/docs/src/content-vi/components/scrollbar/code.mdx +71 -0
  94. package/dist/docs/src/content-vi/components/scrollbar/usage.mdx +36 -0
  95. package/dist/docs/src/content-vi/components/switch/accessibility.mdx +28 -0
  96. package/dist/docs/src/content-vi/components/switch/examples.mdx +35 -0
  97. package/dist/docs/src/content-vi/components/switch/usage.mdx +44 -0
  98. package/dist/docs/src/content-vi/foundations/guidelines/accessibility/statement.mdx +4 -2
  99. package/dist/docs/src/content-vi/foundations/guidelines/accessibility/testing.mdx +1 -1
  100. package/dist/docs/src/content-vi/foundations/guidelines/accessibility.mdx +1 -1
  101. package/dist/docs/src/content-vi/foundations/guidelines/content/messages.mdx +67 -0
  102. package/dist/docs/src/content-vi/foundations/guidelines/content/numbers-dates-and-currency.mdx +71 -0
  103. package/dist/docs/src/content-vi/foundations/guidelines/content/style-and-grammar.mdx +91 -0
  104. package/dist/docs/src/content-vi/foundations/guidelines/content/terms.mdx +57 -0
  105. package/dist/docs/src/content-vi/foundations/guidelines/content/voice-and-tone.mdx +48 -0
  106. package/dist/docs/src/content-vi/foundations/guidelines/content.mdx +24 -19
  107. package/dist/docs/src/content-vi/foundations/styles/border.mdx +5 -5
  108. package/dist/docs/src/content-vi/foundations/styles/color/accessibility.mdx +30 -7
  109. package/dist/docs/src/content-vi/foundations/styles/color/dark-mode.mdx +65 -6
  110. package/dist/docs/src/content-vi/foundations/styles/color/palette.mdx +2 -2
  111. package/dist/docs/src/content-vi/foundations/styles/color/usage.mdx +5 -5
  112. package/dist/docs/src/content-vi/foundations/styles/data-visualization.mdx +31 -1
  113. package/dist/docs/src/content-vi/foundations/styles/elevation.mdx +2 -2
  114. package/dist/docs/src/content-vi/foundations/styles/icons/accessibility.mdx +1 -1
  115. package/dist/docs/src/content-vi/foundations/styles/icons/code.mdx +1 -1
  116. package/dist/docs/src/content-vi/foundations/styles/icons/library.mdx +2 -2
  117. package/dist/docs/src/content-vi/foundations/styles/icons/usage.mdx +0 -3
  118. package/dist/docs/src/content-vi/foundations/styles/interaction-states.mdx +54 -12
  119. package/dist/docs/src/content-vi/foundations/styles/layout/app-frame.mdx +4 -9
  120. package/dist/docs/src/content-vi/foundations/styles/layout/grid.mdx +1 -1
  121. package/dist/docs/src/content-vi/foundations/styles/layout/overlays.mdx +3 -0
  122. package/dist/docs/src/content-vi/foundations/styles/logos/downloads-and-terms.mdx +3 -3
  123. package/dist/docs/src/content-vi/foundations/styles/motion.mdx +2 -0
  124. package/dist/docs/src/content-vi/foundations/styles/radius.mdx +38 -27
  125. package/dist/docs/src/content-vi/foundations/styles/size-and-density.mdx +7 -6
  126. package/dist/docs/src/content-vi/foundations/styles/spacing.mdx +1 -1
  127. package/dist/docs/src/content-vi/foundations/styles/typography/code.mdx +1 -1
  128. package/dist/docs/src/content-vi/foundations/styles/typography/usage.mdx +7 -0
  129. package/dist/docs/src/content-vi/foundations/styles/z-index.mdx +3 -16
  130. package/dist/docs/src/content-vi/foundations/tokens/all-tokens.mdx +51 -2
  131. package/dist/docs/src/content-vi/foundations/tokens/index.mdx +90 -5
  132. package/dist/docs/src/content-vi/get-started/content.mdx +36 -0
  133. package/dist/docs/src/content-vi/get-started/design.mdx +49 -0
  134. package/dist/docs/src/content-vi/get-started/develop.mdx +110 -0
  135. package/dist/docs/src/content-vi/get-started/get-help.mdx +35 -0
  136. package/dist/docs/src/content-vi/get-started/index.mdx +49 -0
  137. package/dist/docs/src/content-vi/release-phases/index.mdx +11 -0
  138. package/dist/docs/src/content-vi/tools/ai-agents.mdx +36 -0
  139. package/dist/docs/src/content-vi/tools/ant-design-vue-theme.mdx +676 -0
  140. package/dist/docs/src/content-vi/tools/application-content.mdx +171 -0
  141. package/dist/docs/src/content-vi/tools/editors.mdx +254 -0
  142. package/dist/docs/src/content-vi/tools/eslint.mdx +15 -0
  143. package/dist/docs/src/content-vi/tools/index.mdx +7 -0
  144. package/dist/docs/src/content-vi/tools/mermaid.mdx +179 -0
  145. package/dist/docs/src/content-vi/tools/stylelint.mdx +18 -0
  146. package/dist/docs/src/content-vi/tools/vueflow.mdx +189 -0
  147. package/dist/docs/src/content.config.ts +12 -1
  148. package/dist/docs/src/lib/dates.ts +8 -0
  149. package/dist/docs/src/lib/i18n.ts +1 -0
  150. package/dist/docs/src/lib/navigation.ts +6 -4
  151. package/dist/docs/src/lib/token-descriptions-vi.ts +247 -11
  152. package/dist/docs/src/lib/tokens.ts +3 -0
  153. package/dist/docs/src/styles/chrome.css +8 -8
  154. package/dist/docs/src/styles/color.css +31 -31
  155. package/dist/docs/src/styles/docs.css +55 -40
  156. package/dist/docs/src/styles/elevation.css +1 -1
  157. package/dist/docs/src/styles/global.css +13 -4
  158. package/dist/docs/src/styles/icons.css +16 -16
  159. package/dist/docs/src/styles/kit.css +29 -10
  160. package/dist/docs/src/styles/layout.css +16 -11
  161. package/dist/docs/src/styles/logos.css +24 -24
  162. package/dist/docs/src/styles/opacity.css +3 -3
  163. package/dist/docs/src/styles/rules.css +24 -0
  164. package/dist/docs/src/styles/shapes.css +2 -2
  165. package/dist/docs/src/styles/tokens.css +228 -147
  166. package/dist/docs/src/styles/tokens.js +88 -62
  167. package/dist/docs/src/styles/typography.css +9 -9
  168. package/dist/docs/src/styles/zindex.css +6 -5
  169. package/dist/docs/tokens/color.json +24 -14
  170. package/dist/docs/tokens/components.json +39 -0
  171. package/dist/docs/tokens/content.json +103 -10
  172. package/dist/docs/tokens/diagram.json +490 -49
  173. package/dist/docs/tokens/editor.json +128 -22
  174. package/dist/docs/tokens/flow.json +412 -80
  175. package/dist/docs/tokens/layout.json +13 -4
  176. package/dist/docs/tokens/motion.json +11 -0
  177. package/dist/docs/tokens/radius.json +9 -9
  178. package/dist/docs/tokens/renderer.json +8 -0
  179. package/dist/docs/tokens/resize.json +84 -15
  180. package/dist/docs/tokens/scrollbar.json +42 -7
  181. package/dist/docs/tokens/size.json +6 -6
  182. package/dist/docs/tokens/spacing.json +1 -1
  183. package/dist/docs/tokens/switch.json +314 -59
  184. package/dist/docs/tokens/typography.json +1 -1
  185. package/dist/docs/tokens/visualization.json +465 -53
  186. package/dist/docs/tokens/z-index.json +0 -10
  187. package/dist/index.js +908 -208
  188. package/package.json +1 -1
  189. package/dist/docs/src/brand/structure-proposal.md +0 -227
  190. package/dist/docs/src/content/components/button/code.mdx +0 -34
@@ -2,7 +2,7 @@
2
2
 
3
3
  <script>
4
4
  import { computed, createApp, defineComponent, h, onBeforeUnmount, ref, useId } from 'vue';
5
- import { Alert, Avatar, Button, Card, ConfigProvider, Dropdown, Empty, Flex, InputNumber, InputSearch, Menu, MenuItem, Modal, Progress, Select, Space, Switch, Tag, TypographyText, type SelectProps } from 'ant-design-vue';
5
+ import { Alert, Avatar, Button, Card, ConfigProvider, Dropdown, Empty, Flex, InputNumber, InputSearch, Menu, MenuItem, Modal, Progress, Segmented, Select, Space, Switch, Tag, Timeline, TimelineItem, Tooltip, TypographyText, type SelectProps } from 'ant-design-vue';
6
6
  import { ClearOutlined, GlobalOutlined, RightOutlined } from '@ant-design/icons-vue';
7
7
  import { tokenPixels } from '@beehexa/design-tokens';
8
8
  import { createAntDesignVueTheme, getAntDesignVueStepProgressSize, useAntDesignVueRootFontSize } from '@beehexa/ant-design-vue-tokens';
@@ -19,6 +19,7 @@
19
19
  const query = ref('');
20
20
  const status = ref<SelectProps['value']>('all');
21
21
  const details = ref(false);
22
+ const modalBodyActivations = ref(0);
22
23
  const controlId = useId();
23
24
  const languageOpen = ref(false);
24
25
  const languageTrigger = ref<{ focus: () => void } | null>(null);
@@ -26,6 +27,9 @@
26
27
  const selectedChoice = ref('flow');
27
28
  const buttonSize = ref<'small' | 'middle' | 'large'>('middle');
28
29
  const buttonPresses = ref(0);
30
+ const dockSelected = ref(false);
31
+ const cardSelected = ref(true);
32
+ const segmentedSelection = ref<string | number>('all');
29
33
  const activateButton = () => { buttonPresses.value += 1; };
30
34
  const buttonSizeOptions = ['small', 'middle', 'large'].map(value => ({ value, label: value }));
31
35
  const buttonAvailability = ['enabled', 'loading', 'disabled'] as const;
@@ -76,7 +80,7 @@
76
80
  const switchSaving = ref(false);
77
81
  let switchSaveTimer: ReturnType<typeof setTimeout> | undefined;
78
82
  const switchExamples = (['default', 'small'] as const).flatMap(size =>
79
- (['enabled', 'loading', 'disabled'] as const).flatMap(availability =>
83
+ (['enabled', 'loading', 'disabled', 'loadingDisabled'] as const).flatMap(availability =>
80
84
  [false, true].map(initialChecked => ({
81
85
  id: `${controlId}-switch-${size}-${availability}-${initialChecked}`,
82
86
  size, availability, initialChecked, checked: ref(initialChecked)
@@ -85,14 +89,14 @@
85
89
  title: 'Công tắc gốc: bật không có nghĩa là thành công',
86
90
  help: 'Đổi giao diện sáng/tối và ngôn ngữ của trang. Di chuột, nhấn giữ hoặc dùng Tab, Space/Enter và phím trái/phải. Công tắc đang xử lý hoặc bị vô hiệu hóa không được tăng bộ đếm.',
87
91
  on: 'Bật', off: 'Tắt', normal: 'Cỡ thường', small: 'Cỡ nhỏ',
88
- enabled: 'Có thể dùng', loading: 'Đang xử lý', disabled: 'Vô hiệu hóa',
92
+ enabled: 'Có thể dùng', loading: 'Đang xử lý', disabled: 'Vô hiệu hóa', loadingDisabled: 'Đang xử lý và vô hiệu hóa',
89
93
  initialOn: 'ban đầu bật', initialOff: 'ban đầu tắt',
90
94
  save: 'Lưu có kiểm soát (mô phỏng 1,2 giây)', callbacks: 'Lần gọi thay đổi', saves: 'Lần lưu', saving: 'Đang lưu', saved: 'Đã lưu'
91
95
  } : {
92
96
  title: 'Native Switch: ON does not mean success',
93
97
  help: 'Change the site light/dark theme and language. Hover, hold a press or use Tab, Space/Enter and Left/Right. Loading and disabled switches must not increment the counter.',
94
98
  on: 'On', off: 'Off', normal: 'Normal', small: 'Small',
95
- enabled: 'Available', loading: 'Loading', disabled: 'Disabled',
99
+ enabled: 'Available', loading: 'Loading', disabled: 'Disabled', loadingDisabled: 'Loading and disabled',
96
100
  initialOn: 'initially on', initialOff: 'initially off',
97
101
  save: 'Controlled save (1.2-second simulation)', callbacks: 'Change callbacks', saves: 'Saves', saving: 'Saving', saved: 'Saved'
98
102
  });
@@ -122,11 +126,13 @@
122
126
  const theme = computed(() => createAntDesignVueTheme({ dark: dark.value, locale: locale.value, rootFontSize: rootFontSize.value }));
123
127
  const gap = () => tokenPixels('space.100', locale.value, rootFontSize.value);
124
128
  const clearFilters = () => { query.value = ''; status.value = 'all'; };
125
- return () => h(ConfigProvider, { theme: theme.value }, () => h(Flex, { vertical: true, style: { gap: 'var(--bh-space-200)' } }, () => [
129
+ return () => h(ConfigProvider, { theme: theme.value }, () => h(Flex, { vertical: true, style: { gap: 'var(--bh-space-400)' } }, () => [
130
+ h(Flex, { vertical: true, style: { gap: 'var(--bh-space-200)' } }, () => [
126
131
  h(Alert, { type: 'info', message: 'Real native controls: utility triggers and page controls share one family; avatar actions remain frameless.' }),
127
- h(Space, { size: gap(), wrap: true, align: 'center' }, () => [
132
+ h(Flex, { vertical: true, style: { gap: 'var(--bh-space-100)' } }, () => [
133
+ h(Flex, { wrap: 'wrap', align: 'center', style: { gap: 'var(--bh-space-100)' } }, () => [
128
134
  h(Dropdown, { trigger: ['click'], open: languageOpen.value, 'onUpdate:open': (open: boolean) => { languageOpen.value = open; } }, {
129
- default: () => h(Button, { ref: languageTrigger, 'data-bh-target': 'responsive', 'aria-label': 'Choose demonstration language', 'aria-haspopup': 'menu', 'aria-expanded': languageOpen.value }, {
135
+ default: () => h(Button, { ref: languageTrigger, 'data-bh-target': 'responsive', 'aria-label': `${language.value}: choose demonstration language`, 'aria-haspopup': 'menu', 'aria-expanded': languageOpen.value }, {
130
136
  icon: () => h(GlobalOutlined), default: () => language.value
131
137
  }),
132
138
  overlay: () => h(Menu, { selectedKeys: [language.value], onKeydown: (event: KeyboardEvent) => { if (event.key === 'Escape') { event.stopPropagation(); closeLanguage(); } }, onClick: ({ key }: { key: string | number }) => { language.value = String(key); closeLanguage(); } }, () => [
@@ -139,23 +145,33 @@
139
145
  h(Avatar, { size: tokenPixels('size.control.small', locale.value, rootFontSize.value) }, () => 'BH'), 'Sample account'
140
146
  ]))
141
147
  ]),
142
- ...(['small', 'middle', 'large'] as const).map(size => h(Space, { size: gap(), wrap: true, align: 'center' }, () => [
148
+ ...(['small', 'middle', 'large'] as const).map(size => h(Flex, { wrap: 'wrap', align: 'center', style: { gap: 'var(--bh-space-100)' } }, () => [
143
149
  h(Button, { size, onClick: () => { details.value = true; } }, () => 'Default action'),
144
150
  h(Button, { size, type: 'primary', onClick: () => { details.value = true; } }, () => 'Primary action'),
145
151
  h(InputSearch, { size, value: query.value, 'aria-label': `${size} search`, placeholder: 'Search', 'onUpdate:value': (value: string) => { query.value = value; }, onSearch: () => { details.value = true; }, style: { width: 'min(100%, 14rem)' } }),
146
152
  h('label', { for: `${controlId}-${size}`, 'data-bh-font': 'label-default' }, `${size} status`),
147
153
  h(Select, { id: `${controlId}-${size}`, size, value: status.value, options: [{ value: 'all', label: 'All statuses' }, { value: 'active', label: 'Active' }], 'onUpdate:value': (value: SelectProps['value']) => { status.value = value; }, style: { width: 'min(100%, 10rem)' } })
148
154
  ])),
149
- h(Space, { size: gap(), wrap: true }, () => [
155
+ h(Flex, { wrap: 'wrap', style: { gap: 'var(--bh-space-100)' } }, () => [
150
156
  h(Button, { disabled: true }, () => 'Disabled'),
151
157
  h(Button, { loading: true }, () => 'Loading'),
152
158
  h(Button, { type: 'text', onClick: clearFilters }, () => 'Frameless action'),
153
159
  h(Button, { type: 'link', onClick: () => { details.value = true; } }, () => 'Link-style action')
160
+ ])
161
+ ])
154
162
  ]),
155
- h(Flex, { vertical: true, style: { gap: 'var(--bh-space-100)' } }, () => [
156
- h('h3', { 'data-bh-font': 'heading-small' }, buttonWords.value.title),
157
- h('p', { 'data-bh-font': 'body-small' }, buttonWords.value.help),
158
- h(Space, { size: gap(), wrap: true }, () => [
163
+ h(Space, { size: gap(), wrap: true, 'data-native-link-matrix': '' }, () => [
164
+ h('a', { href: `#${controlId}-activations`, class: 'bh-content-link', 'data-native-link-case': 'default' },
165
+ locale.value === 'vi' ? 'Liên kết mặc định' : 'Default link'),
166
+ h('a', { href: `#${controlId}-activations`, class: 'bh-content-link bh-link-underline', 'data-native-link-case': 'explicit-underline' },
167
+ locale.value === 'vi' ? 'Liên kết chủ động gạch chân' : 'Explicit underline link')
168
+ ]),
169
+ h(Flex, { vertical: true, style: { gap: 'var(--bh-space-200)' } }, () => [
170
+ h(Flex, { vertical: true, style: { gap: 'var(--bh-space-050)' } }, () => [
171
+ h('h3', { 'data-bh-font': 'heading-small' }, buttonWords.value.title),
172
+ h('p', { 'data-bh-font': 'body-small' }, buttonWords.value.help)
173
+ ]),
174
+ h(Flex, { wrap: 'wrap', style: { gap: 'var(--bh-space-100)' } }, () => [
159
175
  h('label', { for: `${controlId}-button-size` }, buttonWords.value.size),
160
176
  h(Select, {
161
177
  id: `${controlId}-button-size`, value: buttonSize.value, style: { width: '8rem' },
@@ -163,12 +179,18 @@
163
179
  'onUpdate:value': (value: SelectProps['value']) => { if (value === 'small' || value === 'middle' || value === 'large') buttonSize.value = value; }
164
180
  })
165
181
  ]),
166
- ...buttonCases.map(sample => h(Space, {
167
- key: sample.key, size: gap(), wrap: true, align: 'center',
168
- style: sample.inverse ? { background: 'var(--bh-color-surface-inverse)', padding: 'var(--bh-space-100)' } : undefined
182
+ h(Flex, { vertical: true, style: { gap: 'var(--bh-space-100)' } }, () => [
183
+ ...buttonCases.map(sample => h(Flex, {
184
+ key: sample.key, wrap: 'wrap', align: 'center',
185
+ style: { gap: 'var(--bh-space-100)', ...(sample.inverse ? { background: 'var(--bh-color-surface-inverse)', padding: 'var(--bh-space-100)' } : {}) }
169
186
  }, () => [
170
187
  h('span', { 'data-bh-font': 'label-small', style: sample.inverse ? { color: 'var(--bh-color-text-inverse)' } : undefined },
171
188
  `${sample.type}${sample.danger ? ` / ${buttonWords.value.danger}` : ''}${sample.ghost ? ` / ${buttonWords.value.ghost}` : ''}`),
189
+ h(Button, {
190
+ type: sample.type, danger: sample.danger, ghost: sample.ghost, size: buttonSize.value,
191
+ href: `#${controlId}-activations`, disabled: true, 'aria-disabled': true, tabindex: -1,
192
+ 'data-native-button-anchor-case': sample.key, onClick: activateButton
193
+ }, () => buttonWords.value.anchor),
172
194
  ...buttonAvailability.map(availability => h(Button, {
173
195
  type: sample.type, danger: sample.danger, ghost: sample.ghost, size: buttonSize.value,
174
196
  loading: availability === 'loading', disabled: availability === 'disabled',
@@ -176,39 +198,114 @@
176
198
  onClick: activateButton
177
199
  }, { icon: () => h(RightOutlined), default: () => `${buttonWords.value[sample.type]} / ${buttonWords.value[availability]}` }))
178
200
  ])),
179
- h(Button, { href: `#${controlId}-activations`, type: 'link', disabled: true, 'data-native-button-case': 'disabled-anchor' }, () => buttonWords.value.anchor),
201
+ h(Button, { href: `#${controlId}-activations`, type: 'link', disabled: true, 'aria-disabled': true, tabindex: -1, 'data-native-button-case': 'disabled-anchor' }, () => buttonWords.value.anchor)
202
+ ]),
180
203
  h('output', { id: `${controlId}-activations`, role: 'status', 'data-bh-font': 'body-small' }, `${buttonWords.value.presses}: ${buttonPresses.value}`)
181
204
  ]),
182
- h(Flex, { vertical: true, style: { gap: 'var(--bh-space-100)' } }, () => [
205
+ h(Card, {
206
+ title: locale.value === 'vi'
207
+ ? 'Tiêu đề Card dài phải xuống dòng đầy đủ trên điện thoại, độc lập với thao tác bổ sung'
208
+ : 'A long Card heading wraps completely on mobile, independently of its extra action'
209
+ }, {
210
+ extra: () => h(Button, { onClick: () => { details.value = true; } }, () => buttonWords.value.default),
211
+ default: () => [
212
+ h('p', { 'data-bh-font': 'body-small' }, locale.value === 'vi'
213
+ ? 'Nhóm dock gốc giữ riêng trạng thái chọn, nguy hiểm, đang xử lý và liên kết vô hiệu hóa.'
214
+ : 'The compact native dock preserves selection, danger, loading and disabled-link roles.'),
215
+ h(Space, {
216
+ class: 'bh-control-group', 'data-bh-variant': 'dock',
217
+ size: tokenPixels('space.025', locale.value, rootFontSize.value),
218
+ style: { overflowX: 'auto' }
219
+ }, () => [
220
+ h(Button, { type: 'text', onClick: activateButton }, () => buttonWords.value.default),
221
+ h(Button, { type: 'text', danger: true, onClick: activateButton }, () => buttonWords.value.danger),
222
+ h(Button, { type: 'text', 'aria-pressed': dockSelected.value, onClick: () => { dockSelected.value = !dockSelected.value; } }, () => buttonWords.value.text),
223
+ h(Button, { type: 'text', loading: true, onClick: activateButton }, () => buttonWords.value.loading),
224
+ h(Button, { type: 'text', href: `#${controlId}-activations`, disabled: true, 'aria-disabled': true, tabindex: -1, onClick: activateButton }, () => buttonWords.value.anchor)
225
+ ])
226
+ ]
227
+ }),
228
+ h(Card, {
229
+ hoverable: true, 'data-bh-selected': cardSelected.value, 'data-native-card-selection': '',
230
+ bodyStyle: { display: 'flex', flexDirection: 'column', gap: 'var(--bh-space-100)' }
231
+ }, () => [
232
+ h(Button, {
233
+ type: 'text', 'data-bh-layout': 'content', 'data-bh-card-action': 'primary',
234
+ 'aria-pressed': cardSelected.value, onClick: () => { cardSelected.value = !cardSelected.value; }
235
+ }, () => locale.value === 'vi' ? 'Chọn Card: chỉ một khung được chọn' : 'Select Card: one selected frame'),
236
+ h('p', { 'data-bh-font': 'body-small' }, locale.value === 'vi'
237
+ ? 'Tiêu đề giữ trạng thái ngữ nghĩa; Card sở hữu khung chọn. Tab, Enter và Space vẫn là thao tác Nút gốc.'
238
+ : 'The title retains its semantic state; the Card owns selection paint. Tab, Enter and Space remain native Button interactions.')
239
+ ]),
240
+ h('div', {
241
+ 'data-native-card-actions': '',
242
+ style: { display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(min(100%, 16rem), 1fr))', gap: 'var(--bh-space-200)' }
243
+ }, [0, 1, 2].map(index => h(Card, {
244
+ key: index, class: 'bh-ant-card-action-row', hoverable: true, bodyStyle: { display: 'none' }
245
+ }, {
246
+ title: () => h('a', { href: `#${controlId}-activations`, class: 'bh-card-link' }, [
247
+ h('span', { class: 'bh-card-link__title' }, index === 1
248
+ ? (locale.value === 'vi' ? 'Tên mục dài: nội dung xuống dòng độc lập với thao tác cuối hàng' : 'Long entity name: content wraps independently of the trailing action')
249
+ : (locale.value === 'vi' ? 'Tên mục' : 'Entity name')),
250
+ ...(index > 0 ? [h(Flex, { class: 'bh-card-link__metadata', wrap: 'wrap', style: { gap: 'var(--bh-space-050)' } }, () => [
251
+ h(Tag, () => locale.value === 'vi' ? 'Đã ánh xạ' : 'Mapped'), h(Tag, () => '12')
252
+ ])] : [])
253
+ ]),
254
+ extra: () => h(Tooltip, {
255
+ title: locale.value === 'vi' ? 'Cài đặt mục' : 'Entity settings', trigger: ['hover', 'focus']
256
+ }, () => h(Button, {
257
+ type: 'text', 'data-bh-target': 'responsive',
258
+ 'aria-label': locale.value === 'vi' ? 'Cài đặt mục' : 'Entity settings',
259
+ onClick: () => { details.value = true; }
260
+ }, { icon: () => h(GlobalOutlined) }))
261
+ }))),
262
+ h(Tooltip, { overlayClassName: 'bh-ant-metric-tooltip', trigger: ['hover', 'focus'] }, {
263
+ default: () => h(Button, () => locale.value === 'vi' ? 'Ngày và số liệu' : 'Date and metrics'),
264
+ title: () => h('div', { class: 'bh-metric-tooltip' }, [
265
+ h('strong', '2026-11-05 00:00:00 – 2026-11-06 00:00:00'),
266
+ h('dl', [
267
+ h('dt', locale.value === 'vi' ? 'Sự kiện được chấp nhận' : 'Accepted events'), h('dd', '12,345'),
268
+ h('dt', locale.value === 'vi' ? 'Sự kiện bị chặn' : 'Blocked events'), h('dd', '0'),
269
+ h('dt', locale.value === 'vi' ? 'Lỗi xử lý' : 'Processing issues'), h('dd', '2')
270
+ ])
271
+ ])
272
+ }),
273
+ h(Timeline, { 'data-native-timeline': '' }, () => [
274
+ h(TimelineItem, () => locale.value === 'vi' ? 'Mốc thời gian đầu tiên' : 'First timeline event'),
275
+ h(TimelineItem, () => locale.value === 'vi'
276
+ ? 'Một sự kiện dài xuống dòng trong cột nội dung gốc, giữ dấu chấm và đường nối thẳng hàng.'
277
+ : 'A long event wraps within the native content column, keeping the dot and connecting tail aligned.')
278
+ ]),
279
+ h(Flex, { vertical: true, style: { gap: 'var(--bh-space-200)' } }, () => [
183
280
  h('h3', { 'data-bh-font': 'heading-small' }, stepWords.value.title),
184
- h(Space, { size: gap(), wrap: true, align: 'center' }, () => [
281
+ h(Flex, { wrap: 'wrap', align: 'center', style: { gap: 'var(--bh-space-100)' } }, () => [
185
282
  h('label', { for: `${controlId}-step-total` }, stepWords.value.total),
186
283
  h(InputNumber, {
187
- id: `${controlId}-step-total`, min: 1, precision: 0, value: stepTotal.value,
284
+ id: `${controlId}-step-total`, min: 0, precision: 0, value: stepTotal.value,
188
285
  onChange: (value: number | string | null) => {
189
- if (typeof value === 'number' && value >= 1) { stepTotal.value = value; stepIndex.value = Math.min(stepIndex.value, value); }
286
+ if (typeof value === 'number' && value >= 0) { stepTotal.value = value; stepIndex.value = value === 0 ? 0 : Math.min(Math.max(1, stepIndex.value), value); }
190
287
  }
191
288
  }),
192
- h(Button, { onClick: () => { stepIndex.value = 1; } }, () => stepWords.value.first),
193
- h(Button, { onClick: () => { stepIndex.value = Math.ceil(stepTotal.value / 2); } }, () => stepWords.value.middle),
194
- h(Button, { onClick: () => { stepIndex.value = stepTotal.value; } }, () => stepWords.value.last)
289
+ h(Button, { disabled: stepTotal.value === 0, onClick: () => { stepIndex.value = 1; } }, () => stepWords.value.first),
290
+ h(Button, { disabled: stepTotal.value === 0, onClick: () => { stepIndex.value = Math.ceil(stepTotal.value / 2); } }, () => stepWords.value.middle),
291
+ h(Button, { disabled: stepTotal.value === 0, onClick: () => { stepIndex.value = stepTotal.value; } }, () => stepWords.value.last)
195
292
  ]),
196
293
  h('span', { 'data-bh-font': 'label-small' }, stepWords.value.optedIn),
197
- h(Space, { size: gap(), wrap: true, align: 'center' }, () => [
198
- h('span', { 'data-bh-font': 'label-small' }, stepWords.value.current),
199
- h(Progress, {
294
+ h(Flex, { wrap: 'wrap', align: 'center', style: { gap: 'var(--bh-space-100)' } }, () => [
295
+ h('output', { role: 'status', 'data-bh-font': 'label-small' }, stepWords.value.current),
296
+ stepTotal.value > 0 ? h(Progress, {
200
297
  class: 'bh-ant-step-progress', steps: stepTotal.value, percent: stepIndex.value / stepTotal.value * 100,
201
- size: stepSize.value, showInfo: false, 'aria-hidden': true,
298
+ size: stepSize.value, showInfo: false, status: 'normal', 'aria-hidden': true,
202
299
  strokeColor: getStatusColor('info', 'border', { dark: dark.value })
203
- })
300
+ }) : null
204
301
  ]),
205
302
  h('span', { 'data-bh-font': 'label-small' }, stepWords.value.base),
206
303
  h(Progress, {
207
- steps: stepTotal.value, percent: stepIndex.value / stepTotal.value * 100, size: 'small',
304
+ steps: stepTotal.value, percent: stepTotal.value > 0 ? stepIndex.value / stepTotal.value * 100 : 0, size: 'small',
208
305
  showInfo: false, 'aria-hidden': true, strokeColor: getStatusColor('info', 'border', { dark: dark.value })
209
306
  })
210
307
  ]),
211
- h(Flex, { vertical: true, style: { gap: 'var(--bh-space-100)' } }, () => [
308
+ h(Flex, { vertical: true, style: { gap: 'var(--bh-space-200)' } }, () => [
212
309
  h('h3', { 'data-bh-font': 'heading-small' }, emptyWords.value.title),
213
310
  ...[2, 4, 12].map(rows => h(Card, { size: 'small', title: `${rows} rem` }, () =>
214
311
  h('div', { 'data-native-empty-fit': rows, style: { display: 'flex', alignItems: 'center', justifyContent: 'center', blockSize: `${rows}rem`, minBlockSize: 0, overflow: 'auto' } },
@@ -220,10 +317,10 @@
220
317
  h(Empty, { description: emptyWords.value.description }))
221
318
  ]),
222
319
  h(Card, { title: locale.value === 'vi' ? 'Nhãn loại luồng' : 'Flow category badges', 'data-native-flow-categories': '' }, () =>
223
- h(Space, { size: gap(), wrap: true }, () =>
320
+ h(Flex, { wrap: 'wrap', style: { gap: 'var(--bh-space-100)' } }, () =>
224
321
  ['task', 'dependency', 'transformation', 'validation', 'pushStep', 'decision', 'loop', 'grouped'].map(category =>
225
322
  h(Tag, { key: category, style: getFlowCategoryBadgeStyles(category) }, () => category)))),
226
- h(Flex, { vertical: true, style: { gap: 'var(--bh-space-100)' } }, () => choices.value.map(choice => {
323
+ h(Flex, { vertical: true, style: { gap: 'var(--bh-space-200)' } }, () => choices.value.map(choice => {
227
324
  const expanded = expandedChoices.value.includes(choice.key);
228
325
  return h(Card, { key: choice.key, size: 'small' }, {
229
326
  title: () => h('div', { style: { display: 'grid', gridTemplateColumns: 'auto minmax(0, 1fr) max-content', alignItems: 'center', gap: 'var(--bh-space-100)' } }, [
@@ -247,31 +344,59 @@
247
344
  } : {})
248
345
  });
249
346
  })),
250
- h(Flex, { vertical: true, style: { gap: 'var(--bh-space-100)' } }, () => [
251
- h('h3', { 'data-bh-font': 'heading-small' }, switchWords.value.title),
252
- h('p', { 'data-bh-font': 'body-small' }, switchWords.value.help),
253
- ...switchExamples.map(sample => h(Space, { key: sample.id, size: gap(), wrap: true, align: 'center' }, () => [
347
+ h(Flex, { vertical: true, 'data-native-segmented-matrix': '', style: { gap: 'var(--bh-space-100)' } }, () => [
348
+ h('h3', { 'data-bh-font': 'heading-small' }, locale.value === 'vi' ? 'Segmented gốc: nhãn luôn hiển thị' : 'Native Segmented: labels remain visible'),
349
+ h('p', { 'data-bh-font': 'body-small' }, locale.value === 'vi'
350
+ ? 'Di chuột và nhấn giữ trên mục đang chọn lẫn chưa chọn; click để đổi lựa chọn và dùng Tab/phím mũi tên. Kiểm tra chữ trong lúc thumb chuyển động ở cả giao diện sáng và tối.'
351
+ : 'Hover and hold a press on selected and unselected items; click to change selection and use Tab/arrow keys. Check labels during native thumb motion in light and dark.'),
352
+ ...(['small', 'middle', 'large'] as const).flatMap(size => [false, true].map(disabled =>
353
+ h(Segmented, {
354
+ key: `${size}-${disabled}`, id: `${controlId}-segmented-${size}-${disabled ? 'disabled' : 'enabled'}`,
355
+ 'data-native-segmented-case': `${size}-${disabled ? 'disabled' : 'enabled'}`,
356
+ 'aria-label': `${size} ${disabled ? 'disabled' : 'enabled'} segmented`,
357
+ size: size === 'middle' ? undefined : size, disabled, value: segmentedSelection.value,
358
+ options: locale.value === 'vi'
359
+ ? [{ value: 'all', label: 'Tất cả' }, { value: 'active', label: 'Đang hoạt động' }, { value: 'paused', label: 'Tạm dừng' }]
360
+ : [{ value: 'all', label: 'All items' }, { value: 'active', label: 'Active' }, { value: 'paused', label: 'Paused' }],
361
+ 'onUpdate:value': (value: string | number) => { segmentedSelection.value = value; }
362
+ }))),
363
+ h('output', { 'data-native-segmented-value': '', role: 'status' }, `${locale.value === 'vi' ? 'Đang chọn' : 'Selected'}: ${segmentedSelection.value}`)
364
+ ]),
365
+ h(Flex, { vertical: true, style: { gap: 'var(--bh-space-200)' } }, () => [
366
+ h(Flex, { vertical: true, style: { gap: 'var(--bh-space-050)' } }, () => [
367
+ h('h3', { 'data-bh-font': 'heading-small' }, switchWords.value.title),
368
+ h('p', { 'data-bh-font': 'body-small' }, switchWords.value.help)
369
+ ]),
370
+ h(Flex, { vertical: true, style: { gap: 'var(--bh-space-100)' } }, () => [
371
+ ...switchExamples.map(sample => h(Flex, { key: sample.id, wrap: 'wrap', align: 'center', style: { gap: 'var(--bh-space-100)' } }, () => [
254
372
  h('label', { for: sample.id, 'data-bh-font': 'label-small' }, switchExampleLabel(sample)),
255
373
  h(Switch, {
256
374
  id: sample.id, size: sample.size, checked: sample.checked.value,
257
375
  checkedChildren: switchWords.value.on, unCheckedChildren: switchWords.value.off,
258
- loading: sample.availability === 'loading', disabled: sample.availability === 'disabled',
376
+ loading: sample.availability === 'loading' || sample.availability === 'loadingDisabled',
377
+ disabled: sample.availability === 'disabled' || sample.availability === 'loadingDisabled',
259
378
  'data-native-switch-case': `${sample.size}-${sample.availability}-${sample.initialChecked}`,
260
379
  'onUpdate:checked': (checked: boolean | string | number) => { sample.checked.value = checked === true; },
261
380
  onChange: () => { switchChanges.value += 1; }
262
381
  })
263
382
  ])),
264
- h(Space, { size: gap(), wrap: true, align: 'center' }, () => [
383
+ h(Flex, { wrap: 'wrap', align: 'center', style: { gap: 'var(--bh-space-100)' } }, () => [
265
384
  h('label', { for: `${controlId}-switch-save`, 'data-bh-font': 'label-small' }, switchWords.value.save),
266
385
  h(Switch, {
267
386
  id: `${controlId}-switch-save`, checked: switchSaved.value, loading: switchSaving.value,
268
387
  checkedChildren: switchWords.value.on, unCheckedChildren: switchWords.value.off,
269
388
  'data-native-switch-case': 'controlled-save', onChange: saveSwitch
270
389
  })
390
+ ])
271
391
  ]),
272
392
  h('output', { role: 'status', 'data-bh-font': 'body-small' }, `${switchWords.value.callbacks}: ${switchChanges.value}; ${switchWords.value.saves}: ${switchSaves.value}; ${switchSaving.value ? switchWords.value.saving : switchWords.value.saved}: ${switchSaved.value ? switchWords.value.on : switchWords.value.off}.`)
273
393
  ]),
274
- h(Modal, { open: details.value, title: 'Native action details', onCancel: () => { details.value = false; }, onOk: () => { details.value = false; } }, () => `Search: ${query.value || '(empty)'}; status: ${status.value}; language label: ${language.value}.`)
394
+ h(Modal, { open: details.value, title: 'Native action details', onCancel: () => { details.value = false; }, onOk: () => { details.value = false; } }, () => [
395
+ h(Button, { block: true, 'data-native-modal-first-control': '', onClick: () => { modalBodyActivations.value += 1; } },
396
+ () => locale.value === 'vi' ? 'Thao tác đầu nội dung' : 'First body action'),
397
+ h('output', { role: 'status', 'data-native-modal-body-activations': '' }, String(modalBodyActivations.value)),
398
+ h('p', `Search: ${query.value || '(empty)'}; status: ${status.value}; language label: ${language.value}.`)
399
+ ])
275
400
  ]));
276
401
  }
277
402
  });
@@ -0,0 +1,206 @@
1
+ <div data-native-flow-demo aria-label="Native workflow anatomy demonstration"></div>
2
+
3
+ <script>
4
+ import { computed, createApp, defineComponent, h, nextTick, onBeforeUnmount, onMounted, ref, useId, watch } from 'vue';
5
+ import { Alert, Button, ConfigProvider, Flex, Select, Space, Switch } from 'ant-design-vue';
6
+ import mermaid from 'mermaid';
7
+ import { compactFlowGraph, compactFlowMermaid, flowStylesheet, type RenderGroup, type RenderOverlay } from '@beehexa/hexasync-template-model';
8
+ import { tokenPixels } from '@beehexa/design-tokens';
9
+ import { createAntDesignVueTheme, useAntDesignVueRootFontSize } from '@beehexa/ant-design-vue-tokens';
10
+ import { createCanvasTheme, createMermaidConfig, preserveMermaidDefinitionPaint, workerFlowSvgStyle } from '@beehexa/mermaid-tokens';
11
+ import '@beehexa/ant-design-vue-tokens/css';
12
+
13
+ // One genuine native renderer and public model: no copied cards, paths or icon masks.
14
+ let renders = Promise.resolve();
15
+ const Demo = defineComponent({
16
+ setup() {
17
+ const rootFontSize = useAntDesignVueRootFontSize();
18
+ const dark = ref(document.documentElement.dataset.theme === 'dark');
19
+ const locale = ref<'en' | 'vi'>(document.documentElement.lang.startsWith('vi') ? 'vi' : 'en');
20
+ const execution = ref(false);
21
+ const direction = ref<'LR' | 'TD'>('TD');
22
+ const zoom = ref(100);
23
+ const selected = ref<string | null>(null);
24
+ const selectedText = ref('');
25
+ const ready = ref(false);
26
+ const error = ref('');
27
+ const host = ref<HTMLElement>();
28
+ const controlId = useId();
29
+ let revision = 0;
30
+ let disposed = false;
31
+ let currentSvg: SVGSVGElement | undefined;
32
+ const sheet = document.createElement('style');
33
+ sheet.textContent = flowStylesheet();
34
+ document.head.append(sheet);
35
+ const words = computed(() => locale.value === 'vi' ? {
36
+ title: 'Đồng bộ đơn hàng', run: 'Hiện bằng chứng thực thi mẫu', direction: 'Hướng luồng',
37
+ vertical: 'Dọc', horizontal: 'Ngang', reset: 'Đặt lại thu phóng', export: 'Xuất SVG gốc',
38
+ start: 'Bắt đầu', fetch: 'Đọc toàn bộ đơn hàng từ dịch vụ bên ngoài và giữ nguyên tiêu đề dài',
39
+ transform: 'Chuẩn hóa các trường đơn hàng', condition: 'Đơn hàng đã hợp lệ chưa?',
40
+ delay: 'Chờ giới hạn tốc độ', finish: 'Hoàn tất', failure: 'Báo lỗi đồng bộ',
41
+ choose: 'Chọn một bước bằng chuột hoặc Enter/Space; dùng Tab để thấy vòng lấy nét độc lập.',
42
+ selected: 'Bước đã chọn', zoomIn: 'Phóng to', zoomOut: 'Thu nhỏ'
43
+ } : {
44
+ title: 'Order synchronization', run: 'Show sample typed execution evidence', direction: 'Flow direction',
45
+ vertical: 'Vertical', horizontal: 'Horizontal', reset: 'Reset zoom', export: 'Export native SVG',
46
+ start: 'Start', fetch: 'Read all orders from the external service while retaining this complete wrapped title',
47
+ transform: 'Normalize order fields', condition: 'Is this order valid?',
48
+ delay: 'Wait for the rate limit', finish: 'Finished', failure: 'Report the synchronization failure',
49
+ choose: 'Choose a step by mouse or Enter/Space; Tab shows its independent keyboard-focus ring.',
50
+ selected: 'Selected step', zoomIn: 'Zoom in', zoomOut: 'Zoom out'
51
+ });
52
+ const theme = computed(() => createAntDesignVueTheme({ dark: dark.value, locale: locale.value, rootFontSize: rootFontSize.value }));
53
+ const syncContext = () => {
54
+ dark.value = document.documentElement.dataset.theme === 'dark';
55
+ locale.value = document.documentElement.lang.startsWith('vi') ? 'vi' : 'en';
56
+ };
57
+ const observer = new MutationObserver(syncContext);
58
+ observer.observe(document.documentElement, { attributes: true, attributeFilter: ['data-theme', 'lang'] });
59
+ const groups = (): RenderGroup[] => [{ key: 'orders', title: words.value.title, nodes: [
60
+ { address: 'start', name: words.value.start, terminal: true, iconFamily: 'terminal.begin' },
61
+ { address: 'fetch', name: words.value.fetch, key: 'FETCH_ORDERS', type: 'API', iconFamily: 'call.http' },
62
+ { address: 'normalize', name: words.value.transform, key: 'NORMALIZE', type: 'Scriban', iconFamily: 'transform.template' },
63
+ { address: 'condition', name: words.value.condition, key: 'VALID_ORDER', type: 'IF', decides: true, iconFamily: 'control.if' },
64
+ { address: 'delay', name: words.value.delay, key: 'RATE_LIMIT', type: 'SLEEP', iconFamily: 'wait.sleep' },
65
+ { address: 'finish', name: words.value.finish, terminal: true, iconFamily: 'terminal.end' },
66
+ { address: 'failure', name: words.value.failure, key: 'FAILED_ORDER', type: 'EXCEPTION', iconFamily: 'terminal.error' }
67
+ ] }];
68
+ const edges = [
69
+ { from: 'start', to: 'fetch' }, { from: 'fetch', to: 'normalize' },
70
+ { from: 'normalize', to: 'condition' }, { from: 'condition', to: 'delay', label: 'yes' },
71
+ { from: 'delay', to: 'finish' }, { from: 'condition', to: 'failure', label: 'no' }
72
+ ];
73
+ const overlay: RenderOverlay = { nodes: {
74
+ start: { state: 'ranOk' }, fetch: { state: 'ranOk', repeat: 3 }, normalize: { state: 'ranOk' },
75
+ condition: { state: 'ranOk' }, delay: { state: 'neverReached' },
76
+ finish: { state: 'branchNotTaken' }, failure: { state: 'ranFailed' }
77
+ } };
78
+ const select = (id: string) => {
79
+ selected.value = id;
80
+ for (const node of currentSvg?.querySelectorAll<SVGGElement>('g.node') ?? []) {
81
+ node.dataset.bhSelected = String(node.dataset.compactId === id);
82
+ node.setAttribute('aria-pressed', String(node.dataset.compactId === id));
83
+ if (node.dataset.compactId === id) selectedText.value = node.getAttribute('aria-label') ?? id;
84
+ }
85
+ };
86
+ const render = () => {
87
+ const ticket = ++revision;
88
+ const options = { dark: dark.value, locale: locale.value };
89
+ const compact = compactFlowGraph(groups(), edges, { overlay: execution.value ? overlay : undefined });
90
+ const definition = compactFlowMermaid(compact.graph, direction.value);
91
+ // Mermaid owns global initialization and measurement: serialize this page's demos.
92
+ renders = renders.then(async () => {
93
+ if (disposed || ticket !== revision) return;
94
+ await nextTick();
95
+ mermaid.initialize(createMermaidConfig(options));
96
+ const result = await mermaid.render(`native-flow-${controlId.replace(/[^a-zA-Z0-9-]/g, '')}-${ticket}`, definition);
97
+ if (disposed || ticket !== revision || !host.value) return;
98
+ host.value.innerHTML = result.svg;
99
+ currentSvg = host.value.querySelector<SVGSVGElement>('svg') ?? undefined;
100
+ if (!currentSvg) throw new Error('The native Mermaid renderer did not return an SVG.');
101
+ currentSvg.id = `native-flow-${controlId.replace(/[^a-zA-Z0-9-]/g, '')}-${ticket}`;
102
+ const canvas = createCanvasTheme(options);
103
+ currentSvg.classList.add('hx-flow');
104
+ const interactionStyle = document.createElementNS('http://www.w3.org/2000/svg', 'style');
105
+ interactionStyle.textContent = `
106
+ #${currentSvg.id} [data-bh-ring='selection'], #${currentSvg.id} [data-bh-ring='focus'] { visibility: hidden; }
107
+ #${currentSvg.id} [data-bh-selected='true'] [data-bh-ring='selection'],
108
+ #${currentSvg.id} g.node:focus-visible [data-bh-ring='focus'] { visibility: visible; }
109
+ `;
110
+ currentSvg.append(interactionStyle);
111
+ currentSvg.setAttribute('style', workerFlowSvgStyle(canvas));
112
+ // Snapshot the rendered theme on the drawing, including standalone downloads.
113
+ currentSvg.style.backgroundColor = canvas.colors.canvas;
114
+ currentSvg.style.width = '100%';
115
+ currentSvg.style.height = 'auto';
116
+ preserveMermaidDefinitionPaint(currentSvg);
117
+ const elements = new Map(Array.from(currentSvg.querySelectorAll<SVGGElement>('g.node'), node =>
118
+ [node.id.match(/(?:^|-)flowchart-(n[0-9a-z]+)-[0-9]+$/)?.[1], node] as const));
119
+ for (const modelNode of compact.graph.nodes) {
120
+ const node = elements.get(modelNode.id);
121
+ if (!node) continue;
122
+ node.dataset.compactId = modelNode.id;
123
+ node.dataset.bhClickable = 'true';
124
+ node.dataset.bhSelected = String(selected.value === modelNode.id);
125
+ node.setAttribute('role', 'button');
126
+ node.setAttribute('tabindex', '0');
127
+ node.setAttribute('aria-label', [modelNode.name, modelNode.key, modelNode.type, modelNode.state].filter(Boolean).join(' · '));
128
+ node.setAttribute('aria-pressed', String(selected.value === modelNode.id));
129
+ // Additive interaction outlines reuse Mermaid's actual shape, never substitute a card.
130
+ const outline = node.querySelector<SVGGraphicsElement>(':scope > rect, :scope > polygon, :scope > path, :scope > g.label-container path');
131
+ if (outline) {
132
+ for (const state of ['hover', 'selection', 'focus']) {
133
+ const ring = outline.cloneNode(false) as SVGGraphicsElement;
134
+ ring.removeAttribute('id');
135
+ ring.removeAttribute('style');
136
+ ring.dataset.bhRing = state;
137
+ ring.setAttribute('fill', 'none');
138
+ ring.setAttribute('pointer-events', 'none');
139
+ ring.setAttribute('aria-hidden', 'true');
140
+ ring.setAttribute('vector-effect', 'non-scaling-stroke');
141
+ ring.style.setProperty('fill', 'none', 'important');
142
+ ring.style.setProperty('stroke', canvas.selectionRing, 'important');
143
+ ring.style.setProperty('stroke-width', String(canvas.selectionWidth), 'important');
144
+ ring.style.setProperty('stroke-dasharray', state === 'focus' ? '3 3' : 'none', 'important');
145
+ // A gap around the measured native outline keeps failure/execution paint visible.
146
+ ring.style.transformBox = 'fill-box';
147
+ ring.style.transformOrigin = 'center';
148
+ const box = outline.getBBox();
149
+ const gap = canvas.selectionGap + (state === 'focus' ? canvas.selectionWidth : 0);
150
+ ring.style.transform = `scale(${(box.width + gap * 2) / box.width}, ${(box.height + gap * 2) / box.height})`;
151
+ outline.parentElement?.insertBefore(ring, outline);
152
+ }
153
+ }
154
+ node.addEventListener('click', () => select(modelNode.id));
155
+ node.addEventListener('keydown', event => {
156
+ if (event.key === 'Enter' || event.key === ' ') { event.preventDefault(); select(modelNode.id); }
157
+ });
158
+ }
159
+ error.value = '';
160
+ ready.value = true;
161
+ if (selected.value) select(selected.value);
162
+ }).catch(cause => { if (!disposed && ticket === revision) error.value = cause instanceof Error ? cause.message : String(cause); });
163
+ };
164
+ watch([dark, locale, execution, direction], render);
165
+ onMounted(render);
166
+ onBeforeUnmount(() => { disposed = true; revision += 1; observer.disconnect(); sheet.remove(); });
167
+ const exportSvg = () => {
168
+ if (!currentSvg) return;
169
+ const copy = currentSvg.cloneNode(true) as SVGSVGElement;
170
+ copy.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
171
+ const nativeStyle = document.createElementNS('http://www.w3.org/2000/svg', 'style');
172
+ nativeStyle.textContent = flowStylesheet();
173
+ copy.prepend(nativeStyle);
174
+ const url = URL.createObjectURL(new Blob([new XMLSerializer().serializeToString(copy)], { type: 'image/svg+xml' }));
175
+ const link = document.createElement('a');
176
+ link.href = url; link.download = 'native-order-flow.svg'; link.click();
177
+ setTimeout(() => URL.revokeObjectURL(url), 0);
178
+ };
179
+ return () => h(ConfigProvider, { theme: theme.value }, () => h(Flex, { vertical: true, style: { gap: 'var(--bh-space-150)' } }, () => [
180
+ h('p', { 'data-bh-font': 'body-small' }, words.value.choose),
181
+ h(Space, { wrap: true, size: tokenPixels('space.100', locale.value, rootFontSize.value), align: 'center' }, () => [
182
+ h('label', { for: `${controlId}-execution` }, words.value.run),
183
+ h(Switch, { id: `${controlId}-execution`, checked: execution.value, 'onUpdate:checked': (value: boolean | string | number) => { execution.value = value === true; } }),
184
+ h('label', { for: `${controlId}-direction` }, words.value.direction),
185
+ h(Select, { id: `${controlId}-direction`, value: direction.value, options: [{ value: 'TD', label: words.value.vertical }, { value: 'LR', label: words.value.horizontal }], 'onUpdate:value': (value: unknown) => { if (value === 'TD' || value === 'LR') direction.value = value; } }),
186
+ h(Button, { disabled: zoom.value <= 50, onClick: () => { zoom.value -= 25; } }, () => words.value.zoomOut),
187
+ h(Button, { disabled: zoom.value >= 200, onClick: () => { zoom.value += 25; } }, () => words.value.zoomIn),
188
+ h(Button, { onClick: () => { zoom.value = 100; } }, () => `${words.value.reset} (${zoom.value}%)`),
189
+ h(Button, { disabled: !ready.value, onClick: exportSvg }, () => words.value.export)
190
+ ]),
191
+ error.value ? h(Alert, { type: 'error', message: error.value }) : null,
192
+ h('div', { class: 'native-flow-scroll' }, [h('div', { class: 'hx-flow native-flow-svg', ref: host, style: { width: `${zoom.value}%` } })]),
193
+ h('output', { role: 'status', 'data-bh-font': 'body-small' }, `${words.value.selected}: ${selectedText.value || '—'}`)
194
+ ]));
195
+ }
196
+ });
197
+ for (const host of document.querySelectorAll<HTMLElement>('[data-native-flow-demo]')) createApp(Demo).mount(host);
198
+ </script>
199
+
200
+ <style is:global>
201
+ [data-native-flow-demo] .native-flow-scroll { overflow: auto; max-block-size: var(--bh-diagram-preview-height); background: var(--bh-diagram-canvas); border: var(--bh-border-width-default) solid var(--bh-diagram-panel-border); }
202
+ [data-native-flow-demo] .native-flow-svg { min-inline-size: 24rem; }
203
+ [data-native-flow-demo] [data-bh-ring='selection'], [data-native-flow-demo] [data-bh-ring='focus'] { visibility: hidden; }
204
+ [data-native-flow-demo] [data-bh-selected='true'] [data-bh-ring='selection'], [data-native-flow-demo] g.node:focus-visible [data-bh-ring='focus'] { visibility: visible; }
205
+ [data-native-flow-demo] g.node:focus { outline: none; }
206
+ </style>
@@ -1,18 +1,22 @@
1
1
  ---
2
2
  import StatusBadge from './StatusBadge.astro';
3
3
  import type { ReleasePhase } from '../lib/release-phases';
4
+ import { langOf } from '../lib/i18n';
5
+
6
+ const vi = langOf(Astro.url.pathname) === 'vi';
7
+ const L = (en: string, viText: string) => (vi ? viText : en);
4
8
 
5
9
  const phases: { id: ReleasePhase; meaning: string; production: string }[] = [
6
- { id: 'early-access', meaning: 'Being explored. It may change a lot or be removed. Feedback wanted.', production: "Only with the design system team's agreement." },
7
- { id: 'beta', meaning: 'Ready for controlled use. The API may still change, with notice in the changelog.', production: 'Yes, but follow the changelog.' },
8
- { id: 'ga', meaning: 'Stable and supported. Breaking changes follow deprecation.', production: 'Yes.' },
9
- { id: 'deprecated', meaning: 'Being replaced. A migration path is documented.', production: 'No new usage. Migrate existing usage.' },
10
+ { id: 'early-access', meaning: L('Being explored. It may change a lot or be removed. Feedback wanted.', 'Đang thử nghiệm. Có thể thay đổi nhiều hoặc bị bỏ. Rất cần góp ý.'), production: L("Only with the design system team's agreement.", 'Chỉ khi đội design system đồng ý.') },
11
+ { id: 'beta', meaning: L('Ready for controlled use. The API may still change, with notice in the changelog.', 'Sẵn sàng dùng có kiểm soát. API vẫn có thể đổi, có báo trong changelog.'), production: L('Yes, but follow the changelog.', 'Có, nhưng hãy theo dõi changelog.') },
12
+ { id: 'ga', meaning: L('Stable and supported. Breaking changes follow deprecation.', 'Ổn định và được hỗ trợ. Thay đổi lớn đi qua giai đoạn ngừng dùng trước.'), production: L('Yes.', 'Có.') },
13
+ { id: 'deprecated', meaning: L('Being replaced. A migration path is documented.', 'Đang được thay thế. Có hướng dẫn chuyển đổi.'), production: L('No new usage. Migrate existing usage.', 'Không dùng mới. Chuyển những chỗ đang dùng.') },
10
14
  ];
11
15
  ---
12
16
 
13
17
  <div class="table-wrap">
14
18
  <table>
15
- <thead><tr><th>Phase</th><th>Meaning</th><th>Can I use it in production?</th></tr></thead>
19
+ <thead><tr><th>{L('Phase', 'Giai đoạn')}</th><th>{L('Meaning', 'Ý nghĩa')}</th><th>{L('Can I use it in production?', 'Dùng trong sản phẩm thật được không?')}</th></tr></thead>
16
20
  <tbody>
17
21
  {phases.map((phase) => (
18
22
  <tr><td><StatusBadge status={phase.id} link={false} /></td><td>{phase.meaning}</td><td>{phase.production}</td></tr>