@takumi-rs/helpers 2.7.1 → 2.7.3

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.
package/dist/emoji.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./helpers-4kGcvc-Q.cjs"),t=/\uFE0F/g,n=/\p{Extended_Pictographic}/u,r=/^(?:\p{Regional_Indicator}){2}$/u,i=/^[#*0-9]\uFE0F?\u20E3$/u;function a(e){return[...e.indexOf(`‍`)<0?e.replace(t,``):e].map(e=>e.codePointAt(0)?.toString(16)).join(`-`)}const o={twemoji:e=>`https://cdn.jsdelivr.net/gh/jdecked/twemoji@17.0.2/assets/svg/${e.toLowerCase()}.svg`,openmoji:`https://cdn.jsdelivr.net/npm/@svgmoji/openmoji@2.0.0/svg/`,blobmoji:`https://cdn.jsdelivr.net/npm/@svgmoji/blob@2.0.0/svg/`,noto:e=>`https://cdn.jsdelivr.net/gh/googlefonts/noto-emoji@v2.051/svg/emoji_u${e.toLowerCase().replaceAll(`-`,`_`)}.svg`,fluent:e=>`https://cdn.jsdelivr.net/gh/shuding/fluentui-emoji-unicode/assets/${e.toLowerCase()}_color.svg`,fluentFlat:e=>`https://cdn.jsdelivr.net/gh/shuding/fluentui-emoji-unicode/assets/${e.toLowerCase()}_flat.svg`};function s(e,t){let n=a(e),r=o[t];return typeof r==`function`?r(n):`${r}${n.toUpperCase()}.svg`}const c=new Intl.Segmenter(`en`,{granularity:`grapheme`});function l(e){return Array.from(c.segment(e))}function u(e){return n.test(e)||r.test(e)||i.test(e)}function d(t,n){let r=[],i=``,a=l(t.text);for(let{segment:t}of a)u(t)?(i&&=(r.push(e.l({text:i})),``),r.push(e.i({src:s(t,n),style:{display:`inline-block`,width:`1em`,height:`1em`,margin:`0 0.05em 0 0.1em`,verticalAlign:`-0.1em`}}))):i+=t;return i&&r.push(e.l({text:i})),r}function f(t,n){if(t.type===`text`){if(l(t.text).some(({segment:e})=>u(e))){let{type:r,...i}=t;return e.t({...i,children:d(t,n)})}}else if(t.type===`container`&&t.children)return{...t,children:t.children.map(e=>e&&f(e,n))};return t}exports.extractEmojis=f;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./helpers-4kGcvc-Q.cjs"),t=/\uFE0F/g,n=/^\p{Extended_Pictographic}/u,r=/^\p{Emoji_Presentation}/u,i=/^\p{Emoji_Modifier_Base}\p{Emoji_Modifier}/u,a=/^(?:\p{Regional_Indicator}){1,2}$/u,o=/^[#*0-9]\uFE0F?\u20E3$/u;function s(e){return[...e.indexOf(`‍`)<0?e.replace(t,``):e].map(e=>e.codePointAt(0)?.toString(16)).join(`-`)}const c={twemoji:e=>`https://cdn.jsdelivr.net/gh/jdecked/twemoji@17.0.2/assets/svg/${e.toLowerCase()}.svg`,openmoji:`https://cdn.jsdelivr.net/npm/@svgmoji/openmoji@2.0.0/svg/`,blobmoji:`https://cdn.jsdelivr.net/npm/@svgmoji/blob@2.0.0/svg/`,noto:e=>`https://cdn.jsdelivr.net/gh/googlefonts/noto-emoji@v2.051/svg/emoji_u${e.toLowerCase().replaceAll(`-`,`_`)}.svg`,fluent:e=>`https://cdn.jsdelivr.net/gh/shuding/fluentui-emoji-unicode/assets/${e.toLowerCase()}_color.svg`,fluentFlat:e=>`https://cdn.jsdelivr.net/gh/shuding/fluentui-emoji-unicode/assets/${e.toLowerCase()}_flat.svg`};function l(e,t){let n=s(e),r=c[t];return typeof r==`function`?r(n):`${r}${n.toUpperCase()}.svg`}const u=new Intl.Segmenter(`en`,{granularity:`grapheme`});function d(e){return Array.from(u.segment(e))}function f(e){return e.includes(`︎`)?!1:a.test(e)||o.test(e)?!0:n.test(e)&&(e.includes(`️`)||e.includes(`‍`)||r.test(e)||i.test(e))}function p(t,n){let r=[],i=``,a=d(t.text);for(let{segment:t}of a)f(t)?(i&&=(r.push(e.l({text:i})),``),r.push(e.i({src:l(t,n),style:{display:`inline-block`,width:`1em`,height:`1em`,margin:`0 0.05em 0 0.1em`,verticalAlign:`-0.1em`}}))):i+=t;return i&&r.push(e.l({text:i})),r}function m(t,n){if(t.type===`text`){if(d(t.text).some(({segment:e})=>f(e))){let{type:r,...i}=t;return e.t({...i,children:p(t,n)})}}else if(t.type===`container`&&t.children)return{...t,children:t.children.map(e=>e&&m(e,n))};return t}exports.extractEmojis=m;
package/dist/emoji.mjs CHANGED
@@ -1 +1 @@
1
- import{i as e,l as t,t as n}from"./helpers-CVQCT1Rh.mjs";const r=/\uFE0F/g,i=/\p{Extended_Pictographic}/u,a=/^(?:\p{Regional_Indicator}){2}$/u,o=/^[#*0-9]\uFE0F?\u20E3$/u;function s(e){return[...e.indexOf(`‍`)<0?e.replace(r,``):e].map(e=>e.codePointAt(0)?.toString(16)).join(`-`)}const c={twemoji:e=>`https://cdn.jsdelivr.net/gh/jdecked/twemoji@17.0.2/assets/svg/${e.toLowerCase()}.svg`,openmoji:`https://cdn.jsdelivr.net/npm/@svgmoji/openmoji@2.0.0/svg/`,blobmoji:`https://cdn.jsdelivr.net/npm/@svgmoji/blob@2.0.0/svg/`,noto:e=>`https://cdn.jsdelivr.net/gh/googlefonts/noto-emoji@v2.051/svg/emoji_u${e.toLowerCase().replaceAll(`-`,`_`)}.svg`,fluent:e=>`https://cdn.jsdelivr.net/gh/shuding/fluentui-emoji-unicode/assets/${e.toLowerCase()}_color.svg`,fluentFlat:e=>`https://cdn.jsdelivr.net/gh/shuding/fluentui-emoji-unicode/assets/${e.toLowerCase()}_flat.svg`};function l(e,t){let n=s(e),r=c[t];return typeof r==`function`?r(n):`${r}${n.toUpperCase()}.svg`}const u=new Intl.Segmenter(`en`,{granularity:`grapheme`});function d(e){return Array.from(u.segment(e))}function f(e){return i.test(e)||a.test(e)||o.test(e)}function p(n,r){let i=[],a=``,o=d(n.text);for(let{segment:n}of o)f(n)?(a&&=(i.push(t({text:a})),``),i.push(e({src:l(n,r),style:{display:`inline-block`,width:`1em`,height:`1em`,margin:`0 0.05em 0 0.1em`,verticalAlign:`-0.1em`}}))):a+=n;return a&&i.push(t({text:a})),i}function m(e,t){if(e.type===`text`){if(d(e.text).some(({segment:e})=>f(e))){let{type:r,...i}=e;return n({...i,children:p(e,t)})}}else if(e.type===`container`&&e.children)return{...e,children:e.children.map(e=>e&&m(e,t))};return e}export{m as extractEmojis};
1
+ import{i as e,l as t,t as n}from"./helpers-CVQCT1Rh.mjs";const r=/\uFE0F/g,i=/^\p{Extended_Pictographic}/u,a=/^\p{Emoji_Presentation}/u,o=/^\p{Emoji_Modifier_Base}\p{Emoji_Modifier}/u,s=/^(?:\p{Regional_Indicator}){1,2}$/u,c=/^[#*0-9]\uFE0F?\u20E3$/u;function l(e){return[...e.indexOf(`‍`)<0?e.replace(r,``):e].map(e=>e.codePointAt(0)?.toString(16)).join(`-`)}const u={twemoji:e=>`https://cdn.jsdelivr.net/gh/jdecked/twemoji@17.0.2/assets/svg/${e.toLowerCase()}.svg`,openmoji:`https://cdn.jsdelivr.net/npm/@svgmoji/openmoji@2.0.0/svg/`,blobmoji:`https://cdn.jsdelivr.net/npm/@svgmoji/blob@2.0.0/svg/`,noto:e=>`https://cdn.jsdelivr.net/gh/googlefonts/noto-emoji@v2.051/svg/emoji_u${e.toLowerCase().replaceAll(`-`,`_`)}.svg`,fluent:e=>`https://cdn.jsdelivr.net/gh/shuding/fluentui-emoji-unicode/assets/${e.toLowerCase()}_color.svg`,fluentFlat:e=>`https://cdn.jsdelivr.net/gh/shuding/fluentui-emoji-unicode/assets/${e.toLowerCase()}_flat.svg`};function d(e,t){let n=l(e),r=u[t];return typeof r==`function`?r(n):`${r}${n.toUpperCase()}.svg`}const f=new Intl.Segmenter(`en`,{granularity:`grapheme`});function p(e){return Array.from(f.segment(e))}function m(e){return e.includes(`︎`)?!1:s.test(e)||c.test(e)?!0:i.test(e)&&(e.includes(`️`)||e.includes(`‍`)||a.test(e)||o.test(e))}function h(n,r){let i=[],a=``,o=p(n.text);for(let{segment:n}of o)m(n)?(a&&=(i.push(t({text:a})),``),i.push(e({src:d(n,r),style:{display:`inline-block`,width:`1em`,height:`1em`,margin:`0 0.05em 0 0.1em`,verticalAlign:`-0.1em`}}))):a+=n;return a&&i.push(t({text:a})),i}function g(e,t){if(e.type===`text`){if(p(e.text).some(({segment:e})=>m(e))){let{type:r,...i}=e;return n({...i,children:h(e,t)})}}else if(e.type===`container`&&e.children)return{...e,children:e.children.map(e=>e&&g(e,t))};return e}export{g as extractEmojis};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takumi-rs/helpers",
3
- "version": "2.7.1",
3
+ "version": "2.7.3",
4
4
  "description": "Convert JSX and HTML to Takumi node trees. Load fonts and emoji.",
5
5
  "keywords": [
6
6
  "emoji",