boxwood 0.80.0 → 1.0.0

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.
Files changed (2) hide show
  1. package/index.js +36 -0
  2. package/package.json +5 -11
package/index.js CHANGED
@@ -272,6 +272,34 @@ function sequence() {
272
272
  return number++
273
273
  }
274
274
 
275
+ function decamelize(string) {
276
+ return string.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase()
277
+ }
278
+
279
+ function stylesheet(input) {
280
+ const object = { ...input }
281
+ return {
282
+ add(item) {
283
+ for (const key in item) {
284
+ object[key] = item[key]
285
+ }
286
+ },
287
+ set(key, value) {
288
+ object[key] = value
289
+ },
290
+ toString() {
291
+ let result = []
292
+ for (const key in object) {
293
+ const value = object[key]
294
+ if (value) {
295
+ result.push(`${decamelize(key)}:${value}`)
296
+ }
297
+ }
298
+ return result.join(";")
299
+ },
300
+ }
301
+ }
302
+
275
303
  function css(inputs) {
276
304
  let result = ""
277
305
  for (let i = 0, ilen = inputs.length; i < ilen; i += 1) {
@@ -310,6 +338,14 @@ css.load = function () {
310
338
  `
311
339
  }
312
340
 
341
+ css.create = function (object) {
342
+ return stylesheet(object)
343
+ }
344
+
345
+ css.inline = function (object) {
346
+ return stylesheet(object).toString()
347
+ }
348
+
313
349
  function js(inputs) {
314
350
  let result = ""
315
351
  for (let i = 0, ilen = inputs.length; i < ilen; i += 1) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "boxwood",
3
- "version": "0.80.0",
3
+ "version": "1.0.0",
4
4
  "description": "Compile HTML templates into JS",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -11,12 +11,6 @@
11
11
  "watch": "npm test -- --watch",
12
12
  "prepush": "npm test"
13
13
  },
14
- "ava": {
15
- "files": [
16
- "test/spec/**/*.js",
17
- "**/*.spec.js"
18
- ]
19
- },
20
14
  "engines": {
21
15
  "node": ">= 20.11.1"
22
16
  },
@@ -47,10 +41,10 @@
47
41
  "homepage": "https://github.com/buxlabs/boxwood#readme",
48
42
  "devDependencies": {
49
43
  "benchmark": "2.1.4",
50
- "c8": "^10.1.2",
51
- "express": "^4.21.0",
44
+ "c8": "^10.1.3",
45
+ "express": "^5.1.0",
52
46
  "handlebars": "^4.7.8",
53
- "jsdom": "^25.0.0",
47
+ "jsdom": "^26.1.0",
54
48
  "mustache": "^4.2.0",
55
49
  "underscore": "^1.13.7"
56
50
  },
@@ -62,7 +56,7 @@
62
56
  ]
63
57
  },
64
58
  "dependencies": {
65
- "css-tree": "^3.0.0"
59
+ "css-tree": "^3.1.0"
66
60
  },
67
61
  "prettier": {
68
62
  "semi": false