mirror of
https://github.com/Insality/druid.git
synced 2025-09-27 18:12:19 +02:00
Update examples to widgets instead components
This commit is contained in:
@@ -1,16 +1,8 @@
|
||||
local component = require("druid.component")
|
||||
|
||||
---@class examples.basic_input: druid.component
|
||||
---@field druid druid.instance
|
||||
---@class examples.basic_input: druid.widget
|
||||
---@field input druid.input
|
||||
local M = component.create("basic_input")
|
||||
|
||||
|
||||
---@param template string
|
||||
---@param nodes table<hash, node>
|
||||
function M:init(template, nodes)
|
||||
self.druid = self:get_druid(template, nodes)
|
||||
local M = {}
|
||||
|
||||
function M:init()
|
||||
self.input = self.druid:new_input("input/root", "input/text")
|
||||
|
||||
self.input_2 = self.druid:new_input("input_2/root", "input_2/text") --[[@as druid.input]]
|
||||
|
@@ -1,16 +1,10 @@
|
||||
local component = require("druid.component")
|
||||
|
||||
---@class examples.input_password: druid.component
|
||||
---@field druid druid.instance
|
||||
---@class examples.input_password: druid.widget
|
||||
---@field root node
|
||||
local M = component.create("input_password")
|
||||
---@field input druid.input
|
||||
local M = {}
|
||||
|
||||
|
||||
---@param template string
|
||||
---@param nodes table<hash, node>
|
||||
function M:init(template, nodes)
|
||||
self.druid = self:get_druid(template, nodes)
|
||||
|
||||
function M:init()
|
||||
self.root = self:get_node("root")
|
||||
self.input = self.druid:new_input("input/root", "input/text", gui.KEYBOARD_TYPE_PASSWORD)
|
||||
self.input:set_text("")
|
||||
|
@@ -1,15 +1,10 @@
|
||||
local component = require("druid.component")
|
||||
|
||||
---@class examples.rich_input: druid.component
|
||||
---@field druid druid.instance
|
||||
---@class examples.rich_input: druid.widget
|
||||
---@field rich_input druid.rich_input
|
||||
local M = component.create("rich_input")
|
||||
---@field rich_input_2 druid.rich_input
|
||||
local M = {}
|
||||
|
||||
---@param template string
|
||||
---@param nodes table<hash, node>
|
||||
function M:init(template, nodes)
|
||||
self.druid = self:get_druid(template, nodes)
|
||||
|
||||
function M:init()
|
||||
self.rich_input = self.druid:new_rich_input("rich_input") --[[@as druid.rich_input]]
|
||||
self.rich_input:set_placeholder("Enter text")
|
||||
|
||||
|
Reference in New Issue
Block a user