efficient-easel 0.99.1 → 0.99.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/README.md +55 -26
- package/dist/autosave/index.d.ts +5 -5
- package/dist/blocks/index.d.ts +2 -2
- package/dist/canvas/index.d.ts +3 -3
- package/dist/chrome/index.d.ts +13 -9
- package/dist/chrome/index.js +9 -9
- package/dist/chunk-672FAEKU.js +1 -0
- package/dist/chunk-7JTL3P6P.js +1 -0
- package/dist/chunk-F2PIG3AA.js +10 -0
- package/dist/chunk-XUE5O62R.js +3 -0
- package/dist/copy/index.d.ts +5 -5
- package/dist/data/index.d.ts +4 -4
- package/dist/drag/index.d.ts +4 -4
- package/dist/{editor/editor.css → easel/easel.css} +1 -1
- package/dist/easel/index.d.ts +385 -0
- package/dist/easel/index.js +1 -0
- package/dist/edit-lock/index.d.ts +5 -3
- package/dist/edit-lock/index.js +1 -1
- package/dist/editor/index.d.ts +9 -360
- package/dist/editor/index.js +1 -9
- package/dist/fields/index.d.ts +4 -4
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/menu/index.d.ts +8 -6
- package/dist/menu/index.js +4 -4
- package/dist/node-ops/index.d.ts +9 -9
- package/dist/panel/index.d.ts +1 -1
- package/dist/pick/index.d.ts +3 -3
- package/dist/rail/index.d.ts +10 -6
- package/dist/rail/index.js +1 -1
- package/dist/rail/rail.css +1 -1
- package/dist/strings/catalogue.d.ts +23 -17
- package/dist/strings/catalogue.js +1 -1
- package/dist/strings/index.d.ts +28 -20
- package/dist/strings/index.js +2 -2
- package/dist/style-clipboard/index.d.ts +5 -5
- package/dist/tree/index.d.ts +2 -2
- package/dist/{types-Dy6oR6Z2.d.ts → types-BOSGNvil.d.ts} +26 -14
- package/dist/{types-DNrn_w4V.d.ts → types-Bs_gVkVI.d.ts} +18 -10
- package/dist/{types-pGBXevBU.d.ts → types-DO-b0LNj.d.ts} +13 -7
- package/dist/{types-CnRzp9oc.d.ts → types-p9j2Fac7.d.ts} +11 -9
- package/dist/{watch-DmasQA61.d.ts → watch-B5RTR-WX.d.ts} +1 -1
- package/dist/{wordFit-9B9nqyf3.d.ts → wordFit-D4S36PvB.d.ts} +1 -1
- package/dist/{words-D9ChvbNC.d.ts → words-BDignMl_.d.ts} +1 -1
- package/dist/{words-bOMsUJk9.d.ts → words-C74EUpFr.d.ts} +2 -2
- package/dist/{words-B2YLaKEr.d.ts → words-CnnHb9jo.d.ts} +1 -1
- package/dist/{words-DOhF-4D4.d.ts → words-DMG4dYq2.d.ts} +1 -1
- package/dist/{words-BK-npta-.d.ts → words-N4ebT88_.d.ts} +1 -1
- package/dist/{words-Cqmyey0s.d.ts → words-c-3h9xQQ.d.ts} +2 -2
- package/dist/{words-B87GIFWH.d.ts → words-is_Vy6hn.d.ts} +1 -1
- package/package.json +9 -3
- package/dist/chunk-IBOFSS56.js +0 -3
- package/dist/chunk-JE63JHKO.js +0 -1
- package/dist/chunk-TDA4HH54.js +0 -1
- /package/dist/{chunk-OWBO4WKA.js → chunk-2PHD4L6A.js} +0 -0
- /package/dist/{chunk-GGTPNGFJ.js → chunk-AELNNAFM.js} +0 -0
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* A plain module with no import, in drag's own folder: drag may reach only its
|
|
7
7
|
* lane (`tests/drag-leaf-safety.test.ts`), so `AddPanel` and `CanvasDragLayer`
|
|
8
8
|
* do NOT read the strings provider. They take their group as `words`, and a
|
|
9
|
-
* host passes `
|
|
9
|
+
* host passes `useEaselStrings().drag.add` / `.drag.canvas`.
|
|
10
10
|
*/
|
|
11
11
|
type DragWords = {
|
|
12
12
|
add: {
|
|
@@ -46,7 +46,7 @@ declare const COPY_ALIGNS: readonly ["left", "center", "right", "justify"];
|
|
|
46
46
|
type CopyAlign = (typeof COPY_ALIGNS)[number];
|
|
47
47
|
/** The word each direction is called. American spelling, per the product's own
|
|
48
48
|
* rule (British is for client-facing design work, not the product). The words
|
|
49
|
-
* themselves are ./words' (`
|
|
49
|
+
* themselves are ./words' (`EaselStrings.copy.align`); this is their English. */
|
|
50
50
|
declare const COPY_ALIGN_LABELS: Record<CopyAlign, string>;
|
|
51
51
|
/** The mark each direction draws. `justify` is `align-separate` — the icon
|
|
52
52
|
* set's own "rows pushed apart to both edges", which is what justified text
|
|
@@ -84,7 +84,7 @@ declare const COPY_ALIGN_FIT: {
|
|
|
84
84
|
/** The strip's options, for the subset a host can honour. Order is always this
|
|
85
85
|
* module's, never the caller's array order — so two hosts offering the same
|
|
86
86
|
* three directions cannot draw them in two orders. `labels` is the words in
|
|
87
|
-
* the host's language (`
|
|
87
|
+
* the host's language (`useEaselStrings().copy.align`, 0.95.0); left out,
|
|
88
88
|
* English. */
|
|
89
89
|
declare function copyAlignOptions(allow: readonly CopyAlign[], labels?: Record<CopyAlign, string>): {
|
|
90
90
|
id: "left" | "right" | "center" | "justify";
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* A plain module with no import. The style clipboard imports React's JSX
|
|
7
7
|
* runtime and nothing else (`tests/style-clipboard-leaf-safety.test.ts`), so it
|
|
8
8
|
* reads no provider: `styleMenuItems` and `pasteMessage` take these as an
|
|
9
|
-
* argument, and a host passes `
|
|
9
|
+
* argument, and a host passes `useEaselStrings().styleClipboard`.
|
|
10
10
|
*/
|
|
11
11
|
type StyleClipboardWords = {
|
|
12
12
|
/** The Copy style row. */
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* A plain module with no import, in node-ops' own folder (its lane:
|
|
7
7
|
* `tests/node-ops-leaf-safety.test.ts`). `nodeMenuItems` is a plain function,
|
|
8
8
|
* so it takes these as `options.words`; a host passes
|
|
9
|
-
* `
|
|
9
|
+
* `useEaselStrings().menu`. A row's `rows` override still wins over them.
|
|
10
10
|
*
|
|
11
11
|
* The shortcuts drawn beside Copy, Cut and Paste (⌘C, ⌘X, ⌘V) are key names,
|
|
12
12
|
* not words, and stay as they are; `rows` changes one.
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* The tree is hook-free, so it does not read the strings provider: `TreeRow`
|
|
7
7
|
* takes these as its `words` prop and a host passes
|
|
8
|
-
* `
|
|
8
|
+
* `useEaselStrings().tree`.
|
|
9
9
|
*/
|
|
10
10
|
type TreeWords = {
|
|
11
11
|
/** What a draggable row says after 0.7 s on it. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as SaveTone } from './types-
|
|
1
|
+
import { S as SaveTone } from './types-p9j2Fac7.js';
|
|
2
2
|
|
|
3
3
|
/** Time and timers, passed in so a test can run minutes in a millisecond. */
|
|
4
4
|
type AutosaveClock = {
|
|
@@ -121,7 +121,7 @@ type SaveWords = {
|
|
|
121
121
|
unsaved: string;
|
|
122
122
|
};
|
|
123
123
|
/**
|
|
124
|
-
* `words` is the host's language (`
|
|
124
|
+
* `words` is the host's language (`useEaselStrings().save`); left out, the
|
|
125
125
|
* pill speaks English as it always has.
|
|
126
126
|
*/
|
|
127
127
|
declare function saveIndicator(state: AutosaveSnapshot, words?: SaveWords): SaveIndicator;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* A plain module with no import, in the pickers' own folder: they may reach
|
|
6
6
|
* nothing else (`tests/pick-leaf-safety.test.ts`), so they do NOT read the
|
|
7
7
|
* strings provider. `ColourPicker` and `ImageBox` take their group as `words`,
|
|
8
|
-
* and a host passes `
|
|
8
|
+
* and a host passes `useEaselStrings().pick.colour` / `.pick.image`.
|
|
9
9
|
*/
|
|
10
10
|
type PickWords = {
|
|
11
11
|
colour: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "efficient-easel",
|
|
3
|
-
"version": "0.99.
|
|
3
|
+
"version": "0.99.2",
|
|
4
4
|
"description": "Efficient Easel: the EFFICIENT editors' shared engine and chrome: the saved document as pure functions, the published renderer, and the editor frame, panels, Layers tree, text grammar and type-in-place box. Published as editor-shell up to 0.66.0 and as efficient-editor up to 0.95.0.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "Efficient Pty Ltd",
|
|
@@ -97,12 +97,18 @@
|
|
|
97
97
|
"default": "./dist/fields/index.js"
|
|
98
98
|
},
|
|
99
99
|
"./fields.css": "./dist/fields/fields.css",
|
|
100
|
+
"./easel": {
|
|
101
|
+
"types": "./dist/easel/index.d.ts",
|
|
102
|
+
"import": "./dist/easel/index.js",
|
|
103
|
+
"default": "./dist/easel/index.js"
|
|
104
|
+
},
|
|
105
|
+
"./easel.css": "./dist/easel/easel.css",
|
|
100
106
|
"./editor": {
|
|
101
107
|
"types": "./dist/editor/index.d.ts",
|
|
102
108
|
"import": "./dist/editor/index.js",
|
|
103
109
|
"default": "./dist/editor/index.js"
|
|
104
110
|
},
|
|
105
|
-
"./editor.css": "./dist/
|
|
111
|
+
"./editor.css": "./dist/easel/easel.css",
|
|
106
112
|
"./autosave": {
|
|
107
113
|
"types": "./dist/autosave/index.d.ts",
|
|
108
114
|
"import": "./dist/autosave/index.js",
|
|
@@ -182,7 +188,7 @@
|
|
|
182
188
|
"typescript": "^5.3.0"
|
|
183
189
|
},
|
|
184
190
|
"scripts": {
|
|
185
|
-
"build": "tsup && cp src/rail/rail.css dist/rail/rail.css && cp src/shell/shell.css dist/shell/shell.css && cp src/gold/gold.css dist/gold/gold.css && cp src/copy/copy.css dist/copy/copy.css && cp src/panel/panel.css dist/panel/panel.css && cp src/menu/menu.css dist/menu/menu.css && cp src/chrome/chrome.css dist/chrome/chrome.css && cp src/tree/tree.css dist/tree/tree.css && cp src/drag/drag.css dist/drag/drag.css && cp src/pick/pick.css dist/pick/pick.css && cp src/fields/fields.css dist/fields/fields.css && cp src/
|
|
191
|
+
"build": "tsup && cp src/rail/rail.css dist/rail/rail.css && cp src/shell/shell.css dist/shell/shell.css && cp src/gold/gold.css dist/gold/gold.css && cp src/copy/copy.css dist/copy/copy.css && cp src/panel/panel.css dist/panel/panel.css && cp src/menu/menu.css dist/menu/menu.css && cp src/chrome/chrome.css dist/chrome/chrome.css && cp src/tree/tree.css dist/tree/tree.css && cp src/drag/drag.css dist/drag/drag.css && cp src/pick/pick.css dist/pick/pick.css && cp src/fields/fields.css dist/fields/fields.css && cp src/easel/easel.css dist/easel/easel.css",
|
|
186
192
|
"dev": "tsup --watch",
|
|
187
193
|
"typecheck": "tsc --noEmit && tsc -p tsconfig.test.json",
|
|
188
194
|
"test": "node scripts/test.mjs",
|
package/dist/chunk-IBOFSS56.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{DEFAULT_RAIL_WORDS as a}from"./chunk-2OAZYSWJ.js";import{wordFitVars as i}from"./chunk-BZ5ASXOL.js";import{jsxs as e,jsx as r}from"react/jsx-runtime";function o({label:a,worded:i,icon:o,active:l,disabled:t,onSelect:n,className:d}){const s=["es-rail-btn",l?"is-active":"",d??""].filter(Boolean).join(" ");/* @__PURE__ */
|
|
2
|
-
return e("button",{type:"button",className:s,title:a,"aria-label":a,"aria-pressed":"boolean"==typeof l?l:void 0,disabled:t,onClick:t?void 0:n,children:[o,i?/* @__PURE__ */r("span",{className:"es-rail-word","aria-hidden":"true",children:a}):null]})}function l({items:e,ariaLabel:l=a.label,className:t,orientation:n="column",wordFit:d}){const s="row"===n,c=s&&d?d:void 0;/* @__PURE__ */
|
|
3
|
-
return r("div",{className:["es-rail",s?"es-rail-row":"",c?"is-measured":"",t??""].filter(Boolean).join(" "),role:"toolbar","aria-orientation":s?"horizontal":"vertical","aria-label":l,style:c&&i(e.length,c),children:e.map(a=>/* @__PURE__ */r(o,{label:a.label,worded:Boolean(c),icon:a.icon,active:a.active,disabled:a.disabled,onSelect:a.onSelect},a.id))})}var t={railWidth:46,railPaddingY:8,railGap:4,railRadius:12,buttonSize:34,buttonRadius:9,iconSize:18,wordPaddingX:8,wordGap:8,wordFontSize:12,wordFontWeight:500,transition:"background 0.12s, color 0.12s",disabledOpacity:.35,color:{background:"#ffffff",shadow:"0 1px 2px rgba(0, 0, 0, 0.05), 0 10px 30px rgba(0, 0, 0, 0.06)",idle:"#6b7280",hoverBg:"#f3f4f6",hoverFg:"#111827",accent:"#2563eb",accentTint:"#eff6ff"}},n={railWidth:"--es-rail-w",railPaddingY:"--es-rail-pad-y",railGap:"--es-rail-gap",railRadius:"--es-rail-radius",buttonSize:"--es-rail-btn-size",buttonRadius:"--es-rail-btn-radius",iconSize:"--es-rail-icon-size",wordPaddingX:"--es-rail-word-pad-x",wordGap:"--es-rail-word-gap",wordFontSize:"--es-rail-word-size",wordFontWeight:"--es-rail-word-weight",background:"--es-rail-bg",shadow:"--es-rail-shadow",idle:"--es-rail-fg",hoverBg:"--es-rail-hover-bg",hoverFg:"--es-rail-hover-fg",accent:"--es-rail-accent",accentTint:"--es-rail-accent-tint"};export{l as EditorRail,o as EditorRailButton,n as railCssVars,t as railTokens};
|
package/dist/chunk-JE63JHKO.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{DEFAULT_PICK_WORDS as o}from"./chunk-ZAOM6PFH.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as r}from"./chunk-6WY6ZXJG.js";import{DEFAULT_CANVAS_WORDS as t}from"./chunk-GGTPNGFJ.js";import{DEFAULT_FIELDS_WORDS as m}from"./chunk-SUO5627P.js";import{DEFAULT_TREE_WORDS as n}from"./chunk-H4B72XCJ.js";import{DEFAULT_PANEL_WORDS as c}from"./chunk-7A7O2JWQ.js";import{DEFAULT_NODE_MENU_WORDS as f}from"./chunk-WK3AFPXY.js";import{DEFAULT_SAVE_WORDS as p}from"./chunk-H6DDIBQ4.js";import{DEFAULT_CHROME_WORDS as s,DEFAULT_NOTICE_WORDS as i}from"./chunk-KDIVA6WD.js";import{DEFAULT_LOCK_WORDS as u}from"./chunk-RE4LP46F.js";import{DEFAULT_RAIL_WORDS as e}from"./chunk-2OAZYSWJ.js";import{DEFAULT_COPY_WORDS as k}from"./chunk-ZT7M24XD.js";import{DEFAULT_DRAG_WORDS as j}from"./chunk-O2NLQBFX.js";var h={notice:i,lock:u,save:p,chrome:s,rail:e,tree:n,panel:c,fields:m,pick:o,drag:j,menu:f,styleClipboard:r,copy:k,canvas:t},l=o=>"object"==typeof o&&null!==o;function a(o,r){const t={};for(const m of Object.keys(o)){const n=o[m],c=r[m];null==c?t[m]=n:l(n)?t[m]=l(c)?a(n,c):n:t[m]=typeof c==typeof n?c:n}return t}function y(o,r){return r?a(o,r):o}export{h as DEFAULT_EDITOR_STRINGS,y as mergeEditorStrings};
|
package/dist/chunk-TDA4HH54.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{DEFAULT_LOCK_WORDS as e}from"./chunk-RE4LP46F.js";var n=e=>"editing"===e.kind;function t(e){return e?{kind:"checking"}:{kind:"editing"}}var r=e=>"blocked"===e.kind||"readonly"===e.kind||"takenover"===e.kind?e.holder:null;function o(e){if(!e||"object"!=typeof e)return null;const n=e;return"string"!=typeof n.holder_name?null:{name:n.holder_name,secondsSinceSeen:"number"==typeof n.seconds_since_seen?n.seconds_since_seen:0,secondsSinceHeld:"number"==typeof n.seconds_since_held?n.seconds_since_held:0}}var a=e=>e?{edit:!0,insert:!0,delete:!0,duplicate:!0,drag:!1}:{edit:!1,insert:!1,delete:!1,duplicate:!1,drag:!1};function s(n,t=e){if(!Number.isFinite(n)||n<45)return t.justNow;const r=Math.round(n/60);if(r<60)return t.minutesAgo({count:r});const o=Math.round(r/60);return t.hoursAgo({count:o})}var c=(n,t=e)=>n.trim()||t.someone;function d(){return`tab-${"undefined"!=typeof crypto&&"randomUUID"in crypto?crypto.randomUUID():Math.random().toString(36).slice(2)}`.slice(0,64)}var i="edit_lock_taken";function u(e,t,r){return!(n(e)||!n(t))&&(r.pending&&r.autoSaveEnabled&&!r.saveConflict)}function l(e,t,o){return!(null===r(e)||!n(t))&&(!o.pending&&!o.saveConflict)}function f(e,n){return e!==n&&Date.parse(e)>=Date.parse(n)}async function k(e){if(!e.ours)return!1;const n=await e.stored().catch(()=>null);return!(!n||!f(n,e.ours)||e.hasPending())&&(e.reload(),!0)}function h(e){const{readFailure:n,conflictCode:t}=e,r=e=>{const t=n(e);return t&&409===t.status?o(t.data):null},a=e=>{const n=r(e);return n?{kind:"blocked",holder:n}:{kind:"editing"}},s=(e,n)=>{const t=r(e);return t?{kind:"blocked",holder:t}:n},c=(e,n)=>{const t=r(e);return t?{kind:"takenover",holder:t}:n},d=e=>{const t=n(e);return null!==t&&(401===t.status||403===t.status)};return{accessAfterClaimFailure:a,accessAfterTakeoverFailure:s,accessAfterHeartbeatFailure:c,isAuthRejection:d,readSaveConflict:e=>{const r=n(e);if(!r||409!==r.status)return null;if(!r.data||"object"!=typeof r.data)return null;const o=r.data;return o.code!==t?null:{savedBy:"string"==typeof o.saved_by?o.saved_by:"",savedByYou:!0===o.saved_by_you,secondsAgo:"number"==typeof o.seconds_ago?o.seconds_ago:0}},readLockTaken:e=>{const t=n(e);return t&&409===t.status&&t.data&&"object"==typeof t.data?t.data.code!==i?null:o(t.data)??{name:"",secondsSinceSeen:0,secondsSinceHeld:0}:null},makeClaimBeat:e=>{let n=!1;return async t=>{let r,o;try{const a=await e.claim(t);if(e.cancelled())return;r=e.currentAccess(),o={kind:"editing"},!n&&a.heartbeat_seconds>0&&(n=!0,e.startHeartbeat(1e3*a.heartbeat_seconds))}catch(n){if(e.cancelled())return;r=e.currentAccess(),o=t?s(n,r):"checking"===r.kind?a(n):c(n,r),d(n)&&e.stopHeartbeat()}e.setAccess(o);const i=e.heldWrite();u(r,o,i)?e.releaseHeldWrite():t&&l(r,o,i)&&e.reloadIfMoved?.()}}}}export{i as EDIT_LOCK_TAKEN,t as accessForNewDocument,n as canWriteDocument,h as createEditLock,s as describeAge,a as documentPermissions,f as documentVersionMoved,r as holderOf,c as nameOrSomeone,d as newEditorClientId,o as readLockHolder,k as reloadIfVersionMoved,u as shouldReleaseHeldWrite,l as shouldReloadAfterTakeover};
|
|
File without changes
|
|
File without changes
|