Socket
Socket
Sign inDemoInstall

nuejs-core

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nuejs-core - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

.prettierrc.cjs

2

CONTRIBUTING.md

@@ -12,3 +12,3 @@

## Best practises
## Best practices

@@ -15,0 +15,0 @@ 1. If you are adding a new feature, please add a test. If you are fixing a bug, please add a test that fails before your fix and passes after your fix.

@@ -5,3 +5,3 @@ {

"main": "ssr/index.js",
"version": "0.1.0",
"version": "0.1.1",
"scripts": {

@@ -8,0 +8,0 @@ "test": "cd test && bun test",

@@ -19,3 +19,3 @@

## Build user interfaces with 10x less code
The biggest benefit with Nue is that you need less code to do the same thing:
The biggest benefit of Nue is that you need less code to do the same thing:

@@ -41,7 +41,7 @@ ![The amount of code required to build a basic listbox UI component](https://nuejs.org/docs/img/react-listbox-big.jpg)

While React and JXS claim to be "Just JavaScript", Nue can be thought of as "Just HTML". Nue is perfect for [UX developers][divide] focusing on interaction design, accessibility, and user experience.
While React and JSX claim to be "Just JavaScript", Nue can be thought of as "Just HTML". Nue is perfect for [UX developers][divide] focusing on interaction design, accessibility, and user experience.
## Built to scale
Tree reasons why Nue scales extremely well:
Three reasons why Nue scales extremely well:

@@ -48,0 +48,0 @@ 1. [Separation of concerns](//nuejs.org//why/#soc), easy-to-understand code is easier to scale than "spaghetti code"

@@ -32,3 +32,3 @@

// on insert (anomation)
// oninsert callback for transition/animation purposes
ctx.oninsert?.call(ctx, block.$el, item, {

@@ -35,0 +35,0 @@ index: i,

@@ -15,3 +15,3 @@

opts.processAttrs(node) // run event handlers on the parent context
const impl = createApp({ fns, dom: node }, ctx, deps)
const impl = createApp({ fns, dom: node }, ctx, deps, ctx)
blocks.push(impl)

@@ -39,2 +39,4 @@ impl.fn = fn

var _prev
function update() {

@@ -41,0 +43,0 @@ if (!anchor) {

@@ -31,3 +31,3 @@

const fn = fns[i]
if (fn) expr.push(() => node.textContent = renderVal(fn(ctx)))
if (fn) expr.push(_ => node.textContent = renderVal(fn(ctx)))
}

@@ -55,3 +55,3 @@

const ext = CONTROL_FLOW[key]({ root: node, fn, fns, deps, ctx, processAttrs })
expr.push(ext.update || ext)
expr.push(ext.update)
return ext

@@ -88,5 +88,5 @@ }

expr.push(() => setAttrs(comp.$el, parent))
expr.push(_ => setAttrs(comp.$el, parent))
// component refs (TODO: into mount?)
// component refs
self.$refs[node.getAttribute('ref') || tagName] = comp.impl

@@ -129,3 +129,3 @@

if (real == 'attr') {
return expr.push(() => {
return expr.push(_=> {
for (const [name, val] of Object.entries(fn(ctx))) {

@@ -139,3 +139,3 @@ setAttr(node, name, val === true ? '' : val)

if (char == ':' && real != 'bind') {
expr.push(() => {
expr.push(_=> {
let val = fn(ctx)

@@ -150,3 +150,4 @@ setAttr(node, real, renderVal(val))

fn.call(ctx, ctx, evt)
update()
const up = $parent?.update || update
up()
}

@@ -157,7 +158,10 @@ }

if (char == '$') {
expr.push(() => fn(ctx) ? node[real] = real : node.removeAttribute(real))
expr.push(_=> {
const flag = node[real] = !!fn(ctx)
if (!flag) node.removeAttribute(real)
})
}
// html
if (real == 'html') expr.push(() => node.innerHTML = fn(ctx))
if (real == 'html') expr.push(_=> node.innerHTML = fn(ctx))

@@ -281,3 +285,5 @@ }

self.$el = dom
anchor.before(dom)
// TODO: more performant check?
if (!document.body.contains(dom)) anchor.before(dom)
if (!dom.walked) { walk(dom); dom.walked = 1 }

@@ -289,3 +295,5 @@ return update()

unmount() {
self.root.remove()
try {
self.root.remove()
} catch (e) {}
impl.unmounted?.call(ctx, ctx)

@@ -339,3 +347,3 @@ update()

function renderVal(val, separ='') {
return val?.join ? val.filter(el => el != null).join(separ).trim().replace(/\s+/g, ' ') : val || ''
return val?.join ? val.filter(el => el || el === 0).join(separ).trim().replace(/\s+/g, ' ') : val || ''
}

@@ -342,0 +350,0 @@

@@ -6,2 +6,3 @@

import { DomUtils } from 'htmlparser2'
import { dirname } from 'node:path'
const { getOuterHTML, getInnerHTML, removeElement } = DomUtils

@@ -130,3 +131,3 @@

if (name.startsWith('@key')) {
if (name.startsWith('@key') && keycode) {
const code = keycode.replace('-', '')

@@ -210,8 +211,8 @@ const codes = [`'${code}'`]

const js = compile(template)
if (dest) await fs.writeFile(dest, js)
if (dest) {
const destDir = dirname(dest)
await fs.mkdir(destDir, { recursive: true })
await fs.writeFile(dest, js)
}
return js
}

@@ -9,3 +9,3 @@

const RESERVED = `
alert arguments Array as BigInt Boolean confirm console Date decodeURI decodeURIComponent
alert arguments Array as BigInt Boolean confirm console delete Date decodeURI decodeURIComponent
document else encodeURI encodeURIComponent false get history if in Infinity instanceof

@@ -12,0 +12,0 @@ Intl isFinite isNaN JSON localStorage location Map Math NaN navigator new null Number

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