Skip to content

Commit d5a8fd0

Browse files
committed
update & build
1 parent 44be027 commit d5a8fd0

3 files changed

Lines changed: 6479 additions & 6032 deletions

File tree

dist/splitting-lite.min.js

Lines changed: 20 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,23 @@
11
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):t.Splitting=n()}(this,function(){"use strict"
2-
var u=document,f=u.createTextNode.bind(u)
3-
function d(t,n,e){t.style.setProperty(n,e)}function l(t,n){return t.appendChild(n)}function p(t,n,e,r){var i=u.createElement("span")
4-
return n&&(i.className=n),e&&(!r&&i.setAttribute("data-"+n,e),i.textContent=e),t&&l(t,i)||i}function n(t,n){return t&&0!=t.length?t.nodeName?[t]:[].slice.call(t[0].nodeName?t:(n||u).querySelectorAll(t)):[]}function h(t,n){t&&t.some(n)}var a={}
5-
function t(t,n,e,r){return{by:t,depends:n,key:e,split:r}}function i(t){return function n(e,t,r){var i=r.indexOf(e)
2+
var u=document,c=u.createTextNode.bind(u)
3+
function f(t,n,e){t.style.setProperty(n,e)}function l(t,n){return t.appendChild(n)}function d(t,n,e,r){var i=u.createElement("span")
4+
return n&&(i.className=n),e&&(r||i.setAttribute("data-"+n,e),i.textContent=e),t&&l(t,i)||i}function n(t,n){return t&&0!=t.length?t.nodeName?[t]:[].slice.call(t[0].nodeName?t:(n||u).querySelectorAll(t)):[]}function p(t,n){t&&t.some(n)}var o={}
5+
function t(t,n,e,r){return{by:t,depends:n,key:e,split:r}}function r(t){return function n(e,t,r){var i=r.indexOf(e)
66
if(-1==i){r.unshift(e)
7-
var u=a[e]
7+
var u=o[e]
88
if(!u)throw new Error("plugin not loaded: "+e)
9-
h(u.depends,function(t){n(t,e,r)})}else{var o=r.indexOf(t)
10-
r.splice(i,1),r.splice(o,0,e)}return r}(t,0,[]).map((n=a,function(t){return n[t]}))
11-
var n}function e(t){a[t.by]=t}function m(t,r,i,u,o){t.normalize()
12-
var a=[],s=document.createDocumentFragment()
13-
u&&a.push(t.previousSibling)
14-
var c=[]
15-
return n(t.childNodes).some(function(t){if(!t.tagName||t.hasChildNodes()){if(t.childNodes&&t.childNodes.length)return c.push(t),void a.push.apply(a,m(t,r,i,u,o))
16-
var n=t.wholeText||"",e=n.trim()
17-
if(e.length)" "===n[0]&&c.push(f(" ")),h(""===i&&"function"==typeof Intl.Segmenter?Array.from((new Intl.Segmenter).segment(e)).map(function(t){return t.segment}):e.split(i),function(t,n){n&&o&&c.push(p(s,"whitespace"," ",o))
18-
var e=p(s,r,t)
19-
a.push(e),c.push(e)})," "===n[n.length-1]&&c.push(f(" "))}else c.push(t)}),h(c,function(t){l(s,t)}),t.innerHTML="",l(t,s),a}var o="words",r=t(o,0,"word",function(t){return m(t,"word",/\s+/,0,1)}),v="chars",s=t(v,[o],"char",function(t,e,n){var r=[]
20-
return h(n[o],function(t,n){r.push.apply(r,m(t,"char","",e.whitespace&&n))}),r})
21-
function c(r){var l=(r=r||{}).key
22-
return n(r.target||"[data-splitting]").map(function(s){var c=s["🍌"]
23-
if(!r.force&&c)return c
24-
c=s["🍌"]={el:s}
25-
var t,n=r.by||(t="splitting",s.getAttribute("data-"+t))
26-
n&&"true"!=n||(n=v)
27-
var e=i(n),f=function(t,n){for(var e in n)t[e]=n[e]
28-
return t}({},r)
29-
return h(e,function(t){if(t.split){var n=t.by,e=(l?"-"+l:"")+t.key,r=t.split(s,f,c)
30-
e&&(i=s,a=(o="--"+e)+"-index",h(u=r,function(t,n){Array.isArray(t)?h(t,function(t){d(t,a,n)}):d(t,a,n)}),d(i,o+"-total",u.length)),c[n]=r,s.classList.add(n)}var i,u,o,a}),s.classList.add("splitting"),c})}return c.html=function(t){var n=(t=t||{}).target=p()
31-
return n.innerHTML=t.content,c(t),n.outerHTML},(c.add=e)(r),e(s),c})
9+
p(u.depends,function(t){n(t,e,r)})}else u=r.indexOf(t),r.splice(i,1),r.splice(u,0,e)
10+
return r}(t,0,[]).map((n=o,function(t){return n[t]}))
11+
var n}function e(t){o[t.by]=t}function h(t,e,r,i,u){t.normalize()
12+
var o=[],a=document.createDocumentFragment(),s=(i&&o.push(t.previousSibling),[])
13+
return n(t.childNodes).some(function(t){var n
14+
t.tagName&&!t.hasChildNodes()?s.push(t):t.childNodes&&t.childNodes.length?(s.push(t),o.push.apply(o,h(t,e,r,i,u))):(n=(t=t.wholeText||"").trim()).length&&(" "===t[0]&&s.push(c(" ")),p(""===r&&"function"==typeof Intl.Segmenter?Array.from((new Intl.Segmenter).segment(n)).map(function(t){return t.segment}):n.split(r),function(t,n){n&&u&&s.push(d(a,"whitespace"," ",u))
15+
n=d(a,e,t)
16+
o.push(n),s.push(n)})," "===t[t.length-1])&&s.push(c(" "))}),p(s,function(t){l(a,t)}),t.innerHTML="",l(t,a),o}var i="words",a=t(i,0,"word",function(t){return h(t,"word",/\s+/,0,1)}),m="chars",s=t(m,[i],"char",function(t,e,n){var r=[]
17+
return p(n[i],function(t,n){r.push.apply(r,h(t,"char","",e.whitespace&&n))}),r})
18+
function g(e){var c=(e=e||{}).key
19+
return n(e.target||"[data-splitting]").map(function(o){var t,n,a,s=o["🍌"]
20+
return!e.force&&s||(s=o["🍌"]={el:o},n=r(t=(t=e.by||(t="splitting",o.getAttribute("data-"+t)))&&"true"!=t?t:m),a=function(t,n){for(var e in n)t[e]=n[e]
21+
return t}({},e),p(n,function(t){var n,e,r,i,u
22+
t.split&&(n=t.by,r=(c?"-"+c:"")+t.key,t=t.split(o,a,s),r&&(e=o,u=(r="--"+(r=r))+"-index",p(i=t,function(t,n){Array.isArray(t)?p(t,function(t){f(t,u,n)}):f(t,u,n)}),f(e,r+"-total",i.length)),s[n]=t,o.classList.add(n))}),o.classList.add("splitting")),s})}return g.html=function(t){var n=(t=t||{}).target=d()
23+
return n.innerHTML=t.content,g(t),n.outerHTML},(g.add=e)(a),e(s),g})

dist/splitting.min.js

Lines changed: 29 additions & 40 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)