Giter Site home page Giter Site logo

arthurclemens / dialogic Goto Github PK

View Code? Open in Web Editor NEW
57.0 3.0 1.0 32.62 MB

Dialogic: manage dialogs and notifications

Home Page: https://arthurclemens.github.io/dialogic/

License: MIT License

CSS 4.62% HTML 2.26% JavaScript 16.95% TypeScript 60.89% Svelte 15.27%
javascript reactjs mithriljs svelte dialogs notifications typescript

dialogic's Introduction

Dialogic: manage dialogs and notifications

Supported JavaScript libraries

For a more basic solution in vanilla JS, check out dialogic-js.

Features

item: a dialog/modal or a notification

  • Manage multiple items
    • Manage simultaneous (stacked) items
    • Manage a queue of items to show sequentially
  • Optional automatic mode
    • Show and hide when matching a condition such as a route
  • Transitions
    • Show and hide an item with specific transition options (or use CSS)
    • Handle separate spawn locations (for example for different types of notifications)
    • Replace an already displayed item
    • Hide all items, or only ones matching a specific id or spawn
    • Remove all items, or only ones matching a specific id or spawn
  • Timer
    • Automatic timeout to hide items after a given time
    • Pause, resume and stop a timer
  • State
    • Get the number of displayed items (all, per id or per spawn)
    • Get the paused state of a displayed item using a timer
    • Get the remaining time of a displayed item using a timer
    • Use a callback function when an item is shown or hidden
    • Use the returned Promise when an item is shown or hidden
  • Styling
    • Use custom CSS classes or style options
    • Manage timings with CSS (or use transition options)
    • Use any UI library
  • Written in TypeScript

Dialogic does not provide any styling for dialogs or notifications. This gives you the freedom to plug into your own codebase or use any other UI library.

Demo

Demo page

Usage

To create a dialog or notification, you need:

  • Functions show and hide
  • A Dialog / Notification component

The usage of the component varies somewhat per JS library - see library specific notes:

API

Dialog and Notification component

Location where the dialog or notification (after this: "item") will be drawn.

With Mithril:

m(Dialog)
m(Dialog, { spawn: "settings" })

With React:

<Dialog />
<Dialog spawn="settings" />

With Svelte:

<Dialog />
<Dialog spawn="settings" />

Options

Name Type Required Description Default value
spawn string No Spawn identifier, useful when using multiple spawn locations. See Handling multiple items with identity options "default_spawn"

show

Shows an item.

dialog.show({
  dialogic: {
    component: DialogView,
    className: "dialog",
  },
  title: "Dialog Title"
})
  • When queued is true (which is the default for notifications), any further call to show will queue the item and it will be displayed when the current item has transitioned to hidden.
  • When an instance already exists, show replaces the content.

Signature

show: <T>(options: Options<T>, componentOptions?: T) => Promise<Item<T>>;

type Dialogic.Options<T> = {
  dialogic?: DialogicOptions<T>;
} & T;

hide

Hides an item.

dialog.hide()

When identity options are used, only hides the item that match the identity options:

dialog.hide({
  dialogic: {
    id: "settings", // example: use id and/or spawn
  }
})

Signature

hide: <T>(options?: Options<T>, componentOptions?: T) => Promise<Item<T>>;

type Dialogic.Options<T> = {
  dialogic?: DialogicOptions<T>;
} & T;

dialogic options

Options passed to show, hide and hideAll. The options are further explained below.

Name Type Required Description Default value
component Function component No The component to render as an item.
className string No Class added to the wrapper around component; also the base name for transition classes (more below).
styles TransitionStyles object or (domElement: HTMLElement) => TransitionStyles No Pass transition styles in JS.
timeout number (ms) No Creates a timer. When the dialog is completely shown the timer is started automatically. After timeout the dialog is hidden. Use 0 to prevent the timer from running. For notifications 3000
queued boolean No Set to true to manage multiple dialogs in time (more useful for notifications). false; for notifications true
toggle boolean No Set to true to make show() switch between shown and hidden state. false
willShow (item: Dialogic.Item) => void No Function called just before the item will be shown (before transitioning).
didShow (item: Dialogic.Item) => void No Function called when the item is completely shown (after transitioning).
willHide (item: Dialogic.Item) => void No Function called just before the item will be hidden (before transitioning).
didHide (item: Dialogic.Item) => void No Function called when the item is completely hidden (after transitioning).
id string No Dialog identifier, useful when using multiple (stacked) items. See Handling multiple items with identity options "default_dialog" or "default_notification"
spawn string No Spawn identifier, useful when using multiple spawn locations. See Handling multiple items with identity options "default_spawn"
...componentOptions any No Options to pass to the component.

Signature

type IdentityOptions = {
  id?: string;
  spawn?: string;
}

type DialogicOptions<T> = {
  className?: string;
  component?: any;
  willShow?: ConfirmFn<T>;
  didShow?: ConfirmFn<T>;
  willHide?: ConfirmFn<T>;
  didHide?: ConfirmFn<T>;
  domElement?: HTMLElement;
  queued?: boolean;
  styles?: TransitionStyles | TransitionStylesFn;
  timeout?: number;
  toggle?: boolean;
} & IdentityOptions;

type ConfirmFn<T> = (item: Item<T>) => void;

For more type information, see index.d.ts.

component

Pass the component that will be rendered.

className

Create transitions by writing styles using the format className-suffix - where suffix is defined by its transition point.

Class suffix When is the class set What should the style do
-show-start Start of show transition Initial state before the item is shown
-show-end End of show transition State for the shown item, including the transition (properties, duration)
-hide-start Start of hide transition Initial state before the item is hidden
-hide-end End of hide transition State for the hidden item, including the transition (properties, duration)

Define those classes in CSS to create transitions. For example with className "dialog":

.dialog {
  transition: opacity 300ms ease-in-out;
  opacity: 0;
}
.dialog-show-start {}
.dialog-show-end {
  opacity: 1;
}
.dialog-hide-start {}
.dialog-hide-end {
  opacity: 0;
}

Use regular CSS syntax to define delays. Note that delays should be written at the "end" transition.

In this example, the dialog will transition towards the end fully visible and with a delay of half a second:

.dialog-show-end {
  opacity: 1;
  transition-delay: 500ms;
}

styles

Pass a style object in JavaScript instead of using a CSS file. This allows for more dynamic styling based on the current element state.

Property When is the style read What should the style do
default The default style is read at every transition moment and combined with the other styles below. Anything that saves duplication.
showStart Start of show transition Initial state before the item is shown
showEnd End of show transition State for the shown item, including the transition (properties, duration)
hideStart Start of hide transition Initial state before the item is hidden
hideEnd End of hide transition State for the hidden item, including the transition (properties, duration)

Either pass a styles object, or pass a function that returns the styles object. Because the function accepts the item's DOM elemment, styles can be modified by the current DOM state.

The object is read again for every transition, so in this example the height of the DOM element always reads the current height at that moment.

styles: (domElement: HTMLElement) => {
  const height = domElement.getBoundingClientRect().height

  return {
    default: {
      transition: "all 300ms ease-in-out",
    },
    showStart: {
      opacity: "0",
      transform: `translate3d(0, ${height}px, 0)`,
    },
    showEnd: {
      opacity: "1",
      transform: "translate3d(0, 0px,  0)",
    },
    hideEnd: {
      transitionDuration: "450ms",
      transform: `translate3d(0, ${height}px, 0)`,
      opacity: "0",
    },
  }
}

dialog.show({
  dialogic: {
    styles
  },
})

timeout

Creates a timer. The timer starts when the item is completely shown. After timeout the item will be hidden. Use 0 to prevent the timer from running.

dialog.show({
  dialogic: {
    timeout: 3000 // in ms
  },
})

See also: timer functions

queued

When true, items are shown sequentially, instead of replacing the previous item (when using the same id and spawn) or shown simultaneously (when using a different id or spawn).

notification is queued by default, so no additional setting is needed.

dialog.show({
  dialogic: {
    queued: true
  },
})

toggle

Set to true to make dialog.show() switch between shown and hidden state.

So to show and to hide a dialog, use:

dialog.show({
  dialogic: {
    toggle: true
  },
})

willShow

Function called just before the item will be shown (before transitioning).

dialog.show({
  dialogic: {
    willShow: (item) => {
      // before the item will be shown
    }
  },
})

didShow

Function called when the item is completely shown (after transitioning).

dialog.show({
  dialogic: {
    didShow: (item) => {
      // item is shown
    }
  },
})

willHide

Function called just before the item will be hidden (before transitioning).

dialog.show({
  dialogic: {
    didHide: (item) => {
      // before the item will be hidden
    }
  },
})

didHide

Function called when the item is completely hidden (after transitioning).

dialog.show({
  dialogic: {
    didHide: (item) => {
      // item is hidden
    }
  },
})

Component options

Alls options that are passed to the show functions, except for dialogic, are passed to the component.

Here the component receives option title:

dialog.show({
  dialogic: {
    component: DialogView,
  },
  title: "Dialog Title"
})

hideAll

Hides all items. All items are transitioned to their hide state.

For queued items only the first item will be transitioned - the remaining items will be removed from the queue.

dialog.hideAll()

When identity options are used, only hides the items that match the identity options:

dialog.hideAll({
  id: "settings", // example: use id and/or spawn
})

Optional dialogicOptions may be passed with specific transition options. This comes in handy when all items should hide in the same way.

const hideAllStyles = {
  showEnd: {
    opacity: "1",
  },
  hideEnd: {
    transition: "all 450ms ease-in-out",
    opacity: "0",
  },
}

dialog.hideAll({
  styles: hideAllStyles
})

Signature

hideAll: (dialogicOptions?: DialogicOptions<unknown>) => Promise<Item<T>[]>;

resetAll

Resets and hides all items. All items are reset without any transitions.

dialog.resetAll()

When identity options are used, only resets the items that match the identity options:

dialog.resetAll({
  id: "settings", // example: use id and/or spawn
})

Signature

resetAll: (identityOptions?: IdentityOptions) => Promise<Item<unknown>[]>;

Handling multiple items with identity options

Dialogic can handle multiple items in space (simulaneous view) and in time (sequential view).

Dialogs and notifications each have their own namespace and are handled separately.

  • dialog: namespace "dialog"
  • notification: namespace "notification"

Items can further be differentiated using identity options:

  • id - Differentiates simulaneous items.
  • spawn - Diffentiates locations from where to show items. Each Dialog or Notification component has its own spawn identifier.

When no id or spawn is passed, default names are used.

Simultaneous, at the same location

dialog.show({
  dialogic: {
    id: "profile",
  },
  title: "Profile dialog"
})

dialog.show({
  dialogic: {
    id: "confirm",
  },
  title: "Confirm deletion of profile"
})

Simultaneous, at different locations

dialog.show({
  dialogic: {
    spawn: "main",
  },
  title: "Main dialog"
})

dialog.show({
  dialogic: {
    spawn: "settings",
  },
  title: "Settings dialog"
})

Each spawn identifier refers to a Dialog or Notification component.

With Mithril:

m(Dialog, { spawn: "main" })
m(Dialog, { spawn: "settings" })

With React:

<Dialog spawn="1" />
<Dialog spawn="settings" />

With Svelte:

<Dialog spawn="1" />
<Dialog spawn="settings" />

Sequence of items

To show a sequence of items, option queued must be set to true. notification is queued by default, so no additional setting is needed.

exists

Returns a boolean that indicates if an item with given identity options is displayed.

To check if any dialog exists:

const exists = dialog.exists()

When identity options are used, only checks for items that match the identity options:

const exists = dialog.exists({
  id: "settings", // example: use id and/or spawn
})

Signature

exists: (identityOptions?: IdentityOptions) => boolean

React: requires useDialogicState.

getCount

Returns the number of items. Also counts the queued items that are not yet displayed.

const count = notification.getCount()

When identity options are used, only resets the items that match the identity options:

const count = notification.getCount({
  id: "settings", // example: use id and/or spawn
})

Signature

getCount: (identityOptions?: IdentityOptions) => number;

React: requires useDialogicState.

Timer functions

pause

Pauses an item if it has a timer.

Without identity options, pause will pause all items within the same namespace (so: all notifications, or all dialogs):

notification.pause()

When identity options are used, pauses the items (within the same namespace) that match the identity options:

notification.pause({
  id: "settings", // example: use id and/or spawn
})

Signature

pause: (identityOptions?: IdentityOptions) => Promise<Item<T>[]>;

resume

Resumes a paused item.

Without identity options, resume will resume all paused items within the same namespace (so: all notifications, or all dialogs):

notification.resume()

When identity options are used, resumes the items (within the same namespace) that match the identity options:

notification.resume({
  id: "settings", // example: use id and/or spawn
})

Optional minimumDuration can be passed to nudge the timer so it will show at least for minimumDuration ms:

notification.resume({
  minimumDuration: 3000
})

Signature

resume: (commandOptions?: CommandOptions) => Promise<Item<T>[]>;

type CommandOptions = IdentityOptions & TimerResumeOptions;

type TimerResumeOptions = {
  minimumDuration?: number;
}

isPaused

Returns whether an item has been paused.

notification.isPaused()

When identity options are used, finds the item that matches the identity:

notification.isPaused({
  id: "settings", // example: use id and/or spawn
})

Signature

isPaused: (identityOptions?: IdentityOptionsg) => boolean;

React: requires useDialogicState.

getRemaining

Returns the remaining timer duration in ms.

const remaining = notification.getRemaining()

When identity options are used, finds the item that matches the identity:

const remaining = notification.getRemaining({
  id: "settings", // example: use id and/or spawn
})

Signature

getRemaining: (identityOptions?: IdentityOptions) => number | undefined;

React: requires useDialogicState.

useRemaining

Hook that continuously returns the current remaining time.

Signature

useRemaining: (props: UseRemainingProps) => (number | undefined)[];

type UseRemainingProps = {
  instance: Dialogic.DialogicInstance;
  id?: string;
  spawn?: string;

  /**
   * Set to true to return seconds instead of milliseconds.
   */
  roundToSeconds?: boolean;
};

Automatically responding to a variable state, such as a route

It is often desired to automatically show a dialog at a given route, so that it can be accessed by URL, and the browser back button will hide the dialog.

A common pattern is to create a Route that contains the dialog component. A React example with React Router:

import { Route, useRouteMatch } from 'react-router-dom';

const match = useRouteMatch();
const dialogPath = `${match.url}/edit`;

<Route path={dialogPath}>
  // Dialog should appear here
</Route>

The hooks useDialogic, useDialog and useNotification allow for a declarative way of controlling elements. The element will be shown when a condition is met (such as the current route), and automatically hidden as soon as the condition is no longer met.

  • useDialog - useDialogic with instance preset to dialog.
    • For Svelte: use component UseDialog
  • useNotification - useDialogic with instance preset to notification.
    • For Svelte: use component UseNotification
  • useDialogic - generic hook that accepts instance of type Dialogic.DialogicInstance.
    • For Svelte: use component useDialogic

useDialog

For Svelte: use component UseDialog

This is a hook to automatically show a dialog when a condition is met, for instance on URL location match. The dialog will hide when the condition is no longer met.

In the following example the dialog is shown when the URL location matches the given path. This is an example for React, but the Mithril version is very similar - see the Mithril documentation.

import { useDialog } from 'dialogic-react';
import { MyDialog } from './MyDialog';

const MyComponent = () => {
  const returnPath = '/';
  const dialogPath = '/some-path';

  useDialog({
    isShow: window.location.pathname === dialogPath,
    props: {
      dialogic: {
        component: MyDialog,
        className: 'dialog',
      },
      // Props that will be passed to the MyDialog component
      returnPath,
    }
  });
};

With TypeScript

useDialog has a generic type to match the values passed to the component.

import { MyDialog, TDialogProps } from './MyDialog';

const returnPath = '/';
const dialogPath = '/some-path';
const content = 'Some async loaded content';

useDialog<TDialogProps>({
  isShow: window.location.pathname === dialogPath && !!content,
  deps: [content],
  props: {
    dialogic: {
      component: MyDialog,
      className: 'dialog',
    },
    // Props that will be passed to the MyDialog component
    // These props match type TDialogProps
    returnPath,
    content,
  }
})

Options

Name Type Required Description Default value
isShow boolean Yes A boolean value when to show the dialog. None
deps React.DependencyList No Update the hook with these deps. Use this when the instance should appear conditionally, for instance only when content exists. Can be omitted when all content is static, so no re-rendering takes place. []
props object No Props to pass to the dialog. None

Calling show and hide directly

useDialog returns methods show and hide. Using these methods you can invoke dialogs just like dialog.show and dialog.hide, with the addition that an extra condition can be set when to automatically hide the dialog.

In the example below:

  • show is used to show the dialog
  • Component MyDialog receives props hideDialog to explicitly hide the dialog
  • deps includes the URL location - whenever it changes the dialog is hidden

See the Mithril documentation for a Mithril specific example.

import { useDialog } from 'dialogic-react';
import { MyDialog } from './MyDialog';

const MyComponent = () => {
  const { show, hide } = useDialog({
    deps: [window.location.href], // as soon this value changes ...
    hide: true,                   // ... hide
    props: {
      dialogic: {
        component: MyDialog,
        className: 'dialog',
      },
      // Props that will be passed to the MyDialog component
      returnPath,
      hideDialog: () => hide(),
    }
  });

  return (
    <button onClick={() => show()}>Show dialog</button>
  )
};

Options for directed use

All options listed above, plus:

Name Type Required Description Default value
isHide boolean No Only for directed use. A boolean value when to hide the dialog. Can be used together with deps. None

Shout out

Dialogic uses the Meiosis state pattern for state management.

License

MIT

dialogic's People

Contributors

arthurclemens avatar dependabot[bot] avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

tarentino76

dialogic's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • Replace dependency npm-run-all with npm-run-all2 ^5.0.0
  • Update dependency @sveltejs/kit to v1.30.4
  • Update dependency @swc/helpers to v0.5.11
  • Update dependency @tsconfig/svelte to v5.0.4
  • Update dependency @tsconfig/svelte to v5.0.4
  • Update dependency @types/chai to v4.3.15
  • Update dependency eslint-plugin-cypress to v2.15.2
  • Update dependency npm-check-updates to v16.14.20
  • Update dependency prettier to v3.2.5
  • Update dependency svelte-preprocess to v5.1.4
  • Update dependency vite to v4.5.3
  • Update dependency @babel/eslint-parser to v7.24.5
  • Update dependency eslint to v8.57.0
  • Update dependency eslint-plugin-jest-dom to v5.4.0
  • Update dependency eslint-plugin-react to v7.34.1
  • Update dependency mocha to v10.4.0
  • Update dependency prettier-plugin-svelte to v3.2.3
  • Update dependency react-router-dom to v6.23.0
  • Update dependency svelte-check to v3.7.1
  • Update dependency typescript to v5.4.5
  • Update react monorepo (@types/react, @types/react-dom, eslint-plugin-react-hooks, react, react-dom)
  • Update typescript-eslint monorepo to v6.21.0 (@typescript-eslint/eslint-plugin, @typescript-eslint/parser)
  • Update dependency @sveltejs/adapter-auto to v3
  • Update dependency @sveltejs/kit to v2
  • Update dependency bulma to v1
  • Update dependency chai to v5
  • Update dependency eslint to v9
  • Update dependency eslint-plugin-cypress to v3
  • Update dependency eslint-plugin-simple-import-sort to v12
  • Update dependency jsdom to v24
  • Update dependency postcss-cli to v11
  • Update dependency svelte-spa-router to v4
  • Update typescript-eslint monorepo to v7 (major) (@typescript-eslint/eslint-plugin, @typescript-eslint/parser)
  • ๐Ÿ” Create all rate-limited PRs at once ๐Ÿ”

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/main.yml
  • actions/checkout v3
  • actions/setup-node v3
  • actions/cache v3
  • actions/checkout v3
  • actions/setup-node v3
  • actions/cache v3
  • actions/checkout v3
  • actions/setup-node v3
  • actions/cache v3
  • actions/checkout v3
  • actions/setup-node v3
  • actions/cache v3
  • actions/checkout v3
  • actions/setup-node v3
  • actions/cache v3
  • ubuntu 20.04
  • ubuntu 20.04
  • ubuntu 20.04
  • ubuntu 20.04
  • ubuntu 20.04
html
packages/demo-dialogic-mithril-router/index.html
  • bulma 0.9.4
packages/demo-dialogic-mithril/index.html
  • semantic-ui 2.5.0
packages/demo-dialogic-react-router/index.html
  • bulma 0.9.4
packages/demo-dialogic-react/index.html
  • semantic-ui 2.5.0
packages/demo-dialogic-svelte-router/index.html
  • bulma 0.9.4
packages/demo-dialogic-svelte/index.html
  • semantic-ui 2.5.0
packages/test-dialogic-mithril/index.html
  • bulma 0.9.4
packages/test-dialogic-react/index.html
  • bulma 0.9.4
packages/test-dialogic-svelte/index.html
  • bulma 0.9.4
npm
package.json
  • @tsconfig/svelte 5.0.2
  • @types/rollup ^0.54.0
  • @typescript-eslint/eslint-plugin ^6.0.0
  • @typescript-eslint/parser ^6.0.0
  • @vitejs/plugin-react ^4.0.0
  • cypress ^12.7.0
  • eslint ^8.34.0
  • eslint-config-airbnb ^19.0.4
  • eslint-config-next ^13.2.1
  • eslint-config-prettier 8.10.0
  • eslint-import-resolver-typescript 3.6.1
  • eslint-plugin-cypress ^2.12.1
  • eslint-plugin-import 2.29.1
  • eslint-plugin-jest-dom 5.1.0
  • eslint-plugin-json 3.1.0
  • eslint-plugin-jsx-a11y ^6.7.1
  • eslint-plugin-prettier 5.1.3
  • eslint-plugin-react 7.33.2
  • eslint-plugin-react-hooks ^4.6.0
  • eslint-plugin-simple-import-sort 10.0.0
  • eslint-plugin-svelte3 ^4.0.0
  • npm-check-updates ^16.7.9
  • npm-run-all ^4.1.5
  • postcss-cli ^10.1.0
  • prettier ^3.0.0
  • prettier-plugin-svelte ^3.0.0
  • react ^18.2.0
  • rollup-plugin-filesize ^10.0.0
  • typescript ^5.0.0
  • vite ^4.1.4
  • react ^18.0.0
  • react-dom ^18.0.0
packages/demo-dialogic-mithril-router/package.json
  • mithril ^2.2.2
  • mithril-hooks ^0.7.1
  • @types/mithril ^2.0.12
  • typescript ^5.0.0
  • vite ^4.1.4
packages/demo-dialogic-mithril/package.json
  • mithril ^2.2.2
  • mithril-hooks ^0.7.1
  • @types/mithril ^2.0.12
  • shelljs ^0.8.5
  • typescript ^5.0.0
  • vite ^4.1.4
packages/demo-dialogic-nextjs-router/package.json
  • next 13.5.6
  • react 18.2.0
  • react-dom 18.2.0
  • @babel/eslint-parser ^7.19.1
  • @next/env ^13.2.3
  • @swc/helpers ^0.5.0
  • @types/react 18.2.48
  • eslint-config-prettier 8.10.0
  • eslint-import-resolver-typescript 3.6.1
  • eslint-plugin-import 2.29.1
  • eslint-plugin-json 3.1.0
  • eslint-plugin-prettier 5.1.3
  • eslint-plugin-react 7.33.2
  • eslint-plugin-simple-import-sort 10.0.0
  • typescript ^5.0.0
packages/demo-dialogic-react-router/package.json
  • react 18.2.0
  • react-dom 18.2.0
  • react-router-dom 6.21.3
  • @types/react ^18.0.28
  • @types/react-dom ^18.0.11
  • typescript ^5.0.0
  • vite ^4.1.4
packages/demo-dialogic-react/package.json
  • react 18.2.0
  • react-dom 18.2.0
  • @types/react ^18.0.28
  • @types/react-dom ^18.0.11
  • shelljs ^0.8.5
  • typescript ^5.0.0
  • vite ^4.1.4
packages/demo-dialogic-svelte-router/package.json
  • svelte-spa-router 3.3.0
  • @sveltejs/vite-plugin-svelte ^2.0.3
  • @tsconfig/svelte ^5.0.0
  • svelte ^4.0.0
  • vite ^4.1.4
packages/demo-dialogic-svelte/package.json
  • @sveltejs/vite-plugin-svelte ^2.0.3
  • @tsconfig/svelte ^5.0.0
  • shelljs ^0.8.5
  • svelte ^4.0.0
  • vite ^4.1.4
packages/demo-dialogic-sveltekit-router/package.json
  • @lukeed/uuid ^2.0.0
  • @sveltejs/adapter-auto ^2.0.0
  • @sveltejs/kit ^1.9.3
  • svelte ^4.0.0
  • svelte-check ^3.0.4
  • typescript ^5.0.0
packages/dialogic-hooks/package.json
  • typescript ^5.0.0
  • vite ^4.1.4
packages/dialogic-mithril/package.json
  • mithril-hooks ^0.7.1
  • @types/mithril 2.0.12
  • typescript ^5.0.0
  • vite ^4.1.4
  • mithril ^2.0.4
packages/dialogic-react/package.json
  • use-stream ^0.4.3
  • @types/debug ^4.1.7
  • @types/react ^18.0.28
  • react ^18.2.0
  • typescript ^5.0.0
  • vite ^4.1.4
  • react *
packages/dialogic-svelte-ts/package.json
  • @rollup/plugin-typescript ^11.0.0
  • @sveltejs/vite-plugin-svelte ^2.0.3
  • @tsconfig/svelte ^5.0.0
  • svelte ^4.0.0
  • svelte-check ^3.0.4
  • typescript ^5.0.0
  • vite ^4.1.4
packages/dialogic-svelte/package.json
  • @sveltejs/vite-plugin-svelte ^2.0.3
  • svelte ^4.0.0
  • vite ^4.1.4
packages/dialogic/package.json
  • mithril-stream-standalone 0.1.6
packages/test-dialogic-mithril/package.json
  • mithril ^2.2.2
  • mithril-hooks ^0.7.1
  • @types/mithril ^2.0.12
  • npm-run-all ^4.1.5
  • start-server-and-test ^2.0.0
packages/test-dialogic-react/package.json
  • react 18.2.0
  • react-dom 18.2.0
  • react-router-dom 6.21.3
  • @types/react ^18.0.28
  • @types/react-dom ^18.0.11
  • npm-run-all ^4.1.5
  • start-server-and-test ^2.0.0
packages/test-dialogic-svelte/package.json
  • mithril-stream-standalone ^0.1.6
  • svelte ^4.0.0
  • svelte-spa-router ^3.3.0
  • @sveltejs/vite-plugin-svelte ^2.0.3
  • @tsconfig/svelte ^5.0.0
  • npm-run-all ^4.1.5
  • start-server-and-test ^2.0.0
  • svelte-preprocess ^5.0.1
  • vite ^4.1.4
packages/test-dialogic/package.json
  • assert ^2.0.0
  • @types/chai ^4.3.4
  • @types/mocha ^10.0.1
  • chai ^4.3.7
  • jsdom 22.1.0
  • jsdom-global 3.0.2
  • mocha ^10.2.0
  • ts-node ^10.9.1

  • Check this box to trigger a request for Renovate to run again on this repository

Unable to load package, missing src folder in dialogic-svelte.

I was trying to give the package a try in Svelte but it appears the npm package is missing the 'src' folder or miss-configured and not trying to use the dist folder.

npm install dialogic-svelte --save-dev

[!] Error: Could not load [...]/node_modules/dialogic-svelte/src/index.js (imported by src/App.svelte): ENOENT: no such file or directory, open '[...]/node_modules/dialogic-svelte/src/index.js'

The error is correct, the src folder isn't there.

'queued' parameter clarification

I am trying to understand the 'queued' parameter, looking at the Svelete version demo, I tried to queue (or not) notifications, here is the code sample:

    <button
		class="ui button primary"
		on:click={() => {
			notification.show({
				dialogic: {
					component: NotificationComponent,
					className: "notification",
					queued: false,
					timeout: 6000
				}
			})
		}}>
		Add notification
    </button>

But in both cases notifications are queued somehow - is this because they occupy the same position? What would be the way to stack them on screen as they come eventually?

dialog isn't accessible via keyboard

I could be wrong; but on the demo page I was unable to use the keyboard to move focus into the dialog or trigger the buttons in the opened dialogs. Keyboard support is a requirement to meet accessibility standards. From what I gather it's also a tricky problem to solve in notification dialogs; which is why I was hoping to find an existing solution ๐Ÿ˜…

sapper example

Is there a working demo with sapper?

Trying to use it with sapper so I modified _layout by adding import and so on, but get an ERR_REQUIRE_ESM error on npm run dev

undoing change to _layout removed error

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.