Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

trans-render

Package Overview
Dependencies
Maintainers
0
Versions
849
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

trans-render - npm Package Compare versions

Comparing version 0.0.820 to 0.0.821

arr.js

21

dss/find.js

@@ -1,11 +0,24 @@

export async function find(element, specifier) {
export async function find(element, specifier, within) {
const { self, s } = specifier;
if (self)
return element;
if (s === '#') {
if (s === '#' || within !== undefined) {
const { arr } = await import('../arr.js');
const { elS } = specifier;
return element.getRootNode().getElementById(elS);
const rns = (arr(within) || [element.getRootNode()]);
for (const rn of rns) {
let el = null;
if (s === '#') {
el = (rn instanceof DocumentFragment) ? rn.getElementById(elS) : rn.querySelector('#' + elS);
}
else {
el = rn.querySelector(elS);
}
if (el !== null)
return el;
}
throw 404;
}
const { findR } = await import('./findR.js');
return await findR(element, specifier);
return await findR(element, specifier, undefined);
}

@@ -12,0 +25,0 @@ export function getSubProp(specifier, el) {

25

dss/findR.js

@@ -5,9 +5,2 @@ async function getHostish(el, prop) {

await customElements.whenDefined(localName);
// if(prop){
// if(prop in el) {
// return el;
// }else{
// throw 404;
// }
// }
}

@@ -20,4 +13,4 @@ if (ish instanceof HTMLElement)

//if(host) return getHostish(host, prop);
const { AttachedHost, waitForEvent } = await import('./AttachedHost.js');
const ah = new AttachedHost(el, itemScopeAttr);
const { Newish, waitForEvent } = await import('./Newish.js');
const ah = new Newish(el, itemScopeAttr);
if (!ah.isResolved) {

@@ -31,3 +24,3 @@ await waitForEvent(ah, 'resolved');

export async function findR(element, specifier, scopeE) {
const { scopeS, elS } = specifier;
const { scopeS, elS, isModulo } = specifier;
if (scopeS !== undefined) {

@@ -44,3 +37,4 @@ const { dss, rec, rnf, host, s, prop, isiss } = specifier;

const { upSearch } = await import('../lib/upSearch.js');
closest = upSearch(prev, scopeS);
const css = `${scopeS}:has(${elS})`;
closest = upSearch(prev, css);
}

@@ -90,2 +84,11 @@ else {

}
else if (isModulo) {
const { modulo: m, elS } = specifier;
const { modulo } = await import('./modulo.js');
const within = modulo(element, m);
if (elS !== undefined)
throw 'NI'; //not implemented
return within;
//within
}
}

@@ -38,2 +38,3 @@ export async function parse(s) {

tailStart = 2;
break;
case '?': {

@@ -43,2 +44,6 @@ //TODO

}
case '%[':
specifier.dss = '%';
tailStart = 1;
break;
default:

@@ -67,3 +72,3 @@ const head0 = head2[0];

const s = specifier.self ? '$0' : nonEventPart.substring(tailStart, tailStart + 1);
const { scopeS } = specifier;
const { scopeS, isModulo } = specifier;
tailStart += specifier.self ? 2 : 1;

@@ -136,3 +141,3 @@ const iPosOfSC = nonEventPart.indexOf(':', tailStart);

specifier.elS = `[name="${propInference}"]`;
if (scopeS === undefined) {
if (scopeS === undefined && !isModulo) {
if (specifier.dss === undefined)

@@ -176,13 +181,24 @@ specifier.dss = '^';

function parseScope(nonEventPart, tailStart, specifier) {
if (nonEventPart.substring(tailStart, tailStart + 1) !== '{')
throw 'PE'; //parsing error
const iPosOfClosedBrace = nonEventPart.indexOf('}', tailStart + 2);
if (iPosOfClosedBrace === -1)
throw 'PE'; // parsing error
let scopeS = nonEventPart.substring(tailStart + 1, iPosOfClosedBrace);
if (scopeS.startsWith('(') && scopeS.endsWith(')')) {
specifier.isiss = true;
scopeS = scopeS.substring(1, scopeS.length - 1);
const openingSymbol = nonEventPart.substring(tailStart, tailStart + 1);
let iPosOfClosedBrace;
switch (openingSymbol) {
case '{':
iPosOfClosedBrace = nonEventPart.indexOf('}', tailStart + 2);
if (iPosOfClosedBrace === -1)
throw 'PE'; // parsing error
let scopeS = nonEventPart.substring(tailStart + 1, iPosOfClosedBrace);
if (scopeS.startsWith('(') && scopeS.endsWith(')')) {
specifier.isiss = true;
scopeS = scopeS.substring(1, scopeS.length - 1);
}
specifier.scopeS = scopeS;
break;
case '[':
iPosOfClosedBrace = nonEventPart.indexOf(']', tailStart + 2);
specifier.isModulo = true;
specifier.modulo = nonEventPart.substring(tailStart + 1, iPosOfClosedBrace).toLowerCase();
break;
default:
throw 'PE'; //Parsing error
}
specifier.scopeS = scopeS;
return {

@@ -189,0 +205,0 @@ tailStart: iPosOfClosedBrace + 1

{
"name": "trans-render",
"version": "0.0.820",
"version": "0.0.821",
"description": "Instantiate an HTML Template",

@@ -19,14 +19,46 @@ "type": "module",

"exports": {
".": "./Transform.js",
"./EventHandler.js": "./EventHandler.js",
"./Mount.js": "./Mount.js",
".": {
"default": "./Transform.js",
"types": "./Transform.ts"
},
"./arr.js": {
"default": "./arr.js",
"types": "./arr.ts"
},
"./EventHandler.js": {
"default": "./EventHandler.js",
"types": "./EventHandler.ts"
},
"./Mount.js": {
"default": "./Mount.js",
"types": "./Mount.ts"
},
"./Object$tring.js": "./Object$tring.js",
"./Object$entences.js": "./Object$entences.js",
"./trans-render.js": "./trans-render.js",
"./dss/AttachedHost.js": {
"default": "./dss/AttachedHost.js",
"types": "./dss/AttachedHost.ts"
"./dss/Newish.js": {
"default": "./dss/Newish.js",
"types": "./dss/Newish.ts"
},
"./dss/parse.js": "./dss/parse.js",
"./dss/find.js": "./dss/find.js",
"./dss/find.js": {
"default": "./dss/find.js",
"types": "./dss/find.ts"
},
"./dss/tref/getChildren.js": {
"default": "./dss/tref/getChildren.js",
"types": "./dss/tref/getChildren.ts"
},
"./dss/tref/tagTempl.js": {
"default": "./dss/tref/tagTempl.js",
"types": "./dss/tref/tagTempl.ts"
},
"./dss/tref/querySelector.js": {
"default": "./dss/tref/querySelector.js",
"types": "./dss/tref/querySelector.ts"
},
"./dss/tref/splitRefs.js": {
"default": "./dss/tref/splitRefs.js",
"types": "./dss/tref/splitRefs.ts"
},
"./funions/Localizer.js": "./functions/Localizer.js",

@@ -55,3 +87,6 @@ "./froop/CE.js": "./froop/CE.js",

"./lib/getRecipientElement": "./lib/getRecipientElement.js",
"./lib/getVal.js": "./lib/getVal.js",
"./lib/getVal.js": {
"default": "./lib/getVal.js",
"types": "./lib/getVal.ts"
},
"./lib/getValFromEvent.js": "./lib/getValFromEvent.js",

@@ -62,5 +97,2 @@ "./lib/Hashit.js": "./lib/Hashit.js",

"./lib/interpolate.js": "./lib/interpolate.js",
"./lib/insertAdjacentClone.js": "./lib/insertAdjacentClone.js",
"./lib/insertAdjacentTemplate.js": "./lib/insertAdjacentTemplate.js",
"./lib/intersection.js": "./lib/intersection.js",
"./lib/isContainedIn.js": "./lib/isContainedIn.js",

@@ -118,2 +150,4 @@ "./lib/isResolved.js": "./lib/isResolved.js",

"dss/*.d.ts",
"dss/tref/*.js",
"dss/tref/*.d.ts",
"funions/*.js",

@@ -137,6 +171,6 @@ "funions/*.d.ts",

"dependencies": {
"mount-observer": "0.0.30"
"mount-observer": "0.0.31"
},
"devDependencies": {
"@playwright/test": "1.45.3",
"@playwright/test": "1.46.0",
"may-it-serve": "0.0.8",

@@ -143,0 +177,0 @@ "xtal-shell": "0.0.27"

import { MountObserver } from 'mount-observer/MountObserver.js';
import { arr0 } from './arr.js';
export { arr0 } from './arr.js';
export async function Transform(target, model, xform, options) {

@@ -113,3 +115,3 @@ const xformer = new Transformer(target, model, xform, options);

{
const rhses = arr(rhs);
const rhses = arr0(rhs);
for (const rhsPart of rhses) {

@@ -285,3 +287,3 @@ const uow = {

const { o } = uow;
const arrO = arr(o);
const arrO = arr0(o);
const propName = this.#getPropName(arrO, d);

@@ -339,6 +341,2 @@ const pOrC = arrO[d];

}
export function arr(inp) {
return inp === undefined ? []
: Array.isArray(inp) ? inp : [inp];
}
export class MountOrchestrator extends EventTarget {

@@ -354,3 +352,3 @@ transformer;

this.queryInfo = queryInfo;
this.#unitsOfWork = arr(uows);
this.#unitsOfWork = arr0(uows);
}

@@ -397,3 +395,3 @@ async do() {

let { o } = uow;
const p = arr(o);
const p = arr0(o);
const { target, options, model } = this.transformer;

@@ -400,0 +398,0 @@ const propagator = (model.propagator || options.propagator);

@@ -1,2 +0,2 @@

import { arr } from '../Transform.js';
import { arr0 } from '../Transform.js';
import { getUIVal } from './getUIVal.js';

@@ -6,3 +6,3 @@ export async function doYield(transformer, matchingElement, uow, y) {

const { o } = uow;
const observeArr = arr(o);
const observeArr = arr0(o);
const yIsNum = typeof y === 'number';

@@ -9,0 +9,0 @@ const to = yIsNum ? observeArr[y] : y.to;

@@ -1,2 +0,2 @@

import { arr } from '../Transform.js';
import { arr0 } from '../Transform.js';
import { assignGingerly } from '../lib/assignGingerly.js';

@@ -12,3 +12,3 @@ export async function Engage(transformer, matchingElement, type, uow, mountContext) {

do: e
}] : arr(e).map(x => typeof x === 'string' ? { do: x } : x);
}] : arr0(e).map(x => typeof x === 'string' ? { do: x } : x);
for (const engagement of transpiledEngagements) {

@@ -15,0 +15,0 @@ if ('enhPropKey' in engagement) {

@@ -1,2 +0,2 @@

import { arr } from '../Transform.js';
import { arr0 } from '../Transform.js';
export async function onMount(transformer, mo, matchingElement, uows, skipInit, ctx, matchingElements, observer, mountObserver) {

@@ -58,3 +58,3 @@ const { queryInfo } = mo;

else {
transpiledActions = arr(a).map(ai => typeof ai === 'string' ? mo.toStdEvt(ai, matchingElement) : ai);
transpiledActions = arr0(a).map(ai => typeof ai === 'string' ? mo.toStdEvt(ai, matchingElement) : ai);
}

@@ -68,3 +68,3 @@ const { AddEventListener } = await import('./AddEventListener.js');

if (m !== undefined) {
const transpiledMs = arr(m);
const transpiledMs = arr0(m);
const { Mod } = await import('./Mod.js');

@@ -71,0 +71,0 @@ for (const mi of transpiledMs) {

@@ -501,2 +501,4 @@ import { MountContext, PipelineStage } from "mount-observer/types";

parse(): Promise<void>;
}
}
export type ZeroOrMore<T> = T | Array<T> | undefined;

@@ -1,2 +0,1 @@

import { insertAdjacentTemplate } from '../lib/insertAdjacentTemplate.js';
export function clone(target) {

@@ -6,3 +5,3 @@ const clone = target.cloneNode(true);

for (const template of templates) {
insertAdjacentTemplate(template, template, 'afterend');
template.after(template.cloneNode(true));
template.remove();

@@ -9,0 +8,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc