Skip to content

Releases: CarbonPackages/Carbon.Eel

2.16.1

14 Nov 13:28
3e97663
Compare
Choose a tag to compare

2.16.0

13 Nov 23:53
17c7ab1
Compare
Choose a tag to compare

✨ New Eel helper

Carbon.String.getPropertyFromNodeLink(node, value, propertyName, fallback)

Get a property from a node link. Can be used to get the title from a page who is linked via the link editor.

Example:

Expression Result
Carbon.String.getPropertyFromNodeLink(site, 'node://aaaa-bbbb-ccc') 'Title from the linked page'
Carbon.String.getPropertyFromNodeLink(site, 'node://aaaa-bbbb-ccc', null) null
Carbon.String.getPropertyFromNodeLink(null, 'node://aaaa-bbbb-ccc') null
Carbon.String.getPropertyFromNodeLink(site, 'some other value') null
Carbon.String.getPropertyFromNodeLink(site, 'some other value', 'title', 'fallback value') 'fallback value'
  • node (NodeInterface) The node, usally site
  • value (string) The value to process
  • propertyName (string) The name of the property to get
  • fallback (mixed) The fallback value if nothing is found

Full Changelog: 2.15.2...2.16.0

2.15.2

13 Aug 11:53
d3e89f2
Compare
Choose a tag to compare

Full Changelog: 2.15.1...2.15.2

2.15.1

06 Aug 17:04
3943968
Compare
Choose a tag to compare

Full Changelog: 2.15.0...2.15.1

2.15.0

17 Apr 15:59
d138430
Compare
Choose a tag to compare

What's Changed

✨ Exciting new features

Full Changelog: 2.14.0...2.15.0

2.14.0

29 Mar 14:20
5b5e776
Compare
Choose a tag to compare

Rename Carbon.String.merge to Carbon.String.classNames

Render all arguments as classNames and apply conditions if needed.
Merge strings and arrays to a string with unique values, separated by an empty space.

All arguments of the eel helper are evaluated and the following rules are applied:

  • falsy values: (null, '', [], {}) are not rendererd
  • array: all items that are scalar and truthy are rendered as classname
  • object: keys that have a truthy values are rendered as classname
  • scalar: is cast to string and rendered as class-name

Examples:

Expression Result
Carbon.String.classNames('', 'one') 'one'
Carbon.String.classNames(['one two three'], ['one', 'four']) 'one two three four'
Carbon.String.classNames(null, false, [null], {one: false}) null
Carbon.String.classNames('one two three', ['one', 'four']) 'one two three four'
Carbon.String.classNames('one', {two: true, three: false }) 'one two'

Return The merged string

Rename AlpineJS.xData to AlpineJS.function

Generate a function call for AlpineJS. More info.
Supports nested arrays. In named arrays ({first:1,second:null}) null get filtered out, but in list
arrays ([1,null]) and in plain values the will stay.

Examples:

Expression Result
AlpineJS.function('slider', {effect: 'slide', spaceBetween: 12, loop: true, navigation: null}) 'slider({effect:'slide',spaceBetween:12,loop:true})'
AlpineJS.function('slider', 'one', 1, false, null, ['string', 2, null]) 'slider('one',1,false,null,['string',2,null])'
AlpineJS.function("vote", 4) 'vote(4)'
  • name (string) The name for the function (e.g x-data, x-on:click, etc.)
  • ...arguments (mixed) The options for the function

Return The string for the x-data function call

Full Changelog: 2.13.0...2.14.0

2.13.0

29 Feb 18:14
fedf384
Compare
Choose a tag to compare

AlpineJS.magic(name, arg1, arg2, ..argN)

Generate a call for a magic function for AlpineJS..
Supports nested arrays. In named arrays ({first:1,second:null}) null get filtered out, but in list
arrays ([1,null]) and in plain values the will stay.

Examples:

AlpineJS.magic('dispatch', 'notify') == '$dispatch('notify')'
AlpineJS.magic('$dispatch', 'notify', { message: 'Hello World!' }) == '$dispatch('notify',{message:'Hello World!'})'
AlpineJS.xData('dispatch', 'notify', { message: true, nested: {value: true} }) == '$dispatch('notify',{message:true,nested:{value:true}})'
  • name (string) The name for the magic. If not prefixed with an $, it will automatically prefixed.
  • ...arguments (mixed) The options for the function

Return The string for the magic function call

Full Changelog: 2.12.0...2.13.0

2.12.0

06 Feb 14:25
3db2043
Compare
Choose a tag to compare

Carbon.String.replaceOnce(string, search, replace)

Helper to replace the first occurrence of a string.

Examples:

Expression Result
Carbon.String.replaceOnce('Foo Bar Foo', 'Foo', 'X') 'X Bar Foo'
Carbon.String.replaceOnce('Foo Bar Foo', 'Foo ') 'Bar Foo'
  • string (string) The string being searched and replaced on
  • search (string) The value being searched for
  • prefix (string, optional) The replacement value that replaces found search value

Returns the string with one occurrence replaced

Full Changelog: 2.11.0...2.12.0

2.11.0

04 Feb 15:35
7361f5f
Compare
Choose a tag to compare

Carbon.Number.pxToRem(value, fallback)

Convert a pixel value to rem

  • value (numeric | string, required) The value to converted
  • fallback (numeric | string, optional) Fallback value if value is false or null

Examples:

Expression Result
Carbon.Number.pxToRem('') 0
Carbon.Number.pxToRem('8px') 0.5rem
Carbon.Number.pxToRem(16) 1rem
Carbon.Number.pxToRem(0) 0
Carbon.Number.pxToRem(false, 32) 2rem
Carbon.Number.pxToRem(null, '16px') 2rem

Returns a string with the converted value

Full Changelog: 2.10.0...2.11.0

2.10.0

15 Jan 23:09
cde0c6d
Compare
Choose a tag to compare

✨ Add JavaScript and CSS minifier

Carbon.String.minifyJS(javascript)

Minifies JavaScript so that it can be delivered to the client quicker.

  • javascript (string, required) The JavaScript to minify

Return The minified JavaScript

Carbon.String.minifyCSS(javascript)

Minifies CSS so that it can be delivered to the client quicker.

  • css (string, required) The CSS to minify

Return The minified CSS

Full Changelog: 2.9.0...2.10.0