@tatamicks/text 0.1.3 → 0.1.4
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/index.js +1 -1
- package/dist/index.mjs +40 -40
- package/dist/text.css +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -19,5 +19,5 @@
|
|
|
19
19
|
<%s {...props} />
|
|
20
20
|
React keys must be passed directly to JSX without using spread:
|
|
21
21
|
let props = %s;
|
|
22
|
-
<%s key={someKey} {...props} />`,i,l,w,l),Q[l+i]=!0)}if(l=null,o!==void 0&&(h(o),l=""+o),g(n)&&(h(n.key),l=""+n.key),"key"in n){o={};for(var J in n)J!=="key"&&(o[J]=n[J])}else o=n;return l&&x(o,typeof e=="function"?e.displayName||e.name||"Unknown":e),$(e,l,o,u(),L,q)}function R(e){A(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===p&&(e._payload.status==="fulfilled"?A(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function A(e){return typeof e=="object"&&e!==null&&e.$$typeof===O}var E=f,O=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),z=Symbol.for("react.strict_mode"),Y=Symbol.for("react.profiler"),y=Symbol.for("react.consumer"),H=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),r=Symbol.for("react.suspense"),c=Symbol.for("react.suspense_list"),_=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),V=Symbol.for("react.client.reference"),N=E.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,S=Object.prototype.hasOwnProperty,U=Array.isArray,k=console.createTask?console.createTask:function(){return null};E={react_stack_bottom_frame:function(e){return e()}};var T,G={},X=E.react_stack_bottom_frame.bind(E,d)(),Z=k(m(d)),Q={};I.Fragment=j,I.jsx=function(e,n,o){var i=1e4>N.recentlyCreatedOwnerStacks++;return P(e,n,o,!1,i?Error("react-stack-top-frame"):X,i?k(m(e)):Z)},I.jsxs=function(e,n,o){var i=1e4>N.recentlyCreatedOwnerStacks++;return P(e,n,o,!0,i?Error("react-stack-top-frame"):X,i?k(m(e)):Z)}})()),I}var te;function ie(){return te||(te=1,process.env.NODE_ENV==="production"?W.exports=oe():W.exports=ae()),W.exports}var F=ie();const le="
|
|
22
|
+
<%s key={someKey} {...props} />`,i,l,w,l),Q[l+i]=!0)}if(l=null,o!==void 0&&(h(o),l=""+o),g(n)&&(h(n.key),l=""+n.key),"key"in n){o={};for(var J in n)J!=="key"&&(o[J]=n[J])}else o=n;return l&&x(o,typeof e=="function"?e.displayName||e.name||"Unknown":e),$(e,l,o,u(),L,q)}function R(e){A(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===p&&(e._payload.status==="fulfilled"?A(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function A(e){return typeof e=="object"&&e!==null&&e.$$typeof===O}var E=f,O=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),z=Symbol.for("react.strict_mode"),Y=Symbol.for("react.profiler"),y=Symbol.for("react.consumer"),H=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),r=Symbol.for("react.suspense"),c=Symbol.for("react.suspense_list"),_=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),V=Symbol.for("react.client.reference"),N=E.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,S=Object.prototype.hasOwnProperty,U=Array.isArray,k=console.createTask?console.createTask:function(){return null};E={react_stack_bottom_frame:function(e){return e()}};var T,G={},X=E.react_stack_bottom_frame.bind(E,d)(),Z=k(m(d)),Q={};I.Fragment=j,I.jsx=function(e,n,o){var i=1e4>N.recentlyCreatedOwnerStacks++;return P(e,n,o,!1,i?Error("react-stack-top-frame"):X,i?k(m(e)):Z)},I.jsxs=function(e,n,o){var i=1e4>N.recentlyCreatedOwnerStacks++;return P(e,n,o,!0,i?Error("react-stack-top-frame"):X,i?k(m(e)):Z)}})()),I}var te;function ie(){return te||(te=1,process.env.NODE_ENV==="production"?W.exports=oe():W.exports=ae()),W.exports}var F=ie();const le="_ghost_tf9uv_15",se={ghost:le},B=f.forwardRef(({props:t,value:s,onChange:h,onBlur:m,readOnly:u},d)=>{const g=f.useRef(null),x=f.useRef(null),D=f.useRef(null),$=f.useRef(null),[P,R]=f.useState({top:0,bottom:0}),[A,E]=f.useState(null);f.useEffect(()=>{if(!t.multiline)return;const r=$.current,c=D.current;if(!r||!c)return;r.value=s??"";const _=window.getComputedStyle(c),p=Number.parseFloat(_.paddingTop),b=Number.parseFloat(_.paddingBottom),V=Number.parseFloat(_.paddingLeft),N=Number.parseFloat(_.paddingRight),S=c.clientHeight-p-b,U=c.clientWidth-V-N;r.style.width=`${U}px`,r.style.paddingTop="0px",r.style.paddingBottom="0px";const k=r.scrollHeight;if(E(S),k<S){const T=S-k;switch(t.alignItems){case a.VerticalAlign.top:R({top:0,bottom:T});break;case a.VerticalAlign.bottom:R({top:T,bottom:0});break;default:R({top:T/2,bottom:T/2});break}}else R({top:0,bottom:0})},[t,s]),f.useImperativeHandle(d,()=>({focus:()=>{var r;(r=g.current)==null||r.focus()}}),[]);const O=f.useMemo(()=>{const r={width:"100%",height:"100%",display:"flex",boxSizing:"border-box",overflow:"hidden"};switch(t.justifyContent){case a.HorizontalAlign.center:r.justifyContent="center";break;case a.HorizontalAlign.right:r.justifyContent="flex-end";break;default:r.justifyContent="flex-start";break}switch(t.alignItems){case a.VerticalAlign.top:r.alignItems="flex-start";break;case a.VerticalAlign.bottom:r.alignItems="flex-end";break;default:r.alignItems="center";break}if(t.isIndividual)t.top&&(r.paddingTop=a.toPx.fromDim(t.top)),t.right&&(r.paddingRight=a.toPx.fromDim(t.right)),t.bottom&&(r.paddingBottom=a.toPx.fromDim(t.bottom)),t.left&&(r.paddingLeft=a.toPx.fromDim(t.left));else if(t.all){const c=a.toPx.fromDim(t.all);r.padding=`${c}px`}return r},[t]),v=f.useMemo(()=>{const r={background:"transparent",border:"none",outline:"none",resize:"none",padding:0,margin:0,width:"100%",boxSizing:"border-box",fontFamily:"inherit",color:"inherit"};t.fontSize&&(r.fontSize=`${a.toPx.fromDim(t.fontSize)}px`),t.fontFamily&&(r.fontFamily=t.fontFamily),t.color&&(r.color=t.color),r.fontWeight=t.fontWeight?"bold":"normal",r.fontStyle=t.italic?"italic":"normal";const c=[];switch(t.underline&&c.push("underline"),t.lineThrough&&c.push("line-through"),r.textDecoration=c.length>0?c.join(" "):"none",t.lineHeight&&(r.lineHeight=t.lineHeight),t.justifyContent){case a.HorizontalAlign.center:r.textAlign="center";break;case a.HorizontalAlign.right:r.textAlign="right";break;default:r.textAlign="left";break}return r},[t]),j=f.useMemo(()=>({...v,position:"absolute",top:0,left:0,width:"100%",height:"auto",visibility:"hidden",pointerEvents:"none",overflow:"hidden",whiteSpace:"pre-wrap",wordWrap:"break-word",overflowWrap:"break-word",padding:0,border:"none",boxSizing:"border-box",resize:"none"}),[v]),z=r=>{h(r.target.value)},Y=()=>{m==null||m(s)},y=!u;if(t.multiline){const r={...v,resize:"none",overflow:"auto",height:A!==null?`${A}px`:"100%",paddingTop:`${P.top}px`,paddingBottom:`${P.bottom}px`},p={ref:b=>{x.current=b,g.current=b},value:s??"",onChange:b=>{z(b)},onBlur:Y,style:r,placeholder:t.placeholder,readOnly:!y,tabIndex:y?0:-1};return F.jsxs("div",{ref:D,style:O,children:[F.jsx("textarea",{ref:$,className:se.ghost,style:j,"aria-hidden":"true",readOnly:!0,tabIndex:-1,rows:1,value:s??""}),F.jsx("textarea",{...p})]})}const H={...v,height:"100%"},M={ref:g,value:s??"",onChange:z,onBlur:Y,style:H,placeholder:t.placeholder,readOnly:!y,tabIndex:y?0:-1};return F.jsx("div",{style:O,children:F.jsx("input",{type:"text",...M})})});B.displayName="TextRenderer";function re(t=a.DEFAULT_FONT_FAMILY){return{kind:"text",meta:{displayName:"テキスト",description:"リッチなテキスト編集ブロック",defaultSize:{w:4,h:2}},Renderer:B,properties:{...a.universalProperties,...a.placeholderDefinition,...a.fontStyleDefinition,...a.multilineDefinition,...a.validationDefinition,fontFamily:{defaultValue:"sans-serif",label:"フォント",group:"フォント",Component:a.Select,config:{placeholder:"フォントを選択",options:t}}},validateProps:s=>s,validateValue:s=>typeof s=="string"?s:typeof s=="number"?String(s):null}}const ce=re();exports.TextPlugin=ce;exports.TextRenderer=B;exports.createTextPlugin=re;
|
|
23
23
|
//# sourceMappingURL=index.js.map
|
package/dist/index.mjs
CHANGED
|
@@ -100,11 +100,11 @@ function Re() {
|
|
|
100
100
|
}
|
|
101
101
|
if (n) {
|
|
102
102
|
n = console;
|
|
103
|
-
var
|
|
104
|
-
return
|
|
103
|
+
var o = n.error, a = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
104
|
+
return o.call(
|
|
105
105
|
n,
|
|
106
106
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
107
|
-
|
|
107
|
+
a
|
|
108
108
|
), l(e);
|
|
109
109
|
}
|
|
110
110
|
}
|
|
@@ -134,14 +134,14 @@ function Re() {
|
|
|
134
134
|
return e.key !== void 0;
|
|
135
135
|
}
|
|
136
136
|
function b(e, n) {
|
|
137
|
-
function
|
|
137
|
+
function o() {
|
|
138
138
|
R || (R = !0, console.error(
|
|
139
139
|
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
140
140
|
n
|
|
141
141
|
));
|
|
142
142
|
}
|
|
143
|
-
|
|
144
|
-
get:
|
|
143
|
+
o.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
144
|
+
get: o,
|
|
145
145
|
configurable: !0
|
|
146
146
|
});
|
|
147
147
|
}
|
|
@@ -151,14 +151,14 @@ function Re() {
|
|
|
151
151
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
152
152
|
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
153
153
|
}
|
|
154
|
-
function D(e, n,
|
|
155
|
-
var i =
|
|
154
|
+
function D(e, n, o, a, z, B) {
|
|
155
|
+
var i = o.ref;
|
|
156
156
|
return e = {
|
|
157
157
|
$$typeof: P,
|
|
158
158
|
type: e,
|
|
159
159
|
key: n,
|
|
160
|
-
props:
|
|
161
|
-
_owner:
|
|
160
|
+
props: o,
|
|
161
|
+
_owner: a
|
|
162
162
|
}, (i !== void 0 ? i : null) !== null ? Object.defineProperty(e, "ref", {
|
|
163
163
|
enumerable: !1,
|
|
164
164
|
get: F
|
|
@@ -184,13 +184,13 @@ function Re() {
|
|
|
184
184
|
value: B
|
|
185
185
|
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
186
186
|
}
|
|
187
|
-
function w(e, n,
|
|
187
|
+
function w(e, n, o, a, z, B) {
|
|
188
188
|
var i = n.children;
|
|
189
189
|
if (i !== void 0)
|
|
190
|
-
if (
|
|
190
|
+
if (a)
|
|
191
191
|
if (J(i)) {
|
|
192
|
-
for (
|
|
193
|
-
h(i[
|
|
192
|
+
for (a = 0; a < i.length; a++)
|
|
193
|
+
h(i[a]);
|
|
194
194
|
Object.freeze && Object.freeze(i);
|
|
195
195
|
} else
|
|
196
196
|
console.error(
|
|
@@ -202,31 +202,31 @@ function Re() {
|
|
|
202
202
|
var k = Object.keys(n).filter(function(ie) {
|
|
203
203
|
return ie !== "key";
|
|
204
204
|
});
|
|
205
|
-
|
|
205
|
+
a = 0 < k.length ? "{key: someKey, " + k.join(": ..., ") + ": ...}" : "{key: someKey}", ee[i + a] || (k = 0 < k.length ? "{" + k.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
206
206
|
`A props object containing a "key" prop is being spread into JSX:
|
|
207
207
|
let props = %s;
|
|
208
208
|
<%s {...props} />
|
|
209
209
|
React keys must be passed directly to JSX without using spread:
|
|
210
210
|
let props = %s;
|
|
211
211
|
<%s key={someKey} {...props} />`,
|
|
212
|
-
|
|
212
|
+
a,
|
|
213
213
|
i,
|
|
214
214
|
k,
|
|
215
215
|
i
|
|
216
|
-
), ee[i +
|
|
216
|
+
), ee[i + a] = !0);
|
|
217
217
|
}
|
|
218
|
-
if (i = null,
|
|
219
|
-
|
|
218
|
+
if (i = null, o !== void 0 && (g(o), i = "" + o), d(n) && (g(n.key), i = "" + n.key), "key" in n) {
|
|
219
|
+
o = {};
|
|
220
220
|
for (var G in n)
|
|
221
|
-
G !== "key" && (
|
|
222
|
-
} else
|
|
221
|
+
G !== "key" && (o[G] = n[G]);
|
|
222
|
+
} else o = n;
|
|
223
223
|
return i && b(
|
|
224
|
-
|
|
224
|
+
o,
|
|
225
225
|
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
226
226
|
), D(
|
|
227
227
|
e,
|
|
228
228
|
i,
|
|
229
|
-
|
|
229
|
+
o,
|
|
230
230
|
c(),
|
|
231
231
|
z,
|
|
232
232
|
B
|
|
@@ -250,37 +250,37 @@ React keys must be passed directly to JSX without using spread:
|
|
|
250
250
|
_,
|
|
251
251
|
u
|
|
252
252
|
)(), K = y(f(u)), ee = {};
|
|
253
|
-
C.Fragment = O, C.jsx = function(e, n,
|
|
254
|
-
var
|
|
253
|
+
C.Fragment = O, C.jsx = function(e, n, o) {
|
|
254
|
+
var a = 1e4 > j.recentlyCreatedOwnerStacks++;
|
|
255
255
|
return w(
|
|
256
256
|
e,
|
|
257
257
|
n,
|
|
258
|
-
|
|
258
|
+
o,
|
|
259
259
|
!1,
|
|
260
|
-
|
|
261
|
-
|
|
260
|
+
a ? Error("react-stack-top-frame") : Q,
|
|
261
|
+
a ? y(f(e)) : K
|
|
262
262
|
);
|
|
263
|
-
}, C.jsxs = function(e, n,
|
|
264
|
-
var
|
|
263
|
+
}, C.jsxs = function(e, n, o) {
|
|
264
|
+
var a = 1e4 > j.recentlyCreatedOwnerStacks++;
|
|
265
265
|
return w(
|
|
266
266
|
e,
|
|
267
267
|
n,
|
|
268
|
-
|
|
268
|
+
o,
|
|
269
269
|
!0,
|
|
270
|
-
|
|
271
|
-
|
|
270
|
+
a ? Error("react-stack-top-frame") : Q,
|
|
271
|
+
a ? y(f(e)) : K
|
|
272
272
|
);
|
|
273
273
|
};
|
|
274
274
|
})()), C;
|
|
275
275
|
}
|
|
276
|
-
var
|
|
276
|
+
var oe;
|
|
277
277
|
function _e() {
|
|
278
|
-
return
|
|
278
|
+
return oe || (oe = 1, process.env.NODE_ENV === "production" ? M.exports = pe() : M.exports = Re()), M.exports;
|
|
279
279
|
}
|
|
280
280
|
var I = _e();
|
|
281
|
-
const Ee = "
|
|
281
|
+
const Ee = "_ghost_tf9uv_15", ve = {
|
|
282
282
|
ghost: Ee
|
|
283
|
-
},
|
|
283
|
+
}, ae = be(({ props: t, value: l, onChange: g, onBlur: f, readOnly: c }, u) => {
|
|
284
284
|
const d = H(null), b = H(null), F = H(null), D = H(null), [w, h] = te({ top: 0, bottom: 0 }), [A, _] = te(null);
|
|
285
285
|
he(() => {
|
|
286
286
|
if (!t.multiline) return;
|
|
@@ -458,7 +458,7 @@ const Ee = "_ghost_1acb7_15", ve = {
|
|
|
458
458
|
};
|
|
459
459
|
return /* @__PURE__ */ I.jsx("div", { style: P, children: /* @__PURE__ */ I.jsx("input", { type: "text", ...V }) });
|
|
460
460
|
});
|
|
461
|
-
|
|
461
|
+
ae.displayName = "TextRenderer";
|
|
462
462
|
function Te(t = le) {
|
|
463
463
|
return {
|
|
464
464
|
kind: "text",
|
|
@@ -468,7 +468,7 @@ function Te(t = le) {
|
|
|
468
468
|
defaultSize: { w: 4, h: 2 }
|
|
469
469
|
// デフォルトサイズ
|
|
470
470
|
},
|
|
471
|
-
Renderer:
|
|
471
|
+
Renderer: ae,
|
|
472
472
|
properties: {
|
|
473
473
|
...me,
|
|
474
474
|
...de,
|
|
@@ -495,7 +495,7 @@ function Te(t = le) {
|
|
|
495
495
|
const Se = Te();
|
|
496
496
|
export {
|
|
497
497
|
Se as TextPlugin,
|
|
498
|
-
|
|
498
|
+
ae as TextRenderer,
|
|
499
499
|
Te as createTextPlugin
|
|
500
500
|
};
|
|
501
501
|
//# sourceMappingURL=index.mjs.map
|
package/dist/text.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
[contenteditable][data-placeholder]:empty:before{content:attr(data-placeholder);color:#999;pointer-events:none;position:absolute}[contenteditable=false]{cursor:default}@media print{.
|
|
1
|
+
[contenteditable][data-placeholder]:empty:before{content:attr(data-placeholder);color:#999;pointer-events:none;position:absolute}[contenteditable=false]{cursor:default}._ghost_tf9uv_15{visibility:hidden;position:absolute;pointer-events:none}@media print{._ghost_tf9uv_15{display:none}}
|