Skip to content

Commit

Permalink
0.24.277 (R 0.24.273)
Browse files Browse the repository at this point in the history
  • Loading branch information
ychetyrko committed Apr 24, 2024
1 parent 7998298 commit abefd58
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 29 deletions.
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "verstak",
"version": "0.24.276",
"version": "0.24.277",
"description": "Verstak - Front-End Library",
"publisher": "Nezaboodka Software",
"license": "Apache-2.0",
Expand Down Expand Up @@ -31,7 +31,7 @@
},
"homepage": "https://github.com/nezaboodka/verstak/blob/master/README.md#readme",
"dependencies": {
"reactronic": "^0.24.272"
"reactronic": "^0.24.273"
},
"devDependencies": {
"@types/node": "20.11.17",
Expand Down
2 changes: 1 addition & 1 deletion source/html/DraggableArea.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function DraggableArea(
return (
Div<DraggableAreaModel>(builder, {
mode: Mode.independentUpdate,
onChange: b => {
script: b => {
const e = b.native
const model = b.model
const dataForSensor = e.dataForSensor
Expand Down
26 changes: 13 additions & 13 deletions source/html/Elements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export function Splitter<M = unknown, R = void>(

export function rowBreak(shiftCursorDown?: number): void {
RxNode.declare(Drivers.partition, {
onChange: el => {
script: el => {
const ownerEl = el.node.owner.element as ElImpl
if (ownerEl.splitView !== undefined) {
el.style.display = "grid"
Expand All @@ -82,8 +82,8 @@ export function declareSplitter<T>(index: number, splitViewNode: RxNode<El<T>>):
Splitter({
key,
mode: Mode.independentUpdate,
onCreate: el => el.native.className = `splitter ${key}`,
onChange: b => {
creation: el => el.native.className = `splitter ${key}`,
script: b => {
const e = b.native
const model = b.model
const dataForSensor = e.dataForSensor
Expand Down Expand Up @@ -137,7 +137,7 @@ export function declareSplitter<T>(index: number, splitViewNode: RxNode<El<T>>):

export function cursor(areaParams: ElPlace): void {
RxNode.declare(Drivers.cursor, {
onChange: el => {
script: el => {
el.place = areaParams
},
})
Expand All @@ -148,7 +148,7 @@ export function cursor(areaParams: ElPlace): void {
export function Note(content: string, formatted?: boolean,
declaration?: RxNodeDecl<El<HTMLElement, void>>): RxNode<El<HTMLElement, void>> {
return RxNode.declare(Drivers.note, declaration, {
onChange: el => {
script: el => {
if (formatted)
el.native.innerHTML = content
else
Expand All @@ -168,8 +168,8 @@ export function Group<M = unknown, R = void>(
// Fragment

export function Handling<M = unknown>(
onChange: Delegate<El<void, M>>): RxNode<El<void, M>> {
return SyntheticElement({ mode: Mode.independentUpdate, onChange })
script: Delegate<El<void, M>>): RxNode<El<void, M>> {
return SyntheticElement({ mode: Mode.independentUpdate, script })
}

export function SyntheticElement<M = unknown>(
Expand Down Expand Up @@ -233,7 +233,7 @@ export class PanelDriver<T extends HTMLElement> extends HtmlDriver<T> {
SyntheticElement({
mode: Mode.independentUpdate,
triggers: { stamp: el.node.stamp }, // TODO: call this handler when all children are already rendered
onChange: () => {
script: () => {
const native = el.native as HTMLElement
const isHorizontal = el.splitView === Direction.horizontal
if (el.layoutInfo === undefined)
Expand Down Expand Up @@ -306,7 +306,7 @@ export class PanelDriver<T extends HTMLElement> extends HtmlDriver<T> {
if (childDeclaration.triggers === undefined)
childDeclaration.triggers = {}
Object.defineProperty(childDeclaration.triggers, "index", { value: partCount } )
overrideMethod(childDeclaration, "onChange", el => {
overrideMethod(childDeclaration, "script", el => {
if (isHorizontal)
el.style.gridColumn = `${partCount + 1}`
else
Expand Down Expand Up @@ -334,10 +334,10 @@ export function isSplitViewPartition(childDriver: RxNodeDriver): boolean {
return !childDriver.isPartition && childDriver !== Drivers.splitter && childDriver !== Drivers.synthetic
}

function overrideMethod(declaration: RxNodeDecl<El>, method: "onCreate" | "onChange", func: (el: El) => void): void {
const baseOnChange = declaration[method]
declaration[method] = baseOnChange !== undefined
? (el, base) => { baseOnChange(el, base); func(el) }
function overrideMethod(declaration: RxNodeDecl<El>, method: "creation" | "script", func: (el: El) => void): void {
const baseScript = declaration[method]
declaration[method] = baseScript !== undefined
? (el, base) => { baseScript(el, base); func(el) }
: (el, base) => { base(); func(el) }
}

Expand Down
8 changes: 4 additions & 4 deletions source/html/Handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export function OnClick(target: HTMLElement, action: ((pointer: PointerSensor) =
key,
mode: Mode.independentUpdate,
triggers: { target/* , action */ },
onChange: el => {
script: el => {
const pointer = target.sensors.pointer
if (target.dataForSensor.click !== undefined && pointer.clicked === target.dataForSensor.click || target.dataForSensor.click === undefined && pointer.clicked) {
if (action instanceof Function) {
Expand All @@ -38,7 +38,7 @@ export function OnResize(target: HTMLElement, action: ((element: ResizedElement)
key,
mode: Mode.independentUpdate,
triggers: { target/* , action */ },
onChange: el => {
script: el => {
const resize = target.sensors.resize
resize.resizedElements.forEach(x => {
action(x)
Expand All @@ -56,10 +56,10 @@ export function OnFocus(
key,
mode: Mode.independentUpdate,
triggers: { target, model },
onCreate: el => {
creation: el => {
el.node.configureReactronic({ throttling: 0 })
},
onChange: el => {
script: el => {
// console.log(`-> ${model.isEditMode ? "🟢" : "🔴"} RxFocuser [${key}]: ${model.isEditMode ? "focus()" : "blur()"}`)
if (switchEditMode === undefined && !(target instanceof HTMLInputElement || target.hasAttribute("tabindex")))
console.warn(`"${key ?? "noname"}" element must have "tabindex" attribute set in order to be focusable`)
Expand Down

0 comments on commit abefd58

Please sign in to comment.