@pie-element/passage 7.1.2-next.10 → 7.1.2-next.12
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../../shared/player-events/dist/index.js","../../../src/delivery/index.ts"],"sourcesContent":["//#region src/
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../../shared/player-events/dist/index.js","../../../src/delivery/index.ts"],"sourcesContent":["//#region src/session-notifier.ts\nvar e = \"commitPendingSession\", t = /* @__PURE__ */ new WeakMap();\nfunction n(e, n) {\n\tlet r = t.get(e);\n\tr || (r = /* @__PURE__ */ new Set(), t.set(e, r)), r.add(n);\n}\nfunction r(t) {\n\treturn Object.getOwnPropertyDescriptor(t, e) !== void 0;\n}\nfunction i(t) {\n\tif (r(t)) return;\n\tlet n = t[e];\n\tObject.defineProperty(t, e, {\n\t\tvalue: () => {\n\t\t\tif (typeof n == \"function\") try {\n\t\t\t\tn.call(t);\n\t\t\t} catch {}\n\t\t\to(t);\n\t\t},\n\t\tconfigurable: !0,\n\t\tenumerable: !1,\n\t\twritable: !0\n\t});\n}\nfunction a(e, t, r = {}) {\n\tlet a = r.delayMs, o = typeof a == \"function\" ? a : () => a ?? 0, s = r.maxWaitMs, c = null, l = null, u = !1, d = () => {\n\t\tc !== null && (clearTimeout(c), c = null), l !== null && (clearTimeout(l), l = null);\n\t}, f = () => {\n\t\td(), u && (u = !1, t());\n\t}, p = {\n\t\tnotify() {\n\t\t\tu = !0, c !== null && clearTimeout(c), c = setTimeout(f, Math.max(0, o())), s !== void 0 && l === null && (l = setTimeout(f, Math.max(0, s)));\n\t\t},\n\t\tflush() {\n\t\t\tif (!u) {\n\t\t\t\td();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tf();\n\t\t\t} catch (e) {\n\t\t\t\tconsole.warn(\"[session-notifier] a committed session-changed dispatch threw\", e);\n\t\t\t}\n\t\t}\n\t};\n\treturn n(e, p), i(e), p;\n}\nfunction o(e) {\n\tlet n = t.get(e);\n\tif (n) for (let e of [...n]) e.flush();\n}\n//#endregion\n//#region src/index.ts\nvar s = class e extends CustomEvent {\n\tstatic {\n\t\tthis.TYPE = \"model-set\";\n\t}\n\tconstructor(t, n, r) {\n\t\tsuper(e.TYPE, {\n\t\t\tbubbles: !0,\n\t\t\tcomposed: !0,\n\t\t\tdetail: {\n\t\t\t\tcomplete: n,\n\t\t\t\tcomponent: t,\n\t\t\t\thasModel: r\n\t\t\t}\n\t\t}), this.component = t, this.complete = n;\n\t}\n}, c = class e extends CustomEvent {\n\tstatic {\n\t\tthis.TYPE = \"session-changed\";\n\t}\n\tconstructor(t, n) {\n\t\tsuper(e.TYPE, {\n\t\t\tbubbles: !0,\n\t\t\tcomposed: !0,\n\t\t\tdetail: {\n\t\t\t\tcomplete: n,\n\t\t\t\tcomponent: t\n\t\t\t}\n\t\t}), this.component = t, this.complete = n;\n\t}\n};\n//#endregion\nexport { s as ModelSetEvent, e as SESSION_COMMIT_METHOD, c as SessionChangedEvent, a as createSessionNotifier, o as flushSessionNotifiers };\n","// @ts-nocheck\n/**\n * @synced-from pie-elements/packages/passage/src/index.js\n * @auto-generated\n *\n * This file is automatically synced from pie-elements and converted to TypeScript.\n * Manual edits will be overwritten on next sync.\n * To make changes, edit the upstream JavaScript file and run sync again.\n */\n\nimport { ModelSetEvent } from '@pie-element/shared-player-events';\nimport { renderMath } from '@pie-element/shared-math-rendering-mathjax';\nimport React from 'react';\nimport { createRoot } from 'react-dom/client';\n\nimport StimulusTabs from './stimulus-tabs.js';\n\nfunction getBaseHeadingLevel(element) {\n const player =\n element.closest('pie-player') ||\n element.closest('pie-item-player');\n\n if (player) {\n let raw = player.baseHeadingLevel;\n\n // fallback in case someone sets via HTML attribute manually\n if (raw == null) {\n raw =\n player.getAttribute('base-heading-level') ??\n player.getAttribute('baseheadinglevel');\n }\n\n const playerLevel = parseInt(raw, 10);\n\n if (Number.isFinite(playerLevel) && playerLevel >= 1 && playerLevel <= 6) {\n return playerLevel;\n }\n }\n\n return undefined;\n}\n\nexport default class PiePassage extends HTMLElement {\n constructor() {\n super();\n this._model = {\n passages: [],\n };\n this._session = null;\n this._root = null;\n this._mathObserver = null;\n this._mathRenderPending = false;\n this._playerObserver = null;\n }\n\n setLangAttribute() {\n const language = this._model && typeof this._model.language ? this._model.language : '';\n const lang = language ? language.slice(0, 2) : 'en';\n this.setAttribute('lang', lang);\n }\n\n _scheduleMathRender: any = () => {\n if (this._mathRenderPending) return;\n this._mathRenderPending = true;\n\n requestAnimationFrame(() => {\n if (this._mathObserver) {\n this._mathObserver.disconnect();\n }\n renderMath(this);\n this._mathRenderPending = false;\n setTimeout(() => {\n if (this._mathObserver) {\n this._mathObserver.observe(this, { childList: true, subtree: true });\n }\n }, 50);\n });\n };\n\n _initMathObserver() {\n if (this._mathObserver) return;\n this._mathObserver = new MutationObserver(this._scheduleMathRender);\n this._mathObserver.observe(this, { childList: true, subtree: true });\n }\n\n _disconnectMathObserver() {\n if (this._mathObserver) {\n this._mathObserver.disconnect();\n this._mathObserver = null;\n }\n }\n\n set model(s) {\n this._model = s;\n this.dispatchEvent(new ModelSetEvent(this.tagName.toLowerCase(), this._session, !!this._model));\n this.setLangAttribute();\n\n this._render();\n }\n\n set session(s) {\n this._session = s;\n }\n\n connectedCallback() {\n this.setAttribute('aria-label', 'Passage');\n this.setAttribute('role', 'region');\n this._initMathObserver();\n this._initPlayerObserver();\n this._render();\n }\n\n _render() {\n const { passages = [] } = this._model;\n\n if (this._model.passages.length > 0) {\n const passagesTabs = passages.map((passage, index) => ({\n id: index,\n ...passage,\n }));\n\n const elem = React.createElement(StimulusTabs, {\n tabs: passagesTabs,\n model: this._model,\n baseHeadingLevel: getBaseHeadingLevel(this),\n });\n\n if (!this._root) {\n this._root = createRoot(this);\n }\n this._root.render(elem);\n\n this._initMathObserver();\n }\n }\n\n _initPlayerObserver() {\n const player = this.closest('pie-player') || this.closest('pie-item-player');\n if (!player) return;\n\n this._playerObserver = new MutationObserver(() => {\n this._render();\n });\n this._playerObserver.observe(player, { attributes: true, attributeFilter: ['base-heading-level'] });\n }\n\n _disconnectPlayerObserver() {\n if (this._playerObserver) {\n this._playerObserver.disconnect();\n this._playerObserver = null;\n }\n }\n\n disconnectedCallback() {\n this._disconnectMathObserver();\n this._disconnectPlayerObserver();\n if (this._root) {\n this._root.unmount();\n this._root = null;\n }\n }\n}\n"],"mappings":";;;;;AAqDA,IAAI,IAAI,MAAM,UAAU,YAAY;CACnC;EACC,KAAK,OAAO;CACb;CACA,YAAY,GAAG,GAAG,GAAG;EACpB,MAAM,EAAE,MAAM;GACb,SAAS,CAAC;GACV,UAAU,CAAC;GACX,QAAQ;IACP,UAAU;IACV,WAAW;IACX,UAAU;GACX;EACD,CAAC,GAAG,KAAK,YAAY,GAAG,KAAK,WAAW;CACzC;AACD;CAAO,MAAM,UAAU,YAAY;CAClC;EACC,KAAK,OAAO;CACb;CACA,YAAY,GAAG,GAAG;EACjB,MAAM,EAAE,MAAM;GACb,SAAS,CAAC;GACV,UAAU,CAAC;GACX,QAAQ;IACP,UAAU;IACV,WAAW;GACZ;EACD,CAAC,GAAG,KAAK,YAAY,GAAG,KAAK,WAAW;CACzC;AACD;;;ACjEA,SAAS,EAAoB,GAAS;CACpC,IAAM,IACJ,EAAQ,QAAQ,YAAY,KAC5B,EAAQ,QAAQ,iBAAiB;CAEnC,IAAI,GAAQ;EACV,IAAI,IAAM,EAAO;EAGjB,AACE,MACE,EAAO,aAAa,oBAAoB,KACxC,EAAO,aAAa,kBAAkB;EAG1C,IAAM,IAAc,SAAS,GAAK,EAAE;EAEpC,IAAI,OAAO,SAAS,CAAW,KAAK,KAAe,KAAK,KAAe,GACrE,OAAO;CAEX;AAGF;AAEA,IAAqB,IAArB,cAAwC,YAAY;CAClD,cAAc;EASZ,AARA,MAAM,GACN,KAAK,SAAS,EACZ,UAAU,CAAC,EAC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AAK,OAAO,SAAS,SAAS,GAAG;GACnC,IAAM,IAAe,EAAS,KAAK,GAAS,OAAW;IACrD,IAAI;IACJ,GAAG;GACL,EAAE,GAEI,IAAO,EAAM,cAAc,GAAc;IAC7C,MAAM;IACN,OAAO,KAAK;IACZ,kBAAkB,EAAoB,IAAI;GAC5C,CAAC;GAOD,AALA,AACE,KAAK,UAAQ,EAAW,IAAI,GAE9B,KAAK,MAAM,OAAO,CAAI,GAEtB,KAAK,kBAAkB;EACzB;CACF;CAEA,sBAAsB;EACpB,IAAM,IAAS,KAAK,QAAQ,YAAY,KAAK,KAAK,QAAQ,iBAAiB;EACtE,MAEL,KAAK,kBAAkB,IAAI,uBAAuB;GAChD,KAAK,QAAQ;EACf,CAAC,GACD,KAAK,gBAAgB,QAAQ,GAAQ;GAAE,YAAY;GAAM,iBAAiB,CAAC,oBAAoB;EAAE,CAAC;CACpG;CAEA,4BAA4B;EAC1B,AAEE,KAAK,qBADL,KAAK,gBAAgB,WAAW,GACT;CAE3B;CAEA,uBAAuB;EAGrB,AAFA,KAAK,wBAAwB,GAC7B,KAAK,0BAA0B,GAC/B,AAEE,KAAK,WADL,KAAK,MAAM,QAAQ,GACN;CAEjB;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/passage",
|
|
3
|
-
"version": "7.1.2-next.
|
|
3
|
+
"version": "7.1.2-next.12",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -12,13 +12,13 @@
|
|
|
12
12
|
"@emotion/style": "^0.8.0",
|
|
13
13
|
"@mui/icons-material": "^7.3.4",
|
|
14
14
|
"@mui/material": "^7.3.4",
|
|
15
|
-
"@pie-lib/render-ui": "6.2.0-next.
|
|
15
|
+
"@pie-lib/render-ui": "6.2.0-next.41",
|
|
16
16
|
"prop-types": "^15.8.1",
|
|
17
|
-
"@pie-lib/config-ui": "
|
|
17
|
+
"@pie-lib/config-ui": "14.0.0-next.35",
|
|
18
18
|
"@pie-element/shared-configure-events": "0.1.0",
|
|
19
|
-
"@pie-lib/editable-html-tip-tap": "
|
|
19
|
+
"@pie-lib/editable-html-tip-tap": "3.0.0-next.35",
|
|
20
20
|
"@pie-element/shared-lodash": "0.1.1-next.1",
|
|
21
|
-
"@pie-element/shared-player-events": "0.1.0",
|
|
21
|
+
"@pie-element/shared-player-events": "0.1.1-next.0",
|
|
22
22
|
"@pie-element/shared-math-rendering-mathjax": "0.1.1-next.0",
|
|
23
23
|
"debug": "^4.4.3",
|
|
24
24
|
"react": "^18.2.0",
|
|
@@ -89,13 +89,6 @@
|
|
|
89
89
|
"print.js"
|
|
90
90
|
],
|
|
91
91
|
"sideEffects": false,
|
|
92
|
-
"devDependencies": {
|
|
93
|
-
"vite": "^8.0.1",
|
|
94
|
-
"typescript": "^5.9.3",
|
|
95
|
-
"@vitejs/plugin-react": "^6.0.1",
|
|
96
|
-
"@types/react": "^18.2.0",
|
|
97
|
-
"@types/react-dom": "^18.2.0"
|
|
98
|
-
},
|
|
99
92
|
"scripts": {
|
|
100
93
|
"build": "bun x vite build && bun x vite build --config ../../../tools/vite/element-browser.config.ts && bun x vite build --config ../../../tools/vite/element-legacy-print.config.ts && bun x vite build --config vite.config.iife.ts && bun x tsc --emitDeclarationOnly",
|
|
101
94
|
"dev": "bun x vite",
|