can-legacy-view-helpers
Advanced tools
Comparing version 0.1.0 to 0.2.0-0
{ | ||
"name": "can-legacy-view-helpers", | ||
"version": "0.1.0", | ||
"version": "0.2.0-0", | ||
"description": "Legacy view helpers used by can-ejs and can-mustache.", | ||
@@ -23,5 +23,6 @@ "license": "MIT", | ||
"postversion": "git push --tags && git checkout master && git branch -D release && git push", | ||
"testee": "testee src/test/test.html --browsers firefox", | ||
"testee": "testee test/test.html --browsers firefox", | ||
"test": "npm run jshint && npm run testee", | ||
"jshint": "jshint src/. --config", | ||
"release:pre": "npm version pre && npm publish", | ||
"release:patch": "npm version patch && npm publish", | ||
@@ -51,5 +52,2 @@ "release:minor": "npm version minor && npm publish", | ||
"main": "can-legacy-view-helpers", | ||
"directories": { | ||
"lib": "src/" | ||
}, | ||
"configDependencies": [ | ||
@@ -67,4 +65,8 @@ "live-reload" | ||
"dependencies": { | ||
"can": "canjs/canjs#major", | ||
"jquery": "~2.2.1" | ||
"can-compute": "^3.0.0-pre.19", | ||
"can-event": "^3.0.0-pre.17", | ||
"can-util": "^3.0.0-pre.68", | ||
"can-view-callbacks": "^3.0.0-pre.9", | ||
"can-view-live": "^3.0.0-pre.5", | ||
"can-view-parser": "^3.0.0-pre.7" | ||
}, | ||
@@ -75,5 +77,5 @@ "devDependencies": { | ||
"cssify": "^0.6.0", | ||
"steal": "^0.14.0", | ||
"steal": "^0.16.0", | ||
"steal-qunit": "^0.1.1", | ||
"steal-tools": "^0.14.0", | ||
"steal-tools": "^0.16.0", | ||
"testee": "^0.2.4", | ||
@@ -80,0 +82,0 @@ "generator-donejs": "^0.7.0", |
@@ -1,6 +0,7 @@ | ||
import can from "can/view/"; | ||
import elements from "can/view/elements"; | ||
import live from "can/view/live/"; | ||
import "can/util/string/"; | ||
var view = require("./view"); | ||
var elements = require("./elements"); | ||
var string = require("can-util/js/string/string"); | ||
var deepAssign = require("can-util/js/deep-assign/deep-assign"); | ||
var canCompute = require("can-compute"); | ||
var live = require("./live"); | ||
/** | ||
@@ -44,3 +45,3 @@ * Helper(s) | ||
if (tag) { | ||
return "<" + tag + " " + can.view.hook(hook) + "></" + tag + ">"; | ||
return "<" + tag + " " + view.hook(hook) + "></" + tag + ">"; | ||
} else { | ||
@@ -59,3 +60,3 @@ pendingHookups.push(hook); | ||
return (typeof txt === 'string' || typeof txt === 'number') ? | ||
can.esc(txt) : | ||
string.esc(txt) : | ||
contentText(txt, tag); | ||
@@ -70,5 +71,6 @@ }, | ||
can.extend(can.view, { | ||
deepAssign(view, { | ||
contentText: contentText, | ||
live: live, | ||
// called in text to make a temporary | ||
// called in text to make a temporary | ||
// can.view.lists function that can be called with | ||
@@ -79,6 +81,6 @@ // the list to iterate over and the template | ||
var old = can.view.lists, | ||
var old = view.lists, | ||
data; | ||
can.view.lists = function (list, renderer) { | ||
view.lists = function (list, renderer) { | ||
data = { | ||
@@ -92,3 +94,3 @@ list: list, | ||
return function () { | ||
can.view.lists = old; | ||
view.lists = old; | ||
return data; | ||
@@ -161,6 +163,6 @@ }; | ||
// Sets up a listener so we know any can.view.lists called | ||
// Sets up a listener so we know any can.view.lists called | ||
// when func is called | ||
var listTeardown = can.view.setupLists(); | ||
// | ||
var listTeardown = view.setupLists(); | ||
// | ||
unbind = function () { | ||
@@ -170,4 +172,4 @@ compute.unbind("change", emptyHandler); | ||
// Create a compute that calls func and looks for dependencies. | ||
// By passing `false`, this compute can not be a dependency of other | ||
// computes. This is because live-bits are nested, but | ||
// By passing `false`, this compute can not be a dependency of other | ||
// computes. This is because live-bits are nested, but | ||
// handle their own updating. For example: | ||
@@ -177,3 +179,3 @@ // {{#if items.length}}{{#items}}{{.}}{{/items}}{{/if}} | ||
// `{{#items}}` text changes. | ||
compute = can.compute(func, self, false); | ||
compute = canCompute(func, self, false); | ||
@@ -198,3 +200,3 @@ // Bind to get and temporarily cache the value of the compute. | ||
unbind(); | ||
return "<" + tag + can.view.hook(function (el, parentNode) { | ||
return "<" + tag + view.hook(function (el, parentNode) { | ||
live.list(el, listData.list, listData.renderer, self, parentNode); | ||
@@ -220,6 +222,6 @@ }) + "></" + tag + ">"; | ||
// Return an element tag with a hookup in place of the content | ||
return "<" + tag + can.view.hook( | ||
return "<" + tag + view.hook( | ||
// if value is an object, it's likely something returned by .safeString | ||
escape && typeof value !== "object" ? | ||
// If we are escaping, replace the parentNode with | ||
// If we are escaping, replace the parentNode with | ||
// a text node who's value is `func`'s return value. | ||
@@ -270,2 +272,2 @@ function (el, parentNode) { | ||
export default can; | ||
module.exports = view; |
@@ -1,5 +0,11 @@ | ||
import can from "can/view/"; | ||
import elements from "can/view/elements"; | ||
import viewCallbacks from "can/view/callbacks/"; | ||
/** | ||
* This module must be CJS format because is uses `with () { ... }` | ||
* statements which will not work in ES6 since it forces strict mode. | ||
*/ | ||
var elements = require("./elements"); | ||
var viewCallbacks = require("can-view-callbacks"); | ||
var deepAssign = require("can-util/js/deep-assign/deep-assign"); | ||
var view = require("./view"); | ||
var each = require("can-util/js/each/each"); | ||
/** | ||
@@ -92,5 +98,5 @@ * Helper(s) | ||
can.view.Scanner = Scanner = function (options) { | ||
var Scanner = function (options) { | ||
// Set options on self | ||
can.extend(this, { | ||
deepAssign(this, { | ||
/** | ||
@@ -331,3 +337,3 @@ * @typedef {{start: String, escape: String, scope: String, options: String}} can.view.Scanner.text | ||
'"', clean(content), '"', | ||
",can.view.pending({tagName:'" + tagName + "'," + (attrs) + "scope: " + (this.text.scope || "this") + this.text.options); | ||
",CAN_LEGACY_HELPERS.view.pending({tagName:'" + tagName + "'," + (attrs) + "scope: " + (this.text.scope || "this") + this.text.options); | ||
@@ -340,3 +346,3 @@ // if it's a self closing tag (like <content/>) close and end the tag | ||
} | ||
// if it's an empty tag | ||
// if it's an empty tag | ||
else if (tokens[i] === "<" && tokens[i + 1] === "/" + tagName) { | ||
@@ -354,3 +360,3 @@ buff.push("}));"); | ||
// make sure / of /> is on the right of pending | ||
var pendingPart = ",can.view.pending({" + attrs + "scope: " + (this.text.scope || "this") + this.text.options + "}),\""; | ||
var pendingPart = ",CAN_LEGACY_HELPERS.view.pending({" + attrs + "scope: " + (this.text.scope || "this") + this.text.options + "}),\""; | ||
if (emptyElement) { | ||
@@ -416,3 +422,3 @@ put(content.substr(0, content.length - 1), pendingPart + "/>\""); | ||
buff.push(insert_cmd, "can.view.txt(2,'" + getTag(tagName, tokens, i) + "'," + _status() + ",this,function(){", startTxt); | ||
buff.push(insert_cmd, "CAN_LEGACY_HELPERS.view.txt(2,'" + getTag(tagName, tokens, i) + "'," + _status() + ",this,function(){", startTxt); | ||
put(attrName + "=" + token); | ||
@@ -498,4 +504,4 @@ break; | ||
if (bracketCount === 1) { | ||
// We are starting on. | ||
buff.push(insert_cmd, 'can.view.txt(0,\'' + getTag(tagName, tokens, i) + '\',' + _status() + ',this,function(){', startTxt, content); | ||
// We are starting on. | ||
buff.push(insert_cmd, 'CAN_LEGACY_HELPERS.view.txt(0,\'' + getTag(tagName, tokens, i) + '\',' + _status() + ',this,function(){', startTxt, content); | ||
endStack.push({ | ||
@@ -566,3 +572,3 @@ before: "", | ||
if (content.startTxt && content.end && specialAttribute) { | ||
buff.push(insert_cmd, "can.view.toStr( ",content.content, '() ) );'); | ||
buff.push(insert_cmd, "CAN_LEGACY_HELPERS.view.toStr( ",content.content, '() ) );'); | ||
@@ -572,6 +578,6 @@ } else { | ||
if (content.startTxt) { | ||
buff.push(insert_cmd, "can.view.txt(\n" + | ||
buff.push(insert_cmd, "CAN_LEGACY_HELPERS.view.txt(\n" + | ||
(typeof _status() === "string" || (content.escaped != null ? content.escaped : escaped)) + ",\n'" + tagName + "',\n" + _status() + ",\nthis,\n"); | ||
} else if (content.startOnlyTxt) { | ||
buff.push(insert_cmd, 'can.view.onlytxt(this,\n'); | ||
buff.push(insert_cmd, 'CAN_LEGACY_HELPERS.view.onlytxt(this,\n'); | ||
} | ||
@@ -591,5 +597,5 @@ buff.push(content.content); | ||
// If we have `<%== a(function(){ %>` then we want | ||
// `can.EJS.text(0,this, function(){ return a(function(){ var _v1ew = [];`. | ||
// `CAN_LEGACY_HELPERS.EJS.text(0,this, function(){ return a(function(){ var _v1ew = [];`. | ||
buff.push(insert_cmd, "can.view.txt(\n" + (typeof _status() === "string" || escaped) + | ||
buff.push(insert_cmd, "CAN_LEGACY_HELPERS.view.txt(\n" + (typeof _status() === "string" || escaped) + | ||
",\n'" + tagName + "',\n" + _status() + ",\nthis,\nfunction(){ " + | ||
@@ -662,9 +668,9 @@ (this.text.escape || '') + | ||
// This is called when there is a special tag | ||
can.view.pending = function (viewData) { | ||
view.pending = function (viewData) { | ||
// we need to call any live hookups | ||
// so get that and return the hook | ||
// a better system will always be called with the same stuff | ||
var hooks = can.view.getHooks(); | ||
return can.view.hook(function (el) { | ||
can.each(hooks, function (fn) { | ||
var hooks = view.getHooks(); | ||
return view.hook(function (el) { | ||
each(hooks, function (fn) { | ||
fn(el); | ||
@@ -677,3 +683,3 @@ }); | ||
can.each(viewData && viewData.attrs || [], function (attributeName) { | ||
each(viewData && viewData.attrs || [], function (attributeName) { | ||
viewData.attributeName = attributeName; | ||
@@ -690,8 +696,5 @@ var callback = viewCallbacks.attr(attributeName); | ||
can.view.tag("content", function (el, tagData) { | ||
return tagData.scope; | ||
}); | ||
can.view.Scanner = Scanner; | ||
view.Scanner = Scanner; | ||
export default Scanner; | ||
module.exports = Scanner; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
GitHub dependency
Supply chain riskContains a dependency which resolves to a GitHub URL. Dependencies fetched from GitHub specifiers are not immutable can be used to inject untrusted code or reduce the likelihood of a reproducible install.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
79852
18
2235
0
6
+ Addedcan-compute@^3.0.0-pre.19
+ Addedcan-event@^3.0.0-pre.17
+ Addedcan-util@^3.0.0-pre.68
+ Addedcan-view-live@^3.0.0-pre.5
+ Addedcan-view-parser@^3.0.0-pre.7
+ Addedcan-ajax@1.4.1(transitive)
+ Addedcan-assign@1.3.3(transitive)
+ Addedcan-attribute-encoder@0.3.5(transitive)
+ Addedcan-cid@1.3.1(transitive)
+ Addedcan-compute@3.3.10(transitive)
+ Addedcan-deparam@1.2.3(transitive)
+ Addedcan-dom-data-state@0.2.0(transitive)
+ Addedcan-dom-events@1.3.13(transitive)
+ Addedcan-event@3.7.7(transitive)
+ Addedcan-event-dom-enter@1.0.4(transitive)
+ Addedcan-event-dom-radiochange@1.0.5(transitive)
+ Addedcan-globals@1.2.2(transitive)
+ Addedcan-key-tree@1.2.2(transitive)
+ Addedcan-log@1.0.2(transitive)
+ Addedcan-namespace@1.0.0(transitive)
+ Addedcan-observation@3.3.6(transitive)
+ Addedcan-param@1.2.0(transitive)
+ Addedcan-parse-uri@1.2.2(transitive)
+ Addedcan-reflect@1.19.2(transitive)
+ Addedcan-reflect-promise@1.1.5(transitive)
+ Addedcan-stache-key@0.1.4(transitive)
+ Addedcan-symbol@1.7.0(transitive)
+ Addedcan-types@1.4.0(transitive)
+ Addedcan-util@3.14.0(transitive)
+ Addedcan-view-callbacks@3.2.5(transitive)
+ Addedcan-view-live@3.2.6(transitive)
+ Addedcan-view-nodelist@3.1.1(transitive)
+ Addedcan-view-parser@3.8.3(transitive)
+ Addedcan-view-target@3.1.6(transitive)
- Removedcan@canjs/canjs#major
- Removedjquery@~2.2.1
- Removedjquery@2.2.4(transitive)