@takumi-rs/helpers 1.0.0-beta.0 → 1.0.0-beta.2
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 +1 -0
- package/dist/emoji.d.cts +7 -0
- package/dist/emoji.d.ts +7 -0
- package/dist/emoji.js +1 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/jsx/jsx.d.cts +1 -1
- package/dist/jsx/jsx.d.ts +1 -1
- package/dist/{types-DAQVXLBC.d.cts → types-C9AZncSY.d.cts} +1 -1
- package/dist/{types-DAQVXLBC.d.ts → types-C9AZncSY.d.ts} +1 -1
- package/package.json +8 -2
package/dist/emoji.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var c=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var j=Object.prototype.hasOwnProperty;var b=(e,t)=>{for(var n in t)c(e,n,{get:t[n],enumerable:!0})},S=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of h(t))!j.call(e,o)&&o!==n&&c(e,o,{get:()=>t[o],enumerable:!(i=p(t,o))||i.enumerable});return e};var w=e=>S(c({},"__esModule",{value:!0}),e);var P={};b(P,{extractEmojis:()=>y});module.exports=w(P);function s(e,t){t&&Object.keys(t).length>0&&(e.style=t)}function a(e,t){t&&Object.keys(t).length>0&&(e.preset=t)}function u(e,t){t.tagName!==void 0&&(e.tagName=t.tagName),t.className!==void 0&&(e.className=t.className),t.id!==void 0&&(e.id=t.id),t.attributes!==void 0&&(e.attributes=t.attributes)}function f(e){let t={type:"container",children:e.children};return e.tw&&(t.tw=e.tw),u(t,e),a(t,e.preset),s(t,e.style),t}function d(e,t){if(typeof e=="string"){let i={type:"text",text:e};return s(i,t),i}let n={type:"text",text:e.text};return e.tw&&(n.tw=e.tw),u(n,e),a(n,e.preset),s(n,t??e.style),n}function g(e){let t={type:"image",src:e.src,width:e.width,height:e.height};return e.tw&&(t.tw=e.tw),u(t,e),a(t,e.preset),s(t,e.style),t}var v=/\uFE0F/g,C="\u200D";function T(e){let t=e.indexOf(C)<0?e.replace(v,""):e,n="";for(let i=0,o=0;i<t.length;i++){let r=t.charCodeAt(i);if(o){let N=(65536+(o-55296<<10)+(r-56320)).toString(16);n+=(n?"-":"")+N,o=0}else 55296<=r&&r<=56319?o=r:n+=(n?"-":"")+r.toString(16)}return n}var l={twemoji:e=>`https://cdnjs.cloudflare.com/ajax/libs/twemoji/14.0.2/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:"https://cdn.jsdelivr.net/gh/svgmoji/svgmoji/packages/svgmoji__noto/svg/"};function $(e,t){let n=T(e);return t==="twemoji"?l.twemoji(n):`${l[t]}${n.toUpperCase()}.svg`}var m;function E(){return m===void 0&&(typeof Intl<"u"&&typeof Intl.Segmenter=="function"?m=new Intl.Segmenter("en",{granularity:"grapheme"}):m=null),m}function x(e){let t=E();return t?Array.from(t.segment(e)):Array.from(e).map(n=>({segment:n}))}function I(e,t){let n=[],i="",o=x(e.text);for(let{segment:r}of o)/\p{Extended_Pictographic}/u.test(r)?(i&&(n.push(d({text:i})),i=""),n.push(g({src:$(r,t),style:{display:"inline-block",width:"1em",height:"1em",margin:"0 0.05em 0 0.1em",verticalAlign:"-0.1em"}}))):i+=r;return i&&n.push(d({text:i})),n}function y(e,t){if(e.type==="text"){if(x(e.text).some(({segment:i})=>/\p{Extended_Pictographic}/u.test(i))){let{type:i,...o}=e;return f({...o,children:I(e,t)})}}else if(e.type==="container"&&e.children)return{...e,children:e.children.map(n=>n&&y(n,t))};return e}0&&(module.exports={extractEmojis});
|
package/dist/emoji.d.cts
ADDED
package/dist/emoji.d.ts
ADDED
package/dist/emoji.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function s(e,t){t&&Object.keys(t).length>0&&(e.style=t)}function c(e,t){t&&Object.keys(t).length>0&&(e.preset=t)}function a(e,t){t.tagName!==void 0&&(e.tagName=t.tagName),t.className!==void 0&&(e.className=t.className),t.id!==void 0&&(e.id=t.id),t.attributes!==void 0&&(e.attributes=t.attributes)}function d(e){let t={type:"container",children:e.children};return e.tw&&(t.tw=e.tw),a(t,e),c(t,e.preset),s(t,e.style),t}function u(e,t){if(typeof e=="string"){let i={type:"text",text:e};return s(i,t),i}let n={type:"text",text:e.text};return e.tw&&(n.tw=e.tw),a(n,e),c(n,e.preset),s(n,t??e.style),n}function f(e){let t={type:"image",src:e.src,width:e.width,height:e.height};return e.tw&&(t.tw=e.tw),a(t,e),c(t,e.preset),s(t,e.style),t}var y=/\uFE0F/g,N="\u200D";function p(e){let t=e.indexOf(N)<0?e.replace(y,""):e,n="";for(let i=0,r=0;i<t.length;i++){let o=t.charCodeAt(i);if(r){let x=(65536+(r-55296<<10)+(o-56320)).toString(16);n+=(n?"-":"")+x,r=0}else 55296<=o&&o<=56319?r=o:n+=(n?"-":"")+o.toString(16)}return n}var g={twemoji:e=>`https://cdnjs.cloudflare.com/ajax/libs/twemoji/14.0.2/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:"https://cdn.jsdelivr.net/gh/svgmoji/svgmoji/packages/svgmoji__noto/svg/"};function h(e,t){let n=p(e);return t==="twemoji"?g.twemoji(n):`${g[t]}${n.toUpperCase()}.svg`}var m;function j(){return m===void 0&&(typeof Intl<"u"&&typeof Intl.Segmenter=="function"?m=new Intl.Segmenter("en",{granularity:"grapheme"}):m=null),m}function l(e){let t=j();return t?Array.from(t.segment(e)):Array.from(e).map(n=>({segment:n}))}function b(e,t){let n=[],i="",r=l(e.text);for(let{segment:o}of r)/\p{Extended_Pictographic}/u.test(o)?(i&&(n.push(u({text:i})),i=""),n.push(f({src:h(o,t),style:{display:"inline-block",width:"1em",height:"1em",margin:"0 0.05em 0 0.1em",verticalAlign:"-0.1em"}}))):i+=o;return i&&n.push(u({text:i})),n}function S(e,t){if(e.type==="text"){if(l(e.text).some(({segment:i})=>/\p{Extended_Pictographic}/u.test(i))){let{type:i,...r}=e;return d({...r,children:b(e,t)})}}else if(e.type==="container"&&e.children)return{...e,children:e.children.map(n=>n&&S(n,t))};return e}export{S as extractEmojis};
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CSSProperties } from 'react';
|
|
2
|
-
import { C as ContainerNode, T as TextNode, I as ImageNode } from './types-
|
|
3
|
-
export {
|
|
2
|
+
import { C as ContainerNode, T as TextNode, I as ImageNode } from './types-C9AZncSY.cjs';
|
|
3
|
+
export { N as Node, a as NodeAttributes, b as NodeMetadata } from './types-C9AZncSY.cjs';
|
|
4
4
|
|
|
5
5
|
declare function container(props: Omit<ContainerNode, "type">): ContainerNode;
|
|
6
6
|
declare function text(text: string, style?: CSSProperties): TextNode;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CSSProperties } from 'react';
|
|
2
|
-
import { C as ContainerNode, T as TextNode, I as ImageNode } from './types-
|
|
3
|
-
export {
|
|
2
|
+
import { C as ContainerNode, T as TextNode, I as ImageNode } from './types-C9AZncSY.js';
|
|
3
|
+
export { N as Node, a as NodeAttributes, b as NodeMetadata } from './types-C9AZncSY.js';
|
|
4
4
|
|
|
5
5
|
declare function container(props: Omit<ContainerNode, "type">): ContainerNode;
|
|
6
6
|
declare function text(text: string, style?: CSSProperties): TextNode;
|
package/dist/jsx/jsx.d.cts
CHANGED
package/dist/jsx/jsx.d.ts
CHANGED
|
@@ -26,4 +26,4 @@ type ImageNode = NodeMetadata & {
|
|
|
26
26
|
height?: number;
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
export type { ContainerNode as C, ImageNode as I,
|
|
29
|
+
export type { ContainerNode as C, ImageNode as I, Node as N, TextNode as T, NodeAttributes as a, NodeMetadata as b };
|
|
@@ -26,4 +26,4 @@ type ImageNode = NodeMetadata & {
|
|
|
26
26
|
height?: number;
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
export type { ContainerNode as C, ImageNode as I,
|
|
29
|
+
export type { ContainerNode as C, ImageNode as I, Node as N, TextNode as T, NodeAttributes as a, NodeMetadata as b };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@takumi-rs/helpers",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.2",
|
|
4
4
|
"author": {
|
|
5
5
|
"email": "me@kane.tw",
|
|
6
6
|
"name": "Kane Wang",
|
|
@@ -31,6 +31,12 @@
|
|
|
31
31
|
"import": "./dist/jsx/jsx.js",
|
|
32
32
|
"require": "./dist/jsx/jsx.cjs",
|
|
33
33
|
"default": "./dist/jsx/jsx.js"
|
|
34
|
+
},
|
|
35
|
+
"./emoji": {
|
|
36
|
+
"types": "./dist/emoji.d.ts",
|
|
37
|
+
"import": "./dist/emoji.js",
|
|
38
|
+
"require": "./dist/emoji.cjs",
|
|
39
|
+
"default": "./dist/emoji.js"
|
|
34
40
|
}
|
|
35
41
|
},
|
|
36
42
|
"files": [
|
|
@@ -41,7 +47,7 @@
|
|
|
41
47
|
],
|
|
42
48
|
"license": "(MIT OR Apache-2.0)",
|
|
43
49
|
"scripts": {
|
|
44
|
-
"build": "tsup-node src/index.ts src/jsx/jsx.ts src/jsx/create-tailwind-fn.ts --clean --minify --dts --format esm,cjs --no-splitting"
|
|
50
|
+
"build": "tsup-node src/index.ts src/emoji.ts src/jsx/jsx.ts src/jsx/create-tailwind-fn.ts --clean --minify --dts --format esm,cjs --no-splitting"
|
|
45
51
|
},
|
|
46
52
|
"type": "module"
|
|
47
53
|
}
|