@webqit/oohtml 3.1.15 → 3.1.16
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 +42 -6
- package/dist/main.js +1 -1
- package/dist/main.js.map +2 -2
- package/dist/main.lite.js +3 -3
- package/dist/main.lite.js.map +2 -2
- package/dist/namespaced-html.js +1 -1
- package/dist/namespaced-html.js.map +2 -2
- package/dist/scoped-css.js +1 -1
- package/dist/scoped-css.js.map +1 -1
- package/package.json +1 -1
- package/src/namespaced-html/index.js +4 -4
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@ export default function init( $config = {} ) {
|
|
|
15
15
|
attr: { namespace: 'namespace', lid: 'id', },
|
|
16
16
|
api: { namespace: 'namespace', },
|
|
17
17
|
tokens: { lidrefPrefix: '~', lidrefSeparator: ':' },
|
|
18
|
-
target: {
|
|
18
|
+
target: { className: ':target', eventName: ':target', scrolling: true },
|
|
19
19
|
} );
|
|
20
20
|
config.lidSelector = `[${ window.CSS.escape( config.attr.lid ) }]`;
|
|
21
21
|
config.namespaceSelector = `[${ window.CSS.escape( config.attr.namespace ) }]`;
|
|
@@ -350,10 +350,10 @@ function realtime( config ) {
|
|
|
350
350
|
if ( !window.location.hash?.startsWith( `#${ $lidUtil.lidrefPrefix() }` ) ) return;
|
|
351
351
|
const path = window.location.hash?.substring( `#${ $lidUtil.lidrefPrefix() }`.length ).split( '/' ).map( s => s.trim() ).filter( s => s ) || [];
|
|
352
352
|
const currTarget = path.reduce( ( prev, segment ) => prev && prev[ config.api.namespace ][ segment ], window.document );
|
|
353
|
-
if ( prevTarget && config.target.
|
|
353
|
+
if ( prevTarget && config.target.className ) { prevTarget.classList.toggle( config.target.className, false ); }
|
|
354
354
|
if ( currTarget && currTarget !== window.document ) {
|
|
355
|
-
if ( config.target.
|
|
356
|
-
if ( config.target.
|
|
355
|
+
if ( config.target.className ) { currTarget.classList.toggle( config.target.className, true ); }
|
|
356
|
+
if ( config.target.eventName ) { currTarget.dispatchEvent( new window.CustomEvent( config.target.eventName ) ); }
|
|
357
357
|
if ( config.target.scrolling && path.length > 1 ) { currTarget.scrollIntoView(); }
|
|
358
358
|
prevTarget = currTarget;
|
|
359
359
|
}
|