native-document 1.0.169 → 1.0.173
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/CHANGELOG.md +100 -2
- package/docs/vitepress-conventions.md +2 -2
- package/index.d.ts +1 -1
- package/package.json +11 -4
- package/src/components/BaseComponent.js +43 -1
- package/src/components/accordion/Accordion.js +1 -0
- package/src/components/accordion/AccordionItem.js +1 -0
- package/src/components/alert/Alert.js +4 -0
- package/src/components/avatar/Avatar.js +1 -0
- package/src/components/avatar/AvatarGroup.js +1 -0
- package/src/components/badge/Badge.js +1 -0
- package/src/components/breadcrumb/BreadCrumb.js +4 -0
- package/src/components/button/Button.js +1 -0
- package/src/components/card/Card.js +1 -0
- package/src/components/context-menu/ContextMenu.js +2 -0
- package/src/components/context-menu/ContextMenuGroup.js +2 -0
- package/src/components/context-menu/ContextMenuItem.js +2 -0
- package/src/components/divider/Divider.js +2 -0
- package/src/components/dropdown/Dropdown.js +1 -0
- package/src/components/dropdown/DropdownDivider.js +1 -0
- package/src/components/dropdown/DropdownGroup.js +1 -0
- package/src/components/dropdown/DropdownItem.js +1 -0
- package/src/components/dropdown/DropdownTrigger.js +1 -0
- package/src/components/form/FormControl.js +1 -0
- package/src/components/form/field/Field.js +1 -0
- package/src/components/form/field/types/StringField.js +1 -1
- package/src/components/icon/Icon.js +1 -0
- package/src/components/list/ListItem.js +1 -0
- package/src/components/menu/Menu.js +3 -0
- package/src/components/menu/MenuDivider.js +1 -0
- package/src/components/menu/MenuGroup.js +1 -0
- package/src/components/menu/MenuItem.js +1 -0
- package/src/components/menu/MenuLink.js +1 -0
- package/src/components/modal/Modal.js +4 -0
- package/src/components/pagination/Pagination.js +1 -0
- package/src/components/popover/Popover.js +1 -0
- package/src/components/popover/PopoverFooter.js +1 -0
- package/src/components/popover/PopoverHeader.js +1 -0
- package/src/components/progress/Progress.js +5 -0
- package/src/components/skeleton/Skeleton.js +4 -0
- package/src/components/slider/Slider.js +1 -0
- package/src/components/spacer/Spacer.js +1 -0
- package/src/components/spinner/Spinner.js +1 -0
- package/src/components/splitter/Splitter.js +1 -0
- package/src/components/splitter/SplitterGutter.js +6 -0
- package/src/components/splitter/SplitterPanel.js +1 -0
- package/src/components/stacks/AbsoluteStack.js +1 -0
- package/src/components/stacks/FixedStack.js +1 -0
- package/src/components/stacks/HStack.js +1 -0
- package/src/components/stacks/PositionStack.js +1 -0
- package/src/components/stacks/RelativeStack.js +1 -0
- package/src/components/stacks/Stack.js +1 -0
- package/src/components/stacks/VStack.js +1 -0
- package/src/components/stepper/Stepper.js +1 -0
- package/src/components/stepper/StepperStep.js +1 -0
- package/src/components/switch/Switch.js +1 -0
- package/src/components/table/DataTable.js +1 -0
- package/src/components/table/SimpleTable.js +1 -0
- package/src/components/tabs/Tabs.js +1 -0
- package/src/components/toast/Toast.js +1 -0
- package/src/components/tooltip/Tooltip.js +1 -0
- package/src/core/data/MemoryManager.js +6 -1
- package/src/core/data/ObservableItem.js +33 -15
- package/src/core/data/ObservableObject.js +1 -2
- package/src/core/elements/anchor/anchor.js +4 -3
- package/src/core/elements/anchor/one-child-anchor-overwriting.js +4 -4
- package/src/core/elements/content-formatter.js +19 -0
- package/src/core/elements/control/for-each-array-cache.js +59 -0
- package/src/core/elements/control/for-each-array.js +15 -23
- package/src/core/wrappers/AttributesWrapper.js +12 -12
- package/src/core/wrappers/ElementCreator.js +33 -10
- package/src/core/wrappers/HtmlElementWrapper.js +17 -13
- package/src/core/wrappers/NDElement.js +23 -8
- package/src/core/wrappers/NdPrototype.js +64 -39
- package/src/core/wrappers/constants.js +12 -12
- package/src/core/wrappers/prototypes/nd-element-extensions.js +127 -57
- package/src/core/wrappers/template-cloner/NodeCloner.js +10 -6
- package/src/core/wrappers/template-cloner/TemplateCloner.js +7 -4
- package/src/fetch/NativeFetch.js +1 -0
- package/src/ui/components/accordion/AccordionItemRender.js +29 -7
- package/src/ui/components/alert/AlertRender.js +6 -0
- package/src/ui/components/breadcrumb/BreadcrumbRender.js +9 -1
- package/src/ui/components/button/ButtonRender.js +3 -0
- package/src/ui/components/contextmenu/ContextmenuRender.js +2 -0
- package/src/ui/components/dropdown/DropdownRender.js +3 -0
- package/src/ui/components/dropdown/item/DropdownItemRender.js +6 -1
- package/src/ui/components/form/FieldCollectionRender.js +4 -0
- package/src/ui/components/form/fields/CheckboxFieldRender.js +4 -0
- package/src/ui/components/form/fields/CheckboxGroupFieldRender.js +4 -0
- package/src/ui/components/form/fields/FieldRender.js +1 -1
- package/src/ui/components/form/fields/RadioFieldRender.js +4 -0
- package/src/ui/components/form/fields/RangeFieldRender.js +4 -0
- package/src/ui/components/form/fields/SelectFieldRender.js +5 -0
- package/src/ui/components/form/fields/SliderFieldRender.js +3 -0
- package/src/ui/components/icon/tabler/TablerIconRender.js +0 -1
- package/src/ui/components/list/item/ListItemRender.js +4 -0
- package/src/ui/components/menu/MenuItemRender.js +8 -0
- package/src/ui/components/menu/MenuLinkRender.js +11 -0
- package/src/ui/components/menu/MenuRender.js +5 -0
- package/src/ui/components/menu/helpers.js +2 -1
- package/src/ui/components/modal/ModalRender.js +8 -2
- package/src/ui/components/progress/ProgressRender.js +9 -0
- package/src/ui/components/skeleton/SkeletonRender.js +2 -0
- package/src/ui/components/spinner/SpinnerRender.js +3 -0
- package/src/ui/components/splitter/SplitterGutterRender.js +4 -0
- package/src/ui/components/splitter/SplitterPanelRender.js +4 -0
- package/src/ui/components/splitter/SplitterRender.js +2 -0
- package/src/ui/components/stepper/StepperRender.js +2 -1
- package/src/ui/components/stepper/StepperStepRender.js +8 -1
- package/src/ui/components/switch/SwitchRender.js +3 -0
- package/src/ui/components/table/data-table/DataTableRender.js +4 -0
- package/src/ui/components/table/simple-table/SimpleTableRender.js +2 -0
- package/src/ui/components/toast/ToastRender.js +4 -0
- package/src/ui/utils/aria.js +19 -0
- package/tests/integration/ui/attributes-wrapper.test.js +177 -0
- package/tests/integration/ui/for-each-array.test.js +167 -0
- package/tests/integration/ui/lifecycle.test.js +146 -0
- package/tests/integration/ui/show-if.test.js +168 -0
- package/tests/unit/core/observable-array.test.js +404 -0
- package/tests/unit/core/observable-item.test.js +428 -0
- package/tests/unit/core/observable-object.test.js +239 -0
- package/tests/unit/core/observable-resource.test.js +323 -0
- package/tests/unit/core/store.test.js +347 -0
- package/tests/unit/router/route-matching.test.js +169 -0
- package/tests/unit/router/router-guards.test.js +189 -0
- package/tests/unit/utils/cache.test.js +120 -0
- package/tests/unit/utils/filters.test.js +394 -0
- package/types/elements.d.ts +5 -0
- package/types/native-fetch.d.ts +1 -1
- package/types/observable-resource.d.ts +2 -2
- package/types/observable.d.ts +137 -21
- package/types/service.d.ts +2 -1
- package/utils.js +7 -4
- package/vitest.config.js +15 -0
package/CHANGELOG.md
CHANGED
|
@@ -11,6 +11,101 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
11
11
|
|
|
12
12
|
---
|
|
13
13
|
|
|
14
|
+
## [1.0.173] - 2026-06-18
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- `ObservableItem` TypeScript definitions - `subscribe()` and `on()` no longer
|
|
19
|
+
typed as returning `Unsubscribe`; they return nothing in the actual
|
|
20
|
+
implementation. Use `.unsubscribe(callback)` / `.off(value, callback)` with
|
|
21
|
+
the same reference to remove a subscription.
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
|
|
25
|
+
- `ObservableItem` type definitions - `interceptMutations`, `clone`, `valueOf`
|
|
26
|
+
- `ObservableItem` comparison helpers typed: `isEqualTo`, `isNotEqualTo`,
|
|
27
|
+
`isGreaterThan`, `isGreaterThanOrEqualTo`, `isLessThan`,
|
|
28
|
+
`isLessThanOrEqualTo`, `isBetween`, `isNull`, `isTruthy`, `isFalsy`,
|
|
29
|
+
`isStartingWith`, `isEndingWith`, `isMatchingPattern`, `isEmpty`,
|
|
30
|
+
`isNotEmpty`, `isIncludes`, `isIncludedIn`, `isOneOf`, `isHaving`
|
|
31
|
+
- `ObservableItem` transform helpers typed: `toUpperCase`, `toLowerCase`,
|
|
32
|
+
`toTrimmed`, `toBoolean`, `toLiteral`, `toFormatted`, `toProperty`,
|
|
33
|
+
`toLength`, `toClamped`, `toPercent`
|
|
34
|
+
- `ObservableArray` type definitions - `swapItems`, `insertAfter`, `sync`,
|
|
35
|
+
`clone`, `isNotEmpty`, `indexOf`, `includes`; `deepSubscribe` and `sync`
|
|
36
|
+
correctly typed to return `Unsubscribe`
|
|
37
|
+
- `ObservableObject` type definitions - `$observables()` and `configs()` typed
|
|
38
|
+
as callable methods; `subscribe()` documented as deep-subscribing nested
|
|
39
|
+
observables and observable arrays
|
|
40
|
+
- `ObservableResource` type definitions (previously entirely missing) -
|
|
41
|
+
`ResourceState`, `ObservableResourceConfig`, `data`, `error`, `state`,
|
|
42
|
+
`loading`, `fetch`, `refetch`, `mutate`, `into`, `apply`, `destroy`,
|
|
43
|
+
`isReady`, `isPending`, `isRefreshing`, `isErrored`, `isUnresolved`,
|
|
44
|
+
`onSuccess`, `onError`
|
|
45
|
+
- `ObservableStatic` type definitions - `resource()`, `setLocale()`,
|
|
46
|
+
`useValueProperty()`
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## [1.0.172] - 2026-06-15
|
|
51
|
+
|
|
52
|
+
### Added
|
|
53
|
+
|
|
54
|
+
- `Text(string)` - shorthand for `string.toNdChildren()`, parses Observable placeholders in template strings
|
|
55
|
+
- `String.prototype.toNdChildren()` - splits a string containing `{{obs:N}}` placeholders into a mixed array of strings and resolved Observables
|
|
56
|
+
- `ObservableItem.prototype.toString()` - auto-registers the Observable in MemoryManager and returns `{{obs:id}}`, enabling reactive interpolation via standard template literals
|
|
57
|
+
- `NDElement.prototype.className(classes)` - adds static classes, bypasses AttributesWrapper
|
|
58
|
+
- `NDElement.prototype.class(className, value)` - adds a reactive class binding, bypasses AttributesWrapper
|
|
59
|
+
- `__$isNativeNode` flag on DOM prototypes (`Element`, `Text`, `Comment`, `Document`, `DocumentFragment`) - faster alternative to `instanceof Node`
|
|
60
|
+
- `__$isValidNdChild` flag on all valid NdChild prototypes - single property check replaces multiple type guards
|
|
61
|
+
- `defineToNdElement`, `defineValidNdChild`, `defineNativeNode` - non-enumerable prototype helpers in `nd-element-extensions`
|
|
62
|
+
- camelCase variants added to `BOOLEAN_ATTRIBUTES` - removes `toLowerCase()` call on each attribute in the hot path
|
|
63
|
+
|
|
64
|
+
### Changed
|
|
65
|
+
|
|
66
|
+
- `ElementCreator.processChildren` and `getChild` - refactored for better performance
|
|
67
|
+
- `nd-element-extensions` - all prototype extensions converted to non-enumerable `defineProperty`
|
|
68
|
+
- `AttributesWrapper` - `options` defaults to `null` instead of `{}`, fixes truthy check issue
|
|
69
|
+
- NDElement events - inline handler (`on*`) used when no existing handler and no options; falls back to `addEventListener` for subsequent handlers or when options are provided
|
|
70
|
+
- `_prevent`, `_stop`, `_preventStop` - updated with same inline handler strategy
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## [1.0.170] - 2026-06-10
|
|
75
|
+
|
|
76
|
+
### Added
|
|
77
|
+
|
|
78
|
+
- Vitest test suite - `vitest.config.js`, happy-dom environment, scripts `test`, `test:watch`, `test:ui`, `test:coverage`
|
|
79
|
+
- 372 tests passing across 13 files - 0 failures, 0 todo
|
|
80
|
+
|
|
81
|
+
#### Unit tests - core
|
|
82
|
+
- `observable-item` - 48 cases: set, val, subscribe, on/off, once, toggle, reset, transform, equals, clone, cleanup, intercept, assocTrigger
|
|
83
|
+
- `observable-array` - 48 cases: push, remove, clear, merge, swap, insertAfter, isIncludes, where, sync, clone, reset, deepSubscribe
|
|
84
|
+
- `observable-object` - 30 cases: constructor, val, get, set, subscribe, keys, observables, reset, clone
|
|
85
|
+
- `observable-resource` - 29 cases: states, fetch, refetch, mutate, abort, race condition, deps, onSuccess, onError, into, apply, destroy
|
|
86
|
+
- `store` - 43 cases: create, createResettable, createComposed, use, follow, reset, delete, group, protected, createPersistent
|
|
87
|
+
|
|
88
|
+
#### Unit tests - router
|
|
89
|
+
- `route-matching` - 26 cases: exact path, params, typed params, custom validators, url(), metadata
|
|
90
|
+
- `router-guards` - 14 cases: middleware execution, group middlewares, subscribe, resolve, currentState
|
|
91
|
+
|
|
92
|
+
#### Unit tests - utils
|
|
93
|
+
- `cache` - 12 cases: singleton, once, memoize
|
|
94
|
+
- `filters` - 60 cases: equals, comparison, inArray, isEmpty, match, and/or/not, custom, string filters, date/time filters
|
|
95
|
+
|
|
96
|
+
#### Integration tests - UI
|
|
97
|
+
- `attributes-wrapper` - 22 cases: string, class map, style, Observable, boolean, aria attributes
|
|
98
|
+
- `show-if` - 16 cases: static boolean, observable, factory child, HideIf, HideIfNot
|
|
99
|
+
- `for-each-array` - 13 cases: static array, push, removeItem, clear, set, swap, index observable, order preservation
|
|
100
|
+
- `lifecycle` - 11 cases: mounted, unmounted, destroy, destroyOnUnmount
|
|
101
|
+
|
|
102
|
+
### Fixed
|
|
103
|
+
|
|
104
|
+
- `NDElement.prototype.destroy()` - guard against double call when `$element` is already null
|
|
105
|
+
- `NDElement.prototype.destroy()` - disconnect lifecycle observer to prevent callbacks from firing after destroy
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
14
109
|
## [1.0.169] - 2026-06-06
|
|
15
110
|
|
|
16
111
|
### Added
|
|
@@ -39,7 +134,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
39
134
|
|
|
40
135
|
#### UI (renders)
|
|
41
136
|
- `CardRender` + `card.css` - Card renderer with 5 build slots and `layout(slots)` support
|
|
42
|
-
- `ListRender` + `list.css` - `ForEachArray($desc.items)`
|
|
137
|
+
- `ListRender` + `list.css` - `ForEachArray($desc.items)` - items self-render
|
|
43
138
|
- `ListItemRender` + `list-item.css` - reactive checkbox, select indicator, swipe gesture with pointer events, auto-close and stopPropagation
|
|
44
139
|
- `ListGroupRender` + `list-group.css` - collapsible group with reactive chevron via `Switch`
|
|
45
140
|
- `ListDividerRender` + `list-divider.css`
|
|
@@ -181,7 +276,10 @@ Entries use the following categories:
|
|
|
181
276
|
|
|
182
277
|
---
|
|
183
278
|
|
|
184
|
-
[Unreleased]: https://github.com/afrocodeur/native-document/compare/v1.0.
|
|
279
|
+
[Unreleased]: https://github.com/afrocodeur/native-document/compare/v1.0.173...HEAD
|
|
280
|
+
[1.0.173]: https://github.com/afrocodeur/native-document/compare/v1.0.172...v1.0.173
|
|
281
|
+
[1.0.172]: https://github.com/afrocodeur/native-document/compare/v1.0.170...v1.0.172
|
|
282
|
+
[1.0.170]: https://github.com/afrocodeur/native-document/compare/v1.0.169...v1.0.170
|
|
185
283
|
[1.0.169]: https://github.com/afrocodeur/native-document/compare/v1.0.167...v1.0.169
|
|
186
284
|
[1.0.167]: https://github.com/afrocodeur/native-document/compare/v1.0.166...v1.0.167
|
|
187
285
|
[1.0.166]: https://github.com/afrocodeur/native-document/releases/tag/v1.0.166
|
|
@@ -75,7 +75,7 @@ docs/
|
|
|
75
75
|
## Internal Links
|
|
76
76
|
|
|
77
77
|
VitePress resolves links relative to the current file.
|
|
78
|
-
Always use `.md` extension
|
|
78
|
+
Always use `.md` extension - VitePress strips it at build time.
|
|
79
79
|
|
|
80
80
|
```markdown
|
|
81
81
|
<!-- From docs/readme.md or docs/getting-started.md -->
|
|
@@ -93,7 +93,7 @@ Never use absolute paths (`/docs/...`) or paths without `.md`.
|
|
|
93
93
|
|
|
94
94
|
---
|
|
95
95
|
|
|
96
|
-
## `.vitepress/config.js`
|
|
96
|
+
## `.vitepress/config.js` - Sidebar & Nav
|
|
97
97
|
|
|
98
98
|
```javascript
|
|
99
99
|
// .vitepress/config.js
|
package/index.d.ts
CHANGED
|
@@ -18,4 +18,4 @@ export declare const Observable: ObservableStatic;
|
|
|
18
18
|
export declare const $: ObservableStatic;
|
|
19
19
|
export declare const obs: ObservableStatic;
|
|
20
20
|
export declare const Store: StoreStatic;
|
|
21
|
-
export declare const Router: RouterStatic;
|
|
21
|
+
// export declare const Router: RouterStatic;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "native-document",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.173",
|
|
4
4
|
"description": "A reactive JavaScript framework that preserves native DOM simplicity without sacrificing modern features",
|
|
5
5
|
"author": "AfroCodeur <https://github.com/afrocodeur>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -41,7 +41,11 @@
|
|
|
41
41
|
"build": "rollup --config rollup.config.js",
|
|
42
42
|
"build:watch": "rollup --config rollup.config.js --watch",
|
|
43
43
|
"lint": "eslint ./src",
|
|
44
|
-
"lint:fix": "eslint ./src --fix"
|
|
44
|
+
"lint:fix": "eslint ./src --fix",
|
|
45
|
+
"test": "vitest run",
|
|
46
|
+
"test:watch": "vitest",
|
|
47
|
+
"test:ui": "vitest --ui",
|
|
48
|
+
"test:coverage": "vitest run --coverage"
|
|
45
49
|
},
|
|
46
50
|
"dependencies": {
|
|
47
51
|
"@floating-ui/dom": "^1.7.6",
|
|
@@ -53,14 +57,17 @@
|
|
|
53
57
|
"@rollup/plugin-alias": "^5.1.1",
|
|
54
58
|
"@rollup/plugin-replace": "^6.0.2",
|
|
55
59
|
"@rollup/plugin-terser": "^0.4.4",
|
|
60
|
+
"@vitest/coverage-v8": "^4.1.8",
|
|
56
61
|
"eslint": "^9.33.0",
|
|
57
62
|
"eslint-plugin-jsdoc": "^62.5.4",
|
|
63
|
+
"happy-dom": "^20.10.2",
|
|
58
64
|
"magic-string": "^0.30.21",
|
|
59
65
|
"postcss": "^8.5.12",
|
|
60
66
|
"rollup": "^4.53.3",
|
|
61
|
-
"rollup-plugin-postcss": "^4.0.2"
|
|
67
|
+
"rollup-plugin-postcss": "^4.0.2",
|
|
68
|
+
"vitest": "^4.1.8"
|
|
62
69
|
},
|
|
63
70
|
"engines": {
|
|
64
71
|
"node": ">=18.0.0"
|
|
65
72
|
}
|
|
66
|
-
}
|
|
73
|
+
}
|
|
@@ -181,6 +181,12 @@ BaseComponent.prototype.getEditableProps = function() {
|
|
|
181
181
|
class: classPropertyAccumulator(rawProps.class || {}),
|
|
182
182
|
style: cssPropertyAccumulator(rawProps.style || {}),
|
|
183
183
|
};
|
|
184
|
+
|
|
185
|
+
if (this.aria) {
|
|
186
|
+
for (const key in this.aria) {
|
|
187
|
+
this.$editableProps[resolveAriaKey(key)] = this.aria[key];
|
|
188
|
+
}
|
|
189
|
+
}
|
|
184
190
|
}
|
|
185
191
|
|
|
186
192
|
return this.$editableProps;
|
|
@@ -244,4 +250,40 @@ BaseComponent.prototype.context = function(context) {
|
|
|
244
250
|
return this;
|
|
245
251
|
};
|
|
246
252
|
|
|
247
|
-
BaseComponent.prototype.visibility = BaseComponent.prototype.showIf;
|
|
253
|
+
BaseComponent.prototype.visibility = BaseComponent.prototype.showIf;
|
|
254
|
+
|
|
255
|
+
//------------------------------------------------------------------------------
|
|
256
|
+
//--Component Aria -------------------------------------------------------------
|
|
257
|
+
//------------------------------------------------------------------------------
|
|
258
|
+
const ARIA_NO_PREFIX = new Set(['role', 'id', 'tabindex']);
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* @param {string} key
|
|
262
|
+
* @returns {string}
|
|
263
|
+
*/
|
|
264
|
+
const resolveAriaKey = (key) =>
|
|
265
|
+
ARIA_NO_PREFIX.has(key) || key.startsWith('aria-') ? key : `aria-${key}`;
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Override or extend aria attributes on the root element.
|
|
269
|
+
* Automatically prefixes keys with 'aria-' unless they are in ARIA_NO_PREFIX.
|
|
270
|
+
*
|
|
271
|
+
* @example
|
|
272
|
+
* Modal()
|
|
273
|
+
* .setAria({ label: 'Confirmation dialog' })
|
|
274
|
+
* .setAria({ describedby: 'modal-desc' })
|
|
275
|
+
*
|
|
276
|
+
* @param {Record<string, string|boolean|Observable>} attrs
|
|
277
|
+
* @returns {this}
|
|
278
|
+
*/
|
|
279
|
+
BaseComponent.prototype.setAria = function(attrs) {
|
|
280
|
+
if (!this.aria) {
|
|
281
|
+
this.aria = {};
|
|
282
|
+
}
|
|
283
|
+
for (const key in attrs) {
|
|
284
|
+
this.aria[resolveAriaKey(key)] = attrs[key];
|
|
285
|
+
}
|
|
286
|
+
return this;
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
|
|
@@ -26,7 +26,7 @@ import {Validation} from '../../validation/Validation';
|
|
|
26
26
|
*/
|
|
27
27
|
export default function StringField(name, type = 'text', props = {}) {
|
|
28
28
|
if(!(this instanceof StringField)) {
|
|
29
|
-
return new StringField(name, props);
|
|
29
|
+
return new StringField(name, type, props);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
Field.call(this, name, type, props);
|
|
@@ -33,6 +33,10 @@ export default function SplitterGutter(leftPanel, rightPanel, props = {}) {
|
|
|
33
33
|
isDragging: $(false),
|
|
34
34
|
props,
|
|
35
35
|
};
|
|
36
|
+
this.aria = {
|
|
37
|
+
'role': 'separator',
|
|
38
|
+
'aria-orientation': 'horizontal',
|
|
39
|
+
};
|
|
36
40
|
}
|
|
37
41
|
|
|
38
42
|
BaseComponent.extends(SplitterGutter);
|
|
@@ -62,6 +66,7 @@ SplitterGutter.use = function(template) {
|
|
|
62
66
|
SplitterGutter.prototype.vertical = function() {
|
|
63
67
|
this.$description.orientation = 'vertical';
|
|
64
68
|
this.$description.cursor = 'row-resize';
|
|
69
|
+
this.aria['aria-orientation'] = 'vertical';
|
|
65
70
|
return this;
|
|
66
71
|
};
|
|
67
72
|
|
|
@@ -71,6 +76,7 @@ SplitterGutter.prototype.vertical = function() {
|
|
|
71
76
|
SplitterGutter.prototype.horizontal = function() {
|
|
72
77
|
this.$description.orientation = 'horizontal';
|
|
73
78
|
this.$description.cursor = 'col-resize';
|
|
79
|
+
this.aria['aria-orientation'] = 'horizontal';
|
|
74
80
|
return this;
|
|
75
81
|
};
|
|
76
82
|
|