Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
402 changes: 393 additions & 9 deletions OVERVIEW.md

Large diffs are not rendered by default.

15 changes: 6 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@
<img src="https://cdn.rawgit.com/meteor/blaze/master/images/logo.svg" width="260" />
</p>
<p align="center">
<a href="http://slack.blazejs.org" target="_blank">
<img src="http://slack.blazejs.org/badge.svg">
</a>
<a href="https://circleci.com/gh/meteor/blaze" target="_blank">
<img src="https://circleci.com/gh/meteor/blaze.svg?style=shield">
<a href="https://github.com/meteor/blaze/actions/workflows/blaze-tests.yml">
<img src="https://github.com/meteor/blaze/actions/workflows/blaze-tests.yml/badge.svg">
Comment on lines +5 to +6
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Add alt text to the GitHub Actions badge for accessibility.

The badge image is missing alternative text, which impacts accessibility for screen reader users.

♿ Proposed fix to add descriptive alt text
  <a href="https://github.com/meteor/blaze/actions/workflows/blaze-tests.yml">
- 	<img src="https://github.com/meteor/blaze/actions/workflows/blaze-tests.yml/badge.svg">
+ 	<img src="https://github.com/meteor/blaze/actions/workflows/blaze-tests.yml/badge.svg" alt="Blaze Tests">
  </a>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<a href="https://github.com/meteor/blaze/actions/workflows/blaze-tests.yml">
<img src="https://github.com/meteor/blaze/actions/workflows/blaze-tests.yml/badge.svg">
<a href="https://github.com/meteor/blaze/actions/workflows/blaze-tests.yml">
<img src="https://github.com/meteor/blaze/actions/workflows/blaze-tests.yml/badge.svg" alt="Blaze Tests">
</a>
🧰 Tools
🪛 markdownlint-cli2 (0.22.0)

[warning] 6-6: Images should have alternate text (alt text)

(MD045, no-alt-text)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@README.md` around lines 5 - 6, The badge image tag lacks alternative text;
update the README.md badge <img> element (inside the <a
href="https://github.com/meteor/blaze/actions/workflows/blaze-tests.yml"> link)
to include a descriptive alt attribute (e.g., alt="GitHub Actions — blaze-tests
workflow status") so screen readers can convey the badge meaning; ensure the alt
text is concise and specific to the workflow name/status.

</a>
<a href="#backers">
<img src="https://opencollective.com/blaze/backers/badge.svg">
Expand All @@ -18,7 +15,7 @@

## What is Blaze?

Blaze is a powerful library for creating user interfaces by writing reactive HTML templates. Compared to using a combination of traditional templates and jQuery, Blaze eliminates the need for all the "update logic" in your app that listens for data changes and manipulates the DOM. Instead, familiar template directives like ``{{#if}}`` and ``{{#each}}`` integrate with [Tracker's](https://github.com/meteor/meteor/tree/master/packages/tracker) "transparent reactivity" and [Minimongo's](https://meteor.com/mini-databases) database cursors so that the DOM updates automatically.
Blaze is a powerful library for creating user interfaces by writing reactive HTML templates. Compared to using a combination of traditional templates and jQuery, Blaze eliminates the need for all the "update logic" in your app that listens for data changes and manipulates the DOM. Instead, familiar template directives like ``{{#if}}`` and ``{{#each}}`` integrate with [Tracker's](https://github.com/meteor/meteor/tree/master/packages/tracker) "transparent reactivity" and [Minimongo's](https://github.com/meteor/meteor/tree/devel/packages/minimongo) database cursors so that the DOM updates automatically.

### Blaze has two major parts:

Expand All @@ -30,17 +27,17 @@ Check our [Overview](OVERVIEW.md) to learn more.

## Quick Start

Blaze is a [Meteor](http://meteor.com/)-only package for now. Soon we will have Blaze on npm so you can use it in your stack.
Blaze is a [Meteor](http://meteor.com/)-only package for now. In the future, we intend to have Blaze on npm so you can use it in your stack.

Each new Meteor project you create has Blaze included (the `blaze-html-templates` package).
Each new Meteor project you create using the `--blaze` flag has Blaze included (via the `blaze-html-templates` package).

## Get involved

We'd love for you to help us build Blaze. If you'd like to be a contributor,
check out our [contributing guide](/CONTRIBUTING.md).

Also, to stay up-to-date on all Blaze related news and the community you should
definitely [join us on Slack](http://slack.blazejs.org).
definitely [join us on the Meteor forums](http://forums.meteor.com).

See [open issues](https://github.com/meteor/blaze/issues) and consider helping with any of the tasks. Those [labeled "contributions welcome"](https://github.com/meteor/blaze/issues?q=is%3Aopen+is%3Aissue+label%3A%22contributions+welcome%22) are probably a good start. We have issues [organized into GitHub projects](https://github.com/meteor/blaze/projects) for a better overview as well. And the current [roadmap](https://github.com/meteor/blaze/milestones) shows the issues we need help with for the next release.

Expand Down
Binary file removed images/architecture-static-html.png
Binary file not shown.
Binary file removed images/architecture-templating-tools.png
Binary file not shown.

Large diffs are not rendered by default.

213 changes: 213 additions & 0 deletions images/architecture/architecture_packages.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed images/architecture_packages.png
Binary file not shown.
254 changes: 0 additions & 254 deletions images/architecture_packages.svg

This file was deleted.

57 changes: 27 additions & 30 deletions packages/blaze-tools/tojs.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,13 @@ export function toJSLiteral (obj) {
// See <http://timelessrepo.com/json-isnt-a-javascript-subset> for `\u2028\u2029`.
// Also escape Unicode surrogates.
return (JSON.stringify(obj)
.replace(/[\u2028\u2029\ud800-\udfff]/g, function (c) {
return '\\u' + ('000' + c.charCodeAt(0).toString(16)).slice(-4);
}));
.replace(/[\u2028\u2029\ud800-\udfff]/g, (c) => `\\u${c.charCodeAt(0).toString(16).padStart(4, '0')}`));
}



var jsReservedWordSet = (function (set) {
"abstract else instanceof super boolean enum int switch break export interface synchronized byte extends let this case false long throw catch final native throws char finally new transient class float null true const for package try continue function private typeof debugger goto protected var default if public void delete implements return volatile do import short while double in static with".split(' ').forEach(function (w) {
const jsReservedWordSet = ((set) => {
"abstract else instanceof super boolean enum int switch break export interface synchronized byte extends let this case false long throw catch final native throws char finally new transient class float null true const for package try continue function private typeof debugger goto protected var default if public void delete implements return volatile do import short while double in static with".split(' ').forEach((w) => {
set[w] = 1;
});
return set;
Expand All @@ -41,7 +39,7 @@ export function toObjectLiteralKey (k) {
return toJSLiteral(k);
}

var hasToJS = function (x) {
const hasToJS = (x) => {
return x.toJS && (typeof (x.toJS) === 'function');
};

Expand All @@ -54,10 +52,10 @@ ToJSVisitor.def({
return toJSLiteral(stringBooleanOrNumber);
},
visitArray: function (array) {
var parts = [];
for (var i = 0; i < array.length; i++)
const parts = [];
for (let i = 0; i < array.length; i++)
parts.push(this.visit(array[i]));
return '[' + parts.join(', ') + ']';
return `[${parts.join(', ')}]`;
},
visitTag: function (tag) {
return this.generateCall(tag.tagName, tag.attrs, tag.children);
Expand All @@ -77,31 +75,31 @@ ToJSVisitor.def({
return x.toJS(this);
}

throw new Error("Unexpected object in HTMLjs in toJS: " + x);
throw new Error(`Unexpected object in HTMLjs in toJS: ${x}`);
},
generateCall: function (name, attrs, children) {
var tagSymbol;
if (name.indexOf('.') >= 0) {
let tagSymbol;
if (name.includes('.')) {
tagSymbol = name;
} else if (HTML.isTagEnsured(name)) {
tagSymbol = 'HTML.' + HTML.getSymbolName(name);
tagSymbol = `HTML.${HTML.getSymbolName(name)}`;
} else {
tagSymbol = 'HTML.getTag(' + toJSLiteral(name) + ')';
tagSymbol = `HTML.getTag(${toJSLiteral(name)})`;
}

var attrsArray = null;
let attrsArray = null;
let needsHTMLAttrs = false;
if (attrs) {
attrsArray = [];
var needsHTMLAttrs = false;
if (HTML.isArray(attrs)) {
var attrsArray = [];
for (var i = 0; i < attrs.length; i++) {
var a = attrs[i];
attrsArray = [];
for (let i = 0; i < attrs.length; i++) {
const a = attrs[i];
if (hasToJS(a)) {
attrsArray.push(a.toJS(this));
needsHTMLAttrs = true;
} else {
var attrsObjStr = this.generateAttrsDictionary(attrs[i]);
const attrsObjStr = this.generateAttrsDictionary(attrs[i]);
if (attrsObjStr !== null)
attrsArray.push(attrsObjStr);
}
Expand All @@ -113,40 +111,39 @@ ToJSVisitor.def({
attrsArray.push(this.generateAttrsDictionary(attrs));
}
}
var attrsStr = null;
let attrsStr = null;
if (attrsArray && attrsArray.length) {
if (attrsArray.length === 1 && ! needsHTMLAttrs) {
attrsStr = attrsArray[0];
} else {
attrsStr = 'HTML.Attrs(' + attrsArray.join(', ') + ')';
attrsStr = `HTML.Attrs(${attrsArray.join(', ')})`;
}
}

var argStrs = [];
const argStrs = [];
if (attrsStr !== null)
argStrs.push(attrsStr);

if (children) {
for (var i = 0; i < children.length; i++)
for (let i = 0; i < children.length; i++)
argStrs.push(this.visit(children[i]));
}

return tagSymbol + '(' + argStrs.join(', ') + ')';
return `${tagSymbol}(${argStrs.join(', ')})`;
},
generateAttrsDictionary: function (attrsDict) {
if (attrsDict.toJS && (typeof (attrsDict.toJS) === 'function')) {
// not an attrs dictionary, but something else! Like a template tag.
return attrsDict.toJS(this);
}

var kvStrs = [];
for (var k in attrsDict) {
const kvStrs = [];
for (const k in attrsDict) {
if (! HTML.isNully(attrsDict[k]))
kvStrs.push(toObjectLiteralKey(k) + ': ' +
this.visit(attrsDict[k]));
kvStrs.push(`${toObjectLiteralKey(k)}: ${this.visit(attrsDict[k])}`);
}
if (kvStrs.length)
return '{' + kvStrs.join(', ') + '}';
return `{${kvStrs.join(', ')}}`;
return null;
}
});
Expand Down
18 changes: 9 additions & 9 deletions packages/blaze-tools/token_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { HTMLTools } from 'meteor/html-tools';

Tinytest.add("blaze-tools - token parsers", function (test) {

var run = function (func, input, expected) {
var scanner = new HTMLTools.Scanner('z' + input);
const run = function (func, input, expected) {
const scanner = new HTMLTools.Scanner('z' + input);
// make sure the parse function respects `scanner.pos`
scanner.pos = 1;
var result = func(scanner);
const result = func(scanner);
if (expected === null) {
test.equal(scanner.pos, 1);
test.equal(result, null);
Expand All @@ -17,19 +17,19 @@ Tinytest.add("blaze-tools - token parsers", function (test) {
}
};

var runValue = function (func, input, expectedValue) {
var expected;
const runValue = function (func, input, expectedValue) {
let expected;
if (expectedValue === null)
expected = null;
else
expected = { text: input, value: expectedValue };
run(func, input, expected);
};

var parseNumber = BlazeTools.parseNumber;
var parseIdentifierName = BlazeTools.parseIdentifierName;
var parseExtendedIdentifierName = BlazeTools.parseExtendedIdentifierName;
var parseStringLiteral = BlazeTools.parseStringLiteral;
const parseNumber = BlazeTools.parseNumber;
const parseIdentifierName = BlazeTools.parseIdentifierName;
const parseExtendedIdentifierName = BlazeTools.parseExtendedIdentifierName;
const parseStringLiteral = BlazeTools.parseStringLiteral;

runValue(parseNumber, "0", 0);
runValue(parseNumber, "-0", 0);
Expand Down
Loading