native-document 1.0.286 → 1.0.287

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "native-document",
3
- "version": "1.0.286",
3
+ "version": "1.0.287",
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",
@@ -8,7 +8,16 @@ export default function Slot(content) {
8
8
  }
9
9
  this.$anchor = Anchor();
10
10
 
11
- content && this.$anchor.setContent(content);
11
+ if(content) {
12
+ if(content.__$Observable) {
13
+ this.$anchor.set(content.val());
14
+ content.subscribe((value) => {
15
+ this.$anchor.set(value);
16
+ });
17
+ return;
18
+ }
19
+ this.$anchor.setContent(content);
20
+ }
12
21
  }
13
22
 
14
23
 
@@ -1,5 +1,7 @@
1
1
  import AttributesWrapper, { bindClassAttribute, bindStyleAttribute } from './AttributesWrapper';
2
2
  import PluginsManager from '../utils/plugins-manager';
3
+ import Slot from '../elements/anchor/Slot';
4
+ import Ref from '../data/Ref';
3
5
 
4
6
  let $textNodeCache = null;
5
7
 
@@ -125,7 +125,10 @@ export const setupInteraction = (listItem, el, submenuEl, orientation, interacti
125
125
  export function applyIsActive(instance, $description, props) {
126
126
  const root = instance.getRoot();
127
127
  if(root && root.$description.active) {
128
- const isActive = root.active($description);
128
+ if(!(typeof root.$description.active === 'function')) {
129
+ return;
130
+ }
131
+ const isActive = root.$description.active($description);
129
132
  props.class.add({ 'is-active': isActive });
130
133
  }
131
134
  }
@@ -86,6 +86,11 @@
86
86
  color: var(--menu-item-color-active);
87
87
  }
88
88
 
89
+ .is-active > & {
90
+ background: var(--menu-item-bg-selected);
91
+ color: var(--menu-item-color-active);
92
+ }
93
+
89
94
  .is-disabled > & {
90
95
  color: var(--menu-item-color-disabled);
91
96
  pointer-events: none;
@@ -5,6 +5,7 @@ import { NDElement } from './nd-element';
5
5
  import {AnchorAttributes,
6
6
  AudioAttributes, CanvasAttributes, DetailsAttributes, DialogAttributes, GlobalAttributes, OlAttributes,
7
7
  SourceAttributes, SvgAttributes, TrackAttributes, VideoAttributes, ThAttributes, ModAttributes, TdAttributes, TimeAttributes } from './globals';
8
+ import {SlotInterface} from "./slot";
8
9
 
9
10
  // - Re-export all attribute types and utilities from globals
10
11
  export type {
@@ -57,6 +58,7 @@ export type ValidChild =
57
58
  | ObservableItem
58
59
  | NDElement
59
60
  | BindingHydrator
61
+ | SlotInterface
60
62
  | ValidChild[]
61
63
  | ((...args: any[]) => ValidChild);
62
64