@beehexa/design-rules 2611.5.5 → 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.
- package/README.md +1 -1
- package/dist/catalog.json +908 -208
- package/dist/docs/public/_redirects +2 -2
- package/dist/docs/scripts/color-pairs.mjs +4 -0
- package/dist/docs/src/components/ChildPages.astro +8 -1
- package/dist/docs/src/components/ColorDemo.astro +12 -9
- package/dist/docs/src/components/DocsFooter.astro +1 -1
- package/dist/docs/src/components/HelpOptions.astro +8 -6
- package/dist/docs/src/components/IconBrowser.astro +2 -2
- package/dist/docs/src/components/LayoutDemo.astro +178 -99
- package/dist/docs/src/components/NativeControlsDemo.astro +165 -40
- package/dist/docs/src/components/NativeFlowDemo.astro +206 -0
- package/dist/docs/src/components/PhaseTable.astro +9 -5
- package/dist/docs/src/components/RoleGuides.astro +30 -22
- package/dist/docs/src/components/RuleDemo.astro +111 -0
- package/dist/docs/src/components/ShapeDemo.astro +24 -36
- package/dist/docs/src/components/SiteHeader.astro +1 -1
- package/dist/docs/src/components/SpacingDemo.astro +2 -0
- package/dist/docs/src/components/SwitchToggle.astro +13 -0
- package/dist/docs/src/components/SystemAreas.astro +9 -6
- package/dist/docs/src/components/TableOfContents.astro +1 -1
- package/dist/docs/src/components/TokenSearch.astro +64 -0
- package/dist/docs/src/components/TokenTable.astro +14 -9
- package/dist/docs/src/components/TypeDemo.astro +1 -1
- package/dist/docs/src/components/logos/LogoClearSpace.astro +1 -1
- package/dist/docs/src/content/components/button/accessibility.mdx +3 -3
- package/dist/docs/src/content/components/button/changelog.mdx +1 -1
- package/dist/docs/src/content/components/button/examples.mdx +10 -23
- package/dist/docs/src/content/components/button/meta.json +5 -1
- package/dist/docs/src/content/components/button/usage.mdx +13 -26
- package/dist/docs/src/content/components/resizable-panel/meta.json +5 -1
- package/dist/docs/src/content/{foundations/styles/scrollbars.mdx → components/scrollbar/code.mdx} +20 -39
- package/dist/docs/src/content/components/scrollbar/meta.json +9 -0
- package/dist/docs/src/content/components/scrollbar/usage.mdx +36 -0
- package/dist/docs/src/content/components/switch/accessibility.mdx +28 -0
- package/dist/docs/src/content/components/switch/examples.mdx +35 -0
- package/dist/docs/src/content/components/switch/meta.json +9 -0
- package/dist/docs/src/content/components/switch/usage.mdx +44 -0
- package/dist/docs/src/content/foundations/guidelines/accessibility/statement.mdx +4 -2
- package/dist/docs/src/content/foundations/guidelines/accessibility/testing.mdx +1 -1
- package/dist/docs/src/content/foundations/guidelines/accessibility.mdx +1 -1
- package/dist/docs/src/content/foundations/guidelines/content/messages.mdx +67 -0
- package/dist/docs/src/content/foundations/guidelines/content/numbers-dates-and-currency.mdx +72 -0
- package/dist/docs/src/content/foundations/guidelines/content/style-and-grammar.mdx +92 -0
- package/dist/docs/src/content/foundations/guidelines/content/terms.mdx +57 -0
- package/dist/docs/src/content/foundations/guidelines/content/voice-and-tone.mdx +48 -0
- package/dist/docs/src/content/foundations/guidelines/content.mdx +22 -17
- package/dist/docs/src/content/foundations/styles/border.mdx +5 -6
- package/dist/docs/src/content/foundations/styles/color/accessibility.mdx +31 -7
- package/dist/docs/src/content/foundations/styles/color/dark-mode.mdx +66 -6
- package/dist/docs/src/content/foundations/styles/color/palette.mdx +2 -2
- package/dist/docs/src/content/foundations/styles/color/usage.mdx +5 -5
- package/dist/docs/src/content/foundations/styles/data-visualization.mdx +33 -78
- package/dist/docs/src/content/foundations/styles/elevation.mdx +2 -2
- package/dist/docs/src/content/foundations/styles/icons/accessibility.mdx +1 -1
- package/dist/docs/src/content/foundations/styles/icons/code.mdx +1 -1
- package/dist/docs/src/content/foundations/styles/icons/library.mdx +2 -2
- package/dist/docs/src/content/foundations/styles/icons/usage.mdx +0 -3
- package/dist/docs/src/content/foundations/styles/interaction-states.mdx +40 -14
- package/dist/docs/src/content/foundations/styles/layout/app-frame.mdx +4 -9
- package/dist/docs/src/content/foundations/styles/layout/grid.mdx +1 -1
- package/dist/docs/src/content/foundations/styles/layout/overlays.mdx +3 -0
- package/dist/docs/src/content/foundations/styles/logos/downloads-and-terms.mdx +3 -3
- package/dist/docs/src/content/foundations/styles/logos/using-the-logo.mdx +1 -1
- package/dist/docs/src/content/foundations/styles/motion.mdx +2 -0
- package/dist/docs/src/content/foundations/styles/radius.mdx +38 -27
- package/dist/docs/src/content/foundations/styles/size-and-density.mdx +7 -6
- package/dist/docs/src/content/foundations/styles/spacing.mdx +1 -1
- package/dist/docs/src/content/foundations/styles/typography/code.mdx +1 -1
- package/dist/docs/src/content/foundations/styles/typography/usage.mdx +7 -0
- package/dist/docs/src/content/foundations/styles/z-index.mdx +3 -16
- package/dist/docs/src/content/foundations/tokens/all-tokens.mdx +51 -2
- package/dist/docs/src/content/foundations/tokens/index.mdx +91 -6
- package/dist/docs/src/content/get-started/content.mdx +25 -3
- package/dist/docs/src/content/get-started/design.mdx +34 -15
- package/dist/docs/src/content/get-started/develop.mdx +83 -28
- package/dist/docs/src/content/get-started/get-help.mdx +21 -5
- package/dist/docs/src/content/get-started/index.mdx +11 -12
- package/dist/docs/src/content/tools/ant-design-vue-theme.mdx +176 -48
- package/dist/docs/src/content/tools/application-content.mdx +52 -13
- package/dist/docs/src/content/tools/editors.mdx +36 -28
- package/dist/docs/src/content/tools/mermaid.mdx +42 -9
- package/dist/docs/src/content/tools/vueflow.mdx +56 -7
- package/dist/docs/src/content-vi/components/button/accessibility.mdx +51 -0
- package/dist/docs/src/content-vi/components/button/changelog.mdx +6 -0
- package/dist/docs/src/content-vi/components/button/examples.mdx +27 -0
- package/dist/docs/src/content-vi/components/button/usage.mdx +31 -0
- package/dist/docs/src/content-vi/components/resizable-panel/accessibility.mdx +58 -0
- package/dist/docs/src/content-vi/components/resizable-panel/changelog.mdx +20 -0
- package/dist/docs/src/content-vi/components/resizable-panel/code.mdx +78 -0
- package/dist/docs/src/content-vi/components/resizable-panel/examples.mdx +83 -0
- package/dist/docs/src/content-vi/components/resizable-panel/usage.mdx +97 -0
- package/dist/docs/src/content-vi/components/scrollbar/code.mdx +71 -0
- package/dist/docs/src/content-vi/components/scrollbar/usage.mdx +36 -0
- package/dist/docs/src/content-vi/components/switch/accessibility.mdx +28 -0
- package/dist/docs/src/content-vi/components/switch/examples.mdx +35 -0
- package/dist/docs/src/content-vi/components/switch/usage.mdx +44 -0
- package/dist/docs/src/content-vi/foundations/guidelines/accessibility/statement.mdx +4 -2
- package/dist/docs/src/content-vi/foundations/guidelines/accessibility/testing.mdx +1 -1
- package/dist/docs/src/content-vi/foundations/guidelines/accessibility.mdx +1 -1
- package/dist/docs/src/content-vi/foundations/guidelines/content/messages.mdx +67 -0
- package/dist/docs/src/content-vi/foundations/guidelines/content/numbers-dates-and-currency.mdx +71 -0
- package/dist/docs/src/content-vi/foundations/guidelines/content/style-and-grammar.mdx +91 -0
- package/dist/docs/src/content-vi/foundations/guidelines/content/terms.mdx +57 -0
- package/dist/docs/src/content-vi/foundations/guidelines/content/voice-and-tone.mdx +48 -0
- package/dist/docs/src/content-vi/foundations/guidelines/content.mdx +24 -19
- package/dist/docs/src/content-vi/foundations/styles/border.mdx +5 -5
- package/dist/docs/src/content-vi/foundations/styles/color/accessibility.mdx +30 -7
- package/dist/docs/src/content-vi/foundations/styles/color/dark-mode.mdx +65 -6
- package/dist/docs/src/content-vi/foundations/styles/color/palette.mdx +2 -2
- package/dist/docs/src/content-vi/foundations/styles/color/usage.mdx +5 -5
- package/dist/docs/src/content-vi/foundations/styles/data-visualization.mdx +31 -1
- package/dist/docs/src/content-vi/foundations/styles/elevation.mdx +2 -2
- package/dist/docs/src/content-vi/foundations/styles/icons/accessibility.mdx +1 -1
- package/dist/docs/src/content-vi/foundations/styles/icons/code.mdx +1 -1
- package/dist/docs/src/content-vi/foundations/styles/icons/library.mdx +2 -2
- package/dist/docs/src/content-vi/foundations/styles/icons/usage.mdx +0 -3
- package/dist/docs/src/content-vi/foundations/styles/interaction-states.mdx +54 -12
- package/dist/docs/src/content-vi/foundations/styles/layout/app-frame.mdx +4 -9
- package/dist/docs/src/content-vi/foundations/styles/layout/grid.mdx +1 -1
- package/dist/docs/src/content-vi/foundations/styles/layout/overlays.mdx +3 -0
- package/dist/docs/src/content-vi/foundations/styles/logos/downloads-and-terms.mdx +3 -3
- package/dist/docs/src/content-vi/foundations/styles/motion.mdx +2 -0
- package/dist/docs/src/content-vi/foundations/styles/radius.mdx +38 -27
- package/dist/docs/src/content-vi/foundations/styles/size-and-density.mdx +7 -6
- package/dist/docs/src/content-vi/foundations/styles/spacing.mdx +1 -1
- package/dist/docs/src/content-vi/foundations/styles/typography/code.mdx +1 -1
- package/dist/docs/src/content-vi/foundations/styles/typography/usage.mdx +7 -0
- package/dist/docs/src/content-vi/foundations/styles/z-index.mdx +3 -16
- package/dist/docs/src/content-vi/foundations/tokens/all-tokens.mdx +51 -2
- package/dist/docs/src/content-vi/foundations/tokens/index.mdx +90 -5
- package/dist/docs/src/content-vi/get-started/content.mdx +36 -0
- package/dist/docs/src/content-vi/get-started/design.mdx +49 -0
- package/dist/docs/src/content-vi/get-started/develop.mdx +110 -0
- package/dist/docs/src/content-vi/get-started/get-help.mdx +35 -0
- package/dist/docs/src/content-vi/get-started/index.mdx +49 -0
- package/dist/docs/src/content-vi/release-phases/index.mdx +11 -0
- package/dist/docs/src/content-vi/tools/ai-agents.mdx +36 -0
- package/dist/docs/src/content-vi/tools/ant-design-vue-theme.mdx +676 -0
- package/dist/docs/src/content-vi/tools/application-content.mdx +171 -0
- package/dist/docs/src/content-vi/tools/editors.mdx +254 -0
- package/dist/docs/src/content-vi/tools/eslint.mdx +15 -0
- package/dist/docs/src/content-vi/tools/index.mdx +7 -0
- package/dist/docs/src/content-vi/tools/mermaid.mdx +179 -0
- package/dist/docs/src/content-vi/tools/stylelint.mdx +18 -0
- package/dist/docs/src/content-vi/tools/vueflow.mdx +189 -0
- package/dist/docs/src/content.config.ts +12 -1
- package/dist/docs/src/lib/dates.ts +8 -0
- package/dist/docs/src/lib/i18n.ts +1 -0
- package/dist/docs/src/lib/navigation.ts +6 -4
- package/dist/docs/src/lib/token-descriptions-vi.ts +247 -11
- package/dist/docs/src/lib/tokens.ts +3 -0
- package/dist/docs/src/styles/chrome.css +8 -8
- package/dist/docs/src/styles/color.css +31 -31
- package/dist/docs/src/styles/docs.css +55 -40
- package/dist/docs/src/styles/elevation.css +1 -1
- package/dist/docs/src/styles/global.css +13 -4
- package/dist/docs/src/styles/icons.css +16 -16
- package/dist/docs/src/styles/kit.css +29 -10
- package/dist/docs/src/styles/layout.css +16 -11
- package/dist/docs/src/styles/logos.css +24 -24
- package/dist/docs/src/styles/opacity.css +3 -3
- package/dist/docs/src/styles/rules.css +24 -0
- package/dist/docs/src/styles/shapes.css +2 -2
- package/dist/docs/src/styles/tokens.css +228 -147
- package/dist/docs/src/styles/tokens.js +88 -62
- package/dist/docs/src/styles/typography.css +9 -9
- package/dist/docs/src/styles/zindex.css +6 -5
- package/dist/docs/tokens/color.json +24 -14
- package/dist/docs/tokens/components.json +39 -0
- package/dist/docs/tokens/content.json +103 -10
- package/dist/docs/tokens/diagram.json +490 -49
- package/dist/docs/tokens/editor.json +128 -22
- package/dist/docs/tokens/flow.json +412 -80
- package/dist/docs/tokens/layout.json +13 -4
- package/dist/docs/tokens/motion.json +11 -0
- package/dist/docs/tokens/radius.json +9 -9
- package/dist/docs/tokens/renderer.json +8 -0
- package/dist/docs/tokens/resize.json +84 -15
- package/dist/docs/tokens/scrollbar.json +42 -7
- package/dist/docs/tokens/size.json +6 -6
- package/dist/docs/tokens/spacing.json +1 -1
- package/dist/docs/tokens/switch.json +314 -59
- package/dist/docs/tokens/typography.json +1 -1
- package/dist/docs/tokens/visualization.json +465 -53
- package/dist/docs/tokens/z-index.json +0 -10
- package/dist/index.js +908 -208
- package/package.json +1 -1
- package/dist/docs/src/brand/structure-proposal.md +0 -227
- package/dist/docs/src/content/components/button/code.mdx +0 -34
|
@@ -4,6 +4,19 @@ description: Source-backed Mermaid configuration, descriptive execution states,
|
|
|
4
4
|
order: 6
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
+
import NativeFlowDemo from '../../components/NativeFlowDemo.astro';
|
|
8
|
+
|
|
9
|
+
## Native anatomy and execution demonstration
|
|
10
|
+
|
|
11
|
+
<NativeFlowDemo />
|
|
12
|
+
|
|
13
|
+
This is the public native compact model rendered by Mermaid, not a set of HTML
|
|
14
|
+
lookalike cards. Switch execution evidence off to inspect the untouched definition;
|
|
15
|
+
the example's run readings are explicitly sample data, not business-success claims.
|
|
16
|
+
Change the site theme/language, direction and zoom, select with a pointer or keyboard,
|
|
17
|
+
then export the actual SVG. Category masks, native shapes, edge labels and typed
|
|
18
|
+
state geometry survive those changes.
|
|
19
|
+
|
|
7
20
|
Use `@beehexa/mermaid-tokens` for every Mermaid initialization. It returns a fresh
|
|
8
21
|
`MermaidConfig` from `@beehexa/design-tokens`; Mermaid remains a peer dependency.
|
|
9
22
|
Pass the active `dark` and `locale` on every render. A theme or language change
|
|
@@ -67,11 +80,18 @@ export. Add `hx-flow` to the SVG root and bind `workerFlowSvgStyle(canvas)` from
|
|
|
67
80
|
and typed state line-work remain native; the adapter owns literal source paint,
|
|
68
81
|
neutral category tile/glyph pairs and the canonical tile radius.
|
|
69
82
|
|
|
70
|
-
The
|
|
71
|
-
|
|
72
|
-
the
|
|
73
|
-
|
|
74
|
-
|
|
83
|
+
The native model now encloses the complete escaped title in renderer-owned `<b>`
|
|
84
|
+
and separates secondary `KEY · TYPE` metadata with its native `<br>`. The adapter
|
|
85
|
+
binds the entire title to `font.heading.xsmall` and metadata to `font.body.small`;
|
|
86
|
+
wrapping never changes a title line into metadata. Source supplies the fixed
|
|
87
|
+
category tile/glyph dimensions and neutral pair, without replacing native shapes,
|
|
88
|
+
family masks, state markers or compact/public address mapping. Authored markup
|
|
89
|
+
remains escaped; a consumer must not mutate labels or substitute an emitter.
|
|
90
|
+
|
|
91
|
+
This anatomy is implemented in the canonical model source. The pinned published
|
|
92
|
+
model predates the full-title implementation; local verification uses its built
|
|
93
|
+
public export through `HEXASYNC_LOCAL_PACKAGES=1`, not a source alias. A local
|
|
94
|
+
build is not a claim that the model or this site has been released.
|
|
75
95
|
Embedded SVG CSS also supplies opaque source edge-label pairs and explicit
|
|
76
96
|
`"cv05", "cv08"` features alongside the complete font shorthand; SVG/export must
|
|
77
97
|
not depend on the document's universal font-feature rule.
|
|
@@ -113,9 +133,10 @@ state, not an execution-status colour; native focus/keyboard behavior stays inta
|
|
|
113
133
|
|
|
114
134
|
Rectangular node/cluster/actor/note surfaces, execution cards, category tiles and
|
|
115
135
|
small label surfaces use `radius.100` (8 px), including SVG export. Circles,
|
|
116
|
-
diamonds and edge paths retain topology geometry.
|
|
117
|
-
|
|
118
|
-
`radius.150` (12 px).
|
|
136
|
+
diamonds and edge paths retain topology geometry. Inspector cards remain 8 px.
|
|
137
|
+
Viewport docks use an 8 px frame with 4 px padding and actual 4 px control
|
|
138
|
+
buttons, not 8 px Button corners. Dialogs/drawers use `radius.150` (12 px).
|
|
139
|
+
Follow the [Radius role scale](/foundations/styles/radius/).
|
|
119
140
|
|
|
120
141
|
Authoring previews use `diagram.preview-height` for both split panels and
|
|
121
142
|
`diagram.minimum-height` for the drawing viewport; fullscreen fills the enclosing
|
|
@@ -140,6 +161,12 @@ application theme changes before the new drawing lands. Fonts, locale line heigh
|
|
|
140
161
|
state paint and outer selection geometry must survive SVG/PNG capture. A transparent
|
|
141
162
|
image or white sheet behind dark labels is not a valid fallback.
|
|
142
163
|
|
|
164
|
+
The native demo snapshots its opaque canvas colour onto each completed SVG before
|
|
165
|
+
export. Both the supported published model's plain `<p>` labels and local rich
|
|
166
|
+
`<b>` titles retain one completion/reached/unfinished/failure glyph, not colour
|
|
167
|
+
alone. Embedded body/title font shorthands explicitly retain Source `font.features`,
|
|
168
|
+
so standalone downloads do not depend on document-wide token CSS for character variants.
|
|
169
|
+
|
|
143
170
|
All package source is in `tokens/diagram.json`; consumers must not maintain a
|
|
144
171
|
second palette or copy generated token values. Local package references are for
|
|
145
172
|
local development only until an authorized release exists.
|
|
@@ -172,7 +199,7 @@ but two executed endpoints alone do not prove a typed traversal.
|
|
|
172
199
|
## Shared drawing viewport and dock
|
|
173
200
|
|
|
174
201
|
Data Flow is the canonical canvas reference: `diagram.canvas` and `diagram.grid`,
|
|
175
|
-
with
|
|
202
|
+
with `diagram.grid-gap` (16 px) grid spacing and `diagram.grid-dot` (1 px) dots in camera coordinates. These are graph
|
|
176
203
|
geometry, not reader-target dimensions. `.bh-diagram-viewport` supplies the Source
|
|
177
204
|
dot pattern; bind its `--bh-canvas-grid-x`, `--bh-canvas-grid-y` and
|
|
178
205
|
`--bh-canvas-grid-scale` to the existing camera. The SVG root and default stage
|
|
@@ -188,3 +215,9 @@ blank band. Stop pointer/wheel/non-Escape keyboard propagation on the dock,
|
|
|
188
215
|
preserving native focus, popups and overlay Escape handling. Keep genuine action
|
|
189
216
|
differences; do not copy Data Flow-only actions into Mermaid.
|
|
190
217
|
|
|
218
|
+
The complete native Space role combination keeps both Source insets inside the
|
|
219
|
+
allocated viewport, including below-readable-minimum hosts. Its width constraint
|
|
220
|
+
takes precedence over the generic control-group width. Keep one native horizontal
|
|
221
|
+
scroll row so every action remains fully reachable at larger reader roots; do not
|
|
222
|
+
clip the last action or override the dock width in a consumer.
|
|
223
|
+
|
|
@@ -77,6 +77,45 @@ must not overwrite category identity, hide an error, or be conveyed only through
|
|
|
77
77
|
Resting handles use the neutral icon role. Focus color is reserved for actual focus,
|
|
78
78
|
not an always-on connector decoration.
|
|
79
79
|
|
|
80
|
+
## Native WorkflowViewer anatomy
|
|
81
|
+
|
|
82
|
+
Keep the actual `WorkflowViewer` / `WorkflowNodeCard` and provide its public
|
|
83
|
+
`NodeLook`: title, subtitle, kind, caption, category icon, source/destination
|
|
84
|
+
logos, domain indicators and optional typed execution. The Source companion
|
|
85
|
+
`.bh-workflow-canvas` binds those existing slots to complete Source roles:
|
|
86
|
+
`font.heading.xsmall` for the fully wrapped title, `font.body.default` for the
|
|
87
|
+
description and `font.body.small` for kind, caption and indicators. The fixed
|
|
88
|
+
neutral category tile is not a run-state badge. Do not replace a rich native
|
|
89
|
+
node with its ID or a plain rectangle in order to apply tokens.
|
|
90
|
+
Native stadium nodes grow to their content's intrinsic width within the existing
|
|
91
|
+
native minimum and maximum. Short terminal titles remain whole beside their category
|
|
92
|
+
glyph and optional execution marker. Keep the native maximum; do not remove a marker,
|
|
93
|
+
clip a title or add consumer-specific terminal widths.
|
|
94
|
+
|
|
95
|
+
`NodeLook.execution` is absent for definitions. Typed states retain their
|
|
96
|
+
`diagram.*` fill/stroke/text pairs and native non-colour marker; the not-taken
|
|
97
|
+
boundary is dashed. Selection, hover and keyboard focus stay on independent
|
|
98
|
+
outer-ring geometry, so a selected failed node remains visibly failed.
|
|
99
|
+
Repetition, connector logos and group disclosure remain domain metadata.
|
|
100
|
+
|
|
101
|
+
The real native live demo belongs to the
|
|
102
|
+
[`workflow-canvas` producer playground](https://github.com/hexasync-saas/workflow-canvas#native-source-anatomy-playground),
|
|
103
|
+
not a replacement renderer embedded here. In that checkout run
|
|
104
|
+
`npm ci && npm run playground -- --host 127.0.0.1 --port 5174` and open
|
|
105
|
+
`http://127.0.0.1:5174/?anatomy`. It reuses the existing nine-node credential,
|
|
106
|
+
38-node RPA and loop fixtures with theme/language controls, explicit sample
|
|
107
|
+
typed execution, long title/metadata, native ports, selection and native PNG
|
|
108
|
+
export. Build Source packages first and prepend `HEXASYNC_LOCAL_PACKAGES=1`
|
|
109
|
+
to verify unpublished adapter anatomy from built public exports. Default
|
|
110
|
+
playground installs remain registry-only; Source site CI needs no access to
|
|
111
|
+
the private native canvas package. The [Mermaid demonstration](/tools/mermaid/)
|
|
112
|
+
runs here using its public native model and the same Source anatomy roles.
|
|
113
|
+
|
|
114
|
+
Routing stays in the native canvas. Unpinned edges select attachment sides from
|
|
115
|
+
the current measured layout; authored source/target pins remain authoritative.
|
|
116
|
+
After dragging a task or expanding a group, do not repin every edge to one side
|
|
117
|
+
or resurrect a downstream layout processor to hide an attachment defect.
|
|
118
|
+
|
|
80
119
|
## Custom content and geometry
|
|
81
120
|
|
|
82
121
|
Use `getFlowNodeStyles(NodeType, state)` for custom node bodies. It binds semantic fonts,
|
|
@@ -113,11 +152,21 @@ not palette values. Do not arbitrarily round them to the spacing scale. Category
|
|
|
113
152
|
must not mutate the graph's IDs, expansion state, saved positions or relationship semantics.
|
|
114
153
|
|
|
115
154
|
Ordinary node bodies, MiniMap cards and Controls frames use `radius.100` (8 px).
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
155
|
+
Their actual control buttons use `radius.050` (4 px), without clipping focus;
|
|
156
|
+
4 px frame padding nests those control corners inside the 8 px frame. Connector
|
|
157
|
+
logos retain their nested `radius.075` (6 px). Decision and loop nodes keep their
|
|
158
|
+
true circular geometry, as do connection handles; edge-routing radius remains
|
|
159
|
+
path geometry. Inspector cards remain 8 px and dialogs/drawers use
|
|
160
|
+
`radius.150` (12 px). The native WorkflowDock shares this compact frame/control
|
|
161
|
+
family and floats inside the viewport, default lower-left, outside camera
|
|
162
|
+
transforms; never replace it with a full-width toolbar band. Text-editor headers
|
|
163
|
+
remain intrinsic document chrome. Follow the [Radius role scale](/foundations/styles/radius/).
|
|
164
|
+
The native dock's zoom-menu surface uses `radius.overlay` (8 px), independently
|
|
165
|
+
of compact Buttons and menu items; do not derive it from a button radius plus
|
|
166
|
+
a fixed pixel offset. Keep native MiniMap/legend surfaces at
|
|
167
|
+
`radius.100` and the actual keyboard-shortcuts Dialog at `radius.150`; its close
|
|
168
|
+
Button still uses `radius.050`. These role bindings belong to the Source companion,
|
|
169
|
+
not per-viewer CSS or a global chrome-radius change.
|
|
121
170
|
|
|
122
171
|
Bind the user's high-contrast setting to `data-bh-high-contrast="true"` on the actual
|
|
123
172
|
`bh-vue-flow` host. The companion CSS widens node/edge/path, button and custom
|
|
@@ -169,8 +218,8 @@ background or independent system-font palette. Preserve snapshot/fit/restore, ov
|
|
|
169
218
|
resolution feedback and capture fallback handling. Check the real exported image, not just a
|
|
170
219
|
successful capture call.
|
|
171
220
|
|
|
172
|
-
Graph fullscreen uses an isolated local stacking context at `z-index.modal` (400),
|
|
173
|
-
|
|
221
|
+
Graph fullscreen uses an isolated local stacking context at `z-index.modal` (400), like
|
|
222
|
+
other fullscreen surfaces, so global inspectors opened from it stay above it. Private child chrome
|
|
174
223
|
ordering such as z10/z15 stays inside that context; do not assign global1001/1002
|
|
175
224
|
to graph controls. Verify real inspector/dialog ordering, Escape and focus return.
|
|
176
225
|
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Nút đạt WCAG 2.2 AA thế nào, các phím, những gì nút có sẵn và những gì đội của bạn cần làm.
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
## Mức tuân thủ
|
|
6
|
+
|
|
7
|
+
**Nút đạt WCAG 2.2 mức AA khi được dùng như mô tả trên trang này.** Nút theo [mẫu Button](https://www.w3.org/WAI/ARIA/apg/patterns/button/) của WAI-ARIA Authoring Practices.
|
|
8
|
+
|
|
9
|
+
## Bàn phím
|
|
10
|
+
|
|
11
|
+
| Phím | Tác dụng |
|
|
12
|
+
| --- | --- |
|
|
13
|
+
| <kbd>Tab</kbd> | Đưa focus tới nút. Nút vô hiệu bị bỏ qua. |
|
|
14
|
+
| <kbd>Enter</kbd> hoặc <kbd>Space</kbd> | Kích hoạt nút. |
|
|
15
|
+
|
|
16
|
+
## Những gì nút có sẵn
|
|
17
|
+
|
|
18
|
+
- Phần tử `<button>` gốc với `type="button"`, nên có sẵn vai trò, cách dùng bàn phím và focus của một nút.
|
|
19
|
+
- Vòng focus 2 px màu `color.border.focus`, cách nút 2 px (`border.width.focused`, `state.focus.offset`).
|
|
20
|
+
- Chiều cao 24, 32 và 40 px, đều đạt vùng chạm tối thiểu 24 × 24 px; trên màn hình cảm ứng, vùng chạm tăng lên 44 × 44 px (`size.target.touch`).
|
|
21
|
+
- Chữ và nền đạt 4.5:1 ở mọi trạng thái trừ vô hiệu, ở giao diện sáng và tối.
|
|
22
|
+
- Trạng thái vô hiệu bị bỏ khỏi thứ tự Tab và được đọc là không dùng được.
|
|
23
|
+
|
|
24
|
+
## Những gì đội của bạn cần làm
|
|
25
|
+
|
|
26
|
+
- **Đặt tên.** Bắt đầu nhãn bằng động từ: "Đồng bộ đơn hàng", không viết "OK". Nút chỉ có icon cần `aria-label` nói rõ thao tác, như "Xóa cửa hàng".
|
|
27
|
+
- **Dùng liên kết để chuyển trang.** Nút làm một việc; liên kết dẫn tới một trang.
|
|
28
|
+
- **Nói điều đã xảy ra.** Khi nút hiện trạng thái đang xử lý, hãy thông báo kết quả khi xong, ví dụ bằng toast hoặc live region: "Đã đồng bộ đơn hàng".
|
|
29
|
+
- **Tránh vô hiệu hóa.** Nút vô hiệu không giải thích được vì sao. Nên giữ nút hoạt động và chỉ ra điều còn thiếu khi người dùng bấm.
|
|
30
|
+
- **Nút bật/tắt** đặt `aria-pressed="true"` hoặc `"false"`, hoặc đổi nhãn, như "Tạm dừng" và "Phát".
|
|
31
|
+
|
|
32
|
+
## Tiêu chí WCAG
|
|
33
|
+
|
|
34
|
+
| Tiêu chí | Mức | Nút đáp ứng thế nào |
|
|
35
|
+
| --- | --- | --- |
|
|
36
|
+
| 1.4.3 Contrast (Minimum) | AA | Nhãn đạt 4.5:1 ở mọi trạng thái đang dùng được |
|
|
37
|
+
| 1.4.11 Non-text Contrast | AA | Viền và vòng focus đạt 3:1 |
|
|
38
|
+
| 2.1.1 Keyboard | A | Nút gốc: Tab, Enter và Space |
|
|
39
|
+
| 2.4.7 Focus Visible | AA | Vòng focus 2 px khi `:focus-visible` |
|
|
40
|
+
| 2.5.3 Label in Name | A | Tên truy cập là nhãn nhìn thấy |
|
|
41
|
+
| 2.5.8 Target Size (Minimum) | AA | Mọi chiều cao đều ít nhất 24 px |
|
|
42
|
+
| 4.1.2 Name, Role, Value | A | Vai trò nút gốc; tên từ nhãn hoặc `aria-label` |
|
|
43
|
+
|
|
44
|
+
## Kiểm tra
|
|
45
|
+
|
|
46
|
+
| Kiểm tra | Trạng thái | Ngày |
|
|
47
|
+
| --- | --- | --- |
|
|
48
|
+
| Tự động (axe, WCAG 2.2 AA), sáng và tối | Đạt | 4 tháng 11 năm 2026 |
|
|
49
|
+
| Bàn phím | Đạt | 4 tháng 11 năm 2026 |
|
|
50
|
+
| Vùng chạm, cỡ màn hình điện thoại | Đạt | 4 tháng 11 năm 2026 |
|
|
51
|
+
| Trình đọc màn hình (NVDA, VoiceOver) | Dự kiến | |
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
---
|
|
3
|
+
import CodeExample from '../../../components/CodeExample.astro';
|
|
4
|
+
|
|
5
|
+
## Mặc định
|
|
6
|
+
|
|
7
|
+
<CodeExample code={`<button class="bh-button" type="button">Hủy</button>`} />
|
|
8
|
+
|
|
9
|
+
## Chính
|
|
10
|
+
|
|
11
|
+
Mỗi màn hình dùng một nút chính cho thao tác quan trọng nhất.
|
|
12
|
+
|
|
13
|
+
<CodeExample code={`<button class="bh-button bh-button-primary" type="button">Lưu thay đổi</button>`} />
|
|
14
|
+
|
|
15
|
+
## Nguy hiểm
|
|
16
|
+
|
|
17
|
+
<CodeExample code={`<button class="bh-button bh-button-danger" type="button">Xóa tích hợp</button>`} />
|
|
18
|
+
|
|
19
|
+
## Nhẹ
|
|
20
|
+
|
|
21
|
+
Cho thao tác trong thanh công cụ hoặc hàng dày đặc.
|
|
22
|
+
|
|
23
|
+
<CodeExample code={`<button class="bh-button bh-button-subtle" type="button">Lọc</button>`} />
|
|
24
|
+
|
|
25
|
+
## Vô hiệu
|
|
26
|
+
|
|
27
|
+
<CodeExample code={`<button class="bh-button bh-button-primary" type="button" disabled>Lưu thay đổi</button>`} />
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
---
|
|
3
|
+
|
|
4
|
+
## Khi nào dùng
|
|
5
|
+
|
|
6
|
+
- Để thực hiện một thao tác: lưu, gửi, đồng bộ, xóa.
|
|
7
|
+
- Để mở hộp thoại hoặc bắt đầu một luồng.
|
|
8
|
+
|
|
9
|
+
## Khi nào không dùng
|
|
10
|
+
|
|
11
|
+
- Để chuyển sang trang khác. Dùng liên kết.
|
|
12
|
+
- Cho nhiều thao tác liền nhau. Gom các thao tác ít dùng vào menu thả xuống.
|
|
13
|
+
|
|
14
|
+
## Biến thể
|
|
15
|
+
|
|
16
|
+
| Biến thể | Dùng cho | Màu |
|
|
17
|
+
| --- | --- | --- |
|
|
18
|
+
| Mặc định | Phần lớn thao tác, và mọi thao tác phụ đặt cạnh nút chính | `color.surface`, `color.border`, `color.text` |
|
|
19
|
+
| Chính | Thao tác chính duy nhất trên một màn hình | `color.background.primary` với `color.text.inverse`. Ở giao diện tối nút có nền xám ghi sáng và chữ tối; đó là chủ ý, không phải lý do đổi sang màu xanh |
|
|
20
|
+
| Nguy hiểm | Thao tác xóa hoặc không thể hoàn tác | `color.background.danger.bold` với `color.text.on-bold` |
|
|
21
|
+
| Nhẹ | Thao tác trong thanh công cụ hay hàng dày đặc, nơi viền gây rối mắt | Trong suốt khi nghỉ; dùng nền trung tính nhạt khi hover và khi nhấn |
|
|
22
|
+
|
|
23
|
+
- Nút không có bóng khi nghỉ. Dấu hiệu chiều sâu duy nhất là vòng focus, luôn hiện ở mọi biến thể.
|
|
24
|
+
- Icon đặt trước nhãn, cách nhau khoảng cách control (`space.control.gap`). Nút chỉ có icon cần tên; xem [Khả năng tiếp cận](/vi/components/button/accessibility/).
|
|
25
|
+
- Khi đang xử lý, nút giữ nguyên màu, không mờ đi. Nút vô hiệu dùng màu vô hiệu, không dùng độ trong suốt.
|
|
26
|
+
|
|
27
|
+
## Cách dùng tốt nhất
|
|
28
|
+
|
|
29
|
+
- Bắt đầu nhãn bằng động từ và giữ ngắn: "Đồng bộ đơn hàng".
|
|
30
|
+
- Đặt nút chính ở cuối nhóm, bên phải.
|
|
31
|
+
- Hỏi xác nhận trước các thao tác xóa hay không thể hoàn tác.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Hành vi với bàn phím, con trỏ, cảm ứng và công nghệ hỗ trợ của ô kéo giãn."
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
## Ngữ nghĩa của thanh chia
|
|
6
|
+
|
|
7
|
+
Component gốc sở hữu phần tử nhận focus `role="separator"`. Bên dùng cung cấp
|
|
8
|
+
`separatorLabel` đã dịch và đúng ngữ cảnh, ví dụ “Đổi kích thước mã nguồn và xem trước”.
|
|
9
|
+
Không đặt thêm tay nắm kéo nhận focus bên trong nó, và không thay tên của nó bằng một ký
|
|
10
|
+
hiệu. Component gốc cấp ID ô duy nhất, an toàn khi render phía server, `aria-controls` cho
|
|
11
|
+
ô thứ nhất, và các thuộc tính giá trị/min/max dạng phần trăm. `aria-orientation` mô tả
|
|
12
|
+
**đường chia**: dọc khi hai ô trái/phải (horizontal), ngang khi hai ô trên/dưới (vertical).
|
|
13
|
+
|
|
14
|
+
Bố cục ẩn ô thứ hai hoặc có giới hạn cố định không có thanh chia hiển thị hay với tới được.
|
|
15
|
+
Nội dung ô thứ hai bị ẩn bằng display và inert nhưng vẫn giữ trong DOM. Muốn thu gọn sát
|
|
16
|
+
mép thật thì cần `min=0`; nội dung đã thu gọn vẫn giữ trong DOM và bị cắt phần tràn, nhưng
|
|
17
|
+
inert và bị loại khỏi cây trợ năng. Tab/Shift+Tab phải bỏ qua các control được giữ lại
|
|
18
|
+
trong đó. Khôi phục ô sẽ trả lại khả năng nhận focus gốc như thường, không thay control hay
|
|
19
|
+
trạng thái cục bộ của chúng.
|
|
20
|
+
|
|
21
|
+
## Thay thế thao tác kéo bằng bàn phím
|
|
22
|
+
|
|
23
|
+
- Trái/Phải di chuyển thanh chia khi chia trái/phải.
|
|
24
|
+
- Lên/Xuống di chuyển thanh chia khi chia trên/dưới.
|
|
25
|
+
- Mỗi lần bấm mũi tên di chuyển 1 điểm phần trăm; Shift+mũi tên di chuyển 10.
|
|
26
|
+
- Home và End chọn giới hạn dưới và trên hiện tại.
|
|
27
|
+
- Enter đặt lại tỉ lệ ban đầu, trong giới hạn hiện tại. Nhấp đúp cho con trỏ cũng đặt
|
|
28
|
+
lại như vậy, và không lan sự kiện vào ô.
|
|
29
|
+
- Giữ phím lặp tạo thành một vòng đời kéo giãn; thả phím được hỗ trợ hoặc rời thanh chia
|
|
30
|
+
sẽ kết thúc vòng đời đó. Phím tắt không liên quan không bị chặn.
|
|
31
|
+
|
|
32
|
+
Điểm đặt lại được ghi nhận khi component được tạo. Các cập nhật model, thay đổi container
|
|
33
|
+
và đổi hướng theo màn hình về sau không định nghĩa lại nó. Vòng focus hiển thị, lấy từ
|
|
34
|
+
token, nằm trên tay nắm. Dùng cùng một bố cục cho bàn phím, con trỏ và cảm ứng; không để
|
|
35
|
+
control đã vô hiệu vẫn nhận cử chỉ.
|
|
36
|
+
|
|
37
|
+
## Con trỏ và cảm ứng
|
|
38
|
+
|
|
39
|
+
Đường chia mảnh lấy từ token không phải vùng bấm. Vùng bấm trải theo trục vuông góc, lớn
|
|
40
|
+
lên từ `resize.target` thành `resize.touchTarget` với con trỏ thô, và chỉ dùng
|
|
41
|
+
`touch-action: none` trên bề mặt cử chỉ. Pointer capture và lớp chắn cục bộ phía trên các
|
|
42
|
+
ô tránh để editor/iframe chặn cử chỉ; việc chặn chọn chữ chỉ trong lúc kéo tránh bôi chọn
|
|
43
|
+
nội dung ô. Các control khác và document không bị ghi đè con trỏ hay vùng chọn vĩnh viễn.
|
|
44
|
+
|
|
45
|
+
Thả con trỏ, huỷ con trỏ, mất capture, cửa sổ mất focus, giới hạn bị ẩn/khoá và đổi hướng
|
|
46
|
+
đều kết thúc cử chỉ. Khi huỷ, tỉ lệ hợp lệ cuối cùng được giữ. Khi gỡ component, capture,
|
|
47
|
+
listener của document/window, các observer và việc bố cục đang chờ đều được gỡ. Mỗi
|
|
48
|
+
instance tự sở hữu trạng thái của nó.
|
|
49
|
+
|
|
50
|
+
## Tương phản, chuyển động và tuỳ chọn đọc
|
|
51
|
+
|
|
52
|
+
Tay nắm luôn nằm trên các ô bị cắt độc lập ở cả hai trục. Mặc định đường chia nằm giữa với
|
|
53
|
+
độ dài 90%, và tay nắm ở điểm giữa, không ở mép nơi có thể bị một ô che mất. Màu active và
|
|
54
|
+
focus dùng vai trò resize gốc và giá trị token sáng/tối; ở chế độ forced colors vẫn giữ
|
|
55
|
+
viền/chỉ báo focus bằng màu hệ thống. Phóng chữ theo rem của người đọc ảnh hưởng tới vùng
|
|
56
|
+
bấm và tay nắm có kích thước theo token. Không có hiệu ứng chuyển tiếp khi kéo giãn ở chế
|
|
57
|
+
độ giảm chuyển động (và cả khi kéo bình thường). Đổi ngôn ngữ cập nhật nhãn do bên dùng
|
|
58
|
+
cung cấp mà không dựng lại editor, model hay trạng thái zoom bên trong.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Lịch sử triển khai gốc của component ô kéo giãn cho Vue."
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
## Triển khai gốc
|
|
6
|
+
|
|
7
|
+
- Thêm `ResizablePanel` Vue 3 thật trong `@beehexa/vue-components`, độc lập với Ant Design Vue.
|
|
8
|
+
- Thêm bố cục hai trục có giới hạn, tỉ lệ/giới hạn/trạng thái hiện phản ứng theo dữ liệu, và giữ nguyên instance trong slot.
|
|
9
|
+
- Thêm chế độ truy cập tài liệu `preserveMinimum` chỉ định rõ: giữ mức tối thiểu đã cấu hình của các ô cộng rãnh tương tác thật khi phần khung trang chiếm hết chỗ; giữ nguyên cách nới giới hạn mặc định và các phần tử con.
|
|
10
|
+
- Cho lớp bọc ô thành flex container dạng cột co lại được, để Card, Monaco và canvas có giới hạn lấp đầy ô thay vì co về chiều cao tự nhiên.
|
|
11
|
+
- Thêm đường chia dài 90% nằm giữa, với tay nắm ở điểm giữa hiển thị trên lớp cục bộ ở cả hai trục.
|
|
12
|
+
- Dành một rãnh thật có kích thước theo token ở cả hai trục; tỉ lệ/giới hạn pixel của ô và toạ độ con trỏ không tính rãnh, và vùng bấm cho con trỏ thô không còn che thanh cuộn của ô.
|
|
13
|
+
- Thay hoạ tiết tay nắm lặp lại bằng đúng ba chấm tròn theo token gốc, đối xứng và nằm giữa tay nắm (không đổi kích thước) ở cả hai hướng và mọi mức phóng chữ.
|
|
14
|
+
- Cho overlay cố định lồng bên trong dùng chung lớp xếp chồng của phần tử sở hữu overlay thật, thay vì bị kẹt dưới thanh chia anh em bên ngoài. Chỉ giữ stacking context của root/ô trong lúc đang kéo bằng con trỏ, cho lớp chắn iframe cục bộ.
|
|
15
|
+
- Thêm số đo kích thước có kiểu, sau khi bố cục xong, cho thay đổi từ con trỏ, bàn phím, container và code.
|
|
16
|
+
- Thêm pointer capture/huỷ, lớp chắn iframe, giới hạn và đặt lại bằng bàn phím, giá trị thanh chia cho trợ năng, và dọn dẹp khi gỡ.
|
|
17
|
+
- Giữ ô thu gọn sát mép ở trạng thái inert và ngoài cây trợ năng mà vẫn giữ control/trạng thái trong DOM; di chuyển bằng bàn phím trở lại bình thường khi ô được khôi phục.
|
|
18
|
+
- Thêm hỗ trợ sáng/tối theo token gốc, phóng chữ, vùng bấm cho con trỏ thô, giảm chuyển động và forced colors.
|
|
19
|
+
|
|
20
|
+
Trang này mô tả phần triển khai đã viết, không phải một lần phát hành lên registry hay phê duyệt phát hành.
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Export Vue có kiểu, đầy đủ props và vòng đời kéo giãn có số đo."
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import {
|
|
9
|
+
ResizablePanel,
|
|
10
|
+
type ResizablePanelDirection,
|
|
11
|
+
type ResizablePanelResizeEvent,
|
|
12
|
+
} from '@beehexa/vue-components';
|
|
13
|
+
import '@beehexa/vue-components/css';
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Vue 3.5+ là peer; `@beehexa/design-tokens` là gói phụ thuộc duy nhất. Export CSS có kiểu
|
|
17
|
+
cho import side-effect ở chế độ strict và đã gồm CSS token gốc. Component dùng render
|
|
18
|
+
function TypeScript, nên dùng bản ESM đã build không cần trình biên dịch SFC hay Ant Design
|
|
19
|
+
Vue. Dùng tham chiếu gói cục bộ thật cho tới khi có bản phát hành registry được duyệt;
|
|
20
|
+
version gốc `0.0.0` là riêng tư, không phải một version đã phát hành.
|
|
21
|
+
|
|
22
|
+
## Props và slot
|
|
23
|
+
|
|
24
|
+
| Prop | Kiểu | Mặc định | Quy ước |
|
|
25
|
+
| --- | --- | --- | --- |
|
|
26
|
+
| `direction` | `'horizontal'` hoặc `'vertical'` | `'horizontal'` | Hai ô trái/phải hoặc trên/dưới. Bên dùng quyết định breakpoint. |
|
|
27
|
+
| `ratio` | `number` | `0.5` | Tỉ lệ yêu cầu của ô thứ nhất; `v-model:ratio`. |
|
|
28
|
+
| `min` | `number` | `100` | Mức tối thiểu (pixel CSS) cho mỗi ô; dùng `0` để thu gọn sát mép. |
|
|
29
|
+
| `max` | `number` | `Infinity` | Mức tối đa (pixel CSS) của ô thứ nhất. |
|
|
30
|
+
| `preserveMinimum` | `boolean` | `false` | Chế độ truy cập tài liệu chỉ định rõ: giữ `min` sẵn có của mỗi ô cộng rãnh vật lý theo trục đang dùng. Phần tử cha phải cho phép cuộn phần tràn thật; ô có giới hạn thông thường vẫn nới mức tối thiểu. |
|
|
31
|
+
| `minRatio` | `number` | `0` | Tỉ lệ dưới của ô thứ nhất, trong `[0, 1]`. |
|
|
32
|
+
| `maxRatio` | `number` | `1` | Tỉ lệ trên của ô thứ nhất, trong `[0, 1]`. |
|
|
33
|
+
| `secondVisible` | `boolean` | `true` | Ẩn/inert ô thứ hai mà không gỡ khỏi DOM; ô thứ nhất lấp đầy, tỉ lệ được khôi phục khi hiện lại. |
|
|
34
|
+
| `resizerSize` | `string` | `'90%'` | Độ dài CSS/phần trăm của đường chia hiển thị theo trục vuông góc, nằm giữa và không vượt độ dài phần tử chứa. |
|
|
35
|
+
| `separatorLabel` | `string` | `'Resize panels'` | Tên truy cập do bên dùng dịch. |
|
|
36
|
+
|
|
37
|
+
`#first` và `#second` cung cấp hai cây con của ô được giữ nguyên. Component không sở hữu
|
|
38
|
+
tiêu đề, model editor, mức zoom biểu đồ, ngôn ngữ ứng dụng hay trạng thái toàn màn hình.
|
|
39
|
+
|
|
40
|
+
Giới hạn pixel tối thiểu được nới đều khi phần tử chứa không đủ chỗ cho cả hai; giới hạn
|
|
41
|
+
tối đa chỉ định rõ thắng giới hạn tối thiểu mâu thuẫn. Giới hạn hiện hành bằng nhau sẽ tắt
|
|
42
|
+
tương tác nhưng giữ rãnh vật lý; giới hạn hai đầu bằng nhau thì ẩn luôn rãnh. Thay đổi giới
|
|
43
|
+
hạn hiện hành huỷ cử chỉ đang diễn ra mà không gỡ ô nào.
|
|
44
|
+
Giới hạn tạm thời của phần tử chứa kẹp bố cục mà không thay tỉ lệ model đã yêu cầu.
|
|
45
|
+
Enter/nhấp đúp đặt lại về tỉ lệ ghi nhận lúc tạo, trong giới hạn hiện tại; thay đổi từ code
|
|
46
|
+
không định nghĩa lại điểm đặt lại đó.
|
|
47
|
+
|
|
48
|
+
## Sự kiện và kiểu
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
type ResizablePanelDirection = 'horizontal' | 'vertical';
|
|
52
|
+
interface ResizablePanelResizeEvent {
|
|
53
|
+
ratio: number;
|
|
54
|
+
direction: ResizablePanelDirection;
|
|
55
|
+
first: { width: number; height: number };
|
|
56
|
+
second: { width: number; height: number };
|
|
57
|
+
source: 'pointer' | 'keyboard' | 'container' | 'programmatic';
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
| Sự kiện | Payload | Khi nào |
|
|
62
|
+
| --- | --- | --- |
|
|
63
|
+
| `update:ratio` | `number` | Con trỏ/bàn phím yêu cầu một tỉ lệ ô thứ nhất trong giới hạn. |
|
|
64
|
+
| `resize-start` | `ResizablePanelResizeEvent` | Bắt đầu kéo bằng con trỏ, bắt đầu cử chỉ bàn phím được hỗ trợ, hoặc bắt đầu đặt lại. |
|
|
65
|
+
| `resize` | `ResizablePanelResizeEvent` | Tỉ lệ đổi do tương tác; đo lần đầu/đo container; model, hướng, trạng thái hiện hay giới hạn đổi từ bên ngoài. |
|
|
66
|
+
| `resize-end` | `ResizablePanelResizeEvent` | Thả/huỷ/mất capture/mất focus cửa sổ, nhả phím/mất focus, đặt lại xong, hoặc cử chỉ bị kết thúc do props thay đổi. |
|
|
67
|
+
|
|
68
|
+
Sự kiện có số đo chạy sau khi Vue cập nhật DOM và sang khung hình kế tiếp. Chiều rộng và
|
|
69
|
+
chiều cao lấy từ hình chữ nhật thật đã render của mỗi ô. Ô thứ hai bị ẩn báo 0; `ratio` vẫn
|
|
70
|
+
là tỉ lệ chia hiệu lực để khôi phục. Sự kiện di chuyển được gộp theo khung hình mà không đảo
|
|
71
|
+
thứ tự start/end. `v-model` của cha phản hồi lại như thường không biến sự kiện của người
|
|
72
|
+
dùng thành sự kiện từ code. Thay đổi từ container và từ code phát `resize` mà không tự tạo
|
|
73
|
+
start/end tương tác.
|
|
74
|
+
|
|
75
|
+
Dùng các kích thước này để bố cục lại editor/biểu đồ/quy trình đang giữ, không phải để đổi
|
|
76
|
+
key, model, zoom hay trạng thái gắn kết của nó. ResizeObserver và mọi listener, capture,
|
|
77
|
+
việc animation frame của cử chỉ đều được dọn khi gỡ component. Import/render phía server an
|
|
78
|
+
toàn; việc theo dõi bố cục bắt đầu khi gắn kết, và ID ô dùng `useId` an toàn SSR của Vue.
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Tích hợp ô chia đôi mã nguồn/xem trước có giới hạn và đổi hướng theo màn hình."
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
## Giữ nguyên mã nguồn và xem trước
|
|
6
|
+
|
|
7
|
+
Import CSS gốc một lần. Cung cấp phần tử cha có giới hạn và giữ các component trong slot
|
|
8
|
+
luôn gắn kết; panel lo việc cắt nội dung, ẩn hiện và cơ chế kéo giãn.
|
|
9
|
+
|
|
10
|
+
```vue
|
|
11
|
+
<script setup lang="ts">
|
|
12
|
+
import { ref } from 'vue';
|
|
13
|
+
import { ResizablePanel, type ResizablePanelResizeEvent } from '@beehexa/vue-components';
|
|
14
|
+
import '@beehexa/vue-components/css';
|
|
15
|
+
|
|
16
|
+
const ratio = ref(0.62);
|
|
17
|
+
const previewVisible = ref(true);
|
|
18
|
+
const sourceHost = ref<HTMLElement>();
|
|
19
|
+
const previewHost = ref<HTMLElement>();
|
|
20
|
+
const paneSizes = ref<ResizablePanelResizeEvent>();
|
|
21
|
+
function resized(event: ResizablePanelResizeEvent) {
|
|
22
|
+
paneSizes.value = event;
|
|
23
|
+
}
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<template>
|
|
27
|
+
<div style="height: 32rem; min-height: 0; min-width: 0">
|
|
28
|
+
<ResizablePanel
|
|
29
|
+
v-model:ratio="ratio"
|
|
30
|
+
:second-visible="previewVisible"
|
|
31
|
+
:min="0"
|
|
32
|
+
separator-label="Đổi kích thước mã nguồn và xem trước"
|
|
33
|
+
@resize="resized"
|
|
34
|
+
>
|
|
35
|
+
<template #first><div ref="sourceHost" style="height: 100%; min-height: 0" /></template>
|
|
36
|
+
<template #second><div ref="previewHost" style="height: 100%; min-height: 0" /></template>
|
|
37
|
+
</ResizablePanel>
|
|
38
|
+
</div>
|
|
39
|
+
</template>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Gắn instance editor/canvas được giữ nguyên vào hai phần tử chứa. Phản ứng với `paneSizes`
|
|
43
|
+
bằng API bố cục gốc của trình hiển thị; giữ nguyên model và mức zoom hiện có. Không thay
|
|
44
|
+
phần tử chứa hay gắn lại model chỉ để phản ứng với thay đổi chiều rộng/chiều cao.
|
|
45
|
+
Với `min=0`, Home/End có thể thu gọn hẳn một ô mà vẫn giữ instance của nó.
|
|
46
|
+
Enter hoặc nhấp đúp thanh chia khôi phục tỉ lệ ban đầu 0.62 trong giới hạn hiện hành.
|
|
47
|
+
|
|
48
|
+
## Đổi hướng theo màn hình và tên đã dịch
|
|
49
|
+
|
|
50
|
+
Ứng dụng vốn đã sở hữu trạng thái breakpoint và ngôn ngữ. Suy ra hướng từ trạng thái đó;
|
|
51
|
+
không đặt key cho panel hay phần tử con theo nó.
|
|
52
|
+
|
|
53
|
+
```vue
|
|
54
|
+
<ResizablePanel
|
|
55
|
+
v-model:ratio="ratio"
|
|
56
|
+
:direction="isMobile ? 'vertical' : 'horizontal'"
|
|
57
|
+
:separator-label="t('resizeSourceAndPreview')"
|
|
58
|
+
:min="100"
|
|
59
|
+
resizer-size="90%"
|
|
60
|
+
@resize="onPaneResize"
|
|
61
|
+
>
|
|
62
|
+
<template #first><SourceEditor /></template>
|
|
63
|
+
<template #second><WorkflowPreview /></template>
|
|
64
|
+
</ResizablePanel>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
`isMobile`, `t`, các component editor/xem trước được giữ nguyên và callback bố cục lại thuộc
|
|
68
|
+
về bên dùng. Thư viện không áp breakpoint ứng dụng hay một singleton dịch thuật nào. Đổi
|
|
69
|
+
theme dùng biến CSS gốc ngay lập tức.
|
|
70
|
+
|
|
71
|
+
Cả hai ví dụ đều dành một rãnh vật lý theo token giữa hai ô. Ở ví dụ đổi hướng, kiểm tra
|
|
72
|
+
có ba chấm dọc nằm giữa trước khi đổi trục và ba chấm ngang nằm giữa sau khi đổi. Kích
|
|
73
|
+
thước tay nắm và vùng bấm không đổi để giả căn giữa; phóng chữ ở root phóng cả đường kính
|
|
74
|
+
chấm và khoảng cách, với lề bằng nhau quanh cả cụm chấm.
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
## Ô cố định/toàn màn hình được giữ nguyên
|
|
78
|
+
|
|
79
|
+
Với bề mặt toàn màn hình chỉ có ô thứ nhất, dùng `min=0` và hai giới hạn tỉ lệ bằng nhau là
|
|
80
|
+
`1`; chỉ có ô thứ hai thì dùng hai giới hạn bằng `0`. Cách này ẩn/tắt thanh chia mà không
|
|
81
|
+
di chuyển hay gỡ phần tử con trong slot. Khôi phục giới hạn thường sẽ khôi phục tỉ lệ chia
|
|
82
|
+
đã yêu cầu. Nếu chỉ cần tạm ẩn ô thứ hai, dùng `secondVisible`. Component không thêm khung
|
|
83
|
+
toàn màn hình hay modal; giữ nguyên hành vi toàn màn hình/overlay gốc của phần tử cha.
|